From 9fdbc127e72a65c2d8343b5624bd7cd3b7039f73 Mon Sep 17 00:00:00 2001 From: Michilis <120072772+Michilis@users.noreply.github.com> Date: Sat, 19 Jul 2025 09:31:12 +0200 Subject: [PATCH] Add files via upload --- Context.md | 92 + README.md | 179 +- architecture.md | 121 + counter.md | 163 ++ dist/assets/index-0ed31904.css | 1 + dist/assets/index-91eab0ce.js | 189 ++ dist/assets/ndk-40656944.js | 81 + dist/assets/vendor-beb84f6c.js | 59 + dist/index.html | 20 + dist/vite.svg | 6 + env.example | 7 + index.html | 16 + package-lock.json | 4158 +++++++++++++++++++++++++++ package.json | 38 + postcss.config.js | 6 + public/vite.svg | 6 + src/App.tsx | 44 + src/components/CounterCard.tsx | 135 + src/components/CounterFormModal.tsx | 226 ++ src/components/EditCounterModal.tsx | 212 ++ src/components/Header.tsx | 119 + src/components/LoadingSpinner.tsx | 21 + src/components/LoginModal.tsx | 419 +++ src/components/NostrShareModal.tsx | 162 ++ src/components/ZapButton.tsx | 140 + src/contexts/NDKContext.tsx | 344 +++ src/hooks/useCounters.ts | 288 ++ src/index.css | 87 + src/main.tsx | 9 + src/pages/BrowseCounters.tsx | 220 ++ src/pages/CounterDetail.tsx | 293 ++ src/pages/Dashboard.tsx | 226 ++ src/pages/Home.tsx | 242 ++ src/pages/Test.tsx | 270 ++ src/types/index.ts | 51 + src/utils/date.ts | 45 + src/utils/nostr.ts | 193 ++ tailwind.config.js | 38 + tsconfig.json | 21 + tsconfig.node.json | 10 + vite.config.ts | 22 + 41 files changed, 8978 insertions(+), 1 deletion(-) create mode 100644 Context.md create mode 100644 architecture.md create mode 100644 counter.md create mode 100644 dist/assets/index-0ed31904.css create mode 100644 dist/assets/index-91eab0ce.js create mode 100644 dist/assets/ndk-40656944.js create mode 100644 dist/assets/vendor-beb84f6c.js create mode 100644 dist/index.html create mode 100644 dist/vite.svg create mode 100644 env.example create mode 100644 index.html create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 postcss.config.js create mode 100644 public/vite.svg create mode 100644 src/App.tsx create mode 100644 src/components/CounterCard.tsx create mode 100644 src/components/CounterFormModal.tsx create mode 100644 src/components/EditCounterModal.tsx create mode 100644 src/components/Header.tsx create mode 100644 src/components/LoadingSpinner.tsx create mode 100644 src/components/LoginModal.tsx create mode 100644 src/components/NostrShareModal.tsx create mode 100644 src/components/ZapButton.tsx create mode 100644 src/contexts/NDKContext.tsx create mode 100644 src/hooks/useCounters.ts create mode 100644 src/index.css create mode 100644 src/main.tsx create mode 100644 src/pages/BrowseCounters.tsx create mode 100644 src/pages/CounterDetail.tsx create mode 100644 src/pages/Dashboard.tsx create mode 100644 src/pages/Home.tsx create mode 100644 src/pages/Test.tsx create mode 100644 src/types/index.ts create mode 100644 src/utils/date.ts create mode 100644 src/utils/nostr.ts create mode 100644 tailwind.config.js create mode 100644 tsconfig.json create mode 100644 tsconfig.node.json create mode 100644 vite.config.ts diff --git a/Context.md b/Context.md new file mode 100644 index 0000000..ef91163 --- /dev/null +++ b/Context.md @@ -0,0 +1,92 @@ +# context.md + +## Purpose + +The goal of this app is to provide a minimalist but powerful tool for people to track life milestones using the Nostr protocol. It's completely censorship-resistant and optionally anonymous. + +Examples: + +* Days **since** quitting alcohol +* Days **since** last porn use +* Days **since** last cigarette +* Days **until** a planned event like a trip, wedding, or conference + +The app encourages positive habit tracking and event anticipation. Counters are personal but shareable, with optional zapping support. + +--- + +## User Roles + +### Anonymous Visitor + +* Can view public counters +* Cannot create or save counters + +### Nostr Logged-In User + +* Can create counters (published to Nostr relays) +* Can edit/delete own counters (via NIP-01 signature) +* Can receive zaps + +--- + +## User Flows + +### 1. Login + +* User connects a Nostr signer (e.g. extension or mobile app) +* App stores the pubkey in state (no server-side session needed) + +### 2. Create a Counter + +* Click `+ Days Since` or `+ Days Until` +* Fill form: title, type, date, visibility +* App constructs a `kind: 30078` event +* Signs and publishes it to relays + +### 3. View Dashboard + +* Shows counters created by the user +* Sorted by creation or date proximity + +### 4. Public Viewing + +* Counters from all users marked `public` +* Optional featured section +* Zap button visible if NIP-05 or lightning address is detected + +### 5. Share a Counter + +* Permalink to `/counter/:slug` +* Users can repost or share + +--- + +## Event Fetch Logic + +* Use NDK to fetch kind 30078 +* Filter by: + + * Author pubkey (for personal dashboard) + * Tag `visibility=public` for public view +* Parse date and type for rendering + +--- + +## Edge Cases & Decisions + +* Two counters with same `d` tag? Latest one overrides for that user +* Private counters are not displayed publicly, even if published to relays +* If date is in the future and type is `since`, display warning +* Zap metadata must be fetched separately using NIP-05 or kind:0 event + +--- + +## Philosophy + +This is a lightweight, open, and empowering way to track progress. It's built on top of Nostr to ensure: + +* Decentralized data storage +* No vendor lock-in +* Optional pseudonymity +* Easy integration with the Lightning Network (via zaps) diff --git a/README.md b/README.md index 0584094..1354360 100644 --- a/README.md +++ b/README.md @@ -1 +1,178 @@ -# NostrCount \ No newline at end of file +# NostrCount + +A decentralized life milestone tracker built on the Nostr protocol. Track your progress, celebrate achievements, and share your journey with the world. + +## Features + +- **Censorship Resistant**: Built on Nostr for decentralized data storage +- **Lightning Zaps**: Support creators with Bitcoin Lightning Network payments +- **Private or Public**: Choose to keep counters private or share them publicly +- **Two Counter Types**: Track "days since" achievements or "days until" events +- **Real-time Updates**: Automatic syncing across devices through Nostr relays +- **Modern UI**: Beautiful, responsive design with Tailwind CSS + +## Getting Started + +### Prerequisites + +- Node.js (v18 or higher) +- npm or yarn +- A Nostr extension (like Alby, nos2x, or Flamingo) for signing events + +### Installation + +1. Clone the repository: +```bash +git clone https://github.com/yourusername/nostrcount.git +cd nostrcount +``` + +2. Install dependencies: +```bash +npm install +``` + +3. Create environment file: +```bash +cp .env.example .env +``` + +4. Start the development server: +```bash +npm run dev +``` + +5. Open your browser to `http://localhost:3000` + +## Usage + +### Creating a Counter + +1. Connect your Nostr extension by clicking "Login" +2. Go to your Dashboard +3. Click "Create Counter" +4. Fill in the details: + - **Title**: What you're tracking (e.g., "Quit Smoking") + - **Date**: The reference date + - **Type**: "Days Since" or "Days Until" + - **Visibility**: Public or Private + +### Sharing Counters + +Public counters can be shared with a direct link. Each counter has a unique URL that others can view and even zap (tip) if they have Lightning Network setup. + +### Zapping + +Support others on their journey by sending Lightning Network tips. Click the "Zap" button on any public counter to send sats! + +## Architecture + +### Tech Stack + +- **Frontend**: React 18 + TypeScript + Vite +- **Styling**: Tailwind CSS +- **Nostr Integration**: NDK (Nostr Development Kit) +- **Date Handling**: Day.js +- **Routing**: React Router +- **Icons**: Lucide React + +### Nostr Implementation + +- **Event Kind**: 30078 (Parameterized Replaceable Events) +- **Event Tags**: + - `d`: Unique identifier/slug + - `type`: "since" or "until" + - `title`: Human-readable counter name + - `date`: ISO date string + - `visibility`: "public" or "private" + +### Data Storage + +All counter data is stored on Nostr relays as events. No centralized database is required, making the app fully decentralized and censorship-resistant. + +## Development + +### Project Structure + +``` +src/ +├── components/ # React components +│ ├── CounterCard.tsx # Individual counter display +│ ├── CounterFormModal.tsx # Counter creation/editing +│ ├── Header.tsx # Navigation header +│ ├── LoadingSpinner.tsx # Loading component +│ └── ZapButton.tsx # Lightning zap functionality +├── contexts/ # React contexts +│ └── NDKContext.tsx # Nostr connection management +├── hooks/ # Custom React hooks +│ └── useCounters.ts # Counter data management +├── pages/ # Page components +│ ├── CounterDetail.tsx # Individual counter view +│ ├── Dashboard.tsx # User dashboard +│ └── Home.tsx # Landing page +├── types/ # TypeScript types +│ └── index.ts # Type definitions +├── utils/ # Utility functions +│ ├── date.ts # Date calculation helpers +│ └── nostr.ts # Nostr event helpers +└── App.tsx # Main app component +``` + +### Available Scripts + +- `npm run dev`: Start development server +- `npm run build`: Build for production +- `npm run preview`: Preview production build +- `npm run lint`: Run ESLint + +### Adding New Features + +1. **New Counter Types**: Modify the `Counter` type in `src/types/index.ts` +2. **New Relays**: Update `DEFAULT_RELAYS` in `src/utils/nostr.ts` +3. **Styling**: Use Tailwind CSS classes or extend the theme in `tailwind.config.js` + +## Deployment + +### Build for Production + +```bash +npm run build +``` + +The built files will be in the `dist` directory, ready for deployment to any static hosting service. + +### Recommended Hosting + +- **Vercel**: Zero-config deployments with automatic HTTPS +- **Netlify**: Simple drag-and-drop deployments +- **GitHub Pages**: Free hosting for open source projects +- **IPFS**: Decentralized hosting matching the decentralized nature of Nostr + +## Contributing + +1. Fork the repository +2. Create a feature branch: `git checkout -b feature/amazing-feature` +3. Commit your changes: `git commit -m 'Add amazing feature'` +4. Push to the branch: `git push origin feature/amazing-feature` +5. Open a Pull Request + +## License + +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. + +## Support + +- **Issues**: Report bugs or request features on GitHub +- **Discussions**: Join the community discussion +- **Zaps**: Support the project with Lightning Network tips + +## Acknowledgments + +- [Nostr Protocol](https://nostr.com) for the decentralized foundation +- [NDK](https://github.com/nostr-dev-kit/ndk) for the excellent Nostr development kit +- [Tailwind CSS](https://tailwindcss.com) for the amazing styling framework +- All the Nostr relay operators keeping the network running + +--- + +**Built with ⚡ by the Nostr community** \ No newline at end of file diff --git a/architecture.md b/architecture.md new file mode 100644 index 0000000..599dbd3 --- /dev/null +++ b/architecture.md @@ -0,0 +1,121 @@ +# Architecture.md + +## Overview + +"Nostr Count" is a fully client-side web app that allows users to track and share life counters using the Nostr protocol. Events are stored as `kind: 30078` and fetched using Nostr relays. It includes two counter types: + +* Days **since** a past date (e.g., quit smoking) +* Days **until** a future event (e.g., vacation) + +The app does **not require a backend**, but can optionally use one for caching, trending counters, and zap analytics. + +--- + +## Tech Stack + +### Frontend + +* **React 18 + TypeScript** – UI and component structure +* **Tailwind CSS** – Styling +* **NDK (Nostr Dev Kit)** – Nostr integration +* **Day.js** – Date calculation and formatting +* **Vite** – Build tool (or Next.js if SSR required) + +### Nostr Relays + +* Default relays (configurable via `.env` or app settings): + + * `wss://relay.azzamo.net` + * `wss://relay.damus.io` + * `wss://nostr.oxtr.dev` +* Events published and read via NDK + +### Optional Backend (Future Option) + +* Node.js/Express or FastAPI +* Purpose: + + * Cache counters per pubkey + * Track zap totals per counter + * Optional user API for bookmarks/favorites + +--- + +## Event Structure (kind: 30078) + +```json +{ + "kind": 30078, + "content": "", // Not used for now + "tags": [ + ["d", "quit-smoking"], + ["type", "since"], + ["title", "Quit smoking"], + ["date", "2023-09-01"], + ["visibility", "public"] + ], + "created_at": 1690000000, + "pubkey": "" +} +``` + +### Required Tags + +* `d`: unique ID or slug (e.g. kebab-case of title) +* `type`: `since` or `until` +* `title`: human-readable name of the counter +* `date`: ISO date string (YYYY-MM-DD) +* `visibility`: `public` or `private` + +--- + +## App Pages / Routes + +### `/` + +* Landing page +* Featured public counters +* CTA: "Create a Counter" + +### `/dashboard` + +* Login required +* List of user’s counters (from pubkey) +* Create new counter button + +### `/counter/:slug` + +* View a public counter +* Show days since/until, zap button, author + +--- + +## Components + +### `CounterCard` + +* Displays a single counter (days diff + title) +* Button to share or open + +### `CounterFormModal` + +* Modal for creating/editing a counter +* Inputs: title, date, type, visibility + +### `ZapButton` + +* Renders LN zap request if author has Lightning address in NIP-05/metadata + +### `NDKProvider` + +* Provides global access to NDK instance +* Handles login, signer, and event fetch/publish + +--- + +## Future Features (Not MVP) + +* Comments (reply to counter event) +* Counter streaks +* Private reminders +* iCal export or notification system diff --git a/counter.md b/counter.md new file mode 100644 index 0000000..730484e --- /dev/null +++ b/counter.md @@ -0,0 +1,163 @@ + +## Purpose + +This guide explains how to create and publish "Days Since / Until" counter events on Nostr using NDK (Nostr Development Kit). + +Counters are stored as `kind: 30078` events with metadata tags for rendering. + +--- + +## Prerequisites + +* NDK installed +* Signer available (via NIP-07, NIP-46, or npub/nsec input) +* Relay pool configured and connected + +--- + +## Example Setup + +```ts +import NDK, { NDKEvent, NDKPrivateKeySigner } from "@nostr-dev-kit/ndk"; + +const ndk = new NDK({ + explicitRelayUrls: [ + "wss://relay.azzamo.net", + "wss://relay.damus.io" + ] +}); +await ndk.connect(); + +// Login with nsec +const signer = new NDKPrivateKeySigner("nsec1..."); +ndk.signer = signer; +await ndk.signer.user(); +``` + +You can also support login via npub (read-only) or NIP-07 browser extension. + +--- + +## Create Counter Function + +```ts +async function publishCounter({ + title, + date, + type = "since", // or "until" + visibility = "public", // or "private" +}: { + title: string; + date: string; // format YYYY-MM-DD + type?: "since" | "until"; + visibility?: "public" | "private"; +}) { + const event = new NDKEvent(ndk); + event.kind = 30078; + event.tags = [ + ["type", type], + ["title", title], + ["date", date], + ["visibility", visibility], + ]; + event.content = ""; + + await event.sign(); + await event.publish(); + return event; +} +``` + +--- + +## Public Counter Example + +```ts +const ev = await publishCounter({ + title: "Quit smoking", + date: "2024-12-01", + type: "since", + visibility: "public", +}); +console.log("View at /counter/" + ev.id); +``` + +### Published JSON Output: + +```json +{ + "kind": 30078, + "content": "", + "tags": [ + ["type", "since"], + ["title", "Quit smoking"], + ["date", "2024-12-01"], + ["visibility", "public"] + ], + "created_at": 1725000000, + "id": "note1...", + "pubkey": "npub1..." +} +``` + +### Slug / Permalink + +Use the full event ID as the URL slug: + +``` +/counter/note1xyz... ← based on event.id (NIP-19 encoded) +``` + +--- + +## Private Counter Example + +```ts +await publishCounter({ + title: "Last relapse", + date: "2025-07-01", + type: "since", + visibility: "private", +}); +``` + +> Note: Private counters are still published to relays but can be filtered out in the app logic. + +--- + +## Reading Events + +To fetch all public counters: + +```ts +const events = await ndk.fetchEvents({ + kinds: [30078] +}); + +const publicEvents = Array.from(events).filter(e => + e.tags.find(([k, v]) => k === "visibility" && v === "public") +); +``` + +To fetch your own counters: + +```ts +const user = await ndk.signer?.user(); +const events = await ndk.fetchEvents({ + kinds: [30078], + authors: [user?.pubkey || ""] +}); +``` + +--- + +## Notes + +* The URL slug for counters is the **event ID** (NIP-19 encoded if needed) +* Event `id` is used to lookup and display the counter +* Lightning zaps should be handled via metadata (fetch kind:0 or NIP-05 info) +* Updating a counter means publishing a new event with new content + +--- + +Let me know if you want to include zaps, NIP-75 fundraising goals, or update/delete flows. diff --git a/dist/assets/index-0ed31904.css b/dist/assets/index-0ed31904.css new file mode 100644 index 0000000..8c79fcb --- /dev/null +++ b/dist/assets/index-0ed31904.css @@ -0,0 +1 @@ +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter,system-ui,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.left-3{left:.75rem}.right-2{right:.5rem}.right-3{right:.75rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.z-50{z-index:50}.mx-auto{margin-left:auto;margin-right:auto}.mb-12{margin-bottom:3rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.h-12{height:3rem}.h-16{height:4rem}.h-32{height:8rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-8{height:2rem}.max-h-\[80vh\]{max-height:80vh}.max-h-\[90vh\]{max-height:90vh}.min-h-screen{min-height:100vh}.w-12{width:3rem}.w-16{width:4rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-full{width:100%}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-7xl{max-width:80rem}.max-w-md{max-width:28rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.resize-none{resize:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.whitespace-pre-wrap{white-space:pre-wrap}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-blue-600{--tw-border-opacity: 1;border-color:rgb(37 99 235 / var(--tw-border-opacity, 1))}.border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-yellow-500{--tw-border-opacity: 1;border-color:rgb(234 179 8 / var(--tw-border-opacity, 1))}.border-t-blue-600{--tw-border-opacity: 1;border-top-color:rgb(37 99 235 / var(--tw-border-opacity, 1))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-opacity-50{--tw-bg-opacity: .5}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.from-blue-600{--tw-gradient-from: #2563eb var(--tw-gradient-from-position);--tw-gradient-to: rgb(37 99 235 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-purple-700{--tw-gradient-to: #7e22ce var(--tw-gradient-to-position)}.p-1{padding:.25rem}.p-12{padding:3rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pl-10{padding-left:2.5rem}.pr-4{padding-right:1rem}.pt-4{padding-top:1rem}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.leading-tight{line-height:1.25}.text-blue-100{--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}body{margin:0;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}code{font-family:Fira Code,Courier New,monospace}::-webkit-scrollbar{width:8px}::-webkit-scrollbar-track{background:#f1f1f1}::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:4px}::-webkit-scrollbar-thumb:hover{background:#a8a8a8}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}@keyframes fadeIn{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.fade-in{animation:fadeIn .5s ease-out}@media (max-width: 640px){.responsive-text{font-size:.875rem}}.btn-primary{border-radius:.5rem;--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1));padding:.5rem 1rem;font-weight:500;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.btn-primary:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.btn-secondary{border-radius:.5rem;--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));padding:.5rem 1rem;font-weight:500;--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1));transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.btn-secondary:hover{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.card-hover{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s}.card-hover:hover{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus-ring:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1));--tw-ring-offset-width: 2px}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:bg-blue-50:hover{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-600:hover{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.hover\:bg-yellow-600:hover{--tw-bg-opacity: 1;background-color:rgb(202 138 4 / var(--tw-bg-opacity, 1))}.hover\:text-blue-600:hover{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.hover\:text-gray-600:hover{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.hover\:text-gray-900:hover{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.hover\:text-green-600:hover{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.hover\:text-red-600:hover{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:border-transparent:focus{border-color:transparent}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.focus\:ring-yellow-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(234 179 8 / var(--tw-ring-opacity, 1))}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}@media (min-width: 640px){.sm\:flex-row{flex-direction:row}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}}@media (min-width: 768px){.md\:mt-0{margin-top:0}.md\:flex{display:flex}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:items-center{align-items:center}.md\:justify-between{justify-content:space-between}.md\:text-left{text-align:left}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-4xl{font-size:2.25rem;line-height:2.5rem}.md\:text-6xl{font-size:3.75rem;line-height:1}}@media (min-width: 1024px){.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:px-8{padding-left:2rem;padding-right:2rem}}@media (min-width: 1280px){.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}} diff --git a/dist/assets/index-91eab0ce.js b/dist/assets/index-91eab0ce.js new file mode 100644 index 0000000..a8ae71c --- /dev/null +++ b/dist/assets/index-91eab0ce.js @@ -0,0 +1,189 @@ +var $i=Object.defineProperty;var Oi=(i,l,u)=>l in i?$i(i,l,{enumerable:!0,configurable:!0,writable:!0,value:u}):i[l]=u;var xe=(i,l,u)=>(Oi(i,typeof l!="symbol"?l+"":l,u),u);import{r as R,a as Ti,u as Ai,L as Re,R as Ir,b as Mi,B as Ki,c as Ii,d as en}from"./vendor-beb84f6c.js";import{c as qn,g as Bn,a as Es,p as Ri,d as Fi,m as qi,N as Pt,b as bs,e as Bi,n as nn,f as Dr,h as Li,i as zi}from"./ndk-40656944.js";(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))c(f);new MutationObserver(f=>{for(const d of f)if(d.type==="childList")for(const y of d.addedNodes)y.tagName==="LINK"&&y.rel==="modulepreload"&&c(y)}).observe(document,{childList:!0,subtree:!0});function u(f){const d={};return f.integrity&&(d.integrity=f.integrity),f.referrerPolicy&&(d.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?d.credentials="include":f.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function c(f){if(f.ep)return;f.ep=!0;const d=u(f);fetch(f.href,d)}})();var Ds={exports:{}},Ln={};/** + * @license React + * react-jsx-runtime.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Ui=R,Yi=Symbol.for("react.element"),Wi=Symbol.for("react.fragment"),Vi=Object.prototype.hasOwnProperty,Hi=Ui.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Zi={key:!0,ref:!0,__self:!0,__source:!0};function Ps(i,l,u){var c,f={},d=null,y=null;u!==void 0&&(d=""+u),l.key!==void 0&&(d=""+l.key),l.ref!==void 0&&(y=l.ref);for(c in l)Vi.call(l,c)&&!Zi.hasOwnProperty(c)&&(f[c]=l[c]);if(i&&i.defaultProps)for(c in l=i.defaultProps,l)f[c]===void 0&&(f[c]=l[c]);return{$$typeof:Yi,type:i,key:d,ref:y,props:f,_owner:Hi.current}}Ln.Fragment=Wi;Ln.jsx=Ps;Ln.jsxs=Ps;Ds.exports=Ln;var s=Ds.exports,Pr={},vs=Ti;Pr.createRoot=vs.createRoot,Pr.hydrateRoot=vs.hydrateRoot;let Ji={data:""},Qi=i=>typeof window=="object"?((i?i.querySelector("#_goober"):window._goober)||Object.assign((i||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:i||Ji,Gi=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Xi=/\/\*[^]*?\*\/| +/g,xs=/\n+/g,ft=(i,l)=>{let u="",c="",f="";for(let d in i){let y=i[d];d[0]=="@"?d[1]=="i"?u=d+" "+y+";":c+=d[1]=="f"?ft(y,d):d+"{"+ft(y,d[1]=="k"?"":l)+"}":typeof y=="object"?c+=ft(y,l?l.replace(/([^,])+/g,p=>d.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,C=>/&/.test(C)?C.replace(/&/g,p):p?p+" "+C:C)):d):y!=null&&(d=/^--/.test(d)?d:d.replace(/[A-Z]/g,"-$&").toLowerCase(),f+=ft.p?ft.p(d,y):d+":"+y+";")}return u+(l&&f?l+"{"+f+"}":f)+c},st={},$s=i=>{if(typeof i=="object"){let l="";for(let u in i)l+=u+$s(i[u]);return l}return i},eo=(i,l,u,c,f)=>{let d=$s(i),y=st[d]||(st[d]=(C=>{let S=0,$=11;for(;S>>0;return"go"+$})(d));if(!st[y]){let C=d!==i?i:(S=>{let $,A,Y=[{}];for(;$=Gi.exec(S.replace(Xi,""));)$[4]?Y.shift():$[3]?(A=$[3].replace(xs," ").trim(),Y.unshift(Y[0][A]=Y[0][A]||{})):Y[0][$[1]]=$[2].replace(xs," ").trim();return Y[0]})(i);st[y]=ft(f?{["@keyframes "+y]:C}:C,u?"":"."+y)}let p=u&&st.g?st.g:null;return u&&(st.g=st[y]),((C,S,$,A)=>{A?S.data=S.data.replace(A,C):S.data.indexOf(C)===-1&&(S.data=$?C+S.data:S.data+C)})(st[y],l,c,p),y},to=(i,l,u)=>i.reduce((c,f,d)=>{let y=l[d];if(y&&y.call){let p=y(u),C=p&&p.props&&p.props.className||/^go/.test(p)&&p;y=C?"."+C:p&&typeof p=="object"?p.props?"":ft(p,""):p===!1?"":p}return c+f+(y??"")},"");function zn(i){let l=this||{},u=i.call?i(l.p):i;return eo(u.unshift?u.raw?to(u,[].slice.call(arguments,1),l.p):u.reduce((c,f)=>Object.assign(c,f&&f.call?f(l.p):f),{}):u,Qi(l.target),l.g,l.o,l.k)}let Os,$r,Or;zn.bind({g:1});let it=zn.bind({k:1});function no(i,l,u,c){ft.p=l,Os=i,$r=u,Or=c}function pt(i,l){let u=this||{};return function(){let c=arguments;function f(d,y){let p=Object.assign({},d),C=p.className||f.className;u.p=Object.assign({theme:$r&&$r()},p),u.o=/ *go\d+/.test(C),p.className=zn.apply(u,c)+(C?" "+C:""),l&&(p.ref=y);let S=i;return i[0]&&(S=p.as||i,delete p.as),Or&&S[0]&&Or(p),Os(S,p)}return l?l(f):f}}var ro=i=>typeof i=="function",Rn=(i,l)=>ro(i)?i(l):i,so=(()=>{let i=0;return()=>(++i).toString()})(),Ts=(()=>{let i;return()=>{if(i===void 0&&typeof window<"u"){let l=matchMedia("(prefers-reduced-motion: reduce)");i=!l||l.matches}return i}})(),io=20,As=(i,l)=>{switch(l.type){case 0:return{...i,toasts:[l.toast,...i.toasts].slice(0,io)};case 1:return{...i,toasts:i.toasts.map(d=>d.id===l.toast.id?{...d,...l.toast}:d)};case 2:let{toast:u}=l;return As(i,{type:i.toasts.find(d=>d.id===u.id)?1:0,toast:u});case 3:let{toastId:c}=l;return{...i,toasts:i.toasts.map(d=>d.id===c||c===void 0?{...d,dismissed:!0,visible:!1}:d)};case 4:return l.toastId===void 0?{...i,toasts:[]}:{...i,toasts:i.toasts.filter(d=>d.id!==l.toastId)};case 5:return{...i,pausedAt:l.time};case 6:let f=l.time-(i.pausedAt||0);return{...i,pausedAt:void 0,toasts:i.toasts.map(d=>({...d,pauseDuration:d.pauseDuration+f}))}}},In=[],Dt={toasts:[],pausedAt:void 0},Ot=i=>{Dt=As(Dt,i),In.forEach(l=>{l(Dt)})},oo={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},ao=(i={})=>{let[l,u]=R.useState(Dt),c=R.useRef(Dt);R.useEffect(()=>(c.current!==Dt&&u(Dt),In.push(u),()=>{let d=In.indexOf(u);d>-1&&In.splice(d,1)}),[]);let f=l.toasts.map(d=>{var y,p,C;return{...i,...i[d.type],...d,removeDelay:d.removeDelay||((y=i[d.type])==null?void 0:y.removeDelay)||(i==null?void 0:i.removeDelay),duration:d.duration||((p=i[d.type])==null?void 0:p.duration)||(i==null?void 0:i.duration)||oo[d.type],style:{...i.style,...(C=i[d.type])==null?void 0:C.style,...d.style}}});return{...l,toasts:f}},lo=(i,l="blank",u)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:l,ariaProps:{role:"status","aria-live":"polite"},message:i,pauseDuration:0,...u,id:(u==null?void 0:u.id)||so()}),ln=i=>(l,u)=>{let c=lo(l,i,u);return Ot({type:2,toast:c}),c.id},Ue=(i,l)=>ln("blank")(i,l);Ue.error=ln("error");Ue.success=ln("success");Ue.loading=ln("loading");Ue.custom=ln("custom");Ue.dismiss=i=>{Ot({type:3,toastId:i})};Ue.remove=i=>Ot({type:4,toastId:i});Ue.promise=(i,l,u)=>{let c=Ue.loading(l.loading,{...u,...u==null?void 0:u.loading});return typeof i=="function"&&(i=i()),i.then(f=>{let d=l.success?Rn(l.success,f):void 0;return d?Ue.success(d,{id:c,...u,...u==null?void 0:u.success}):Ue.dismiss(c),f}).catch(f=>{let d=l.error?Rn(l.error,f):void 0;d?Ue.error(d,{id:c,...u,...u==null?void 0:u.error}):Ue.dismiss(c)}),i};var co=(i,l)=>{Ot({type:1,toast:{id:i,height:l}})},uo=()=>{Ot({type:5,time:Date.now()})},rn=new Map,ho=1e3,fo=(i,l=ho)=>{if(rn.has(i))return;let u=setTimeout(()=>{rn.delete(i),Ot({type:4,toastId:i})},l);rn.set(i,u)},mo=i=>{let{toasts:l,pausedAt:u}=ao(i);R.useEffect(()=>{if(u)return;let d=Date.now(),y=l.map(p=>{if(p.duration===1/0)return;let C=(p.duration||0)+p.pauseDuration-(d-p.createdAt);if(C<0){p.visible&&Ue.dismiss(p.id);return}return setTimeout(()=>Ue.dismiss(p.id),C)});return()=>{y.forEach(p=>p&&clearTimeout(p))}},[l,u]);let c=R.useCallback(()=>{u&&Ot({type:6,time:Date.now()})},[u]),f=R.useCallback((d,y)=>{let{reverseOrder:p=!1,gutter:C=8,defaultPosition:S}=y||{},$=l.filter(M=>(M.position||S)===(d.position||S)&&M.height),A=$.findIndex(M=>M.id===d.id),Y=$.filter((M,T)=>TM.visible).slice(...p?[Y+1]:[0,Y]).reduce((M,T)=>M+(T.height||0)+C,0)},[l]);return R.useEffect(()=>{l.forEach(d=>{if(d.dismissed)fo(d.id,d.removeDelay);else{let y=rn.get(d.id);y&&(clearTimeout(y),rn.delete(d.id))}})},[l]),{toasts:l,handlers:{updateHeight:co,startPause:uo,endPause:c,calculateOffset:f}}},po=it` +from { + transform: scale(0) rotate(45deg); + opacity: 0; +} +to { + transform: scale(1) rotate(45deg); + opacity: 1; +}`,yo=it` +from { + transform: scale(0); + opacity: 0; +} +to { + transform: scale(1); + opacity: 1; +}`,go=it` +from { + transform: scale(0) rotate(90deg); + opacity: 0; +} +to { + transform: scale(1) rotate(90deg); + opacity: 1; +}`,bo=pt("div")` + width: 20px; + opacity: 0; + height: 20px; + border-radius: 10px; + background: ${i=>i.primary||"#ff4b4b"}; + position: relative; + transform: rotate(45deg); + + animation: ${po} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) + forwards; + animation-delay: 100ms; + + &:after, + &:before { + content: ''; + animation: ${yo} 0.15s ease-out forwards; + animation-delay: 150ms; + position: absolute; + border-radius: 3px; + opacity: 0; + background: ${i=>i.secondary||"#fff"}; + bottom: 9px; + left: 4px; + height: 2px; + width: 12px; + } + + &:before { + animation: ${go} 0.15s ease-out forwards; + animation-delay: 180ms; + transform: rotate(90deg); + } +`,vo=it` + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +`,xo=pt("div")` + width: 12px; + height: 12px; + box-sizing: border-box; + border: 2px solid; + border-radius: 100%; + border-color: ${i=>i.secondary||"#e0e0e0"}; + border-right-color: ${i=>i.primary||"#616161"}; + animation: ${vo} 1s linear infinite; +`,wo=it` +from { + transform: scale(0) rotate(45deg); + opacity: 0; +} +to { + transform: scale(1) rotate(45deg); + opacity: 1; +}`,jo=it` +0% { + height: 0; + width: 0; + opacity: 0; +} +40% { + height: 0; + width: 6px; + opacity: 1; +} +100% { + opacity: 1; + height: 10px; +}`,No=pt("div")` + width: 20px; + opacity: 0; + height: 20px; + border-radius: 10px; + background: ${i=>i.primary||"#61d345"}; + position: relative; + transform: rotate(45deg); + + animation: ${wo} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) + forwards; + animation-delay: 100ms; + &:after { + content: ''; + box-sizing: border-box; + animation: ${jo} 0.2s ease-out forwards; + opacity: 0; + animation-delay: 200ms; + position: absolute; + border-right: 2px solid; + border-bottom: 2px solid; + border-color: ${i=>i.secondary||"#fff"}; + bottom: 6px; + left: 6px; + height: 10px; + width: 6px; + } +`,ko=pt("div")` + position: absolute; +`,_o=pt("div")` + position: relative; + display: flex; + justify-content: center; + align-items: center; + min-width: 20px; + min-height: 20px; +`,Co=it` +from { + transform: scale(0.6); + opacity: 0.4; +} +to { + transform: scale(1); + opacity: 1; +}`,So=pt("div")` + position: relative; + transform: scale(0.6); + opacity: 0.4; + min-width: 20px; + animation: ${Co} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275) + forwards; +`,Eo=({toast:i})=>{let{icon:l,type:u,iconTheme:c}=i;return l!==void 0?typeof l=="string"?R.createElement(So,null,l):l:u==="blank"?null:R.createElement(_o,null,R.createElement(xo,{...c}),u!=="loading"&&R.createElement(ko,null,u==="error"?R.createElement(bo,{...c}):R.createElement(No,{...c})))},Do=i=>` +0% {transform: translate3d(0,${i*-200}%,0) scale(.6); opacity:.5;} +100% {transform: translate3d(0,0,0) scale(1); opacity:1;} +`,Po=i=>` +0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;} +100% {transform: translate3d(0,${i*-150}%,-1px) scale(.6); opacity:0;} +`,$o="0%{opacity:0;} 100%{opacity:1;}",Oo="0%{opacity:1;} 100%{opacity:0;}",To=pt("div")` + display: flex; + align-items: center; + background: #fff; + color: #363636; + line-height: 1.3; + will-change: transform; + box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05); + max-width: 350px; + pointer-events: auto; + padding: 8px 10px; + border-radius: 8px; +`,Ao=pt("div")` + display: flex; + justify-content: center; + margin: 4px 10px; + color: inherit; + flex: 1 1 auto; + white-space: pre-line; +`,Mo=(i,l)=>{let u=i.includes("top")?1:-1,[c,f]=Ts()?[$o,Oo]:[Do(u),Po(u)];return{animation:l?`${it(c)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${it(f)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},Ko=R.memo(({toast:i,position:l,style:u,children:c})=>{let f=i.height?Mo(i.position||l||"top-center",i.visible):{opacity:0},d=R.createElement(Eo,{toast:i}),y=R.createElement(Ao,{...i.ariaProps},Rn(i.message,i));return R.createElement(To,{className:i.className,style:{...f,...u,...i.style}},typeof c=="function"?c({icon:d,message:y}):R.createElement(R.Fragment,null,d,y))});no(R.createElement);var Io=({id:i,className:l,style:u,onHeightUpdate:c,children:f})=>{let d=R.useCallback(y=>{if(y){let p=()=>{let C=y.getBoundingClientRect().height;c(i,C)};p(),new MutationObserver(p).observe(y,{subtree:!0,childList:!0,characterData:!0})}},[i,c]);return R.createElement("div",{ref:d,className:l,style:u},f)},Ro=(i,l)=>{let u=i.includes("top"),c=u?{top:0}:{bottom:0},f=i.includes("center")?{justifyContent:"center"}:i.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:Ts()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${l*(u?1:-1)}px)`,...c,...f}},Fo=zn` + z-index: 9999; + > * { + pointer-events: auto; + } +`,Kn=16,qo=({reverseOrder:i,position:l="top-center",toastOptions:u,gutter:c,children:f,containerStyle:d,containerClassName:y})=>{let{toasts:p,handlers:C}=mo(u);return R.createElement("div",{id:"_rht_toaster",style:{position:"fixed",zIndex:9999,top:Kn,left:Kn,right:Kn,bottom:Kn,pointerEvents:"none",...d},className:y,onMouseEnter:C.startPause,onMouseLeave:C.endPause},p.map(S=>{let $=S.position||l,A=C.calculateOffset(S,{reverseOrder:i,gutter:c,defaultPosition:l}),Y=Ro($,A);return R.createElement(Io,{id:S.id,key:S.id,onHeightUpdate:C.updateHeight,className:S.visible?Fo:"",style:Y},S.type==="custom"?Rn(S.message,S):f?f(S):R.createElement(Ko,{toast:S,position:$}))}))},Le=Ue,Ms={exports:{}};(function(i,l){(function(u,c){i.exports=c()})(qn,function(){var u=function(e,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])})(e,t)},c=function(){return(c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n"u"||d.Promise||(d.Promise=Promise);var S=Object.getPrototypeOf,$={}.hasOwnProperty;function A(e,t){return $.call(e,t)}function Y(e,t){typeof t=="function"&&(t=t(S(e))),(typeof Reflect>"u"?y:Reflect.ownKeys)(t).forEach(function(n){T(e,n,t[n])})}var M=Object.defineProperty;function T(e,t,n,r){M(e,t,C(n&&A(n,"get")&&typeof n.get=="function"?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function ne(e){return{from:function(t){return e.prototype=Object.create(t.prototype),T(e.prototype,"constructor",e),{extend:Y.bind(null,e.prototype)}}}}var pe=Object.getOwnPropertyDescriptor,ue=[].slice;function ie(e,t,n){return ue.call(e,t,n)}function G(e,t){return t(e)}function de(e){if(!e)throw new Error("Assertion Failed")}function me(e){d.setImmediate?setImmediate(e):setTimeout(e,0)}function Q(e,t){if(typeof t=="string"&&A(e,t))return e[t];if(!t)return e;if(typeof t!="string"){for(var n=[],r=0,o=t.length;r"u"?[]:function(){var e=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[e,S(e),e];var t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,S(t),e]}(),Lt=bt[0],Je=bt[1],bt=bt[2],Je=Je&&Je.then,vt=Lt&&Lt.constructor,Hn=!!bt,zt=function(e,t){Ut.push([e,t]),un&&(queueMicrotask(ai),un=!1)},Zn=!0,un=!0,xt=[],dn=[],Jn=Ge,ot={id:"globalThis",globalThis:!0,ref:0,unhandleds:[],onunhandled:ve,pgp:!1,env:{},finalize:ve},ae=ot,Ut=[],wt=0,hn=[];function J(e){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var t=this._PSD=ae;if(typeof e!="function"){if(e!==Bt)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&Gn(this,this._value))}this._state=null,this._value=null,++t.ref,function n(r,o){try{o(function(a){if(r._state===null){if(a===r)throw new TypeError("A promise cannot be resolved with itself.");var h=r._lib&&Tt();a&&typeof a.then=="function"?n(r,function(m,b){a instanceof J?a._then(m,b):a.then(m,b)}):(r._state=!0,r._value=a,Lr(r)),h&&At()}},Gn.bind(null,r))}catch(a){Gn(r,a)}}(this,e)}var Qn={get:function(){var e=ae,t=yn;function n(r,o){var a=this,h=!e.global&&(e!==ae||t!==yn),m=h&&!lt(),b=new J(function(x,N){Xn(a,new Br(Ur(r,e,h,m),Ur(o,e,h,m),x,N,e))});return this._consoleTask&&(b._consoleTask=this._consoleTask),b}return n.prototype=Bt,n},set:function(e){T(this,"then",e&&e.prototype===Bt?Qn:{get:function(){return e},set:Qn.set})}};function Br(e,t,n,r,o){this.onFulfilled=typeof e=="function"?e:null,this.onRejected=typeof t=="function"?t:null,this.resolve=n,this.reject=r,this.psd=o}function Gn(e,t){var n,r;dn.push(t),e._state===null&&(n=e._lib&&Tt(),t=Jn(t),e._state=!1,e._value=t,r=e,xt.some(function(o){return o._value===r._value})||xt.push(r),Lr(e),n&&At())}function Lr(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n.",Yr="String expected.",Kt=[],bn="__dbnames",nr="readonly",rr="readwrite";function kt(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var Wr={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function vn(e){return typeof e!="string"||/\./.test(e)?function(t){return t}:function(t){return t[e]===void 0&&e in t&&delete(t=ke(t))[e],t}}function Vr(){throw re.Type()}function be(e,t){try{var n=Hr(e),r=Hr(t);if(n!==r)return n==="Array"?1:r==="Array"?-1:n==="binary"?1:r==="binary"?-1:n==="string"?1:r==="string"?-1:n==="Date"?1:r!=="Date"?NaN:-1;switch(n){case"number":case"Date":case"string":return tP+O&&E(P+N)})})}var D=It(n)&&n.limit===1/0&&(typeof e!="function"||e===or)&&{index:n.index,range:n.range};return E(0).then(function(){if(0=_})).length!==0?(N.forEach(function(E){k.push(function(){var D=w,P=E._cfg.dbschema;Sn(g,D,j),Sn(g,P,j),w=g._dbSchema=P;var O=hr(D,P);O.add.forEach(function(H){fr(j,H[0],H[1].primKey,H[1].indexes)}),O.change.forEach(function(H){if(H.recreate)throw new re.Upgrade("Not yet support for changing primary key");var L=j.objectStore(H.name);H.add.forEach(function(ee){return _n(L,ee)}),H.change.forEach(function(ee){L.deleteIndex(ee.name),_n(L,ee)}),H.del.forEach(function(ee){return L.deleteIndex(ee)})});var K=E._cfg.contentUpgrade;if(K&&E._cfg.version>_){Nn(g,j),v._memoizedTables={};var z=W(P);O.del.forEach(function(H){z[H]=D[H]}),dr(g,[g.Transaction.prototype]),kn(g,[g.Transaction.prototype],y(z),z),v.schema=z;var I,B=we(K);return B&&Mt(),O=J.follow(function(){var H;(I=K(v))&&B&&(H=lt.bind(null,null),I.then(H,H))}),I&&typeof I.then=="function"?J.resolve(I):O.then(function(){return I})}}),k.push(function(D){var P,O,K=E._cfg.dbschema;P=K,O=D,[].slice.call(O.db.objectStoreNames).forEach(function(z){return P[z]==null&&O.db.deleteObjectStore(z)}),dr(g,[g.Transaction.prototype]),kn(g,[g.Transaction.prototype],g._storeNames,g._dbSchema),v.schema=g._dbSchema}),k.push(function(D){g.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(g.idbdb.version/10)===E._cfg.version?(g.idbdb.deleteObjectStore("$meta"),delete g._dbSchema.$meta,g._storeNames=g._storeNames.filter(function(P){return P!=="$meta"})):D.objectStore("$meta").put(E._cfg.version,"version"))})}),function E(){return k.length?J.resolve(k.shift()(v.idbtrans)).then(E):J.resolve()}().then(function(){ss(w,j)})):J.resolve();var g,_,v,j,k,w}).catch(h)):(y(o).forEach(function(N){fr(n,N,o[N].primKey,o[N].indexes)}),Nn(e,n),void J.follow(function(){return e.on.populate.fire(a)}).catch(h));var b,x})}function xi(e,t){ss(e._dbSchema,t),t.db.version%10!=0||t.objectStoreNames.contains("$meta")||t.db.createObjectStore("$meta").add(Math.ceil(t.db.version/10-1),"version");var n=Cn(0,e.idbdb,t);Sn(e,e._dbSchema,t);for(var r=0,o=hr(n,e._dbSchema).change;rMath.pow(2,62)?0:w.oldVersion,g=w<1,e.idbdb=k.result,a&&xi(e,N),vi(e,w/10,N,v))},v),k.onsuccess=De(function(){N=null;var w,E,D,P,O,K=e.idbdb=k.result,z=ie(K.objectStoreNames);if(0"u"?J.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(_){function v(){return indexedDB.databases().finally(_)}b=setInterval(v,100),v()}).finally(function(){return clearInterval(b)}):Promise.resolve()).then(m)]).then(function(){return h(),t.onReadyBeingFired=[],J.resolve(yr(function(){return e.on.ready.fire(e.vip)})).then(function _(){if(0t.limit?_.length=t.limit:e.length===t.limit&&_.length=E.limit&&(!E.values||K.req.values)&&Si(K.req.query.range,E.query.range)}),!1,D,P];case"count":return O=P.find(function(K){return ps(K.req.query.range,E.query.range)}),[O,!!O,D,P]}}(t,n,"query",a),N=x[0],g=x[1],_=x[2],v=x[3];return N&&g?N.obsSet=a.obsSet:(g=r.query(a).then(function(j){var k=j.result;if(N&&(N.res=k),h){for(var w=0,E=k.length;wasync(u,c)=>{const f=[];for(const d of u){const y=c.get(d);if(y)for(const p of y)f.push({tagValue:d,eventId:p})}f.length>0&&(l(`Saving ${f.length} events cache entries to database`),await i.bulkPut(f)),u.clear()};async function Uo(i,l){const u=await l.limit(i.maxSize).toArray();for(const c of u)i.set(c.id,c,!1)}var Yo=(i,l)=>async(u,c)=>{const f=[];for(const d of u){const y=c.get(d);y&&f.push(y)}f.length>0&&(l(`Saving ${f.length} events cache entries to database`),await i.bulkPut(f)),u.clear()};async function Wo(i,l){const u=await l.limit(i.maxSize).toArray();for(const c of u)i.set(c.nip05,c,!1)}var Vo=(i,l)=>async(u,c)=>{const f=[];for(const d of u){const y=c.get(d);y&&f.push({nip05:d,...y})}f.length&&(l(`Saving ${f.length} NIP-05 cache entries to database`),await i.bulkPut(f)),u.clear()},Ho=class extends Ar{constructor(l){super(l);xe(this,"profiles");xe(this,"events");xe(this,"eventTags");xe(this,"nip05");xe(this,"lnurl");xe(this,"relayStatus");xe(this,"unpublishedEvents");this.version(15).stores({profiles:"&pubkey",events:"&id, kind",eventTags:"&tagValue",nip05:"&nip05",lnurl:"&pubkey",relayStatus:"&url",unpublishedEvents:"&id"})}},Oe;function Zo(i){Oe=new Ho(i)}var Jo=Es("ndk:dexie-adapter:profiles");async function Qo(i,l){const u=await l.limit(i.maxSize).toArray();for(const c of u){const f=c;i.set(c.pubkey,f,!1)}Jo("Loaded %d profiles from database",i.size())}var Go=(i,l)=>async(u,c)=>{const f=[];for(const d of u){const y=c.get(d);y&&f.push(y)}f.length&&(l(`Saving ${f.length} users to database`),await i.bulkPut(f)),u.clear()};async function Xo(i,l){const u=await l.limit(i.maxSize).toArray();for(const c of u)i.set(c.url,{url:c.url,updatedAt:c.updatedAt,lastConnectedAt:c.lastConnectedAt,dontConnectBefore:c.dontConnectBefore},!1)}var ea=(i,l)=>async(u,c)=>{const f=[];for(const d of u){const y=c.get(d);y&&f.push({url:d,updatedAt:y.updatedAt,lastConnectedAt:y.lastConnectedAt,dontConnectBefore:y.dontConnectBefore})}f.length>0&&(l(`Saving ${f.length} relay status cache entries to database`),await i.bulkPut(f)),u.clear()},ta=3;async function na(i,l){await l.each(u=>{i.set(u.event.id,u,!1)})}function ra(i,l){return async(u,c)=>{const f=[];for(const d of u){const y=c.get(d);y&&f.push(y)}f.length>0&&(l(`Saving ${f.length} unpublished events cache entries to database`),await i.bulkPut(f)),u.clear()}}async function sa(i,l){await i.delete(l)}async function ia(i){const l=[];return await i.each(u=>{l.push({event:new Pt(void 0,u.event),relays:Object.keys(u.relays),lastTryAt:u.lastTryAt})}),l}function oa(i,l){const u={};l.forEach(f=>u[f]=!1),this.unpublishedEvents.set(i.id,{id:i.id,event:i.rawEvent(),relays:u});const c=f=>{const d=f.url,y=this.unpublishedEvents.get(i.id);if(!y){i.off("publushed",c);return}y.relays[d]=!0,this.unpublishedEvents.set(i.id,y);const p=Object.values(y.relays).filter(S=>S).length,C=Object.values(y.relays).length-p;(p>=ta||C===0)&&(this.unpublishedEvents.delete(i.id),i.off("published",c))};i.on("published",c)}async function aa(i,l){const u=await l.limit(i.maxSize).toArray();for(const c of u)i.set(c.pubkey,{document:c.document,fetchedAt:c.fetchedAt},!1)}var la=(i,l)=>async(u,c)=>{const f=[];for(const d of u){const y=c.get(d);y&&f.push({pubkey:d,...y})}f.length&&(l(`Saving ${f.length} zapper cache entries to database`),await i.bulkPut(f)),u.clear()},Et=class{constructor(i){xe(this,"cache");xe(this,"dirtyKeys",new Set);xe(this,"options");xe(this,"debug");xe(this,"indexes");xe(this,"isSet",!1);xe(this,"maxSize",0);this.debug=i.debug,this.options=i,this.maxSize=i.maxSize,i.maxSize>0&&(this.cache=new bs.LRUCache({maxSize:i.maxSize}),setInterval(()=>this.dump().catch(console.error),1e3*10)),this.indexes=new Map}getSet(i){var l;return(l=this.cache)==null?void 0:l.get(i)}getAllWithFilter(i){var u;const l=new Map;return(u=this.cache)==null||u.forEach((c,f)=>{i(f,c)&&l.set(f,c)}),l}get(i){var l;return(l=this.cache)==null?void 0:l.get(i)}async getWithFallback(i,l){let u=this.get(i);return u||(u=await l.get(i),u&&this.set(i,u)),u}async getManyWithFallback(i,l){const u=[],c=[];for(const f of i){const d=this.get(f);d?u.push(d):c.push(f)}if(u.length>0&&this.debug(`Cache hit for keys ${u.length} and miss for ${c.length} keys`),c.length>0){const f=Date.now(),d=await l.bulkGet(c),y=Date.now();let p=0;for(const C of d)C&&(this.set(C.id,C),u.push(C),p++);this.debug(`Time spent querying database: ${y-f}ms for ${c.length} keys, which added ${p} entries to the cache`)}return u}add(i,l,u=!0){var f;const c=this.get(i)??new Set;c.add(l),(f=this.cache)==null||f.set(i,c),u&&this.dirtyKeys.add(i)}set(i,l,u=!0){var c;(c=this.cache)==null||c.set(i,l),u&&this.dirtyKeys.add(i);for(const[f,d]of this.indexes.entries()){const y=l[f];if(y){const p=d.get(y)||new Set;p.add(i),d.set(y,p)}}}size(){var i;return((i=this.cache)==null?void 0:i.size)||0}delete(i){var l;(l=this.cache)==null||l.delete(i),this.dirtyKeys.add(i)}async dump(){this.dirtyKeys.size>0&&this.cache&&(await this.options.dump(this.dirtyKeys,this.cache),this.dirtyKeys.clear())}addIndex(i){this.indexes.set(i,new bs.LRUCache({maxSize:this.options.maxSize}))}getFromIndex(i,l){const u=new Set,c=this.indexes.get(i);if(c){const f=c.get(l);if(f)for(const d of f.values()){const y=this.get(d);y&&u.add(y)}}return u}},ca=10,ua=class{constructor(i={}){xe(this,"debug");xe(this,"locking",!1);xe(this,"ready",!1);xe(this,"profiles");xe(this,"zappers");xe(this,"nip05s");xe(this,"events");xe(this,"eventTags");xe(this,"relayInfo");xe(this,"unpublishedEvents");xe(this,"warmedUp",!1);xe(this,"warmUpPromise");xe(this,"devMode",!1);xe(this,"saveSig");xe(this,"_onReady");xe(this,"addUnpublishedEvent",oa.bind(this));xe(this,"getUnpublishedEvents",()=>ia(Oe.unpublishedEvents));xe(this,"discardUnpublishedEvent",i=>sa(Oe.unpublishedEvents,i));Zo(i.dbName||"ndk"),this.debug=i.debug||Es("ndk:dexie-adapter"),this.saveSig=i.saveSig||!1,this.profiles=new Et({maxSize:i.profileCacheSize||1e5,dump:Go(Oe.profiles,this.debug),debug:this.debug}),this.zappers=new Et({maxSize:i.zapperCacheSize||200,dump:la(Oe.lnurl,this.debug),debug:this.debug}),this.nip05s=new Et({maxSize:i.nip05CacheSize||1e3,dump:Vo(Oe.nip05,this.debug),debug:this.debug}),this.events=new Et({maxSize:i.eventCacheSize||5e4,dump:Yo(Oe.events,this.debug),debug:this.debug}),this.events.addIndex("pubkey"),this.events.addIndex("kind"),this.eventTags=new Et({maxSize:i.eventTagsCacheSize||1e5,dump:zo(Oe.eventTags,this.debug),debug:this.debug}),this.relayInfo=new Et({maxSize:500,debug:this.debug,dump:ea(Oe.relayStatus,this.debug)}),this.unpublishedEvents=new Et({maxSize:5e3,debug:this.debug,dump:ra(Oe.unpublishedEvents,this.debug)});const l=(c,f)=>{const d=Date.now();return f().then(()=>{const y=Date.now();this.debug(c,"took",y-d,"ms")})},u=Date.now();this.warmUpPromise=Promise.allSettled([l("profilesWarmUp",()=>Qo(this.profiles,Oe.profiles)),l("zapperWarmUp",()=>aa(this.zappers,Oe.lnurl)),l("nip05WarmUp",()=>Wo(this.nip05s,Oe.nip05)),l("relayInfoWarmUp",()=>Xo(this.relayInfo,Oe.relayStatus)),l("unpublishedEventsWarmUp",()=>na(this.unpublishedEvents,Oe.unpublishedEvents)),l("eventsWarmUp",()=>Uo(this.events,Oe.events)),l("eventTagsWarmUp",()=>Lo(this.eventTags,Oe.eventTags))]),this.warmUpPromise.then(()=>{const c=Date.now();this.warmedUp=!0,this.ready=!0,this.locking=!0,this.debug("Warm up completed, time",c-u,"ms"),this._onReady&&this._onReady()})}onReady(i){this._onReady=i}async query(i){if(!this.warmedUp){const c=Date.now();await this.warmUpPromise,this.debug("froze query for",Date.now()-c,"ms",i.filters)}const l=Date.now();i.filters.map(c=>this.processFilter(c,i));const u=Date.now()-l;return u>100&&this.debug("query took",u,"ms",i.filter),[]}async fetchProfile(i){return this.profiles?await this.profiles.getWithFallback(i,Oe.profiles):null}fetchProfileSync(i){return this.profiles?this.profiles.get(i):null}async getProfiles(i){if(this.profiles)return this.profiles.getAllWithFilter(i)}saveProfile(i,l){const u=this.profiles.get(i);if(u!=null&&u.created_at&&l.created_at&&u.created_at>=l.created_at)return;const c=Math.floor(Date.now()/1e3);this.profiles.set(i,{pubkey:i,...l,cachedAt:c}),this.debug("Saved profile for pubkey",i,l)}async loadNip05(i,l=3600){var d;const u=(d=this.nip05s)==null?void 0:d.get(i);if(u){if(u.profile===null)return u.fetchedAt+l*1e3this.events.delete(l)),await Oe.events.where({id:i}).delete()}async setEvent(i,l,u){if(i.kind===0){if(!this.profiles)return;try{const f=Ri(i);this.saveProfile(i.pubkey,f)}catch{this.debug(`Failed to save profile for pubkey: ${i.pubkey}`)}}let c=!0;if(i.isParamReplaceable()){const f=this.events.get(i.tagId());f&&i.created_at&&f.createdAt>i.created_at&&(c=!1)}if(c){const f={id:i.tagId(),pubkey:i.pubkey,kind:i.kind,createdAt:i.created_at??Date.now(),relay:u==null?void 0:u.url,event:i.serialize(this.saveSig,!0)};this.saveSig&&i.sig&&(f.sig=i.sig),this.events.set(i.tagId(),f);const d=ha(i);for(const y of d)this.eventTags.add(y[0]+y[1],i.tagId())}}updateRelayStatus(i,l){const u={url:i,updatedAt:Date.now(),...l};this.relayInfo.set(i,u)}getRelayStatus(i){const l=this.relayInfo.get(i);if(l)return{lastConnectedAt:l.lastConnectedAt,dontConnectBefore:l.dontConnectBefore}}byAuthors(i,l){if(!i.authors)return!1;let u=0;for(const c of i.authors){let f=Array.from(this.events.getFromIndex("pubkey",c));i.kinds&&(f=f.filter(d=>{var y;return(y=i.kinds)==null?void 0:y.includes(d.kind)})),da(l,f,i),u+=f.length}return!0}byIdsQuery(i,l){if(i.ids){for(const u of i.ids){const c=this.events.get(u);c&&tn(l,c,c.relay,i)}return!0}return!1}byNip33Query(i,l,u){const c=["#d","authors","kinds"];if(i.size===c.length&&c.every(d=>i.has(d))&&l.kinds&&l.authors){for(const d of l.kinds)if(d>=3e4&&d<4e4)for(const p of l.authors)for(const C of l["#d"]){const S=`${d}:${p}:${C}`,$=this.events.get(S);$&&tn(u,$,$.relay,l)}return!0}return!1}byTags(i,l){const u=Object.entries(i).filter(([c])=>c.startsWith("#")&&c.length===2).map(([c,f])=>[c[1],f]);if(u.length===0)return!1;for(const[c,f]of u)for(const d of f){const y=c+d,p=this.eventTags.getSet(y);p&&p.forEach(C=>{const S=this.events.get(C);S&&(!i.kinds||i.kinds.includes(S.kind))&&tn(l,S,S.relay,i)})}return!0}byKinds(i,l,u){if(!l.kinds||i.size!==1||!i.has("kinds"))return!1;const c=l.limit||500;let f=0;const d=new Set,y=[...l.kinds].sort((p,C)=>{var S,$,A,Y;return((($=(S=this.events.indexes.get("kind"))==null?void 0:S.get(p))==null?void 0:$.size)||0)-(((Y=(A=this.events.indexes.get("kind"))==null?void 0:A.get(C))==null?void 0:Y.size)||0)});for(const p of y){const C=this.events.getFromIndex("kind",p);for(const S of C)if(!d.has(S.id)&&(d.add(S.id),tn(u,S,S.relay,l),f++,f>=c))break;if(f>=c)break}return!0}};function da(i,l,u){u!=null&&u.limit&&l.length>u.limit&&(l=l.sort((c,f)=>f.createdAt-c.createdAt).slice(0,u.limit));for(const c of l)tn(i,c,c.relay,u)}function tn(i,l,u,c){try{const f=Fi(l.event);if(c&&!qi(c,f))return;const d=new Pt(void 0,f),y=u?i.pool.getRelay(u,!1):void 0;d.relay=y,i.eventReceived(d,y,!0)}catch(f){console.error("failed to deserialize event",f)}}function ha(i){const l=[];if(i.kind===3)return[];for(const u of i.tags)if(u[0].length===1&&(l.push(u),l.length>=ca))return[];return l}function sn(i){const l=new Date;return new Date(i)<=l?"since":"until"}function Ks(i,l=!1){const u=i.tags,c=u.some(p=>p[0]==="type"&&(p[1]==="since"||p[1]==="until")),f=u.some(p=>p[0]==="title"&&p[1]&&p[1].length>0),d=u.some(p=>p[0]==="date"&&p[1]&&/^\d{4}-\d{2}-\d{2}$/.test(p[1]));return c&&f&&d?l?u.some(C=>C[0]==="visibility"&&C[1]==="public"):!0:!1}function Un(i,l=!1){var u,c,f,d;try{console.log("Parsing event:",i);const y=i.tags;console.log("Event tags:",y),y.forEach((M,T)=>{console.log(`Tag ${T}:`,M)});let p=(u=y.find(M=>M[0]==="type"))==null?void 0:u[1],C=(c=y.find(M=>M[0]==="title"))==null?void 0:c[1],S=(f=y.find(M=>M[0]==="date"))==null?void 0:f[1],$=(d=y.find(M=>M[0]==="visibility"))==null?void 0:d[1];if(!p||!C||!S){console.log("Standard tags not found, trying alternative parsing...");for(const M of y)M[0]==="d"&&M[1]&&(C||(C=M[1])),M[0]==="t"&&M[1]&&(p||(p=M[1]));if(i.content&&i.content.trim()!=="")try{const M=JSON.parse(i.content);console.log("Parsed content:",M),!C&&M.title&&(C=M.title),!p&&M.type&&(p=M.type),!S&&M.date&&(S=M.date),!$&&M.visibility&&($=M.visibility)}catch{console.log("Content is not JSON:",i.content)}}if(console.log("Parsed tags:",{typeTag:p,titleTag:C,dateTag:S,visibilityTag:$}),!C||!S)return console.log("Missing required title or date, skipping event"),null;if(p||(p="since"),$||($="public"),p!=="since"&&p!=="until")return console.log("Invalid type tag:",p),null;if($!=="public"&&$!=="private")return console.log("Invalid visibility tag:",$),null;if(!/^\d{4}-\d{2}-\d{2}$/.test(S))return console.log("Invalid date format:",S),null;if(C.length<2||C.length>100)return console.log("Invalid title length:",C.length),null;if(l&&$!=="public")return console.log("Counter is not public, skipping:",$),null;const Y={id:i.id,title:C,date:S,type:p,visibility:$,pubkey:i.pubkey,createdAt:i.created_at||0,slug:i.id};return console.log("Created counter:",Y),Y}catch(y){return console.error("Error parsing counter event:",y),null}}function Is(i,l){const u={kinds:[30078],limit:100};return i&&(u.authors=[i]),console.log("getCounterFilter: Created filter:",u,{pubkey:i,isPublic:l}),u}const Rs=["wss://relay.azzamo.net","wss://relay.damus.io","wss://nostr.oxtr.dev","wss://nos.lol","wss://relay.snort.social"];function fa(i){if(!i||!i.includes("@"))return null;const[l,u]=i.split("@");return{name:l,domain:u}}function Fs(i){return i.lud16?i.lud16:i.lud06?i.lud06:null}const ma=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_RELAYS:Rs,deriveCounterType:sn,eventToCounter:Un,extractLightningAddress:Fs,getCounterFilter:Is,isValidCounterEvent:Ks,parseNip05:fa},Symbol.toStringTag,{value:"Module"})),qs=R.createContext(null),Ze=()=>{const i=R.useContext(qs);if(!i)throw new Error("useNDK must be used within NDKProvider");return i},pa=({children:i})=>{const[l,u]=R.useState(null),[c,f]=R.useState(null),[d,y]=R.useState(null),[p,C]=R.useState(!1),[S,$]=R.useState(!0);R.useEffect(()=>{(async()=>{try{console.log("Initializing NDK with Dexie cache...");const G=new ua({dbName:"nostrcount-cache"}),de=new Bi({explicitRelayUrls:Rs,cacheAdapter:G});console.log("Connecting to relays..."),await de.connect(),console.log("NDK connected successfully with cache"),u(de),$(!1)}catch(G){console.error("Failed to initialize NDK:",G),$(!1)}})()},[]);const A=async()=>{if(l)try{if($(!0),console.log("Attempting login with NIP-07 extension..."),window.nostr){console.log("Nostr extension found, getting public key...");const ie=await window.nostr.getPublicKey();console.log("Got public key:",ie);const G=l.getUser({pubkey:ie});l.signer={user:async()=>G,sign:async me=>{if(console.log("Signing event with NIP-07 extension..."),!window.nostr)throw new Error("Nostr extension not available");const Q={kind:me.kind,created_at:me.created_at||Math.floor(Date.now()/1e3),tags:me.tags,content:me.content,pubkey:me.pubkey};console.log("Raw event to sign:",Q);const F=await window.nostr.signEvent(Q);return console.log("Event signed successfully:",F),me.sig=F.sig,me.sig},blockUntilReady:async()=>!0},f(G),C(!0),console.log("Login successful with NIP-07");const de=await pe(ie);y(de)}else throw new Error("No Nostr extension found")}catch(ie){throw console.error("Login failed:",ie),ie}finally{$(!1)}},Y=async(ie,G)=>{if(l)try{$(!0),console.log("Attempting login with keys...");let de,me;if(G&&!ie)try{const te=nn.decode(G).data;de=Dr(te),me=te,console.log("Derived public key from private key:",de)}catch{throw new Error("Invalid nsec format")}else if(ie&&G){try{de=nn.decode(ie).data}catch{throw new Error("Invalid npub format")}try{me=nn.decode(G).data}catch{throw new Error("Invalid nsec format")}if(Dr(me)!==de)throw new Error("Public key does not match private key")}else throw new Error("Please provide a valid private key");console.log("Keys verified successfully");const Q=l.getUser({pubkey:de}),F=Array.from(me).map(X=>X.toString(16).padStart(2,"0")).join(""),W=new Li(F);l.signer=W,console.log("Signer set successfully"),f(Q),C(!0),console.log("Login successful with keys");const le=await pe(de);y(le)}catch(de){throw console.error("Keys login failed:",de),de}finally{$(!1)}},M=async ie=>{if(l)try{throw $(!0),console.log("Attempting NIP-55 login with URL:",ie),new Error("NIP-55 login not yet implemented")}catch(G){throw console.error("NIP-55 login failed:",G),G}finally{$(!1)}},T=()=>{console.log("Logging out..."),f(null),y(null),C(!1),l&&(l.signer=void 0)},ne=async ie=>{if(!l||!c)throw new Error("NDK not initialized or user not logged in");try{console.log("Creating NDK event with data:",ie);const G=new Pt(l,{...ie,pubkey:c.pubkey});return console.log("Signing event..."),await G.sign(),console.log("Event signed successfully"),console.log("Publishing event..."),await G.publish(),console.log("Event published successfully"),G}catch(G){throw console.error("Error in publishEvent:",G),G}},pe=async ie=>{if(!l)return null;try{console.log("Fetching user profile for:",ie);const G=l.getUser({pubkey:ie});return await G.fetchProfile(),G.profile?(console.log("User profile fetched:",G.profile),{pubkey:ie,name:G.profile.name,display_name:G.profile.display_name,about:G.profile.about,picture:G.profile.picture,nip05:G.profile.nip05,lud16:G.profile.lud16,lud06:G.profile.lud06}):(console.log("No profile found for user"),null)}catch(G){return console.error("Error fetching user profile:",G),null}},ue=async ie=>{if(!l||!c)throw new Error("NDK not initialized or user not logged in");try{console.log("Updating user profile:",ie);const G=new Pt(l);G.kind=0,G.content=JSON.stringify(ie),console.log("Publishing profile update..."),await G.sign(),await G.publish(),console.log("Profile updated successfully");const de=await pe(c.pubkey);y(de)}catch(G){throw console.error("Error updating user profile:",G),G}};return s.jsx(qs.Provider,{value:{ndk:l,user:c,userProfile:d,isConnected:p,isLoading:S,login:A,loginWithKeys:Y,loginWithNip55:M,logout:T,publishEvent:ne,fetchUserProfile:pe,updateUserProfile:ue},children:i})};var ya={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const ga=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ce=(i,l)=>{const u=R.forwardRef(({color:c="currentColor",size:f=24,strokeWidth:d=2,absoluteStrokeWidth:y,children:p,...C},S)=>R.createElement("svg",{ref:S,...ya,width:f,height:f,stroke:c,strokeWidth:y?Number(d)*24/Number(f):d,className:`lucide lucide-${ga(i)}`,...C},[...l.map(([$,A])=>R.createElement($,A)),...(Array.isArray(p)?p:[p])||[]]));return u.displayName=`${i}`,u},js=Ce("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),ba=Ce("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),Ns=Ce("BarChart3",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]),mt=Ce("Calendar",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",ry:"2",key:"eu3xkr"}],["line",{x1:"16",x2:"16",y1:"2",y2:"6",key:"m3sa8f"}],["line",{x1:"8",x2:"8",y1:"2",y2:"6",key:"18kwsl"}],["line",{x1:"3",x2:"21",y1:"10",y2:"10",key:"xt86sb"}]]),Bs=Ce("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]),Mr=Ce("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),Ls=Ce("ExternalLink",[["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}],["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["line",{x1:"10",x2:"21",y1:"14",y2:"3",key:"18c3s4"}]]),zs=Ce("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]),cn=Ce("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),va=Ce("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]),xa=Ce("Key",[["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["path",{d:"m15.5 7.5 3 3L22 7l-3-3",key:"1rn1fs"}]]),Us=Ce("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),wa=Ce("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]),ja=Ce("MessageCircle",[["path",{d:"m3 21 1.9-5.7a8.5 8.5 0 1 1 3.8 3.8z",key:"v2veuj"}]]),Ys=Ce("PenSquare",[["path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1qinfi"}],["path",{d:"M18.5 2.5a2.12 2.12 0 0 1 3 3L12 15l-4 1 1-4Z",key:"w2jsv5"}]]),qt=Ce("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),ks=Ce("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),Na=Ce("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]),Kr=Ce("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),ka=Ce("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]),_a=Ce("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),Ca=Ce("Shield",[["path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10",key:"1irkt0"}]]),Ws=Ce("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),Vs=Ce("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),Sa=Ce("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),Yn=Ce("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Fn=Ce("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),Ea=({isOpen:i,onClose:l})=>{const{login:u,loginWithKeys:c,loginWithNip55:f,updateUserProfile:d}=Ze(),[y,p]=R.useState("extension"),[C,S]=R.useState("username"),[$,A]=R.useState(""),[Y,M]=R.useState("unknown"),[T,ne]=R.useState(""),[pe,ue]=R.useState(""),[ie,G]=R.useState(""),[de,me]=R.useState(""),[Q,F]=R.useState(!1),[W,le]=R.useState(null),X=q=>q.startsWith("npub")?"npub":q.startsWith("nsec")?"nsec":"unknown",te=q=>{A(q),M(X(q))},Ne=async()=>{try{F(!0),le(null),await u(),l()}catch(q){console.error("Extension login failed:",q),le(q instanceof Error?q.message:"Login failed")}finally{F(!1)}},ke=async()=>{if(!$.trim()){le("Please enter a public or private key");return}try{if(F(!0),le(null),Y==="nsec")await c("",$.trim());else if(Y==="npub"){le("Public key only provides read-only access. Please provide a private key for full access.");return}else{le("Please enter a valid npub or nsec key");return}l()}catch(q){console.error("Keys login failed:",q),le(q instanceof Error?q.message:"Login failed")}finally{F(!1)}},oe=async()=>{if(!T.trim()){le("Please enter a username");return}try{F(!0),le(null);const q=zi(),we=Dr(q),Se=nn.nsecEncode(q),_e=nn.npubEncode(we);ue(Se),G(_e),S("keys")}catch(q){console.error("Account creation failed:",q),le("Failed to create account")}finally{F(!1)}},Z=async()=>{try{F(!0),le(null),await c(ie,pe),await d({name:T,display_name:T}),l()}catch(q){console.error("Login with new keys failed:",q),le(q instanceof Error?q.message:"Login failed")}finally{F(!1)}},V=async()=>{if(!de.trim()){le("Please enter a NIP-55 URL");return}try{F(!0),le(null),await f(de),l()}catch(q){console.error("NIP-55 login failed:",q),le(q instanceof Error?q.message:"Login failed")}finally{F(!1)}},se=q=>{navigator.clipboard.writeText(q)},U=()=>{A(""),M("unknown"),ne(""),ue(""),G(""),me(""),le(null),S("username")},ce=()=>{U(),l()};return i?s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:s.jsxs("div",{className:"bg-white rounded-lg max-w-md w-full max-h-[90vh] overflow-y-auto",children:[s.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200",children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Connect to Nostr"}),s.jsx("button",{onClick:ce,className:"p-2 hover:bg-gray-100 rounded-full transition-colors",disabled:Q,children:s.jsx(Yn,{className:"w-5 h-5 text-gray-500"})})]}),s.jsxs("div",{className:"p-6",children:[s.jsxs("div",{className:"flex gap-2 mb-6",children:[s.jsxs("button",{onClick:()=>p("extension"),className:`flex-1 px-3 py-2 rounded-md font-medium transition-colors text-sm ${y==="extension"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200"}`,children:[s.jsx(Fn,{className:"w-4 h-4 inline mr-1"}),"Extension"]}),s.jsxs("button",{onClick:()=>p("keys"),className:`flex-1 px-3 py-2 rounded-md font-medium transition-colors text-sm ${y==="keys"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200"}`,children:[s.jsx(xa,{className:"w-4 h-4 inline mr-1"}),"Keys"]}),s.jsxs("button",{onClick:()=>p("create"),className:`flex-1 px-3 py-2 rounded-md font-medium transition-colors text-sm ${y==="create"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200"}`,children:[s.jsx(qt,{className:"w-4 h-4 inline mr-1"}),"Create"]}),s.jsxs("button",{onClick:()=>p("nip55"),className:`flex-1 px-3 py-2 rounded-md font-medium transition-colors text-sm ${y==="nip55"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200"}`,children:[s.jsx(Ls,{className:"w-4 h-4 inline mr-1"}),"NIP-55"]})]}),y==="extension"&&s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-600 mb-4",children:"Connect using your Nostr browser extension (Alby, nos2x, etc.)"}),s.jsx("button",{onClick:Ne,disabled:Q,className:"w-full px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors font-medium disabled:opacity-50",children:Q?"Connecting...":"Connect Extension"})]}),y==="keys"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Public or Private Key"}),s.jsx("input",{type:"password",value:$,onChange:q=>te(q.target.value),placeholder:"npub1... or nsec1...",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",disabled:Q}),Y!=="unknown"&&s.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Detected: ",Y==="npub"?"Public Key (Read-only)":"Private Key (Full Access)"]})]}),s.jsx("button",{onClick:ke,disabled:Q||Y==="unknown",className:"w-full px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors font-medium disabled:opacity-50",children:Q?"Connecting...":"Connect with Keys"})]}),y==="create"&&C==="username"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Choose a Username"}),s.jsx("input",{type:"text",value:T,onChange:q=>ne(q.target.value),placeholder:"your-username",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",disabled:Q}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"This will be used to identify your account"})]}),s.jsx("button",{onClick:oe,disabled:Q||!T.trim(),className:"w-full px-4 py-2 bg-green-600 text-white rounded-md hover:bg-green-700 transition-colors font-medium disabled:opacity-50",children:Q?"Creating...":"Create Account"})]}),y==="create"&&C==="keys"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"bg-yellow-50 border border-yellow-200 rounded-md p-4",children:[s.jsx("h3",{className:"font-semibold text-yellow-800 mb-2",children:"Save Your Keys!"}),s.jsx("p",{className:"text-sm text-yellow-700 mb-3",children:"Store these keys safely. You'll need them to access your account."})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Private Key (nsec) - Keep Secret!"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:"password",value:pe,readOnly:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md bg-gray-50"}),s.jsx("button",{onClick:()=>se(pe),className:"absolute right-2 top-2 p-1 hover:bg-gray-200 rounded",children:s.jsx(Mr,{className:"w-4 h-4 text-gray-500"})})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Public Key (npub)"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:"text",value:ie,readOnly:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md bg-gray-50"}),s.jsx("button",{onClick:()=>se(ie),className:"absolute right-2 top-2 p-1 hover:bg-gray-200 rounded",children:s.jsx(Mr,{className:"w-4 h-4 text-gray-500"})})]})]}),s.jsx("button",{onClick:Z,disabled:Q,className:"w-full px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors font-medium disabled:opacity-50",children:Q?"Connecting...":"Use These Keys"})]}),y==="nip55"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"NIP-55 URL"}),s.jsx("input",{type:"url",value:de,onChange:q=>me(q.target.value),placeholder:"https://example.com/.well-known/nostr.json",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",disabled:Q}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Enter a NIP-55 compatible URL to connect with an external signer"})]}),s.jsx("button",{onClick:V,disabled:Q||!de.trim(),className:"w-full px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors font-medium disabled:opacity-50",children:Q?"Connecting...":"Connect with NIP-55"})]}),W&&s.jsx("div",{className:"mt-4 p-3 bg-red-50 border border-red-200 rounded-md",children:s.jsx("p",{className:"text-red-600 text-sm",children:W})})]})]})}):null},Da=()=>{const{userProfile:i,isConnected:l,logout:u}=Ze(),c=Ai(),[f,d]=R.useState(!1),y=C=>c.pathname===C,p=()=>{l?u():d(!0)};return s.jsxs("header",{className:"bg-white shadow-sm border-b border-gray-200",children:[s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"flex justify-between items-center h-16",children:[s.jsxs("div",{className:"flex items-center gap-8",children:[s.jsxs(Re,{to:"/",className:"flex items-center gap-2",children:[s.jsx(Ns,{className:"w-8 h-8 text-blue-600"}),s.jsx("span",{className:"text-xl font-bold text-gray-900",children:"NostrCount"})]}),s.jsxs("nav",{className:"hidden md:flex items-center gap-6",children:[s.jsxs(Re,{to:"/",className:`flex items-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors ${y("/")?"bg-blue-100 text-blue-700":"text-gray-600 hover:text-gray-900 hover:bg-gray-100"}`,children:[s.jsx(va,{className:"w-4 h-4"}),"Home"]}),s.jsxs(Re,{to:"/browse",className:`flex items-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors ${y("/browse")?"bg-blue-100 text-blue-700":"text-gray-600 hover:text-gray-900 hover:bg-gray-100"}`,children:[s.jsx(cn,{className:"w-4 h-4"}),"Browse"]}),l&&s.jsxs(Re,{to:"/dashboard",className:`flex items-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors ${y("/dashboard")?"bg-blue-100 text-blue-700":"text-gray-600 hover:text-gray-900 hover:bg-gray-100"}`,children:[s.jsx(Ns,{className:"w-4 h-4"}),"Dashboard"]})]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[l&&i&&s.jsxs("div",{className:"flex items-center gap-2",children:[i.picture&&s.jsx("img",{src:i.picture,alt:i.name||"User",className:"w-8 h-8 rounded-full"}),s.jsx("span",{className:"text-sm font-medium text-gray-700",children:i.display_name||i.name||"Anonymous"})]}),s.jsx("button",{onClick:p,className:`flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors ${l?"text-gray-600 hover:text-gray-900 hover:bg-gray-100":"bg-blue-600 text-white hover:bg-blue-700"}`,children:l?s.jsxs(s.Fragment,{children:[s.jsx(wa,{className:"w-4 h-4"}),"Logout"]}):s.jsxs(s.Fragment,{children:[s.jsx(Vs,{className:"w-4 h-4"}),"Login"]})})]})]})}),s.jsx(Ea,{isOpen:f,onClose:()=>d(!1)})]})};var Hs={exports:{}};(function(i,l){(function(u,c){i.exports=c()})(qn,function(){var u=1e3,c=6e4,f=36e5,d="millisecond",y="second",p="minute",C="hour",S="day",$="week",A="month",Y="quarter",M="year",T="date",ne="Invalid Date",pe=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,ue=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,ie={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(oe){var Z=["th","st","nd","rd"],V=oe%100;return"["+oe+(Z[(V-20)%10]||Z[V]||Z[0])+"]"}},G=function(oe,Z,V){var se=String(oe);return!se||se.length>=Z?oe:""+Array(Z+1-se.length).join(V)+oe},de={s:G,z:function(oe){var Z=-oe.utcOffset(),V=Math.abs(Z),se=Math.floor(V/60),U=V%60;return(Z<=0?"+":"-")+G(se,2,"0")+":"+G(U,2,"0")},m:function oe(Z,V){if(Z.date()1)return oe(q[0])}else{var we=Z.name;Q[we]=Z,U=we}return!se&&U&&(me=U),U||!se&&me},X=function(oe,Z){if(W(oe))return oe.clone();var V=typeof Z=="object"?Z:{};return V.date=oe,V.args=arguments,new Ne(V)},te=de;te.l=le,te.i=W,te.w=function(oe,Z){return X(oe,{locale:Z.$L,utc:Z.$u,x:Z.$x,$offset:Z.$offset})};var Ne=function(){function oe(V){this.$L=le(V.locale,null,!0),this.parse(V),this.$x=this.$x||V.x||{},this[F]=!0}var Z=oe.prototype;return Z.parse=function(V){this.$d=function(se){var U=se.date,ce=se.utc;if(U===null)return new Date(NaN);if(te.u(U))return new Date;if(U instanceof Date)return new Date(U);if(typeof U=="string"&&!/Z$/i.test(U)){var q=U.match(pe);if(q){var we=q[2]-1||0,Se=(q[7]||"0").substring(0,3);return ce?new Date(Date.UTC(q[1],we,q[3]||1,q[4]||0,q[5]||0,q[6]||0,Se)):new Date(q[1],we,q[3]||1,q[4]||0,q[5]||0,q[6]||0,Se)}}return new Date(U)}(V),this.init()},Z.init=function(){var V=this.$d;this.$y=V.getFullYear(),this.$M=V.getMonth(),this.$D=V.getDate(),this.$W=V.getDay(),this.$H=V.getHours(),this.$m=V.getMinutes(),this.$s=V.getSeconds(),this.$ms=V.getMilliseconds()},Z.$utils=function(){return te},Z.isValid=function(){return this.$d.toString()!==ne},Z.isSame=function(V,se){var U=X(V);return this.startOf(se)<=U&&U<=this.endOf(se)},Z.isAfter=function(V,se){return X(V)0,Q<=me.r||!me.r){Q<=1&&de>0&&(me=ie[de-1]);var F=ue[me.l];M&&(Q=M(""+Q)),ne=typeof F=="string"?F.replace("%d",Q):F(Q,$,me.l,pe);break}}if($)return ne;var W=pe?ue.future:ue.past;return typeof W=="function"?W(ne):W.replace("%s",ne)},d.to=function(S,$){return p(S,$,this,!0)},d.from=function(S,$){return p(S,$,this)};var C=function(S){return S.$u?f.utc():f()};d.toNow=function(S){return this.to(C(this),S)},d.fromNow=function(S){return this.from(C(this),S)}}})})(Zs);var $a=Zs.exports;const Oa=Bn($a);var Js={exports:{}};(function(i,l){(function(u,c){i.exports=c()})(qn,function(){var u,c,f=1e3,d=6e4,y=36e5,p=864e5,C=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,S=31536e6,$=2628e6,A=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,Y={years:S,months:$,days:p,hours:y,minutes:d,seconds:f,milliseconds:1,weeks:6048e5},M=function(Q){return Q instanceof de},T=function(Q,F,W){return new de(Q,W,F.$l)},ne=function(Q){return c.p(Q)+"s"},pe=function(Q){return Q<0},ue=function(Q){return pe(Q)?Math.ceil(Q):Math.floor(Q)},ie=function(Q){return Math.abs(Q)},G=function(Q,F){return Q?pe(Q)?{negative:!0,format:""+ie(Q)+F}:{negative:!1,format:""+Q+F}:{negative:!1,format:""}},de=function(){function Q(W,le,X){var te=this;if(this.$d={},this.$l=X,W===void 0&&(this.$ms=0,this.parseFromMilliseconds()),le)return T(W*Y[ne(le)],this);if(typeof W=="number")return this.$ms=W,this.parseFromMilliseconds(),this;if(typeof W=="object")return Object.keys(W).forEach(function(oe){te.$d[ne(oe)]=W[oe]}),this.calMilliseconds(),this;if(typeof W=="string"){var Ne=W.match(A);if(Ne){var ke=Ne.slice(2).map(function(oe){return oe!=null?Number(oe):0});return this.$d.years=ke[0],this.$d.months=ke[1],this.$d.weeks=ke[2],this.$d.days=ke[3],this.$d.hours=ke[4],this.$d.minutes=ke[5],this.$d.seconds=ke[6],this.calMilliseconds(),this}}return this}var F=Q.prototype;return F.calMilliseconds=function(){var W=this;this.$ms=Object.keys(this.$d).reduce(function(le,X){return le+(W.$d[X]||0)*Y[X]},0)},F.parseFromMilliseconds=function(){var W=this.$ms;this.$d.years=ue(W/S),W%=S,this.$d.months=ue(W/$),W%=$,this.$d.days=ue(W/p),W%=p,this.$d.hours=ue(W/y),W%=y,this.$d.minutes=ue(W/d),W%=d,this.$d.seconds=ue(W/f),W%=f,this.$d.milliseconds=W},F.toISOString=function(){var W=G(this.$d.years,"Y"),le=G(this.$d.months,"M"),X=+this.$d.days||0;this.$d.weeks&&(X+=7*this.$d.weeks);var te=G(X,"D"),Ne=G(this.$d.hours,"H"),ke=G(this.$d.minutes,"M"),oe=this.$d.seconds||0;this.$d.milliseconds&&(oe+=this.$d.milliseconds/1e3,oe=Math.round(1e3*oe)/1e3);var Z=G(oe,"S"),V=W.negative||le.negative||te.negative||Ne.negative||ke.negative||Z.negative,se=Ne.format||ke.format||Z.format?"T":"",U=(V?"-":"")+"P"+W.format+le.format+te.format+se+Ne.format+ke.format+Z.format;return U==="P"||U==="-P"?"P0D":U},F.toJSON=function(){return this.toISOString()},F.format=function(W){var le=W||"YYYY-MM-DDTHH:mm:ss",X={Y:this.$d.years,YY:c.s(this.$d.years,2,"0"),YYYY:c.s(this.$d.years,4,"0"),M:this.$d.months,MM:c.s(this.$d.months,2,"0"),D:this.$d.days,DD:c.s(this.$d.days,2,"0"),H:this.$d.hours,HH:c.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:c.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:c.s(this.$d.seconds,2,"0"),SSS:c.s(this.$d.milliseconds,3,"0")};return le.replace(C,function(te,Ne){return Ne||String(X[te])})},F.as=function(W){return this.$ms/Y[ne(W)]},F.get=function(W){var le=this.$ms,X=ne(W);return X==="milliseconds"?le%=1e3:le=X==="weeks"?ue(le/Y[X]):this.$d[X],le||0},F.add=function(W,le,X){var te;return te=le?W*Y[ne(le)]:M(W)?W.$ms:T(W,this).$ms,T(this.$ms+te*(X?-1:1),this)},F.subtract=function(W,le){return this.add(W,le,!0)},F.locale=function(W){var le=this.clone();return le.$l=W,le},F.clone=function(){return T(this.$ms,this)},F.humanize=function(W){return u().add(this.$ms,"ms").locale(this.$l).fromNow(!W)},F.valueOf=function(){return this.asMilliseconds()},F.milliseconds=function(){return this.get("milliseconds")},F.asMilliseconds=function(){return this.as("milliseconds")},F.seconds=function(){return this.get("seconds")},F.asSeconds=function(){return this.as("seconds")},F.minutes=function(){return this.get("minutes")},F.asMinutes=function(){return this.as("minutes")},F.hours=function(){return this.get("hours")},F.asHours=function(){return this.as("hours")},F.days=function(){return this.get("days")},F.asDays=function(){return this.as("days")},F.weeks=function(){return this.get("weeks")},F.asWeeks=function(){return this.as("weeks")},F.months=function(){return this.get("months")},F.asMonths=function(){return this.as("months")},F.years=function(){return this.get("years")},F.asYears=function(){return this.as("years")},Q}(),me=function(Q,F,W){return Q.add(F.years()*W,"y").add(F.months()*W,"M").add(F.days()*W,"d").add(F.hours()*W,"h").add(F.minutes()*W,"m").add(F.seconds()*W,"s").add(F.milliseconds()*W,"ms")};return function(Q,F,W){u=W,c=W().$utils(),W.duration=function(te,Ne){var ke=W.locale();return T(te,{$l:ke},Ne)},W.isDuration=M;var le=F.prototype.add,X=F.prototype.subtract;F.prototype.add=function(te,Ne){return M(te)?me(this,te,1):le.bind(this)(te,Ne)},F.prototype.subtract=function(te,Ne){return M(te)?me(this,te,-1):X.bind(this)(te,Ne)}}})})(Js);var Ta=Js.exports;const Aa=Bn(Ta);$t.extend(Oa);$t.extend(Aa);function on(i,l){const u=$t(i),c=$t();return l==="since"?c.diff(u,"day"):u.diff(c,"day")}function _s(i){return $t(i).format("MMMM D, YYYY")}function Ma(i){return $t(i).isValid()}function Cs(){return $t().format("YYYY-MM-DD")}const Wn=({counter:i,onDelete:l,onEdit:u,onShare:c,showActions:f=!1})=>{const{user:d}=Ze(),y=(d==null?void 0:d.pubkey)===i.pubkey,p=on(i.date,i.type),C=i.type==="until"&&p<0,S=()=>i.type==="since"?p===0?"Today":`${p} days`:p===0?"Today":p>0?`${p} days`:`${Math.abs(p)} days ago`,$=()=>i.type==="since"||C?"since":"until";return s.jsx("div",{className:"bg-white rounded-lg shadow-md hover:shadow-lg transition-shadow duration-200 border border-gray-200",children:s.jsxs("div",{className:"p-6",children:[s.jsxs("div",{className:"flex items-start justify-between mb-4",children:[s.jsx(Re,{to:`/counter/${i.slug}`,className:"text-lg font-semibold text-gray-900 leading-tight hover:text-blue-600 transition-colors",children:i.title}),s.jsxs("div",{className:"flex items-center gap-2",children:[i.visibility==="private"?s.jsx(zs,{className:"w-4 h-4 text-gray-400"}):s.jsx(cn,{className:"w-4 h-4 text-gray-400"}),f&&s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(Re,{to:`/counter/${i.slug}`,className:"p-1 text-gray-400 hover:text-blue-600 transition-colors",title:"View counter",children:s.jsx(Ls,{className:"w-4 h-4"})}),c&&s.jsx("button",{onClick:()=>c(i),className:"p-1 text-gray-400 hover:text-blue-600 transition-colors",title:"Share counter",children:s.jsx(_a,{className:"w-4 h-4"})}),y&&u&&s.jsx("button",{onClick:()=>u(i),className:"p-1 text-gray-400 hover:text-green-600 transition-colors",title:"Edit counter",children:s.jsx(Ys,{className:"w-4 h-4"})}),y&&l&&s.jsx("button",{onClick:()=>l(i.slug),className:"p-1 text-gray-400 hover:text-red-600 transition-colors",title:"Delete counter",children:s.jsx(Ws,{className:"w-4 h-4"})})]})]})]}),s.jsxs("div",{className:"text-center py-4",children:[s.jsx("div",{className:`text-4xl font-bold mb-2 ${C?"text-red-600":"text-blue-600"}`,children:S()}),s.jsxs("div",{className:"text-gray-600 text-sm",children:[$()," ",_s(i.date)]})]}),s.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-500 pt-4 border-t border-gray-100",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(mt,{className:"w-4 h-4"}),s.jsx("span",{children:_s(i.date)})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(Bs,{className:"w-4 h-4"}),s.jsxs("span",{children:["Created ",new Date(i.createdAt*1e3).toLocaleDateString()]})]})]})]})})},an=({size:i="md",className:l=""})=>{const u={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};return s.jsx("div",{className:`animate-spin rounded-full border-2 border-gray-300 border-t-blue-600 ${u[i]} ${l}`})};function Rr(i,l){const{ndk:u}=Ze(),[c,f]=R.useState([]),[d,y]=R.useState(!0),[p,C]=R.useState(null),S=R.useCallback(async()=>{if(console.log("useCounters: fetchCounters called",{pubkey:i,isPublic:l,ndk:!!u}),!u){console.log("useCounters: NDK not initialized, skipping fetch"),y(!1);return}try{y(!0),C(null);const A={kinds:[5],limit:100};i&&(A.authors=[i]),console.log("useCounters: Fetching deletion events...");const Y=await u.fetchEvents(A);console.log("useCounters: Fetched deletion events:",Y.size);const M=new Set;for(const ue of Y)for(const ie of ue.tags)if(ie[0]==="a"&&ie[1]){const G=ie[1].split(":");G.length===2&&G[0]==="30078"&&M.add(G[1])}console.log("useCounters: Deleted event IDs:",Array.from(M));const T=Is(i,l);console.log("useCounters: Using filter:",T),console.log("useCounters: Fetching counter events...");const ne=await u.fetchEvents(T);console.log("useCounters: Fetched events:",ne.size);const pe=[];for(const ue of ne){if(console.log("useCounters: Processing event:",ue.id),M.has(ue.id)){console.log("useCounters: Skipping deleted event:",ue.id);continue}if(!Ks(ue,l)){console.log("useCounters: Skipping invalid counter event:",ue.id);continue}const ie=Un(ue,l);ie?(console.log("useCounters: Valid counter found:",ie.title),pe.push(ie)):console.log("useCounters: Invalid counter event:",ue.id)}console.log("useCounters: Total valid counters:",pe.length),pe.sort((ue,ie)=>ie.createdAt-ue.createdAt),f(pe)}catch(A){console.error("useCounters: Error fetching counters:",A),C("Failed to fetch counters")}finally{y(!1)}},[u,i,l]);R.useEffect(()=>{console.log("useCounters: useEffect triggered",{pubkey:i,isPublic:l,ndk:!!u}),S()},[S]);const $=R.useCallback(()=>{console.log("useCounters: Manual refetch triggered"),S()},[S]);return{counters:c,loading:d,error:p,refetch:$}}function Ka(i){const{ndk:l}=Ze(),[u,c]=R.useState(null),[f,d]=R.useState(!0),[y,p]=R.useState(null);return R.useEffect(()=>{(async()=>{if(!(!l||!i))try{d(!0),p(null);const S={kinds:[30078],ids:[i]},$=await l.fetchEvents(S);if($.size===0){p("Counter not found");return}const Y=Array.from($).sort((T,ne)=>ne.created_at-T.created_at)[0],M=Un(Y);M?c(M):p("Invalid counter data")}catch(S){console.error("Error fetching counter:",S),p("Failed to fetch counter")}finally{d(!1)}})()},[l,i]),{counter:u,loading:f,error:y}}function Qs(){const{ndk:i,user:l}=Ze(),[u,c]=R.useState(!1),[f,d]=R.useState(null);return{createCounter:async p=>{if(!i||!l)throw new Error("NDK not initialized or user not logged in");try{c(!0),d(null),console.log("Creating counter with form data:",p);const C=sn(p.date);console.log("Derived type from date:",C);const S={kind:30078,content:"",tags:[["type",C],["title",p.title],["date",p.date],["visibility",p.visibility]],created_at:Math.floor(Date.now()/1e3),pubkey:l.pubkey};console.log("Event data:",S);const $=new Pt(i,S);console.log("NDK event created:",$),console.log("Signing event..."),await $.sign(),console.log("Event signed successfully"),console.log("Publishing event..."),await $.publish(),console.log("Event published successfully");const A=Un($);if(!A)throw new Error("Failed to parse created counter");return console.log("Counter created successfully:",A),A}catch(C){console.error("Error creating counter:",C);const S=C instanceof Error?C.message:"Failed to create counter";throw d(S),C}finally{c(!1)}},loading:u,error:f}}function Gs(){const{publishEvent:i}=Ze(),[l,u]=R.useState(!1),[c,f]=R.useState(null);return{deleteCounter:async y=>{try{u(!0),f(null);const p={kind:5,content:"Deleted counter",tags:[["a",`30078:${y}`]],created_at:Math.floor(Date.now()/1e3)};return await i(p)}catch(p){throw console.error("Error deleting counter:",p),f("Failed to delete counter"),p}finally{u(!1)}},loading:l,error:c}}const Ia=()=>{const{isConnected:i,ndk:l}=Ze(),{counters:u,loading:c,error:f,refetch:d}=Rr(void 0,!0);console.log("Home: Render state",{isConnected:i,ndkConnected:!!l,countersCount:u.length,loading:c,error:f});const y=Ir.useMemo(()=>[...u].sort((C,S)=>{const $=on(C.date,C.type),A=on(S.date,S.type);return Math.abs(A)-Math.abs($)}).slice(0,6),[u]);return s.jsxs("div",{className:"min-h-screen bg-gray-50",children:[s.jsx("div",{className:"bg-gradient-to-br from-blue-600 to-purple-700 text-white",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-20",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-4xl md:text-6xl font-bold mb-6",children:"Track Your Life Milestones"}),s.jsx("p",{className:"text-xl md:text-2xl mb-8 text-blue-100 max-w-3xl mx-auto",children:"Count the days since your last achievement or until your next big event. Built on Nostr."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[i?s.jsxs(Re,{to:"/dashboard",className:"inline-flex items-center gap-2 px-8 py-3 bg-white text-blue-600 rounded-lg font-semibold hover:bg-blue-50 transition-colors",children:[s.jsx(qt,{className:"w-5 h-5"}),"Create Your First Counter"]}):s.jsxs("button",{onClick:()=>window.scrollTo({top:800,behavior:"smooth"}),className:"inline-flex items-center gap-2 px-8 py-3 bg-white text-blue-600 rounded-lg font-semibold hover:bg-blue-50 transition-colors",children:[s.jsx(mt,{className:"w-5 h-5"}),"Get Started"]}),s.jsxs(Re,{to:"/browse",className:"inline-flex items-center gap-2 px-8 py-3 border-2 border-white text-white rounded-lg font-semibold hover:bg-white hover:text-blue-600 transition-colors",children:[s.jsx(cn,{className:"w-5 h-5"}),"Browse Public Counters"]})]})]})})}),s.jsx("div",{className:"py-20 bg-white",children:s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[s.jsxs("div",{className:"text-center mb-16",children:[s.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-gray-900 mb-4",children:"Why NostrCount?"}),s.jsx("p",{className:"text-xl text-gray-600 max-w-2xl mx-auto",children:"Experience the future of personal tracking with decentralized technology"})]}),s.jsxs("div",{className:"grid md:grid-cols-3 gap-8",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-4",children:s.jsx(Ca,{className:"w-8 h-8 text-blue-600"})}),s.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Censorship Resistant"}),s.jsx("p",{className:"text-gray-600",children:"Your data is stored on the Nostr network, ensuring no single entity can control or delete your progress."})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mx-auto mb-4",children:s.jsx(Sa,{className:"w-8 h-8 text-purple-600"})}),s.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Social & Shareable"}),s.jsx("p",{className:"text-gray-600",children:"Share your milestones with friends and family. Get support from the community on your journey."})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-yellow-100 rounded-full flex items-center justify-center mx-auto mb-4",children:s.jsx(Fn,{className:"w-8 h-8 text-yellow-600"})}),s.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Lightning Zaps"}),s.jsx("p",{className:"text-gray-600",children:"Support others on their journey with Lightning Network tips. Every sat counts!"})]})]})]})}),s.jsx("div",{className:"py-20 bg-gray-50",children:s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between mb-12",children:[s.jsxs("div",{className:"text-center md:text-left",children:[s.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-gray-900 mb-4",children:"Featured Counters"}),s.jsx("p",{className:"text-xl text-gray-600",children:"See what others are tracking and celebrating"})]}),s.jsxs("div",{className:"mt-4 md:mt-0 flex gap-2",children:[s.jsxs("button",{onClick:d,disabled:c,className:"px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors text-sm disabled:opacity-50",children:[s.jsx(ks,{className:`w-4 h-4 inline mr-1 ${c?"animate-spin":""}`}),c?"Loading...":"Refetch"]}),s.jsxs(Re,{to:"/browse",className:"inline-flex items-center gap-2 px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:["View All Counters",s.jsx(ba,{className:"w-4 h-4"})]})]})]}),c?s.jsx("div",{className:"flex justify-center items-center py-12",children:s.jsx(an,{size:"lg"})}):f?s.jsxs("div",{className:"text-center py-12",children:[s.jsx("div",{className:"w-16 h-16 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-4",children:s.jsx(ks,{className:"w-8 h-8 text-red-600"})}),s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Error Loading Counters"}),s.jsx("p",{className:"text-gray-600 mb-6",children:f}),s.jsx("button",{onClick:d,className:"px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:"Try Again"})]}):y.length>0?s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:y.map(p=>s.jsx(Re,{to:`/counter/${p.slug}`,className:"block transform hover:scale-105 transition-transform",children:s.jsx(Wn,{counter:p})},p.id))}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx("div",{className:"w-16 h-16 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-4",children:s.jsx(mt,{className:"w-8 h-8 text-gray-400"})}),s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"No public counters yet"}),s.jsx("p",{className:"text-gray-600 mb-6",children:"Be the first to create and share a public counter!"}),i&&s.jsxs(Re,{to:"/dashboard",className:"inline-flex items-center gap-2 px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:[s.jsx(qt,{className:"w-4 h-4"}),"Create First Counter"]})]})]})}),s.jsx("div",{className:"bg-blue-600 text-white py-20",children:s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 text-center",children:[s.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-4",children:"Ready to Start Tracking?"}),s.jsx("p",{className:"text-xl text-blue-100 mb-8 max-w-2xl mx-auto",children:"Join the decentralized movement. Track your progress, share your journey, and celebrate your milestones with the world."}),i?s.jsxs(Re,{to:"/dashboard",className:"inline-flex items-center gap-2 px-8 py-3 bg-white text-blue-600 rounded-lg font-semibold hover:bg-blue-50 transition-colors",children:[s.jsx(qt,{className:"w-5 h-5"}),"Create Your First Counter"]}):s.jsx("p",{className:"text-blue-100 mb-4",children:"Connect your Nostr account to get started"})]})})]})},Ra=({isOpen:i,onClose:l,onSubmit:u,initialData:c,isLoading:f=!1})=>{const[d,y]=R.useState({title:"",date:Cs(),type:"since",visibility:"private"}),[p,C]=R.useState({});R.useEffect(()=>{y(c||{title:"",date:Cs(),type:"since",visibility:"private"}),C({})},[c,i]);const S=sn(d.date),$=S==="since"?"Days Since":"Days Until",A=()=>{const T={};return d.title.trim()?d.title.length>100&&(T.title="Title must be 100 characters or less"):T.title="Title is required",d.date?Ma(d.date)||(T.date="Invalid date format"):T.date="Date is required",C(T),Object.keys(T).length===0},Y=async T=>{if(T.preventDefault(),!!A())try{const ne={...d,type:S};await u(ne),l()}catch(ne){console.error("Error submitting form:",ne)}},M=(T,ne)=>{y(pe=>({...pe,[T]:ne})),p[T]&&C(pe=>({...pe,[T]:void 0}))};return i?s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:s.jsxs("div",{className:"bg-white rounded-lg max-w-md w-full max-h-[90vh] overflow-y-auto",children:[s.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200",children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:c?"Edit Counter":"Create Counter"}),s.jsx("button",{onClick:l,className:"p-2 hover:bg-gray-100 rounded-full transition-colors",disabled:f,children:s.jsx(Yn,{className:"w-5 h-5 text-gray-500"})})]}),s.jsxs("form",{onSubmit:Y,className:"p-6 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Title"}),s.jsx("input",{type:"text",value:d.title,onChange:T=>M("title",T.target.value),className:`w-full px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 ${p.title?"border-red-500":"border-gray-300"}`,placeholder:"e.g., Quit smoking",disabled:f}),p.title&&s.jsx("p",{className:"mt-1 text-sm text-red-600",children:p.title})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Date"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:"date",value:d.date,onChange:T=>M("date",T.target.value),className:`w-full px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 ${p.date?"border-red-500":"border-gray-300"}`,disabled:f}),s.jsx(mt,{className:"absolute right-3 top-2.5 w-5 h-5 text-gray-400 pointer-events-none"})]}),p.date&&s.jsx("p",{className:"mt-1 text-sm text-red-600",children:p.date})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Counter Type"}),s.jsx("div",{className:"px-3 py-2 bg-gray-50 border border-gray-300 rounded-md",children:s.jsxs("p",{className:"text-sm text-gray-700",children:[s.jsx("span",{className:"font-medium",children:$}),s.jsx("span",{className:"text-gray-500 ml-2",children:"(auto-detected from date)"})]})})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Visibility"}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>M("visibility","private"),className:`px-4 py-2 rounded-md border font-medium transition-colors flex items-center justify-center gap-2 ${d.visibility==="private"?"bg-blue-600 text-white border-blue-600":"bg-white text-gray-700 border-gray-300 hover:bg-gray-50"}`,disabled:f,children:[s.jsx(zs,{className:"w-4 h-4"}),"Private"]}),s.jsxs("button",{type:"button",onClick:()=>M("visibility","public"),className:`px-4 py-2 rounded-md border font-medium transition-colors flex items-center justify-center gap-2 ${d.visibility==="public"?"bg-blue-600 text-white border-blue-600":"bg-white text-gray-700 border-gray-300 hover:bg-gray-50"}`,disabled:f,children:[s.jsx(cn,{className:"w-4 h-4"}),"Public"]})]})]}),s.jsxs("div",{className:"flex gap-3 pt-4",children:[s.jsx("button",{type:"button",onClick:l,className:"flex-1 px-4 py-2 text-gray-700 bg-gray-100 rounded-md hover:bg-gray-200 transition-colors font-medium",disabled:f,children:"Cancel"}),s.jsx("button",{type:"submit",className:"flex-1 px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors font-medium disabled:opacity-50",disabled:f,children:f?"Saving...":c?"Update":"Create"})]})]})]})}):null},Fa="modulepreload",qa=function(i){return"/"+i},Ss={},Xs=function(l,u,c){if(!u||u.length===0)return l();const f=document.getElementsByTagName("link");return Promise.all(u.map(d=>{if(d=qa(d),d in Ss)return;Ss[d]=!0;const y=d.endsWith(".css"),p=y?'[rel="stylesheet"]':"";if(!!c)for(let $=f.length-1;$>=0;$--){const A=f[$];if(A.href===d&&(!y||A.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${p}`))return;const S=document.createElement("link");if(S.rel=y?"stylesheet":Fa,y||(S.as="script",S.crossOrigin=""),S.href=d,document.head.appendChild(S),y)return new Promise(($,A)=>{S.addEventListener("load",$),S.addEventListener("error",()=>A(new Error(`Unable to preload CSS for ${d}`)))})})).then(()=>l()).catch(d=>{const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=d,window.dispatchEvent(y),!y.defaultPrevented)throw d})},ei=({isOpen:i,onClose:l,counter:u,onUpdate:c})=>{const{publishEvent:f}=Ze(),[d,y]=R.useState({title:"",date:"",type:"since",visibility:"public"}),[p,C]=R.useState(!1);R.useEffect(()=>{i&&u&&y({title:u.title,date:u.date,type:u.type,visibility:u.visibility})},[i,u]);const S=async A=>{if(A.preventDefault(),!d.title.trim()){Le.error("Title is required");return}if(!d.date){Le.error("Date is required");return}try{C(!0);const Y={kind:30078,content:"",tags:[["type",d.type],["title",d.title],["date",d.date],["visibility",d.visibility]],created_at:Math.floor(Date.now()/1e3)};console.log("Updating counter with data:",Y);const M=await f(Y),{eventToCounter:T}=await Xs(()=>Promise.resolve().then(()=>ma),void 0),ne=T(M);if(ne)c(ne),Le.success("Counter updated successfully!"),l();else throw new Error("Failed to parse updated counter")}catch(Y){console.error("Error updating counter:",Y),Le.error("Failed to update counter. Please try again.")}finally{C(!1)}},$=()=>{p||l()};return i?s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full max-h-[90vh] overflow-y-auto",children:[s.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Edit Counter"}),s.jsx("button",{onClick:$,disabled:p,className:"text-gray-400 hover:text-gray-600 transition-colors disabled:opacity-50",children:s.jsx(Yn,{className:"w-5 h-5"})})]}),s.jsxs("form",{onSubmit:S,className:"p-6 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Title"}),s.jsx("input",{type:"text",value:d.title,onChange:A=>y({...d,title:A.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"Enter counter title",disabled:p,required:!0})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Date"}),s.jsx("input",{type:"date",value:d.date,onChange:A=>y({...d,date:A.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",disabled:p,required:!0})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Type"}),s.jsxs("select",{value:d.type,onChange:A=>y({...d,type:A.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",disabled:p,children:[s.jsx("option",{value:"since",children:"Days Since"}),s.jsx("option",{value:"until",children:"Days Until"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Visibility"}),s.jsxs("select",{value:d.visibility,onChange:A=>y({...d,visibility:A.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",disabled:p,children:[s.jsx("option",{value:"public",children:"Public"}),s.jsx("option",{value:"private",children:"Private"})]})]}),s.jsxs("div",{className:"flex items-center justify-end gap-3 pt-4 border-t border-gray-200",children:[s.jsx("button",{type:"button",onClick:$,disabled:p,className:"px-4 py-2 text-gray-700 bg-gray-100 rounded-lg font-medium hover:bg-gray-200 transition-colors disabled:opacity-50",children:"Cancel"}),s.jsx("button",{type:"submit",disabled:p||!d.title.trim()||!d.date,className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg font-medium hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:p?s.jsxs(s.Fragment,{children:[s.jsx(Us,{className:"w-4 h-4 animate-spin"}),"Updating..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Na,{className:"w-4 h-4"}),"Update Counter"]})})]})]})]})}):null},Ba=()=>{const{user:i,isConnected:l}=Ze(),{counters:u,loading:c,refetch:f}=Rr(i==null?void 0:i.pubkey),{createCounter:d,loading:y}=Qs(),{deleteCounter:p}=Gs(),[C,S]=R.useState(!1),[$,A]=R.useState(!1),[Y,M]=R.useState(null),[T,ne]=R.useState(""),[pe,ue]=R.useState("all"),[ie,G]=R.useState("all");if(!l)return s.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Please log in to access your dashboard"}),s.jsx("p",{className:"text-gray-600",children:"Connect your Nostr account to create and manage your counters."})]})});const de=u.filter(X=>{const te=X.title.toLowerCase().includes(T.toLowerCase()),Ne=pe==="all"||X.type===pe,ke=ie==="all"||X.visibility===ie;return te&&Ne&&ke}),me=async X=>{try{await d(X),Le.success("Counter created successfully!"),f()}catch{Le.error("Failed to create counter. Please try again.")}},Q=async X=>{if(window.confirm("Are you sure you want to delete this counter?"))try{await p(X),Le.success("Counter deleted successfully!"),f()}catch{Le.error("Failed to delete counter. Please try again.")}},F=X=>{const te=`${window.location.origin}/counter/${X.slug}`;navigator.clipboard.writeText(te),Le.success("Counter link copied to clipboard!")},W=X=>{M(X),A(!0)},le=()=>{f()};return s.jsx("div",{className:"min-h-screen bg-gray-50",children:s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-2",children:"My Counters"}),s.jsx("p",{className:"text-gray-600",children:"Track your progress and celebrate your milestones"})]}),s.jsxs("button",{onClick:()=>S(!0),className:"mt-4 md:mt-0 inline-flex items-center gap-2 px-6 py-3 bg-blue-600 text-white rounded-lg font-medium hover:bg-blue-700 transition-colors",children:[s.jsx(qt,{className:"w-5 h-5"}),"Create Counter"]})]}),s.jsx("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 mb-6",children:s.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[s.jsx("div",{className:"flex-1",children:s.jsxs("div",{className:"relative",children:[s.jsx(Kr,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),s.jsx("input",{type:"text",placeholder:"Search counters...",value:T,onChange:X=>ne(X.target.value),className:"w-full pl-10 pr-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]})}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("select",{value:pe,onChange:X=>ue(X.target.value),className:"px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",children:[s.jsx("option",{value:"all",children:"All Types"}),s.jsx("option",{value:"since",children:"Days Since"}),s.jsx("option",{value:"until",children:"Days Until"})]}),s.jsxs("select",{value:ie,onChange:X=>G(X.target.value),className:"px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",children:[s.jsx("option",{value:"all",children:"All Visibility"}),s.jsx("option",{value:"public",children:"Public"}),s.jsx("option",{value:"private",children:"Private"})]})]})]})}),c?s.jsx("div",{className:"flex justify-center items-center py-12",children:s.jsx(an,{size:"lg"})}):de.length>0?s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:de.map(X=>s.jsx(Wn,{counter:X,onDelete:Q,onEdit:W,onShare:F,showActions:!0},X.id))}):s.jsx("div",{className:"text-center py-12",children:s.jsx("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-12",children:u.length===0?s.jsxs(s.Fragment,{children:[s.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No counters yet"}),s.jsx("p",{className:"text-gray-500 mb-6",children:"Create your first counter to start tracking your progress"}),s.jsxs("button",{onClick:()=>S(!0),className:"inline-flex items-center gap-2 px-6 py-3 bg-blue-600 text-white rounded-lg font-medium hover:bg-blue-700 transition-colors",children:[s.jsx(qt,{className:"w-5 h-5"}),"Create Your First Counter"]})]}):s.jsxs(s.Fragment,{children:[s.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No counters match your filters"}),s.jsx("p",{className:"text-gray-500",children:"Try adjusting your search or filter settings"})]})})}),s.jsx(Ra,{isOpen:C,onClose:()=>S(!1),onSubmit:me,isLoading:y}),Y&&s.jsx(ei,{isOpen:$,onClose:()=>{A(!1),M(null)},counter:Y,onUpdate:le})]})})},La=({counter:i,userProfile:l,className:u=""})=>{const[c,f]=R.useState(!1),[d,y]=R.useState(1e3),[p,C]=R.useState(""),[S,$]=R.useState(!1),A=l?Fs(l):null;if(!A)return null;const Y=async()=>{if(A)try{f(!0);const T=`lightning:${A}?amount=${d}&comment=${encodeURIComponent(p||`Zapped ${i.title}`)}`;window.open(T,"_blank"),$(!1)}catch(T){console.error("Error creating zap:",T)}finally{f(!1)}},M=[100,500,1e3,5e3,1e4];return S?s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:s.jsxs("div",{className:"bg-white rounded-lg max-w-md w-full p-6",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("h3",{className:"text-lg font-semibold text-gray-900",children:["Zap ",i.title]}),s.jsx("button",{onClick:()=>$(!1),className:"text-gray-400 hover:text-gray-600",children:"×"})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Amount (sats)"}),s.jsx("div",{className:"grid grid-cols-3 gap-2 mb-2",children:M.map(T=>s.jsx("button",{onClick:()=>y(T),className:`px-3 py-2 rounded-md border font-medium transition-colors ${d===T?"bg-yellow-500 text-white border-yellow-500":"bg-white text-gray-700 border-gray-300 hover:bg-gray-50"}`,children:T},T))}),s.jsx("input",{type:"number",value:d,onChange:T=>y(Number(T.target.value)),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-yellow-500",placeholder:"Custom amount",min:"1"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Comment (optional)"}),s.jsx("textarea",{value:p,onChange:T=>C(T.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-yellow-500",rows:3,placeholder:"Add a comment..."})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{onClick:()=>$(!1),className:"flex-1 px-4 py-2 text-gray-700 bg-gray-100 rounded-md hover:bg-gray-200 transition-colors font-medium",children:"Cancel"}),s.jsxs("button",{onClick:Y,disabled:c,className:"flex-1 px-4 py-2 bg-yellow-500 text-white rounded-md hover:bg-yellow-600 transition-colors font-medium disabled:opacity-50 flex items-center justify-center gap-2",children:[s.jsx(Fn,{className:"w-4 h-4"}),c?"Creating...":"Zap"]})]})]})]})}):s.jsxs("button",{onClick:()=>$(!0),className:`inline-flex items-center gap-2 px-4 py-2 bg-yellow-500 text-white rounded-md hover:bg-yellow-600 transition-colors font-medium ${u}`,children:[s.jsx(Fn,{className:"w-4 h-4"}),"Zap"]})},za=({isOpen:i,onClose:l,counter:u})=>{const{ndk:c,user:f}=Ze(),[d,y]=R.useState(""),[p,C]=R.useState(!1),S=`Check out my ${u.type==="since"?"progress":"countdown"}: ${u.title}`;Ir.useEffect(()=>{i&&y(S)},[i,S]);const $=async()=>{if(!c||!f){Le.error("Please log in to share on Nostr");return}if(!d.trim()){Le.error("Please enter a message to share");return}try{C(!0);const{NDKEvent:Y}=await Xs(()=>import("./ndk-40656944.js").then(T=>T.j),[]),M=new Y(c);M.kind=1,M.content=d,M.tags=[["e",u.id,"","mention"],["p",u.pubkey,"","mention"]],console.log("Publishing Nostr share event:",{content:M.content,tags:M.tags,kind:M.kind}),await M.sign(),await M.publish(),Le.success("Shared on Nostr successfully!"),l()}catch(Y){console.error("Error publishing Nostr share:",Y),Le.error("Failed to share on Nostr. Please try again.")}finally{C(!1)}},A=()=>{p||l()};return i?s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full max-h-[80vh] overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Share on Nostr"}),s.jsx("button",{onClick:A,disabled:p,className:"text-gray-400 hover:text-gray-600 transition-colors disabled:opacity-50",children:s.jsx(Yn,{className:"w-5 h-5"})})]}),s.jsxs("div",{className:"p-6",children:[s.jsxs("div",{className:"mb-4",children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Your message"}),s.jsx("textarea",{value:d,onChange:Y=>y(Y.target.value),placeholder:"Write your message...",className:"w-full h-32 px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none",disabled:p})]}),s.jsx("div",{className:"text-xs text-gray-500 mb-4",children:"This will publish a NIP-1 text note that references the counter."}),s.jsxs("div",{className:"bg-gray-50 rounded-lg p-4 mb-4",children:[s.jsx("div",{className:"text-sm text-gray-600 mb-2",children:"Sharing counter:"}),s.jsx("div",{className:"font-medium text-gray-900",children:u.title}),s.jsxs("div",{className:"text-sm text-gray-600",children:[u.type==="since"?"Days since":"Days until"," ",new Date(u.date).toLocaleDateString()]})]})]}),s.jsxs("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-gray-200",children:[s.jsx("button",{onClick:A,disabled:p,className:"px-4 py-2 text-gray-700 bg-gray-100 rounded-lg font-medium hover:bg-gray-200 transition-colors disabled:opacity-50",children:"Cancel"}),s.jsx("button",{onClick:$,disabled:p||!d.trim(),className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg font-medium hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:p?s.jsxs(s.Fragment,{children:[s.jsx(Us,{className:"w-4 h-4 animate-spin"}),"Publishing..."]}):s.jsxs(s.Fragment,{children:[s.jsx(ka,{className:"w-4 h-4"}),"Share on Nostr"]})})]})]})}):null},Ua=()=>{const{slug:i}=Mi(),{counter:l,loading:u,error:c}=Ka(i),{fetchUserProfile:f,user:d}=Ze(),{deleteCounter:y}=Gs(),[p,C]=R.useState(null),[S,$]=R.useState(!1),[A,Y]=R.useState(!1),[M,T]=R.useState(!1);R.useEffect(()=>{l&&l.pubkey&&($(!0),f(l.pubkey).then(C).catch(console.error).finally(()=>$(!1)))},[l,f]);const ne=()=>{const me=window.location.href;navigator.clipboard.writeText(me),Le.success("Counter link copied to clipboard!")},pe=()=>{l&&Y(!0)},ue=()=>{l&&T(!0)},ie=async()=>{if(l&&window.confirm("Are you sure you want to delete this counter?"))try{await y(l.slug),Le.success("Counter deleted successfully!"),window.location.href="/"}catch{Le.error("Failed to delete counter. Please try again.")}},G=()=>{window.location.reload()},de=(d==null?void 0:d.pubkey)===(l==null?void 0:l.pubkey);return u?s.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:s.jsx(an,{size:"lg"})}):c||!l?s.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Counter not found"}),s.jsx("p",{className:"text-gray-600 mb-6",children:"The counter you're looking for doesn't exist or has been deleted."}),s.jsxs(Re,{to:"/",className:"inline-flex items-center gap-2 px-6 py-3 bg-blue-600 text-white rounded-lg font-medium hover:bg-blue-700 transition-colors",children:[s.jsx(js,{className:"w-4 h-4"}),"Back to Home"]})]})}):s.jsxs("div",{className:"min-h-screen bg-gray-50",children:[s.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[s.jsxs(Re,{to:"/",className:"inline-flex items-center gap-2 text-gray-600 hover:text-gray-900 mb-8 font-medium",children:[s.jsx(js,{className:"w-4 h-4"}),"Back to Home"]}),s.jsx("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden",children:s.jsx("div",{className:"p-8",children:s.jsx("div",{className:"max-w-md mx-auto",children:s.jsx(Wn,{counter:l})})})}),s.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 mt-6 p-6",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Counter Details"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Vs,{className:"w-5 h-5 text-gray-400"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-600",children:"Created by:"}),S?s.jsx(an,{size:"sm",className:"ml-2"}):s.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[(p==null?void 0:p.picture)&&s.jsx("img",{src:p.picture,alt:p.name||"Author",className:"w-6 h-6 rounded-full"}),s.jsx("span",{className:"font-medium text-gray-900",children:(p==null?void 0:p.display_name)||(p==null?void 0:p.name)||`${l.pubkey.slice(0,8)}...${l.pubkey.slice(-8)}`})]})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(mt,{className:"w-5 h-5 text-gray-400"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-600",children:"Target date:"}),s.jsx("div",{className:"font-medium text-gray-900 mt-1",children:new Date(l.date).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Bs,{className:"w-5 h-5 text-gray-400"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-600",children:"Created:"}),s.jsx("div",{className:"font-medium text-gray-900 mt-1",children:new Date(l.createdAt*1e3).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]})]})]})]}),s.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 mt-6 p-6",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Actions"}),s.jsxs("div",{className:"flex flex-wrap gap-3",children:[s.jsxs("button",{onClick:ne,className:"inline-flex items-center gap-2 px-4 py-2 bg-gray-100 text-gray-700 rounded-lg font-medium hover:bg-gray-200 transition-colors",children:[s.jsx(Mr,{className:"w-4 h-4"}),"Copy Link"]}),s.jsxs("button",{onClick:pe,className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-500 text-white rounded-lg font-medium hover:bg-blue-600 transition-colors",children:[s.jsx(ja,{className:"w-4 h-4"}),"Share on Nostr"]}),de&&s.jsxs(s.Fragment,{children:[s.jsxs("button",{onClick:ue,className:"inline-flex items-center gap-2 px-4 py-2 bg-green-600 text-white rounded-lg font-medium hover:bg-green-700 transition-colors",children:[s.jsx(Ys,{className:"w-4 h-4"}),"Edit Counter"]}),s.jsxs("button",{onClick:ie,className:"inline-flex items-center gap-2 px-4 py-2 bg-red-600 text-white rounded-lg font-medium hover:bg-red-700 transition-colors",children:[s.jsx(Ws,{className:"w-4 h-4"}),"Delete Counter"]})]}),p&&s.jsx(La,{counter:l,userProfile:p,className:"flex-shrink-0"})]})]}),s.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 mt-6 p-6",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Nostr Details"}),s.jsxs("div",{className:"space-y-3 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-600",children:"Event ID:"}),s.jsx("code",{className:"ml-2 px-2 py-1 bg-gray-100 rounded text-xs font-mono",children:l.id})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-600",children:"Author Pubkey:"}),s.jsx("code",{className:"ml-2 px-2 py-1 bg-gray-100 rounded text-xs font-mono",children:l.pubkey})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-600",children:"Kind:"}),s.jsx("code",{className:"ml-2 px-2 py-1 bg-gray-100 rounded text-xs font-mono",children:"30078"})]})]})]})]}),l&&s.jsx(za,{isOpen:A,onClose:()=>Y(!1),counter:l}),l&&s.jsx(ei,{isOpen:M,onClose:()=>T(!1),counter:l,onUpdate:G})]})},Ya=()=>{const{counters:i,loading:l,error:u}=Rr(void 0,!0),[c,f]=R.useState(""),[d,y]=R.useState("all"),p=R.useMemo(()=>{let S=i;if(d!=="all"&&(S=S.filter($=>$.type===d)),c.trim()){const $=c.toLowerCase();S=S.filter(A=>A.title.toLowerCase().includes($)||A.date.includes($))}return S.sort(($,A)=>{const Y=on($.date,$.type),M=on(A.date,A.type);return Math.abs(M)-Math.abs(Y)}),S},[i,c,d]),C=R.useMemo(()=>{const S=i.length,$=i.filter(Y=>Y.type==="since").length,A=i.filter(Y=>Y.type==="until").length;return{total:S,since:$,until:A}},[i]);return u?s.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Error Loading Counters"}),s.jsx("p",{className:"text-gray-600 mb-4",children:u}),s.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700",children:"Try Again"})]})}):s.jsxs("div",{className:"min-h-screen bg-gray-50",children:[s.jsx("div",{className:"bg-white border-b border-gray-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-2",children:"Browse Public Counters"}),s.jsx("p",{className:"text-gray-600",children:"Discover and celebrate milestones from around the Nostr network"})]}),s.jsx("div",{className:"mt-4 md:mt-0",children:s.jsxs(Re,{to:"/dashboard",className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:[s.jsx(mt,{className:"w-4 h-4"}),"Create Counter"]})})]})})}),s.jsx("div",{className:"bg-white border-b border-gray-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-2xl font-bold text-gray-900",children:C.total}),s.jsx("div",{className:"text-sm text-gray-600",children:"Total Counters"})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-2xl font-bold text-green-600",children:C.since}),s.jsx("div",{className:"text-sm text-gray-600",children:"Days Since"})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-2xl font-bold text-blue-600",children:C.until}),s.jsx("div",{className:"text-sm text-gray-600",children:"Days Until"})]})]})})}),s.jsx("div",{className:"bg-white border-b border-gray-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6",children:s.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[s.jsxs("div",{className:"flex-1 relative",children:[s.jsx(Kr,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-gray-400"}),s.jsx("input",{type:"text",placeholder:"Search counters by title or date...",value:c,onChange:S=>f(S.target.value),className:"w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>y("all"),className:`px-4 py-2 rounded-lg font-medium transition-colors ${d==="all"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200"}`,children:"All"}),s.jsxs("button",{onClick:()=>y("since"),className:`px-4 py-2 rounded-lg font-medium transition-colors flex items-center gap-1 ${d==="since"?"bg-green-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200"}`,children:[s.jsx(cn,{className:"w-4 h-4"}),"Since"]}),s.jsxs("button",{onClick:()=>y("until"),className:`px-4 py-2 rounded-lg font-medium transition-colors flex items-center gap-1 ${d==="until"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200"}`,children:[s.jsx(mt,{className:"w-4 h-4"}),"Until"]})]})]})})}),s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:l?s.jsx("div",{className:"flex justify-center items-center py-12",children:s.jsx(an,{size:"lg"})}):p.length>0?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mb-6",children:s.jsxs("p",{className:"text-gray-600",children:["Showing ",p.length," of ",i.length," counters"]})}),s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:p.map(S=>s.jsx(Re,{to:`/counter/${S.slug}`,className:"block transform hover:scale-105 transition-transform",children:s.jsx(Wn,{counter:S})},S.id))})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx("div",{className:"w-16 h-16 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-4",children:s.jsx(Kr,{className:"w-8 h-8 text-gray-400"})}),s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:c||d!=="all"?"No counters found":"No public counters yet"}),s.jsx("p",{className:"text-gray-600 mb-6",children:c||d!=="all"?"Try adjusting your search terms or filters":"Be the first to create and share a public counter!"}),!c&&d==="all"&&s.jsxs(Re,{to:"/dashboard",className:"inline-flex items-center gap-2 px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:[s.jsx(mt,{className:"w-4 h-4"}),"Create First Counter"]})]})})]})},Wa=()=>{const{isConnected:i,login:l,ndk:u,user:c}=Ze(),{createCounter:f,loading:d,error:y}=Qs(),[p,C]=R.useState(""),S=async()=>{try{C("Testing counter creation...");const T={title:"Test Counter",date:"2024-01-01",type:"since",visibility:"public"};console.log("Creating test counter with data:",T);const ne=await f(T);console.log("Test counter created:",ne),C(`✅ Counter created successfully! Event ID: ${ne.id}`)}catch(T){console.error("Test failed:",T),C(`❌ Test failed: ${T instanceof Error?T.message:"Unknown error"}`)}},$=async()=>{try{if(C("Testing NDK connection..."),!u){C("❌ NDK not initialized");return}const T={kinds:[1],limit:1},ne=await u.fetchEvents(T);C(`✅ NDK connection working! Found ${ne.size} events`)}catch(T){console.error("Connection test failed:",T),C(`❌ Connection test failed: ${T instanceof Error?T.message:"Unknown error"}`)}},A=async()=>{if(!u||!c){C("❌ NDK not initialized or user not logged in");return}try{C("Creating simple counter...");const T={kind:30078,content:"",tags:[["type","since"],["title","Simple Test"],["date","2024-01-01"],["visibility","public"]],created_at:Math.floor(Date.now()/1e3),pubkey:c.pubkey};console.log("Simple event data:",T);const ne=new Pt(u,T);console.log("Simple event created:",ne),console.log("Event tags:",ne.tags),console.log("Event kind:",ne.kind),console.log("Signing simple event..."),await ne.sign(),console.log("Simple event signed successfully"),console.log("Publishing simple event..."),await ne.publish(),console.log("Simple event published successfully"),C(`✅ Simple counter created! Event ID: ${ne.id}`)}catch(T){console.error("Simple test failed:",T),C(`❌ Simple test failed: ${T instanceof Error?T.message:"Unknown error"}`)}},Y=async()=>{if(!u||!c){C("❌ NDK not initialized or user not logged in");return}try{C("Creating counter manually...");const T="2024-01-01",ne=sn(T);console.log("Test date:",T),console.log("Derived type:",ne);const pe={kind:30078,content:"",tags:[["type",ne],["title","Manual Test Counter"],["date",T],["visibility","public"]],created_at:Math.floor(Date.now()/1e3),pubkey:c.pubkey};console.log("Manual event data:",pe);const ue=new Pt(u,pe);console.log("Event created with tags:",ue.tags),console.log("Signing event..."),await ue.sign(),console.log("Event signed successfully"),console.log("Publishing event..."),await ue.publish(),console.log("Event published successfully"),C(`✅ Manual counter created! Event ID: ${ue.id}`)}catch(T){console.error("Manual test failed:",T),C(`❌ Manual test failed: ${T instanceof Error?T.message:"Unknown error"}`)}},M=()=>{const T=[{date:"2023-01-01",expected:"since"},{date:"2024-01-01",expected:"since"},{date:"2025-01-01",expected:"until"},{date:new Date().toISOString().split("T")[0],expected:"since"}];let ne=`Testing type derivation: +`;T.forEach(({date:pe,expected:ue})=>{const ie=sn(pe);ne+=`${ie===ue?"✅":"❌"} ${pe} → ${ie} (expected: ${ue}) +`}),C(ne)};return s.jsx("div",{className:"min-h-screen bg-gray-50 p-8",children:s.jsxs("div",{className:"max-w-2xl mx-auto",children:[s.jsx("h1",{className:"text-3xl font-bold mb-8",children:"NostrCount Test Page"}),s.jsxs("div",{className:"bg-white rounded-lg shadow p-6 mb-6",children:[s.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Connection Status"}),s.jsxs("p",{className:"mb-4",children:[s.jsx("strong",{children:"Connected:"})," ",i?"✅ Yes":"❌ No"]}),!i&&s.jsx("button",{onClick:l,className:"bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700",children:"Connect Nostr Extension"})]}),s.jsxs("div",{className:"bg-white rounded-lg shadow p-6 mb-6",children:[s.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Connection Test"}),s.jsx("button",{onClick:$,className:"bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700 mr-2",children:"Test NDK Connection"}),p&&s.jsx("div",{className:"mt-4 p-4 bg-gray-100 rounded",children:s.jsx("pre",{className:"text-sm whitespace-pre-wrap",children:p})})]}),s.jsxs("div",{className:"bg-white rounded-lg shadow p-6 mb-6",children:[s.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Type Derivation Test"}),s.jsx("button",{onClick:M,className:"bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700",children:"Test Type Derivation"})]}),s.jsxs("div",{className:"bg-white rounded-lg shadow p-6 mb-6",children:[s.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Counter Creation Tests"}),i?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("button",{onClick:S,disabled:d,className:"bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700 disabled:opacity-50 mr-2",children:d?"Creating...":"Create Test Counter (Hook)"}),s.jsx("button",{onClick:Y,className:"bg-purple-600 text-white px-4 py-2 rounded hover:bg-purple-700 mr-2",children:"Create Manual Counter"}),s.jsx("button",{onClick:A,className:"bg-orange-600 text-white px-4 py-2 rounded hover:bg-orange-700",children:"Simple Test"})]}),y&&s.jsxs("p",{className:"text-red-600 mt-2",children:["Error: ",y]})]}):s.jsx("p",{className:"text-gray-600",children:"Please connect your Nostr extension first."})]}),s.jsxs("div",{className:"bg-white rounded-lg shadow p-6",children:[s.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Debug Information"}),s.jsx("p",{className:"text-sm text-gray-600",children:"Check the browser console for detailed logs about the counter creation process."}),c&&s.jsx("div",{className:"mt-4 p-4 bg-gray-100 rounded",children:s.jsxs("p",{className:"text-sm",children:[s.jsx("strong",{children:"User Pubkey:"})," ",c.pubkey]})})]})]})})};function Va(){return s.jsx(pa,{children:s.jsx(Ki,{children:s.jsxs("div",{className:"min-h-screen bg-gray-50",children:[s.jsx(Da,{}),s.jsx("main",{children:s.jsxs(Ii,{children:[s.jsx(en,{path:"/",element:s.jsx(Ia,{})}),s.jsx(en,{path:"/dashboard",element:s.jsx(Ba,{})}),s.jsx(en,{path:"/counter/:slug",element:s.jsx(Ua,{})}),s.jsx(en,{path:"/browse",element:s.jsx(Ya,{})}),s.jsx(en,{path:"/test",element:s.jsx(Wa,{})})]})}),s.jsx(qo,{position:"top-right",toastOptions:{duration:4e3,style:{background:"#363636",color:"#fff"}}})]})})})}Pr.createRoot(document.getElementById("root")).render(s.jsx(Ir.StrictMode,{children:s.jsx(Va,{})})); diff --git a/dist/assets/ndk-40656944.js b/dist/assets/ndk-40656944.js new file mode 100644 index 0000000..00e9bec --- /dev/null +++ b/dist/assets/ndk-40656944.js @@ -0,0 +1,81 @@ +var Ge=Object.defineProperty;var Ke=(n,e,t)=>e in n?Ge(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var g=(n,e,t)=>(Ke(n,typeof e!="symbol"?e+"":e,t),t);var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};function getDefaultExportFromCjs(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var lib$1={},types={};Object.defineProperty(types,"__esModule",{value:!0});var ee={},taskCollection$1={},taskCollection={},utils$1={};Object.defineProperty(utils$1,"__esModule",{value:!0});utils$1._fast_remove_single=void 0;function _fast_remove_single(n,e){e!==-1&&(e===0?n.shift():e===n.length-1?n.length=n.length-1:n.splice(e,1))}utils$1._fast_remove_single=_fast_remove_single;var bakeCollection={};(function(exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.bakeCollectionVariadic=exports.bakeCollectionAwait=exports.bakeCollection=exports.BAKED_EMPTY_FUNC=void 0,exports.BAKED_EMPTY_FUNC=function(){};var FORLOOP_FALLBACK=1500;function generateArgsDefCode(n){var e="";if(n===0)return e;for(var t=0;t1)if(e){var r;(r=this._tasks).push.apply(r,arguments),this.length+=arguments.length}else this._tasks.push(n),this.length++;else if(e){if(t===1){var s=Array(1+arguments.length);s.push(s),s.push.apply(s,arguments),this._tasks=s}else{var s=Array(arguments.length);s.push.apply(s,arguments),this._tasks=s}this.length+=arguments.length}else t===1?this._tasks=[this._tasks,n]:this._tasks=n,this.length++}function push_rebuild(n,e){var t=this.length;if(t>1)if(e){var r;(r=this._tasks).push.apply(r,arguments),this.length+=arguments.length}else this._tasks.push(n),this.length++;else if(e){if(t===1){var s=Array(1+arguments.length);s.push(s),s.push.apply(s,arguments),this._tasks=s}else{var s=Array(arguments.length);s.push.apply(s,arguments),this._tasks=s}this.length+=arguments.length}else t===1?this._tasks=[this._tasks,n]:this._tasks=n,this.length++;this.firstEmitBuildStrategy?this.call=rebuild_on_first_call:this.rebuild()}function removeLast_norebuild(n){this.length!==0&&(this.length===1?this._tasks===n&&(this.length=0):((0,utils_1$1._fast_remove_single)(this._tasks,this._tasks.lastIndexOf(n)),this._tasks.length===1?(this._tasks=this._tasks[0],this.length=1):this.length=this._tasks.length))}function removeLast_rebuild(n){if(this.length!==0){if(this.length===1)if(this._tasks===n&&(this.length=0),this.firstEmitBuildStrategy){this.call=bake_collection_1.BAKED_EMPTY_FUNC;return}else{this.rebuild();return}else(0,utils_1$1._fast_remove_single)(this._tasks,this._tasks.lastIndexOf(n)),this._tasks.length===1?(this._tasks=this._tasks[0],this.length=1):this.length=this._tasks.length;this.firstEmitBuildStrategy?this.call=rebuild_on_first_call:this.rebuild()}}function insert_norebuild(n){for(var e,t=[],r=1;r0)return a(h);if(p==="number"&&isFinite(h))return u.long?l(h):c(h);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(h))};function a(h){if(h=String(h),!(h.length>100)){var u=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(h);if(u){var p=parseFloat(u[1]),y=(u[2]||"ms").toLowerCase();switch(y){case"years":case"year":case"yrs":case"yr":case"y":return p*o;case"weeks":case"week":case"w":return p*s;case"days":case"day":case"d":return p*r;case"hours":case"hour":case"hrs":case"hr":case"h":return p*t;case"minutes":case"minute":case"mins":case"min":case"m":return p*e;case"seconds":case"second":case"secs":case"sec":case"s":return p*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return p;default:return}}}}function c(h){var u=Math.abs(h);return u>=r?Math.round(h/r)+"d":u>=t?Math.round(h/t)+"h":u>=e?Math.round(h/e)+"m":u>=n?Math.round(h/n)+"s":h+"ms"}function l(h){var u=Math.abs(h);return u>=r?f(h,u,r,"day"):u>=t?f(h,u,t,"hour"):u>=e?f(h,u,e,"minute"):u>=n?f(h,u,n,"second"):h+" ms"}function f(h,u,p,y){var b=u>=p*1.5;return Math.round(h/p)+" "+y+(b?"s":"")}return ms}function setup(n){t.debug=t,t.default=t,t.coerce=l,t.disable=a,t.enable=s,t.enabled=c,t.humanize=requireMs(),t.destroy=f,Object.keys(n).forEach(h=>{t[h]=n[h]}),t.names=[],t.skips=[],t.formatters={};function e(h){let u=0;for(let p=0;p{if(C==="%%")return"%";U++;const F=t.formatters[M];if(typeof F=="function"){const O=k[U];C=F.call(R,O),k.splice(U,1),U--}return C}),t.formatArgs.call(R,k),(R.log||t.log).apply(R,k)}return m.namespace=h,m.useColors=t.useColors(),m.color=t.selectColor(h),m.extend=r,m.destroy=t.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(y!==t.namespaces&&(y=t.namespaces,b=t.enabled(h)),b),set:k=>{p=k}}),typeof t.init=="function"&&t.init(m),m}function r(h,u){const p=t(this.namespace+(typeof u>"u"?":":u)+h);return p.log=this.log,p}function s(h){t.save(h),t.namespaces=h,t.names=[],t.skips=[];const u=(typeof h=="string"?h:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const p of u)p[0]==="-"?t.skips.push(p.slice(1)):t.names.push(p)}function o(h,u){let p=0,y=0,b=-1,m=0;for(;p"-"+u)].join(",");return t.enable(""),h}function c(h){for(const u of t.skips)if(o(h,u))return!1;for(const u of t.names)if(o(h,u))return!0;return!1}function l(h){return h instanceof Error?h.stack||h.message:h}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}var common=setup;(function(n,e){e.formatArgs=r,e.save=s,e.load=o,e.useColors=t,e.storage=a(),e.destroy=(()=>{let l=!1;return()=>{l||(l=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function t(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let l;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(l=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(l[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+n.exports.humanize(this.diff),!this.useColors)return;const f="color: "+this.color;l.splice(1,0,f,"color: inherit");let h=0,u=0;l[0].replace(/%[a-zA-Z%]/g,p=>{p!=="%%"&&(h++,p==="%c"&&(u=h))}),l.splice(u,0,f)}e.log=console.debug||console.log||(()=>{});function s(l){try{l?e.storage.setItem("debug",l):e.storage.removeItem("debug")}catch{}}function o(){let l;try{l=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch{}return!l&&typeof process<"u"&&"env"in process&&(l={}.DEBUG),l}function a(){try{return localStorage}catch{}}n.exports=common(e);const{formatters:c}=n.exports;c.j=function(l){try{return JSON.stringify(l)}catch(f){return"[UnexpectedJSONParseError]: "+f.message}}})(browser,browser.exports);var browserExports=browser.exports;const createDebug2=getDefaultExportFromCjs(browserExports);function number$2(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function bytes$2(n,...e){if(!(n instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(n.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${n.length}`)}function hash$1(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$2(n.outputLen),number$2(n.blockLen)}function exists$1(n,e=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(e&&n.finished)throw new Error("Hash#digest() has already been called")}function output$1(n,e){bytes$2(n);const t=e.outputLen;if(n.lengthn instanceof Uint8Array,createView$2=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),rotr$2=(n,e)=>n<<32-e|n>>>e,isLE$2=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE$2)throw new Error("Non little-endian hardware is not supported");function utf8ToBytes$3(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function toBytes$2(n){if(typeof n=="string"&&(n=utf8ToBytes$3(n)),!u8a$2(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}function concatBytes$3(...n){const e=new Uint8Array(n.reduce((r,s)=>r+s.length,0));let t=0;return n.forEach(r=>{if(!u8a$2(r))throw new Error("Uint8Array expected");e.set(r,t),t+=r.length}),e}let Hash$2=class{clone(){return this._cloneInto()}};function wrapConstructor$1(n){const e=r=>n().update(toBytes$2(r)).digest(),t=n();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>n(),e}function randomBytes$2(n=32){if(crypto$2&&typeof crypto$2.getRandomValues=="function")return crypto$2.getRandomValues(new Uint8Array(n));throw new Error("crypto.getRandomValues must be defined")}function setBigUint64$2(n,e,t,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(e,t,r);const s=BigInt(32),o=BigInt(4294967295),a=Number(t>>s&o),c=Number(t&o),l=r?4:0,f=r?0:4;n.setUint32(e+l,a,r),n.setUint32(e+f,c,r)}let SHA2$1=class extends Hash$2{constructor(e,t,r,s){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=createView$2(this.buffer)}update(e){exists$1(this);const{view:t,buffer:r,blockLen:s}=this;e=toBytes$2(e);const o=e.length;for(let a=0;as-a&&(this.process(r,0),a=0);for(let u=a;uh.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;un&e^~n&t,Maj$2=(n,e,t)=>n&e^n&t^e&t,SHA256_K$2=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),IV$1=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W$2=new Uint32Array(64);let SHA256$2=class extends SHA2$1{constructor(){super(64,32,8,!1),this.A=IV$1[0]|0,this.B=IV$1[1]|0,this.C=IV$1[2]|0,this.D=IV$1[3]|0,this.E=IV$1[4]|0,this.F=IV$1[5]|0,this.G=IV$1[6]|0,this.H=IV$1[7]|0}get(){const{A:e,B:t,C:r,D:s,E:o,F:a,G:c,H:l}=this;return[e,t,r,s,o,a,c,l]}set(e,t,r,s,o,a,c,l){this.A=e|0,this.B=t|0,this.C=r|0,this.D=s|0,this.E=o|0,this.F=a|0,this.G=c|0,this.H=l|0}process(e,t){for(let u=0;u<16;u++,t+=4)SHA256_W$2[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const p=SHA256_W$2[u-15],y=SHA256_W$2[u-2],b=rotr$2(p,7)^rotr$2(p,18)^p>>>3,m=rotr$2(y,17)^rotr$2(y,19)^y>>>10;SHA256_W$2[u]=m+SHA256_W$2[u-7]+b+SHA256_W$2[u-16]|0}let{A:r,B:s,C:o,D:a,E:c,F:l,G:f,H:h}=this;for(let u=0;u<64;u++){const p=rotr$2(c,6)^rotr$2(c,11)^rotr$2(c,25),y=h+p+Chi$2(c,l,f)+SHA256_K$2[u]+SHA256_W$2[u]|0,m=(rotr$2(r,2)^rotr$2(r,13)^rotr$2(r,22))+Maj$2(r,s,o)|0;h=f,f=l,l=c,c=a+y|0,a=o,o=s,s=r,r=y+m|0}r=r+this.A|0,s=s+this.B|0,o=o+this.C|0,a=a+this.D|0,c=c+this.E|0,l=l+this.F|0,f=f+this.G|0,h=h+this.H|0,this.set(r,s,o,a,c,l,f,h)}roundClean(){SHA256_W$2.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const sha256$3=wrapConstructor$1(()=>new SHA256$2);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$9=BigInt(0),_1n$9=BigInt(1),_2n$5=BigInt(2),u8a$1=n=>n instanceof Uint8Array,hexes$2=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function bytesToHex$2(n){if(!u8a$1(n))throw new Error("Uint8Array expected");let e="";for(let t=0;tr+s.length,0));let t=0;return n.forEach(r=>{if(!u8a$1(r))throw new Error("Uint8Array expected");e.set(r,t),t+=r.length}),e}function equalBytes$1(n,e){if(n.length!==e.length)return!1;for(let t=0;t_0n$9;n>>=_1n$9,e+=1);return e}function bitGet(n,e){return n>>BigInt(e)&_1n$9}const bitSet=(n,e,t)=>n|(t?_1n$9:_0n$9)<(_2n$5<new Uint8Array(n),u8fr=n=>Uint8Array.from(n);function createHmacDrbg$1(n,e,t){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let r=u8n(n),s=u8n(n),o=0;const a=()=>{r.fill(1),s.fill(0),o=0},c=(...u)=>t(s,r,...u),l=(u=u8n())=>{s=c(u8fr([0]),u),r=c(),u.length!==0&&(s=c(u8fr([1]),u),r=c())},f=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let u=0;const p=[];for(;u{a(),l(u);let y;for(;!(y=p(f()));)l();return a(),y}}const validatorFns={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||n instanceof Uint8Array,isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,e)=>e.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function validateObject(n,e,t={}){const r=(s,o,a)=>{const c=validatorFns[o];if(typeof c!="function")throw new Error(`Invalid validator "${o}", expected function`);const l=n[s];if(!(a&&l===void 0)&&!c(l,n))throw new Error(`Invalid param ${String(s)}=${l} (${typeof l}), expected ${o}`)};for(const[s,o]of Object.entries(e))r(s,o,!1);for(const[s,o]of Object.entries(t))r(s,o,!0);return n}const ut=Object.freeze(Object.defineProperty({__proto__:null,bitGet,bitLen:bitLen$1,bitMask:bitMask$1,bitSet,bytesToHex:bytesToHex$2,bytesToNumberBE:bytesToNumberBE$1,bytesToNumberLE:bytesToNumberLE$1,concatBytes:concatBytes$2,createHmacDrbg:createHmacDrbg$1,ensureBytes:ensureBytes$1,equalBytes:equalBytes$1,hexToBytes:hexToBytes$2,hexToNumber:hexToNumber$1,numberToBytesBE:numberToBytesBE$1,numberToBytesLE:numberToBytesLE$1,numberToHexUnpadded:numberToHexUnpadded$1,numberToVarBytesBE,utf8ToBytes:utf8ToBytes$2,validateObject},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$8=BigInt(0),_1n$8=BigInt(1),_2n$4=BigInt(2),_3n$3=BigInt(3),_4n$2=BigInt(4),_5n$1=BigInt(5),_8n$1=BigInt(8);BigInt(9);BigInt(16);function mod$1(n,e){const t=n%e;return t>=_0n$8?t:e+t}function pow(n,e,t){if(t<=_0n$8||e<_0n$8)throw new Error("Expected power/modulo > 0");if(t===_1n$8)return _0n$8;let r=_1n$8;for(;e>_0n$8;)e&_1n$8&&(r=r*n%t),n=n*n%t,e>>=_1n$8;return r}function pow2$1(n,e,t){let r=n;for(;e-- >_0n$8;)r*=r,r%=t;return r}function invert$1(n,e){if(n===_0n$8||e<=_0n$8)throw new Error(`invert: expected positive integers, got n=${n} mod=${e}`);let t=mod$1(n,e),r=e,s=_0n$8,o=_1n$8;for(;t!==_0n$8;){const c=r/t,l=r%t,f=s-o*c;r=t,t=l,s=o,o=f}if(r!==_1n$8)throw new Error("invert: does not exist");return mod$1(s,e)}function tonelliShanks$1(n){const e=(n-_1n$8)/_2n$4;let t,r,s;for(t=n-_1n$8,r=0;t%_2n$4===_0n$8;t/=_2n$4,r++);for(s=_2n$4;s(r[s]="function",r),e);return validateObject(n,t)}function FpPow$1(n,e,t){if(t<_0n$8)throw new Error("Expected power > 0");if(t===_0n$8)return n.ONE;if(t===_1n$8)return e;let r=n.ONE,s=e;for(;t>_0n$8;)t&_1n$8&&(r=n.mul(r,s)),s=n.sqr(s),t>>=_1n$8;return r}function FpInvertBatch$1(n,e){const t=new Array(e.length),r=e.reduce((o,a,c)=>n.is0(a)?o:(t[c]=o,n.mul(o,a)),n.ONE),s=n.inv(r);return e.reduceRight((o,a,c)=>n.is0(a)?o:(t[c]=n.mul(o,t[c]),n.mul(o,a)),s),t}function nLength$1(n,e){const t=e!==void 0?e:n.toString(2).length,r=Math.ceil(t/8);return{nBitLength:t,nByteLength:r}}function Field$1(n,e,t=!1,r={}){if(n<=_0n$8)throw new Error(`Expected Field ORDER > 0, got ${n}`);const{nBitLength:s,nByteLength:o}=nLength$1(n,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const a=FpSqrt$1(n),c=Object.freeze({ORDER:n,BITS:s,BYTES:o,MASK:bitMask$1(s),ZERO:_0n$8,ONE:_1n$8,create:l=>mod$1(l,n),isValid:l=>{if(typeof l!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof l}`);return _0n$8<=l&&ll===_0n$8,isOdd:l=>(l&_1n$8)===_1n$8,neg:l=>mod$1(-l,n),eql:(l,f)=>l===f,sqr:l=>mod$1(l*l,n),add:(l,f)=>mod$1(l+f,n),sub:(l,f)=>mod$1(l-f,n),mul:(l,f)=>mod$1(l*f,n),pow:(l,f)=>FpPow$1(c,l,f),div:(l,f)=>mod$1(l*invert$1(f,n),n),sqrN:l=>l*l,addN:(l,f)=>l+f,subN:(l,f)=>l-f,mulN:(l,f)=>l*f,inv:l=>invert$1(l,n),sqrt:r.sqrt||(l=>a(c,l)),invertBatch:l=>FpInvertBatch$1(c,l),cmov:(l,f,h)=>h?f:l,toBytes:l=>t?numberToBytesLE$1(l,o):numberToBytesBE$1(l,o),fromBytes:l=>{if(l.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${l.length}`);return t?bytesToNumberLE$1(l):bytesToNumberBE$1(l)}});return Object.freeze(c)}function getFieldBytesLength$1(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const e=n.toString(2).length;return Math.ceil(e/8)}function getMinHashLength$1(n){const e=getFieldBytesLength$1(n);return e+Math.ceil(e/2)}function mapHashToField$1(n,e,t=!1){const r=n.length,s=getFieldBytesLength$1(e),o=getMinHashLength$1(e);if(r<16||r1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const a=t?bytesToNumberBE$1(n):bytesToNumberLE$1(n),c=mod$1(a,e-_1n$8)+_1n$8;return t?numberToBytesLE$1(c,s):numberToBytesBE$1(c,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$7=BigInt(0),_1n$7=BigInt(1);function wNAF$1(n,e){const t=(s,o)=>{const a=o.negate();return s?a:o},r=s=>{const o=Math.ceil(e/s)+1,a=2**(s-1);return{windows:o,windowSize:a}};return{constTimeNegate:t,unsafeLadder(s,o){let a=n.ZERO,c=s;for(;o>_0n$7;)o&_1n$7&&(a=a.add(c)),c=c.double(),o>>=_1n$7;return a},precomputeWindow(s,o){const{windows:a,windowSize:c}=r(o),l=[];let f=s,h=f;for(let u=0;u>=y,k>l&&(k-=p,a+=_1n$7);const R=m,B=m+Math.abs(k)-1,D=b%2!==0,U=k<0;k===0?h=h.add(t(D,o[R])):f=f.add(t(U,o[B]))}return{p:f,f:h}},wNAFCached(s,o,a,c){const l=s._WINDOW_SIZE||1;let f=o.get(s);return f||(f=this.precomputeWindow(s,l),l!==1&&o.set(s,c(f))),this.wNAF(l,f,a)}}}function validateBasic(n){return validateField$1(n.Fp),validateObject(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...nLength$1(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function validatePointOpts(n){const e=validateBasic(n);validateObject(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:r,a:s}=e;if(t){if(!r.eql(s,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:b2n,hexToBytes:h2b}=ut,DER$1={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(n){const{Err:e}=DER$1;if(n.length<2||n[0]!==2)throw new e("Invalid signature integer tag");const t=n[1],r=n.subarray(2,t+2);if(!t||r.length!==t)throw new e("Invalid signature integer: wrong length");if(r[0]&128)throw new e("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:b2n(r),l:n.subarray(t+2)}},toSig(n){const{Err:e}=DER$1,t=typeof n=="string"?h2b(n):n;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let r=t.length;if(r<2||t[0]!=48)throw new e("Invalid signature tag");if(t[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:s,l:o}=DER$1._parseInt(t.subarray(2)),{d:a,l:c}=DER$1._parseInt(o);if(c.length)throw new e("Invalid signature: left bytes after parsing");return{r:s,s:a}},hexFromSig(n){const e=f=>Number.parseInt(f[0],16)&8?"00"+f:f,t=f=>{const h=f.toString(16);return h.length&1?`0${h}`:h},r=e(t(n.s)),s=e(t(n.r)),o=r.length/2,a=s.length/2,c=t(o),l=t(a);return`30${t(a+o+4)}02${l}${s}02${c}${r}`}},_0n$6=BigInt(0),_1n$6=BigInt(1);BigInt(2);const _3n$2=BigInt(3);BigInt(4);function weierstrassPoints(n){const e=validatePointOpts(n),{Fp:t}=e,r=e.toBytes||((b,m,k)=>{const R=m.toAffine();return concatBytes$2(Uint8Array.from([4]),t.toBytes(R.x),t.toBytes(R.y))}),s=e.fromBytes||(b=>{const m=b.subarray(1),k=t.fromBytes(m.subarray(0,t.BYTES)),R=t.fromBytes(m.subarray(t.BYTES,2*t.BYTES));return{x:k,y:R}});function o(b){const{a:m,b:k}=e,R=t.sqr(b),B=t.mul(R,b);return t.add(t.add(B,t.mul(b,m)),k)}if(!t.eql(t.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(b){return typeof b=="bigint"&&_0n$6t.eql(D,t.ZERO);return B(k)&&B(R)?u.ZERO:new u(k,R,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(m){const k=t.invertBatch(m.map(R=>R.pz));return m.map((R,B)=>R.toAffine(k[B])).map(u.fromAffine)}static fromHex(m){const k=u.fromAffine(s(ensureBytes$1("pointHex",m)));return k.assertValidity(),k}static fromPrivateKey(m){return u.BASE.multiply(l(m))}_setWindowSize(m){this._WINDOW_SIZE=m,f.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!t.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:m,y:k}=this.toAffine();if(!t.isValid(m)||!t.isValid(k))throw new Error("bad point: x or y not FE");const R=t.sqr(k),B=o(m);if(!t.eql(R,B))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:m}=this.toAffine();if(t.isOdd)return!t.isOdd(m);throw new Error("Field doesn't support isOdd")}equals(m){h(m);const{px:k,py:R,pz:B}=this,{px:D,py:U,pz:H}=m,C=t.eql(t.mul(k,H),t.mul(D,B)),M=t.eql(t.mul(R,H),t.mul(U,B));return C&&M}negate(){return new u(this.px,t.neg(this.py),this.pz)}double(){const{a:m,b:k}=e,R=t.mul(k,_3n$2),{px:B,py:D,pz:U}=this;let H=t.ZERO,C=t.ZERO,M=t.ZERO,F=t.mul(B,B),O=t.mul(D,D),$=t.mul(U,U),E=t.mul(B,D);return E=t.add(E,E),M=t.mul(B,U),M=t.add(M,M),H=t.mul(m,M),C=t.mul(R,$),C=t.add(H,C),H=t.sub(O,C),C=t.add(O,C),C=t.mul(H,C),H=t.mul(E,H),M=t.mul(R,M),$=t.mul(m,$),E=t.sub(F,$),E=t.mul(m,E),E=t.add(E,M),M=t.add(F,F),F=t.add(M,F),F=t.add(F,$),F=t.mul(F,E),C=t.add(C,F),$=t.mul(D,U),$=t.add($,$),F=t.mul($,E),H=t.sub(H,F),M=t.mul($,O),M=t.add(M,M),M=t.add(M,M),new u(H,C,M)}add(m){h(m);const{px:k,py:R,pz:B}=this,{px:D,py:U,pz:H}=m;let C=t.ZERO,M=t.ZERO,F=t.ZERO;const O=e.a,$=t.mul(e.b,_3n$2);let E=t.mul(k,D),_=t.mul(R,U),T=t.mul(B,H),N=t.add(k,R),x=t.add(D,U);N=t.mul(N,x),x=t.add(E,_),N=t.sub(N,x),x=t.add(k,B);let w=t.add(D,H);return x=t.mul(x,w),w=t.add(E,T),x=t.sub(x,w),w=t.add(R,B),C=t.add(U,H),w=t.mul(w,C),C=t.add(_,T),w=t.sub(w,C),F=t.mul(O,x),C=t.mul($,T),F=t.add(C,F),C=t.sub(_,F),F=t.add(_,F),M=t.mul(C,F),_=t.add(E,E),_=t.add(_,E),T=t.mul(O,T),x=t.mul($,x),_=t.add(_,T),T=t.sub(E,T),T=t.mul(O,T),x=t.add(x,T),E=t.mul(_,x),M=t.add(M,E),E=t.mul(w,x),C=t.mul(N,C),C=t.sub(C,E),E=t.mul(N,_),F=t.mul(w,F),F=t.add(F,E),new u(C,M,F)}subtract(m){return this.add(m.negate())}is0(){return this.equals(u.ZERO)}wNAF(m){return y.wNAFCached(this,f,m,k=>{const R=t.invertBatch(k.map(B=>B.pz));return k.map((B,D)=>B.toAffine(R[D])).map(u.fromAffine)})}multiplyUnsafe(m){const k=u.ZERO;if(m===_0n$6)return k;if(c(m),m===_1n$6)return this;const{endo:R}=e;if(!R)return y.unsafeLadder(this,m);let{k1neg:B,k1:D,k2neg:U,k2:H}=R.splitScalar(m),C=k,M=k,F=this;for(;D>_0n$6||H>_0n$6;)D&_1n$6&&(C=C.add(F)),H&_1n$6&&(M=M.add(F)),F=F.double(),D>>=_1n$6,H>>=_1n$6;return B&&(C=C.negate()),U&&(M=M.negate()),M=new u(t.mul(M.px,R.beta),M.py,M.pz),C.add(M)}multiply(m){c(m);let k=m,R,B;const{endo:D}=e;if(D){const{k1neg:U,k1:H,k2neg:C,k2:M}=D.splitScalar(k);let{p:F,f:O}=this.wNAF(H),{p:$,f:E}=this.wNAF(M);F=y.constTimeNegate(U,F),$=y.constTimeNegate(C,$),$=new u(t.mul($.px,D.beta),$.py,$.pz),R=F.add($),B=O.add(E)}else{const{p:U,f:H}=this.wNAF(k);R=U,B=H}return u.normalizeZ([R,B])[0]}multiplyAndAddUnsafe(m,k,R){const B=u.BASE,D=(H,C)=>C===_0n$6||C===_1n$6||!H.equals(B)?H.multiplyUnsafe(C):H.multiply(C),U=D(this,k).add(D(m,R));return U.is0()?void 0:U}toAffine(m){const{px:k,py:R,pz:B}=this,D=this.is0();m==null&&(m=D?t.ONE:t.inv(B));const U=t.mul(k,m),H=t.mul(R,m),C=t.mul(B,m);if(D)return{x:t.ZERO,y:t.ZERO};if(!t.eql(C,t.ONE))throw new Error("invZ was invalid");return{x:U,y:H}}isTorsionFree(){const{h:m,isTorsionFree:k}=e;if(m===_1n$6)return!0;if(k)return k(u,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:m,clearCofactor:k}=e;return m===_1n$6?this:k?k(u,this):this.multiplyUnsafe(e.h)}toRawBytes(m=!0){return this.assertValidity(),r(u,this,m)}toHex(m=!0){return bytesToHex$2(this.toRawBytes(m))}}u.BASE=new u(e.Gx,e.Gy,t.ONE),u.ZERO=new u(t.ZERO,t.ONE,t.ZERO);const p=e.nBitLength,y=wNAF$1(u,e.endo?Math.ceil(p/2):p);return{CURVE:e,ProjectivePoint:u,normPrivateKeyToScalar:l,weierstrassEquation:o,isWithinCurveOrder:a}}function validateOpts(n){const e=validateBasic(n);return validateObject(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function weierstrass$1(n){const e=validateOpts(n),{Fp:t,n:r}=e,s=t.BYTES+1,o=2*t.BYTES+1;function a(x){return _0n$6bytesToHex$2(numberToBytesBE$1(x,e.nByteLength));function b(x){const w=r>>_1n$6;return x>w}function m(x){return b(x)?c(-x):x}const k=(x,w,v)=>bytesToNumberBE$1(x.slice(w,v));class R{constructor(w,v,S){this.r=w,this.s=v,this.recovery=S,this.assertValidity()}static fromCompact(w){const v=e.nByteLength;return w=ensureBytes$1("compactSignature",w,v*2),new R(k(w,0,v),k(w,v,2*v))}static fromDER(w){const{r:v,s:S}=DER$1.toSig(ensureBytes$1("DER",w));return new R(v,S)}assertValidity(){if(!p(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!p(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(w){return new R(this.r,this.s,w)}recoverPublicKey(w){const{r:v,s:S,recovery:A}=this,L=M(ensureBytes$1("msgHash",w));if(A==null||![0,1,2,3].includes(A))throw new Error("recovery id invalid");const I=A===2||A===3?v+e.n:v;if(I>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const P=A&1?"03":"02",V=f.fromHex(P+y(I)),z=l(I),W=c(-L*z),q=c(S*z),j=f.BASE.multiplyAndAddUnsafe(V,W,q);if(!j)throw new Error("point at infinify");return j.assertValidity(),j}hasHighS(){return b(this.s)}normalizeS(){return this.hasHighS()?new R(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes$2(this.toDERHex())}toDERHex(){return DER$1.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes$2(this.toCompactHex())}toCompactHex(){return y(this.r)+y(this.s)}}const B={isValidPrivateKey(x){try{return h(x),!0}catch{return!1}},normPrivateKeyToScalar:h,randomPrivateKey:()=>{const x=getMinHashLength$1(e.n);return mapHashToField$1(e.randomBytes(x),e.n)},precompute(x=8,w=f.BASE){return w._setWindowSize(x),w.multiply(BigInt(3)),w}};function D(x,w=!0){return f.fromPrivateKey(x).toRawBytes(w)}function U(x){const w=x instanceof Uint8Array,v=typeof x=="string",S=(w||v)&&x.length;return w?S===s||S===o:v?S===2*s||S===2*o:x instanceof f}function H(x,w,v=!0){if(U(x))throw new Error("first arg must be private key");if(!U(w))throw new Error("second arg must be public key");return f.fromHex(w).multiply(h(x)).toRawBytes(v)}const C=e.bits2int||function(x){const w=bytesToNumberBE$1(x),v=x.length*8-e.nBitLength;return v>0?w>>BigInt(v):w},M=e.bits2int_modN||function(x){return c(C(x))},F=bitMask$1(e.nBitLength);function O(x){if(typeof x!="bigint")throw new Error("bigint expected");if(!(_0n$6<=x&&xZ in v))throw new Error("sign() legacy options not supported");const{hash:S,randomBytes:A}=e;let{lowS:L,prehash:I,extraEntropy:P}=v;L==null&&(L=!0),x=ensureBytes$1("msgHash",x),I&&(x=ensureBytes$1("prehashed msgHash",S(x)));const V=M(x),z=h(w),W=[O(z),O(V)];if(P!=null){const Z=P===!0?A(t.BYTES):P;W.push(ensureBytes$1("extraEntropy",Z))}const q=concatBytes$2(...W),j=V;function G(Z){const Y=C(Z);if(!p(Y))return;const te=l(Y),J=f.BASE.multiply(Y).toAffine(),K=c(J.x);if(K===_0n$6)return;const Q=c(te*c(j+K*z));if(Q===_0n$6)return;let Se=(J.x===K?0:2)|Number(J.y&_1n$6),Ne=Q;return L&&b(Q)&&(Ne=m(Q),Se^=1),new R(K,Ne,Se)}return{seed:q,k2sig:G}}const E={lowS:e.lowS,prehash:!1},_={lowS:e.lowS,prehash:!1};function T(x,w,v=E){const{seed:S,k2sig:A}=$(x,w,v),L=e;return createHmacDrbg$1(L.hash.outputLen,L.nByteLength,L.hmac)(S,A)}f.BASE._setWindowSize(8);function N(x,w,v,S=_){var J;const A=x;if(w=ensureBytes$1("msgHash",w),v=ensureBytes$1("publicKey",v),"strict"in S)throw new Error("options.strict was renamed to lowS");const{lowS:L,prehash:I}=S;let P,V;try{if(typeof A=="string"||A instanceof Uint8Array)try{P=R.fromDER(A)}catch(K){if(!(K instanceof DER$1.Err))throw K;P=R.fromCompact(A)}else if(typeof A=="object"&&typeof A.r=="bigint"&&typeof A.s=="bigint"){const{r:K,s:Q}=A;P=new R(K,Q)}else throw new Error("PARSE");V=f.fromHex(v)}catch(K){if(K.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(L&&P.hasHighS())return!1;I&&(w=e.hash(w));const{r:z,s:W}=P,q=M(w),j=l(W),G=c(q*j),Z=c(z*j),Y=(J=f.BASE.multiplyAndAddUnsafe(V,G,Z))==null?void 0:J.toAffine();return Y?c(Y.x)===z:!1}return{CURVE:e,getPublicKey:D,getSharedSecret:H,sign:T,verify:N,ProjectivePoint:f,Signature:R,utils:B}}let HMAC$2=class extends Hash$2{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,hash$1(e);const r=toBytes$2(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,o=new Uint8Array(s);o.set(r.length>s?e.create().update(r).digest():r);for(let a=0;anew HMAC$2(n,e).update(t).digest();hmac$2.create=(n,e)=>new HMAC$2(n,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function getHash(n){return{hash:n,hmac:(e,...t)=>hmac$2(n,e,concatBytes$3(...t)),randomBytes:randomBytes$2}}function createCurve$1(n,e){const t=r=>weierstrass$1({...n,...getHash(r)});return Object.freeze({...t(e),create:t})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const secp256k1P=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),secp256k1N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_1n$5=BigInt(1),_2n$3=BigInt(2),divNearest$1=(n,e)=>(n+e/_2n$3)/e;function sqrtMod$1(n){const e=secp256k1P,t=BigInt(3),r=BigInt(6),s=BigInt(11),o=BigInt(22),a=BigInt(23),c=BigInt(44),l=BigInt(88),f=n*n*n%e,h=f*f*n%e,u=pow2$1(h,t,e)*h%e,p=pow2$1(u,t,e)*h%e,y=pow2$1(p,_2n$3,e)*f%e,b=pow2$1(y,s,e)*y%e,m=pow2$1(b,o,e)*b%e,k=pow2$1(m,c,e)*m%e,R=pow2$1(k,l,e)*k%e,B=pow2$1(R,c,e)*m%e,D=pow2$1(B,t,e)*h%e,U=pow2$1(D,a,e)*b%e,H=pow2$1(U,r,e)*f%e,C=pow2$1(H,_2n$3,e);if(!Fp.eql(Fp.sqr(C),n))throw new Error("Cannot find square root");return C}const Fp=Field$1(secp256k1P,void 0,void 0,{sqrt:sqrtMod$1}),secp256k1$1=createCurve$1({a:BigInt(0),b:BigInt(7),Fp,n:secp256k1N,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{const e=secp256k1N,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-_1n$5*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=t,a=BigInt("0x100000000000000000000000000000000"),c=divNearest$1(o*n,e),l=divNearest$1(-r*n,e);let f=mod$1(n-c*t-l*s,e),h=mod$1(-c*r-l*o,e);const u=f>a,p=h>a;if(u&&(f=e-f),p&&(h=e-h),f>a||h>a)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:u,k1:f,k2neg:p,k2:h}}}},sha256$3),_0n$5=BigInt(0),fe=n=>typeof n=="bigint"&&_0n$5typeof n=="bigint"&&_0n$5s.charCodeAt(0)));t=concatBytes$2(r,r),TAGGED_HASH_PREFIXES$1[n]=t}return sha256$3(concatBytes$2(t,...e))}const pointToBytes$1=n=>n.toRawBytes(!0).slice(1),numTo32b$1=n=>numberToBytesBE$1(n,32),modP$1=n=>mod$1(n,secp256k1P),modN$1=n=>mod$1(n,secp256k1N),Point$1=secp256k1$1.ProjectivePoint,GmulAdd=(n,e,t)=>Point$1.BASE.multiplyAndAddUnsafe(n,e,t);function schnorrGetExtPubKey$1(n){let e=secp256k1$1.utils.normPrivateKeyToScalar(n),t=Point$1.fromPrivateKey(e);return{scalar:t.hasEvenY()?e:modN$1(-e),bytes:pointToBytes$1(t)}}function lift_x$1(n){if(!fe(n))throw new Error("bad x: need 0 < x < p");const e=modP$1(n*n),t=modP$1(e*n+BigInt(7));let r=sqrtMod$1(t);r%_2n$3!==_0n$5&&(r=modP$1(-r));const s=new Point$1(n,r,_1n$5);return s.assertValidity(),s}function challenge$1(...n){return modN$1(bytesToNumberBE$1(taggedHash$1("BIP0340/challenge",...n)))}function schnorrGetPublicKey$1(n){return schnorrGetExtPubKey$1(n).bytes}function schnorrSign$1(n,e,t=randomBytes$2(32)){const r=ensureBytes$1("message",n),{bytes:s,scalar:o}=schnorrGetExtPubKey$1(e),a=ensureBytes$1("auxRand",t,32),c=numTo32b$1(o^bytesToNumberBE$1(taggedHash$1("BIP0340/aux",a))),l=taggedHash$1("BIP0340/nonce",c,s,r),f=modN$1(bytesToNumberBE$1(l));if(f===_0n$5)throw new Error("sign failed: k is zero");const{bytes:h,scalar:u}=schnorrGetExtPubKey$1(f),p=challenge$1(h,s,r),y=new Uint8Array(64);if(y.set(h,0),y.set(numTo32b$1(modN$1(u+p*o)),32),!schnorrVerify$1(y,r,s))throw new Error("sign: Invalid signature produced");return y}function schnorrVerify$1(n,e,t){const r=ensureBytes$1("signature",n,64),s=ensureBytes$1("message",e),o=ensureBytes$1("publicKey",t,32);try{const a=lift_x$1(bytesToNumberBE$1(o)),c=bytesToNumberBE$1(r.subarray(0,32));if(!fe(c))return!1;const l=bytesToNumberBE$1(r.subarray(32,64));if(!ge(l))return!1;const f=challenge$1(numTo32b$1(c),pointToBytes$1(a),s),h=GmulAdd(a,l,modN$1(-f));return!(!h||!h.hasEvenY()||h.toAffine().x!==c)}catch{return!1}}const schnorr$1=(()=>({getPublicKey:schnorrGetPublicKey$1,sign:schnorrSign$1,verify:schnorrVerify$1,utils:{randomPrivateKey:secp256k1$1.utils.randomPrivateKey,lift_x:lift_x$1,pointToBytes:pointToBytes$1,numberToBytesBE:numberToBytesBE$1,bytesToNumberBE:bytesToNumberBE$1,taggedHash:taggedHash$1,mod:mod$1}}))(),crypto$1=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const u8a=n=>n instanceof Uint8Array,createView$1=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),rotr$1=(n,e)=>n<<32-e|n>>>e,isLE$1=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE$1)throw new Error("Non little-endian hardware is not supported");const hexes$1=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function bytesToHex$1(n){if(!u8a(n))throw new Error("Uint8Array expected");let e="";for(let t=0;tr+s.length,0));let t=0;return n.forEach(r=>{if(!u8a(r))throw new Error("Uint8Array expected");e.set(r,t),t+=r.length}),e}let Hash$1=class{clone(){return this._cloneInto()}};function wrapConstructor(n){const e=r=>n().update(toBytes$1(r)).digest(),t=n();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>n(),e}function randomBytes$1(n=32){if(crypto$1&&typeof crypto$1.getRandomValues=="function")return crypto$1.getRandomValues(new Uint8Array(n));throw new Error("crypto.getRandomValues must be defined")}function number$1(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function bool$1(n){if(typeof n!="boolean")throw new Error(`Expected boolean, not ${n}`)}function bytes$1(n,...e){if(!(n instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(n.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${n.length}`)}function hash(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$1(n.outputLen),number$1(n.blockLen)}function exists(n,e=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(e&&n.finished)throw new Error("Hash#digest() has already been called")}function output(n,e){bytes$1(n);const t=e.outputLen;if(n.length>s&o),c=Number(t&o),l=r?4:0,f=r?0:4;n.setUint32(e+l,a,r),n.setUint32(e+f,c,r)}class SHA2 extends Hash$1{constructor(e,t,r,s){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=createView$1(this.buffer)}update(e){assert.exists(this);const{view:t,buffer:r,blockLen:s}=this;e=toBytes$1(e);const o=e.length;for(let a=0;as-a&&(this.process(r,0),a=0);for(let u=a;uh.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;un&e^~n&t,Maj$1=(n,e,t)=>n&e^n&t^e&t,SHA256_K$1=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W$1=new Uint32Array(64);let SHA256$1=class extends SHA2{constructor(){super(64,32,8,!1),this.A=IV[0]|0,this.B=IV[1]|0,this.C=IV[2]|0,this.D=IV[3]|0,this.E=IV[4]|0,this.F=IV[5]|0,this.G=IV[6]|0,this.H=IV[7]|0}get(){const{A:e,B:t,C:r,D:s,E:o,F:a,G:c,H:l}=this;return[e,t,r,s,o,a,c,l]}set(e,t,r,s,o,a,c,l){this.A=e|0,this.B=t|0,this.C=r|0,this.D=s|0,this.E=o|0,this.F=a|0,this.G=c|0,this.H=l|0}process(e,t){for(let u=0;u<16;u++,t+=4)SHA256_W$1[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const p=SHA256_W$1[u-15],y=SHA256_W$1[u-2],b=rotr$1(p,7)^rotr$1(p,18)^p>>>3,m=rotr$1(y,17)^rotr$1(y,19)^y>>>10;SHA256_W$1[u]=m+SHA256_W$1[u-7]+b+SHA256_W$1[u-16]|0}let{A:r,B:s,C:o,D:a,E:c,F:l,G:f,H:h}=this;for(let u=0;u<64;u++){const p=rotr$1(c,6)^rotr$1(c,11)^rotr$1(c,25),y=h+p+Chi$1(c,l,f)+SHA256_K$1[u]+SHA256_W$1[u]|0,m=(rotr$1(r,2)^rotr$1(r,13)^rotr$1(r,22))+Maj$1(r,s,o)|0;h=f,f=l,l=c,c=a+y|0,a=o,o=s,s=r,r=y+m|0}r=r+this.A|0,s=s+this.B|0,o=o+this.C|0,a=a+this.D|0,c=c+this.E|0,l=l+this.F|0,f=f+this.G|0,h=h+this.H|0,this.set(r,s,o,a,c,l,f,h)}roundClean(){SHA256_W$1.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};class SHA224 extends SHA256$1{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}const sha256$2=wrapConstructor(()=>new SHA256$1);wrapConstructor(()=>new SHA224);/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function assertNumber(n){if(!Number.isSafeInteger(n))throw new Error(`Wrong integer: ${n}`)}function chain$1(...n){const e=(s,o)=>a=>s(o(a)),t=Array.from(n).reverse().reduce((s,o)=>s?e(s,o.encode):o.encode,void 0),r=n.reduce((s,o)=>s?e(s,o.decode):o.decode,void 0);return{encode:t,decode:r}}function alphabet$1(n){return{encode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return e.map(t=>{if(assertNumber(t),t<0||t>=n.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${n.length})`);return n[t]})},decode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="string")throw new Error("alphabet.decode input should be array of strings");return e.map(t=>{if(typeof t!="string")throw new Error(`alphabet.decode: not string element=${t}`);const r=n.indexOf(t);if(r===-1)throw new Error(`Unknown letter: "${t}". Allowed: ${n}`);return r})}}}function join$1(n=""){if(typeof n!="string")throw new Error("join separator should be string");return{encode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="string")throw new Error("join.encode input should be array of strings");for(let t of e)if(typeof t!="string")throw new Error(`join.encode: non-string input=${t}`);return e.join(n)},decode:e=>{if(typeof e!="string")throw new Error("join.decode input should be string");return e.split(n)}}}function padding(n,e="="){if(assertNumber(n),typeof e!="string")throw new Error("padding chr should be string");return{encode(t){if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("padding.encode input should be array of strings");for(let r of t)if(typeof r!="string")throw new Error(`padding.encode: non-string input=${r}`);for(;t.length*n%8;)t.push(e);return t},decode(t){if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("padding.encode input should be array of strings");for(let s of t)if(typeof s!="string")throw new Error(`padding.decode: non-string input=${s}`);let r=t.length;if(r*n%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;r>0&&t[r-1]===e;r--)if(!((r-1)*n%8))throw new Error("Invalid padding: string has too much padding");return t.slice(0,r)}}}function normalize$1(n){if(typeof n!="function")throw new Error("normalize fn should be function");return{encode:e=>e,decode:e=>n(e)}}function convertRadix(n,e,t){if(e<2)throw new Error(`convertRadix: wrong from=${e}, base cannot be less than 2`);if(t<2)throw new Error(`convertRadix: wrong to=${t}, base cannot be less than 2`);if(!Array.isArray(n))throw new Error("convertRadix: data should be array");if(!n.length)return[];let r=0;const s=[],o=Array.from(n);for(o.forEach(a=>{if(assertNumber(a),a<0||a>=e)throw new Error(`Wrong integer: ${a}`)});;){let a=0,c=!0;for(let l=r;le?gcd$1(e,n%e):n,radix2carry$1=(n,e)=>n+(e-gcd$1(n,e));function convertRadix2$1(n,e,t,r){if(!Array.isArray(n))throw new Error("convertRadix2: data should be array");if(e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(t<=0||t>32)throw new Error(`convertRadix2: wrong to=${t}`);if(radix2carry$1(e,t)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${t} carryBits=${radix2carry$1(e,t)}`);let s=0,o=0;const a=2**t-1,c=[];for(const l of n){if(assertNumber(l),l>=2**e)throw new Error(`convertRadix2: invalid data word=${l} from=${e}`);if(s=s<32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${e}`);for(o+=e;o>=t;o-=t)c.push((s>>o-t&a)>>>0);s&=2**o-1}if(s=s<=e)throw new Error("Excess padding");if(!r&&s)throw new Error(`Non-zero padding: ${s}`);return r&&o>0&&c.push(s>>>0),c}function radix(n){return assertNumber(n),{encode:e=>{if(!(e instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return convertRadix(Array.from(e),2**8,n)},decode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="number")throw new Error("radix.decode input should be array of strings");return Uint8Array.from(convertRadix(e,n,2**8))}}}function radix2$1(n,e=!1){if(assertNumber(n),n<=0||n>32)throw new Error("radix2: bits should be in (0..32]");if(radix2carry$1(8,n)>32||radix2carry$1(n,8)>32)throw new Error("radix2: carry overflow");return{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return convertRadix2$1(Array.from(t),8,n,!e)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(convertRadix2$1(t,n,8,e))}}}function unsafeWrapper$1(n){if(typeof n!="function")throw new Error("unsafeWrapper fn should be function");return function(...e){try{return n.apply(null,e)}catch{}}}const base16=chain$1(radix2$1(4),alphabet$1("0123456789ABCDEF"),join$1("")),base32=chain$1(radix2$1(5),alphabet$1("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),padding(5),join$1(""));chain$1(radix2$1(5),alphabet$1("0123456789ABCDEFGHIJKLMNOPQRSTUV"),padding(5),join$1(""));chain$1(radix2$1(5),alphabet$1("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),join$1(""),normalize$1(n=>n.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));const base64=chain$1(radix2$1(6),alphabet$1("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),padding(6),join$1("")),base64url=chain$1(radix2$1(6),alphabet$1("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),padding(6),join$1("")),genBase58=n=>chain$1(radix(58),alphabet$1(n),join$1("")),base58=genBase58("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");genBase58("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ");genBase58("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const XMR_BLOCK_LEN=[0,2,3,5,6,7,9,10,11],base58xmr={encode(n){let e="";for(let t=0;t>25;let t=(n&33554431)<<5;for(let r=0;r>r&1)===1&&(t^=POLYMOD_GENERATORS$1[r]);return t}function bechChecksum$1(n,e,t=1){const r=n.length;let s=1;for(let o=0;o126)throw new Error(`Invalid prefix (${n})`);s=bech32Polymod$1(s)^a>>5}s=bech32Polymod$1(s);for(let o=0;op)throw new TypeError(`Length ${y} exceeds limit ${p}`);return h=h.toLowerCase(),`${h}1${BECH_ALPHABET$1.encode(u)}${bechChecksum$1(h,u,e)}`}function c(h,u=90){if(typeof h!="string")throw new Error(`bech32.decode input should be string, not ${typeof h}`);if(h.length<8||u!==!1&&h.length>u)throw new TypeError(`Wrong string length: ${h.length} (${h}). Expected (8..${u})`);const p=h.toLowerCase();if(h!==p&&h!==h.toUpperCase())throw new Error("String must be lowercase or uppercase");h=p;const y=h.lastIndexOf("1");if(y===0||y===-1)throw new Error('Letter "1" must be present between prefix and data only');const b=h.slice(0,y),m=h.slice(y+1);if(m.length<6)throw new Error("Data must be at least 6 characters long");const k=BECH_ALPHABET$1.decode(m).slice(0,-6),R=bechChecksum$1(b,k,e);if(!m.endsWith(R))throw new Error(`Invalid checksum in ${h}: expected "${R}"`);return{prefix:b,words:k}}const l=unsafeWrapper$1(c);function f(h){const{prefix:u,words:p}=c(h,!1);return{prefix:u,words:p,bytes:r(p)}}return{encode:a,decode:c,decodeToBytes:f,decodeUnsafe:l,fromWords:r,fromWordsUnsafe:o,toWords:s}}const bech32$2=genBech32$1("bech32");genBech32$1("bech32m");const utf8$1={encode:n=>new TextDecoder().decode(n),decode:n=>new TextEncoder().encode(n)},hex$1=chain$1(radix2$1(4),alphabet$1("0123456789abcdef"),join$1(""),normalize$1(n=>{if(typeof n!="string"||n.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof n} with length ${n.length}`);return n.toLowerCase()})),CODERS={utf8:utf8$1,hex:hex$1,base16,base32,base64,base64url,base58,base58xmr};`${Object.keys(CODERS).join(", ")}`;function number(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`positive integer expected, not ${n}`)}function bool(n){if(typeof n!="boolean")throw new Error(`boolean expected, not ${n}`)}function isBytes$2(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}function bytes(n,...e){if(!isBytes$2(n))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(n.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${n.length}`)}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */const u32=n=>new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4)),isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE)throw new Error("Non little-endian hardware is not supported");function checkOpts(n,e){if(e==null||typeof e!="object")throw new Error("options must be defined");return Object.assign(n,e)}function equalBytes(n,e){if(n.length!==e.length)return!1;let t=0;for(let r=0;r(Object.assign(e,n),e),BLOCK_SIZE=16,POLY=283;function mul2(n){return n<<1^POLY&-(n>>7)}function mul(n,e){let t=0;for(;e>0;e>>=1)t^=n&-(e&1),n=mul2(n);return t}const sbox=(()=>{let n=new Uint8Array(256);for(let t=0,r=1;t<256;t++,r^=mul2(r))n[t]=r;const e=new Uint8Array(256);e[0]=99;for(let t=0;t<255;t++){let r=n[255-t];r|=r<<8,e[n[t]]=(r^r>>4^r>>5^r>>6^r>>7^99)&255}return e})(),invSbox=sbox.map((n,e)=>sbox.indexOf(e)),rotr32_8=n=>n<<24|n>>>8,rotl32_8=n=>n<<8|n>>>24;function genTtable(n,e){if(n.length!==256)throw new Error("Wrong sbox length");const t=new Uint32Array(256).map((f,h)=>e(n[h])),r=t.map(rotl32_8),s=r.map(rotl32_8),o=s.map(rotl32_8),a=new Uint32Array(256*256),c=new Uint32Array(256*256),l=new Uint16Array(256*256);for(let f=0;f<256;f++)for(let h=0;h<256;h++){const u=f*256+h;a[u]=t[f]^r[h],c[u]=s[f]^o[h],l[u]=n[f]<<8|n[h]}return{sbox:n,sbox2:l,T0:t,T1:r,T2:s,T3:o,T01:a,T23:c}}const tableEncoding=genTtable(sbox,n=>mul(n,3)<<24|n<<16|n<<8|mul(n,2)),tableDecoding=genTtable(invSbox,n=>mul(n,11)<<24|mul(n,13)<<16|mul(n,9)<<8|mul(n,14)),xPowers=(()=>{const n=new Uint8Array(16);for(let e=0,t=1;e<16;e++,t=mul2(t))n[e]=t;return n})();function expandKeyLE(n){bytes(n);const e=n.length;if(![16,24,32].includes(e))throw new Error(`aes: wrong key size: should be 16, 24 or 32, got: ${e}`);const{sbox2:t}=tableEncoding,r=u32(n),s=r.length,o=c=>applySbox(t,c,c,c,c),a=new Uint32Array(e+28);a.set(r);for(let c=s;c6&&c%s===4&&(l=o(l)),a[c]=a[c-s]^l}return a}function expandKeyDecLE(n){const e=expandKeyLE(n),t=e.slice(),r=e.length,{sbox2:s}=tableEncoding,{T0:o,T1:a,T2:c,T3:l}=tableDecoding;for(let f=0;f>>8&255]^c[u>>>16&255]^l[u>>>24]}return t}function apply0123(n,e,t,r,s,o){return n[t<<8&65280|r>>>8&255]^e[s>>>8&65280|o>>>24&255]}function applySbox(n,e,t,r,s){return n[e&255|t&65280]|n[r>>>16&255|s>>>16&65280]<<16}function encrypt$2(n,e,t,r,s){const{sbox2:o,T01:a,T23:c}=tableEncoding;let l=0;e^=n[l++],t^=n[l++],r^=n[l++],s^=n[l++];const f=n.length/4-2;for(let b=0;b16)throw new Error(`aes/pcks5: wrong padding byte: ${r}`);const s=n.subarray(0,-r);for(let o=0;o{const c=expandKeyLE(e),{b:l,o:f,out:h}=validateBlockEncrypt(o,s,a),u=u32(t);let p=u[0],y=u[1],b=u[2],m=u[3],k=0;for(;k+4<=l.length;)p^=l[k+0],y^=l[k+1],b^=l[k+2],m^=l[k+3],{s0:p,s1:y,s2:b,s3:m}=encrypt$2(c,p,y,b,m),f[k++]=p,f[k++]=y,f[k++]=b,f[k++]=m;if(s){const R=padPCKS(o.subarray(k*4));p^=R[0],y^=R[1],b^=R[2],m^=R[3],{s0:p,s1:y,s2:b,s3:m}=encrypt$2(c,p,y,b,m),f[k++]=p,f[k++]=y,f[k++]=b,f[k++]=m}return c.fill(0),h},decrypt:(o,a)=>{validateBlockDecrypt(o);const c=expandKeyDecLE(e),l=u32(t),f=getDst(o.length,a),h=u32(o),u=u32(f);let p=l[0],y=l[1],b=l[2],m=l[3];for(let k=0;k+4<=h.length;){const R=p,B=y,D=b,U=m;p=h[k+0],y=h[k+1],b=h[k+2],m=h[k+3];const{s0:H,s1:C,s2:M,s3:F}=decrypt$2(c,p,y,b,m);u[k++]=H^R,u[k++]=C^B,u[k++]=M^D,u[k++]=F^U}return c.fill(0),validatePCKS(f,s)}}}),_utf8ToBytes=n=>Uint8Array.from(n.split("").map(e=>e.charCodeAt(0))),sigma16=_utf8ToBytes("expand 16-byte k"),sigma32=_utf8ToBytes("expand 32-byte k"),sigma16_32=u32(sigma16),sigma32_32=u32(sigma32);sigma32_32.slice();function rotl(n,e){return n<>>32-e}function isAligned32(n){return n.byteOffset%4===0}const BLOCK_LEN=64,BLOCK_LEN32=16,MAX_COUNTER=2**32-1,U32_EMPTY=new Uint32Array;function runCipher(n,e,t,r,s,o,a,c){const l=s.length,f=new Uint8Array(BLOCK_LEN),h=u32(f),u=isAligned32(s)&&isAligned32(o),p=u?u32(s):U32_EMPTY,y=u?u32(o):U32_EMPTY;for(let b=0;b=MAX_COUNTER)throw new Error("arx: counter overflow");const m=Math.min(BLOCK_LEN,l-b);if(u&&m===BLOCK_LEN){const k=b/4;if(b%4!==0)throw new Error("arx: invalid block position");for(let R=0,B;R{bytes(c),bytes(l),bytes(f);const p=f.length;if(h||(h=new Uint8Array(p)),bytes(h),number(u),u<0||u>=MAX_COUNTER)throw new Error("arx: counter overflow");if(h.length0;)y.pop().fill(0);return h}}function chachaCore(n,e,t,r,s,o=20){let a=n[0],c=n[1],l=n[2],f=n[3],h=e[0],u=e[1],p=e[2],y=e[3],b=e[4],m=e[5],k=e[6],R=e[7],B=s,D=t[0],U=t[1],H=t[2],C=a,M=c,F=l,O=f,$=h,E=u,_=p,T=y,N=b,x=m,w=k,v=R,S=B,A=D,L=U,I=H;for(let V=0;Vs?e.create().update(r).digest():r);for(let a=0;anew HMAC$1(n,e).update(t).digest();hmac$1.create=(n,e)=>new HMAC$1(n,e);function extract(n,e,t){return assert.hash(n),t===void 0&&(t=new Uint8Array(n.outputLen)),hmac$1(n,toBytes$1(t),toBytes$1(e))}const HKDF_COUNTER=new Uint8Array([0]),EMPTY_BUFFER=new Uint8Array;function expand(n,e,t,r=32){if(assert.hash(n),assert.number(r),r>255*n.outputLen)throw new Error("Length should be <= 255*HashLen");const s=Math.ceil(r/n.outputLen);t===void 0&&(t=EMPTY_BUFFER);const o=new Uint8Array(s*n.outputLen),a=hmac$1.create(n,e),c=a._cloneInto(),l=new Uint8Array(a.outputLen);for(let f=0;f{for(var t in e)__defProp(n,t,{get:e[t],enumerable:!0})},verifiedSymbol=Symbol("verified"),isRecord=n=>n instanceof Object;function validateEvent(n){if(!isRecord(n)||typeof n.kind!="number"||typeof n.content!="string"||typeof n.created_at!="number"||typeof n.pubkey!="string"||!n.pubkey.match(/^[a-f0-9]{64}$/)||!Array.isArray(n.tags))return!1;for(let e=0;eQueue$1,QueueNode:()=>QueueNode,binarySearch:()=>binarySearch,bytesToHex:()=>bytesToHex$1,hexToBytes:()=>hexToBytes$1,insertEventIntoAscendingList:()=>insertEventIntoAscendingList,insertEventIntoDescendingList:()=>insertEventIntoDescendingList,normalizeURL:()=>normalizeURL,utf8Decoder:()=>utf8Decoder,utf8Encoder:()=>utf8Encoder});var utf8Decoder=new TextDecoder("utf-8"),utf8Encoder=new TextEncoder;function normalizeURL(n){try{n.indexOf("://")===-1&&(n="wss://"+n);let e=new URL(n);return e.pathname=e.pathname.replace(/\/+/g,"/"),e.pathname.endsWith("/")&&(e.pathname=e.pathname.slice(0,-1)),(e.port==="80"&&e.protocol==="ws:"||e.port==="443"&&e.protocol==="wss:")&&(e.port=""),e.searchParams.sort(),e.hash="",e.toString()}catch{throw new Error(`Invalid URL: ${n}`)}}function insertEventIntoDescendingList(n,e){const[t,r]=binarySearch(n,s=>e.id===s.id?0:e.created_at===s.created_at?-1:s.created_at-e.created_at);return r||n.splice(t,0,e),n}function insertEventIntoAscendingList(n,e){const[t,r]=binarySearch(n,s=>e.id===s.id?0:e.created_at===s.created_at?-1:e.created_at-s.created_at);return r||n.splice(t,0,e),n}function binarySearch(n,e){let t=0,r=n.length-1;for(;t<=r;){const s=Math.floor((t+r)/2),o=e(n[s]);if(o===0)return[s,!0];o<0?r=s-1:t=s+1}return[t,!1]}var QueueNode=class{constructor(n){g(this,"value");g(this,"next",null);g(this,"prev",null);this.value=n}},Queue$1=class{constructor(){g(this,"first");g(this,"last");this.first=null,this.last=null}enqueue(e){const t=new QueueNode(e);return this.last?this.last===this.first?(this.last=t,this.last.prev=this.first,this.first.next=t):(t.prev=this.last,this.last.next=t,this.last=t):(this.first=t,this.last=t),!0}dequeue(){if(!this.first)return null;if(this.first===this.last){const t=this.first;return this.first=null,this.last=null,t.value}const e=this.first;return this.first=e.next,this.first&&(this.first.prev=null),e.value}},JS=class{generateSecretKey(){return schnorr$1.utils.randomPrivateKey()}getPublicKey(n){return bytesToHex$1(schnorr$1.getPublicKey(n))}finalizeEvent(n,e){const t=n;return t.pubkey=bytesToHex$1(schnorr$1.getPublicKey(e)),t.id=getEventHash$1(t),t.sig=bytesToHex$1(schnorr$1.sign(getEventHash$1(t),e)),t[verifiedSymbol]=!0,t}verifyEvent(n){if(typeof n[verifiedSymbol]=="boolean")return n[verifiedSymbol];const e=getEventHash$1(n);if(e!==n.id)return n[verifiedSymbol]=!1,!1;try{const t=schnorr$1.verify(n.sig,e,n.pubkey);return n[verifiedSymbol]=t,t}catch{return n[verifiedSymbol]=!1,!1}}};function serializeEvent(n){if(!validateEvent(n))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,n.pubkey,n.created_at,n.kind,n.tags,n.content])}function getEventHash$1(n){let e=sha256$2(utf8Encoder.encode(serializeEvent(n)));return bytesToHex$1(e)}var i=new JS,generateSecretKey=i.generateSecretKey,getPublicKey=i.getPublicKey,finalizeEvent=i.finalizeEvent,verifyEvent=i.verifyEvent,kinds_exports={};__export(kinds_exports,{Application:()=>Application,BadgeAward:()=>BadgeAward,BadgeDefinition:()=>BadgeDefinition,BlockedRelaysList:()=>BlockedRelaysList,BookmarkList:()=>BookmarkList,Bookmarksets:()=>Bookmarksets,Calendar:()=>Calendar,CalendarEventRSVP:()=>CalendarEventRSVP,ChannelCreation:()=>ChannelCreation,ChannelHideMessage:()=>ChannelHideMessage,ChannelMessage:()=>ChannelMessage,ChannelMetadata:()=>ChannelMetadata,ChannelMuteUser:()=>ChannelMuteUser,ClassifiedListing:()=>ClassifiedListing,ClientAuth:()=>ClientAuth,CommunitiesList:()=>CommunitiesList,CommunityDefinition:()=>CommunityDefinition,CommunityPostApproval:()=>CommunityPostApproval,Contacts:()=>Contacts,CreateOrUpdateProduct:()=>CreateOrUpdateProduct,CreateOrUpdateStall:()=>CreateOrUpdateStall,Curationsets:()=>Curationsets,Date:()=>Date2,DirectMessageRelaysList:()=>DirectMessageRelaysList,DraftClassifiedListing:()=>DraftClassifiedListing,DraftLong:()=>DraftLong,Emojisets:()=>Emojisets,EncryptedDirectMessage:()=>EncryptedDirectMessage,EventDeletion:()=>EventDeletion,FileMetadata:()=>FileMetadata,FileServerPreference:()=>FileServerPreference,Followsets:()=>Followsets,GenericRepost:()=>GenericRepost,Genericlists:()=>Genericlists,GiftWrap:()=>GiftWrap,HTTPAuth:()=>HTTPAuth,Handlerinformation:()=>Handlerinformation,Handlerrecommendation:()=>Handlerrecommendation,Highlights:()=>Highlights,InterestsList:()=>InterestsList,Interestsets:()=>Interestsets,JobFeedback:()=>JobFeedback,JobRequest:()=>JobRequest,JobResult:()=>JobResult,Label:()=>Label,LightningPubRPC:()=>LightningPubRPC,LiveChatMessage:()=>LiveChatMessage,LiveEvent:()=>LiveEvent,LongFormArticle:()=>LongFormArticle,Metadata:()=>Metadata,Mutelist:()=>Mutelist,NWCWalletInfo:()=>NWCWalletInfo,NWCWalletRequest:()=>NWCWalletRequest,NWCWalletResponse:()=>NWCWalletResponse,NostrConnect:()=>NostrConnect,OpenTimestamps:()=>OpenTimestamps,Pinlist:()=>Pinlist,PrivateDirectMessage:()=>PrivateDirectMessage,ProblemTracker:()=>ProblemTracker,ProfileBadges:()=>ProfileBadges,PublicChatsList:()=>PublicChatsList,Reaction:()=>Reaction,RecommendRelay:()=>RecommendRelay,RelayList:()=>RelayList,Relaysets:()=>Relaysets,Report:()=>Report,Reporting:()=>Reporting,Repost:()=>Repost,Seal:()=>Seal,SearchRelaysList:()=>SearchRelaysList,ShortTextNote:()=>ShortTextNote,Time:()=>Time,UserEmojiList:()=>UserEmojiList,UserStatuses:()=>UserStatuses,Zap:()=>Zap,ZapGoal:()=>ZapGoal,ZapRequest:()=>ZapRequest,classifyKind:()=>classifyKind,isAddressableKind:()=>isAddressableKind,isEphemeralKind:()=>isEphemeralKind,isKind:()=>isKind,isRegularKind:()=>isRegularKind,isReplaceableKind:()=>isReplaceableKind});function isRegularKind(n){return 1e3<=n&&n<1e4||[1,2,4,5,6,7,8,16,40,41,42,43,44].includes(n)}function isReplaceableKind(n){return[0,3].includes(n)||1e4<=n&&n<2e4}function isEphemeralKind(n){return 2e4<=n&&n<3e4}function isAddressableKind(n){return 3e4<=n&&n<4e4}function classifyKind(n){return isRegularKind(n)?"regular":isReplaceableKind(n)?"replaceable":isEphemeralKind(n)?"ephemeral":isAddressableKind(n)?"parameterized":"unknown"}function isKind(n,e){const t=e instanceof Array?e:[e];return validateEvent(n)&&t.includes(n.kind)||!1}var Metadata=0,ShortTextNote=1,RecommendRelay=2,Contacts=3,EncryptedDirectMessage=4,EventDeletion=5,Repost=6,Reaction=7,BadgeAward=8,Seal=13,PrivateDirectMessage=14,GenericRepost=16,ChannelCreation=40,ChannelMetadata=41,ChannelMessage=42,ChannelHideMessage=43,ChannelMuteUser=44,OpenTimestamps=1040,GiftWrap=1059,FileMetadata=1063,LiveChatMessage=1311,ProblemTracker=1971,Report=1984,Reporting=1984,Label=1985,CommunityPostApproval=4550,JobRequest=5999,JobResult=6999,JobFeedback=7e3,ZapGoal=9041,ZapRequest=9734,Zap=9735,Highlights=9802,Mutelist=1e4,Pinlist=10001,RelayList=10002,BookmarkList=10003,CommunitiesList=10004,PublicChatsList=10005,BlockedRelaysList=10006,SearchRelaysList=10007,InterestsList=10015,UserEmojiList=10030,DirectMessageRelaysList=10050,FileServerPreference=10096,NWCWalletInfo=13194,LightningPubRPC=21e3,ClientAuth=22242,NWCWalletRequest=23194,NWCWalletResponse=23195,NostrConnect=24133,HTTPAuth=27235,Followsets=3e4,Genericlists=30001,Relaysets=30002,Bookmarksets=30003,Curationsets=30004,ProfileBadges=30008,BadgeDefinition=30009,Interestsets=30015,CreateOrUpdateStall=30017,CreateOrUpdateProduct=30018,LongFormArticle=30023,DraftLong=30024,Emojisets=30030,Application=30078,LiveEvent=30311,UserStatuses=30315,ClassifiedListing=30402,DraftClassifiedListing=30403,Date2=31922,Time=31923,Calendar=31924,CalendarEventRSVP=31925,Handlerrecommendation=31989,Handlerinformation=31990,CommunityDefinition=34550;function matchFilter$1(n,e){if(n.ids&&n.ids.indexOf(e.id)===-1||n.kinds&&n.kinds.indexOf(e.kind)===-1||n.authors&&n.authors.indexOf(e.pubkey)===-1)return!1;for(let t in n)if(t[0]==="#"){let r=t.slice(1),s=n[`#${r}`];if(s&&!e.tags.find(([o,a])=>o===t.slice(1)&&s.indexOf(a)!==-1))return!1}return!(n.since&&e.created_atn.until)}function matchFilters(n,e){for(let t=0;tgetHex64,getInt:()=>getInt,getSubscriptionId:()=>getSubscriptionId,matchEventId:()=>matchEventId,matchEventKind:()=>matchEventKind,matchEventPubkey:()=>matchEventPubkey});function getHex64(n,e){let t=e.length+3,r=n.indexOf(`"${e}":`)+t,s=n.slice(r).indexOf('"')+r+1;return n.slice(s,s+64)}function getInt(n,e){let t=e.length,r=n.indexOf(`"${e}":`)+t+3,s=n.slice(r),o=Math.min(s.indexOf(","),s.indexOf("}"));return parseInt(s.slice(0,o),10)}function getSubscriptionId(n){let e=n.slice(0,22).indexOf('"EVENT"');if(e===-1)return null;let t=n.slice(e+7+1).indexOf('"');if(t===-1)return null;let r=e+7+1+t,s=n.slice(r+1,80).indexOf('"');if(s===-1)return null;let o=r+1+s;return n.slice(r+1,o)}function matchEventId(n,e){return e===getHex64(n,"id")}function matchEventPubkey(n,e){return e===getHex64(n,"pubkey")}function matchEventKind(n,e){return e===getInt(n,"kind")}var nip42_exports={};__export(nip42_exports,{makeAuthEvent:()=>makeAuthEvent});function makeAuthEvent(n,e){return{kind:ClientAuth,created_at:Math.floor(Date.now()/1e3),tags:[["relay",n],["challenge",e]],content:""}}var _WebSocket;try{_WebSocket=WebSocket}catch{}var _WebSocket2;try{_WebSocket2=WebSocket}catch{}var nip19_exports={};__export(nip19_exports,{BECH32_REGEX:()=>BECH32_REGEX$1,Bech32MaxSize:()=>Bech32MaxSize,NostrTypeGuard:()=>NostrTypeGuard,decode:()=>decode$1,decodeNostrURI:()=>decodeNostrURI,encodeBytes:()=>encodeBytes,naddrEncode:()=>naddrEncode,neventEncode:()=>neventEncode,noteEncode:()=>noteEncode,nprofileEncode:()=>nprofileEncode,npubEncode:()=>npubEncode,nsecEncode:()=>nsecEncode});var NostrTypeGuard={isNProfile:n=>/^nprofile1[a-z\d]+$/.test(n||""),isNEvent:n=>/^nevent1[a-z\d]+$/.test(n||""),isNAddr:n=>/^naddr1[a-z\d]+$/.test(n||""),isNSec:n=>/^nsec1[a-z\d]{58}$/.test(n||""),isNPub:n=>/^npub1[a-z\d]{58}$/.test(n||""),isNote:n=>/^note1[a-z\d]+$/.test(n||""),isNcryptsec:n=>/^ncryptsec1[a-z\d]+$/.test(n||"")},Bech32MaxSize=5e3,BECH32_REGEX$1=/[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;function integerToUint8Array(n){const e=new Uint8Array(4);return e[0]=n>>24&255,e[1]=n>>16&255,e[2]=n>>8&255,e[3]=n&255,e}function decodeNostrURI(n){try{return n.startsWith("nostr:")&&(n=n.substring(6)),decode$1(n)}catch{return{type:"invalid",data:null}}}function decode$1(n){var s,o,a,c,l,f,h;let{prefix:e,words:t}=bech32$2.decode(n,Bech32MaxSize),r=new Uint8Array(bech32$2.fromWords(t));switch(e){case"nprofile":{let u=parseTLV(r);if(!((s=u[0])!=null&&s[0]))throw new Error("missing TLV 0 for nprofile");if(u[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:bytesToHex$1(u[0][0]),relays:u[1]?u[1].map(p=>utf8Decoder.decode(p)):[]}}}case"nevent":{let u=parseTLV(r);if(!((o=u[0])!=null&&o[0]))throw new Error("missing TLV 0 for nevent");if(u[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");if(u[2]&&u[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(u[3]&&u[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:bytesToHex$1(u[0][0]),relays:u[1]?u[1].map(p=>utf8Decoder.decode(p)):[],author:(a=u[2])!=null&&a[0]?bytesToHex$1(u[2][0]):void 0,kind:(c=u[3])!=null&&c[0]?parseInt(bytesToHex$1(u[3][0]),16):void 0}}}case"naddr":{let u=parseTLV(r);if(!((l=u[0])!=null&&l[0]))throw new Error("missing TLV 0 for naddr");if(!((f=u[2])!=null&&f[0]))throw new Error("missing TLV 2 for naddr");if(u[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(!((h=u[3])!=null&&h[0]))throw new Error("missing TLV 3 for naddr");if(u[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:utf8Decoder.decode(u[0][0]),pubkey:bytesToHex$1(u[2][0]),kind:parseInt(bytesToHex$1(u[3][0]),16),relays:u[1]?u[1].map(p=>utf8Decoder.decode(p)):[]}}}case"nsec":return{type:e,data:r};case"npub":case"note":return{type:e,data:bytesToHex$1(r)};default:throw new Error(`unknown prefix ${e}`)}}function parseTLV(n){let e={},t=n;for(;t.length>0;){let r=t[0],s=t[1],o=t.slice(2,2+s);if(t=t.slice(2+s),o.lengthutf8Encoder.encode(t))});return encodeBech32("nprofile",e)}function neventEncode(n){let e;n.kind!==void 0&&(e=integerToUint8Array(n.kind));let t=encodeTLV({0:[hexToBytes$1(n.id)],1:(n.relays||[]).map(r=>utf8Encoder.encode(r)),2:n.author?[hexToBytes$1(n.author)]:[],3:e?[new Uint8Array(e)]:[]});return encodeBech32("nevent",t)}function naddrEncode(n){let e=new ArrayBuffer(4);new DataView(e).setUint32(0,n.kind,!1);let t=encodeTLV({0:[utf8Encoder.encode(n.identifier)],1:(n.relays||[]).map(r=>utf8Encoder.encode(r)),2:[hexToBytes$1(n.pubkey)],3:[new Uint8Array(e)]});return encodeBech32("naddr",t)}function encodeTLV(n){let e=[];return Object.entries(n).reverse().forEach(([t,r])=>{r.forEach(s=>{let o=new Uint8Array(s.length+2);o.set([parseInt(t)],0),o.set([s.length],1),o.set(s,2),e.push(o)})}),concatBytes$1(...e)}var nip04_exports={};__export(nip04_exports,{decrypt:()=>decrypt$1,encrypt:()=>encrypt$1});function encrypt$1(n,e,t){const r=n instanceof Uint8Array?bytesToHex$1(n):n,s=secp256k1$1.getSharedSecret(r,"02"+e),o=getNormalizedX(s);let a=Uint8Array.from(randomBytes$1(16)),c=utf8Encoder.encode(t),l=cbc(o,a).encrypt(c),f=base64.encode(new Uint8Array(l)),h=base64.encode(new Uint8Array(a.buffer));return`${f}?iv=${h}`}function decrypt$1(n,e,t){const r=n instanceof Uint8Array?bytesToHex$1(n):n;let[s,o]=t.split("?iv="),a=secp256k1$1.getSharedSecret(r,"02"+e),c=getNormalizedX(a),l=base64.decode(o),f=base64.decode(s),h=cbc(c,l).decrypt(f);return utf8Decoder.decode(h)}function getNormalizedX(n){return n.slice(1,33)}var nip05_exports={};__export(nip05_exports,{NIP05_REGEX:()=>NIP05_REGEX$1,isNip05:()=>isNip05,isValid:()=>isValid,queryProfile:()=>queryProfile,searchDomain:()=>searchDomain,useFetchImplementation:()=>useFetchImplementation});var NIP05_REGEX$1=/^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/,isNip05=n=>NIP05_REGEX$1.test(n||""),_fetch;try{_fetch=fetch}catch(n){}function useFetchImplementation(n){_fetch=n}async function searchDomain(n,e=""){try{const t=`https://${n}/.well-known/nostr.json?name=${e}`,r=await _fetch(t,{redirect:"manual"});if(r.status!==200)throw Error("Wrong response code");return(await r.json()).names}catch{return{}}}async function queryProfile(n){var s;const e=n.match(NIP05_REGEX$1);if(!e)return null;const[,t="_",r]=e;try{const o=`https://${r}/.well-known/nostr.json?name=${t}`,a=await _fetch(o,{redirect:"manual"});if(a.status!==200)throw Error("Wrong response code");const c=await a.json(),l=c.names[t];return l?{pubkey:l,relays:(s=c.relays)==null?void 0:s[l]}:null}catch{return null}}async function isValid(n,e){const t=await queryProfile(e);return t?t.pubkey===n:!1}var nip10_exports={};__export(nip10_exports,{parse:()=>parse});function parse(n){const e={reply:void 0,root:void 0,mentions:[],profiles:[],quotes:[]};let t,r;for(let s=n.tags.length-1;s>=0;s--){const o=n.tags[s];if(o[0]==="e"&&o[1]){const[a,c,l,f,h]=o,u={id:c,relays:l?[l]:[],author:h};if(f==="root"){e.root=u;continue}if(f==="reply"){e.reply=u;continue}if(f==="mention"){e.mentions.push(u);continue}t?r=u:t=u,e.mentions.push(u);continue}if(o[0]==="q"&&o[1]){const[a,c,l]=o;e.quotes.push({id:c,relays:l?[l]:[]})}if(o[0]==="p"&&o[1]){e.profiles.push({pubkey:o[1],relays:o[2]?[o[2]]:[]});continue}}return e.root||(e.root=r||t||e.reply),e.reply||(e.reply=t||e.root),[e.reply,e.root].forEach(s=>{if(!s)return;let o=e.mentions.indexOf(s);if(o!==-1&&e.mentions.splice(o,1),s.author){let a=e.profiles.find(c=>c.pubkey===s.author);a&&a.relays&&(s.relays||(s.relays=[]),a.relays.forEach(c=>{var l;((l=s.relays)==null?void 0:l.indexOf(c))===-1&&s.relays.push(c)}),a.relays=s.relays)}}),e.mentions.forEach(s=>{if(s.author){let o=e.profiles.find(a=>a.pubkey===s.author);o&&o.relays&&(s.relays||(s.relays=[]),o.relays.forEach(a=>{s.relays.indexOf(a)===-1&&s.relays.push(a)}),o.relays=s.relays)}}),e}var nip11_exports={};__export(nip11_exports,{fetchRelayInformation:()=>fetchRelayInformation,useFetchImplementation:()=>useFetchImplementation2});var _fetch2;try{_fetch2=fetch}catch{}function useFetchImplementation2(n){_fetch2=n}async function fetchRelayInformation(n){return await(await fetch(n.replace("ws://","http://").replace("wss://","https://"),{headers:{Accept:"application/nostr+json"}})).json()}var nip13_exports={};__export(nip13_exports,{fastEventHash:()=>fastEventHash,getPow:()=>getPow,minePow:()=>minePow});function getPow(n){let e=0;for(let t=0;t<64;t+=8){const r=parseInt(n.substring(t,t+8),16);if(r===0)e+=32;else{e+=Math.clz32(r);break}}return e}function minePow(n,e){let t=0;const r=n,s=["nonce",t.toString(),e.toString()];for(r.tags.push(s);;){const o=Math.floor(new Date().getTime()/1e3);if(o!==r.created_at&&(t=0,r.created_at=o),s[1]=(++t).toString(),r.id=fastEventHash(r),getPow(r.id)>=e)break}return r}function fastEventHash(n){return bytesToHex$1(sha256$2(utf8Encoder.encode(JSON.stringify([0,n.pubkey,n.created_at,n.kind,n.tags,n.content]))))}var nip17_exports={};__export(nip17_exports,{unwrapEvent:()=>unwrapEvent2,unwrapManyEvents:()=>unwrapManyEvents2,wrapEvent:()=>wrapEvent2,wrapManyEvents:()=>wrapManyEvents2});var nip59_exports={};__export(nip59_exports,{createRumor:()=>createRumor,createSeal:()=>createSeal,createWrap:()=>createWrap,unwrapEvent:()=>unwrapEvent,unwrapManyEvents:()=>unwrapManyEvents,wrapEvent:()=>wrapEvent$1,wrapManyEvents:()=>wrapManyEvents});var nip44_exports={};__export(nip44_exports,{decrypt:()=>decrypt2$1,encrypt:()=>encrypt2$1,getConversationKey:()=>getConversationKey,v2:()=>v2});var minPlaintextSize=1,maxPlaintextSize=65535;function getConversationKey(n,e){const t=secp256k1$1.getSharedSecret(n,"02"+e).subarray(1,33);return extract(sha256$2,t,"nip44-v2")}function getMessageKeys(n,e){const t=expand(sha256$2,n,e,76);return{chacha_key:t.subarray(0,32),chacha_nonce:t.subarray(32,44),hmac_key:t.subarray(44,76)}}function calcPaddedLen(n){if(!Number.isSafeInteger(n)||n<1)throw new Error("expected positive integer");if(n<=32)return 32;const e=1<maxPlaintextSize)throw new Error("invalid plaintext size: must be between 1 and 65535 bytes");const e=new Uint8Array(2);return new DataView(e.buffer).setUint16(0,n,!1),e}function pad(n){const e=utf8Encoder.encode(n),t=e.length,r=writeU16BE(t),s=new Uint8Array(calcPaddedLen(t)-t);return concatBytes$1(r,e,s)}function unpad(n){const e=new DataView(n.buffer).getUint16(0),t=n.subarray(2,2+e);if(emaxPlaintextSize||t.length!==e||n.length!==2+calcPaddedLen(e))throw new Error("invalid padding");return utf8Decoder.decode(t)}function hmacAad(n,e,t){if(t.length!==32)throw new Error("AAD associated data must be 32 bytes");const r=concatBytes$1(t,e);return hmac$1(sha256$2,n,r)}function decodePayload(n){if(typeof n!="string")throw new Error("payload must be a valid string");const e=n.length;if(e<132||e>87472)throw new Error("invalid payload length: "+e);if(n[0]==="#")throw new Error("unknown encryption version");let t;try{t=base64.decode(n)}catch(o){throw new Error("invalid base64: "+o.message)}const r=t.length;if(r<99||r>65603)throw new Error("invalid data length: "+r);const s=t[0];if(s!==2)throw new Error("unknown encryption version "+s);return{nonce:t.subarray(1,33),ciphertext:t.subarray(33,-32),mac:t.subarray(-32)}}function encrypt2$1(n,e,t=randomBytes$1(32)){const{chacha_key:r,chacha_nonce:s,hmac_key:o}=getMessageKeys(e,t),a=pad(n),c=chacha20(r,s,a),l=hmacAad(o,c,t);return base64.encode(concatBytes$1(new Uint8Array([2]),t,c,l))}function decrypt2$1(n,e){const{nonce:t,ciphertext:r,mac:s}=decodePayload(n),{chacha_key:o,chacha_nonce:a,hmac_key:c}=getMessageKeys(e,t),l=hmacAad(c,r,t);if(!equalBytes(l,s))throw new Error("invalid MAC");const f=chacha20(o,a,r);return unpad(f)}var v2={utils:{getConversationKey,calcPaddedLen},encrypt:encrypt2$1,decrypt:decrypt2$1},TWO_DAYS=2*24*60*60,now=()=>Math.round(Date.now()/1e3),randomNow=()=>Math.round(now()-Math.random()*TWO_DAYS),nip44ConversationKey=(n,e)=>getConversationKey(n,e),nip44Encrypt=(n,e,t)=>encrypt2$1(JSON.stringify(n),nip44ConversationKey(e,t)),nip44Decrypt=(n,e)=>JSON.parse(decrypt2$1(n.content,nip44ConversationKey(e,n.pubkey)));function createRumor(n,e){const t={created_at:now(),content:"",tags:[],...n,pubkey:getPublicKey(e)};return t.id=getEventHash$1(t),t}function createSeal(n,e,t){return finalizeEvent({kind:Seal,content:nip44Encrypt(n,e,t),created_at:randomNow(),tags:[]},e)}function createWrap(n,e){const t=generateSecretKey();return finalizeEvent({kind:GiftWrap,content:nip44Encrypt(n,t,e),created_at:randomNow(),tags:[["p",e]]},t)}function wrapEvent$1(n,e,t){const r=createRumor(n,e),s=createSeal(r,e,t);return createWrap(s,t)}function wrapManyEvents(n,e,t){if(!t||t.length===0)throw new Error("At least one recipient is required.");const r=getPublicKey(e),s=[wrapEvent$1(n,e,r)];return t.forEach(o=>{s.push(wrapEvent$1(n,e,o))}),s}function unwrapEvent(n,e){const t=nip44Decrypt(n,e);return nip44Decrypt(t,e)}function unwrapManyEvents(n,e){let t=[];return n.forEach(r=>{t.push(unwrapEvent(r,e))}),t.sort((r,s)=>r.created_at-s.created_at),t}function createEvent(n,e,t,r){const s={created_at:Math.ceil(Date.now()/1e3),kind:PrivateDirectMessage,tags:[],content:e};return(Array.isArray(n)?n:[n]).forEach(({publicKey:a,relayUrl:c})=>{s.tags.push(c?["p",a,c]:["p",a])}),r&&s.tags.push(["e",r.eventId,r.relayUrl||"","reply"]),t&&s.tags.push(["subject",t]),s}function wrapEvent2(n,e,t,r,s){const o=createEvent(e,t,r,s);return wrapEvent$1(o,n,e.publicKey)}function wrapManyEvents2(n,e,t,r,s){if(!e||e.length===0)throw new Error("At least one recipient is required.");return[{publicKey:getPublicKey(n)},...e].map(a=>wrapEvent2(n,a,t,r,s))}var unwrapEvent2=unwrapEvent,unwrapManyEvents2=unwrapManyEvents,nip18_exports={};__export(nip18_exports,{finishRepostEvent:()=>finishRepostEvent,getRepostedEvent:()=>getRepostedEvent,getRepostedEventPointer:()=>getRepostedEventPointer});function finishRepostEvent(n,e,t,r){var a;let s;const o=[...n.tags??[],["e",e.id,t],["p",e.pubkey]];return e.kind===ShortTextNote?s=Repost:(s=GenericRepost,o.push(["k",String(e.kind)])),finalizeEvent({kind:s,tags:o,content:n.content===""||(a=e.tags)!=null&&a.find(c=>c[0]==="-")?"":JSON.stringify(e),created_at:n.created_at},r)}function getRepostedEventPointer(n){if(![Repost,GenericRepost].includes(n.kind))return;let e,t;for(let r=n.tags.length-1;r>=0&&(e===void 0||t===void 0);r--){const s=n.tags[r];s.length>=2&&(s[0]==="e"&&e===void 0?e=s:s[0]==="p"&&t===void 0&&(t=s))}if(e!==void 0)return{id:e[1],relays:[e[2],t==null?void 0:t[2]].filter(r=>typeof r=="string"),author:t==null?void 0:t[1]}}function getRepostedEvent(n,{skipVerification:e}={}){const t=getRepostedEventPointer(n);if(t===void 0||n.content==="")return;let r;try{r=JSON.parse(n.content)}catch{return}if(r.id===t.id&&!(!e&&!verifyEvent(r)))return r}var nip21_exports={};__export(nip21_exports,{NOSTR_URI_REGEX:()=>NOSTR_URI_REGEX,parse:()=>parse2,test:()=>test});var NOSTR_URI_REGEX=new RegExp(`nostr:(${BECH32_REGEX$1.source})`);function test(n){return typeof n=="string"&&new RegExp(`^${NOSTR_URI_REGEX.source}$`).test(n)}function parse2(n){const e=n.match(new RegExp(`^${NOSTR_URI_REGEX.source}$`));if(!e)throw new Error(`Invalid Nostr URI: ${n}`);return{uri:e[0],value:e[1],decoded:decode$1(e[1])}}var nip25_exports={};__export(nip25_exports,{finishReactionEvent:()=>finishReactionEvent,getReactedEventPointer:()=>getReactedEventPointer});function finishReactionEvent(n,e,t){const r=e.tags.filter(s=>s.length>=2&&(s[0]==="e"||s[0]==="p"));return finalizeEvent({...n,kind:Reaction,tags:[...n.tags??[],...r,["e",e.id],["p",e.pubkey]],content:n.content??"+"},t)}function getReactedEventPointer(n){if(n.kind!==Reaction)return;let e,t;for(let r=n.tags.length-1;r>=0&&(e===void 0||t===void 0);r--){const s=n.tags[r];s.length>=2&&(s[0]==="e"&&e===void 0?e=s:s[0]==="p"&&t===void 0&&(t=s))}if(!(e===void 0||t===void 0))return{id:e[1],relays:[e[2],t[2]].filter(r=>r!==void 0),author:t[1]}}var nip27_exports={};__export(nip27_exports,{parse:()=>parse3});var noCharacter=/\W/m,noURLCharacter=/\W |\W$|$|,| /m;function*parse3(n){const e=n.length;let t=0,r=0;for(;rchannelCreateEvent,channelHideMessageEvent:()=>channelHideMessageEvent,channelMessageEvent:()=>channelMessageEvent,channelMetadataEvent:()=>channelMetadataEvent,channelMuteUserEvent:()=>channelMuteUserEvent});var channelCreateEvent=(n,e)=>{let t;if(typeof n.content=="object")t=JSON.stringify(n.content);else if(typeof n.content=="string")t=n.content;else return;return finalizeEvent({kind:ChannelCreation,tags:[...n.tags??[]],content:t,created_at:n.created_at},e)},channelMetadataEvent=(n,e)=>{let t;if(typeof n.content=="object")t=JSON.stringify(n.content);else if(typeof n.content=="string")t=n.content;else return;return finalizeEvent({kind:ChannelMetadata,tags:[["e",n.channel_create_event_id],...n.tags??[]],content:t,created_at:n.created_at},e)},channelMessageEvent=(n,e)=>{const t=[["e",n.channel_create_event_id,n.relay_url,"root"]];return n.reply_to_channel_message_event_id&&t.push(["e",n.reply_to_channel_message_event_id,n.relay_url,"reply"]),finalizeEvent({kind:ChannelMessage,tags:[...t,...n.tags??[]],content:n.content,created_at:n.created_at},e)},channelHideMessageEvent=(n,e)=>{let t;if(typeof n.content=="object")t=JSON.stringify(n.content);else if(typeof n.content=="string")t=n.content;else return;return finalizeEvent({kind:ChannelHideMessage,tags:[["e",n.channel_message_event_id],...n.tags??[]],content:t,created_at:n.created_at},e)},channelMuteUserEvent=(n,e)=>{let t;if(typeof n.content=="object")t=JSON.stringify(n.content);else if(typeof n.content=="string")t=n.content;else return;return finalizeEvent({kind:ChannelMuteUser,tags:[["p",n.pubkey_to_mute],...n.tags??[]],content:t,created_at:n.created_at},e)},nip30_exports={};__export(nip30_exports,{EMOJI_SHORTCODE_REGEX:()=>EMOJI_SHORTCODE_REGEX,matchAll:()=>matchAll,regex:()=>regex,replaceAll:()=>replaceAll});var EMOJI_SHORTCODE_REGEX=/:(\w+):/,regex=()=>new RegExp(`\\B${EMOJI_SHORTCODE_REGEX.source}\\B`,"g");function*matchAll(n){const e=n.matchAll(regex());for(const t of e)try{const[r,s]=t;yield{shortcode:r,name:s,start:t.index,end:t.index+r.length}}catch{}}function replaceAll(n,e){return n.replaceAll(regex(),(t,r)=>e({shortcode:t,name:r}))}var nip39_exports={};__export(nip39_exports,{useFetchImplementation:()=>useFetchImplementation3,validateGithub:()=>validateGithub});var _fetch3;try{_fetch3=fetch}catch{}function useFetchImplementation3(n){_fetch3=n}async function validateGithub(n,e,t){try{return await(await _fetch3(`https://gist.github.com/${e}/${t}/raw`)).text()===`Verifying that I control the following Nostr public key: ${n}`}catch{return!1}}var nip47_exports={};__export(nip47_exports,{makeNwcRequestEvent:()=>makeNwcRequestEvent,parseConnectionString:()=>parseConnectionString});function parseConnectionString(n){const{pathname:e,searchParams:t}=new URL(n),r=e,s=t.get("relay"),o=t.get("secret");if(!r||!s||!o)throw new Error("invalid connection string");return{pubkey:r,relay:s,secret:o}}async function makeNwcRequestEvent(n,e,t){const s=encrypt$1(e,n,JSON.stringify({method:"pay_invoice",params:{invoice:t}})),o={kind:NWCWalletRequest,created_at:Math.round(Date.now()/1e3),content:s,tags:[["p",n]]};return finalizeEvent(o,e)}var nip54_exports={};__export(nip54_exports,{normalizeIdentifier:()=>normalizeIdentifier});function normalizeIdentifier(n){return n=n.trim().toLowerCase(),n=n.normalize("NFKC"),Array.from(n).map(e=>/\p{Letter}/u.test(e)||/\p{Number}/u.test(e)?e:"-").join("")}var nip57_exports={};__export(nip57_exports,{getSatoshisAmountFromBolt11:()=>getSatoshisAmountFromBolt11,getZapEndpoint:()=>getZapEndpoint,makeZapReceipt:()=>makeZapReceipt,makeZapRequest:()=>makeZapRequest,useFetchImplementation:()=>useFetchImplementation4,validateZapRequest:()=>validateZapRequest});var _fetch4;try{_fetch4=fetch}catch{}function useFetchImplementation4(n){_fetch4=n}async function getZapEndpoint(n){try{let e="",{lud06:t,lud16:r}=JSON.parse(n.content);if(t){let{words:a}=bech32$2.decode(t,1e3),c=bech32$2.fromWords(a);e=utf8Decoder.decode(c)}else if(r){let[a,c]=r.split("@");e=new URL(`/.well-known/lnurlp/${a}`,`https://${c}`).toString()}else return null;let o=await(await _fetch4(e)).json();if(o.allowsNostr&&o.nostrPubkey)return o.callback}catch{}return null}function makeZapRequest({profile:n,event:e,amount:t,relays:r,comment:s=""}){if(!t)throw new Error("amount not given");if(!n)throw new Error("profile not given");let o={kind:9734,created_at:Math.round(Date.now()/1e3),content:s,tags:[["p",n],["amount",t.toString()],["relays",...r]]};if(e&&typeof e=="string"&&o.tags.push(["e",e]),e&&typeof e=="object"){if(isReplaceableKind(e.kind)){const a=["a",`${e.kind}:${e.pubkey}:`];o.tags.push(a)}else if(isAddressableKind(e.kind)){let a=e.tags.find(([l,f])=>l==="d"&&f);if(!a)throw new Error("d tag not found or is empty");const c=["a",`${e.kind}:${e.pubkey}:${a[1]}`];o.tags.push(c)}}return o}function validateZapRequest(n){let e;try{e=JSON.parse(n)}catch{return"Invalid zap request JSON."}if(!validateEvent(e))return"Zap request is not a valid Nostr event.";if(!verifyEvent(e))return"Invalid signature on zap request.";let t=e.tags.find(([o,a])=>o==="p"&&a);if(!t)return"Zap request doesn't have a 'p' tag.";if(!t[1].match(/^[a-f0-9]{64}$/))return"Zap request 'p' tag is not valid hex.";let r=e.tags.find(([o,a])=>o==="e"&&a);return r&&!r[1].match(/^[a-f0-9]{64}$/)?"Zap request 'e' tag is not valid hex.":e.tags.find(([o,a])=>o==="relays"&&a)?null:"Zap request doesn't have a 'relays' tag."}function makeZapReceipt({zapRequest:n,preimage:e,bolt11:t,paidAt:r}){let s=JSON.parse(n),o=s.tags.filter(([c])=>c==="e"||c==="p"||c==="a"),a={kind:9735,created_at:Math.round(r.getTime()/1e3),content:"",tags:[...o,["P",s.pubkey],["bolt11",t],["description",n]]};return e&&a.tags.push(["preimage",e]),a}function getSatoshisAmountFromBolt11(n){if(n.length<50)return 0;n=n.substring(0,50);const e=n.lastIndexOf("1");if(e===-1)return 0;const t=n.substring(0,e);if(!t.startsWith("lnbc"))return 0;const r=t.substring(4);if(r.length<1)return 0;const s=r[r.length-1],o=s.charCodeAt(0)-"0".charCodeAt(0),a=o>=0&&o<=9;let c=r.length-1;if(a&&c++,c<1)return 0;const l=parseInt(r.substring(0,c));switch(s){case"m":return l*1e5;case"u":return l*100;case"n":return l/10;case"p":return l/1e4;default:return l*1e8}}var nip98_exports={};__export(nip98_exports,{getToken:()=>getToken,hashPayload:()=>hashPayload,unpackEventFromToken:()=>unpackEventFromToken,validateEvent:()=>validateEvent2,validateEventKind:()=>validateEventKind,validateEventMethodTag:()=>validateEventMethodTag,validateEventPayloadTag:()=>validateEventPayloadTag,validateEventTimestamp:()=>validateEventTimestamp,validateEventUrlTag:()=>validateEventUrlTag,validateToken:()=>validateToken});var _authorizationScheme="Nostr ";async function getToken(n,e,t,r=!1,s){const o={kind:HTTPAuth,tags:[["u",n],["method",e]],created_at:Math.round(new Date().getTime()/1e3),content:""};s&&o.tags.push(["payload",hashPayload(s)]);const a=await t(o);return(r?_authorizationScheme:"")+base64.encode(utf8Encoder.encode(JSON.stringify(a)))}async function validateToken(n,e,t){const r=await unpackEventFromToken(n).catch(o=>{throw o});return await validateEvent2(r,e,t).catch(o=>{throw o})}async function unpackEventFromToken(n){if(!n)throw new Error("Missing token");n=n.replace(_authorizationScheme,"");const e=utf8Decoder.decode(base64.decode(n));if(!e||e.length===0||!e.startsWith("{"))throw new Error("Invalid token");return JSON.parse(e)}function validateEventTimestamp(n){return n.created_at?Math.round(new Date().getTime()/1e3)-n.created_at<60:!1}function validateEventKind(n){return n.kind===HTTPAuth}function validateEventUrlTag(n,e){const t=n.tags.find(r=>r[0]==="u");return t?t.length>0&&t[1]===e:!1}function validateEventMethodTag(n,e){const t=n.tags.find(r=>r[0]==="method");return t?t.length>0&&t[1].toLowerCase()===e.toLowerCase():!1}function hashPayload(n){const e=sha256$2(utf8Encoder.encode(JSON.stringify(n)));return bytesToHex$1(e)}function validateEventPayloadTag(n,e){const t=n.tags.find(s=>s[0]==="payload");if(!t)return!1;const r=hashPayload(e);return t.length>0&&t[1]===r}async function validateEvent2(n,e,t,r){if(!verifyEvent(n))throw new Error("Invalid nostr event, signature invalid");if(!validateEventKind(n))throw new Error("Invalid nostr event, kind invalid");if(!validateEventTimestamp(n))throw new Error("Invalid nostr event, created_at timestamp invalid");if(!validateEventUrlTag(n,e))throw new Error("Invalid nostr event, url tag invalid");if(!validateEventMethodTag(n,t))throw new Error("Invalid nostr event, method tag invalid");if(r&&typeof r=="object"&&Object.keys(r).length>0&&!validateEventPayloadTag(n,r))throw new Error("Invalid nostr event, payload tag does not match request body hash");return!0}const crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function isBytes$1(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function anumber$1(n){if(!Number.isSafeInteger(n)||n<0)throw new Error("positive integer expected, got "+n)}function abytes(n,...e){if(!isBytes$1(n))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(n.length))throw new Error("Uint8Array expected of length "+e+", got length="+n.length)}function ahash(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");anumber$1(n.outputLen),anumber$1(n.blockLen)}function aexists(n,e=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(e&&n.finished)throw new Error("Hash#digest() has already been called")}function aoutput(n,e){abytes(n);const t=e.outputLen;if(n.length>>e}const hasHexBuiltin=(()=>typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function")(),hexes=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function bytesToHex(n){if(abytes(n),hasHexBuiltin)return n.toHex();let e="";for(let t=0;t=asciis._0&&n<=asciis._9)return n-asciis._0;if(n>=asciis.A&&n<=asciis.F)return n-(asciis.A-10);if(n>=asciis.a&&n<=asciis.f)return n-(asciis.a-10)}function hexToBytes(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);if(hasHexBuiltin)return Uint8Array.fromHex(n);const e=n.length,t=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(t);for(let s=0,o=0;sn().update(toBytes(r)).digest(),t=n();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>n(),e}function randomBytes(n=32){if(crypto&&typeof crypto.getRandomValues=="function")return crypto.getRandomValues(new Uint8Array(n));if(crypto&&typeof crypto.randomBytes=="function")return Uint8Array.from(crypto.randomBytes(n));throw new Error("crypto.getRandomValues must be defined")}function setBigUint64(n,e,t,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(e,t,r);const s=BigInt(32),o=BigInt(4294967295),a=Number(t>>s&o),c=Number(t&o),l=r?4:0,f=r?0:4;n.setUint32(e+l,a,r),n.setUint32(e+f,c,r)}function Chi(n,e,t){return n&e^~n&t}function Maj(n,e,t){return n&e^n&t^e&t}class HashMD extends Hash{constructor(e,t,r,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=s,this.buffer=new Uint8Array(e),this.view=createView(this.buffer)}update(e){aexists(this),e=toBytes(e),abytes(e);const{view:t,buffer:r,blockLen:s}=this,o=e.length;for(let a=0;as-a&&(this.process(r,0),a=0);for(let u=a;uh.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u>>3,m=rotr(y,17)^rotr(y,19)^y>>>10;SHA256_W[u]=m+SHA256_W[u-7]+b+SHA256_W[u-16]|0}let{A:r,B:s,C:o,D:a,E:c,F:l,G:f,H:h}=this;for(let u=0;u<64;u++){const p=rotr(c,6)^rotr(c,11)^rotr(c,25),y=h+p+Chi(c,l,f)+SHA256_K[u]+SHA256_W[u]|0,m=(rotr(r,2)^rotr(r,13)^rotr(r,22))+Maj(r,s,o)|0;h=f,f=l,l=c,c=a+y|0,a=o,o=s,s=r,r=y+m|0}r=r+this.A|0,s=s+this.B|0,o=o+this.C|0,a=a+this.D|0,c=c+this.E|0,l=l+this.F|0,f=f+this.G|0,h=h+this.H|0,this.set(r,s,o,a,c,l,f,h)}roundClean(){clean(SHA256_W)}destroy(){this.set(0,0,0,0,0,0,0,0),clean(this.buffer)}}const sha256$1=createHasher(()=>new SHA256);class HMAC extends Hash{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,ahash(e);const r=toBytes(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,o=new Uint8Array(s);o.set(r.length>s?e.create().update(r).digest():r);for(let a=0;anew HMAC(n,e).update(t).digest();hmac.create=(n,e)=>new HMAC(n,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$4=BigInt(0),_1n$4=BigInt(1);function abool(n,e){if(typeof e!="boolean")throw new Error(n+" boolean expected, got "+e)}function numberToHexUnpadded(n){const e=n.toString(16);return e.length&1?"0"+e:e}function hexToNumber(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?_0n$4:BigInt("0x"+n)}function bytesToNumberBE(n){return hexToNumber(bytesToHex(n))}function bytesToNumberLE(n){return abytes(n),hexToNumber(bytesToHex(Uint8Array.from(n).reverse()))}function numberToBytesBE(n,e){return hexToBytes(n.toString(16).padStart(e*2,"0"))}function numberToBytesLE(n,e){return numberToBytesBE(n,e).reverse()}function ensureBytes(n,e,t){let r;if(typeof e=="string")try{r=hexToBytes(e)}catch(o){throw new Error(n+" must be hex string or Uint8Array, cause: "+o)}else if(isBytes$1(e))r=Uint8Array.from(e);else throw new Error(n+" must be hex string or Uint8Array");const s=r.length;if(typeof t=="number"&&s!==t)throw new Error(n+" of length "+t+" expected, got "+s);return r}const isPosBig=n=>typeof n=="bigint"&&_0n$4<=n;function inRange(n,e,t){return isPosBig(n)&&isPosBig(e)&&isPosBig(t)&&e<=n&&n_0n$4;n>>=_1n$4,e+=1);return e}const bitMask=n=>(_1n$4<new Uint8Array(y),s=y=>Uint8Array.of(y);let o=r(n),a=r(n),c=0;const l=()=>{o.fill(1),a.fill(0),c=0},f=(...y)=>t(a,o,...y),h=(y=r(0))=>{a=f(s(0),y),o=f(),y.length!==0&&(a=f(s(1),y),o=f())},u=()=>{if(c++>=1e3)throw new Error("drbg: tried 1000 values");let y=0;const b=[];for(;y{l(),h(y);let m;for(;!(m=b(u()));)h();return l(),m}}function _validateObject(n,e,t={}){if(!n||typeof n!="object")throw new Error("expected valid options object");function r(s,o,a){const c=n[s];if(a&&c===void 0)return;const l=typeof c;if(l!==o||c===null)throw new Error(`param "${s}" is invalid: expected ${o}, got ${l}`)}Object.entries(e).forEach(([s,o])=>r(s,o,!1)),Object.entries(t).forEach(([s,o])=>r(s,o,!0))}function memoized(n){const e=new WeakMap;return(t,...r)=>{const s=e.get(t);if(s!==void 0)return s;const o=n(t,...r);return e.set(t,o),o}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$3=BigInt(0),_1n$3=BigInt(1),_2n$2=BigInt(2),_3n$1=BigInt(3),_4n$1=BigInt(4),_5n=BigInt(5),_7n=BigInt(7),_8n=BigInt(8),_9n=BigInt(9),_16n=BigInt(16);function mod(n,e){const t=n%e;return t>=_0n$3?t:e+t}function pow2(n,e,t){let r=n;for(;e-- >_0n$3;)r*=r,r%=t;return r}function invert(n,e){if(n===_0n$3)throw new Error("invert: expected non-zero number");if(e<=_0n$3)throw new Error("invert: expected positive modulus, got "+e);let t=mod(n,e),r=e,s=_0n$3,o=_1n$3;for(;t!==_0n$3;){const c=r/t,l=r%t,f=s-o*c;r=t,t=l,s=o,o=f}if(r!==_1n$3)throw new Error("invert: does not exist");return mod(s,e)}function assertIsSquare(n,e,t){if(!n.eql(n.sqr(e),t))throw new Error("Cannot find square root")}function sqrt3mod4(n,e){const t=(n.ORDER+_1n$3)/_4n$1,r=n.pow(e,t);return assertIsSquare(n,r,e),r}function sqrt5mod8(n,e){const t=(n.ORDER-_5n)/_8n,r=n.mul(e,_2n$2),s=n.pow(r,t),o=n.mul(e,s),a=n.mul(n.mul(o,_2n$2),s),c=n.mul(o,n.sub(a,n.ONE));return assertIsSquare(n,c,e),c}function sqrt9mod16(n){const e=Field(n),t=tonelliShanks(n),r=t(e,e.neg(e.ONE)),s=t(e,r),o=t(e,e.neg(r)),a=(n+_7n)/_16n;return(c,l)=>{let f=c.pow(l,a),h=c.mul(f,r);const u=c.mul(f,s),p=c.mul(f,o),y=c.eql(c.sqr(h),l),b=c.eql(c.sqr(u),l);f=c.cmov(f,h,y),h=c.cmov(p,u,b);const m=c.eql(c.sqr(h),l),k=c.cmov(f,h,m);return assertIsSquare(c,k,l),k}}function tonelliShanks(n){if(n<_3n$1)throw new Error("sqrt is not defined for small field");let e=n-_1n$3,t=0;for(;e%_2n$2===_0n$3;)e/=_2n$2,t++;let r=_2n$2;const s=Field(n);for(;FpLegendre(s,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(t===1)return sqrt3mod4;let o=s.pow(r,e);const a=(e+_1n$3)/_2n$2;return function(l,f){if(l.is0(f))return f;if(FpLegendre(l,f)!==1)throw new Error("Cannot find square root");let h=t,u=l.mul(l.ONE,o),p=l.pow(f,e),y=l.pow(f,a);for(;!l.eql(p,l.ONE);){if(l.is0(p))return l.ZERO;let b=1,m=l.sqr(p);for(;!l.eql(m,l.ONE);)if(b++,m=l.sqr(m),b===h)throw new Error("Cannot find square root");const k=_1n$3<(r[s]="function",r),e);return _validateObject(n,t),n}function FpPow(n,e,t){if(t<_0n$3)throw new Error("invalid exponent, negatives unsupported");if(t===_0n$3)return n.ONE;if(t===_1n$3)return e;let r=n.ONE,s=e;for(;t>_0n$3;)t&_1n$3&&(r=n.mul(r,s)),s=n.sqr(s),t>>=_1n$3;return r}function FpInvertBatch(n,e,t=!1){const r=new Array(e.length).fill(t?n.ZERO:void 0),s=e.reduce((a,c,l)=>n.is0(c)?a:(r[l]=a,n.mul(a,c)),n.ONE),o=n.inv(s);return e.reduceRight((a,c,l)=>n.is0(c)?a:(r[l]=n.mul(a,r[l]),n.mul(a,c)),o),r}function FpLegendre(n,e){const t=(n.ORDER-_1n$3)/_2n$2,r=n.pow(e,t),s=n.eql(r,n.ONE),o=n.eql(r,n.ZERO),a=n.eql(r,n.neg(n.ONE));if(!s&&!o&&!a)throw new Error("invalid Legendre symbol result");return s?1:o?0:-1}function nLength(n,e){e!==void 0&&anumber$1(e);const t=e!==void 0?e:n.toString(2).length,r=Math.ceil(t/8);return{nBitLength:t,nByteLength:r}}function Field(n,e,t=!1,r={}){if(n<=_0n$3)throw new Error("invalid field: expected ORDER > 0, got "+n);let s,o,a=!1,c;if(typeof e=="object"&&e!=null){if(r.sqrt||t)throw new Error("cannot specify opts in two arguments");const p=e;p.BITS&&(s=p.BITS),p.sqrt&&(o=p.sqrt),typeof p.isLE=="boolean"&&(t=p.isLE),typeof p.modOnDecode=="boolean"&&(a=p.modOnDecode),c=p.allowedLengths}else typeof e=="number"&&(s=e),r.sqrt&&(o=r.sqrt);const{nBitLength:l,nByteLength:f}=nLength(n,s);if(f>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let h;const u=Object.freeze({ORDER:n,isLE:t,BITS:l,BYTES:f,MASK:bitMask(l),ZERO:_0n$3,ONE:_1n$3,allowedLengths:c,create:p=>mod(p,n),isValid:p=>{if(typeof p!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof p);return _0n$3<=p&&pp===_0n$3,isValidNot0:p=>!u.is0(p)&&u.isValid(p),isOdd:p=>(p&_1n$3)===_1n$3,neg:p=>mod(-p,n),eql:(p,y)=>p===y,sqr:p=>mod(p*p,n),add:(p,y)=>mod(p+y,n),sub:(p,y)=>mod(p-y,n),mul:(p,y)=>mod(p*y,n),pow:(p,y)=>FpPow(u,p,y),div:(p,y)=>mod(p*invert(y,n),n),sqrN:p=>p*p,addN:(p,y)=>p+y,subN:(p,y)=>p-y,mulN:(p,y)=>p*y,inv:p=>invert(p,n),sqrt:o||(p=>(h||(h=FpSqrt(n)),h(u,p))),toBytes:p=>t?numberToBytesLE(p,f):numberToBytesBE(p,f),fromBytes:(p,y=!0)=>{if(c){if(!c.includes(p.length)||p.length>f)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+p.length);const m=new Uint8Array(f);m.set(p,t?0:m.length-p.length),p=m}if(p.length!==f)throw new Error("Field.fromBytes: expected "+f+" bytes, got "+p.length);let b=t?bytesToNumberLE(p):bytesToNumberBE(p);if(a&&(b=mod(b,n)),!y&&!u.isValid(b))throw new Error("invalid field element: outside of range 0..ORDER");return b},invertBatch:p=>FpInvertBatch(u,p),cmov:(p,y,b)=>b?y:p});return Object.freeze(u)}function getFieldBytesLength(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const e=n.toString(2).length;return Math.ceil(e/8)}function getMinHashLength(n){const e=getFieldBytesLength(n);return e+Math.ceil(e/2)}function mapHashToField(n,e,t=!1){const r=n.length,s=getFieldBytesLength(e),o=getMinHashLength(e);if(r<16||r1024)throw new Error("expected "+o+"-1024 bytes of input, got "+r);const a=t?bytesToNumberLE(n):bytesToNumberBE(n),c=mod(a,e-_1n$3)+_1n$3;return t?numberToBytesLE(c,s):numberToBytesBE(c,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$2=BigInt(0),_1n$2=BigInt(1);function negateCt(n,e){const t=e.negate();return n?t:e}function normalizeZ(n,e){const t=FpInvertBatch(n.Fp,e.map(r=>r.Z));return e.map((r,s)=>n.fromAffine(r.toAffine(t[s])))}function validateW(n,e){if(!Number.isSafeInteger(n)||n<=0||n>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+n)}function calcWOpts(n,e){validateW(n,e);const t=Math.ceil(e/n)+1,r=2**(n-1),s=2**n,o=bitMask(n),a=BigInt(n);return{windows:t,windowSize:r,mask:o,maxNumber:s,shiftBy:a}}function calcOffsets(n,e,t){const{windowSize:r,mask:s,maxNumber:o,shiftBy:a}=t;let c=Number(n&s),l=n>>a;c>r&&(c-=o,l+=_1n$2);const f=e*r,h=f+Math.abs(c)-1,u=c===0,p=c<0,y=e%2!==0;return{nextN:l,offset:h,isZero:u,isNeg:p,isNegF:y,offsetF:f}}function validateMSMPoints(n,e){if(!Array.isArray(n))throw new Error("array expected");n.forEach((t,r)=>{if(!(t instanceof e))throw new Error("invalid point at index "+r)})}function validateMSMScalars(n,e){if(!Array.isArray(n))throw new Error("array of scalars expected");n.forEach((t,r)=>{if(!e.isValid(t))throw new Error("invalid scalar at index "+r)})}const pointPrecomputes=new WeakMap,pointWindowSizes=new WeakMap;function getW(n){return pointWindowSizes.get(n)||1}function assert0(n){if(n!==_0n$2)throw new Error("invalid wNAF")}class wNAF{constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,r=this.ZERO){let s=e;for(;t>_0n$2;)t&_1n$2&&(r=r.add(s)),s=s.double(),t>>=_1n$2;return r}precomputeWindow(e,t){const{windows:r,windowSize:s}=calcWOpts(t,this.bits),o=[];let a=e,c=a;for(let l=0;l_0n$2||r>_0n$2;)t&_1n$2&&(o=o.add(s)),r&_1n$2&&(a=a.add(s)),s=s.double(),t>>=_1n$2,r>>=_1n$2;return{p1:o,p2:a}}function pippenger(n,e,t,r){validateMSMPoints(t,n),validateMSMScalars(r,e);const s=t.length,o=r.length;if(s!==o)throw new Error("arrays of points and scalars must have equal length");const a=n.ZERO,c=bitLen(BigInt(s));let l=1;c>12?l=c-3:c>4?l=c-2:c>0&&(l=2);const f=bitMask(l),h=new Array(Number(f)+1).fill(a),u=Math.floor((e.BITS-1)/l)*l;let p=a;for(let y=u;y>=0;y-=l){h.fill(a);for(let m=0;m>BigInt(y)&f);h[R]=h[R].add(t[m])}let b=a;for(let m=h.length-1,k=a;m>0;m--)k=k.add(h[m]),b=b.add(k);if(p=p.add(b),y!==0)for(let m=0;m_0n$2))throw new Error(`CURVE.${c} must be positive bigint`)}const r=createField(e.p,t.Fp),s=createField(e.n,t.Fn),a=["Gx","Gy","a",n==="weierstrass"?"b":"d"];for(const c of a)if(!r.isValid(e[c]))throw new Error(`CURVE.${c} must be valid field element of CURVE.Fp`);return{Fp:r,Fn:s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const divNearest=(n,e)=>(n+(n>=0?e:-e)/_2n$1)/e;function _splitEndoScalar(n,e,t){const[[r,s],[o,a]]=e,c=divNearest(a*n,t),l=divNearest(-s*n,t);let f=n-c*r-l*o,h=-c*s-l*a;const u=f<_0n$1,p=h<_0n$1;u&&(f=-f),p&&(h=-h);const y=bitMask(Math.ceil(bitLen(t)/2))+_1n$1;if(f<_0n$1||f>=y||h<_0n$1||h>=y)throw new Error("splitScalar (endomorphism): failed, k="+n);return{k1neg:u,k1:f,k2neg:p,k2:h}}function validateSigVerOpts(n){n.lowS!==void 0&&abool("lowS",n.lowS),n.prehash!==void 0&&abool("prehash",n.prehash)}class DERErr extends Error{constructor(e=""){super(e)}}const DER={Err:DERErr,_tlv:{encode:(n,e)=>{const{Err:t}=DER;if(n<0||n>256)throw new t("tlv.encode: wrong tag");if(e.length&1)throw new t("tlv.encode: unpadded data");const r=e.length/2,s=numberToHexUnpadded(r);if(s.length/2&128)throw new t("tlv.encode: long form length too big");const o=r>127?numberToHexUnpadded(s.length/2|128):"";return numberToHexUnpadded(n)+o+s+e},decode(n,e){const{Err:t}=DER;let r=0;if(n<0||n>256)throw new t("tlv.encode: wrong tag");if(e.length<2||e[r++]!==n)throw new t("tlv.decode: wrong tlv");const s=e[r++],o=!!(s&128);let a=0;if(!o)a=s;else{const l=s&127;if(!l)throw new t("tlv.decode(long): indefinite length not supported");if(l>4)throw new t("tlv.decode(long): byte length is too big");const f=e.subarray(r,r+l);if(f.length!==l)throw new t("tlv.decode: length bytes not complete");if(f[0]===0)throw new t("tlv.decode(long): zero leftmost byte");for(const h of f)a=a<<8|h;if(r+=l,a<128)throw new t("tlv.decode(long): not minimal encoding")}const c=e.subarray(r,r+a);if(c.length!==a)throw new t("tlv.decode: wrong value length");return{v:c,l:e.subarray(r+a)}}},_int:{encode(n){const{Err:e}=DER;if(n<_0n$1)throw new e("integer: negative integers are not allowed");let t=numberToHexUnpadded(n);if(Number.parseInt(t[0],16)&8&&(t="00"+t),t.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return t},decode(n){const{Err:e}=DER;if(n[0]&128)throw new e("invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return bytesToNumberBE(n)}},toSig(n){const{Err:e,_int:t,_tlv:r}=DER,s=ensureBytes("signature",n),{v:o,l:a}=r.decode(48,s);if(a.length)throw new e("invalid signature: left bytes after parsing");const{v:c,l}=r.decode(2,o),{v:f,l:h}=r.decode(2,l);if(h.length)throw new e("invalid signature: left bytes after parsing");return{r:t.decode(c),s:t.decode(f)}},hexFromSig(n){const{_tlv:e,_int:t}=DER,r=e.encode(2,t.encode(n.r)),s=e.encode(2,t.encode(n.s)),o=r+s;return e.encode(48,o)}},_0n$1=BigInt(0),_1n$1=BigInt(1),_2n$1=BigInt(2),_3n=BigInt(3),_4n=BigInt(4);function _legacyHelperEquat(n,e,t){function r(s){const o=n.sqr(s),a=n.mul(o,s);return n.add(n.add(a,n.mul(s,e)),t)}return r}function _normFnElement(n,e){const{BYTES:t}=n;let r;if(typeof e=="bigint")r=e;else{let s=ensureBytes("private key",e);try{r=n.fromBytes(s)}catch{throw new Error(`invalid private key: expected ui8a of size ${t}, got ${typeof e}`)}}if(!n.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}function weierstrassN(n,e={}){const{Fp:t,Fn:r}=_createCurveFields("weierstrass",n,e),{h:s,n:o}=n;_validateObject(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:a}=e;if(a&&(!t.is0(n.a)||typeof a.beta!="bigint"||!Array.isArray(a.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');function c(){if(!t.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function l(O,$,E){const{x:_,y:T}=$.toAffine(),N=t.toBytes(_);if(abool("isCompressed",E),E){c();const x=!t.isOdd(T);return concatBytes(pprefix(x),N)}else return concatBytes(Uint8Array.of(4),N,t.toBytes(T))}function f(O){abytes(O);const $=t.BYTES,E=$+1,_=2*$+1,T=O.length,N=O[0],x=O.subarray(1);if(T===E&&(N===2||N===3)){const w=t.fromBytes(x);if(!t.isValid(w))throw new Error("bad point: is not on curve, wrong x");const v=p(w);let S;try{S=t.sqrt(v)}catch(I){const P=I instanceof Error?": "+I.message:"";throw new Error("bad point: is not on curve, sqrt error"+P)}c();const A=t.isOdd(S);return(N&1)===1!==A&&(S=t.neg(S)),{x:w,y:S}}else if(T===_&&N===4){const w=t.fromBytes(x.subarray($*0,$*1)),v=t.fromBytes(x.subarray($*1,$*2));if(!y(w,v))throw new Error("bad point: is not on curve");return{x:w,y:v}}else throw new Error(`bad point: got length ${T}, expected compressed=${E} or uncompressed=${_}`)}const h=e.toBytes||l,u=e.fromBytes||f,p=_legacyHelperEquat(t,n.a,n.b);function y(O,$){const E=t.sqr($),_=p(O);return t.eql(E,_)}if(!y(n.Gx,n.Gy))throw new Error("bad curve params: generator point");const b=t.mul(t.pow(n.a,_3n),_4n),m=t.mul(t.sqr(n.b),BigInt(27));if(t.is0(t.add(b,m)))throw new Error("bad curve params: a or b");function k(O,$,E=!1){if(!t.isValid($)||E&&t.is0($))throw new Error(`bad point coordinate ${O}`);return $}function R(O){if(!(O instanceof C))throw new Error("ProjectivePoint expected")}function B(O){if(!a||!a.basises)throw new Error("no endo");return _splitEndoScalar(O,a.basises,r.ORDER)}const D=memoized((O,$)=>{const{X:E,Y:_,Z:T}=O;if(t.eql(T,t.ONE))return{x:E,y:_};const N=O.is0();$==null&&($=N?t.ONE:t.inv(T));const x=t.mul(E,$),w=t.mul(_,$),v=t.mul(T,$);if(N)return{x:t.ZERO,y:t.ZERO};if(!t.eql(v,t.ONE))throw new Error("invZ was invalid");return{x,y:w}}),U=memoized(O=>{if(O.is0()){if(e.allowInfinityPoint&&!t.is0(O.Y))return;throw new Error("bad point: ZERO")}const{x:$,y:E}=O.toAffine();if(!t.isValid($)||!t.isValid(E))throw new Error("bad point: x or y not field elements");if(!y($,E))throw new Error("bad point: equation left != right");if(!O.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function H(O,$,E,_,T){return E=new C(t.mul(E.X,O),E.Y,E.Z),$=negateCt(_,$),E=negateCt(T,E),$.add(E)}class C{constructor($,E,_){this.X=k("x",$),this.Y=k("y",E,!0),this.Z=k("z",_),Object.freeze(this)}static fromAffine($){const{x:E,y:_}=$||{};if(!$||!t.isValid(E)||!t.isValid(_))throw new Error("invalid affine point");if($ instanceof C)throw new Error("projective point not allowed");return t.is0(E)&&t.is0(_)?C.ZERO:new C(E,_,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}static normalizeZ($){return normalizeZ(C,$)}static fromBytes($){return abytes($),C.fromHex($)}static fromHex($){const E=C.fromAffine(u(ensureBytes("pointHex",$)));return E.assertValidity(),E}static fromPrivateKey($){return C.BASE.multiply(_normFnElement(r,$))}static msm($,E){return pippenger(C,r,$,E)}_setWindowSize($){this.precompute($)}precompute($=8,E=!0){return F.createCache(this,$),E||this.multiply(_3n),this}assertValidity(){U(this)}hasEvenY(){const{y:$}=this.toAffine();if(!t.isOdd)throw new Error("Field doesn't support isOdd");return!t.isOdd($)}equals($){R($);const{X:E,Y:_,Z:T}=this,{X:N,Y:x,Z:w}=$,v=t.eql(t.mul(E,w),t.mul(N,T)),S=t.eql(t.mul(_,w),t.mul(x,T));return v&&S}negate(){return new C(this.X,t.neg(this.Y),this.Z)}double(){const{a:$,b:E}=n,_=t.mul(E,_3n),{X:T,Y:N,Z:x}=this;let w=t.ZERO,v=t.ZERO,S=t.ZERO,A=t.mul(T,T),L=t.mul(N,N),I=t.mul(x,x),P=t.mul(T,N);return P=t.add(P,P),S=t.mul(T,x),S=t.add(S,S),w=t.mul($,S),v=t.mul(_,I),v=t.add(w,v),w=t.sub(L,v),v=t.add(L,v),v=t.mul(w,v),w=t.mul(P,w),S=t.mul(_,S),I=t.mul($,I),P=t.sub(A,I),P=t.mul($,P),P=t.add(P,S),S=t.add(A,A),A=t.add(S,A),A=t.add(A,I),A=t.mul(A,P),v=t.add(v,A),I=t.mul(N,x),I=t.add(I,I),A=t.mul(I,P),w=t.sub(w,A),S=t.mul(I,L),S=t.add(S,S),S=t.add(S,S),new C(w,v,S)}add($){R($);const{X:E,Y:_,Z:T}=this,{X:N,Y:x,Z:w}=$;let v=t.ZERO,S=t.ZERO,A=t.ZERO;const L=n.a,I=t.mul(n.b,_3n);let P=t.mul(E,N),V=t.mul(_,x),z=t.mul(T,w),W=t.add(E,_),q=t.add(N,x);W=t.mul(W,q),q=t.add(P,V),W=t.sub(W,q),q=t.add(E,T);let j=t.add(N,w);return q=t.mul(q,j),j=t.add(P,z),q=t.sub(q,j),j=t.add(_,T),v=t.add(x,w),j=t.mul(j,v),v=t.add(V,z),j=t.sub(j,v),A=t.mul(L,q),v=t.mul(I,z),A=t.add(v,A),v=t.sub(V,A),A=t.add(V,A),S=t.mul(v,A),V=t.add(P,P),V=t.add(V,P),z=t.mul(L,z),q=t.mul(I,q),V=t.add(V,z),z=t.sub(P,z),z=t.mul(L,z),q=t.add(q,z),P=t.mul(V,q),S=t.add(S,P),P=t.mul(j,q),v=t.mul(W,v),v=t.sub(v,P),P=t.mul(W,V),A=t.mul(j,A),A=t.add(A,P),new C(v,S,A)}subtract($){return this.add($.negate())}is0(){return this.equals(C.ZERO)}multiply($){const{endo:E}=e;if(!r.isValidNot0($))throw new Error("invalid scalar: out of range");let _,T;const N=x=>F.cached(this,x,w=>normalizeZ(C,w));if(E){const{k1neg:x,k1:w,k2neg:v,k2:S}=B($),{p:A,f:L}=N(w),{p:I,f:P}=N(S);T=L.add(P),_=H(E.beta,A,I,x,v)}else{const{p:x,f:w}=N($);_=x,T=w}return normalizeZ(C,[_,T])[0]}multiplyUnsafe($){const{endo:E}=e,_=this;if(!r.isValid($))throw new Error("invalid scalar: out of range");if($===_0n$1||_.is0())return C.ZERO;if($===_1n$1)return _;if(F.hasCache(this))return this.multiply($);if(E){const{k1neg:T,k1:N,k2neg:x,k2:w}=B($),{p1:v,p2:S}=mulEndoUnsafe(C,_,N,w);return H(E.beta,v,S,T,x)}else return F.unsafe(_,$)}multiplyAndAddUnsafe($,E,_){const T=this.multiplyUnsafe(E).add($.multiplyUnsafe(_));return T.is0()?void 0:T}toAffine($){return D(this,$)}isTorsionFree(){const{isTorsionFree:$}=e;return s===_1n$1?!0:$?$(C,this):F.unsafe(this,o).is0()}clearCofactor(){const{clearCofactor:$}=e;return s===_1n$1?this:$?$(C,this):this.multiplyUnsafe(s)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}toBytes($=!0){return abool("isCompressed",$),this.assertValidity(),h(C,this,$)}toRawBytes($=!0){return this.toBytes($)}toHex($=!0){return bytesToHex(this.toBytes($))}toString(){return``}}C.BASE=new C(n.Gx,n.Gy,t.ONE),C.ZERO=new C(t.ZERO,t.ONE,t.ZERO),C.Fp=t,C.Fn=r;const M=r.BITS,F=new wNAF(C,e.endo?Math.ceil(M/2):M);return C}function pprefix(n){return Uint8Array.of(n?2:3)}function ecdsa(n,e,t={}){ahash(e),_validateObject(t,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=t.randomBytes||randomBytes,s=t.hmac||((w,...v)=>hmac(e,w,concatBytes(...v))),{Fp:o,Fn:a}=n,{ORDER:c,BITS:l}=a,f=getMinHashLength(c),h={secret:a.BYTES,public:1+o.BYTES,publicUncompressed:1+2*o.BYTES,signature:2*a.BYTES,seed:f};function u(w){const v=c>>_1n$1;return w>v}function p(w){return u(w)?a.neg(w):w}function y(w,v){if(!a.isValidNot0(v))throw new Error(`invalid signature ${w}: out of range 1..CURVE.n`)}class b{constructor(v,S,A){y("r",v),y("s",S),this.r=v,this.s=S,A!=null&&(this.recovery=A),Object.freeze(this)}static fromBytes(v,S="compact"){if(S==="compact"){const A=a.BYTES;abytes(v,A*2);const L=v.subarray(0,A),I=v.subarray(A,A*2);return new b(a.fromBytes(L),a.fromBytes(I))}if(S==="der"){abytes(v);const{r:A,s:L}=DER.toSig(v);return new b(A,L)}throw new Error("invalid format")}static fromHex(v,S){return this.fromBytes(hexToBytes(v),S)}addRecoveryBit(v){return new b(this.r,this.s,v)}recoverPublicKey(v){const S=o.ORDER,{r:A,s:L,recovery:I}=this;if(I==null||![0,1,2,3].includes(I))throw new Error("recovery id invalid");if(c*_2n$11)throw new Error("recovery id is ambiguous for h>1 curve");const V=I===2||I===3?A+c:A;if(!o.isValid(V))throw new Error("recovery id 2 or 3 invalid");const z=o.toBytes(V),W=n.fromHex(concatBytes(pprefix((I&1)===0),z)),q=a.inv(V),j=M(ensureBytes("msgHash",v)),G=a.create(-j*q),Z=a.create(L*q),Y=n.BASE.multiplyUnsafe(G).add(W.multiplyUnsafe(Z));if(Y.is0())throw new Error("point at infinify");return Y.assertValidity(),Y}hasHighS(){return u(this.s)}normalizeS(){return this.hasHighS()?new b(this.r,a.neg(this.s),this.recovery):this}toBytes(v="compact"){if(v==="compact")return concatBytes(a.toBytes(this.r),a.toBytes(this.s));if(v==="der")return hexToBytes(DER.hexFromSig(this));throw new Error("invalid format")}toHex(v){return bytesToHex(this.toBytes(v))}assertValidity(){}static fromCompact(v){return b.fromBytes(ensureBytes("sig",v),"compact")}static fromDER(v){return b.fromBytes(ensureBytes("sig",v),"der")}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return bytesToHex(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return bytesToHex(this.toBytes("compact"))}}function m(w){try{return!!_normFnElement(a,w)}catch{return!1}}function k(w,v){try{const S=w.length;return v===!0&&S!==h.public||v===!1&&S!==h.publicUncompressed?!1:!!n.fromBytes(w)}catch{return!1}}function R(w=r(f)){return mapHashToField(w,c)}const B={isValidSecretKey:m,isValidPublicKey:k,randomSecretKey:R,isValidPrivateKey:m,randomPrivateKey:R,normPrivateKeyToScalar:w=>_normFnElement(a,w),precompute(w=8,v=n.BASE){return v.precompute(w,!1)}};function D(w,v=!0){return n.BASE.multiply(_normFnElement(a,w)).toBytes(v)}function U(w){if(typeof w=="bigint")return!1;if(w instanceof n)return!0;if(a.allowedLengths||h.secret===h.public)return;const v=ensureBytes("key",w).length;return v===h.public||v===h.publicUncompressed}function H(w,v,S=!0){if(U(w)===!0)throw new Error("first arg must be private key");if(U(v)===!1)throw new Error("second arg must be public key");const A=_normFnElement(a,w);return n.fromHex(v).multiply(A).toBytes(S)}const C=t.bits2int||function(w){if(w.length>8192)throw new Error("input is too large");const v=bytesToNumberBE(w),S=w.length*8-l;return S>0?v>>BigInt(S):v},M=t.bits2int_modN||function(w){return a.create(C(w))},F=bitMask(l);function O(w){return aInRange("num < 2^"+l,w,_0n$1,F),a.toBytes(w)}function $(w,v,S=E){if(["recovered","canonical"].some(G=>G in S))throw new Error("sign() legacy options not supported");let{lowS:A,prehash:L,extraEntropy:I}=S;A==null&&(A=!0),w=ensureBytes("msgHash",w),validateSigVerOpts(S),L&&(w=ensureBytes("prehashed msgHash",e(w)));const P=M(w),V=_normFnElement(a,v),z=[O(V),O(P)];if(I!=null&&I!==!1){const G=I===!0?r(h.secret):I;z.push(ensureBytes("extraEntropy",G))}const W=concatBytes(...z),q=P;function j(G){const Z=C(G);if(!a.isValidNot0(Z))return;const Y=a.inv(Z),te=n.BASE.multiply(Z).toAffine(),J=a.create(te.x);if(J===_0n$1)return;const K=a.create(Y*a.create(q+J*V));if(K===_0n$1)return;let Q=(te.x===J?0:2)|Number(te.y&_1n$1),Se=K;return A&&u(K)&&(Se=p(K),Q^=1),new b(J,Se,Q)}return{seed:W,k2sig:j}}const E={lowS:t.lowS,prehash:!1},_={lowS:t.lowS,prehash:!1};function T(w,v,S=E){const{seed:A,k2sig:L}=$(w,v,S);return createHmacDrbg(e.outputLen,a.BYTES,s)(A,L)}n.BASE.precompute(8);function N(w,v,S,A=_){const L=w;v=ensureBytes("msgHash",v),S=ensureBytes("publicKey",S),validateSigVerOpts(A);const{lowS:I,prehash:P,format:V}=A;if("strict"in A)throw new Error("options.strict was renamed to lowS");let z,W;if(V===void 0){const q=typeof L=="string"||isBytes$1(L),j=!q&&L!==null&&typeof L=="object"&&typeof L.r=="bigint"&&typeof L.s=="bigint";if(!q&&!j)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(j)z=new b(L.r,L.s);else if(q){try{z=b.fromDER(L)}catch(G){if(!(G instanceof DER.Err))throw G}if(!z)try{z=b.fromCompact(L)}catch{return!1}}}else if(V==="compact"||V==="der"){if(typeof L!="string"&&!isBytes$1(L))throw new Error('"der" / "compact" format expects Uint8Array signature');z=b.fromBytes(ensureBytes("sig",L),V)}else if(V==="js"){if(!(L instanceof b))throw new Error('"js" format expects Signature instance');z=L}else throw new Error('format must be "compact", "der" or "js"');if(!z)return!1;try{if(W=n.fromHex(S),I&&z.hasHighS())return!1;P&&(v=e(v));const{r:q,s:j}=z,G=M(v),Z=a.inv(j),Y=a.create(G*Z),te=a.create(q*Z),J=n.BASE.multiplyUnsafe(Y).add(W.multiplyUnsafe(te));return J.is0()?!1:a.create(J.x)===q}catch{return!1}}function x(w){const v=B.randomSecretKey(w);return{secretKey:v,publicKey:D(v)}}return Object.freeze({keygen:x,getPublicKey:D,sign:T,verify:N,getSharedSecret:H,utils:B,Point:n,Signature:b,info:{type:"weierstrass",lengths:h,publicKeyHasPrefix:!0}})}function _weierstrass_legacy_opts_to_new(n){const e={a:n.a,b:n.b,p:n.Fp.ORDER,n:n.n,h:n.h,Gx:n.Gx,Gy:n.Gy},t=n.Fp;let r=n.allowedPrivateKeyLengths?Array.from(new Set(n.allowedPrivateKeyLengths.map(a=>Math.ceil(a/2)))):void 0;const s=Field(e.n,{BITS:n.nBitLength,allowedLengths:r,modOnDecode:n.wrapPrivateKey}),o={Fp:t,Fn:s,allowInfinityPoint:n.allowInfinityPoint,endo:n.endo,isTorsionFree:n.isTorsionFree,clearCofactor:n.clearCofactor,fromBytes:n.fromBytes,toBytes:n.toBytes};return{CURVE:e,curveOpts:o}}function _ecdsa_legacy_opts_to_new(n){const{CURVE:e,curveOpts:t}=_weierstrass_legacy_opts_to_new(n),r={hmac:n.hmac,randomBytes:n.randomBytes,lowS:n.lowS,bits2int:n.bits2int,bits2int_modN:n.bits2int_modN};return{CURVE:e,curveOpts:t,hash:n.hash,ecdsaOpts:r}}function _ecdsa_new_output_to_legacy(n,e){return Object.assign({},e,{ProjectivePoint:e.Point,CURVE:n})}function weierstrass(n){const{CURVE:e,curveOpts:t,hash:r,ecdsaOpts:s}=_ecdsa_legacy_opts_to_new(n),o=weierstrassN(e,t),a=ecdsa(o,r,s);return _ecdsa_new_output_to_legacy(n,a)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function createCurve(n,e){const t=r=>weierstrass({...n,hash:r});return{...t(e),create:t}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const secp256k1_CURVE={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},secp256k1_ENDO={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},_0n=BigInt(0),_1n=BigInt(1),_2n=BigInt(2);function sqrtMod(n){const e=secp256k1_CURVE.p,t=BigInt(3),r=BigInt(6),s=BigInt(11),o=BigInt(22),a=BigInt(23),c=BigInt(44),l=BigInt(88),f=n*n*n%e,h=f*f*n%e,u=pow2(h,t,e)*h%e,p=pow2(u,t,e)*h%e,y=pow2(p,_2n,e)*f%e,b=pow2(y,s,e)*y%e,m=pow2(b,o,e)*b%e,k=pow2(m,c,e)*m%e,R=pow2(k,l,e)*k%e,B=pow2(R,c,e)*m%e,D=pow2(B,t,e)*h%e,U=pow2(D,a,e)*b%e,H=pow2(U,r,e)*f%e,C=pow2(H,_2n,e);if(!Fpk1.eql(Fpk1.sqr(C),n))throw new Error("Cannot find square root");return C}const Fpk1=Field(secp256k1_CURVE.p,void 0,void 0,{sqrt:sqrtMod}),secp256k1=createCurve({...secp256k1_CURVE,Fp:Fpk1,lowS:!0,endo:secp256k1_ENDO},sha256$1),TAGGED_HASH_PREFIXES={};function taggedHash(n,...e){let t=TAGGED_HASH_PREFIXES[n];if(t===void 0){const r=sha256$1(Uint8Array.from(n,s=>s.charCodeAt(0)));t=concatBytes(r,r),TAGGED_HASH_PREFIXES[n]=t}return sha256$1(concatBytes(t,...e))}const pointToBytes=n=>n.toBytes(!0).slice(1),numTo32b=n=>numberToBytesBE(n,32),modP=n=>mod(n,secp256k1_CURVE.p),modN=n=>mod(n,secp256k1_CURVE.n),Point=(()=>secp256k1.Point)(),hasEven=n=>n%_2n===_0n;function schnorrGetExtPubKey(n){let e=_normFnElement(Point.Fn,n),t=Point.BASE.multiply(e);return{scalar:hasEven(t.y)?e:modN(-e),bytes:pointToBytes(t)}}function lift_x(n){aInRange("x",n,_1n,secp256k1_CURVE.p);const e=modP(n*n),t=modP(e*n+BigInt(7));let r=sqrtMod(t);hasEven(r)||(r=modP(-r));const s=Point.fromAffine({x:n,y:r});return s.assertValidity(),s}const num=bytesToNumberBE;function challenge(...n){return modN(num(taggedHash("BIP0340/challenge",...n)))}function schnorrGetPublicKey(n){return schnorrGetExtPubKey(n).bytes}function schnorrSign(n,e,t=randomBytes(32)){const r=ensureBytes("message",n),{bytes:s,scalar:o}=schnorrGetExtPubKey(e),a=ensureBytes("auxRand",t,32),c=numTo32b(o^num(taggedHash("BIP0340/aux",a))),l=taggedHash("BIP0340/nonce",c,s,r),f=modN(num(l));if(f===_0n)throw new Error("sign failed: k is zero");const{bytes:h,scalar:u}=schnorrGetExtPubKey(f),p=challenge(h,s,r),y=new Uint8Array(64);if(y.set(h,0),y.set(numTo32b(modN(u+p*o)),32),!schnorrVerify(y,r,s))throw new Error("sign: Invalid signature produced");return y}function schnorrVerify(n,e,t){const r=ensureBytes("signature",n,64),s=ensureBytes("message",e),o=ensureBytes("publicKey",t,32);try{const a=lift_x(num(o)),c=num(r.subarray(0,32));if(!inRange(c,_1n,secp256k1_CURVE.p))return!1;const l=num(r.subarray(32,64));if(!inRange(l,_1n,secp256k1_CURVE.n))return!1;const f=challenge(numTo32b(c),pointToBytes(a),s),h=Point.BASE.multiplyUnsafe(l).add(a.multiplyUnsafe(modN(-f))),{x:u,y:p}=h.toAffine();return!(h.is0()||!hasEven(p)||u!==c)}catch{return!1}}const schnorr=(()=>{const t=(s=randomBytes(48))=>mapHashToField(s,secp256k1_CURVE.n);secp256k1.utils.randomSecretKey;function r(s){const o=t(s);return{secretKey:o,publicKey:schnorrGetPublicKey(o)}}return{keygen:r,getPublicKey:schnorrGetPublicKey,sign:schnorrSign,verify:schnorrVerify,Point,utils:{randomSecretKey:t,randomPrivateKey:t,taggedHash,lift_x,pointToBytes,numberToBytesBE,bytesToNumberBE,mod},info:{type:"weierstrass",publicKeyHasPrefix:!1,lengths:{secret:32,public:32,signature:32*2,seed:48}}}})(),sha256=sha256$1;var dist={},LRUCache$1={},LRUCacheNode$1={};Object.defineProperty(LRUCacheNode$1,"__esModule",{value:!0});LRUCacheNode$1.LRUCacheNode=void 0;class LRUCacheNode{constructor(e,t,r){const{entryExpirationTimeInMS:s=null,next:o=null,prev:a=null,onEntryEvicted:c,onEntryMarkedAsMostRecentlyUsed:l,clone:f,cloneFn:h}=r??{};if(typeof s=="number"&&(s<=0||Number.isNaN(s)))throw new Error("entryExpirationTimeInMS must either be null (no expiry) or greater than 0");this.clone=f??!1,this.cloneFn=h??this.defaultClone,this.key=e,this.internalValue=this.clone?this.cloneFn(t):t,this.created=Date.now(),this.entryExpirationTimeInMS=s,this.next=o,this.prev=a,this.onEntryEvicted=c,this.onEntryMarkedAsMostRecentlyUsed=l}get value(){return this.clone?this.cloneFn(this.internalValue):this.internalValue}get isExpired(){return typeof this.entryExpirationTimeInMS=="number"&&Date.now()-this.created>this.entryExpirationTimeInMS}invokeOnEvicted(){if(this.onEntryEvicted){const{key:e,value:t,isExpired:r}=this;this.onEntryEvicted({key:e,value:t,isExpired:r})}}invokeOnEntryMarkedAsMostRecentlyUsed(){if(this.onEntryMarkedAsMostRecentlyUsed){const{key:e,value:t}=this;this.onEntryMarkedAsMostRecentlyUsed({key:e,value:t})}}defaultClone(e){return typeof e=="boolean"||typeof e=="string"||typeof e=="number"?e:JSON.parse(JSON.stringify(e))}}LRUCacheNode$1.LRUCacheNode=LRUCacheNode;Object.defineProperty(LRUCache$1,"__esModule",{value:!0});LRUCache$1.LRUCache=void 0;const LRUCacheNode_1=LRUCacheNode$1;class LRUCache{constructor(e){this.lookupTable=new Map,this.head=null,this.tail=null;const{maxSize:t=25,entryExpirationTimeInMS:r=null,onEntryEvicted:s,onEntryMarkedAsMostRecentlyUsed:o,cloneFn:a,clone:c}=e??{};if(Number.isNaN(t)||t<=0)throw new Error("maxSize must be greater than 0.");if(typeof r=="number"&&(r<=0||Number.isNaN(r)))throw new Error("entryExpirationTimeInMS must either be null (no expiry) or greater than 0");this.maxSizeInternal=t,this.entryExpirationTimeInMS=r,this.onEntryEvicted=s,this.onEntryMarkedAsMostRecentlyUsed=o,this.clone=c,this.cloneFn=a}get size(){return this.cleanCache(),this.lookupTable.size}get remainingSize(){return this.maxSizeInternal-this.size}get newest(){return this.head?this.head.isExpired?(this.removeNodeFromListAndLookupTable(this.head),this.newest):this.mapNodeToEntry(this.head):null}get oldest(){return this.tail?this.tail.isExpired?(this.removeNodeFromListAndLookupTable(this.tail),this.oldest):this.mapNodeToEntry(this.tail):null}get maxSize(){return this.maxSizeInternal}set maxSize(e){if(Number.isNaN(e)||e<=0)throw new Error("maxSize must be greater than 0.");this.maxSizeInternal=e,this.enforceSizeLimit()}set(e,t,r){const s=this.lookupTable.get(e);s&&this.removeNodeFromListAndLookupTable(s);const o=new LRUCacheNode_1.LRUCacheNode(e,t,{entryExpirationTimeInMS:this.entryExpirationTimeInMS,onEntryEvicted:this.onEntryEvicted,onEntryMarkedAsMostRecentlyUsed:this.onEntryMarkedAsMostRecentlyUsed,clone:this.clone,cloneFn:this.cloneFn,...r});return this.setNodeAsHead(o),this.lookupTable.set(e,o),this.enforceSizeLimit(),this}get(e){const t=this.lookupTable.get(e);return t?t.isExpired?(this.removeNodeFromListAndLookupTable(t),null):(this.setNodeAsHead(t),t.value):null}peek(e){const t=this.lookupTable.get(e);return t?t.isExpired?(this.removeNodeFromListAndLookupTable(t),null):t.value:null}delete(e){const t=this.lookupTable.get(e);return t?this.removeNodeFromListAndLookupTable(t):!1}has(e){const t=this.lookupTable.get(e);return t?t.isExpired?(this.removeNodeFromListAndLookupTable(t),!1):!0:!1}clear(){this.head=null,this.tail=null,this.lookupTable.clear()}find(e){let t=this.head;for(;t;){if(t.isExpired){const s=t.next;this.removeNodeFromListAndLookupTable(t),t=s;continue}const r=this.mapNodeToEntry(t);if(e(r))return this.setNodeAsHead(t),r;t=t.next}return null}forEach(e){let t=this.head,r=0;for(;t;){if(t.isExpired){const s=t.next;this.removeNodeFromListAndLookupTable(t),t=s;continue}e(t.value,t.key,r),t=t.next,r++}}*values(){let e=this.head;for(;e;){if(e.isExpired){const t=e.next;this.removeNodeFromListAndLookupTable(e),e=t;continue}yield e.value,e=e.next}}*keys(){let e=this.head;for(;e;){if(e.isExpired){const t=e.next;this.removeNodeFromListAndLookupTable(e),e=t;continue}yield e.key,e=e.next}}*entries(){let e=this.head;for(;e;){if(e.isExpired){const t=e.next;this.removeNodeFromListAndLookupTable(e),e=t;continue}yield this.mapNodeToEntry(e),e=e.next}}*[Symbol.iterator](){let e=this.head;for(;e;){if(e.isExpired){const t=e.next;this.removeNodeFromListAndLookupTable(e),e=t;continue}yield this.mapNodeToEntry(e),e=e.next}}enforceSizeLimit(){let e=this.tail;for(;e!==null&&this.size>this.maxSizeInternal;){const t=e.prev;this.removeNodeFromListAndLookupTable(e),e=t}}mapNodeToEntry({key:e,value:t}){return{key:e,value:t}}setNodeAsHead(e){this.removeNodeFromList(e),this.head?(e.next=this.head,this.head.prev=e,this.head=e):(this.head=e,this.tail=e),e.invokeOnEntryMarkedAsMostRecentlyUsed()}removeNodeFromList(e){e.prev!==null&&(e.prev.next=e.next),e.next!==null&&(e.next.prev=e.prev),this.head===e&&(this.head=e.next),this.tail===e&&(this.tail=e.prev),e.next=null,e.prev=null}removeNodeFromListAndLookupTable(e){return e.invokeOnEvicted(),this.removeNodeFromList(e),this.lookupTable.delete(e.key)}cleanCache(){if(!this.entryExpirationTimeInMS)return;const e=[];for(const t of this.lookupTable.values())t.isExpired&&e.push(t);e.forEach(t=>this.removeNodeFromListAndLookupTable(t))}}LRUCache$1.LRUCache=LRUCache;(function(n){var e=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(r,s,o,a){a===void 0&&(a=o);var c=Object.getOwnPropertyDescriptor(s,o);(!c||("get"in c?!s.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return s[o]}}),Object.defineProperty(r,a,c)}:function(r,s,o,a){a===void 0&&(a=o),r[a]=s[o]}),t=commonjsGlobal&&commonjsGlobal.__exportStar||function(r,s){for(var o in r)o!=="default"&&!Object.prototype.hasOwnProperty.call(s,o)&&e(s,r,o)};Object.defineProperty(n,"__esModule",{value:!0}),t(LRUCache$1,n)})(dist);var lib={};(function(n){/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(n,"__esModule",{value:!0}),n.bytes=n.stringToBytes=n.str=n.bytesToString=n.hex=n.utf8=n.bech32m=n.bech32=n.base58check=n.base58xmr=n.base58xrp=n.base58flickr=n.base58=n.base64url=n.base64=n.base32crockford=n.base32hex=n.base32=n.base16=n.utils=n.assertNumber=void 0;function e(E){if(!Number.isSafeInteger(E))throw new Error(`Wrong integer: ${E}`)}n.assertNumber=e;function t(...E){const _=(x,w)=>v=>x(w(v)),T=Array.from(E).reverse().reduce((x,w)=>x?_(x,w.encode):w.encode,void 0),N=E.reduce((x,w)=>x?_(x,w.decode):w.decode,void 0);return{encode:T,decode:N}}function r(E){return{encode:_=>{if(!Array.isArray(_)||_.length&&typeof _[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return _.map(T=>{if(e(T),T<0||T>=E.length)throw new Error(`Digit index outside alphabet: ${T} (alphabet: ${E.length})`);return E[T]})},decode:_=>{if(!Array.isArray(_)||_.length&&typeof _[0]!="string")throw new Error("alphabet.decode input should be array of strings");return _.map(T=>{if(typeof T!="string")throw new Error(`alphabet.decode: not string element=${T}`);const N=E.indexOf(T);if(N===-1)throw new Error(`Unknown letter: "${T}". Allowed: ${E}`);return N})}}}function s(E=""){if(typeof E!="string")throw new Error("join separator should be string");return{encode:_=>{if(!Array.isArray(_)||_.length&&typeof _[0]!="string")throw new Error("join.encode input should be array of strings");for(let T of _)if(typeof T!="string")throw new Error(`join.encode: non-string input=${T}`);return _.join(E)},decode:_=>{if(typeof _!="string")throw new Error("join.decode input should be string");return _.split(E)}}}function o(E,_="="){if(e(E),typeof _!="string")throw new Error("padding chr should be string");return{encode(T){if(!Array.isArray(T)||T.length&&typeof T[0]!="string")throw new Error("padding.encode input should be array of strings");for(let N of T)if(typeof N!="string")throw new Error(`padding.encode: non-string input=${N}`);for(;T.length*E%8;)T.push(_);return T},decode(T){if(!Array.isArray(T)||T.length&&typeof T[0]!="string")throw new Error("padding.encode input should be array of strings");for(let x of T)if(typeof x!="string")throw new Error(`padding.decode: non-string input=${x}`);let N=T.length;if(N*E%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;N>0&&T[N-1]===_;N--)if(!((N-1)*E%8))throw new Error("Invalid padding: string has too much padding");return T.slice(0,N)}}}function a(E){if(typeof E!="function")throw new Error("normalize fn should be function");return{encode:_=>_,decode:_=>E(_)}}function c(E,_,T){if(_<2)throw new Error(`convertRadix: wrong from=${_}, base cannot be less than 2`);if(T<2)throw new Error(`convertRadix: wrong to=${T}, base cannot be less than 2`);if(!Array.isArray(E))throw new Error("convertRadix: data should be array");if(!E.length)return[];let N=0;const x=[],w=Array.from(E);for(w.forEach(v=>{if(e(v),v<0||v>=_)throw new Error(`Wrong integer: ${v}`)});;){let v=0,S=!0;for(let A=N;A_?l(_,E%_):E,f=(E,_)=>E+(_-l(E,_));function h(E,_,T,N){if(!Array.isArray(E))throw new Error("convertRadix2: data should be array");if(_<=0||_>32)throw new Error(`convertRadix2: wrong from=${_}`);if(T<=0||T>32)throw new Error(`convertRadix2: wrong to=${T}`);if(f(_,T)>32)throw new Error(`convertRadix2: carry overflow from=${_} to=${T} carryBits=${f(_,T)}`);let x=0,w=0;const v=2**T-1,S=[];for(const A of E){if(e(A),A>=2**_)throw new Error(`convertRadix2: invalid data word=${A} from=${_}`);if(x=x<<_|A,w+_>32)throw new Error(`convertRadix2: carry overflow pos=${w} from=${_}`);for(w+=_;w>=T;w-=T)S.push((x>>w-T&v)>>>0);x&=2**w-1}if(x=x<=_)throw new Error("Excess padding");if(!N&&x)throw new Error(`Non-zero padding: ${x}`);return N&&w>0&&S.push(x>>>0),S}function u(E){return e(E),{encode:_=>{if(!(_ instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return c(Array.from(_),2**8,E)},decode:_=>{if(!Array.isArray(_)||_.length&&typeof _[0]!="number")throw new Error("radix.decode input should be array of strings");return Uint8Array.from(c(_,E,2**8))}}}function p(E,_=!1){if(e(E),E<=0||E>32)throw new Error("radix2: bits should be in (0..32]");if(f(8,E)>32||f(E,8)>32)throw new Error("radix2: carry overflow");return{encode:T=>{if(!(T instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return h(Array.from(T),8,E,!_)},decode:T=>{if(!Array.isArray(T)||T.length&&typeof T[0]!="number")throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(h(T,E,8,_))}}}function y(E){if(typeof E!="function")throw new Error("unsafeWrapper fn should be function");return function(..._){try{return E.apply(null,_)}catch{}}}function b(E,_){if(e(E),typeof _!="function")throw new Error("checksum fn should be function");return{encode(T){if(!(T instanceof Uint8Array))throw new Error("checksum.encode: input should be Uint8Array");const N=_(T).slice(0,E),x=new Uint8Array(T.length+E);return x.set(T),x.set(N,T.length),x},decode(T){if(!(T instanceof Uint8Array))throw new Error("checksum.decode: input should be Uint8Array");const N=T.slice(0,-E),x=_(N).slice(0,E),w=T.slice(-E);for(let v=0;vE.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),n.base64=t(p(6),r("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),o(6),s("")),n.base64url=t(p(6),r("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),o(6),s(""));const m=E=>t(u(58),r(E),s(""));n.base58=m("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),n.base58flickr=m("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),n.base58xrp=m("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const k=[0,2,3,5,6,7,9,10,11];n.base58xmr={encode(E){let _="";for(let T=0;Tt(b(4,_=>E(E(_))),n.base58);n.base58check=R;const B=t(r("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),s("")),D=[996825010,642813549,513874426,1027748829,705979059];function U(E){const _=E>>25;let T=(E&33554431)<<5;for(let N=0;N>N&1)===1&&(T^=D[N]);return T}function H(E,_,T=1){const N=E.length;let x=1;for(let w=0;w126)throw new Error(`Invalid prefix (${E})`);x=U(x)^v>>5}x=U(x);for(let w=0;wV)throw new TypeError(`Length ${z} exceeds limit ${V}`);return I=I.toLowerCase(),`${I}1${B.encode(P)}${H(I,P,_)}`}function S(I,P=90){if(typeof I!="string")throw new Error(`bech32.decode input should be string, not ${typeof I}`);if(I.length<8||P!==!1&&I.length>P)throw new TypeError(`Wrong string length: ${I.length} (${I}). Expected (8..${P})`);const V=I.toLowerCase();if(I!==V&&I!==I.toUpperCase())throw new Error("String must be lowercase or uppercase");I=V;const z=I.lastIndexOf("1");if(z===0||z===-1)throw new Error('Letter "1" must be present between prefix and data only');const W=I.slice(0,z),q=I.slice(z+1);if(q.length<6)throw new Error("Data must be at least 6 characters long");const j=B.decode(q).slice(0,-6),G=H(W,j,_);if(!q.endsWith(G))throw new Error(`Invalid checksum in ${I}: expected "${G}"`);return{prefix:W,words:j}}const A=y(S);function L(I){const{prefix:P,words:V}=S(I,!1);return{prefix:P,words:V,bytes:N(V)}}return{encode:v,decode:S,decodeToBytes:L,decodeUnsafe:A,fromWords:N,fromWordsUnsafe:w,toWords:x}}n.bech32=C("bech32"),n.bech32m=C("bech32m"),n.utf8={encode:E=>new TextDecoder().decode(E),decode:E=>new TextEncoder().encode(E)},n.hex=t(p(4),r("0123456789abcdef"),s(""),a(E=>{if(typeof E!="string"||E.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof E} with length ${E.length}`);return E.toLowerCase()}));const M={utf8:n.utf8,hex:n.hex,base16:n.base16,base32:n.base32,base64:n.base64,base64url:n.base64url,base58:n.base58,base58xmr:n.base58xmr},F=`Invalid encoding type. Available types: ${Object.keys(M).join(", ")}`,O=(E,_)=>{if(typeof E!="string"||!M.hasOwnProperty(E))throw new TypeError(F);if(!(_ instanceof Uint8Array))throw new TypeError("bytesToString() expects Uint8Array");return M[E].encode(_)};n.bytesToString=O,n.str=n.bytesToString;const $=(E,_)=>{if(!M.hasOwnProperty(E))throw new TypeError(F);if(typeof _!="string")throw new TypeError("stringToBytes() expects string");return M[E].decode(_)};n.stringToBytes=$,n.bytes=n.stringToBytes})(lib);const{bech32:bech32$1,hex,utf8}=lib,DEFAULTNETWORK={bech32:"bc",pubKeyHash:0,scriptHash:5,validWitnessVersions:[0]},TESTNETWORK={bech32:"tb",pubKeyHash:111,scriptHash:196,validWitnessVersions:[0]},SIGNETNETWORK={bech32:"tbs",pubKeyHash:111,scriptHash:196,validWitnessVersions:[0]},REGTESTNETWORK={bech32:"bcrt",pubKeyHash:111,scriptHash:196,validWitnessVersions:[0]},SIMNETWORK={bech32:"sb",pubKeyHash:63,scriptHash:123,validWitnessVersions:[0]},FEATUREBIT_ORDER=["option_data_loss_protect","initial_routing_sync","option_upfront_shutdown_script","gossip_queries","var_onion_optin","gossip_queries_ex","option_static_remotekey","payment_secret","basic_mpp","option_support_large_channel"],DIVISORS={m:BigInt(1e3),u:BigInt(1e6),n:BigInt(1e9),p:BigInt(1e12)},MAX_MILLISATS=BigInt("2100000000000000000"),MILLISATS_PER_BTC=BigInt(1e11),TAGCODES={payment_hash:1,payment_secret:16,description:13,payee:19,description_hash:23,expiry:6,min_final_cltv_expiry:24,fallback_address:9,route_hint:3,feature_bits:5,metadata:27},TAGNAMES={};for(let n=0,e=Object.keys(TAGCODES);nhex.encode(bech32$1.fromWordsUnsafe(n)),16:n=>hex.encode(bech32$1.fromWordsUnsafe(n)),13:n=>utf8.encode(bech32$1.fromWordsUnsafe(n)),19:n=>hex.encode(bech32$1.fromWordsUnsafe(n)),23:n=>hex.encode(bech32$1.fromWordsUnsafe(n)),27:n=>hex.encode(bech32$1.fromWordsUnsafe(n)),6:wordsToIntBE,24:wordsToIntBE,3:routingInfoParser,5:featureBitsParser};function getUnknownParser(n){return e=>({tagCode:parseInt(n),words:bech32$1.encode("unknown",e,Number.MAX_SAFE_INTEGER)})}function wordsToIntBE(n){return n.reverse().reduce((e,t,r)=>e+t*Math.pow(32,r),0)}function routingInfoParser(n){const e=[];let t,r,s,o,a,c=bech32$1.fromWordsUnsafe(n);for(;c.length>0;)t=hex.encode(c.slice(0,33)),r=hex.encode(c.slice(33,41)),s=parseInt(hex.encode(c.slice(41,45)),16),o=parseInt(hex.encode(c.slice(45,49)),16),a=parseInt(hex.encode(c.slice(49,51)),16),c=c.slice(51),e.push({pubkey:t,short_channel_id:r,fee_base_msat:s,fee_proportional_millionths:o,cltv_expiry_delta:a});return e}function featureBitsParser(n){const e=n.slice().reverse().map(s=>[!!(s&1),!!(s&2),!!(s&4),!!(s&8),!!(s&16)]).reduce((s,o)=>s.concat(o),[]);for(;e.length{let a;e[o*2]?a="required":e[o*2+1]?a="supported":a="unsupported",t[s]=a});const r=e.slice(FEATUREBIT_ORDER.length*2);return t.extra_bits={start_bit:FEATUREBIT_ORDER.length*2,bits:r,has_required:r.reduce((s,o,a)=>a%2!==0?s||!1:s||o,!1)},t}function hrpToMillisat(n,e){let t,r;if(n.slice(-1).match(/^[munp]$/))t=n.slice(-1),r=n.slice(0,-1);else{if(n.slice(-1).match(/^[^munp0-9]$/))throw new Error("Not a valid multiplier for the amount");r=n}if(!r.match(/^\d+$/))throw new Error("Not a valid human readable amount");const s=BigInt(r),o=t?s*MILLISATS_PER_BTC/DIVISORS[t]:s*MILLISATS_PER_BTC;if(t==="p"&&s%BigInt(10)!==BigInt(0)||o>MAX_MILLISATS)throw new Error("Amount is outside of valid range");return e?o.toString():o}function decode(n,e){if(typeof n!="string")throw new Error("Lightning Payment Request must be string");if(n.slice(0,2).toLowerCase()!=="ln")throw new Error("Not a proper lightning payment request");const t=[],r=bech32$1.decode(n,Number.MAX_SAFE_INTEGER);n=n.toLowerCase();const s=r.prefix;let o=r.words,a=n.slice(s.length+1),c=o.slice(-104);o=o.slice(0,-104);let l=s.match(/^ln(\S+?)(\d*)([a-zA-Z]?)$/);if(l&&!l[2]&&(l=s.match(/^ln(\S+)$/)),!l)throw new Error("Not a proper lightning payment request");t.push({name:"lightning_network",letters:"ln"});const f=l[1];let h;if(e){if(e.bech32===void 0||e.pubKeyHash===void 0||e.scriptHash===void 0||!Array.isArray(e.validWitnessVersions))throw new Error("Invalid network");h=e}else switch(f){case DEFAULTNETWORK.bech32:h=DEFAULTNETWORK;break;case TESTNETWORK.bech32:h=TESTNETWORK;break;case SIGNETNETWORK.bech32:h=SIGNETNETWORK;break;case REGTESTNETWORK.bech32:h=REGTESTNETWORK;break;case SIMNETWORK.bech32:h=SIMNETWORK;break}if(!h||h.bech32!==f)throw new Error("Unknown coin bech32 prefix");t.push({name:"coin_network",letters:f,value:h});const u=l[2];let p;if(u){const U=l[3];p=hrpToMillisat(u+U,!0),t.push({name:"amount",letters:l[2]+l[3],value:p})}else p=null;t.push({name:"separator",letters:"1"});const y=wordsToIntBE(o.slice(0,7));o=o.slice(7),t.push({name:"timestamp",letters:a.slice(0,7),value:y}),a=a.slice(7);let b,m,k,R;for(;o.length>0;){const U=o[0].toString();b=TAGNAMES[U]||"unknown_tag",m=TAGPARSERS[U]||getUnknownParser(U),o=o.slice(1),k=wordsToIntBE(o.slice(0,2)),o=o.slice(2),R=o.slice(0,k),o=o.slice(k),t.push({name:b,tag:a[0],letters:a.slice(0,1+2+k),value:m(R)}),a=a.slice(1+2+k)}t.push({name:"signature",letters:a.slice(0,104),value:hex.encode(bech32$1.fromWordsUnsafe(c))}),a=a.slice(104),t.push({name:"checksum",letters:a});let B={paymentRequest:n,sections:t,get expiry(){let U=t.find(H=>H.name==="expiry");if(U)return D("timestamp")+U.value},get route_hints(){return t.filter(U=>U.name==="route_hint").map(U=>U.value)}};for(let U in TAGCODES)U!=="route_hint"&&Object.defineProperty(B,U,{get(){return D(U)}});return B;function D(U){let H=t.find(C=>C.name===U);return H?H.value:void 0}}var bolt11={decode,hrpToMillisat};/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function isBytes(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function isArrayOf(n,e){return Array.isArray(e)?e.length===0?!0:n?e.every(t=>typeof t=="string"):e.every(t=>Number.isSafeInteger(t)):!1}function afn(n){if(typeof n!="function")throw new Error("function expected");return!0}function astr(n,e){if(typeof e!="string")throw new Error(`${n}: string expected`);return!0}function anumber(n){if(!Number.isSafeInteger(n))throw new Error(`invalid integer: ${n}`)}function aArr(n){if(!Array.isArray(n))throw new Error("array expected")}function astrArr(n,e){if(!isArrayOf(!0,e))throw new Error(`${n}: array of strings expected`)}function anumArr(n,e){if(!isArrayOf(!1,e))throw new Error(`${n}: array of numbers expected`)}function chain(...n){const e=o=>o,t=(o,a)=>c=>o(a(c)),r=n.map(o=>o.encode).reduceRight(t,e),s=n.map(o=>o.decode).reduce(t,e);return{encode:r,decode:s}}function alphabet(n){const e=typeof n=="string"?n.split(""):n,t=e.length;astrArr("alphabet",e);const r=new Map(e.map((s,o)=>[s,o]));return{encode:s=>(aArr(s),s.map(o=>{if(!Number.isSafeInteger(o)||o<0||o>=t)throw new Error(`alphabet.encode: digit index outside alphabet "${o}". Allowed: ${n}`);return e[o]})),decode:s=>(aArr(s),s.map(o=>{astr("alphabet.decode",o);const a=r.get(o);if(a===void 0)throw new Error(`Unknown letter: "${o}". Allowed: ${n}`);return a}))}}function join(n=""){return astr("join",n),{encode:e=>(astrArr("join.decode",e),e.join(n)),decode:e=>(astr("join.decode",e),e.split(n))}}const gcd=(n,e)=>e===0?n:gcd(e,n%e),radix2carry=(n,e)=>n+(e-gcd(n,e)),powers=(()=>{let n=[];for(let e=0;e<40;e++)n.push(2**e);return n})();function convertRadix2(n,e,t,r){if(aArr(n),e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(t<=0||t>32)throw new Error(`convertRadix2: wrong to=${t}`);if(radix2carry(e,t)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${t} carryBits=${radix2carry(e,t)}`);let s=0,o=0;const a=powers[e],c=powers[t]-1,l=[];for(const f of n){if(anumber(f),f>=a)throw new Error(`convertRadix2: invalid data word=${f} from=${e}`);if(s=s<32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${e}`);for(o+=e;o>=t;o-=t)l.push((s>>o-t&c)>>>0);const h=powers[o];if(h===void 0)throw new Error("invalid carry");s&=h-1}if(s=s<=e)throw new Error("Excess padding");if(!r&&s>0)throw new Error(`Non-zero padding: ${s}`);return r&&o>0&&l.push(s>>>0),l}function radix2(n,e=!1){if(anumber(n),n<=0||n>32)throw new Error("radix2: bits should be in (0..32]");if(radix2carry(8,n)>32||radix2carry(n,8)>32)throw new Error("radix2: carry overflow");return{encode:t=>{if(!isBytes(t))throw new Error("radix2.encode input should be Uint8Array");return convertRadix2(Array.from(t),8,n,!e)},decode:t=>(anumArr("radix2.decode",t),Uint8Array.from(convertRadix2(t,n,8,e)))}}function unsafeWrapper(n){return afn(n),function(...e){try{return n.apply(null,e)}catch{}}}const BECH_ALPHABET=chain(alphabet("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),join("")),POLYMOD_GENERATORS=[996825010,642813549,513874426,1027748829,705979059];function bech32Polymod(n){const e=n>>25;let t=(n&33554431)<<5;for(let r=0;r>r&1)===1&&(t^=POLYMOD_GENERATORS[r]);return t}function bechChecksum(n,e,t=1){const r=n.length;let s=1;for(let o=0;o126)throw new Error(`Invalid prefix (${n})`);s=bech32Polymod(s)^a>>5}s=bech32Polymod(s);for(let o=0;oy)throw new TypeError(`Length ${m} exceeds limit ${y}`);const k=u.toLowerCase(),R=bechChecksum(k,p,e);return`${k}1${BECH_ALPHABET.encode(p)}${R}`}function c(u,p=90){astr("bech32.decode input",u);const y=u.length;if(y<8||p!==!1&&y>p)throw new TypeError(`invalid string length: ${y} (${u}). Expected (8..${p})`);const b=u.toLowerCase();if(u!==b&&u!==u.toUpperCase())throw new Error("String must be lowercase or uppercase");const m=b.lastIndexOf("1");if(m===0||m===-1)throw new Error('Letter "1" must be present between prefix and data only');const k=b.slice(0,m),R=b.slice(m+1);if(R.length<6)throw new Error("Data must be at least 6 characters long");const B=BECH_ALPHABET.decode(R).slice(0,-6),D=bechChecksum(k,B,e);if(!R.endsWith(D))throw new Error(`Invalid checksum in ${u}: expected "${D}"`);return{prefix:k,words:B}}const l=unsafeWrapper(c);function f(u){const{prefix:p,words:y}=c(u,!1);return{prefix:p,words:y,bytes:r(y)}}function h(u,p){return a(u,s(p))}return{encode:a,decode:c,encodeFromBytes:h,decodeToBytes:f,decodeUnsafe:l,fromWords:r,fromWordsUnsafe:o,toWords:s}}const bech32=genBech32("bech32");var NdkNutzapStatus=(n=>(n.INITIAL="initial",n.PROCESSING="processing",n.REDEEMED="redeemed",n.SPENT="spent",n.MISSING_PRIVKEY="missing_privkey",n.TEMPORARY_ERROR="temporary_error",n.PERMANENT_ERROR="permanent_error",n.INVALID_NUTZAP="invalid_nutzap",n))(NdkNutzapStatus||{}),NDKKind=(n=>(n[n.Metadata=0]="Metadata",n[n.Text=1]="Text",n[n.RecommendRelay=2]="RecommendRelay",n[n.Contacts=3]="Contacts",n[n.EncryptedDirectMessage=4]="EncryptedDirectMessage",n[n.EventDeletion=5]="EventDeletion",n[n.Repost=6]="Repost",n[n.Reaction=7]="Reaction",n[n.BadgeAward=8]="BadgeAward",n[n.GroupChat=9]="GroupChat",n[n.Thread=11]="Thread",n[n.GroupReply=12]="GroupReply",n[n.GiftWrapSeal=13]="GiftWrapSeal",n[n.PrivateDirectMessage=14]="PrivateDirectMessage",n[n.Image=20]="Image",n[n.Video=21]="Video",n[n.ShortVideo=22]="ShortVideo",n[n.Story=23]="Story",n[n.Vanish=62]="Vanish",n[n.CashuWalletBackup=375]="CashuWalletBackup",n[n.GiftWrap=1059]="GiftWrap",n[n.GenericRepost=16]="GenericRepost",n[n.ChannelCreation=40]="ChannelCreation",n[n.ChannelMetadata=41]="ChannelMetadata",n[n.ChannelMessage=42]="ChannelMessage",n[n.ChannelHideMessage=43]="ChannelHideMessage",n[n.ChannelMuteUser=44]="ChannelMuteUser",n[n.WikiMergeRequest=818]="WikiMergeRequest",n[n.GenericReply=1111]="GenericReply",n[n.Media=1063]="Media",n[n.DraftCheckpoint=1234]="DraftCheckpoint",n[n.Task=1934]="Task",n[n.Report=1984]="Report",n[n.Label=1985]="Label",n[n.DVMReqTextExtraction=5e3]="DVMReqTextExtraction",n[n.DVMReqTextSummarization=5001]="DVMReqTextSummarization",n[n.DVMReqTextTranslation=5002]="DVMReqTextTranslation",n[n.DVMReqTextGeneration=5050]="DVMReqTextGeneration",n[n.DVMReqImageGeneration=5100]="DVMReqImageGeneration",n[n.DVMReqTextToSpeech=5250]="DVMReqTextToSpeech",n[n.DVMReqDiscoveryNostrContent=5300]="DVMReqDiscoveryNostrContent",n[n.DVMReqDiscoveryNostrPeople=5301]="DVMReqDiscoveryNostrPeople",n[n.DVMReqTimestamping=5900]="DVMReqTimestamping",n[n.DVMEventSchedule=5905]="DVMEventSchedule",n[n.DVMJobFeedback=7e3]="DVMJobFeedback",n[n.Subscribe=7001]="Subscribe",n[n.Unsubscribe=7002]="Unsubscribe",n[n.SubscriptionReceipt=7003]="SubscriptionReceipt",n[n.CashuReserve=7373]="CashuReserve",n[n.CashuQuote=7374]="CashuQuote",n[n.CashuToken=7375]="CashuToken",n[n.CashuWalletTx=7376]="CashuWalletTx",n[n.GroupAdminAddUser=9e3]="GroupAdminAddUser",n[n.GroupAdminRemoveUser=9001]="GroupAdminRemoveUser",n[n.GroupAdminEditMetadata=9002]="GroupAdminEditMetadata",n[n.GroupAdminEditStatus=9006]="GroupAdminEditStatus",n[n.GroupAdminCreateGroup=9007]="GroupAdminCreateGroup",n[n.GroupAdminRequestJoin=9021]="GroupAdminRequestJoin",n[n.MuteList=1e4]="MuteList",n[n.PinList=10001]="PinList",n[n.RelayList=10002]="RelayList",n[n.BookmarkList=10003]="BookmarkList",n[n.CommunityList=10004]="CommunityList",n[n.PublicChatList=10005]="PublicChatList",n[n.BlockRelayList=10006]="BlockRelayList",n[n.SearchRelayList=10007]="SearchRelayList",n[n.SimpleGroupList=10009]="SimpleGroupList",n[n.InterestList=10015]="InterestList",n[n.CashuMintList=10019]="CashuMintList",n[n.EmojiList=10030]="EmojiList",n[n.DirectMessageReceiveRelayList=10050]="DirectMessageReceiveRelayList",n[n.BlossomList=10063]="BlossomList",n[n.NostrWaletConnectInfo=13194]="NostrWaletConnectInfo",n[n.TierList=17e3]="TierList",n[n.CashuWallet=17375]="CashuWallet",n[n.FollowSet=3e4]="FollowSet",n[n.CategorizedPeopleList=3e4]="CategorizedPeopleList",n[n.CategorizedBookmarkList=30001]="CategorizedBookmarkList",n[n.RelaySet=30002]="RelaySet",n[n.CategorizedRelayList=30002]="CategorizedRelayList",n[n.BookmarkSet=30003]="BookmarkSet",n[n.CurationSet=30004]="CurationSet",n[n.ArticleCurationSet=30004]="ArticleCurationSet",n[n.VideoCurationSet=30005]="VideoCurationSet",n[n.ImageCurationSet=30006]="ImageCurationSet",n[n.InterestSet=30015]="InterestSet",n[n.InterestsList=30015]="InterestsList",n[n.ProjectTemplate=30717]="ProjectTemplate",n[n.EmojiSet=30030]="EmojiSet",n[n.ModularArticle=30040]="ModularArticle",n[n.ModularArticleItem=30041]="ModularArticleItem",n[n.Wiki=30818]="Wiki",n[n.Draft=31234]="Draft",n[n.Project=31933]="Project",n[n.SubscriptionTier=37001]="SubscriptionTier",n[n.EcashMintRecommendation=38e3]="EcashMintRecommendation",n[n.HighlightSet=39802]="HighlightSet",n[n.CategorizedHighlightList=39802]="CategorizedHighlightList",n[n.Nutzap=9321]="Nutzap",n[n.ZapRequest=9734]="ZapRequest",n[n.Zap=9735]="Zap",n[n.Highlight=9802]="Highlight",n[n.ClientAuth=22242]="ClientAuth",n[n.NostrWalletConnectReq=23194]="NostrWalletConnectReq",n[n.NostrWalletConnectRes=23195]="NostrWalletConnectRes",n[n.NostrConnect=24133]="NostrConnect",n[n.BlossomUpload=24242]="BlossomUpload",n[n.HttpAuth=27235]="HttpAuth",n[n.ProfileBadge=30008]="ProfileBadge",n[n.BadgeDefinition=30009]="BadgeDefinition",n[n.MarketStall=30017]="MarketStall",n[n.MarketProduct=30018]="MarketProduct",n[n.Article=30023]="Article",n[n.AppSpecificData=30078]="AppSpecificData",n[n.Classified=30402]="Classified",n[n.HorizontalVideo=34235]="HorizontalVideo",n[n.VerticalVideo=34236]="VerticalVideo",n[n.LegacyCashuWallet=37375]="LegacyCashuWallet",n[n.GroupMetadata=39e3]="GroupMetadata",n[n.GroupAdmins=39001]="GroupAdmins",n[n.GroupMembers=39002]="GroupMembers",n[n.FollowPack=39089]="FollowPack",n[n.MediaFollowPack=39092]="MediaFollowPack",n[n.AppRecommendation=31989]="AppRecommendation",n[n.AppHandler=31990]="AppHandler",n))(NDKKind||{}),NDKListKinds=[1e4,10001,10002,10003,10004,10005,10006,10007,10015,10030,10050,3e4,30003,30001,30002,30004,30005,30015,30030,39802];function getRelaysForSync(n,e,t="write"){if(!n.outboxTracker)return;const r=n.outboxTracker.data.get(e);if(r)return t==="write"?r.writeRelays:r.readRelays}async function getWriteRelaysFor(n,e,t="write"){if(n.outboxTracker)return n.outboxTracker.data.has(e)||await n.outboxTracker.trackUsers([e]),getRelaysForSync(n,e,t)}function getTopRelaysForAuthors(n,e){const t=new Map;return e.forEach(s=>{const o=getRelaysForSync(n,s);o&&o.forEach(a=>{const c=t.get(a)||0;t.set(a,c+1)})}),Array.from(t.entries()).sort((s,o)=>o[1]-s[1]).map(s=>s[0])}function getAllRelaysForAllPubkeys(n,e,t="read"){const r=new Map,s=new Set;return e.forEach(o=>{const a=getRelaysForSync(n,o,t);a&&a.size>0?(a.forEach(c=>{(r.get(c)||new Set).add(o)}),r.set(o,a)):s.add(o)}),{pubkeysToRelays:r,authorsMissingRelays:s}}function chooseRelayCombinationForPubkeys(n,e,t,{count:r,preferredRelays:s}={}){r??(r=2),s??(s=new Set);const o=n.pool,a=o.connectedRelays();a.forEach(p=>{s==null||s.add(p.url)});const c=new Map,{pubkeysToRelays:l,authorsMissingRelays:f}=getAllRelaysForAllPubkeys(n,e,t),h=getTopRelaysForAuthors(n,e),u=(p,y)=>{const b=c.get(y)||[];b.push(p),c.set(y,b)};for(const[p,y]of l.entries()){let b=r;for(const m of a)y.has(m.url)&&(u(p,m.url),b--);for(const m of y)c.has(m)&&(u(p,m),b--);if(!(b<=0))for(const m of h){if(b<=0)break;y.has(m)&&(u(p,m),b--)}}for(const p of f)o.permanentAndConnectedRelays().forEach(y=>{const b=c.get(y.url)||[];b.push(p),c.set(y.url,b)});return c}function getRelaysForFilterWithAuthors(n,e,t=2){return chooseRelayCombinationForPubkeys(n,e,"write",{count:t})}function tryNormalizeRelayUrl(n){try{return normalizeRelayUrl(n)}catch{return}}function normalizeRelayUrl(n){let e=normalizeUrl(n,{stripAuthentication:!1,stripWWW:!1,stripHash:!0});return e.endsWith("/")||(e+="/"),e}function normalize(n){const e=new Set;for(const t of n)try{e.add(normalizeRelayUrl(t))}catch{}return Array.from(e)}var DATA_URL_DEFAULT_MIME_TYPE="text/plain",DATA_URL_DEFAULT_CHARSET="us-ascii",testParameter=(n,e)=>e.some(t=>t instanceof RegExp?t.test(n):t===n),supportedProtocols=new Set(["https:","http:","file:"]),hasCustomProtocol=n=>{try{const{protocol:e}=new URL(n);return e.endsWith(":")&&!e.includes(".")&&!supportedProtocols.has(e)}catch{return!1}},normalizeDataURL=(n,{stripHash:e})=>{var u,p,y,b;const t=/^data:(?[^,]*?),(?[^#]*?)(?:#(?.*))?$/.exec(n);if(!t)throw new Error(`Invalid URL: ${n}`);const r=((u=t.groups)==null?void 0:u.type)??"",s=((p=t.groups)==null?void 0:p.data)??"";let o=((y=t.groups)==null?void 0:y.hash)??"";const a=r.split(";");o=e?"":o;let c=!1;a[a.length-1]==="base64"&&(a.pop(),c=!0);const l=((b=a.shift())==null?void 0:b.toLowerCase())??"",h=[...a.map(m=>{let[k,R=""]=m.split("=").map(B=>B.trim());return k==="charset"&&(R=R.toLowerCase(),R===DATA_URL_DEFAULT_CHARSET)?"":`${k}${R?`=${R}`:""}`}).filter(Boolean)];return c&&h.push("base64"),(h.length>0||l&&l!==DATA_URL_DEFAULT_MIME_TYPE)&&h.unshift(l),`data:${h.join(";")},${c?s.trim():s}${o?`#${o}`:""}`};function normalizeUrl(n,e={}){if(e={defaultProtocol:"http",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,removeExplicitPort:!1,sortQueryParameters:!0,...e},typeof e.defaultProtocol=="string"&&!e.defaultProtocol.endsWith(":")&&(e.defaultProtocol=`${e.defaultProtocol}:`),n=n.trim(),/^data:/i.test(n))return normalizeDataURL(n,e);if(hasCustomProtocol(n))return n;const t=n.startsWith("//");!t&&/^\.*\//.test(n)||(n=n.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,e.defaultProtocol));const s=new URL(n);if(s.hostname=s.hostname.toLowerCase(),e.forceHttp&&e.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(e.forceHttp&&s.protocol==="https:"&&(s.protocol="http:"),e.forceHttps&&s.protocol==="http:"&&(s.protocol="https:"),e.stripAuthentication&&(s.username="",s.password=""),e.stripHash?s.hash="":e.stripTextFragment&&(s.hash=s.hash.replace(/#?:~:text.*?$/i,"")),s.pathname){const a=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g;let c=0,l="";for(;;){const h=a.exec(s.pathname);if(!h)break;const u=h[0],p=h.index,y=s.pathname.slice(c,p);l+=y.replace(/\/{2,}/g,"/"),l+=u,c=p+u.length}const f=s.pathname.slice(c,s.pathname.length);l+=f.replace(/\/{2,}/g,"/"),s.pathname=l}if(s.pathname)try{s.pathname=decodeURI(s.pathname)}catch{}if(e.removeDirectoryIndex===!0&&(e.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(e.removeDirectoryIndex)&&e.removeDirectoryIndex.length>0){let a=s.pathname.split("/");const c=a[a.length-1];testParameter(c,e.removeDirectoryIndex)&&(a=a.slice(0,-1),s.pathname=`${a.slice(1).join("/")}/`)}if(s.hostname&&(s.hostname=s.hostname.replace(/\.$/,""),e.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(s.hostname)&&(s.hostname=s.hostname.replace(/^www\./,""))),Array.isArray(e.removeQueryParameters))for(const a of[...s.searchParams.keys()])testParameter(a,e.removeQueryParameters)&&s.searchParams.delete(a);if(!Array.isArray(e.keepQueryParameters)&&e.removeQueryParameters===!0&&(s.search=""),Array.isArray(e.keepQueryParameters)&&e.keepQueryParameters.length>0)for(const a of[...s.searchParams.keys()])testParameter(a,e.keepQueryParameters)||s.searchParams.delete(a);if(e.sortQueryParameters){s.searchParams.sort();try{s.search=decodeURIComponent(s.search)}catch{}}e.removeTrailingSlash&&(s.pathname=s.pathname.replace(/\/$/,"")),e.removeExplicitPort&&s.port&&(s.port="");const o=n;return n=s.toString(),!e.removeSingleSlash&&s.pathname==="/"&&!o.endsWith("/")&&s.hash===""&&(n=n.replace(/\/$/,"")),(e.removeTrailingSlash||s.pathname==="/")&&s.hash===""&&e.removeSingleSlash&&(n=n.replace(/\/$/,"")),t&&!e.normalizeProtocol&&(n=n.replace(/^http:\/\//,"//")),e.stripProtocol&&(n=n.replace(/^(?:https?:)?\/\//,"")),n}var MAX_RECONNECT_ATTEMPTS=5,FLAPPING_THRESHOLD_MS=1e3,NDKRelayConnectivity=class{constructor(n,e){g(this,"ndkRelay");g(this,"ws");g(this,"_status");g(this,"timeoutMs");g(this,"connectedAt");g(this,"_connectionStats",{attempts:0,success:0,durations:[]});g(this,"debug");g(this,"netDebug");g(this,"connectTimeout");g(this,"reconnectTimeout");g(this,"ndk");g(this,"openSubs",new Map);g(this,"openCountRequests",new Map);g(this,"openEventPublishes",new Map);g(this,"serial",0);g(this,"baseEoseTimeout",4400);g(this,"updateConnectionStats",{connected:()=>{this._connectionStats.success++,this._connectionStats.connectedAt=Date.now()},disconnected:()=>{this._connectionStats.connectedAt&&(this._connectionStats.durations.push(Date.now()-this._connectionStats.connectedAt),this._connectionStats.durations.length>100&&this._connectionStats.durations.shift()),this._connectionStats.connectedAt=void 0},attempt:()=>{this._connectionStats.attempts++,this._connectionStats.connectedAt=Date.now()}});this.ndkRelay=n,this._status=1;const t=Math.floor(Math.random()*1e3);this.debug=this.ndkRelay.debug.extend(`connectivity${t}`),this.ndk=e}async connect(n,e=!0){if(this._status!==2&&this._status!==1){this.debug("Relay requested to be connected but was in state %s or it had a reconnect timeout",this._status);return}this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0),this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=void 0),n??(n=this.timeoutMs),!this.timeoutMs&&n&&(this.timeoutMs=n),this.timeoutMs&&(this.connectTimeout=setTimeout(()=>this.onConnectionError(e),this.timeoutMs));try{this.updateConnectionStats.attempt(),this._status===1?this._status=4:this._status=2,this.ws=new WebSocket(this.ndkRelay.url),this.ws.onopen=this.onConnect.bind(this),this.ws.onclose=this.onDisconnect.bind(this),this.ws.onmessage=this.onMessage.bind(this),this.ws.onerror=this.onError.bind(this)}catch(t){throw this.debug(`Failed to connect to ${this.ndkRelay.url}`,t),this._status=1,e?this.handleReconnection():this.ndkRelay.emit("delayed-connect",2*24*60*60*1e3),t}}disconnect(){var n;this._status=0;try{(n=this.ws)==null||n.close()}catch(e){this.debug("Failed to disconnect",e),this._status=1}}onConnectionError(n){this.debug(`Error connecting to ${this.ndkRelay.url}`,this.timeoutMs),n&&!this.reconnectTimeout&&this.handleReconnection()}onConnect(){var n;(n=this.netDebug)==null||n.call(this,"connected",this.ndkRelay),this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0),this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=void 0),this.updateConnectionStats.connected(),this._status=5,this.ndkRelay.emit("connect"),this.ndkRelay.emit("ready")}onDisconnect(){var n;(n=this.netDebug)==null||n.call(this,"disconnected",this.ndkRelay),this.updateConnectionStats.disconnected(),this._status===5&&this.handleReconnection(),this._status=1,this.ndkRelay.emit("disconnect")}onMessage(n){var e;(e=this.netDebug)==null||e.call(this,n.data,this.ndkRelay,"recv");try{const t=JSON.parse(n.data),[r,s,...o]=t;switch(r){case"EVENT":{const a=this.openSubs.get(s),c=t[2];if(!a){this.debug(`Received event for unknown subscription ${s}`);return}a.onevent(c);return}case"COUNT":{const a=t[2],c=this.openCountRequests.get(s);c&&(c.resolve(a.count),this.openCountRequests.delete(s));return}case"EOSE":{const a=this.openSubs.get(s);if(!a)return;a.oneose(s);return}case"OK":{const a=t[2],c=t[3],l=this.openEventPublishes.get(s),f=l==null?void 0:l.pop();if(!l||!f){this.debug("Received OK for unknown event publish",s);return}a?f.resolve(c):f.reject(new Error(c)),l.length===0?this.openEventPublishes.delete(s):this.openEventPublishes.set(s,l);return}case"CLOSED":{const a=this.openSubs.get(s);if(!a)return;a.onclosed(t[2]);return}case"NOTICE":this.onNotice(t[1]);return;case"AUTH":{this.onAuthRequested(t[1]);return}}}catch(t){this.debug(`Error parsing message from ${this.ndkRelay.url}: ${t.message}`,t==null?void 0:t.stack);return}}async onAuthRequested(n){var t,r,s;const e=this.ndkRelay.authPolicy??((t=this.ndk)==null?void 0:t.relayAuthDefaultPolicy);if(this.debug("Relay requested authentication",{havePolicy:!!e}),this._status===7){this.debug("Already authenticating, ignoring");return}if(this._status=6,e){if(this._status>=5){this._status=7;let o;try{o=await e(this.ndkRelay,n)}catch(a){this.debug("Authentication policy threw an error",a),o=!1}if(this.debug("Authentication policy returned",!!o),o instanceof NDKEvent||o===!0){o instanceof NDKEvent&&await this.auth(o);const a=async()=>{if(this._status>=5&&this._status<8){const c=new NDKEvent(this.ndk);c.kind=22242,c.tags=[["relay",this.ndkRelay.url],["challenge",n]],await c.sign(),this.auth(c).then(()=>{this._status=8,this.ndkRelay.emit("authed"),this.debug("Authentication successful")}).catch(l=>{this._status=6,this.ndkRelay.emit("auth:failed",l),this.debug("Authentication failed",l)})}else this.debug("Authentication failed, it changed status, status is %d",this._status)};o===!0&&((r=this.ndk)!=null&&r.signer?a().catch(c=>{console.error("Error authenticating",c)}):(this.debug("No signer available for authentication localhost"),(s=this.ndk)==null||s.once("signer:ready",a))),this._status=5,this.ndkRelay.emit("authed")}}}else this.ndkRelay.emit("auth",n)}onError(n){this.debug(`WebSocket error on ${this.ndkRelay.url}:`,n)}get status(){return this._status}isAvailable(){return this._status===5}isFlapping(){const n=this._connectionStats.durations;if(n.length%3!==0)return!1;const t=n.reduce((a,c)=>a+c,0)/n.length,r=n.map(a=>(a-t)**2).reduce((a,c)=>a+c,0)/n.length;return Math.sqrt(r){this.reconnectTimeout=void 0,this._status=2,this.connect().catch(t=>{n{this.handleReconnection(n+1)},1e3*(n+1)^4):this.debug("Reconnect failed")})},e),this.ndkRelay.emit("delayed-connect",e),this.debug("Reconnecting in",e),this._connectionStats.nextReconnectAt=Date.now()+e}async send(n){var e,t,r;this._status>=5&&((e=this.ws)==null?void 0:e.readyState)===WebSocket.OPEN?((t=this.ws)==null||t.send(n),(r=this.netDebug)==null||r.call(this,n,this.ndkRelay,"send")):this.debug(`Not connected to ${this.ndkRelay.url} (%d), not sending message ${n}`,this._status)}async auth(n){const e=new Promise((t,r)=>{const s=this.openEventPublishes.get(n.id)??[];s.push({resolve:t,reject:r}),this.openEventPublishes.set(n.id,s)});return this.send(`["AUTH",${JSON.stringify(n.rawEvent())}]`),e}async publish(n){const e=new Promise((t,r)=>{const s=this.openEventPublishes.get(n.id)??[];s.length>0&&console.warn(`Duplicate event publishing detected, you are publishing event ${n.id} twice`),s.push({resolve:t,reject:r}),this.openEventPublishes.set(n.id,s)});return this.send(`["EVENT",${JSON.stringify(n)}]`),e}async count(n,e){this.serial++;const t=(e==null?void 0:e.id)||`count:${this.serial}`,r=new Promise((s,o)=>{this.openCountRequests.set(t,{resolve:s,reject:o})});return this.send(`["COUNT","${t}",${JSON.stringify(n).substring(1)}`),r}close(n,e){this.send(`["CLOSE","${n}"]`);const t=this.openSubs.get(n);this.openSubs.delete(n),t&&t.onclose(e)}req(n){`${this.send(`["REQ","${n.subId}",${JSON.stringify(n.executeFilters).substring(1)}`)}`,this.openSubs.set(n.subId,n)}get connectionStats(){return this._connectionStats}get url(){return this.ndkRelay.url}get connected(){var n;return this._status>=5&&((n=this.ws)==null?void 0:n.readyState)===WebSocket.OPEN}},NDKRelayPublisher=class{constructor(n){g(this,"ndkRelay");g(this,"debug");this.ndkRelay=n,this.debug=n.debug.extend("publisher")}async publish(n,e=2500){let t;const r=()=>new Promise((h,u)=>{try{this.publishEvent(n).then(p=>{this.ndkRelay.emit("published",n),n.emit("relay:published",this.ndkRelay),h(!0)}).catch(u)}catch(p){u(p)}}),s=new Promise((h,u)=>{t=setTimeout(()=>{t=void 0,u(new Error(`Timeout: ${e}ms`))},e)}),o=()=>{r().then(h=>a(h)).catch(h=>c(h))};let a,c;const l=h=>{throw this.ndkRelay.debug("Publish failed",h,n.id),this.ndkRelay.emit("publish:failed",n,h),n.emit("relay:publish:failed",this.ndkRelay,h),h},f=()=>{t&&clearTimeout(t),this.ndkRelay.removeListener("connect",o)};return this.ndkRelay.status>=5?Promise.race([r(),s]).catch(l).finally(f):(this.ndkRelay.status<=1?(console.warn("Relay is disconnected, trying to connect to publish an event",this.ndkRelay.url),this.ndkRelay.connect()):console.warn("Relay not connected, waiting for connection to publish an event",this.ndkRelay.url),Promise.race([new Promise((h,u)=>{a=h,c=u,this.ndkRelay.on("connect",o)}),s]).catch(l).finally(f))}async publishEvent(n){return this.ndkRelay.connectivity.publish(n.rawEvent())}};function filterFingerprint(n,e){const t=[];for(const s of n){const o=Object.entries(s||{}).map(([a,c])=>["since","until"].includes(a)?`${a}:${c}`:a).sort().join("-");t.push(o)}let r=e?"+":"";return r+=t.join("|"),r}function mergeFilters(n){const e=[],t={};return n.filter(r=>!!r.limit).forEach(r=>e.push(r)),n=n.filter(r=>!r.limit),n.length===0?e:(n.forEach(r=>{Object.entries(r).forEach(([s,o])=>{Array.isArray(o)?t[s]===void 0?t[s]=[...o]:t[s]=Array.from(new Set([...t[s],...o])):t[s]=o})}),[...e,t])}var NDKRelaySubscription=class{constructor(n,e,t){g(this,"fingerprint");g(this,"items",new Map);g(this,"topSubManager");g(this,"debug");g(this,"status",0);g(this,"onClose");g(this,"relay");g(this,"eosed",!1);g(this,"executionTimer");g(this,"fireTime");g(this,"delayType");g(this,"executeFilters");g(this,"id",Math.random().toString(36).substring(7));g(this,"_subId");g(this,"subIdParts",new Set);g(this,"executeOnRelayReady",()=>{if(this.status===2){if(this.items.size===0){this.debug("No items to execute; this relay was probably too slow to respond and the caller gave up",{status:this.status,fingerprint:this.fingerprint,items:this.items,itemsSize:this.items.size,id:this.id,subId:this.subId}),this.cleanup();return}this.debug("Executing on relay ready",{status:this.status,fingerprint:this.fingerprint,items:this.items,itemsSize:this.items.size}),this.status=1,this.execute()}});g(this,"reExecuteAfterAuth",(()=>{const n=this.subId;this.debug("Re-executing after auth",this.items.size),this.eosed?this.relay.close(this.subId):this.debug("We are abandoning an opened subscription, once it EOSE's, the handler will close it",{oldSubId:n}),this._subId=void 0,this.status=1,this.execute(),this.debug("Re-executed after auth %s 👉 %s",n,this.subId)}).bind(this));this.relay=n,this.topSubManager=t,this.debug=n.debug.extend(`sub[${this.id}]`),this.fingerprint=e||Math.random().toString(36).substring(7)}get subId(){return this._subId?this._subId:(this._subId=this.fingerprint.slice(0,15),this._subId)}addSubIdPart(n){this.subIdParts.add(n)}addItem(n,e){if(this.debug("Adding item",{filters:e,internalId:n.internalId,status:this.status,fingerprint:this.fingerprint,id:this.subId,items:this.items,itemsSize:this.items.size}),!this.items.has(n.internalId))switch(n.on("close",this.removeItem.bind(this,n)),this.items.set(n.internalId,{subscription:n,filters:e}),this.status!==3&&n.subId&&(!this._subId||this._subId.length<48)&&(this.status===0||this.status===1)&&this.addSubIdPart(n.subId),this.status){case 0:this.evaluateExecutionPlan(n);break;case 3:break;case 1:this.evaluateExecutionPlan(n);break;case 4:throw this.debug("Subscription is closed, cannot add new items %o (%o)",n,e),new Error("Cannot add new items to a closed subscription")}}removeItem(n){if(this.items.delete(n.internalId),this.items.size===0){if(!this.eosed)return;this.close(),this.cleanup()}}close(){if(this.status===4)return;const n=this.status;if(this.status=4,n===3)try{this.relay.close(this.subId)}catch(e){this.debug("Error closing subscription",e,this)}else this.debug("Subscription wanted to close but it wasn't running, this is probably ok",{subId:this.subId,prevStatus:n,sub:this});this.cleanup()}cleanup(){this.executionTimer&&clearTimeout(this.executionTimer),this.relay.off("ready",this.executeOnRelayReady),this.relay.off("authed",this.reExecuteAfterAuth),this.onClose&&this.onClose(this)}evaluateExecutionPlan(n){if(!n.isGroupable()){this.status=1,this.execute();return}if(n.filters.find(r=>!!r.limit)&&(this.executeFilters=this.compileFilters(),this.executeFilters.length>=10)){this.status=1,this.execute();return}const e=n.groupableDelay,t=n.groupableDelayType;if(!e)throw new Error("Cannot group a subscription without a delay");if(this.status===0)this.schedule(e,t);else{const r=this.delayType,s=this.fireTime-Date.now();if(r==="at-least"&&t==="at-least")se&&(this.executionTimer&&clearTimeout(this.executionTimer),this.schedule(e,t));else if(r==="at-most"&&t==="at-most")s>e&&(this.executionTimer&&clearTimeout(this.executionTimer),this.schedule(e,t));else if(r==="at-most"&&t==="at-least")s>e&&(this.executionTimer&&clearTimeout(this.executionTimer),this.schedule(e,t));else throw new Error(`Unknown delay type combination ${r} ${t}`)}}schedule(n,e){this.status=1;const t=Date.now();this.fireTime=t+n,this.delayType=e;const r=setTimeout(this.execute.bind(this),n);e==="at-least"&&(this.executionTimer=r)}finalizeSubId(){this.subIdParts.size>0?this._subId=Array.from(this.subIdParts).join("-"):this._subId=this.fingerprint.slice(0,15),this._subId+=`-${Math.random().toString(36).substring(2,7)}`}execute(){if(this.status===1){if(!this.relay.connected){this.status=2,this.debug("Waiting for relay to be ready",{status:this.status,id:this.subId,fingerprint:this.fingerprint,items:this.items,itemsSize:this.items.size}),this.relay.once("ready",this.executeOnRelayReady);return}this.relay.status<8&&this.relay.once("authed",this.reExecuteAfterAuth),this.status=3,this.finalizeSubId(),this.executeFilters=this.compileFilters(),this.relay.req(this)}}onstart(){}onevent(n){this.topSubManager.dispatchEvent(n,this.relay)}oneose(n){if(this.eosed=!0,n!==this.subId){this.debug("Received EOSE for an abandoned subscription",n,this.subId),this.relay.close(n);return}this.items.size===0&&this.close();for(const{subscription:e}of this.items.values())e.eoseReceived(this.relay),e.closeOnEose&&(this.debug("Removing item because of EOSE",{filters:e.filters,internalId:e.internalId,status:this.status,fingerprint:this.fingerprint,items:this.items,itemsSize:this.items.size}),this.removeItem(e))}onclose(n){this.status=4}onclosed(n){if(n)for(const{subscription:e}of this.items.values())e.closedReceived(this.relay,n)}compileFilters(){const n=[],e=Array.from(this.items.values()).map(r=>r.filters);if(!e[0])return this.debug("👀 No filters to merge",this.items),console.error("BUG: No filters to merge!",this.items),[];const t=e[0].length;for(let r=0;ro[r]);n.push(...mergeFilters(s))}return n}},NDKRelaySubscriptionManager=class{constructor(n,e){g(this,"relay");g(this,"subscriptions");g(this,"generalSubManager");this.relay=n,this.subscriptions=new Map,this.generalSubManager=e}addSubscription(n,e){let t;if(!n.isGroupable())t=this.createSubscription(n,e);else{const r=filterFingerprint(e,n.closeOnEose);r&&(t=(this.subscriptions.get(r)||[]).find(o=>o.status<3)),t??(t=this.createSubscription(n,e,r))}t.addItem(n,e)}createSubscription(n,e,t){const r=new NDKRelaySubscription(this.relay,t||null,this.generalSubManager);r.onClose=this.onRelaySubscriptionClose.bind(this);const s=this.subscriptions.get(r.fingerprint)??[];return this.subscriptions.set(r.fingerprint,[...s,r]),r}onRelaySubscriptionClose(n){let e=this.subscriptions.get(n.fingerprint)??[];e?e.length===1?this.subscriptions.delete(n.fingerprint):(e=e.filter(t=>t.id!==n.id),this.subscriptions.set(n.fingerprint,e)):console.warn("Unexpectedly did not find a subscription with fingerprint",n.fingerprint)}},SignatureVerificationStats=class{constructor(n,e=1e4){g(this,"ndk");g(this,"debug");g(this,"intervalId",null);g(this,"intervalMs");this.ndk=n,this.debug=createDebug2("ndk:signature-verification-stats"),this.intervalMs=e}start(){if(this.intervalId){this.debug("Stats tracking already started");return}this.debug(`Starting signature verification stats reporting every ${this.intervalMs}ms`),this.intervalId=setInterval(()=>{this.reportStats()},this.intervalMs)}stop(){if(!this.intervalId){this.debug("Stats tracking not started");return}clearInterval(this.intervalId),this.intervalId=null,this.debug("Stopped signature verification stats reporting")}reportStats(){const n=this.collectStats();console.log(` +=== Signature Verification Sampling Stats ===`),console.log(`Timestamp: ${new Date().toISOString()}`),console.log(`Total Relays: ${n.totalRelays}`),console.log(`Connected Relays: ${n.connectedRelays}`),n.relayStats.length===0?console.log("No relay statistics available"):(console.log(` +Relay Statistics:`),n.relayStats.sort((e,t)=>e.url.localeCompare(t.url)),n.relayStats.forEach(e=>{var t;console.log(` + ${e.url} ${e.connected?"(connected)":"(disconnected)"}`),console.log(` Validated Events: ${e.validatedCount}`),console.log(` Non-validated Events: ${e.nonValidatedCount}`),console.log(` Total Events: ${e.totalEvents}`),console.log(` Current Validation Ratio: ${e.validationRatio.toFixed(4)} (${(e.validationRatio*100).toFixed(2)}%)`),console.log(` Target Validation Ratio: ${((t=e.targetValidationRatio)==null?void 0:t.toFixed(4))||"N/A"} (${e.targetValidationRatio?(e.targetValidationRatio*100).toFixed(2)+"%":"N/A"})`),console.log(` Trusted: ${e.trusted?"Yes":"No"}`)})),console.log(` +Global Settings:`),console.log(` Initial Validation Ratio: ${n.initialValidationRatio.toFixed(4)} (${(n.initialValidationRatio*100).toFixed(2)}%)`),console.log(` Lowest Validation Ratio: ${n.lowestValidationRatio.toFixed(4)} (${(n.lowestValidationRatio*100).toFixed(2)}%)`),console.log(` Auto-blacklist Invalid Relays: ${n.autoBlacklistInvalidRelays?"Yes":"No"}`),console.log(` Blacklisted Relays: ${n.blacklistedRelayCount}`),console.log(`=========================================== +`)}collectStats(){var e;const n=[];for(const t of this.ndk.pool.relays.values())n.push({url:t.url,connected:t.connected,validatedCount:t.validatedEventCount,nonValidatedCount:t.nonValidatedEventCount,totalEvents:t.validatedEventCount+t.nonValidatedEventCount,validationRatio:t.validationRatio,targetValidationRatio:t.targetValidationRatio,trusted:t.trusted});return{totalRelays:this.ndk.pool.relays.size,connectedRelays:this.ndk.pool.connectedRelays().length,relayStats:n,initialValidationRatio:this.ndk.initialValidationRatio,lowestValidationRatio:this.ndk.lowestValidationRatio,autoBlacklistInvalidRelays:this.ndk.autoBlacklistInvalidRelays,blacklistedRelayCount:((e=this.ndk.blacklistRelayUrls)==null?void 0:e.length)||0}}};function startSignatureVerificationStats(n,e=1e4){const t=new SignatureVerificationStats(n,e);return t.start(),t}var NDKRelayStatus=(n=>(n[n.DISCONNECTING=0]="DISCONNECTING",n[n.DISCONNECTED=1]="DISCONNECTED",n[n.RECONNECTING=2]="RECONNECTING",n[n.FLAPPING=3]="FLAPPING",n[n.CONNECTING=4]="CONNECTING",n[n.CONNECTED=5]="CONNECTED",n[n.AUTH_REQUESTED=6]="AUTH_REQUESTED",n[n.AUTHENTICATING=7]="AUTHENTICATING",n[n.AUTHENTICATED=8]="AUTHENTICATED",n))(NDKRelayStatus||{}),Te,NDKRelay=(Te=class extends lib$1.EventEmitter{constructor(t,r,s){super();g(this,"url");g(this,"scores");g(this,"connectivity");g(this,"subs");g(this,"publisher");g(this,"authPolicy");g(this,"lowestValidationRatio");g(this,"targetValidationRatio");g(this,"validationRatioFn");g(this,"validatedEventCount",0);g(this,"nonValidatedEventCount",0);g(this,"trusted",!1);g(this,"complaining",!1);g(this,"debug");g(this,"req");g(this,"close");this.url=normalizeRelayUrl(t),this.scores=new Map,this.debug=createDebug2(`ndk:relay:${t}`),this.connectivity=new NDKRelayConnectivity(this,s),this.connectivity.netDebug=s==null?void 0:s.netDebug,this.req=this.connectivity.req.bind(this.connectivity),this.close=this.connectivity.close.bind(this.connectivity),this.subs=new NDKRelaySubscriptionManager(this,s.subManager),this.publisher=new NDKRelayPublisher(this),this.authPolicy=r,this.targetValidationRatio=s==null?void 0:s.initialValidationRatio,this.lowestValidationRatio=s==null?void 0:s.lowestValidationRatio,this.validationRatioFn=((s==null?void 0:s.validationRatioFn)??Te.defaultValidationRatioUpdateFn).bind(this),this.updateValidationRatio(),s||console.trace("relay created without ndk")}updateValidationRatio(){if(this.validationRatioFn&&this.validatedEventCount>0){const t=this.validationRatioFn(this,this.validatedEventCount,this.nonValidatedEventCount);this.targetValidationRatio=t}setTimeout(()=>{this.updateValidationRatio()},3e4)}get status(){return this.connectivity.status}get connectionStats(){return this.connectivity.connectionStats}async connect(t,r=!0){return this.connectivity.connect(t,r)}disconnect(){this.status!==1&&this.connectivity.disconnect()}subscribe(t,r){this.subs.addSubscription(t,r)}async publish(t,r=2500){return this.publisher.publish(t,r)}referenceTags(){return[["r",this.url]]}addValidatedEvent(){this.validatedEventCount++}addNonValidatedEvent(){this.nonValidatedEventCount++}get validationRatio(){return this.nonValidatedEventCount===0?1:this.validatedEventCount/(this.validatedEventCount+this.nonValidatedEventCount)}shouldValidateEvent(){return this.trusted?!1:this.targetValidationRatio===void 0||this.targetValidationRatio>=1?!0:Math.random(){if(t.lowestValidationRatio===void 0||t.targetValidationRatio===void 0)return 1;let o=t.validationRatio;if(t.validationRatio>t.targetValidationRatio){const a=r/100;o=Math.max(t.lowestValidationRatio,t.validationRatio-a)}return oe.url)}static fromRelayUrls(e,t,r=!0,s){if(s=s??t.pool,!s)throw new Error("No pool provided");const o=new Set;for(const a of e){const c=s.relays.get(normalizeRelayUrl(a));if(c)c.status<5&&r&&c.connect(),o.add(c);else{const l=new NDKRelay(normalizeRelayUrl(a),t==null?void 0:t.relayAuthDefaultPolicy,t);s.useTemporaryRelay(l,void 0,`requested from fromRelayUrls ${e}`),o.add(l)}}return new Ie(new Set(o),t,s)}async publish(e,t,r=1){var l;const s=new Set,o=new Map,a=e.isEphemeral();e.publishStatus="pending";const c=f=>{s.add(f)};e.on("relay:published",c);try{const f=Array.from(this.relays).map(h=>new Promise(u=>{const p=t?setTimeout(()=>{s.has(h)||(o.set(h,new Error(`Publish timeout after ${t}ms`)),u(!1))},t):null;h.publish(e,t).then(y=>{p&&clearTimeout(p),y?(s.add(h),u(!0)):u(!1)}).catch(y=>{p&&clearTimeout(p),a||o.set(h,y),u(!1)})}));if(await Promise.all(f),s.size{var u;const h=(u=n.pool)==null?void 0:u.getRelay(f);h&&r.add(h)});let o=e.tags.filter(f=>["a","e"].includes(f[0])).map(f=>f[2]).filter(f=>f==null?void 0:f.startsWith("wss://")).filter(f=>{try{return new URL(f),!0}catch{return!1}}).map(f=>normalizeRelayUrl(f));o=Array.from(new Set(o)).slice(0,5),o.forEach(f=>{var u;const h=(u=n.pool)==null?void 0:u.getRelay(f,!0,!0);h&&(d("Adding relay hint %s",f),r.add(h))});const a=e.getMatchingTags("p").map(f=>f[1]);if(a.length<5?Array.from(chooseRelayCombinationForPubkeys(n,a,"read",{preferredRelays:new Set(s)}).keys()).forEach(h=>{var p;const u=(p=n.pool)==null?void 0:p.getRelay(h,!1,!0);u&&(d("Adding p-tagged relay %s",h),r.add(u))}):d("Too many p-tags to consider %d",a.length),(c=n.pool)==null||c.permanentAndConnectedRelays().forEach(f=>r.add(f)),t&&r.size!Array.from(r).some(u=>u.url===h)).slice(0,t-r.size);f==null||f.forEach(h=>{var p;const u=(p=n.pool)==null?void 0:p.getRelay(h,!1,!0);u&&(d("Adding explicit relay %s",h),r.add(u))})}return new NDKRelaySet(r,n)}function calculateRelaySetsFromFilter(n,e,t){const r=new Map,s=new Set;if(e.forEach(o=>{o.authors&&o.authors.forEach(a=>s.add(a))}),s.size>0){const o=getRelaysForFilterWithAuthors(n,Array.from(s));for(const a of o.keys())r.set(a,[]);for(const a of e)if(a.authors)for(const[c,l]of o.entries()){const f=a.authors.filter(h=>l.includes(h));r.set(c,[...r.get(c),{...a,authors:f}])}else for(const c of o.keys())r.set(c,[...r.get(c),a])}else n.explicitRelayUrls&&n.explicitRelayUrls.forEach(o=>{r.set(o,e)});return r.size===0&&t.permanentAndConnectedRelays().slice(0,5).forEach(o=>{r.set(o.url,e)}),r}function calculateRelaySetsFromFilters(n,e,t){return calculateRelaySetsFromFilter(n,e,t)}function mergeTags(n,e){const t=new Map,r=a=>a.join(","),s=(a,c)=>a.every((l,f)=>l===c[f]),o=a=>{for(const[c,l]of t)if(s(l,a)||s(a,l)){a.length>=l.length&&t.set(c,a);return}t.set(r(a),a)};return n.concat(e).forEach(o),Array.from(t.values())}function uniqueTag(n,e){const t=n.length,r=e.length;return t===r?n.every((o,a)=>o===e[a])?[n]:[n,e]:t>r&&n.every((o,a)=>o===e[a])?[n]:r>t&&e.every((o,a)=>o===n[a])?[e]:[n,e]}var hashtagRegex=new RegExp(`(?<=\\s|^)(#[^\\s!@#$%^&*()=+./,[{\\]};:'"?><]+)`,"g");function generateHashtags(n){const e=n.match(hashtagRegex),t=new Set,r=new Set;if(e)for(const s of e)t.has(s.slice(1))||(r.add(s.slice(1)),t.add(s.slice(1)));return Array.from(r)}async function generateContentTags(n,e=[]){const t=/(@|nostr:)(npub|nprofile|note|nevent|naddr)[a-zA-Z0-9]+/g,r=[],s=a=>{e.find(c=>["q",a[0]].includes(c[0])&&c[1]===a[1])||e.push(a)};n=n.replace(t,a=>{try{const c=a.split(/(@|nostr:)/)[2],{type:l,data:f}=nip19_exports.decode(c);let h;switch(l){case"npub":h=["p",f];break;case"nprofile":h=["p",f.pubkey];break;case"note":r.push(new Promise(async u=>{s(["q",f,await maybeGetEventRelayUrl(c)]),u()}));break;case"nevent":r.push(new Promise(async u=>{const{id:p,author:y}=f;let{relays:b}=f;(!b||b.length===0)&&(b=[await maybeGetEventRelayUrl(c)]),s(["q",p,b[0]]),y&&s(["p",y]),u()}));break;case"naddr":r.push(new Promise(async u=>{const p=[f.kind,f.pubkey,f.identifier].join(":");let y=f.relays??[];y.length===0&&(y=[await maybeGetEventRelayUrl(c)]),s(["q",p,y[0]]),s(["p",f.pubkey]),u()}));break;default:return a}return h&&s(h),`nostr:${c}`}catch{return a}}),await Promise.all(r);const o=generateHashtags(n).map(a=>["t",a]);return e=mergeTags(e,o),{content:n,tags:e}}async function maybeGetEventRelayUrl(n){return""}async function encrypt(n,e,t="nip44"){let r;if(!this.ndk)throw new Error("No NDK instance found!");let s=e;if(s||(this.ndk.assertSigner(),s=this.ndk.signer),!s)throw new Error("no NDK signer");const o=n||(()=>{const a=this.getMatchingTags("p");if(a.length!==1)throw new Error("No recipient could be determined and no explicit recipient was provided");return this.ndk.getUser({pubkey:a[0][1]})})();if(t==="nip44"&&await isEncryptionEnabled(s,"nip44")&&(r=await s.encrypt(o,this.content,"nip44")),(!r||t==="nip04")&&await isEncryptionEnabled(s,"nip04")&&(r=await s.encrypt(o,this.content,"nip04")),!r)throw new Error("Failed to encrypt event.");this.content=r}async function decrypt(n,e,t){var c,l,f,h;if((l=(c=this.ndk)==null?void 0:c.cacheAdapter)!=null&&l.getDecryptedEvent){let u=null;if(typeof this.ndk.cacheAdapter.getDecryptedEvent=="function"&&(u=this.ndk.cacheAdapter.getDecryptedEvent(this.id)),u){this.content=u.content;return}}let r;if(!this.ndk)throw new Error("No NDK instance found!");let s=e;if(s||(this.ndk.assertSigner(),s=this.ndk.signer),!s)throw new Error("no NDK signer");const o=n||this.author;if(!o)throw new Error("No sender provided and no author available");const a=t||(this.content.match(/\\?iv=/)?"nip04":"nip44");if((a==="nip04"||this.kind===4)&&await isEncryptionEnabled(s,"nip04")&&this.content.search("\\?iv=")&&(r=await s.decrypt(o,this.content,"nip04")),!r&&a==="nip44"&&await isEncryptionEnabled(s,"nip44")&&(r=await s.decrypt(o,this.content,"nip44")),!r)throw new Error("Failed to decrypt event.");this.content=r,(h=(f=this.ndk)==null?void 0:f.cacheAdapter)!=null&&h.addDecryptedEvent&&this.ndk.cacheAdapter.addDecryptedEvent(this)}async function isEncryptionEnabled(n,e){return n.encryptionEnabled?e?!!await n.encryptionEnabled(e):!0:!1}function eventsBySameAuthor(n,e){const t=new Map;return t.set(n.id,n),e.forEach(r=>{r.pubkey===n.pubkey&&t.set(r.id,r)}),t}var hasMarkers=(n,e)=>n.getMatchingTags(e).some(t=>t[3]&&t[3]!=="");function eventIsReply(n,e,t=new Set,r){r??(r=n.tagType());const s=e.getMatchingTags(r);if(t.add(n.tagId()),t.has(e.tagId()))return!1;const a=(()=>{let l=!1;for(const f of s){if(f[3]==="reply")return t.has(f[1]);const h=f[3]===""||f[3]===void 0,u=f[3]==="root";f[1]===n.tagId()&&(h||u)&&(l=u?"root":!0)}if(!l)return!1;if(l==="root")return!0})();if(a!==void 0)return a;if(hasMarkers(e,r))return!1;const c=n.getMatchingTags("e").map(l=>l[1]);return c.push(n.id),e.getMatchingTags("e").every(l=>c.includes(l[1]))}function eventThreads(n,e){const t=eventsBySameAuthor(n,e);return e.filter(s=>eventIsPartOfThread(n,s,t)).sort((s,o)=>s.created_at-o.created_at)}function getEventReplyId(n){const e=getReplyTag(n);if(e)return e[1];const t=getRootTag(n);if(t)return t[1]}function isEventOriginalPost(n){return getEventReplyId(n)===void 0}function eventThreadIds(n,e){const t=new Map;return eventThreads(n,e).forEach(s=>t.set(s.id,s)),t}function eventReplies(n,e,t){return t??(t=new Set(eventThreadIds(n,e).keys())),e.filter(r=>eventIsReply(n,r,t))}function eventIsPartOfThread(n,e,t){return n.pubkey!==e.pubkey?!1:e.getMatchingTags("e").map(o=>o[1]).every(o=>t.has(o))}function eventHasETagMarkers(n){for(const e of n.tags)if(e[0]==="e"&&(e[3]??"").length>0)return!0;return!1}function getRootEventId(n,e){e??(e=n.tagType());const t=getRootTag(n,e);if(t)return t[1];const r=getReplyTag(n,e);return r==null?void 0:r[1]}function getRootTag(n,e){e??(e=n.tagType());const t=n.tags.find(isTagRootTag);if(!t){if(eventHasETagMarkers(n))return;const r=n.getMatchingTags(e);if(r.length<3)return r[0]}return t}var nip22RootTags=new Set(["A","E","I"]),nip22ReplyTags=new Set(["a","e","i"]);function getReplyTag(n,e){if(n.kind===1111){let s;for(const o of n.tags)if(nip22RootTags.has(o[0]))s=o;else if(nip22ReplyTags.has(o[0])){s=o;break}return s}e??(e=n.tagType());let t=!1,r;for(const s of n.tags)if(s[0]===e){if((s[3]??"").length>0&&(t=!0),t&&s[3]==="reply")return s;t&&s[3]==="root"&&(r=s),t||(r=s)}return r}function isTagRootTag(n){return n[0]==="E"||n[3]==="root"}async function fetchTaggedEvent(n,e){if(!this.ndk)throw new Error("NDK instance not found");const t=this.getMatchingTags(n,e);if(t.length===0)return;const[r,s,o]=t[0];let a=o!==""?this.ndk.pool.getRelay(o):void 0;return await this.ndk.fetchEvent(s,{},a)}async function fetchRootEvent(n){if(!this.ndk)throw new Error("NDK instance not found");const e=getRootTag(this);if(e)return this.ndk.fetchEventFromTag(e,this,n)}async function fetchReplyEvent(n){if(!this.ndk)throw new Error("NDK instance not found");const e=getReplyTag(this);if(e)return this.ndk.fetchEventFromTag(e,this,n)}function isReplaceable(){if(this.kind===void 0)throw new Error("Kind not set");return[0,3].includes(this.kind)||this.kind>=1e4&&this.kind<2e4||this.kind>=3e4&&this.kind<4e4}function isEphemeral(){if(this.kind===void 0)throw new Error("Kind not set");return this.kind>=2e4&&this.kind<3e4}function isParamReplaceable(){if(this.kind===void 0)throw new Error("Kind not set");return this.kind>=3e4&&this.kind<4e4}var DEFAULT_RELAY_COUNT=2;function encode(n=DEFAULT_RELAY_COUNT){let e=[];return this.onRelays.length>0?e=this.onRelays.map(t=>t.url):this.relay&&(e=[this.relay.url]),e.length>n&&(e=e.slice(0,n)),this.isParamReplaceable()?nip19_exports.naddrEncode({kind:this.kind,pubkey:this.pubkey,identifier:this.replaceableDTag(),relays:e}):e.length>0?nip19_exports.neventEncode({id:this.tagId(),relays:e,author:this.pubkey}):nip19_exports.noteEncode(this.tagId())}async function repost(n=!0,e){if(!e&&n){if(!this.ndk)throw new Error("No NDK instance found");this.ndk.assertSigner(),e=this.ndk.signer}const t=new NDKEvent(this.ndk,{kind:getKind(this)});return this.isProtected||(t.content=JSON.stringify(this.rawEvent())),t.tag(this),this.kind!==1&&t.tags.push(["k",`${this.kind}`]),e&&await t.sign(e),n&&await t.publish(),t}function getKind(n){return n.kind===1?6:16}function serialize(n=!1,e=!1){const t=[0,this.pubkey,this.created_at,this.kind,this.tags,this.content];return n&&t.push(this.sig),e&&t.push(this.id),JSON.stringify(t)}function deserialize(n){const e=JSON.parse(n),t={pubkey:e[1],created_at:e[2],kind:e[3],tags:e[4],content:e[5]};if(e.length>=7){const r=e[6],s=e[7];r&&r.length===128?(t.sig=r,s&&s.length===64&&(t.id=s)):r&&r.length===64&&(t.id=r,s&&s.length===128&&(t.sig=s))}return t}var worker,processingQueue={};function signatureVerificationInit(n){worker=n,worker.onmessage=e=>{const[t,r]=e.data,s=processingQueue[t];if(!s){console.error("No record found for event",t);return}delete processingQueue[t];for(const o of s.resolves)o(r)}}async function verifySignatureAsync(n,e,t){const r=n.ndk,s=Date.now();let o;return r.signatureVerificationFunction?(console.log("[NDK-CORE] Using custom signature verification function async"),o=await r.signatureVerificationFunction(n),console.log("Custom signature verification result",n.id,{result:o})):(console.log("Using worker-based signature verification async"),o=await new Promise(a=>{const c=n.serialize();let l=!1;processingQueue[n.id]||(processingQueue[n.id]={event:n,resolves:[],relay:t},l=!0),processingQueue[n.id].resolves.push(a),l&&(worker==null||worker.postMessage({serialized:c,id:n.id,sig:n.sig,pubkey:n.pubkey}))})),r.signatureVerificationTimeMs+=Date.now()-s,o}var PUBKEY_REGEX=/^[a-f0-9]{64}$/;function validate(){if(typeof this.kind!="number"||typeof this.content!="string"||typeof this.created_at!="number"||typeof this.pubkey!="string"||!this.pubkey.match(PUBKEY_REGEX)||!Array.isArray(this.tags))return!1;for(let n=0;n{var s,o;n&&(this.signatureVerified=r,r&&verifiedSignatures.set(this.id,this.sig)),r||(this.relay?(s=this.ndk)==null||s.reportInvalidSignature(this,this.relay):(o=this.ndk)==null||o.reportInvalidSignature(this),verifiedSignatures.set(this.id,!1))}).catch(r=>{console.error("signature verification error",this.id,r)});else{const r=sha256(new TextEncoder().encode(this.serialize())),s=schnorr.verify(this.sig,r,this.pubkey);return s?verifiedSignatures.set(this.id,this.sig):verifiedSignatures.set(this.id,!1),this.signatureVerified=s,s}}catch{return this.signatureVerified=!1,!1}}function getEventHash(){return getEventHashFromSerializedEvent(this.serialize())}function getEventHashFromSerializedEvent(n){const e=sha256(new TextEncoder().encode(n));return bytesToHex(e)}var skipClientTagOnKinds=new Set([0,4,1059,13,3,9734,5]),NDKEvent=class ie extends lib$1.EventEmitter{constructor(t,r){var s;super();g(this,"ndk");g(this,"created_at");g(this,"content","");g(this,"tags",[]);g(this,"kind");g(this,"id","");g(this,"sig");g(this,"pubkey","");g(this,"signatureVerified");g(this,"_author");g(this,"relay");g(this,"publishStatus","success");g(this,"publishError");g(this,"serialize",serialize.bind(this));g(this,"getEventHash",getEventHash.bind(this));g(this,"validate",validate.bind(this));g(this,"verifySignature",verifySignature.bind(this));g(this,"isReplaceable",isReplaceable.bind(this));g(this,"isEphemeral",isEphemeral.bind(this));g(this,"isDvm",()=>this.kind&&this.kind>=5e3&&this.kind<=7e3);g(this,"isParamReplaceable",isParamReplaceable.bind(this));g(this,"encode",encode.bind(this));g(this,"encrypt",encrypt.bind(this));g(this,"decrypt",decrypt.bind(this));g(this,"fetchTaggedEvent",fetchTaggedEvent.bind(this));g(this,"fetchRootEvent",fetchRootEvent.bind(this));g(this,"fetchReplyEvent",fetchReplyEvent.bind(this));g(this,"repost",repost.bind(this));this.ndk=t,this.created_at=r==null?void 0:r.created_at,this.content=(r==null?void 0:r.content)||"",this.tags=(r==null?void 0:r.tags)||[],this.id=(r==null?void 0:r.id)||"",this.sig=r==null?void 0:r.sig,this.pubkey=(r==null?void 0:r.pubkey)||"",this.kind=r==null?void 0:r.kind,r instanceof ie&&(this.relay&&(this.relay=r.relay,(s=this.ndk)==null||s.subManager.seenEvent(r.id,this.relay)),this.publishStatus=r.publishStatus,this.publishError=r.publishError)}get onRelays(){let t=[];return this.ndk?t=this.ndk.subManager.seenEvents.get(this.id)||[]:this.relay&&t.push(this.relay),t}static deserialize(t,r){return new ie(t,deserialize(r))}rawEvent(){return{created_at:this.created_at,content:this.content,tags:this.tags,kind:this.kind,pubkey:this.pubkey,id:this.id,sig:this.sig}}set author(t){var r;this.pubkey=t.pubkey,this._author=t,(r=this._author).ndk??(r.ndk=this.ndk)}get author(){if(this._author)return this._author;if(!this.ndk)throw new Error("No NDK instance found");const t=this.ndk.getUser({pubkey:this.pubkey});return this._author=t,t}tagExternal(t,r,s){const o=["i"],a=["k"];switch(r){case"url":{const c=new URL(t);c.hash="",o.push(c.toString()),a.push(`${c.protocol}//${c.host}`);break}case"hashtag":o.push(`#${t.toLowerCase()}`),a.push("#");break;case"geohash":o.push(`geo:${t.toLowerCase()}`),a.push("geo");break;case"isbn":o.push(`isbn:${t.replace(/-/g,"")}`),a.push("isbn");break;case"podcast:guid":o.push(`podcast:guid:${t}`),a.push("podcast:guid");break;case"podcast:item:guid":o.push(`podcast:item:guid:${t}`),a.push("podcast:item:guid");break;case"podcast:publisher:guid":o.push(`podcast:publisher:guid:${t}`),a.push("podcast:publisher:guid");break;case"isan":o.push(`isan:${t.split("-").slice(0,4).join("-")}`),a.push("isan");break;case"doi":o.push(`doi:${t.toLowerCase()}`),a.push("doi");break;default:throw new Error(`Unsupported NIP-73 entity type: ${r}`)}s&&o.push(s),this.tags.push(o),this.tags.push(a)}tag(t,r,s,o){let a=[];if(t.fetchProfile!==void 0){o??(o="p");const l=[o,t.pubkey];r&&l.push("",r),a.push(l)}else if(t instanceof ie){const l=t;s??(s=(l==null?void 0:l.pubkey)===this.pubkey),a=l.referenceTags(r,s,o);for(const f of l.getMatchingTags("p"))f[1]!==this.pubkey&&(this.tags.find(h=>h[0]==="p"&&h[1]===f[1])||this.tags.push(["p",f[1]]))}else if(Array.isArray(t))a=[t];else throw new Error("Invalid argument",t);this.tags=mergeTags(this.tags,a)}async toNostrEvent(t){var o,a;if(!t&&this.pubkey===""){const c=await((a=(o=this.ndk)==null?void 0:o.signer)==null?void 0:a.user());this.pubkey=(c==null?void 0:c.pubkey)||""}this.created_at||(this.created_at=Math.floor(Date.now()/1e3));const{content:r,tags:s}=await this.generateTags();this.content=r||"",this.tags=s;try{this.id=this.getEventHash()}catch{}return this.rawEvent()}getMatchingTags(t,r){const s=this.tags.filter(o=>o[0]===t);return r===void 0?s:s.filter(o=>o[3]===r)}hasTag(t,r){return this.tags.some(s=>s[0]===t&&(!r||s[3]===r))}tagValue(t,r){const s=this.getMatchingTags(t,r);if(s.length!==0)return s[0][1]}get alt(){return this.tagValue("alt")}set alt(t){this.removeTag("alt"),t&&this.tags.push(["alt",t])}get dTag(){return this.tagValue("d")}set dTag(t){this.removeTag("d"),t&&this.tags.push(["d",t])}removeTag(t,r){const s=Array.isArray(t)?t:[t];this.tags=this.tags.filter(o=>{const a=s.includes(o[0]),c=r?o[3]===r:!0;return!(a&&c)})}replaceTag(t){this.removeTag(t[0]),this.tags.push(t)}async sign(t){var s,o;t?this.author=await t.user():((s=this.ndk)==null||s.assertSigner(),t=(o=this.ndk)==null?void 0:o.signer);const r=await this.toNostrEvent();return this.sig=await t.sign(r),this.sig}async publishReplaceable(t,r,s){return this.id="",this.created_at=Math.floor(Date.now()/1e3),this.sig="",this.publish(t,r,s)}async publish(t,r,s){var c,l,f;if(s||(s=1),this.sig||await this.sign(),!this.ndk)throw new Error("NDKEvent must be associated with an NDK instance to publish");if((!t||t.size===0)&&(t=this.ndk.devWriteRelaySet||await calculateRelaySetFromEvent(this.ndk,this,s)),this.kind===5&&((c=this.ndk.cacheAdapter)!=null&&c.deleteEventIds)){const h=this.getMatchingTags("e").map(u=>u[1]);this.ndk.cacheAdapter.deleteEventIds(h)}const o=this.rawEvent();if((l=this.ndk.cacheAdapter)!=null&&l.addUnpublishedEvent&&shouldTrackUnpublishedEvent(this))try{this.ndk.cacheAdapter.addUnpublishedEvent(this,t.relayUrls)}catch(h){console.error("Error adding unpublished event to cache",h)}this.kind===5&&((f=this.ndk.cacheAdapter)!=null&&f.deleteEventIds)&&this.ndk.cacheAdapter.deleteEventIds(this.getMatchingTags("e").map(h=>h[1])),this.ndk.subManager.dispatchEvent(o,void 0,!0);const a=await t.publish(this,r,s);return a.forEach(h=>{var u;return(u=this.ndk)==null?void 0:u.subManager.seenEvent(this.id,h)}),a}async generateTags(){var o,a,c;let t=[];const r=await generateContentTags(this.content,this.tags),s=r.content;if(t=r.tags,this.kind&&this.isParamReplaceable()&&!this.getMatchingTags("d")[0]){const f=this.tagValue("title");let u=[...Array(f?6:16)].map(()=>Math.random().toString(36)[2]).join("");f&&f.length>0&&(u=`${f.replace(/[^a-z0-9]+/gi,"-").replace(/^-|-$/g,"")}-${u}`),t.push(["d",u])}if(this.shouldAddClientTag){const l=["client",((o=this.ndk)==null?void 0:o.clientName)??""];(a=this.ndk)!=null&&a.clientNip89&&l.push((c=this.ndk)==null?void 0:c.clientNip89),t.push(l)}else this.shouldStripClientTag&&(t=t.filter(l=>l[0]!=="client"));return{content:s||"",tags:t}}get shouldAddClientTag(){var t,r;return!(!((t=this.ndk)!=null&&t.clientName)&&!((r=this.ndk)!=null&&r.clientNip89)||skipClientTagOnKinds.has(this.kind)||this.isEphemeral()||this.isReplaceable()&&!this.isParamReplaceable()||this.isDvm()||this.hasTag("client"))}get shouldStripClientTag(){return skipClientTagOnKinds.has(this.kind)}muted(){var o,a;const t=(o=this.ndk)==null?void 0:o.mutedIds.get(this.pubkey);if(t&&t==="p")return"author";const r=this.tagReference(),s=(a=this.ndk)==null?void 0:a.mutedIds.get(r[1]);return s&&s===r[0]?"event":null}replaceableDTag(){if(this.kind&&this.kind>=3e4&&this.kind<=4e4){const t=this.getMatchingTags("d")[0];return t?t[1]:""}throw new Error("Event is not a parameterized replaceable event")}deduplicationKey(){return this.kind===0||this.kind===3||this.kind&&this.kind>=1e4&&this.kind<2e4?`${this.kind}:${this.pubkey}`:this.tagId()}tagId(){return this.isParamReplaceable()?this.tagAddress():this.id}tagAddress(){if(this.isParamReplaceable()){const t=this.dTag??"";return`${this.kind}:${this.pubkey}:${t}`}if(this.isReplaceable())return`${this.kind}:${this.pubkey}:`;throw new Error("Event is not a replaceable event")}tagType(){return this.isParamReplaceable()?"a":"e"}tagReference(t){let r;return this.isParamReplaceable()?r=["a",this.tagAddress()]:r=["e",this.tagId()],this.relay?r.push(this.relay.url):r.push(""),r.push(t??""),this.isParamReplaceable()||r.push(this.pubkey),r}referenceTags(t,r,s){let o=[];return this.isParamReplaceable()?o=[[s??"a",this.tagAddress()],[s??"e",this.id]]:o=[[s??"e",this.id]],o=o.map(a=>{var c,l,f;return a[0]==="e"||t?a.push(((c=this.relay)==null?void 0:c.url)??""):(l=this.relay)!=null&&l.url&&a.push((f=this.relay)==null?void 0:f.url),a}),o.forEach(a=>{a[0]==="e"?(a.push(t??""),a.push(this.pubkey)):t&&a.push(t)}),o=[...o,...this.getMatchingTags("h")],r||o.push(...this.author.referenceTags()),o}filter(){return this.isParamReplaceable()?{"#a":[this.tagId()]}:{"#e":[this.tagId()]}}nip22Filter(){return this.isParamReplaceable()?{"#A":[this.tagId()]}:{"#E":[this.tagId()]}}async delete(t,r=!0){var o;if(!this.ndk)throw new Error("No NDK instance found");this.ndk.assertSigner();const s=new ie(this.ndk,{kind:5,content:t||""});return s.tag(this,void 0,!0),s.tags.push(["k",(o=this.kind)==null?void 0:o.toString()]),r&&(this.emit("deleted"),await s.publish()),s}set isProtected(t){this.removeTag("-"),t&&this.tags.push(["-"])}get isProtected(){return this.hasTag("-")}async react(t,r=!0){if(!this.ndk)throw new Error("No NDK instance found");this.ndk.assertSigner();const s=new ie(this.ndk,{kind:7,content:t});return s.tag(this),this.kind!==1&&s.tags.push(["k",`${this.kind}`]),r&&await s.publish(),s}get isValid(){return this.validate()}get inspect(){return JSON.stringify(this.rawEvent(),null,4)}dump(){console.debug(JSON.stringify(this.rawEvent(),null,4)),console.debug("Event on relays:",this.onRelays.map(t=>t.url).join(", "))}reply(t){var s,o;const r=new ie(this.ndk);if(this.kind===1&&!t)r.kind=1,this.hasTag("e")?r.tags=[...r.tags,...this.getMatchingTags("e"),...this.getMatchingTags("p"),...this.getMatchingTags("a"),...this.referenceTags("reply")]:r.tag(this,"root");else{r.kind=1111;const a=["A","E","I","P"],c=this.tags.filter(l=>a.includes(l[0]));if(c.length>0){const l=this.tagValue("K");r.tags.push(...c),l&&r.tags.push(["K",l]);const[f,h,u,...p]=this.tagReference(),y=[f,h,...p];r.tags.push(y)}else{const[l,f,h,u]=this.tagReference(),p=[l,f,u??""];l==="e"&&p.push(this.pubkey),r.tags.push(p);const y=[...p];y[0]=y[0].toUpperCase(),r.tags.push(y),r.tags.push(["K",(s=this.kind)==null?void 0:s.toString()]),r.tags.push(["P",this.pubkey])}r.tags.push(["k",(o=this.kind)==null?void 0:o.toString()]),r.tags.push(...this.getMatchingTags("p")),r.tags.push(["p",this.pubkey])}return r}},untrackedUnpublishedEvents=new Set([24133,13194,23194,23195]);function shouldTrackUnpublishedEvent(n){return!untrackedUnpublishedEvents.has(n.kind)}function isSignedEvent(n){return!!(n.sig&&n.id&&n.created_at&&n.created_at>0)}function isUnsignedEvent(n){return!isSignedEvent(n)}function assertSignedEvent(n){if(!isSignedEvent(n))throw new Error("Expected signed event but event is not signed")}function createSignedEvent(n){if(!isSignedEvent(n))throw new Error("Cannot create signed event from unsigned event");return Object.defineProperty(n,"signed",{value:!0,writable:!1,enumerable:!1}),n}var NDKPool=class extends lib$1.EventEmitter{constructor(e,t,r,{debug:s,name:o}={}){super();g(this,"_relays",new Map);g(this,"status","idle");g(this,"autoConnectRelays",new Set);g(this,"poolBlacklistRelayUrls",new Set);g(this,"debug");g(this,"temporaryRelayTimers",new Map);g(this,"flappingRelays",new Set);g(this,"backoffTimes",new Map);g(this,"ndk");g(this,"_name","unnamed");this.debug=s??r.debug.extend("pool"),o&&(this._name=o),this.ndk=r,this.relayUrls=e,this.poolBlacklistRelayUrls=new Set(t),this.ndk.pools.push(this)}get blacklistRelayUrls(){const e=new Set(this.ndk.blacklistRelayUrls);return this.poolBlacklistRelayUrls.forEach(t=>e.add(t)),e}get relays(){return this._relays}set relayUrls(e){this._relays.clear();for(const t of e){const r=new NDKRelay(t,void 0,this.ndk);r.connectivity.netDebug=this.ndk.netDebug,this.addRelay(r)}}get name(){return this._name}set name(e){this._name=e,this.debug=this.debug.extend(e)}useTemporaryRelay(e,t=3e4,r){const s=this.relays.has(e.url);s||(this.addRelay(e),this.debug("Adding temporary relay %s for filters %o",e.url,r));const o=this.temporaryRelayTimers.get(e.url);if(o&&clearTimeout(o),!s||o){const a=setTimeout(()=>{var c;(c=this.ndk.explicitRelayUrls)!=null&&c.includes(e.url)||this.removeRelay(e.url)},t);this.temporaryRelayTimers.set(e.url,a)}}addRelay(e,t=!0){var m,k;const r=this.relays.has(e.url),s=(m=this.blacklistRelayUrls)==null?void 0:m.has(e.url),o=e.url.includes("/npub1");let a=!0;const c=e.url;if(r)return;if(s){this.debug(`Refusing to add relay ${c}: blacklisted`);return}if(o){this.debug(`Refusing to add relay ${c}: is a filter relay`);return}if((k=this.ndk.cacheAdapter)!=null&&k.getRelayStatus){const R=this.ndk.cacheAdapter.getRelayStatus(c);if(R!=null&&R.dontConnectBefore){if(R.dontConnectBefore>Date.now()){const B=R.dontConnectBefore-Date.now();this.debug(`Refusing to add relay ${c}: delayed connect for ${B}ms`),setTimeout(()=>{this.addRelay(e,t)},B);return}a=!1}}const l=R=>this.emit("notice",e,R),f=()=>this.handleRelayConnect(c),h=()=>this.handleRelayReady(e),u=()=>this.emit("relay:disconnect",e),p=()=>this.handleFlapping(e),y=R=>this.emit("relay:auth",e,R),b=()=>this.emit("relay:authed",e);e.off("notice",l),e.off("connect",f),e.off("ready",h),e.off("disconnect",u),e.off("flapping",p),e.off("auth",y),e.off("authed",b),e.on("notice",l),e.on("connect",f),e.on("ready",h),e.on("disconnect",u),e.on("flapping",p),e.on("auth",y),e.on("authed",b),e.on("delayed-connect",R=>{var B;(B=this.ndk.cacheAdapter)!=null&&B.updateRelayStatus&&this.ndk.cacheAdapter.updateRelayStatus(e.url,{dontConnectBefore:Date.now()+R})}),this._relays.set(c,e),t&&this.autoConnectRelays.add(c),t&&this.status==="active"&&(this.emit("relay:connecting",e),e.connect(void 0,a).catch(R=>{this.debug(`Failed to connect to relay ${c}`,R)}))}removeRelay(e){const t=this.relays.get(e);if(t)return t.disconnect(),this.relays.delete(e),this.autoConnectRelays.delete(e),this.emit("relay:disconnect",t),!0;const r=this.temporaryRelayTimers.get(e);return r&&(clearTimeout(r),this.temporaryRelayTimers.delete(e)),!1}isRelayConnected(e){const t=normalizeRelayUrl(e),r=this.relays.get(t);return r?r.status===5:!1}getRelay(e,t=!0,r=!1,s){let o=this.relays.get(normalizeRelayUrl(e));return o||(o=new NDKRelay(e,void 0,this.ndk),o.connectivity.netDebug=this.ndk.netDebug,r?this.useTemporaryRelay(o,3e4,s):this.addRelay(o,t)),o}handleRelayConnect(e){const t=this.relays.get(e);if(!t){console.error("NDK BUG: relay not found in pool",{relayUrl:e});return}this.emit("relay:connect",t),this.stats().connected===this.relays.size&&this.emit("connect")}handleRelayReady(e){this.emit("relay:ready",e)}async connect(e){this.status="active",this.debug(`Connecting to ${this.relays.size} relays${e?`, timeout ${e}ms`:""}...`);const t=Array.from(this.autoConnectRelays.keys()).map(a=>this.relays.get(a)).filter(a=>!!a);for(const a of t)a.status!==5&&a.status!==4&&(this.emit("relay:connecting",a),a.connect().catch(c=>{this.debug(`Failed to connect to relay ${a.url}: ${c??"No reason specified"}`)}));const r=()=>t.every(a=>a.status===5),s=new Promise(a=>{if(r()){a();return}const c=[];for(const l of t){const f=()=>{if(r()){for(let h=0;hsetTimeout(a,e)):new Promise(()=>{});await Promise.race([s,o])}checkOnFlappingRelays(){const e=this.flappingRelays.size,t=this.relays.size;if(e/t>=.8)for(const r of this.flappingRelays)this.backoffTimes.set(r,0)}handleFlapping(e){this.debug(`Relay ${e.url} is flapping`);let t=this.backoffTimes.get(e.url)||5e3;t=t*2,this.backoffTimes.set(e.url,t),this.debug(`Backoff time for ${e.url} is ${t}ms`),setTimeout(()=>{this.debug(`Attempting to reconnect to ${e.url}`),this.emit("relay:connecting",e),e.connect(),this.checkOnFlappingRelays()},t),e.disconnect(),this.emit("flapping",e)}size(){return this.relays.size}stats(){const e={total:0,connected:0,disconnected:0,connecting:0};for(const t of this.relays.values())e.total++,t.status===5?e.connected++:t.status===1?e.disconnected++:t.status===4&&e.connecting++;return e}connectedRelays(){return Array.from(this.relays.values()).filter(e=>e.status>=5)}permanentAndConnectedRelays(){return Array.from(this.relays.values()).filter(e=>e.status>=5&&!this.temporaryRelayTimers.has(e.url))}urls(){return Array.from(this.relays.keys())}},oe,NDKCashuMintList=(oe=class extends NDKEvent{constructor(t,r){super(t,r);g(this,"_p2pk");this.kind??(this.kind=10019)}static from(t){return new oe(t.ndk,t)}set relays(t){this.tags=this.tags.filter(r=>r[0]!=="relay");for(const r of t)this.tags.push(["relay",r])}get relays(){const t=[];for(const r of this.tags)r[0]==="relay"&&t.push(r[1]);return t}set mints(t){this.tags=this.tags.filter(r=>r[0]!=="mint");for(const r of t)this.tags.push(["mint",r])}get mints(){const t=[];for(const r of this.tags)r[0]==="mint"&&t.push(r[1]);return Array.from(new Set(t))}get p2pk(){return this._p2pk?this._p2pk:(this._p2pk=this.tagValue("pubkey")??this.pubkey,this._p2pk)}set p2pk(t){this._p2pk=t,this.removeTag("pubkey"),t&&this.tags.push(["pubkey",t])}get relaySet(){return NDKRelaySet.fromRelayUrls(this.relays,this.ndk)}},g(oe,"kind",10019),g(oe,"kinds",[10019]),oe),ae,NDKArticle=(ae=class extends NDKEvent{constructor(e,t){super(e,t),this.kind??(this.kind=30023)}static from(e){return new ae(e.ndk,e)}get title(){return this.tagValue("title")}set title(e){this.removeTag("title"),e&&this.tags.push(["title",e])}get image(){return this.tagValue("image")}set image(e){this.removeTag("image"),e&&this.tags.push(["image",e])}get summary(){return this.tagValue("summary")}set summary(e){this.removeTag("summary"),e&&this.tags.push(["summary",e])}get published_at(){const e=this.tagValue("published_at");if(e){let t=Number.parseInt(e);return t>1e12&&(t=Math.floor(t/1e3)),t}}set published_at(e){this.removeTag("published_at"),e!==void 0&&this.tags.push(["published_at",e.toString()])}async generateTags(){return super.generateTags(),this.published_at||(this.published_at=this.created_at),super.generateTags()}get url(){return this.tagValue("url")}set url(e){e?this.tags.push(["url",e]):this.removeTag("url")}},g(ae,"kind",30023),g(ae,"kinds",[30023]),ae);function proofsTotalBalance(n){return n.reduce((e,t)=>{if(t.amount<0)throw new Error("proof amount is negative");return e+t.amount},0)}var ce,NDKCashuToken=(ce=class extends NDKEvent{constructor(t,r){super(t,r);g(this,"_proofs",[]);g(this,"_mint");g(this,"_deletes",[]);g(this,"original");this.kind??(this.kind=7375)}static async from(t){const r=new ce(t.ndk,t);r.original=t;try{await r.decrypt()}catch{r.content=r.original.content}try{const s=JSON.parse(r.content);if(r.proofs=s.proofs,r.mint=s.mint??r.tagValue("mint"),r.deletedTokens=s.del??[],!Array.isArray(r.proofs))return}catch{return}return r}get proofs(){return this._proofs}set proofs(t){const r=new Set;this._proofs=t.filter(s=>r.has(s.C)?(console.warn("Passed in proofs had duplicates, ignoring",s.C),!1):s.amount<0?(console.warn("Invalid proof with negative amount",s),!1):(r.add(s.C),!0)).map(this.cleanProof)}cleanProof(t){return{id:t.id,amount:t.amount,C:t.C,secret:t.secret}}async toNostrEvent(t){if(!this.ndk)throw new Error("no ndk");if(!this.ndk.signer)throw new Error("no signer");const r={proofs:this.proofs.map(this.cleanProof),mint:this.mint,del:this.deletedTokens??[]};this.content=JSON.stringify(r);const s=await this.ndk.signer.user();return await this.encrypt(s,void 0,"nip44"),super.toNostrEvent(t)}set mint(t){this._mint=t}get mint(){return this._mint}get deletedTokens(){return this._deletes}set deletedTokens(t){this._deletes=t}get amount(){return proofsTotalBalance(this.proofs)}async publish(t,r,s){return this.original?this.original.publish(t,r,s):super.publish(t,r,s)}},g(ce,"kind",7375),g(ce,"kinds",[7375]),ce),le,NDKHighlight=(le=class extends NDKEvent{constructor(t,r){super(t,r);g(this,"_article");this.kind??(this.kind=9802)}static from(t){return new le(t.ndk,t)}get url(){return this.tagValue("r")}set context(t){t===void 0?this.tags=this.tags.filter(([r,s])=>r!=="context"):(this.tags=this.tags.filter(([r,s])=>r!=="context"),this.tags.push(["context",t]))}get context(){var t;return((t=this.tags.find(([r,s])=>r==="context"))==null?void 0:t[1])??void 0}get article(){return this._article}set article(t){this._article=t,typeof t=="string"?this.tags.push(["r",t]):this.tag(t)}getArticleTag(){return this.getMatchingTags("a")[0]||this.getMatchingTags("e")[0]||this.getMatchingTags("r")[0]}async getArticle(){var s;if(this._article!==void 0)return this._article;let t;const r=this.getArticleTag();if(r){switch(r[0]){case"a":{const[o,a,c]=r[1].split(":");t=nip19_exports.naddrEncode({kind:Number.parseInt(o),pubkey:a,identifier:c});break}case"e":t=nip19_exports.noteEncode(r[1]);break;case"r":this._article=r[1];break}if(t){let o=await((s=this.ndk)==null?void 0:s.fetchEvent(t));o&&(o.kind===30023&&(o=NDKArticle.from(o)),this._article=o)}return this._article}}},g(le,"kind",9802),g(le,"kinds",[9802]),le);function mapImetaTag(n){const e={};if(n.length===2){const r=n[1].split(" ");for(let s=0;s0}get imetas(){return this._imetas?this._imetas:(this._imetas=this.tags.filter(t=>t[0]==="imeta").map(mapImetaTag).filter(t=>!!t.url),this._imetas)}set imetas(t){this._imetas=t,this.tags=this.tags.filter(r=>r[0]!=="imeta"),this.tags.push(...t.map(imetaTagToTag))}},g(ue,"kind",20),g(ue,"kinds",[20]),ue),Re,NDKList=(Re=class extends NDKEvent{constructor(t,r){super(t,r);g(this,"_encryptedTags");g(this,"encryptedTagsLength");this.kind??(this.kind=30001)}static from(t){return new Re(t.ndk,t)}get title(){const t=this.tagValue("title")||this.tagValue("name");return t||(this.kind===3?"Contacts":this.kind===1e4?"Mute":this.kind===10001?"Pinned Notes":this.kind===10002?"Relay Metadata":this.kind===10003?"Bookmarks":this.kind===10004?"Communities":this.kind===10005?"Public Chats":this.kind===10006?"Blocked Relays":this.kind===10007?"Search Relays":this.kind===10050?"Direct Message Receive Relays":this.kind===10015?"Interests":this.kind===10030?"Emojis":this.tagValue("d"))}set title(t){this.removeTag(["title","name"]),t&&this.tags.push(["title",t])}get name(){return this.title}set name(t){this.title=t}get description(){return this.tagValue("description")}set description(t){this.removeTag("description"),t&&this.tags.push(["description",t])}get image(){return this.tagValue("image")}set image(t){this.removeTag("image"),t&&this.tags.push(["image",t])}isEncryptedTagsCacheValid(){return!!(this._encryptedTags&&this.encryptedTagsLength===this.content.length)}async encryptedTags(t=!0){if(t&&this.isEncryptedTagsCacheValid())return this._encryptedTags;if(!this.ndk)throw new Error("NDK instance not set");if(!this.ndk.signer)throw new Error("NDK signer not set");const r=await this.ndk.signer.user();try{if(this.content.length>0)try{const s=await this.ndk.signer.decrypt(r,this.content),o=JSON.parse(s);return o!=null&&o[0]?(this.encryptedTagsLength=this.content.length,this._encryptedTags=o):(this.encryptedTagsLength=this.content.length,this._encryptedTags=[])}catch{}}catch{}return[]}validateTag(t){return!0}getItems(t){return this.tags.filter(r=>r[0]===t)}get items(){return this.tags.filter(t=>!["d","L","l","title","name","description","published_at","summary","image","thumb","alt","expiration","subject","client"].includes(t[0]))}async addItem(t,r=void 0,s=!1,o="bottom"){if(!this.ndk)throw new Error("NDK instance not set");if(!this.ndk.signer)throw new Error("NDK signer not set");let a;if(t instanceof NDKEvent)a=[t.tagReference(r)];else if(t instanceof NDKUser)a=t.referenceTags();else if(t instanceof NDKRelay)a=t.referenceTags();else if(Array.isArray(t))a=[t];else throw new Error("Invalid object type");if(r&&a[0].push(r),s){const c=await this.ndk.signer.user(),l=await this.encryptedTags();o==="top"?l.unshift(...a):l.push(...a),this._encryptedTags=l,this.encryptedTagsLength=this.content.length,this.content=JSON.stringify(l),await this.encrypt(c)}else o==="top"?this.tags.unshift(...a):this.tags.push(...a);this.created_at=Math.floor(Date.now()/1e3),this.emit("change")}async removeItemByValue(t,r=!0){if(!this.ndk)throw new Error("NDK instance not set");if(!this.ndk.signer)throw new Error("NDK signer not set");const s=this.tags.findIndex(l=>l[1]===t);s>=0&&this.tags.splice(s,1);const o=await this.ndk.signer.user(),a=await this.encryptedTags(),c=a.findIndex(l=>l[1]===t);if(c>=0&&(a.splice(c,1),this._encryptedTags=a,this.encryptedTagsLength=this.content.length,this.content=JSON.stringify(a),await this.encrypt(o)),r)return this.publishReplaceable();this.created_at=Math.floor(Date.now()/1e3),this.emit("change")}async removeItem(t,r){if(!this.ndk)throw new Error("NDK instance not set");if(!this.ndk.signer)throw new Error("NDK signer not set");if(r){const s=await this.ndk.signer.user(),o=await this.encryptedTags();o.splice(t,1),this._encryptedTags=o,this.encryptedTagsLength=this.content.length,this.content=JSON.stringify(o),await this.encrypt(s)}else this.tags.splice(t,1);return this.created_at=Math.floor(Date.now()/1e3),this.emit("change"),this}has(t){return this.items.some(r=>r[1]===t)}filterForItems(){const t=new Set,r=new Map,s=[];for(const o of this.items)if(o[0]==="e"&&o[1])t.add(o[1]);else if(o[0]==="a"&&o[1]){const[a,c,l]=o[1].split(":");if(!a||!c)continue;const f=`${a}:${c}`,h=r.get(f)||[];h.push(l||""),r.set(f,h)}if(t.size>0&&s.push({ids:Array.from(t)}),r.size>0)for(const[o,a]of r.entries()){const[c,l]=o.split(":");s.push({kinds:[Number.parseInt(c)],authors:[l],"#d":a})}return s}},g(Re,"kinds",[10063,30001,10004,10050,10030,10015,10001,10002,10007,10006,10003]),Re),lists_default=NDKList,re,NDKNutzap=(re=class extends NDKEvent{constructor(t,r){super(t,r);g(this,"debug");g(this,"_proofs",[]);g(this,"sender",this.author);this.kind??(this.kind=9321),this.debug=(t==null?void 0:t.debug.extend("nutzap"))??createDebug2("ndk:nutzap"),this.alt||(this.alt="This is a nutzap");try{const s=this.getMatchingTags("proof");s.length?this._proofs=s.map(o=>JSON.parse(o[1])):this._proofs=JSON.parse(this.content)}catch{return}}static from(t){const r=new re(t.ndk,t);if(!(!r._proofs||!r._proofs.length))return r}set comment(t){this.content=t??""}get comment(){const t=this.tagValue("comment");return t||this.content}set proofs(t){this._proofs=t,this.tags=this.tags.filter(r=>r[0]!=="proof");for(const r of t)this.tags.push(["proof",JSON.stringify(r)])}get proofs(){return this._proofs}get rawP2pk(){var r;const t=this.proofs[0];try{const s=JSON.parse(t.secret);let o;if(typeof s=="string"?(o=JSON.parse(s),this.debug("stringified payload",t.secret)):typeof s=="object"&&(o=s),Array.isArray(o)&&o[0]==="P2PK"&&o.length>1&&typeof o[1]=="object"&&o[1]!==null||typeof o=="object"&&o!==null&&typeof((r=o[1])==null?void 0:r.data)=="string")return o[1].data}catch(s){this.debug("error parsing p2pk pubkey",s,this.proofs[0])}}get p2pk(){const t=this.rawP2pk;if(t)return t.startsWith("02")?t.slice(2):t}get mint(){return this.tagValue("u")}set mint(t){this.replaceTag(["u",t])}get unit(){let t=this.tagValue("unit")??"sat";return t!=null&&t.startsWith("msat")&&(t="sat"),t}set unit(t){if(this.removeTag("unit"),t!=null&&t.startsWith("msat"))throw new Error("msat is not allowed, use sat denomination instead");t&&this.tag(["unit",t])}get amount(){return this.proofs.reduce((r,s)=>r+s.amount,0)}set target(t){this.tags=this.tags.filter(r=>r[0]!=="p"),t instanceof NDKEvent&&this.tags.push(t.tagReference())}set recipientPubkey(t){this.removeTag("p"),this.tag(["p",t])}get recipientPubkey(){return this.tagValue("p")}get recipient(){const t=this.recipientPubkey;return this.ndk?this.ndk.getUser({pubkey:t}):new NDKUser({pubkey:t})}async toNostrEvent(){this.unit==="msat"&&(this.unit="sat"),this.removeTag("amount"),this.tags.push(["amount",this.amount.toString()]);const t=await super.toNostrEvent();return t.content=this.comment,t}get isValid(){let t=0,r=0,s=0;for(const o of this.tags)o[0]==="e"&&t++,o[0]==="p"&&r++,o[0]==="u"&&s++;return r===1&&s===1&&t<=1&&this.proofs.length>0}},g(re,"kind",9321),g(re,"kinds",[re.kind]),re);function proofP2pk(n){var e;try{const t=JSON.parse(n.secret);let r={};if(typeof t=="string"?r=JSON.parse(t):typeof t=="object"&&(r=t),r[0]==="P2PK"&&((e=r[1])==null?void 0:e.data))return r[1].data}catch(t){console.error("error parsing p2pk pubkey",t,n)}}function proofP2pkNostr(n){const e=proofP2pk(n);if(e)return e.startsWith("02")&&e.length===66?e.slice(2):e}function cashuPubkeyToNostrPubkey(n){if(n.startsWith("02")&&n.length===66)return n.slice(2)}var he,NDKSimpleGroupMemberList=(he=class extends NDKEvent{constructor(t,r){super(t,r);g(this,"relaySet");g(this,"memberSet",new Set);this.kind??(this.kind=39002),this.memberSet=new Set(this.members)}static from(t){return new he(t.ndk,t)}get members(){return this.getMatchingTags("p").map(t=>t[1])}hasMember(t){return this.memberSet.has(t)}async publish(t,r,s){return t??(t=this.relaySet),super.publishReplaceable(t,r,s)}},g(he,"kind",39002),g(he,"kinds",[39002]),he),de,NDKSimpleGroupMetadata=(de=class extends NDKEvent{constructor(e,t){super(e,t),this.kind??(this.kind=39e3)}static from(e){return new de(e.ndk,e)}get name(){return this.tagValue("name")}get picture(){return this.tagValue("picture")}get about(){return this.tagValue("about")}get scope(){if(this.getMatchingTags("public").length>0)return"public";if(this.getMatchingTags("public").length>0)return"private"}set scope(e){this.removeTag("public"),this.removeTag("private"),e==="public"?this.tags.push(["public",""]):e==="private"&&this.tags.push(["private",""])}get access(){if(this.getMatchingTags("open").length>0)return"open";if(this.getMatchingTags("closed").length>0)return"closed"}set access(e){this.removeTag("open"),this.removeTag("closed"),e==="open"?this.tags.push(["open",""]):e==="closed"&&this.tags.push(["closed",""])}},g(de,"kind",39e3),g(de,"kinds",[39e3]),de),NDKStoryStickerType=(n=>(n.Pubkey="pubkey",n.Event="event",n.Prompt="prompt",n.Text="text",n.Countdown="countdown",n))(NDKStoryStickerType||{});function strToPosition(n){const[e,t]=n.split(",").map(Number);return{x:e,y:t}}function strToDimension(n){const[e,t]=n.split("x").map(Number);return{width:e,height:t}}var X,NDKStorySticker=(X=class{constructor(e){g(this,"type");g(this,"value");g(this,"position");g(this,"dimension");g(this,"properties");g(this,"hasValidDimensions",()=>typeof this.dimension.width=="number"&&typeof this.dimension.height=="number"&&!Number.isNaN(this.dimension.width)&&!Number.isNaN(this.dimension.height));g(this,"hasValidPosition",()=>typeof this.position.x=="number"&&typeof this.position.y=="number"&&!Number.isNaN(this.position.x)&&!Number.isNaN(this.position.y));if(Array.isArray(e)){const t=e;if(t[0]!=="sticker"||t.length<5)throw new Error("Invalid sticker tag");this.type=t[1],this.value=t[2],this.position=strToPosition(t[3]),this.dimension=strToDimension(t[4]);const r={};for(let s=5;s0&&(this.properties=r)}else this.type=e,this.value=void 0,this.position={x:0,y:0},this.dimension={width:0,height:0}}static fromTag(e){try{return new X(e)}catch{return null}}get style(){var e;return(e=this.properties)==null?void 0:e.style}set style(e){var t;e?this.properties={...this.properties,style:e}:(t=this.properties)==null||delete t.style}get rotation(){var e;return(e=this.properties)!=null&&e.rot?Number.parseFloat(this.properties.rot):void 0}set rotation(e){var t;e!==void 0?this.properties={...this.properties,rot:e.toString()}:(t=this.properties)==null||delete t.rot}get isValid(){return this.hasValidDimensions()&&this.hasValidPosition()}toTag(){if(!this.isValid){const r=[this.hasValidDimensions()?void 0:"dimensions is invalid",this.hasValidPosition()?void 0:"position is invalid"].filter(Boolean);throw new Error(`Invalid sticker: ${r.join(", ")}`)}let e;switch(this.type){case"event":e=this.value.tagId();break;case"pubkey":e=this.value.pubkey;break;default:e=this.value}const t=["sticker",this.type,e,coordinates(this.position),dimension(this.dimension)];if(this.properties)for(const[r,s]of Object.entries(this.properties))t.push(`${r} ${s}`);return t}},g(X,"Text","text"),g(X,"Pubkey","pubkey"),g(X,"Event","event"),g(X,"Prompt","prompt"),g(X,"Countdown","countdown"),X),pe,NDKStory=(pe=class extends NDKEvent{constructor(t,r){super(t,r);g(this,"_imeta");g(this,"_dimensions");if(this.kind??(this.kind=23),r)for(const s of r.tags)switch(s[0]){case"imeta":this._imeta=mapImetaTag(s);break;case"dim":this.dimensions=strToDimension(s[1]);break}}static from(t){return new pe(t.ndk,t)}get isValid(){return!!this.imeta}get imeta(){return this._imeta}set imeta(t){this._imeta=t,this.tags=this.tags.filter(r=>r[0]!=="imeta"),t&&this.tags.push(imetaTagToTag(t))}get dimensions(){const t=this.tagValue("dim");if(t)return strToDimension(t)}set dimensions(t){this.removeTag("dim"),t&&this.tags.push(["dim",`${t.width}x${t.height}`])}get duration(){const t=this.tagValue("dur");if(t)return Number.parseInt(t)}set duration(t){this.removeTag("dur"),t!==void 0&&this.tags.push(["dur",t.toString()])}get stickers(){const t=[];for(const r of this.tags){if(r[0]!=="sticker"||r.length<5)continue;const s=NDKStorySticker.fromTag(r);s&&t.push(s)}return t}addSticker(t){let r;if(t instanceof NDKStorySticker)r=t;else{const s=["sticker",t.type,typeof t.value=="string"?t.value:"",coordinates(t.position),dimension(t.dimension)];if(t.properties)for(const[o,a]of Object.entries(t.properties))s.push(`${o} ${a}`);r=new NDKStorySticker(s),r.value=t.value}r.type==="pubkey"?this.tag(r.value):r.type==="event"&&this.tag(r.value),this.tags.push(r.toTag())}removeSticker(t){const r=this.stickers;if(t<0||t>=r.length)return;let s=0;for(let o=0;o`${n.x},${n.y}`,dimension=n=>`${n.width}x${n.height}`,possibleIntervalFrequencies=["daily","weekly","monthly","quarterly","yearly"];function calculateTermDurationInSeconds(n){switch(n){case"daily":return 24*60*60;case"weekly":return 7*24*60*60;case"monthly":return 30*24*60*60;case"quarterly":return 3*30*24*60*60;case"yearly":return 365*24*60*60}}function newAmount(n,e,t){return["amount",n.toString(),e,t]}function parseTagToSubscriptionAmount(n){const e=Number.parseInt(n[1]);if(Number.isNaN(e)||e===void 0||e===null||e<=0)return;const t=n[2];if(t===void 0||t==="")return;const r=n[3];if(r!==void 0&&possibleIntervalFrequencies.includes(r))return{amount:e,currency:t,term:r}}var ye,NDKSubscriptionTier=(ye=class extends NDKArticle{constructor(e,t){const r=(t==null?void 0:t.kind)??37001;super(e,t),this.kind=r}static from(e){return new ye(e.ndk,e)}get perks(){return this.getMatchingTags("perk").map(e=>e[1]).filter(e=>e!==void 0)}addPerk(e){this.tags.push(["perk",e])}get amounts(){return this.getMatchingTags("amount").map(e=>parseTagToSubscriptionAmount(e)).filter(e=>e!==void 0)}addAmount(e,t,r){this.tags.push(newAmount(e,t,r))}set relayUrl(e){this.tags.push(["r",e])}get relayUrls(){return this.getMatchingTags("r").map(e=>e[1]).filter(e=>e!==void 0)}get verifierPubkey(){return this.tagValue("p")}set verifierPubkey(e){this.removeTag("p"),e&&this.tags.push(["p",e])}get isValid(){return this.title!==void 0&&this.amounts.length>0}},g(ye,"kind",37001),g(ye,"kinds",[37001]),ye),me,NDKVideo=(me=class extends NDKEvent{constructor(){super(...arguments);g(this,"_imetas")}static from(t){return new me(t.ndk,t.rawEvent())}get title(){return this.tagValue("title")}set title(t){this.removeTag("title"),t&&this.tags.push(["title",t])}get thumbnail(){var r;let t;return this.imetas&&this.imetas.length>0&&(t=(r=this.imetas[0].image)==null?void 0:r[0]),t??this.tagValue("thumb")}get imetas(){return this._imetas?this._imetas:(this._imetas=this.tags.filter(t=>t[0]==="imeta").map(mapImetaTag),this._imetas)}set imetas(t){this._imetas=t,this.tags=this.tags.filter(r=>r[0]!=="imeta"),this.tags.push(...t.map(imetaTagToTag))}get url(){return this.imetas&&this.imetas.length>0?this.imetas[0].url:this.tagValue("url")}get published_at(){const t=this.tagValue("published_at");if(t)return Number.parseInt(t)}async generateTags(){var t,r;if(super.generateTags(),!this.kind&&(r=(t=this.imetas)==null?void 0:t[0])!=null&&r.dim){const[s,o]=this.imetas[0].dim.split("x"),a=s&&o&&Number.parseInt(s){if(t[0]==="a"||t[0]==="e"&&t[3]!=="source")return!0}),this.tag(e)}get sourceId(){return this.tagValue("e","source")}set source(e){this.removeTag("e","source"),this.tag(e,"source",!1,"e")}},g(we,"kind",818),g(we,"kinds",[818]),we),$e,NDKBlossomList=($e=class extends NDKEvent{constructor(e,t){super(e,t),this.kind??(this.kind=10063)}static from(e){return new $e(e.ndk,e.rawEvent())}get servers(){return this.tags.filter(e=>e[0]==="server").map(e=>e[1])}set servers(e){this.tags=this.tags.filter(t=>t[0]!=="server");for(const t of e)this.tags.push(["server",t])}get default(){const e=this.servers;return e.length>0?e[0]:void 0}set default(e){if(!e)return;const r=this.servers.filter(s=>s!==e);this.servers=[e,...r]}addServer(e){if(!e)return;const t=this.servers;t.includes(e)||(this.servers=[...t,e])}removeServer(e){if(!e)return;const t=this.servers;this.servers=t.filter(r=>r!==e)}},g($e,"kinds",[10063]),$e),Ee,NDKFollowPack=(Ee=class extends NDKEvent{constructor(e,t){super(e,t),this.kind??(this.kind=39089)}static from(e){return new Ee(e.ndk,e)}get title(){return this.tagValue("title")}set title(e){this.removeTag("title"),e&&this.tags.push(["title",e])}get image(){const e=this.tags.find(t=>t[0]==="imeta");if(e){const t=mapImetaTag(e);if(t.url)return t.url}return this.tagValue("image")}set image(e){this.tags=this.tags.filter(t=>t[0]!=="imeta"&&t[0]!=="image"),typeof e=="string"?e!==void 0&&this.tags.push(["image",e]):e&&typeof e=="object"&&(this.tags.push(imetaTagToTag(e)),e.url&&this.tags.push(["image",e.url]))}get pubkeys(){return Array.from(new Set(this.tags.filter(e=>e[0]==="p").map(e=>e[1])))}set pubkeys(e){this.tags=this.tags.filter(t=>t[0]!=="p");for(const t of e)this.tags.push(["p",t])}get description(){return this.tagValue("description")}set description(e){this.removeTag("description"),e&&this.tags.push(["description",e])}},g(Ee,"kind",39089),g(Ee,"kinds",[39089,39092]),Ee),signerRegistry=new Map;function registerSigner(n,e){signerRegistry.set(n,e)}var NDKPrivateKeySigner=class Ce{constructor(e,t){g(this,"_user");g(this,"_privateKey");g(this,"_pubkey");if(typeof e=="string")if(e.startsWith("nsec1")){const{type:r,data:s}=nip19_exports.decode(e);if(r==="nsec")this._privateKey=s;else throw new Error("Invalid private key provided.")}else if(e.length===64)this._privateKey=hexToBytes(e);else throw new Error("Invalid private key provided.");else this._privateKey=e;this._pubkey=getPublicKey(this._privateKey),t&&(this._user=t.getUser({pubkey:this._pubkey})),this._user??(this._user=new NDKUser({pubkey:this._pubkey}))}get privateKey(){if(!this._privateKey)throw new Error("Not ready");return bytesToHex(this._privateKey)}get pubkey(){if(!this._pubkey)throw new Error("Not ready");return this._pubkey}get nsec(){if(!this._privateKey)throw new Error("Not ready");return nip19_exports.nsecEncode(this._privateKey)}get npub(){if(!this._pubkey)throw new Error("Not ready");return nip19_exports.npubEncode(this._pubkey)}static generate(){const e=generateSecretKey();return new Ce(e)}async blockUntilReady(){return this._user}async user(){return this._user}get userSync(){return this._user}async sign(e){if(!this._privateKey)throw Error("Attempted to sign without a private key");return finalizeEvent(e,this._privateKey).sig}async encryptionEnabled(e){const t=[];return(!e||e==="nip04")&&t.push("nip04"),(!e||e==="nip44")&&t.push("nip44"),t}async encrypt(e,t,r){if(!this._privateKey||!this.privateKey)throw Error("Attempted to encrypt without a private key");const s=e.pubkey;if(r==="nip44"){const o=nip44_exports.v2.utils.getConversationKey(this._privateKey,s);return await nip44_exports.v2.encrypt(t,o)}return await nip04_exports.encrypt(this._privateKey,s,t)}async decrypt(e,t,r){if(!this._privateKey||!this.privateKey)throw Error("Attempted to decrypt without a private key");const s=e.pubkey;if(r==="nip44"){const o=nip44_exports.v2.utils.getConversationKey(this._privateKey,s);return await nip44_exports.v2.decrypt(t,o)}return await nip04_exports.decrypt(this._privateKey,s,t)}toPayload(){if(!this._privateKey)throw new Error("Private key not available");const e={type:"private-key",payload:this.privateKey};return JSON.stringify(e)}static async fromPayload(e,t){const r=JSON.parse(e);if(r.type!=="private-key")throw new Error(`Invalid payload type: expected 'private-key', got ${r.type}`);if(!r.payload||typeof r.payload!="string")throw new Error("Invalid payload content for private-key signer");return new Ce(r.payload,t)}};registerSigner("private-key",NDKPrivateKeySigner);var se,NDKProject=(se=class extends NDKEvent{constructor(t,r){super(t,r);g(this,"_signer");this.kind=31933}static from(t){return new se(t.ndk,t.rawEvent())}set repo(t){this.removeTag("repo"),t&&this.tags.push(["repo",t])}set hashtags(t){this.removeTag("hashtags"),t.filter(r=>r.length>0).length&&this.tags.push(["hashtags",...t])}get hashtags(){const t=this.tags.find(r=>r[0]==="hashtags");return t?t.slice(1):[]}get repo(){return this.tagValue("repo")}get title(){return this.tagValue("title")}set title(t){this.removeTag("title"),t&&this.tags.push(["title",t])}get picture(){return this.tagValue("picture")}set picture(t){this.removeTag("picture"),t&&this.tags.push(["picture",t])}set description(t){this.content=t}get description(){return this.content}get slug(){return this.dTag??"empty-dtag"}async getSigner(){var r,s;if(this._signer)return this._signer;const t=this.tagValue("key");if(!t)this._signer=NDKPrivateKeySigner.generate(),await this.encryptAndSaveNsec();else{const o=await((s=(r=this.ndk)==null?void 0:r.signer)==null?void 0:s.decrypt(this.ndk.activeUser,t));if(!o)throw new Error("Failed to decrypt project key or missing signer context.");this._signer=new NDKPrivateKeySigner(o)}return this._signer}async getNsec(){return(await this.getSigner()).privateKey}async setNsec(t){this._signer=new NDKPrivateKeySigner(t),await this.encryptAndSaveNsec()}async encryptAndSaveNsec(){var s,o;if(!this._signer)throw new Error("Signer is not set.");const t=this._signer.privateKey,r=await((o=(s=this.ndk)==null?void 0:s.signer)==null?void 0:o.encrypt(this.ndk.activeUser,t));r&&(this.removeTag("key"),this.tags.push(["key",r]))}},g(se,"kind",31933),g(se,"kinds",[se.kind]),se),ve,NDKThread=(ve=class extends NDKEvent{constructor(e,t){super(e,t),this.kind??(this.kind=11)}static from(e){return new ve(e.ndk,e)}get title(){return this.tagValue("title")}set title(e){this.removeTag("title"),e&&this.tags.push(["title",e])}},g(ve,"kind",11),g(ve,"kinds",[11]),ve),ke,NDKDraft=(ke=class extends NDKEvent{constructor(t,r){super(t,r);g(this,"_event");g(this,"counterparty");this.kind??(this.kind=31234)}static from(t){return new ke(t.ndk,t)}set identifier(t){this.removeTag("d"),this.tags.push(["d",t])}get identifier(){return this.dTag}set event(t){t instanceof NDKEvent?this._event=t:this._event=new NDKEvent(void 0,t),this.prepareEvent()}set checkpoint(t){t?(this.tags.push(t.tagReference()),this.kind=1234):(this.removeTag("a"),this.kind=31234)}get isCheckpoint(){return this.kind===1234}get isProposal(){const t=this.tagValue("p");return!!t&&t!==this.pubkey}async getEvent(t){var r;if(this._event)return this._event;if(t??(t=(r=this.ndk)==null?void 0:r.signer),!t)throw new Error("No signer available");if(this.content&&this.content.length>0)try{const s=t.pubkey,a=[this.tagValue("p"),this.pubkey].filter(Boolean).find(f=>f!==s);let c;c=new NDKUser({pubkey:a??s}),await this.decrypt(c,t);const l=JSON.parse(this.content);return this._event=await wrapEvent(new NDKEvent(this.ndk,l)),this._event}catch(s){console.error(s);return}else return null}prepareEvent(){if(!this._event)throw new Error("No event has been provided");this.removeTag("k"),this._event.kind&&this.tags.push(["k",this._event.kind.toString()]),this.content=JSON.stringify(this._event.rawEvent())}async save({signer:t,publish:r,relaySet:s}){var a;if(t??(t=(a=this.ndk)==null?void 0:a.signer),!t)throw new Error("No signer available");const o=this.counterparty||await t.user();if(await this.encrypt(o,t),this.counterparty){const c=this.counterparty.pubkey;this.removeTag("p"),this.tags.push(["p",c])}if(r!==!1)return this.publishReplaceable(s)}},g(ke,"kind",31234),g(ke,"kinds",[31234,1234]),ke),_e,NDKTask=(_e=class extends NDKEvent{constructor(e,t){super(e,t),this.kind=1934}static from(e){return new _e(e.ndk,e.rawEvent())}set title(e){this.removeTag("title"),e&&this.tags.push(["title",e])}get title(){return this.tagValue("title")}set project(e){this.removeTag("a"),this.tags.push(e.tagReference())}get projectSlug(){var t;const e=this.getMatchingTags("a")[0];return e?(t=e[1].split(/:/))==null?void 0:t[2]:void 0}},g(_e,"kind",1934),g(_e,"kinds",[1934]),_e),xe,NDKProjectTemplate=(xe=class extends NDKEvent{constructor(e,t){super(e,t),this.kind=30717}static from(e){return new xe(e.ndk,e.rawEvent())}get templateId(){return this.dTag??""}set templateId(e){this.dTag=e}get name(){return this.tagValue("title")??""}set name(e){this.removeTag("title"),e&&this.tags.push(["title",e])}get description(){return this.tagValue("description")??""}set description(e){this.removeTag("description"),e&&this.tags.push(["description",e])}get repoUrl(){return this.tagValue("uri")??""}set repoUrl(e){this.removeTag("uri"),e&&this.tags.push(["uri",e])}get image(){return this.tagValue("image")}set image(e){this.removeTag("image"),e&&this.tags.push(["image",e])}get command(){return this.tagValue("command")}set command(e){this.removeTag("command"),e&&this.tags.push(["command",e])}get agentConfig(){const e=this.tagValue("agent");if(e)try{return JSON.parse(e)}catch{return}}set agentConfig(e){this.removeTag("agent"),e&&this.tags.push(["agent",JSON.stringify(e)])}get templateTags(){return this.getMatchingTags("t").map(e=>e[1]).filter(Boolean)}set templateTags(e){this.tags=this.tags.filter(t=>t[0]!=="t"),e.forEach(t=>{t&&this.tags.push(["t",t])})}},g(xe,"kind",30717),g(xe,"kinds",[30717]),xe),registeredEventClasses=new Set;function registerEventClass(n){registeredEventClasses.add(n)}function unregisterEventClass(n){registeredEventClasses.delete(n)}function getRegisteredEventClasses(){return new Set(registeredEventClasses)}function wrapEvent(n){const e=new Map,r=[...[NDKImage,NDKVideo,NDKCashuMintList,NDKArticle,NDKHighlight,NDKDraft,NDKWiki,NDKNutzap,NDKProject,NDKTask,NDKProjectTemplate,NDKSimpleGroupMemberList,NDKSimpleGroupMetadata,NDKSubscriptionTier,NDKCashuToken,NDKList,NDKStory,NDKBlossomList,NDKFollowPack,NDKThread],...registeredEventClasses];for(const o of r)for(const a of o.kinds)e.set(a,o);const s=e.get(n.kind);return s?s.from(n):n}var MAX_SUBID_LENGTH=20;function queryFullyFilled(n){return!!(filterIncludesIds(n.filter)&&resultHasAllRequestedIds(n))}function compareFilter(n,e){if(Object.keys(n).length!==Object.keys(e).length)return!1;for(const[t,r]of Object.entries(n)){const s=e[t];if(!s)return!1;if(Array.isArray(r)&&Array.isArray(s)){const o=r;for(const a of s){const c=a;if(!o.includes(c))return!1}}else if(s!==r)return!1}return!0}function filterIncludesIds(n){return!!n.ids}function resultHasAllRequestedIds(n){const e=n.filter.ids;return!!e&&e.length===n.eventFirstSeen.size}function generateSubId(n,e){var c;const t=n.map(l=>l.subId).filter(Boolean),r=[],s=new Set,o=new Set;if(t.length>0)r.push(Array.from(new Set(t)).join(","));else{for(const l of e)for(const f of Object.keys(l))f==="kinds"?(c=l.kinds)==null||c.forEach(h=>o.add(h)):s.add(f);o.size>0&&r.push(`kinds:${Array.from(o).join(",")}`),s.size>0&&r.push(Array.from(s).join(","))}let a=r.join("-");return a.length>MAX_SUBID_LENGTH&&(a=a.substring(0,MAX_SUBID_LENGTH)),a+=`-${Math.floor(Math.random()*999).toString()}`,a}function filterForEventsTaggingId(n){try{const e=nip19_exports.decode(n);switch(e.type){case"naddr":return{"#a":[`${e.data.kind}:${e.data.pubkey}:${e.data.identifier}`]};case"nevent":return{"#e":[e.data.id]};case"note":return{"#e":[e.data]};case"nprofile":return{"#p":[e.data.pubkey]};case"npub":return{"#p":[e.data]}}}catch{}}function filterAndRelaySetFromBech32(n,e){const t=filterFromId(n),r=relaysFromBech32(n,e);return r.length===0?{filter:t}:{filter:t,relaySet:new NDKRelaySet(new Set(r),e)}}function filterFromId(n){let e;if(n.match(NIP33_A_REGEX)){const[t,r,s]=n.split(":"),o={authors:[r],kinds:[Number.parseInt(t)]};return s&&(o["#d"]=[s]),o}if(n.match(BECH32_REGEX))try{switch(e=nip19_exports.decode(n),e.type){case"nevent":{const t={ids:[e.data.id]};return e.data.author&&(t.authors=[e.data.author]),e.data.kind&&(t.kinds=[e.data.kind]),t}case"note":return{ids:[e.data]};case"naddr":{const t={authors:[e.data.pubkey],kinds:[e.data.kind]};return e.data.identifier&&(t["#d"]=[e.data.identifier]),t}}}catch(t){console.error("Error decoding",n,t)}return{ids:[n]}}function isNip33AValue(n){return n.match(NIP33_A_REGEX)!==null}var NIP33_A_REGEX=/^(\d+):([0-9A-Fa-f]+)(?::(.*))?$/,BECH32_REGEX=/^n(event|ote|profile|pub|addr)1[\d\w]+$/;function relaysFromBech32(n,e){try{const t=nip19_exports.decode(n);if(["naddr","nevent"].includes(t==null?void 0:t.type)){const r=t.data;if(r!=null&&r.relays)return r.relays.map(s=>new NDKRelay(s,e.relayAuthDefaultPolicy,e))}}catch{}return[]}var NDKSubscriptionCacheUsage=(n=>(n.ONLY_CACHE="ONLY_CACHE",n.CACHE_FIRST="CACHE_FIRST",n.PARALLEL="PARALLEL",n.ONLY_RELAY="ONLY_RELAY",n))(NDKSubscriptionCacheUsage||{}),defaultOpts={closeOnEose:!1,cacheUsage:"CACHE_FIRST",dontSaveToCache:!1,groupable:!0,groupableDelay:100,groupableDelayType:"at-most",cacheUnconstrainFilter:["limit","since","until"]},NDKSubscription=class extends lib$1.EventEmitter{constructor(e,t,r,s){super();g(this,"subId");g(this,"filters");g(this,"opts");g(this,"pool");g(this,"skipVerification",!1);g(this,"skipValidation",!1);g(this,"relayFilters");g(this,"relaySet");g(this,"ndk");g(this,"debug");g(this,"eventFirstSeen",new Map);g(this,"eosesSeen",new Set);g(this,"lastEventReceivedAt");g(this,"mostRecentCacheEventTimestamp");g(this,"internalId");g(this,"closeOnEose");g(this,"poolMonitor");g(this,"skipOptimisticPublishEvent",!1);g(this,"cacheUnconstrainFilter");g(this,"onStopped");g(this,"eoseTimeout");g(this,"eosed",!1);this.ndk=e,this.opts={...defaultOpts,...r||{}},this.pool=this.opts.pool||e.pool,this.filters=Array.isArray(t)?t:[t],this.subId=s||this.opts.subId,this.internalId=Math.random().toString(36).substring(7),this.debug=e.debug.extend(`subscription[${this.opts.subId??this.internalId}]`),this.opts.relaySet?this.relaySet=this.opts.relaySet:this.opts.relayUrls&&(this.relaySet=NDKRelaySet.fromRelayUrls(this.opts.relayUrls,this.ndk)),this.skipVerification=this.opts.skipVerification||!1,this.skipValidation=this.opts.skipValidation||!1,this.closeOnEose=this.opts.closeOnEose||!1,this.skipOptimisticPublishEvent=this.opts.skipOptimisticPublishEvent||!1,this.cacheUnconstrainFilter=this.opts.cacheUnconstrainFilter}relaysMissingEose(){var t;return this.relayFilters?Array.from((t=this.relayFilters)==null?void 0:t.keys()).filter(r=>!this.eosesSeen.has(this.pool.getRelay(r,!1,!1))):[]}get filter(){return this.filters[0]}get groupableDelay(){var e;if(this.isGroupable())return(e=this.opts)==null?void 0:e.groupableDelay}get groupableDelayType(){var e;return((e=this.opts)==null?void 0:e.groupableDelayType)||"at-most"}isGroupable(){var e;return((e=this.opts)==null?void 0:e.groupable)||!1}shouldQueryCache(){var t;return this.opts.addSinceFromCache?!0:((t=this.opts)==null?void 0:t.cacheUsage)==="ONLY_RELAY"?!1:(this.filters.some(r=>{var s;return(s=r.kinds)==null?void 0:s.some(o=>kindIsEphemeral(o))}),!0)}shouldQueryRelays(){var e;return((e=this.opts)==null?void 0:e.cacheUsage)!=="ONLY_CACHE"}shouldWaitForCache(){var e;return this.opts.addSinceFromCache?!0:!!this.opts.closeOnEose&&!!((e=this.ndk.cacheAdapter)!=null&&e.locking)&&this.opts.cacheUsage!=="PARALLEL"}start(e=!0){let t;const r=o=>{if(e)for(const a of o)a.created_at&&(!this.mostRecentCacheEventTimestamp||a.created_at>this.mostRecentCacheEventTimestamp)&&(this.mostRecentCacheEventTimestamp=a.created_at),this.eventReceived(a,void 0,!0,!1);else{t=[];for(const a of o){a.created_at&&(!this.mostRecentCacheEventTimestamp||a.created_at>this.mostRecentCacheEventTimestamp)&&(this.mostRecentCacheEventTimestamp=a.created_at),a.ndk=this.ndk;const c=this.opts.wrap?wrapEvent(a):a;if(!c)break;if(c instanceof Promise){c.then(l=>{this.emitEvent(!1,l,void 0,!0,!1)});break}this.eventFirstSeen.set(c.id,Date.now()),t.push(c)}}},s=()=>{this.shouldQueryRelays()?(this.startWithRelays(),this.startPoolMonitor()):this.emit("eose",this)};return this.shouldQueryCache()?(t=this.startWithCache(),t instanceof Promise?this.shouldWaitForCache()?(t.then(o=>{if(r(o),queryFullyFilled(this)){this.emit("eose",this);return}s()}),null):(t.then(o=>{r(o)}),s(),null):(r(t),queryFullyFilled(this)?this.emit("eose",this):s(),t)):(s(),null)}startPoolMonitor(){this.debug.extend("pool-monitor"),this.poolMonitor=e=>{var r,s;if((r=this.relayFilters)!=null&&r.has(e.url))return;calculateRelaySetsFromFilters(this.ndk,this.filters,this.pool).get(e.url)&&((s=this.relayFilters)==null||s.set(e.url,this.filters),e.subscribe(this,this.filters))},this.pool.on("relay:connect",this.poolMonitor)}stop(){var e;this.emit("close",this),this.poolMonitor&&this.pool.off("relay:connect",this.poolMonitor),(e=this.onStopped)==null||e.call(this)}hasAuthorsFilter(){return this.filters.some(e=>{var t;return(t=e.authors)==null?void 0:t.length})}startWithCache(){var e;return(e=this.ndk.cacheAdapter)!=null&&e.query?this.ndk.cacheAdapter.query(this):[]}startWithRelays(){let e=this.filters;if(this.opts.addSinceFromCache&&this.mostRecentCacheEventTimestamp){const t=this.mostRecentCacheEventTimestamp+1;e=e.map(r=>({...r,since:Math.max(r.since||0,t)}))}if(!this.relaySet||this.relaySet.relays.size===0)this.relayFilters=calculateRelaySetsFromFilters(this.ndk,e,this.pool);else{this.relayFilters=new Map;for(const t of this.relaySet.relays)this.relayFilters.set(t.url,e)}for(const[t,r]of this.relayFilters)this.pool.getRelay(t,!0,!0,r).subscribe(this,r)}eventReceived(e,t,r=!1,s=!1){var l;const o=e.id,a=this.eventFirstSeen.has(o);let c;if(e instanceof NDKEvent&&(c=e),a){const f=Date.now()-(this.eventFirstSeen.get(o)||0);if(this.emit("event:dup",e,t,f,this,r,s),t){const h=verifiedSignatures.get(o);if(h&&typeof h=="string")if(e.sig===h)t.addValidatedEvent();else{const u=e instanceof NDKEvent?e:new NDKEvent(this.ndk,e);this.ndk.reportInvalidSignature(u,t)}}}else{if(c??(c=new NDKEvent(this.ndk,e)),c.ndk=this.ndk,c.relay=t,!r&&!s){if(!this.skipValidation&&!c.isValid){this.debug("Event failed validation %s from relay %s",o,t==null?void 0:t.url);return}if(t)if(t.shouldValidateEvent()&&!this.skipVerification){if(c.relay=t,!this.ndk.asyncSigVerification){if(!c.verifySignature(!0)){this.debug("Event failed signature validation",e),this.ndk.reportInvalidSignature(c,t);return}t.addValidatedEvent()}}else t.addNonValidatedEvent();this.ndk.cacheAdapter&&!this.opts.dontSaveToCache&&this.ndk.cacheAdapter.setEvent(c,this.filters,t)}(!s||this.skipOptimisticPublishEvent!==!0)&&(this.emitEvent(((l=this.opts)==null?void 0:l.wrap)??!1,c,t,r,s),this.eventFirstSeen.set(o,Date.now()))}this.lastEventReceivedAt=Date.now()}emitEvent(e,t,r,s,o){const a=e?wrapEvent(t):t;a instanceof Promise?a.then(c=>this.emitEvent(!1,c,r,s,o)):a&&this.emit("event",a,r,this,s,o)}closedReceived(e,t){this.emit("closed",e,t)}eoseReceived(e){var a;this.debug("EOSE received from %s",e.url),this.eosesSeen.add(e);let t=this.lastEventReceivedAt?Date.now()-this.lastEventReceivedAt:void 0;const r=this.eosesSeen.size===((a=this.relayFilters)==null?void 0:a.size),s=queryFullyFilled(this),o=c=>{var l;this.debug("Performing EOSE: %s %d",c,this.eosed),!this.eosed&&(this.eoseTimeout&&clearTimeout(this.eoseTimeout),this.emit("eose",this),this.eosed=!0,(l=this.opts)!=null&&l.closeOnEose&&this.stop())};if(s||r)o("query filled or seen all");else if(this.relayFilters){let c=1e3;const l=new Set(this.pool.connectedRelays().map(u=>u.url)),f=Array.from(this.relayFilters.keys()).filter(u=>l.has(u));if(f.length===0){this.debug("No connected relays, waiting for all relays to connect",Array.from(this.relayFilters.keys()).join(", "));return}const h=this.eosesSeen.size/f.length;if(this.debug("Percentage of relays that have sent EOSE",{subId:this.subId,percentageOfRelaysThatHaveSentEose:h,seen:this.eosesSeen.size,total:f.length}),this.eosesSeen.size>=2&&h>=.5){if(c=c*(1-h),c===0){o("time to wait was 0");return}this.eoseTimeout&&clearTimeout(this.eoseTimeout);const u=()=>{t=this.lastEventReceivedAt?Date.now()-this.lastEventReceivedAt:void 0,t!==void 0&&t<20?this.eoseTimeout=setTimeout(u,c):o(`send eose timeout: ${c}`)};this.eoseTimeout=setTimeout(u,c)}}}},kindIsEphemeral=n=>n>=2e4&&n<3e4;async function follows(n,e,t=3){var s,o;if(!this.ndk)throw new Error("NDK not set");const r=await this.ndk.fetchEvent({kinds:[t],authors:[this.pubkey]},n||{groupable:!1});if(r){const a=new Set;return r.tags.forEach(c=>{c[0]==="p"&&a.add(c[1])}),e&&((o=(s=this.ndk)==null?void 0:s.outboxTracker)==null||o.trackUsers(Array.from(a))),[...a].reduce((c,l)=>{const f=new NDKUser({pubkey:l});return f.ndk=this.ndk,c.add(f),c},new Set)}return new Set}var NIP05_REGEX=/^(?:([\w.+-]+)@)?([\w.-]+)$/;async function getNip05For(n,e,t=fetch,r={}){return await n.queuesNip05.add({id:e,func:async()=>{var l,f,h;if((l=n.cacheAdapter)!=null&&l.loadNip05){const u=await n.cacheAdapter.loadNip05(e);if(u!=="missing"){if(u){const p=new NDKUser({pubkey:u.pubkey,relayUrls:u.relays,nip46Urls:u.nip46});return p.ndk=n,p}if(r.cache!=="no-cache")return null}}const s=e.match(NIP05_REGEX);if(!s)return null;const[o,a="_",c]=s;try{const u=await t(`https://${c}/.well-known/nostr.json?name=${a}`,r),{names:p,relays:y,nip46:b}=parseNIP05Result(await u.json()),m=p[a.toLowerCase()];let k=null;return m&&(k={pubkey:m,relays:y==null?void 0:y[m],nip46:b==null?void 0:b[m]}),(f=n==null?void 0:n.cacheAdapter)!=null&&f.saveNip05&&n.cacheAdapter.saveNip05(e,k),k}catch(u){return(h=n==null?void 0:n.cacheAdapter)!=null&&h.saveNip05&&(n==null||n.cacheAdapter.saveNip05(e,null)),console.error("Failed to fetch NIP05 for",e,u),null}}})}function parseNIP05Result(n){const e={names:{}};for(const[t,r]of Object.entries(n.names))typeof t=="string"&&typeof r=="string"&&(e.names[t.toLowerCase()]=r);if(n.relays){e.relays={};for(const[t,r]of Object.entries(n.relays))typeof t=="string"&&Array.isArray(r)&&(e.relays[t]=r.filter(s=>typeof s=="string"))}if(n.nip46){e.nip46={};for(const[t,r]of Object.entries(n.nip46))typeof t=="string"&&Array.isArray(r)&&(e.nip46[t]=r.filter(s=>typeof s=="string"))}return e}function profileFromEvent(n){const e={};let t;try{t=JSON.parse(n.content)}catch(r){throw new Error(`Failed to parse profile event: ${r}`)}e.profileEvent=JSON.stringify(n.rawEvent());for(const r of Object.keys(t))switch(r){case"name":e.name=t.name;break;case"display_name":e.displayName=t.display_name;break;case"image":case"picture":e.picture=t.picture||t.image,e.image=e.picture;break;case"banner":e.banner=t.banner;break;case"bio":e.bio=t.bio;break;case"nip05":e.nip05=t.nip05;break;case"lud06":e.lud06=t.lud06;break;case"lud16":e.lud16=t.lud16;break;case"about":e.about=t.about;break;case"website":e.website=t.website;break;default:e[r]=t[r];break}return e.created_at=n.created_at,e}function serializeProfile(n){const e={};for(const[t,r]of Object.entries(n))switch(t){case"username":case"name":e.name=r;break;case"displayName":e.display_name=r;break;case"image":case"picture":e.picture=r;break;case"bio":case"about":e.about=r;break;default:e[t]=r;break}return JSON.stringify(e)}var NDKUser=class Be{constructor(e){g(this,"ndk");g(this,"profile");g(this,"profileEvent");g(this,"_npub");g(this,"_pubkey");g(this,"relayUrls",[]);g(this,"nip46Urls",[]);g(this,"follows",follows.bind(this));if(e.npub&&(this._npub=e.npub),e.hexpubkey&&(this._pubkey=e.hexpubkey),e.pubkey&&(this._pubkey=e.pubkey),e.relayUrls&&(this.relayUrls=e.relayUrls),e.nip46Urls&&(this.nip46Urls=e.nip46Urls),e.nprofile)try{const t=nip19_exports.decode(e.nprofile);t.type==="nprofile"&&(this._pubkey=t.data.pubkey,t.data.relays&&t.data.relays.length>0&&this.relayUrls.push(...t.data.relays))}catch(t){console.error("Failed to decode nprofile",t)}}get npub(){if(!this._npub){if(!this._pubkey)throw new Error("pubkey not set");this._npub=nip19_exports.npubEncode(this.pubkey)}return this._npub}get nprofile(){var t,r;const e=(r=(t=this.profileEvent)==null?void 0:t.onRelays)==null?void 0:r.map(s=>s.url);return nip19_exports.nprofileEncode({pubkey:this.pubkey,relays:e})}set npub(e){this._npub=e}get pubkey(){if(!this._pubkey){if(!this._npub)throw new Error("npub not set");this._pubkey=nip19_exports.decode(this.npub).data}return this._pubkey}set pubkey(e){this._pubkey=e}filter(){return{"#p":[this.pubkey]}}async getZapInfo(e){if(!this.ndk)throw new Error("No NDK instance found");const t=async a=>{if(!e)return a;let c;const l=new Promise((f,h)=>{c=setTimeout(()=>h(new Error("Timeout")),e)});try{const f=await Promise.race([a,l]);return c&&clearTimeout(c),f}catch(f){if(f instanceof Error&&f.message==="Timeout")try{return await a}catch{return}return}},[r,s]=await Promise.all([t(this.fetchProfile()),t(this.ndk.fetchEvent({kinds:[10019],authors:[this.pubkey]}))]),o=new Map;if(s){const a=NDKCashuMintList.from(s);a.mints.length>0&&o.set("nip61",{mints:a.mints,relays:a.relays,p2pk:a.p2pk})}if(r){const{lud06:a,lud16:c}=r;o.set("nip57",{lud06:a,lud16:c})}return o}static async fromNip05(e,t,r=!1){if(!t)throw new Error("No NDK instance found");const s={};r&&(s.cache="no-cache");const o=await getNip05For(t,e,t==null?void 0:t.httpFetch,s);if(o){const a=new Be({pubkey:o.pubkey,relayUrls:o.relays,nip46Urls:o.nip46});return a.ndk=t,a}}async fetchProfile(e,t=!1){if(!this.ndk)throw new Error("NDK not set");let r=null;if(this.ndk.cacheAdapter&&(this.ndk.cacheAdapter.fetchProfile||this.ndk.cacheAdapter.fetchProfileSync)&&(e==null?void 0:e.cacheUsage)!=="ONLY_RELAY"){let s=null;if(this.ndk.cacheAdapter.fetchProfileSync?s=this.ndk.cacheAdapter.fetchProfileSync(this.pubkey):this.ndk.cacheAdapter.fetchProfile&&(s=await this.ndk.cacheAdapter.fetchProfile(this.pubkey)),s)return this.profile=s,s}return e??(e={}),e.cacheUsage??(e.cacheUsage="ONLY_RELAY"),e.closeOnEose??(e.closeOnEose=!0),e.groupable??(e.groupable=!0),e.groupableDelay??(e.groupableDelay=250),r||(r=await this.ndk.fetchEvent({kinds:[0],authors:[this.pubkey]},e)),r?(this.profile=profileFromEvent(r),t&&this.profile&&this.ndk.cacheAdapter&&this.ndk.cacheAdapter.saveProfile&&this.ndk.cacheAdapter.saveProfile(this.pubkey,this.profile),this.profile):null}async followSet(e,t,r=3){const s=await this.follows(e,t,r);return new Set(Array.from(s).map(o=>o.pubkey))}tagReference(){return["p",this.pubkey]}referenceTags(e){const t=[["p",this.pubkey]];return e&&t[0].push("",e),t}async publish(){if(!this.ndk)throw new Error("No NDK instance found");if(!this.profile)throw new Error("No profile available");this.ndk.assertSigner(),await new NDKEvent(this.ndk,{kind:0,content:serializeProfile(this.profile)}).publish()}async follow(e,t,r=3){if(!this.ndk)throw new Error("No NDK instance found");if(this.ndk.assertSigner(),t||(t=await this.follows(void 0,void 0,r)),t.has(e))return!1;t.add(e);const s=new NDKEvent(this.ndk,{kind:r});for(const o of t)s.tag(o);return await s.publish(),!0}async unfollow(e,t,r=3){if(!this.ndk)throw new Error("No NDK instance found");this.ndk.assertSigner(),t||(t=await this.follows(void 0,void 0,r));const s=new Set;let o=!1;for(const c of t)c.pubkey!==e.pubkey?s.add(c):o=!0;if(!o)return!1;const a=new NDKEvent(this.ndk,{kind:r});for(const c of s)a.tag(c);return await a.publish()}async validateNip05(e){if(!this.ndk)throw new Error("No NDK instance found");const t=await getNip05For(this.ndk,e);return t===null?null:t.pubkey===this.pubkey}};async function pinEvent(n,e,t,r){if(!n.ndk)throw new Error("No NDK instance found");if(n.ndk.assertSigner(),!t){const o=await n.ndk.fetchEvents({kinds:[10001],authors:[n.pubkey]},{cacheUsage:"ONLY_RELAY"});o.size>0?t=lists_default.from(Array.from(o)[0]):t=new NDKEvent(n.ndk,{kind:10001})}return t.tag(e),r&&await t.publish(),t}var NDKClassified=class Pe extends NDKEvent{constructor(e,t){super(e,t),this.kind??(this.kind=30402)}static from(e){return new Pe(e.ndk,e)}get title(){return this.tagValue("title")}set title(e){this.removeTag("title"),e&&this.tags.push(["title",e])}get summary(){return this.tagValue("summary")}set summary(e){this.removeTag("summary"),e&&this.tags.push(["summary",e])}get published_at(){const e=this.tagValue("published_at");if(e)return Number.parseInt(e)}set published_at(e){this.removeTag("published_at"),e!==void 0&&this.tags.push(["published_at",e.toString()])}get location(){return this.tagValue("location")}set location(e){this.removeTag("location"),e&&this.tags.push(["location",e])}get price(){const e=this.tags.find(t=>t[0]==="price");if(e)return{amount:Number.parseFloat(e[1]),currency:e[2],frequency:e[3]}}set price(e){if(typeof e=="string"&&(e={amount:Number.parseFloat(e)}),e!=null&&e.amount){const t=["price",e.amount.toString()];e.currency&&t.push(e.currency),e.frequency&&t.push(e.frequency),this.tags.push(t)}else this.removeTag("price")}async generateTags(){return super.generateTags(),this.published_at||(this.published_at=this.created_at),super.generateTags()}},NDKDvmJobFeedbackStatus=(n=>(n.Processing="processing",n.Success="success",n.Scheduled="scheduled",n.PayReq="payment_required",n))(NDKDvmJobFeedbackStatus||{}),NDKDVMJobFeedback=class Le extends NDKEvent{constructor(e,t){super(e,t),this.kind??(this.kind=7e3)}static async from(e){const t=new Le(e.ndk,e.rawEvent());return t.encrypted&&await t.dvmDecrypt(),t}get status(){return this.tagValue("status")}set status(e){this.removeTag("status"),e!==void 0&&this.tags.push(["status",e])}get encrypted(){return!!this.getMatchingTags("encrypted")[0]}async dvmDecrypt(){await this.decrypt();const e=JSON.parse(this.content);this.tags.push(...e)}},NDKDVMRequest=class Ue extends NDKEvent{static from(e){return new Ue(e.ndk,e.rawEvent())}set bid(e){e===void 0?this.removeTag("bid"):this.tags.push(["bid",e.toString()])}get bid(){const e=this.tagValue("bid");if(e!==void 0)return Number.parseInt(e)}addInput(...e){this.tags.push(["i",...e])}addParam(...e){this.tags.push(["param",...e])}set output(e){e===void 0?this.removeTag("output"):(typeof e=="string"&&(e=[e]),this.tags.push(["output",...e]))}get output(){const e=this.getMatchingTags("output")[0];return e?e.slice(1):void 0}get params(){return this.getMatchingTags("param").map(t=>t.slice(1))}getParam(e){const t=this.getMatchingTags("param").find(r=>r[1]===e);return t?t[2]:void 0}createFeedback(e){const t=new NDKDVMJobFeedback(this.ndk);return t.tag(this,"job"),t.status=e,t}async encryption(e,t){const r=["i","param","output","relays","bid"],s=this.tags.filter(o=>r.includes(o[0]));this.tags=this.tags.filter(o=>!r.includes(o[0])),this.content=JSON.stringify(s),this.tag(e),this.tags.push(["encrypted"]),await this.encrypt(e,t)}set dvm(e){this.removeTag("p"),e&&this.tag(e)}},NDKTranscriptionDVM=class Me extends NDKDVMRequest{constructor(e,t){super(e,t),this.kind=5e3}static from(e){return new Me(e.ndk,e.rawEvent())}get url(){const e=this.getMatchingTags("i");if(e.length===1)return e[0][1]}get title(){return this.tagValue("title")}set title(e){this.removeTag("title"),e&&this.tags.push(["title",e])}get image(){return this.tagValue("image")}set image(e){this.removeTag("image"),e&&this.tags.push(["image",e])}},NDKDVMJobResult=class De extends NDKEvent{static from(e){return new De(e.ndk,e.rawEvent())}setAmount(e,t){this.removeTag("amount");const r=["amount",e.toString()];t&&r.push(t),this.tags.push(r)}set result(e){e===void 0?this.content="":this.content=e}get result(){if(this.content!=="")return this.content}set status(e){this.removeTag("status"),e!==void 0&&this.tags.push(["status",e])}get status(){return this.tagValue("status")}get jobRequestId(){for(const e of this.getMatchingTags("e"))if(e[2]==="job")return e[1];return this.jobRequest?this.jobRequest.id:this.tagValue("e")}set jobRequest(e){this.removeTag("request"),e&&(this.kind=e.kind+1e3,this.tags.push(["request",JSON.stringify(e.rawEvent())]),this.tag(e))}get jobRequest(){const e=this.tagValue("request");if(e!==void 0)return new NDKEvent(this.ndk,JSON.parse(e))}},MARKERS={REDEEMED:"redeemed",CREATED:"created",DESTROYED:"destroyed",RESERVED:"reserved"},ne,NDKCashuWalletTx=(ne=class extends NDKEvent{constructor(e,t){super(e,t),this.kind??(this.kind=7376)}static async from(e){const t=new ne(e.ndk,e),r=t.content;try{await t.decrypt()}catch{t.content??(t.content=r)}try{const s=JSON.parse(t.content);t.tags=[...s,...t.tags]}catch{return}return t}set direction(e){this.removeTag("direction"),e&&this.tags.push(["direction",e])}get direction(){return this.tagValue("direction")}set amount(e){this.removeTag("amount"),this.tags.push(["amount",e.toString()])}get amount(){const e=this.tagValue("amount");if(e!==void 0)return Number(e)}set fee(e){this.removeTag("fee"),this.tags.push(["fee",e.toString()])}get fee(){const e=this.tagValue("fee");if(e!==void 0)return Number(e)}set unit(e){this.removeTag("unit"),e&&this.tags.push(["unit",e.toString()])}get unit(){return this.tagValue("unit")}set description(e){this.removeTag("description"),e&&this.tags.push(["description",e.toString()])}get description(){return this.tagValue("description")}set mint(e){this.removeTag("mint"),e&&this.tags.push(["mint",e.toString()])}get mint(){return this.tagValue("mint")}set destroyedTokens(e){for(const t of e)this.tags.push(t.tagReference(MARKERS.DESTROYED))}set destroyedTokenIds(e){for(const t of e)this.tags.push(["e",t,"",MARKERS.DESTROYED])}set createdTokens(e){for(const t of e)this.tags.push(t.tagReference(MARKERS.CREATED))}set reservedTokens(e){for(const t of e)this.tags.push(t.tagReference(MARKERS.RESERVED))}addRedeemedNutzap(e){this.tag(e,MARKERS.REDEEMED)}async toNostrEvent(e){var o,a;const t=[],r=[];for(const c of this.tags)this.shouldEncryptTag(c)?t.push(c):r.push(c);this.tags=r.filter(c=>c[0]!=="client"),this.content=JSON.stringify(t);const s=await((a=(o=this.ndk)==null?void 0:o.signer)==null?void 0:a.user());if(s){const c=s.pubkey;this.tags=this.tags.filter(l=>l[0]!=="p"||l[1]!==c)}return await this.encrypt(s,void 0,"nip44"),super.toNostrEvent(e)}get hasNutzapRedemption(){return this.getMatchingTags("e",MARKERS.REDEEMED).length>0}shouldEncryptTag(e){return!(["client"].includes(e[0])||e[0]==="e"&&e[3]===MARKERS.REDEEMED||e[0]==="p")}},g(ne,"MARKERS",MARKERS),g(ne,"kind",7376),g(ne,"kinds",[7376]),ne),READ_MARKER="read",WRITE_MARKER="write",NDKRelayList=class Fe extends NDKEvent{constructor(e,t){super(e,t),this.kind??(this.kind=10002)}static from(e){return new Fe(e.ndk,e.rawEvent())}get readRelayUrls(){return this.tags.filter(e=>e[0]==="r"||e[0]==="relay").filter(e=>!e[2]||e[2]&&e[2]===READ_MARKER).map(e=>tryNormalizeRelayUrl(e[1])).filter(e=>!!e)}set readRelayUrls(e){for(const t of e)this.tags.push(["r",t,READ_MARKER])}get writeRelayUrls(){return this.tags.filter(e=>e[0]==="r"||e[0]==="relay").filter(e=>!e[2]||e[2]&&e[2]===WRITE_MARKER).map(e=>tryNormalizeRelayUrl(e[1])).filter(e=>!!e)}set writeRelayUrls(e){for(const t of e)this.tags.push(["r",t,WRITE_MARKER])}get bothRelayUrls(){return this.tags.filter(e=>e[0]==="r"||e[0]==="relay").filter(e=>!e[2]).map(e=>e[1])}set bothRelayUrls(e){for(const t of e)this.tags.push(["r",t])}get relays(){return this.tags.filter(e=>e[0]==="r"||e[0]==="relay").map(e=>e[1])}get relaySet(){if(!this.ndk)throw new Error("NDKRelayList has no NDK instance");return new NDKRelaySet(new Set(this.relays.map(e=>{var t;return(t=this.ndk)==null?void 0:t.pool.getRelay(e)}).filter(e=>!!e)),this.ndk)}};function relayListFromKind3(n,e){try{const t=JSON.parse(e.content),r=new NDKRelayList(n),s=new Set,o=new Set;for(let[a,c]of Object.entries(t)){try{a=normalizeRelayUrl(a)}catch{continue}if(!c)s.add(a),o.add(a);else{const l=c;l.write&&o.add(a),l.read&&s.add(a)}}return r.readRelayUrls=Array.from(s),r.writeRelayUrls=Array.from(o),r}catch{}}var NDKAppHandlerEvent=class Oe extends NDKEvent{constructor(t,r){super(t,r);g(this,"profile");this.kind??(this.kind=31990)}static from(t){const r=new Oe(t.ndk,t.rawEvent());return r.isValid?r:null}get isValid(){const t=new Map,r=o=>[o[0],o[2]].join(":").toLowerCase(),s=["web","android","ios"];for(const o of this.tags)if(s.includes(o[0])){const a=r(o);if(t.has(a)&&t.get(a)!==o[1].toLowerCase())return!1;t.set(a,o[1].toLowerCase())}return!0}async fetchProfile(){if(this.profile===void 0&&this.content.length>0)try{const t=JSON.parse(this.content);if(t!=null&&t.name)return t;this.profile=null}catch{this.profile=null}return new Promise((t,r)=>{const s=this.author;s.fetchProfile().then(()=>{t(s.profile)}).catch(r)})}},NDKRepost=class He extends NDKEvent{constructor(){super(...arguments);g(this,"_repostedEvents")}static from(t){return new He(t.ndk,t.rawEvent())}async repostedEvents(t,r){const s=[];if(!this.ndk)throw new Error("NDK instance not set");if(this._repostedEvents!==void 0)return this._repostedEvents;for(const o of this.repostedEventIds()){const a=filterForId(o),c=await this.ndk.fetchEvent(a,r);c&&s.push(t?t.from(c):c)}return s}repostedEventIds(){return this.tags.filter(t=>t[0]==="e"||t[0]==="a").map(t=>t[1])}};function filterForId(n){if(n.match(/:/)){const[e,t,r]=n.split(":");return{kinds:[Number.parseInt(e)],authors:[t],"#d":[r]}}return{ids:[n]}}var NDKSubscriptionReceipt=class Ve extends NDKEvent{constructor(t,r){super(t,r);g(this,"debug");this.kind??(this.kind=7003),this.debug=(t==null?void 0:t.debug.extend("subscription-start"))??createDebug2("ndk:subscription-start")}static from(t){return new Ve(t.ndk,t.rawEvent())}get recipient(){var s;const t=(s=this.getMatchingTags("p"))==null?void 0:s[0];return t?new NDKUser({pubkey:t[1]}):void 0}set recipient(t){this.removeTag("p"),t&&this.tags.push(["p",t.pubkey])}get subscriber(){var s;const t=(s=this.getMatchingTags("P"))==null?void 0:s[0];return t?new NDKUser({pubkey:t[1]}):void 0}set subscriber(t){this.removeTag("P"),t&&this.tags.push(["P",t.pubkey])}set subscriptionStart(t){this.debug(`before setting subscription start: ${this.rawEvent}`),this.removeTag("e"),this.tag(t,"subscription",!0),this.debug(`after setting subscription start: ${this.rawEvent}`)}get tierName(){var r;const t=(r=this.getMatchingTags("tier"))==null?void 0:r[0];return t==null?void 0:t[1]}get isValid(){const t=this.validPeriod;if(!t||t.start>t.end)return!1;const r=this.getMatchingTags("p"),s=this.getMatchingTags("P");return!(r.length!==1||s.length!==1)}get validPeriod(){var r;const t=(r=this.getMatchingTags("valid"))==null?void 0:r[0];if(t)try{return{start:new Date(Number.parseInt(t[1])*1e3),end:new Date(Number.parseInt(t[2])*1e3)}}catch{return}}set validPeriod(t){this.removeTag("valid"),t&&this.tags.push(["valid",Math.floor(t.start.getTime()/1e3).toString(),Math.floor(t.end.getTime()/1e3).toString()])}get startPeriod(){var t;return(t=this.validPeriod)==null?void 0:t.start}get endPeriod(){var t;return(t=this.validPeriod)==null?void 0:t.end}isActive(t){t??(t=new Date);const r=this.validPeriod;return!(!r||tr.end)}},NDKSubscriptionStart=class ze extends NDKEvent{constructor(t,r){super(t,r);g(this,"debug");this.kind??(this.kind=7001),this.debug=(t==null?void 0:t.debug.extend("subscription-start"))??createDebug2("ndk:subscription-start")}static from(t){return new ze(t.ndk,t.rawEvent())}get recipient(){var s;const t=(s=this.getMatchingTags("p"))==null?void 0:s[0];return t?new NDKUser({pubkey:t[1]}):void 0}set recipient(t){this.removeTag("p"),t&&this.tags.push(["p",t.pubkey])}get amount(){var r;const t=(r=this.getMatchingTags("amount"))==null?void 0:r[0];if(t)return parseTagToSubscriptionAmount(t)}set amount(t){this.removeTag("amount"),t&&this.tags.push(newAmount(t.amount,t.currency,t.term))}get tierId(){var s,o;const t=(s=this.getMatchingTags("e"))==null?void 0:s[0],r=(o=this.getMatchingTags("a"))==null?void 0:o[0];if(!(!t||!r))return t[1]??r[1]}set tier(t){this.removeTag("e"),this.removeTag("a"),this.removeTag("event"),t&&(this.tag(t),this.removeTag("p"),this.tags.push(["p",t.pubkey]),this.tags.push(["event",JSON.stringify(t.rawEvent())]))}async fetchTier(){var o;const t=this.tagValue("event");if(t)try{const a=JSON.parse(t);return new NDKSubscriptionTier(this.ndk,a)}catch{this.debug("Failed to parse event tag")}const r=this.tierId;if(!r)return;const s=await((o=this.ndk)==null?void 0:o.fetchEvent(r));if(s)return NDKSubscriptionTier.from(s)}get isValid(){return this.getMatchingTags("amount").length!==1?(this.debug("Invalid # of amount tag"),!1):this.amount?this.getMatchingTags("p").length!==1?(this.debug("Invalid # of p tag"),!1):this.recipient?!0:(this.debug("Invalid p tag"),!1):(this.debug("Invalid amount tag"),!1)}};async function giftWrap(n,e,t,r={}){let s=t;if(r.scheme??(r.scheme="nip44"),!s){if(!n.ndk)throw new Error("no signer available for giftWrap");s=n.ndk.signer}if(!s)throw new Error("no signer");if(!s.encryptionEnabled||!s.encryptionEnabled(r.scheme))throw new Error("signer is not able to giftWrap");const o=getRumorEvent(n,r==null?void 0:r.rumorKind),a=await getSealEvent(o,e,s,r.scheme),c=await getWrapEvent(a,e,r);return new NDKEvent(n.ndk,c)}async function giftUnwrap(n,e,t,r="nip44"){const s=e||new NDKUser({pubkey:n.pubkey});let o=t;if(!o){if(!n.ndk)throw new Error("no signer available for giftUnwrap");o=n.ndk.signer}if(!t)throw new Error("no signer");try{const a=JSON.parse(await t.decrypt(s,n.content,r));if(!a)throw new Error("Failed to decrypt wrapper");if(!new NDKEvent(void 0,a).verifySignature(!1))throw new Error("GiftSeal signature verification failed!");const c=new NDKUser({pubkey:a.pubkey}),l=JSON.parse(await t.decrypt(c,a.content,r));if(!l)throw new Error("Failed to decrypt seal");if(l.pubkey!==a.pubkey)throw new Error("Invalid GiftWrap, sender validation failed!");return new NDKEvent(n.ndk,l)}catch{return Promise.reject("Got error unwrapping event! See console log.")}}function getRumorEvent(n,e){const t=n.rawEvent();return t.kind=e||t.kind||14,t.sig=void 0,t.id=getEventHash$1(t),new NDKEvent(n.ndk,t)}async function getSealEvent(n,e,t,r="nip44"){const s=new NDKEvent(n.ndk);return s.kind=13,s.created_at=approximateNow(5),s.content=JSON.stringify(n.rawEvent()),await s.encrypt(e,t,r),await s.sign(t),s}async function getWrapEvent(n,e,t,r="nip44"){const s=NDKPrivateKeySigner.generate(),o=new NDKEvent(n.ndk);return o.kind=1059,o.created_at=approximateNow(5),t!=null&&t.wrapTags&&(o.tags=t.wrapTags),o.tag(e),o.content=JSON.stringify(n.rawEvent()),await o.encrypt(e,s,r),await o.sign(s),o}function approximateNow(n=0){return Math.round(Date.now()/1e3-Math.random()*10**n)}var NDKSimpleGroup=class qe{constructor(e,t,r){g(this,"ndk");g(this,"groupId");g(this,"relaySet");g(this,"fetchingMetadata");g(this,"metadata");g(this,"memberList");g(this,"adminList");this.ndk=e,this.groupId=r??randomId(24),this.relaySet=t}get id(){return this.groupId}relayUrls(){var e;return(e=this.relaySet)==null?void 0:e.relayUrls}get name(){var e;return(e=this.metadata)==null?void 0:e.name}get about(){var e;return(e=this.metadata)==null?void 0:e.about}get picture(){var e;return(e=this.metadata)==null?void 0:e.picture}get members(){var e;return((e=this.memberList)==null?void 0:e.members)??[]}get admins(){var e;return((e=this.adminList)==null?void 0:e.members)??[]}async getMetadata(){return await this.ensureMetadataEvent(),this.metadata}async createGroup(e){if(e??(e=this.ndk.signer),!e)throw new Error("No signer available");if(!await e.user())throw new Error("No user available");const r=new NDKEvent(this.ndk);return r.kind=9007,r.tags.push(["h",this.groupId]),await r.sign(e),r.publish(this.relaySet)}async setMetadata({name:e,about:t,picture:r}){const s=new NDKEvent(this.ndk);return s.kind=9002,s.tags.push(["h",this.groupId]),e&&s.tags.push(["name",e]),t&&s.tags.push(["about",t]),r&&s.tags.push(["picture",r]),await s.sign(),s.publish(this.relaySet)}async addUser(e){const t=qe.generateAddUserEvent(e.pubkey,this.groupId);return t.ndk=this.ndk,t}async getMemberListEvent(){const e=await this.ndk.fetchEvent({kinds:[39002],"#d":[this.groupId]},void 0,this.relaySet);return e?NDKSimpleGroupMemberList.from(e):null}async getMembers(){const e=[],t=new Set,r=await this.getMemberListEvent();if(!r)return[];for(const s of r.getMatchingTags("p")){const o=s[1];if(!t.has(o)){t.add(o);try{e.push(this.ndk.getUser({pubkey:o}))}catch{}}}return e}static generateUserListEvent(e){return new NDKEvent(void 0,{kind:39002,tags:[["h",e],["alt","Group Member List"]]})}static generateAddUserEvent(e,t){const r=new NDKEvent(void 0,{kind:9e3,tags:[["h",t]]});return r.tags.push(["p",e]),r}async requestToJoin(e,t){return new NDKEvent(this.ndk,{kind:9021,content:t??"",tags:[["h",this.groupId]]}).publish(this.relaySet)}async ensureMetadataEvent(){if(!this.metadata)return this.fetchingMetadata?this.fetchingMetadata:(this.fetchingMetadata=this.ndk.fetchEvent({kinds:[39e3],"#d":[this.groupId]},void 0,this.relaySet).then(e=>{e?this.metadata=NDKSimpleGroupMetadata.from(e):(this.metadata=new NDKSimpleGroupMetadata(this.ndk),this.metadata.dTag=this.groupId)}).finally(()=>{this.fetchingMetadata=void 0}).catch(()=>{throw new Error(`Failed to fetch metadata for group ${this.groupId}`)}),this.fetchingMetadata)}};function randomId(n){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=e.length;let r="";for(let s=0;s0)try{this.settings=JSON.parse(this.content)}catch(s){console.error("Error parsing app settings",s)}}static from(t){return new je(t.ndk,t)}set(t,r){this.settings[t]=r}get(t){return this.settings[t]}async publishReplaceable(t,r,s){return this.content=JSON.stringify(this.settings),super.publishReplaceable(t,r,s)}};function disconnect(n,e){return e??(e=createDebug2("ndk:relay:auth-policies:disconnect")),async t=>{e==null||e(`Relay ${t.url} requested authentication, disconnecting`),n.removeRelay(t.url)}}async function signAndAuth(n,e,t,r,s,o){try{await n.sign(t),s(n)}catch(a){r==null||r(`Failed to publish auth event to relay ${e.url}`,a),o(n)}}function signIn({ndk:n,signer:e,debug:t}={}){return t??(t=createDebug2("ndk:auth-policies:signIn")),async(r,s)=>{t==null||t(`Relay ${r.url} requested authentication, signing in`);const o=new NDKEvent(n);return o.kind=22242,o.tags=[["relay",r.url],["challenge",s]],e??(e=n==null?void 0:n.signer),new Promise(async(a,c)=>{e?await signAndAuth(o,r,e,t,a,c):n==null||n.once("signer:ready",async l=>{await signAndAuth(o,r,l,t,a,c)})})}}var NDKRelayAuthPolicies={disconnect,signIn},NDKNip07Signer=class We{constructor(e=1e3,t){g(this,"_userPromise");g(this,"encryptionQueue",[]);g(this,"encryptionProcessing",!1);g(this,"debug");g(this,"waitTimeout");g(this,"_pubkey");g(this,"ndk");g(this,"_user");this.debug=createDebug2("ndk:nip07"),this.waitTimeout=e,this.ndk=t}get pubkey(){if(!this._pubkey)throw new Error("Not ready");return this._pubkey}async blockUntilReady(){var r;await this.waitForExtension();const e=await((r=window.nostr)==null?void 0:r.getPublicKey());if(!e)throw new Error("User rejected access");this._pubkey=e;let t;return this.ndk?t=this.ndk.getUser({pubkey:e}):t=new NDKUser({pubkey:e}),this._user=t,t}async user(){return this._userPromise||(this._userPromise=this.blockUntilReady()),this._userPromise}get userSync(){if(!this._user)throw new Error("User not ready");return this._user}async sign(e){var r;await this.waitForExtension();const t=await((r=window.nostr)==null?void 0:r.signEvent(e));if(!t)throw new Error("Failed to sign event");return t.sig}async relays(e){var s,o;await this.waitForExtension();const t=await((o=(s=window.nostr)==null?void 0:s.getRelays)==null?void 0:o.call(s))||{},r=[];for(const a of Object.keys(t))t[a].read&&t[a].write&&r.push(a);return r.map(a=>new NDKRelay(a,e==null?void 0:e.relayAuthDefaultPolicy,e))}async encryptionEnabled(e){var r,s;const t=[];return(!e||e==="nip04")&&((r=window.nostr)!=null&&r.nip04)&&t.push("nip04"),(!e||e==="nip44")&&((s=window.nostr)!=null&&s.nip44)&&t.push("nip44"),t}async encrypt(e,t,r="nip04"){if(!await this.encryptionEnabled(r))throw new Error(`${r}encryption is not available from your browser extension`);await this.waitForExtension();const s=e.pubkey;return this.queueEncryption(r,"encrypt",s,t)}async decrypt(e,t,r="nip04"){if(!await this.encryptionEnabled(r))throw new Error(`${r}encryption is not available from your browser extension`);await this.waitForExtension();const s=e.pubkey;return this.queueEncryption(r,"decrypt",s,t)}async queueEncryption(e,t,r,s){return new Promise((o,a)=>{this.encryptionQueue.push({scheme:e,method:t,counterpartyHexpubkey:r,value:s,resolve:o,reject:a}),this.encryptionProcessing||this.processEncryptionQueue()})}async processEncryptionQueue(e,t=0){var h,u;if(!e&&this.encryptionQueue.length===0){this.encryptionProcessing=!1;return}this.encryptionProcessing=!0;const r=e||this.encryptionQueue.shift();if(!r){this.encryptionProcessing=!1;return}const{scheme:s,method:o,counterpartyHexpubkey:a,value:c,resolve:l,reject:f}=r;this.debug("Processing encryption queue item",{method:o,counterpartyHexpubkey:a,value:c});try{const p=await((u=(h=window.nostr)==null?void 0:h[s])==null?void 0:u[o](a,c));if(!p)throw new Error("Failed to encrypt/decrypt");l(p)}catch(p){const y=p instanceof Error?p.message:String(p);if(y.includes("call already executing")&&t<5){this.debug("Retrying encryption queue item",{method:o,counterpartyHexpubkey:a,value:c,retries:t}),setTimeout(()=>{this.processEncryptionQueue(r,t+1)},50*t);return}f(p instanceof Error?p:new Error(y))}this.processEncryptionQueue()}waitForExtension(){return new Promise((e,t)=>{if(window.nostr){e();return}let r;const s=setInterval(()=>{window.nostr&&(clearTimeout(r),clearInterval(s),e())},100);r=setTimeout(()=>{clearInterval(s),t(new Error("NIP-07 extension not available"))},this.waitTimeout)})}toPayload(){return JSON.stringify({type:"nip07",payload:""})}static async fromPayload(e,t){const r=JSON.parse(e);if(r.type!=="nip07")throw new Error(`Invalid payload type: expected 'nip07', got ${r.type}`);return new We(void 0,t)}};registerSigner("nip07",NDKNip07Signer);var NDKNostrRpc=class extends lib$1.EventEmitter{constructor(e,t,r,s){super();g(this,"ndk");g(this,"signer");g(this,"relaySet");g(this,"debug");g(this,"encryptionType","nip04");g(this,"pool");if(this.ndk=e,this.signer=t,s){this.pool=new NDKPool(s,[],e,{debug:r.extend("rpc-pool"),name:"Nostr RPC"}),this.relaySet=new NDKRelaySet(new Set,e,this.pool);for(const o of s){const a=this.pool.getRelay(o,!1,!1);a.authPolicy=NDKRelayAuthPolicies.signIn({ndk:e,signer:t,debug:r}),this.relaySet.addRelay(a),a.connect()}}this.debug=r.extend("rpc")}subscribe(e){const t=this.ndk.subscribe(e,{closeOnEose:!1,groupable:!1,cacheUsage:"ONLY_RELAY",pool:this.pool,relaySet:this.relaySet},!1);return t.on("event",async r=>{try{const s=await this.parseEvent(r);s.method?this.emit("request",s):(this.emit(`response-${s.id}`,s),this.emit("response",s))}catch(s){this.debug("error parsing event",s,r.rawEvent())}}),new Promise(r=>{t.on("eose",()=>{this.debug("eosed"),r(t)}),t.start()})}async parseEvent(e){this.encryptionType==="nip44"&&e.content.includes("?iv=")?this.encryptionType="nip04":this.encryptionType==="nip04"&&!e.content.includes("?iv=")&&(this.encryptionType="nip44");const t=this.ndk.getUser({pubkey:e.pubkey});t.ndk=this.ndk;let r;try{r=await this.signer.decrypt(t,e.content,this.encryptionType)}catch{const u=this.encryptionType==="nip04"?"nip44":"nip04";r=await this.signer.decrypt(t,e.content,u),this.encryptionType=u}const s=JSON.parse(r),{id:o,method:a,params:c,result:l,error:f}=s;return a?{id:o,pubkey:e.pubkey,method:a,params:c,event:e}:{id:o,result:l,error:f,event:e}}async sendResponse(e,t,r,s=24133,o){const a={id:e,result:r};o&&(a.error=o);const c=await this.signer.user(),l=this.ndk.getUser({pubkey:t}),f=new NDKEvent(this.ndk,{kind:s,content:JSON.stringify(a),tags:[["p",t]],pubkey:c.pubkey});f.content=await this.signer.encrypt(l,f.content,this.encryptionType),await f.sign(this.signer),await f.publish(this.relaySet)}async sendRequest(e,t,r=[],s=24133,o){const a=Math.random().toString(36).substring(7),c=await this.signer.user(),l=this.ndk.getUser({pubkey:e}),f={id:a,method:t,params:r},h=new Promise(()=>{const p=y=>{y.result==="auth_url"?(this.once(`response-${a}`,p),this.emit("authUrl",y.error)):o&&o(y)};this.once(`response-${a}`,p)}),u=new NDKEvent(this.ndk,{kind:s,content:JSON.stringify(f),tags:[["p",e]],pubkey:c.pubkey});return u.content=await this.signer.encrypt(l,u.content,this.encryptionType),await u.sign(this.signer),await u.publish(this.relaySet),h}},ConnectEventHandlingStrategy=class{async handle(n,e,t,r){const[s,o]=r,a=n.debug.extend("connect");if(a(`connection request from ${t}`),o&&n.applyToken&&(a("applying token"),await n.applyToken(t,o)),await n.pubkeyAllowed({id:e,pubkey:t,method:"connect",params:o}))return a(`connection request from ${t} allowed`),"ack";a(`connection request from ${t} rejected`)}},GetPublicKeyHandlingStrategy=class{async handle(n,e,t,r){var s;return(s=n.localUser)==null?void 0:s.pubkey}},Nip04DecryptHandlingStrategy=class{async handle(n,e,t,r){const[s,o]=r,a=new NDKUser({pubkey:s});return await decrypt2(n,e,t,a,o)}};async function decrypt2(n,e,t,r,s){if(!await n.pubkeyAllowed({id:e,pubkey:t,method:"nip04_decrypt",params:s})){n.debug(`decrypt request from ${t} rejected`);return}return await n.signer.decrypt(r,s,"nip04")}var Nip04EncryptHandlingStrategy=class{async handle(n,e,t,r){const[s,o]=r,a=new NDKUser({pubkey:s});return await encrypt2(n,e,t,a,o)}};async function encrypt2(n,e,t,r,s){if(!await n.pubkeyAllowed({id:e,pubkey:t,method:"nip04_encrypt",params:s})){n.debug(`encrypt request from ${t} rejected`);return}return await n.signer.encrypt(r,s,"nip04")}var Nip04DecryptHandlingStrategy2=class{async handle(n,e,t,r){const[s,o]=r,a=new NDKUser({pubkey:s});return await decrypt3(n,e,t,a,o)}};async function decrypt3(n,e,t,r,s){if(!await n.pubkeyAllowed({id:e,pubkey:t,method:"nip44_decrypt",params:s})){n.debug(`decrypt request from ${t} rejected`);return}return await n.signer.decrypt(r,s,"nip44")}var Nip04EncryptHandlingStrategy2=class{async handle(n,e,t,r){const[s,o]=r,a=new NDKUser({pubkey:s});return await encrypt3(n,e,t,a,o)}};async function encrypt3(n,e,t,r,s){if(!await n.pubkeyAllowed({id:e,pubkey:t,method:"nip44_encrypt",params:s})){n.debug(`encrypt request from ${t} rejected`);return}return await n.signer.encrypt(r,s,"nip44")}var PingEventHandlingStrategy=class{async handle(n,e,t,r){const s=n.debug.extend("ping");if(s(`ping request from ${t}`),await n.pubkeyAllowed({id:e,pubkey:t,method:"ping"}))return s(`connection request from ${t} allowed`),"pong";s(`connection request from ${t} rejected`)}},SignEventHandlingStrategy=class{async handle(n,e,t,r){const s=await signEvent(n,e,t,r);if(s)return JSON.stringify(await s.toNostrEvent())}};async function signEvent(n,e,t,r){const[s]=r;n.debug(`sign event request from ${t}`);const o=new NDKEvent(n.ndk,JSON.parse(s));if(n.debug("event to sign",o.rawEvent()),!await n.pubkeyAllowed({id:e,pubkey:t,method:"sign_event",params:o})){n.debug(`sign event request from ${t} rejected`);return}return n.debug(`sign event request from ${t} allowed`),await o.sign(n.signer),o}var NDKNip46Backend=class{constructor(n,e,t,r){g(this,"ndk");g(this,"signer");g(this,"localUser");g(this,"debug");g(this,"rpc");g(this,"permitCallback");g(this,"relayUrls");g(this,"handlers",{connect:new ConnectEventHandlingStrategy,sign_event:new SignEventHandlingStrategy,nip04_encrypt:new Nip04EncryptHandlingStrategy,nip04_decrypt:new Nip04DecryptHandlingStrategy,nip44_encrypt:new Nip04EncryptHandlingStrategy2,nip44_decrypt:new Nip04DecryptHandlingStrategy2,get_public_key:new GetPublicKeyHandlingStrategy,ping:new PingEventHandlingStrategy});if(this.ndk=n,e instanceof Uint8Array)this.signer=new NDKPrivateKeySigner(e);else if(e instanceof String)this.signer=new NDKPrivateKeySigner(hexToBytes(e));else if(e instanceof NDKPrivateKeySigner)this.signer=e;else throw new Error("Invalid signer");this.debug=n.debug.extend("nip46:backend"),this.relayUrls=r??Array.from(n.pool.relays.keys()),this.rpc=new NDKNostrRpc(n,this.signer,this.debug,this.relayUrls),this.permitCallback=t}async start(){this.localUser=await this.signer.user(),this.ndk.subscribe({kinds:[24133],"#p":[this.localUser.pubkey]},{closeOnEose:!1}).on("event",e=>this.handleIncomingEvent(e))}setStrategy(n,e){this.handlers[n]=e}async applyToken(n,e){throw new Error("connection token not supported")}async handleIncomingEvent(n){const{id:e,method:t,params:r}=await this.rpc.parseEvent(n),s=n.pubkey;let o;if(this.debug("incoming event",{id:e,method:t,params:r}),!n.verifySignature(!1)){this.debug("invalid signature",n.rawEvent());return}const a=this.handlers[t];if(a)try{o=await a.handle(this,e,s,r)}catch(c){this.debug("error handling event",c,{id:e,method:t,params:r}),this.rpc.sendResponse(e,s,"error",void 0,c.message)}else this.debug("unsupported method",{method:t,params:r});o?(this.debug(`sending response to ${s}`,o),this.rpc.sendResponse(e,s,o)):this.rpc.sendResponse(e,s,"error",void 0,"Not authorized")}async pubkeyAllowed(n){return this.permitCallback(n)}};async function ndkSignerFromPayload(n,e){let t;try{t=JSON.parse(n)}catch(s){console.error("Failed to parse signer payload string",n,s);return}if(!t||typeof t.type!="string"){console.error("Failed to parse signer payload string",n,new Error("Missing type field"));return}const r=signerRegistry.get(t.type);if(!r)throw new Error(`Unknown signer type: ${t.type}`);try{return await r.fromPayload(n,e)}catch(s){const o=s instanceof Error?s.message:String(s);throw new Error(`Failed to deserialize signer type ${t.type}: ${o}`)}}function nostrConnectGenerateSecret(){return Math.random().toString(36).substring(2,15)}function generateNostrConnectUri(n,e,t,r){const s={name:r!=null&&r.name?encodeURIComponent(r.name):"",url:r!=null&&r.url?encodeURIComponent(r.url):"",image:r!=null&&r.image?encodeURIComponent(r.image):"",perms:r!=null&&r.perms?encodeURIComponent(r.perms):""};let o=`nostrconnect://${n}?image=${s.image}&url=${s.url}&name=${s.name}&perms=${s.perms}&secret=${encodeURIComponent(e)}`;return t&&(o+=`&relay=${encodeURIComponent(t)}`),o}var NDKNip46Signer=class Ae extends lib$1.EventEmitter{constructor(t,r,s,o,a){super();g(this,"ndk");g(this,"_user");g(this,"bunkerPubkey");g(this,"userPubkey");g(this,"secret");g(this,"localSigner");g(this,"nip05");g(this,"rpc");g(this,"debug");g(this,"relayUrls");g(this,"subscription");g(this,"nostrConnectUri");g(this,"nostrConnectSecret");this.ndk=t,this.debug=t.debug.extend("nip46:signer"),this.relayUrls=o,s?typeof s=="string"?this.localSigner=new NDKPrivateKeySigner(s):this.localSigner=s:this.localSigner=NDKPrivateKeySigner.generate(),r===!1||(r?r.startsWith("bunker://")?this.bunkerFlowInit(r):this.nip05Init(r):this.nostrconnectFlowInit(a)),this.rpc=new NDKNostrRpc(this.ndk,this.localSigner,this.debug,this.relayUrls)}get pubkey(){if(!this.userPubkey)throw new Error("Not ready");return this.userPubkey}static bunker(t,r,s){return new Ae(t,r,s)}static nostrconnect(t,r,s,o){return new Ae(t,void 0,s,[r],o)}nostrconnectFlowInit(t){var s;this.nostrConnectSecret=nostrConnectGenerateSecret();const r=this.localSigner.pubkey;this.nostrConnectUri=generateNostrConnectUri(r,this.nostrConnectSecret,(s=this.relayUrls)==null?void 0:s[0],t)}bunkerFlowInit(t){const r=new URL(t),s=r.hostname||r.pathname.replace(/^\/\//,""),o=r.searchParams.get("pubkey"),a=r.searchParams.getAll("relay"),c=r.searchParams.get("secret");this.bunkerPubkey=s,this.userPubkey=o,this.relayUrls=a,this.secret=c}nip05Init(t){this.nip05=t}async startListening(){if(this.subscription)return;const t=await this.localSigner.user();if(!t)throw new Error("Local signer not ready");this.subscription=await this.rpc.subscribe({kinds:[24133],"#p":[t.pubkey]})}async user(){return this._user?this._user:this.blockUntilReady()}get userSync(){if(!this._user)throw new Error("Remote user not ready synchronously");return this._user}async blockUntilReadyNostrConnect(){return new Promise((t,r)=>{const s=o=>{o.result===this.nostrConnectSecret&&(this._user=o.event.author,this.userPubkey=o.event.pubkey,this.bunkerPubkey=o.event.pubkey,this.rpc.off("response",s),t(this._user))};this.startListening(),this.rpc.on("response",s)})}async blockUntilReady(){if(!this.bunkerPubkey&&!this.nostrConnectSecret&&!this.nip05)throw new Error("Bunker pubkey not set");if(this.nostrConnectSecret)return this.blockUntilReadyNostrConnect();if(this.nip05&&!this.userPubkey){const t=await NDKUser.fromNip05(this.nip05,this.ndk);t&&(this._user=t,this.userPubkey=t.pubkey,this.relayUrls=t.nip46Urls,this.rpc=new NDKNostrRpc(this.ndk,this.localSigner,this.debug,this.relayUrls))}if(!this.bunkerPubkey&&this.userPubkey)this.bunkerPubkey=this.userPubkey;else if(!this.bunkerPubkey)throw new Error("Bunker pubkey not set");return await this.startListening(),this.rpc.on("authUrl",(...t)=>{this.emit("authUrl",...t)}),new Promise((t,r)=>{const s=[this.userPubkey??""];if(this.secret&&s.push(this.secret),!this.bunkerPubkey)throw new Error("Bunker pubkey not set");this.rpc.sendRequest(this.bunkerPubkey,"connect",s,24133,o=>{o.result==="ack"?this.getPublicKey().then(a=>{this.userPubkey=a,this._user=this.ndk.getUser({pubkey:a}),t(this._user)}):r(o.error)})})}stop(){var t;(t=this.subscription)==null||t.stop(),this.subscription=void 0}async getPublicKey(){return this.userPubkey?this.userPubkey:new Promise((t,r)=>{if(!this.bunkerPubkey)throw new Error("Bunker pubkey not set");this.rpc.sendRequest(this.bunkerPubkey,"get_public_key",[],24133,s=>{t(s.result)})})}async encryptionEnabled(t){return t?[t]:Promise.resolve(["nip04","nip44"])}async encrypt(t,r,s="nip04"){return this.encryption(t,r,s,"encrypt")}async decrypt(t,r,s="nip04"){return this.encryption(t,r,s,"decrypt")}async encryption(t,r,s,o){return new Promise((c,l)=>{if(!this.bunkerPubkey)throw new Error("Bunker pubkey not set");this.rpc.sendRequest(this.bunkerPubkey,`${s}_${o}`,[t.pubkey,r],24133,f=>{f.error?l(f.error):c(f.result)})})}async sign(t){return new Promise((s,o)=>{if(!this.bunkerPubkey)throw new Error("Bunker pubkey not set");this.rpc.sendRequest(this.bunkerPubkey,"sign_event",[JSON.stringify(t)],24133,a=>{if(a.error)o(a.error);else{const c=JSON.parse(a.result);s(c.sig)}})})}async createAccount(t,r,s){await this.startListening();const o=[];return t&&o.push(t),r&&o.push(r),s&&o.push(s),new Promise((a,c)=>{if(!this.bunkerPubkey)throw new Error("Bunker pubkey not set");this.rpc.sendRequest(this.bunkerPubkey,"create_account",o,24133,l=>{if(l.error)c(l.error);else{const f=l.result;a(f)}})})}toPayload(){if(!this.bunkerPubkey||!this.userPubkey)throw new Error("NIP-46 signer is not fully initialized for serialization");const t={type:"nip46",payload:{bunkerPubkey:this.bunkerPubkey,userPubkey:this.userPubkey,relayUrls:this.relayUrls,secret:this.secret,localSignerPayload:this.localSigner.toPayload(),nip05:this.nip05||null}};return JSON.stringify(t)}static async fromPayload(t,r){if(!r)throw new Error("NDK instance is required to deserialize NIP-46 signer");const s=JSON.parse(t);if(s.type!=="nip46")throw new Error(`Invalid payload type: expected 'nip46', got ${s.type}`);const o=s.payload;if(!o||typeof o!="object"||!o.localSignerPayload)throw new Error("Invalid payload content for nip46 signer");const a=await ndkSignerFromPayload(o.localSignerPayload,r);if(!a)throw new Error("Failed to deserialize local signer for NIP-46");if(!(a instanceof NDKPrivateKeySigner))throw new Error("Local signer must be an instance of NDKPrivateKeySigner");let c;return c=new Ae(r,!1,a,o.relayUrls),c.userPubkey=o.userPubkey,c.bunkerPubkey=o.bunkerPubkey,c.relayUrls=o.relayUrls,c.secret=o.secret,o.userPubkey&&(c._user=new NDKUser({pubkey:o.userPubkey}),c._user&&(c._user.ndk=r)),c}};registerSigner("nip46",NDKNip46Signer);function addRelays(n,e){var r;const t=[];if(!e||e.length===0){const s=(r=n.ndk)==null?void 0:r.pool.relays;e=s?Object.keys(s):void 0}return e&&e.length>0&&t.push(["relays",...e]),t}async function dvmSchedule(n,e,t,r=!0,s){Array.isArray(n)||(n=[n]);const o=n[0].ndk;if(!o)throw new Error("NDK not set");for(const h of n){if(!h.sig)throw new Error("Event not signed");if(!h.created_at)throw new Error("Event has no date");if(!e)throw new Error("No DVM specified");if(h.created_at<=Date.now()/1e3)throw new Error("Event needs to be in the future")}const a=new NDKDVMRequest(o,{kind:5905});for(const h of n)a.addInput(JSON.stringify(h.rawEvent()),"text");a.tags.push(...addRelays(n[0],t)),r?await a.encryption(e):a.dvm=e,await a.sign();let c;s&&(c=o.subscribe({kinds:[5905+1e3,7e3],...a.filter()},{groupable:!1,closeOnEose:!1}));const l=new Promise(h=>{setTimeout(()=>{c==null||c.stop(),h("Timeout waiting for an answer from the DVM")},s)}),f=new Promise((h,u)=>{s&&(c==null||c.on("event",async p=>{if(c==null||c.stop(),p.kind===7e3){const y=await NDKDVMJobFeedback.from(p);if(y.status==="error"){const b=y.getMatchingTags("status");u((b==null?void 0:b[2])??y)}else h(y)}h(p)})),a.publish().then(()=>{s||h(void 0)})});return new Promise((h,u)=>{s?Promise.race([l,f]).then(p=>{h(p)}).catch(u):f.then(h)})}function dedup(n,e){return n.created_at>e.created_at?n:e}async function getRelayListForUser(n,e){return(await getRelayListForUsers([n],e)).get(n)}async function getRelayListForUsers(n,e,t=!1,r=1e3){var u;const s=e.outboxPool||e.pool,o=new Set;for(const p of s.relays.values())o.add(p);const a=new Map,c=new Map,l=new NDKRelaySet(o,e);if((u=e.cacheAdapter)!=null&&u.locking&&!t){const p=await e.fetchEvents({kinds:[3,10002],authors:Array.from(new Set(n))},{cacheUsage:"ONLY_CACHE",subId:"ndk-relay-list-fetch"});for(const y of p)y.kind===10002&&a.set(y.pubkey,NDKRelayList.from(y));for(const y of p)if(y.kind===3){if(a.has(y.pubkey))continue;const b=relayListFromKind3(e,y);b&&c.set(y.pubkey,b)}n=n.filter(y=>!a.has(y)&&!c.has(y))}if(n.length===0)return a;const f=new Map,h=new Map;return new Promise(p=>{(async()=>{const b={closeOnEose:!0,pool:s,groupable:!0,subId:"ndk-relay-list-fetch",addSinceFromCache:!0,relaySet:l};l&&(b.relaySet=l),e.subscribe({kinds:[3,10002],authors:n},b,{onEvent:m=>{if(m.kind===10002){const k=f.get(m.pubkey);if(k&&k.created_at>m.created_at)return;f.set(m.pubkey,m)}else if(m.kind===3){const k=h.get(m.pubkey);if(k&&k.created_at>m.created_at)return;h.set(m.pubkey,m)}},onEose:()=>{for(const m of f.values())a.set(m.pubkey,NDKRelayList.from(m));for(const m of n){if(a.has(m))continue;const k=h.get(m);if(!k)continue;const R=relayListFromKind3(e,k);R&&a.set(m,R)}p(a)}}),setTimeout(()=>{p(a)},r)})()})}var OutboxItem=class{constructor(n){g(this,"type");g(this,"relayUrlScores");g(this,"readRelays");g(this,"writeRelays");this.type=n,this.relayUrlScores=new Map,this.readRelays=new Set,this.writeRelays=new Set}},OutboxTracker=class extends lib$1.EventEmitter{constructor(e){super();g(this,"data");g(this,"ndk");g(this,"debug");this.ndk=e,this.debug=e.debug.extend("outbox-tracker"),this.data=new dist.LRUCache({maxSize:1e5,entryExpirationTimeInMS:2*60*1e3})}async trackUsers(e,t=!1){const r=[];for(let s=0;sgetKeyFromItem(c)).filter(c=>!this.data.has(c));if(a.length!==0){for(const c of a)this.data.set(c,new OutboxItem("user"));r.push(new Promise(c=>{getRelayListForUsers(a,this.ndk,t).then(l=>{for(const[f,h]of l){let u=this.data.get(f);if(u??(u=new OutboxItem("user")),h){u.readRelays=new Set(normalize(h.readRelayUrls)),u.writeRelays=new Set(normalize(h.writeRelayUrls));for(const p of u.readRelays)this.ndk.pool.blacklistRelayUrls.has(p)&&u.readRelays.delete(p);for(const p of u.writeRelays)this.ndk.pool.blacklistRelayUrls.has(p)&&u.writeRelays.delete(p);this.data.set(f,u)}}}).finally(c)}))}}return Promise.all(r)}track(e,t,r=!0){const s=getKeyFromItem(e);t??(t=getTypeFromItem(e));let o=this.data.get(s);return o||(o=new OutboxItem(t),e instanceof NDKUser&&this.trackUsers([e])),o}};function getKeyFromItem(n){return n instanceof NDKUser?n.pubkey:n}function getTypeFromItem(n){return n instanceof NDKUser?"user":"kind"}function correctRelaySet(n,e){const t=e.connectedRelays();if(!Array.from(n.relays).some(s=>t.map(o=>o.url).includes(s.url)))for(const s of t)n.addRelay(s);if(t.length===0)for(const s of e.relays.values())n.addRelay(s);return n}var NDKSubscriptionManager=class{constructor(){g(this,"subscriptions");g(this,"seenEvents",new Map);this.subscriptions=new Map}add(n){this.subscriptions.set(n.internalId,n),n.onStopped,n.onStopped=()=>{this.subscriptions.delete(n.internalId)},n.on("close",()=>{this.subscriptions.delete(n.internalId)})}seenEvent(n,e){const t=this.seenEvents.get(n)||[];t.push(e),this.seenEvents.set(n,t)}dispatchEvent(n,e,t=!1){e&&this.seenEvent(n.id,e);const r=this.subscriptions.values(),s=[];for(const o of r)matchFilters(o.filters,n)&&s.push(o);for(const o of s)o.eventReceived(n,e,!1,t)}},debug7=createDebug2("ndk:active-user");async function getUserRelayList(n){if(!this.autoConnectUserRelays)return;const e=await getRelayListForUser(n.pubkey,this);if(e){for(const t of e.relays){let r=this.pool.relays.get(t);r||(r=new NDKRelay(t,this.relayAuthDefaultPolicy,this),this.pool.addRelay(r))}return e}}async function setActiveUser(n){const e=this.outboxPool||this.pool;e.connectedRelays.length>0?setActiveUserConnected.call(this,n):e.once("connect",()=>{setActiveUserConnected.call(this,n)})}async function setActiveUserConnected(n){var o;const e=await getUserRelayList.call(this,n),t=[{kinds:[10006],authors:[n.pubkey]}];this.autoFetchUserMutelist&&((o=t[0].kinds)==null||o.push(1e4));const r=new Map,s=e?e.relaySet:void 0;this.subscribe(t,{subId:"active-user-settings",closeOnEose:!0,relaySet:s},{onEvent:a=>{const c=r.get(a.kind);c&&c.created_at>=a.created_at||r.set(a.kind,a)},onEose:()=>{for(const a of r.values())processEvent.call(this,a)}})}async function processEvent(n){n.kind===10006?processBlockRelayList.call(this,n):n.kind===1e4&&processMuteList.call(this,n)}function processBlockRelayList(n){const e=lists_default.from(n);for(const t of e.items)this.pool.blacklistRelayUrls.add(t[0]);debug7("Added %d relays to relay blacklist",e.items.length)}function processMuteList(n){const e=lists_default.from(n);for(const t of e.items)this.mutedIds.set(t[1],t[0]);debug7("Added %d users to mute list",e.items.length)}function getEntity(n){try{const e=nip19_exports.decode(n);return e.type==="npub"?npub(this,e.data):e.type==="nprofile"?nprofile(this,e.data):e}catch{return null}}function npub(n,e){return n.getUser({pubkey:e})}function nprofile(n,e){const t=n.getUser({pubkey:e.pubkey});return e.relays&&(t.relayUrls=e.relays),t}function isValidHint(n){if(!n||n==="")return!1;try{return new URL(n),!0}catch{return!1}}async function fetchEventFromTag(n,e,t,r={type:"timeout"}){const s=this.debug.extend("fetch-event-from-tag"),[o,a,c]=n;t={},s("fetching event from tag",n,t,r);const l=getRelaysForSync(this,e.pubkey);if(l&&l.size>0){s("fetching event from author relays %o",Array.from(l));const m=NDKRelaySet.fromRelayUrls(Array.from(l),this),k=await this.fetchEvent(a,t,m);if(k)return k}else s("no author relays found for %s",e.pubkey,e);const f=calculateRelaySetsFromFilters(this,[{ids:[a]}],this.pool);s("fetching event without relay hint",f);const h=await this.fetchEvent(a,t);if(h)return h;if(c&&c!==""){const m=await this.fetchEvent(a,t,this.pool.getRelay(c,!0,!0,[{ids:[a]}]));if(m)return m}let u;const p=isValidHint(c)?this.pool.getRelay(c,!1,!0,[{ids:[a]}]):void 0,y=new Promise(m=>{this.fetchEvent(a,t,p).then(m)});if(!isValidHint(c)||r.type==="none")return y;const b=new Promise(async m=>{const k=r.relaySet,R=r.timeout??1500,B=new Promise(D=>setTimeout(D,R));if(r.type==="timeout"&&await B,u)m(u);else{s("fallback fetch triggered");const D=await this.fetchEvent(a,t,k);m(D)}});switch(r.type){case"timeout":return Promise.race([y,b]);case"eose":return u=await y,u||b}}var Queue=class{constructor(n,e){g(this,"queue",[]);g(this,"maxConcurrency");g(this,"processing",new Set);g(this,"promises",new Map);this.maxConcurrency=e}add(n){if(this.promises.has(n.id))return this.promises.get(n.id);const e=new Promise((t,r)=>{this.queue.push({...n,func:()=>n.func().then(s=>(t(s),s),s=>{throw r(s),s})}),this.process()});return this.promises.set(n.id,e),e.finally(()=>{this.promises.delete(n.id),this.processing.delete(n.id),this.process()}),e}process(){if(this.processing.size>=this.maxConcurrency||this.queue.length===0)return;const n=this.queue.shift();!n||this.processing.has(n.id)||(this.processing.add(n.id),n.func())}clear(){this.queue=[]}clearProcessing(){this.processing.clear()}clearAll(){this.clear(),this.clearProcessing()}length(){return this.queue.length}},DEFAULT_OUTBOX_RELAYS=["wss://purplepag.es/","wss://nos.lol/"],DEFAULT_BLACKLISTED_RELAYS=["wss://brb.io/","wss://nostr.mutinywallet.com/"],NDK=class extends lib$1.EventEmitter{constructor(e={}){super();g(this,"_explicitRelayUrls");g(this,"blacklistRelayUrls");g(this,"pool");g(this,"outboxPool");g(this,"_signer");g(this,"_activeUser");g(this,"cacheAdapter");g(this,"debug");g(this,"devWriteRelaySet");g(this,"outboxTracker");g(this,"mutedIds");g(this,"clientName");g(this,"clientNip89");g(this,"queuesZapConfig");g(this,"queuesNip05");g(this,"asyncSigVerification",!1);g(this,"initialValidationRatio",1);g(this,"lowestValidationRatio",.1);g(this,"validationRatioFn");g(this,"autoBlacklistInvalidRelays",!1);g(this,"subManager");g(this,"_signatureVerificationFunction");g(this,"_signatureVerificationWorker");g(this,"signatureVerificationTimeMs",0);g(this,"publishingFailureHandled",!1);g(this,"pools",[]);g(this,"relayAuthDefaultPolicy");g(this,"httpFetch");g(this,"netDebug");g(this,"autoConnectUserRelays",!0);g(this,"autoFetchUserMutelist",!0);g(this,"walletConfig");g(this,"fetchEventFromTag",fetchEventFromTag.bind(this));g(this,"getEntity",getEntity.bind(this));this.debug=e.debug||createDebug2("ndk"),this.netDebug=e.netDebug,this._explicitRelayUrls=e.explicitRelayUrls||[],this.blacklistRelayUrls=e.blacklistRelayUrls||DEFAULT_BLACKLISTED_RELAYS,this.subManager=new NDKSubscriptionManager,this.pool=new NDKPool(e.explicitRelayUrls||[],[],this),this.pool.name="Main",this.pool.on("relay:auth",async(t,r)=>{this.relayAuthDefaultPolicy&&await this.relayAuthDefaultPolicy(t,r)}),this.autoConnectUserRelays=e.autoConnectUserRelays??!0,this.autoFetchUserMutelist=e.autoFetchUserMutelist??!0,this.clientName=e.clientName,this.clientNip89=e.clientNip89,this.relayAuthDefaultPolicy=e.relayAuthDefaultPolicy,e.enableOutboxModel&&(this.outboxPool=new NDKPool(e.outboxRelayUrls||DEFAULT_OUTBOX_RELAYS,[],this,{debug:this.debug.extend("outbox-pool"),name:"Outbox Pool"}),this.outboxTracker=new OutboxTracker(this)),this.signer=e.signer,this.cacheAdapter=e.cacheAdapter,this.mutedIds=e.mutedIds||new Map,e.devWriteRelayUrls&&(this.devWriteRelaySet=NDKRelaySet.fromRelayUrls(e.devWriteRelayUrls,this)),this.queuesZapConfig=new Queue("zaps",3),this.queuesNip05=new Queue("nip05",10),e.signatureVerificationWorker&&(this.signatureVerificationWorker=e.signatureVerificationWorker),e.signatureVerificationFunction&&(this.signatureVerificationFunction=e.signatureVerificationFunction),this.initialValidationRatio=e.initialValidationRatio||1,this.lowestValidationRatio=e.lowestValidationRatio||.1,this.autoBlacklistInvalidRelays=e.autoBlacklistInvalidRelays||!1,this.validationRatioFn=e.validationRatioFn||this.defaultValidationRatioFn;try{this.httpFetch=fetch}catch{}}set explicitRelayUrls(e){this._explicitRelayUrls=e.map(normalizeRelayUrl),this.pool.relayUrls=e}get explicitRelayUrls(){return this._explicitRelayUrls||[]}set signatureVerificationWorker(e){this._signatureVerificationWorker=e,e?(signatureVerificationInit(e),this.asyncSigVerification=!0):this.asyncSigVerification=!1}set signatureVerificationFunction(e){this._signatureVerificationFunction=e,this.asyncSigVerification=!!e}get signatureVerificationFunction(){return this._signatureVerificationFunction}addExplicitRelay(e,t,r=!0){var o;let s;return typeof e=="string"?s=new NDKRelay(e,t,this):s=e,this.pool.addRelay(s,r),(o=this.explicitRelayUrls)==null||o.push(s.url),s}toJSON(){return{relayCount:this.pool.relays.size}.toString()}get activeUser(){return this._activeUser}set activeUser(e){var r;const t=((r=this._activeUser)==null?void 0:r.pubkey)!==(e==null?void 0:e.pubkey);this._activeUser=e,e&&t?setActiveUser.call(this,e):e||(this.mutedIds=new Map)}get signer(){return this._signer}set signer(e){this._signer=e,e&&this.emit("signer:ready",e),e==null||e.user().then(t=>{t.ndk=this,this.activeUser=t})}async connect(e){var r,s;this._signer&&this.autoConnectUserRelays&&(this.debug("Attempting to connect to user relays specified by signer %o",await((s=(r=this._signer).relays)==null?void 0:s.call(r,this))),this._signer.relays&&(await this._signer.relays(this)).forEach(a=>this.pool.addRelay(a)));const t=[this.pool.connect(e)];return this.outboxPool&&t.push(this.outboxPool.connect(e)),Promise.allSettled(t).then(()=>{})}reportInvalidSignature(e,t){this.debug(`Invalid signature detected for event ${e.id}${t?` from relay ${t.url}`:""}`),this.emit("event:invalid-sig",e,t),this.autoBlacklistInvalidRelays&&t&&this.blacklistRelay(t.url)}blacklistRelay(e){if(this.blacklistRelayUrls||(this.blacklistRelayUrls=[]),!this.blacklistRelayUrls.includes(e)){this.blacklistRelayUrls.push(e),this.debug(`Added relay to blacklist: ${e}`);const t=this.pool.getRelay(e,!1,!1);t&&(t.disconnect(),this.debug(`Disconnected from blacklisted relay: ${e}`))}}defaultValidationRatioFn(e,t,r){if(t<10)return this.initialValidationRatio;const s=Math.min(t/100,1),o=this.initialValidationRatio*(1-s)+this.lowestValidationRatio*s;return Math.max(o,this.lowestValidationRatio)}getUser(e){const t=new NDKUser(e);return t.ndk=this,t}async getUserFromNip05(e,t=!1){return NDKUser.fromNip05(e,this,t)}subscribe(e,t,r=!0,s=!0){var f;let o=t==null?void 0:t.relaySet,a=s;r instanceof NDKRelaySet?(console.warn("relaySet is deprecated, use opts.relaySet instead. This will be removed in version v2.14.0"),o=r,a=s):(typeof r=="boolean"||typeof r=="object")&&(a=r);const c=new NDKSubscription(this,e,{relaySet:o,...t});this.subManager.add(c);const l=c.pool;if(c.relaySet)for(const h of c.relaySet.relays)l.useTemporaryRelay(h,void 0,c.filters);if(this.outboxPool&&c.hasAuthorsFilter()){const h=c.filters.filter(u=>{var p;return u.authors&&((p=u.authors)==null?void 0:p.length)>0}).flatMap(u=>u.authors);(f=this.outboxTracker)==null||f.trackUsers(h)}if(a){let h;typeof a=="object"&&(a.onEvent&&c.on("event",a.onEvent),a.onEose&&c.on("eose",a.onEose),a.onEvents&&(h=a.onEvents)),setTimeout(()=>{const u=c.start(!h);u&&u.length>0&&h&&h(u)},0)}return c}fetchEventSync(e){if(!this.cacheAdapter)throw new Error("Cache adapter not set");let t;typeof e=="string"?t=[filterFromId(e)]:t=e;const r=new NDKSubscription(this,t),s=this.cacheAdapter.query(r);if(s instanceof Promise)throw new Error("Cache adapter is async");return s.map(o=>(o.ndk=this,o))}async fetchEvent(e,t,r){let s,o;if(r instanceof NDKRelay?o=new NDKRelaySet(new Set([r]),this):r instanceof NDKRelaySet&&(o=r),!r&&typeof e=="string"&&!isNip33AValue(e)){const a=relaysFromBech32(e,this);a.length>0&&(o=new NDKRelaySet(new Set(a),this),o=correctRelaySet(o,this.pool))}if(typeof e=="string"?s=[filterFromId(e)]:Array.isArray(e)?s=e:s=[e],s.length===0)throw new Error(`Invalid filter: ${JSON.stringify(e)}`);return new Promise(a=>{let c=null;const l={...t||{},closeOnEose:!0};o&&(l.relaySet=o);const f=this.subscribe(s,l,!1),h=setTimeout(()=>{f.stop(),a(c)},1e4);f.on("event",u=>{u.ndk=this,u.isReplaceable()?(!c||c.created_at{clearTimeout(h),a(c)}),f.start()})}async fetchEvents(e,t,r){return new Promise(s=>{const o=new Map,a={...t||{},closeOnEose:!0};r&&(a.relaySet=r);const c=this.subscribe(e,a,!1),l=f=>{let h;f instanceof NDKEvent?h=f:h=new NDKEvent(void 0,f);const u=h.deduplicationKey(),p=o.get(u);p&&(h=dedup(p,h)),h.ndk=this,o.set(u,h)};c.on("event",l),c.on("eose",()=>{s(new Set(o.values()))}),c.start()})}assertSigner(){if(!this.signer)throw this.emit("signer:required"),new Error("Signer required")}set wallet(e){var t,r;if(!e){this.walletConfig=void 0;return}this.walletConfig??(this.walletConfig={}),this.walletConfig.lnPay=(t=e==null?void 0:e.lnPay)==null?void 0:t.bind(e),this.walletConfig.cashuPay=(r=e==null?void 0:e.cashuPay)==null?void 0:r.bind(e)}};function zapInvoiceFromEvent(n){const e=n.getMatchingTags("description")[0],t=n.getMatchingTags("bolt11")[0];let r,s;if(!e||!t||!t[1])return null;try{let b=e[1];if(b.startsWith("%")&&(b=decodeURIComponent(b)),b==="")return null;s=JSON.parse(b),r=bolt11.decode(t[1])}catch{return null}const o=r.sections.find(b=>b.name==="amount");if(!o)return null;const a=Number.parseInt(o.value);if(!a)return null;const c=s.content,l=s.pubkey,h=n.getMatchingTags("p")[0][1];let u=n.getMatchingTags("e")[0];u||(u=n.getMatchingTags("a")[0]);const p=u?u[1]:void 0;return{id:n.id,zapper:n.pubkey,zappee:l,zapped:h,zappedEvent:p,amount:a,comment:c}}var d2=createDebug2("ndk:zapper:ln");async function getNip57ZapSpecFromLud({lud06:n,lud16:e},t){let r;if(e&&!e.startsWith("LNURL")){const[s,o]=e.split("@");r=`https://${o}/.well-known/lnurlp/${s}`}else if(n){const{words:s}=bech32.decode(n,1e3),o=bech32.fromWords(s);r=new TextDecoder("utf-8").decode(o)}if(!r)throw d2("No zap endpoint found %o",{lud06:n,lud16:e}),new Error("No zap endpoint found");try{const o=await(t.httpFetch||fetch)(r);if(o.status!==200){const a=await o.text();throw new Error(`Unable to fetch zap endpoint ${r}: ${a}`)}return await o.json()}catch(s){throw new Error(`Unable to fetch zap endpoint ${r}: ${s}`)}}async function generateZapRequest(n,e,t,r,s,o,a,c,l){const f=t.callback,h=nip57_exports.makeZapRequest({profile:r,event:null,amount:s,comment:a||"",relays:o.slice(0,4)});if(n instanceof NDKEvent){const m=n.referenceTags().filter(k=>k[0]!=="p");h.tags.push(...m)}h.tags.push(["lnurl",f]);const u=new NDKEvent(e,h);c&&(u.tags=u.tags.concat(c));const p=new Set,y=new Set;for(const b of u.tags)b[0]==="e"?p.add(b[1]):b[0]==="a"&&y.add(b[1]);if(p.size>1)throw new Error("Only one e-tag is allowed");if(y.size>1)throw new Error("Only one a-tag is allowed");return u.tags=u.tags.filter(b=>b[0]!=="p"),u.tags.push(["p",r]),await u.sign(l),u}var d3=createDebug2("ndk:zapper"),NDKZapper=class extends lib$1.EventEmitter{constructor(e,t,r="msat",s={}){var o,a,c;super();g(this,"target");g(this,"ndk");g(this,"comment");g(this,"amount");g(this,"unit");g(this,"tags");g(this,"signer");g(this,"zapMethod");g(this,"nutzapAsFallback");g(this,"lnPay");g(this,"cashuPay");g(this,"onComplete");g(this,"maxRelays",3);if(this.target=e,this.ndk=s.ndk||e.ndk,!this.ndk)throw new Error("No NDK instance provided");this.amount=t,this.comment=s.comment,this.unit=r,this.tags=s.tags,this.signer=s.signer,this.nutzapAsFallback=s.nutzapAsFallback??!1,this.lnPay=s.lnPay||((o=this.ndk.walletConfig)==null?void 0:o.lnPay),this.cashuPay=s.cashuPay||((a=this.ndk.walletConfig)==null?void 0:a.cashuPay),this.onComplete=s.onComplete||((c=this.ndk.walletConfig)==null?void 0:c.onPaymentComplete)}async zap(e){const t=this.getZapSplits(),r=new Map;return await Promise.all(t.map(async s=>{let o;try{o=await this.zapSplit(s,e)}catch(a){o=new Error(a.message)}this.emit("split:complete",s,o),r.set(s,o)})),this.emit("complete",r),this.onComplete&&this.onComplete(r),r}async zapNip57(e,t){if(!this.lnPay)throw new Error("No lnPay function available");const r=await getNip57ZapSpecFromLud(t,this.ndk);if(!r)throw new Error("No zap spec available for recipient");const s=await this.relays(e.pubkey),o=await generateZapRequest(this.target,this.ndk,r,e.pubkey,e.amount,s,this.comment,this.tags,this.signer);if(!o)throw d3("Unable to generate zap request"),new Error("Unable to generate zap request");const a=await this.getLnInvoice(o,e.amount,r);if(!a)throw d3("Unable to get payment request"),new Error("Unable to get payment request");this.emit("ln_invoice",{amount:e.amount,recipientPubkey:e.pubkey,unit:this.unit,nip57ZapRequest:o,pr:a,type:"nip57"});const c=await this.lnPay({target:this.target,recipientPubkey:e.pubkey,paymentDescription:"NIP-57 Zap",pr:a,amount:e.amount,unit:this.unit,nip57ZapRequest:o});return c!=null&&c.preimage&&this.emit("ln_payment",{preimage:c.preimage,amount:e.amount,recipientPubkey:e.pubkey,pr:a,unit:this.unit,nip57ZapRequest:o,type:"nip57"}),c}async zapNip61(e,t){if(!this.cashuPay)throw new Error("No cashuPay function available");let r;if(r=await this.cashuPay({target:this.target,recipientPubkey:e.pubkey,paymentDescription:"NIP-61 Zap",amount:e.amount,unit:this.unit,...t??{}},s=>{this.emit("ln_invoice",{pr:s,amount:e.amount,recipientPubkey:e.pubkey,unit:this.unit,type:"nip61"})}),d3("NIP-61 Zap result: %o",r),r instanceof Error)return r;if(r){const{proofs:s,mint:o}=r;if(!s||!o)throw new Error(`Invalid zap confirmation: missing proofs or mint: ${r}`);const a=await this.relays(e.pubkey),c=NDKRelaySet.fromRelayUrls(a,this.ndk),l=new NDKNutzap(this.ndk);return l.tags=[...l.tags,...this.tags||[]],l.proofs=s,l.mint=o,l.target=this.target,l.comment=this.comment,l.unit="sat",l.recipientPubkey=e.pubkey,await l.sign(this.signer),l.publish(c),l}}async zapSplit(e,t){const s=await this.ndk.getUser({pubkey:e.pubkey}).getZapInfo(2500);let o;const a=this.nutzapAsFallback&&this.cashuPay;if(s.size===0&&!a)throw new Error("No zap method available for recipient and NIP-61 fallback is disabled");const c=async()=>{var b;if(!this.nutzapAsFallback)return;let y=(b=(await getRelayListForUsers([e.pubkey],this.ndk)).get(e.pubkey))==null?void 0:b.readRelayUrls;return y=this.ndk.pool.connectedRelays().map(m=>m.url),await this.zapNip61(e,{relays:y,p2pk:e.pubkey,allowIntramintFallback:!!a})},l=!t||t.includes("nip61"),f=!t||t.includes("nip57"),h=s.get("nip61");if(h&&l)try{if(o=await this.zapNip61(e,h),o instanceof NDKNutzap)return o}catch(p){this.emit("notice",`NIP-61 attempt failed: ${p.message}`)}const u=s.get("nip57");if(u&&f)try{if(o=await this.zapNip57(e,u),!(o instanceof Error))return o}catch(p){this.emit("notice",`NIP-57 attempt failed: ${p.message}`)}if(a){if(o=await c(),o instanceof Error)throw o;return o}if(this.emit("notice","Zap methods exhausted and there was no fallback to NIP-61"),o instanceof Error)throw o;return o}async getLnInvoice(e,t,r){const s=r.callback,o=JSON.stringify(e.rawEvent());d3(`Fetching invoice from ${s}?${new URLSearchParams({amount:t.toString(),nostr:o})}`);const a=new URL(s);a.searchParams.append("amount",t.toString()),a.searchParams.append("nostr",o),d3(`Fetching invoice from ${a.toString()}`);const c=await fetch(a.toString());if(d3(`Got response from zap endpoint: ${s}`,{status:c.status}),c.status!==200){d3(`Received non-200 status from zap endpoint: ${s}`,{status:c.status,amount:t,nostr:o});const f=await c.text();throw new Error(`Unable to fetch zap endpoint ${s}: ${f}`)}return(await c.json()).pr}getZapSplits(){if(this.target instanceof NDKUser)return[{pubkey:this.target.pubkey,amount:this.amount}];const e=this.target.getMatchingTags("zap");if(e.length===0)return[{pubkey:this.target.pubkey,amount:this.amount}];const t=[],r=e.reduce((s,o)=>s+Number.parseInt(o[2]),0);for(const s of e){const o=s[1],a=Math.floor(Number.parseInt(s[2])/r*this.amount);t.push({pubkey:o,amount:a})}return t}async getZapMethods(e,t,r=2500){return await e.getUser({pubkey:t}).getZapInfo(r)}async relays(e){var r,s,o;let t=[];if((r=this.ndk)!=null&&r.activeUser){const a=await getRelayListForUsers([this.ndk.activeUser.pubkey,e],this.ndk),c=new Map;for(const l of a.values())for(const f of l.readRelayUrls){const h=c.get(f)||0;c.set(f,h+1)}t=Array.from(c.entries()).sort((l,f)=>f[1]-l[1]).map(([l])=>l).slice(0,this.maxRelays)}return(o=(s=this.ndk)==null?void 0:s.pool)!=null&&o.permanentAndConnectedRelays().length&&(t=this.ndk.pool.permanentAndConnectedRelays().map(a=>a.url)),t.length||(t=[]),t}};function matchFilter(n,e){var t;if(n.ids&&n.ids.indexOf(e.id)===-1||n.kinds&&n.kinds.indexOf(e.kind)===-1||n.authors&&n.authors.indexOf(e.pubkey)===-1)return!1;for(const r in n)if(r[0]==="#"){const s=r.slice(1);if(s==="t"){const o=(t=n[`#${s}`])==null?void 0:t.map(a=>a.toLowerCase());if(o&&!e.tags.find(([a,c])=>a===s&&(o==null?void 0:o.indexOf(c.toLowerCase()))!==-1))return!1}else{const o=n[`#${s}`];if(o&&!e.tags.find(([a,c])=>a===s&&(o==null?void 0:o.indexOf(c))!==-1))return!1}}return!(n.since&&e.created_atn.until)}const index=Object.freeze(Object.defineProperty({__proto__:null,BECH32_REGEX,NDKAppHandlerEvent,NDKAppSettings,NDKArticle,NDKBlossomList,NDKCashuMintList,NDKCashuToken,NDKCashuWalletTx,NDKClassified,NDKDVMJobFeedback,NDKDVMJobResult,NDKDVMRequest,NDKDraft,NDKDvmJobFeedbackStatus,NDKEvent,NDKFollowPack,NDKHighlight,NDKImage,NDKKind,NDKList,NDKListKinds,NDKNip07Signer,NDKNip46Backend,NDKNip46Signer,NDKNostrRpc,NDKNutzap,NDKPool,NDKPrivateKeySigner,NDKProject,NDKProjectTemplate,NDKPublishError,NDKRelay,NDKRelayAuthPolicies,NDKRelayList,NDKRelaySet,NDKRelayStatus,NDKRepost,NDKSimpleGroup,NDKSimpleGroupMemberList,NDKSimpleGroupMetadata,NDKStory,NDKStorySticker,NDKStoryStickerType,NDKSubscription,NDKSubscriptionCacheUsage,NDKSubscriptionReceipt,NDKSubscriptionStart,NDKSubscriptionTier,NDKTask,NDKThread,NDKTranscriptionDVM,NDKUser,NDKVideo,NDKWiki,NDKWikiMergeRequest,NDKZapper,NIP33_A_REGEX,NdkNutzapStatus,SignatureVerificationStats,assertSignedEvent,calculateRelaySetFromEvent,calculateTermDurationInSeconds,cashuPubkeyToNostrPubkey,compareFilter,createSignedEvent,default:NDK,defaultOpts,deserialize,dvmSchedule,eventHasETagMarkers,eventIsPartOfThread,eventIsReply,eventReplies,eventThreadIds,eventThreads,eventsBySameAuthor,filterAndRelaySetFromBech32,filterFingerprint,filterForEventsTaggingId,filterFromId,generateContentTags,generateHashtags,generateSubId,generateZapRequest,getEventReplyId,getNip57ZapSpecFromLud,getRegisteredEventClasses,getRelayListForUser,getRelayListForUsers,getReplyTag,getRootEventId,getRootTag,giftUnwrap,giftWrap,imetaTagToTag,isEventOriginalPost,isNip33AValue,isSignedEvent,isUnsignedEvent,mapImetaTag,matchFilter,mergeFilters,mergeTags,ndkSignerFromPayload,newAmount,normalize,normalizeRelayUrl,normalizeUrl,parseTagToSubscriptionAmount,pinEvent,possibleIntervalFrequencies,profileFromEvent,proofP2pk,proofP2pkNostr,proofsTotalBalance,queryFullyFilled,registerEventClass,registerSigner,relayListFromKind3,relaysFromBech32,serialize,serializeProfile,startSignatureVerificationStats,strToDimension,strToPosition,tryNormalizeRelayUrl,uniqueTag,unregisterEventClass,wrapEvent,zapInvoiceFromEvent},Symbol.toStringTag,{value:"Module"}));export{NDKEvent as N,createDebug2 as a,dist as b,commonjsGlobal as c,deserialize as d,NDK as e,getPublicKey as f,getDefaultExportFromCjs as g,NDKPrivateKeySigner as h,generateSecretKey as i,index as j,matchFilter$1 as m,nip19_exports as n,profileFromEvent as p}; diff --git a/dist/assets/vendor-beb84f6c.js b/dist/assets/vendor-beb84f6c.js new file mode 100644 index 0000000..93ddaaa --- /dev/null +++ b/dist/assets/vendor-beb84f6c.js @@ -0,0 +1,59 @@ +import{g as Dc}from"./ndk-40656944.js";function Fc(e,t){for(var n=0;nr[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var ps={exports:{}},T={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var tr=Symbol.for("react.element"),Uc=Symbol.for("react.portal"),jc=Symbol.for("react.fragment"),$c=Symbol.for("react.strict_mode"),Bc=Symbol.for("react.profiler"),Vc=Symbol.for("react.provider"),Ac=Symbol.for("react.context"),Wc=Symbol.for("react.forward_ref"),Hc=Symbol.for("react.suspense"),Qc=Symbol.for("react.memo"),Kc=Symbol.for("react.lazy"),Zo=Symbol.iterator;function Yc(e){return e===null||typeof e!="object"?null:(e=Zo&&e[Zo]||e["@@iterator"],typeof e=="function"?e:null)}var hs={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ms=Object.assign,vs={};function an(e,t,n){this.props=e,this.context=t,this.refs=vs,this.updater=n||hs}an.prototype.isReactComponent={};an.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};an.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function ys(){}ys.prototype=an.prototype;function qi(e,t,n){this.props=e,this.context=t,this.refs=vs,this.updater=n||hs}var bi=qi.prototype=new ys;bi.constructor=qi;ms(bi,an.prototype);bi.isPureReactComponent=!0;var Jo=Array.isArray,gs=Object.prototype.hasOwnProperty,eo={current:null},ws={key:!0,ref:!0,__self:!0,__source:!0};function Ss(e,t,n){var r,l={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)gs.call(t,r)&&!ws.hasOwnProperty(r)&&(l[r]=t[r]);var u=arguments.length-2;if(u===1)l.children=n;else if(1>>1,Z=x[H];if(0>>1;Hl(Ll,R))Stl(sr,Ll)?(x[H]=sr,x[St]=R,H=St):(x[H]=Ll,x[wt]=R,H=wt);else if(Stl(sr,R))x[H]=sr,x[St]=R,H=St;else break e}}return L}function l(x,L){var R=x.sortIndex-L.sortIndex;return R!==0?R:x.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,u=o.now();e.unstable_now=function(){return o.now()-u}}var s=[],a=[],h=1,p=null,m=3,y=!1,g=!1,w=!1,E=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function d(x){for(var L=n(a);L!==null;){if(L.callback===null)r(a);else if(L.startTime<=x)r(a),L.sortIndex=L.expirationTime,t(s,L);else break;L=n(a)}}function v(x){if(w=!1,d(x),!g)if(n(s)!==null)g=!0,Nl(k);else{var L=n(a);L!==null&&zl(v,L.startTime-x)}}function k(x,L){g=!1,w&&(w=!1,f(z),z=-1),y=!0;var R=m;try{for(d(L),p=n(s);p!==null&&(!(p.expirationTime>L)||x&&!Ne());){var H=p.callback;if(typeof H=="function"){p.callback=null,m=p.priorityLevel;var Z=H(p.expirationTime<=L);L=e.unstable_now(),typeof Z=="function"?p.callback=Z:p===n(s)&&r(s),d(L)}else r(s);p=n(s)}if(p!==null)var ur=!0;else{var wt=n(a);wt!==null&&zl(v,wt.startTime-L),ur=!1}return ur}finally{p=null,m=R,y=!1}}var P=!1,N=null,z=-1,W=5,O=-1;function Ne(){return!(e.unstable_now()-Ox||125H?(x.sortIndex=R,t(a,x),n(s)===null&&x===n(a)&&(w?(f(z),z=-1):w=!0,zl(v,R-H))):(x.sortIndex=Z,t(s,x),g||y||(g=!0,Nl(k))),x},e.unstable_shouldYield=Ne,e.unstable_wrapCallback=function(x){var L=m;return function(){var R=m;m=L;try{return x.apply(this,arguments)}finally{m=R}}}})(xs);Cs.exports=xs;var ef=Cs.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var tf=_,ge=ef;function S(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ri=Object.prototype.hasOwnProperty,nf=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,bo={},eu={};function rf(e){return ri.call(eu,e)?!0:ri.call(bo,e)?!1:nf.test(e)?eu[e]=!0:(bo[e]=!0,!1)}function lf(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function of(e,t,n,r){if(t===null||typeof t>"u"||lf(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function ae(e,t,n,r,l,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var te={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){te[e]=new ae(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];te[t]=new ae(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){te[e]=new ae(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){te[e]=new ae(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){te[e]=new ae(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){te[e]=new ae(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){te[e]=new ae(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){te[e]=new ae(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){te[e]=new ae(e,5,!1,e.toLowerCase(),null,!1,!1)});var no=/[\-:]([a-z])/g;function ro(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(no,ro);te[t]=new ae(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(no,ro);te[t]=new ae(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(no,ro);te[t]=new ae(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){te[e]=new ae(e,1,!1,e.toLowerCase(),null,!1,!1)});te.xlinkHref=new ae("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){te[e]=new ae(e,1,!1,e.toLowerCase(),null,!0,!0)});function lo(e,t,n,r){var l=te.hasOwnProperty(t)?te[t]:null;(l!==null?l.type!==0:r||!(2u||l[o]!==i[u]){var s=` +`+l[o].replace(" at new "," at ");return e.displayName&&s.includes("")&&(s=s.replace("",e.displayName)),s}while(1<=o&&0<=u);break}}}finally{Ol=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Cn(e):""}function uf(e){switch(e.tag){case 5:return Cn(e.type);case 16:return Cn("Lazy");case 13:return Cn("Suspense");case 19:return Cn("SuspenseList");case 0:case 2:case 15:return e=Ml(e.type,!1),e;case 11:return e=Ml(e.type.render,!1),e;case 1:return e=Ml(e.type,!0),e;default:return""}}function ui(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case jt:return"Fragment";case Ut:return"Portal";case li:return"Profiler";case io:return"StrictMode";case ii:return"Suspense";case oi:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ns:return(e.displayName||"Context")+".Consumer";case Ps:return(e._context.displayName||"Context")+".Provider";case oo:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case uo:return t=e.displayName||null,t!==null?t:ui(e.type)||"Memo";case Je:t=e._payload,e=e._init;try{return ui(e(t))}catch{}}return null}function sf(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ui(t);case 8:return t===io?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function pt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ls(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function af(e){var t=Ls(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function fr(e){e._valueTracker||(e._valueTracker=af(e))}function Rs(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Ls(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function jr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function si(e,t){var n=t.checked;return V({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function nu(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=pt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Ts(e,t){t=t.checked,t!=null&&lo(e,"checked",t,!1)}function ai(e,t){Ts(e,t);var n=pt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ci(e,t.type,n):t.hasOwnProperty("defaultValue")&&ci(e,t.type,pt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ru(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function ci(e,t,n){(t!=="number"||jr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var xn=Array.isArray;function Gt(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=dr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Un(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Nn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},cf=["Webkit","ms","Moz","O"];Object.keys(Nn).forEach(function(e){cf.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Nn[t]=Nn[e]})});function Ds(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Nn.hasOwnProperty(e)&&Nn[e]?(""+t).trim():t+"px"}function Fs(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Ds(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var ff=V({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function pi(e,t){if(t){if(ff[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(S(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(S(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(S(61))}if(t.style!=null&&typeof t.style!="object")throw Error(S(62))}}function hi(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var mi=null;function so(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var vi=null,Zt=null,Jt=null;function ou(e){if(e=lr(e)){if(typeof vi!="function")throw Error(S(280));var t=e.stateNode;t&&(t=hl(t),vi(e.stateNode,e.type,t))}}function Us(e){Zt?Jt?Jt.push(e):Jt=[e]:Zt=e}function js(){if(Zt){var e=Zt,t=Jt;if(Jt=Zt=null,ou(e),t)for(e=0;e>>=0,e===0?32:31-(Ef(e)/Cf|0)|0}var pr=64,hr=4194304;function _n(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ar(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var u=o&~l;u!==0?r=_n(u):(i&=o,i!==0&&(r=_n(i)))}else o=n&~l,o!==0?r=_n(o):i!==0&&(r=_n(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function nr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Oe(t),e[t]=n}function Nf(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Ln),mu=String.fromCharCode(32),vu=!1;function la(e,t){switch(e){case"keyup":return td.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ia(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var $t=!1;function rd(e,t){switch(e){case"compositionend":return ia(t);case"keypress":return t.which!==32?null:(vu=!0,mu);case"textInput":return e=t.data,e===mu&&vu?null:e;default:return null}}function ld(e,t){if($t)return e==="compositionend"||!yo&&la(e,t)?(e=na(),Lr=ho=tt=null,$t=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Su(n)}}function aa(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?aa(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ca(){for(var e=window,t=jr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=jr(e.document)}return t}function go(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function pd(e){var t=ca(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&aa(n.ownerDocument.documentElement,n)){if(r!==null&&go(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,i=Math.min(r.start,l);r=r.end===void 0?i:Math.min(r.end,l),!e.extend&&i>r&&(l=r,r=i,i=l),l=ku(n,i);var o=ku(n,r);l&&o&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Bt=null,Ei=null,Tn=null,Ci=!1;function Eu(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ci||Bt==null||Bt!==jr(r)||(r=Bt,"selectionStart"in r&&go(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Tn&&Wn(Tn,r)||(Tn=r,r=Qr(Ei,"onSelect"),0Wt||(e.current=Li[Wt],Li[Wt]=null,Wt--)}function D(e,t){Wt++,Li[Wt]=e.current,e.current=t}var ht={},ie=vt(ht),de=vt(!1),zt=ht;function nn(e,t){var n=e.type.contextTypes;if(!n)return ht;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in n)l[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function pe(e){return e=e.childContextTypes,e!=null}function Yr(){U(de),U(ie)}function Lu(e,t,n){if(ie.current!==ht)throw Error(S(168));D(ie,t),D(de,n)}function wa(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(S(108,sf(e)||"Unknown",l));return V({},n,r)}function Xr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ht,zt=ie.current,D(ie,e),D(de,de.current),!0}function Ru(e,t,n){var r=e.stateNode;if(!r)throw Error(S(169));n?(e=wa(e,t,zt),r.__reactInternalMemoizedMergedChildContext=e,U(de),U(ie),D(ie,e)):U(de),D(de,n)}var Ve=null,ml=!1,Yl=!1;function Sa(e){Ve===null?Ve=[e]:Ve.push(e)}function _d(e){ml=!0,Sa(e)}function yt(){if(!Yl&&Ve!==null){Yl=!0;var e=0,t=I;try{var n=Ve;for(I=1;e>=o,l-=o,Ae=1<<32-Oe(t)+l|n<z?(W=N,N=null):W=N.sibling;var O=m(f,N,d[z],v);if(O===null){N===null&&(N=W);break}e&&N&&O.alternate===null&&t(f,N),c=i(O,c,z),P===null?k=O:P.sibling=O,P=O,N=W}if(z===d.length)return n(f,N),j&&kt(f,z),k;if(N===null){for(;zz?(W=N,N=null):W=N.sibling;var Ne=m(f,N,O.value,v);if(Ne===null){N===null&&(N=W);break}e&&N&&Ne.alternate===null&&t(f,N),c=i(Ne,c,z),P===null?k=Ne:P.sibling=Ne,P=Ne,N=W}if(O.done)return n(f,N),j&&kt(f,z),k;if(N===null){for(;!O.done;z++,O=d.next())O=p(f,O.value,v),O!==null&&(c=i(O,c,z),P===null?k=O:P.sibling=O,P=O);return j&&kt(f,z),k}for(N=r(f,N);!O.done;z++,O=d.next())O=y(N,f,z,O.value,v),O!==null&&(e&&O.alternate!==null&&N.delete(O.key===null?z:O.key),c=i(O,c,z),P===null?k=O:P.sibling=O,P=O);return e&&N.forEach(function(pn){return t(f,pn)}),j&&kt(f,z),k}function E(f,c,d,v){if(typeof d=="object"&&d!==null&&d.type===jt&&d.key===null&&(d=d.props.children),typeof d=="object"&&d!==null){switch(d.$$typeof){case cr:e:{for(var k=d.key,P=c;P!==null;){if(P.key===k){if(k=d.type,k===jt){if(P.tag===7){n(f,P.sibling),c=l(P,d.props.children),c.return=f,f=c;break e}}else if(P.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Je&&Mu(k)===P.type){n(f,P.sibling),c=l(P,d.props),c.ref=Sn(f,P,d),c.return=f,f=c;break e}n(f,P);break}else t(f,P);P=P.sibling}d.type===jt?(c=Nt(d.props.children,f.mode,v,d.key),c.return=f,f=c):(v=Ur(d.type,d.key,d.props,null,f.mode,v),v.ref=Sn(f,c,d),v.return=f,f=v)}return o(f);case Ut:e:{for(P=d.key;c!==null;){if(c.key===P)if(c.tag===4&&c.stateNode.containerInfo===d.containerInfo&&c.stateNode.implementation===d.implementation){n(f,c.sibling),c=l(c,d.children||[]),c.return=f,f=c;break e}else{n(f,c);break}else t(f,c);c=c.sibling}c=ti(d,f.mode,v),c.return=f,f=c}return o(f);case Je:return P=d._init,E(f,c,P(d._payload),v)}if(xn(d))return g(f,c,d,v);if(mn(d))return w(f,c,d,v);kr(f,d)}return typeof d=="string"&&d!==""||typeof d=="number"?(d=""+d,c!==null&&c.tag===6?(n(f,c.sibling),c=l(c,d),c.return=f,f=c):(n(f,c),c=ei(d,f.mode,v),c.return=f,f=c),o(f)):n(f,c)}return E}var ln=xa(!0),_a=xa(!1),Jr=vt(null),qr=null,Kt=null,Eo=null;function Co(){Eo=Kt=qr=null}function xo(e){var t=Jr.current;U(Jr),e._currentValue=t}function Oi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function bt(e,t){qr=e,Eo=Kt=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(fe=!0),e.firstContext=null)}function _e(e){var t=e._currentValue;if(Eo!==e)if(e={context:e,memoizedValue:t,next:null},Kt===null){if(qr===null)throw Error(S(308));Kt=e,qr.dependencies={lanes:0,firstContext:e}}else Kt=Kt.next=e;return t}var xt=null;function _o(e){xt===null?xt=[e]:xt.push(e)}function Pa(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,_o(t)):(n.next=l.next,l.next=n),t.interleaved=n,Ye(e,r)}function Ye(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var qe=!1;function Po(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Na(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function He(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function st(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,M&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Ye(e,n)}return l=r.interleaved,l===null?(t.next=t,_o(r)):(t.next=l.next,l.next=t),r.interleaved=t,Ye(e,n)}function Tr(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,co(e,n)}}function Iu(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?l=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?l=i=t:i=i.next=t}else l=i=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function br(e,t,n,r){var l=e.updateQueue;qe=!1;var i=l.firstBaseUpdate,o=l.lastBaseUpdate,u=l.shared.pending;if(u!==null){l.shared.pending=null;var s=u,a=s.next;s.next=null,o===null?i=a:o.next=a,o=s;var h=e.alternate;h!==null&&(h=h.updateQueue,u=h.lastBaseUpdate,u!==o&&(u===null?h.firstBaseUpdate=a:u.next=a,h.lastBaseUpdate=s))}if(i!==null){var p=l.baseState;o=0,h=a=s=null,u=i;do{var m=u.lane,y=u.eventTime;if((r&m)===m){h!==null&&(h=h.next={eventTime:y,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var g=e,w=u;switch(m=t,y=n,w.tag){case 1:if(g=w.payload,typeof g=="function"){p=g.call(y,p,m);break e}p=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=w.payload,m=typeof g=="function"?g.call(y,p,m):g,m==null)break e;p=V({},p,m);break e;case 2:qe=!0}}u.callback!==null&&u.lane!==0&&(e.flags|=64,m=l.effects,m===null?l.effects=[u]:m.push(u))}else y={eventTime:y,lane:m,tag:u.tag,payload:u.payload,callback:u.callback,next:null},h===null?(a=h=y,s=p):h=h.next=y,o|=m;if(u=u.next,u===null){if(u=l.shared.pending,u===null)break;m=u,u=m.next,m.next=null,l.lastBaseUpdate=m,l.shared.pending=null}}while(1);if(h===null&&(s=p),l.baseState=s,l.firstBaseUpdate=a,l.lastBaseUpdate=h,t=l.shared.interleaved,t!==null){l=t;do o|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);Tt|=o,e.lanes=o,e.memoizedState=p}}function Du(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Gl.transition;Gl.transition={};try{e(!1),t()}finally{I=n,Gl.transition=r}}function Ha(){return Pe().memoizedState}function Ld(e,t,n){var r=ct(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Qa(e))Ka(t,n);else if(n=Pa(e,t,n,r),n!==null){var l=ue();Me(n,e,r,l),Ya(n,t,r)}}function Rd(e,t,n){var r=ct(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Qa(e))Ka(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,u=i(o,n);if(l.hasEagerState=!0,l.eagerState=u,Ie(u,o)){var s=t.interleaved;s===null?(l.next=l,_o(t)):(l.next=s.next,s.next=l),t.interleaved=l;return}}catch{}finally{}n=Pa(e,t,l,r),n!==null&&(l=ue(),Me(n,e,r,l),Ya(n,t,r))}}function Qa(e){var t=e.alternate;return e===B||t!==null&&t===B}function Ka(e,t){On=tl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ya(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,co(e,n)}}var nl={readContext:_e,useCallback:ne,useContext:ne,useEffect:ne,useImperativeHandle:ne,useInsertionEffect:ne,useLayoutEffect:ne,useMemo:ne,useReducer:ne,useRef:ne,useState:ne,useDebugValue:ne,useDeferredValue:ne,useTransition:ne,useMutableSource:ne,useSyncExternalStore:ne,useId:ne,unstable_isNewReconciler:!1},Td={readContext:_e,useCallback:function(e,t){return Fe().memoizedState=[e,t===void 0?null:t],e},useContext:_e,useEffect:Uu,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Mr(4194308,4,$a.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Mr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Mr(4,2,e,t)},useMemo:function(e,t){var n=Fe();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Fe();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Ld.bind(null,B,e),[r.memoizedState,e]},useRef:function(e){var t=Fe();return e={current:e},t.memoizedState=e},useState:Fu,useDebugValue:Io,useDeferredValue:function(e){return Fe().memoizedState=e},useTransition:function(){var e=Fu(!1),t=e[0];return e=zd.bind(null,e[1]),Fe().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=B,l=Fe();if(j){if(n===void 0)throw Error(S(407));n=n()}else{if(n=t(),q===null)throw Error(S(349));Rt&30||Ta(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Uu(Ma.bind(null,r,i,e),[e]),r.flags|=2048,Jn(9,Oa.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Fe(),t=q.identifierPrefix;if(j){var n=We,r=Ae;n=(r&~(1<<32-Oe(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Gn++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Ue]=t,e[Kn]=r,rc(e,t,!1,!1),t.stateNode=e;e:{switch(o=hi(n,r),n){case"dialog":F("cancel",e),F("close",e),l=r;break;case"iframe":case"object":case"embed":F("load",e),l=r;break;case"video":case"audio":for(l=0;lsn&&(t.flags|=128,r=!0,kn(i,!1),t.lanes=4194304)}else{if(!r)if(e=el(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),kn(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!j)return re(t),null}else 2*Q()-i.renderingStartTime>sn&&n!==1073741824&&(t.flags|=128,r=!0,kn(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Q(),t.sibling=null,n=$.current,D($,r?n&1|2:n&1),t):(re(t),null);case 22:case 23:return Bo(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?me&1073741824&&(re(t),t.subtreeFlags&6&&(t.flags|=8192)):re(t),null;case 24:return null;case 25:return null}throw Error(S(156,t.tag))}function $d(e,t){switch(So(t),t.tag){case 1:return pe(t.type)&&Yr(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return on(),U(de),U(ie),Lo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return zo(t),null;case 13:if(U($),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(S(340));rn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return U($),null;case 4:return on(),null;case 10:return xo(t.type._context),null;case 22:case 23:return Bo(),null;case 24:return null;default:return null}}var Cr=!1,le=!1,Bd=typeof WeakSet=="function"?WeakSet:Set,C=null;function Yt(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){A(e,t,r)}else n.current=null}function Vi(e,t,n){try{n()}catch(r){A(e,t,r)}}var Xu=!1;function Vd(e,t){if(xi=Wr,e=ca(),go(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,u=-1,s=-1,a=0,h=0,p=e,m=null;t:for(;;){for(var y;p!==n||l!==0&&p.nodeType!==3||(u=o+l),p!==i||r!==0&&p.nodeType!==3||(s=o+r),p.nodeType===3&&(o+=p.nodeValue.length),(y=p.firstChild)!==null;)m=p,p=y;for(;;){if(p===e)break t;if(m===n&&++a===l&&(u=o),m===i&&++h===r&&(s=o),(y=p.nextSibling)!==null)break;p=m,m=p.parentNode}p=y}n=u===-1||s===-1?null:{start:u,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(_i={focusedElem:e,selectionRange:n},Wr=!1,C=t;C!==null;)if(t=C,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,C=e;else for(;C!==null;){t=C;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var w=g.memoizedProps,E=g.memoizedState,f=t.stateNode,c=f.getSnapshotBeforeUpdate(t.elementType===t.type?w:Le(t.type,w),E);f.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var d=t.stateNode.containerInfo;d.nodeType===1?d.textContent="":d.nodeType===9&&d.documentElement&&d.removeChild(d.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(S(163))}}catch(v){A(t,t.return,v)}if(e=t.sibling,e!==null){e.return=t.return,C=e;break}C=t.return}return g=Xu,Xu=!1,g}function Mn(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&Vi(t,n,i)}l=l.next}while(l!==r)}}function gl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Ai(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function oc(e){var t=e.alternate;t!==null&&(e.alternate=null,oc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ue],delete t[Kn],delete t[zi],delete t[Cd],delete t[xd])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function uc(e){return e.tag===5||e.tag===3||e.tag===4}function Gu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||uc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Wi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Kr));else if(r!==4&&(e=e.child,e!==null))for(Wi(e,t,n),e=e.sibling;e!==null;)Wi(e,t,n),e=e.sibling}function Hi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Hi(e,t,n),e=e.sibling;e!==null;)Hi(e,t,n),e=e.sibling}var b=null,Re=!1;function Ze(e,t,n){for(n=n.child;n!==null;)sc(e,t,n),n=n.sibling}function sc(e,t,n){if(je&&typeof je.onCommitFiberUnmount=="function")try{je.onCommitFiberUnmount(cl,n)}catch{}switch(n.tag){case 5:le||Yt(n,t);case 6:var r=b,l=Re;b=null,Ze(e,t,n),b=r,Re=l,b!==null&&(Re?(e=b,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):b.removeChild(n.stateNode));break;case 18:b!==null&&(Re?(e=b,n=n.stateNode,e.nodeType===8?Kl(e.parentNode,n):e.nodeType===1&&Kl(e,n),Vn(e)):Kl(b,n.stateNode));break;case 4:r=b,l=Re,b=n.stateNode.containerInfo,Re=!0,Ze(e,t,n),b=r,Re=l;break;case 0:case 11:case 14:case 15:if(!le&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Vi(n,t,o),l=l.next}while(l!==r)}Ze(e,t,n);break;case 1:if(!le&&(Yt(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){A(n,t,u)}Ze(e,t,n);break;case 21:Ze(e,t,n);break;case 22:n.mode&1?(le=(r=le)||n.memoizedState!==null,Ze(e,t,n),le=r):Ze(e,t,n);break;default:Ze(e,t,n)}}function Zu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Bd),t.forEach(function(r){var l=Zd.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function ze(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=o),r&=~i}if(r=l,r=Q()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Wd(r/1960))-r,10e?16:e,nt===null)var r=!1;else{if(e=nt,nt=null,il=0,M&6)throw Error(S(331));var l=M;for(M|=4,C=e.current;C!==null;){var i=C,o=i.child;if(C.flags&16){var u=i.deletions;if(u!==null){for(var s=0;sQ()-jo?Pt(e,0):Uo|=n),he(e,t)}function vc(e,t){t===0&&(e.mode&1?(t=hr,hr<<=1,!(hr&130023424)&&(hr=4194304)):t=1);var n=ue();e=Ye(e,t),e!==null&&(nr(e,t,n),he(e,n))}function Gd(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),vc(e,n)}function Zd(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(S(314))}r!==null&&r.delete(t),vc(e,n)}var yc;yc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||de.current)fe=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return fe=!1,Ud(e,t,n);fe=!!(e.flags&131072)}else fe=!1,j&&t.flags&1048576&&ka(t,Zr,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ir(e,t),e=t.pendingProps;var l=nn(t,ie.current);bt(t,n),l=To(null,t,r,e,l,n);var i=Oo();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,pe(r)?(i=!0,Xr(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Po(t),l.updater=yl,t.stateNode=l,l._reactInternals=t,Ii(t,r,e,n),t=Ui(null,t,r,!0,i,n)):(t.tag=0,j&&i&&wo(t),oe(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ir(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=qd(r),e=Le(r,e),l){case 0:t=Fi(null,t,r,e,n);break e;case 1:t=Qu(null,t,r,e,n);break e;case 11:t=Wu(null,t,r,e,n);break e;case 14:t=Hu(null,t,r,Le(r.type,e),n);break e}throw Error(S(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Le(r,l),Fi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Le(r,l),Qu(e,t,r,l,n);case 3:e:{if(ec(t),e===null)throw Error(S(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Na(e,t),br(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=un(Error(S(423)),t),t=Ku(e,t,r,n,l);break e}else if(r!==l){l=un(Error(S(424)),t),t=Ku(e,t,r,n,l);break e}else for(ve=ut(t.stateNode.containerInfo.firstChild),ye=t,j=!0,Te=null,n=_a(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(rn(),r===l){t=Xe(e,t,n);break e}oe(e,t,r,n)}t=t.child}return t;case 5:return za(t),e===null&&Ti(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,o=l.children,Pi(r,l)?o=null:i!==null&&Pi(r,i)&&(t.flags|=32),ba(e,t),oe(e,t,o,n),t.child;case 6:return e===null&&Ti(t),null;case 13:return tc(e,t,n);case 4:return No(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ln(t,null,r,n):oe(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Le(r,l),Wu(e,t,r,l,n);case 7:return oe(e,t,t.pendingProps,n),t.child;case 8:return oe(e,t,t.pendingProps.children,n),t.child;case 12:return oe(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,o=l.value,D(Jr,r._currentValue),r._currentValue=o,i!==null)if(Ie(i.value,o)){if(i.children===l.children&&!de.current){t=Xe(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var u=i.dependencies;if(u!==null){o=i.child;for(var s=u.firstContext;s!==null;){if(s.context===r){if(i.tag===1){s=He(-1,n&-n),s.tag=2;var a=i.updateQueue;if(a!==null){a=a.shared;var h=a.pending;h===null?s.next=s:(s.next=h.next,h.next=s),a.pending=s}}i.lanes|=n,s=i.alternate,s!==null&&(s.lanes|=n),Oi(i.return,n,t),u.lanes|=n;break}s=s.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(S(341));o.lanes|=n,u=o.alternate,u!==null&&(u.lanes|=n),Oi(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}oe(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,bt(t,n),l=_e(l),r=r(l),t.flags|=1,oe(e,t,r,n),t.child;case 14:return r=t.type,l=Le(r,t.pendingProps),l=Le(r.type,l),Hu(e,t,r,l,n);case 15:return Ja(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Le(r,l),Ir(e,t),t.tag=1,pe(r)?(e=!0,Xr(t)):e=!1,bt(t,n),Xa(t,r,l),Ii(t,r,l,n),Ui(null,t,r,!0,e,n);case 19:return nc(e,t,n);case 22:return qa(e,t,n)}throw Error(S(156,t.tag))};function gc(e,t){return Qs(e,t)}function Jd(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ce(e,t,n,r){return new Jd(e,t,n,r)}function Ao(e){return e=e.prototype,!(!e||!e.isReactComponent)}function qd(e){if(typeof e=="function")return Ao(e)?1:0;if(e!=null){if(e=e.$$typeof,e===oo)return 11;if(e===uo)return 14}return 2}function ft(e,t){var n=e.alternate;return n===null?(n=Ce(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ur(e,t,n,r,l,i){var o=2;if(r=e,typeof e=="function")Ao(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case jt:return Nt(n.children,l,i,t);case io:o=8,l|=8;break;case li:return e=Ce(12,n,t,l|2),e.elementType=li,e.lanes=i,e;case ii:return e=Ce(13,n,t,l),e.elementType=ii,e.lanes=i,e;case oi:return e=Ce(19,n,t,l),e.elementType=oi,e.lanes=i,e;case zs:return Sl(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ps:o=10;break e;case Ns:o=9;break e;case oo:o=11;break e;case uo:o=14;break e;case Je:o=16,r=null;break e}throw Error(S(130,e==null?e:typeof e,""))}return t=Ce(o,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function Nt(e,t,n,r){return e=Ce(7,e,r,t),e.lanes=n,e}function Sl(e,t,n,r){return e=Ce(22,e,r,t),e.elementType=zs,e.lanes=n,e.stateNode={isHidden:!1},e}function ei(e,t,n){return e=Ce(6,e,null,t),e.lanes=n,e}function ti(e,t,n){return t=Ce(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function bd(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Dl(0),this.expirationTimes=Dl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Dl(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Wo(e,t,n,r,l,i,o,u,s){return e=new bd(e,t,n,u,s),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ce(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Po(i),e}function ep(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Ec)}catch(e){console.error(e)}}Ec(),Es.exports=we;var oh=Es.exports;/** + * @remix-run/router v1.23.0 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function bn(){return bn=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function Cc(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function op(){return Math.random().toString(36).substr(2,8)}function is(e,t){return{usr:e.state,key:e.key,idx:t}}function Gi(e,t,n,r){return n===void 0&&(n=null),bn({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?dn(t):t,{state:n,key:t&&t.key||r||op()})}function sl(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function dn(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function up(e,t,n,r){r===void 0&&(r={});let{window:l=document.defaultView,v5Compat:i=!1}=r,o=l.history,u=rt.Pop,s=null,a=h();a==null&&(a=0,o.replaceState(bn({},o.state,{idx:a}),""));function h(){return(o.state||{idx:null}).idx}function p(){u=rt.Pop;let E=h(),f=E==null?null:E-a;a=E,s&&s({action:u,location:w.location,delta:f})}function m(E,f){u=rt.Push;let c=Gi(w.location,E,f);n&&n(c,E),a=h()+1;let d=is(c,a),v=w.createHref(c);try{o.pushState(d,"",v)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;l.location.assign(v)}i&&s&&s({action:u,location:w.location,delta:1})}function y(E,f){u=rt.Replace;let c=Gi(w.location,E,f);n&&n(c,E),a=h();let d=is(c,a),v=w.createHref(c);o.replaceState(d,"",v),i&&s&&s({action:u,location:w.location,delta:0})}function g(E){let f=l.location.origin!=="null"?l.location.origin:l.location.href,c=typeof E=="string"?E:sl(E);return c=c.replace(/ $/,"%20"),Y(f,"No window.location.(origin|href) available to create URL for href: "+c),new URL(c,f)}let w={get action(){return u},get location(){return e(l,o)},listen(E){if(s)throw new Error("A history only accepts one active listener");return l.addEventListener(ls,p),s=E,()=>{l.removeEventListener(ls,p),s=null}},createHref(E){return t(l,E)},createURL:g,encodeLocation(E){let f=g(E);return{pathname:f.pathname,search:f.search,hash:f.hash}},push:m,replace:y,go(E){return o.go(E)}};return w}var os;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(os||(os={}));function sp(e,t,n){return n===void 0&&(n="/"),ap(e,t,n,!1)}function ap(e,t,n,r){let l=typeof t=="string"?dn(t):t,i=Yo(l.pathname||"/",n);if(i==null)return null;let o=xc(e);cp(o);let u=null;for(let s=0;u==null&&s{let s={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};s.relativePath.startsWith("/")&&(Y(s.relativePath.startsWith(r),'Absolute route path "'+s.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),s.relativePath=s.relativePath.slice(r.length));let a=dt([r,s.relativePath]),h=n.concat(s);i.children&&i.children.length>0&&(Y(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+a+'".')),xc(i.children,t,h,a)),!(i.path==null&&!i.index)&&t.push({path:a,score:yp(a,i.index),routesMeta:h})};return e.forEach((i,o)=>{var u;if(i.path===""||!((u=i.path)!=null&&u.includes("?")))l(i,o);else for(let s of _c(i.path))l(i,o,s)}),t}function _c(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,l=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return l?[i,""]:[i];let o=_c(r.join("/")),u=[];return u.push(...o.map(s=>s===""?i:[i,s].join("/"))),l&&u.push(...o),u.map(s=>e.startsWith("/")&&s===""?"/":s)}function cp(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:gp(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const fp=/^:[\w-]+$/,dp=3,pp=2,hp=1,mp=10,vp=-2,us=e=>e==="*";function yp(e,t){let n=e.split("/"),r=n.length;return n.some(us)&&(r+=vp),t&&(r+=pp),n.filter(l=>!us(l)).reduce((l,i)=>l+(fp.test(i)?dp:i===""?hp:mp),r)}function gp(e,t){return e.length===t.length&&e.slice(0,-1).every((r,l)=>r===t[l])?e[e.length-1]-t[t.length-1]:0}function wp(e,t,n){n===void 0&&(n=!1);let{routesMeta:r}=e,l={},i="/",o=[];for(let u=0;u{let{paramName:m,isOptional:y}=h;if(m==="*"){let w=u[p]||"";o=i.slice(0,i.length-w.length).replace(/(.)\/+$/,"$1")}const g=u[p];return y&&!g?a[m]=void 0:a[m]=(g||"").replace(/%2F/g,"/"),a},{}),pathname:i,pathnameBase:o,pattern:e}}function Sp(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Cc(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,u,s)=>(r.push({paramName:u,isOptional:s!=null}),s?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),r]}function kp(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Cc(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Yo(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function Ep(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:l=""}=typeof e=="string"?dn(e):e;return{pathname:n?n.startsWith("/")?n:Cp(n,t):t,search:Pp(r),hash:Np(l)}}function Cp(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(l=>{l===".."?n.length>1&&n.pop():l!=="."&&n.push(l)}),n.length>1?n.join("/"):"/"}function ni(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function xp(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Pc(e,t){let n=xp(e);return t?n.map((r,l)=>l===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Nc(e,t,n,r){r===void 0&&(r=!1);let l;typeof e=="string"?l=dn(e):(l=bn({},e),Y(!l.pathname||!l.pathname.includes("?"),ni("?","pathname","search",l)),Y(!l.pathname||!l.pathname.includes("#"),ni("#","pathname","hash",l)),Y(!l.search||!l.search.includes("#"),ni("#","search","hash",l)));let i=e===""||l.pathname==="",o=i?"/":l.pathname,u;if(o==null)u=n;else{let p=t.length-1;if(!r&&o.startsWith("..")){let m=o.split("/");for(;m[0]==="..";)m.shift(),p-=1;l.pathname=m.join("/")}u=p>=0?t[p]:"/"}let s=Ep(l,u),a=o&&o!=="/"&&o.endsWith("/"),h=(i||o===".")&&n.endsWith("/");return!s.pathname.endsWith("/")&&(a||h)&&(s.pathname+="/"),s}const dt=e=>e.join("/").replace(/\/\/+/g,"/"),_p=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Pp=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Np=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function zp(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const zc=["post","put","patch","delete"];new Set(zc);const Lp=["get",...zc];new Set(Lp);/** + * React Router v6.30.1 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function er(){return er=Object.assign?Object.assign.bind():function(e){for(var t=1;t{u.current=!0}),_.useCallback(function(a,h){if(h===void 0&&(h={}),!u.current)return;if(typeof a=="number"){r.go(a);return}let p=Nc(a,JSON.parse(o),i,h.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:dt([t,p.pathname])),(h.replace?r.replace:r.push)(p,h.state,h)},[t,r,o,i,e])}function uh(){let{matches:e}=_.useContext(gt),t=e[e.length-1];return t?t.params:{}}function Tc(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=_.useContext(Dt),{matches:l}=_.useContext(gt),{pathname:i}=Pl(),o=JSON.stringify(Pc(l,r.v7_relativeSplatPath));return _.useMemo(()=>Nc(e,JSON.parse(o),i,n==="path"),[e,o,i,n])}function Ip(e,t){return Dp(e,t)}function Dp(e,t,n,r){or()||Y(!1);let{navigator:l}=_.useContext(Dt),{matches:i}=_.useContext(gt),o=i[i.length-1],u=o?o.params:{};o&&o.pathname;let s=o?o.pathnameBase:"/";o&&o.route;let a=Pl(),h;if(t){var p;let E=typeof t=="string"?dn(t):t;s==="/"||(p=E.pathname)!=null&&p.startsWith(s)||Y(!1),h=E}else h=a;let m=h.pathname||"/",y=m;if(s!=="/"){let E=s.replace(/^\//,"").split("/");y="/"+m.replace(/^\//,"").split("/").slice(E.length).join("/")}let g=sp(e,{pathname:y}),w=Bp(g&&g.map(E=>Object.assign({},E,{params:Object.assign({},u,E.params),pathname:dt([s,l.encodeLocation?l.encodeLocation(E.pathname).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?s:dt([s,l.encodeLocation?l.encodeLocation(E.pathnameBase).pathname:E.pathnameBase])})),i,n,r);return t&&w?_.createElement(_l.Provider,{value:{location:er({pathname:"/",search:"",hash:"",state:null,key:"default"},h),navigationType:rt.Pop}},w):w}function Fp(){let e=Hp(),t=zp(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,l={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},i=null;return _.createElement(_.Fragment,null,_.createElement("h2",null,"Unexpected Application Error!"),_.createElement("h3",{style:{fontStyle:"italic"}},t),n?_.createElement("pre",{style:l},n):null,i)}const Up=_.createElement(Fp,null);class jp extends _.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?_.createElement(gt.Provider,{value:this.props.routeContext},_.createElement(Lc.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function $p(e){let{routeContext:t,match:n,children:r}=e,l=_.useContext(Xo);return l&&l.static&&l.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=n.route.id),_.createElement(gt.Provider,{value:t},r)}function Bp(e,t,n,r){var l;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,u=(l=n)==null?void 0:l.errors;if(u!=null){let h=o.findIndex(p=>p.route.id&&(u==null?void 0:u[p.route.id])!==void 0);h>=0||Y(!1),o=o.slice(0,Math.min(o.length,h+1))}let s=!1,a=-1;if(n&&r&&r.v7_partialHydration)for(let h=0;h=0?o=o.slice(0,a+1):o=[o[0]];break}}}return o.reduceRight((h,p,m)=>{let y,g=!1,w=null,E=null;n&&(y=u&&p.route.id?u[p.route.id]:void 0,w=p.route.errorElement||Up,s&&(a<0&&m===0?(Kp("route-fallback",!1),g=!0,E=null):a===m&&(g=!0,E=p.route.hydrateFallbackElement||null)));let f=t.concat(o.slice(0,m+1)),c=()=>{let d;return y?d=w:g?d=E:p.route.Component?d=_.createElement(p.route.Component,null):p.route.element?d=p.route.element:d=h,_.createElement($p,{match:p,routeContext:{outlet:h,matches:f,isDataRoute:n!=null},children:d})};return n&&(p.route.ErrorBoundary||p.route.errorElement||m===0)?_.createElement(jp,{location:n.location,revalidation:n.revalidation,component:w,error:y,children:c(),routeContext:{outlet:null,matches:f,isDataRoute:!0}}):c()},null)}var Oc=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(Oc||{}),al=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(al||{});function Vp(e){let t=_.useContext(Xo);return t||Y(!1),t}function Ap(e){let t=_.useContext(Rp);return t||Y(!1),t}function Wp(e){let t=_.useContext(gt);return t||Y(!1),t}function Mc(e){let t=Wp(),n=t.matches[t.matches.length-1];return n.route.id||Y(!1),n.route.id}function Hp(){var e;let t=_.useContext(Lc),n=Ap(al.UseRouteError),r=Mc(al.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function Qp(){let{router:e}=Vp(Oc.UseNavigateStable),t=Mc(al.UseNavigateStable),n=_.useRef(!1);return Rc(()=>{n.current=!0}),_.useCallback(function(l,i){i===void 0&&(i={}),n.current&&(typeof l=="number"?e.navigate(l):e.navigate(l,er({fromRouteId:t},i)))},[e,t])}const as={};function Kp(e,t,n){!t&&!as[e]&&(as[e]=!0)}function Yp(e,t){e==null||e.v7_startTransition,(e==null?void 0:e.v7_relativeSplatPath)===void 0&&(!t||t.v7_relativeSplatPath),t&&(t.v7_fetcherPersist,t.v7_normalizeFormMethod,t.v7_partialHydration,t.v7_skipActionErrorRevalidation)}function Xp(e){Y(!1)}function Gp(e){let{basename:t="/",children:n=null,location:r,navigationType:l=rt.Pop,navigator:i,static:o=!1,future:u}=e;or()&&Y(!1);let s=t.replace(/^\/*/,"/"),a=_.useMemo(()=>({basename:s,navigator:i,static:o,future:er({v7_relativeSplatPath:!1},u)}),[s,u,i,o]);typeof r=="string"&&(r=dn(r));let{pathname:h="/",search:p="",hash:m="",state:y=null,key:g="default"}=r,w=_.useMemo(()=>{let E=Yo(h,s);return E==null?null:{location:{pathname:E,search:p,hash:m,state:y,key:g},navigationType:l}},[s,h,p,m,y,g,l]);return w==null?null:_.createElement(Dt.Provider,{value:a},_.createElement(_l.Provider,{children:n,value:w}))}function sh(e){let{children:t,location:n}=e;return Ip(Zi(t),n)}new Promise(()=>{});function Zi(e,t){t===void 0&&(t=[]);let n=[];return _.Children.forEach(e,(r,l)=>{if(!_.isValidElement(r))return;let i=[...t,l];if(r.type===_.Fragment){n.push.apply(n,Zi(r.props.children,i));return}r.type!==Xp&&Y(!1),!r.props.index||!r.props.children||Y(!1);let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Zi(r.props.children,i)),n.push(o)}),n}/** + * React Router DOM v6.30.1 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Ji(){return Ji=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[l]=e[l]);return n}function Jp(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function qp(e,t){return e.button===0&&(!t||t==="_self")&&!Jp(e)}const bp=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],eh="6";try{window.__reactRouterVersion=eh}catch{}const th="startTransition",cs=bc[th];function ah(e){let{basename:t,children:n,future:r,window:l}=e,i=_.useRef();i.current==null&&(i.current=ip({window:l,v5Compat:!0}));let o=i.current,[u,s]=_.useState({action:o.action,location:o.location}),{v7_startTransition:a}=r||{},h=_.useCallback(p=>{a&&cs?cs(()=>s(p)):s(p)},[s,a]);return _.useLayoutEffect(()=>o.listen(h),[o,h]),_.useEffect(()=>Yp(r),[r]),_.createElement(Gp,{basename:t,children:n,location:u.location,navigationType:u.action,navigator:o,future:r})}const nh=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",rh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ch=_.forwardRef(function(t,n){let{onClick:r,relative:l,reloadDocument:i,replace:o,state:u,target:s,to:a,preventScrollReset:h,viewTransition:p}=t,m=Zp(t,bp),{basename:y}=_.useContext(Dt),g,w=!1;if(typeof a=="string"&&rh.test(a)&&(g=a,nh))try{let d=new URL(window.location.href),v=a.startsWith("//")?new URL(d.protocol+a):new URL(a),k=Yo(v.pathname,y);v.origin===d.origin&&k!=null?a=k+v.search+v.hash:w=!0}catch{}let E=Tp(a,{relative:l}),f=lh(a,{replace:o,state:u,target:s,preventScrollReset:h,relative:l,viewTransition:p});function c(d){r&&r(d),d.defaultPrevented||f(d)}return _.createElement("a",Ji({},m,{href:g||E,onClick:w||i?r:c,ref:n,target:s}))});var fs;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(fs||(fs={}));var ds;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(ds||(ds={}));function lh(e,t){let{target:n,replace:r,state:l,preventScrollReset:i,relative:o,viewTransition:u}=t===void 0?{}:t,s=Op(),a=Pl(),h=Tc(e,{relative:o});return _.useCallback(p=>{if(qp(p,n)){p.preventDefault();let m=r!==void 0?r:sl(a)===sl(h);s(e,{replace:m,state:l,preventScrollReset:i,relative:o,viewTransition:u})}},[a,s,h,r,l,n,e,i,o,u])}export{ah as B,ch as L,qc as R,oh as a,uh as b,sh as c,Xp as d,_ as r,Pl as u}; diff --git a/dist/index.html b/dist/index.html new file mode 100644 index 0000000..def3639 --- /dev/null +++ b/dist/index.html @@ -0,0 +1,20 @@ + + + + + + + NostrCount - Track Life Milestones + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/dist/vite.svg b/dist/vite.svg new file mode 100644 index 0000000..9345cb5 --- /dev/null +++ b/dist/vite.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/env.example b/env.example new file mode 100644 index 0000000..b0958c1 --- /dev/null +++ b/env.example @@ -0,0 +1,7 @@ +# Nostr Relay Configuration +VITE_DEFAULT_RELAYS=wss://relay.azzamo.net,wss://relay.damus.io,wss://nostr.oxtr.dev,wss://nos.lol,wss://relay.snort.social + +# App Configuration +VITE_APP_NAME=NostrCount +VITE_APP_DESCRIPTION=Track life milestones on Nostr +VITE_APP_URL=https://nostrcount.com \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..47b0807 --- /dev/null +++ b/index.html @@ -0,0 +1,16 @@ + + + + + + + NostrCount - Track Life Milestones + + + + + +
+ + + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..08ddfea --- /dev/null +++ b/package-lock.json @@ -0,0 +1,4158 @@ +{ + "name": "nostrcount", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "nostrcount", + "version": "0.0.0", + "dependencies": { + "@nostr-dev-kit/ndk": "^2.14.32", + "@nostr-dev-kit/ndk-cache-dexie": "^2.6.33", + "dayjs": "^1.11.10", + "lucide-react": "^0.292.0", + "nostr-tools": "^2.0.2", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-hot-toast": "^2.4.1", + "react-router-dom": "^6.19.0" + }, + "devDependencies": { + "@types/react": "^18.2.37", + "@types/react-dom": "^18.2.15", + "@typescript-eslint/eslint-plugin": "^6.10.0", + "@typescript-eslint/parser": "^6.10.0", + "@vitejs/plugin-react": "^4.1.0", + "autoprefixer": "^10.4.16", + "eslint": "^8.53.0", + "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-react-refresh": "^0.4.4", + "postcss": "^8.4.31", + "tailwindcss": "^3.3.5", + "typescript": "^5.2.2", + "vite": "^4.5.0" + } + }, + "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, + "engines": { + "node": ">=10" + }, + "funding": { + "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, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.27.1", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.0.tgz", + "integrity": "sha512-60X7qkglvrap8mn1lh2ebxXdZYtUcpd7gsmy9kLaBJ4i/WdY8PqTSdxyA8qraikqKQK5C1KRBKXqznrVapyNaw==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.0.tgz", + "integrity": "sha512-UlLAnTPrFdNGoFtbSXwcGFQBtQZJCNjaN6hQNP3UPvuNXT1i82N26KL3dZeIpNalWywr9IuQuncaAfUaS1g6sQ==", + "dev": true, + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.27.1", + "@babel/generator": "^7.28.0", + "@babel/helper-compilation-targets": "^7.27.2", + "@babel/helper-module-transforms": "^7.27.3", + "@babel/helpers": "^7.27.6", + "@babel/parser": "^7.28.0", + "@babel/template": "^7.27.2", + "@babel/traverse": "^7.28.0", + "@babel/types": "^7.28.0", + "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/core/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, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/generator": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.28.0.tgz", + "integrity": "sha512-lJjzvrbEeWrhB4P3QBsH7tey117PjLZnDbLiQEKjQ/fNJTjuq4HSqgFA+UNSwZT8D7dxxbnuSBMsa1lrWzKlQg==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.28.0", + "@babel/types": "^7.28.0", + "@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.27.2", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz", + "integrity": "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.27.2", + "@babel/helper-validator-option": "^7.27.1", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets/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, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", + "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz", + "integrity": "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w==", + "dev": true, + "dependencies": { + "@babel/traverse": "^7.27.1", + "@babel/types": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.27.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.27.3.tgz", + "integrity": "sha512-dSOvYwvyLsWBeIRyOeHXp5vPj5l1I011r52FM1+r1jCERv+aFXYk4whgQccYEGYxK2H3ZAIA8nuPkQ0HaUo3qg==", + "dev": true, + "dependencies": { + "@babel/helper-module-imports": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1", + "@babel/traverse": "^7.27.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz", + "integrity": "sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", + "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", + "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.27.6", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.27.6.tgz", + "integrity": "sha512-muE8Tt8M22638HU31A3CgfSUciwz1fhATfoVai05aPXGor//CdWDCbnlY1yvBPo07njuVOCNGCSp/GTt12lIug==", + "dev": true, + "dependencies": { + "@babel/template": "^7.27.2", + "@babel/types": "^7.27.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.0.tgz", + "integrity": "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g==", + "dev": true, + "dependencies": { + "@babel/types": "^7.28.0" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-self": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.27.1.tgz", + "integrity": "sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-source": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.27.1.tgz", + "integrity": "sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.27.2", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz", + "integrity": "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.27.1", + "@babel/parser": "^7.27.2", + "@babel/types": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.0.tgz", + "integrity": "sha512-mGe7UK5wWyh0bKRfupsUchrQGqvDbZDbKJw+kcRGSmdHVYrv+ltd0pnpDTVpiTqnaBru9iEvA8pz8W46v0Amwg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.27.1", + "@babel/generator": "^7.28.0", + "@babel/helper-globals": "^7.28.0", + "@babel/parser": "^7.28.0", + "@babel/template": "^7.27.2", + "@babel/types": "^7.28.0", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.28.1", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.1.tgz", + "integrity": "sha512-x0LvFTekgSX+83TI28Y9wYPUfzrnl2aT5+5QLnO6v7mSJYtEEevuDRN0F0uSHRk1G1IWZC43o00Y0xDDrpBGPQ==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", + "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", + "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", + "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz", + "integrity": "sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", + "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", + "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", + "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", + "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", + "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", + "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", + "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", + "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", + "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", + "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", + "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", + "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", + "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", + "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", + "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", + "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", + "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", + "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz", + "integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==", + "dev": true, + "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/regexpp": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@eslint/js": { + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", + "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", + "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", + "deprecated": "Use @eslint/config-array instead", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^2.0.3", + "debug": "^4.3.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "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, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", + "deprecated": "Use @eslint/object-schema instead", + "dev": true + }, + "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, + "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-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.12", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.12.tgz", + "integrity": "sha512-OuLGC46TjB5BbN1dH8JULVVZY4WTdkF7tV9Ys6wLL1rubZnCMstOhNHueU5bLCrnRuDhKPDM4g6sw4Bel5Gzqg==", + "dev": true, + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@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, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.4.tgz", + "integrity": "sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.29", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.29.tgz", + "integrity": "sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@noble/ciphers": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-0.5.3.tgz", + "integrity": "sha512-B0+6IIHiqEs3BPMT0hcRmHvEj2QHOLu+uwt+tqDDeVd0oyVzh7BPrDcPjRnV1PV/5LaknXJJQvOuRGR0zQJz+w==", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/curves": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.3.tgz", + "integrity": "sha512-NiHFh8qtZRREtY0Bpup+xpmLnB0bn9UAtj8CARBc2x1zjpVLDC84u+Bvy2+uaSgA3AmMP9zsacMZT1echgVAdQ==", + "dependencies": { + "@noble/hashes": "1.8.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/secp256k1": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-2.3.0.tgz", + "integrity": "sha512-0TQed2gcBbIrh7Ccyw+y/uZQvbJwm7Ao4scBUxqpBCcsOlZG0O4KGfjtNAy/li4W8n1xt3dxrwJ0beZ2h2G6Kw==", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "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, + "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, + "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, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nostr-dev-kit/ndk": { + "version": "2.14.32", + "resolved": "https://registry.npmjs.org/@nostr-dev-kit/ndk/-/ndk-2.14.32.tgz", + "integrity": "sha512-LUBO35RCB9/emBYsXNDece7m/WO2rGYR8j4SD0Crb3z8GcKTJq6P8OjpZ6+Kr+sLNo8N0uL07XxtAvEBnp2OqQ==", + "dependencies": { + "@noble/curves": "^1.6.0", + "@noble/hashes": "^1.5.0", + "@noble/secp256k1": "^2.1.0", + "@scure/base": "^1.1.9", + "debug": "^4.3.6", + "light-bolt11-decoder": "^3.2.0", + "tseep": "^1.3.1", + "typescript-lru-cache": "^2" + }, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "nostr-tools": "^2" + } + }, + "node_modules/@nostr-dev-kit/ndk-cache-dexie": { + "version": "2.6.33", + "resolved": "https://registry.npmjs.org/@nostr-dev-kit/ndk-cache-dexie/-/ndk-cache-dexie-2.6.33.tgz", + "integrity": "sha512-JzUD5cuJbGQDUXYuW1530vy347Kk3AhdtvPO8tL6kFpV3KzGt/QPZ0SHxcjMhJdf7r6cAIpCEWj9oUlStr0gsg==", + "dependencies": { + "@nostr-dev-kit/ndk": "2.14.32", + "debug": "^4.3.7", + "dexie": "^4.0.8", + "nostr-tools": "^2.4.0", + "typescript-lru-cache": "^2.0.0" + } + }, + "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, + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@remix-run/router": { + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.23.0.tgz", + "integrity": "sha512-O3rHJzAQKamUz1fvE0Qaw0xSFqsA/yafi2iqeE0pvdFtCO1viYx8QL6f3Ln/aCCTLxs68SLf0KPM9eSeM8yBnA==", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.0-beta.19", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.19.tgz", + "integrity": "sha512-3FL3mnMbPu0muGOCaKAhhFEYmqv9eTfPSJRJmANrCwtgK8VuxpsZDGK+m0LYAGoyO8+0j5uRe4PeyPDK1yA/hA==", + "dev": true + }, + "node_modules/@scure/base": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.6.tgz", + "integrity": "sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.1.tgz", + "integrity": "sha512-osvveYtyzdEVbt3OfwwXFr4P2iVBL5u1Q3q4ONBfDY/UpOuXmOlbgwc1xECEboY8wIays8Yt6onaWMUdUbfl0A==", + "dependencies": { + "@noble/curves": "~1.1.0", + "@noble/hashes": "~1.3.1", + "@scure/base": "~1.1.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32/node_modules/@noble/curves": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.1.0.tgz", + "integrity": "sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==", + "dependencies": { + "@noble/hashes": "1.3.1" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32/node_modules/@noble/curves/node_modules/@noble/hashes": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz", + "integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32/node_modules/@noble/hashes": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", + "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip39": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz", + "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==", + "dependencies": { + "@noble/hashes": "~1.3.0", + "@scure/base": "~1.1.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip39/node_modules/@noble/hashes": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", + "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip39/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "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, + "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, + "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, + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.7.tgz", + "integrity": "sha512-dkO5fhS7+/oos4ciWxyEyjWe48zmG6wbCheo/G2ZnHx4fs3EU6YC6UM8rk56gAjNJ9P3MTH2jo5jb92/K6wbng==", + "dev": true, + "dependencies": { + "@babel/types": "^7.20.7" + } + }, + "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 + }, + "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==", + "dev": true + }, + "node_modules/@types/react": { + "version": "18.3.23", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.23.tgz", + "integrity": "sha512-/LDXMQh55EzZQ0uVAZmKKhfENivEvWz6E+EYzh+/MCjMhNsotd+ZHhBGIjFDTi6+fz0OhQQQLbTgdQIxxCsC0w==", + "dev": true, + "dependencies": { + "@types/prop-types": "*", + "csstype": "^3.0.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, + "peerDependencies": { + "@types/react": "^18.0.0" + } + }, + "node_modules/@types/semver": { + "version": "7.7.0", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.7.0.tgz", + "integrity": "sha512-k107IF4+Xr7UHjwDc7Cfd6PRQfbdkiRabXGRjo07b4WyPahFBZCZ1sE+BNxYIJPPg73UkfOsVOLwqVc/6ETrIA==", + "dev": true + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz", + "integrity": "sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==", + "dev": true, + "dependencies": { + "@eslint-community/regexpp": "^4.5.1", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/type-utils": "6.21.0", + "@typescript-eslint/utils": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4", + "graphemer": "^1.4.0", + "ignore": "^5.2.4", + "natural-compare": "^1.4.0", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha", + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.21.0.tgz", + "integrity": "sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz", + "integrity": "sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==", + "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/utils": "6.21.0", + "debug": "^4.3.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz", + "integrity": "sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.12", + "@types/semver": "^7.5.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "semver": "^7.5.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@ungap/structured-clone": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "dev": true + }, + "node_modules/@vitejs/plugin-react": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.6.0.tgz", + "integrity": "sha512-5Kgff+m8e2PB+9j51eGHEpn5kUzRKH2Ry0qGoe8ItJg7pqnkPrYPkDQZGgGmTa0EGarHrkjLvOdU3b1fzI8otQ==", + "dev": true, + "dependencies": { + "@babel/core": "^7.27.4", + "@babel/plugin-transform-react-jsx-self": "^7.27.1", + "@babel/plugin-transform-react-jsx-source": "^7.27.1", + "@rolldown/pluginutils": "1.0.0-beta.19", + "@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-beta.0" + } + }, + "node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "dev": true, + "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, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "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-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "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, + "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 + }, + "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, + "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 + }, + "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 + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/autoprefixer": { + "version": "10.4.21", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.21.tgz", + "integrity": "sha512-O+A6LWV5LDHSJD3LjHYoNi4VLsj/Whi7k6zG12xTYaU4cQ8oxQGckXNX8cRHK5yOZ/ppVHe0ZBXGzSV9jXdVbQ==", + "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" + } + ], + "dependencies": { + "browserslist": "^4.24.4", + "caniuse-lite": "^1.0.30001702", + "fraction.js": "^4.3.7", + "normalize-range": "^0.1.2", + "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 + }, + "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, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "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, + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.25.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.25.1.tgz", + "integrity": "sha512-KGj0KoOMXLpSNkkEI6Z6mShmQy0bc1I+T7K9N81k4WWMrfz+6fQ6es80B/YLAeRoKvjYE1YSHHOW1qe9xIVzHw==", + "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" + } + ], + "dependencies": { + "caniuse-lite": "^1.0.30001726", + "electron-to-chromium": "^1.5.173", + "node-releases": "^2.0.19", + "update-browserslist-db": "^1.1.3" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "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, + "engines": { + "node": ">=6" + } + }, + "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, + "engines": { + "node": ">= 6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001727", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001727.tgz", + "integrity": "sha512-pB68nIHmbN6L/4C6MH1DokyR3bYqFwjaSs/sWDHGj4CTcFtQUQMuJftVwWkXq7mNWOybD3KhUv3oWHoGxgP14Q==", + "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" + } + ] + }, + "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, + "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, + "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, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "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, + "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 + }, + "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, + "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 + }, + "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 + }, + "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, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "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, + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/csstype": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" + }, + "node_modules/dayjs": { + "version": "1.11.13", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz", + "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==" + }, + "node_modules/debug": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "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 + }, + "node_modules/dexie": { + "version": "4.0.11", + "resolved": "https://registry.npmjs.org/dexie/-/dexie-4.0.11.tgz", + "integrity": "sha512-SOKO002EqlvBYYKQSew3iymBoN2EQ4BDw/3yprjh7kAfFzjBYkaMNa/pZvcA7HSWlcKSQb9XhPe3wKyQ0x4A8A==" + }, + "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 + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dlv": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", + "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", + "dev": true + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "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 + }, + "node_modules/electron-to-chromium": { + "version": "1.5.186", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.186.tgz", + "integrity": "sha512-lur7L4BFklgepaJxj4DqPk7vKbTEl0pajNlg2QjE5shefmlmBLm2HvQ7PMf1R/GvlevT/581cop33/quQcfX3A==", + "dev": true + }, + "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 + }, + "node_modules/esbuild": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz", + "integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.18.20", + "@esbuild/android-arm64": "0.18.20", + "@esbuild/android-x64": "0.18.20", + "@esbuild/darwin-arm64": "0.18.20", + "@esbuild/darwin-x64": "0.18.20", + "@esbuild/freebsd-arm64": "0.18.20", + "@esbuild/freebsd-x64": "0.18.20", + "@esbuild/linux-arm": "0.18.20", + "@esbuild/linux-arm64": "0.18.20", + "@esbuild/linux-ia32": "0.18.20", + "@esbuild/linux-loong64": "0.18.20", + "@esbuild/linux-mips64el": "0.18.20", + "@esbuild/linux-ppc64": "0.18.20", + "@esbuild/linux-riscv64": "0.18.20", + "@esbuild/linux-s390x": "0.18.20", + "@esbuild/linux-x64": "0.18.20", + "@esbuild/netbsd-x64": "0.18.20", + "@esbuild/openbsd-x64": "0.18.20", + "@esbuild/sunos-x64": "0.18.20", + "@esbuild/win32-arm64": "0.18.20", + "@esbuild/win32-ia32": "0.18.20", + "@esbuild/win32-x64": "0.18.20" + } + }, + "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, + "engines": { + "node": ">=6" + } + }, + "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, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", + "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", + "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.1", + "@humanwhocodes/config-array": "^0.13.0", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-plugin-react-hooks": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.2.tgz", + "integrity": "sha512-QzliNJq4GinDBcD8gPB5v0wh6g8q3SUi6EFF0x8N/BL9PoVs0atuGc47ozMRyOWAKdwaZ5OnbOEa3WR+dSGKuQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0" + } + }, + "node_modules/eslint-plugin-react-refresh": { + "version": "0.4.20", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.20.tgz", + "integrity": "sha512-XpbHQ2q5gUF8BGOX4dHe+71qoirYMhApEPZ7sfhF/dNnOF1UXnCMGZf79SFTBO7Bz5YEIT4TMieSlJBWhP9WBA==", + "dev": true, + "peerDependencies": { + "eslint": ">=8.40" + } + }, + "node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "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, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dev": true, + "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, + "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, + "engines": { + "node": ">=4.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, + "engines": { + "node": ">=0.10.0" + } + }, + "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 + }, + "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, + "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, + "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 + }, + "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 + }, + "node_modules/fastq": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", + "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.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, + "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, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "dev": true, + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.3", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", + "dev": true + }, + "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, + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/fraction.js": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz", + "integrity": "sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==", + "dev": true, + "engines": { + "node": "*" + }, + "funding": { + "type": "patreon", + "url": "https://github.com/sponsors/rawify" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "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, + "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, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "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, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "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", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/goober": { + "version": "2.1.16", + "resolved": "https://registry.npmjs.org/goober/-/goober-2.1.16.tgz", + "integrity": "sha512-erjk19y1U33+XAMe1VTvIONHYoSqE4iS7BYUZfHaqeohLmnC0FdxEh7rQU+6MZ4OajItzjZFSRtVANrQwNq6/g==", + "peerDependencies": { + "csstype": "^3.0.10" + } + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, + "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, + "engines": { + "node": ">=8" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "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, + "engines": { + "node": ">= 4" + } + }, + "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, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "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 + }, + "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, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "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, + "engines": { + "node": ">=0.10.0" + } + }, + "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, + "engines": { + "node": ">=8" + } + }, + "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, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "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, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "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, + "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", + "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==", + "dev": true, + "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==" + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "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, + "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 + }, + "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 + }, + "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 + }, + "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, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "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, + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "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, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/light-bolt11-decoder": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/light-bolt11-decoder/-/light-bolt11-decoder-3.2.0.tgz", + "integrity": "sha512-3QEofgiBOP4Ehs9BI+RkZdXZNtSys0nsJ6fyGeSiAGCBsMwHGUDS/JQlY/sTnWs91A2Nh0S9XXfA8Sy9g6QpuQ==", + "dependencies": { + "@scure/base": "1.1.1" + } + }, + "node_modules/light-bolt11-decoder/node_modules/@scure/base": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", + "integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "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, + "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 + }, + "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, + "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 + }, + "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==", + "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, + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/lucide-react": { + "version": "0.292.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.292.0.tgz", + "integrity": "sha512-rRgUkpEHWpa5VCT66YscInCQmQuPCB1RFRzkkxMxg4b+jaL0V12E3riWWR2Sh5OIiUhCwGW/ZExuEO4Az32E6Q==", + "peerDependencies": { + "react": "^16.5.1 || ^17.0.0 || ^18.0.0" + } + }, + "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, + "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, + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "dev": true, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "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==" + }, + "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, + "dependencies": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "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 + }, + "node_modules/node-releases": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", + "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", + "dev": true + }, + "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, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/normalize-range": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", + "integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/nostr-tools": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/nostr-tools/-/nostr-tools-2.15.0.tgz", + "integrity": "sha512-Jj/+UFbu3JbTAWP4ipPFNuyD4W5eVRBNAP+kmnoRCYp3bLmTrlQ0Qhs5O1xSQJTFpjdZqoS0zZOUKdxUdjc+pw==", + "dependencies": { + "@noble/ciphers": "^0.5.1", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.1", + "@scure/base": "1.1.1", + "@scure/bip32": "1.3.1", + "@scure/bip39": "1.2.1", + "nostr-wasm": "0.1.0" + }, + "peerDependencies": { + "typescript": ">=5.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/nostr-tools/node_modules/@noble/curves": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", + "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "dependencies": { + "@noble/hashes": "1.3.2" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/nostr-tools/node_modules/@noble/curves/node_modules/@noble/hashes": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", + "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/nostr-tools/node_modules/@noble/hashes": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz", + "integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/nostr-tools/node_modules/@scure/base": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", + "integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "node_modules/nostr-wasm": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/nostr-wasm/-/nostr-wasm-0.1.0.tgz", + "integrity": "sha512-78BTryCLcLYv96ONU8Ws3Q1JzjlAt+43pWQhIl86xZmWeegYCNLPml7yQ+gG3vR6V5h4XGj+TxO+SS5dsThQIA==" + }, + "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, + "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, + "engines": { + "node": ">= 6" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "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/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, + "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, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "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 + }, + "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, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "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, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "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, + "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 + }, + "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, + "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 + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "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 + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "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, + "engines": { + "node": ">=0.10.0" + } + }, + "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, + "engines": { + "node": ">= 6" + } + }, + "node_modules/postcss": { + "version": "8.5.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", + "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" + } + ], + "dependencies": { + "nanoid": "^3.3.11", + "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, + "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.0.1", + "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.0.1.tgz", + "integrity": "sha512-dDLF8pEO191hJMtlHFPRa8xsizHaM82MLfNkUHdUtVEV3tgTp5oj+8qbEqYM57SLfc74KSbw//4SeJma2LRVIw==", + "dev": true, + "dependencies": { + "camelcase-css": "^2.0.1" + }, + "engines": { + "node": "^12 || ^14 || >= 16" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": "^8.4.21" + } + }, + "node_modules/postcss-load-config": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-4.0.2.tgz", + "integrity": "sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "lilconfig": "^3.0.0", + "yaml": "^2.3.4" + }, + "engines": { + "node": ">= 14" + }, + "peerDependencies": { + "postcss": ">=8.0.9", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "postcss": { + "optional": true + }, + "ts-node": { + "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" + } + ], + "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, + "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 + }, + "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, + "engines": { + "node": ">= 0.8.0" + } + }, + "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, + "engines": { + "node": ">=6" + } + }, + "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" + } + ] + }, + "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==", + "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==", + "dependencies": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.2" + }, + "peerDependencies": { + "react": "^18.3.1" + } + }, + "node_modules/react-hot-toast": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/react-hot-toast/-/react-hot-toast-2.5.2.tgz", + "integrity": "sha512-Tun3BbCxzmXXM7C+NI4qiv6lT0uwGh4oAfeJyNOjYUejTsm35mK9iCaYLGv8cBz9L5YxZLx/2ii7zsIwPtPUdw==", + "dependencies": { + "csstype": "^3.1.3", + "goober": "^2.1.16" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "react": ">=16", + "react-dom": ">=16" + } + }, + "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, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-router": { + "version": "6.30.1", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.30.1.tgz", + "integrity": "sha512-X1m21aEmxGXqENEPG3T6u0Th7g0aS4ZmoNynhbs+Cn+q+QGTLt+d5IQ2bHAXKzKcxGJjxACpVbnYQSCRcfxHlQ==", + "dependencies": { + "@remix-run/router": "1.23.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8" + } + }, + "node_modules/react-router-dom": { + "version": "6.30.1", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.30.1.tgz", + "integrity": "sha512-llKsgOkZdbPU1Eg3zK8lCn+sjD9wMRZZPuzmdWWX5SUs8OFkN5HnFVC0u5KMeMaC9aoancFI/KoLuKPqN+hxHw==", + "dependencies": { + "@remix-run/router": "1.23.0", + "react-router": "6.30.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8", + "react-dom": ">=16.8" + } + }, + "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, + "dependencies": { + "pify": "^2.3.0" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.10", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", + "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", + "dev": true, + "dependencies": { + "is-core-module": "^2.16.0", + "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, + "engines": { + "node": ">=4" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rollup": { + "version": "3.29.5", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.5.tgz", + "integrity": "sha512-GVsDdsbJzzy4S/v3dqWPJ7EfvZJfCHiDqe80IyrF59LYuP+e6U1LJoUqeuqRbwAWoMNoXivMNeNAOf5E22VA1w==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=14.18.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "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" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/scheduler": { + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", + "dependencies": { + "loose-envify": "^1.1.0" + } + }, + "node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "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, + "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, + "engines": { + "node": ">=8" + } + }, + "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, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "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, + "engines": { + "node": ">=0.10.0" + } + }, + "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, + "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/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, + "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/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 + }, + "node_modules/string-width/node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/string-width/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "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, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "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, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "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", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/sucrase": { + "version": "3.35.0", + "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.0.tgz", + "integrity": "sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.2", + "commander": "^4.0.0", + "glob": "^10.3.10", + "lines-and-columns": "^1.1.6", + "mz": "^2.7.0", + "pirates": "^4.0.1", + "ts-interface-checker": "^0.1.9" + }, + "bin": { + "sucrase": "bin/sucrase", + "sucrase-node": "bin/sucrase-node" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/sucrase/node_modules/glob": { + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "dev": true, + "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/sucrase/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "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, + "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, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tailwindcss": { + "version": "3.4.17", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.17.tgz", + "integrity": "sha512-w33E2aCvSDP0tW9RZuNXadXlkHXqFzSkQew/aIa2i/Sj8fThxwovwlXHSPXTbAHwEIhBFXAedUhP2tueAKP8Og==", + "dev": true, + "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.6", + "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", + "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/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, + "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, + "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, + "dependencies": { + "thenify": ">= 3.1.0 < 4" + }, + "engines": { + "node": ">=0.8" + } + }, + "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, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/ts-api-utils": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.4.3.tgz", + "integrity": "sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==", + "dev": true, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "typescript": ">=4.2.0" + } + }, + "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 + }, + "node_modules/tseep": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/tseep/-/tseep-1.3.1.tgz", + "integrity": "sha512-ZPtfk1tQnZVyr7BPtbJ93qaAh2lZuIOpTMjhrYa4XctT8xe7t4SAW9LIxrySDuYMsfNNayE51E/WNGrNVgVicQ==" + }, + "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, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "devOptional": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/typescript-lru-cache": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/typescript-lru-cache/-/typescript-lru-cache-2.0.0.tgz", + "integrity": "sha512-Jp57Qyy8wXeMkdNuZiglE6v2Cypg13eDA1chHwDG6kq51X7gk4K7P7HaDdzZKCxkegXkVHNcPD0n5aW6OZH3aA==" + }, + "node_modules/update-browserslist-db": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz", + "integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==", + "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" + } + ], + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "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, + "dependencies": { + "punycode": "^2.1.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 + }, + "node_modules/vite": { + "version": "4.5.14", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.14.tgz", + "integrity": "sha512-+v57oAaoYNnO3hIu5Z/tJRZjq5aHM2zDve9YZ8HngVHbhk66RStobhb1sqPMIPEleV6cNKYK4eGrAbE9Ulbl2g==", + "dev": true, + "dependencies": { + "esbuild": "^0.18.10", + "postcss": "^8.4.27", + "rollup": "^3.27.1" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + }, + "peerDependencies": { + "@types/node": ">= 14", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, + "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, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "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, + "engines": { + "node": ">=0.10.0" + } + }, + "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, + "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/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, + "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/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 + }, + "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, + "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/node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + }, + "node_modules/yaml": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.0.tgz", + "integrity": "sha512-4lLa/EcQCB0cJkyts+FpIRx5G/llPxfP6VQU5KByHEhLxY3IJCH0f0Hy1MHI8sClTvsIb8qwRJ6R/ZdlDJ/leQ==", + "dev": true, + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14.6" + } + }, + "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, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..bf3cc5a --- /dev/null +++ b/package.json @@ -0,0 +1,38 @@ +{ + "name": "nostrcount", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", + "preview": "vite preview" + }, + "dependencies": { + "@nostr-dev-kit/ndk": "^2.14.32", + "@nostr-dev-kit/ndk-cache-dexie": "^2.6.33", + "dayjs": "^1.11.10", + "lucide-react": "^0.292.0", + "nostr-tools": "^2.0.2", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-hot-toast": "^2.4.1", + "react-router-dom": "^6.19.0" + }, + "devDependencies": { + "@types/react": "^18.2.37", + "@types/react-dom": "^18.2.15", + "@typescript-eslint/eslint-plugin": "^6.10.0", + "@typescript-eslint/parser": "^6.10.0", + "@vitejs/plugin-react": "^4.1.0", + "autoprefixer": "^10.4.16", + "eslint": "^8.53.0", + "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-react-refresh": "^0.4.4", + "postcss": "^8.4.31", + "tailwindcss": "^3.3.5", + "typescript": "^5.2.2", + "vite": "^4.5.0" + } +} diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 0000000..387612e --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,6 @@ +export default { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} \ No newline at end of file diff --git a/public/vite.svg b/public/vite.svg new file mode 100644 index 0000000..9345cb5 --- /dev/null +++ b/public/vite.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/App.tsx b/src/App.tsx new file mode 100644 index 0000000..a74a535 --- /dev/null +++ b/src/App.tsx @@ -0,0 +1,44 @@ + +import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'; +import { Toaster } from 'react-hot-toast'; +import { NDKProvider } from './contexts/NDKContext'; +import { Header } from './components/Header'; +import { Home } from './pages/Home'; +import { Dashboard } from './pages/Dashboard'; +import { CounterDetail } from './pages/CounterDetail'; +import { BrowseCounters } from './pages/BrowseCounters'; +import { Test } from './pages/Test'; +import './index.css'; + +function App() { + return ( + + +
+
+
+ + } /> + } /> + } /> + } /> + } /> + +
+ +
+
+
+ ); +} + +export default App; \ No newline at end of file diff --git a/src/components/CounterCard.tsx b/src/components/CounterCard.tsx new file mode 100644 index 0000000..c105cbe --- /dev/null +++ b/src/components/CounterCard.tsx @@ -0,0 +1,135 @@ +import React from 'react'; +import { Link } from 'react-router-dom'; +import { Calendar, Clock, Eye, EyeOff, Share2, Trash2, Edit, ExternalLink } from 'lucide-react'; +import type { Counter } from '../types'; +import { calculateDaysDiff, formatDate } from '../utils/date'; +import { useNDK } from '../contexts/NDKContext'; + +interface CounterCardProps { + counter: Counter; + onDelete?: (slug: string) => void; + onEdit?: (counter: Counter) => void; + onShare?: (counter: Counter) => void; + showActions?: boolean; +} + +export const CounterCard: React.FC = ({ + counter, + onDelete, + onEdit, + onShare, + showActions = false, +}) => { + const { user } = useNDK(); + const isOwner = user?.pubkey === counter.pubkey; + + const daysDiff = calculateDaysDiff(counter.date, counter.type); + const isOverdue = counter.type === 'until' && daysDiff < 0; + + const getDayText = () => { + if (counter.type === 'since') { + return daysDiff === 0 ? 'Today' : `${daysDiff} days`; + } else { + if (daysDiff === 0) return 'Today'; + if (daysDiff > 0) return `${daysDiff} days`; + return `${Math.abs(daysDiff)} days ago`; + } + }; + + const getTypeText = () => { + if (counter.type === 'since') { + return 'since'; + } else { + return isOverdue ? 'since' : 'until'; + } + }; + + return ( +
+
+
+ + {counter.title} + + +
+ {counter.visibility === 'private' ? ( + + ) : ( + + )} + + {showActions && ( +
+ + + + + {onShare && ( + + )} + + {isOwner && onEdit && ( + + )} + + {isOwner && onDelete && ( + + )} +
+ )} +
+
+ +
+
+ {getDayText()} +
+ +
+ {getTypeText()} {formatDate(counter.date)} +
+
+ +
+
+ + {formatDate(counter.date)} +
+ +
+ + Created {new Date(counter.createdAt * 1000).toLocaleDateString()} +
+
+
+
+ ); +}; \ No newline at end of file diff --git a/src/components/CounterFormModal.tsx b/src/components/CounterFormModal.tsx new file mode 100644 index 0000000..ce56105 --- /dev/null +++ b/src/components/CounterFormModal.tsx @@ -0,0 +1,226 @@ +import React, { useState, useEffect } from 'react'; +import { X, Calendar, Eye, EyeOff } from 'lucide-react'; +import type { CounterFormData } from '../types'; +import { getTodayISOString, isDateValid } from '../utils/date'; +import { deriveCounterType } from '../utils/nostr'; + +interface CounterFormModalProps { + isOpen: boolean; + onClose: () => void; + onSubmit: (data: CounterFormData) => Promise; + initialData?: CounterFormData; + isLoading?: boolean; +} + +export const CounterFormModal: React.FC = ({ + isOpen, + onClose, + onSubmit, + initialData, + isLoading = false, +}) => { + const [formData, setFormData] = useState({ + title: '', + date: getTodayISOString(), + type: 'since', + visibility: 'private', + }); + + const [errors, setErrors] = useState>({}); + + useEffect(() => { + if (initialData) { + setFormData(initialData); + } else { + setFormData({ + title: '', + date: getTodayISOString(), + type: 'since', + visibility: 'private', + }); + } + setErrors({}); + }, [initialData, isOpen]); + + // Auto-derive type from date + const derivedType = deriveCounterType(formData.date); + const typeDescription = derivedType === 'since' ? 'Days Since' : 'Days Until'; + + const validateForm = (): boolean => { + const newErrors: Partial = {}; + + if (!formData.title.trim()) { + newErrors.title = 'Title is required'; + } else if (formData.title.length > 100) { + newErrors.title = 'Title must be 100 characters or less'; + } + + if (!formData.date) { + newErrors.date = 'Date is required'; + } else if (!isDateValid(formData.date)) { + newErrors.date = 'Invalid date format'; + } + + setErrors(newErrors); + return Object.keys(newErrors).length === 0; + }; + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + + if (!validateForm()) return; + + try { + // Use the derived type instead of the form type + const submitData = { + ...formData, + type: derivedType, + }; + await onSubmit(submitData); + onClose(); + } catch (error) { + console.error('Error submitting form:', error); + } + }; + + const handleInputChange = ( + field: keyof CounterFormData, + value: string + ) => { + setFormData(prev => ({ ...prev, [field]: value })); + + // Clear error for this field + if (errors[field]) { + setErrors(prev => ({ ...prev, [field]: undefined })); + } + }; + + if (!isOpen) return null; + + return ( +
+
+
+

+ {initialData ? 'Edit Counter' : 'Create Counter'} +

+ +
+ +
+
+ + handleInputChange('title', e.target.value)} + className={`w-full px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 ${ + errors.title ? 'border-red-500' : 'border-gray-300' + }`} + placeholder="e.g., Quit smoking" + disabled={isLoading} + /> + {errors.title && ( +

{errors.title}

+ )} +
+ +
+ +
+ handleInputChange('date', e.target.value)} + className={`w-full px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 ${ + errors.date ? 'border-red-500' : 'border-gray-300' + }`} + disabled={isLoading} + /> + +
+ {errors.date && ( +

{errors.date}

+ )} +
+ +
+ +
+

+ {typeDescription} + + (auto-detected from date) + +

+
+
+ +
+ +
+ + +
+
+ +
+ + +
+
+
+
+ ); +}; \ No newline at end of file diff --git a/src/components/EditCounterModal.tsx b/src/components/EditCounterModal.tsx new file mode 100644 index 0000000..b197e78 --- /dev/null +++ b/src/components/EditCounterModal.tsx @@ -0,0 +1,212 @@ +import React, { useState, useEffect } from 'react'; +import { X, Save, Loader2 } from 'lucide-react'; +import { useNDK } from '../contexts/NDKContext'; +import type { Counter, CounterFormData } from '../types'; +import toast from 'react-hot-toast'; + +interface EditCounterModalProps { + isOpen: boolean; + onClose: () => void; + counter: Counter; + onUpdate: (updatedCounter: Counter) => void; +} + +export const EditCounterModal: React.FC = ({ + isOpen, + onClose, + counter, + onUpdate, +}) => { + const { publishEvent } = useNDK(); + const [formData, setFormData] = useState({ + title: '', + date: '', + type: 'since', + visibility: 'public', + }); + const [isSubmitting, setIsSubmitting] = useState(false); + + // Initialize form data when modal opens + useEffect(() => { + if (isOpen && counter) { + setFormData({ + title: counter.title, + date: counter.date, + type: counter.type, + visibility: counter.visibility, + }); + } + }, [isOpen, counter]); + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + + if (!formData.title.trim()) { + toast.error('Title is required'); + return; + } + + if (!formData.date) { + toast.error('Date is required'); + return; + } + + try { + setIsSubmitting(true); + + // Create updated event data + const eventData = { + kind: 30078, + content: '', + tags: [ + ['type', formData.type], + ['title', formData.title], + ['date', formData.date], + ['visibility', formData.visibility], + ], + created_at: Math.floor(Date.now() / 1000), + }; + + console.log('Updating counter with data:', eventData); + + // Publish the updated event + const event = await publishEvent(eventData); + + // Convert to Counter object + const { eventToCounter } = await import('../utils/nostr'); + const updatedCounter = eventToCounter(event); + + if (updatedCounter) { + onUpdate(updatedCounter); + toast.success('Counter updated successfully!'); + onClose(); + } else { + throw new Error('Failed to parse updated counter'); + } + } catch (error) { + console.error('Error updating counter:', error); + toast.error('Failed to update counter. Please try again.'); + } finally { + setIsSubmitting(false); + } + }; + + const handleClose = () => { + if (!isSubmitting) { + onClose(); + } + }; + + if (!isOpen) return null; + + return ( +
+
+ {/* Header */} +
+

+ Edit Counter +

+ +
+ + {/* Form */} +
+
+ + setFormData({ ...formData, title: e.target.value })} + className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" + placeholder="Enter counter title" + disabled={isSubmitting} + required + /> +
+ +
+ + setFormData({ ...formData, date: e.target.value })} + className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" + disabled={isSubmitting} + required + /> +
+ +
+ + +
+ +
+ + +
+ + {/* Actions */} +
+ + +
+
+
+
+ ); +}; \ No newline at end of file diff --git a/src/components/Header.tsx b/src/components/Header.tsx new file mode 100644 index 0000000..45a2647 --- /dev/null +++ b/src/components/Header.tsx @@ -0,0 +1,119 @@ +import React, { useState } from 'react'; +import { Link, useLocation } from 'react-router-dom'; +import { User, LogOut, Home, BarChart3, Eye } from 'lucide-react'; +import { useNDK } from '../contexts/NDKContext'; +import { LoginModal } from './LoginModal'; + +export const Header: React.FC = () => { + const { userProfile, isConnected, logout } = useNDK(); + const location = useLocation(); + const [showLoginModal, setShowLoginModal] = useState(false); + + const isActive = (path: string) => location.pathname === path; + + const handleAuth = () => { + if (isConnected) { + logout(); + } else { + setShowLoginModal(true); + } + }; + + return ( +
+
+
+
+ + + NostrCount + + + +
+ +
+ {isConnected && userProfile && ( +
+ {userProfile.picture && ( + {userProfile.name + )} + + {userProfile.display_name || userProfile.name || 'Anonymous'} + +
+ )} + + +
+
+
+ + setShowLoginModal(false)} + /> +
+ ); +}; \ No newline at end of file diff --git a/src/components/LoadingSpinner.tsx b/src/components/LoadingSpinner.tsx new file mode 100644 index 0000000..f3abda2 --- /dev/null +++ b/src/components/LoadingSpinner.tsx @@ -0,0 +1,21 @@ +import React from 'react'; + +interface LoadingSpinnerProps { + size?: 'sm' | 'md' | 'lg'; + className?: string; +} + +export const LoadingSpinner: React.FC = ({ + size = 'md', + className = '', +}) => { + const sizeClasses = { + sm: 'w-4 h-4', + md: 'w-8 h-8', + lg: 'w-12 h-12', + }; + + return ( +
+ ); +}; \ No newline at end of file diff --git a/src/components/LoginModal.tsx b/src/components/LoginModal.tsx new file mode 100644 index 0000000..5aa5d91 --- /dev/null +++ b/src/components/LoginModal.tsx @@ -0,0 +1,419 @@ +import React, { useState } from 'react'; +import { X, Key, Zap, Plus, Copy, ExternalLink } from 'lucide-react'; +import { useNDK } from '../contexts/NDKContext'; +import { nip19, generateSecretKey, getPublicKey } from 'nostr-tools'; + +interface LoginModalProps { + isOpen: boolean; + onClose: () => void; +} + +type LoginMethod = 'extension' | 'keys' | 'create' | 'nip55'; +type CreateStep = 'username' | 'keys'; + +export const LoginModal: React.FC = ({ isOpen, onClose }) => { + const { login, loginWithKeys, loginWithNip55, updateUserProfile } = useNDK(); + const [loginMethod, setLoginMethod] = useState('extension'); + const [createStep, setCreateStep] = useState('username'); + + // Keys login + const [keyInput, setKeyInput] = useState(''); + const [keyType, setKeyType] = useState<'npub' | 'nsec' | 'unknown'>('unknown'); + + // Account creation + const [username, setUsername] = useState(''); + const [newPrivateKey, setNewPrivateKey] = useState(''); + const [newPublicKey, setNewPublicKey] = useState(''); + + // NIP-55 + const [nip55Url, setNip55Url] = useState(''); + + const [loading, setLoading] = useState(false); + const [error, setError] = useState(null); + + const detectKeyType = (input: string): 'npub' | 'nsec' | 'unknown' => { + if (input.startsWith('npub')) return 'npub'; + if (input.startsWith('nsec')) return 'nsec'; + return 'unknown'; + }; + + const handleKeyInputChange = (value: string) => { + setKeyInput(value); + setKeyType(detectKeyType(value)); + }; + + const handleExtensionLogin = async () => { + try { + setLoading(true); + setError(null); + await login(); + onClose(); + } catch (err) { + console.error('Extension login failed:', err); + setError(err instanceof Error ? err.message : 'Login failed'); + } finally { + setLoading(false); + } + }; + + const handleKeysLogin = async () => { + if (!keyInput.trim()) { + setError('Please enter a public or private key'); + return; + } + + try { + setLoading(true); + setError(null); + + if (keyType === 'nsec') { + // Private key provided - we can derive the public key + await loginWithKeys('', keyInput.trim()); + } else if (keyType === 'npub') { + // Only public key provided - read-only mode + setError('Public key only provides read-only access. Please provide a private key for full access.'); + return; + } else { + setError('Please enter a valid npub or nsec key'); + return; + } + + onClose(); + } catch (err) { + console.error('Keys login failed:', err); + setError(err instanceof Error ? err.message : 'Login failed'); + } finally { + setLoading(false); + } + }; + + const handleCreateAccount = async () => { + if (!username.trim()) { + setError('Please enter a username'); + return; + } + + try { + setLoading(true); + setError(null); + + // Generate new key pair + const privateKey = generateSecretKey(); + const publicKey = getPublicKey(privateKey); + + // Encode to nostr format + const nsec = nip19.nsecEncode(privateKey); + const npub = nip19.npubEncode(publicKey); + + setNewPrivateKey(nsec); + setNewPublicKey(npub); + setCreateStep('keys'); + } catch (err) { + console.error('Account creation failed:', err); + setError('Failed to create account'); + } finally { + setLoading(false); + } + }; + + const handleUseNewKeys = async () => { + try { + setLoading(true); + setError(null); + + // Login with the new keys + await loginWithKeys(newPublicKey, newPrivateKey); + + // Update user profile with the username + await updateUserProfile({ + name: username, + display_name: username, + }); + + onClose(); + } catch (err) { + console.error('Login with new keys failed:', err); + setError(err instanceof Error ? err.message : 'Login failed'); + } finally { + setLoading(false); + } + }; + + const handleNip55Login = async () => { + if (!nip55Url.trim()) { + setError('Please enter a NIP-55 URL'); + return; + } + + try { + setLoading(true); + setError(null); + await loginWithNip55(nip55Url); + onClose(); + } catch (err) { + console.error('NIP-55 login failed:', err); + setError(err instanceof Error ? err.message : 'Login failed'); + } finally { + setLoading(false); + } + }; + + const copyToClipboard = (text: string) => { + navigator.clipboard.writeText(text); + }; + + const resetForm = () => { + setKeyInput(''); + setKeyType('unknown'); + setUsername(''); + setNewPrivateKey(''); + setNewPublicKey(''); + setNip55Url(''); + setError(null); + setCreateStep('username'); + }; + + const handleClose = () => { + resetForm(); + onClose(); + }; + + if (!isOpen) return null; + + return ( +
+
+
+

+ Connect to Nostr +

+ +
+ +
+
+ + + + +
+ + {loginMethod === 'extension' && ( +
+

+ Connect using your Nostr browser extension (Alby, nos2x, etc.) +

+ +
+ )} + + {loginMethod === 'keys' && ( +
+
+ + handleKeyInputChange(e.target.value)} + placeholder="npub1... or nsec1..." + className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" + disabled={loading} + /> + {keyType !== 'unknown' && ( +

+ Detected: {keyType === 'npub' ? 'Public Key (Read-only)' : 'Private Key (Full Access)'} +

+ )} +
+ + +
+ )} + + {loginMethod === 'create' && createStep === 'username' && ( +
+
+ + setUsername(e.target.value)} + placeholder="your-username" + className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" + disabled={loading} + /> +

+ This will be used to identify your account +

+
+ + +
+ )} + + {loginMethod === 'create' && createStep === 'keys' && ( +
+
+

Save Your Keys!

+

+ Store these keys safely. You'll need them to access your account. +

+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ + +
+ )} + + {loginMethod === 'nip55' && ( +
+
+ + setNip55Url(e.target.value)} + placeholder="https://example.com/.well-known/nostr.json" + className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" + disabled={loading} + /> +

+ Enter a NIP-55 compatible URL to connect with an external signer +

+
+ + +
+ )} + + {error && ( +
+

{error}

+
+ )} +
+
+
+ ); +}; \ No newline at end of file diff --git a/src/components/NostrShareModal.tsx b/src/components/NostrShareModal.tsx new file mode 100644 index 0000000..3470fd3 --- /dev/null +++ b/src/components/NostrShareModal.tsx @@ -0,0 +1,162 @@ +import React, { useState } from 'react'; +import { X, Send, Loader2 } from 'lucide-react'; +import { useNDK } from '../contexts/NDKContext'; +import type { Counter } from '../types'; +import toast from 'react-hot-toast'; + +interface NostrShareModalProps { + isOpen: boolean; + onClose: () => void; + counter: Counter; +} + +export const NostrShareModal: React.FC = ({ + isOpen, + onClose, + counter, +}) => { + const { ndk, user } = useNDK(); + const [content, setContent] = useState(''); + const [isPublishing, setIsPublishing] = useState(false); + + // Generate default share text + const defaultShareText = `Check out my ${counter.type === 'since' ? 'progress' : 'countdown'}: ${counter.title}`; + + // Initialize content with default text when modal opens + React.useEffect(() => { + if (isOpen) { + setContent(defaultShareText); + } + }, [isOpen, defaultShareText]); + + const handlePublish = async () => { + if (!ndk || !user) { + toast.error('Please log in to share on Nostr'); + return; + } + + if (!content.trim()) { + toast.error('Please enter a message to share'); + return; + } + + try { + setIsPublishing(true); + + // Create NIP-1 text note event + const { NDKEvent } = await import('@nostr-dev-kit/ndk'); + const event = new NDKEvent(ndk); + + event.kind = 1; // Text note + event.content = content; + + // Add counter event as a reference + event.tags = [ + ['e', counter.id, '', 'mention'], // Reference the counter event + ['p', counter.pubkey, '', 'mention'], // Reference the counter author + ]; + + console.log('Publishing Nostr share event:', { + content: event.content, + tags: event.tags, + kind: event.kind, + }); + + await event.sign(); + await event.publish(); + + toast.success('Shared on Nostr successfully!'); + onClose(); + } catch (error) { + console.error('Error publishing Nostr share:', error); + toast.error('Failed to share on Nostr. Please try again.'); + } finally { + setIsPublishing(false); + } + }; + + const handleClose = () => { + if (!isPublishing) { + onClose(); + } + }; + + if (!isOpen) return null; + + return ( +
+
+ {/* Header */} +
+

+ Share on Nostr +

+ +
+ + {/* Content */} +
+
+ +