diff --git a/.github/workflows/npm-package-release.yaml b/.github/workflows/npm-package-release.yaml new file mode 100644 index 00000000..8a9b127a --- /dev/null +++ b/.github/workflows/npm-package-release.yaml @@ -0,0 +1,115 @@ +name: NPM Packages Release +on: + push: + branches: + - main + +jobs: + release: + if: ${{ github.ref == 'refs/heads/main' && !startsWith(github.event.head_commit.message, 'NPM Package Release') }} + runs-on: ubuntu-latest + permissions: + id-token: write + contents: write + outputs: + version: ${{ env.NEW_VERSION }} + steps: + - uses: actions/checkout@v4 + with: + ssh-key: ${{ secrets.PUBLISH_PRIVATE_KEY }} + submodules: recursive + fetch-depth: 0 + + - uses: DeterminateSystems/nix-installer-action@main + with: + determinate: true + - uses: DeterminateSystems/flakehub-cache-action@main + + - name: Install NodeJS v22 + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: "npm" + + - run: nix develop -c rainix-sol-prelude + + - name: Test JS/TS Binding + run: nix develop -c test-js-bindings + + - name: Git Config + run: | + git config --global user.email "${{ secrets.CI_GIT_EMAIL }}" + git config --global user.name "${{ secrets.CI_GIT_USER }}" + + # get hash of latest published pkgs from npm and concat them + - name: Get Old Hash + run: | + OLD_HASH=$(npm view @rainlanguage/float@latest dist.shasum 2>/dev/null || echo "none") + echo "OLD_HASH=$OLD_HASH" >> $GITHUB_ENV + echo "old hash: $OLD_HASH" + + # calc hash of current workspace pkgs by packing them and concat them + - name: Get New Hash + run: | + NEW_HASH=$(npm pack --silent | xargs shasum | cut -c1-40) + echo "NEW_HASH=$NEW_HASH" >> $GITHUB_ENV + echo "new hash: $NEW_HASH" + rm -f *.tgz + + # from here on, we'll skip if OLD_HASH and NEW_HASH are the same (ie no publish) + # this means we need to skip every step by using an if statement. + # set npm version + - name: Set Version + if: ${{ env.OLD_HASH != env.NEW_HASH }} + run: | + NEW_VERSION=$(npm version prerelease --preid alpha --no-git-tag-version) + echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV + + # Commit changes and tag + - name: Commit And Tag + if: ${{ env.OLD_HASH != env.NEW_HASH }} + run: | + git add "package.json" + git add "package-lock.json" + git commit -m "NPM Package Release v${{ env.NEW_VERSION }}" + git tag npm-v${{ env.NEW_VERSION }} + + # Push the commit to remote + - name: Push Changes To Remote + if: ${{ env.OLD_HASH != env.NEW_HASH }} + run: | + git push origin + git push -u origin npm-v${{ env.NEW_VERSION }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # Create float npm package tarball + - name: Create float NPM Package Tarball + if: ${{ env.OLD_HASH != env.NEW_HASH }} + run: echo "NPM_PACKAGE=$(npm pack --silent)" >> $GITHUB_ENV + + - name: Rename float NPM Package Tarball + if: ${{ env.OLD_HASH != env.NEW_HASH }} + run: mv ${{ env.NPM_PACKAGE }} float_npm_package_${{ env.NEW_VERSION }}.tgz + + # publish float pkg to npm + - name: Publish float pkg To NPM + if: ${{ env.OLD_HASH != env.NEW_HASH }} + uses: JS-DevTools/npm-publish@v3 + with: + token: ${{ secrets.NPM_TOKEN }} + access: public + package: float_npm_package_${{ env.NEW_VERSION }}.tgz + + # Create gitHub release with tarballs + - name: Create GitHub Release with float pkg + if: ${{ env.OLD_HASH != env.NEW_HASH }} + id: gh_release + uses: softprops/action-gh-release@v2 + with: + tag_name: npm-v${{ env.NEW_VERSION }} + name: NPM Package Release v${{ env.NEW_VERSION }} + files: | + float_npm_package_${{ env.NEW_VERSION }}.tgz + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 805c9107..01d487d5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ out cache .direnv -target \ No newline at end of file +target +temp +dist +node_modules diff --git a/Cargo.lock b/Cargo.lock index d5d3e621..bb9ade17 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4605,8 +4605,7 @@ dependencies = [ [[package]] name = "wasm-bindgen-utils" version = "0.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed82a9f56693dd939d2f37431e0dd5401e6447694f9930353fd5c3fb3d9d152e" +source = "git+https://github.com/rainlanguage/rain.wasm?rev=06990d85a0b7c55378a1c8cca4dd9e2bc34a596a#06990d85a0b7c55378a1c8cca4dd9e2bc34a596a" dependencies = [ "js-sys", "paste", @@ -4621,8 +4620,7 @@ dependencies = [ [[package]] name = "wasm-bindgen-utils-macros" version = "0.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cc4956f28c8dba2ad5b3afb5ed7d584f7e9e7194e516eae0577d79d594de6e6" +source = "git+https://github.com/rainlanguage/rain.wasm?rev=06990d85a0b7c55378a1c8cca4dd9e2bc34a596a#06990d85a0b7c55378a1c8cca4dd9e2bc34a596a" dependencies = [ "proc-macro2", "quote", diff --git a/crates/float/Cargo.toml b/crates/float/Cargo.toml index 5a2695e9..9f3fcca4 100644 --- a/crates/float/Cargo.toml +++ b/crates/float/Cargo.toml @@ -5,11 +5,14 @@ edition.workspace = true license.workspace = true homepage.workspace = true +[lib] +crate-type = ["rlib", "cdylib"] + [dependencies] alloy.workspace = true thiserror.workspace = true serde.workspace = true -wasm-bindgen-utils = "0.0.10" +wasm-bindgen-utils = { git = "https://github.com/rainlanguage/rain.wasm", rev = "06990d85a0b7c55378a1c8cca4dd9e2bc34a596a" } [target.'cfg(not(target_family = "wasm"))'.dependencies] revm = { workspace = true, default-features = false, features = [ diff --git a/crates/float/src/error.rs b/crates/float/src/error.rs index f87a8434..89935316 100644 --- a/crates/float/src/error.rs +++ b/crates/float/src/error.rs @@ -1,10 +1,12 @@ +use crate::DecimalFloat; +use alloy::hex::FromHexError; use alloy::primitives::{Bytes, FixedBytes}; use alloy::sol_types::SolError; use revm::context::result::{EVMError, HaltReason, Output, SuccessReason}; use std::thread::AccessError; use thiserror::Error; - -use crate::DecimalFloat; +use wasm_bindgen_utils::prelude::js_sys::{Error as JsError, RangeError}; +use wasm_bindgen_utils::result::WasmEncodedError; #[derive(Debug, Error)] pub enum FloatError { @@ -26,6 +28,14 @@ pub enum FloatError { Access(#[from] AccessError), #[error("Invalid hex string: {0}")] InvalidHex(String), + #[error(transparent)] + AlloyFromHexError(#[from] FromHexError), + #[error(transparent)] + AlloyParseError(#[from] alloy::primitives::ruint::ParseError), + #[error(transparent)] + AlloyParseSignedError(#[from] alloy::primitives::ParseSignedError), + #[error("Wasm bindgen js_sys threw error: {0}")] + JsSysError(String), } #[derive(Debug)] @@ -64,3 +74,24 @@ impl TryFrom> for DecimalFloatErrorSelector { } } } + +impl From for WasmEncodedError { + fn from(value: FloatError) -> Self { + WasmEncodedError { + msg: value.to_string(), + readable_msg: value.to_string(), // todo: add detailed readable msg for errors + } + } +} + +impl From for FloatError { + fn from(value: JsError) -> Self { + FloatError::JsSysError(value.to_string().into()) + } +} + +impl From for FloatError { + fn from(value: RangeError) -> Self { + FloatError::JsSysError(value.to_string().into()) + } +} diff --git a/crates/float/src/js_api.rs b/crates/float/src/js_api.rs new file mode 100644 index 00000000..a3c020f6 --- /dev/null +++ b/crates/float/src/js_api.rs @@ -0,0 +1,694 @@ +use crate::{Float, FloatError}; +use alloy::primitives::aliases::I224; +use revm::primitives::{B256, U256}; +use std::{ + ops::{Add, Div, Mul, Neg, Sub}, + str::FromStr, +}; +use wasm_bindgen_utils::prelude::{js_sys::BigInt, *}; + +#[wasm_bindgen] +impl Float { + /// Returns the 32-byte hexadecimal string representation of the float. + /// + /// # Returns + /// + /// * `String` - The 32-byte hex string. + /// + /// # Example + /// + /// ```typescript + /// const float = Float.fromHex("0x0000000000000000000000000000000000000000000000000000000000000005").value!; + /// assert(float.asHex() === "0x0000000000000000000000000000000000000000000000000000000000000005"); + /// ``` + #[wasm_bindgen(js_name = "asHex", unchecked_return_type = "`0x${string}`")] + pub fn as_hex_js(&self) -> String { + self.as_hex() + } + + /// Convert the float to a JS/TS bigint equivalent of `asHex()` returned hex string. + /// + /// # Throws + /// if conversion fails. + /// + /// # Example + /// + /// ```typescript + /// const float = Float.fromHex("0xfffffffe0000000000000000000000000000000000000000000000000000013a"); + /// const value = float.toBigInt(); + /// assert(value === 115792089183396302089269705419353877679230723318366275194376439045705909141818n); + /// ``` + #[wasm_bindgen(js_name = "toBigint", unchecked_return_type = "bigint")] + pub fn to_bigint(&self) -> BigInt { + self.try_to_bigint().unwrap_throw() + } + + /// Constructs a `Float` from a bigint equivalent of the `fromHex()` returned Float. + /// + /// # Throws + /// if conversion fails. + /// + /// # Example + /// + /// ```typescript + /// const float = Float.fromBigint(115792089183396302089269705419353877679230723318366275194376439045705909141818n); + /// assert(float.asHex() === "0xfffffffe0000000000000000000000000000000000000000000000000000013a"); + /// ``` + #[wasm_bindgen(js_name = "fromBigint")] + pub fn from_bigint(value: BigInt) -> Float { + Self::try_from_bigint(value).unwrap_throw() + } +} + +#[wasm_export] +impl Float { + /// Tries to convert the float to a JS/TS bigint equivalent of `asHex()` returned hex string. + /// + /// # Returns + /// + /// * `Ok(bigint)` - The resulting `bigint` value. + /// * `Err(FloatError)` - If the conversion fails. + /// + /// # Example + /// + /// ```typescript + /// const float = Float.fromHex("0xfffffffe0000000000000000000000000000000000000000000000000000013a"); + /// const bigintResult = float.tryToBigInt(); + /// if (bigintResult.error) { + /// console.error(bigintResult.error); + /// } + /// assert(bigintResult.value === 115792089183396302089269705419353877679230723318366275194376439045705909141818n); + /// ``` + #[wasm_export( + js_name = "tryToBigint", + preserve_js_class, + unchecked_return_type = "bigint" + )] + pub fn try_to_bigint(&self) -> Result { + Ok(BigInt::from_str(&self.as_hex())?) + } + + /// Constructs a `Float` from a bigint equivalent of the `fromHex()` returned Float. + /// + /// # Returns + /// + /// * `Ok(Float)` - The resulting `Float` value. + /// * `Err(FloatError)` - If the conversion fails. + /// + /// # Example + /// + /// ```typescript + /// const floatResult = Float.tryFromBigint(115792089183396302089269705419353877679230723318366275194376439045705909141818n); + /// if (floatResult.error) { + /// console.error(floatResult.error); + /// } + /// const value = float.value; + /// assert(value.asHex() === "0xfffffffe0000000000000000000000000000000000000000000000000000013a"); + /// ``` + #[wasm_export(js_name = "tryFromBigint", preserve_js_class)] + pub fn try_from_bigint(value: BigInt) -> Result { + // convert to 16 radix string and append 0 if length is odd + let mut value: String = value.to_string(16)?.into(); + if value.len() % 2 == 1 { + value = format!("0{}", value); + } + Ok(Float(B256::left_padding_from(&alloy::hex::decode(&value)?))) + } + + /// Converts a fixed-point decimal value to a `Float` using the specified number of decimals. + /// + /// # Arguments + /// + /// * `value` - The fixed-point decimal value as a `string`. + /// * `decimals` - The number of decimals in the fixed-point representation. + /// + /// # Returns + /// + /// * `Ok(Float)` - The resulting `Float` value. + /// * `Err(FloatError)` - If the conversion fails. + /// + /// # Example + /// + /// ```typescript + /// const floatResult = Float.fromFixedDecimal("12345", 2); + /// if (floatResult.error) { + /// console.error(floatResult.error); + /// } + /// const float = floatResult.value; + /// assert(float.format() === "123.45"); + /// ``` + #[wasm_export(js_name = "fromFixedDecimal", preserve_js_class)] + pub fn from_fixed_decimal_js(value: String, decimals: u8) -> Result { + let val = U256::from_str(&value)?; + Self::from_fixed_decimal(val, decimals) + } + + /// Packs a coefficient and exponent into a `Float` in a lossless manner. + /// + /// # Arguments + /// + /// * `coefficient` - The coefficient as an `string`. + /// * `exponent` - The exponent as an `number`. + /// + /// # Returns + /// + /// * `Ok(Float)` - The packed float. + /// * `Err(FloatError)` - If the packing fails (e.g., overflow). + /// + /// # Example + /// + /// ```typescript + /// const floatResult = Float.packLossless("314", -2); + /// if (floatResult.error) { + /// console.error(floatResult.error); + /// } + /// const float = floatResult.value; + /// assert(float.format() === "3.14"); + /// ``` + #[wasm_export(js_name = "packLossless", preserve_js_class)] + pub fn pack_lossless_js(coefficient: String, exponent: i32) -> Result { + let val = I224::from_str(&coefficient)?; + Self::pack_lossless(val, exponent) + } + + /// Parses a decimal string into a `Float`. + /// + /// # Arguments + /// + /// * `str` - The string to parse. + /// + /// # Returns + /// + /// * `Ok(Float)` - The parsed float. + /// * `Err(FloatError)` - If parsing fails. + /// + /// # Example + /// + /// ```typescript + /// const floatResult = Float.parse("3.1415"); + /// if (floatResult.error) { + /// console.error(floatResult.error); + /// } + /// const float = floatResult.value; + /// assert(float.format() === "3.1415"); + /// ``` + #[wasm_export(js_name = "parse", preserve_js_class)] + pub fn parse_js(str: String) -> Result { + Self::parse(str) + } + + /// Constructs a `Float` from a 32-byte hexadecimal string. + /// + /// # Arguments + /// + /// * `hex` - The 32-byte hex string to parse. + /// + /// # Returns + /// + /// * `Ok(Float)` - The float parsed from the hex string. + /// * `Err(FloatError)` - If the hex string is not valid or not 32 bytes. + /// + /// # Example + /// + /// ```typescript + /// const floatResult = Float.fromHex("0x0000000000000000000000000000000000000000000000000000000000000005"); + /// if (floatResult.error) { + /// console.error(floatResult.error); + /// } + /// const float = floatResult.value; + /// assert(float.asHex() === "0x0000000000000000000000000000000000000000000000000000000000000005"); + /// ``` + #[wasm_export(js_name = "fromHex", preserve_js_class)] + pub fn from_hex_js( + #[wasm_export(unchecked_param_type = "`0x${string}`")] hex: &str, + ) -> Result { + Self::from_hex(hex) + } + + /// Formats the float as a decimal string. + /// + /// NOTE: Uses 18 decimal places and fails if the float has more than + /// that number of decimals. + /// + /// # Returns + /// + /// * `Ok(String)` - The formatted string. + /// * `Err(FloatError)` - If formatting fails. + /// + /// # Example + /// + /// ```typescript + /// const floatResult = Float.parse("2.5"); + /// if (floatResult.error) { + /// console.error(floatResult.error); + /// } + /// const float = floatResult.value; + /// assert(float.format() === "2.5"); + /// ``` + #[wasm_export(js_name = "format")] + pub fn format_js(&self) -> Result { + self.format() + } + + /// Formats the float as a decimal string. Gets truncated to 18 decimal + /// places if it has more than that. + /// + /// # Returns + /// + /// * `Ok(String)` - The formatted string. + /// * `Err(FloatError)` - If formatting fails. + /// + /// # Example + /// + /// ```typescript + /// const floatResult = Float.parse("2.5"); + /// if (floatResult.error) { + /// console.error(floatResult.error); + /// } + /// const float = floatResult.value; + /// assert(float.format18() === "2.5"); + /// ``` + #[wasm_export(js_name = "format18")] + pub fn format18_js(&self) -> Result { + self.format18() + } + + /// Returns `true` if `self` is less than `b`. + /// + /// # Arguments + /// + /// * `b` - The `Float` value to compare with `self`. + /// + /// # Returns + /// + /// * `Ok(true)` if `self` is less than `b`. + /// * `Ok(false)` if `self` is not less than `b`. + /// * `Err(FloatError)` if the comparison fails due to an error in the underlying EVM call or decoding. + /// + /// # Example + /// + /// ```typescript + /// const a = Float.parse("1.0").value!; + /// const b = Float.parse("2.0").value!; + /// const result = a.lt(b); + /// if (result.error) { + /// console.error(result.error); + /// } + /// assert(result.value); + /// ``` + #[wasm_export(js_name = "lt", unchecked_return_type = "boolean")] + pub fn lt_js(&self, b: &Self) -> Result { + self.lt(*b) + } + + /// Returns `true` if `self` is equal to `b`. + /// + /// # Arguments + /// + /// * `b` - The `Float` value to compare with `self`. + /// + /// # Returns + /// + /// * `Ok(true)` if `self` is equal to `b`. + /// * `Ok(false)` if `self` is not equal to `b`. + /// * `Err(FloatError)` if the comparison fails due to an error in the underlying EVM call or decoding. + /// + /// # Example + /// + /// ```typescript + /// const a = Float.parse("2.0").value!; + /// const b = Float.parse("2.0").value!; + /// const result = a.eq(b); + /// if (result.error) { + /// console.error(result.error); + /// } + /// assert(result.value); + /// ``` + #[wasm_export(js_name = "eq", unchecked_return_type = "boolean")] + pub fn eq_js(&self, b: &Self) -> Result { + self.eq(*b) + } + + /// Returns `true` if `self` is less than or equal to `b`. + /// + /// # Arguments + /// + /// * `b` - The `Float` value to compare with `self`. + /// + /// # Returns + /// + /// * `Ok(true)` if `self` is less than or equal to `b`. + /// * `Ok(false)` if `self` is not less than or equal to `b`. + /// * `Err(FloatError)` if the comparison fails due to an error in the underlying EVM call or decoding. + /// + /// # Example + /// + /// ```typescript + /// const a = Float.parse("1.0").value!; + /// const b = Float.parse("2.0").value!; + /// const result = a.lte(b); + /// if (result.error) { + /// console.error(result.error); + /// } + /// assert(result.value); + /// ``` + #[wasm_export(js_name = "lte", unchecked_return_type = "boolean")] + pub fn lte_js(&self, b: &Self) -> Result { + self.lte(*b) + } + + /// Returns `true` if `self` is greater than or equal to `b`. + /// + /// # Arguments + /// + /// * `b` - The `Float` value to compare with `self`. + /// + /// # Returns + /// + /// * `Ok(true)` if `self` is greater than or equal to `b`. + /// * `Ok(false)` if `self` is not greater than or equal to `b`. + /// * `Err(FloatError)` if the comparison fails due to an error in the underlying EVM call or decoding. + /// + /// # Example + /// + /// ```typescript + /// const a = Float.parse("2.0").value!; + /// const b = Float.parse("1.0").value!; + /// const result = a.gte(b); + /// if (result.error) { + /// console.error(result.error); + /// } + /// assert(result.value); + /// ``` + #[wasm_export(js_name = "gte", unchecked_return_type = "boolean")] + pub fn gte_js(&self, b: &Self) -> Result { + self.gte(*b) + } + + /// Returns `true` if `self` is greater than `b`. + /// + /// # Arguments + /// + /// * `b` - The `Float` value to compare with `self`. + /// + /// # Returns + /// + /// * `Ok(true)` if `self` is greater than `b`. + /// * `Ok(false)` if `self` is not greater than `b`. + /// * `Err(FloatError)` if the comparison fails due to an error in the underlying EVM call or decoding. + /// + /// # Example + /// + /// ```typescript + /// const a = Float.parse("2.0").value!; + /// const b = Float.parse("1.0").value!; + /// const result = a.gt(b); + /// if (result.error) { + /// console.error(result.error); + /// } + /// assert(result.value); + /// ``` + #[wasm_export(js_name = "gt", unchecked_return_type = "boolean")] + pub fn gt_js(&self, b: &Self) -> Result { + self.gt(*b) + } + + /// Returns the multiplicative inverse of the float. + /// + /// # Returns + /// + /// * `Ok(Float)` - The inverse. + /// * `Err(FloatError)` - If inversion fails. + /// + /// # Example + /// + /// ```typescript + /// const x = Float.parse("2.0").value!; + /// const inv = x.inv(); + /// if (inv.error) { + /// console.error(inv.error); + /// } + /// assert(inv.value.format().startsWith("0.5")); + /// ``` + #[wasm_export(js_name = "inv", preserve_js_class)] + pub fn inv_js(&self) -> Result { + self.inv() + } + + /// Returns the absolute value of the float. + /// + /// # Returns + /// + /// * `Ok(Float)` - The absolute value. + /// * `Err(FloatError)` - If the operation fails. + /// + /// # Example + /// + /// ```typescript + /// const x = Float.parse("-3.14").value!; + /// const abs = x.abs(); + /// if (abs.error) { + /// console.error(abs.error); + /// } + /// assert(abs.value.format() === "3.14"); + /// ``` + #[wasm_export(js_name = "abs", preserve_js_class)] + pub fn abs_js(&self) -> Result { + self.abs() + } + + /// Adds two floats. + /// + /// # Returns + /// + /// * `Ok(Float)` - The sum. + /// * `Err(FloatError)` - If addition fails. + /// + /// # Example + /// + /// ```typescript + /// const a = Float.parse("1.5").value!; + /// const b = Float.parse("2.5").value!; + /// const result = a.add(b); + /// if (result.error) { + /// console.error(result.error); + /// } + /// assert(result.value.format() === "4"); + /// ``` + #[wasm_export(js_name = "add", preserve_js_class)] + pub fn add_js(&self, b: &Self) -> Result { + self.add(*b) + } + + /// Subtracts `b` from `self`. + /// + /// # Returns + /// + /// * `Ok(Float)` - The difference. + /// * `Err(FloatError)` - If subtraction fails. + /// + /// # Example + /// + /// ```typescript + /// const a = Float.parse("5.0").value!; + /// const b = Float.parse("2.0").value!; + /// const result = a.sub(b); + /// if (result.error) { + /// console.error(result.error); + /// } + /// assert(result.value.format() === "3"); + /// ``` + #[wasm_export(js_name = "sub", preserve_js_class)] + pub fn sub_js(&self, b: &Self) -> Result { + self.sub(*b) + } + + /// Multiplies two floats. + /// + /// # Returns + /// + /// * `Ok(Float)` - The product. + /// * `Err(FloatError)` - If multiplication fails. + /// + /// # Example + /// + /// ```typescript + /// const a = Float.parse("2.0").value!; + /// const b = Float.parse("3.0").value!; + /// const result = a.mul(b); + /// if (result.error) { + /// console.error(result.error); + /// } + /// assert(result.value.format() === "6"); + /// ``` + #[wasm_export(js_name = "mul", preserve_js_class)] + pub fn mul_js(&self, b: &Self) -> Result { + self.mul(*b) + } + + /// Divides `self` by `b`. + /// + /// # Returns + /// + /// * `Ok(Float)` - The quotient. + /// * `Err(FloatError)` - If division fails. + /// + /// # Example + /// + /// ```typescript + /// const a = Float.parse("6.0").value!; + /// const b = Float.parse("2.0").value!; + /// const result = a.div(b); + /// if (result.error) { + /// console.error(result.error); + /// } + /// assert(result.value.format() === "3"); + /// ``` + #[wasm_export(js_name = "div", preserve_js_class)] + pub fn div_js(&self, b: &Self) -> Result { + self.div(*b) + } + + /// Returns the fractional part of the float. + /// + /// # Returns + /// + /// * `Ok(Float)` - The fractional part. + /// * `Err(FloatError)` - If the operation fails. + /// + /// # Example + /// + /// ```typescript + /// const x = Float.parse("3.75").value!; + /// const result = x.frac(); + /// if (result.error) { + /// console.error(result.error); + /// } + /// assert(result.value.format() === "0.75"); + /// ``` + #[wasm_export(js_name = "frac", preserve_js_class)] + pub fn frac_js(&self) -> Result { + self.frac() + } + + /// Returns the floor of the float. + /// + /// # Returns + /// + /// * `Ok(Float)` - The floored value. + /// * `Err(FloatError)` - If the operation fails. + /// + /// # Example + /// + /// ```typescript + /// const x = Float.parse("3.75").value!; + /// const result = x.floor(); + /// if (result.error) { + /// console.error(result.error); + /// } + /// assert(result.value.format() === "3"); + /// ``` + #[wasm_export(js_name = "floor", preserve_js_class)] + pub fn floor_js(&self) -> Result { + self.floor() + } + + /// Returns the minimum of `self` and `b`. + /// + /// # Arguments + /// + /// * `b` - The other `Float` to compare with. + /// + /// # Returns + /// + /// * `Ok(Float)` - The minimum value. + /// * `Err(FloatError)` - If the operation fails. + /// + /// # Example + /// + /// ```typescript + /// const a = Float.parse("1.0").value!; + /// const b = Float.parse("2.0").value!; + /// const result = a.min(b); + /// if (result.error) { + /// console.error(result.error); + /// } + /// assert(result.value.format() === "1"); + /// ``` + #[wasm_export(js_name = "min", preserve_js_class)] + pub fn min_js(&self, b: &Self) -> Result { + self.min(*b) + } + + /// Returns the maximum of `self` and `b`. + /// + /// # Arguments + /// + /// * `b` - The other `Float` to compare with. + /// + /// # Returns + /// + /// * `Ok(Float)` - The maximum value. + /// * `Err(FloatError)` - If the operation fails. + /// + /// # Example + /// + /// ```typescript + /// const a = Float.parse("1.0").value!; + /// const b = Float.parse("2.0").value!; + /// const result = a.max(b); + /// if (result.error) { + /// console.error(result.error); + /// } + /// assert(result.value.format() === "2"); + /// ``` + #[wasm_export(js_name = "max", preserve_js_class)] + pub fn max_js(&self, b: &Self) -> Result { + self.max(*b) + } + + /// Checks if the float is zero. + /// + /// # Returns + /// + /// * `Ok(true)` if the float is zero. + /// * `Ok(false)` if the float is not zero. + /// * `Err(FloatError)` if the operation fails. + /// + /// # Example + /// + /// ```typescript + /// const zero = Float.parse("0").value!; + /// const result = zero.isZero(); + /// if (result.error) { + /// console.error(result.error); + /// } + /// assert(result.value); + /// ``` + #[wasm_export(js_name = "isZero", unchecked_return_type = "boolean")] + pub fn is_zero_js(&self) -> Result { + self.is_zero() + } + + /// Returns the negation of the float. + /// + /// # Returns + /// + /// * `Ok(Float)` - The negated value. + /// * `Err(FloatError)` - If the operation fails. + /// + /// # Example + /// + /// ```typescript + /// const x = Float.parse("3.14").value!; + /// const result = x.neg(); + /// if (result.error) { + /// console.error(result.error); + /// } + /// assert(result.value.format() === "-3.14"); + /// ``` + #[wasm_export(js_name = "neg", preserve_js_class)] + pub fn neg_js(&self) -> Result { + self.neg() + } +} diff --git a/crates/float/src/lib.rs b/crates/float/src/lib.rs index fb0dd210..1b468502 100644 --- a/crates/float/src/lib.rs +++ b/crates/float/src/lib.rs @@ -5,11 +5,11 @@ use alloy::{sol, sol_types::SolCall}; use revm::primitives::{U256, fixed_bytes}; use serde::{Deserialize, Serialize}; use std::ops::{Add, Div, Mul, Neg, Sub}; -use wasm_bindgen_utils::impl_wasm_traits; use wasm_bindgen_utils::prelude::*; pub mod error; mod evm; +pub mod js_api; use error::DecimalFloatErrorSelector; pub use error::FloatError; @@ -21,11 +21,26 @@ sol!( "../../out/DecimalFloat.sol/DecimalFloat.json" ); -#[derive(Debug, Copy, Clone, Default, Serialize, Deserialize, Hash, Tsify)] -pub struct Float(#[tsify(type = "`0x${string}`")] pub B256); -impl_wasm_traits!(Float); +#[derive(Debug, Copy, Clone, Default, Serialize, Deserialize, Hash)] +#[wasm_bindgen] +pub struct Float(B256); impl Float { + /// Creates a new `Float` from the given 32-byte value `B256`. + pub fn from_raw(value: B256) -> Self { + Float(value) + } + + /// Getter for inner 32-bytes value of this Float instance as `B256`. + pub fn get_inner(&self) -> B256 { + self.0 + } + + /// Sets the inner 32-byte value of this float from the given `B256`. + pub fn set_inner(&mut self, value: B256) { + self.0 = value; + } + /// Converts a fixed-point decimal value to a `Float` using the specified number of decimals. /// /// # Arguments @@ -417,6 +432,60 @@ impl Float { Ok(Float(decoded)) }) } + + /// Returns `true` if `self` is less than or equal to `b`. + /// + /// # Arguments + /// + /// * `b` - The `Float` value to compare with `self`. + /// + /// # Returns + /// + /// * `Ok(true)` if `self` is less than or equal to `b`. + /// * `Ok(false)` if `self` is not less than or equal to `b`. + /// * `Err(FloatError)` if the comparison fails due to an error in the underlying EVM call or decoding. + /// + /// # Example + /// + /// ``` + /// use rain_math_float::Float; + /// + /// let a = Float::parse("1.0".to_string())?; + /// let b = Float::parse("2.0".to_string())?; + /// assert!(a.lte(b)?); + /// + /// anyhow::Ok(()) + /// ``` + pub fn lte(self, b: Self) -> Result { + Ok(self.lt(b)? || self.eq(b)?) + } + + /// Returns `true` if `self` is greater than or equal to `b`. + /// + /// # Arguments + /// + /// * `b` - The `Float` value to compare with `self`. + /// + /// # Returns + /// + /// * `Ok(true)` if `self` is greater than or equal to `b`. + /// * `Ok(false)` if `self` is not greater than or equal to `b`. + /// * `Err(FloatError)` if the comparison fails due to an error in the underlying EVM call or decoding. + /// + /// # Example + /// + /// ``` + /// use rain_math_float::Float; + /// + /// let a = Float::parse("2.0".to_string())?; + /// let b = Float::parse("1.0".to_string())?; + /// assert!(a.gte(b)?); + /// + /// anyhow::Ok(()) + /// ``` + pub fn gte(self, b: Self) -> Result { + Ok(self.gt(b)? || self.eq(b)?) + } } impl Add for Float { @@ -743,6 +812,18 @@ impl Neg for Float { } } +impl From for Float { + fn from(value: B256) -> Self { + Float(value) + } +} + +impl From for B256 { + fn from(value: Float) -> Self { + value.0 + } +} + #[cfg(test)] mod tests { use crate::DecimalFloat::DecimalFloatErrors; @@ -1414,4 +1495,41 @@ mod tests { ); } } + + #[test] + fn test_lte_gte() { + let negone = Float::parse("-1".to_string()).unwrap(); + let zero = Float::parse("0".to_string()).unwrap(); + let three = Float::parse("3".to_string()).unwrap(); + + assert!(negone.lte(zero).unwrap()); + assert!(zero.lte(three).unwrap()); + assert!(negone.lte(three).unwrap()); + + assert!(zero.gte(negone).unwrap()); + assert!(three.gte(zero).unwrap()); + assert!(three.gte(negone).unwrap()); + } + + proptest! { + #[test] + fn test_lte_gte_fuzz(a in reasonable_float()) { + let b = a; + let one = Float::parse("1".to_string()).unwrap(); + + let a = (a - one).unwrap(); + let lte = a.lte(b).unwrap(); + prop_assert!(lte); // lt + + let a = (a + one).unwrap(); + let gte = a.gte(b).unwrap(); + let lte = a.lte(b).unwrap(); + prop_assert!(gte); // eq + prop_assert!(lte); // eq + + let a = (a + one).unwrap(); + let gte = a.gte(b).unwrap(); + prop_assert!(gte); // gt + } + } } diff --git a/flake.nix b/flake.nix index 22d563c9..7c850c76 100644 --- a/flake.nix +++ b/flake.nix @@ -15,14 +15,24 @@ name = "test-wasm-build"; body = '' set -euxo pipefail - cargo build --target wasm32-unknown-unknown --workspace + cargo build -r --target wasm32-unknown-unknown --lib --workspace + ''; + }; + + test-js-bindings = rainix.mkTask.${system} { + name = "test-js-bindings"; + body = '' + set -euxo pipefail + npm install --no-check + npm run build + npm test ''; }; }; devShells.default = pkgs.mkShell { shellHook = rainix.devShells.${system}.default.shellHook; - packages = [ packages.test-wasm-build ]; + packages = [ packages.test-wasm-build packages.test-js-bindings ]; inputsFrom = [ rainix.devShells.${system}.default ]; }; }); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..02474037 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,2357 @@ +{ + "name": "@rainlanguage/float", + "version": "0.0.0-alpha.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@rainlanguage/float", + "version": "0.0.0-alpha.0", + "license": "LicenseRef-DCL-1.0", + "dependencies": { + "buffer": "6.0.3" + }, + "devDependencies": { + "rimraf": "6.0.1", + "typedoc": "^0.28.7", + "vitest": "^3.1.4" + }, + "engines": { + "node": ">=22" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.6.tgz", + "integrity": "sha512-ShbM/3XxwuxjFiuVBHA+d3j5dyac0aEVVq1oluIDf71hUw0aRF59dV/efUsIwFnR6m8JNM2FjZOzmaZ8yG61kw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.6.tgz", + "integrity": "sha512-S8ToEOVfg++AU/bHwdksHNnyLyVM+eMVAOf6yRKFitnwnbwwPNqKr3srzFRe7nzV69RQKb5DgchIX5pt3L53xg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.6.tgz", + "integrity": "sha512-hd5zdUarsK6strW+3Wxi5qWws+rJhCCbMiC9QZyzoxfk5uHRIE8T287giQxzVpEvCwuJ9Qjg6bEjcRJcgfLqoA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.6.tgz", + "integrity": "sha512-0Z7KpHSr3VBIO9A/1wcT3NTy7EB4oNC4upJ5ye3R7taCc2GUdeynSLArnon5G8scPwaU866d3H4BCrE5xLW25A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.6.tgz", + "integrity": "sha512-FFCssz3XBavjxcFxKsGy2DYK5VSvJqa6y5HXljKzhRZ87LvEi13brPrf/wdyl/BbpbMKJNOr1Sd0jtW4Ge1pAA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.6.tgz", + "integrity": "sha512-GfXs5kry/TkGM2vKqK2oyiLFygJRqKVhawu3+DOCk7OxLy/6jYkWXhlHwOoTb0WqGnWGAS7sooxbZowy+pK9Yg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.6.tgz", + "integrity": "sha512-aoLF2c3OvDn2XDTRvn8hN6DRzVVpDlj2B/F66clWd/FHLiHaG3aVZjxQX2DYphA5y/evbdGvC6Us13tvyt4pWg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.6.tgz", + "integrity": "sha512-2SkqTjTSo2dYi/jzFbU9Plt1vk0+nNg8YC8rOXXea+iA3hfNJWebKYPs3xnOUf9+ZWhKAaxnQNUf2X9LOpeiMQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.6.tgz", + "integrity": "sha512-SZHQlzvqv4Du5PrKE2faN0qlbsaW/3QQfUUc6yO2EjFcA83xnwm91UbEEVx4ApZ9Z5oG8Bxz4qPE+HFwtVcfyw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.6.tgz", + "integrity": "sha512-b967hU0gqKd9Drsh/UuAm21Khpoh6mPBSgz8mKRq4P5mVK8bpA+hQzmm/ZwGVULSNBzKdZPQBRT3+WuVavcWsQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.6.tgz", + "integrity": "sha512-aHWdQ2AAltRkLPOsKdi3xv0mZ8fUGPdlKEjIEhxCPm5yKEThcUjHpWB1idN74lfXGnZ5SULQSgtr5Qos5B0bPw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.6.tgz", + "integrity": "sha512-VgKCsHdXRSQ7E1+QXGdRPlQ/e08bN6WMQb27/TMfV+vPjjTImuT9PmLXupRlC90S1JeNNW5lzkAEO/McKeJ2yg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.6.tgz", + "integrity": "sha512-WViNlpivRKT9/py3kCmkHnn44GkGXVdXfdc4drNmRl15zVQ2+D2uFwdlGh6IuK5AAnGTo2qPB1Djppj+t78rzw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.6.tgz", + "integrity": "sha512-wyYKZ9NTdmAMb5730I38lBqVu6cKl4ZfYXIs31Baf8aoOtB4xSGi3THmDYt4BTFHk7/EcVixkOV2uZfwU3Q2Jw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.6.tgz", + "integrity": "sha512-KZh7bAGGcrinEj4qzilJ4hqTY3Dg2U82c8bv+e1xqNqZCrCyc+TL9AUEn5WGKDzm3CfC5RODE/qc96OcbIe33w==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.6.tgz", + "integrity": "sha512-9N1LsTwAuE9oj6lHMyyAM+ucxGiVnEqUdp4v7IaMmrwb06ZTEVCIs3oPPplVsnjPfyjmxwHxHMF8b6vzUVAUGw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.6.tgz", + "integrity": "sha512-A6bJB41b4lKFWRKNrWoP2LHsjVzNiaurf7wyj/XtFNTsnPuxwEBWHLty+ZE0dWBKuSK1fvKgrKaNjBS7qbFKig==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.6.tgz", + "integrity": "sha512-IjA+DcwoVpjEvyxZddDqBY+uJ2Snc6duLpjmkXm/v4xuS3H+3FkLZlDm9ZsAbF9rsfP3zeA0/ArNDORZgrxR/Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.6.tgz", + "integrity": "sha512-dUXuZr5WenIDlMHdMkvDc1FAu4xdWixTCRgP7RQLBOkkGgwuuzaGSYcOpW4jFxzpzL1ejb8yF620UxAqnBrR9g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.6.tgz", + "integrity": "sha512-l8ZCvXP0tbTJ3iaqdNf3pjaOSd5ex/e6/omLIQCVBLmHTlfXW3zAxQ4fnDmPLOB1x9xrcSi/xtCWFwCZRIaEwg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.6.tgz", + "integrity": "sha512-hKrmDa0aOFOr71KQ/19JC7az1P0GWtCN1t2ahYAf4O007DHZt/dW8ym5+CUdJhQ/qkZmI1HAF8KkJbEFtCL7gw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.6.tgz", + "integrity": "sha512-+SqBcAWoB1fYKmpWoQP4pGtx+pUUC//RNYhFdbcSA16617cchuryuhOCRpPsjCblKukAckWsV+aQ3UKT/RMPcA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.6.tgz", + "integrity": "sha512-dyCGxv1/Br7MiSC42qinGL8KkG4kX0pEsdb0+TKhmJZgCUDBGmyo1/ArCjNGiOLiIAgdbWgmWgib4HoCi5t7kA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.6.tgz", + "integrity": "sha512-42QOgcZeZOvXfsCBJF5Afw73t4veOId//XD3i+/9gSkhSV6Gk3VPlWncctI+JcOyERv85FUo7RxuxGy+z8A43Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.6.tgz", + "integrity": "sha512-4AWhgXmDuYN7rJI6ORB+uU9DHLq/erBbuMoAuB4VWJTu5KtCgcKYPynF0YI1VkBNuEfjNlLrFr9KZPJzrtLkrQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.6.tgz", + "integrity": "sha512-NgJPHHbEpLQgDH2MjQu90pzW/5vvXIZ7KOnPyNBm92A6WgZ/7b6fJyUBjoumLqeOQQGqY2QjQxRo97ah4Sj0cA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@gerrit0/mini-shiki": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/@gerrit0/mini-shiki/-/mini-shiki-3.8.0.tgz", + "integrity": "sha512-tloLVqvvoyv636PilYZwNhCmZ+xxgRicysMvpKdZ4Y6+9IH6v4lp7GodbDDncApNQjflwTSnXuYQoe3el5C59w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/engine-oniguruma": "^3.8.0", + "@shikijs/langs": "^3.8.0", + "@shikijs/themes": "^3.8.0", + "@shikijs/types": "^3.8.0", + "@shikijs/vscode-textmate": "^10.0.2" + } + }, + "node_modules/@isaacs/balanced-match": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz", + "integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@isaacs/brace-expansion": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz", + "integrity": "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@isaacs/balanced-match": "^4.0.1" + }, + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.4.tgz", + "integrity": "sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.45.1.tgz", + "integrity": "sha512-NEySIFvMY0ZQO+utJkgoMiCAjMrGvnbDLHvcmlA33UXJpYBCvlBEbMMtV837uCkS+plG2umfhn0T5mMAxGrlRA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.45.1.tgz", + "integrity": "sha512-ujQ+sMXJkg4LRJaYreaVx7Z/VMgBBd89wGS4qMrdtfUFZ+TSY5Rs9asgjitLwzeIbhwdEhyj29zhst3L1lKsRQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.45.1.tgz", + "integrity": "sha512-FSncqHvqTm3lC6Y13xncsdOYfxGSLnP+73k815EfNmpewPs+EyM49haPS105Rh4aF5mJKywk9X0ogzLXZzN9lA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.45.1.tgz", + "integrity": "sha512-2/vVn/husP5XI7Fsf/RlhDaQJ7x9zjvC81anIVbr4b/f0xtSmXQTFcGIQ/B1cXIYM6h2nAhJkdMHTnD7OtQ9Og==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.45.1.tgz", + "integrity": "sha512-4g1kaDxQItZsrkVTdYQ0bxu4ZIQ32cotoQbmsAnW1jAE4XCMbcBPDirX5fyUzdhVCKgPcrwWuucI8yrVRBw2+g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.45.1.tgz", + "integrity": "sha512-L/6JsfiL74i3uK1Ti2ZFSNsp5NMiM4/kbbGEcOCps99aZx3g8SJMO1/9Y0n/qKlWZfn6sScf98lEOUe2mBvW9A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.45.1.tgz", + "integrity": "sha512-RkdOTu2jK7brlu+ZwjMIZfdV2sSYHK2qR08FUWcIoqJC2eywHbXr0L8T/pONFwkGukQqERDheaGTeedG+rra6Q==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.45.1.tgz", + "integrity": "sha512-3kJ8pgfBt6CIIr1o+HQA7OZ9mp/zDk3ctekGl9qn/pRBgrRgfwiffaUmqioUGN9hv0OHv2gxmvdKOkARCtRb8Q==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.45.1.tgz", + "integrity": "sha512-k3dOKCfIVixWjG7OXTCOmDfJj3vbdhN0QYEqB+OuGArOChek22hn7Uy5A/gTDNAcCy5v2YcXRJ/Qcnm4/ma1xw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.45.1.tgz", + "integrity": "sha512-PmI1vxQetnM58ZmDFl9/Uk2lpBBby6B6rF4muJc65uZbxCs0EA7hhKCk2PKlmZKuyVSHAyIw3+/SiuMLxKxWog==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loongarch64-gnu": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.45.1.tgz", + "integrity": "sha512-9UmI0VzGmNJ28ibHW2GpE2nF0PBQqsyiS4kcJ5vK+wuwGnV5RlqdczVocDSUfGX/Na7/XINRVoUgJyFIgipoRg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.45.1.tgz", + "integrity": "sha512-7nR2KY8oEOUTD3pBAxIBBbZr0U7U+R9HDTPNy+5nVVHDXI4ikYniH1oxQz9VoB5PbBU1CZuDGHkLJkd3zLMWsg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.45.1.tgz", + "integrity": "sha512-nlcl3jgUultKROfZijKjRQLUu9Ma0PeNv/VFHkZiKbXTBQXhpytS8CIj5/NfBeECZtY2FJQubm6ltIxm/ftxpw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.45.1.tgz", + "integrity": "sha512-HJV65KLS51rW0VY6rvZkiieiBnurSzpzore1bMKAhunQiECPuxsROvyeaot/tcK3A3aGnI+qTHqisrpSgQrpgA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.45.1.tgz", + "integrity": "sha512-NITBOCv3Qqc6hhwFt7jLV78VEO/il4YcBzoMGGNxznLgRQf43VQDae0aAzKiBeEPIxnDrACiMgbqjuihx08OOw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.45.1.tgz", + "integrity": "sha512-+E/lYl6qu1zqgPEnTrs4WysQtvc/Sh4fC2nByfFExqgYrqkKWp1tWIbe+ELhixnenSpBbLXNi6vbEEJ8M7fiHw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.45.1.tgz", + "integrity": "sha512-a6WIAp89p3kpNoYStITT9RbTbTnqarU7D8N8F2CV+4Cl9fwCOZraLVuVFvlpsW0SbIiYtEnhCZBPLoNdRkjQFw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.45.1.tgz", + "integrity": "sha512-T5Bi/NS3fQiJeYdGvRpTAP5P02kqSOpqiopwhj0uaXB6nzs5JVi2XMJb18JUSKhCOX8+UE1UKQufyD6Or48dJg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.45.1.tgz", + "integrity": "sha512-lxV2Pako3ujjuUe9jiU3/s7KSrDfH6IgTSQOnDWr9aJ92YsFd7EurmClK0ly/t8dzMkDtd04g60WX6yl0sGfdw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.45.1.tgz", + "integrity": "sha512-M/fKi4sasCdM8i0aWJjCSFm2qEnYRR8AMLG2kxp6wD13+tMGA4Z1tVAuHkNRjud5SW2EM3naLuK35w9twvf6aA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@shikijs/engine-oniguruma": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-3.8.0.tgz", + "integrity": "sha512-Tx7kR0oFzqa+rY7t80LjN8ZVtHO3a4+33EUnBVx2qYP3fGxoI9H0bvnln5ySelz9SIUTsS0/Qn+9dg5zcUMsUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.8.0", + "@shikijs/vscode-textmate": "^10.0.2" + } + }, + "node_modules/@shikijs/langs": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-3.8.0.tgz", + "integrity": "sha512-mfGYuUgjQ5GgXinB5spjGlBVhG2crKRpKkfADlp8r9k/XvZhtNXxyOToSnCEnF0QNiZnJjlt5MmU9PmhRdwAbg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.8.0" + } + }, + "node_modules/@shikijs/themes": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-3.8.0.tgz", + "integrity": "sha512-yaZiLuyO23sXe16JFU76KyUMTZCJi4EMQKIrdQt7okoTzI4yAaJhVXT2Uy4k8yBIEFRiia5dtD7gC1t8m6y3oQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.8.0" + } + }, + "node_modules/@shikijs/types": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.8.0.tgz", + "integrity": "sha512-I/b/aNg0rP+kznVDo7s3UK8jMcqEGTtoPDdQ+JlQ2bcJIyu/e2iRvl42GLIDMK03/W1YOHOuhlhQ7aM+XbKUeg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" + } + }, + "node_modules/@shikijs/vscode-textmate": { + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.0.2.tgz", + "integrity": "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/chai": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.2.tgz", + "integrity": "sha512-8kB30R7Hwqf40JPiKhVzodJs2Qc1ZJ5zuT3uzw5Hq/dhNCl3G3l83jfpdI1e20BP348+fV7VIL/+FxaXkqBmWg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*" + } + }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@vitest/expect": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-3.2.4.tgz", + "integrity": "sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/chai": "^5.2.2", + "@vitest/spy": "3.2.4", + "@vitest/utils": "3.2.4", + "chai": "^5.2.0", + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/mocker": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-3.2.4.tgz", + "integrity": "sha512-46ryTE9RZO/rfDd7pEqFl7etuyzekzEhUbTW3BvmeO/BcCMEgq59BKhek3dXDWgAj4oMK6OZi+vRr1wPW6qjEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "3.2.4", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.17" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/pretty-format": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-3.2.4.tgz", + "integrity": "sha512-IVNZik8IVRJRTr9fxlitMKeJeXFFFN0JaB9PHPGQ8NKQbGpfjlTx9zO4RefN8gp7eqjNy8nyK3NZmBzOPeIxtA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-3.2.4.tgz", + "integrity": "sha512-oukfKT9Mk41LreEW09vt45f8wx7DordoWUZMYdY/cyAk7w5TWkTRCNZYF7sX7n2wB7jyGAl74OxgwhPgKaqDMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/utils": "3.2.4", + "pathe": "^2.0.3", + "strip-literal": "^3.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-3.2.4.tgz", + "integrity": "sha512-dEYtS7qQP2CjU27QBC5oUOxLE/v5eLkGqPE0ZKEIDGMs4vKWe7IjgLOeauHsR0D5YuuycGRO5oSRXnwnmA78fQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "3.2.4", + "magic-string": "^0.30.17", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-3.2.4.tgz", + "integrity": "sha512-vAfasCOe6AIK70iP5UD11Ac4siNUNJ9i/9PZ3NKx07sG6sUxeag1LWdNrMWeKKYBLlzuK+Gn65Yd5nyL6ds+nw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyspy": "^4.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-3.2.4.tgz", + "integrity": "sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "3.2.4", + "loupe": "^3.1.4", + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "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/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/chai": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/chai/-/chai-5.2.1.tgz", + "integrity": "sha512-5nFxhUrX0PqtyogoYOA8IPswy5sZFTOsBFl/9bNsmDLgsxYTzSZQJDPppDnZPTQbzSEm0hqGjWPzRemQCYbD6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "assertion-error": "^2.0.1", + "check-error": "^2.1.1", + "deep-eql": "^5.0.1", + "loupe": "^3.1.0", + "pathval": "^2.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/check-error": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz", + "integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 16" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-eql": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", + "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true, + "license": "MIT" + }, + "node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true, + "license": "MIT" + }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/es-module-lexer": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", + "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "dev": true, + "license": "MIT" + }, + "node_modules/esbuild": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.6.tgz", + "integrity": "sha512-GVuzuUwtdsghE3ocJ9Bs8PNoF13HNQ5TXbEi2AhvVb8xU1Iwt9Fos9FEamfoee+u/TOsn7GUWc04lz46n2bbTg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.6", + "@esbuild/android-arm": "0.25.6", + "@esbuild/android-arm64": "0.25.6", + "@esbuild/android-x64": "0.25.6", + "@esbuild/darwin-arm64": "0.25.6", + "@esbuild/darwin-x64": "0.25.6", + "@esbuild/freebsd-arm64": "0.25.6", + "@esbuild/freebsd-x64": "0.25.6", + "@esbuild/linux-arm": "0.25.6", + "@esbuild/linux-arm64": "0.25.6", + "@esbuild/linux-ia32": "0.25.6", + "@esbuild/linux-loong64": "0.25.6", + "@esbuild/linux-mips64el": "0.25.6", + "@esbuild/linux-ppc64": "0.25.6", + "@esbuild/linux-riscv64": "0.25.6", + "@esbuild/linux-s390x": "0.25.6", + "@esbuild/linux-x64": "0.25.6", + "@esbuild/netbsd-arm64": "0.25.6", + "@esbuild/netbsd-x64": "0.25.6", + "@esbuild/openbsd-arm64": "0.25.6", + "@esbuild/openbsd-x64": "0.25.6", + "@esbuild/openharmony-arm64": "0.25.6", + "@esbuild/sunos-x64": "0.25.6", + "@esbuild/win32-arm64": "0.25.6", + "@esbuild/win32-ia32": "0.25.6", + "@esbuild/win32-x64": "0.25.6" + } + }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/expect-type": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.2.2.tgz", + "integrity": "sha512-JhFGDVJ7tmDJItKhYgJCGLOWjuK9vPxiXoUFLwLDc99NlmklilbiQJwoctZtt13+xMw91MCk/REan6MWHqDjyA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/fdir": { + "version": "6.4.6", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.6.tgz", + "integrity": "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "dev": true, + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/glob": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.3.tgz", + "integrity": "sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA==", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.3.1", + "jackspeak": "^4.1.1", + "minimatch": "^10.0.3", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^2.0.0" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/jackspeak": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.1.1.tgz", + "integrity": "sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/js-tokens": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.1.tgz", + "integrity": "sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "uc.micro": "^2.0.0" + } + }, + "node_modules/loupe": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.1.4.tgz", + "integrity": "sha512-wJzkKwJrheKtknCOKNEtDK4iqg/MxmZheEMtSTYvnzRdEYaZzmgH976nenp8WdJRdx5Vc1X/9MO0Oszl6ezeXg==", + "dev": true, + "license": "MIT" + }, + "node_modules/lru-cache": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.1.0.tgz", + "integrity": "sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A==", + "dev": true, + "license": "ISC", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/lunr": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", + "dev": true, + "license": "MIT" + }, + "node_modules/magic-string": { + "version": "0.30.17", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", + "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, + "node_modules/markdown-it": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz", + "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1", + "entities": "^4.4.0", + "linkify-it": "^5.0.0", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.1.0" + }, + "bin": { + "markdown-it": "bin/markdown-it.mjs" + } + }, + "node_modules/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", + "dev": true, + "license": "MIT" + }, + "node_modules/minimatch": { + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.3.tgz", + "integrity": "sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw==", + "dev": true, + "license": "ISC", + "dependencies": { + "@isaacs/brace-expansion": "^5.0.0" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-scurry": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", + "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, + "node_modules/pathval": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.1.tgz", + "integrity": "sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.16" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/punycode.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/rimraf": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.0.1.tgz", + "integrity": "sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A==", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^11.0.0", + "package-json-from-dist": "^1.0.0" + }, + "bin": { + "rimraf": "dist/esm/bin.mjs" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rollup": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.45.1.tgz", + "integrity": "sha512-4iya7Jb76fVpQyLoiVpzUrsjQ12r3dM7fIVz+4NwoYvZOShknRmiv+iu9CClZml5ZLGb0XMcYLutK6w9tgxHDw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.8" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.45.1", + "@rollup/rollup-android-arm64": "4.45.1", + "@rollup/rollup-darwin-arm64": "4.45.1", + "@rollup/rollup-darwin-x64": "4.45.1", + "@rollup/rollup-freebsd-arm64": "4.45.1", + "@rollup/rollup-freebsd-x64": "4.45.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.45.1", + "@rollup/rollup-linux-arm-musleabihf": "4.45.1", + "@rollup/rollup-linux-arm64-gnu": "4.45.1", + "@rollup/rollup-linux-arm64-musl": "4.45.1", + "@rollup/rollup-linux-loongarch64-gnu": "4.45.1", + "@rollup/rollup-linux-powerpc64le-gnu": "4.45.1", + "@rollup/rollup-linux-riscv64-gnu": "4.45.1", + "@rollup/rollup-linux-riscv64-musl": "4.45.1", + "@rollup/rollup-linux-s390x-gnu": "4.45.1", + "@rollup/rollup-linux-x64-gnu": "4.45.1", + "@rollup/rollup-linux-x64-musl": "4.45.1", + "@rollup/rollup-win32-arm64-msvc": "4.45.1", + "@rollup/rollup-win32-ia32-msvc": "4.45.1", + "@rollup/rollup-win32-x64-msvc": "4.45.1", + "fsevents": "~2.3.2" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true, + "license": "ISC" + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true, + "license": "MIT" + }, + "node_modules/std-env": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.9.0.tgz", + "integrity": "sha512-UGvjygr6F6tpH7o2qyqR6QYpwraIjKSdtzyBdyytFOHmPZY917kwdwLG0RbOjWOnKmnm3PeHjaoLLMie7kPLQw==", + "dev": true, + "license": "MIT" + }, + "node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/string-width-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-literal": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-3.0.0.tgz", + "integrity": "sha512-TcccoMhJOM3OebGhSBEmp3UZ2SfDMZUEBdRA/9ynfLi8yYajyWX3JiXArcJt4Umh4vISpspkQIY8ZZoCqjbviA==", + "dev": true, + "license": "MIT", + "dependencies": { + "js-tokens": "^9.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", + "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyglobby": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz", + "integrity": "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.4.4", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinypool": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.1.1.tgz", + "integrity": "sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.0.0 || >=20.0.0" + } + }, + "node_modules/tinyrainbow": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-2.0.0.tgz", + "integrity": "sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tinyspy": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-4.0.3.tgz", + "integrity": "sha512-t2T/WLB2WRgZ9EpE4jgPJ9w+i66UZfDc8wHh0xrwiRNN+UwH98GIJkTeZqX9rg0i0ptwzqW+uYeIF0T4F8LR7A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/typedoc": { + "version": "0.28.7", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.28.7.tgz", + "integrity": "sha512-lpz0Oxl6aidFkmS90VQDQjk/Qf2iw0IUvFqirdONBdj7jPSN9mGXhy66BcGNDxx5ZMyKKiBVAREvPEzT6Uxipw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@gerrit0/mini-shiki": "^3.7.0", + "lunr": "^2.3.9", + "markdown-it": "^14.1.0", + "minimatch": "^9.0.5", + "yaml": "^2.8.0" + }, + "bin": { + "typedoc": "bin/typedoc" + }, + "engines": { + "node": ">= 18", + "pnpm": ">= 10" + }, + "peerDependencies": { + "typescript": "5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x || 5.7.x || 5.8.x" + } + }, + "node_modules/typedoc/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/typescript": { + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", + "dev": true, + "license": "MIT" + }, + "node_modules/vite": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.0.4.tgz", + "integrity": "sha512-SkaSguuS7nnmV7mfJ8l81JGBFV7Gvzp8IzgE8A8t23+AxuNX61Q5H1Tpz5efduSN7NHC8nQXD3sKQKZAu5mNEA==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.25.0", + "fdir": "^6.4.6", + "picomatch": "^4.0.2", + "postcss": "^8.5.6", + "rollup": "^4.40.0", + "tinyglobby": "^0.2.14" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "lightningcss": "^1.21.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vite-node": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-3.2.4.tgz", + "integrity": "sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.4.1", + "es-module-lexer": "^1.7.0", + "pathe": "^2.0.3", + "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/vitest": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-3.2.4.tgz", + "integrity": "sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/chai": "^5.2.2", + "@vitest/expect": "3.2.4", + "@vitest/mocker": "3.2.4", + "@vitest/pretty-format": "^3.2.4", + "@vitest/runner": "3.2.4", + "@vitest/snapshot": "3.2.4", + "@vitest/spy": "3.2.4", + "@vitest/utils": "3.2.4", + "chai": "^5.2.0", + "debug": "^4.4.1", + "expect-type": "^1.2.1", + "magic-string": "^0.30.17", + "pathe": "^2.0.3", + "picomatch": "^4.0.2", + "std-env": "^3.9.0", + "tinybench": "^2.9.0", + "tinyexec": "^0.3.2", + "tinyglobby": "^0.2.14", + "tinypool": "^1.1.1", + "tinyrainbow": "^2.0.0", + "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0", + "vite-node": "3.2.4", + "why-is-node-running": "^2.3.0" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@types/debug": "^4.1.12", + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "@vitest/browser": "3.2.4", + "@vitest/ui": "3.2.4", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@types/debug": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yaml": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.0.tgz", + "integrity": "sha512-4lLa/EcQCB0cJkyts+FpIRx5G/llPxfP6VQU5KByHEhLxY3IJCH0f0Hy1MHI8sClTvsIb8qwRJ6R/ZdlDJ/leQ==", + "dev": true, + "license": "ISC", + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14.6" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..704de1d4 --- /dev/null +++ b/package.json @@ -0,0 +1,45 @@ +{ + "name": "@rainlanguage/float", + "description": "Rainlanguage rust Float library in JS/TS through wasm bindgen", + "version": "0.0.0-alpha.0", + "license": "LicenseRef-DCL-1.0", + "author": "Rain Open Source Software Ltd", + "repository": { + "type": "git", + "url": "https://github.com/rainlanguage/rain.math.float.git" + }, + "keywords": [], + "bugs": { + "url": "https://github.com/rainlanguage/rain.math.float/issues" + }, + "homepage": "https://github.com/rainlanguage/rain.math.float#readme", + "main": "./dist/cjs/index.js", + "module": "./dist/esm/index.js", + "browser": { + "./dist/cjs/index.js": "./dist/cjs/index.js", + "./dist/esm/index.js": "./dist/esm/index.js" + }, + "engines": { + "node": ">=22" + }, + "files": [ + "./dist" + ], + "scripts": { + "prepublish": "node ./scripts/prepublish", + "build": "npm run rm-dist && npm run rm-temp && node ./scripts/build", + "build-wasm": "cargo build --target wasm32-unknown-unknown --lib -r --workspace", + "rm-dist": "rimraf ./dist", + "rm-temp": "rimraf ./temp", + "test": "npm run check && vitest run --dir test_js", + "check": "tsc ./dist/**/*.{ts,js} --noEmit --allowJs --lib ES2022" + }, + "devDependencies": { + "rimraf": "6.0.1", + "typedoc": "^0.28.7", + "vitest": "^3.1.4" + }, + "dependencies": { + "buffer": "6.0.3" + } +} diff --git a/scripts/build.js b/scripts/build.js new file mode 100644 index 00000000..e5024cc7 --- /dev/null +++ b/scripts/build.js @@ -0,0 +1,85 @@ +const fs = require("fs"); +const { execSync } = require("child_process"); + +// create dist dir +fs.mkdirSync("./dist/cjs", { recursive: true }); +fs.mkdirSync("./dist/esm", { recursive: true }); + +// build for wasm32 target +execSync("npm run build-wasm"); + +// generate node/web bindgens +execSync( + `wasm-bindgen --target nodejs ./target/wasm32-unknown-unknown/release/rain_math_float.wasm --out-dir ./temp/node --out-name float` +); +execSync( + `wasm-bindgen --target web ./target/wasm32-unknown-unknown/release/rain_math_float.wasm --out-dir ./temp/web --out-name float` +); + +// encode wasm as base64 into a json for cjs and esm that can be natively imported +// in js modules in order to avoid using fetch or fs operations +const wasmCjsBytes = fs.readFileSync(`./temp/node/float_bg.wasm`); +fs.writeFileSync( + `./dist/cjs/float_wbg.json`, + JSON.stringify({ + wasm: Buffer.from(wasmCjsBytes, "binary").toString("base64"), + }) +); +const wasmEsmBytes = fs.readFileSync(`./temp/web/float_bg.wasm`); +fs.writeFileSync( + `./dist/esm/float_wbg.json`, + JSON.stringify({ + wasm: Buffer.from(wasmEsmBytes, "binary").toString("base64"), + }) +); + +// prepare the dts +let dts = fs.readFileSync(`./temp/node/float.d.ts`, { + encoding: "utf-8", +}); +dts = dts.replace( + `/* tslint:disable */ +/* eslint-disable */`, + "" +); +dts = "/* this file is auto-generated, do not modify */\n" + dts; +fs.writeFileSync(`./dist/cjs/index.d.ts`, dts); +fs.writeFileSync(`./dist/esm/index.d.ts`, dts); + +// prepare cjs +let cjs = fs.readFileSync(`./temp/node/float.js`, { + encoding: "utf-8", +}); +cjs = cjs.replace( + `const path = require('path').join(__dirname, 'float_bg.wasm'); +const bytes = require('fs').readFileSync(path);`, + ` +const { Buffer } = require('buffer'); +const wasmB64 = require('./float_wbg.json'); +const bytes = Buffer.from(wasmB64.wasm, 'base64');` +); +cjs = cjs.replace("const { TextEncoder, TextDecoder } = require(`util`);", ""); +cjs = "/* this file is auto-generated, do not modify */\n" + cjs; +fs.writeFileSync(`./dist/cjs/index.js`, cjs); + +// prepare esm +let esm = fs.readFileSync(`./temp/web/float.js`, { + encoding: "utf-8", +}); +esm = esm.replace( + `export { initSync }; +export default __wbg_init;`, +`import { Buffer } from 'buffer'; +import wasmB64 from './float_wbg.json'; +const bytes = Buffer.from(wasmB64.wasm, 'base64'); +initSync(bytes);` +) +esm = "/* this file is auto-generated, do not modify */\n" + esm; +fs.writeFileSync(`./dist/esm/index.js`, esm); + + +// rm temp folder +execSync("npm run rm-temp"); + +// check bindings for possible errors +execSync("npm run check"); diff --git a/scripts/prepublish.js b/scripts/prepublish.js new file mode 100644 index 00000000..65b34741 --- /dev/null +++ b/scripts/prepublish.js @@ -0,0 +1,10 @@ +const fs = require("fs"); +const { execSync } = require("child_process"); + +// exit early if already built +// for npm install from an already built and packed package +if (fs.existsSync("./dist")) return; + +execSync("npm run rm-temp"); +execSync("npm run rm-dist"); +execSync("nix develop -c node scripts/build"); diff --git a/test_js/float.test.ts b/test_js/float.test.ts new file mode 100644 index 00000000..5a751947 --- /dev/null +++ b/test_js/float.test.ts @@ -0,0 +1,104 @@ +import { describe, it, expect, assert } from 'vitest'; + +describe('Test Float Bindings', () => { + describe('CJS', async () => { + await runTests('cjs'); + }); + + describe('ESM', async () => { + await runTests('esm'); + }); + + async function runTests(mod: 'cjs' | 'esm') { + // load the Float class from the appropriate module + const { Float } = await (mod === 'cjs' ? import('../dist/cjs') : import('../dist/esm')); + + it('should test parse', () => { + const float = Float.parse('3.14')?.value!; + expect(float.asHex()).toBe('0xfffffffe0000000000000000000000000000000000000000000000000000013a'); + }); + + it('should test format', () => { + const float = Float.fromHex('0xfffffffe0000000000000000000000000000000000000000000000000000013a')?.value!; + expect(float.format()?.value!).toBe('3.14'); + }); + + it('should test format18 and fromFixedDecimal', () => { + const float = Float.fromFixedDecimal('12345', 2)?.value!; + expect(float.format18()?.value!).toBe('123.45'); + }); + + it('should test packLossless', () => { + const float = Float.packLossless('314', -2)?.value!; + expect(float.format()?.value!).toBe('3.14'); + }); + + it('should try from bigint', () => { + const result = Float.tryFromBigint(5n); + assert.ok(result.error === undefined, `Expected no error, but got: ${result.error?.readableMsg}`); + + const expected = Float.fromHex('0x0000000000000000000000000000000000000000000000000000000000000005')?.value!; + expect(result.value.eq(expected)).toBeTruthy(); + }); + + it('should convert from bigint', () => { + const result = Float.fromBigint(18n); + const expected = Float.fromHex('0x0000000000000000000000000000000000000000000000000000000000000012')?.value!; + expect(result.eq(expected)).toBeTruthy(); + }); + + it('should try to bigint', () => { + const float = Float.fromHex('0x0000000000000000000000000000000000000000000000000000000000000008')?.value!; + const result = float.tryToBigint(); + assert.ok(result.error === undefined, `Expected no error, but got: ${result.error?.readableMsg}`); + + expect(result.value).toBe(8n); + }); + + it('should convert to bigint', () => { + const float = Float.fromHex('0x0000000000000000000000000000000000000000000000000000000000001234')?.value!; + const result = float.toBigint(); + + expect(result).toBe(BigInt('0x1234')); + }); + + it('should test logic ops', () => { + const a = Float.fromBigint(1n); + const b = Float.fromBigint(2n); + const c = Float.fromBigint(1n); + const zero = Float.fromBigint(0n); + const neg = Float.parse('-1')?.value!; + + expect(a.lt(b)?.value!).toBe(true); + expect(a.lte(b)?.value!).toBe(true); + expect(a.lte(c)?.value!).toBe(true); + + expect(b.gt(a)?.value!).toBe(true); + expect(b.gte(a)?.value!).toBe(true); + expect(c.gte(a)?.value!).toBe(true); + + expect(a.eq(c)?.value!).toBe(true); + expect(zero.isZero()?.value!).toBe(true); + expect(neg.neg()?.value!.eq(a)?.value!).toBe(true); + + expect(a.max(b)?.value!.eq(b)?.value!).toBe(true); + expect(a.min(b)?.value!.eq(a)?.value!).toBe(true); + }); + + it('should test math ops', () => { + const a = Float.parse('3.14')?.value!; + const b = Float.parse('-3.14')?.value!; + const c = Float.parse('2.0')?.value!; + + expect(a.floor()?.value!.format()?.value!).toBe('3'); + expect(a.frac()?.value!.format()?.value!).toBe('0.14'); + expect(c.inv()?.value!.format()?.value!).toBe('0.5'); + expect(b.abs()?.value!.format()?.value!).toBe('3.14'); + expect(a.sub(b)?.value!.format()?.value!).toBe('6.28'); + expect(a.mul(c)?.value!.format()?.value!).toBe('6.28'); + expect(a.div(c)?.value!.format()?.value!).toBe('1.57'); + expect(a.div(b)?.value!.format()?.value!).toBe('-1'); + expect(a.add(b)?.value!.format()?.value!).toBe('0'); + }); + } +}); diff --git a/test_js/tsconfig.json b/test_js/tsconfig.json new file mode 100644 index 00000000..680a52d9 --- /dev/null +++ b/test_js/tsconfig.json @@ -0,0 +1,19 @@ +{ + "include": ["./**/*.ts"], + "exclude": ["node_modules"], + "compilerOptions": { + "target": "ES2022", + "lib": ["ES2022"], + "esModuleInterop": true, + "moduleResolution": "node", + "resolveJsonModule": true, + "noUnusedLocals": true, + "strict": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "skipLibCheck": true, + "allowJs": true, + "outDir": "./dist", + "module": "ES2022" + } +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..0739e74a --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ES2022", + "moduleResolution": "node", + "lib": ["ES2022"], + "declaration": true, + "outDir": "./dist", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "allowSyntheticDefaultImports": true, + "resolveJsonModule": true + }, + "include": [ + "./dist/**/*.d.ts" + ], + "exclude": [ + "node_modules", + "test_js" + ] +}