From ce83af4dd5e1193fd64861f555e0421039cabd85 Mon Sep 17 00:00:00 2001 From: Shane Osbourne Date: Sun, 12 Jul 2026 12:28:00 +0100 Subject: [PATCH 1/7] make sure the system can be invoked free of stdout --- Cargo.lock | 5 +- Cargo.toml | 1 + bsnext/src/main.rs | 3 + crates/bsnext_dto/src/external_events.rs | 9 +++ crates/bsnext_system/Cargo.toml | 1 + .../bsnext_system/examples/without_stdout.rs | 68 ++++++------------ crates/bsnext_system/src/args.rs | 3 - crates/bsnext_system/src/cli.rs | 72 ++++++++++++++++--- crates/bsnext_system/src/run/mod.rs | 27 +++++++ crates/bsnext_system/src/run/run.md | 3 + 10 files changed, 128 insertions(+), 64 deletions(-) create mode 100644 crates/bsnext_system/src/run/run.md diff --git a/Cargo.lock b/Cargo.lock index 416104b4..643a6af1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -701,6 +701,7 @@ dependencies = [ "insta", "kill_tree", "reqwest", + "shell-words", "tempfile", "tokio", "tokio-stream", @@ -3016,9 +3017,9 @@ dependencies = [ [[package]] name = "shell-words" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" +checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77" [[package]] name = "shlex" diff --git a/Cargo.toml b/Cargo.toml index e7e843df..59b4b7a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,6 +39,7 @@ miette = { version = "7.2.0", features = ["fancy", "syntect-highlighter"] } kill_tree = { version = "0.2.4", features = ["tokio"] } sqids = "0.4.2" tokio-util = "0.7.11" +shell-words = "1.1.1" [profile.release] strip = true diff --git a/bsnext/src/main.rs b/bsnext/src/main.rs index 3a3adfd0..88ac8ff2 100644 --- a/bsnext/src/main.rs +++ b/bsnext/src/main.rs @@ -5,6 +5,9 @@ use std::process; use bsnext_system::cli::from_args; fn main() { + unsafe { + std::env::set_var("RUST_LIB_BACKTRACE", "0"); + } let code = System::with_tokio_rt(|| { // build system with a multi-thread tokio runtime. tokio::runtime::Builder::new_multi_thread() diff --git a/crates/bsnext_dto/src/external_events.rs b/crates/bsnext_dto/src/external_events.rs index 65441e20..da73a729 100644 --- a/crates/bsnext_dto/src/external_events.rs +++ b/crates/bsnext_dto/src/external_events.rs @@ -1,4 +1,5 @@ use crate::archy::{archy, overlay_results, ArchyNode, Prefix}; +use crate::internal::AnyEvent; use crate::{ FileChangedDTO, FilesChangedDTO, InputAcceptedDTO, OutputLineDTO, ServerIdentityDTO, ServersChangedDTO, StderrLineDTO, StdoutLineDTO, StoppedWatchingDTO, WatchingDTO, @@ -329,3 +330,11 @@ pub fn print_watching(w: &mut W, evt: &WatchingDTO) -> anyhow::Result< } Ok(()) } + +pub fn has_output_line_matching(events: &[AnyEvent], expected: &str) -> bool { + events.iter().any(|e| { + matches!(e, AnyEvent::External(ExternalEventsDTO::OutputLine(OutputLineDTO::Stdout( + StdoutLineDTO { line, .. }, + ))) if line == expected) + }) +} diff --git a/crates/bsnext_system/Cargo.toml b/crates/bsnext_system/Cargo.toml index a6afaaa4..84efa349 100644 --- a/crates/bsnext_system/Cargo.toml +++ b/crates/bsnext_system/Cargo.toml @@ -30,6 +30,7 @@ actix-rt = { workspace = true } tracing = { workspace = true } tempfile = { workspace = true } globset = { workspace = true } +shell-words = { workspace = true } futures-util = { workspace = true } futures = "0.3.30" diff --git a/crates/bsnext_system/examples/without_stdout.rs b/crates/bsnext_system/examples/without_stdout.rs index 80ff2573..ed2843f6 100644 --- a/crates/bsnext_system/examples/without_stdout.rs +++ b/crates/bsnext_system/examples/without_stdout.rs @@ -1,52 +1,24 @@ -use bsnext_core::shared_args::{FsOpts, InputOpts}; -use bsnext_dto::internal::AnyEvent; -use bsnext_system::start::start_command::StartCommand; -use bsnext_system::start::start_kind::start_from_paths::StartFromPaths; -use bsnext_system::start::start_kind::StartKind; -use bsnext_system::start::start_system::start_system; -use std::fs; -use std::path::PathBuf; -use tokio::sync::mpsc; +use bsnext_dto::external_events::{has_output_line_matching, ExternalEventsDTO}; +use bsnext_system::cli::from_args_with_output; +use std::process; -#[actix_rt::main] -pub async fn main() -> Result<(), anyhow::Error> { - let tmp_dir = tempfile::tempdir().unwrap(); - let index_file = tmp_dir.path().join("index.html"); - fs::write(&index_file, String::from("Hello world! (without-stdout)")).expect("can write?"); - - let cwd = PathBuf::from(tmp_dir.path()); - let as_str = cwd.to_string_lossy().to_string(); - - let start = StartFromPaths { - port: None, - force: false, - paths: vec![as_str], - watch_sub_opts: Default::default(), - no_watch: false, - write_input: false, - route_opts: Default::default(), - }; - - let (events_sender, mut events_receiver) = mpsc::channel::(1); - let start_kind = StartKind::FromPaths(start); - let api = start_system(cwd, start_kind, events_sender) - .await - .map_err(|e| anyhow::anyhow!("{:?}", e))?; - - let Some(api) = api else { - unreachable!("failed if we get here") - }; - - tokio::spawn(async move { - tokio::time::sleep(std::time::Duration::from_millis(1000)).await; - if let Err(e) = api.stop().await { - tracing::error!(?e); - } - }); - - while let Some(evt) = events_receiver.recv().await { - dbg!(&evt); +fn main() { + unsafe { + std::env::set_var("RUST_LIB_BACKTRACE", "0"); } + let rt = actix_rt::System::new(); + let code = rt.block_on(async_main()); + process::exit(code) +} - Ok(()) +async fn async_main() -> i32 { + let args = "bslive run --sh 'echo 1' --sh 'echo 2'"; + let words = shell_words::split(args).unwrap(); + let (r, events) = from_args_with_output(words).await; + assert!(has_output_line_matching(&events, "1")); + assert!(has_output_line_matching(&events, "2")); + match r { + Ok(_) => 0, + Err(_) => 1, + } } diff --git a/crates/bsnext_system/src/args.rs b/crates/bsnext_system/src/args.rs index c34c9d1d..9277292c 100644 --- a/crates/bsnext_system/src/args.rs +++ b/crates/bsnext_system/src/args.rs @@ -60,10 +60,7 @@ impl Args { #[derive(Debug, Clone, clap::Subcommand)] pub enum SubCommands { - /// Start the services Start(StartCommand), - /// Just use file watching Watch(WatchCommand), - /// Just run tasks Run(RunCommand), } diff --git a/crates/bsnext_system/src/cli.rs b/crates/bsnext_system/src/cli.rs index 6a2e3b31..26e75072 100644 --- a/crates/bsnext_system/src/cli.rs +++ b/crates/bsnext_system/src/cli.rs @@ -4,6 +4,7 @@ use crate::start::start_command::StartCommand; use crate::start::start_kind::start_from_inputs::StartFromInput; use crate::start::start_kind::StartKind; use crate::start::stdout_channel; +use bsnext_dto::internal::AnyEvent; use bsnext_input::route::MultiWatch; use bsnext_input::Input; use bsnext_output::OutputWriters; @@ -13,7 +14,10 @@ use bsnext_tracing::{ use clap::Parser; use std::env::current_dir; use std::ffi::OsString; +use std::future::Future; use std::path::PathBuf; +use tokio::sync::mpsc; +use tokio::sync::mpsc::Sender; use tracing::{debug_span, Instrument}; /// The typical lifecycle when ran from a CLI environment @@ -84,47 +88,93 @@ where tracing::debug!("subcommand = {:?}", sub_command); let _guard = debug_span!("parent").entered(); - let r = async_init(sub_command, writer, args_c, cwd).await; + let (sender, fut) = stdout_channel(writer); + let result = async_init(sub_command, args_c, cwd, (sender, fut)).await; drop(_guard); drop(tracing_guard); - r + result +} + +/// The typical lifecycle when ran from a CLI environment +pub async fn from_args_with_output(itr: I) -> (anyhow::Result<()>, Vec) +where + I: IntoIterator + std::fmt::Debug, + T: Into + Clone, +{ + let args = Args::parse_from(itr); + let args_c = args.clone(); + let cwd = PathBuf::from(current_dir().unwrap().to_string_lossy().to_string()); + + let logging = *args.logging(); + let format = args.format(); + + let sub_command = args.command.unwrap_or_else(move || { + SubCommands::Start(StartCommand { + cors: false, + port: args.port, + trailing: args.trailing.clone(), + proxies: vec![], + watch_sub_opts: args.watch_opts, + logging, + format, + no_watch: args.no_watch, + }) + }); + let ready_future = futures::future::pending(); + let (events_sender, mut events_receiver) = mpsc::channel::(100); + + let result = async_init(sub_command, args_c, cwd, (events_sender, ready_future)).await; + + // now consume all the events + let mut events: Vec = Vec::new(); + let len = events_receiver.len(); + + tracing::debug!("will try to collect {len} events"); + let count = events_receiver.recv_many(&mut events, len).await; + + tracing::debug!("did collect {count} events"); + if count != len { + tracing::error!( + "collected events didn't match expectation, expected: {len} actual: {count}" + ); + } + (result, events) } async fn async_init( command: SubCommands, - writer: OutputWriters, args: Args, cwd: PathBuf, + (sender, fut): (Sender, impl Future + 'static), ) -> Result<(), anyhow::Error> { match command { SubCommands::Start(start) => { let start_kind = start.as_start_kind(&args.fs_opts, &args.input_opts); - start_stdout_wrapper(start_kind, cwd, writer).await + start_wrapper(start_kind, cwd, (sender, fut)).await } SubCommands::Watch(watch) => { let mut input = Input::default(); let multi = MultiWatch::from(watch); input.watchers.push(multi); let start_kind = StartKind::FromInput(StartFromInput { input }); - start_stdout_wrapper(start_kind, cwd, writer).await + start_wrapper(start_kind, cwd, (sender, fut)).await } SubCommands::Run(run) => { let start_kind = run.as_start_kind(&args.input_opts); - start_stdout_wrapper(start_kind, cwd, writer) + start_wrapper(start_kind, cwd, (sender, fut)) .instrument(debug_span!("SubCommands::Run").or_current()) .await } } } -async fn start_stdout_wrapper( +async fn start_wrapper( start_kind: StartKind, cwd: PathBuf, - writer: OutputWriters, + (sender, fut): (Sender, impl Future + 'static), ) -> anyhow::Result<()> { - let (events_sender, channel_future) = stdout_channel(writer); - let system_handle = actix_rt::spawn(start::with_sender(cwd, start_kind, events_sender)); - let channel_handle = actix_rt::spawn(channel_future); + let system_handle = actix_rt::spawn(start::with_sender(cwd, start_kind, sender.clone())); + let channel_handle = actix_rt::spawn(fut); let output = tokio::select! { r = system_handle => { match r { diff --git a/crates/bsnext_system/src/run/mod.rs b/crates/bsnext_system/src/run/mod.rs index 4c84608c..ee0fa76c 100644 --- a/crates/bsnext_system/src/run/mod.rs +++ b/crates/bsnext_system/src/run/mod.rs @@ -8,7 +8,34 @@ use bsnext_input::startup::{RunMode, TopLevelRunMode}; use bsnext_input::Input; use bsnext_tracing::OutputFormat; +fn about() -> String { + let s = r#" +Use bslive to run groups of tasks and exit immediately after. + "#; + s.to_string() +} + #[derive(Debug, Clone, clap::Parser)] +#[command(about = about(), long_about = None)] +/// +/// # Examples +/// Run a single command and exit immediately +/// +/// ```rust +/// # use bsnext_system::cli::from_args_with_output; +/// # use bsnext_dto::external_events::has_output_line_matching; +/// # let rt = actix_rt::System::new(); +/// # rt.block_on(async { +/// # let args = r#" +/// bslive run --sh "echo 1" +/// # "#; +/// # let words = shell_words::split(args).unwrap(); +/// # let (result, events) = from_args_with_output(words).await; +/// # assert!(result.is_ok()); +/// # assert!(has_output_line_matching(&events, "1")); +/// # }); +/// ``` +/// pub struct RunCommand { /// commands to run pub trailing: Vec, diff --git a/crates/bsnext_system/src/run/run.md b/crates/bsnext_system/src/run/run.md new file mode 100644 index 00000000..73683499 --- /dev/null +++ b/crates/bsnext_system/src/run/run.md @@ -0,0 +1,3 @@ +``` + +``` \ No newline at end of file From a248350493394331c6f61d6423bbc0f0089cc7ac Mon Sep 17 00:00:00 2001 From: Shane Osbourne Date: Sun, 12 Jul 2026 19:05:19 +0100 Subject: [PATCH 2/7] default to 'start' --- .../bsnext_system/examples/without_stdout.rs | 7 ++- crates/bsnext_system/src/args.rs | 20 +++++++ crates/bsnext_system/src/cli.rs | 53 +++++-------------- crates/bsnext_system/src/run/mod.rs | 11 ++-- 4 files changed, 43 insertions(+), 48 deletions(-) diff --git a/crates/bsnext_system/examples/without_stdout.rs b/crates/bsnext_system/examples/without_stdout.rs index ed2843f6..e4aac465 100644 --- a/crates/bsnext_system/examples/without_stdout.rs +++ b/crates/bsnext_system/examples/without_stdout.rs @@ -1,5 +1,7 @@ -use bsnext_dto::external_events::{has_output_line_matching, ExternalEventsDTO}; +use bsnext_dto::external_events::has_output_line_matching; use bsnext_system::cli::from_args_with_output; +use std::env::current_dir; +use std::path::PathBuf; use std::process; fn main() { @@ -14,7 +16,8 @@ fn main() { async fn async_main() -> i32 { let args = "bslive run --sh 'echo 1' --sh 'echo 2'"; let words = shell_words::split(args).unwrap(); - let (r, events) = from_args_with_output(words).await; + let cwd = PathBuf::from(current_dir().unwrap().to_string_lossy().to_string()); + let (r, events) = from_args_with_output(words, cwd).await; assert!(has_output_line_matching(&events, "1")); assert!(has_output_line_matching(&events, "2")); match r { diff --git a/crates/bsnext_system/src/args.rs b/crates/bsnext_system/src/args.rs index 9277292c..4a7824d4 100644 --- a/crates/bsnext_system/src/args.rs +++ b/crates/bsnext_system/src/args.rs @@ -39,6 +39,26 @@ pub struct Args { pub trailing: Vec, } +impl Args { + /// Chose the given command or just default to 'start' + pub(crate) fn command(self) -> SubCommands { + let logging = *self.logging(); + let format = self.format(); + self.command.unwrap_or_else(|| { + SubCommands::Start(StartCommand { + cors: false, + port: self.port, + trailing: self.trailing.clone(), + proxies: vec![], + watch_sub_opts: self.watch_opts, + logging, + format, + no_watch: self.no_watch, + }) + }) + } +} + impl Args { pub fn logging(&self) -> &LoggingOpts { match &self.command { diff --git a/crates/bsnext_system/src/cli.rs b/crates/bsnext_system/src/cli.rs index 26e75072..234164e2 100644 --- a/crates/bsnext_system/src/cli.rs +++ b/crates/bsnext_system/src/cli.rs @@ -1,6 +1,5 @@ use crate::args::{Args, SubCommands}; use crate::start; -use crate::start::start_command::StartCommand; use crate::start::start_kind::start_from_inputs::StartFromInput; use crate::start::start_kind::StartKind; use crate::start::stdout_channel; @@ -30,7 +29,6 @@ where std::env::set_var("RUST_LIB_BACKTRACE", "0"); } let args = Args::parse_from(itr); - let args_c = args.clone(); let cwd = PathBuf::from(current_dir().unwrap().to_string_lossy().to_string()); let logging = *args.logging(); @@ -73,57 +71,29 @@ where OutputFormat::Json => OutputWriters::Json, }; - let sub_command = args.command.unwrap_or_else(move || { - SubCommands::Start(StartCommand { - cors: false, - port: args.port, - trailing: args.trailing.clone(), - proxies: vec![], - watch_sub_opts: args.watch_opts, - logging, - format, - no_watch: args.no_watch, - }) - }); - - tracing::debug!("subcommand = {:?}", sub_command); let _guard = debug_span!("parent").entered(); let (sender, fut) = stdout_channel(writer); - let result = async_init(sub_command, args_c, cwd, (sender, fut)).await; + let result = async_init(args, cwd, (sender, fut)).await; drop(_guard); drop(tracing_guard); result } -/// The typical lifecycle when ran from a CLI environment -pub async fn from_args_with_output(itr: I) -> (anyhow::Result<()>, Vec) +/// a way of running that will collect events and not exit until the program exits naturally +pub async fn from_args_with_output( + itr: I, + cwd: PathBuf, +) -> (anyhow::Result<()>, Vec) where I: IntoIterator + std::fmt::Debug, T: Into + Clone, { let args = Args::parse_from(itr); - let args_c = args.clone(); - let cwd = PathBuf::from(current_dir().unwrap().to_string_lossy().to_string()); - let logging = *args.logging(); - let format = args.format(); - - let sub_command = args.command.unwrap_or_else(move || { - SubCommands::Start(StartCommand { - cors: false, - port: args.port, - trailing: args.trailing.clone(), - proxies: vec![], - watch_sub_opts: args.watch_opts, - logging, - format, - no_watch: args.no_watch, - }) - }); let ready_future = futures::future::pending(); let (events_sender, mut events_receiver) = mpsc::channel::(100); - let result = async_init(sub_command, args_c, cwd, (events_sender, ready_future)).await; + let result = async_init(args, cwd, (events_sender, ready_future)).await; // now consume all the events let mut events: Vec = Vec::new(); @@ -142,14 +112,15 @@ where } async fn async_init( - command: SubCommands, args: Args, cwd: PathBuf, (sender, fut): (Sender, impl Future + 'static), ) -> Result<(), anyhow::Error> { - match command { + let fs_opts = args.fs_opts.clone(); + let input_opts = args.input_opts.clone(); + match args.command() { SubCommands::Start(start) => { - let start_kind = start.as_start_kind(&args.fs_opts, &args.input_opts); + let start_kind = start.as_start_kind(&fs_opts, &input_opts); start_wrapper(start_kind, cwd, (sender, fut)).await } SubCommands::Watch(watch) => { @@ -160,7 +131,7 @@ async fn async_init( start_wrapper(start_kind, cwd, (sender, fut)).await } SubCommands::Run(run) => { - let start_kind = run.as_start_kind(&args.input_opts); + let start_kind = run.as_start_kind(&input_opts); start_wrapper(start_kind, cwd, (sender, fut)) .instrument(debug_span!("SubCommands::Run").or_current()) .await diff --git a/crates/bsnext_system/src/run/mod.rs b/crates/bsnext_system/src/run/mod.rs index ee0fa76c..bb61e47e 100644 --- a/crates/bsnext_system/src/run/mod.rs +++ b/crates/bsnext_system/src/run/mod.rs @@ -26,13 +26,14 @@ Use bslive to run groups of tasks and exit immediately after. /// # use bsnext_dto::external_events::has_output_line_matching; /// # let rt = actix_rt::System::new(); /// # rt.block_on(async { -/// # let args = r#" +/// # let args = r#" /// bslive run --sh "echo 1" /// # "#; -/// # let words = shell_words::split(args).unwrap(); -/// # let (result, events) = from_args_with_output(words).await; -/// # assert!(result.is_ok()); -/// # assert!(has_output_line_matching(&events, "1")); +/// # let words = shell_words::split(args).unwrap(); +/// # let cwd = std::path::PathBuf::from(std::env::current_dir().unwrap().to_string_lossy().to_string()); +/// # let (result, events) = from_args_with_output(words, cwd).await; +/// # assert!(result.is_ok()); +/// # assert!(has_output_line_matching(&events, "1")); /// # }); /// ``` /// From 5e9df05445498517d198c8e8c46f7ef41fa16488 Mon Sep 17 00:00:00 2001 From: Shane Osbourne Date: Sat, 18 Jul 2026 19:41:52 +0100 Subject: [PATCH 3/7] more cleanup --- bslive/src/async_start.rs | 42 ++++++++++++++ bslive/src/blocking_start.rs | 21 +++++++ bslive/src/lib.rs | 56 ++----------------- bsnext/src/main.rs | 9 ++- crates/bsnext_fs/src/lib.rs | 14 ++--- .../examples/path_monitor_example.rs | 12 ++-- crates/bsnext_path_monitor/src/lib.rs | 20 +++---- .../bsnext_path_monitor/src/path_monitor.rs | 23 ++++---- .../bsnext_system/examples/without_stdout.rs | 4 +- crates/bsnext_system/src/api.rs | 4 +- crates/bsnext_system/src/cli.rs | 9 +-- ...ent_grouping.rs => handle_fs_changeset.rs} | 22 ++++---- crates/bsnext_system/src/lib.rs | 2 +- crates/bsnext_system/src/run/mod.rs | 4 +- crates/bsnext_system/src/watchables/mod.rs | 6 +- examples/api/index.html | 11 ++++ examples/api/index.mjs | 8 +++ examples/api/package-lock.json | 46 +++++++++++++++ examples/api/package.json | 8 +++ index.d.ts | 2 +- 20 files changed, 206 insertions(+), 117 deletions(-) create mode 100644 bslive/src/async_start.rs create mode 100644 bslive/src/blocking_start.rs rename crates/bsnext_system/src/{handle_fs_event_grouping.rs => handle_fs_changeset.rs} (92%) create mode 100644 examples/api/index.html create mode 100644 examples/api/index.mjs create mode 100644 examples/api/package-lock.json create mode 100644 examples/api/package.json diff --git a/bslive/src/async_start.rs b/bslive/src/async_start.rs new file mode 100644 index 00000000..3c5863e5 --- /dev/null +++ b/bslive/src/async_start.rs @@ -0,0 +1,42 @@ +use bsnext_system::cli::from_args; +use napi::{Env, JsNumber}; +use std::env::current_dir; +use std::path::PathBuf; + +pub struct AsyncStart { + pub(crate) args: Vec, + pub(crate) rx: Option>, +} + +impl napi::Task for AsyncStart { + type Output = i32; + type JsValue = JsNumber; + + fn compute(&mut self) -> napi::Result { + let sys = actix_rt::System::new(); + let args = self.args.clone(); + let rx = self.rx.take().expect("must be there"); + let cwd = PathBuf::from(current_dir().unwrap().to_string_lossy().to_string()); + unsafe { + std::env::set_var("RUST_LIB_BACKTRACE", "0"); + } + let result = sys.block_on(async move { + tokio::select! { + _ = rx => { + 2 + } + res = from_args(args, cwd) => { + match res { + Ok(_) => 0, + Err(_) => 1, + } + } + } + }); + Ok(result) + } + + fn resolve(&mut self, env: Env, output: Self::Output) -> napi::Result { + env.create_int32(output) + } +} diff --git a/bslive/src/blocking_start.rs b/bslive/src/blocking_start.rs new file mode 100644 index 00000000..635c6ac1 --- /dev/null +++ b/bslive/src/blocking_start.rs @@ -0,0 +1,21 @@ +use bsnext_system::cli::from_args; +use std::env::current_dir; +use std::path::PathBuf; + +/// Launch in a blocking way +#[allow(dead_code)] +#[napi] +pub fn start_blocking(args: Vec) -> napi::bindgen_prelude::Result { + let sys = actix_rt::System::new(); + let result = sys.block_on(async move { + let cwd = PathBuf::from(current_dir().unwrap().to_string_lossy().to_string()); + unsafe { + std::env::set_var("RUST_LIB_BACKTRACE", "0"); + } + match from_args(args, cwd).await { + Ok(_) => 0, + Err(_) => 1, + } + }); + Ok(result) +} diff --git a/bslive/src/lib.rs b/bslive/src/lib.rs index 8226d842..2e0f8832 100644 --- a/bslive/src/lib.rs +++ b/bslive/src/lib.rs @@ -4,59 +4,11 @@ #[macro_use] extern crate napi_derive; -use bsnext_system::cli::from_args; +use crate::async_start::AsyncStart; use napi::bindgen_prelude::{AbortSignal, AsyncTask}; -use napi::{Env, JsNumber}; -/// Launch in a blocking way -#[allow(dead_code)] -#[napi] -fn start_blocking(args: Vec) -> napi::bindgen_prelude::Result { - let sys = actix_rt::System::new(); - let result = sys.block_on(async move { - match from_args(args).await { - Ok(_) => 0, - Err(_) => 1, - } - }); - Ok(result) -} - -pub struct AsyncStart { - args: Vec, - rx: Option>, -} - -impl napi::Task for AsyncStart { - type Output = i32; - type JsValue = JsNumber; - - fn compute(&mut self) -> napi::Result { - let sys = actix_rt::System::new(); - let args = self.args.clone(); - let rx = self.rx.take().expect("must be there"); - let result = sys.block_on(async move { - tokio::select! { - _ = rx => { - println!("did exit from one-shot"); - 2 - } - res = from_args(args) => { - println!("did exit from server-shot"); - match res { - Ok(_) => 0, - Err(_) => 1, - } - } - } - }); - Ok(result) - } - - fn resolve(&mut self, env: Env, output: Self::Output) -> napi::Result { - env.create_int32(output) - } -} +mod async_start; +mod blocking_start; #[napi(js_name = "BsSystem")] pub struct JsBsSystem { @@ -88,7 +40,7 @@ impl JsBsSystem { system: BsSystem::new(), } } - #[napi] + #[napi(ts_return_type = "Promise")] pub fn start(&mut self, args: Vec, signal: AbortSignal) -> AsyncTask { let (tx, rx) = tokio::sync::oneshot::channel::<()>(); self.system.sender = Some(tx); diff --git a/bsnext/src/main.rs b/bsnext/src/main.rs index 88ac8ff2..31ba18db 100644 --- a/bsnext/src/main.rs +++ b/bsnext/src/main.rs @@ -1,5 +1,6 @@ use actix_rt::System; -use std::env::args; +use std::env::{args, current_dir}; +use std::path::PathBuf; use std::process; use bsnext_system::cli::from_args; @@ -23,7 +24,11 @@ fn main() { async fn async_main() -> i32 { let cli_args = args(); - match from_args(cli_args).await { + let cwd = PathBuf::from(current_dir().unwrap().to_string_lossy().to_string()); + unsafe { + std::env::set_var("RUST_LIB_BACKTRACE", "0"); + } + match from_args(cli_args, cwd).await { Ok(_) => 0, Err(_) => 1, } diff --git a/crates/bsnext_fs/src/lib.rs b/crates/bsnext_fs/src/lib.rs index 68573d3a..176a4f4a 100644 --- a/crates/bsnext_fs/src/lib.rs +++ b/crates/bsnext_fs/src/lib.rs @@ -172,17 +172,17 @@ impl<'a> From<&'a PathDescription<'_>> for PathDescriptionOwned { } #[derive(Debug, Clone)] -pub struct BufferedChangeEvent { - pub events: Vec, +pub struct BufferedChangeset { + pub changes: Vec, pub fs_event_ctx: FsEventContext, } -impl BufferedChangeEvent { +impl BufferedChangeset { pub fn dropping_absolute(self, path: &Path) -> Self { - if self.events.iter().any(|x| x.absolute == path) { + if self.changes.iter().any(|x| x.absolute == path) { Self { - events: self - .events + changes: self + .changes .iter() .filter(|x| x.absolute != path) .map(ToOwned::to_owned) @@ -191,7 +191,7 @@ impl BufferedChangeEvent { } } else { Self { - events: self.events, + changes: self.changes, fs_event_ctx: self.fs_event_ctx, } } diff --git a/crates/bsnext_path_monitor/examples/path_monitor_example.rs b/crates/bsnext_path_monitor/examples/path_monitor_example.rs index 853abd14..d33190d1 100644 --- a/crates/bsnext_path_monitor/examples/path_monitor_example.rs +++ b/crates/bsnext_path_monitor/examples/path_monitor_example.rs @@ -2,7 +2,7 @@ use actix::{Actor, ResponseFuture}; use actix_rt::System; use bsnext_fs::{FsEvent, FsEventContext}; use bsnext_input::route::{DebounceDuration, WatchSpec}; -use bsnext_path_monitor::PathMonitorEvent; +use bsnext_path_monitor::PathMonitorChangeset; use bsnext_path_monitor::path_monitor::PathMonitor; use bsnext_path_monitor::watch_paths_msg::WatchPaths; use std::env::current_dir; @@ -34,7 +34,7 @@ fn main() { #[derive(Default)] struct Consumer { - events: Vec, + events: Vec, } #[derive(actix::Message, Debug, Clone)] @@ -45,10 +45,10 @@ impl actix::Actor for Consumer { type Context = actix::Context; } -impl actix::Handler for Consumer { +impl actix::Handler for Consumer { type Result = (); - fn handle(&mut self, msg: PathMonitorEvent, _ctx: &mut Self::Context) -> Self::Result { + fn handle(&mut self, msg: PathMonitorChangeset, _ctx: &mut Self::Context) -> Self::Result { self.events.push(msg); } } @@ -62,11 +62,11 @@ impl actix::Handler for Consumer { } #[derive(actix::Message, Debug, Clone)] -#[rtype(result = "Vec")] +#[rtype(result = "Vec")] struct Read; impl actix::Handler for Consumer { - type Result = Vec; + type Result = Vec; fn handle(&mut self, _msg: Read, _ctx: &mut Self::Context) -> Self::Result { self.events.clone() diff --git a/crates/bsnext_path_monitor/src/lib.rs b/crates/bsnext_path_monitor/src/lib.rs index ee00ab08..a61137d4 100644 --- a/crates/bsnext_path_monitor/src/lib.rs +++ b/crates/bsnext_path_monitor/src/lib.rs @@ -1,4 +1,4 @@ -use bsnext_fs::{BufferedChangeEvent, Debounce, FsEvent, FsEventContext, PathDescriptionOwned}; +use bsnext_fs::{BufferedChangeset, Debounce, FsEvent, FsEventContext, PathDescriptionOwned}; use bsnext_input::route::WatchSpec; pub mod path_and_filter; pub mod path_monitor; @@ -6,23 +6,23 @@ pub mod watch_paths_msg; #[derive(actix::Message, Debug, Clone)] #[rtype(result = "()")] -pub struct PathMonitorEvent { +pub struct PathMonitorChangeset { pub watch_spec: WatchSpec, pub debounce: Debounce, - pub group: Group, + pub changeset: Changeset, } #[derive(Debug, Clone)] -pub enum Group { +pub enum Changeset { Singular(FsEvent), - BufferedChange(BufferedChangeEvent), + BufferedChange(BufferedChangeset), } -impl PathMonitorEvent { +impl PathMonitorChangeset { pub fn singular(evt: FsEvent, watch_spec: WatchSpec, debounce: Debounce) -> Self { - PathMonitorEvent { + PathMonitorChangeset { debounce, - group: Group::Singular(evt), + changeset: Changeset::Singular(evt), watch_spec, } } @@ -33,8 +33,8 @@ impl PathMonitorEvent { debounce: Debounce, ) -> Self { Self { - group: Group::BufferedChange(BufferedChangeEvent { - events, + changeset: Changeset::BufferedChange(BufferedChangeset { + changes: events, fs_event_ctx, }), watch_spec, diff --git a/crates/bsnext_path_monitor/src/path_monitor.rs b/crates/bsnext_path_monitor/src/path_monitor.rs index 4a73ab0b..f2f8601f 100644 --- a/crates/bsnext_path_monitor/src/path_monitor.rs +++ b/crates/bsnext_path_monitor/src/path_monitor.rs @@ -1,4 +1,4 @@ -use crate::PathMonitorEvent; +use crate::PathMonitorChangeset; use crate::path_and_filter::PathAndFilter; use crate::watch_paths_msg::WatchPaths; use actix::{Actor, ActorContext, Addr, AsyncContext, Context, Handler, Recipient, StreamHandler}; @@ -24,14 +24,14 @@ pub struct PathMonitor { pub(crate) debounce: Debounce, pub(crate) watch_spec: WatchSpec, addrs: Vec>, - recipient: Recipient, + recipient: Recipient, inner_sender: tokio::sync::mpsc::Sender, inner_receiver: Option>, } impl PathMonitor { pub fn new( - recipient: Recipient, + recipient: Recipient, debounce: Debounce, cwd: PathBuf, fs_ctx: FsEventContext, @@ -111,7 +111,7 @@ impl actix::Handler for PathMonitor { impl StreamHandler for PathMonitor { fn handle(&mut self, event: FsEvent, _ctx: &mut Context) { debug!("StreamHandler for PathMonitor"); - self.recipient.do_send(PathMonitorEvent::singular( + self.recipient.do_send(PathMonitorChangeset::singular( event, self.watch_spec.clone(), self.debounce, @@ -136,12 +136,13 @@ impl StreamHandler> for PathMonitor { _ => None, }) .collect::>(); - self.recipient.do_send(PathMonitorEvent::buffered_change( - outgoing, - self.fs_ctx, - self.watch_spec.clone(), - self.debounce, - )) + self.recipient + .do_send(PathMonitorChangeset::buffered_change( + outgoing, + self.fs_ctx, + self.watch_spec.clone(), + self.debounce, + )) } } @@ -236,7 +237,7 @@ impl Handler for PathMonitor { // todo: any need to buffer these? debug!("Sending some other event"); let output = - PathMonitorEvent::singular(msg, self.watch_spec.clone(), self.debounce); + PathMonitorChangeset::singular(msg, self.watch_spec.clone(), self.debounce); self.recipient.do_send(output) } } diff --git a/crates/bsnext_system/examples/without_stdout.rs b/crates/bsnext_system/examples/without_stdout.rs index e4aac465..a145650e 100644 --- a/crates/bsnext_system/examples/without_stdout.rs +++ b/crates/bsnext_system/examples/without_stdout.rs @@ -1,5 +1,5 @@ use bsnext_dto::external_events::has_output_line_matching; -use bsnext_system::cli::from_args_with_output; +use bsnext_system::cli::from_args_with_buffered_output; use std::env::current_dir; use std::path::PathBuf; use std::process; @@ -17,7 +17,7 @@ async fn async_main() -> i32 { let args = "bslive run --sh 'echo 1' --sh 'echo 2'"; let words = shell_words::split(args).unwrap(); let cwd = PathBuf::from(current_dir().unwrap().to_string_lossy().to_string()); - let (r, events) = from_args_with_output(words, cwd).await; + let (r, events) = from_args_with_buffered_output(words, cwd).await; assert!(has_output_line_matching(&events, "1")); assert!(has_output_line_matching(&events, "2")); match r { diff --git a/crates/bsnext_system/src/api.rs b/crates/bsnext_system/src/api.rs index cee7b802..ea300592 100644 --- a/crates/bsnext_system/src/api.rs +++ b/crates/bsnext_system/src/api.rs @@ -6,7 +6,7 @@ use bsnext_dto::internal::ServerError; use bsnext_dto::ActiveServer; use bsnext_fs::{Debounce, FsEvent}; use bsnext_input::route::WatchSpec; -use bsnext_path_monitor::PathMonitorEvent; +use bsnext_path_monitor::PathMonitorChangeset; use tokio::sync::oneshot; #[derive(Debug)] @@ -45,7 +45,7 @@ impl BsSystemApi { } pub fn fs_event(&self, evt: FsEvent) { - self.sys_address.do_send(PathMonitorEvent::singular( + self.sys_address.do_send(PathMonitorChangeset::singular( evt, WatchSpec::default(), Debounce::default(), diff --git a/crates/bsnext_system/src/cli.rs b/crates/bsnext_system/src/cli.rs index 234164e2..11ef9821 100644 --- a/crates/bsnext_system/src/cli.rs +++ b/crates/bsnext_system/src/cli.rs @@ -11,7 +11,6 @@ use bsnext_tracing::{ init_tracing, init_tracing_with_otel, LineNumberOption, OutputFormat, WriteOption, }; use clap::Parser; -use std::env::current_dir; use std::ffi::OsString; use std::future::Future; use std::path::PathBuf; @@ -20,16 +19,12 @@ use tokio::sync::mpsc::Sender; use tracing::{debug_span, Instrument}; /// The typical lifecycle when ran from a CLI environment -pub async fn from_args(itr: I) -> Result<(), anyhow::Error> +pub async fn from_args(itr: I, cwd: PathBuf) -> Result<(), anyhow::Error> where I: IntoIterator + std::fmt::Debug, T: Into + Clone, { - unsafe { - std::env::set_var("RUST_LIB_BACKTRACE", "0"); - } let args = Args::parse_from(itr); - let cwd = PathBuf::from(current_dir().unwrap().to_string_lossy().to_string()); let logging = *args.logging(); let write_log_opt = if logging.write_log { @@ -80,7 +75,7 @@ where } /// a way of running that will collect events and not exit until the program exits naturally -pub async fn from_args_with_output( +pub async fn from_args_with_buffered_output( itr: I, cwd: PathBuf, ) -> (anyhow::Result<()>, Vec) diff --git a/crates/bsnext_system/src/handle_fs_event_grouping.rs b/crates/bsnext_system/src/handle_fs_changeset.rs similarity index 92% rename from crates/bsnext_system/src/handle_fs_event_grouping.rs rename to crates/bsnext_system/src/handle_fs_changeset.rs index fb7cddb8..99ba5d3c 100644 --- a/crates/bsnext_system/src/handle_fs_event_grouping.rs +++ b/crates/bsnext_system/src/handle_fs_changeset.rs @@ -11,31 +11,31 @@ use bsnext_dto::external_events::ExternalEventsDTO; use bsnext_dto::internal::{AnyEvent, InternalEvents}; use bsnext_dto::{StoppedWatchingDTO, WatchingDTO}; use bsnext_fs::{ - BufferedChangeEvent, Debounce, FsEvent, FsEventContext, FsEventKind, PathAddedEvent, + BufferedChangeset, Debounce, FsEvent, FsEventContext, FsEventKind, PathAddedEvent, PathDescriptionOwned, PathEvent, }; use bsnext_input::bs_live_built_in_task::BsLiveBuiltInTask; use bsnext_input::route::WatchSpec; use bsnext_input::{Input, InputError, PathDefinition, PathDefs, PathError}; -use bsnext_path_monitor::{Group, PathMonitorEvent}; +use bsnext_path_monitor::{Changeset, PathMonitorChangeset}; use bsnext_task::task_trigger::FsChangesTrigger; use tracing::{debug, debug_span, info}; -impl actix::Handler for BsSystem { +impl actix::Handler for BsSystem { type Result = (); - fn handle(&mut self, msg: PathMonitorEvent, ctx: &mut Self::Context) -> Self::Result { + fn handle(&mut self, msg: PathMonitorChangeset, ctx: &mut Self::Context) -> Self::Result { let addr = ctx.address(); let span = debug_span!("Handler->FsEventGrouping->BsSystem"); let _guard = span.enter(); let debounce = msg.debounce; let watch_spec = msg.watch_spec; - let next = match msg.group { - Group::Singular(fs_event) => { + let next = match msg.changeset { + Changeset::Singular(fs_event) => { tracing::debug!("will handle single event"); self.handle_fs_event(fs_event, addr, debounce) } - Group::BufferedChange(buff) => { + Changeset::BufferedChange(buff) => { if let Some((task_trigger, task_spec)) = self.handle_buffered(buff, watch_spec) { tracing::debug!("will trigger task runner"); self.fs_task_tracker @@ -90,10 +90,10 @@ impl BsSystem { #[tracing::instrument(skip_all)] fn handle_buffered( &mut self, - buf: BufferedChangeEvent, + buf: BufferedChangeset, watch_spec: WatchSpec, ) -> Option<(FsChangesTrigger, TaskSpec)> { - tracing::debug!(msg.event_count = buf.events.len(), msg.ctx = ?buf.fs_event_ctx, ?buf); + tracing::debug!(msg.event_count = buf.changes.len(), msg.ctx = ?buf.fs_event_ctx, ?buf); let change = if let Some(mon) = &self.input_monitors { if let Some(fp) = mon.input_ctx.file_path() { @@ -106,7 +106,7 @@ impl BsSystem { buf }; - if change.events.is_empty() { + if change.changes.is_empty() { tracing::debug!( "Ignoring handle_buffered events because it was empty after removing input monitor" ); @@ -114,7 +114,7 @@ impl BsSystem { } let paths = change - .events + .changes .iter() .map(|evt| evt.absolute.to_owned()) .collect::>(); diff --git a/crates/bsnext_system/src/lib.rs b/crates/bsnext_system/src/lib.rs index b67a8259..af1550e5 100644 --- a/crates/bsnext_system/src/lib.rs +++ b/crates/bsnext_system/src/lib.rs @@ -4,7 +4,7 @@ pub mod capabilities; pub mod cli; mod external_event_sender; mod fs_task_tracker; -mod handle_fs_event_grouping; +mod handle_fs_changeset; pub mod input_fs; mod invoke_scope; pub mod monitor_any; diff --git a/crates/bsnext_system/src/run/mod.rs b/crates/bsnext_system/src/run/mod.rs index bb61e47e..6638242c 100644 --- a/crates/bsnext_system/src/run/mod.rs +++ b/crates/bsnext_system/src/run/mod.rs @@ -22,7 +22,7 @@ Use bslive to run groups of tasks and exit immediately after. /// Run a single command and exit immediately /// /// ```rust -/// # use bsnext_system::cli::from_args_with_output; +/// # use bsnext_system::cli::from_args_with_buffered_output; /// # use bsnext_dto::external_events::has_output_line_matching; /// # let rt = actix_rt::System::new(); /// # rt.block_on(async { @@ -31,7 +31,7 @@ Use bslive to run groups of tasks and exit immediately after. /// # "#; /// # let words = shell_words::split(args).unwrap(); /// # let cwd = std::path::PathBuf::from(std::env::current_dir().unwrap().to_string_lossy().to_string()); -/// # let (result, events) = from_args_with_output(words, cwd).await; +/// # let (result, events) = from_args_with_buffered_output(words, cwd).await; /// # assert!(result.is_ok()); /// # assert!(has_output_line_matching(&events, "1")); /// # }); diff --git a/crates/bsnext_system/src/watchables/mod.rs b/crates/bsnext_system/src/watchables/mod.rs index 5132919d..e8a62b06 100644 --- a/crates/bsnext_system/src/watchables/mod.rs +++ b/crates/bsnext_system/src/watchables/mod.rs @@ -4,7 +4,7 @@ use crate::watchables::route_watchable::to_route_watchables; use crate::watchables::server_watchable::to_server_watchables; use actix::Recipient; use bsnext_input::{InferWatchers, Input, WatchGlobalConfig}; -use bsnext_path_monitor::PathMonitorEvent; +use bsnext_path_monitor::PathMonitorChangeset; use std::path::PathBuf; use tracing::debug; @@ -18,11 +18,11 @@ pub mod server_watchable; pub struct MonitorPathWatchables { pub watchables: Vec, pub cwd: PathBuf, - pub recipient: Recipient, + pub recipient: Recipient, } impl MonitorPathWatchables { - pub fn new(cwd: PathBuf, input: &Input, recipient: Recipient) -> Self { + pub fn new(cwd: PathBuf, input: &Input, recipient: Recipient) -> Self { let route_watchables = to_route_watchables(input); let server_watchables = to_server_watchables(input); let any_watchables = to_any_watchables(input); diff --git a/examples/api/index.html b/examples/api/index.html new file mode 100644 index 00000000..41356fc0 --- /dev/null +++ b/examples/api/index.html @@ -0,0 +1,11 @@ + + + + + + Api test + + +

bslive node api

+ + \ No newline at end of file diff --git a/examples/api/index.mjs b/examples/api/index.mjs new file mode 100644 index 00000000..da802677 --- /dev/null +++ b/examples/api/index.mjs @@ -0,0 +1,8 @@ +import { BsSystem } from "@browsersync/bslive"; +const sys = new BsSystem(); +const controller = new AbortController(); +const done = sys.start(["bslive", "."], controller.signal); +setTimeout(() => { + sys.stop(); + done.then((x) => console.log("result ->", x)); +}, 1000); diff --git a/examples/api/package-lock.json b/examples/api/package-lock.json new file mode 100644 index 00000000..7e2e3e59 --- /dev/null +++ b/examples/api/package-lock.json @@ -0,0 +1,46 @@ +{ + "name": "api", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "devDependencies": { + "@browsersync/bslive": "file:../../" + } + }, + "../..": { + "name": "@browsersync/bslive", + "version": "0.28.2", + "dev": true, + "license": "MIT", + "workspaces": [ + "ui", + "inject", + "generated", + "./examples/openai", + "./examples/react-router", + "./examples/watcher" + ], + "bin": { + "bslive": "bin.js" + }, + "devDependencies": { + "@napi-rs/cli": "^2.18.3", + "@playwright/test": "^1.49.0", + "@types/node": "20.17.6", + "ava": "^8.0.1", + "esbuild": "^0.28.0", + "prettier": "^3.3.3", + "typescript": "^5.6.3", + "zod": "^3.24.2" + }, + "engines": { + "node": "24" + } + }, + "node_modules/@browsersync/bslive": { + "resolved": "../..", + "link": true + } + } +} diff --git a/examples/api/package.json b/examples/api/package.json new file mode 100644 index 00000000..7b11c1db --- /dev/null +++ b/examples/api/package.json @@ -0,0 +1,8 @@ +{ + "type": "module", + "private": "true", + "main": "index.mjs", + "devDependencies": { + "@browsersync/bslive": "file:../../" + } +} \ No newline at end of file diff --git a/index.d.ts b/index.d.ts index 8472c1f9..5b418c06 100644 --- a/index.d.ts +++ b/index.d.ts @@ -8,7 +8,7 @@ export declare function startBlocking(args: Array): number export type JsBsSystem = BsSystem export class BsSystem { constructor() - start(args: Array, signal: AbortSignal): Promise + start(args: Array, signal: AbortSignal): Promise send(arg: any): void stop(): void } From ef9ab2a1324127e9a22da965e4aa349db44d9eb2 Mon Sep 17 00:00:00 2001 From: Shane Osbourne Date: Sat, 18 Jul 2026 20:11:58 +0100 Subject: [PATCH 4/7] napi --- .nvmrc | 2 +- Cargo.lock | 66 +- bslive/Cargo.toml | 4 +- bslive/src/async_start.rs | 8 +- index.d.ts | 14 +- index.js | 790 ++++++++++----- package-lock.json | 2003 ++++++++++++++++++++++++++++++++++--- package.json | 18 +- 8 files changed, 2468 insertions(+), 437 deletions(-) diff --git a/.nvmrc b/.nvmrc index 8fdd954d..cabf43b5 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -22 \ No newline at end of file +24 \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 643a6af1..7987bae2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -363,7 +363,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "rustc-hash", + "rustc-hash 1.1.0", "shlex", "syn", "which", @@ -835,7 +835,7 @@ checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" dependencies = [ "glob", "libc", - "libloading", + "libloading 0.8.3", ] [[package]] @@ -898,9 +898,9 @@ dependencies = [ [[package]] name = "convert_case" -version = "0.6.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +checksum = "affbf0190ed2caf063e3def54ff444b449371d55c58e513a95ab98eca50adb49" dependencies = [ "unicode-segmentation", ] @@ -989,13 +989,9 @@ dependencies = [ [[package]] name = "ctor" -version = "0.2.9" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501" -dependencies = [ - "quote", - "syn", -] +checksum = "a394189d59f9befacce833f337f7b1eca5e9a91221bcdd4d28e0114d96e597b3" [[package]] name = "darling" @@ -1793,6 +1789,16 @@ dependencies = [ "windows-targets 0.52.5", ] +[[package]] +name = "libloading" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "754ca22de805bb5744484a5b151a9e1a8e837d5dc232c2d7d8c2e3492edc8b60" +dependencies = [ + "cfg-if", + "windows-link", +] + [[package]] name = "linked-hash-map" version = "0.5.6" @@ -1968,15 +1974,17 @@ dependencies = [ [[package]] name = "napi" -version = "2.16.17" +version = "3.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55740c4ae1d8696773c78fdafd5d0e5fe9bc9f1b071c7ba493ba5c413a9184f3" +checksum = "6826e5ddc15589b2d68c8ad5321c18e85d40488e93e32962f362e572669bccf6" dependencies = [ "bitflags 2.5.0", "ctor", - "napi-derive", + "futures", + "napi-build", "napi-sys", - "once_cell", + "nohash-hasher", + "rustc-hash 2.1.3", "serde", "serde_json", ] @@ -1989,12 +1997,12 @@ checksum = "c9c366d2c8c60b86fa632df75f745509b52f9128f91a6bad4c796e44abb505e1" [[package]] name = "napi-derive" -version = "2.16.13" +version = "3.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cbe2585d8ac223f7d34f13701434b9d5f4eb9c332cccce8dee57ea18ab8ab0c" +checksum = "b0fe526e81c105d3640516fcde83909dd1afe757c0d7a15af58830b5bc0fb9a1" dependencies = [ - "cfg-if", "convert_case", + "ctor", "napi-derive-backend", "proc-macro2", "quote", @@ -2003,26 +2011,24 @@ dependencies = [ [[package]] name = "napi-derive-backend" -version = "1.0.75" +version = "5.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1639aaa9eeb76e91c6ae66da8ce3e89e921cd3885e99ec85f4abacae72fc91bf" +checksum = "514281397bcddd9ea9a876c7a21a57bff2374237a000ca9a64ea0211ec1993e2" dependencies = [ "convert_case", - "once_cell", "proc-macro2", "quote", - "regex", "semver", "syn", ] [[package]] name = "napi-sys" -version = "2.4.0" +version = "3.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "427802e8ec3a734331fec1035594a210ce1ff4dc5bc1950530920ab717964ea3" +checksum = "73e43cf2eb0bd1bf95a43c07c076ebd2da5d1e015a71c3d201faeffffcc0ecac" dependencies = [ - "libloading", + "libloading 0.9.0", ] [[package]] @@ -2060,6 +2066,12 @@ dependencies = [ "libc", ] +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + [[package]] name = "nom" version = "7.1.3" @@ -2725,6 +2737,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + [[package]] name = "rustix" version = "0.38.34" diff --git a/bslive/Cargo.toml b/bslive/Cargo.toml index 1293785c..21b11e44 100644 --- a/bslive/Cargo.toml +++ b/bslive/Cargo.toml @@ -14,10 +14,10 @@ serde_json = { workspace = true } actix-rt = { workspace = true } # Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix -napi-derive = "2.16.13" +napi-derive = "3.5.10" [dependencies.napi] -version = "2.16.17" +version = "3.10.5" default-features = false features = ["napi4", "serde", "serde-json"] diff --git a/bslive/src/async_start.rs b/bslive/src/async_start.rs index 3c5863e5..8ca4175e 100644 --- a/bslive/src/async_start.rs +++ b/bslive/src/async_start.rs @@ -1,5 +1,5 @@ use bsnext_system::cli::from_args; -use napi::{Env, JsNumber}; +use napi::Env; use std::env::current_dir; use std::path::PathBuf; @@ -10,7 +10,7 @@ pub struct AsyncStart { impl napi::Task for AsyncStart { type Output = i32; - type JsValue = JsNumber; + type JsValue = i32; fn compute(&mut self) -> napi::Result { let sys = actix_rt::System::new(); @@ -36,7 +36,7 @@ impl napi::Task for AsyncStart { Ok(result) } - fn resolve(&mut self, env: Env, output: Self::Output) -> napi::Result { - env.create_int32(output) + fn resolve(&mut self, _: Env, output: Self::Output) -> napi::Result { + napi::Result::Ok(output) } } diff --git a/index.d.ts b/index.d.ts index 5b418c06..dd168cb1 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,14 +1,12 @@ -/* tslint:disable */ -/* eslint-disable */ - /* auto-generated by NAPI-RS */ - -/** Launch in a blocking way */ -export declare function startBlocking(args: Array): number -export type JsBsSystem = BsSystem -export class BsSystem { +/* eslint-disable */ +export declare class BsSystem { constructor() start(args: Array, signal: AbortSignal): Promise send(arg: any): void stop(): void } +export type JsBsSystem = BsSystem + +/** Launch in a blocking way */ +export declare function startBlocking(args: Array): number diff --git a/index.js b/index.js index ada601ba..771d70db 100644 --- a/index.js +++ b/index.js @@ -1,316 +1,592 @@ -/* tslint:disable */ +// prettier-ignore /* eslint-disable */ -/* prettier-ignore */ - +// @ts-nocheck /* auto-generated by NAPI-RS */ -const { existsSync, readFileSync } = require('fs') -const { join } = require('path') +const { readFileSync } = require('fs') +let nativeBinding = null +const loadErrors = [] -const { platform, arch } = process +const isMusl = () => { + let musl = false + if (process.platform === 'linux') { + musl = isMuslFromFilesystem() + if (musl === null) { + musl = isMuslFromReport() + } + if (musl === null) { + musl = isMuslFromChildProcess() + } + } + return musl +} -let nativeBinding = null -let localFileExisted = false -let loadError = null +const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-') -function isMusl() { - // For Node 10 - if (!process.report || typeof process.report.getReport !== 'function') { - try { - const lddPath = require('child_process').execSync('which ldd').toString().trim() - return readFileSync(lddPath, 'utf8').includes('musl') - } catch (e) { +const isMuslFromFilesystem = () => { + try { + return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl') + } catch { + return null + } +} + +const isMuslFromReport = () => { + let report = null + if (process.report && typeof process.report.getReport === 'function') { + process.report.excludeNetwork = true + report = process.report.getReport() + } + if (!report) { + return null + } + if (report.header && report.header.glibcVersionRuntime) { + return false + } + if (Array.isArray(report.sharedObjects)) { + if (report.sharedObjects.some(isFileMusl)) { return true } - } else { - const { glibcVersionRuntime } = process.report.getReport().header - return !glibcVersionRuntime } + return false } -switch (platform) { - case 'android': - switch (arch) { - case 'arm64': - localFileExisted = existsSync(join(__dirname, 'bslive.android-arm64.node')) +const isMuslFromChildProcess = () => { + try { + return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl') + } catch (e) { + // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false + return false + } +} + +function requireNative() { + if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) { + try { + return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH); + } catch (err) { + loadErrors.push(err) + } + } else if (process.platform === 'android') { + if (process.arch === 'arm64') { + try { + return require('./bslive.android-arm64.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@browsersync/bslive-android-arm64') + const bindingPackageVersion = require('@browsersync/bslive-android-arm64/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'arm') { + try { + return require('./bslive.android-arm-eabi.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@browsersync/bslive-android-arm-eabi') + const bindingPackageVersion = require('@browsersync/bslive-android-arm-eabi/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`)) + } + } else if (process.platform === 'win32') { + if (process.arch === 'x64') { + if ((process.config && process.config.variables && process.config.variables.shlib_suffix === 'dll.a') || (process.config && process.config.variables && process.config.variables.node_target_type === 'shared_library')) { try { - if (localFileExisted) { - nativeBinding = require('./bslive.android-arm64.node') - } else { - nativeBinding = require('@browsersync/bslive-android-arm64') - } + return require('./bslive.win32-x64-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@browsersync/bslive-win32-x64-gnu') + const bindingPackageVersion = require('@browsersync/bslive-win32-x64-gnu/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + try { + return require('./bslive.win32-x64-msvc.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@browsersync/bslive-win32-x64-msvc') + const bindingPackageVersion = require('@browsersync/bslive-win32-x64-msvc/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } + } else if (process.arch === 'ia32') { + try { + return require('./bslive.win32-ia32-msvc.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@browsersync/bslive-win32-ia32-msvc') + const bindingPackageVersion = require('@browsersync/bslive-win32-ia32-msvc/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'arm64') { + try { + return require('./bslive.win32-arm64-msvc.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@browsersync/bslive-win32-arm64-msvc') + const bindingPackageVersion = require('@browsersync/bslive-win32-arm64-msvc/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`)) + } + } else if (process.platform === 'darwin') { + try { + return require('./bslive.darwin-universal.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@browsersync/bslive-darwin-universal') + const bindingPackageVersion = require('@browsersync/bslive-darwin-universal/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + if (process.arch === 'x64') { + try { + return require('./bslive.darwin-x64.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@browsersync/bslive-darwin-x64') + const bindingPackageVersion = require('@browsersync/bslive-darwin-x64/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'arm64') { + try { + return require('./bslive.darwin-arm64.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@browsersync/bslive-darwin-arm64') + const bindingPackageVersion = require('@browsersync/bslive-darwin-arm64/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`)) + } + } else if (process.platform === 'freebsd') { + if (process.arch === 'x64') { + try { + return require('./bslive.freebsd-x64.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@browsersync/bslive-freebsd-x64') + const bindingPackageVersion = require('@browsersync/bslive-freebsd-x64/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'arm64') { + try { + return require('./bslive.freebsd-arm64.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@browsersync/bslive-freebsd-arm64') + const bindingPackageVersion = require('@browsersync/bslive-freebsd-arm64/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`)) + } + } else if (process.platform === 'linux') { + if (process.arch === 'x64') { + if (isMusl()) { + try { + return require('./bslive.linux-x64-musl.node') } catch (e) { - loadError = e + loadErrors.push(e) } - break - case 'arm': - localFileExisted = existsSync(join(__dirname, 'bslive.android-arm-eabi.node')) try { - if (localFileExisted) { - nativeBinding = require('./bslive.android-arm-eabi.node') - } else { - nativeBinding = require('@browsersync/bslive-android-arm-eabi') + const binding = require('@browsersync/bslive-linux-x64-musl') + const bindingPackageVersion = require('@browsersync/bslive-linux-x64-musl/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } + return binding } catch (e) { - loadError = e + loadErrors.push(e) } - break - default: - throw new Error(`Unsupported architecture on Android ${arch}`) - } - break - case 'win32': - switch (arch) { - case 'x64': - localFileExisted = existsSync( - join(__dirname, 'bslive.win32-x64-msvc.node') - ) + } else { try { - if (localFileExisted) { - nativeBinding = require('./bslive.win32-x64-msvc.node') - } else { - nativeBinding = require('@browsersync/bslive-win32-x64-msvc') - } + return require('./bslive.linux-x64-gnu.node') } catch (e) { - loadError = e + loadErrors.push(e) } - break - case 'ia32': - localFileExisted = existsSync( - join(__dirname, 'bslive.win32-ia32-msvc.node') - ) try { - if (localFileExisted) { - nativeBinding = require('./bslive.win32-ia32-msvc.node') - } else { - nativeBinding = require('@browsersync/bslive-win32-ia32-msvc') + const binding = require('@browsersync/bslive-linux-x64-gnu') + const bindingPackageVersion = require('@browsersync/bslive-linux-x64-gnu/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } + return binding } catch (e) { - loadError = e + loadErrors.push(e) } - break - case 'arm64': - localFileExisted = existsSync( - join(__dirname, 'bslive.win32-arm64-msvc.node') - ) + } + } else if (process.arch === 'arm64') { + if (isMusl()) { try { - if (localFileExisted) { - nativeBinding = require('./bslive.win32-arm64-msvc.node') - } else { - nativeBinding = require('@browsersync/bslive-win32-arm64-msvc') + return require('./bslive.linux-arm64-musl.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@browsersync/bslive-linux-arm64-musl') + const bindingPackageVersion = require('@browsersync/bslive-linux-arm64-musl/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } + return binding } catch (e) { - loadError = e + loadErrors.push(e) } - break - default: - throw new Error(`Unsupported architecture on Windows: ${arch}`) - } - break - case 'darwin': - localFileExisted = existsSync(join(__dirname, 'bslive.darwin-universal.node')) - try { - if (localFileExisted) { - nativeBinding = require('./bslive.darwin-universal.node') } else { - nativeBinding = require('@browsersync/bslive-darwin-universal') - } - break - } catch {} - switch (arch) { - case 'x64': - localFileExisted = existsSync(join(__dirname, 'bslive.darwin-x64.node')) try { - if (localFileExisted) { - nativeBinding = require('./bslive.darwin-x64.node') - } else { - nativeBinding = require('@browsersync/bslive-darwin-x64') - } + return require('./bslive.linux-arm64-gnu.node') } catch (e) { - loadError = e + loadErrors.push(e) } - break - case 'arm64': - localFileExisted = existsSync( - join(__dirname, 'bslive.darwin-arm64.node') - ) try { - if (localFileExisted) { - nativeBinding = require('./bslive.darwin-arm64.node') - } else { - nativeBinding = require('@browsersync/bslive-darwin-arm64') + const binding = require('@browsersync/bslive-linux-arm64-gnu') + const bindingPackageVersion = require('@browsersync/bslive-linux-arm64-gnu/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } + return binding } catch (e) { - loadError = e + loadErrors.push(e) } - break - default: - throw new Error(`Unsupported architecture on macOS: ${arch}`) - } - break - case 'freebsd': - if (arch !== 'x64') { - throw new Error(`Unsupported architecture on FreeBSD: ${arch}`) - } - localFileExisted = existsSync(join(__dirname, 'bslive.freebsd-x64.node')) - try { - if (localFileExisted) { - nativeBinding = require('./bslive.freebsd-x64.node') - } else { - nativeBinding = require('@browsersync/bslive-freebsd-x64') } - } catch (e) { - loadError = e - } - break - case 'linux': - switch (arch) { - case 'x64': - if (isMusl()) { - localFileExisted = existsSync( - join(__dirname, 'bslive.linux-x64-musl.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./bslive.linux-x64-musl.node') - } else { - nativeBinding = require('@browsersync/bslive-linux-x64-musl') - } - } catch (e) { - loadError = e - } - } else { - localFileExisted = existsSync( - join(__dirname, 'bslive.linux-x64-gnu.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./bslive.linux-x64-gnu.node') - } else { - nativeBinding = require('@browsersync/bslive-linux-x64-gnu') - } - } catch (e) { - loadError = e - } + } else if (process.arch === 'arm') { + if (isMusl()) { + try { + return require('./bslive.linux-arm-musleabihf.node') + } catch (e) { + loadErrors.push(e) } - break - case 'arm64': - if (isMusl()) { - localFileExisted = existsSync( - join(__dirname, 'bslive.linux-arm64-musl.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./bslive.linux-arm64-musl.node') - } else { - nativeBinding = require('@browsersync/bslive-linux-arm64-musl') - } - } catch (e) { - loadError = e - } - } else { - localFileExisted = existsSync( - join(__dirname, 'bslive.linux-arm64-gnu.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./bslive.linux-arm64-gnu.node') - } else { - nativeBinding = require('@browsersync/bslive-linux-arm64-gnu') - } - } catch (e) { - loadError = e + try { + const binding = require('@browsersync/bslive-linux-arm-musleabihf') + const bindingPackageVersion = require('@browsersync/bslive-linux-arm-musleabihf/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + try { + return require('./bslive.linux-arm-gnueabihf.node') + } catch (e) { + loadErrors.push(e) } - break - case 'arm': - if (isMusl()) { - localFileExisted = existsSync( - join(__dirname, 'bslive.linux-arm-musleabihf.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./bslive.linux-arm-musleabihf.node') - } else { - nativeBinding = require('@browsersync/bslive-linux-arm-musleabihf') - } - } catch (e) { - loadError = e + try { + const binding = require('@browsersync/bslive-linux-arm-gnueabihf') + const bindingPackageVersion = require('@browsersync/bslive-linux-arm-gnueabihf/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } - } else { - localFileExisted = existsSync( - join(__dirname, 'bslive.linux-arm-gnueabihf.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./bslive.linux-arm-gnueabihf.node') - } else { - nativeBinding = require('@browsersync/bslive-linux-arm-gnueabihf') - } - } catch (e) { - loadError = e + return binding + } catch (e) { + loadErrors.push(e) + } + } + } else if (process.arch === 'loong64') { + if (isMusl()) { + try { + return require('./bslive.linux-loong64-musl.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@browsersync/bslive-linux-loong64-musl') + const bindingPackageVersion = require('@browsersync/bslive-linux-loong64-musl/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + try { + return require('./bslive.linux-loong64-gnu.node') + } catch (e) { + loadErrors.push(e) } - break - case 'riscv64': - if (isMusl()) { - localFileExisted = existsSync( - join(__dirname, 'bslive.linux-riscv64-musl.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./bslive.linux-riscv64-musl.node') - } else { - nativeBinding = require('@browsersync/bslive-linux-riscv64-musl') - } - } catch (e) { - loadError = e + try { + const binding = require('@browsersync/bslive-linux-loong64-gnu') + const bindingPackageVersion = require('@browsersync/bslive-linux-loong64-gnu/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } - } else { - localFileExisted = existsSync( - join(__dirname, 'bslive.linux-riscv64-gnu.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./bslive.linux-riscv64-gnu.node') - } else { - nativeBinding = require('@browsersync/bslive-linux-riscv64-gnu') - } - } catch (e) { - loadError = e + return binding + } catch (e) { + loadErrors.push(e) + } + } + } else if (process.arch === 'riscv64') { + if (isMusl()) { + try { + return require('./bslive.linux-riscv64-musl.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@browsersync/bslive-linux-riscv64-musl') + const bindingPackageVersion = require('@browsersync/bslive-linux-riscv64-musl/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + try { + return require('./bslive.linux-riscv64-gnu.node') + } catch (e) { + loadErrors.push(e) } - break - case 's390x': - localFileExisted = existsSync( - join(__dirname, 'bslive.linux-s390x-gnu.node') - ) try { - if (localFileExisted) { - nativeBinding = require('./bslive.linux-s390x-gnu.node') - } else { - nativeBinding = require('@browsersync/bslive-linux-s390x-gnu') + const binding = require('@browsersync/bslive-linux-riscv64-gnu') + const bindingPackageVersion = require('@browsersync/bslive-linux-riscv64-gnu/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } + return binding } catch (e) { - loadError = e + loadErrors.push(e) + } + } + } else if (process.arch === 'ppc64') { + try { + return require('./bslive.linux-ppc64-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@browsersync/bslive-linux-ppc64-gnu') + const bindingPackageVersion = require('@browsersync/bslive-linux-ppc64-gnu/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 's390x') { + try { + return require('./bslive.linux-s390x-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@browsersync/bslive-linux-s390x-gnu') + const bindingPackageVersion = require('@browsersync/bslive-linux-s390x-gnu/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } - break - default: - throw new Error(`Unsupported architecture on Linux: ${arch}`) + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`)) } - break - default: - throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`) + } else if (process.platform === 'openharmony') { + if (process.arch === 'arm64') { + try { + return require('./bslive.openharmony-arm64.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@browsersync/bslive-openharmony-arm64') + const bindingPackageVersion = require('@browsersync/bslive-openharmony-arm64/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'x64') { + try { + return require('./bslive.openharmony-x64.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@browsersync/bslive-openharmony-x64') + const bindingPackageVersion = require('@browsersync/bslive-openharmony-x64/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'arm') { + try { + return require('./bslive.openharmony-arm.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@browsersync/bslive-openharmony-arm') + const bindingPackageVersion = require('@browsersync/bslive-openharmony-arm/package.json').version + if (bindingPackageVersion !== '0.28.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.28.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`)) + } + } else { + loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`)) + } +} + +nativeBinding = requireNative() + +// NAPI_RS_FORCE_WASI is a tri-state flag: +// unset / any other value → native binding preferred, WASI is only a fallback +// 'true' → force WASI fallback even if native loaded +// 'error' → force WASI and throw if no WASI binding is found +// Treating any non-empty string as truthy (the historical behavior) meant +// NAPI_RS_FORCE_WASI=false, NAPI_RS_FORCE_WASI=0, etc. inadvertently triggered +// the WASI path, causing ENOENT for packages shipped without a .wasi.cjs file. +const forceWasi = + process.env.NAPI_RS_FORCE_WASI === 'true' || process.env.NAPI_RS_FORCE_WASI === 'error' + +if (!nativeBinding || forceWasi) { + let wasiBinding = null + let wasiBindingError = null + try { + wasiBinding = require('./bslive.wasi.cjs') + nativeBinding = wasiBinding + } catch (err) { + if (forceWasi) { + wasiBindingError = err + } + } + if (!nativeBinding || forceWasi) { + try { + wasiBinding = require('@browsersync/bslive-wasm32-wasi') + nativeBinding = wasiBinding + } catch (err) { + if (forceWasi) { + if (!wasiBindingError) { + wasiBindingError = err + } else { + wasiBindingError.cause = err + } + loadErrors.push(err) + } + } + } + if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) { + const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error') + error.cause = wasiBindingError + throw error + } } if (!nativeBinding) { - if (loadError) { - throw loadError + if (loadErrors.length > 0) { + const error = new Error( + `Cannot find native binding. ` + + `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` + + 'Please try `npm i` again after removing both package-lock.json and node_modules directory.', + ) + // assign instead of the `new Error(message, { cause })` options form, + // which Node < 16.9 silently ignores + error.cause = loadErrors.reduce((err, cur) => { + cur.cause = err + return cur + }) + throw error } throw new Error(`Failed to load native binding`) } -const { startBlocking, BsSystem } = nativeBinding - -module.exports.startBlocking = startBlocking -module.exports.BsSystem = BsSystem +module.exports = nativeBinding +module.exports.BsSystem = nativeBinding.BsSystem +module.exports.JsBsSystem = nativeBinding.JsBsSystem +module.exports.startBlocking = nativeBinding.startBlocking diff --git a/package-lock.json b/package-lock.json index d8bd1089..70b6a0c9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "bslive": "bin.js" }, "devDependencies": { - "@napi-rs/cli": "^2.18.3", + "@napi-rs/cli": "^3.7.3", "@playwright/test": "^1.49.0", "@types/node": "20.17.6", "ava": "^8.0.1", @@ -33,33 +33,6 @@ "node": "24" } }, - "crates/bsnext_client": { - "version": "0.2.0", - "extraneous": true, - "license": "ISC", - "workspaces": [ - "./inject", - "./ui" - ], - "dependencies": { - "ts-to-zod": "^3.11.0" - } - }, - "crates/bsnext_client/inject": { - "name": "@browsersync/bslive-inject", - "version": "0.2.0", - "extraneous": true, - "license": "ISC" - }, - "crates/bsnext_client/ui": { - "name": "@browsersync/bslive-ui", - "version": "0.2.0", - "extraneous": true, - "license": "ISC", - "dependencies": { - "lit": "^3.1.3" - } - }, "examples/openai": { "version": "0.28.2", "license": "ISC", @@ -185,14 +158,6 @@ "node": ">=4.2.0" } }, - "examples/watcher": { - "version": "0.14.0", - "extraneous": true, - "license": "ISC", - "devDependencies": { - "preact": "^10.26.4" - } - }, "generated": { "name": "@browsersync/generated", "version": "0.28.2", @@ -663,6 +628,40 @@ "node": ">=20" } }, + "node_modules/@emnapi/core": { + "version": "1.11.2", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.2.tgz", + "integrity": "sha512-TC8MkTuZUtcTSiFeuC0ksCh9QIJ5+F21MvZ4Wn4ORfYaFJ/0dsiudv5tVkejgwZlwQ39jL9WWDe2lz8x0WglOA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "1.2.2", + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.11.2", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.2.tgz", + "integrity": "sha512-kyOl3X0DuTiT1h2ft8r2fYO8JYtU9a9Xis/zBSiGArNaagCOWx90N1k2wxp18czFDH+OgcWGb5ZP/XMt3dcyPA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/wasi-threads": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.2.tgz", + "integrity": "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/@esbuild/aix-ppc64": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz", @@ -1082,122 +1081,1568 @@ "node": ">=12" } }, - "node_modules/@isaacs/fs-minipass": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz", - "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==", + "node_modules/@inquirer/ansi": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@inquirer/ansi/-/ansi-2.0.7.tgz", + "integrity": "sha512-3eTuUO1vH2cZm2ZKHeQxnOqlTi9EfZDGgIe3BL3I4u+rJHocr9Fz86M4fjYABPvFnQG/gGK551HqDiIcETwU6Q==", "dev": true, - "license": "ISC", + "license": "MIT", + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + } + }, + "node_modules/@inquirer/checkbox": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@inquirer/checkbox/-/checkbox-5.2.1.tgz", + "integrity": "sha512-b6xmA/VlTe0ZgDQHDui+Nav470u7u49nRd8/iuhOcQPO9Ch7lGuogydhi2VOmNlZ+zXcM8IcPuNSwQcdJaF/kw==", + "dev": true, + "license": "MIT", "dependencies": { - "minipass": "^7.0.4" + "@inquirer/ansi": "^2.0.7", + "@inquirer/core": "^11.2.1", + "@inquirer/figures": "^2.0.7", + "@inquirer/type": "^4.0.7" }, "engines": { - "node": ">=18.0.0" + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } } }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", - "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "node_modules/@inquirer/confirm": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-6.1.1.tgz", + "integrity": "sha512-eb8DBZcz/2qHWQda4rk2JiQk5h9QV/cVHi1yjt0f69WFZMRFn0sJTye3EAP8icut8UDMjQPsaH5KbcOogefrFQ==", "dev": true, "license": "MIT", "dependencies": { - "@jridgewell/set-array": "^1.2.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.24" + "@inquirer/core": "^11.2.1", + "@inquirer/type": "^4.0.7" }, "engines": { - "node": ">=6.0.0" + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } } }, - "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==", + "node_modules/@inquirer/core": { + "version": "11.2.1", + "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-11.2.1.tgz", + "integrity": "sha512-Qd6GJT1yVyrZZCfN8W2qKF5ApmqryXRhRKCuip8h01x2w/esJQ2XIYc6f9abMIHgKQdBfFTSOdbHRLAhuM09UA==", "dev": true, "license": "MIT", + "dependencies": { + "@inquirer/ansi": "^2.0.7", + "@inquirer/figures": "^2.0.7", + "@inquirer/type": "^4.0.7", + "cli-width": "^4.1.0", + "fast-wrap-ansi": "^0.2.0", + "mute-stream": "^3.0.0", + "signal-exit": "^4.1.0" + }, "engines": { - "node": ">=6.0.0" + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } } }, - "node_modules/@jridgewell/set-array": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", - "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "node_modules/@inquirer/core/node_modules/cli-width": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.1.0.tgz", + "integrity": "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">= 12" + } + }, + "node_modules/@inquirer/core/node_modules/mute-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-3.0.0.tgz", + "integrity": "sha512-dkEJPVvun4FryqBmZ5KhDo0K9iDXAwn08tMLDinNdRBNPcYEDiWYysLcc6k3mjTMlbP9KyylvRpd4wFtwrT9rw==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@inquirer/editor": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/@inquirer/editor/-/editor-5.2.2.tgz", + "integrity": "sha512-ZRVd/oD+sYsUd5zVm0NflqEzlqfYCyHNsqkHl2oWXEUHs12tCbcSFi+wVFEvD8+LGRaMUsVrE7qeo6lSG/S1Vg==", "dev": true, "license": "MIT", + "dependencies": { + "@inquirer/core": "^11.2.1", + "@inquirer/external-editor": "^3.0.3", + "@inquirer/type": "^4.0.7" + }, "engines": { - "node": ">=6.0.0" + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } } }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", - "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "node_modules/@inquirer/expand": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@inquirer/expand/-/expand-5.1.1.tgz", + "integrity": "sha512-YmQpenjbFSHAK3sOd44puHh3V1KXXr+JiNpUztoSQ4drLh2rTVzTap/YtlAVu/5xavifIlBfNEzJ/neZJ1a/1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^11.2.1", + "@inquirer/type": "^4.0.7" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/external-editor": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@inquirer/external-editor/-/external-editor-3.0.3.tgz", + "integrity": "sha512-6thf5I8q7lZwzGLAxPaaGEREEkZ3nyePPDQ1oyobblxmEE8mqTLguScP7pDjUTAibiyb4hfXl+qjUEJ+di/aNA==", + "dev": true, + "license": "MIT", + "dependencies": { + "chardet": "^2.1.1", + "iconv-lite": "^0.7.2" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/external-editor/node_modules/chardet": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-2.2.0.tgz", + "integrity": "sha512-rddelWYNPRrXq6PtNEN2S3f6t9ILzvqaN5pVgi4kqt9jHQaXIial9PznB5iSPVlQSLNaaH22ItWz3EJtQ10+OA==", "dev": true, "license": "MIT" }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.25", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", - "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "node_modules/@inquirer/external-editor/node_modules/iconv-lite": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.3.tgz", + "integrity": "sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/@inquirer/figures": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@inquirer/figures/-/figures-2.0.7.tgz", + "integrity": "sha512-aJ8TBPOGB6f/2qziPfElISTCEd5XOYTFckA2SGjhNmiKzfK/u4ot3v0DUzGVdUnKjN10EqnnEPck36BkyfLnJw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + } + }, + "node_modules/@inquirer/input": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@inquirer/input/-/input-5.1.2.tgz", + "integrity": "sha512-9K/DDBSQpOyZSkt6sOVP9Vo0TR7atX2kuILsUu0x3wVcVbe97lJwIJKMLdMw25tDYuXl/qp6erT0Xs1rfmcfZg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^11.2.1", + "@inquirer/type": "^4.0.7" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/number": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@inquirer/number/-/number-4.1.1.tgz", + "integrity": "sha512-XF4IXAbPnGPgw0wsbC/i2tPcyfdZgDpUlhsqU0SfT4IRIGWha6Xm9VRgN5yYxJq+jnyXlfXI/nQ3ulfk0iEICA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^11.2.1", + "@inquirer/type": "^4.0.7" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/password": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@inquirer/password/-/password-5.1.1.tgz", + "integrity": "sha512-3XBfF7DAsp5qeDsvN5Rd1HmbNokVvEQoUM0QLrRcybC9nX96w3Pbmu7qUsb3IT3J3jBvs2+mTXaKHOUsgHMLzg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/ansi": "^2.0.7", + "@inquirer/core": "^11.2.1", + "@inquirer/type": "^4.0.7" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/prompts": { + "version": "8.5.2", + "resolved": "https://registry.npmjs.org/@inquirer/prompts/-/prompts-8.5.2.tgz", + "integrity": "sha512-IYR/3C/paEVVQYQvdDlFZVjRCJVYHHON0XXMH91KO9GSxs0TdKYWlUdvfQl2EfAHDxUaN3IBffkE/BDTh5nJ6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/checkbox": "^5.2.1", + "@inquirer/confirm": "^6.1.1", + "@inquirer/editor": "^5.2.2", + "@inquirer/expand": "^5.1.1", + "@inquirer/input": "^5.1.2", + "@inquirer/number": "^4.1.1", + "@inquirer/password": "^5.1.1", + "@inquirer/rawlist": "^5.3.1", + "@inquirer/search": "^4.2.1", + "@inquirer/select": "^5.2.1" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/rawlist": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/@inquirer/rawlist/-/rawlist-5.3.1.tgz", + "integrity": "sha512-QqdTqQddL3qPX/PPrjobpsO25NZ4dWXgTLenrR445L2ptLEYE6Z+PD5c5CNDJNx4ugRgELAIpSIJxZaO2jJ2Og==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^11.2.1", + "@inquirer/type": "^4.0.7" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/search": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@inquirer/search/-/search-4.2.1.tgz", + "integrity": "sha512-xJj8QWKRSrfKoBIITLZK61dD3zwo0Rz11fgDImku30/Oe81zMdIdGgrLY2h6RkJ+KZ/GhNYIRMKnH/62qBTA5g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^11.2.1", + "@inquirer/figures": "^2.0.7", + "@inquirer/type": "^4.0.7" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/select": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@inquirer/select/-/select-5.2.1.tgz", + "integrity": "sha512-FlDndEUww8m7BfukO2nJa25vhD+H5jxxCv4oGioKqzyWz3nPHhhw4LKdYRSlXuAx7DsdWia7iyaBPKKS95Evfw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/ansi": "^2.0.7", + "@inquirer/core": "^11.2.1", + "@inquirer/figures": "^2.0.7", + "@inquirer/type": "^4.0.7" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/type": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/@inquirer/type/-/type-4.0.7.tgz", + "integrity": "sha512-t28inv14nMQ1PhKpsJPY+kEs/c00qzeCOS2gTNRyTjG5d6qsVA2fItxW4hkvGZ5lvanGLdtCzVIx5dwdRpN1+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@isaacs/fs-minipass": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz", + "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "minipass": "^7.0.4" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@lit-labs/ssr-dom-shim": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.5.1.tgz", + "integrity": "sha512-Aou5UdlSpr5whQe8AA/bZG0jMj96CoJIWbGfZ91qieWu5AWUMKw8VR/pAkQkJYvBNhmCcWnZlyyk5oze8JIqYA==", + "license": "BSD-3-Clause" + }, + "node_modules/@lit/reactive-element": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-2.1.2.tgz", + "integrity": "sha512-pbCDiVMnne1lYUIaYNN5wrwQXDtHaYtg7YEFPeW+hws6U47WeFvISGUWekPGKWOP1ygrs0ef0o1VJMk1exos5A==", + "license": "BSD-3-Clause", + "dependencies": { + "@lit-labs/ssr-dom-shim": "^1.5.0" + } + }, + "node_modules/@mapbox/node-pre-gyp": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-2.0.3.tgz", + "integrity": "sha512-uwPAhccfFJlsfCxMYTwOdVfOz3xqyj8xYL3zJj8f0pb30tLohnnFPhLuqp4/qoEz8sNxe4SESZedcBojRefIzg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "consola": "^3.2.3", + "detect-libc": "^2.0.0", + "https-proxy-agent": "^7.0.5", + "node-fetch": "^2.6.7", + "nopt": "^8.0.0", + "semver": "^7.5.3", + "tar": "^7.4.0" + }, + "bin": { + "node-pre-gyp": "bin/node-pre-gyp" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@napi-rs/cli": { + "version": "3.7.3", + "resolved": "https://registry.npmjs.org/@napi-rs/cli/-/cli-3.7.3.tgz", + "integrity": "sha512-iu5BOoYjYVixp5jwE7JniHvg72XuKWXUfXteu+6Gt/XY4/mslsS+Qbipleg1+3CAUGHkWc+ebaMJj7Pc93BXSQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/prompts": "^8.5.2", + "@napi-rs/cross-toolchain": "^1.0.3", + "@napi-rs/wasm-tools": "^1.0.1", + "@octokit/rest": "^22.0.1", + "clipanion": "^4.0.0-rc.4", + "colorette": "^2.0.20", + "emnapi": "^1.11.1", + "es-toolkit": "^1.47.0", + "js-yaml": "^4.2.0", + "obug": "^2.1.2", + "semver": "^7.8.2", + "typanion": "^3.14.0" + }, + "bin": { + "napi": "dist/cli.js", + "napi-raw": "cli.mjs" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "peerDependencies": { + "@emnapi/runtime": "^1.7.1" + }, + "peerDependenciesMeta": { + "@emnapi/runtime": { + "optional": true + } + } + }, + "node_modules/@napi-rs/cli/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/@napi-rs/cli/node_modules/js-yaml": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz", + "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@napi-rs/cross-toolchain": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@napi-rs/cross-toolchain/-/cross-toolchain-1.0.3.tgz", + "integrity": "sha512-ENPfLe4937bsKVTDA6zdABx4pq9w0tHqRrJHyaGxgaPq03a2Bd1unD5XSKjXJjebsABJ+MjAv1A2OvCgK9yehg==", + "dev": true, + "license": "MIT", + "workspaces": [ + ".", + "arm64/*", + "x64/*" + ], + "dependencies": { + "@napi-rs/lzma": "^1.4.5", + "@napi-rs/tar": "^1.1.0", + "debug": "^4.4.1" + }, + "peerDependencies": { + "@napi-rs/cross-toolchain-arm64-target-aarch64": "^1.0.3", + "@napi-rs/cross-toolchain-arm64-target-armv7": "^1.0.3", + "@napi-rs/cross-toolchain-arm64-target-ppc64le": "^1.0.3", + "@napi-rs/cross-toolchain-arm64-target-s390x": "^1.0.3", + "@napi-rs/cross-toolchain-arm64-target-x86_64": "^1.0.3", + "@napi-rs/cross-toolchain-x64-target-aarch64": "^1.0.3", + "@napi-rs/cross-toolchain-x64-target-armv7": "^1.0.3", + "@napi-rs/cross-toolchain-x64-target-ppc64le": "^1.0.3", + "@napi-rs/cross-toolchain-x64-target-s390x": "^1.0.3", + "@napi-rs/cross-toolchain-x64-target-x86_64": "^1.0.3" + }, + "peerDependenciesMeta": { + "@napi-rs/cross-toolchain-arm64-target-aarch64": { + "optional": true + }, + "@napi-rs/cross-toolchain-arm64-target-armv7": { + "optional": true + }, + "@napi-rs/cross-toolchain-arm64-target-ppc64le": { + "optional": true + }, + "@napi-rs/cross-toolchain-arm64-target-s390x": { + "optional": true + }, + "@napi-rs/cross-toolchain-arm64-target-x86_64": { + "optional": true + }, + "@napi-rs/cross-toolchain-x64-target-aarch64": { + "optional": true + }, + "@napi-rs/cross-toolchain-x64-target-armv7": { + "optional": true + }, + "@napi-rs/cross-toolchain-x64-target-ppc64le": { + "optional": true + }, + "@napi-rs/cross-toolchain-x64-target-s390x": { + "optional": true + }, + "@napi-rs/cross-toolchain-x64-target-x86_64": { + "optional": true + } + } + }, + "node_modules/@napi-rs/lzma": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma/-/lzma-1.5.1.tgz", + "integrity": "sha512-sgOZ89+y8cDbY+3WbzR8CtIhCuFRWotZ9/2PjPVDJHz6np5KFTAev0DrwiyTJTgFsCRDhfGlbmhMgyhHbWdZ6g==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^22.20 || ^24.12 || >=25" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "optionalDependencies": { + "@napi-rs/lzma-android-arm-eabi": "1.5.1", + "@napi-rs/lzma-android-arm64": "1.5.1", + "@napi-rs/lzma-darwin-arm64": "1.5.1", + "@napi-rs/lzma-darwin-x64": "1.5.1", + "@napi-rs/lzma-freebsd-x64": "1.5.1", + "@napi-rs/lzma-linux-arm-gnueabihf": "1.5.1", + "@napi-rs/lzma-linux-arm64-gnu": "1.5.1", + "@napi-rs/lzma-linux-arm64-musl": "1.5.1", + "@napi-rs/lzma-linux-ppc64-gnu": "1.5.1", + "@napi-rs/lzma-linux-riscv64-gnu": "1.5.1", + "@napi-rs/lzma-linux-s390x-gnu": "1.5.1", + "@napi-rs/lzma-linux-x64-gnu": "1.5.1", + "@napi-rs/lzma-linux-x64-musl": "1.5.1", + "@napi-rs/lzma-wasm32-wasi": "1.5.1", + "@napi-rs/lzma-win32-arm64-msvc": "1.5.1", + "@napi-rs/lzma-win32-ia32-msvc": "1.5.1", + "@napi-rs/lzma-win32-x64-msvc": "1.5.1" + } + }, + "node_modules/@napi-rs/lzma-android-arm-eabi": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-android-arm-eabi/-/lzma-android-arm-eabi-1.5.1.tgz", + "integrity": "sha512-sahBe4ko2Z69NPTddaX6ZgbQZu9SDoITxw1S3dWl1gAGynZG34qHHCT8UaUMFxf3h3zMhCJjEzz4basaBxiTuQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-android-arm64": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-android-arm64/-/lzma-android-arm64-1.5.1.tgz", + "integrity": "sha512-7tkQAJJuBHxAxiEBNFgSTpvrtGpbwZYYJUSOmGEK3OfbdbNeoT2rdBxpM/gY1s+itEVbtOSlpaRPPG19MnwOzA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-darwin-arm64": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-darwin-arm64/-/lzma-darwin-arm64-1.5.1.tgz", + "integrity": "sha512-XWX8gtF+GHGk3nH3Wm3QUZNcxw9QHsFVZz3MzVLhWWHhceede1J4/vD+3dj3E1iKB9G6mualaZxOoD08R3E+7g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-darwin-x64": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-darwin-x64/-/lzma-darwin-x64-1.5.1.tgz", + "integrity": "sha512-CfsqUpMTI1z8enrA/b+GcHM6YDI8D0kqCiqPYEnst4rbOABQ9KZ92ybTTNnlnZ7A017WoMZKUEWc36KXDwi0xg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-freebsd-x64": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-freebsd-x64/-/lzma-freebsd-x64-1.5.1.tgz", + "integrity": "sha512-bTyNfg90FXIgE61U7l14aMmVOqRQ6AyP5JMT3jmCStaZI18apLNPdzZ8i7yqxZfKvRMVfPjE2brXIw27c+RRgA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-linux-arm-gnueabihf": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-arm-gnueabihf/-/lzma-linux-arm-gnueabihf-1.5.1.tgz", + "integrity": "sha512-vNE+D8nrw+eOkBsdKCsmDhowDV3pIMKXEhedvXfbgrWbrO7GlZJH+RXL+X+RYLxGwi8Ym61ZMt15sIOnNmh9Sw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-linux-arm64-gnu": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-arm64-gnu/-/lzma-linux-arm64-gnu-1.5.1.tgz", + "integrity": "sha512-csUem4WgoKGTprv/pOPm9UIWbb+hrfUwYXefpTHPAEGVFLl5behEFabisJ7FtihCa3yG2Efcl+yw25rlhhrIYw==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-linux-arm64-musl": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-arm64-musl/-/lzma-linux-arm64-musl-1.5.1.tgz", + "integrity": "sha512-kB/xhlVN1eLvVmDJSKZEjp5Gg2xDYexNrB5jwpSMbOkeGS6N9AasByPBg5VqCpMYC+zZi7DM458DRhtWYhqXTQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-linux-ppc64-gnu": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-ppc64-gnu/-/lzma-linux-ppc64-gnu-1.5.1.tgz", + "integrity": "sha512-s28RW0W1yBWQc1nbPdF7tp14koqslY3ZWLVI8uaanX292Dc6ezd4NPVwxEoCNBVON/oD7BmUbWGtyFvmm7dQ5A==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-linux-riscv64-gnu": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-riscv64-gnu/-/lzma-linux-riscv64-gnu-1.5.1.tgz", + "integrity": "sha512-+lGNwYlIN14YPMTNvYtIJJqHFevDTd6Juw/1NmXbWx/iRd/LLrjhlM/yluMX6pxs6NkOGsuuEXJJrbbEUS59OQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-linux-s390x-gnu": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-s390x-gnu/-/lzma-linux-s390x-gnu-1.5.1.tgz", + "integrity": "sha512-PB44FFWWFrLeQowhcep1hPD1YcLqKlnnY60RMU74qrxTlr4YGEyzeMItJqh2uivBfv9kQScOF/B0J9+Vab/oyw==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-linux-x64-gnu": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz", + "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-linux-x64-musl": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-musl/-/lzma-linux-x64-musl-1.5.1.tgz", + "integrity": "sha512-I3nsYrWtrW9JpeCr+mkJIVDt0HY3m6qVUBs5vTtoIvJQxwqf1PBXSy5IS7T53ksQFH2kd2UX8rLxJ7B4WISpZg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-wasm32-wasi": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-wasm32-wasi/-/lzma-wasm32-wasi-1.5.1.tgz", + "integrity": "sha512-gy3wwPBa6+XEyA4fUzq6CClrXA1ajXjuVf5zbnHytJRgoHznj+mvpU3+co2fxXwqTCmIpn6KrzqH5bRDztBPhA==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "1.11.2", + "@emnapi/runtime": "1.11.2", + "@napi-rs/wasm-runtime": "^1.1.6" + }, + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-win32-arm64-msvc": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-win32-arm64-msvc/-/lzma-win32-arm64-msvc-1.5.1.tgz", + "integrity": "sha512-dK+huOsHiyH6oJjij+cnjqFCakk2HgWmpI12Xm4pLUyPphe4ebYoJBgehaNAxprmjFqBQ7nL95YPVz9BHyqmPg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-win32-ia32-msvc": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-win32-ia32-msvc/-/lzma-win32-ia32-msvc-1.5.1.tgz", + "integrity": "sha512-dGE8L+0EQ+GyU9ap9InqB/t/PmPG/bLj918q7OsJ29FuTdn8fK4OX3U4IQZhylHIA+/dQ/SXJk5n4yfah2XVvA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-win32-x64-msvc": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-win32-x64-msvc/-/lzma-win32-x64-msvc-1.5.1.tgz", + "integrity": "sha512-EKW4t/iqdCT/xnd5t9oXLvVER/PMNAWXKqUAl3fgvUcOILeZIIht77/dVnfFcc9htA/DCBXC/6YQWdW+LusjFA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/tar": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/tar/-/tar-1.1.1.tgz", + "integrity": "sha512-p6q2HhUc5vwH1CNwfOcrhLoxfgn8ust8Sqlfx+sA4VzAcp1cMbvbkl99tZZlDqOjCHgQNSiTfk/yWPjl/D42qA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + }, + "optionalDependencies": { + "@napi-rs/tar-android-arm-eabi": "1.1.1", + "@napi-rs/tar-android-arm64": "1.1.1", + "@napi-rs/tar-darwin-arm64": "1.1.1", + "@napi-rs/tar-darwin-x64": "1.1.1", + "@napi-rs/tar-freebsd-x64": "1.1.1", + "@napi-rs/tar-linux-arm-gnueabihf": "1.1.1", + "@napi-rs/tar-linux-arm64-gnu": "1.1.1", + "@napi-rs/tar-linux-arm64-musl": "1.1.1", + "@napi-rs/tar-linux-ppc64-gnu": "1.1.1", + "@napi-rs/tar-linux-s390x-gnu": "1.1.1", + "@napi-rs/tar-linux-x64-gnu": "1.1.1", + "@napi-rs/tar-linux-x64-musl": "1.1.1", + "@napi-rs/tar-wasm32-wasi": "1.1.1", + "@napi-rs/tar-win32-arm64-msvc": "1.1.1", + "@napi-rs/tar-win32-ia32-msvc": "1.1.1", + "@napi-rs/tar-win32-x64-msvc": "1.1.1" + } + }, + "node_modules/@napi-rs/tar-android-arm-eabi": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/tar-android-arm-eabi/-/tar-android-arm-eabi-1.1.1.tgz", + "integrity": "sha512-cAhnA10cSusAUbcE9HtjQY/tZ9BH/0w2sKtRcQc94TzIlnm7QSr1htJSd/PPrbWNPtrv1orXb2CkrHlVlbnlHA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/tar-android-arm64": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/tar-android-arm64/-/tar-android-arm64-1.1.1.tgz", + "integrity": "sha512-EslUWHCDBY/g5abTPBiHLsMaML4GagV0TXLm5WL9hAjx/DDtlxz9fegMb77RJ+f7nFLOIsUxF/3QWFvgOT0sMQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/tar-darwin-arm64": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/tar-darwin-arm64/-/tar-darwin-arm64-1.1.1.tgz", + "integrity": "sha512-+A42/6ES5G9CQ35BOwzwA+WBjLID28r2jNPgc0dteD2hhClIhng0mva7D2ujUlXBNmgNOsr1LHn3stA4uTf4NQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/tar-darwin-x64": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/tar-darwin-x64/-/tar-darwin-x64-1.1.1.tgz", + "integrity": "sha512-RYtE8w1dkEvj8hSJCDV5Jw0Rz2i13fsM7u893zv5O9n/4Ad5GNsw/f4RQ7/0YGSFaenkVxqPFrjmEvUHlKzsrg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/tar-freebsd-x64": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/tar-freebsd-x64/-/tar-freebsd-x64-1.1.1.tgz", + "integrity": "sha512-rEepBvCJUwcuvUYkY83e8aot8RsR5Jcnal4PsG3tbWGKW1yAvcXhyMXf0fN6ZGpVRZFnB+FJqDyBxvsCPEXKhw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/tar-linux-arm-gnueabihf": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/tar-linux-arm-gnueabihf/-/tar-linux-arm-gnueabihf-1.1.1.tgz", + "integrity": "sha512-an1bJdfyhI5FpZYyTQ20mrqwR+a676i8GkaYc4Uy12dH/a7TJIfrK6Qa2Gm46arZvxUvx56qxoRKXbpOjUPvwA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/tar-linux-arm64-gnu": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/tar-linux-arm64-gnu/-/tar-linux-arm64-gnu-1.1.1.tgz", + "integrity": "sha512-w++Vtx36T2yHTKws7GVnmHHcUT1ybB59xLWSh9A8bwEpJVG4dG7Qub9mFe5cpcbfrJ+XP2mKKxC3oUJSunK3iQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/tar-linux-arm64-musl": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/tar-linux-arm64-musl/-/tar-linux-arm64-musl-1.1.1.tgz", + "integrity": "sha512-Rh6UFhNtj3i4deJHOBINFIeRL0072mgbeyuK5rl1HokKnNoMKx8qKIZNEzBTTqpogMfDHWGvzyTQdnVxes5dpA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/tar-linux-ppc64-gnu": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/tar-linux-ppc64-gnu/-/tar-linux-ppc64-gnu-1.1.1.tgz", + "integrity": "sha512-Cp+AxFbv9zcyAXtnzQi0OzmgDnQgy2w9D4Ubr+iwzMtVgJcztzcEoCcCrN1k2ATdEB01LX2Vb49IaocGOZhC9Q==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/tar-linux-s390x-gnu": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/tar-linux-s390x-gnu/-/tar-linux-s390x-gnu-1.1.1.tgz", + "integrity": "sha512-ZyscC3SYKTBWyDRYjLOKAd5TyJ7q0KACRdQ8bWrb3rgrra1CCIJD66CsGTH6Dh0AVSdfLwZ8MfIIXU6+14BMjQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/tar-linux-x64-gnu": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/tar-linux-x64-gnu/-/tar-linux-x64-gnu-1.1.1.tgz", + "integrity": "sha512-LlIv+zg4fiOQge9LQX/ieBdRWE2fhVDjCTHxnunZkbugNmdhdelxWf1RpZb/6ZujWpNF4LPu4N/MW7ygg2oYAQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/tar-linux-x64-musl": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/tar-linux-x64-musl/-/tar-linux-x64-musl-1.1.1.tgz", + "integrity": "sha512-gZBeoKLjanOVj55qk4EMu13P2i9M0SuINmlGQkOxm1niIJofexzddHUYtqO5o/5QqtyL8lADmAcZplLILMLhHA==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/tar-wasm32-wasi": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/tar-wasm32-wasi/-/tar-wasm32-wasi-1.1.1.tgz", + "integrity": "sha512-rwtQ1Mdt/ft6g6I54fJzbUeLspl4yTwj6I3UJ6mitKnrN42soJkcDrdh3Y/FGvlpqZTad2YMQ96fGJl3EtAm2Q==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "1.11.2", + "@emnapi/runtime": "1.11.2", + "@napi-rs/wasm-runtime": "^1.1.6" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@napi-rs/tar-win32-arm64-msvc": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/tar-win32-arm64-msvc/-/tar-win32-arm64-msvc-1.1.1.tgz", + "integrity": "sha512-30PVp1AehRpfwxmv5wI4cg0yj3WmWBsZ+1QnLGnvEELu7Eu/+dhNU0nrmhI7VfPgLwSRK2eg9DQTB3tP7Wv9bA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/tar-win32-ia32-msvc": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/tar-win32-ia32-msvc/-/tar-win32-ia32-msvc-1.1.1.tgz", + "integrity": "sha512-aI3/rmz+izUChiSeaPxcasAOxhf3FpJNuIHMXlxS/vpW+HIxUsSDR5+XV61PEG5DL4L/75iENVUxmSGM5l2yaw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/tar-win32-x64-msvc": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/tar-win32-x64-msvc/-/tar-win32-x64-msvc-1.1.1.tgz", + "integrity": "sha512-yJsB2IsrODQVLKbm2Fg1nHiVRbEj49mSPbj4x7JPZWJI0jGVPjohE2Sif0FBbx8OxsVoUODvS0BwksZZ8jl/OA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.6.tgz", + "integrity": "sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@tybys/wasm-util": "^0.10.3" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "peerDependencies": { + "@emnapi/core": "^1.7.1", + "@emnapi/runtime": "^1.7.1" + } + }, + "node_modules/@napi-rs/wasm-tools": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-tools/-/wasm-tools-1.0.1.tgz", + "integrity": "sha512-enkZYyuCdo+9jneCPE/0fjIta4wWnvVN9hBo2HuiMpRF0q3lzv1J6b/cl7i0mxZUKhBrV3aCKDBQnCOhwKbPmQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + }, + "optionalDependencies": { + "@napi-rs/wasm-tools-android-arm-eabi": "1.0.1", + "@napi-rs/wasm-tools-android-arm64": "1.0.1", + "@napi-rs/wasm-tools-darwin-arm64": "1.0.1", + "@napi-rs/wasm-tools-darwin-x64": "1.0.1", + "@napi-rs/wasm-tools-freebsd-x64": "1.0.1", + "@napi-rs/wasm-tools-linux-arm64-gnu": "1.0.1", + "@napi-rs/wasm-tools-linux-arm64-musl": "1.0.1", + "@napi-rs/wasm-tools-linux-x64-gnu": "1.0.1", + "@napi-rs/wasm-tools-linux-x64-musl": "1.0.1", + "@napi-rs/wasm-tools-wasm32-wasi": "1.0.1", + "@napi-rs/wasm-tools-win32-arm64-msvc": "1.0.1", + "@napi-rs/wasm-tools-win32-ia32-msvc": "1.0.1", + "@napi-rs/wasm-tools-win32-x64-msvc": "1.0.1" + } + }, + "node_modules/@napi-rs/wasm-tools-android-arm-eabi": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-tools-android-arm-eabi/-/wasm-tools-android-arm-eabi-1.0.1.tgz", + "integrity": "sha512-lr07E/l571Gft5v4aA1dI8koJEmF1F0UigBbsqg9OWNzg80H3lDPO+auv85y3T/NHE3GirDk7x/D3sLO57vayw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/wasm-tools-android-arm64": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-tools-android-arm64/-/wasm-tools-android-arm64-1.0.1.tgz", + "integrity": "sha512-WDR7S+aRLV6LtBJAg5fmjKkTZIdrEnnQxgdsb7Cf8pYiMWBHLU+LC49OUVppQ2YSPY0+GeYm9yuZWW3kLjJ7Bg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/wasm-tools-darwin-arm64": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-tools-darwin-arm64/-/wasm-tools-darwin-arm64-1.0.1.tgz", + "integrity": "sha512-qWTI+EEkiN0oIn/N2gQo7+TVYil+AJ20jjuzD2vATS6uIjVz+Updeqmszi7zq7rdFTLp6Ea3/z4kDKIfZwmR9g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/wasm-tools-darwin-x64": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-tools-darwin-x64/-/wasm-tools-darwin-x64-1.0.1.tgz", + "integrity": "sha512-bA6hubqtHROR5UI3tToAF/c6TDmaAgF0SWgo4rADHtQ4wdn0JeogvOk50gs2TYVhKPE2ZD2+qqt7oBKB+sxW3A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/wasm-tools-freebsd-x64": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-tools-freebsd-x64/-/wasm-tools-freebsd-x64-1.0.1.tgz", + "integrity": "sha512-90+KLBkD9hZEjPQW1MDfwSt5J1L46EUKacpCZWyRuL6iIEO5CgWU0V/JnEgFsDOGyyYtiTvHc5bUdUTWd4I9Vg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/wasm-tools-linux-arm64-gnu": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-tools-linux-arm64-gnu/-/wasm-tools-linux-arm64-gnu-1.0.1.tgz", + "integrity": "sha512-rG0QlS65x9K/u3HrKafDf8cFKj5wV2JHGfl8abWgKew0GVPyp6vfsDweOwHbWAjcHtp2LHi6JHoW80/MTHm52Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/wasm-tools-linux-arm64-musl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-tools-linux-arm64-musl/-/wasm-tools-linux-arm64-musl-1.0.1.tgz", + "integrity": "sha512-jAasbIvjZXCgX0TCuEFQr+4D6Lla/3AAVx2LmDuMjgG4xoIXzjKWl7c4chuaD+TI+prWT0X6LJcdzFT+ROKGHQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/wasm-tools-linux-x64-gnu": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-tools-linux-x64-gnu/-/wasm-tools-linux-x64-gnu-1.0.1.tgz", + "integrity": "sha512-Plgk5rPqqK2nocBGajkMVbGm010Z7dnUgq0wtnYRZbzWWxwWcXfZMPa8EYxrK4eE8SzpI7VlZP1tdVsdjgGwMw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/wasm-tools-linux-x64-musl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-tools-linux-x64-musl/-/wasm-tools-linux-x64-musl-1.0.1.tgz", + "integrity": "sha512-GW7AzGuWxtQkyHknHWYFdR0CHmW6is8rG2Rf4V6GNmMpmwtXt/ItWYWtBe4zqJWycMNazpfZKSw/BpT7/MVCXQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/wasm-tools-wasm32-wasi": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-tools-wasm32-wasi/-/wasm-tools-wasm32-wasi-1.0.1.tgz", + "integrity": "sha512-/nQVSTrqSsn7YdAc2R7Ips/tnw5SPUcl3D7QrXCNGPqjbatIspnaexvaOYNyKMU6xPu+pc0BTnKVmqhlJJCPLA==", + "cpu": [ + "wasm32" + ], "dev": true, "license": "MIT", + "optional": true, "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" + "@napi-rs/wasm-runtime": "^1.0.3" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@lit-labs/ssr-dom-shim": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.5.1.tgz", - "integrity": "sha512-Aou5UdlSpr5whQe8AA/bZG0jMj96CoJIWbGfZ91qieWu5AWUMKw8VR/pAkQkJYvBNhmCcWnZlyyk5oze8JIqYA==", - "license": "BSD-3-Clause" - }, - "node_modules/@lit/reactive-element": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-2.1.2.tgz", - "integrity": "sha512-pbCDiVMnne1lYUIaYNN5wrwQXDtHaYtg7YEFPeW+hws6U47WeFvISGUWekPGKWOP1ygrs0ef0o1VJMk1exos5A==", - "license": "BSD-3-Clause", - "dependencies": { - "@lit-labs/ssr-dom-shim": "^1.5.0" + "node_modules/@napi-rs/wasm-tools-win32-arm64-msvc": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-tools-win32-arm64-msvc/-/wasm-tools-win32-arm64-msvc-1.0.1.tgz", + "integrity": "sha512-PFi7oJIBu5w7Qzh3dwFea3sHRO3pojMsaEnUIy22QvsW+UJfNQwJCryVrpoUt8m4QyZXI+saEq/0r4GwdoHYFQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" } }, - "node_modules/@mapbox/node-pre-gyp": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-2.0.3.tgz", - "integrity": "sha512-uwPAhccfFJlsfCxMYTwOdVfOz3xqyj8xYL3zJj8f0pb30tLohnnFPhLuqp4/qoEz8sNxe4SESZedcBojRefIzg==", + "node_modules/@napi-rs/wasm-tools-win32-ia32-msvc": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-tools-win32-ia32-msvc/-/wasm-tools-win32-ia32-msvc-1.0.1.tgz", + "integrity": "sha512-gXkuYzxQsgkj05Zaq+KQTkHIN83dFAwMcTKa2aQcpYPRImFm2AQzEyLtpXmyCWzJ0F9ZYAOmbSyrNew8/us6bw==", + "cpu": [ + "ia32" + ], "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "consola": "^3.2.3", - "detect-libc": "^2.0.0", - "https-proxy-agent": "^7.0.5", - "node-fetch": "^2.6.7", - "nopt": "^8.0.0", - "semver": "^7.5.3", - "tar": "^7.4.0" - }, - "bin": { - "node-pre-gyp": "bin/node-pre-gyp" - }, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">=18" + "node": ">= 10" } }, - "node_modules/@napi-rs/cli": { - "version": "2.18.3", + "node_modules/@napi-rs/wasm-tools-win32-x64-msvc": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-tools-win32-x64-msvc/-/wasm-tools-win32-x64-msvc-1.0.1.tgz", + "integrity": "sha512-rEAf05nol3e3eei2sRButmgXP+6ATgm0/38MKhz9Isne82T4rPIMYsCIFj0kOisaGeVwoi2fnm7O9oWp5YVnYQ==", + "cpu": [ + "x64" + ], "dev": true, "license": "MIT", - "bin": { - "napi": "scripts/index.js" - }, + "optional": true, + "os": [ + "win32" + ], "engines": { "node": ">= 10" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Brooooooklyn" } }, "node_modules/@nodelib/fs.scandir": { @@ -1319,6 +2764,173 @@ "node": ">=8" } }, + "node_modules/@octokit/auth-token": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-6.0.0.tgz", + "integrity": "sha512-P4YJBPdPSpWTQ1NU4XYdvHvXJJDxM6YwpS0FZHRgP7YFkdVxsWcpWGy/NVqlAA7PcPCnMacXlRm1y2PFZRWL/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/core": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-7.0.6.tgz", + "integrity": "sha512-DhGl4xMVFGVIyMwswXeyzdL4uXD5OGILGX5N8Y+f6W7LhC1Ze2poSNrkF/fedpVDHEEZ+PHFW0vL14I+mm8K3Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/auth-token": "^6.0.0", + "@octokit/graphql": "^9.0.3", + "@octokit/request": "^10.0.6", + "@octokit/request-error": "^7.0.2", + "@octokit/types": "^16.0.0", + "before-after-hook": "^4.0.0", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/endpoint": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-11.0.3.tgz", + "integrity": "sha512-FWFlNxghg4HrXkD3ifYbS/IdL/mDHjh9QcsNyhQjN8dplUoZbejsdpmuqdA76nxj2xoWPs7p8uX2SNr9rYu0Ag==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^16.0.0", + "universal-user-agent": "^7.0.2" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/graphql": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-9.0.3.tgz", + "integrity": "sha512-grAEuupr/C1rALFnXTv6ZQhFuL1D8G5y8CN04RgrO4FIPMrtm+mcZzFG7dcBm+nq+1ppNixu+Jd78aeJOYxlGA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/request": "^10.0.6", + "@octokit/types": "^16.0.0", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/openapi-types": { + "version": "27.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-27.0.0.tgz", + "integrity": "sha512-whrdktVs1h6gtR+09+QsNk2+FO+49j6ga1c55YZudfEG+oKJVvJLQi3zkOm5JjiUXAagWK2tI2kTGKJ2Ys7MGA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-paginate-rest": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-14.0.0.tgz", + "integrity": "sha512-fNVRE7ufJiAA3XUrha2omTA39M6IXIc6GIZLvlbsm8QOQCYvpq/LkMNGyFlB1d8hTDzsAXa3OKtybdMAYsV/fw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^16.0.0" + }, + "engines": { + "node": ">= 20" + }, + "peerDependencies": { + "@octokit/core": ">=6" + } + }, + "node_modules/@octokit/plugin-request-log": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-6.0.0.tgz", + "integrity": "sha512-UkOzeEN3W91/eBq9sPZNQ7sUBvYCqYbrrD8gTbBuGtHEuycE4/awMXcYvx6sVYo7LypPhmQwwpUe4Yyu4QZN5Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 20" + }, + "peerDependencies": { + "@octokit/core": ">=6" + } + }, + "node_modules/@octokit/plugin-rest-endpoint-methods": { + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-17.0.0.tgz", + "integrity": "sha512-B5yCyIlOJFPqUUeiD0cnBJwWJO8lkJs5d8+ze9QDP6SvfiXSz1BF+91+0MeI1d2yxgOhU/O+CvtiZ9jSkHhFAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^16.0.0" + }, + "engines": { + "node": ">= 20" + }, + "peerDependencies": { + "@octokit/core": ">=6" + } + }, + "node_modules/@octokit/request": { + "version": "10.0.11", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-10.0.11.tgz", + "integrity": "sha512-+s7HUxjfFqOMS9VlIwDffq0MikjSAK0gSpG73W+meAvVAvX4MBrHYTK5Bj3Uot55qFT4gzUtfzE4mGWY4Br8/Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/endpoint": "^11.0.3", + "@octokit/request-error": "^7.0.2", + "@octokit/types": "^16.0.0", + "content-type": "^2.0.0", + "json-with-bigint": "^3.5.3", + "universal-user-agent": "^7.0.2" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/request-error": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-7.1.0.tgz", + "integrity": "sha512-KMQIfq5sOPpkQYajXHwnhjCC0slzCNScLHs9JafXc4RAJI+9f+jNDlBNaIMTvazOPLgb4BnlhGJOTbnN0wIjPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^16.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/rest": { + "version": "22.0.1", + "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-22.0.1.tgz", + "integrity": "sha512-Jzbhzl3CEexhnivb1iQ0KJ7s5vvjMWcmRtq5aUsKmKDrRW6z3r84ngmiFKFvpZjpiU/9/S6ITPFRpn5s/3uQJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/core": "^7.0.6", + "@octokit/plugin-paginate-rest": "^14.0.0", + "@octokit/plugin-request-log": "^6.0.0", + "@octokit/plugin-rest-endpoint-methods": "^17.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/types": { + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-16.0.0.tgz", + "integrity": "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^27.0.0" + } + }, "node_modules/@playwright/test": { "version": "1.49.0", "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.49.0.tgz", @@ -1415,6 +3027,17 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@tybys/wasm-util": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.3.tgz", + "integrity": "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/@types/estree": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", @@ -1877,6 +3500,13 @@ "resolved": "examples/react-router", "link": true }, + "node_modules/before-after-hook": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-4.0.0.tgz", + "integrity": "sha512-q6tR3RPqIB1pMiTRMFcZwuG5T8vwp+vUvEG0vuI6B+Rikh5BfPp2fQ82c925FOs+b0lcFQ8CFrL+KbilfZFhOQ==", + "dev": true, + "license": "Apache-2.0" + }, "node_modules/binary-extensions": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", @@ -2250,6 +3880,22 @@ "node": ">= 10" } }, + "node_modules/clipanion": { + "version": "4.0.0-rc.4", + "resolved": "https://registry.npmjs.org/clipanion/-/clipanion-4.0.0-rc.4.tgz", + "integrity": "sha512-CXkMQxU6s9GklO/1f714dkKBMu1lopS1WFF0B8o4AxPykR1hpozxSiUZ5ZUeBjfPgCWqbcNOtZVFhB8Lkfp1+Q==", + "dev": true, + "license": "MIT", + "workspaces": [ + "website" + ], + "dependencies": { + "typanion": "^3.8.0" + }, + "peerDependencies": { + "typanion": "*" + } + }, "node_modules/cliui": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-9.0.1.tgz", @@ -2371,6 +4017,13 @@ "version": "1.1.4", "license": "MIT" }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true, + "license": "MIT" + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -2420,6 +4073,20 @@ "node": "^14.18.0 || >=16.10.0" } }, + "node_modules/content-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.0.0.tgz", + "integrity": "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", @@ -2568,10 +4235,36 @@ "url": "https://github.com/sindresorhus/emittery?sponsor=1" } }, + "node_modules/emnapi": { + "version": "1.11.2", + "resolved": "https://registry.npmjs.org/emnapi/-/emnapi-1.11.2.tgz", + "integrity": "sha512-iMt/XQc69fFn2EvcU6tm14HmXKwyy0lnABugsQlqp6xFuZIUuO+ONVSg2mz+MTVF8WbC+bic65AvRXdoldALKg==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "node-addon-api": ">= 6.1.0" + }, + "peerDependenciesMeta": { + "node-addon-api": { + "optional": true + } + } + }, "node_modules/emoji-regex": { "version": "8.0.0", "license": "MIT" }, + "node_modules/es-toolkit": { + "version": "1.49.0", + "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.49.0.tgz", + "integrity": "sha512-G5iZ6Pc/FNRY/soKZHC+TxGDD83rHUDXxzaWhGCX44vAv/tMs56WMusnm/KMNK+luUPsgA9U28cGr4RDlSzL2g==", + "dev": true, + "license": "MIT", + "workspaces": [ + "docs", + "benchmarks" + ] + }, "node_modules/esbuild": { "version": "0.28.0", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.0.tgz", @@ -3100,6 +4793,33 @@ "node": ">=8.6.0" } }, + "node_modules/fast-string-truncated-width": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/fast-string-truncated-width/-/fast-string-truncated-width-3.0.3.tgz", + "integrity": "sha512-0jjjIEL6+0jag3l2XWWizO64/aZVtpiGE3t0Zgqxv0DPuxiMjvB3M24fCyhZUO4KomJQPj3LTSUnDP3GpdwC0g==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-string-width": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/fast-string-width/-/fast-string-width-3.0.2.tgz", + "integrity": "sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-string-truncated-width": "^3.0.2" + } + }, + "node_modules/fast-wrap-ansi": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/fast-wrap-ansi/-/fast-wrap-ansi-0.2.2.tgz", + "integrity": "sha512-7F2Fl+TjRSenLqlU3UjSH0iyqopqoZIu7eZVpEirP2g1GtWa2G/ecEmBdgz31+Mxr+ELclgg6sokpSFIQiZ02Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-string-width": "^3.0.2" + } + }, "node_modules/fastq": { "version": "1.17.1", "license": "ISC", @@ -3876,6 +5596,13 @@ "node": ">=4" } }, + "node_modules/json-with-bigint": { + "version": "3.5.10", + "resolved": "https://registry.npmjs.org/json-with-bigint/-/json-with-bigint-3.5.10.tgz", + "integrity": "sha512-Vcx+JVNEBts/xfcoCS69sKrOhOk/3TVlvlT+XzUOefVKnnrbYSCKpDCm10pohsJFtsJVYnwa/cXRZ4eElzaM6w==", + "dev": true, + "license": "MIT" + }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -4042,17 +5769,6 @@ "loose-envify": "cli.js" } }, - "node_modules/lru-cache": { - "version": "6.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/magic-string": { "version": "0.27.0", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.27.0.tgz", @@ -4334,6 +6050,20 @@ "integrity": "sha512-9gRK4+sRWzeN6AOewNBTLXir7Zl/i3GB6Yl26gK4flxz8BXVpD3kt8amREmWNb0mxYOGDotvE5a4N+PtGGKdkg==", "license": "MIT" }, + "node_modules/obug": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.4.tgz", + "integrity": "sha512-4a+OsYv9UktOJKE+l1A4OufDgdRF9PifWj+tJnHURo/P+WOxpG4GzUFL9qCalmWauao6ogiG+QvnCovwPoyAWA==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/onetime": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", @@ -4904,12 +6634,11 @@ } }, "node_modules/semver": { - "version": "7.6.0", + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", "dev": true, "license": "ISC", - "dependencies": { - "lru-cache": "^6.0.0" - }, "bin": { "semver": "bin/semver.js" }, @@ -5314,6 +7043,16 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "license": "0BSD" }, + "node_modules/typanion": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/typanion/-/typanion-3.14.0.tgz", + "integrity": "sha512-ZW/lVMRabETuYCd9O9ZvMhAh8GslSqaUjxmK/JLPCh6l73CvLBiuXswj/+7LdnWOgYsQ130FqLzFz5aGT4I3Ug==", + "dev": true, + "license": "MIT", + "workspaces": [ + "website" + ] + }, "node_modules/type-fest": { "version": "0.13.1", "dev": true, @@ -5355,6 +7094,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/universal-user-agent": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.3.tgz", + "integrity": "sha512-TmnEAEAsBJVZM/AADELsK76llnwcf9vMKuPz8JflO1frO8Lchitr0fNaN9d+Ap0BjKtqWqd/J17qeDnXh8CL2A==", + "dev": true, + "license": "ISC" + }, "node_modules/universalify": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", @@ -5968,11 +7714,6 @@ "node": ">=10" } }, - "node_modules/yallist": { - "version": "4.0.0", - "dev": true, - "license": "ISC" - }, "node_modules/yargs": { "version": "18.0.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-18.0.0.tgz", diff --git a/package.json b/package.json index 6a925556..0a394af3 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "bin.js" ], "devDependencies": { - "@napi-rs/cli": "^2.18.3", + "@napi-rs/cli": "^3.7.3", "@playwright/test": "^1.49.0", "ava": "^8.0.1", "typescript": "^5.6.3", @@ -34,8 +34,8 @@ ], "scripts": { "artifacts": "napi artifacts", - "build": "napi build --cargo-name bslive --platform --release", - "build:debug": "napi build --cargo-name bslive --platform", + "build": "napi build --output-dir=. --package bslive --platform --release", + "build:debug": "napi build --output-dir=. --package bslive --platform", "build:client": "npm run build:client --workspaces --if-present", "build:example": "npm run build:example --workspaces --if-present", "prepublishOnly": "napi prepublish -t npm", @@ -50,13 +50,11 @@ "fmt": "prettier tests inject ui --write" }, "napi": { - "name": "bslive", - "triples": { - "additional": [ - "aarch64-apple-darwin", - "aarch64-pc-windows-msvc" - ] - } + "binaryName": "bslive", + "targets": [ + "aarch64-apple-darwin", + "aarch64-pc-windows-msvc" + ] }, "license": "MIT", "ava": { From e8e387b96331e57c02f55d86f70b7da6560eacda Mon Sep 17 00:00:00 2001 From: Shane Osbourne Date: Sat, 18 Jul 2026 21:55:30 +0100 Subject: [PATCH 5/7] server changeset --- .../bsnext_core/src/servers_supervisor/mod.rs | 1 + .../src/servers_supervisor/resolve_servers.rs | 108 +++++++++++++++ crates/bsnext_dto/src/external_events.rs | 123 ++++++++++++------ crates/bsnext_dto/src/internal.rs | 10 +- crates/bsnext_dto/src/internal_events.rs | 104 +-------------- crates/bsnext_dto/src/lib.rs | 92 ++++++++++++- crates/bsnext_system/src/override_input.rs | 6 +- crates/bsnext_system/src/servers/mod.rs | 116 +---------------- .../bsnext_system/src/start/start_system.rs | 35 ++++- crates/bsnext_system/src/system.rs | 14 +- generated/dto.ts | 38 +++++- generated/schema.js | 55 +++++++- generated/schema.ts | 55 +++++++- inject/dist/index.js | 32 ++--- tests/utils.ts | 8 +- tests/watcher.spec.ts | 8 +- 16 files changed, 482 insertions(+), 323 deletions(-) create mode 100644 crates/bsnext_core/src/servers_supervisor/resolve_servers.rs diff --git a/crates/bsnext_core/src/servers_supervisor/mod.rs b/crates/bsnext_core/src/servers_supervisor/mod.rs index 3c33a64f..18321c6d 100644 --- a/crates/bsnext_core/src/servers_supervisor/mod.rs +++ b/crates/bsnext_core/src/servers_supervisor/mod.rs @@ -2,5 +2,6 @@ pub mod actor; pub mod file_changed_handler; pub mod get_servers_handler; pub mod input_changed_handler; +pub mod resolve_servers; pub mod start_handler; pub mod stop_handler; diff --git a/crates/bsnext_core/src/servers_supervisor/resolve_servers.rs b/crates/bsnext_core/src/servers_supervisor/resolve_servers.rs new file mode 100644 index 00000000..9f438de5 --- /dev/null +++ b/crates/bsnext_core/src/servers_supervisor/resolve_servers.rs @@ -0,0 +1,108 @@ +use crate::server::handler_client_config::ClientConfigChange; +use crate::server::handler_routes_updated::RoutesUpdated; +use crate::servers_supervisor::actor::{ChildHandler, ChildStopped, ServersSupervisor}; +use crate::servers_supervisor::get_servers_handler::GetActiveServers; +use crate::servers_supervisor::input_changed_handler::InputChanged; +use crate::servers_supervisor::start_handler::ChildCreatedInsert; +use actix::{Addr, AsyncContext, ResponseFuture}; +use bsnext_dto::internal::{ChildResult, ServerError}; +use bsnext_dto::GetActiveServersResponse; +use bsnext_input::Input; +use tracing::debug; + +#[derive(actix::Message)] +#[rtype(result = "Result<(GetActiveServersResponse, Vec), ServerError>")] +pub struct ResolveServers { + input: Input, +} + +impl ResolveServers { + pub fn new(input: Input) -> Self { + Self { input } + } +} + +impl actix::Handler for ServersSupervisor { + type Result = ResponseFuture), ServerError>>; + + #[tracing::instrument(skip_all, name = "Handler->ResolveServers->BsSystem")] + fn handle(&mut self, msg: ResolveServers, ctx: &mut Self::Context) -> Self::Result { + // let external_event_sender = self.sender().clone(); + let addr = ctx.address(); + + let f = async move { + debug!("will mark input as changed or new"); + let results = addr.send(InputChanged { input: msg.input }).await; + + let Ok(result_set) = results else { + let e = results.unwrap_err(); + unreachable!("?1 {:?}", e); + }; + + debug!( + "result_set from resolve servers {}", + result_set.changes.len() + ); + + for (maybe_addr, x) in &result_set.changes { + match x { + ChildResult::Stopped(id) => addr.do_send(ChildStopped { + identity: id.clone(), + }), + ChildResult::Created(c) if maybe_addr.is_some() => { + let child_handler = ChildHandler { + actor_address: maybe_addr.clone().expect("guarded above"), + identity: c.server_handler.identity.clone(), + socket_addr: c.server_handler.socket_addr, + }; + addr.do_send(ChildCreatedInsert { child_handler }) + } + ChildResult::Created(_c) => { + unreachable!("can't be created without") + } + ChildResult::Patched(p) if maybe_addr.is_some() => { + if let Some(child_actor) = maybe_addr { + child_actor.do_send(ClientConfigChange { + change_set: p.client_config_change_set.clone(), + }); + child_actor.do_send(RoutesUpdated { + change_set: p.route_change_set.clone(), + }) + } else { + tracing::error!("missing actor addr where it was needed") + } + } + ChildResult::Patched(p) => { + debug!("ChildResult::Patched {:?}", p); + } + ChildResult::PatchErr(e) => { + debug!("ChildResult::PatchErr {:?}", e); + } + ChildResult::CreateErr(e) => { + debug!("ChildResult::CreateErr {:?}", e); + } + } + } + + let res: Vec = result_set + .changes + .into_iter() + .map(|(_, child_result)| child_result) + .collect(); + + get_servers(addr, res) + .await + .map_err(|e| ServerError::Unknown(e.to_string())) + }; + + Box::pin(f) + } +} + +async fn get_servers( + addr: Addr, + results: Vec, +) -> anyhow::Result<(GetActiveServersResponse, Vec)> { + let resp = addr.send(GetActiveServers).await?; + Ok((resp, results)) +} diff --git a/crates/bsnext_dto/src/external_events.rs b/crates/bsnext_dto/src/external_events.rs index da73a729..fa690f6f 100644 --- a/crates/bsnext_dto/src/external_events.rs +++ b/crates/bsnext_dto/src/external_events.rs @@ -1,8 +1,9 @@ use crate::archy::{archy, overlay_results, ArchyNode, Prefix}; use crate::internal::AnyEvent; use crate::{ - FileChangedDTO, FilesChangedDTO, InputAcceptedDTO, OutputLineDTO, ServerIdentityDTO, - ServersChangedDTO, StderrLineDTO, StdoutLineDTO, StoppedWatchingDTO, WatchingDTO, + FileChangedDTO, FilesChangedDTO, InputAcceptedDTO, OutputLineDTO, ServerChangeDTO, + ServerChangesetDTO, ServerIdentityDTO, StderrLineDTO, StdoutLineDTO, StoppedWatchingDTO, + WatchingDTO, }; use bsnext_output::OutputWriterTrait; use bsnext_task::task_report::TaskReport; @@ -17,7 +18,7 @@ use typeshare::typeshare; #[derive(Debug, Clone, serde::Serialize)] #[serde(tag = "kind", content = "payload")] pub enum ExternalEventsDTO { - ServersChanged(ServersChangedDTO), + ServerChangeset(ServerChangesetDTO), Watching(WatchingDTO), WatchingStopped(StoppedWatchingDTO), FileChanged(FileChangedDTO), @@ -126,9 +127,6 @@ impl OutputWriterTrait for ExternalEventsDTO { fn write_pretty(&self, sink: &mut W) -> anyhow::Result<()> { match self { - ExternalEventsDTO::ServersChanged(servers_started) => { - print_servers_changed(sink, servers_started) - } ExternalEventsDTO::Watching(watching) => print_watching(sink, watching), ExternalEventsDTO::WatchingStopped(watching) => print_stopped_watching(sink, watching), ExternalEventsDTO::InputAccepted(input_accepted) => { @@ -159,6 +157,15 @@ impl OutputWriterTrait for ExternalEventsDTO { ExternalEventsDTO::TaskTreeSummary(TaskTreeSummary { tree, report_map }) => { print_task_tree_summary(sink, tree, report_map) } + ExternalEventsDTO::ServerChangeset(ServerChangesetDTO { changeset, .. }) => { + let lines = print_server_updates(changeset); + for line in lines { + if let Err(e) = writeln!(sink, "{line}") { + tracing::error!(?e); + } + } + Ok(()) + } } } } @@ -187,40 +194,6 @@ fn print_task_tree_summary( Ok(()) } -pub fn print_servers_changed( - w: &mut W, - servers_started: &ServersChangedDTO, -) -> anyhow::Result<()> -where - W: Write, -{ - let ServersChangedDTO { - servers_resp, - // changeset, - } = servers_started; - - for server_dto in &servers_resp.servers { - match &server_dto.identity { - ServerIdentityDTO::Both { name, .. } => { - writeln!(w, "[server] [{}] http://{}", name, server_dto.socket_addr)?; - } - ServerIdentityDTO::Address { .. } => { - writeln!(w, "[server] http://{}", server_dto.socket_addr)?; - } - ServerIdentityDTO::Named { name } => { - writeln!(w, "[server] [{}] http://{}", name, &server_dto.socket_addr)? - } - ServerIdentityDTO::Port { .. } => { - writeln!(w, "[server] http://{}", &server_dto.socket_addr)? - } - ServerIdentityDTO::PortNamed { name, .. } => { - writeln!(w, "[server] [{}] http://{}", name, &server_dto.socket_addr)? - } - } - } - Ok(()) -} - pub fn print_stopped_watching(w: &mut W, evt: &StoppedWatchingDTO) -> anyhow::Result<()> { for x in &evt.paths { writeln!(w, "[watching:stopped] {x}")?; @@ -338,3 +311,73 @@ pub fn has_output_line_matching(events: &[AnyEvent], expected: &str) -> bool { ))) if line == expected) }) } + +pub fn print_server_updates(evts: &[ServerChangeDTO]) -> Vec { + evts.iter() + .flat_map(|r| match r { + ServerChangeDTO::Created { + identity, + socket_addr, + } => { + vec![format!( + "[created] {}", + server_display(identity, socket_addr), + )] + } + ServerChangeDTO::Stopped { identity } => { + vec![format!("[stopped] {}", iden(identity))] + } + ServerChangeDTO::CreateErr { error } => { + vec![format!("[server] did not create, reason: {}", error)] + } + ServerChangeDTO::Patched { + changed, + identity, + added, + } => { + let mut lines = vec![]; + // todo: determine WHICH changes were actually applied (instead of saying everything was patched) + for x in changed { + lines.push(format!("[patched] {} {:?}", iden(identity), x)); + } + for x in added { + lines.push(format!("[added] {} {:?}", iden(identity), x)); + } + lines + } + ServerChangeDTO::PatchErr { error, identity } => { + vec![format!("[patch] error {} {} ", iden(identity), error)] + } + }) + .collect() +} + +fn server_display(identity_dto: &ServerIdentityDTO, socket_addr: &str) -> String { + match &identity_dto { + ServerIdentityDTO::Both { name, .. } => { + format!("[server] [{name}] http://{socket_addr}") + } + ServerIdentityDTO::Address { .. } => { + format!("[server] http://{socket_addr}") + } + ServerIdentityDTO::Named { name } => { + format!("[server] [{name}] http://{socket_addr}") + } + ServerIdentityDTO::Port { port } => { + format!("[server] [{port}] http://{socket_addr}") + } + ServerIdentityDTO::PortNamed { name, .. } => { + format!("[server] [{name}] http://{socket_addr}") + } + } +} + +fn iden(identity_dto: &ServerIdentityDTO) -> String { + match identity_dto { + ServerIdentityDTO::Both { name, bind_address } => format!("[{name}] {bind_address}"), + ServerIdentityDTO::Address { bind_address } => bind_address.to_string(), + ServerIdentityDTO::Named { name } => format!("[{name}]"), + ServerIdentityDTO::Port { port } => format!("[{port}]"), + ServerIdentityDTO::PortNamed { port, name } => format!("[{name}] {port}"), + } +} diff --git a/crates/bsnext_dto/src/internal.rs b/crates/bsnext_dto/src/internal.rs index 492435bf..454c8ede 100644 --- a/crates/bsnext_dto/src/internal.rs +++ b/crates/bsnext_dto/src/internal.rs @@ -3,7 +3,7 @@ use crate::external_events::{ ExternalEventsDTO, InvocationIdDTO, TaskActionDTO, TaskActionStageDTO, TaskConclusionDTO, TaskReportDTO, TaskResultDTO, }; -use crate::{GetActiveServersResponse, GetActiveServersResponseDTO, StartupError}; +use crate::{GetActiveServersResponseDTO, StartupError}; use bsnext_input::server_config::ServerIdentity; use bsnext_input::InputError; use bsnext_task::invocation_result::{InvocationConclusion, InvocationResult}; @@ -21,16 +21,10 @@ pub enum AnyEvent { } #[derive(Debug)] pub enum InternalEvents { - ServersChanged { - server_resp: GetActiveServersResponse, - child_results: Vec, - }, InputError(InputError), StartupError(StartupError), TaskAction(TaskAction), - TaskSpecDisplay { - tree: ArchyNode, - }, + TaskSpecDisplay { tree: ArchyNode }, } #[derive(Debug, Clone)] diff --git a/crates/bsnext_dto/src/internal_events.rs b/crates/bsnext_dto/src/internal_events.rs index 89cc31c3..2f0160fc 100644 --- a/crates/bsnext_dto/src/internal_events.rs +++ b/crates/bsnext_dto/src/internal_events.rs @@ -1,8 +1,6 @@ use crate::archy::{archy, Prefix}; -use crate::internal::{ - ChildResult, InternalEvents, InternalEventsDTO, TaskAction, TaskActionStage, -}; -use crate::{GetActiveServersResponseDTO, InputErrorDTO, ServerIdentityDTO}; +use crate::internal::{InternalEvents, InternalEventsDTO, TaskAction, TaskActionStage}; +use crate::InputErrorDTO; use bsnext_input::InputError; use bsnext_output::OutputWriterTrait; use std::io::Write; @@ -10,12 +8,6 @@ use std::io::Write; impl OutputWriterTrait for InternalEvents { fn write_json(&self, sink: &mut W) -> anyhow::Result<()> { match self { - InternalEvents::ServersChanged { server_resp, .. } => { - let as_dto = GetActiveServersResponseDTO::from(server_resp); - let output = InternalEventsDTO::ServersChanged(as_dto); - writeln!(sink, "{}", serde_json::to_string(&output)?) - .map_err(|e| anyhow::anyhow!(e.to_string()))?; - } InternalEvents::InputError(err) => { let e = InputErrorDTO::from(err); writeln!(sink, "{}", serde_json::to_string(&e)?) @@ -56,17 +48,6 @@ impl OutputWriterTrait for InternalEvents { fn write_pretty(&self, sink: &mut W) -> anyhow::Result<()> { match self { - InternalEvents::ServersChanged { - server_resp: _, - child_results, - } => { - let lines = print_server_updates(child_results); - for x in lines { - if let Err(e) = writeln!(sink, "{x}") { - tracing::error!(?e); - } - } - } InternalEvents::InputError(InputError::BsLiveRules(bs_rules)) => { let n = miette::GraphicalReportHandler::new(); let mut inner = String::new(); @@ -90,84 +71,3 @@ impl OutputWriterTrait for InternalEvents { Ok(()) } } - -pub fn print_server_updates(evts: &[ChildResult]) -> Vec { - evts.iter() - .flat_map(|r| match r { - ChildResult::Created(created) => { - vec![format!( - "[created] {}", - server_display( - &ServerIdentityDTO::from(&created.server_handler.identity), - &created.server_handler.socket_addr.to_string() - ), - )] - } - ChildResult::Stopped(stopped) => { - vec![format!("[stopped] {}", iden(stopped))] - } - ChildResult::CreateErr(errored) => { - vec![format!( - "[server] did not create, reason: {}", - errored.server_error - )] - } - ChildResult::Patched(child) => { - let mut lines = vec![]; - // todo: determine WHICH changes were actually applied (instead of saying everything was patched) - for x in &child.route_change_set.changed { - lines.push(format!( - "[patched] {} {:?}", - iden(&child.server_handler.identity), - x - )); - } - for x in &child.route_change_set.added { - lines.push(format!( - "[added] {} {:?}", - iden(&child.server_handler.identity), - x - )); - } - lines - } - ChildResult::PatchErr(errored) => { - vec![format!( - "[patch] error {} {} ", - iden(&errored.identity), - errored.patch_error - )] - } - }) - .collect() -} - -pub fn server_display(identity_dto: &ServerIdentityDTO, socket_addr: &str) -> String { - match &identity_dto { - ServerIdentityDTO::Both { name, .. } => { - format!("[server] [{name}] http://{socket_addr}") - } - ServerIdentityDTO::Address { .. } => { - format!("[server] http://{socket_addr}") - } - ServerIdentityDTO::Named { name } => { - format!("[server] [{name}] http://{socket_addr}") - } - ServerIdentityDTO::Port { port } => { - format!("[server] [{port}] http://{socket_addr}") - } - ServerIdentityDTO::PortNamed { name, .. } => { - format!("[server] [{name}] http://{socket_addr}") - } - } -} - -pub fn iden(identity_dto: impl Into) -> String { - match identity_dto.into() { - ServerIdentityDTO::Both { name, bind_address } => format!("[{name}] {bind_address}"), - ServerIdentityDTO::Address { bind_address } => bind_address.to_string(), - ServerIdentityDTO::Named { name } => format!("[{name}]"), - ServerIdentityDTO::Port { port } => format!("[{port}]"), - ServerIdentityDTO::PortNamed { port, name } => format!("[{name}] {port}"), - } -} diff --git a/crates/bsnext_dto/src/lib.rs b/crates/bsnext_dto/src/lib.rs index b4ad936a..c621432a 100644 --- a/crates/bsnext_dto/src/lib.rs +++ b/crates/bsnext_dto/src/lib.rs @@ -5,10 +5,11 @@ use std::fmt::{Display, Formatter}; use std::net::SocketAddr; use std::path::Path; -use crate::internal::{ServerError, StartupEvent}; +use crate::internal::{ChildCreated, ChildResult, ServerError, StartupEvent}; use bsnext_fs::Debounce; use bsnext_input::client_config::ClientConfig; use bsnext_input::route::{DirRoute, ProxyRoute, RawRoute, Route, RouteKind}; +use bsnext_input::route_manifest::RouteIdentity; use bsnext_tracing::LogLevel; use typeshare::typeshare; @@ -97,10 +98,97 @@ impl From for RouteKindDTO { #[typeshare] #[derive(Debug, Clone, serde::Serialize)] -pub struct ServersChangedDTO { +pub struct ServerChangesetDTO { + pub changeset: Vec, pub servers_resp: GetActiveServersResponseDTO, } +impl ServerChangesetDTO { + pub fn from_changes(servers: &GetActiveServersResponse, changes: &[ChildResult]) -> Self { + let servers = servers.into(); + let changeset = changes + .iter() + .map(|e| match e { + ChildResult::Created(ChildCreated { server_handler }) => ServerChangeDTO::Created { + identity: ServerIdentityDTO::from(&server_handler.identity), + socket_addr: server_handler.socket_addr.to_string(), + }, + ChildResult::CreateErr(e) => ServerChangeDTO::CreateErr { + error: e.server_error.to_string(), + }, + ChildResult::Patched(child) => ServerChangeDTO::Patched { + identity: ServerIdentityDTO::from(&child.server_handler.identity), + changed: child + .route_change_set + .changed + .iter() + .map(RouteIdentityDTO::from) + .collect(), + added: child + .route_change_set + .added + .iter() + .map(RouteIdentityDTO::from) + .collect(), + }, + ChildResult::PatchErr(errored) => ServerChangeDTO::PatchErr { + identity: ServerIdentityDTO::from(&errored.identity), + error: errored.patch_error.to_string(), + }, + ChildResult::Stopped(stopped) => ServerChangeDTO::Stopped { + identity: ServerIdentityDTO::from(stopped), + }, + }) + .collect(); + Self { + changeset, + servers_resp: servers, + } + } +} + +#[typeshare] +#[derive(Debug, PartialEq, Hash, Eq, Clone, serde::Serialize)] +pub struct RouteIdentityDTO { + pub path: String, + pub kind_str: String, +} + +impl From<&'_ RouteIdentity> for RouteIdentityDTO { + fn from(value: &'_ RouteIdentity) -> Self { + Self { + path: value.path.clone(), + kind_str: value.kind_str.to_string(), + } + } +} + +/// @discriminator kind +#[typeshare] +#[derive(Debug, Clone, serde::Serialize)] +#[serde(tag = "kind", content = "payload")] +pub enum ServerChangeDTO { + Created { + identity: ServerIdentityDTO, + socket_addr: String, + }, + Stopped { + identity: ServerIdentityDTO, + }, + CreateErr { + error: String, + }, + Patched { + identity: ServerIdentityDTO, + added: Vec, + changed: Vec, + }, + PatchErr { + identity: ServerIdentityDTO, + error: String, + }, +} + #[typeshare] #[derive(Debug, serde::Serialize)] pub enum EventLevel { diff --git a/crates/bsnext_system/src/override_input.rs b/crates/bsnext_system/src/override_input.rs index 290a506a..c975b25e 100644 --- a/crates/bsnext_system/src/override_input.rs +++ b/crates/bsnext_system/src/override_input.rs @@ -1,7 +1,7 @@ -use crate::servers::ResolveServers; use crate::system::BsSystem; use crate::watchables::MonitorPathWatchables; use actix::{ActorFutureExt, AsyncContext, ResponseActFuture, WrapFuture}; +use bsnext_core::servers_supervisor::resolve_servers::ResolveServers; use bsnext_dto::internal::{AnyEvent, ChildResult, ServerError}; use bsnext_dto::GetActiveServersResponse; use bsnext_input::startup::StartupContext; @@ -24,8 +24,8 @@ impl actix::Handler for BsSystem { let start_ctx_clone = self.start_context.clone(); let addr = ctx.address(); // let ctx_clone = self.st - let f = ctx - .address() + let f = self + .servers() .send(ResolveServers::new(msg.input)) .into_actor(self) .map(move |res, actor, _ctx| { diff --git a/crates/bsnext_system/src/servers/mod.rs b/crates/bsnext_system/src/servers/mod.rs index 49f07ed9..0a035414 100644 --- a/crates/bsnext_system/src/servers/mod.rs +++ b/crates/bsnext_system/src/servers/mod.rs @@ -1,122 +1,8 @@ use crate::system::BsSystem; use actix::ResponseFuture; -use actix_rt::Arbiter; -use bsnext_core::server::handler_client_config::ClientConfigChange; -use bsnext_core::server::handler_routes_updated::RoutesUpdated; -use bsnext_core::servers_supervisor::actor::{ChildHandler, ChildStopped}; use bsnext_core::servers_supervisor::get_servers_handler::GetActiveServers; -use bsnext_core::servers_supervisor::input_changed_handler::InputChanged; -use bsnext_core::servers_supervisor::start_handler::ChildCreatedInsert; -use bsnext_dto::internal::{AnyEvent, ChildResult, InternalEvents, ServerError}; +use bsnext_dto::internal::ServerError; use bsnext_dto::GetActiveServersResponse; -use bsnext_input::Input; -use tracing::debug; - -#[derive(actix::Message)] -#[rtype(result = "Result<(GetActiveServersResponse, Vec), ServerError>")] -pub struct ResolveServers { - input: Input, -} - -impl ResolveServers { - pub fn new(input: Input) -> Self { - Self { input } - } -} - -impl actix::Handler for BsSystem { - type Result = ResponseFuture), ServerError>>; - - #[tracing::instrument(skip_all, name = "Handler->ResolveServers->BsSystem")] - fn handle(&mut self, msg: ResolveServers, _ctx: &mut Self::Context) -> Self::Result { - let external_event_sender = self.sender().clone(); - let addr = self.servers().clone(); - - let f = async move { - debug!("will mark input as changed or new"); - let results = addr.send(InputChanged { input: msg.input }).await; - - let Ok(result_set) = results else { - let e = results.unwrap_err(); - unreachable!("?1 {:?}", e); - }; - - debug!( - "result_set from resolve servers {}", - result_set.changes.len() - ); - - for (maybe_addr, x) in &result_set.changes { - match x { - ChildResult::Stopped(id) => addr.do_send(ChildStopped { - identity: id.clone(), - }), - ChildResult::Created(c) if maybe_addr.is_some() => { - let child_handler = ChildHandler { - actor_address: maybe_addr.clone().expect("guarded above"), - identity: c.server_handler.identity.clone(), - socket_addr: c.server_handler.socket_addr, - }; - addr.do_send(ChildCreatedInsert { child_handler }) - } - ChildResult::Created(_c) => { - unreachable!("can't be created without") - } - ChildResult::Patched(p) if maybe_addr.is_some() => { - if let Some(child_actor) = maybe_addr { - child_actor.do_send(ClientConfigChange { - change_set: p.client_config_change_set.clone(), - }); - child_actor.do_send(RoutesUpdated { - change_set: p.route_change_set.clone(), - }) - } else { - tracing::error!("missing actor addr where it was needed") - } - } - ChildResult::Patched(p) => { - debug!("ChildResult::Patched {:?}", p); - } - ChildResult::PatchErr(e) => { - debug!("ChildResult::PatchErr {:?}", e); - } - ChildResult::CreateErr(e) => { - debug!("ChildResult::CreateErr {:?}", e); - } - } - } - - let res = result_set - .changes - .into_iter() - .map(|(_, child_result)| child_result) - .collect::>(); - - match addr.send(GetActiveServers).await { - Ok(resp) => { - Arbiter::current().spawn({ - let evt = InternalEvents::ServersChanged { - server_resp: resp.clone(), - child_results: res.clone(), - }; - debug!("will emit {:?}", evt); - async move { - match external_event_sender.send(AnyEvent::Internal(evt)).await { - Ok(_) => {} - Err(e) => debug!(?e), - }; - } - }); - Ok((resp, res)) - } - Err(e) => Err(ServerError::Unknown(e.to_string())), - } - }; - - Box::pin(f) - } -} - #[derive(actix::Message)] #[rtype(result = "Result")] pub struct ReadActiveServers; diff --git a/crates/bsnext_system/src/start/start_system.rs b/crates/bsnext_system/src/start/start_system.rs index 2519a0b4..9ec838f1 100644 --- a/crates/bsnext_system/src/start/start_system.rs +++ b/crates/bsnext_system/src/start/start_system.rs @@ -10,8 +10,9 @@ use crate::system::{ use actix::{ Actor, ActorContext, ActorFutureExt, AsyncContext, Handler, ResponseActFuture, WrapFuture, }; +use bsnext_dto::external_events::ExternalEventsDTO; use bsnext_dto::internal::{AnyEvent, ChildResult, InternalEvents}; -use bsnext_dto::{DidStart, StartupError}; +use bsnext_dto::{DidStart, ServerChangesetDTO, StartupError}; use bsnext_input::startup::{RunMode, SystemStart, SystemStartArgs}; use bsnext_input::InputCtx; use std::future::ready; @@ -62,17 +63,27 @@ impl Handler for BsSystem { #[tracing::instrument(name = "BsSystem->Start", skip(self, msg, ctx))] fn handle(&mut self, msg: Start, ctx: &mut Self::Context) -> Self::Result { let addr = ctx.address(); + let servers_addr = self.servers().clone(); match msg.kind.resolve_input(&self.start_context) { Ok(SystemStartArgs::PathWithInput { path, input }) => { debug!("SystemStartArgs::PathWithInput"); let ids = input.ids(); let input_ctx = InputCtx::new(&ids, None, &self.start_context, Some(&path)); - let jobs = crate::system::setup_jobs(addr.clone(), input.clone()); + let jobs = crate::system::setup_jobs(addr.clone(), servers_addr, input.clone()); Box::pin(jobs.into_actor(self).map( move |res: Result, actor, ctx| { - let SetupOk { servers, input, .. } = res.map_err(StartupError::Any)?; + let SetupOk { + servers, + input, + child_results, + .. + } = res.map_err(StartupError::Any)?; + let notif = ServerChangesetDTO::from_changes(&servers, &child_results); + actor.publish_any_event(AnyEvent::External( + ExternalEventsDTO::ServerChangeset(notif), + )); debug!("✅ setup jobs completed"); ctx.notify(MonitorInput { path: path.clone(), @@ -88,12 +99,17 @@ impl Handler for BsSystem { debug!("SystemStartArgs::InputOnly"); let addr = ctx.address(); - let jobs = crate::system::setup_jobs(addr.clone(), input.clone()); + let jobs = crate::system::setup_jobs(addr.clone(), servers_addr, input.clone()); Box::pin(jobs.into_actor(self).map( - move |res: Result, _actor, ctx| { + move |res: Result, actor, ctx| { let res = res?; debug!("✅ setup jobs completed"); + let notif = + ServerChangesetDTO::from_changes(&res.servers, &res.child_results); + actor.publish_any_event(AnyEvent::External( + ExternalEventsDTO::ServerChangeset(notif), + )); let errored = ChildResult::first_server_error(&res.child_results); if let Some(server_error) = errored { debug!("errored: {:?}", errored); @@ -118,7 +134,7 @@ impl Handler for BsSystem { let SetupServersOk { servers, child_results, - } = setup_servers_only(addr_clone, input.clone()).await?; + } = setup_servers_only(servers_addr, input.clone()).await?; let next = SetupOk { input, servers, @@ -129,8 +145,13 @@ impl Handler for BsSystem { }; Box::pin(jobs.into_actor(self).map( - move |res: Result, _actor, ctx| { + move |res: Result, actor, ctx| { let res = res?; + let notif = + ServerChangesetDTO::from_changes(&res.servers, &res.child_results); + actor.publish_any_event(AnyEvent::External( + ExternalEventsDTO::ServerChangeset(notif), + )); debug!("✅ setup jobs completed"); let errored = ChildResult::first_server_error(&res.child_results); if let Some(server_error) = errored { diff --git a/crates/bsnext_system/src/system.rs b/crates/bsnext_system/src/system.rs index a6ce171c..8ee66673 100644 --- a/crates/bsnext_system/src/system.rs +++ b/crates/bsnext_system/src/system.rs @@ -4,12 +4,12 @@ use crate::invoke_scope::{InvokeScope, Invoker}; use crate::monitor_input::InputMonitor; use crate::path_monitors::PathMonitors; use crate::run::resolve_spec::{InvokeRunTasks, ResolveSpec}; -use crate::servers::ResolveServers; use crate::tasks::resolve::ResolveInitialTasks; use crate::tasks::task_spec::TaskSpec; use actix::{Actor, Addr, AsyncContext, ResponseFuture, Running}; use actix_rt::Arbiter; use bsnext_core::servers_supervisor::actor::ServersSupervisor; +use bsnext_core::servers_supervisor::resolve_servers::ResolveServers; use bsnext_dto::external_events::{ExternalEventsDTO, TaskTreePreview, TaskTreeSummary}; use bsnext_dto::internal::{AnyEvent, ChildResult, TaskReportAndTree}; use bsnext_dto::GetActiveServersResponse; @@ -147,13 +147,17 @@ impl actix::Handler for BsSystem { } } -pub async fn setup_jobs(addr: Addr, input: Input) -> anyhow::Result { +pub async fn setup_jobs( + addr: Addr, + servers_addr: Addr, + input: Input, +) -> anyhow::Result { let clone = input.clone(); let clone2 = input.clone(); let spec = addr.send(ResolveInitialTasks::new(clone)).await??; let report_and_tree = addr.send(InvokeRunTasks::new(spec)).await??; - let (servers, child_results) = addr.send(ResolveServers::new(clone2)).await??; + let (servers, child_results) = servers_addr.send(ResolveServers::new(clone2)).await??; Ok(SetupOk { input, report_and_tree, @@ -169,10 +173,10 @@ pub async fn setup_jobs_only(addr: Addr, input: Input) -> anyhow::Resu } pub async fn setup_servers_only( - addr: Addr, + servers_addr: Addr, input: Input, ) -> anyhow::Result { - let (servers, child_results) = addr.send(ResolveServers::new(input)).await??; + let (servers, child_results) = servers_addr.send(ResolveServers::new(input)).await??; Ok(SetupServersOk { servers, child_results, diff --git a/generated/dto.ts b/generated/dto.ts index 49cca032..fd9631eb 100644 --- a/generated/dto.ts +++ b/generated/dto.ts @@ -110,6 +110,11 @@ export interface RouteDTO { kind: RouteKindDTO; } +export interface RouteIdentityDTO { + path: string; + kind_str: string; +} + /** @discriminator kind */ export type ServerChange = | { kind: "Stopped", payload: { @@ -130,15 +135,38 @@ export interface ServerChangeSet { items: ServerChangeSetItem[]; } +/** @discriminator kind */ +export type ServerChangeDTO = + | { kind: "Created", payload: { + identity: ServerIdentityDTO; + socket_addr: string; +}} + | { kind: "Stopped", payload: { + identity: ServerIdentityDTO; +}} + | { kind: "CreateErr", payload: { + error: string; +}} + | { kind: "Patched", payload: { + identity: ServerIdentityDTO; + added: RouteIdentityDTO[]; + changed: RouteIdentityDTO[]; +}} + | { kind: "PatchErr", payload: { + identity: ServerIdentityDTO; + error: string; +}}; + +export interface ServerChangesetDTO { + changeset: ServerChangeDTO[]; + servers_resp: GetActiveServersResponseDTO; +} + export interface ServerDesc { routes: RouteDTO[]; id: string; } -export interface ServersChangedDTO { - servers_resp: GetActiveServersResponseDTO; -} - export interface SseDTOOpts { body: string; } @@ -233,7 +261,7 @@ export enum EventLevel { /** @discriminator kind */ export type ExternalEventsDTO = - | { kind: "ServersChanged", payload: ServersChangedDTO } + | { kind: "ServerChangeset", payload: ServerChangesetDTO } | { kind: "Watching", payload: WatchingDTO } | { kind: "WatchingStopped", payload: StoppedWatchingDTO } | { kind: "FileChanged", payload: FileChangedDTO } diff --git a/generated/schema.js b/generated/schema.js index eaaefc37..a0dba29b 100644 --- a/generated/schema.js +++ b/generated/schema.js @@ -142,6 +142,10 @@ var routeKindDTOSchema = z.discriminatedUnion("kind", [ }) }) ]); +var routeIdentityDTOSchema = z.object({ + path: z.string(), + kind_str: z.string() +}); var serverChangeSchema = z.discriminatedUnion("kind", [ z.object({ kind: z.literal("Stopped"), @@ -171,13 +175,50 @@ var serverChangeSetItemSchema = z.object({ var serverChangeSetSchema = z.object({ items: z.array(serverChangeSetItemSchema) }); +var serverChangeDTOSchema = z.discriminatedUnion("kind", [ + z.object({ + kind: z.literal("Created"), + payload: z.object({ + identity: serverIdentityDTOSchema, + socket_addr: z.string() + }) + }), + z.object({ + kind: z.literal("Stopped"), + payload: z.object({ + identity: serverIdentityDTOSchema + }) + }), + z.object({ + kind: z.literal("CreateErr"), + payload: z.object({ + error: z.string() + }) + }), + z.object({ + kind: z.literal("Patched"), + payload: z.object({ + identity: serverIdentityDTOSchema, + added: z.array(routeIdentityDTOSchema), + changed: z.array(routeIdentityDTOSchema) + }) + }), + z.object({ + kind: z.literal("PatchErr"), + payload: z.object({ + identity: serverIdentityDTOSchema, + error: z.string() + }) + }) +]); +var serverChangesetDTOSchema = z.object({ + changeset: z.array(serverChangeDTOSchema), + servers_resp: getActiveServersResponseDTOSchema +}); var routeDTOSchema = z.object({ path: z.string(), kind: routeKindDTOSchema }); -var serversChangedDTOSchema = z.object({ - servers_resp: getActiveServersResponseDTOSchema -}); var stderrLineDTOSchema = z.object({ line: z.string(), prefix: z.string().optional() @@ -398,8 +439,8 @@ var taskTreeSummarySchema = z.lazy( var externalEventsDTOSchema = z.lazy( () => z.discriminatedUnion("kind", [ z.object({ - kind: z.literal("ServersChanged"), - payload: serversChangedDTOSchema + kind: z.literal("ServerChangeset"), + payload: serverChangesetDTOSchema }), z.object({ kind: z.literal("Watching"), @@ -465,14 +506,16 @@ export { logLevelDTOSchema, outputLineDTOSchema, routeDTOSchema, + routeIdentityDTOSchema, routeKindDTOSchema, + serverChangeDTOSchema, serverChangeSchema, serverChangeSetItemSchema, serverChangeSetSchema, + serverChangesetDTOSchema, serverDTOSchema, serverDescSchema, serverIdentityDTOSchema, - serversChangedDTOSchema, sseDTOOptsSchema, startupEventDTOSchema, stderrLineDTOSchema, diff --git a/generated/schema.ts b/generated/schema.ts index a0756aa1..947aace2 100644 --- a/generated/schema.ts +++ b/generated/schema.ts @@ -151,6 +151,11 @@ export const routeKindDTOSchema = z.discriminatedUnion("kind", [ }), ]); +export const routeIdentityDTOSchema = z.object({ + path: z.string(), + kind_str: z.string(), +}); + export const serverChangeSchema = z.discriminatedUnion("kind", [ z.object({ kind: z.literal("Stopped"), @@ -183,15 +188,53 @@ export const serverChangeSetSchema = z.object({ items: z.array(serverChangeSetItemSchema), }); +export const serverChangeDTOSchema = z.discriminatedUnion("kind", [ + z.object({ + kind: z.literal("Created"), + payload: z.object({ + identity: serverIdentityDTOSchema, + socket_addr: z.string(), + }), + }), + z.object({ + kind: z.literal("Stopped"), + payload: z.object({ + identity: serverIdentityDTOSchema, + }), + }), + z.object({ + kind: z.literal("CreateErr"), + payload: z.object({ + error: z.string(), + }), + }), + z.object({ + kind: z.literal("Patched"), + payload: z.object({ + identity: serverIdentityDTOSchema, + added: z.array(routeIdentityDTOSchema), + changed: z.array(routeIdentityDTOSchema), + }), + }), + z.object({ + kind: z.literal("PatchErr"), + payload: z.object({ + identity: serverIdentityDTOSchema, + error: z.string(), + }), + }), +]); + +export const serverChangesetDTOSchema = z.object({ + changeset: z.array(serverChangeDTOSchema), + servers_resp: getActiveServersResponseDTOSchema, +}); + export const routeDTOSchema = z.object({ path: z.string(), kind: routeKindDTOSchema, }); -export const serversChangedDTOSchema = z.object({ - servers_resp: getActiveServersResponseDTOSchema, -}); - export const stderrLineDTOSchema = z.object({ line: z.string(), prefix: z.string().optional(), @@ -434,8 +477,8 @@ export const externalEventsDTOSchema: z.ZodSchema = z.lazy( () => z.discriminatedUnion("kind", [ z.object({ - kind: z.literal("ServersChanged"), - payload: serversChangedDTOSchema, + kind: z.literal("ServerChangeset"), + payload: serverChangesetDTOSchema, }), z.object({ kind: z.literal("Watching"), diff --git a/inject/dist/index.js b/inject/dist/index.js index f41f2e60..fcee29eb 100644 --- a/inject/dist/index.js +++ b/inject/dist/index.js @@ -1,8 +1,8 @@ -var Vi=Object.create;var Er=Object.defineProperty;var cn=Object.getOwnPropertyDescriptor;var Bi=Object.getOwnPropertyNames;var Wi=Object.getPrototypeOf,Hi=Object.prototype.hasOwnProperty;var qi=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Gi=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Bi(e))!Hi.call(r,i)&&i!==t&&Er(r,i,{get:()=>e[i],enumerable:!(n=cn(e,i))||n.enumerable});return r};var Yi=(r,e,t)=>(t=r!=null?Vi(Wi(r)):{},Gi(e||!r||!r.__esModule?Er(t,"default",{value:r,enumerable:!0}):t,r));var W=(r,e,t,n)=>{for(var i=n>1?void 0:n?cn(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&Er(e,t,i),i};var hi=qi(pi=>{"use strict";var dr=class{constructor(e){this.func=e,this.running=!1,this.id=null,this._handler=()=>(this.running=!1,this.id=null,this.func())}start(e){this.running&&clearTimeout(this.id),this.id=setTimeout(this._handler,e),this.running=!0}stop(){this.running&&(clearTimeout(this.id),this.running=!1,this.id=null)}};dr.start=(r,e)=>setTimeout(e,r);pi.Timer=dr});var Or=function(r,e){return Or=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Or(r,e)};function R(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Or(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var jt=function(){return jt=Object.assign||function(e){for(var t,n=1,i=arguments.length;n0&&o[o.length-1])&&(d[0]===6||d[0]===2)){t=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function H(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return o}function q(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,o;n1||l(y,S)})},A&&(i[y]=A(i[y])))}function l(y,A){try{d(n[y](A))}catch(S){w(o[0][3],S)}}function d(y){y.value instanceof ve?Promise.resolve(y.value.v).then(u,p):w(o[0][2],y)}function u(y){l("next",y)}function p(y){l("throw",y)}function w(y,A){y(A),o.shift(),o.length&&l(o[0][0],o[0][1])}}function un(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof re=="function"?re(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(o){t[o]=r[o]&&function(s){return new Promise(function(c,l){s=r[o](s),i(c,l,s.done,s.value)})}}function i(o,s,c,l){Promise.resolve(l).then(function(d){o({value:d,done:c})},s)}}function k(r){return typeof r=="function"}function It(r){var e=function(n){Error.call(n),n.stack=new Error().stack},t=r(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Pt=It(function(r){return function(t){r(this),this.message=t?t.length+` errors occurred during unsubscription: +var Bi=Object.create;var Or=Object.defineProperty;var ln=Object.getOwnPropertyDescriptor;var Wi=Object.getOwnPropertyNames;var Hi=Object.getPrototypeOf,qi=Object.prototype.hasOwnProperty;var Gi=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Yi=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Wi(e))!qi.call(r,i)&&i!==t&&Or(r,i,{get:()=>e[i],enumerable:!(n=ln(e,i))||n.enumerable});return r};var Ji=(r,e,t)=>(t=r!=null?Bi(Hi(r)):{},Yi(e||!r||!r.__esModule?Or(t,"default",{value:r,enumerable:!0}):t,r));var W=(r,e,t,n)=>{for(var i=n>1?void 0:n?ln(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&Or(e,t,i),i};var mi=Gi(hi=>{"use strict";var ur=class{constructor(e){this.func=e,this.running=!1,this.id=null,this._handler=()=>(this.running=!1,this.id=null,this.func())}start(e){this.running&&clearTimeout(this.id),this.id=setTimeout(this._handler,e),this.running=!0}stop(){this.running&&(clearTimeout(this.id),this.running=!1,this.id=null)}};ur.start=(r,e)=>setTimeout(e,r);hi.Timer=ur});var Cr=function(r,e){return Cr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Cr(r,e)};function R(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Cr(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Rt=function(){return Rt=Object.assign||function(e){for(var t,n=1,i=arguments.length;n0&&o[o.length-1])&&(d[0]===6||d[0]===2)){t=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function H(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return o}function q(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,o;n1||l(y,S)})},A&&(i[y]=A(i[y])))}function l(y,A){try{d(n[y](A))}catch(S){w(o[0][3],S)}}function d(y){y.value instanceof ve?Promise.resolve(y.value.v).then(u,p):w(o[0][2],y)}function u(y){l("next",y)}function p(y){l("throw",y)}function w(y,A){y(A),o.shift(),o.length&&l(o[0][0],o[0][1])}}function fn(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof re=="function"?re(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(o){t[o]=r[o]&&function(s){return new Promise(function(c,l){s=r[o](s),i(c,l,s.done,s.value)})}}function i(o,s,c,l){Promise.resolve(l).then(function(d){o({value:d,done:c})},s)}}function k(r){return typeof r=="function"}function Pt(r){var e=function(n){Error.call(n),n.stack=new Error().stack},t=r(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Dt=Pt(function(r){return function(t){r(this),this.message=t?t.length+` errors occurred during unsubscription: `+t.map(function(n,i){return i+1+") "+n.toString()}).join(` - `):"",this.name="UnsubscriptionError",this.errors=t}});function ye(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}var X=(function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var e,t,n,i,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var c=re(s),l=c.next();!l.done;l=c.next()){var d=l.value;d.remove(this)}}catch(S){e={error:S}}finally{try{l&&!l.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}else s.remove(this);var u=this.initialTeardown;if(k(u))try{u()}catch(S){o=S instanceof Pt?S.errors:[S]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var w=re(p),y=w.next();!y.done;y=w.next()){var A=y.value;try{fn(A)}catch(S){o=o??[],S instanceof Pt?o=q(q([],H(o)),H(S.errors)):o.push(S)}}}catch(S){n={error:S}}finally{try{y&&!y.done&&(i=w.return)&&i.call(w)}finally{if(n)throw n.error}}}if(o)throw new Pt(o)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)fn(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&ye(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&ye(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=(function(){var e=new r;return e.closed=!0,e})(),r})();var Cr=X.EMPTY;function Mt(r){return r instanceof X||r&&"closed"in r&&k(r.remove)&&k(r.add)&&k(r.unsubscribe)}function fn(r){k(r)?r():r.unsubscribe()}var G={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var qe={setTimeout:function(r,e){for(var t=[],n=2;n0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,i=this,o=i.hasError,s=i.isStopped,c=i.observers;return o||s?Cr:(this.currentObservers=null,c.push(t),new X(function(){n.currentObservers=null,ye(c,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,i=n.hasError,o=n.thrownError,s=n.isStopped;i?t.error(o):s&&t.complete()},e.prototype.asObservable=function(){var t=new E;return t.source=this,t},e.create=function(t,n){return new Lt(t,n)},e})(E);var Lt=(function(r){R(e,r);function e(t,n){var i=r.call(this)||this;return i.destination=t,i.source=n,i}return e.prototype.next=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,t)},e.prototype.error=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&i!==void 0?i:Cr},e})(Y);var ut={now:function(){return(ut.delegate||Date).now()},delegate:void 0};var Ut=(function(r){R(e,r);function e(t,n,i){t===void 0&&(t=1/0),n===void 0&&(n=1/0),i===void 0&&(i=ut);var o=r.call(this)||this;return o._bufferSize=t,o._windowTime=n,o._timestampProvider=i,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=n===1/0,o._bufferSize=Math.max(1,t),o._windowTime=Math.max(1,n),o}return e.prototype.next=function(t){var n=this,i=n.isStopped,o=n._buffer,s=n._infiniteTimeWindow,c=n._timestampProvider,l=n._windowTime;i||(o.push(t),!s&&o.push(c.now()+l)),this._trimBuffer(),r.prototype.next.call(this,t)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(t),i=this,o=i._infiniteTimeWindow,s=i._buffer,c=s.slice(),l=0;l0&&(u=new be({next:function($t){return Ct.next($t)},error:function($t){S=!0,I(),p=Dr(U,i,$t),Ct.error($t)},complete:function(){A=!0,I(),p=Dr(U,s),Ct.complete()}}),j(lt).subscribe(u))})(d)}}function Dr(r,e){for(var t=[],n=2;n{let e=new URL(window.location.href),t=e.protocol==="https:"?"wss":"ws",n;if(r.host)n=new URL(r.ws_path,t+"://"+r.host);else{let o=new URL(e);o.protocol=t,o.pathname=r.ws_path,n=o}return Lr(n.toString()).pipe(Mr({delay:5e3}))}}}var Zn={debug(...r){},error(...r){},info(...r){},trace(...r){}},Ur={name:"console",globalSetup:r=>{let e=new Y;return[e,{debug:function(...n){e.next({level:"debug",args:n})},info:function(...n){e.next({level:"info",args:n})},trace:function(...n){e.next({level:"trace",args:n})},error:function(...n){e.next({level:"error",args:n})}}]},resetSink:(r,e,t)=>r.pipe(we(n=>{let i=["trace","debug","info","error"],o=i.indexOf(n.level),s=i.indexOf(t.log_level);o>=s&&console.log(`[${n.level}]`,...n.args)}),xe())};var T;(function(r){r.assertEqual=i=>i;function e(i){}r.assertIs=e;function t(i){throw new Error}r.assertNever=t,r.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},r.getValidEnumValues=i=>{let o=r.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),s={};for(let c of o)s[c]=i[c];return r.objectValues(s)},r.objectValues=i=>r.objectKeys(i).map(function(o){return i[o]}),r.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},r.find=(i,o)=>{for(let s of i)if(o(s))return s},r.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}r.joinValues=n,r.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(T||(T={}));var Zr;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Zr||(Zr={}));var m=T.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ie=r=>{switch(typeof r){case"undefined":return m.undefined;case"string":return m.string;case"number":return isNaN(r)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(r)?m.array:r===null?m.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?m.promise:typeof Map<"u"&&r instanceof Map?m.map:typeof Set<"u"&&r instanceof Set?m.set:typeof Date<"u"&&r instanceof Date?m.date:m.object;default:return m.unknown}},f=T.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),mo=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),z=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(t(s));else{let c=n,l=0;for(;lt.message){let t={},n=[];for(let i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};z.create=r=>new z(r);var Xe=(r,e)=>{let t;switch(r.code){case f.invalid_type:r.received===m.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case f.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,T.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:t=`Unrecognized key(s) in object: ${T.joinValues(r.keys,", ")}`;break;case f.invalid_union:t="Invalid input";break;case f.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${T.joinValues(r.options)}`;break;case f.invalid_enum_value:t=`Invalid enum value. Expected ${T.joinValues(r.options)}, received '${r.received}'`;break;case f.invalid_arguments:t="Invalid function arguments";break;case f.invalid_return_type:t="Invalid function return type";break;case f.invalid_date:t="Invalid date";break;case f.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:T.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case f.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case f.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case f.custom:t="Invalid input";break;case f.invalid_intersection_types:t="Intersection results could not be merged";break;case f.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case f.not_finite:t="Number must be finite";break;default:t=e.defaultError,T.assertNever(r)}return{message:t}},Wn=Xe;function vo(r){Wn=r}function er(){return Wn}var tr=r=>{let{data:e,path:t,errorMaps:n,issueData:i}=r,o=[...t,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let c="",l=n.filter(d=>!!d).slice().reverse();for(let d of l)c=d(s,{data:e,defaultError:c}).message;return{...i,path:o,message:c}},yo=[];function h(r,e){let t=er(),n=tr({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Xe?void 0:Xe].filter(i=>!!i)});r.common.issues.push(n)}var P=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let i of t){if(i.status==="aborted")return _;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let i of t){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let i of t){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return _;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:e.value,value:n}}},_=Object.freeze({status:"aborted"}),Ke=r=>({status:"dirty",value:r}),M=r=>({status:"valid",value:r}),Fr=r=>r.status==="aborted",Vr=r=>r.status==="dirty",Se=r=>r.status==="valid",yt=r=>typeof Promise<"u"&&r instanceof Promise;function rr(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)}function Hn(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t}var v;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(v||(v={}));var mt,vt,B=class{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Fn=(r,e)=>{if(Se(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new z(r.common.issues);return this._error=t,this._error}}};function b(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:i}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,c)=>{var l,d;let{message:u}=r;return s.code==="invalid_enum_value"?{message:u??c.defaultError}:typeof c.data>"u"?{message:(l=u??n)!==null&&l!==void 0?l:c.defaultError}:s.code!=="invalid_type"?{message:c.defaultError}:{message:(d=u??t)!==null&&d!==void 0?d:c.defaultError}},description:i}}var x=class{get description(){return this._def.description}_getType(e){return ie(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ie(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new P,ctx:{common:e.parent.common,data:e.data,parsedType:ie(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(yt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let i={common:{issues:[],async:(n=t?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ie(e)},o=this._parseSync({data:e,path:i.path,parent:i});return Fn(i,o)}"~validate"(e){var t,n;let i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ie(e)};if(!this["~standard"].async)try{let o=this._parseSync({data:e,path:[],parent:i});return Se(o)?{value:o.value}:{issues:i.common.issues}}catch(o){!((n=(t=o?.message)===null||t===void 0?void 0:t.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:i}).then(o=>Se(o)?{value:o.value}:{issues:i.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ie(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(yt(i)?i:Promise.resolve(i));return Fn(n,o)}refine(e,t){let n=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,o)=>{let s=e(i),c=()=>o.addIssue({code:f.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(c(),!1)):s?!0:(c(),!1)})}refinement(e,t){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof t=="function"?t(n,i):t),!1))}_refinement(e){return new Z({schema:this,typeName:g.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return V.create(this,this._def)}nullable(){return te.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return se.create(this)}promise(){return pe.create(this,this._def)}or(e){return $e.create([this,e],this._def)}and(e){return je.create(this,e,this._def)}transform(e){return new Z({...b(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new De({...b(this._def),innerType:this,defaultValue:t,typeName:g.ZodDefault})}brand(){return new gt({typeName:g.ZodBranded,type:this,...b(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Ne({...b(this._def),innerType:this,catchValue:t,typeName:g.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return _t.create(this,e)}readonly(){return Le.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},go=/^c[^\s-]{8,}$/i,_o=/^[0-9a-z]+$/,bo=/^[0-9A-HJKMNP-TV-Z]{26}$/i,xo=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,wo=/^[a-z0-9_-]{21}$/i,So=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ko=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,To=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ao="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",zr,Eo=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Oo=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Co=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,$o=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,jo=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ro=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,qn="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Io=new RegExp(`^${qn}$`);function Gn(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Po(r){return new RegExp(`^${Gn(r)}$`)}function Yn(r){let e=`${qn}T${Gn(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Mo(r,e){return!!((e==="v4"||!e)&&Eo.test(r)||(e==="v6"||!e)&&Co.test(r))}function Do(r,e){if(!So.test(r))return!1;try{let[t]=r.split("."),n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||!i.typ||!i.alg||e&&i.alg!==e)}catch{return!1}}function No(r,e){return!!((e==="v4"||!e)&&Oo.test(r)||(e==="v6"||!e)&&$o.test(r))}var ue=class r extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){let o=this._getOrReturnCtx(e);return h(o,{code:f.invalid_type,expected:m.string,received:o.parsedType}),_}let n=new P,i;for(let o of this._def.checks)if(o.kind==="min")e.data.lengtho.value&&(i=this._getOrReturnCtx(e,i),h(i,{code:f.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,c=e.data.lengthe.test(i),{validation:t,code:f.invalid_string,...v.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...v.errToObj(e)})}url(e){return this._addCheck({kind:"url",...v.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...v.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...v.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...v.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...v.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...v.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...v.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...v.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...v.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...v.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...v.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...v.errToObj(e)})}datetime(e){var t,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...v.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...v.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...v.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...v.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...v.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...v.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...v.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...v.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...v.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...v.errToObj(t)})}nonempty(e){return this.min(1,v.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value{var e;return new ue({checks:[],typeName:g.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...b(r)})};function Lo(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,o=parseInt(r.toFixed(i).replace(".","")),s=parseInt(e.toFixed(i).replace(".",""));return o%s/Math.pow(10,i)}var ke=class r extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==m.number){let o=this._getOrReturnCtx(e);return h(o,{code:f.invalid_type,expected:m.number,received:o.parsedType}),_}let n,i=new P;for(let o of this._def.checks)o.kind==="int"?T.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:f.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:f.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Lo(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),h(n,{code:f.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:f.not_finite,message:o.message}),i.dirty()):T.assertNever(o);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:v.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:v.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuee.kind==="int"||e.kind==="multipleOf"&&T.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.valuenew ke({checks:[],typeName:g.ZodNumber,coerce:r?.coerce||!1,...b(r)});var Te=class r extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==m.bigint)return this._getInvalidInput(e);let n,i=new P;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:f.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),h(n,{code:f.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):T.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return h(t,{code:f.invalid_type,expected:m.bigint,received:t.parsedType}),_}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:v.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value{var e;return new Te({checks:[],typeName:g.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...b(r)})};var Ae=class extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.boolean,received:n.parsedType}),_}return M(e.data)}};Ae.create=r=>new Ae({typeName:g.ZodBoolean,coerce:r?.coerce||!1,...b(r)});var Ee=class r extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){let o=this._getOrReturnCtx(e);return h(o,{code:f.invalid_type,expected:m.date,received:o.parsedType}),_}if(isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return h(o,{code:f.invalid_date}),_}let n=new P,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()o.value&&(i=this._getOrReturnCtx(e,i),h(i,{code:f.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):T.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:v.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:v.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew Ee({checks:[],coerce:r?.coerce||!1,typeName:g.ZodDate,...b(r)});var Qe=class extends x{_parse(e){if(this._getType(e)!==m.symbol){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.symbol,received:n.parsedType}),_}return M(e.data)}};Qe.create=r=>new Qe({typeName:g.ZodSymbol,...b(r)});var Oe=class extends x{_parse(e){if(this._getType(e)!==m.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.undefined,received:n.parsedType}),_}return M(e.data)}};Oe.create=r=>new Oe({typeName:g.ZodUndefined,...b(r)});var Ce=class extends x{_parse(e){if(this._getType(e)!==m.null){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.null,received:n.parsedType}),_}return M(e.data)}};Ce.create=r=>new Ce({typeName:g.ZodNull,...b(r)});var fe=class extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return M(e.data)}};fe.create=r=>new fe({typeName:g.ZodAny,...b(r)});var oe=class extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return M(e.data)}};oe.create=r=>new oe({typeName:g.ZodUnknown,...b(r)});var J=class extends x{_parse(e){let t=this._getOrReturnCtx(e);return h(t,{code:f.invalid_type,expected:m.never,received:t.parsedType}),_}};J.create=r=>new J({typeName:g.ZodNever,...b(r)});var et=class extends x{_parse(e){if(this._getType(e)!==m.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.void,received:n.parsedType}),_}return M(e.data)}};et.create=r=>new et({typeName:g.ZodVoid,...b(r)});var se=class r extends x{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==m.array)return h(t,{code:f.invalid_type,expected:m.array,received:t.parsedType}),_;if(i.exactLength!==null){let s=t.data.length>i.exactLength.value,c=t.data.lengthi.maxLength.value&&(h(t,{code:f.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((s,c)=>i.type._parseAsync(new B(t,s,t.path,c)))).then(s=>P.mergeArray(n,s));let o=[...t.data].map((s,c)=>i.type._parseSync(new B(t,s,t.path,c)));return P.mergeArray(n,o)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:v.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:v.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:v.toString(t)}})}nonempty(e){return this.min(1,e)}};se.create=(r,e)=>new se({type:r,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,...b(e)});function Je(r){if(r instanceof D){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=V.create(Je(n))}return new D({...r._def,shape:()=>e})}else return r instanceof se?new se({...r._def,type:Je(r.element)}):r instanceof V?V.create(Je(r.unwrap())):r instanceof te?te.create(Je(r.unwrap())):r instanceof ee?ee.create(r.items.map(e=>Je(e))):r}var D=class r extends x{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=T.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==m.object){let d=this._getOrReturnCtx(e);return h(d,{code:f.invalid_type,expected:m.object,received:d.parsedType}),_}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),c=[];if(!(this._def.catchall instanceof J&&this._def.unknownKeys==="strip"))for(let d in i.data)s.includes(d)||c.push(d);let l=[];for(let d of s){let u=o[d],p=i.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new B(i,p,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof J){let d=this._def.unknownKeys;if(d==="passthrough")for(let u of c)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(d==="strict")c.length>0&&(h(i,{code:f.unrecognized_keys,keys:c}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let u of c){let p=i.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new B(i,p,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let d=[];for(let u of l){let p=await u.key,w=await u.value;d.push({key:p,value:w,alwaysSet:u.alwaysSet})}return d}).then(d=>P.mergeObjectSync(n,d)):P.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return v.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var i,o,s,c;let l=(s=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,t,n).message)!==null&&s!==void 0?s:n.defaultError;return t.code==="unrecognized_keys"?{message:(c=v.errToObj(e).message)!==null&&c!==void 0?c:l}:{message:l}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:g.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};return T.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}omit(e){let t={};return T.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}deepPartial(){return Je(this)}partial(e){let t={};return T.objectKeys(this.shape).forEach(n=>{let i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}),new r({...this._def,shape:()=>t})}required(e){let t={};return T.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof V;)o=o._def.innerType;t[n]=o}}),new r({...this._def,shape:()=>t})}keyof(){return Jn(T.objectKeys(this.shape))}};D.create=(r,e)=>new D({shape:()=>r,unknownKeys:"strip",catchall:J.create(),typeName:g.ZodObject,...b(e)});D.strictCreate=(r,e)=>new D({shape:()=>r,unknownKeys:"strict",catchall:J.create(),typeName:g.ZodObject,...b(e)});D.lazycreate=(r,e)=>new D({shape:r,unknownKeys:"strip",catchall:J.create(),typeName:g.ZodObject,...b(e)});var $e=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function i(o){for(let c of o)if(c.result.status==="valid")return c.result;for(let c of o)if(c.result.status==="dirty")return t.common.issues.push(...c.ctx.common.issues),c.result;let s=o.map(c=>new z(c.ctx.common.issues));return h(t,{code:f.invalid_union,unionErrors:s}),_}if(t.common.async)return Promise.all(n.map(async o=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let l of n){let d={...t,common:{...t.common,issues:[]},parent:null},u=l._parseSync({data:t.data,path:t.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:d}),d.common.issues.length&&s.push(d.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let c=s.map(l=>new z(l));return h(t,{code:f.invalid_union,unionErrors:c}),_}}get options(){return this._def.options}};$e.create=(r,e)=>new $e({options:r,typeName:g.ZodUnion,...b(e)});var ne=r=>r instanceof Re?ne(r.schema):r instanceof Z?ne(r.innerType()):r instanceof Ie?[r.value]:r instanceof Pe?r.options:r instanceof Me?T.objectValues(r.enum):r instanceof De?ne(r._def.innerType):r instanceof Oe?[void 0]:r instanceof Ce?[null]:r instanceof V?[void 0,...ne(r.unwrap())]:r instanceof te?[null,...ne(r.unwrap())]:r instanceof gt||r instanceof Le?ne(r.unwrap()):r instanceof Ne?ne(r._def.innerType):[],nr=class r extends x{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.object)return h(t,{code:f.invalid_type,expected:m.object,received:t.parsedType}),_;let n=this.discriminator,i=t.data[n],o=this.optionsMap.get(i);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(h(t,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),_)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let i=new Map;for(let o of t){let s=ne(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of s){if(i.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);i.set(c,o)}}return new r({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...b(n)})}};function Br(r,e){let t=ie(r),n=ie(e);if(r===e)return{valid:!0,data:r};if(t===m.object&&n===m.object){let i=T.objectKeys(e),o=T.objectKeys(r).filter(c=>i.indexOf(c)!==-1),s={...r,...e};for(let c of o){let l=Br(r[c],e[c]);if(!l.valid)return{valid:!1};s[c]=l.data}return{valid:!0,data:s}}else if(t===m.array&&n===m.array){if(r.length!==e.length)return{valid:!1};let i=[];for(let o=0;o{if(Fr(o)||Fr(s))return _;let c=Br(o.value,s.value);return c.valid?((Vr(o)||Vr(s))&&t.dirty(),{status:t.value,value:c.data}):(h(n,{code:f.invalid_intersection_types}),_)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};je.create=(r,e,t)=>new je({left:r,right:e,typeName:g.ZodIntersection,...b(t)});var ee=class r extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return h(n,{code:f.invalid_type,expected:m.array,received:n.parsedType}),_;if(n.data.lengththis._def.items.length&&(h(n,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let o=[...n.data].map((s,c)=>{let l=this._def.items[c]||this._def.rest;return l?l._parse(new B(n,s,n.path,c)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>P.mergeArray(t,s)):P.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};ee.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ee({items:r,typeName:g.ZodTuple,rest:null,...b(e)})};var ir=class r extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return h(n,{code:f.invalid_type,expected:m.object,received:n.parsedType}),_;let i=[],o=this._def.keyType,s=this._def.valueType;for(let c in n.data)i.push({key:o._parse(new B(n,c,n.path,c)),value:s._parse(new B(n,n.data[c],n.path,c)),alwaysSet:c in n.data});return n.common.async?P.mergeObjectAsync(t,i):P.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof x?new r({keyType:e,valueType:t,typeName:g.ZodRecord,...b(n)}):new r({keyType:ue.create(),valueType:e,typeName:g.ZodRecord,...b(t)})}},tt=class extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return h(n,{code:f.invalid_type,expected:m.map,received:n.parsedType}),_;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([c,l],d)=>({key:i._parse(new B(n,c,n.path,[d,"key"])),value:o._parse(new B(n,l,n.path,[d,"value"]))}));if(n.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let l of s){let d=await l.key,u=await l.value;if(d.status==="aborted"||u.status==="aborted")return _;(d.status==="dirty"||u.status==="dirty")&&t.dirty(),c.set(d.value,u.value)}return{status:t.value,value:c}})}else{let c=new Map;for(let l of s){let d=l.key,u=l.value;if(d.status==="aborted"||u.status==="aborted")return _;(d.status==="dirty"||u.status==="dirty")&&t.dirty(),c.set(d.value,u.value)}return{status:t.value,value:c}}}};tt.create=(r,e,t)=>new tt({valueType:e,keyType:r,typeName:g.ZodMap,...b(t)});var rt=class r extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return h(n,{code:f.invalid_type,expected:m.set,received:n.parsedType}),_;let i=this._def;i.minSize!==null&&n.data.sizei.maxSize.value&&(h(n,{code:f.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());let o=this._def.valueType;function s(l){let d=new Set;for(let u of l){if(u.status==="aborted")return _;u.status==="dirty"&&t.dirty(),d.add(u.value)}return{status:t.value,value:d}}let c=[...n.data.values()].map((l,d)=>o._parse(new B(n,l,n.path,d)));return n.common.async?Promise.all(c).then(l=>s(l)):s(c)}min(e,t){return new r({...this._def,minSize:{value:e,message:v.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:v.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};rt.create=(r,e)=>new rt({valueType:r,minSize:null,maxSize:null,typeName:g.ZodSet,...b(e)});var or=class r extends x{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.function)return h(t,{code:f.invalid_type,expected:m.function,received:t.parsedType}),_;function n(c,l){return tr({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,er(),Xe].filter(d=>!!d),issueData:{code:f.invalid_arguments,argumentsError:l}})}function i(c,l){return tr({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,er(),Xe].filter(d=>!!d),issueData:{code:f.invalid_return_type,returnTypeError:l}})}let o={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof pe){let c=this;return M(async function(...l){let d=new z([]),u=await c._def.args.parseAsync(l,o).catch(y=>{throw d.addIssue(n(l,y)),d}),p=await Reflect.apply(s,this,u);return await c._def.returns._def.type.parseAsync(p,o).catch(y=>{throw d.addIssue(i(p,y)),d})})}else{let c=this;return M(function(...l){let d=c._def.args.safeParse(l,o);if(!d.success)throw new z([n(l,d.error)]);let u=Reflect.apply(s,this,d.data),p=c._def.returns.safeParse(u,o);if(!p.success)throw new z([i(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:ee.create(e).rest(oe.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||ee.create([]).rest(oe.create()),returns:t||oe.create(),typeName:g.ZodFunction,...b(n)})}},Re=class extends x{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Re.create=(r,e)=>new Re({getter:r,typeName:g.ZodLazy,...b(e)});var Ie=class extends x{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return h(t,{received:t.data,code:f.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ie.create=(r,e)=>new Ie({value:r,typeName:g.ZodLiteral,...b(e)});function Jn(r,e){return new Pe({values:r,typeName:g.ZodEnum,...b(e)})}var Pe=class r extends x{constructor(){super(...arguments),mt.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{expected:T.joinValues(n),received:t.parsedType,code:f.invalid_type}),_}if(rr(this,mt,"f")||Hn(this,mt,new Set(this._def.values),"f"),!rr(this,mt,"f").has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{received:t.data,code:f.invalid_enum_value,options:n}),_}return M(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};mt=new WeakMap;Pe.create=Jn;var Me=class extends x{constructor(){super(...arguments),vt.set(this,void 0)}_parse(e){let t=T.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){let i=T.objectValues(t);return h(n,{expected:T.joinValues(i),received:n.parsedType,code:f.invalid_type}),_}if(rr(this,vt,"f")||Hn(this,vt,new Set(T.getValidEnumValues(this._def.values)),"f"),!rr(this,vt,"f").has(e.data)){let i=T.objectValues(t);return h(n,{received:n.data,code:f.invalid_enum_value,options:i}),_}return M(e.data)}get enum(){return this._def.values}};vt=new WeakMap;Me.create=(r,e)=>new Me({values:r,typeName:g.ZodNativeEnum,...b(e)});var pe=class extends x{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&t.common.async===!1)return h(t,{code:f.invalid_type,expected:m.promise,received:t.parsedType}),_;let n=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return M(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};pe.create=(r,e)=>new pe({type:r,typeName:g.ZodPromise,...b(e)});var Z=class extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{h(n,s),s.fatal?t.abort():t.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async c=>{if(t.value==="aborted")return _;let l=await this._def.schema._parseAsync({data:c,path:n.path,parent:n});return l.status==="aborted"?_:l.status==="dirty"||t.value==="dirty"?Ke(l.value):l});{if(t.value==="aborted")return _;let c=this._def.schema._parseSync({data:s,path:n.path,parent:n});return c.status==="aborted"?_:c.status==="dirty"||t.value==="dirty"?Ke(c.value):c}}if(i.type==="refinement"){let s=c=>{let l=i.refinement(c,o);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(n.common.async===!1){let c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return c.status==="aborted"?_:(c.status==="dirty"&&t.dirty(),s(c.value),{status:t.value,value:c.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>c.status==="aborted"?_:(c.status==="dirty"&&t.dirty(),s(c.value).then(()=>({status:t.value,value:c.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Se(s))return s;let c=i.transform(s.value,o);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:c}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Se(s)?Promise.resolve(i.transform(s.value,o)).then(c=>({status:t.value,value:c})):s);T.assertNever(i)}};Z.create=(r,e,t)=>new Z({schema:r,typeName:g.ZodEffects,effect:e,...b(t)});Z.createWithPreprocess=(r,e,t)=>new Z({schema:e,effect:{type:"preprocess",transform:r},typeName:g.ZodEffects,...b(t)});var V=class extends x{_parse(e){return this._getType(e)===m.undefined?M(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};V.create=(r,e)=>new V({innerType:r,typeName:g.ZodOptional,...b(e)});var te=class extends x{_parse(e){return this._getType(e)===m.null?M(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};te.create=(r,e)=>new te({innerType:r,typeName:g.ZodNullable,...b(e)});var De=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};De.create=(r,e)=>new De({innerType:r,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...b(e)});var Ne=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return yt(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new z(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new z(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ne.create=(r,e)=>new Ne({innerType:r,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...b(e)});var nt=class extends x{_parse(e){if(this._getType(e)!==m.nan){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.nan,received:n.parsedType}),_}return{status:"valid",value:e.data}}};nt.create=r=>new nt({typeName:g.ZodNaN,...b(r)});var Uo=Symbol("zod_brand"),gt=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},_t=class r extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?_:o.status==="dirty"?(t.dirty(),Ke(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?_:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:g.ZodPipeline})}},Le=class extends x{_parse(e){let t=this._def.innerType._parse(e),n=i=>(Se(i)&&(i.value=Object.freeze(i.value)),i);return yt(t)?t.then(i=>n(i)):n(t)}unwrap(){return this._def.innerType}};Le.create=(r,e)=>new Le({innerType:r,typeName:g.ZodReadonly,...b(e)});function Vn(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function Kn(r,e={},t){return r?fe.create().superRefine((n,i)=>{var o,s;let c=r(n);if(c instanceof Promise)return c.then(l=>{var d,u;if(!l){let p=Vn(e,n),w=(u=(d=p.fatal)!==null&&d!==void 0?d:t)!==null&&u!==void 0?u:!0;i.addIssue({code:"custom",...p,fatal:w})}});if(!c){let l=Vn(e,n),d=(s=(o=l.fatal)!==null&&o!==void 0?o:t)!==null&&s!==void 0?s:!0;i.addIssue({code:"custom",...l,fatal:d})}}):fe.create()}var zo={object:D.lazycreate},g;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(g||(g={}));var Zo=(r,e={message:`Input not instance of ${r.name}`})=>Kn(t=>t instanceof r,e),Xn=ue.create,Qn=ke.create,Fo=nt.create,Vo=Te.create,ei=Ae.create,Bo=Ee.create,Wo=Qe.create,Ho=Oe.create,qo=Ce.create,Go=fe.create,Yo=oe.create,Jo=J.create,Ko=et.create,Xo=se.create,Qo=D.create,es=D.strictCreate,ts=$e.create,rs=nr.create,ns=je.create,is=ee.create,os=ir.create,ss=tt.create,as=rt.create,cs=or.create,ls=Re.create,ds=Ie.create,us=Pe.create,fs=Me.create,ps=pe.create,Bn=Z.create,hs=V.create,ms=te.create,vs=Z.createWithPreprocess,ys=_t.create,gs=()=>Xn().optional(),_s=()=>Qn().optional(),bs=()=>ei().optional(),xs={string:(r=>ue.create({...r,coerce:!0})),number:(r=>ke.create({...r,coerce:!0})),boolean:(r=>Ae.create({...r,coerce:!0})),bigint:(r=>Te.create({...r,coerce:!0})),date:(r=>Ee.create({...r,coerce:!0}))},ws=_,a=Object.freeze({__proto__:null,defaultErrorMap:Xe,setErrorMap:vo,getErrorMap:er,makeIssue:tr,EMPTY_PATH:yo,addIssueToContext:h,ParseStatus:P,INVALID:_,DIRTY:Ke,OK:M,isAborted:Fr,isDirty:Vr,isValid:Se,isAsync:yt,get util(){return T},get objectUtil(){return Zr},ZodParsedType:m,getParsedType:ie,ZodType:x,datetimeRegex:Yn,ZodString:ue,ZodNumber:ke,ZodBigInt:Te,ZodBoolean:Ae,ZodDate:Ee,ZodSymbol:Qe,ZodUndefined:Oe,ZodNull:Ce,ZodAny:fe,ZodUnknown:oe,ZodNever:J,ZodVoid:et,ZodArray:se,ZodObject:D,ZodUnion:$e,ZodDiscriminatedUnion:nr,ZodIntersection:je,ZodTuple:ee,ZodRecord:ir,ZodMap:tt,ZodSet:rt,ZodFunction:or,ZodLazy:Re,ZodLiteral:Ie,ZodEnum:Pe,ZodNativeEnum:Me,ZodPromise:pe,ZodEffects:Z,ZodTransformer:Z,ZodOptional:V,ZodNullable:te,ZodDefault:De,ZodCatch:Ne,ZodNaN:nt,BRAND:Uo,ZodBranded:gt,ZodPipeline:_t,ZodReadonly:Le,custom:Kn,Schema:x,ZodSchema:x,late:zo,get ZodFirstPartyTypeKind(){return g},coerce:xs,any:Go,array:Xo,bigint:Vo,boolean:ei,date:Bo,discriminatedUnion:rs,effect:Bn,enum:us,function:cs,instanceof:Zo,intersection:ns,lazy:ls,literal:ds,map:ss,nan:Fo,nativeEnum:fs,never:Jo,null:qo,nullable:ms,number:Qn,object:Qo,oboolean:bs,onumber:_s,optional:hs,ostring:gs,pipeline:ys,preprocess:vs,promise:ps,record:os,set:as,strictObject:es,string:Xn,symbol:Wo,transformer:Bn,tuple:is,undefined:Ho,union:ts,unknown:Yo,void:Ko,NEVER:ws,ZodIssueCode:f,quotelessJson:mo,ZodError:z});var ni=(r=>(r.Info="info",r.Debug="debug",r.Trace="trace",r.Error="error",r))(ni||{}),ii=(r=>(r.Changed="Changed",r.Added="Added",r.Removed="Removed",r))(ii||{}),oi=(r=>(r.External="BSLIVE_EXTERNAL",r))(oi||{}),Ss=a.string(),it=a.lazy(()=>a.object({id:a.string(),label:a.string(),nodes:a.array(it)})),ks=a.nativeEnum(ni),ti=a.object({log_level:ks}),Ts=a.object({ws_path:a.string(),host:a.string().optional()}),As=a.object({kind:a.string(),ms:a.string()}),Es=a.object({message:a.string(),reason:a.string().optional()}),ri=a.object({path:a.string()}),Os=a.object({paths:a.array(a.string())}),si=a.discriminatedUnion("kind",[a.object({kind:a.literal("Both"),payload:a.object({name:a.string(),bind_address:a.string()})}),a.object({kind:a.literal("Address"),payload:a.object({bind_address:a.string()})}),a.object({kind:a.literal("Named"),payload:a.object({name:a.string()})}),a.object({kind:a.literal("Port"),payload:a.object({port:a.number()})}),a.object({kind:a.literal("PortNamed"),payload:a.object({port:a.number(),name:a.string()})})]),Cs=a.object({id:a.string(),identity:si,socket_addr:a.string()}),ai=a.object({servers:a.array(Cs)}),ci=a.object({connect:Ts,ctx_message:a.string()}),$s=a.object({path:a.string()}),js=a.object({body:a.string()}),Rs=a.discriminatedUnion("kind",[a.object({kind:a.literal("Html"),payload:a.object({html:a.string()})}),a.object({kind:a.literal("Json"),payload:a.object({json_str:a.string()})}),a.object({kind:a.literal("Raw"),payload:a.object({raw:a.string()})}),a.object({kind:a.literal("Sse"),payload:a.object({sse:js})}),a.object({kind:a.literal("Proxy"),payload:a.object({proxy:a.string()})}),a.object({kind:a.literal("Dir"),payload:a.object({dir:a.string(),base:a.string().optional()})})]),Is=a.discriminatedUnion("kind",[a.object({kind:a.literal("Stopped"),payload:a.object({bind_address:a.string()})}),a.object({kind:a.literal("Started"),payload:a.undefined().optional()}),a.object({kind:a.literal("Patched"),payload:a.undefined().optional()}),a.object({kind:a.literal("Errored"),payload:a.object({error:a.string()})})]),Ps=a.object({identity:si,change:Is}),Ku=a.object({items:a.array(Ps)}),Ms=a.object({path:a.string(),kind:Rs}),Ds=a.object({servers_resp:ai}),Ns=a.object({line:a.string(),prefix:a.string().optional()}),Ls=a.object({line:a.string(),prefix:a.string().optional()}),Us=a.object({paths:a.array(a.string())}),zs=a.union([a.object({kind:a.literal("Ok"),payload:a.undefined().optional()}),a.object({kind:a.literal("Err"),payload:a.string()}),a.object({kind:a.literal("Cancelled"),payload:a.undefined().optional()})]),Zs=a.object({tree:it,will_exec:a.boolean()}),Fs=a.object({paths:a.array(a.string()),debounce:As}),Vs=a.nativeEnum(ii),ar=a.lazy(()=>a.discriminatedUnion("kind",[a.object({kind:a.literal("Fs"),payload:a.object({path:a.string(),change_kind:Vs})}),a.object({kind:a.literal("FsMany"),payload:a.array(ar)})])),Xu=a.discriminatedUnion("kind",[a.object({kind:a.literal("Change"),payload:ar}),a.object({kind:a.literal("WsConnection"),payload:ti}),a.object({kind:a.literal("Config"),payload:ti}),a.object({kind:a.literal("DisplayMessage"),payload:Es})]),Qu=a.nativeEnum(oi),Bs=a.discriminatedUnion("kind",[a.object({kind:a.literal("Stdout"),payload:Ls}),a.object({kind:a.literal("Stderr"),payload:Ns})]),ef=a.discriminatedUnion("kind",[a.object({kind:a.literal("MissingInputs"),payload:a.string()}),a.object({kind:a.literal("InvalidInput"),payload:a.string()}),a.object({kind:a.literal("NotFound"),payload:a.string()}),a.object({kind:a.literal("InputWriteError"),payload:a.string()}),a.object({kind:a.literal("PathError"),payload:a.string()}),a.object({kind:a.literal("PortError"),payload:a.string()}),a.object({kind:a.literal("DirError"),payload:a.string()}),a.object({kind:a.literal("YamlError"),payload:a.string()}),a.object({kind:a.literal("MarkdownError"),payload:a.string()}),a.object({kind:a.literal("HtmlError"),payload:a.string()}),a.object({kind:a.literal("Io"),payload:a.string()}),a.object({kind:a.literal("UnsupportedExtension"),payload:a.string()}),a.object({kind:a.literal("MissingExtension"),payload:a.string()}),a.object({kind:a.literal("EmptyInput"),payload:a.string()}),a.object({kind:a.literal("BsLiveRules"),payload:a.string()})]),tf=a.discriminatedUnion("kind",[a.object({kind:a.literal("ServersChanged"),payload:ai}),a.object({kind:a.literal("TaskReport"),payload:a.object({id:a.string()})}),a.object({kind:a.literal("TaskTreeDisplay"),payload:a.object({tree:it})})]),rf=a.discriminatedUnion("kind",[a.object({kind:a.literal("Started"),payload:a.undefined().optional()}),a.object({kind:a.literal("FailedStartup"),payload:a.string()})]),nf=a.object({routes:a.array(Ms),id:a.string()}),Ws=a.lazy(()=>a.discriminatedUnion("kind",[a.object({kind:a.literal("Started"),payload:a.object({tree:it})}),a.object({kind:a.literal("Ended"),payload:a.object({tree:it,report:sr,report_map:a.record(sr)})}),a.object({kind:a.literal("Error"),payload:a.undefined().optional()})])),sr=a.lazy(()=>a.object({result:qs})),Hs=a.lazy(()=>a.object({stage:Ws})),qs=a.lazy(()=>a.object({conclusion:zs,invocation_id:Ss,task_reports:a.array(sr)})),Gs=a.lazy(()=>a.object({tree:it,report_map:a.record(sr)})),of=a.lazy(()=>a.discriminatedUnion("kind",[a.object({kind:a.literal("ServersChanged"),payload:Ds}),a.object({kind:a.literal("Watching"),payload:Fs}),a.object({kind:a.literal("WatchingStopped"),payload:Us}),a.object({kind:a.literal("FileChanged"),payload:ri}),a.object({kind:a.literal("FilesChanged"),payload:Os}),a.object({kind:a.literal("InputFileChanged"),payload:ri}),a.object({kind:a.literal("InputAccepted"),payload:$s}),a.object({kind:a.literal("OutputLine"),payload:Bs}),a.object({kind:a.literal("TaskAction"),payload:Hs}),a.object({kind:a.literal("TaskTreePreview"),payload:Zs}),a.object({kind:a.literal("TaskTreeSummary"),payload:Gs})]));var li=[{selector:"background",styleNames:["backgroundImage"]},{selector:"border",styleNames:["borderImage","webkitBorderImage","MozBorderImage"]}],cr={stylesheetReloadTimeout:15e3},Ys=/\.(jpe?g|png|gif|svg)$/i,lr=class{constructor(e,t,n){this.window=e,this.console=t,this.Timer=n,this.document=this.window.document,this.importCacheWaitPeriod=200,this.plugins=[]}addPlugin(e){return this.plugins.push(e)}analyze(e){}reload(e,t={}){if(this.options={...cr,...t},!(t.liveCSS&&e.match(/\.css(?:\.map)?$/i)&&this.reloadStylesheet(e))){if(t.liveImg&&e.match(Ys)){this.reloadImages(e);return}if(t.isChromeExtension){this.reloadChromeExtension();return}return this.reloadPage()}}reloadPage(){return this.window.document.location.reload()}reloadChromeExtension(){return this.window.chrome.runtime.reload()}reloadImages(e){let t,n=this.generateUniqueString();for(t of Array.from(this.document.images))di(e,Wr(t.src))&&(t.src=this.generateCacheBustUrl(t.src,n));if(this.document.querySelectorAll)for(let{selector:i,styleNames:o}of li)for(t of Array.from(this.document.querySelectorAll(`[style*=${i}]`)))this.reloadStyleImages(t.style,o,e,n);if(this.document.styleSheets)return Array.from(this.document.styleSheets).map(i=>this.reloadStylesheetImages(i,e,n))}reloadStylesheetImages(e,t,n){let i;try{i=(e||{}).cssRules}catch{}if(i)for(let o of Array.from(i))switch(o.type){case CSSRule.IMPORT_RULE:this.reloadStylesheetImages(o.styleSheet,t,n);break;case CSSRule.STYLE_RULE:for(let{styleNames:s}of li)this.reloadStyleImages(o.style,s,t,n);break;case CSSRule.MEDIA_RULE:this.reloadStylesheetImages(o,t,n);break}}reloadStyleImages(e,t,n,i){for(let o of t){let s=e[o];if(typeof s=="string"){let c=s.replace(new RegExp("\\burl\\s*\\(([^)]*)\\)"),(l,d)=>di(n,Wr(d))?`url(${this.generateCacheBustUrl(d,i)})`:l);c!==s&&(e[o]=c)}}}reloadStylesheet(e){let t=this.options||cr,n,i,o=(()=>{let l=[];for(i of Array.from(this.document.getElementsByTagName("link")))i.rel.match(/^stylesheet$/i)&&!i.__LiveReload_pendingRemoval&&l.push(i);return l})(),s=[];for(n of Array.from(this.document.getElementsByTagName("style")))n.sheet&&this.collectImportedStylesheets(n,n.sheet,s);for(i of Array.from(o))this.collectImportedStylesheets(i,i.sheet,s);if(this.window.StyleFix&&this.document.querySelectorAll)for(n of Array.from(this.document.querySelectorAll("style[data-href]")))o.push(n);this.console.debug(`found ${o.length} LINKed stylesheets, ${s.length} @imported stylesheets`);let c=Js(e,o.concat(s),l=>Wr(this.linkHref(l)));if(c)c.object.rule?(this.console.debug(`is reloading imported stylesheet: ${c.object.href}`),this.reattachImportedRule(c.object)):(this.console.debug(`is reloading stylesheet: ${this.linkHref(c.object)}`),this.reattachStylesheetLink(c.object));else if(t.reloadMissingCSS){this.console.debug(`will reload all stylesheets because path '${e}' did not match any specific one. To disable this behavior, set 'options.reloadMissingCSS' to 'false'.`);for(i of Array.from(o))this.reattachStylesheetLink(i)}else this.console.debug(`will not reload path '${e}' because the stylesheet was not found on the page and 'options.reloadMissingCSS' was set to 'false'.`);return!0}collectImportedStylesheets(e,t,n){let i;try{i=(t||{}).cssRules}catch{}if(i&&i.length)for(let o=0;o{if(!i)return i=!0,t()};if(e.onload=()=>(this.console.debug("the new stylesheet has finished loading"),this.knownToSupportCssOnLoad=!0,o()),!this.knownToSupportCssOnLoad){let s;(s=()=>e.sheet?(this.console.debug("is polling until the new CSS finishes loading..."),o()):this.Timer.start(50,s))()}return this.Timer.start(n.stylesheetReloadTimeout,o)}linkHref(e){return e.href||e.getAttribute&&e.getAttribute("data-href")}reattachStylesheetLink(e){let t;if(e.__LiveReload_pendingRemoval)return;e.__LiveReload_pendingRemoval=!0,e.tagName==="STYLE"?(t=this.document.createElement("link"),t.rel="stylesheet",t.media=e.media,t.disabled=e.disabled):t=e.cloneNode(!1),t.href=this.generateCacheBustUrl(this.linkHref(e));let n=e.parentNode;return n.lastChild===e?n.appendChild(t):n.insertBefore(t,e.nextSibling),this.waitUntilCssLoads(t,()=>{let i;return/AppleWebKit/.test(this.window.navigator.userAgent)?i=5:i=200,this.Timer.start(i,()=>{if(e.parentNode)return e.parentNode.removeChild(e),t.onreadystatechange=null,this.window.StyleFix?this.window.StyleFix.link(t):void 0})})}reattachImportedRule({rule:e,index:t,link:n}){let i=e.parentStyleSheet,o=this.generateCacheBustUrl(e.href),s=e.media.length?[].join.call(e.media,", "):"",c=`@import url("${o}") ${s};`;e.__LiveReload_newHref=o;let l=this.document.createElement("link");return l.rel="stylesheet",l.href=o,l.__LiveReload_pendingRemoval=!0,n.parentNode&&n.parentNode.insertBefore(l,n),this.Timer.start(this.importCacheWaitPeriod,()=>{if(l.parentNode&&l.parentNode.removeChild(l),e.__LiveReload_newHref===o)return i.insertRule(c,t),i.deleteRule(t+1),e=i.cssRules[t],e.__LiveReload_newHref=o,this.Timer.start(this.importCacheWaitPeriod,()=>{if(e.__LiveReload_newHref===o)return i.insertRule(c,t),i.deleteRule(t+1)})})}generateUniqueString(){return`livereload=${Date.now()}`}generateCacheBustUrl(e,t){let n=this.options||cr,i,o;if(t||(t=this.generateUniqueString()),{url:e,hash:i,params:o}=ui(e),n.overrideURL&&e.indexOf(n.serverURL)<0){let c=e;e=n.serverURL+n.overrideURL+"?url="+encodeURIComponent(e),this.console.debug(`is overriding source URL ${c} with ${e}`)}let s=o.replace(/(\?|&)livereload=(\d+)/,(c,l)=>`${l}${t}`);return s===o&&(o.length===0?s=`?${t}`:s=`${o}&${t}`),e+s+i}};function ui(r){let e="",t="",n=r.indexOf("#");n>=0&&(e=r.slice(n),r=r.slice(0,n));let i=r.indexOf("??");return i>=0?i+1!==r.lastIndexOf("?")&&(n=r.lastIndexOf("?")):n=r.indexOf("?"),n>=0&&(t=r.slice(n),r=r.slice(0,n)),{url:r,params:t,hash:e}}function Wr(r){if(!r)return"";let e;return{url:r}=ui(r),r.indexOf("file://")===0?e=r.replace(new RegExp("^file://(localhost)?"),""):e=r.replace(new RegExp("^([^:]+:)?//([^:/]+)(:\\d*)?/"),"/"),decodeURIComponent(e)}function fi(r,e){if(r=r.replace(/^\/+/,"").toLowerCase(),e=e.replace(/^\/+/,"").toLowerCase(),r===e)return 1e4;let t=r.split(/\/|\\/).reverse(),n=e.split(/\/|\\/).reverse(),i=Math.min(t.length,n.length),o=0;for(;on){let n,i={score:0};for(let o of e)n=fi(r,t(o)),n>i.score&&(i={object:o,score:n});return i.score===0?null:i}function di(r,e){return fi(r,e)>0}var mi=Yi(hi(),1);var Ks=/\.(jpe?g|png|gif|svg)$/i;function Hr(r,e,t){switch(r.kind){case"FsMany":{if(r.payload.some(i=>{switch(i.kind){case"Fs":return!(i.payload.path.match(/\.css(?:\.map)?$/i)||i.payload.path.match(Ks));case"FsMany":throw new Error("unreachable")}}))return window.__playwright?.record?window.__playwright?.record({kind:"reloadPage"}):t.reloadPage();for(let i of r.payload)Hr(i,e,t);break}case"Fs":{let n=r.payload.path,i={liveCSS:!0,liveImg:!0,reloadMissingCSS:!0,originalPath:"",overrideURL:"",serverURL:""};window.__playwright?.record?window.__playwright?.record({kind:"reload",args:{path:n,opts:i}}):(e.trace("will reload a file with path ",n),t.reload(n,i))}}}var qr={name:"dom plugin",globalSetup:(r,e)=>{let t=new lr(window,e,mi.Timer);return[r,[e,t]]},resetSink(r,e,t){let[n,i]=e;return r.pipe(de(o=>o.kind==="Change"),Q(o=>o.payload),we(o=>{n.trace("incoming message",JSON.stringify({change:o,config:t},null,2));let s=ar.parse(o);Hr(s,n,i)}),xe())}};var ur=globalThis,fr=ur.ShadowRoot&&(ur.ShadyCSS===void 0||ur.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Gr=Symbol(),vi=new WeakMap,bt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Gr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(fr&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=vi.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&vi.set(t,e))}return e}toString(){return this.cssText}},yi=r=>new bt(typeof r=="string"?r:r+"",void 0,Gr),K=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,i,o)=>n+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[o+1],r[0]);return new bt(t,r,Gr)},gi=(r,e)=>{if(fr)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),i=ur.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Yr=fr?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return yi(t)})(r):r;var{is:Xs,defineProperty:Qs,getOwnPropertyDescriptor:ea,getOwnPropertyNames:ta,getOwnPropertySymbols:ra,getPrototypeOf:na}=Object,pr=globalThis,_i=pr.trustedTypes,ia=_i?_i.emptyScript:"",oa=pr.reactiveElementPolyfillSupport,xt=(r,e)=>r,wt={toAttribute(r,e){switch(e){case Boolean:r=r?ia:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},hr=(r,e)=>!Xs(r,e),bi={attribute:!0,type:String,converter:wt,reflect:!1,useDefault:!1,hasChanged:hr};Symbol.metadata??=Symbol("metadata"),pr.litPropertyMetadata??=new WeakMap;var ae=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=bi){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&Qs(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:o}=ea(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let c=i?.call(this);o?.call(this,s),this.requestUpdate(e,c,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??bi}static _$Ei(){if(this.hasOwnProperty(xt("elementProperties")))return;let e=na(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(xt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(xt("properties"))){let t=this.properties,n=[...ta(t),...ra(t)];for(let i of n)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let i of n)t.unshift(Yr(i))}else e!==void 0&&t.push(Yr(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return gi(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(i!==void 0&&n.reflect===!0){let o=(n.converter?.toAttribute!==void 0?n.converter:wt).toAttribute(t,n.type);this._$Em=e,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,t){let n=this.constructor,i=n._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let o=n.getPropertyOptions(i),s=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:wt;this._$Em=i;let c=s.fromAttribute(t,o.type);this[i]=c??this._$Ej?.get(i)??c,this._$Em=null}}requestUpdate(e,t,n,i=!1,o){if(e!==void 0){let s=this.constructor;if(i===!1&&(o=this[e]),n??=s.getPropertyOptions(e),!((n.hasChanged??hr)(o,t)||n.useDefault&&n.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:o},s){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??t??this[e]),o!==!0||s!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[i,o]of n){let{wrapped:s}=o,c=this[i];s!==!0||this._$AL.has(i)||c===void 0||this.C(i,void 0,o,c)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(t)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};ae.elementStyles=[],ae.shadowRootOptions={mode:"open"},ae[xt("elementProperties")]=new Map,ae[xt("finalized")]=new Map,oa?.({ReactiveElement:ae}),(pr.reactiveElementVersions??=[]).push("2.1.2");var Kr=globalThis,xi=r=>r,mr=Kr.trustedTypes,wi=mr?mr.createPolicy("lit-html",{createHTML:r=>r}):void 0,Xr="$lit$",ce=`lit$${Math.random().toFixed(9).slice(2)}$`,Qr="?"+ce,sa=`<${Qr}>`,Ze=document,kt=()=>Ze.createComment(""),Tt=r=>r===null||typeof r!="object"&&typeof r!="function",en=Array.isArray,Oi=r=>en(r)||typeof r?.[Symbol.iterator]=="function",Jr=`[ -\f\r]`,St=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Si=/-->/g,ki=/>/g,Ue=RegExp(`>|${Jr}(?:([^\\s"'>=/]+)(${Jr}*=${Jr}*(?:[^ -\f\r"'\`<>=]|("|')|))|$)`,"g"),Ti=/'/g,Ai=/"/g,Ci=/^(?:script|style|textarea|title)$/i,tn=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),N=tn(1),bf=tn(2),xf=tn(3),Fe=Symbol.for("lit-noChange"),O=Symbol.for("lit-nothing"),Ei=new WeakMap,ze=Ze.createTreeWalker(Ze,129);function $i(r,e){if(!en(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return wi!==void 0?wi.createHTML(e):e}var ji=(r,e)=>{let t=r.length-1,n=[],i,o=e===2?"":e===3?"":"",s=St;for(let c=0;c"?(s=i??St,p=-1):u[1]===void 0?p=-2:(p=s.lastIndex-u[2].length,d=u[1],s=u[3]===void 0?Ue:u[3]==='"'?Ai:Ti):s===Ai||s===Ti?s=Ue:s===Si||s===ki?s=St:(s=Ue,i=void 0);let y=s===Ue&&r[c+1].startsWith("/>")?" ":"";o+=s===St?l+sa:p>=0?(n.push(d),l.slice(0,p)+Xr+l.slice(p)+ce+y):l+ce+(p===-2?c:y)}return[$i(r,o+(r[t]||"")+(e===2?"":e===3?"":"")),n]},At=class r{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let o=0,s=0,c=e.length-1,l=this.parts,[d,u]=ji(e,t);if(this.el=r.createElement(d,n),ze.currentNode=this.el.content,t===2||t===3){let p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=ze.nextNode())!==null&&l.length0){i.textContent=mr?mr.emptyScript:"";for(let y=0;y2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=O}_$AI(e,t=this,n,i){let o=this.strings,s=!1;if(o===void 0)e=Ve(this,e,t,0),s=!Tt(e)||e!==this._$AH&&e!==Fe,s&&(this._$AH=e);else{let c=e,l,d;for(e=o[0],l=0;l{let n=t?.renderBefore??e,i=n._$litPart$;if(i===void 0){let o=t?.renderBefore??null;n._$litPart$=i=new ot(e.insertBefore(kt(),o),o,void 0,t??{})}return i._$AI(r),i};var rn=globalThis,L=class extends ae{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=xr(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Fe}};L._$litElement$=!0,L.finalized=!0,rn.litElementHydrateSupport?.({LitElement:L});var ca=rn.litElementPolyfillSupport;ca?.({LitElement:L});(rn.litElementVersions??=[]).push("4.2.2");var st=r=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)};var la={attribute:!0,type:String,converter:wt,reflect:!1,hasChanged:hr},da=(r=la,e,t)=>{let{kind:n,metadata:i}=t,o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),n==="setter"&&((r=Object.create(r)).wrapped=!0),o.set(t.name,r),n==="accessor"){let{name:s}=t;return{set(c){let l=e.get.call(this);e.set.call(this,c),this.requestUpdate(s,l,r,!0,c)},init(c){return c!==void 0&&this.C(s,void 0,r,c),c}}}if(n==="setter"){let{name:s}=t;return function(c){let l=this[s];e.call(this,c),this.requestUpdate(s,l,r,!0,c)}}throw Error("Unsupported decorator location: "+n)};function he(r){return(e,t)=>typeof t=="object"?da(r,e,t):((n,i,o)=>{let s=i.hasOwnProperty(o);return i.constructor.createProperty(o,n),s?Object.getOwnPropertyDescriptor(i,o):void 0})(r,e,t)}var{I:cp}=Ri;var Ii=r=>r.strings===void 0;var Pi={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},nn=r=>(...e)=>({_$litDirective$:r,values:e}),Sr=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var Et=(r,e)=>{let t=r._$AN;if(t===void 0)return!1;for(let n of t)n._$AO?.(e,!1),Et(n,e);return!0},kr=r=>{let e,t;do{if((e=r._$AM)===void 0)break;t=e._$AN,t.delete(r),r=e}while(t?.size===0)},Mi=r=>{for(let e;e=r._$AM;r=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(r))break;t.add(r),pa(e)}};function ua(r){this._$AN!==void 0?(kr(this),this._$AM=r,Mi(this)):this._$AM=r}function fa(r,e=!1,t=0){let n=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(n))for(let o=t;o{r.type==Pi.CHILD&&(r._$AP??=fa,r._$AQ??=ua)},Tr=class extends Sr{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),Mi(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Et(this,e),kr(this))}setValue(e){if(Ii(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var Di=()=>new sn,sn=class{},on=new WeakMap,Ni=nn(class extends Tr{render(r){return O}update(r,[e]){let t=e!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=r.options?.host,this.rt(this.ct=r.element)),O}rt(r){if(this.isConnected||(r=void 0),typeof this.G=="function"){let e=this.ht??globalThis,t=on.get(e);t===void 0&&(t=new WeakMap,on.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,r),r!==void 0&&this.G.call(this.ht,r)}else this.G.value=r}get lt(){return typeof this.G=="function"?on.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var me=K` + `):"",this.name="UnsubscriptionError",this.errors=t}});function ye(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}var X=(function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var e,t,n,i,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var c=re(s),l=c.next();!l.done;l=c.next()){var d=l.value;d.remove(this)}}catch(S){e={error:S}}finally{try{l&&!l.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}else s.remove(this);var u=this.initialTeardown;if(k(u))try{u()}catch(S){o=S instanceof Dt?S.errors:[S]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var w=re(p),y=w.next();!y.done;y=w.next()){var A=y.value;try{pn(A)}catch(S){o=o??[],S instanceof Dt?o=q(q([],H(o)),H(S.errors)):o.push(S)}}}catch(S){n={error:S}}finally{try{y&&!y.done&&(i=w.return)&&i.call(w)}finally{if(n)throw n.error}}}if(o)throw new Dt(o)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)pn(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&ye(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&ye(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=(function(){var e=new r;return e.closed=!0,e})(),r})();var $r=X.EMPTY;function Mt(r){return r instanceof X||r&&"closed"in r&&k(r.remove)&&k(r.add)&&k(r.unsubscribe)}function pn(r){k(r)?r():r.unsubscribe()}var G={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var qe={setTimeout:function(r,e){for(var t=[],n=2;n0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,i=this,o=i.hasError,s=i.isStopped,c=i.observers;return o||s?$r:(this.currentObservers=null,c.push(t),new X(function(){n.currentObservers=null,ye(c,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,i=n.hasError,o=n.thrownError,s=n.isStopped;i?t.error(o):s&&t.complete()},e.prototype.asObservable=function(){var t=new E;return t.source=this,t},e.create=function(t,n){return new Ut(t,n)},e})(E);var Ut=(function(r){R(e,r);function e(t,n){var i=r.call(this)||this;return i.destination=t,i.source=n,i}return e.prototype.next=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,t)},e.prototype.error=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&i!==void 0?i:$r},e})(Y);var ft={now:function(){return(ft.delegate||Date).now()},delegate:void 0};var zt=(function(r){R(e,r);function e(t,n,i){t===void 0&&(t=1/0),n===void 0&&(n=1/0),i===void 0&&(i=ft);var o=r.call(this)||this;return o._bufferSize=t,o._windowTime=n,o._timestampProvider=i,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=n===1/0,o._bufferSize=Math.max(1,t),o._windowTime=Math.max(1,n),o}return e.prototype.next=function(t){var n=this,i=n.isStopped,o=n._buffer,s=n._infiniteTimeWindow,c=n._timestampProvider,l=n._windowTime;i||(o.push(t),!s&&o.push(c.now()+l)),this._trimBuffer(),r.prototype.next.call(this,t)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(t),i=this,o=i._infiniteTimeWindow,s=i._buffer,c=s.slice(),l=0;l0&&(u=new be({next:function(jt){return $t.next(jt)},error:function(jt){S=!0,I(),p=Nr(U,i,jt),$t.error(jt)},complete:function(){A=!0,I(),p=Nr(U,s),$t.complete()}}),j(dt).subscribe(u))})(d)}}function Nr(r,e){for(var t=[],n=2;n{let e=new URL(window.location.href),t=e.protocol==="https:"?"wss":"ws",n;if(r.host)n=new URL(r.ws_path,t+"://"+r.host);else{let o=new URL(e);o.protocol=t,o.pathname=r.ws_path,n=o}return Ur(n.toString()).pipe(Mr({delay:5e3}))}}}var Fn={debug(...r){},error(...r){},info(...r){},trace(...r){}},zr={name:"console",globalSetup:r=>{let e=new Y;return[e,{debug:function(...n){e.next({level:"debug",args:n})},info:function(...n){e.next({level:"info",args:n})},trace:function(...n){e.next({level:"trace",args:n})},error:function(...n){e.next({level:"error",args:n})}}]},resetSink:(r,e,t)=>r.pipe(we(n=>{let i=["trace","debug","info","error"],o=i.indexOf(n.level),s=i.indexOf(t.log_level);o>=s&&console.log(`[${n.level}]`,...n.args)}),xe())};var T;(function(r){r.assertEqual=i=>i;function e(i){}r.assertIs=e;function t(i){throw new Error}r.assertNever=t,r.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},r.getValidEnumValues=i=>{let o=r.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),s={};for(let c of o)s[c]=i[c];return r.objectValues(s)},r.objectValues=i=>r.objectKeys(i).map(function(o){return i[o]}),r.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},r.find=(i,o)=>{for(let s of i)if(o(s))return s},r.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}r.joinValues=n,r.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(T||(T={}));var Fr;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Fr||(Fr={}));var m=T.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ie=r=>{switch(typeof r){case"undefined":return m.undefined;case"string":return m.string;case"number":return isNaN(r)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(r)?m.array:r===null?m.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?m.promise:typeof Map<"u"&&r instanceof Map?m.map:typeof Set<"u"&&r instanceof Set?m.set:typeof Date<"u"&&r instanceof Date?m.date:m.object;default:return m.unknown}},f=T.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),vo=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),z=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(t(s));else{let c=n,l=0;for(;lt.message){let t={},n=[];for(let i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};z.create=r=>new z(r);var Xe=(r,e)=>{let t;switch(r.code){case f.invalid_type:r.received===m.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case f.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,T.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:t=`Unrecognized key(s) in object: ${T.joinValues(r.keys,", ")}`;break;case f.invalid_union:t="Invalid input";break;case f.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${T.joinValues(r.options)}`;break;case f.invalid_enum_value:t=`Invalid enum value. Expected ${T.joinValues(r.options)}, received '${r.received}'`;break;case f.invalid_arguments:t="Invalid function arguments";break;case f.invalid_return_type:t="Invalid function return type";break;case f.invalid_date:t="Invalid date";break;case f.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:T.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case f.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case f.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case f.custom:t="Invalid input";break;case f.invalid_intersection_types:t="Intersection results could not be merged";break;case f.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case f.not_finite:t="Number must be finite";break;default:t=e.defaultError,T.assertNever(r)}return{message:t}},Hn=Xe;function yo(r){Hn=r}function tr(){return Hn}var rr=r=>{let{data:e,path:t,errorMaps:n,issueData:i}=r,o=[...t,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let c="",l=n.filter(d=>!!d).slice().reverse();for(let d of l)c=d(s,{data:e,defaultError:c}).message;return{...i,path:o,message:c}},go=[];function h(r,e){let t=tr(),n=rr({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Xe?void 0:Xe].filter(i=>!!i)});r.common.issues.push(n)}var P=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let i of t){if(i.status==="aborted")return _;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let i of t){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let i of t){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return _;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:e.value,value:n}}},_=Object.freeze({status:"aborted"}),Ke=r=>({status:"dirty",value:r}),D=r=>({status:"valid",value:r}),Vr=r=>r.status==="aborted",Br=r=>r.status==="dirty",Se=r=>r.status==="valid",gt=r=>typeof Promise<"u"&&r instanceof Promise;function nr(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)}function qn(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t}var v;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(v||(v={}));var vt,yt,B=class{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Vn=(r,e)=>{if(Se(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new z(r.common.issues);return this._error=t,this._error}}};function b(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:i}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,c)=>{var l,d;let{message:u}=r;return s.code==="invalid_enum_value"?{message:u??c.defaultError}:typeof c.data>"u"?{message:(l=u??n)!==null&&l!==void 0?l:c.defaultError}:s.code!=="invalid_type"?{message:c.defaultError}:{message:(d=u??t)!==null&&d!==void 0?d:c.defaultError}},description:i}}var x=class{get description(){return this._def.description}_getType(e){return ie(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ie(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new P,ctx:{common:e.parent.common,data:e.data,parsedType:ie(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(gt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let i={common:{issues:[],async:(n=t?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ie(e)},o=this._parseSync({data:e,path:i.path,parent:i});return Vn(i,o)}"~validate"(e){var t,n;let i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ie(e)};if(!this["~standard"].async)try{let o=this._parseSync({data:e,path:[],parent:i});return Se(o)?{value:o.value}:{issues:i.common.issues}}catch(o){!((n=(t=o?.message)===null||t===void 0?void 0:t.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:i}).then(o=>Se(o)?{value:o.value}:{issues:i.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ie(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(gt(i)?i:Promise.resolve(i));return Vn(n,o)}refine(e,t){let n=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,o)=>{let s=e(i),c=()=>o.addIssue({code:f.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(c(),!1)):s?!0:(c(),!1)})}refinement(e,t){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof t=="function"?t(n,i):t),!1))}_refinement(e){return new Z({schema:this,typeName:g.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return V.create(this,this._def)}nullable(){return te.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return se.create(this)}promise(){return pe.create(this,this._def)}or(e){return $e.create([this,e],this._def)}and(e){return je.create(this,e,this._def)}transform(e){return new Z({...b(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Me({...b(this._def),innerType:this,defaultValue:t,typeName:g.ZodDefault})}brand(){return new _t({typeName:g.ZodBranded,type:this,...b(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Ne({...b(this._def),innerType:this,catchValue:t,typeName:g.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return bt.create(this,e)}readonly(){return Le.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},_o=/^c[^\s-]{8,}$/i,bo=/^[0-9a-z]+$/,xo=/^[0-9A-HJKMNP-TV-Z]{26}$/i,wo=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,So=/^[a-z0-9_-]{21}$/i,ko=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,To=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ao=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Eo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Zr,Oo=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Co=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,$o=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,jo=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ro=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Io=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Gn="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Po=new RegExp(`^${Gn}$`);function Yn(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Do(r){return new RegExp(`^${Yn(r)}$`)}function Jn(r){let e=`${Gn}T${Yn(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Mo(r,e){return!!((e==="v4"||!e)&&Oo.test(r)||(e==="v6"||!e)&&$o.test(r))}function No(r,e){if(!ko.test(r))return!1;try{let[t]=r.split("."),n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||!i.typ||!i.alg||e&&i.alg!==e)}catch{return!1}}function Lo(r,e){return!!((e==="v4"||!e)&&Co.test(r)||(e==="v6"||!e)&&jo.test(r))}var ue=class r extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){let o=this._getOrReturnCtx(e);return h(o,{code:f.invalid_type,expected:m.string,received:o.parsedType}),_}let n=new P,i;for(let o of this._def.checks)if(o.kind==="min")e.data.lengtho.value&&(i=this._getOrReturnCtx(e,i),h(i,{code:f.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,c=e.data.lengthe.test(i),{validation:t,code:f.invalid_string,...v.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...v.errToObj(e)})}url(e){return this._addCheck({kind:"url",...v.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...v.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...v.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...v.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...v.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...v.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...v.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...v.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...v.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...v.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...v.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...v.errToObj(e)})}datetime(e){var t,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...v.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...v.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...v.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...v.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...v.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...v.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...v.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...v.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...v.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...v.errToObj(t)})}nonempty(e){return this.min(1,v.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value{var e;return new ue({checks:[],typeName:g.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...b(r)})};function Uo(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,o=parseInt(r.toFixed(i).replace(".","")),s=parseInt(e.toFixed(i).replace(".",""));return o%s/Math.pow(10,i)}var ke=class r extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==m.number){let o=this._getOrReturnCtx(e);return h(o,{code:f.invalid_type,expected:m.number,received:o.parsedType}),_}let n,i=new P;for(let o of this._def.checks)o.kind==="int"?T.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:f.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:f.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Uo(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),h(n,{code:f.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:f.not_finite,message:o.message}),i.dirty()):T.assertNever(o);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:v.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:v.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuee.kind==="int"||e.kind==="multipleOf"&&T.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.valuenew ke({checks:[],typeName:g.ZodNumber,coerce:r?.coerce||!1,...b(r)});var Te=class r extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==m.bigint)return this._getInvalidInput(e);let n,i=new P;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:f.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),h(n,{code:f.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):T.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return h(t,{code:f.invalid_type,expected:m.bigint,received:t.parsedType}),_}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:v.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value{var e;return new Te({checks:[],typeName:g.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...b(r)})};var Ae=class extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.boolean,received:n.parsedType}),_}return D(e.data)}};Ae.create=r=>new Ae({typeName:g.ZodBoolean,coerce:r?.coerce||!1,...b(r)});var Ee=class r extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){let o=this._getOrReturnCtx(e);return h(o,{code:f.invalid_type,expected:m.date,received:o.parsedType}),_}if(isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return h(o,{code:f.invalid_date}),_}let n=new P,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()o.value&&(i=this._getOrReturnCtx(e,i),h(i,{code:f.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):T.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:v.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:v.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew Ee({checks:[],coerce:r?.coerce||!1,typeName:g.ZodDate,...b(r)});var Qe=class extends x{_parse(e){if(this._getType(e)!==m.symbol){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.symbol,received:n.parsedType}),_}return D(e.data)}};Qe.create=r=>new Qe({typeName:g.ZodSymbol,...b(r)});var Oe=class extends x{_parse(e){if(this._getType(e)!==m.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.undefined,received:n.parsedType}),_}return D(e.data)}};Oe.create=r=>new Oe({typeName:g.ZodUndefined,...b(r)});var Ce=class extends x{_parse(e){if(this._getType(e)!==m.null){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.null,received:n.parsedType}),_}return D(e.data)}};Ce.create=r=>new Ce({typeName:g.ZodNull,...b(r)});var fe=class extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return D(e.data)}};fe.create=r=>new fe({typeName:g.ZodAny,...b(r)});var oe=class extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return D(e.data)}};oe.create=r=>new oe({typeName:g.ZodUnknown,...b(r)});var J=class extends x{_parse(e){let t=this._getOrReturnCtx(e);return h(t,{code:f.invalid_type,expected:m.never,received:t.parsedType}),_}};J.create=r=>new J({typeName:g.ZodNever,...b(r)});var et=class extends x{_parse(e){if(this._getType(e)!==m.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.void,received:n.parsedType}),_}return D(e.data)}};et.create=r=>new et({typeName:g.ZodVoid,...b(r)});var se=class r extends x{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==m.array)return h(t,{code:f.invalid_type,expected:m.array,received:t.parsedType}),_;if(i.exactLength!==null){let s=t.data.length>i.exactLength.value,c=t.data.lengthi.maxLength.value&&(h(t,{code:f.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((s,c)=>i.type._parseAsync(new B(t,s,t.path,c)))).then(s=>P.mergeArray(n,s));let o=[...t.data].map((s,c)=>i.type._parseSync(new B(t,s,t.path,c)));return P.mergeArray(n,o)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:v.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:v.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:v.toString(t)}})}nonempty(e){return this.min(1,e)}};se.create=(r,e)=>new se({type:r,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,...b(e)});function Je(r){if(r instanceof M){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=V.create(Je(n))}return new M({...r._def,shape:()=>e})}else return r instanceof se?new se({...r._def,type:Je(r.element)}):r instanceof V?V.create(Je(r.unwrap())):r instanceof te?te.create(Je(r.unwrap())):r instanceof ee?ee.create(r.items.map(e=>Je(e))):r}var M=class r extends x{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=T.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==m.object){let d=this._getOrReturnCtx(e);return h(d,{code:f.invalid_type,expected:m.object,received:d.parsedType}),_}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),c=[];if(!(this._def.catchall instanceof J&&this._def.unknownKeys==="strip"))for(let d in i.data)s.includes(d)||c.push(d);let l=[];for(let d of s){let u=o[d],p=i.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new B(i,p,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof J){let d=this._def.unknownKeys;if(d==="passthrough")for(let u of c)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(d==="strict")c.length>0&&(h(i,{code:f.unrecognized_keys,keys:c}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let u of c){let p=i.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new B(i,p,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let d=[];for(let u of l){let p=await u.key,w=await u.value;d.push({key:p,value:w,alwaysSet:u.alwaysSet})}return d}).then(d=>P.mergeObjectSync(n,d)):P.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return v.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var i,o,s,c;let l=(s=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,t,n).message)!==null&&s!==void 0?s:n.defaultError;return t.code==="unrecognized_keys"?{message:(c=v.errToObj(e).message)!==null&&c!==void 0?c:l}:{message:l}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:g.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};return T.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}omit(e){let t={};return T.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}deepPartial(){return Je(this)}partial(e){let t={};return T.objectKeys(this.shape).forEach(n=>{let i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}),new r({...this._def,shape:()=>t})}required(e){let t={};return T.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof V;)o=o._def.innerType;t[n]=o}}),new r({...this._def,shape:()=>t})}keyof(){return Kn(T.objectKeys(this.shape))}};M.create=(r,e)=>new M({shape:()=>r,unknownKeys:"strip",catchall:J.create(),typeName:g.ZodObject,...b(e)});M.strictCreate=(r,e)=>new M({shape:()=>r,unknownKeys:"strict",catchall:J.create(),typeName:g.ZodObject,...b(e)});M.lazycreate=(r,e)=>new M({shape:r,unknownKeys:"strip",catchall:J.create(),typeName:g.ZodObject,...b(e)});var $e=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function i(o){for(let c of o)if(c.result.status==="valid")return c.result;for(let c of o)if(c.result.status==="dirty")return t.common.issues.push(...c.ctx.common.issues),c.result;let s=o.map(c=>new z(c.ctx.common.issues));return h(t,{code:f.invalid_union,unionErrors:s}),_}if(t.common.async)return Promise.all(n.map(async o=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let l of n){let d={...t,common:{...t.common,issues:[]},parent:null},u=l._parseSync({data:t.data,path:t.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:d}),d.common.issues.length&&s.push(d.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let c=s.map(l=>new z(l));return h(t,{code:f.invalid_union,unionErrors:c}),_}}get options(){return this._def.options}};$e.create=(r,e)=>new $e({options:r,typeName:g.ZodUnion,...b(e)});var ne=r=>r instanceof Re?ne(r.schema):r instanceof Z?ne(r.innerType()):r instanceof Ie?[r.value]:r instanceof Pe?r.options:r instanceof De?T.objectValues(r.enum):r instanceof Me?ne(r._def.innerType):r instanceof Oe?[void 0]:r instanceof Ce?[null]:r instanceof V?[void 0,...ne(r.unwrap())]:r instanceof te?[null,...ne(r.unwrap())]:r instanceof _t||r instanceof Le?ne(r.unwrap()):r instanceof Ne?ne(r._def.innerType):[],ir=class r extends x{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.object)return h(t,{code:f.invalid_type,expected:m.object,received:t.parsedType}),_;let n=this.discriminator,i=t.data[n],o=this.optionsMap.get(i);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(h(t,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),_)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let i=new Map;for(let o of t){let s=ne(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of s){if(i.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);i.set(c,o)}}return new r({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...b(n)})}};function Wr(r,e){let t=ie(r),n=ie(e);if(r===e)return{valid:!0,data:r};if(t===m.object&&n===m.object){let i=T.objectKeys(e),o=T.objectKeys(r).filter(c=>i.indexOf(c)!==-1),s={...r,...e};for(let c of o){let l=Wr(r[c],e[c]);if(!l.valid)return{valid:!1};s[c]=l.data}return{valid:!0,data:s}}else if(t===m.array&&n===m.array){if(r.length!==e.length)return{valid:!1};let i=[];for(let o=0;o{if(Vr(o)||Vr(s))return _;let c=Wr(o.value,s.value);return c.valid?((Br(o)||Br(s))&&t.dirty(),{status:t.value,value:c.data}):(h(n,{code:f.invalid_intersection_types}),_)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};je.create=(r,e,t)=>new je({left:r,right:e,typeName:g.ZodIntersection,...b(t)});var ee=class r extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return h(n,{code:f.invalid_type,expected:m.array,received:n.parsedType}),_;if(n.data.lengththis._def.items.length&&(h(n,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let o=[...n.data].map((s,c)=>{let l=this._def.items[c]||this._def.rest;return l?l._parse(new B(n,s,n.path,c)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>P.mergeArray(t,s)):P.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};ee.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ee({items:r,typeName:g.ZodTuple,rest:null,...b(e)})};var or=class r extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return h(n,{code:f.invalid_type,expected:m.object,received:n.parsedType}),_;let i=[],o=this._def.keyType,s=this._def.valueType;for(let c in n.data)i.push({key:o._parse(new B(n,c,n.path,c)),value:s._parse(new B(n,n.data[c],n.path,c)),alwaysSet:c in n.data});return n.common.async?P.mergeObjectAsync(t,i):P.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof x?new r({keyType:e,valueType:t,typeName:g.ZodRecord,...b(n)}):new r({keyType:ue.create(),valueType:e,typeName:g.ZodRecord,...b(t)})}},tt=class extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return h(n,{code:f.invalid_type,expected:m.map,received:n.parsedType}),_;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([c,l],d)=>({key:i._parse(new B(n,c,n.path,[d,"key"])),value:o._parse(new B(n,l,n.path,[d,"value"]))}));if(n.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let l of s){let d=await l.key,u=await l.value;if(d.status==="aborted"||u.status==="aborted")return _;(d.status==="dirty"||u.status==="dirty")&&t.dirty(),c.set(d.value,u.value)}return{status:t.value,value:c}})}else{let c=new Map;for(let l of s){let d=l.key,u=l.value;if(d.status==="aborted"||u.status==="aborted")return _;(d.status==="dirty"||u.status==="dirty")&&t.dirty(),c.set(d.value,u.value)}return{status:t.value,value:c}}}};tt.create=(r,e,t)=>new tt({valueType:e,keyType:r,typeName:g.ZodMap,...b(t)});var rt=class r extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return h(n,{code:f.invalid_type,expected:m.set,received:n.parsedType}),_;let i=this._def;i.minSize!==null&&n.data.sizei.maxSize.value&&(h(n,{code:f.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());let o=this._def.valueType;function s(l){let d=new Set;for(let u of l){if(u.status==="aborted")return _;u.status==="dirty"&&t.dirty(),d.add(u.value)}return{status:t.value,value:d}}let c=[...n.data.values()].map((l,d)=>o._parse(new B(n,l,n.path,d)));return n.common.async?Promise.all(c).then(l=>s(l)):s(c)}min(e,t){return new r({...this._def,minSize:{value:e,message:v.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:v.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};rt.create=(r,e)=>new rt({valueType:r,minSize:null,maxSize:null,typeName:g.ZodSet,...b(e)});var sr=class r extends x{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.function)return h(t,{code:f.invalid_type,expected:m.function,received:t.parsedType}),_;function n(c,l){return rr({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,tr(),Xe].filter(d=>!!d),issueData:{code:f.invalid_arguments,argumentsError:l}})}function i(c,l){return rr({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,tr(),Xe].filter(d=>!!d),issueData:{code:f.invalid_return_type,returnTypeError:l}})}let o={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof pe){let c=this;return D(async function(...l){let d=new z([]),u=await c._def.args.parseAsync(l,o).catch(y=>{throw d.addIssue(n(l,y)),d}),p=await Reflect.apply(s,this,u);return await c._def.returns._def.type.parseAsync(p,o).catch(y=>{throw d.addIssue(i(p,y)),d})})}else{let c=this;return D(function(...l){let d=c._def.args.safeParse(l,o);if(!d.success)throw new z([n(l,d.error)]);let u=Reflect.apply(s,this,d.data),p=c._def.returns.safeParse(u,o);if(!p.success)throw new z([i(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:ee.create(e).rest(oe.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||ee.create([]).rest(oe.create()),returns:t||oe.create(),typeName:g.ZodFunction,...b(n)})}},Re=class extends x{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Re.create=(r,e)=>new Re({getter:r,typeName:g.ZodLazy,...b(e)});var Ie=class extends x{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return h(t,{received:t.data,code:f.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ie.create=(r,e)=>new Ie({value:r,typeName:g.ZodLiteral,...b(e)});function Kn(r,e){return new Pe({values:r,typeName:g.ZodEnum,...b(e)})}var Pe=class r extends x{constructor(){super(...arguments),vt.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{expected:T.joinValues(n),received:t.parsedType,code:f.invalid_type}),_}if(nr(this,vt,"f")||qn(this,vt,new Set(this._def.values),"f"),!nr(this,vt,"f").has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{received:t.data,code:f.invalid_enum_value,options:n}),_}return D(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};vt=new WeakMap;Pe.create=Kn;var De=class extends x{constructor(){super(...arguments),yt.set(this,void 0)}_parse(e){let t=T.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){let i=T.objectValues(t);return h(n,{expected:T.joinValues(i),received:n.parsedType,code:f.invalid_type}),_}if(nr(this,yt,"f")||qn(this,yt,new Set(T.getValidEnumValues(this._def.values)),"f"),!nr(this,yt,"f").has(e.data)){let i=T.objectValues(t);return h(n,{received:n.data,code:f.invalid_enum_value,options:i}),_}return D(e.data)}get enum(){return this._def.values}};yt=new WeakMap;De.create=(r,e)=>new De({values:r,typeName:g.ZodNativeEnum,...b(e)});var pe=class extends x{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&t.common.async===!1)return h(t,{code:f.invalid_type,expected:m.promise,received:t.parsedType}),_;let n=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return D(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};pe.create=(r,e)=>new pe({type:r,typeName:g.ZodPromise,...b(e)});var Z=class extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{h(n,s),s.fatal?t.abort():t.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async c=>{if(t.value==="aborted")return _;let l=await this._def.schema._parseAsync({data:c,path:n.path,parent:n});return l.status==="aborted"?_:l.status==="dirty"||t.value==="dirty"?Ke(l.value):l});{if(t.value==="aborted")return _;let c=this._def.schema._parseSync({data:s,path:n.path,parent:n});return c.status==="aborted"?_:c.status==="dirty"||t.value==="dirty"?Ke(c.value):c}}if(i.type==="refinement"){let s=c=>{let l=i.refinement(c,o);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(n.common.async===!1){let c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return c.status==="aborted"?_:(c.status==="dirty"&&t.dirty(),s(c.value),{status:t.value,value:c.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>c.status==="aborted"?_:(c.status==="dirty"&&t.dirty(),s(c.value).then(()=>({status:t.value,value:c.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Se(s))return s;let c=i.transform(s.value,o);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:c}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Se(s)?Promise.resolve(i.transform(s.value,o)).then(c=>({status:t.value,value:c})):s);T.assertNever(i)}};Z.create=(r,e,t)=>new Z({schema:r,typeName:g.ZodEffects,effect:e,...b(t)});Z.createWithPreprocess=(r,e,t)=>new Z({schema:e,effect:{type:"preprocess",transform:r},typeName:g.ZodEffects,...b(t)});var V=class extends x{_parse(e){return this._getType(e)===m.undefined?D(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};V.create=(r,e)=>new V({innerType:r,typeName:g.ZodOptional,...b(e)});var te=class extends x{_parse(e){return this._getType(e)===m.null?D(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};te.create=(r,e)=>new te({innerType:r,typeName:g.ZodNullable,...b(e)});var Me=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Me.create=(r,e)=>new Me({innerType:r,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...b(e)});var Ne=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return gt(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new z(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new z(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ne.create=(r,e)=>new Ne({innerType:r,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...b(e)});var nt=class extends x{_parse(e){if(this._getType(e)!==m.nan){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.nan,received:n.parsedType}),_}return{status:"valid",value:e.data}}};nt.create=r=>new nt({typeName:g.ZodNaN,...b(r)});var zo=Symbol("zod_brand"),_t=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},bt=class r extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?_:o.status==="dirty"?(t.dirty(),Ke(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?_:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:g.ZodPipeline})}},Le=class extends x{_parse(e){let t=this._def.innerType._parse(e),n=i=>(Se(i)&&(i.value=Object.freeze(i.value)),i);return gt(t)?t.then(i=>n(i)):n(t)}unwrap(){return this._def.innerType}};Le.create=(r,e)=>new Le({innerType:r,typeName:g.ZodReadonly,...b(e)});function Bn(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function Xn(r,e={},t){return r?fe.create().superRefine((n,i)=>{var o,s;let c=r(n);if(c instanceof Promise)return c.then(l=>{var d,u;if(!l){let p=Bn(e,n),w=(u=(d=p.fatal)!==null&&d!==void 0?d:t)!==null&&u!==void 0?u:!0;i.addIssue({code:"custom",...p,fatal:w})}});if(!c){let l=Bn(e,n),d=(s=(o=l.fatal)!==null&&o!==void 0?o:t)!==null&&s!==void 0?s:!0;i.addIssue({code:"custom",...l,fatal:d})}}):fe.create()}var Zo={object:M.lazycreate},g;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(g||(g={}));var Fo=(r,e={message:`Input not instance of ${r.name}`})=>Xn(t=>t instanceof r,e),Qn=ue.create,ei=ke.create,Vo=nt.create,Bo=Te.create,ti=Ae.create,Wo=Ee.create,Ho=Qe.create,qo=Oe.create,Go=Ce.create,Yo=fe.create,Jo=oe.create,Ko=J.create,Xo=et.create,Qo=se.create,es=M.create,ts=M.strictCreate,rs=$e.create,ns=ir.create,is=je.create,os=ee.create,ss=or.create,as=tt.create,cs=rt.create,ls=sr.create,ds=Re.create,us=Ie.create,fs=Pe.create,ps=De.create,hs=pe.create,Wn=Z.create,ms=V.create,vs=te.create,ys=Z.createWithPreprocess,gs=bt.create,_s=()=>Qn().optional(),bs=()=>ei().optional(),xs=()=>ti().optional(),ws={string:(r=>ue.create({...r,coerce:!0})),number:(r=>ke.create({...r,coerce:!0})),boolean:(r=>Ae.create({...r,coerce:!0})),bigint:(r=>Te.create({...r,coerce:!0})),date:(r=>Ee.create({...r,coerce:!0}))},Ss=_,a=Object.freeze({__proto__:null,defaultErrorMap:Xe,setErrorMap:yo,getErrorMap:tr,makeIssue:rr,EMPTY_PATH:go,addIssueToContext:h,ParseStatus:P,INVALID:_,DIRTY:Ke,OK:D,isAborted:Vr,isDirty:Br,isValid:Se,isAsync:gt,get util(){return T},get objectUtil(){return Fr},ZodParsedType:m,getParsedType:ie,ZodType:x,datetimeRegex:Jn,ZodString:ue,ZodNumber:ke,ZodBigInt:Te,ZodBoolean:Ae,ZodDate:Ee,ZodSymbol:Qe,ZodUndefined:Oe,ZodNull:Ce,ZodAny:fe,ZodUnknown:oe,ZodNever:J,ZodVoid:et,ZodArray:se,ZodObject:M,ZodUnion:$e,ZodDiscriminatedUnion:ir,ZodIntersection:je,ZodTuple:ee,ZodRecord:or,ZodMap:tt,ZodSet:rt,ZodFunction:sr,ZodLazy:Re,ZodLiteral:Ie,ZodEnum:Pe,ZodNativeEnum:De,ZodPromise:pe,ZodEffects:Z,ZodTransformer:Z,ZodOptional:V,ZodNullable:te,ZodDefault:Me,ZodCatch:Ne,ZodNaN:nt,BRAND:zo,ZodBranded:_t,ZodPipeline:bt,ZodReadonly:Le,custom:Xn,Schema:x,ZodSchema:x,late:Zo,get ZodFirstPartyTypeKind(){return g},coerce:ws,any:Yo,array:Qo,bigint:Bo,boolean:ti,date:Wo,discriminatedUnion:ns,effect:Wn,enum:fs,function:ls,instanceof:Fo,intersection:is,lazy:ds,literal:us,map:as,nan:Vo,nativeEnum:ps,never:Ko,null:Go,nullable:vs,number:ei,object:es,oboolean:xs,onumber:bs,optional:ms,ostring:_s,pipeline:gs,preprocess:ys,promise:hs,record:ss,set:cs,strictObject:ts,string:Qn,symbol:Ho,transformer:Wn,tuple:os,undefined:qo,union:rs,unknown:Jo,void:Xo,NEVER:Ss,ZodIssueCode:f,quotelessJson:vo,ZodError:z});var oi=(r=>(r.Info="info",r.Debug="debug",r.Trace="trace",r.Error="error",r))(oi||{}),si=(r=>(r.Changed="Changed",r.Added="Added",r.Removed="Removed",r))(si||{}),ai=(r=>(r.External="BSLIVE_EXTERNAL",r))(ai||{}),ks=a.string(),ot=a.lazy(()=>a.object({id:a.string(),label:a.string(),nodes:a.array(ot)})),Ts=a.nativeEnum(oi),ri=a.object({log_level:Ts}),As=a.object({ws_path:a.string(),host:a.string().optional()}),Es=a.object({kind:a.string(),ms:a.string()}),Os=a.object({message:a.string(),reason:a.string().optional()}),ni=a.object({path:a.string()}),Cs=a.object({paths:a.array(a.string())}),it=a.discriminatedUnion("kind",[a.object({kind:a.literal("Both"),payload:a.object({name:a.string(),bind_address:a.string()})}),a.object({kind:a.literal("Address"),payload:a.object({bind_address:a.string()})}),a.object({kind:a.literal("Named"),payload:a.object({name:a.string()})}),a.object({kind:a.literal("Port"),payload:a.object({port:a.number()})}),a.object({kind:a.literal("PortNamed"),payload:a.object({port:a.number(),name:a.string()})})]),$s=a.object({id:a.string(),identity:it,socket_addr:a.string()}),ci=a.object({servers:a.array($s)}),li=a.object({connect:As,ctx_message:a.string()}),js=a.object({path:a.string()}),Rs=a.object({body:a.string()}),Is=a.discriminatedUnion("kind",[a.object({kind:a.literal("Html"),payload:a.object({html:a.string()})}),a.object({kind:a.literal("Json"),payload:a.object({json_str:a.string()})}),a.object({kind:a.literal("Raw"),payload:a.object({raw:a.string()})}),a.object({kind:a.literal("Sse"),payload:a.object({sse:Rs})}),a.object({kind:a.literal("Proxy"),payload:a.object({proxy:a.string()})}),a.object({kind:a.literal("Dir"),payload:a.object({dir:a.string(),base:a.string().optional()})})]),ii=a.object({path:a.string(),kind_str:a.string()}),Ps=a.discriminatedUnion("kind",[a.object({kind:a.literal("Stopped"),payload:a.object({bind_address:a.string()})}),a.object({kind:a.literal("Started"),payload:a.undefined().optional()}),a.object({kind:a.literal("Patched"),payload:a.undefined().optional()}),a.object({kind:a.literal("Errored"),payload:a.object({error:a.string()})})]),Ds=a.object({identity:it,change:Ps}),Qu=a.object({items:a.array(Ds)}),Ms=a.discriminatedUnion("kind",[a.object({kind:a.literal("Created"),payload:a.object({identity:it,socket_addr:a.string()})}),a.object({kind:a.literal("Stopped"),payload:a.object({identity:it})}),a.object({kind:a.literal("CreateErr"),payload:a.object({error:a.string()})}),a.object({kind:a.literal("Patched"),payload:a.object({identity:it,added:a.array(ii),changed:a.array(ii)})}),a.object({kind:a.literal("PatchErr"),payload:a.object({identity:it,error:a.string()})})]),Ns=a.object({changeset:a.array(Ms),servers_resp:ci}),Ls=a.object({path:a.string(),kind:Is}),Us=a.object({line:a.string(),prefix:a.string().optional()}),zs=a.object({line:a.string(),prefix:a.string().optional()}),Zs=a.object({paths:a.array(a.string())}),Fs=a.union([a.object({kind:a.literal("Ok"),payload:a.undefined().optional()}),a.object({kind:a.literal("Err"),payload:a.string()}),a.object({kind:a.literal("Cancelled"),payload:a.undefined().optional()})]),Vs=a.object({tree:ot,will_exec:a.boolean()}),Bs=a.object({paths:a.array(a.string()),debounce:Es}),Ws=a.nativeEnum(si),cr=a.lazy(()=>a.discriminatedUnion("kind",[a.object({kind:a.literal("Fs"),payload:a.object({path:a.string(),change_kind:Ws})}),a.object({kind:a.literal("FsMany"),payload:a.array(cr)})])),ef=a.discriminatedUnion("kind",[a.object({kind:a.literal("Change"),payload:cr}),a.object({kind:a.literal("WsConnection"),payload:ri}),a.object({kind:a.literal("Config"),payload:ri}),a.object({kind:a.literal("DisplayMessage"),payload:Os})]),tf=a.nativeEnum(ai),Hs=a.discriminatedUnion("kind",[a.object({kind:a.literal("Stdout"),payload:zs}),a.object({kind:a.literal("Stderr"),payload:Us})]),rf=a.discriminatedUnion("kind",[a.object({kind:a.literal("MissingInputs"),payload:a.string()}),a.object({kind:a.literal("InvalidInput"),payload:a.string()}),a.object({kind:a.literal("NotFound"),payload:a.string()}),a.object({kind:a.literal("InputWriteError"),payload:a.string()}),a.object({kind:a.literal("PathError"),payload:a.string()}),a.object({kind:a.literal("PortError"),payload:a.string()}),a.object({kind:a.literal("DirError"),payload:a.string()}),a.object({kind:a.literal("YamlError"),payload:a.string()}),a.object({kind:a.literal("MarkdownError"),payload:a.string()}),a.object({kind:a.literal("HtmlError"),payload:a.string()}),a.object({kind:a.literal("Io"),payload:a.string()}),a.object({kind:a.literal("UnsupportedExtension"),payload:a.string()}),a.object({kind:a.literal("MissingExtension"),payload:a.string()}),a.object({kind:a.literal("EmptyInput"),payload:a.string()}),a.object({kind:a.literal("BsLiveRules"),payload:a.string()})]),nf=a.discriminatedUnion("kind",[a.object({kind:a.literal("ServersChanged"),payload:ci}),a.object({kind:a.literal("TaskReport"),payload:a.object({id:a.string()})}),a.object({kind:a.literal("TaskTreeDisplay"),payload:a.object({tree:ot})})]),of=a.discriminatedUnion("kind",[a.object({kind:a.literal("Started"),payload:a.undefined().optional()}),a.object({kind:a.literal("FailedStartup"),payload:a.string()})]),sf=a.object({routes:a.array(Ls),id:a.string()}),qs=a.lazy(()=>a.discriminatedUnion("kind",[a.object({kind:a.literal("Started"),payload:a.object({tree:ot})}),a.object({kind:a.literal("Ended"),payload:a.object({tree:ot,report:ar,report_map:a.record(ar)})}),a.object({kind:a.literal("Error"),payload:a.undefined().optional()})])),ar=a.lazy(()=>a.object({result:Ys})),Gs=a.lazy(()=>a.object({stage:qs})),Ys=a.lazy(()=>a.object({conclusion:Fs,invocation_id:ks,task_reports:a.array(ar)})),Js=a.lazy(()=>a.object({tree:ot,report_map:a.record(ar)})),af=a.lazy(()=>a.discriminatedUnion("kind",[a.object({kind:a.literal("ServerChangeset"),payload:Ns}),a.object({kind:a.literal("Watching"),payload:Bs}),a.object({kind:a.literal("WatchingStopped"),payload:Zs}),a.object({kind:a.literal("FileChanged"),payload:ni}),a.object({kind:a.literal("FilesChanged"),payload:Cs}),a.object({kind:a.literal("InputFileChanged"),payload:ni}),a.object({kind:a.literal("InputAccepted"),payload:js}),a.object({kind:a.literal("OutputLine"),payload:Hs}),a.object({kind:a.literal("TaskAction"),payload:Gs}),a.object({kind:a.literal("TaskTreePreview"),payload:Vs}),a.object({kind:a.literal("TaskTreeSummary"),payload:Js})]));var di=[{selector:"background",styleNames:["backgroundImage"]},{selector:"border",styleNames:["borderImage","webkitBorderImage","MozBorderImage"]}],lr={stylesheetReloadTimeout:15e3},Ks=/\.(jpe?g|png|gif|svg)$/i,dr=class{constructor(e,t,n){this.window=e,this.console=t,this.Timer=n,this.document=this.window.document,this.importCacheWaitPeriod=200,this.plugins=[]}addPlugin(e){return this.plugins.push(e)}analyze(e){}reload(e,t={}){if(this.options={...lr,...t},!(t.liveCSS&&e.match(/\.css(?:\.map)?$/i)&&this.reloadStylesheet(e))){if(t.liveImg&&e.match(Ks)){this.reloadImages(e);return}if(t.isChromeExtension){this.reloadChromeExtension();return}return this.reloadPage()}}reloadPage(){return this.window.document.location.reload()}reloadChromeExtension(){return this.window.chrome.runtime.reload()}reloadImages(e){let t,n=this.generateUniqueString();for(t of Array.from(this.document.images))ui(e,Hr(t.src))&&(t.src=this.generateCacheBustUrl(t.src,n));if(this.document.querySelectorAll)for(let{selector:i,styleNames:o}of di)for(t of Array.from(this.document.querySelectorAll(`[style*=${i}]`)))this.reloadStyleImages(t.style,o,e,n);if(this.document.styleSheets)return Array.from(this.document.styleSheets).map(i=>this.reloadStylesheetImages(i,e,n))}reloadStylesheetImages(e,t,n){let i;try{i=(e||{}).cssRules}catch{}if(i)for(let o of Array.from(i))switch(o.type){case CSSRule.IMPORT_RULE:this.reloadStylesheetImages(o.styleSheet,t,n);break;case CSSRule.STYLE_RULE:for(let{styleNames:s}of di)this.reloadStyleImages(o.style,s,t,n);break;case CSSRule.MEDIA_RULE:this.reloadStylesheetImages(o,t,n);break}}reloadStyleImages(e,t,n,i){for(let o of t){let s=e[o];if(typeof s=="string"){let c=s.replace(new RegExp("\\burl\\s*\\(([^)]*)\\)"),(l,d)=>ui(n,Hr(d))?`url(${this.generateCacheBustUrl(d,i)})`:l);c!==s&&(e[o]=c)}}}reloadStylesheet(e){let t=this.options||lr,n,i,o=(()=>{let l=[];for(i of Array.from(this.document.getElementsByTagName("link")))i.rel.match(/^stylesheet$/i)&&!i.__LiveReload_pendingRemoval&&l.push(i);return l})(),s=[];for(n of Array.from(this.document.getElementsByTagName("style")))n.sheet&&this.collectImportedStylesheets(n,n.sheet,s);for(i of Array.from(o))this.collectImportedStylesheets(i,i.sheet,s);if(this.window.StyleFix&&this.document.querySelectorAll)for(n of Array.from(this.document.querySelectorAll("style[data-href]")))o.push(n);this.console.debug(`found ${o.length} LINKed stylesheets, ${s.length} @imported stylesheets`);let c=Xs(e,o.concat(s),l=>Hr(this.linkHref(l)));if(c)c.object.rule?(this.console.debug(`is reloading imported stylesheet: ${c.object.href}`),this.reattachImportedRule(c.object)):(this.console.debug(`is reloading stylesheet: ${this.linkHref(c.object)}`),this.reattachStylesheetLink(c.object));else if(t.reloadMissingCSS){this.console.debug(`will reload all stylesheets because path '${e}' did not match any specific one. To disable this behavior, set 'options.reloadMissingCSS' to 'false'.`);for(i of Array.from(o))this.reattachStylesheetLink(i)}else this.console.debug(`will not reload path '${e}' because the stylesheet was not found on the page and 'options.reloadMissingCSS' was set to 'false'.`);return!0}collectImportedStylesheets(e,t,n){let i;try{i=(t||{}).cssRules}catch{}if(i&&i.length)for(let o=0;o{if(!i)return i=!0,t()};if(e.onload=()=>(this.console.debug("the new stylesheet has finished loading"),this.knownToSupportCssOnLoad=!0,o()),!this.knownToSupportCssOnLoad){let s;(s=()=>e.sheet?(this.console.debug("is polling until the new CSS finishes loading..."),o()):this.Timer.start(50,s))()}return this.Timer.start(n.stylesheetReloadTimeout,o)}linkHref(e){return e.href||e.getAttribute&&e.getAttribute("data-href")}reattachStylesheetLink(e){let t;if(e.__LiveReload_pendingRemoval)return;e.__LiveReload_pendingRemoval=!0,e.tagName==="STYLE"?(t=this.document.createElement("link"),t.rel="stylesheet",t.media=e.media,t.disabled=e.disabled):t=e.cloneNode(!1),t.href=this.generateCacheBustUrl(this.linkHref(e));let n=e.parentNode;return n.lastChild===e?n.appendChild(t):n.insertBefore(t,e.nextSibling),this.waitUntilCssLoads(t,()=>{let i;return/AppleWebKit/.test(this.window.navigator.userAgent)?i=5:i=200,this.Timer.start(i,()=>{if(e.parentNode)return e.parentNode.removeChild(e),t.onreadystatechange=null,this.window.StyleFix?this.window.StyleFix.link(t):void 0})})}reattachImportedRule({rule:e,index:t,link:n}){let i=e.parentStyleSheet,o=this.generateCacheBustUrl(e.href),s=e.media.length?[].join.call(e.media,", "):"",c=`@import url("${o}") ${s};`;e.__LiveReload_newHref=o;let l=this.document.createElement("link");return l.rel="stylesheet",l.href=o,l.__LiveReload_pendingRemoval=!0,n.parentNode&&n.parentNode.insertBefore(l,n),this.Timer.start(this.importCacheWaitPeriod,()=>{if(l.parentNode&&l.parentNode.removeChild(l),e.__LiveReload_newHref===o)return i.insertRule(c,t),i.deleteRule(t+1),e=i.cssRules[t],e.__LiveReload_newHref=o,this.Timer.start(this.importCacheWaitPeriod,()=>{if(e.__LiveReload_newHref===o)return i.insertRule(c,t),i.deleteRule(t+1)})})}generateUniqueString(){return`livereload=${Date.now()}`}generateCacheBustUrl(e,t){let n=this.options||lr,i,o;if(t||(t=this.generateUniqueString()),{url:e,hash:i,params:o}=fi(e),n.overrideURL&&e.indexOf(n.serverURL)<0){let c=e;e=n.serverURL+n.overrideURL+"?url="+encodeURIComponent(e),this.console.debug(`is overriding source URL ${c} with ${e}`)}let s=o.replace(/(\?|&)livereload=(\d+)/,(c,l)=>`${l}${t}`);return s===o&&(o.length===0?s=`?${t}`:s=`${o}&${t}`),e+s+i}};function fi(r){let e="",t="",n=r.indexOf("#");n>=0&&(e=r.slice(n),r=r.slice(0,n));let i=r.indexOf("??");return i>=0?i+1!==r.lastIndexOf("?")&&(n=r.lastIndexOf("?")):n=r.indexOf("?"),n>=0&&(t=r.slice(n),r=r.slice(0,n)),{url:r,params:t,hash:e}}function Hr(r){if(!r)return"";let e;return{url:r}=fi(r),r.indexOf("file://")===0?e=r.replace(new RegExp("^file://(localhost)?"),""):e=r.replace(new RegExp("^([^:]+:)?//([^:/]+)(:\\d*)?/"),"/"),decodeURIComponent(e)}function pi(r,e){if(r=r.replace(/^\/+/,"").toLowerCase(),e=e.replace(/^\/+/,"").toLowerCase(),r===e)return 1e4;let t=r.split(/\/|\\/).reverse(),n=e.split(/\/|\\/).reverse(),i=Math.min(t.length,n.length),o=0;for(;on){let n,i={score:0};for(let o of e)n=pi(r,t(o)),n>i.score&&(i={object:o,score:n});return i.score===0?null:i}function ui(r,e){return pi(r,e)>0}var vi=Ji(mi(),1);var Qs=/\.(jpe?g|png|gif|svg)$/i;function qr(r,e,t){switch(r.kind){case"FsMany":{if(r.payload.some(i=>{switch(i.kind){case"Fs":return!(i.payload.path.match(/\.css(?:\.map)?$/i)||i.payload.path.match(Qs));case"FsMany":throw new Error("unreachable")}}))return window.__playwright?.record?window.__playwright?.record({kind:"reloadPage"}):t.reloadPage();for(let i of r.payload)qr(i,e,t);break}case"Fs":{let n=r.payload.path,i={liveCSS:!0,liveImg:!0,reloadMissingCSS:!0,originalPath:"",overrideURL:"",serverURL:""};window.__playwright?.record?window.__playwright?.record({kind:"reload",args:{path:n,opts:i}}):(e.trace("will reload a file with path ",n),t.reload(n,i))}}}var Gr={name:"dom plugin",globalSetup:(r,e)=>{let t=new dr(window,e,vi.Timer);return[r,[e,t]]},resetSink(r,e,t){let[n,i]=e;return r.pipe(de(o=>o.kind==="Change"),Q(o=>o.payload),we(o=>{n.trace("incoming message",JSON.stringify({change:o,config:t},null,2));let s=cr.parse(o);qr(s,n,i)}),xe())}};var fr=globalThis,pr=fr.ShadowRoot&&(fr.ShadyCSS===void 0||fr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Yr=Symbol(),yi=new WeakMap,xt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Yr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(pr&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=yi.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&yi.set(t,e))}return e}toString(){return this.cssText}},gi=r=>new xt(typeof r=="string"?r:r+"",void 0,Yr),K=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,i,o)=>n+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[o+1],r[0]);return new xt(t,r,Yr)},_i=(r,e)=>{if(pr)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),i=fr.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Jr=pr?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return gi(t)})(r):r;var{is:ea,defineProperty:ta,getOwnPropertyDescriptor:ra,getOwnPropertyNames:na,getOwnPropertySymbols:ia,getPrototypeOf:oa}=Object,hr=globalThis,bi=hr.trustedTypes,sa=bi?bi.emptyScript:"",aa=hr.reactiveElementPolyfillSupport,wt=(r,e)=>r,St={toAttribute(r,e){switch(e){case Boolean:r=r?sa:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},mr=(r,e)=>!ea(r,e),xi={attribute:!0,type:String,converter:St,reflect:!1,useDefault:!1,hasChanged:mr};Symbol.metadata??=Symbol("metadata"),hr.litPropertyMetadata??=new WeakMap;var ae=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=xi){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&ta(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:o}=ra(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let c=i?.call(this);o?.call(this,s),this.requestUpdate(e,c,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??xi}static _$Ei(){if(this.hasOwnProperty(wt("elementProperties")))return;let e=oa(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(wt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(wt("properties"))){let t=this.properties,n=[...na(t),...ia(t)];for(let i of n)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let i of n)t.unshift(Jr(i))}else e!==void 0&&t.push(Jr(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return _i(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(i!==void 0&&n.reflect===!0){let o=(n.converter?.toAttribute!==void 0?n.converter:St).toAttribute(t,n.type);this._$Em=e,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,t){let n=this.constructor,i=n._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let o=n.getPropertyOptions(i),s=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:St;this._$Em=i;let c=s.fromAttribute(t,o.type);this[i]=c??this._$Ej?.get(i)??c,this._$Em=null}}requestUpdate(e,t,n,i=!1,o){if(e!==void 0){let s=this.constructor;if(i===!1&&(o=this[e]),n??=s.getPropertyOptions(e),!((n.hasChanged??mr)(o,t)||n.useDefault&&n.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:o},s){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??t??this[e]),o!==!0||s!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[i,o]of n){let{wrapped:s}=o,c=this[i];s!==!0||this._$AL.has(i)||c===void 0||this.C(i,void 0,o,c)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(t)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};ae.elementStyles=[],ae.shadowRootOptions={mode:"open"},ae[wt("elementProperties")]=new Map,ae[wt("finalized")]=new Map,aa?.({ReactiveElement:ae}),(hr.reactiveElementVersions??=[]).push("2.1.2");var Xr=globalThis,wi=r=>r,vr=Xr.trustedTypes,Si=vr?vr.createPolicy("lit-html",{createHTML:r=>r}):void 0,Qr="$lit$",ce=`lit$${Math.random().toFixed(9).slice(2)}$`,en="?"+ce,ca=`<${en}>`,Ze=document,Tt=()=>Ze.createComment(""),At=r=>r===null||typeof r!="object"&&typeof r!="function",tn=Array.isArray,Ci=r=>tn(r)||typeof r?.[Symbol.iterator]=="function",Kr=`[ +\f\r]`,kt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ki=/-->/g,Ti=/>/g,Ue=RegExp(`>|${Kr}(?:([^\\s"'>=/]+)(${Kr}*=${Kr}*(?:[^ +\f\r"'\`<>=]|("|')|))|$)`,"g"),Ai=/'/g,Ei=/"/g,$i=/^(?:script|style|textarea|title)$/i,rn=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),N=rn(1),wf=rn(2),Sf=rn(3),Fe=Symbol.for("lit-noChange"),O=Symbol.for("lit-nothing"),Oi=new WeakMap,ze=Ze.createTreeWalker(Ze,129);function ji(r,e){if(!tn(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Si!==void 0?Si.createHTML(e):e}var Ri=(r,e)=>{let t=r.length-1,n=[],i,o=e===2?"":e===3?"":"",s=kt;for(let c=0;c"?(s=i??kt,p=-1):u[1]===void 0?p=-2:(p=s.lastIndex-u[2].length,d=u[1],s=u[3]===void 0?Ue:u[3]==='"'?Ei:Ai):s===Ei||s===Ai?s=Ue:s===ki||s===Ti?s=kt:(s=Ue,i=void 0);let y=s===Ue&&r[c+1].startsWith("/>")?" ":"";o+=s===kt?l+ca:p>=0?(n.push(d),l.slice(0,p)+Qr+l.slice(p)+ce+y):l+ce+(p===-2?c:y)}return[ji(r,o+(r[t]||"")+(e===2?"":e===3?"":"")),n]},Et=class r{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let o=0,s=0,c=e.length-1,l=this.parts,[d,u]=Ri(e,t);if(this.el=r.createElement(d,n),ze.currentNode=this.el.content,t===2||t===3){let p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=ze.nextNode())!==null&&l.length0){i.textContent=vr?vr.emptyScript:"";for(let y=0;y2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=O}_$AI(e,t=this,n,i){let o=this.strings,s=!1;if(o===void 0)e=Ve(this,e,t,0),s=!At(e)||e!==this._$AH&&e!==Fe,s&&(this._$AH=e);else{let c=e,l,d;for(e=o[0],l=0;l{let n=t?.renderBefore??e,i=n._$litPart$;if(i===void 0){let o=t?.renderBefore??null;n._$litPart$=i=new st(e.insertBefore(Tt(),o),o,void 0,t??{})}return i._$AI(r),i};var nn=globalThis,L=class extends ae{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=wr(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Fe}};L._$litElement$=!0,L.finalized=!0,nn.litElementHydrateSupport?.({LitElement:L});var da=nn.litElementPolyfillSupport;da?.({LitElement:L});(nn.litElementVersions??=[]).push("4.2.2");var at=r=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)};var ua={attribute:!0,type:String,converter:St,reflect:!1,hasChanged:mr},fa=(r=ua,e,t)=>{let{kind:n,metadata:i}=t,o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),n==="setter"&&((r=Object.create(r)).wrapped=!0),o.set(t.name,r),n==="accessor"){let{name:s}=t;return{set(c){let l=e.get.call(this);e.set.call(this,c),this.requestUpdate(s,l,r,!0,c)},init(c){return c!==void 0&&this.C(s,void 0,r,c),c}}}if(n==="setter"){let{name:s}=t;return function(c){let l=this[s];e.call(this,c),this.requestUpdate(s,l,r,!0,c)}}throw Error("Unsupported decorator location: "+n)};function he(r){return(e,t)=>typeof t=="object"?fa(r,e,t):((n,i,o)=>{let s=i.hasOwnProperty(o);return i.constructor.createProperty(o,n),s?Object.getOwnPropertyDescriptor(i,o):void 0})(r,e,t)}var{I:dp}=Ii;var Pi=r=>r.strings===void 0;var Di={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},on=r=>(...e)=>({_$litDirective$:r,values:e}),kr=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var Ot=(r,e)=>{let t=r._$AN;if(t===void 0)return!1;for(let n of t)n._$AO?.(e,!1),Ot(n,e);return!0},Tr=r=>{let e,t;do{if((e=r._$AM)===void 0)break;t=e._$AN,t.delete(r),r=e}while(t?.size===0)},Mi=r=>{for(let e;e=r._$AM;r=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(r))break;t.add(r),ma(e)}};function pa(r){this._$AN!==void 0?(Tr(this),this._$AM=r,Mi(this)):this._$AM=r}function ha(r,e=!1,t=0){let n=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(n))for(let o=t;o{r.type==Di.CHILD&&(r._$AP??=ha,r._$AQ??=pa)},Ar=class extends kr{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),Mi(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Ot(this,e),Tr(this))}setValue(e){if(Pi(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var Ni=()=>new an,an=class{},sn=new WeakMap,Li=on(class extends Ar{render(r){return O}update(r,[e]){let t=e!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=r.options?.host,this.rt(this.ct=r.element)),O}rt(r){if(this.isConnected||(r=void 0),typeof this.G=="function"){let e=this.ht??globalThis,t=sn.get(e);t===void 0&&(t=new WeakMap,sn.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,r),r!==void 0&&this.G.call(this.ht,r)}else this.G.value=r}get lt(){return typeof this.G=="function"?sn.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var me=K` * { box-sizing: border-box; } @@ -20,7 +20,7 @@ var Vi=Object.create;var Er=Object.defineProperty;var cn=Object.getOwnPropertyDe margin: 0; padding: 0; } -`;var at=K` +`;var ct=K` :host { --brand-blue: #0f2634; --brand-grey: #6d6d6d; @@ -33,10 +33,10 @@ var Vi=Object.create;var Er=Object.defineProperty;var cn=Object.getOwnPropertyDe Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; } -`;var Li="narrow",Ui="wide",We=class extends L{constructor(){super(...arguments);this.kind="overlay";this.dialogRef=Di();this.width="narrow"}firstUpdated(t){super.firstUpdated(t),this.dialogRef.value?.showModal()}closed(){this.dispatchEvent(new Event("closed",{bubbles:!0,composed:!0}))}toggleWidth(t){if(t.currentTarget instanceof HTMLButtonElement){let n=t.currentTarget.value;(n===Ui||n===Li)&&(this.width=n)}}render(){return N` +`;var Ui="narrow",zi="wide",We=class extends L{constructor(){super(...arguments);this.kind="overlay";this.dialogRef=Ni();this.width="narrow"}firstUpdated(t){super.firstUpdated(t),this.dialogRef.value?.showModal()}closed(){this.dispatchEvent(new Event("closed",{bubbles:!0,composed:!0}))}toggleWidth(t){if(t.currentTarget instanceof HTMLButtonElement){let n=t.currentTarget.value;(n===zi||n===Ui)&&(this.width=n)}}render(){return N` @@ -44,14 +44,14 @@ var Vi=Object.create;var Er=Object.defineProperty;var cn=Object.getOwnPropertyDe - `}};We.styles=[at,me,K` + `}};We.styles=[ct,me,K` ::backdrop { background: rgba(0, 0, 0, 0.7); } @@ -100,7 +100,7 @@ var Vi=Object.create;var Er=Object.defineProperty;var cn=Object.getOwnPropertyDe justify-content: flex-end; gap: 0.5rem; } - `],W([he({type:String})],We.prototype,"kind",2),W([he({type:String})],We.prototype,"width",2),We=W([st("bs-overlay")],We);var Ar=class extends L{static{this.styles=[me,K` + `],W([he({type:String})],We.prototype,"kind",2),W([he({type:String})],We.prototype,"width",2),We=W([at("bs-overlay")],We);var Er=class extends L{static{this.styles=[me,K` .svg-icon { display: inline-block; fill: var(--bs-icon-color, currentColor); @@ -234,15 +234,15 @@ var Vi=Object.create;var Er=Object.defineProperty;var cn=Object.getOwnPropertyDe /> - ${this.icon}`}};W([he({type:String,attribute:"icon-name"})],Ar.prototype,"iconName",2);customElements.define("bs-icon",Ar);function zi(){return N``}var ct=class extends L{constructor(){super(...arguments);this.title="..."}render(){return N`
+ ${this.icon}`}};W([he({type:String,attribute:"icon-name"})],Er.prototype,"iconName",2);customElements.define("bs-icon",Er);function Zi(){return N``}var lt=class extends L{constructor(){super(...arguments);this.title="..."}render(){return N`
- ${zi()} + ${Zi()} ${this.title}
-
`}};ct.styles=[at,me,K` +
`}};lt.styles=[ct,me,K` .root { background: white; color: var(--brand-blue); @@ -279,7 +279,7 @@ var Vi=Object.create;var Er=Object.defineProperty;var cn=Object.getOwnPropertyDe slot::slotted(*) { font-size: 10px; } - `],W([he({type:String})],ct.prototype,"title",2),ct=W([st("bs-panel")],ct);var Ot=class extends L{render(){return N` `}};Ot.styles=[me,at],Ot=W([st("bs-token-env")],Ot);function Zi({displayMessage:r}){let t=N` + `],W([he({type:String})],lt.prototype,"title",2),lt=W([at("bs-panel")],lt);var Ct=class extends L{render(){return N` `}};Ct.styles=[me,ct],Ct=W([at("bs-token-env")],Ct);function Fi({displayMessage:r}){let t=N`