diff --git a/.cargo/config b/.cargo/config new file mode 100644 index 000000000..5aa69189f --- /dev/null +++ b/.cargo/config @@ -0,0 +1,2 @@ +[env] +__TAURI_WORKSPACE__ = "true" diff --git a/.changes/add-dylib-support-to-macos-frameworks.md b/.changes/add-dylib-support-to-macos-frameworks.md new file mode 100644 index 000000000..1017a65d7 --- /dev/null +++ b/.changes/add-dylib-support-to-macos-frameworks.md @@ -0,0 +1,5 @@ +--- +"tauri-bundler": patch +--- + +Add dylib support to `tauri.bundle.macOS.frameworks`. \ No newline at end of file diff --git a/.changes/additional-args-api.md b/.changes/additional-args-api.md new file mode 100644 index 000000000..e5a257daf --- /dev/null +++ b/.changes/additional-args-api.md @@ -0,0 +1,5 @@ +--- +"api": minor +--- + +Added the `additionalBrowserArgs` option when creating a window. diff --git a/.changes/additional-args-config.md b/.changes/additional-args-config.md new file mode 100644 index 000000000..bdb497ee3 --- /dev/null +++ b/.changes/additional-args-config.md @@ -0,0 +1,5 @@ +--- +"tauri-utils": minor +--- + +Added the `additional_browser_args` option to the window configuration. diff --git a/.changes/additional-args.md b/.changes/additional-args.md new file mode 100644 index 000000000..a9cc187ad --- /dev/null +++ b/.changes/additional-args.md @@ -0,0 +1,7 @@ +--- +"tauri": minor +"tauri-runtime-wry": minor +"tauri-runtime": minor +--- + +Added the `additional_browser_args` option when creating a window. diff --git a/.changes/bundler-msi-mini-version.md b/.changes/bundler-msi-mini-version.md new file mode 100644 index 000000000..b71568dd8 --- /dev/null +++ b/.changes/bundler-msi-mini-version.md @@ -0,0 +1,5 @@ +--- +'tauri-bundler': 'minor' +--- + +Added support for pre-release identifiers and build numbers for the `.msi` bundle target. Only one of each can be used and it must be numeric only. The version must still be semver compatible according to https://semver.org/. diff --git a/.changes/cli-info.md b/.changes/cli-info.md new file mode 100644 index 000000000..e35cd9007 --- /dev/null +++ b/.changes/cli-info.md @@ -0,0 +1,6 @@ +--- +"cli.rs": "patch" +--- + +Fix `tauri info` panicking when parsing crates version on a newly created project without a `Cargo.lock` file. + diff --git a/.changes/cli-rustc-not-found-msg.md b/.changes/cli-rustc-not-found-msg.md new file mode 100644 index 000000000..719f49946 --- /dev/null +++ b/.changes/cli-rustc-not-found-msg.md @@ -0,0 +1,5 @@ +--- +"cli.rs": "patch" +--- + +Improve the error message when `rustc` couldn't be found. diff --git a/.changes/cli-sign-non-interactive.md b/.changes/cli-sign-non-interactive.md new file mode 100644 index 000000000..473dad10c --- /dev/null +++ b/.changes/cli-sign-non-interactive.md @@ -0,0 +1,6 @@ +--- +"cli.rs": patch +"cli.js": patch +--- + +Add `--ci` flag and respect the `CI` environment variable on the `signer generate` command. In this case the default password will be an empty string and the CLI will not prompt for a value. diff --git a/.changes/cli-windows-paths-print.md b/.changes/cli-windows-paths-print.md new file mode 100644 index 000000000..774040c19 --- /dev/null +++ b/.changes/cli-windows-paths-print.md @@ -0,0 +1,7 @@ +--- +"cli.rs": "patch" +"tauri-bundler": "patch" +--- + +On Windows, printing consistent paths on Windows with backslashs only. + diff --git a/.changes/content-protection-api.md b/.changes/content-protection-api.md new file mode 100644 index 000000000..b82d184b1 --- /dev/null +++ b/.changes/content-protection-api.md @@ -0,0 +1,5 @@ +--- +"api": "minor" +--- + +Added the `WindowOptions::contentProtected` option and `WebviewWindow#setContentProtected` to change it at runtime. diff --git a/.changes/content-protection-utils.md b/.changes/content-protection-utils.md new file mode 100644 index 000000000..591a40081 --- /dev/null +++ b/.changes/content-protection-utils.md @@ -0,0 +1,5 @@ +--- +"tauri-utils": "patch" +--- + +Added the `content_protected` option to the window configuration. diff --git a/.changes/content-protection.md b/.changes/content-protection.md new file mode 100644 index 000000000..489104058 --- /dev/null +++ b/.changes/content-protection.md @@ -0,0 +1,7 @@ +--- +"tauri": "minor" +"tauri-runtime": "minor" +"tauri-runtime-wry": "minor" +--- + +Added the `content_protected` option when creating a window and `Window::set_content_protected` to change it at runtime. diff --git a/.changes/core-js-Map.md b/.changes/core-js-Map.md new file mode 100644 index 000000000..8b0233849 --- /dev/null +++ b/.changes/core-js-Map.md @@ -0,0 +1,5 @@ +--- +"tauri": "patch" +--- + +Fix serialization of js `Map` when used in `invoke`. diff --git a/.changes/core-navigation-handler.md b/.changes/core-navigation-handler.md new file mode 100644 index 000000000..ac48a4a14 --- /dev/null +++ b/.changes/core-navigation-handler.md @@ -0,0 +1,5 @@ +--- +"tauri": minor +--- + +Added `Window::on_navigation`. diff --git a/.changes/core-sync-windows-metadata.md b/.changes/core-sync-windows-metadata.md new file mode 100644 index 000000000..3c735ecc5 --- /dev/null +++ b/.changes/core-sync-windows-metadata.md @@ -0,0 +1,5 @@ +--- +"tauri": "patch" +--- + +Sync `__TAURI_METADATA__.__windows` across all windows. diff --git a/.changes/custom-buttons-api.md b/.changes/custom-buttons-api.md new file mode 100644 index 000000000..15c9058ac --- /dev/null +++ b/.changes/custom-buttons-api.md @@ -0,0 +1,5 @@ +--- +"api": minor +--- + +Allow setting the text of the dialog buttons. diff --git a/.changes/custom-buttons.md b/.changes/custom-buttons.md new file mode 100644 index 000000000..81b4dfd3e --- /dev/null +++ b/.changes/custom-buttons.md @@ -0,0 +1,5 @@ +--- +"tauri": minor +--- + +Added `OkWithLabel` and `OkCancelWithLabels` variants to the `api::dialog::MessageDialogButtons` enum to set the text of the dialog buttons. diff --git a/.changes/custom-icon.md b/.changes/custom-icon.md new file mode 100644 index 000000000..b41a58565 --- /dev/null +++ b/.changes/custom-icon.md @@ -0,0 +1,6 @@ +--- +"cli.rs": minor +"cli.js": minor +--- + +Add `--png` option for the `icon` command to generate custom icon sizes. diff --git a/.changes/empty-tauri-key-password.md b/.changes/empty-tauri-key-password.md new file mode 100644 index 000000000..14b8d8da1 --- /dev/null +++ b/.changes/empty-tauri-key-password.md @@ -0,0 +1,6 @@ +--- +"cli.rs": patch +"cli.js": patch +--- + +Skip the password prompt on the build command when `TAURI_KEY_PASSWORD` environment variable is empty and the `--ci` argument is provided or the `CI` environment variable is set. diff --git a/.changes/expose-set_device_event_filter-in-tauri-api.md b/.changes/expose-set_device_event_filter-in-tauri-api.md new file mode 100644 index 000000000..cf1993c02 --- /dev/null +++ b/.changes/expose-set_device_event_filter-in-tauri-api.md @@ -0,0 +1,7 @@ +--- +"tauri-runtime-wry": minor +"tauri-runtime": minor +"tauri": minor +--- + +Added `Builder::device_event_filter` and `App::set_device_event_filter` methods. diff --git a/.changes/fix-2549.md b/.changes/fix-2549.md new file mode 100644 index 000000000..35b782a94 --- /dev/null +++ b/.changes/fix-2549.md @@ -0,0 +1,5 @@ +--- +"tauri": "patch" +--- + +Fix resize glitch when double clicking a custom titlebar in the top resize area. diff --git a/.changes/fix-dev-server-html-serialization.md b/.changes/fix-dev-server-html-serialization.md new file mode 100644 index 000000000..7427b8591 --- /dev/null +++ b/.changes/fix-dev-server-html-serialization.md @@ -0,0 +1,6 @@ +--- +"cli.rs": patch +"cli.js": patch +--- + +Fixes HTML serialization removing template tags on the dev server. diff --git a/.changes/heck-unicode.md b/.changes/heck-unicode.md new file mode 100644 index 000000000..f0a0e4a26 --- /dev/null +++ b/.changes/heck-unicode.md @@ -0,0 +1,5 @@ +--- +"cli.rs": "patch" +--- + +Fix building apps with unicode characters in their `productName`. diff --git a/.changes/is-minimized.md b/.changes/is-minimized.md new file mode 100644 index 000000000..106e0906d --- /dev/null +++ b/.changes/is-minimized.md @@ -0,0 +1,8 @@ +--- +"tauri": minor +"tauri-runtime": minor +"tauri-runtime-wry": minor +"api": minor +--- + +Add `is_minimized()` window method. diff --git a/.changes/linux-mouse.md b/.changes/linux-mouse.md new file mode 100644 index 000000000..d1713a326 --- /dev/null +++ b/.changes/linux-mouse.md @@ -0,0 +1,5 @@ +--- +"tauri-runtime-wry": patch +--- + +Disable cursor mouse events on Linux. diff --git a/.changes/nsis-linux.md b/.changes/nsis-linux.md new file mode 100644 index 000000000..558b43959 --- /dev/null +++ b/.changes/nsis-linux.md @@ -0,0 +1,9 @@ +--- +"tauri-bundler": minor +"tauri-utils": minor +"cli.rs": minor +"cli.js": minor +"tauri-build": minor +--- + +Add initial support for building `nsis` bundles on non-Windows platforms. diff --git a/.changes/nsis.md b/.changes/nsis.md new file mode 100644 index 000000000..2a196dd74 --- /dev/null +++ b/.changes/nsis.md @@ -0,0 +1,8 @@ +--- +"tauri-bundler": minor +"tauri-utils": minor +"cli.rs": minor +"cli.js": minor +--- + +Add `nsis` bundle target diff --git a/.changes/open-links-mail-tel.md b/.changes/open-links-mail-tel.md new file mode 100644 index 000000000..1a925aa6a --- /dev/null +++ b/.changes/open-links-mail-tel.md @@ -0,0 +1,5 @@ +--- +"tauri": minor +--- + +Added support to `mailto:` and `tel:` links on the shell API. diff --git a/.changes/pin-os-info.md b/.changes/pin-os-info.md new file mode 100644 index 000000000..f9b2d75c8 --- /dev/null +++ b/.changes/pin-os-info.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +Pin `os_info` to `=3.5`. diff --git a/.changes/runtime-navigation-handler.md b/.changes/runtime-navigation-handler.md new file mode 100644 index 000000000..640eb406d --- /dev/null +++ b/.changes/runtime-navigation-handler.md @@ -0,0 +1,5 @@ +--- +"tauri-runtime": minor +--- + +Added `navigation_handler` field on `PendingWindow`. diff --git a/.changes/tauri-build-windows-manifest.md b/.changes/tauri-build-windows-manifest.md new file mode 100644 index 000000000..29605ee56 --- /dev/null +++ b/.changes/tauri-build-windows-manifest.md @@ -0,0 +1,5 @@ +--- +"tauri-build": "minor" +--- + +Add `WindowsAttributes::app_manifest` to specify the application manifest on Windows. diff --git a/.changes/template-default-features.md b/.changes/template-default-features.md new file mode 100644 index 000000000..4cdd17419 --- /dev/null +++ b/.changes/template-default-features.md @@ -0,0 +1,6 @@ +--- +'cli.rs': minor +'cli.js': minor +--- + +Remove default features from Cargo.toml template. diff --git a/.changes/title-getter.md b/.changes/title-getter.md new file mode 100644 index 000000000..d24da5817 --- /dev/null +++ b/.changes/title-getter.md @@ -0,0 +1,8 @@ +--- +"tauri": "minor" +"api": "minor" +"tauri-runtime": "minor" +"tauri-runtime-wry": "minor" +--- + +Add `title` getter on window. diff --git a/.changes/tray-tooltip-runtime.md b/.changes/tray-tooltip-runtime.md new file mode 100644 index 000000000..1c7a07a51 --- /dev/null +++ b/.changes/tray-tooltip-runtime.md @@ -0,0 +1,6 @@ +--- +"tauri-runtime": minor +"tauri-runtime-wry": minor +--- + +Added `TrayHandle::set_tooltip` and `SystemTray::with_tooltip`. diff --git a/.changes/tray-tooltip.md b/.changes/tray-tooltip.md new file mode 100644 index 000000000..f088c7aac --- /dev/null +++ b/.changes/tray-tooltip.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +Implement `SystemTray::with_tooltip` and `SystemTrayHandle::set_tooltip` for Windows and macOS. diff --git a/.changes/url-getter.md b/.changes/url-getter.md new file mode 100644 index 000000000..b40863fef --- /dev/null +++ b/.changes/url-getter.md @@ -0,0 +1,7 @@ +--- +"tauri-runtime": minor +"tauri-runtime-wry": minor +"tauri": minor +--- + +Added window's `url()` getter. diff --git a/.changes/version-inheritance.md b/.changes/version-inheritance.md new file mode 100644 index 000000000..324433005 --- /dev/null +++ b/.changes/version-inheritance.md @@ -0,0 +1,6 @@ +--- +'cli.rs': 'minor' +'tauri-build': 'minor' +--- + +Added support for Cargo's workspace inheritance for package information. The cli now also detects inherited `tauri` and `tauri-build` dependencies and disables manifest rewrites accordingly. diff --git a/.changes/webview-theme.md b/.changes/webview-theme.md new file mode 100644 index 000000000..38e58bca9 --- /dev/null +++ b/.changes/webview-theme.md @@ -0,0 +1,7 @@ +--- +"tauri": "patch" +"tauri-runtime": "patch" +"tauri-runtime-wry": "patch" +--- + +On Windows, change webview theme based on Window theme for more accurate `prefers-color-scheme` support. diff --git a/.changes/window-from-config.md b/.changes/window-from-config.md new file mode 100644 index 000000000..c485c3e40 --- /dev/null +++ b/.changes/window-from-config.md @@ -0,0 +1,5 @@ +--- +'tauri': 'minor' +--- + +Add a method to the `WindowBuilder` struct to recreate windows from tauri.conf.json configurations. diff --git a/.changes/wix-launch-app-checked.md b/.changes/wix-launch-app-checked.md new file mode 100644 index 000000000..073e4c3ec --- /dev/null +++ b/.changes/wix-launch-app-checked.md @@ -0,0 +1,6 @@ +--- +"tauri-bundler": "patch" +--- + +On Windows, the `msi` installer's `Launch App` checkbox will be checked by default. + diff --git a/.changes/wry-navigation-handler.md b/.changes/wry-navigation-handler.md new file mode 100644 index 000000000..6ac20e528 --- /dev/null +++ b/.changes/wry-navigation-handler.md @@ -0,0 +1,5 @@ +--- +"tauri-runtime-wry": minor +--- + +Implement the webview navigation handler. diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 0c0d6c42e..de0cc5024 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,6 +1,6 @@ # These are supported funding model platforms -github: nothingismagick +github: tauri-apps patreon: # open_collective: tauri ko_fi: # Replace with a single Ko-fi username diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 8a489e659..45eaf14cc 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -10,6 +10,7 @@ on: env: RUST_BACKTRACE: 1 CARGO_PROFILE_DEV_DEBUG: 0 # This would add unnecessary bloat to the target folder, decreasing cache efficiency. + LC_ALL: en_US.UTF-8 # This prevents strace from changing it's number format to use commas. concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -22,7 +23,7 @@ jobs: matrix: rust: [nightly] platform: - - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest } + - { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04 } runs-on: ${{ matrix.platform.os }} diff --git a/.github/workflows/check-generated-files.yml b/.github/workflows/check-generated-files.yml index 9f7e49ef1..156f19f52 100644 --- a/.github/workflows/check-generated-files.yml +++ b/.github/workflows/check-generated-files.yml @@ -5,6 +5,14 @@ name: Check generated files on: + pull_request: + paths: + - '.github/workflows/check-generated-files.yml' + - 'tooling/api/src/**' + - 'core/tauri/scripts/bundle.global.js' + - 'core/tauri-utils/src/config.rs' + - 'tooling/cli/schema.json' + - 'core/config-schema/schema.json' push: paths: - '.github/workflows/check-generated-files.yml' diff --git a/.github/workflows/publish-cli-rs.yml b/.github/workflows/publish-cli-rs.yml index d4f17f883..3a17c872e 100644 --- a/.github/workflows/publish-cli-rs.yml +++ b/.github/workflows/publish-cli-rs.yml @@ -8,40 +8,45 @@ on: jobs: build: - runs-on: ${{ matrix.target.platform }} + runs-on: ${{ matrix.config.os }} strategy: fail-fast: false matrix: - target: - - { - name: 'x86_64-unknown-linux-gnu', - platform: 'ubuntu-18.04', - ext: '' - } - - { name: 'x86_64-apple-darwin', platform: 'macos-latest', ext: '' } - - { - name: 'x86_64-pc-windows-msvc', - platform: 'windows-latest', - ext: '.exe' - } + config: + - os: ubuntu-18.04 + rust_target: x86_64-unknown-linux-gnu + ext: '' + - os: macos-latest + rust_target: x86_64-apple-darwin + ext: '' + - os: macos-latest + rust_target: aarch64-apple-darwin + ext: '' + - os: windows-latest + rust_target: x86_64-pc-windows-msvc + ext: '.exe' steps: - name: Checkout uses: actions/checkout@v3 - - name: install stable - uses: actions-rs/toolchain@v1 + - name: 'Setup Rust' + uses: dtolnay/rust-toolchain@stable with: - toolchain: stable + targets: ${{ matrix.config.rust_target }} + + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.config.rust_target }} - name: install Linux dependencies - if: matrix.target.platform == 'ubuntu-latest' + if: matrix.config.os == 'ubuntu-latest' run: | sudo apt-get update sudo apt-get install -y libgtk-3-dev - - name: build CLI + - name: Build CLI uses: actions-rs/cargo@v1 with: command: build @@ -50,8 +55,8 @@ jobs: - name: Upload CLI uses: actions/upload-artifact@v3 with: - name: cargo-tauri-${{ matrix.target.name }}${{ matrix.target.ext }} - path: tooling/cli/target/release/cargo-tauri${{ matrix.target.ext }} + name: cargo-tauri-${{ matrix.config.rust_target }}${{ matrix.config.ext }} + path: tooling/cli/target/release/cargo-tauri${{ matrix.config.ext }} if-no-files-found: error upload: diff --git a/.scripts/update-lockfiles.sh b/.scripts/update-lockfiles.sh index 666c3a5e1..67490bfc4 100755 --- a/.scripts/update-lockfiles.sh +++ b/.scripts/update-lockfiles.sh @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: MIT -declare -a examples=("api" "sidecar" "updater" "resources" "tauri-dynamic-lib") +declare -a examples=("api" "sidecar" "updater" "resources" "tauri-dynamic-lib" "workspace") declare -a tooling=("bench" "cli" "webdriver") for example in "${examples[@]}" diff --git a/Cargo.toml b/Cargo.toml index 68a0dd214..cd6783a04 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,8 @@ exclude = [ "examples/updater/src-tauri", "examples/resources/src-tauri", "examples/sidecar/src-tauri", - "examples/web/core" + "examples/web/core", + "examples/workspace" ] # default to small, optimized workspace release binaries diff --git a/SECURITY.md b/SECURITY.md index cbd06ded3..0b30bfd89 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -13,7 +13,16 @@ If you have found a potential security threat, vulnerability or exploit in Tauri or one of its upstream dependencies, please DON’T create a pull-request, DON’T file an issue on GitHub, DON’T mention it on Discord and DON’T create a forum thread. -We will be adding contact information to this page very soon. +Please submit your report via the GitHub Private Vulnerability Disclosure functionality. + +Find out more about the reporting process [here](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability). + +Our team will triage your report and keep you informed about the progress. +We may ask questions or request further guidance on reproduction of the vulnerability in the comments of the advisory, which will be publicized. + +Additionally, we may ask you to independently verify our patch, which will be available in the private advisory branch. Please do not publish your vulnerability during the process or before coordinated public disclosure from our side. We try to adhere to common standards of publication within 90-Days of disclosure. + +Depending on your decision to accept or deny credit for the vulnerability, you will be publicly attributed to the vulnerability and may be mentioned in our announcements. At the current time we do not have the financial ability to reward bounties, but in extreme cases will at our discretion consider a reward. diff --git a/core/config-schema/schema.json b/core/config-schema/schema.json index f9bdc4030..8a9886987 100644 --- a/core/config-schema/schema.json +++ b/core/config-schema/schema.json @@ -105,6 +105,7 @@ "print": false, "requestUserAttention": false, "setAlwaysOnTop": false, + "setContentProtected": false, "setCursorGrab": false, "setCursorIcon": false, "setCursorPosition": false, @@ -147,6 +148,7 @@ "allowDowngrades": true, "certificateThumbprint": null, "digestAlgorithm": null, + "nsis": null, "timestampUrl": null, "tsp": false, "webviewFixedRuntimePath": null, @@ -170,7 +172,8 @@ "dialog": true, "pubkey": "", "windows": { - "installMode": "passive" + "installMode": "passive", + "installerArgs": [] } }, "windows": [] @@ -284,6 +287,7 @@ "allowDowngrades": true, "certificateThumbprint": null, "digestAlgorithm": null, + "nsis": null, "timestampUrl": null, "tsp": false, "webviewFixedRuntimePath": null, @@ -381,6 +385,7 @@ "print": false, "requestUserAttention": false, "setAlwaysOnTop": false, + "setContentProtected": false, "setCursorGrab": false, "setCursorIcon": false, "setCursorPosition": false, @@ -429,7 +434,8 @@ "dialog": true, "pubkey": "", "windows": { - "installMode": "passive" + "installMode": "passive", + "installerArgs": [] } }, "allOf": [ @@ -645,6 +651,11 @@ "default": false, "type": "boolean" }, + "contentProtected": { + "description": "Prevents the window contents from being captured by other apps.", + "default": false, + "type": "boolean" + }, "skipTaskbar": { "description": "If `true`, hides the window icon from the taskbar on Windows and Linux.", "default": false, @@ -687,6 +698,13 @@ "null" ] }, + "additionalBrowserArgs": { + "description": "Defines additional browser arguments on Windows. By default wry passes `--disable-features=msWebOOUI,msPdfOOUI,msSmartScreenProtection` so if you use this method, you also need to disable these components by yourself if you want.", + "type": [ + "string", + "null" + ] + }, "shadow": { "description": "Whether or not the window has shadow.\n\n## Platform-specific\n\n- **Windows:** - `false` has no effect on decorated window, shadow are always ON. - `true` will make ndecorated window have a 1px white border, and on Windows 11, it will have a rounded corners. - **Linux:** Unsupported.", "default": false, @@ -1013,7 +1031,7 @@ "type": "boolean" }, "targets": { - "description": "The bundle targets, currently supports [\"deb\", \"appimage\", \"msi\", \"app\", \"dmg\", \"updater\"] or \"all\".", + "description": "The bundle targets, currently supports [\"deb\", \"appimage\", \"nsis\", \"msi\", \"app\", \"dmg\", \"updater\"] or \"all\".", "default": "all", "allOf": [ { @@ -1127,6 +1145,7 @@ "allowDowngrades": true, "certificateThumbprint": null, "digestAlgorithm": null, + "nsis": null, "timestampUrl": null, "tsp": false, "webviewFixedRuntimePath": null, @@ -1204,6 +1223,13 @@ "msi" ] }, + { + "description": "The NSIS bundle (.exe).", + "type": "string", + "enum": [ + "nsis" + ] + }, { "description": "The macOS application bundle (.app).", "type": "string", @@ -1388,6 +1414,17 @@ "type": "null" } ] + }, + "nsis": { + "description": "Configuration for the installer generated with NSIS.", + "anyOf": [ + { + "$ref": "#/definitions/NsisConfig" + }, + { + "type": "null" + } + ] } }, "additionalProperties": false @@ -1636,6 +1673,91 @@ }, "additionalProperties": false }, + "NsisConfig": { + "description": "Configuration for the Installer bundle using NSIS.", + "type": "object", + "properties": { + "license": { + "description": "The path to the license file to render on the installer.", + "type": [ + "string", + "null" + ] + }, + "headerImage": { + "description": "The path to a bitmap file to display on the header of installers pages.\n\nThe recommended dimensions are 150px x 57px.", + "type": [ + "string", + "null" + ] + }, + "sidebarImage": { + "description": "The path to a bitmap file for the Welcome page and the Finish page.\n\nThe recommended dimensions are 164px x 314px.", + "type": [ + "string", + "null" + ] + }, + "installerIcon": { + "description": "The path to an icon file used as the installer icon.", + "type": [ + "string", + "null" + ] + }, + "installMode": { + "description": "Whether the installation will be for all users or just the current user.", + "default": "currentUser", + "allOf": [ + { + "$ref": "#/definitions/NSISInstallerMode" + } + ] + }, + "languages": { + "description": "A list of installer languages. By default the OS language is used. If the OS language is not in the list of languages, the first language will be used. To allow the user to select the language, set `display_language_selector` to `true`.\n\nSee for the complete list of languages.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "displayLanguageSelector": { + "description": "Whether to display a language selector dialog before the installer and uninstaller windows are rendered or not. By default the OS language is selected, with a fallback to the first language in the `languages` array.", + "default": false, + "type": "boolean" + } + }, + "additionalProperties": false + }, + "NSISInstallerMode": { + "description": "Install Modes for the NSIS installer.", + "oneOf": [ + { + "description": "Default mode for the installer.\n\nInstall the app by default in a directory that doesn't require Administrator access.\n\nInstaller metadata will be saved under the `HKCU` registry path.", + "type": "string", + "enum": [ + "currentUser" + ] + }, + { + "description": "Install the app by default in the `Program Files` folder directory requires Administrator access for the installation.\n\nInstaller metadata will be saved under the `HKLM` registry path.", + "type": "string", + "enum": [ + "perMachine" + ] + }, + { + "description": "Combines both modes and allows the user to choose at install time whether to install for the current user or per machine. Note that this mode will require Administrator access even if the user wants to install it for the current user only.\n\nInstaller metadata will be saved under the `HKLM` or `HKCU` registry path based on the user's choice.", + "type": "string", + "enum": [ + "both" + ] + } + ] + }, "IosConfig": { "description": "General configuration for the iOS target.", "type": "object", @@ -1651,7 +1773,7 @@ "additionalProperties": false }, "AllowlistConfig": { - "description": "Allowlist configuration.", + "description": "Allowlist configuration. The allowlist is a translation of the [Cargo allowlist features](https://docs.rs/tauri/latest/tauri/#cargo-allowlist-features).\n\n# Notes\n\n- Endpoints that don't have their own allowlist option are enabled by default. - There is only \"opt-in\", no \"opt-out\". Setting an option to `false` has no effect.\n\n# Examples\n\n- * [`\"app-all\": true`](https://tauri.app/v1/api/config/#appallowlistconfig.all) will make the [hide](https://tauri.app/v1/api/js/app#hide) endpoint be available regardless of whether `hide` is set to `false` or `true` in the allowlist.", "type": "object", "properties": { "all": { @@ -1693,6 +1815,7 @@ "print": false, "requestUserAttention": false, "setAlwaysOnTop": false, + "setContentProtected": false, "setCursorGrab": false, "setCursorIcon": false, "setCursorPosition": false, @@ -2049,6 +2172,11 @@ "default": false, "type": "boolean" }, + "setContentProtected": { + "description": "Allows preventing the window contents from being captured by other apps.", + "default": false, + "type": "boolean" + }, "setSize": { "description": "Allows setting the window size.", "default": false, @@ -2249,7 +2377,7 @@ "description": "Defines the `shell > open` api scope.", "anyOf": [ { - "description": "If the shell open API should be enabled.\n\nIf enabled, the default validation regex (`^https?://`) is used.", + "description": "If the shell open API should be enabled.\n\nIf enabled, the default validation regex (`^((mailto:\\w+)|(tel:\\w+)|(https?://\\w+)).+`) is used.", "type": "boolean" }, { @@ -2597,7 +2725,8 @@ "windows": { "description": "The Windows configuration for the updater.", "default": { - "installMode": "passive" + "installMode": "passive", + "installerArgs": [] }, "allOf": [ { @@ -2617,6 +2746,14 @@ "description": "The updater configuration for Windows.", "type": "object", "properties": { + "installerArgs": { + "description": "Additional arguments given to the NSIS or WiX installer.", + "default": [], + "type": "array", + "items": { + "type": "string" + } + }, "installMode": { "description": "The installation mode for the update on Windows. Defaults to `passive`.", "default": "passive", @@ -2640,7 +2777,7 @@ ] }, { - "description": "The quiet mode means there's no user interaction required. Requires admin privileges if the installer does.", + "description": "The quiet mode means there's no user interaction required. Requires admin privileges if the installer does (WiX).", "type": "string", "enum": [ "quiet" diff --git a/core/tauri-build/Cargo.toml b/core/tauri-build/Cargo.toml index 3f5d14793..04ad1b58e 100644 --- a/core/tauri-build/Cargo.toml +++ b/core/tauri-build/Cargo.toml @@ -21,20 +21,20 @@ anyhow = "1" quote = { version = "1", optional = true } tauri-codegen = { version = "2.0.0-alpha.1", path = "../tauri-codegen", optional = true } tauri-utils = { version = "2.0.0-alpha.1", path = "../tauri-utils", features = [ "build", "resources" ] } -cargo_toml = "0.13" +cargo_toml = "0.14" +serde = "1" serde_json = "1" heck = "0.4" -json-patch = "0.2" +json-patch = "0.3" walkdir = "2" filetime = "0.2" +# dependencies for Windows targets +tauri-winres = "0.1" +semver = "1" [target."cfg(target_os = \"macos\")".dependencies] swift-rs = { git = "https://github.com/Brendonovich/swift-rs", rev = "eb6de914ad57501da5019154d476d45660559999", features = ["build"] } -[target."cfg(windows)".dependencies] -winres = "0.1" -semver = "1" - [features] codegen = [ "tauri-codegen", "quote" ] isolation = [ "tauri-codegen/isolation", "tauri-utils/isolation" ] diff --git a/core/tauri-build/src/lib.rs b/core/tauri-build/src/lib.rs index 964929c08..1d6dc526d 100644 --- a/core/tauri-build/src/lib.rs +++ b/core/tauri-build/src/lib.rs @@ -5,9 +5,13 @@ #![cfg_attr(doc_cfg, feature(doc_cfg))] pub use anyhow::Result; +use cargo_toml::{Dependency, Manifest}; use heck::AsShoutySnakeCase; -use tauri_utils::resources::{external_binaries, resource_relpath, ResourcePaths}; +use tauri_utils::{ + config::Config, + resources::{external_binaries, resource_relpath, ResourcePaths}, +}; use std::path::{Path, PathBuf}; @@ -15,7 +19,6 @@ use std::path::{Path, PathBuf}; mod codegen; /// Mobile build functions. pub mod mobile; -#[cfg(windows)] mod static_vcruntime; #[cfg(feature = "codegen")] @@ -112,6 +115,15 @@ pub struct WindowsAttributes { /// /// If it is left unset, it will look up a path in the registry, i.e. HKLM\SOFTWARE\Microsoft\Windows Kits\Installed Roots sdk_dir: Option, + /// A string containing an [application manifest] to be included with the application on Windows. + /// + /// Defaults to: + /// ```ignore + #[doc = include_str!("window-app-manifest.xml")] + /// ``` + /// + /// [application manifest]: https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests + app_manifest: Option, } impl WindowsAttributes { @@ -137,6 +149,45 @@ impl WindowsAttributes { self.sdk_dir = Some(sdk_dir.as_ref().into()); self } + + /// Sets the Windows app [manifest]. + /// + /// # Example + /// + /// The following manifest will brand the exe as requesting administrator privileges. + /// Thus, everytime it is executed, a Windows UAC dialog will appear. + /// + /// Note that you can move the manifest contents to a separate file and use `include_str!("manifest.xml")` + /// instead of the inline string. + /// + /// ```rust,no_run + /// let mut windows = tauri_build::WindowsAttributes::new(); + /// windows = windows.app_manifest(r#" + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// "#); + /// tauri_build::try_build( + /// tauri_build::Attributes::new().windows_attributes(windows) + /// ).expect("failed to run build script"); + /// ``` + /// + /// Defaults to: + /// ```ignore + #[doc = include_str!("window-app-manifest.xml")] + /// [manifest]: https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests + /// ``` + #[must_use] + pub fn app_manifest>(mut self, manifest: S) -> Self { + self.app_manifest = Some(manifest.as_ref().to_string()); + self + } } /// The attributes used on the build. @@ -197,8 +248,6 @@ pub fn build() { #[allow(unused_variables)] pub fn try_build(attributes: Attributes) -> Result<()> { use anyhow::anyhow; - use cargo_toml::{Dependency, Manifest}; - use tauri_utils::config::{Config, TauriConfig}; println!("cargo:rerun-if-env-changed=TAURI_CONFIG"); println!("cargo:rerun-if-changed=tauri.conf.json"); @@ -235,50 +284,33 @@ pub fn try_build(attributes: Attributes) -> Result<()> { cfg_alias("dev", !has_feature("custom-protocol")); - let mut manifest = Manifest::from_path("Cargo.toml")?; + let ws_path = get_workspace_dir()?; + let mut manifest = + Manifest::::from_slice_with_metadata(&std::fs::read("Cargo.toml")?)?; + + if let Ok(ws_manifest) = Manifest::from_path(ws_path.join("Cargo.toml")) { + Manifest::complete_from_path_and_workspace( + &mut manifest, + Path::new("Cargo.toml"), + Some((&ws_manifest, ws_path.as_path())), + )?; + } else { + Manifest::complete_from_path(&mut manifest, Path::new("Cargo.toml"))?; + } + + if let Some(tauri_build) = manifest.build_dependencies.remove("tauri-build") { + let error_message = check_features(&config, tauri_build, true); + + if !error_message.is_empty() { + return Err(anyhow!(" + The `tauri-build` dependency features on the `Cargo.toml` file does not match the allowlist defined under `tauri.conf.json`. + Please run `tauri dev` or `tauri build` or {}. + ", error_message)); + } + } + if let Some(tauri) = manifest.dependencies.remove("tauri") { - let features = match tauri { - Dependency::Simple(_) => Vec::new(), - Dependency::Detailed(dep) => dep.features, - Dependency::Inherited(dep) => dep.features, - }; - - let all_cli_managed_features = TauriConfig::all_features(); - let diff = features_diff( - &features - .into_iter() - .filter(|f| all_cli_managed_features.contains(&f.as_str())) - .collect::>(), - &config - .tauri - .features() - .into_iter() - .map(|f| f.to_string()) - .collect::>(), - ); - - let mut error_message = String::new(); - if !diff.remove.is_empty() { - error_message.push_str("remove the `"); - error_message.push_str(&diff.remove.join(", ")); - error_message.push_str(if diff.remove.len() == 1 { - "` feature" - } else { - "` features" - }); - if !diff.add.is_empty() { - error_message.push_str(" and "); - } - } - if !diff.add.is_empty() { - error_message.push_str("add the `"); - error_message.push_str(&diff.add.join(", ")); - error_message.push_str(if diff.add.len() == 1 { - "` feature" - } else { - "` features" - }); - } + let error_message = check_features(&config, tauri, false); if !error_message.is_empty() { return Err(anyhow!(" @@ -313,25 +345,25 @@ pub fn try_build(attributes: Attributes) -> Result<()> { #[allow(unused_mut, clippy::redundant_clone)] let mut resources = config.tauri.bundle.resources.clone().unwrap_or_default(); - #[cfg(windows)] - if let Some(fixed_webview2_runtime_path) = &config.tauri.bundle.windows.webview_fixed_runtime_path - { - resources.push(fixed_webview2_runtime_path.display().to_string()); + if target_triple.contains("windows") { + if let Some(fixed_webview2_runtime_path) = + &config.tauri.bundle.windows.webview_fixed_runtime_path + { + resources.push(fixed_webview2_runtime_path.display().to_string()); + } } copy_resources(ResourcePaths::new(resources.as_slice(), true), target_dir)?; - #[cfg(target_os = "macos")] - { - if let Some(version) = config.tauri.bundle.macos.minimum_system_version { + if target_triple.contains("darwin") { + if let Some(version) = &config.tauri.bundle.macos.minimum_system_version { println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET={}", version); } } - #[cfg(windows)] - { + if target_triple.contains("windows") { use anyhow::Context; use semver::Version; - use winres::{VersionInfo, WindowsResource}; + use tauri_winres::{VersionInfo, WindowsResource}; fn find_icon bool>(config: &Config, predicate: F, default: &str) -> PathBuf { let icon_path = config @@ -354,24 +386,11 @@ pub fn try_build(attributes: Attributes) -> Result<()> { if window_icon_path.exists() { let mut res = WindowsResource::new(); - res.set_manifest( - r#" - - - - - - - - "#, - ); + if let Some(manifest) = attributes.windows_attributes.app_manifest { + res.set_manifest(&manifest); + } else { + res.set_manifest(include_str!("window-app-manifest.xml")); + } if let Some(sdk_dir) = &attributes.windows_attributes.sdk_dir { if let Some(sdk_dir_str) = sdk_dir.to_str() { @@ -470,6 +489,89 @@ fn features_diff(current: &[String], expected: &[String]) -> Diff { Diff { remove, add } } +fn check_features(config: &Config, dependency: Dependency, is_tauri_build: bool) -> String { + use tauri_utils::config::{PatternKind, TauriConfig}; + + let features = match dependency { + Dependency::Simple(_) => Vec::new(), + Dependency::Detailed(dep) => dep.features, + Dependency::Inherited(dep) => dep.features, + }; + + let all_cli_managed_features = if is_tauri_build { + vec!["isolation"] + } else { + TauriConfig::all_features() + }; + + let expected = if is_tauri_build { + match config.tauri.pattern { + PatternKind::Isolation { .. } => vec!["isolation".to_string()], + _ => vec![], + } + } else { + config + .tauri + .features() + .into_iter() + .map(|f| f.to_string()) + .collect::>() + }; + + let diff = features_diff( + &features + .into_iter() + .filter(|f| all_cli_managed_features.contains(&f.as_str())) + .collect::>(), + &expected, + ); + + let mut error_message = String::new(); + if !diff.remove.is_empty() { + error_message.push_str("remove the `"); + error_message.push_str(&diff.remove.join(", ")); + error_message.push_str(if diff.remove.len() == 1 { + "` feature" + } else { + "` features" + }); + if !diff.add.is_empty() { + error_message.push_str(" and "); + } + } + if !diff.add.is_empty() { + error_message.push_str("add the `"); + error_message.push_str(&diff.add.join(", ")); + error_message.push_str(if diff.add.len() == 1 { + "` feature" + } else { + "` features" + }); + } + + error_message +} + +#[derive(serde::Deserialize)] +struct CargoMetadata { + workspace_root: PathBuf, +} + +fn get_workspace_dir() -> Result { + let output = std::process::Command::new("cargo") + .args(["metadata", "--no-deps", "--format-version", "1"]) + .output()?; + + if !output.status.success() { + return Err(anyhow::anyhow!( + "cargo metadata command exited with a non zero exit code: {}", + String::from_utf8(output.stderr)? + )); + } + + Ok(serde_json::from_slice::(&output.stdout)?.workspace_root) +} + #[cfg(test)] mod tests { use super::Diff; diff --git a/core/tauri-build/src/static_vcruntime.rs b/core/tauri-build/src/static_vcruntime.rs index a707ac932..859232d9b 100644 --- a/core/tauri-build/src/static_vcruntime.rs +++ b/core/tauri-build/src/static_vcruntime.rs @@ -48,7 +48,7 @@ fn override_msvcrt_lib() { let f = fs::OpenOptions::new() .write(true) .create_new(true) - .open(&path); + .open(path); if let Ok(mut f) = f { f.write_all(machine).unwrap(); f.write_all(bytes).unwrap(); diff --git a/core/tauri-build/src/window-app-manifest.xml b/core/tauri-build/src/window-app-manifest.xml new file mode 100644 index 000000000..2d510ed31 --- /dev/null +++ b/core/tauri-build/src/window-app-manifest.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/core/tauri-codegen/Cargo.toml b/core/tauri-codegen/Cargo.toml index bc36df3b4..3e48e8402 100644 --- a/core/tauri-codegen/Cargo.toml +++ b/core/tauri-codegen/Cargo.toml @@ -14,7 +14,7 @@ readme = "README.md" [dependencies] sha2 = "0.10" -base64 = "0.13" +base64 = "0.21" proc-macro2 = "1" quote = "1" serde = { version = "1", features = [ "derive" ] } @@ -23,12 +23,12 @@ tauri-utils = { version = "2.0.0-alpha.1", path = "../tauri-utils", features = [ thiserror = "1" walkdir = "2" brotli = { version = "3", optional = true, default-features = false, features = [ "std" ] } -regex = { version = "1.7.0", optional = true } +regex = { version = "1.7.1", optional = true } uuid = { version = "1", features = [ "v4" ] } semver = "1" -ico = "0.2" +ico = "0.3" png = "0.17" -json-patch = "0.2" +json-patch = "0.3" url = "2" [target."cfg(target_os = \"macos\")".dependencies] diff --git a/core/tauri-codegen/src/context.rs b/core/tauri-codegen/src/context.rs index 32e2c05fa..869a16e82 100644 --- a/core/tauri-codegen/src/context.rs +++ b/core/tauri-codegen/src/context.rs @@ -5,6 +5,7 @@ use std::path::{Path, PathBuf}; use std::{ffi::OsStr, str::FromStr}; +use base64::Engine; use proc_macro2::TokenStream; use quote::quote; use sha2::{Digest, Sha256}; @@ -57,7 +58,10 @@ fn map_core_assets( let mut hasher = Sha256::new(); hasher.update(&script); let hash = hasher.finalize(); - scripts.push(format!("'sha256-{}'", base64::encode(hash))); + scripts.push(format!( + "'sha256-{}'", + base64::engine::general_purpose::STANDARD.encode(hash) + )); } csp_hashes .inline_scripts @@ -74,9 +78,10 @@ fn map_core_assets( let mut hasher = Sha256::new(); hasher.update(tauri_utils::pattern::isolation::IFRAME_STYLE); let hash = hasher.finalize(); - csp_hashes - .styles - .push(format!("'sha256-{}'", base64::encode(hash))); + csp_hashes.styles.push(format!( + "'sha256-{}'", + base64::engine::general_purpose::STANDARD.encode(hash) + )); } } @@ -413,7 +418,7 @@ pub fn context_codegen(data: ContextData) -> Result quote!(::std::option::Option::None), ShellAllowlistOpen::Flag(true) => { - quote!(::std::option::Option::Some(#root::regex::Regex::new("^https?://").unwrap())) + quote!(::std::option::Option::Some(#root::regex::Regex::new(r#"^((mailto:\w+)|(tel:\w+)|(https?://\w+)).+"#).unwrap())) } ShellAllowlistOpen::Validate(regex) => match Regex::new(regex) { Ok(_) => quote!(::std::option::Option::Some(#root::regex::Regex::new(#regex).unwrap())), diff --git a/core/tauri-codegen/src/embedded_assets.rs b/core/tauri-codegen/src/embedded_assets.rs index 272826969..f46df8760 100644 --- a/core/tauri-codegen/src/embedded_assets.rs +++ b/core/tauri-codegen/src/embedded_assets.rs @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT +use base64::Engine; use proc_macro2::TokenStream; use quote::{quote, ToTokens, TokenStreamExt}; use sha2::{Digest, Sha256}; @@ -181,9 +182,10 @@ impl CspHashes { })?, ); let hash = hasher.finalize(); - self - .scripts - .push(format!("'sha256-{}'", base64::encode(hash))); + self.scripts.push(format!( + "'sha256-{}'", + base64::engine::general_purpose::STANDARD.encode(hash) + )); } } diff --git a/core/tauri-runtime-wry/src/lib.rs b/core/tauri-runtime-wry/src/lib.rs index bedec6006..090bde001 100644 --- a/core/tauri-runtime-wry/src/lib.rs +++ b/core/tauri-runtime-wry/src/lib.rs @@ -14,8 +14,8 @@ use tauri_runtime::{ dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, Position, Size}, CursorIcon, DetachedWindow, FileDropEvent, JsEventListenerKey, PendingWindow, WindowEvent, }, - Dispatch, Error, EventLoopProxy, ExitRequestedEventAction, Icon, Result, RunEvent, RunIteration, - Runtime, RuntimeHandle, UserAttentionType, UserEvent, + DeviceEventFilter, Dispatch, Error, EventLoopProxy, ExitRequestedEventAction, Icon, Result, + RunEvent, RunIteration, Runtime, RuntimeHandle, UserAttentionType, UserEvent, }; use tauri_runtime::window::MenuEvent; @@ -33,6 +33,8 @@ use wry::application::platform::macos::WindowBuilderExtMacOS; use wry::application::platform::unix::{WindowBuilderExtUnix, WindowExtUnix}; #[cfg(windows)] use wry::application::platform::windows::{WindowBuilderExtWindows, WindowExtWindows}; +#[cfg(windows)] +use wry::webview::WebViewBuilderExtWindows; #[cfg(target_os = "macos")] use tauri_utils::TitleBarStyle; @@ -47,7 +49,8 @@ use wry::{ }, event::{Event, StartCause, WindowEvent as WryWindowEvent}, event_loop::{ - ControlFlow, EventLoop, EventLoopProxy as WryEventLoopProxy, EventLoopWindowTarget, + ControlFlow, DeviceEventFilter as WryDeviceEventFilter, EventLoop, + EventLoopProxy as WryEventLoopProxy, EventLoopWindowTarget, }, menu::{ AboutMetadata as WryAboutMetadata, CustomMenuItem as WryCustomMenuItem, MenuBar, @@ -61,10 +64,9 @@ use wry::{ }, }, http::{Request as WryRequest, Response as WryResponse}, - webview::{FileDropEvent as WryFileDropEvent, WebContext, WebView, WebViewBuilder}, + webview::{FileDropEvent as WryFileDropEvent, Url, WebContext, WebView, WebViewBuilder}, }; -pub use wry; pub use wry::application::window::{Window, WindowBuilder as WryWindowBuilder, WindowId}; #[cfg(windows)] use wry::webview::WebviewExtWindows; @@ -367,6 +369,18 @@ impl From for MenuItemWrapper { } } +pub struct DeviceEventFilterWrapper(pub WryDeviceEventFilter); + +impl From for DeviceEventFilterWrapper { + fn from(item: DeviceEventFilter) -> Self { + match item { + DeviceEventFilter::Always => Self(WryDeviceEventFilter::Always), + DeviceEventFilter::Never => Self(WryDeviceEventFilter::Never), + DeviceEventFilter::Unfocused => Self(WryDeviceEventFilter::Unfocused), + } + } +} + #[cfg(target_os = "macos")] pub struct NativeImageWrapper(pub WryNativeImage); @@ -727,6 +741,12 @@ impl WindowBuilder for WindowBuilderWrapper { "); } + #[cfg(target_os = "linux")] + { + // Mouse event is disabled on Linux since sudden event bursts could block event loop. + window.inner = window.inner.with_cursor_moved_event(false); + } + #[cfg(desktop)] { window = window @@ -738,6 +758,7 @@ impl WindowBuilder for WindowBuilderWrapper { .decorations(config.decorations) .maximized(config.maximized) .always_on_top(config.always_on_top) + .content_protected(config.content_protected) .skip_taskbar(config.skip_taskbar) .theme(config.theme) .shadow(config.shadow); @@ -848,6 +869,11 @@ impl WindowBuilder for WindowBuilderWrapper { self } + fn content_protected(mut self, protected: bool) -> Self { + self.inner = self.inner.with_content_protection(protected); + self + } + fn shadow(#[allow(unused_mut)] mut self, _enable: bool) -> Self { #[cfg(windows)] { @@ -1037,16 +1063,19 @@ pub enum WindowMessage { #[cfg(any(debug_assertions, feature = "devtools"))] IsDevToolsOpen(Sender), // Getters + Url(Sender), ScaleFactor(Sender), InnerPosition(Sender>>), OuterPosition(Sender>>), InnerSize(Sender>), OuterSize(Sender>), IsFullscreen(Sender), + IsMinimized(Sender), IsMaximized(Sender), IsDecorated(Sender), IsResizable(Sender), IsVisible(Sender), + Title(Sender), IsMenuVisible(Sender), CurrentMonitor(Sender>), PrimaryMonitor(Sender>), @@ -1078,6 +1107,7 @@ pub enum WindowMessage { SetDecorations(bool), SetShadow(bool), SetAlwaysOnTop(bool), + SetContentProtected(bool), SetSize(Size), SetMinSize(Option), SetMaxSize(Option), @@ -1120,6 +1150,7 @@ pub enum TrayMessage { UpdateIconAsTemplate(bool), #[cfg(target_os = "macos")] UpdateTitle(String), + UpdateTooltip(String), Create(SystemTray, Sender>), Destroy(Sender>), } @@ -1236,6 +1267,10 @@ impl Dispatch for WryDispatcher { // Getters + fn url(&self) -> Result { + window_getter!(self, WindowMessage::Url) + } + fn scale_factor(&self) -> Result { window_getter!(self, WindowMessage::ScaleFactor) } @@ -1260,6 +1295,10 @@ impl Dispatch for WryDispatcher { window_getter!(self, WindowMessage::IsFullscreen) } + fn is_minimized(&self) -> Result { + window_getter!(self, WindowMessage::IsMinimized) + } + fn is_maximized(&self) -> Result { window_getter!(self, WindowMessage::IsMaximized) } @@ -1278,6 +1317,10 @@ impl Dispatch for WryDispatcher { window_getter!(self, WindowMessage::IsVisible) } + fn title(&self) -> Result { + window_getter!(self, WindowMessage::Title) + } + fn is_menu_visible(&self) -> Result { window_getter!(self, WindowMessage::IsMenuVisible) } @@ -1454,6 +1497,16 @@ impl Dispatch for WryDispatcher { ) } + fn set_content_protected(&self, protected: bool) -> Result<()> { + send_user_message( + &self.context, + Message::Window( + self.window_id, + WindowMessage::SetContentProtected(protected), + ), + ) + } + fn set_size(&self, size: Size) -> Result<()> { send_user_message( &self.context, @@ -2076,6 +2129,12 @@ impl Runtime for Wry { self.event_loop.hide_application(); } + fn set_device_event_filter(&mut self, filter: DeviceEventFilter) { + self + .event_loop + .set_device_event_filter(DeviceEventFilterWrapper::from(filter).0); + } + #[cfg(desktop)] fn run_iteration) + 'static>(&mut self, mut callback: F) -> RunIteration { use wry::application::platform::run_return::EventLoopExtRunReturn; @@ -2373,6 +2432,11 @@ fn handle_user_message( } } // Getters + WindowMessage::Url(tx) => { + if let WindowHandle::Webview { inner: w, .. } = &window { + tx.send(w.url()).unwrap(); + } + } WindowMessage::ScaleFactor(tx) => tx.send(window.scale_factor()).unwrap(), WindowMessage::InnerPosition(tx) => tx .send( @@ -2397,10 +2461,12 @@ fn handle_user_message( .send(PhysicalSizeWrapper(window.outer_size()).into()) .unwrap(), WindowMessage::IsFullscreen(tx) => tx.send(window.fullscreen().is_some()).unwrap(), + WindowMessage::IsMinimized(tx) => tx.send(window.is_minimized()).unwrap(), WindowMessage::IsMaximized(tx) => tx.send(window.is_maximized()).unwrap(), WindowMessage::IsDecorated(tx) => tx.send(window.is_decorated()).unwrap(), WindowMessage::IsResizable(tx) => tx.send(window.is_resizable()).unwrap(), WindowMessage::IsVisible(tx) => tx.send(window.is_visible()).unwrap(), + WindowMessage::Title(tx) => tx.send(window.title()).unwrap(), WindowMessage::IsMenuVisible(tx) => tx.send(window.is_menu_visible()).unwrap(), WindowMessage::CurrentMonitor(tx) => tx.send(window.current_monitor()).unwrap(), WindowMessage::PrimaryMonitor(tx) => tx.send(window.primary_monitor()).unwrap(), @@ -2451,6 +2517,9 @@ fn handle_user_message( window.set_has_shadow(_enable); } WindowMessage::SetAlwaysOnTop(always_on_top) => window.set_always_on_top(always_on_top), + WindowMessage::SetContentProtected(protected) => { + window.set_content_protection(protected) + } WindowMessage::SetSize(size) => { window.set_inner_size(SizeWrapper::from(size).0); } @@ -2637,6 +2706,11 @@ fn handle_user_message( tray.set_title(&title); } } + TrayMessage::UpdateTooltip(tooltip) => { + if let Some(tray) = &mut *tray_context.tray.lock().unwrap() { + tray.set_tooltip(&tooltip); + } + } TrayMessage::Create(_tray, _tx) => { // already handled } @@ -2852,6 +2926,19 @@ fn handle_event_loop( } match event { + #[cfg(windows)] + WryWindowEvent::ThemeChanged(theme) => { + if let Some(window) = windows.borrow().get(&window_id) { + if let Some(WindowHandle::Webview { inner, .. }) = &window.inner { + let theme = match theme { + WryTheme::Dark => wry::webview::Theme::Dark, + WryTheme::Light => wry::webview::Theme::Light, + _ => wry::webview::Theme::Light, + }; + inner.set_theme(theme); + } + } + } WryWindowEvent::CloseRequested => { on_close_requested(callback, window_id, windows.clone()); } @@ -3028,6 +3115,9 @@ fn create_webview( .with_drag_and_drop(webview_attributes.file_drop_handler_enabled); } + #[cfg(windows)] + let window_theme = window_builder.inner.window.preferred_theme; + #[cfg(target_os = "macos")] { if window_builder.tabbing_identifier.is_none() @@ -3064,9 +3154,29 @@ fn create_webview( webview_builder = webview_builder .with_file_drop_handler(create_file_drop_handler(window_event_listeners.clone())); } + if let Some(navigation_handler) = pending.navigation_handler { + webview_builder = webview_builder.with_navigation_handler(move |url| { + Url::parse(&url).map(&navigation_handler).unwrap_or(true) + }); + } if let Some(user_agent) = webview_attributes.user_agent { webview_builder = webview_builder.with_user_agent(&user_agent); } + + #[cfg(windows)] + if let Some(additional_browser_args) = webview_attributes.additional_browser_args { + webview_builder = webview_builder.with_additional_browser_args(&additional_browser_args); + } + + #[cfg(windows)] + if let Some(theme) = window_theme { + webview_builder = webview_builder.with_theme(match theme { + WryTheme::Dark => wry::webview::Theme::Dark, + WryTheme::Light => wry::webview::Theme::Light, + _ => wry::webview::Theme::Light, + }); + } + if let Some(handler) = ipc_handler { webview_builder = webview_builder.with_ipc_handler(create_ipc_handler( context, diff --git a/core/tauri-runtime-wry/src/system_tray.rs b/core/tauri-runtime-wry/src/system_tray.rs index ee6db6c9e..6262460a3 100644 --- a/core/tauri-runtime-wry/src/system_tray.rs +++ b/core/tauri-runtime-wry/src/system_tray.rs @@ -114,6 +114,10 @@ pub fn create_tray( } } + if let Some(tooltip) = system_tray.tooltip { + builder = builder.with_tooltip(&tooltip); + } + let tray = builder .build(event_loop) .map_err(|e| Error::SystemTray(Box::new(e)))?; @@ -172,6 +176,16 @@ impl TrayHandle for SystemTrayHandle { .map_err(|_| Error::FailedToSendMessage) } + fn set_tooltip(&self, tooltip: &str) -> Result<()> { + self + .proxy + .send_event(Message::Tray( + self.id, + TrayMessage::UpdateTooltip(tooltip.to_owned()), + )) + .map_err(|_| Error::FailedToSendMessage) + } + fn destroy(&self) -> Result<()> { let (tx, rx) = std::sync::mpsc::channel(); send_user_message( diff --git a/core/tauri-runtime/Cargo.toml b/core/tauri-runtime/Cargo.toml index 2a392c406..b4b792bb1 100644 --- a/core/tauri-runtime/Cargo.toml +++ b/core/tauri-runtime/Cargo.toml @@ -32,6 +32,7 @@ http = "0.2.4" http-range = "0.1.4" raw-window-handle = "0.5" rand = "0.8" +url = { version = "2" } [target."cfg(windows)".dependencies] webview2-com = "0.22" diff --git a/core/tauri-runtime/src/lib.rs b/core/tauri-runtime/src/lib.rs index b5dc09ac4..9b4e5d4af 100644 --- a/core/tauri-runtime/src/lib.rs +++ b/core/tauri-runtime/src/lib.rs @@ -10,6 +10,7 @@ use raw_window_handle::RawDisplayHandle; use serde::Deserialize; use std::{fmt::Debug, sync::mpsc::Sender}; use tauri_utils::Theme; +use url::Url; use uuid::Uuid; pub mod http; @@ -53,6 +54,7 @@ pub struct SystemTray { #[cfg(target_os = "macos")] pub title: Option, pub on_event: Option>, + pub tooltip: Option, } #[cfg(all(desktop, feature = "system-tray"))] @@ -86,6 +88,7 @@ impl Clone for SystemTray { menu_on_left_click: self.menu_on_left_click, #[cfg(target_os = "macos")] title: self.title.clone(), + tooltip: self.tooltip.clone(), } } } @@ -104,6 +107,7 @@ impl Default for SystemTray { #[cfg(target_os = "macos")] title: None, on_event: None, + tooltip: None, } } } @@ -156,6 +160,17 @@ impl SystemTray { self } + /// Sets the tray icon tooltip. + /// + /// ## Platform-specific: + /// + /// - **Linux:** Unsupported + #[must_use] + pub fn with_tooltip(mut self, tooltip: &str) -> Self { + self.tooltip = Some(tooltip.to_owned()); + self + } + /// Sets the menu to show when the system tray is right clicked. #[must_use] pub fn with_menu(mut self, menu: menu::SystemTrayMenu) -> Self { @@ -184,6 +199,23 @@ pub enum UserAttentionType { Informational, } +#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize)] +#[serde(tag = "type")] +pub enum DeviceEventFilter { + /// Always filter out device events. + Always, + /// Filter out device events while the window is not focused. + Unfocused, + /// Report all device events regardless of window focus. + Never, +} + +impl Default for DeviceEventFilter { + fn default() -> Self { + Self::Unfocused + } +} + #[derive(Debug, thiserror::Error)] #[non_exhaustive] pub enum Error { @@ -480,6 +512,19 @@ pub trait Runtime: Debug + Sized + 'static { #[cfg_attr(doc_cfg, doc(cfg(target_os = "macos")))] fn hide(&self); + /// Change the device event filter mode. + /// + /// Since the DeviceEvent capture can lead to high CPU usage for unfocused windows, [`tao`] + /// will ignore them by default for unfocused windows on Windows. This method allows changing + /// the filter to explicitly capture them again. + /// + /// ## Platform-specific + /// + /// - ** Linux / macOS / iOS / Android**: Unsupported. + /// + /// [`tao`]: https://crates.io/crates/tao + fn set_device_event_filter(&mut self, filter: DeviceEventFilter); + /// Runs the one step of the webview runtime event loop and returns control flow to the caller. #[cfg(desktop)] fn run_iteration) + 'static>(&mut self, callback: F) -> RunIteration; @@ -522,6 +567,9 @@ pub trait Dispatch: Debug + Clone + Send + Sync + Sized + 'static // GETTERS + /// Returns the webview's current URL. + fn url(&self) -> Result; + /// Returns the scale factor that can be used to map logical pixels to physical pixels, and vice versa. fn scale_factor(&self) -> Result; @@ -544,6 +592,9 @@ pub trait Dispatch: Debug + Clone + Send + Sync + Sized + 'static /// Gets the window's current fullscreen state. fn is_fullscreen(&self) -> Result; + /// Gets the window's current minimized state. + fn is_minimized(&self) -> Result; + /// Gets the window's current maximized state. fn is_maximized(&self) -> Result; @@ -555,6 +606,8 @@ pub trait Dispatch: Debug + Clone + Send + Sync + Sized + 'static /// Gets the window's current visibility state. fn is_visible(&self) -> Result; + /// Gets the window's current title. + fn title(&self) -> Result; /// Gets the window menu current visibility state. fn is_menu_visible(&self) -> Result; @@ -648,6 +701,9 @@ pub trait Dispatch: Debug + Clone + Send + Sync + Sized + 'static /// Updates the window alwaysOnTop flag. fn set_always_on_top(&self, always_on_top: bool) -> Result<()>; + /// Prevents the window contents from being captured by other apps. + fn set_content_protected(&self, protected: bool) -> Result<()>; + /// Resizes the window. fn set_size(&self, size: Size) -> Result<()>; diff --git a/core/tauri-runtime/src/menu.rs b/core/tauri-runtime/src/menu.rs index 4df40b23c..fe71bb17f 100644 --- a/core/tauri-runtime/src/menu.rs +++ b/core/tauri-runtime/src/menu.rs @@ -154,6 +154,7 @@ pub trait TrayHandle: fmt::Debug + Clone + Send + Sync { fn set_icon_as_template(&self, is_template: bool) -> crate::Result<()>; #[cfg(target_os = "macos")] fn set_title(&self, title: &str) -> crate::Result<()>; + fn set_tooltip(&self, tooltip: &str) -> crate::Result<()>; fn destroy(&self) -> crate::Result<()>; } diff --git a/core/tauri-runtime/src/webview.rs b/core/tauri-runtime/src/webview.rs index db9c8dfcc..c03a3611f 100644 --- a/core/tauri-runtime/src/webview.rs +++ b/core/tauri-runtime/src/webview.rs @@ -28,6 +28,7 @@ pub struct WebviewAttributes { pub file_drop_handler_enabled: bool, pub clipboard: bool, pub accept_first_mouse: bool, + pub additional_browser_args: Option, } impl WebviewAttributes { @@ -41,6 +42,7 @@ impl WebviewAttributes { file_drop_handler_enabled: true, clipboard: false, accept_first_mouse: false, + additional_browser_args: None, } } @@ -88,6 +90,13 @@ impl WebviewAttributes { self.accept_first_mouse = accept; self } + + /// Sets additional browser arguments. **Windows Only** + #[must_use] + pub fn additional_browser_args(mut self, additional_args: &str) -> Self { + self.additional_browser_args = Some(additional_args.to_string()); + self + } } /// Do **NOT** implement this trait except for use in a custom [`Runtime`](crate::Runtime). @@ -172,6 +181,10 @@ pub trait WindowBuilder: WindowBuilderBase { #[must_use] fn always_on_top(self, always_on_top: bool) -> Self; + /// Prevents the window contents from being captured by other apps. + #[must_use] + fn content_protected(self, protected: bool) -> Self; + /// Sets the window icon. fn icon(self, icon: Icon) -> crate::Result; diff --git a/core/tauri-runtime/src/window.rs b/core/tauri-runtime/src/window.rs index 2f5931280..aaf004d52 100644 --- a/core/tauri-runtime/src/window.rs +++ b/core/tauri-runtime/src/window.rs @@ -12,6 +12,7 @@ use crate::{ }; use serde::{Deserialize, Deserializer, Serialize}; use tauri_utils::{config::WindowConfig, Theme}; +use url::Url; use std::{ collections::{HashMap, HashSet}, @@ -240,6 +241,9 @@ pub struct PendingWindow> { /// A HashMap mapping JS event names with associated listener ids. pub js_event_listeners: Arc>>>, + /// A handler to decide if incoming url is allowed to navigate. + pub navigation_handler: Option bool + Send>>, + #[cfg(target_os = "android")] pub on_webview_created: Option) -> Result<(), jni::errors::Error> + Send>>, @@ -282,6 +286,7 @@ impl> PendingWindow { url: "tauri://localhost".to_string(), menu_ids: Arc::new(Mutex::new(menu_ids)), js_event_listeners: Default::default(), + navigation_handler: Default::default(), #[cfg(target_os = "android")] on_webview_created: None, }) @@ -313,6 +318,7 @@ impl> PendingWindow { url: "tauri://localhost".to_string(), menu_ids: Arc::new(Mutex::new(menu_ids)), js_event_listeners: Default::default(), + navigation_handler: Default::default(), #[cfg(target_os = "android")] on_webview_created: None, }) diff --git a/core/tauri-utils/Cargo.toml b/core/tauri-utils/Cargo.toml index f7724a5e5..e00251071 100644 --- a/core/tauri-utils/Cargo.toml +++ b/core/tauri-utils/Cargo.toml @@ -12,30 +12,30 @@ exclude = [ "CHANGELOG.md", "/target" ] readme = "README.md" [dependencies] -serde = { version = "1.0", features = [ "derive" ] } -serde_json = "1.0" -thiserror = "1.0.30" +serde = { version = "1", features = [ "derive" ] } +serde_json = "1" +thiserror = "1" phf = { version = "0.10", features = [ "macros" ] } brotli = { version = "3", optional = true, default-features = false, features = [ "std" ] } -url = { version = "2.2", features = [ "serde" ] } +url = { version = "2", features = [ "serde" ] } kuchiki = "0.8" html5ever = "0.25" -proc-macro2 = { version = "1.0", optional = true } -quote = { version = "1.0", optional = true } +proc-macro2 = { version = "1", optional = true } +quote = { version = "1", optional = true } schemars = { version = "0.8", features = [ "url" ], optional = true } -serde_with = "1.12" -aes-gcm = { version = "0.9", optional = true } +serde_with = "1" +aes-gcm = { version = "0.10", optional = true } getrandom = { version = "0.2", optional = true, features = [ "std" ] } serialize-to-javascript = { version = "=0.1.1", optional = true } ctor = "0.1" json5 = { version = "0.4", optional = true } toml = { version = "0.5", optional = true } -json-patch = "0.2" -glob = { version = "0.3.0", optional = true } +json-patch = "0.3" +glob = { version = "0.3", optional = true } walkdir = { version = "2", optional = true } -memchr = "2.4" +memchr = "2" semver = "1" -infer = "0.7" +infer = "0.12" [target."cfg(target_os = \"linux\")".dependencies] heck = "0.4" diff --git a/core/tauri-utils/src/config.rs b/core/tauri-utils/src/config.rs index 65f97a388..56b40632a 100644 --- a/core/tauri-utils/src/config.rs +++ b/core/tauri-utils/src/config.rs @@ -78,6 +78,8 @@ pub enum BundleType { AppImage, /// The Microsoft Installer bundle (.msi). Msi, + /// The NSIS bundle (.exe). + Nsis, /// The macOS application bundle (.app). App, /// The Apple Disk Image bundle (.dmg). @@ -95,6 +97,7 @@ impl Display for BundleType { Self::Deb => "deb", Self::AppImage => "appimage", Self::Msi => "msi", + Self::Nsis => "nsis", Self::App => "app", Self::Dmg => "dmg", Self::Updater => "updater", @@ -122,6 +125,7 @@ impl<'de> Deserialize<'de> for BundleType { "deb" => Ok(Self::Deb), "appimage" => Ok(Self::AppImage), "msi" => Ok(Self::Msi), + "nsis" => Ok(Self::Nsis), "app" => Ok(Self::App), "dmg" => Ok(Self::Dmg), "updater" => Ok(Self::Updater), @@ -416,6 +420,71 @@ pub struct WixConfig { pub dialog_image_path: Option, } +/// Configuration for the Installer bundle using NSIS. +#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "schema", derive(JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct NsisConfig { + /// The path to the license file to render on the installer. + pub license: Option, + /// The path to a bitmap file to display on the header of installers pages. + /// + /// The recommended dimensions are 150px x 57px. + #[serde(alias = "header-image")] + pub header_image: Option, + /// The path to a bitmap file for the Welcome page and the Finish page. + /// + /// The recommended dimensions are 164px x 314px. + #[serde(alias = "sidebar-image")] + pub sidebar_image: Option, + /// The path to an icon file used as the installer icon. + #[serde(alias = "install-icon")] + pub installer_icon: Option, + /// Whether the installation will be for all users or just the current user. + #[serde(default, alias = "install-mode")] + pub install_mode: NSISInstallerMode, + /// A list of installer languages. + /// By default the OS language is used. If the OS language is not in the list of languages, the first language will be used. + /// To allow the user to select the language, set `display_language_selector` to `true`. + /// + /// See for the complete list of languages. + pub languages: Option>, + /// Whether to display a language selector dialog before the installer and uninstaller windows are rendered or not. + /// By default the OS language is selected, with a fallback to the first language in the `languages` array. + #[serde(default, alias = "display-language-selector")] + pub display_language_selector: bool, +} + +/// Install Modes for the NSIS installer. +#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +#[cfg_attr(feature = "schema", derive(JsonSchema))] +pub enum NSISInstallerMode { + /// Default mode for the installer. + /// + /// Install the app by default in a directory that doesn't require Administrator access. + /// + /// Installer metadata will be saved under the `HKCU` registry path. + CurrentUser, + /// Install the app by default in the `Program Files` folder directory requires Administrator + /// access for the installation. + /// + /// Installer metadata will be saved under the `HKLM` registry path. + PerMachine, + /// Combines both modes and allows the user to choose at install time + /// whether to install for the current user or per machine. Note that this mode + /// will require Administrator access even if the user wants to install it for the current user only. + /// + /// Installer metadata will be saved under the `HKLM` or `HKCU` registry path based on the user's choice. + Both, +} + +impl Default for NSISInstallerMode { + fn default() -> Self { + Self::CurrentUser + } +} + /// Install modes for the Webview2 runtime. /// Note that for the updater bundle [`Self::DownloadBootstrapper`] is used. /// @@ -508,6 +577,8 @@ pub struct WindowsConfig { pub allow_downgrades: bool, /// Configuration for the MSI generated with WiX. pub wix: Option, + /// Configuration for the installer generated with NSIS. + pub nsis: Option, } impl Default for WindowsConfig { @@ -521,6 +592,7 @@ impl Default for WindowsConfig { webview_fixed_runtime_path: None, allow_downgrades: default_true(), wix: None, + nsis: None, } } } @@ -534,7 +606,7 @@ pub struct BundleConfig { /// Whether Tauri should bundle your application or just output the executable. #[serde(default)] pub active: bool, - /// The bundle targets, currently supports ["deb", "appimage", "msi", "app", "dmg", "updater"] or "all". + /// The bundle targets, currently supports ["deb", "appimage", "nsis", "msi", "app", "dmg", "updater"] or "all". #[serde(default)] pub targets: BundleTarget, /// The application identifier in reverse domain name notation (e.g. `com.tauri.example`). @@ -854,6 +926,9 @@ pub struct WindowConfig { /// Whether the window should always be on top of other windows. #[serde(default, alias = "always-on-top")] pub always_on_top: bool, + /// Prevents the window contents from being captured by other apps. + #[serde(default, alias = "content-protected")] + pub content_protected: bool, /// If `true`, hides the window icon from the taskbar on Windows and Linux. #[serde(default, alias = "skip-taskbar")] pub skip_taskbar: bool, @@ -876,6 +951,10 @@ pub struct WindowConfig { /// [tabbing identifier]: #[serde(default, alias = "tabbing-identifier")] pub tabbing_identifier: Option, + /// Defines additional browser arguments on Windows. By default wry passes `--disable-features=msWebOOUI,msPdfOOUI,msSmartScreenProtection` + /// so if you use this method, you also need to disable these components by yourself if you want. + #[serde(default, alias = "additional-browser-args")] + pub additional_browser_args: Option, /// Whether or not the window has shadow. /// /// ## Platform-specific @@ -914,12 +993,14 @@ impl Default for WindowConfig { visible: default_true(), decorations: default_true(), always_on_top: false, + content_protected: false, skip_taskbar: false, theme: None, title_bar_style: Default::default(), hidden_title: false, accept_first_mouse: false, tabbing_identifier: None, + additional_browser_args: None, shadow: false, } } @@ -1323,6 +1404,9 @@ pub struct WindowAllowlistConfig { /// Allows setting the always_on_top flag of the window. #[serde(default, alias = "set-always-on-top")] pub set_always_on_top: bool, + /// Allows preventing the window contents from being captured by other apps. + #[serde(default, alias = "set-content-protected")] + pub set_content_protected: bool, /// Allows setting the window size. #[serde(default, alias = "set-size")] pub set_size: bool, @@ -1388,6 +1472,7 @@ impl Allowlist for WindowAllowlistConfig { close: true, set_decorations: true, set_always_on_top: true, + set_content_protected: false, set_size: true, set_min_size: true, set_max_size: true, @@ -1440,6 +1525,12 @@ impl Allowlist for WindowAllowlistConfig { set_always_on_top, "window-set-always-on-top" ); + check_feature!( + self, + features, + set_content_protected, + "window-set-content-protected" + ); check_feature!(self, features, set_size, "window-set-size"); check_feature!(self, features, set_min_size, "window-set-min-size"); check_feature!(self, features, set_max_size, "window-set-max-size"); @@ -1595,7 +1686,7 @@ pub struct ShellAllowlistScope(pub Vec); pub enum ShellAllowlistOpen { /// If the shell open API should be enabled. /// - /// If enabled, the default validation regex (`^https?://`) is used. + /// If enabled, the default validation regex (`^((mailto:\w+)|(tel:\w+)|(https?://\w+)).+`) is used. Flag(bool), /// Enable the shell open API, with a custom regex that the opened path must match against. @@ -2058,7 +2149,16 @@ impl Allowlist for AppAllowlistConfig { } } -/// Allowlist configuration. +/// Allowlist configuration. The allowlist is a translation of the [Cargo allowlist features](https://docs.rs/tauri/latest/tauri/#cargo-allowlist-features). +/// +/// # Notes +/// +/// - Endpoints that don't have their own allowlist option are enabled by default. +/// - There is only "opt-in", no "opt-out". Setting an option to `false` has no effect. +/// +/// # Examples +/// +/// - * [`"app-all": true`](https://tauri.app/v1/api/config/#appallowlistconfig.all) will make the [hide](https://tauri.app/v1/api/js/app#hide) endpoint be available regardless of whether `hide` is set to `false` or `true` in the allowlist. #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", deny_unknown_fields)] @@ -2283,7 +2383,7 @@ pub enum WindowsUpdateInstallMode { /// Specifies there's a basic UI during the installation process, including a final dialog box at the end. BasicUi, /// The quiet mode means there's no user interaction required. - /// Requires admin privileges if the installer does. + /// Requires admin privileges if the installer does (WiX). Quiet, /// Specifies unattended mode, which means the installation only shows a progress bar. Passive, @@ -2354,6 +2454,9 @@ impl<'de> Deserialize<'de> for WindowsUpdateInstallMode { #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct UpdaterWindowsConfig { + /// Additional arguments given to the NSIS or WiX installer. + #[serde(default, alias = "installer-args")] + pub installer_args: Vec, /// The installation mode for the update on Windows. Defaults to `passive`. #[serde(default, alias = "install-mode")] pub install_mode: WindowsUpdateInstallMode, @@ -3033,12 +3136,14 @@ mod build { let visible = self.visible; let decorations = self.decorations; let always_on_top = self.always_on_top; + let content_protected = self.content_protected; let skip_taskbar = self.skip_taskbar; let theme = opt_lit(self.theme.as_ref()); let title_bar_style = &self.title_bar_style; let hidden_title = self.hidden_title; let accept_first_mouse = self.accept_first_mouse; let tabbing_identifier = opt_str_lit(self.tabbing_identifier.as_ref()); + let additional_browser_args = opt_str_lit(self.additional_browser_args.as_ref()); let shadow = self.shadow; literal_struct!( @@ -3066,12 +3171,14 @@ mod build { visible, decorations, always_on_top, + content_protected, skip_taskbar, theme, title_bar_style, hidden_title, accept_first_mouse, tabbing_identifier, + additional_browser_args, shadow ); } @@ -3330,7 +3437,8 @@ mod build { impl ToTokens for UpdaterWindowsConfig { fn to_tokens(&self, tokens: &mut TokenStream) { let install_mode = &self.install_mode; - literal_struct!(tokens, UpdaterWindowsConfig, install_mode); + let installer_args = vec_lit(&self.installer_args, str_lit); + literal_struct!(tokens, UpdaterWindowsConfig, install_mode, installer_args); } } diff --git a/core/tauri-utils/src/lib.rs b/core/tauri-utils/src/lib.rs index 1fb1202ea..5fcd0cf06 100644 --- a/core/tauri-utils/src/lib.rs +++ b/core/tauri-utils/src/lib.rs @@ -5,7 +5,10 @@ //! Tauri utility helpers #![warn(missing_docs, rust_2018_idioms)] -use std::fmt::Display; +use std::{ + fmt::Display, + path::{Path, PathBuf}, +}; use semver::Version; use serde::{Deserialize, Deserializer, Serialize, Serializer}; @@ -296,3 +299,12 @@ macro_rules! debug_eprintln { $crate::consume_unused_variable!($($arg)*); }; } + +/// Reconstructs a path from its components using the platform separator then converts it to String +pub fn display_path>(p: P) -> String { + p.as_ref() + .components() + .collect::() + .display() + .to_string() +} diff --git a/core/tauri-utils/src/pattern/isolation.js b/core/tauri-utils/src/pattern/isolation.js index 507c13a96..f4f554f61 100644 --- a/core/tauri-utils/src/pattern/isolation.js +++ b/core/tauri-utils/src/pattern/isolation.js @@ -43,7 +43,7 @@ algorithm.iv = window.crypto.getRandomValues(new Uint8Array(12)) let encoder = new TextEncoder() - let payloadRaw = encoder.encode(JSON.stringify(data)) + let payloadRaw = encoder.encode(__RAW_stringify_ipc_message_fn__(data)) return window.crypto.subtle .encrypt(algorithm, aesGcmKey, payloadRaw) diff --git a/core/tauri-utils/src/pattern/isolation.rs b/core/tauri-utils/src/pattern/isolation.rs index d05cf4bee..49010fedc 100644 --- a/core/tauri-utils/src/pattern/isolation.rs +++ b/core/tauri-utils/src/pattern/isolation.rs @@ -8,7 +8,7 @@ use std::fmt::{Debug, Formatter}; use std::string::FromUtf8Error; use aes_gcm::aead::Aead; -use aes_gcm::{aead::NewAead, Aes256Gcm, Nonce}; +use aes_gcm::{Aes256Gcm, KeyInit, Nonce}; use getrandom::{getrandom, Error as CsprngError}; use serialize_to_javascript::{default_template, Template}; @@ -57,7 +57,7 @@ impl AesGcmPair { fn new() -> Result { let mut raw = [0u8; 32]; getrandom(&mut raw)?; - let key = aes_gcm::Key::from_slice(&raw); + let key = aes_gcm::Key::::from_slice(&raw); Ok(Self { raw, key: Aes256Gcm::new(key), @@ -141,6 +141,9 @@ pub struct IsolationJavascriptCodegen { pub struct IsolationJavascriptRuntime<'a> { /// The key used on the Rust backend and the Isolation Javascript pub runtime_aes_gcm_key: &'a [u8; 32], + /// The function that stringifies a IPC message. + #[raw] + pub stringify_ipc_message_fn: &'a str, } #[cfg(test)] diff --git a/core/tauri/CHANGELOG.md b/core/tauri/CHANGELOG.md index 91204f1a1..4ecc896ae 100644 --- a/core/tauri/CHANGELOG.md +++ b/core/tauri/CHANGELOG.md @@ -42,6 +42,16 @@ - Export types required by the `mobile_entry_point` macro. - [98904863](https://www.github.com/tauri-apps/tauri/commit/9890486321c9c79ccfb7c547fafee85b5c3ffa71) feat(core): add `mobile_entry_point` macro ([#4983](https://www.github.com/tauri-apps/tauri/pull/4983)) on 2022-08-21 +## \[1.2.4] + +- Pin `ignore` to `=0.4.18`. + - [adcb082b](https://www.github.com/tauri-apps/tauri/commit/adcb082b1651ecb2a6208b093e12f4185aa3fc98) chore(deps): pin `ignore` to =0.4.18 on 2023-01-17 + +## \[1.2.3] + +- Fix the filesystem scope allowing sub-directories of the directory picked by the dialog when `recursive` option was `false`. + - [f1b0ad6e](https://www.github.com/tauri-apps/tauri/commit/f1b0ad6e8b721cf1420a9a4b9be5b05c39941d16) Merge pull request from GHSA-6mv3-wm7j-h4w5 on 2022-12-22 + ## \[1.2.2] - Invoke event listener in windows safely to avoid causing uncaught errors in windows that have loaded external urls @@ -109,6 +119,11 @@ - Added the `user_agent` option when creating a window. - [a6c94119](https://www.github.com/tauri-apps/tauri/commit/a6c94119d8545d509723b147c273ca5edfe3729f) feat(core): expose user_agent to window config ([#5317](https://www.github.com/tauri-apps/tauri/pull/5317)) on 2022-10-02 +## \[1.1.3] + +- Fix the filesystem scope allowing sub-directories of the directory picked by the dialog when `recursive` option was `false`. + - [2654c0f4](https://www.github.com/tauri-apps/tauri/commit/2654c0f49da23434d36447d0908fa24e61ff5e4e) Merge pull request from GHSA-6mv3-wm7j-h4w5 on 2022-12-22 + ## \[1.1.2] - Escape glob special characters in files/directories when dropping files or using the open/save dialogs. @@ -159,6 +174,11 @@ - Add `exists` function to the fs module. - [3c62dbc9](https://www.github.com/tauri-apps/tauri/commit/3c62dbc902c904d35a7472ce72a969084c95fbbe) feat(api): Add `exists` function to the fs module. ([#5060](https://www.github.com/tauri-apps/tauri/pull/5060)) on 2022-09-15 +## \[1.0.8] + +- Fix the filesystem scope allowing sub-directories of the directory picked by the dialog when `recursive` option was `false`. + - [f0602e7c](https://www.github.com/tauri-apps/tauri/commit/f0602e7c294245ab6ef6fbf2a976ef398340ef58) Merge pull request from GHSA-6mv3-wm7j-h4w5 on 2022-12-22 + ## \[1.0.7] - Escape glob special characters in files/directories when dropping files or using the open/save dialogs. diff --git a/core/tauri/Cargo.toml b/core/tauri/Cargo.toml index 54d0266cc..dc3aefd82 100644 --- a/core/tauri/Cargo.toml +++ b/core/tauri/Cargo.toml @@ -66,7 +66,7 @@ flate2 = "1.0" http = "0.2" dirs-next = "2.0" percent-encoding = "2.2" -base64 = { version = "0.13", optional = true } +base64 = { version = "0.21", optional = true } clap = { version = "3", optional = true } reqwest = { version = "0.11", default-features = false, features = [ "json", "stream" ], optional = true } bytes = { version = "1", features = [ "serde" ], optional = true } @@ -77,7 +77,7 @@ os_pipe = { version = "1.0", optional = true } raw-window-handle = "0.5" minisign-verify = { version = "0.2", optional = true } time = { version = "0.3", features = [ "parsing", "formatting" ], optional = true } -os_info = { version = "3.5.0", optional = true } +os_info = { version = "=3.5.0", optional = true } regex = { version = "1.6.0", optional = true } glob = "0.3" data-url = { version = "0.2", optional = true } @@ -88,7 +88,7 @@ ico = { version = "0.2.0", optional = true } encoding_rs = "0.8.31" [target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] -rfd = { version = "0.11.0", optional = true } +rfd = { version = "0.11", optional = true, features=["gtk3", "common-controls-v6"] } notify-rust = { version = "4.5", default-features = false, features = [ "d" ], optional = true } [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] @@ -128,6 +128,7 @@ tauri-build = { path = "../tauri-build/" } [dev-dependencies] mockito = "0.31" proptest = "1.0.0" +unarray = "=0.1.3" quickcheck = "1.0.3" quickcheck_macros = "1.0.0" serde = { version = "1.0", features = [ "derive" ] } @@ -256,6 +257,7 @@ window-all = [ "window-set-decorations", "window-set-shadow", "window-set-always-on-top", + "window-set-content-protected", "window-set-size", "window-set-min-size", "window-set-max-size", @@ -287,6 +289,7 @@ window-close = [ ] window-set-decorations = [ ] window-set-shadow = [ ] window-set-always-on-top = [ ] +window-set-content-protected = [ ] window-set-size = [ ] window-set-min-size = [ ] window-set-max-size = [ ] diff --git a/core/tauri/build.rs b/core/tauri/build.rs index a1c9abf66..1716af6fe 100644 --- a/core/tauri/build.rs +++ b/core/tauri/build.rs @@ -87,6 +87,7 @@ fn main() { "set-decorations", "set-shadow", "set-always-on-top", + "set-content-protected", "set-size", "set-min-size", "set-max-size", @@ -146,6 +147,14 @@ fn main() { ) .expect("failed to write checked_features file"); + // workaround needed to prevent `STATUS_ENTRYPOINT_NOT_FOUND` error + // see https://github.com/tauri-apps/tauri/pull/4383#issuecomment-1212221864 + let target_env = std::env::var("CARGO_CFG_TARGET_ENV"); + let is_tauri_workspace = std::env::var("__TAURI_WORKSPACE__").map_or(false, |v| v == "true"); + if is_tauri_workspace && target_os == "windows" && Ok("msvc") == target_env.as_deref() { + add_manifest(); + } + if target_os == "android" { if let Some(project_dir) = var_os("TAURI_ANDROID_PROJECT_PATH").map(PathBuf::from) { tauri_build::mobile::inject_android_project( @@ -207,3 +216,22 @@ fn alias_module(module: &str, apis: &[&str], api_all: bool) { alias(&format!("{}_any", AsSnakeCase(module)), any); } + +fn add_manifest() { + static WINDOWS_MANIFEST_FILE: &str = "window-app-manifest.xml"; + + let manifest = std::env::current_dir() + .unwrap() + .join("../tauri-build/src") + .join(WINDOWS_MANIFEST_FILE); + + println!("cargo:rerun-if-changed={}", manifest.display()); + // Embed the Windows application manifest file. + println!("cargo:rustc-link-arg=/MANIFEST:EMBED"); + println!( + "cargo:rustc-link-arg=/MANIFESTINPUT:{}", + manifest.to_str().unwrap() + ); + // Turn linker warnings into errors. + println!("cargo:rustc-link-arg=/WX"); +} diff --git a/core/tauri/scripts/bundle.global.js b/core/tauri/scripts/bundle.global.js index 9b125f1af..2e2f13371 100644 --- a/core/tauri/scripts/bundle.global.js +++ b/core/tauri/scripts/bundle.global.js @@ -1,8 +1,8 @@ -"use strict";var __TAURI_IIFE__=(()=>{var L=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var pe=Object.prototype.hasOwnProperty;var d=(t,e)=>{for(var n in e)L(t,n,{get:e[n],enumerable:!0})},ge=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of me(e))!pe.call(t,s)&&s!==n&&L(t,s,{get:()=>e[s],enumerable:!(r=ce(e,s))||r.enumerable});return t};var he=t=>ge(L({},"__esModule",{value:!0}),t);var Jt={};d(Jt,{app:()=>k,cli:()=>U,clipboard:()=>I,dialog:()=>N,event:()=>V,fs:()=>j,globalShortcut:()=>q,http:()=>$,invoke:()=>$t,notification:()=>J,os:()=>ne,path:()=>K,process:()=>Q,shell:()=>Z,tauri:()=>R,updater:()=>X,window:()=>te});var k={};d(k,{getName:()=>be,getTauriVersion:()=>Pe,getVersion:()=>_e,hide:()=>ve,show:()=>we});var R={};d(R,{convertFileSrc:()=>fe,invoke:()=>f,transformCallback:()=>c});function ye(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function c(t,e=!1){let n=ye(),r=`_${n}`;return Object.defineProperty(window,r,{value:s=>(e&&Reflect.deleteProperty(window,r),t?.(s)),writable:!1,configurable:!0}),n}async function f(t,e={}){return new Promise((n,r)=>{let s=c(l=>{n(l),Reflect.deleteProperty(window,`_${a}`)},!0),a=c(l=>{r(l),Reflect.deleteProperty(window,`_${s}`)},!0);window.__TAURI_IPC__({cmd:t,callback:s,error:a,...e})})}function fe(t,e="asset"){let n=encodeURIComponent(t);return navigator.userAgent.includes("Windows")?`https://${e}.localhost/${n}`:`${e}://localhost/${n}`}async function i(t){return f("tauri",t)}async function _e(){return i({__tauriModule:"App",message:{cmd:"getAppVersion"}})}async function be(){return i({__tauriModule:"App",message:{cmd:"getAppName"}})}async function Pe(){return i({__tauriModule:"App",message:{cmd:"getTauriVersion"}})}async function we(){return i({__tauriModule:"App",message:{cmd:"show"}})}async function ve(){return i({__tauriModule:"App",message:{cmd:"hide"}})}var U={};d(U,{getMatches:()=>Me});async function Me(){return i({__tauriModule:"Cli",message:{cmd:"cliMatches"}})}var I={};d(I,{readText:()=>Oe,writeText:()=>Te});async function Te(t){return i({__tauriModule:"Clipboard",message:{cmd:"writeText",data:t}})}async function Oe(){return i({__tauriModule:"Clipboard",message:{cmd:"readText",data:null}})}var N={};d(N,{ask:()=>Ce,confirm:()=>De,message:()=>Ae,open:()=>Fe,save:()=>Ee});async function Fe(t={}){return typeof t=="object"&&Object.freeze(t),i({__tauriModule:"Dialog",message:{cmd:"openDialog",options:t}})}async function Ee(t={}){return typeof t=="object"&&Object.freeze(t),i({__tauriModule:"Dialog",message:{cmd:"saveDialog",options:t}})}async function Ae(t,e){let n=typeof e=="string"?{title:e}:e;return i({__tauriModule:"Dialog",message:{cmd:"messageDialog",message:t.toString(),title:n?.title?.toString(),type:n?.type}})}async function Ce(t,e){let n=typeof e=="string"?{title:e}:e;return i({__tauriModule:"Dialog",message:{cmd:"askDialog",message:t.toString(),title:n?.title?.toString(),type:n?.type}})}async function De(t,e){let n=typeof e=="string"?{title:e}:e;return i({__tauriModule:"Dialog",message:{cmd:"confirmDialog",message:t.toString(),title:n?.title?.toString(),type:n?.type}})}var V={};d(V,{TauriEvent:()=>M,emit:()=>T,listen:()=>z,once:()=>H});async function ie(t,e){return i({__tauriModule:"Event",message:{cmd:"unlisten",event:t,eventId:e}})}async function w(t,e,n){await i({__tauriModule:"Event",message:{cmd:"emit",event:t,windowLabel:e,payload:n}})}async function _(t,e,n){return i({__tauriModule:"Event",message:{cmd:"listen",event:t,windowLabel:e,handler:c(n)}}).then(r=>async()=>ie(t,r))}async function v(t,e,n){return _(t,e,r=>{n(r),ie(t,r.id).catch(()=>{})})}var M=(u=>(u.WINDOW_RESIZED="tauri://resize",u.WINDOW_MOVED="tauri://move",u.WINDOW_CLOSE_REQUESTED="tauri://close-requested",u.WINDOW_CREATED="tauri://window-created",u.WINDOW_DESTROYED="tauri://destroyed",u.WINDOW_FOCUS="tauri://focus",u.WINDOW_BLUR="tauri://blur",u.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",u.WINDOW_THEME_CHANGED="tauri://theme-changed",u.WINDOW_FILE_DROP="tauri://file-drop",u.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",u.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",u.MENU="tauri://menu",u.CHECK_UPDATE="tauri://update",u.UPDATE_AVAILABLE="tauri://update-available",u.INSTALL_UPDATE="tauri://update-install",u.STATUS_UPDATE="tauri://update-status",u.DOWNLOAD_PROGRESS="tauri://update-download-progress",u))(M||{});async function z(t,e){return _(t,null,e)}async function H(t,e){return v(t,null,e)}async function T(t,e){return w(t,void 0,e)}var j={};d(j,{BaseDirectory:()=>O,Dir:()=>O,copyFile:()=>Ne,createDir:()=>Ue,exists:()=>Ve,readBinaryFile:()=>xe,readDir:()=>ke,readTextFile:()=>We,removeDir:()=>Ie,removeFile:()=>ze,renameFile:()=>He,writeBinaryFile:()=>Re,writeFile:()=>Le,writeTextFile:()=>Le});var O=(o=>(o[o.Audio=1]="Audio",o[o.Cache=2]="Cache",o[o.Config=3]="Config",o[o.Data=4]="Data",o[o.LocalData=5]="LocalData",o[o.Desktop=6]="Desktop",o[o.Document=7]="Document",o[o.Download=8]="Download",o[o.Executable=9]="Executable",o[o.Font=10]="Font",o[o.Home=11]="Home",o[o.Picture=12]="Picture",o[o.Public=13]="Public",o[o.Runtime=14]="Runtime",o[o.Template=15]="Template",o[o.Video=16]="Video",o[o.Resource=17]="Resource",o[o.App=18]="App",o[o.Log=19]="Log",o[o.Temp=20]="Temp",o[o.AppConfig=21]="AppConfig",o[o.AppData=22]="AppData",o[o.AppLocalData=23]="AppLocalData",o[o.AppCache=24]="AppCache",o[o.AppLog=25]="AppLog",o))(O||{});async function We(t,e={}){return i({__tauriModule:"Fs",message:{cmd:"readTextFile",path:t,options:e}})}async function xe(t,e={}){let n=await i({__tauriModule:"Fs",message:{cmd:"readFile",path:t,options:e}});return Uint8Array.from(n)}async function Le(t,e,n){typeof n=="object"&&Object.freeze(n),typeof t=="object"&&Object.freeze(t);let r={path:"",contents:""},s=n;return typeof t=="string"?r.path=t:(r.path=t.path,r.contents=t.contents),typeof e=="string"?r.contents=e??"":s=e,i({__tauriModule:"Fs",message:{cmd:"writeFile",path:r.path,contents:Array.from(new TextEncoder().encode(r.contents)),options:s}})}async function Re(t,e,n){typeof n=="object"&&Object.freeze(n),typeof t=="object"&&Object.freeze(t);let r={path:"",contents:[]},s=n;return typeof t=="string"?r.path=t:(r.path=t.path,r.contents=t.contents),e&&"dir"in e?s=e:typeof t=="string"&&(r.contents=e??[]),i({__tauriModule:"Fs",message:{cmd:"writeFile",path:r.path,contents:Array.from(r.contents instanceof ArrayBuffer?new Uint8Array(r.contents):r.contents),options:s}})}async function ke(t,e={}){return i({__tauriModule:"Fs",message:{cmd:"readDir",path:t,options:e}})}async function Ue(t,e={}){return i({__tauriModule:"Fs",message:{cmd:"createDir",path:t,options:e}})}async function Ie(t,e={}){return i({__tauriModule:"Fs",message:{cmd:"removeDir",path:t,options:e}})}async function Ne(t,e,n={}){return i({__tauriModule:"Fs",message:{cmd:"copyFile",source:t,destination:e,options:n}})}async function ze(t,e={}){return i({__tauriModule:"Fs",message:{cmd:"removeFile",path:t,options:e}})}async function He(t,e,n={}){return i({__tauriModule:"Fs",message:{cmd:"renameFile",oldPath:t,newPath:e,options:n}})}async function Ve(t,e={}){return i({__tauriModule:"Fs",message:{cmd:"exists",path:t,options:e}})}var q={};d(q,{isRegistered:()=>Ge,register:()=>je,registerAll:()=>qe,unregister:()=>$e,unregisterAll:()=>Je});async function je(t,e){return i({__tauriModule:"GlobalShortcut",message:{cmd:"register",shortcut:t,handler:c(e)}})}async function qe(t,e){return i({__tauriModule:"GlobalShortcut",message:{cmd:"registerAll",shortcuts:t,handler:c(e)}})}async function Ge(t){return i({__tauriModule:"GlobalShortcut",message:{cmd:"isRegistered",shortcut:t}})}async function $e(t){return i({__tauriModule:"GlobalShortcut",message:{cmd:"unregister",shortcut:t}})}async function Je(){return i({__tauriModule:"GlobalShortcut",message:{cmd:"unregisterAll"}})}var $={};d($,{Body:()=>p,Client:()=>E,Response:()=>F,ResponseType:()=>re,fetch:()=>Ke,getClient:()=>se});var re=(r=>(r[r.JSON=1]="JSON",r[r.Text=2]="Text",r[r.Binary=3]="Binary",r))(re||{}),p=class{constructor(e,n){this.type=e,this.payload=n}static form(e){let n={},r=(s,a)=>{if(a!==null){let l;typeof a=="string"?l=a:a instanceof Uint8Array||Array.isArray(a)?l=Array.from(a):a instanceof File?l={file:a.name,mime:a.type,fileName:a.name}:typeof a.file=="string"?l={file:a.file,mime:a.mime,fileName:a.fileName}:l={file:Array.from(a.file),mime:a.mime,fileName:a.fileName},n[String(s)]=l}};if(e instanceof FormData)for(let[s,a]of e)r(s,a);else for(let[s,a]of Object.entries(e))r(s,a);return new p("Form",n)}static json(e){return new p("Json",e)}static text(e){return new p("Text",e)}static bytes(e){return new p("Bytes",Array.from(e instanceof ArrayBuffer?new Uint8Array(e):e))}},F=class{constructor(e){this.url=e.url,this.status=e.status,this.ok=this.status>=200&&this.status<300,this.headers=e.headers,this.rawHeaders=e.rawHeaders,this.data=e.data}},E=class{constructor(e){this.id=e}async drop(){return i({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}})}async request(e){let n=!e.responseType||e.responseType===1;return n&&(e.responseType=2),i({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:e}}).then(r=>{let s=new F(r);if(n){try{s.data=JSON.parse(s.data)}catch(a){if(s.ok&&s.data==="")s.data={};else if(s.ok)throw Error(`Failed to parse response \`${s.data}\` as JSON: ${a}; - try setting the \`responseType\` option to \`ResponseType.Text\` or \`ResponseType.Binary\` if the API does not return a JSON response.`)}return s}return s})}async get(e,n){return this.request({method:"GET",url:e,...n})}async post(e,n,r){return this.request({method:"POST",url:e,body:n,...r})}async put(e,n,r){return this.request({method:"PUT",url:e,body:n,...r})}async patch(e,n){return this.request({method:"PATCH",url:e,...n})}async delete(e,n){return this.request({method:"DELETE",url:e,...n})}};async function se(t){return i({__tauriModule:"Http",message:{cmd:"createClient",options:t}}).then(e=>new E(e))}var G=null;async function Ke(t,e){return G===null&&(G=await se()),G.request({url:t,method:e?.method??"GET",...e})}var J={};d(J,{isPermissionGranted:()=>Qe,requestPermission:()=>Ze,sendNotification:()=>Ye});async function Qe(){return window.Notification.permission!=="default"?Promise.resolve(window.Notification.permission==="granted"):i({__tauriModule:"Notification",message:{cmd:"isNotificationPermissionGranted"}})}async function Ze(){return window.Notification.requestPermission()}function Ye(t){typeof t=="string"?new window.Notification(t):new window.Notification(t.title,t)}var K={};d(K,{BaseDirectory:()=>O,appCacheDir:()=>tt,appConfigDir:()=>ae,appDataDir:()=>Be,appDir:()=>Xe,appLocalDataDir:()=>et,appLogDir:()=>oe,audioDir:()=>nt,basename:()=>At,cacheDir:()=>it,configDir:()=>rt,dataDir:()=>st,delimiter:()=>vt,desktopDir:()=>at,dirname:()=>Ft,documentDir:()=>ot,downloadDir:()=>lt,executableDir:()=>ut,extname:()=>Et,fontDir:()=>dt,homeDir:()=>ct,isAbsolute:()=>Ct,join:()=>Ot,localDataDir:()=>mt,logDir:()=>Pt,normalize:()=>Tt,pictureDir:()=>pt,publicDir:()=>gt,resolve:()=>Mt,resolveResource:()=>yt,resourceDir:()=>ht,runtimeDir:()=>ft,sep:()=>wt,templateDir:()=>_t,videoDir:()=>bt});function b(){return navigator.appVersion.includes("Win")}async function Xe(){return ae()}async function ae(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:21}})}async function Be(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:22}})}async function et(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:23}})}async function tt(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:24}})}async function nt(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:1}})}async function it(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:2}})}async function rt(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:3}})}async function st(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:4}})}async function at(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:6}})}async function ot(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:7}})}async function lt(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:8}})}async function ut(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:9}})}async function dt(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:10}})}async function ct(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:11}})}async function mt(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:5}})}async function pt(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:12}})}async function gt(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:13}})}async function ht(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:17}})}async function yt(t){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:t,directory:17}})}async function ft(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:14}})}async function _t(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:15}})}async function bt(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:16}})}async function Pt(){return oe()}async function oe(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:25}})}var wt=b()?"\\":"/",vt=b()?";":":";async function Mt(...t){return i({__tauriModule:"Path",message:{cmd:"resolve",paths:t}})}async function Tt(t){return i({__tauriModule:"Path",message:{cmd:"normalize",path:t}})}async function Ot(...t){return i({__tauriModule:"Path",message:{cmd:"join",paths:t}})}async function Ft(t){return i({__tauriModule:"Path",message:{cmd:"dirname",path:t}})}async function Et(t){return i({__tauriModule:"Path",message:{cmd:"extname",path:t}})}async function At(t,e){return i({__tauriModule:"Path",message:{cmd:"basename",path:t,ext:e}})}async function Ct(t){return i({__tauriModule:"Path",message:{cmd:"isAbsolute",path:t}})}var Q={};d(Q,{exit:()=>Dt,relaunch:()=>St});async function Dt(t=0){return i({__tauriModule:"Process",message:{cmd:"exit",exitCode:t}})}async function St(){return i({__tauriModule:"Process",message:{cmd:"relaunch"}})}var Z={};d(Z,{Child:()=>A,Command:()=>P,EventEmitter:()=>g,open:()=>xt});async function Wt(t,e,n=[],r){return typeof n=="object"&&Object.freeze(n),i({__tauriModule:"Shell",message:{cmd:"execute",program:e,args:n,options:r,onEventFn:c(t)}})}var g=class{constructor(){this.eventListeners=Object.create(null)}addListener(e,n){return this.on(e,n)}removeListener(e,n){return this.off(e,n)}on(e,n){return e in this.eventListeners?this.eventListeners[e].push(n):this.eventListeners[e]=[n],this}once(e,n){let r=(...s)=>{this.removeListener(e,r),n(...s)};return this.addListener(e,r)}off(e,n){return e in this.eventListeners&&(this.eventListeners[e]=this.eventListeners[e].filter(r=>r!==n)),this}removeAllListeners(e){return e?delete this.eventListeners[e]:this.eventListeners=Object.create(null),this}emit(e,...n){if(e in this.eventListeners){let r=this.eventListeners[e];for(let s of r)s(...n);return!0}return!1}listenerCount(e){return e in this.eventListeners?this.eventListeners[e].length:0}prependListener(e,n){return e in this.eventListeners?this.eventListeners[e].unshift(n):this.eventListeners[e]=[n],this}prependOnceListener(e,n){let r=(...s)=>{this.removeListener(e,r),n(...s)};return this.prependListener(e,r)}},A=class{constructor(e){this.pid=e}async write(e){return i({__tauriModule:"Shell",message:{cmd:"stdinWrite",pid:this.pid,buffer:typeof e=="string"?e:Array.from(e)}})}async kill(){return i({__tauriModule:"Shell",message:{cmd:"killChild",pid:this.pid}})}},P=class extends g{constructor(n,r=[],s){super();this.stdout=new g;this.stderr=new g;this.program=n,this.args=typeof r=="string"?[r]:r,this.options=s??{}}static sidecar(n,r=[],s){let a=new P(n,r,s);return a.options.sidecar=!0,a}async spawn(){return Wt(n=>{switch(n.event){case"Error":this.emit("error",n.payload);break;case"Terminated":this.emit("close",n.payload);break;case"Stdout":this.stdout.emit("data",n.payload);break;case"Stderr":this.stderr.emit("data",n.payload);break}},this.program,this.args,this.options).then(n=>new A(n))}async execute(){return new Promise((n,r)=>{this.on("error",r);let s=[],a=[];this.stdout.on("data",l=>{s.push(l)}),this.stderr.on("data",l=>{a.push(l)}),this.on("close",l=>{n({code:l.code,signal:l.signal,stdout:s.join(` +"use strict";var __TAURI_IIFE__=(()=>{var L=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var pe=Object.prototype.hasOwnProperty;var d=(n,e)=>{for(var t in e)L(n,t,{get:e[t],enumerable:!0})},ge=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of me(e))!pe.call(n,s)&&s!==t&&L(n,s,{get:()=>e[s],enumerable:!(r=ce(e,s))||r.enumerable});return n};var he=n=>ge(L({},"__esModule",{value:!0}),n);var Jt={};d(Jt,{app:()=>k,cli:()=>U,clipboard:()=>I,dialog:()=>z,event:()=>V,fs:()=>j,globalShortcut:()=>q,http:()=>$,invoke:()=>$t,notification:()=>J,os:()=>ne,path:()=>K,process:()=>Q,shell:()=>Y,tauri:()=>R,updater:()=>X,window:()=>te});var k={};d(k,{getName:()=>_e,getTauriVersion:()=>Pe,getVersion:()=>be,hide:()=>ve,show:()=>we});var R={};d(R,{convertFileSrc:()=>fe,invoke:()=>f,transformCallback:()=>c});function ye(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function c(n,e=!1){let t=ye(),r=`_${t}`;return Object.defineProperty(window,r,{value:s=>(e&&Reflect.deleteProperty(window,r),n?.(s)),writable:!1,configurable:!0}),t}async function f(n,e={}){return new Promise((t,r)=>{let s=c(l=>{t(l),Reflect.deleteProperty(window,`_${a}`)},!0),a=c(l=>{r(l),Reflect.deleteProperty(window,`_${s}`)},!0);window.__TAURI_IPC__({cmd:n,callback:s,error:a,...e})})}function fe(n,e="asset"){let t=encodeURIComponent(n);return navigator.userAgent.includes("Windows")?`https://${e}.localhost/${t}`:`${e}://localhost/${t}`}async function i(n){return f("tauri",n)}async function be(){return i({__tauriModule:"App",message:{cmd:"getAppVersion"}})}async function _e(){return i({__tauriModule:"App",message:{cmd:"getAppName"}})}async function Pe(){return i({__tauriModule:"App",message:{cmd:"getTauriVersion"}})}async function we(){return i({__tauriModule:"App",message:{cmd:"show"}})}async function ve(){return i({__tauriModule:"App",message:{cmd:"hide"}})}var U={};d(U,{getMatches:()=>Me});async function Me(){return i({__tauriModule:"Cli",message:{cmd:"cliMatches"}})}var I={};d(I,{readText:()=>Oe,writeText:()=>Te});async function Te(n){return i({__tauriModule:"Clipboard",message:{cmd:"writeText",data:n}})}async function Oe(){return i({__tauriModule:"Clipboard",message:{cmd:"readText",data:null}})}var z={};d(z,{ask:()=>Ae,confirm:()=>De,message:()=>Ce,open:()=>Fe,save:()=>Ee});async function Fe(n={}){return typeof n=="object"&&Object.freeze(n),i({__tauriModule:"Dialog",message:{cmd:"openDialog",options:n}})}async function Ee(n={}){return typeof n=="object"&&Object.freeze(n),i({__tauriModule:"Dialog",message:{cmd:"saveDialog",options:n}})}async function Ce(n,e){let t=typeof e=="string"?{title:e}:e;return i({__tauriModule:"Dialog",message:{cmd:"messageDialog",message:n.toString(),title:t?.title?.toString(),type:t?.type,buttonLabel:t?.okLabel?.toString()}})}async function Ae(n,e){let t=typeof e=="string"?{title:e}:e;return i({__tauriModule:"Dialog",message:{cmd:"askDialog",message:n.toString(),title:t?.title?.toString(),type:t?.type,buttonLabels:[t?.okLabel?.toString()??"Yes",t?.cancelLabel?.toString()??"No"]}})}async function De(n,e){let t=typeof e=="string"?{title:e}:e;return i({__tauriModule:"Dialog",message:{cmd:"confirmDialog",message:n.toString(),title:t?.title?.toString(),type:t?.type,buttonLabels:[t?.okLabel?.toString()??"Ok",t?.cancelLabel?.toString()??"Cancel"]}})}var V={};d(V,{TauriEvent:()=>M,emit:()=>T,listen:()=>N,once:()=>H});async function ie(n,e){return i({__tauriModule:"Event",message:{cmd:"unlisten",event:n,eventId:e}})}async function w(n,e,t){await i({__tauriModule:"Event",message:{cmd:"emit",event:n,windowLabel:e,payload:t}})}async function b(n,e,t){return i({__tauriModule:"Event",message:{cmd:"listen",event:n,windowLabel:e,handler:c(t)}}).then(r=>async()=>ie(n,r))}async function v(n,e,t){return b(n,e,r=>{t(r),ie(n,r.id).catch(()=>{})})}var M=(u=>(u.WINDOW_RESIZED="tauri://resize",u.WINDOW_MOVED="tauri://move",u.WINDOW_CLOSE_REQUESTED="tauri://close-requested",u.WINDOW_CREATED="tauri://window-created",u.WINDOW_DESTROYED="tauri://destroyed",u.WINDOW_FOCUS="tauri://focus",u.WINDOW_BLUR="tauri://blur",u.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",u.WINDOW_THEME_CHANGED="tauri://theme-changed",u.WINDOW_FILE_DROP="tauri://file-drop",u.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",u.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",u.MENU="tauri://menu",u.CHECK_UPDATE="tauri://update",u.UPDATE_AVAILABLE="tauri://update-available",u.INSTALL_UPDATE="tauri://update-install",u.STATUS_UPDATE="tauri://update-status",u.DOWNLOAD_PROGRESS="tauri://update-download-progress",u))(M||{});async function N(n,e){return b(n,null,e)}async function H(n,e){return v(n,null,e)}async function T(n,e){return w(n,void 0,e)}var j={};d(j,{BaseDirectory:()=>O,Dir:()=>O,copyFile:()=>ze,createDir:()=>Ue,exists:()=>Ve,readBinaryFile:()=>xe,readDir:()=>ke,readTextFile:()=>We,removeDir:()=>Ie,removeFile:()=>Ne,renameFile:()=>He,writeBinaryFile:()=>Re,writeFile:()=>Le,writeTextFile:()=>Le});var O=(o=>(o[o.Audio=1]="Audio",o[o.Cache=2]="Cache",o[o.Config=3]="Config",o[o.Data=4]="Data",o[o.LocalData=5]="LocalData",o[o.Desktop=6]="Desktop",o[o.Document=7]="Document",o[o.Download=8]="Download",o[o.Executable=9]="Executable",o[o.Font=10]="Font",o[o.Home=11]="Home",o[o.Picture=12]="Picture",o[o.Public=13]="Public",o[o.Runtime=14]="Runtime",o[o.Template=15]="Template",o[o.Video=16]="Video",o[o.Resource=17]="Resource",o[o.App=18]="App",o[o.Log=19]="Log",o[o.Temp=20]="Temp",o[o.AppConfig=21]="AppConfig",o[o.AppData=22]="AppData",o[o.AppLocalData=23]="AppLocalData",o[o.AppCache=24]="AppCache",o[o.AppLog=25]="AppLog",o))(O||{});async function We(n,e={}){return i({__tauriModule:"Fs",message:{cmd:"readTextFile",path:n,options:e}})}async function xe(n,e={}){let t=await i({__tauriModule:"Fs",message:{cmd:"readFile",path:n,options:e}});return Uint8Array.from(t)}async function Le(n,e,t){typeof t=="object"&&Object.freeze(t),typeof n=="object"&&Object.freeze(n);let r={path:"",contents:""},s=t;return typeof n=="string"?r.path=n:(r.path=n.path,r.contents=n.contents),typeof e=="string"?r.contents=e??"":s=e,i({__tauriModule:"Fs",message:{cmd:"writeFile",path:r.path,contents:Array.from(new TextEncoder().encode(r.contents)),options:s}})}async function Re(n,e,t){typeof t=="object"&&Object.freeze(t),typeof n=="object"&&Object.freeze(n);let r={path:"",contents:[]},s=t;return typeof n=="string"?r.path=n:(r.path=n.path,r.contents=n.contents),e&&"dir"in e?s=e:typeof n=="string"&&(r.contents=e??[]),i({__tauriModule:"Fs",message:{cmd:"writeFile",path:r.path,contents:Array.from(r.contents instanceof ArrayBuffer?new Uint8Array(r.contents):r.contents),options:s}})}async function ke(n,e={}){return i({__tauriModule:"Fs",message:{cmd:"readDir",path:n,options:e}})}async function Ue(n,e={}){return i({__tauriModule:"Fs",message:{cmd:"createDir",path:n,options:e}})}async function Ie(n,e={}){return i({__tauriModule:"Fs",message:{cmd:"removeDir",path:n,options:e}})}async function ze(n,e,t={}){return i({__tauriModule:"Fs",message:{cmd:"copyFile",source:n,destination:e,options:t}})}async function Ne(n,e={}){return i({__tauriModule:"Fs",message:{cmd:"removeFile",path:n,options:e}})}async function He(n,e,t={}){return i({__tauriModule:"Fs",message:{cmd:"renameFile",oldPath:n,newPath:e,options:t}})}async function Ve(n,e={}){return i({__tauriModule:"Fs",message:{cmd:"exists",path:n,options:e}})}var q={};d(q,{isRegistered:()=>Ge,register:()=>je,registerAll:()=>qe,unregister:()=>$e,unregisterAll:()=>Je});async function je(n,e){return i({__tauriModule:"GlobalShortcut",message:{cmd:"register",shortcut:n,handler:c(e)}})}async function qe(n,e){return i({__tauriModule:"GlobalShortcut",message:{cmd:"registerAll",shortcuts:n,handler:c(e)}})}async function Ge(n){return i({__tauriModule:"GlobalShortcut",message:{cmd:"isRegistered",shortcut:n}})}async function $e(n){return i({__tauriModule:"GlobalShortcut",message:{cmd:"unregister",shortcut:n}})}async function Je(){return i({__tauriModule:"GlobalShortcut",message:{cmd:"unregisterAll"}})}var $={};d($,{Body:()=>p,Client:()=>E,Response:()=>F,ResponseType:()=>re,fetch:()=>Ke,getClient:()=>se});var re=(r=>(r[r.JSON=1]="JSON",r[r.Text=2]="Text",r[r.Binary=3]="Binary",r))(re||{}),p=class{constructor(e,t){this.type=e,this.payload=t}static form(e){let t={},r=(s,a)=>{if(a!==null){let l;typeof a=="string"?l=a:a instanceof Uint8Array||Array.isArray(a)?l=Array.from(a):a instanceof File?l={file:a.name,mime:a.type,fileName:a.name}:typeof a.file=="string"?l={file:a.file,mime:a.mime,fileName:a.fileName}:l={file:Array.from(a.file),mime:a.mime,fileName:a.fileName},t[String(s)]=l}};if(e instanceof FormData)for(let[s,a]of e)r(s,a);else for(let[s,a]of Object.entries(e))r(s,a);return new p("Form",t)}static json(e){return new p("Json",e)}static text(e){return new p("Text",e)}static bytes(e){return new p("Bytes",Array.from(e instanceof ArrayBuffer?new Uint8Array(e):e))}},F=class{constructor(e){this.url=e.url,this.status=e.status,this.ok=this.status>=200&&this.status<300,this.headers=e.headers,this.rawHeaders=e.rawHeaders,this.data=e.data}},E=class{constructor(e){this.id=e}async drop(){return i({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}})}async request(e){let t=!e.responseType||e.responseType===1;return t&&(e.responseType=2),i({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:e}}).then(r=>{let s=new F(r);if(t){try{s.data=JSON.parse(s.data)}catch(a){if(s.ok&&s.data==="")s.data={};else if(s.ok)throw Error(`Failed to parse response \`${s.data}\` as JSON: ${a}; + try setting the \`responseType\` option to \`ResponseType.Text\` or \`ResponseType.Binary\` if the API does not return a JSON response.`)}return s}return s})}async get(e,t){return this.request({method:"GET",url:e,...t})}async post(e,t,r){return this.request({method:"POST",url:e,body:t,...r})}async put(e,t,r){return this.request({method:"PUT",url:e,body:t,...r})}async patch(e,t){return this.request({method:"PATCH",url:e,...t})}async delete(e,t){return this.request({method:"DELETE",url:e,...t})}};async function se(n){return i({__tauriModule:"Http",message:{cmd:"createClient",options:n}}).then(e=>new E(e))}var G=null;async function Ke(n,e){return G===null&&(G=await se()),G.request({url:n,method:e?.method??"GET",...e})}var J={};d(J,{isPermissionGranted:()=>Qe,requestPermission:()=>Ye,sendNotification:()=>Ze});async function Qe(){return window.Notification.permission!=="default"?Promise.resolve(window.Notification.permission==="granted"):i({__tauriModule:"Notification",message:{cmd:"isNotificationPermissionGranted"}})}async function Ye(){return window.Notification.requestPermission()}function Ze(n){typeof n=="string"?new window.Notification(n):new window.Notification(n.title,n)}var K={};d(K,{BaseDirectory:()=>O,appCacheDir:()=>tt,appConfigDir:()=>ae,appDataDir:()=>Be,appDir:()=>Xe,appLocalDataDir:()=>et,appLogDir:()=>oe,audioDir:()=>nt,basename:()=>Ct,cacheDir:()=>it,configDir:()=>rt,dataDir:()=>st,delimiter:()=>vt,desktopDir:()=>at,dirname:()=>Ft,documentDir:()=>ot,downloadDir:()=>lt,executableDir:()=>ut,extname:()=>Et,fontDir:()=>dt,homeDir:()=>ct,isAbsolute:()=>At,join:()=>Ot,localDataDir:()=>mt,logDir:()=>Pt,normalize:()=>Tt,pictureDir:()=>pt,publicDir:()=>gt,resolve:()=>Mt,resolveResource:()=>yt,resourceDir:()=>ht,runtimeDir:()=>ft,sep:()=>wt,templateDir:()=>bt,videoDir:()=>_t});function _(){return navigator.appVersion.includes("Win")}async function Xe(){return ae()}async function ae(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:21}})}async function Be(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:22}})}async function et(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:23}})}async function tt(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:24}})}async function nt(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:1}})}async function it(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:2}})}async function rt(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:3}})}async function st(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:4}})}async function at(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:6}})}async function ot(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:7}})}async function lt(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:8}})}async function ut(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:9}})}async function dt(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:10}})}async function ct(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:11}})}async function mt(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:5}})}async function pt(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:12}})}async function gt(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:13}})}async function ht(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:17}})}async function yt(n){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:n,directory:17}})}async function ft(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:14}})}async function bt(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:15}})}async function _t(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:16}})}async function Pt(){return oe()}async function oe(){return i({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:25}})}var wt=_()?"\\":"/",vt=_()?";":":";async function Mt(...n){return i({__tauriModule:"Path",message:{cmd:"resolve",paths:n}})}async function Tt(n){return i({__tauriModule:"Path",message:{cmd:"normalize",path:n}})}async function Ot(...n){return i({__tauriModule:"Path",message:{cmd:"join",paths:n}})}async function Ft(n){return i({__tauriModule:"Path",message:{cmd:"dirname",path:n}})}async function Et(n){return i({__tauriModule:"Path",message:{cmd:"extname",path:n}})}async function Ct(n,e){return i({__tauriModule:"Path",message:{cmd:"basename",path:n,ext:e}})}async function At(n){return i({__tauriModule:"Path",message:{cmd:"isAbsolute",path:n}})}var Q={};d(Q,{exit:()=>Dt,relaunch:()=>St});async function Dt(n=0){return i({__tauriModule:"Process",message:{cmd:"exit",exitCode:n}})}async function St(){return i({__tauriModule:"Process",message:{cmd:"relaunch"}})}var Y={};d(Y,{Child:()=>C,Command:()=>P,EventEmitter:()=>g,open:()=>xt});async function Wt(n,e,t=[],r){return typeof t=="object"&&Object.freeze(t),i({__tauriModule:"Shell",message:{cmd:"execute",program:e,args:t,options:r,onEventFn:c(n)}})}var g=class{constructor(){this.eventListeners=Object.create(null)}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}on(e,t){return e in this.eventListeners?this.eventListeners[e].push(t):this.eventListeners[e]=[t],this}once(e,t){let r=(...s)=>{this.removeListener(e,r),t(...s)};return this.addListener(e,r)}off(e,t){return e in this.eventListeners&&(this.eventListeners[e]=this.eventListeners[e].filter(r=>r!==t)),this}removeAllListeners(e){return e?delete this.eventListeners[e]:this.eventListeners=Object.create(null),this}emit(e,...t){if(e in this.eventListeners){let r=this.eventListeners[e];for(let s of r)s(...t);return!0}return!1}listenerCount(e){return e in this.eventListeners?this.eventListeners[e].length:0}prependListener(e,t){return e in this.eventListeners?this.eventListeners[e].unshift(t):this.eventListeners[e]=[t],this}prependOnceListener(e,t){let r=(...s)=>{this.removeListener(e,r),t(...s)};return this.prependListener(e,r)}},C=class{constructor(e){this.pid=e}async write(e){return i({__tauriModule:"Shell",message:{cmd:"stdinWrite",pid:this.pid,buffer:typeof e=="string"?e:Array.from(e)}})}async kill(){return i({__tauriModule:"Shell",message:{cmd:"killChild",pid:this.pid}})}},P=class extends g{constructor(t,r=[],s){super();this.stdout=new g;this.stderr=new g;this.program=t,this.args=typeof r=="string"?[r]:r,this.options=s??{}}static sidecar(t,r=[],s){let a=new P(t,r,s);return a.options.sidecar=!0,a}async spawn(){return Wt(t=>{switch(t.event){case"Error":this.emit("error",t.payload);break;case"Terminated":this.emit("close",t.payload);break;case"Stdout":this.stdout.emit("data",t.payload);break;case"Stderr":this.stderr.emit("data",t.payload);break}},this.program,this.args,this.options).then(t=>new C(t))}async execute(){return new Promise((t,r)=>{this.on("error",r);let s=[],a=[];this.stdout.on("data",l=>{s.push(l)}),this.stderr.on("data",l=>{a.push(l)}),this.on("close",l=>{t({code:l.code,signal:l.signal,stdout:s.join(` `),stderr:a.join(` -`)})}),this.spawn().catch(r)})}};async function xt(t,e){return i({__tauriModule:"Shell",message:{cmd:"open",path:t,with:e}})}var X={};d(X,{checkUpdate:()=>Rt,installUpdate:()=>Lt,onUpdaterEvent:()=>Y});async function Y(t){return z("tauri://update-status",e=>{t(e?.payload)})}async function Lt(){let t;function e(){t&&t(),t=void 0}return new Promise((n,r)=>{function s(a){if(a.error)return e(),r(a.error);if(a.status==="DONE")return e(),n()}Y(s).then(a=>{t=a}).catch(a=>{throw e(),a}),T("tauri://update-install").catch(a=>{throw e(),a})})}async function Rt(){let t;function e(){t&&t(),t=void 0}return new Promise((n,r)=>{function s(l){return e(),n({manifest:l,shouldUpdate:!0})}function a(l){if(l.error)return e(),r(l.error);if(l.status==="UPTODATE")return e(),n({shouldUpdate:!1})}H("tauri://update-available",l=>{s(l?.payload)}).catch(l=>{throw e(),l}),Y(a).then(l=>{t=l}).catch(l=>{throw e(),l}),T("tauri://update").catch(l=>{throw e(),l})})}var te={};d(te,{CloseRequestedEvent:()=>x,LogicalPosition:()=>D,LogicalSize:()=>C,PhysicalPosition:()=>y,PhysicalSize:()=>h,UserAttentionType:()=>ue,WebviewWindow:()=>m,WebviewWindowHandle:()=>S,WindowManager:()=>W,appWindow:()=>B,availableMonitors:()=>Nt,currentMonitor:()=>Ut,getAll:()=>de,getCurrent:()=>kt,primaryMonitor:()=>It});var C=class{constructor(e,n){this.type="Logical";this.width=e,this.height=n}},h=class{constructor(e,n){this.type="Physical";this.width=e,this.height=n}toLogical(e){return new C(this.width/e,this.height/e)}},D=class{constructor(e,n){this.type="Logical";this.x=e,this.y=n}},y=class{constructor(e,n){this.type="Physical";this.x=e,this.y=n}toLogical(e){return new D(this.x/e,this.y/e)}},ue=(n=>(n[n.Critical=1]="Critical",n[n.Informational=2]="Informational",n))(ue||{});function kt(){return new m(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})}function de(){return window.__TAURI_METADATA__.__windows.map(t=>new m(t.label,{skip:!0}))}var le=["tauri://created","tauri://error"],S=class{constructor(e){this.label=e,this.listeners=Object.create(null)}async listen(e,n){return this._handleTauriEvent(e,n)?Promise.resolve(()=>{let r=this.listeners[e];r.splice(r.indexOf(n),1)}):_(e,this.label,n)}async once(e,n){return this._handleTauriEvent(e,n)?Promise.resolve(()=>{let r=this.listeners[e];r.splice(r.indexOf(n),1)}):v(e,this.label,n)}async emit(e,n){if(le.includes(e)){for(let r of this.listeners[e]||[])r({event:e,id:-1,windowLabel:this.label,payload:n});return Promise.resolve()}return w(e,this.label,n)}_handleTauriEvent(e,n){return le.includes(e)?(e in this.listeners?this.listeners[e].push(n):this.listeners[e]=[n],!0):!1}},W=class extends S{async scaleFactor(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"scaleFactor"}}}})}async innerPosition(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"innerPosition"}}}}).then(({x:e,y:n})=>new y(e,n))}async outerPosition(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"outerPosition"}}}}).then(({x:e,y:n})=>new y(e,n))}async innerSize(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"innerSize"}}}}).then(({width:e,height:n})=>new h(e,n))}async outerSize(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"outerSize"}}}}).then(({width:e,height:n})=>new h(e,n))}async isFullscreen(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isFullscreen"}}}})}async isMaximized(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isMaximized"}}}})}async isDecorated(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isDecorated"}}}})}async isResizable(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isResizable"}}}})}async isVisible(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isVisible"}}}})}async theme(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"theme"}}}})}async center(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"center"}}}})}async requestUserAttention(e){let n=null;return e&&(e===1?n={type:"Critical"}:n={type:"Informational"}),i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"requestUserAttention",payload:n}}}})}async setResizable(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setResizable",payload:e}}}})}async setTitle(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setTitle",payload:e}}}})}async maximize(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"maximize"}}}})}async unmaximize(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"unmaximize"}}}})}async toggleMaximize(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"toggleMaximize"}}}})}async minimize(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"minimize"}}}})}async unminimize(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"unminimize"}}}})}async show(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"show"}}}})}async hide(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"hide"}}}})}async close(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"close"}}}})}async setDecorations(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setDecorations",payload:e}}}})}async setShadow(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setShadow",payload:e}}}})}async setAlwaysOnTop(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setAlwaysOnTop",payload:e}}}})}async setSize(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setSize",payload:{type:e.type,data:{width:e.width,height:e.height}}}}}})}async setMinSize(e){if(e&&e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setMinSize",payload:e?{type:e.type,data:{width:e.width,height:e.height}}:null}}}})}async setMaxSize(e){if(e&&e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setMaxSize",payload:e?{type:e.type,data:{width:e.width,height:e.height}}:null}}}})}async setPosition(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setPosition",payload:{type:e.type,data:{x:e.x,y:e.y}}}}}})}async setFullscreen(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setFullscreen",payload:e}}}})}async setFocus(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setFocus"}}}})}async setIcon(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setIcon",payload:{icon:typeof e=="string"?e:Array.from(e)}}}}})}async setSkipTaskbar(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setSkipTaskbar",payload:e}}}})}async setCursorGrab(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorGrab",payload:e}}}})}async setCursorVisible(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorVisible",payload:e}}}})}async setCursorIcon(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorIcon",payload:e}}}})}async setCursorPosition(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorPosition",payload:{type:e.type,data:{x:e.x,y:e.y}}}}}})}async setIgnoreCursorEvents(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setIgnoreCursorEvents",payload:e}}}})}async startDragging(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"startDragging"}}}})}async onResized(e){return this.listen("tauri://resize",e)}async onMoved(e){return this.listen("tauri://move",e)}async onCloseRequested(e){return this.listen("tauri://close-requested",n=>{let r=new x(n);Promise.resolve(e(r)).then(()=>{if(!r.isPreventDefault())return this.close()})})}async onFocusChanged(e){let n=await this.listen("tauri://focus",s=>{e({...s,payload:!0})}),r=await this.listen("tauri://blur",s=>{e({...s,payload:!1})});return()=>{n(),r()}}async onScaleChanged(e){return this.listen("tauri://scale-change",e)}async onMenuClicked(e){return this.listen("tauri://menu",e)}async onFileDropEvent(e){let n=await this.listen("tauri://file-drop",a=>{e({...a,payload:{type:"drop",paths:a.payload}})}),r=await this.listen("tauri://file-drop-hover",a=>{e({...a,payload:{type:"hover",paths:a.payload}})}),s=await this.listen("tauri://file-drop-cancelled",a=>{e({...a,payload:{type:"cancel"}})});return()=>{n(),r(),s()}}async onThemeChanged(e){return this.listen("tauri://theme-changed",e)}},x=class{constructor(e){this._preventDefault=!1;this.event=e.event,this.windowLabel=e.windowLabel,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}},m=class extends W{constructor(e,n={}){super(e),n?.skip||i({__tauriModule:"Window",message:{cmd:"createWebview",data:{options:{label:e,...n}}}}).then(async()=>this.emit("tauri://created")).catch(async r=>this.emit("tauri://error",r))}static getByLabel(e){return de().some(n=>n.label===e)?new m(e,{skip:!0}):null}},B;"__TAURI_METADATA__"in window?B=new m(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0}):(console.warn(`Could not find "window.__TAURI_METADATA__". The "appWindow" value will reference the "main" window label. -Note that this is not an issue if running this frontend on a browser instead of a Tauri window.`),B=new m("main",{skip:!0}));function ee(t){return t===null?null:{name:t.name,scaleFactor:t.scaleFactor,position:new y(t.position.x,t.position.y),size:new h(t.size.width,t.size.height)}}async function Ut(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"currentMonitor"}}}}).then(ee)}async function It(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"primaryMonitor"}}}}).then(ee)}async function Nt(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"availableMonitors"}}}}).then(t=>t.map(ee))}var ne={};d(ne,{EOL:()=>zt,arch:()=>qt,platform:()=>Ht,tempdir:()=>Gt,type:()=>jt,version:()=>Vt});var zt=b()?`\r +`)})}),this.spawn().catch(r)})}};async function xt(n,e){return i({__tauriModule:"Shell",message:{cmd:"open",path:n,with:e}})}var X={};d(X,{checkUpdate:()=>Rt,installUpdate:()=>Lt,onUpdaterEvent:()=>Z});async function Z(n){return N("tauri://update-status",e=>{n(e?.payload)})}async function Lt(){let n;function e(){n&&n(),n=void 0}return new Promise((t,r)=>{function s(a){if(a.error){e(),r(a.error);return}a.status==="DONE"&&(e(),t())}Z(s).then(a=>{n=a}).catch(a=>{throw e(),a}),T("tauri://update-install").catch(a=>{throw e(),a})})}async function Rt(){let n;function e(){n&&n(),n=void 0}return new Promise((t,r)=>{function s(l){e(),t({manifest:l,shouldUpdate:!0})}function a(l){if(l.error){e(),r(l.error);return}l.status==="UPTODATE"&&(e(),t({shouldUpdate:!1}))}H("tauri://update-available",l=>{s(l?.payload)}).catch(l=>{throw e(),l}),Z(a).then(l=>{n=l}).catch(l=>{throw e(),l}),T("tauri://update").catch(l=>{throw e(),l})})}var te={};d(te,{CloseRequestedEvent:()=>x,LogicalPosition:()=>D,LogicalSize:()=>A,PhysicalPosition:()=>y,PhysicalSize:()=>h,UserAttentionType:()=>ue,WebviewWindow:()=>m,WebviewWindowHandle:()=>S,WindowManager:()=>W,appWindow:()=>B,availableMonitors:()=>zt,currentMonitor:()=>Ut,getAll:()=>de,getCurrent:()=>kt,primaryMonitor:()=>It});var A=class{constructor(e,t){this.type="Logical";this.width=e,this.height=t}},h=class{constructor(e,t){this.type="Physical";this.width=e,this.height=t}toLogical(e){return new A(this.width/e,this.height/e)}},D=class{constructor(e,t){this.type="Logical";this.x=e,this.y=t}},y=class{constructor(e,t){this.type="Physical";this.x=e,this.y=t}toLogical(e){return new D(this.x/e,this.y/e)}},ue=(t=>(t[t.Critical=1]="Critical",t[t.Informational=2]="Informational",t))(ue||{});function kt(){return new m(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})}function de(){return window.__TAURI_METADATA__.__windows.map(n=>new m(n.label,{skip:!0}))}var le=["tauri://created","tauri://error"],S=class{constructor(e){this.label=e,this.listeners=Object.create(null)}async listen(e,t){return this._handleTauriEvent(e,t)?Promise.resolve(()=>{let r=this.listeners[e];r.splice(r.indexOf(t),1)}):b(e,this.label,t)}async once(e,t){return this._handleTauriEvent(e,t)?Promise.resolve(()=>{let r=this.listeners[e];r.splice(r.indexOf(t),1)}):v(e,this.label,t)}async emit(e,t){if(le.includes(e)){for(let r of this.listeners[e]||[])r({event:e,id:-1,windowLabel:this.label,payload:t});return Promise.resolve()}return w(e,this.label,t)}_handleTauriEvent(e,t){return le.includes(e)?(e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t],!0):!1}},W=class extends S{async scaleFactor(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"scaleFactor"}}}})}async innerPosition(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"innerPosition"}}}}).then(({x:e,y:t})=>new y(e,t))}async outerPosition(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"outerPosition"}}}}).then(({x:e,y:t})=>new y(e,t))}async innerSize(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"innerSize"}}}}).then(({width:e,height:t})=>new h(e,t))}async outerSize(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"outerSize"}}}}).then(({width:e,height:t})=>new h(e,t))}async isFullscreen(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isFullscreen"}}}})}async isMinimized(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isMinimized"}}}})}async isMaximized(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isMaximized"}}}})}async isDecorated(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isDecorated"}}}})}async isResizable(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isResizable"}}}})}async isVisible(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isVisible"}}}})}async title(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"title"}}}})}async theme(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"theme"}}}})}async center(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"center"}}}})}async requestUserAttention(e){let t=null;return e&&(e===1?t={type:"Critical"}:t={type:"Informational"}),i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"requestUserAttention",payload:t}}}})}async setResizable(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setResizable",payload:e}}}})}async setTitle(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setTitle",payload:e}}}})}async maximize(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"maximize"}}}})}async unmaximize(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"unmaximize"}}}})}async toggleMaximize(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"toggleMaximize"}}}})}async minimize(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"minimize"}}}})}async unminimize(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"unminimize"}}}})}async show(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"show"}}}})}async hide(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"hide"}}}})}async close(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"close"}}}})}async setDecorations(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setDecorations",payload:e}}}})}async setShadow(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setShadow",payload:e}}}})}async setAlwaysOnTop(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setAlwaysOnTop",payload:e}}}})}async setContentProtected(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setContentProtected",payload:e}}}})}async setSize(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setSize",payload:{type:e.type,data:{width:e.width,height:e.height}}}}}})}async setMinSize(e){if(e&&e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setMinSize",payload:e?{type:e.type,data:{width:e.width,height:e.height}}:null}}}})}async setMaxSize(e){if(e&&e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setMaxSize",payload:e?{type:e.type,data:{width:e.width,height:e.height}}:null}}}})}async setPosition(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setPosition",payload:{type:e.type,data:{x:e.x,y:e.y}}}}}})}async setFullscreen(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setFullscreen",payload:e}}}})}async setFocus(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setFocus"}}}})}async setIcon(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setIcon",payload:{icon:typeof e=="string"?e:Array.from(e)}}}}})}async setSkipTaskbar(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setSkipTaskbar",payload:e}}}})}async setCursorGrab(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorGrab",payload:e}}}})}async setCursorVisible(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorVisible",payload:e}}}})}async setCursorIcon(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorIcon",payload:e}}}})}async setCursorPosition(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorPosition",payload:{type:e.type,data:{x:e.x,y:e.y}}}}}})}async setIgnoreCursorEvents(e){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setIgnoreCursorEvents",payload:e}}}})}async startDragging(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"startDragging"}}}})}async onResized(e){return this.listen("tauri://resize",e)}async onMoved(e){return this.listen("tauri://move",e)}async onCloseRequested(e){return this.listen("tauri://close-requested",t=>{let r=new x(t);Promise.resolve(e(r)).then(()=>{if(!r.isPreventDefault())return this.close()})})}async onFocusChanged(e){let t=await this.listen("tauri://focus",s=>{e({...s,payload:!0})}),r=await this.listen("tauri://blur",s=>{e({...s,payload:!1})});return()=>{t(),r()}}async onScaleChanged(e){return this.listen("tauri://scale-change",e)}async onMenuClicked(e){return this.listen("tauri://menu",e)}async onFileDropEvent(e){let t=await this.listen("tauri://file-drop",a=>{e({...a,payload:{type:"drop",paths:a.payload}})}),r=await this.listen("tauri://file-drop-hover",a=>{e({...a,payload:{type:"hover",paths:a.payload}})}),s=await this.listen("tauri://file-drop-cancelled",a=>{e({...a,payload:{type:"cancel"}})});return()=>{t(),r(),s()}}async onThemeChanged(e){return this.listen("tauri://theme-changed",e)}},x=class{constructor(e){this._preventDefault=!1;this.event=e.event,this.windowLabel=e.windowLabel,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}},m=class extends W{constructor(e,t={}){super(e),t?.skip||i({__tauriModule:"Window",message:{cmd:"createWebview",data:{options:{label:e,...t}}}}).then(async()=>this.emit("tauri://created")).catch(async r=>this.emit("tauri://error",r))}static getByLabel(e){return de().some(t=>t.label===e)?new m(e,{skip:!0}):null}},B;"__TAURI_METADATA__"in window?B=new m(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0}):(console.warn(`Could not find "window.__TAURI_METADATA__". The "appWindow" value will reference the "main" window label. +Note that this is not an issue if running this frontend on a browser instead of a Tauri window.`),B=new m("main",{skip:!0}));function ee(n){return n===null?null:{name:n.name,scaleFactor:n.scaleFactor,position:new y(n.position.x,n.position.y),size:new h(n.size.width,n.size.height)}}async function Ut(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"currentMonitor"}}}}).then(ee)}async function It(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"primaryMonitor"}}}}).then(ee)}async function zt(){return i({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"availableMonitors"}}}}).then(n=>n.map(ee))}var ne={};d(ne,{EOL:()=>Nt,arch:()=>qt,platform:()=>Ht,tempdir:()=>Gt,type:()=>jt,version:()=>Vt});var Nt=_()?`\r `:` `;async function Ht(){return i({__tauriModule:"Os",message:{cmd:"platform"}})}async function Vt(){return i({__tauriModule:"Os",message:{cmd:"version"}})}async function jt(){return i({__tauriModule:"Os",message:{cmd:"osType"}})}async function qt(){return i({__tauriModule:"Os",message:{cmd:"arch"}})}async function Gt(){return i({__tauriModule:"Os",message:{cmd:"tempdir"}})}var $t=f;return he(Jt);})(); window.__TAURI__ = __TAURI_IIFE__ diff --git a/core/tauri/scripts/bundle.js b/core/tauri/scripts/bundle.js new file mode 100644 index 000000000..4a7da586b --- /dev/null +++ b/core/tauri/scripts/bundle.js @@ -0,0 +1 @@ +function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_setPrototypeOf(e,t)}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var r,n=_getPrototypeOf(e);if(t){var a=_getPrototypeOf(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return _possibleConstructorReturn(this,r)}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _getPrototypeOf(e){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_getPrototypeOf(e)}function _createForOfIteratorHelper(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){u=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(u)throw o}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),s=r.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),R(r),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;R(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:x(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),P(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;P(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:A(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}("object"===("undefined"==typeof module?"undefined":_typeof(module))?module.exports:{});try{regeneratorRuntime=t}catch(e){"object"===("undefined"==typeof globalThis?"undefined":_typeof(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}function r(e){for(var t=void 0,r=e[0],n=1;n1&&void 0!==arguments[1]&&arguments[1],a=n(),o="_".concat(a);return Object.defineProperty(window,o,{value:function(n){return t&&Reflect.deleteProperty(window,o),r([e,"optionalCall",function(e){return e(n)}])},writable:!1,configurable:!0}),a}function o(e){return i.apply(this,arguments)}function i(){return i=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",new Promise((function(e,n){var o=a((function(t){e(t),Reflect.deleteProperty(window,"_".concat(i))}),!0),i=a((function(e){n(e),Reflect.deleteProperty(window,"_".concat(o))}),!0);window.__TAURI_IPC__(_objectSpread({cmd:t,callback:o,error:i},r))})));case 2:case"end":return e.stop()}}),e)}))),i.apply(this,arguments)}var u=Object.freeze({__proto__:null,transformCallback:a,invoke:o,convertFileSrc:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"asset",r=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?"https://".concat(t,".localhost/").concat(r):"".concat(t,"://").concat(r)}});function s(e){return c.apply(this,arguments)}function c(){return(c=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o("tauri",t));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function p(){return(p=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"App",message:{cmd:"getAppVersion"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function l(){return(l=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"App",message:{cmd:"getAppName"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function f(){return(f=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"App",message:{cmd:"getTauriVersion"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var h=Object.freeze({__proto__:null,getName:function(){return l.apply(this,arguments)},getVersion:function(){return p.apply(this,arguments)},getTauriVersion:function(){return f.apply(this,arguments)}});function d(){return(d=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Cli",message:{cmd:"cliMatches"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var m=Object.freeze({__proto__:null,getMatches:function(){return d.apply(this,arguments)}});function _(){return(_=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Clipboard",message:{cmd:"writeText",data:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function y(){return(y=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Clipboard",message:{cmd:"readText",data:null}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var g=Object.freeze({__proto__:null,writeText:function(e){return _.apply(this,arguments)},readText:function(){return y.apply(this,arguments)}});function v(e,t){return null!=e?e:t()}function w(e){for(var t=void 0,r=e[0],n=1;n0&&void 0!==r[0]?r[0]:{})&&Object.freeze(t),e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"openDialog",options:t}}));case 3:case"end":return e.stop()}}),e)}))),b.apply(this,arguments)}function R(){return R=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,r=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(t=r.length>0&&void 0!==r[0]?r[0]:{})&&Object.freeze(t),e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"saveDialog",options:t}}));case 3:case"end":return e.stop()}}),e)}))),R.apply(this,arguments)}function k(){return k=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="string"==typeof r?{title:r}:r,e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"messageDialog",message:t.toString(),title:w([n,"optionalAccess",function(e){return e.title},"optionalAccess",function(e){return e.toString},"call",function(e){return e()}]),type:w([n,"optionalAccess",function(e){return e.type}]),buttonLabel:w([n,"optionalAccess",function(e){return e.okLabel},"optionalAccess",function(e){return e.toString},"call",function(e){return e()}])}}));case 2:case"end":return e.stop()}}),e)}))),k.apply(this,arguments)}function x(){return x=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="string"==typeof r?{title:r}:r,e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"askDialog",message:t.toString(),title:w([n,"optionalAccess",function(e){return e.title},"optionalAccess",function(e){return e.toString},"call",function(e){return e()}]),type:w([n,"optionalAccess",function(e){return e.type}]),buttonLabels:[v(w([n,"optionalAccess",function(e){return e.okLabel},"optionalAccess",function(e){return e.toString},"call",function(e){return e()}]),(function(){return"Yes"})),v(w([n,"optionalAccess",function(e){return e.cancelLabel},"optionalAccess",function(e){return e.toString},"call",function(e){return e()}]),(function(){return"No"}))]}}));case 2:case"end":return e.stop()}}),e)}))),x.apply(this,arguments)}function T(){return T=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="string"==typeof r?{title:r}:r,e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"confirmDialog",message:t.toString(),title:w([n,"optionalAccess",function(e){return e.title},"optionalAccess",function(e){return e.toString},"call",function(e){return e()}]),type:w([n,"optionalAccess",function(e){return e.type}]),buttonLabels:[v(w([n,"optionalAccess",function(e){return e.okLabel},"optionalAccess",function(e){return e.toString},"call",function(e){return e()}]),(function(){return"Ok"})),v(w([n,"optionalAccess",function(e){return e.cancelLabel},"optionalAccess",function(e){return e.toString},"call",function(e){return e()}]),(function(){return"Cancel"}))]}}));case 2:case"end":return e.stop()}}),e)}))),T.apply(this,arguments)}var G,P=Object.freeze({__proto__:null,open:function(){return b.apply(this,arguments)},save:function(){return R.apply(this,arguments)},message:function(e,t){return k.apply(this,arguments)},ask:function(e,t){return x.apply(this,arguments)},confirm:function(e,t){return T.apply(this,arguments)}});function O(e,t){return A.apply(this,arguments)}function A(){return A=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Event",message:{cmd:"unlisten",event:t,eventId:r}}));case 1:case"end":return e.stop()}}),e)}))),A.apply(this,arguments)}function L(e,t,r){return M.apply(this,arguments)}function M(){return M=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s({__tauriModule:"Event",message:{cmd:"emit",event:t,windowLabel:r,payload:"string"==typeof n?n:JSON.stringify(n)}});case 2:case"end":return e.stop()}}),e)}))),M.apply(this,arguments)}function E(e,t,r){return D.apply(this,arguments)}function D(){return D=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Event",message:{cmd:"listen",event:t,windowLabel:r,handler:a(n)}}).then((function(e){return _asyncToGenerator(_regeneratorRuntime().mark((function r(){return _regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",O(t,e));case 1:case"end":return r.stop()}}),r)})))})));case 1:case"end":return e.stop()}}),e)}))),D.apply(this,arguments)}function C(e,t,r){return S.apply(this,arguments)}function S(){return S=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",E(t,r,(function(e){n(e),O(t,e.id).catch((function(){}))})));case 1:case"end":return e.stop()}}),e)}))),S.apply(this,arguments)}function j(e,t){return W.apply(this,arguments)}function W(){return W=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",E(t,null,r));case 1:case"end":return e.stop()}}),e)}))),W.apply(this,arguments)}function N(e,t){return I.apply(this,arguments)}function I(){return I=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",C(t,null,r));case 1:case"end":return e.stop()}}),e)}))),I.apply(this,arguments)}function z(e,t){return F.apply(this,arguments)}function F(){return F=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",L(t,void 0,r));case 1:case"end":return e.stop()}}),e)}))),F.apply(this,arguments)}!function(e){e.WINDOW_RESIZED="tauri://resize";e.WINDOW_MOVED="tauri://move";e.WINDOW_CLOSE_REQUESTED="tauri://close-requested";e.WINDOW_CREATED="tauri://window-created";e.WINDOW_DESTROYED="tauri://destroyed";e.WINDOW_FOCUS="tauri://focus";e.WINDOW_BLUR="tauri://blur";e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change";e.WINDOW_THEME_CHANGED="tauri://theme-changed";e.WINDOW_FILE_DROP="tauri://file-drop";e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover";e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled";e.MENU="tauri://menu";e.CHECK_UPDATE="tauri://update";e.UPDATE_AVAILABLE="tauri://update-available";e.INSTALL_UPDATE="tauri://update-install";e.STATUS_UPDATE="tauri://update-status";e.DOWNLOAD_PROGRESS="tauri://update-download-progress"}(G||(G={}));var U,H=Object.freeze({__proto__:null,listen:j,once:N,emit:z});function V(e,t){return null!=e?e:t()}function B(){return B=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"readTextFile",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)}))),B.apply(this,arguments)}function q(){return q=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,a=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:{},e.next=3,s({__tauriModule:"Fs",message:{cmd:"readFile",path:t,options:r}});case 3:return n=e.sent,e.abrupt("return",Uint8Array.from(n));case 5:case"end":return e.stop()}}),e)}))),q.apply(this,arguments)}function J(e,t,r){return Y.apply(this,arguments)}function Y(){return Y=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){var a,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(n)&&Object.freeze(n),"object"===_typeof(t)&&Object.freeze(t),a={path:"",contents:""},o=n,"string"==typeof t?a.path=t:(a.path=t.path,a.contents=t.contents),"string"==typeof r?a.contents=V(r,(function(){return""})):o=r,e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"writeFile",path:a.path,contents:Array.from((new TextEncoder).encode(a.contents)),options:o}}));case 7:case"end":return e.stop()}}),e)}))),Y.apply(this,arguments)}function K(){return K=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){var a,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(n)&&Object.freeze(n),"object"===_typeof(t)&&Object.freeze(t),a={path:"",contents:[]},o=n,"string"==typeof t?a.path=t:(a.path=t.path,a.contents=t.contents),r&&"dir"in r?o=r:"string"==typeof t&&(a.contents=V(r,(function(){return[]}))),e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"writeFile",path:a.path,contents:Array.from(a.contents instanceof ArrayBuffer?new Uint8Array(a.contents):a.contents),options:o}}));case 7:case"end":return e.stop()}}),e)}))),K.apply(this,arguments)}function Q(){return Q=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"readDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)}))),Q.apply(this,arguments)}function Z(){return Z=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"createDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)}))),Z.apply(this,arguments)}function $(){return $=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"removeDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)}))),$.apply(this,arguments)}function X(){return X=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,a=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>2&&void 0!==a[2]?a[2]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"copyFile",source:t,destination:r,options:n}}));case 2:case"end":return e.stop()}}),e)}))),X.apply(this,arguments)}function ee(){return ee=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"removeFile",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)}))),ee.apply(this,arguments)}function te(){return te=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,a=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>2&&void 0!==a[2]?a[2]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"renameFile",oldPath:t,newPath:r,options:n}}));case 2:case"end":return e.stop()}}),e)}))),te.apply(this,arguments)}!function(e){e[e.Audio=1]="Audio";e[e.Cache=2]="Cache";e[e.Config=3]="Config";e[e.Data=4]="Data";e[e.LocalData=5]="LocalData";e[e.Desktop=6]="Desktop";e[e.Document=7]="Document";e[e.Download=8]="Download";e[e.Executable=9]="Executable";e[e.Font=10]="Font";e[e.Home=11]="Home";e[e.Picture=12]="Picture";e[e.Public=13]="Public";e[e.Runtime=14]="Runtime";e[e.Template=15]="Template";e[e.Video=16]="Video";e[e.Resource=17]="Resource";e[e.App=18]="App";e[e.Log=19]="Log";e[e.Temp=20]="Temp"}(U||(U={}));var re=Object.freeze({__proto__:null,get BaseDirectory(){return U},get Dir(){return U},readTextFile:function(e){return B.apply(this,arguments)},readBinaryFile:function(e){return q.apply(this,arguments)},writeTextFile:J,writeFile:J,writeBinaryFile:function(e,t,r){return K.apply(this,arguments)},readDir:function(e){return Q.apply(this,arguments)},createDir:function(e){return Z.apply(this,arguments)},removeDir:function(e){return $.apply(this,arguments)},copyFile:function(e,t){return X.apply(this,arguments)},removeFile:function(e){return ee.apply(this,arguments)},renameFile:function(e,t){return te.apply(this,arguments)}});function ne(){return(ne=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"register",shortcut:t,handler:a(r)}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ae(){return(ae=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"registerAll",shortcuts:t,handler:a(r)}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oe(){return(oe=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"isRegistered",shortcut:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ie(){return(ie=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"unregister",shortcut:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ue(){return(ue=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"unregisterAll"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var se,ce=Object.freeze({__proto__:null,register:function(e,t){return ne.apply(this,arguments)},registerAll:function(e,t){return ae.apply(this,arguments)},isRegistered:function(e){return oe.apply(this,arguments)},unregister:function(e){return ie.apply(this,arguments)},unregisterAll:function(){return ue.apply(this,arguments)}});function pe(e,t){return null!=e?e:t()}function le(e){for(var t=void 0,r=e[0],n=1;n=200&&this.status<300,this.headers=t.headers,this.rawHeaders=t.rawHeaders,this.data=t.data})),de=function(){function e(t){_classCallCheck(this,e),this.id=t}var t,r,n,a,o,i,u;return _createClass(e,[{key:"drop",value:(u=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}}));case 1:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"request",value:(i=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=!t.responseType||t.responseType===se.JSON)&&(t.responseType=se.Text),e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:t}}).then((function(e){var t=new he(e);if(r){try{t.data=JSON.parse(t.data)}catch(e){if(t.ok&&""===t.data)t.data={};else if(t.ok)throw Error("Failed to parse response `".concat(t.data,"` as JSON: ").concat(e,";\n try setting the `responseType` option to `ResponseType.Text` or `ResponseType.Binary` if the API does not return a JSON response."))}return t}return t})));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"get",value:(o=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"GET",url:t},r)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"post",value:(a=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"POST",url:t,body:r},n)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return a.apply(this,arguments)})},{key:"put",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"PUT",url:t,body:r},n)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"patch",value:(r=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"PATCH",url:t},r)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"delete",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"DELETE",url:t},r)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),e}();function me(e){return _e.apply(this,arguments)}function _e(){return(_e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"createClient",options:t}}).then((function(e){return new de(e)})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ye=null;function ge(){return(ge=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==ye){e.next=4;break}return e.next=3,me();case 3:ye=e.sent;case 4:return e.abrupt("return",ye.request(_objectSpread({url:t,method:pe(le([r,"optionalAccess",function(e){return e.method}]),(function(){return"GET"}))},r)));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ve=Object.freeze({__proto__:null,getClient:me,fetch:function(e,t){return ge.apply(this,arguments)},Body:fe,Client:de,Response:he,get ResponseType(){return se}});function we(){return(we=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("default"===window.Notification.permission){e.next=2;break}return e.abrupt("return",Promise.resolve("granted"===window.Notification.permission));case 2:return e.abrupt("return",s({__tauriModule:"Notification",message:{cmd:"isNotificationPermissionGranted"}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function be(){return(be=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",window.Notification.requestPermission());case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Re=Object.freeze({__proto__:null,sendNotification:function(e){"string"==typeof e?new window.Notification(e):new window.Notification(e.title,e)},requestPermission:function(){return be.apply(this,arguments)},isPermissionGranted:function(){return we.apply(this,arguments)}});function ke(){return navigator.appVersion.includes("Win")}function xe(){return(xe=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:U.App}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Te(){return(Te=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:U.Audio}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ge(){return(Ge=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:U.Cache}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Pe(){return(Pe=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:U.Config}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Oe(){return(Oe=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:U.Data}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ae(){return(Ae=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:U.Desktop}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Le(){return(Le=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:U.Document}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Me(){return(Me=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:U.Download}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ee(){return(Ee=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:U.Executable}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function De(){return(De=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:U.Font}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ce(){return(Ce=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:U.Home}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Se(){return(Se=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:U.LocalData}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function je(){return(je=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:U.Picture}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function We(){return(We=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:U.Public}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ne(){return(Ne=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:U.Resource}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ie(){return(Ie=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:t,directory:U.Resource}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ze(){return(ze=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:U.Runtime}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Fe(){return(Fe=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:U.Template}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ue(){return(Ue=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:U.Video}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function He(){return(He=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:U.Log}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ve=ke()?"\\":"/",Be=ke()?";":":";function qe(){return qe=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,r,n,a=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=a.length,r=new Array(t),n=0;n0&&void 0!==r[0]?r[0]:0,e.abrupt("return",s({__tauriModule:"Process",message:{cmd:"exit",exitCode:t}}));case 2:case"end":return e.stop()}}),e)}))),et.apply(this,arguments)}function tt(){return(tt=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Process",message:{cmd:"relaunch"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var rt=Object.freeze({__proto__:null,exit:function(){return et.apply(this,arguments)},relaunch:function(){return tt.apply(this,arguments)}});function nt(e,t){return null!=e?e:t()}function at(e,t){return ot.apply(this,arguments)}function ot(){return ot=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,o,i=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.length>2&&void 0!==i[2]?i[2]:[],o=i.length>3?i[3]:void 0,"object"===_typeof(n)&&Object.freeze(n),e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"execute",program:r,args:n,options:o,onEventFn:a(t)}}));case 4:case"end":return e.stop()}}),e)}))),ot.apply(this,arguments)}var it=function(){function e(){_classCallCheck(this,e),e.prototype.__init.call(this)}return _createClass(e,[{key:"__init",value:function(){this.eventListeners=Object.create(null)}},{key:"addListener",value:function(e,t){return this.on(e,t)}},{key:"removeListener",value:function(e,t){return this.off(e,t)}},{key:"on",value:function(e,t){return e in this.eventListeners?this.eventListeners[e].push(t):this.eventListeners[e]=[t],this}},{key:"once",value:function(e,t){var r=this;return this.addListener(e,(function n(){r.removeListener(e,n),t.apply(void 0,arguments)}))}},{key:"off",value:function(e,t){return e in this.eventListeners&&(this.eventListeners[e]=this.eventListeners[e].filter((function(e){return e!==t}))),this}},{key:"removeAllListeners",value:function(e){return e?delete this.eventListeners[e]:this.eventListeners=Object.create(null),this}},{key:"emit",value:function(e){if(e in this.eventListeners){for(var t=this.eventListeners[e],r=arguments.length,n=new Array(r>1?r-1:0),a=1;a1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2?arguments[2]:void 0;return _classCallCheck(this,a),t=n.call(this),a.prototype.__init2.call(_assertThisInitialized(t)),a.prototype.__init3.call(_assertThisInitialized(t)),t.program=e,t.args="string"==typeof r?[r]:r,t.options=nt(o,(function(){return{}})),t}return _createClass(a,[{key:"__init2",value:function(){this.stdout=new it}},{key:"__init3",value:function(){this.stderr=new it}},{key:"spawn",value:(r=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t=this;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",at((function(e){switch(e.event){case"Error":t.emit("error",e.payload);break;case"Terminated":t.emit("close",e.payload);break;case"Stdout":t.stdout.emit("data",e.payload);break;case"Stderr":t.stderr.emit("data",e.payload)}}),this.program,this.args,this.options).then((function(e){return new ut(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"execute",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t=this;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,r){t.on("error",r);var n=[],a=[];t.stdout.on("data",(function(e){n.push(e)})),t.stderr.on("data",(function(e){a.push(e)})),t.on("close",(function(t){e({code:t.code,signal:t.signal,stdout:n.join("\n"),stderr:a.join("\n")})})),t.spawn().catch(r)})));case 1:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})}],[{key:"sidecar",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,n=new a(e,t,r);return n.options.sidecar=!0,n}}]),a}(it);function ct(){return ct=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"open",path:t,with:r}}));case 1:case"end":return e.stop()}}),e)}))),ct.apply(this,arguments)}var pt=Object.freeze({__proto__:null,Command:st,Child:ut,EventEmitter:it,open:function(e,t){return ct.apply(this,arguments)}});function lt(e){for(var t=void 0,r=e[0],n=1;n1&&void 0!==arguments[1]?arguments[1]:{};return _classCallCheck(this,r),n=t.call(this,e),yt([a,"optionalAccess",function(e){return e.skip}])||s({__tauriModule:"Window",message:{cmd:"createWebview",data:{options:_objectSpread({label:e},a)}}}).then(_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.emit("tauri://created"));case 1:case"end":return e.stop()}}),e)})))).catch(function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.emit("tauri://error",t));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),n}return _createClass(r,null,[{key:"getByLabel",value:function(e){return kt().some((function(t){return t.label===e}))?new r(e,{skip:!0}):null}}]),r}(Pt);function Lt(){return(Lt=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"currentMonitor"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Mt(){return(Mt=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"primaryMonitor"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Et(){return(Et=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"availableMonitors"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}"__TAURI_METADATA__"in window?xt=new At(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0}):(console.warn('Could not find "window.__TAURI_METADATA__". The "appWindow" value will reference the "main" window label.\nNote that this is not an issue if running this frontend on a browser instead of a Tauri window.'),xt=new At("main",{skip:!0}));var Dt=Object.freeze({__proto__:null,WebviewWindow:At,WebviewWindowHandle:Gt,WindowManager:Pt,CloseRequestedEvent:Ot,getCurrent:function(){return new At(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})},getAll:kt,get appWindow(){return xt},LogicalSize:vt,PhysicalSize:wt,LogicalPosition:bt,PhysicalPosition:Rt,get UserAttentionType(){return gt},currentMonitor:function(){return Lt.apply(this,arguments)},primaryMonitor:function(){return Mt.apply(this,arguments)},availableMonitors:function(){return Et.apply(this,arguments)}}),Ct=ke()?"\r\n":"\n";function St(){return(St=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"platform"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function jt(){return(jt=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"version"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Wt(){return(Wt=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"osType"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Nt(){return(Nt=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"arch"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function It(){return(It=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"tempdir"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var zt=Object.freeze({__proto__:null,EOL:Ct,platform:function(){return St.apply(this,arguments)},version:function(){return jt.apply(this,arguments)},type:function(){return Wt.apply(this,arguments)},arch:function(){return Nt.apply(this,arguments)},tempdir:function(){return It.apply(this,arguments)}}),Ft=o;e.app=h,e.cli=m,e.clipboard=g,e.dialog=P,e.event=H,e.fs=re,e.globalShortcut=ce,e.http=ve,e.invoke=Ft,e.notification=Re,e.os=zt,e.path=Xe,e.process=rt,e.shell=pt,e.tauri=u,e.updater=_t,e.window=Dt,Object.defineProperty(e,"__esModule",{value:!0})})); diff --git a/core/tauri/scripts/core.js b/core/tauri/scripts/core.js index 5fa5bbd8e..ec4bd59b3 100644 --- a/core/tauri/scripts/core.js +++ b/core/tauri/scripts/core.js @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -;(function () { +; (function () { function uid() { return window.crypto.getRandomValues(new Uint32Array(1))[0] } @@ -96,7 +96,7 @@ if (target.matches('a')) { if ( target.href && - target.href.startsWith('http') && + (['http://', 'https://', 'mailto:', 'tel:'].some(v => target.href.startsWith(v))) && target.target === '_blank' ) { window.__TAURI_INVOKE__('tauri', { @@ -136,6 +136,10 @@ if (e.target.hasAttribute('data-tauri-drag-region') && e.buttons === 1) { // prevents text cursor e.preventDefault() + // fix #2549: double click on drag region edge causes content to maximize without window sizing change + // https://github.com/tauri-apps/tauri/issues/2549#issuecomment-1250036908 + e.stopImmediatePropagation() + // start dragging if the element has a `tauri-drag-region` data attribute and maximize on double-clicking it window.__TAURI_INVOKE__('tauri', { __tauriModule: 'Window', @@ -151,15 +155,6 @@ } }) - listen('tauri://window-created', function (event) { - if (event.payload) { - var windowLabel = event.payload.label - window.__TAURI_METADATA__.__windows.push({ - label: windowLabel - }) - } - }) - let permissionSettable = false let permissionValue = 'default' diff --git a/core/tauri/scripts/stringify-ipc-message-fn.js b/core/tauri/scripts/stringify-ipc-message-fn.js new file mode 100644 index 000000000..7700dc9f7 --- /dev/null +++ b/core/tauri/scripts/stringify-ipc-message-fn.js @@ -0,0 +1,11 @@ +(function (message) { + return JSON.stringify(message, (_k, val) => { + if (val instanceof Map) { + let o = {}; + val.forEach((v, k) => o[k] = v); + return o; + } else { + return val; + } + }) +}) diff --git a/core/tauri/src/api/dialog.rs b/core/tauri/src/api/dialog.rs index 313c075b2..b7e504085 100644 --- a/core/tauri/src/api/dialog.rs +++ b/core/tauri/src/api/dialog.rs @@ -171,7 +171,7 @@ macro_rules! message_dialog_builder { /// Options for action buttons on message dialogs. #[non_exhaustive] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum MessageDialogButtons { /// Ok button. Ok, @@ -179,6 +179,10 @@ pub enum MessageDialogButtons { OkCancel, /// Yes and No buttons. YesNo, + /// OK button with customized text. + OkWithLabel(String), + /// Ok and Cancel buttons with customized text. + OkCancelWithLabels(String, String), } impl From for rfd::MessageButtons { @@ -187,6 +191,10 @@ impl From for rfd::MessageButtons { MessageDialogButtons::Ok => Self::Ok, MessageDialogButtons::OkCancel => Self::OkCancel, MessageDialogButtons::YesNo => Self::YesNo, + MessageDialogButtons::OkWithLabel(ok_text) => Self::OkCustom(ok_text), + MessageDialogButtons::OkCancelWithLabels(ok_text, cancel_text) => { + Self::OkCancelCustom(ok_text, cancel_text) + } } } } diff --git a/core/tauri/src/api/file/extract.rs b/core/tauri/src/api/file/extract.rs index 9e2eb76e8..88d523a46 100644 --- a/core/tauri/src/api/file/extract.rs +++ b/core/tauri/src/api/file/extract.rs @@ -279,9 +279,8 @@ fn set_perms( ) -> crate::api::Result<()> { _set_perms(dst, f, mode, preserve).map_err(|_| { crate::api::Error::Extract(format!( - "failed to set permissions to {:o} \ + "failed to set permissions to {mode:o} \ for `{}`", - mode, dst.display() )) }) diff --git a/core/tauri/src/api/ipc.rs b/core/tauri/src/api/ipc.rs index f09be3232..90900ff6a 100644 --- a/core/tauri/src/api/ipc.rs +++ b/core/tauri/src/api/ipc.rs @@ -57,7 +57,7 @@ const MIN_JSON_PARSE_LEN: usize = 10_240; /// bar: String, /// } /// let foo = Foo { bar: "x".repeat(20_000).into() }; -/// let value = serialize_js_with(&foo, SerializeOptions::default(), |v| format!("console.log({})", v)).unwrap(); +/// let value = serialize_js_with(&foo, SerializeOptions::default(), |v| format!("console.log({v})")).unwrap(); /// assert_eq!(value, format!("console.log(JSON.parse('{{\"bar\":\"{}\"}}'))", foo.bar)); /// ``` pub fn serialize_js_with String>( @@ -179,8 +179,7 @@ pub fn format_callback( }} else {{ console.warn("[TAURI] Couldn't find callback id {fn} in window. This happens when the app is reloaded while Rust is running an asynchronous operation.") }}"#, - fn = function_name.0, - arg = arg + fn = function_name.0 ) }) } @@ -281,7 +280,7 @@ mod test { // check arbitrary strings in the format callback function #[quickcheck] - fn qc_formating(f: CallbackFn, a: String) -> bool { + fn qc_formatting(f: CallbackFn, a: String) -> bool { // call format callback let fc = format_callback(f, &a).unwrap(); fc.contains(&format!( diff --git a/core/tauri/src/api/notification.rs b/core/tauri/src/api/notification.rs index bc07e61ac..b0f5f36b3 100644 --- a/core/tauri/src/api/notification.rs +++ b/core/tauri/src/api/notification.rs @@ -5,7 +5,7 @@ //! Types and functions related to desktop notifications. #[cfg(windows)] -use std::path::MAIN_SEPARATOR; +use std::path::MAIN_SEPARATOR as SEP; /// The desktop notification definition. /// @@ -114,8 +114,8 @@ impl Notification { let exe_dir = exe.parent().expect("failed to get exe directory"); let curr_dir = exe_dir.display().to_string(); // set the notification's System.AppUserModel.ID only when running the installed app - if !(curr_dir.ends_with(format!("{S}target{S}debug", S = MAIN_SEPARATOR).as_str()) - || curr_dir.ends_with(format!("{S}target{S}release", S = MAIN_SEPARATOR).as_str())) + if !(curr_dir.ends_with(format!("{SEP}target{SEP}debug").as_str()) + || curr_dir.ends_with(format!("{SEP}target{SEP}release").as_str())) { notification.app_id(&self.identifier); } diff --git a/core/tauri/src/api/process/command.rs b/core/tauri/src/api/process/command.rs index 8f7d2ca17..d98d16762 100644 --- a/core/tauri/src/api/process/command.rs +++ b/core/tauri/src/api/process/command.rs @@ -137,9 +137,9 @@ pub struct Output { fn relative_command_path(command: String) -> crate::Result { match platform::current_exe()?.parent() { #[cfg(windows)] - Some(exe_dir) => Ok(format!("{}\\{}.exe", exe_dir.display(), command)), + Some(exe_dir) => Ok(format!("{}\\{command}.exe", exe_dir.display())), #[cfg(not(windows))] - Some(exe_dir) => Ok(format!("{}/{}", exe_dir.display(), command)), + Some(exe_dir) => Ok(format!("{}/{command}", exe_dir.display())), None => Err(crate::api::Error::Command("Could not evaluate executable dir".to_string()).into()), } } diff --git a/core/tauri/src/api/shell.rs b/core/tauri/src/api/shell.rs index 6ca16cc75..f9db17f36 100644 --- a/core/tauri/src/api/shell.rs +++ b/core/tauri/src/api/shell.rs @@ -91,7 +91,7 @@ impl Program { /// Opens path or URL with the program specified in `with`, or system default if `None`. /// -/// The path will be matched against the shell open validation regex, defaulting to `^https?://`. +/// The path will be matched against the shell open validation regex, defaulting to `^((mailto:\w+)|(tel:\w+)|(https?://\w+)).+`. /// A custom validation regex may be supplied in the config in `tauri > allowlist > scope > open`. /// /// # Examples diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index ab127dca3..ffcf17f2b 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -23,8 +23,8 @@ use crate::{ sealed::{ManagerBase, RuntimeOrDispatch}, utils::config::Config, utils::{assets::Assets, resources::resource_relpath, Env}, - Context, EventLoopMessage, Invoke, InvokeError, InvokeResponse, Manager, Runtime, Scopes, - StateManager, Theme, Window, + Context, DeviceEventFilter, EventLoopMessage, Invoke, InvokeError, InvokeResponse, Manager, + Runtime, Scopes, StateManager, Theme, Window, }; #[cfg(shell_scope)] @@ -1061,6 +1061,35 @@ impl App { .set_activation_policy(activation_policy); } + /// Change the device event filter mode. + /// + /// Since the DeviceEvent capture can lead to high CPU usage for unfocused windows, [`tao`] + /// will ignore them by default for unfocused windows on Windows. This method allows changing + /// the filter to explicitly capture them again. + /// + /// ## Platform-specific + /// + /// - ** Linux / macOS / iOS / Android**: Unsupported. + /// + /// # Examples + /// ```,no_run + /// let mut app = tauri::Builder::default() + /// // on an actual app, remove the string argument + /// .build(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json")) + /// .expect("error while building tauri application"); + /// app.set_device_event_filter(tauri::DeviceEventFilter::Always); + /// app.run(|_app_handle, _event| {}); + /// ``` + /// + /// [`tao`]: https://crates.io/crates/tao + pub fn set_device_event_filter(&mut self, filter: DeviceEventFilter) { + self + .runtime + .as_mut() + .unwrap() + .set_device_event_filter(filter); + } + /// Gets the argument matches of the CLI definition configured in `tauri.conf.json`. /// /// # Examples @@ -1275,6 +1304,9 @@ pub struct Builder { /// The updater configuration. #[cfg(updater)] updater_settings: UpdaterSettings, + + /// The device event filter. + device_event_filter: DeviceEventFilter, } impl Builder { @@ -1287,7 +1319,7 @@ impl Builder { invoke_handler: Box::new(|_| false), invoke_responder: Arc::new(window_invoke_responder), invoke_initialization_script: - "Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { value: (message) => window.ipc.postMessage(JSON.stringify(message)) })".into(), + format!("Object.defineProperty(window, '__TAURI_POST_MESSAGE__', {{ value: (message) => window.ipc.postMessage({}(message)) }})", crate::manager::STRINGIFY_IPC_MESSAGE_FN), on_page_load: Box::new(|_, _| ()), pending_windows: Default::default(), plugins: PluginStore::default(), @@ -1303,6 +1335,7 @@ impl Builder { system_tray_event_listeners: Vec::new(), #[cfg(updater)] updater_settings: Default::default(), + device_event_filter: Default::default(), } } @@ -1737,7 +1770,7 @@ impl Builder { /// ``` /// let kind = if cfg!(debug_assertions) { "debug" } else { "release" }; /// tauri::Builder::default() - /// .updater_target(format!("{}-{}", tauri::updater::target().unwrap(), kind)); + /// .updater_target(format!("{}-{kind}", tauri::updater::target().unwrap())); /// ``` /// /// - Use the platform's target triple: @@ -1752,6 +1785,28 @@ impl Builder { self } + /// Change the device event filter mode. + /// + /// Since the DeviceEvent capture can lead to high CPU usage for unfocused windows, [`tao`] + /// will ignore them by default for unfocused windows on Windows. This method allows changing + /// the filter to explicitly capture them again. + /// + /// ## Platform-specific + /// + /// - ** Linux / macOS / iOS / Android**: Unsupported. + /// + /// # Examples + /// ```,no_run + /// tauri::Builder::default() + /// .device_event_filter(tauri::DeviceEventFilter::Always); + /// ``` + /// + /// [`tao`]: https://crates.io/crates/tao + pub fn device_event_filter(mut self, filter: DeviceEventFilter) -> Self { + self.device_event_filter = filter; + self + } + /// Builds the application. #[allow(clippy::type_complexity)] pub fn build(mut self, context: Context) -> crate::Result> { @@ -1785,6 +1840,9 @@ impl Builder { if let Some(ua) = &config.user_agent { webview_attributes = webview_attributes.user_agent(&ua.to_string()); } + if let Some(args) = &config.additional_browser_args { + webview_attributes = webview_attributes.additional_browser_args(&args.to_string()); + } if !config.file_drop_enabled { webview_attributes = webview_attributes.disable_file_drop_handler(); } @@ -1797,13 +1855,15 @@ impl Builder { } #[cfg(any(windows, target_os = "linux"))] - let runtime = if self.runtime_any_thread { + let mut runtime = if self.runtime_any_thread { R::new_any_thread()? } else { R::new()? }; #[cfg(not(any(windows, target_os = "linux")))] - let runtime = R::new()?; + let mut runtime = R::new()?; + + runtime.set_device_event_filter(self.device_event_filter); let runtime_handle = runtime.handle(); diff --git a/core/tauri/src/app/tray.rs b/core/tauri/src/app/tray.rs index 3a265f0c9..96c660127 100644 --- a/core/tauri/src/app/tray.rs +++ b/core/tauri/src/app/tray.rs @@ -64,6 +64,7 @@ pub struct SystemTray { icon_as_template_set: bool, #[cfg(target_os = "macos")] title: Option, + tooltip: Option, } impl fmt::Debug for SystemTray { @@ -98,6 +99,7 @@ impl Default for SystemTray { menu_on_left_click_set: false, #[cfg(target_os = "macos")] title: None, + tooltip: None, } } } @@ -257,6 +259,29 @@ impl SystemTray { self } + /// Sets the tray icon tooltip. + /// + /// ## Platform-specific: + /// + /// - **Linux:** Unsupported + /// + /// # Examples + /// + /// ``` + /// use tauri::SystemTray; + /// + /// tauri::Builder::default() + /// .setup(|app| { + /// let tray_handle = SystemTray::new().with_tooltip("My App").build(app)?; + /// Ok(()) + /// }); + /// ``` + #[must_use] + pub fn with_tooltip(mut self, tooltip: &str) -> Self { + self.tooltip = Some(tooltip.to_owned()); + self + } + /// Sets the event listener for this system tray. /// /// # Examples @@ -414,6 +439,10 @@ impl SystemTray { } } + if let Some(tooltip) = self.tooltip { + runtime_tray = runtime_tray.with_tooltip(&tooltip); + } + let id = runtime_tray.id; let tray_handler = match manager.runtime() { RuntimeOrDispatch::Runtime(r) => r.system_tray(runtime_tray), @@ -610,6 +639,15 @@ impl SystemTrayHandle { self.inner.set_title(title).map_err(Into::into) } + /// Set the tooltip for this tray icon. + /// + /// ## Platform-specific: + /// + /// - **Linux:** Unsupported + pub fn set_tooltip(&self, tooltip: &str) -> crate::Result<()> { + self.inner.set_tooltip(tooltip).map_err(Into::into) + } + /// Destroys this system tray. pub fn destroy(&self) -> crate::Result<()> { self.inner.destroy().map_err(Into::into) diff --git a/core/tauri/src/endpoints/dialog.rs b/core/tauri/src/endpoints/dialog.rs index aaba2d046..f71923cef 100644 --- a/core/tauri/src/endpoints/dialog.rs +++ b/core/tauri/src/endpoints/dialog.rs @@ -14,19 +14,21 @@ use tauri_macros::{command_enum, module_command_handler, CommandModule}; use std::path::PathBuf; macro_rules! message_dialog { - ($fn_name: ident, $allowlist: ident, $buttons: expr) => { + ($fn_name: ident, $allowlist: ident, $button_labels_type: ty, $buttons: expr) => { #[module_command_handler($allowlist)] fn $fn_name( context: InvokeContext, title: Option, message: String, level: Option, + button_labels: $button_labels_type, ) -> super::Result { + let determine_button = $buttons; let mut builder = crate::api::dialog::blocking::MessageDialogBuilder::new( title.unwrap_or_else(|| context.window.app_handle.package_info().name.clone()), message, ) - .buttons($buttons); + .buttons(determine_button(button_labels)); #[cfg(any(windows, target_os = "macos"))] { builder = builder.parent(&context.window); @@ -139,6 +141,8 @@ pub enum Cmd { message: String, #[serde(rename = "type")] level: Option, + #[serde(rename = "buttonLabel")] + button_label: Option, }, #[cmd(dialog_ask, "dialog > ask")] AskDialog { @@ -146,6 +150,8 @@ pub enum Cmd { message: String, #[serde(rename = "type")] level: Option, + #[serde(rename = "buttonLabels")] + button_label: Option<(String, String)>, }, #[cmd(dialog_confirm, "dialog > confirm")] ConfirmDialog { @@ -153,6 +159,8 @@ pub enum Cmd { message: String, #[serde(rename = "type")] level: Option, + #[serde(rename = "buttonLabels")] + button_labels: Option<(String, String)>, }, } @@ -255,19 +263,36 @@ impl Cmd { message_dialog!( message_dialog, dialog_message, - crate::api::dialog::MessageDialogButtons::Ok + Option, + |label: Option| { + label + .map(crate::api::dialog::MessageDialogButtons::OkWithLabel) + .unwrap_or(crate::api::dialog::MessageDialogButtons::Ok) + } ); message_dialog!( ask_dialog, dialog_ask, - crate::api::dialog::MessageDialogButtons::YesNo + Option<(String, String)>, + |labels: Option<(String, String)>| { + labels + .map(|(yes, no)| crate::api::dialog::MessageDialogButtons::OkCancelWithLabels(yes, no)) + .unwrap_or(crate::api::dialog::MessageDialogButtons::YesNo) + } ); message_dialog!( confirm_dialog, dialog_confirm, - crate::api::dialog::MessageDialogButtons::OkCancel + Option<(String, String)>, + |labels: Option<(String, String)>| { + labels + .map(|(ok, cancel)| { + crate::api::dialog::MessageDialogButtons::OkCancelWithLabels(ok, cancel) + }) + .unwrap_or(crate::api::dialog::MessageDialogButtons::OkCancel) + } ); } diff --git a/core/tauri/src/endpoints/file_system.rs b/core/tauri/src/endpoints/file_system.rs index 8d5f4534b..1d5be61d3 100644 --- a/core/tauri/src/endpoints/file_system.rs +++ b/core/tauri/src/endpoints/file_system.rs @@ -386,7 +386,7 @@ fn resolve_path( } } Err(e) => super::Result::::Err(e.into()) - .with_context(|| format!("path: {}, base dir: {:?}", path.display(), dir)), + .with_context(|| format!("path: {}, base dir: {dir:?}", path.display())), } } diff --git a/core/tauri/src/endpoints/window.rs b/core/tauri/src/endpoints/window.rs index e20e63e66..732dfbb12 100644 --- a/core/tauri/src/endpoints/window.rs +++ b/core/tauri/src/endpoints/window.rs @@ -63,10 +63,12 @@ pub enum WindowManagerCmd { InnerSize, OuterSize, IsFullscreen, + IsMinimized, IsMaximized, IsDecorated, IsResizable, IsVisible, + Title, CurrentMonitor, PrimaryMonitor, AvailableMonitors, @@ -103,6 +105,8 @@ pub enum WindowManagerCmd { #[cfg(window_set_always_on_top)] #[serde(rename_all = "camelCase")] SetAlwaysOnTop(bool), + #[cfg(window_set_content_protected)] + SetContentProtected(bool), #[cfg(window_set_size)] SetSize(Size), #[cfg(window_set_min_size)] @@ -165,6 +169,9 @@ pub fn into_allowlist_error(variant: &str) -> crate::Error { "setDecorations" => crate::Error::ApiNotAllowlisted("window > setDecorations".to_string()), "setShadow" => crate::Error::ApiNotAllowlisted("window > setShadow".to_string()), "setAlwaysOnTop" => crate::Error::ApiNotAllowlisted("window > setAlwaysOnTop".to_string()), + "setContentProtected" => { + crate::Error::ApiNotAllowlisted("window > setContentProtected".to_string()) + } "setSize" => crate::Error::ApiNotAllowlisted("window > setSize".to_string()), "setMinSize" => crate::Error::ApiNotAllowlisted("window > setMinSize".to_string()), "setMaxSize" => crate::Error::ApiNotAllowlisted("window > setMaxSize".to_string()), @@ -183,9 +190,10 @@ pub fn into_allowlist_error(variant: &str) -> crate::Error { } "startDragging" => crate::Error::ApiNotAllowlisted("window > startDragging".to_string()), "print" => crate::Error::ApiNotAllowlisted("window > print".to_string()), - "internalToggleMaximize" => { + "__toggleMaximize" => { crate::Error::ApiNotAllowlisted("window > maximize and window > unmaximize".to_string()) } + "__toggleDevtools" => crate::Error::ApiNotAllowlisted("devtools".to_string()), _ => crate::Error::ApiNotAllowlisted("window".to_string()), } } @@ -210,19 +218,9 @@ impl Cmd { context: InvokeContext, options: Box, ) -> super::Result<()> { - let label = options.label.clone(); - let url = options.url.clone(); - let file_drop_enabled = options.file_drop_enabled; - - let mut builder = crate::window::Window::builder(&context.window, label, url); - if !file_drop_enabled { - builder = builder.disable_file_drop_handler(); - } - - builder.window_builder = - <>::WindowBuilder>::with_config(*options); - builder.build().map_err(crate::error::into_anyhow)?; - + crate::window::WindowBuilder::from_config(&context.window, *options) + .build() + .map_err(crate::error::into_anyhow)?; Ok(()) } @@ -256,10 +254,12 @@ impl Cmd { WindowManagerCmd::InnerSize => return Ok(window.inner_size()?.into()), WindowManagerCmd::OuterSize => return Ok(window.outer_size()?.into()), WindowManagerCmd::IsFullscreen => return Ok(window.is_fullscreen()?.into()), + WindowManagerCmd::IsMinimized => return Ok(window.is_minimized()?.into()), WindowManagerCmd::IsMaximized => return Ok(window.is_maximized()?.into()), WindowManagerCmd::IsDecorated => return Ok(window.is_decorated()?.into()), WindowManagerCmd::IsResizable => return Ok(window.is_resizable()?.into()), WindowManagerCmd::IsVisible => return Ok(window.is_visible()?.into()), + WindowManagerCmd::Title => return Ok(window.title()?.into()), WindowManagerCmd::CurrentMonitor => return Ok(window.current_monitor()?.into()), WindowManagerCmd::PrimaryMonitor => return Ok(window.primary_monitor()?.into()), WindowManagerCmd::AvailableMonitors => return Ok(window.available_monitors()?.into()), @@ -300,6 +300,10 @@ impl Cmd { WindowManagerCmd::SetShadow(enable) => window.set_shadow(enable)?, #[cfg(all(desktop, window_set_always_on_top))] WindowManagerCmd::SetAlwaysOnTop(always_on_top) => window.set_always_on_top(always_on_top)?, + #[cfg(all(desktop, window_set_content_protected))] + WindowManagerCmd::SetContentProtected(protected) => { + window.set_content_protected(protected)? + } #[cfg(all(desktop, window_set_size))] WindowManagerCmd::SetSize(size) => window.set_size(size)?, #[cfg(all(desktop, window_set_min_size))] diff --git a/core/tauri/src/event.rs b/core/tauri/src/event.rs index 1605be2bc..6db9651ff 100644 --- a/core/tauri/src/event.rs +++ b/core/tauri/src/event.rs @@ -338,22 +338,15 @@ pub fn listen_js( windowLabel: {window_label}, handler: {handler} }}; - if ({event} == 'tauri://window-created') {{ - eventListeners.splice(eventListeners.length - 1, 0, listener) - }} else {{ - eventListeners.push(listener); - }} + eventListeners.push(listener); }})() ", listeners = listeners_object_name, - event = event, - event_id = event_id, window_label = if let Some(l) = window_label { crate::runtime::window::assert_label_is_valid(&l); format!("'{l}'") } else { "null".to_owned() }, - handler = handler ) } diff --git a/core/tauri/src/lib.rs b/core/tauri/src/lib.rs index f1bed1987..46f5e1f97 100644 --- a/core/tauri/src/lib.rs +++ b/core/tauri/src/lib.rs @@ -137,6 +137,7 @@ //! - **window-set-decorations**: Enables the [`setDecorations` API](https://tauri.app/en/docs/api/js/classes/window.WebviewWindow#setdecorations). //! - **window-set-shadow**: Enables the [`setShadow` API](https://tauri.app/en/docs/api/js/classes/window.WebviewWindow#setshadow). //! - **window-set-always-on-top**: Enables the [`setAlwaysOnTop` API](https://tauri.app/en/docs/api/js/classes/window.WebviewWindow#setalwaysontop). +//! - **window-set-content-protected**: Enables the [`setContentProtected` API](https://tauri.app/en/docs/api/js/classes/window.WebviewWindow#setcontentprotected). //! - **window-set-size**: Enables the [`setSize` API](https://tauri.app/en/docs/api/js/classes/window.WebviewWindow#setsize). //! - **window-set-min-size**: Enables the [`setMinSize` API](https://tauri.app/en/docs/api/js/classes/window.WebviewWindow#setminsize). //! - **window-set-max-size**: Enables the [`setMaxSize` API](https://tauri.app/en/docs/api/js/classes/window.WebviewWindow#setmaxsize). @@ -290,7 +291,7 @@ pub use { dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, Pixel, Position, Size}, CursorIcon, FileDropEvent, }, - RunIteration, UserAttentionType, + DeviceEventFilter, RunIteration, UserAttentionType, }, self::state::{State, StateManager}, self::utils::{ diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index 1a54e01c5..bb1279e6c 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -73,6 +73,9 @@ const WINDOW_FILE_DROP_HOVER_EVENT: &str = "tauri://file-drop-hover"; const WINDOW_FILE_DROP_CANCELLED_EVENT: &str = "tauri://file-drop-cancelled"; const MENU_EVENT: &str = "tauri://menu"; +pub(crate) const STRINGIFY_IPC_MESSAGE_FN: &str = + include_str!("../scripts/stringify-ipc-message-fn.js"); + // we need to proxy the dev server on mobile because we can't use `localhost`, so we use the local IP address // and we do not get a secure context without the custom protocol that proxies to the dev server // additionally, we need the custom protocol to inject the initialization scripts on Android @@ -624,7 +627,7 @@ impl WindowManager { .insert("Content-Length", real_length.to_string()); data.headers.insert( "Content-Range", - format!("bytes {}-{}/{}", range.start, last_byte, file_size), + format!("bytes {}-{last_byte}/{file_size}", range.start), ); if let Err(e) = file.seek(std::io::SeekFrom::Start(range.start)).await { @@ -719,8 +722,8 @@ impl WindowManager { } = &self.inner.pattern { let assets = assets.clone(); - let _schema_ = schema.clone(); - let url_base = format!("{schema}://localhost"); + let schema_ = schema.clone(); + let url_base = format!("{schema_}://localhost"); let aes_gcm_key = *crypto_keys.aes_gcm().raw(); pending.register_uri_scheme_protocol(schema, move |request| { @@ -730,6 +733,7 @@ impl WindowManager { let asset = String::from_utf8_lossy(asset.as_ref()); let template = tauri_utils::pattern::isolation::IsolationJavascriptRuntime { runtime_aes_gcm_key: &aes_gcm_key, + stringify_ipc_message_fn: STRINGIFY_IPC_MESSAGE_FN, }; match template.render(asset.as_ref(), &Default::default()) { Ok(asset) => HttpResponseBuilder::new() @@ -1435,6 +1439,14 @@ impl WindowManager { .try_for_each(|window| window.emit_internal(event, source_window_label, payload.clone())) } + pub fn eval_script_all>(&self, script: S) -> crate::Result<()> { + let script = script.into(); + self + .windows_lock() + .values() + .try_for_each(|window| window.eval(&script)) + } + pub fn labels(&self) -> HashSet { self.windows_lock().keys().cloned().collect() } diff --git a/core/tauri/src/plugin.rs b/core/tauri/src/plugin.rs index fe4633498..eb3dc3884 100644 --- a/core/tauri/src/plugin.rs +++ b/core/tauri/src/plugin.rs @@ -35,7 +35,7 @@ pub trait Plugin: Send { /// it's recommended to check the `window.location` to guard your script from running on unexpected origins. /// /// The script is wrapped into its own context with `(function () { /* your script here */ })();`, - /// so global variables must be assigned to `window` instead of implicity declared. + /// so global variables must be assigned to `window` instead of implicitly declared. fn initialization_script(&self) -> Option { None } @@ -205,7 +205,7 @@ impl Builder { /// it's recommended to check the `window.location` to guard your script from running on unexpected origins. /// /// The script is wrapped into its own context with `(function () { /* your script here */ })();`, - /// so global variables must be assigned to `window` instead of implicity declared. + /// so global variables must be assigned to `window` instead of implicitly declared. /// /// Note that calling this function multiple times overrides previous values. /// diff --git a/core/tauri/src/scope/fs.rs b/core/tauri/src/scope/fs.rs index 8979eb8f1..5b1476aac 100644 --- a/core/tauri/src/scope/fs.rs +++ b/core/tauri/src/scope/fs.rs @@ -256,10 +256,9 @@ fn escaped_pattern(p: &str) -> Result { fn escaped_pattern_with(p: &str, append: &str) -> Result { Pattern::new(&format!( - "{}{}{}", + "{}{}{append}", glob::Pattern::escape(p), - MAIN_SEPARATOR, - append + MAIN_SEPARATOR )) } diff --git a/core/tauri/src/scope/shell.rs b/core/tauri/src/scope/shell.rs index 9197bc61f..e3ad64486 100644 --- a/core/tauri/src/scope/shell.rs +++ b/core/tauri/src/scope/shell.rs @@ -301,7 +301,7 @@ impl Scope { /// Open a path in the default (or specified) browser. /// /// The path is validated against the `tauri > allowlist > shell > open` validation regex, which - /// defaults to `^https?://`. + /// defaults to `^((mailto:\w+)|(tel:\w+)|(https?://\w+)).+`. #[cfg(feature = "shell-open-api")] pub fn open(&self, path: &str, with: Option) -> Result<(), ScopeError> { // ensure we pass validation if the configuration has one diff --git a/core/tauri/src/test/mock_runtime.rs b/core/tauri/src/test/mock_runtime.rs index 0043fa4be..47065b595 100644 --- a/core/tauri/src/test/mock_runtime.rs +++ b/core/tauri/src/test/mock_runtime.rs @@ -12,8 +12,8 @@ use tauri_runtime::{ dpi::{PhysicalPosition, PhysicalSize, Position, Size}, CursorIcon, DetachedWindow, MenuEvent, PendingWindow, WindowEvent, }, - Dispatch, EventLoopProxy, Icon, Result, RunEvent, Runtime, RuntimeHandle, UserAttentionType, - UserEvent, + DeviceEventFilter, Dispatch, EventLoopProxy, Icon, Result, RunEvent, Runtime, RuntimeHandle, + UserAttentionType, UserEvent, }; #[cfg(all(desktop, feature = "system-tray"))] use tauri_runtime::{ @@ -270,6 +270,10 @@ impl WindowBuilder for MockWindowBuilder { self } + fn content_protected(self, protected: bool) -> Self { + self + } + fn icon(self, icon: Icon) -> Result { Ok(self) } @@ -357,6 +361,10 @@ impl Dispatch for MockDispatcher { Ok(false) } + fn url(&self) -> Result { + todo!() + } + fn scale_factor(&self) -> Result { Ok(1.0) } @@ -387,6 +395,10 @@ impl Dispatch for MockDispatcher { Ok(false) } + fn is_minimized(&self) -> Result { + Ok(false) + } + fn is_maximized(&self) -> Result { Ok(false) } @@ -403,6 +415,10 @@ impl Dispatch for MockDispatcher { Ok(true) } + fn title(&self) -> Result { + Ok(String::new()) + } + fn is_menu_visible(&self) -> Result { Ok(true) } @@ -513,6 +529,10 @@ impl Dispatch for MockDispatcher { Ok(()) } + fn set_content_protected(&self, protected: bool) -> Result<()> { + Ok(()) + } + fn set_size(&self, size: Size) -> Result<()> { Ok(()) } @@ -605,6 +625,10 @@ impl TrayHandle for MockTrayHandler { Ok(()) } + fn set_tooltip(&self, tooltip: &str) -> Result<()> { + Ok(()) + } + fn destroy(&self) -> Result<()> { Ok(()) } @@ -727,6 +751,8 @@ impl Runtime for MockRuntime { #[cfg_attr(doc_cfg, doc(cfg(target_os = "macos")))] fn hide(&self) {} + fn set_device_event_filter(&mut self, filter: DeviceEventFilter) {} + #[cfg(any( target_os = "macos", windows, diff --git a/core/tauri/src/updater/core.rs b/core/tauri/src/updater/core.rs index c212bf91e..754abad2b 100644 --- a/core/tauri/src/updater/core.rs +++ b/core/tauri/src/updater/core.rs @@ -9,7 +9,7 @@ use crate::{ api::http::{ClientBuilder, HttpRequestBuilder}, AppHandle, Manager, Runtime, }; -use base64::decode; +use base64::Engine; use http::{ header::{HeaderName, HeaderValue}, HeaderMap, StatusCode, @@ -612,15 +612,7 @@ impl Update { archive_buffer, &self.extract_path, self.with_elevated_task, - self - .app - .config() - .tauri - .updater - .windows - .install_mode - .clone() - .msiexec_args(), + &self.app.config(), )?; #[cfg(not(target_os = "windows"))] copy_files_and_run(archive_buffer, &self.extract_path)?; @@ -698,17 +690,19 @@ fn copy_files_and_run(archive_buffer: R, extract_path: &Path) -> } // Windows - +// // ### Expected structure: // ├── [AppName]_[version]_x64.msi.zip # ZIP generated by tauri-bundler // │ └──[AppName]_[version]_x64.msi # Application MSI +// ├── [AppName]_[version]_x64-setup.exe.zip # ZIP generated by tauri-bundler +// │ └──[AppName]_[version]_x64-setup.exe # NSIS installer // └── ... - +// // ## MSI // Update server can provide a MSI for Windows. (Generated with tauri-bundler from *Wix*) // To replace current version of the application. In later version we'll offer // incremental update to push specific binaries. - +// // ## EXE // Update server can provide a custom EXE (installer) who can run any task. #[cfg(target_os = "windows")] @@ -717,7 +711,7 @@ fn copy_files_and_run( archive_buffer: R, _extract_path: &Path, with_elevated_task: bool, - msiexec_args: &[&str], + config: &crate::Config, ) -> Result { // FIXME: We need to create a memory buffer with the MSI and then run it. // (instead of extracting the MSI to a temp path) @@ -736,8 +730,6 @@ fn copy_files_and_run( extractor.extract_into(&tmp_dir)?; let paths = read_dir(&tmp_dir)?; - // This consumes the TempDir without deleting directory on the filesystem, - // meaning that the directory will no longer be automatically deleted. for path in paths { let found_path = path?.path(); @@ -745,9 +737,15 @@ fn copy_files_and_run( // If it's an `exe` we expect an installer not a runtime. if found_path.extension() == Some(OsStr::new("exe")) { // Run the EXE - Command::new(found_path) - .spawn() - .expect("installer failed to start"); + let mut installer = Command::new(found_path); + if crate::utils::config::WindowsUpdateInstallMode::Quiet + == config.tauri.updater.windows.install_mode + { + installer.arg("/S"); + } + installer.args(&config.tauri.updater.windows.installer_args); + + installer.spawn().expect("installer failed to start"); exit(0); } else if found_path.extension() == Some(OsStr::new("msi")) { @@ -760,7 +758,7 @@ fn copy_files_and_run( let product_name = bin_name.replace(".exe", ""); // Check if there is a task that enables the updater to skip the UAC prompt - let update_task_name = format!("Update {} - Skip UAC", product_name); + let update_task_name = format!("Update {product_name} - Skip UAC"); if let Ok(output) = Command::new("schtasks") .arg("/QUERY") .arg("/TN") @@ -801,6 +799,18 @@ fn copy_files_and_run( msi_path_arg.push(&found_path); msi_path_arg.push("\"\"\""); + let mut msiexec_args = config + .tauri + .updater + .windows + .install_mode + .clone() + .msiexec_args() + .iter() + .map(|p| p.to_string()) + .collect::>(); + msiexec_args.extend(config.tauri.updater.windows.installer_args.clone()); + // run the installer and relaunch the application let system_root = std::env::var("SYSTEMROOT"); let powershell_path = system_root.as_ref().map_or_else( @@ -968,7 +978,7 @@ pub fn extract_path_from_executable(env: &Env, executable_path: &Path) -> PathBu // Convert base64 to string and prevent failing fn base64_to_string(base64_string: &str) -> Result { - let decoded_string = &decode(base64_string)?; + let decoded_string = &base64::engine::general_purpose::STANDARD.decode(base64_string)?; let result = from_utf8(decoded_string) .map_err(|_| Error::SignatureUtf8(base64_string.into()))? .to_string(); @@ -1565,11 +1575,10 @@ mod test { #[cfg(target_os = "windows")] let archive_file = "archive.windows.zip"; - let good_archive_url = format!("{}/{}", mockito::server_url(), archive_file); + let good_archive_url = format!("{}/{archive_file}", mockito::server_url()); let mut signature_file = File::open(format!( - "./test/updater/fixture/archives/{}.sig", - archive_file + "./test/updater/fixture/archives/{archive_file}.sig" )) .expect("Unable to open signature"); let mut signature = String::new(); @@ -1585,10 +1594,10 @@ mod test { .expect("Unable to read signature as string"); // add sample file - let _m = mockito::mock("GET", format!("/{}", archive_file).as_str()) + let _m = mockito::mock("GET", format!("/{archive_file}").as_str()) .with_status(200) .with_header("content-type", "application/octet-stream") - .with_body_from_file(format!("./test/updater/fixture/archives/{}", archive_file)) + .with_body_from_file(format!("./test/updater/fixture/archives/{archive_file}")) .create(); // sample mock for update file diff --git a/core/tauri/src/updater/mod.rs b/core/tauri/src/updater/mod.rs index 240c06bc8..ef3f09082 100644 --- a/core/tauri/src/updater/mod.rs +++ b/core/tauri/src/updater/mod.rs @@ -202,7 +202,7 @@ impl UpdateBuilder { /// let handle = app.handle(); /// tauri::async_runtime::spawn(async move { /// let kind = if cfg!(debug_assertions) { "debug" } else { "release" }; - /// let builder = tauri::updater::builder(handle).target(format!("{}-{}", tauri::updater::target().unwrap(), kind)); + /// let builder = tauri::updater::builder(handle).target(format!("{}-{kind}", tauri::updater::target().unwrap())); /// match builder.check().await { /// Ok(update) => {} /// Err(error) => {} @@ -567,13 +567,13 @@ async fn prompt_for_install( parent_window, format!(r#"A new version of {app_name} is available! "#), format!( - r#"{} {} is now available -- you have {}. + r#"{app_name} {} is now available -- you have {}. Would you like to install it now? Release Notes: -{}"#, - app_name, update.version, update.current_version, body, +{body}"#, + update.version, update.current_version ), ); diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 0d3c74f93..d88c17b9a 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -7,6 +7,7 @@ pub(crate) mod menu; pub use menu::{MenuEvent, MenuHandle}; +use url::Url; #[cfg(target_os = "macos")] use crate::TitleBarStyle; @@ -28,7 +29,7 @@ use crate::{ }, sealed::ManagerBase, sealed::RuntimeOrDispatch, - utils::config::WindowUrl, + utils::config::{WindowConfig, WindowUrl}, EventLoopMessage, Invoke, InvokeError, InvokeMessage, InvokeResolver, Manager, PageLoadPayload, Runtime, Theme, WindowEvent, }; @@ -56,6 +57,7 @@ use std::{ }; pub(crate) type WebResourceRequestHandler = dyn Fn(&HttpRequest, &mut HttpResponse) + Send + Sync; +pub(crate) type NavigationHandler = dyn Fn(Url) -> bool + Send; #[derive(Clone, Serialize)] struct WindowCreatedEvent { @@ -116,6 +118,7 @@ pub struct WindowBuilder<'a, R: Runtime> { pub(crate) window_builder: >::WindowBuilder, pub(crate) webview_attributes: WebviewAttributes, web_resource_request_handler: Option>, + navigation_handler: Option>, } impl<'a, R: Runtime> fmt::Debug for WindowBuilder<'a, R> { @@ -189,9 +192,58 @@ impl<'a, R: Runtime> WindowBuilder<'a, R> { window_builder: >::WindowBuilder::new(), webview_attributes: WebviewAttributes::new(url), web_resource_request_handler: None, + navigation_handler: None, } } + /// Initializes a webview window builder from a window config from tauri.conf.json. + /// Keep in mind that you can't create 2 windows with the same `label` so make sure + /// that the initial window was closed or change the label of the new `WindowBuilder`. + /// + /// # Known issues + /// + /// On Windows, this function deadlocks when used in a synchronous command, see [the Webview2 issue]. + /// You should use `async` commands when creating windows. + /// + /// # Examples + /// + /// - Create a window in a command: + /// + /// ``` + /// #[tauri::command] + /// async fn reopen_window(app: tauri::AppHandle) { + /// let window = tauri::WindowBuilder::from_config(&app, app.config().tauri.windows.get(0).unwrap().clone()) + /// .build() + /// .unwrap(); + /// } + /// ``` + /// + /// [the Webview2 issue]: https://github.com/tauri-apps/wry/issues/583 + pub fn from_config>(manager: &'a M, config: WindowConfig) -> Self { + let runtime = manager.runtime(); + let app_handle = manager.app_handle(); + let url = config.url.clone(); + let file_drop_enabled = config.file_drop_enabled; + let mut builder = Self { + manager: manager.manager().clone(), + runtime, + app_handle, + label: config.label.clone(), + window_builder: >::WindowBuilder::with_config( + config, + ), + webview_attributes: WebviewAttributes::new(url), + web_resource_request_handler: None, + navigation_handler: None, + }; + + if !file_drop_enabled { + builder = builder.disable_file_drop_handler(); + } + + builder + } + /// Defines a closure to be executed when the webview makes an HTTP request for a web resource, allowing you to modify the response. /// /// Currently only implemented for the `tauri` URI protocol. @@ -237,6 +289,33 @@ impl<'a, R: Runtime> WindowBuilder<'a, R> { self } + /// Defines a closure to be executed when the webview navigates to a URL. Returning `false` cancels the navigation. + /// + /// # Examples + /// + /// ```rust,no_run + /// use tauri::{ + /// utils::config::{Csp, CspDirectiveSources, WindowUrl}, + /// http::header::HeaderValue, + /// window::WindowBuilder, + /// }; + /// use std::collections::HashMap; + /// tauri::Builder::default() + /// .setup(|app| { + /// WindowBuilder::new(app, "core", WindowUrl::App("index.html".into())) + /// .on_navigation(|url| { + /// // allow the production URL or localhost on dev + /// url.scheme() == "tauri" || (cfg!(dev) && url.host_str() == Some("localhost")) + /// }) + /// .build()?; + /// Ok(()) + /// }); + /// ``` + pub fn on_navigation bool + Send + 'static>(mut self, f: F) -> Self { + self.navigation_handler.replace(Box::new(f)); + self + } + /// Creates a new webview window. pub fn build(mut self) -> crate::Result> { let web_resource_request_handler = self.web_resource_request_handler.take(); @@ -246,12 +325,13 @@ impl<'a, R: Runtime> WindowBuilder<'a, R> { self.label.clone(), )?; let labels = self.manager.labels().into_iter().collect::>(); - let pending = self.manager.prepare_window( + let mut pending = self.manager.prepare_window( self.app_handle.clone(), pending, &labels, web_resource_request_handler, )?; + pending.navigation_handler = self.navigation_handler.take(); let window = match &mut self.runtime { RuntimeOrDispatch::Runtime(runtime) => runtime.create_window(pending), RuntimeOrDispatch::RuntimeHandle(handle) => handle.create_window(pending), @@ -259,6 +339,11 @@ impl<'a, R: Runtime> WindowBuilder<'a, R> { } .map(|window| self.manager.attach_window(self.app_handle.clone(), window))?; + self.manager.eval_script_all(format!( + "window.__TAURI_METADATA__.__windows = {window_labels_array}.map(function (label) {{ return {{ label: label }} }})", + window_labels_array = serde_json::to_string(&self.manager.labels())?, + ))?; + self.manager.emit_filter( "tauri://window-created", None, @@ -408,6 +493,13 @@ impl<'a, R: Runtime> WindowBuilder<'a, R> { self } + /// Whether the window should always be on top of other windows. + #[must_use] + pub fn content_protected(mut self, protected: bool) -> Self { + self.window_builder = self.window_builder.content_protected(protected); + self + } + /// Sets the window icon. pub fn icon(mut self, icon: Icon) -> crate::Result { self.window_builder = self.window_builder.icon(icon.try_into()?)?; @@ -559,6 +651,22 @@ impl<'a, R: Runtime> WindowBuilder<'a, R> { self } + /// Set additional arguments for the webview. + /// + /// ## Platform-specific + /// + /// - **macOS / Linux / Android / iOS**: Unsupported. + /// + /// ## Warning + /// + /// By default wry passes `--disable-features=msWebOOUI,msPdfOOUI,msSmartScreenProtection` + /// so if you use this method, you also need to disable these components by yourself if you want. + #[must_use] + pub fn additional_browser_args(mut self, additional_args: &str) -> Self { + self.webview_attributes.additional_browser_args = Some(additional_args.to_string()); + self + } + /// Data directory for the webview. #[must_use] pub fn data_directory(mut self, data_directory: PathBuf) -> Self { @@ -924,6 +1032,11 @@ impl Window { self.window.dispatcher.is_fullscreen().map_err(Into::into) } + /// Gets the window's current minimized state. + pub fn is_minimized(&self) -> crate::Result { + self.window.dispatcher.is_minimized().map_err(Into::into) + } + /// Gets the window's current maximized state. pub fn is_maximized(&self) -> crate::Result { self.window.dispatcher.is_maximized().map_err(Into::into) @@ -944,6 +1057,11 @@ impl Window { self.window.dispatcher.is_visible().map_err(Into::into) } + /// Gets the window's current title. + pub fn title(&self) -> crate::Result { + self.window.dispatcher.title().map_err(Into::into) + } + /// Returns the monitor on which the window currently resides. /// /// Returns None if current monitor can't be detected. @@ -1169,6 +1287,15 @@ impl Window { .map_err(Into::into) } + /// Prevents the window contents from being captured by other apps. + pub fn set_content_protected(&self, protected: bool) -> crate::Result<()> { + self + .window + .dispatcher + .set_content_protected(protected) + .map_err(Into::into) + } + /// Resizes this window. pub fn set_size>(&self, size: S) -> crate::Result<()> { self @@ -1310,6 +1437,11 @@ impl Window { /// Webview APIs. impl Window { + /// Returns the current url of the webview. + pub fn url(&self) -> crate::Result { + self.window.dispatcher.url().map_err(Into::into) + } + /// Handles this window receiving an [`InvokeMessage`]. pub fn on_message(self, payload: InvokePayload) -> crate::Result<()> { let manager = self.manager.clone(); diff --git a/core/tests/app-updater/src/main.rs b/core/tests/app-updater/src/main.rs index f0ffd2a75..db4a8db02 100644 --- a/core/tests/app-updater/src/main.rs +++ b/core/tests/app-updater/src/main.rs @@ -8,6 +8,13 @@ )] fn main() { + let mut context = tauri::generate_context!(); + if std::env::var("TARGET").unwrap_or_default() == "nsis" { + context.config_mut().tauri.updater.windows.installer_args = vec![format!( + "/D={}", + std::env::current_exe().unwrap().parent().unwrap().display() + )]; + } tauri::Builder::default() .setup(|app| { let handle = app.handle(); @@ -28,6 +35,6 @@ fn main() { }); Ok(()) }) - .run(tauri::generate_context!()) + .run(context) .expect("error while running tauri application"); } diff --git a/core/tests/app-updater/tests/update.rs b/core/tests/app-updater/tests/update.rs index a755bd4f2..c41983c86 100644 --- a/core/tests/app-updater/tests/update.rs +++ b/core/tests/app-updater/tests/update.rs @@ -54,7 +54,13 @@ fn get_cli_bin_path(cli_dir: &Path, debug: bool) -> Option { } } -fn build_app(cli_bin_path: &Path, cwd: &Path, config: &Config, bundle_updater: bool) { +fn build_app( + cli_bin_path: &Path, + cwd: &Path, + config: &Config, + bundle_updater: bool, + target: BundleTarget, +) { let mut command = Command::new(cli_bin_path); command .args(["build", "--debug", "--verbose"]) @@ -62,18 +68,22 @@ fn build_app(cli_bin_path: &Path, cwd: &Path, config: &Config, bundle_updater: b .arg(serde_json::to_string(config).unwrap()) .current_dir(cwd); - #[cfg(windows)] - command.args(["--bundles", "msi"]); #[cfg(target_os = "linux")] - command.args(["--bundles", "appimage"]); + command.args(["--bundles", target.name()]); #[cfg(target_os = "macos")] - command.args(["--bundles", "app"]); + command.args(["--bundles", target.name()]); if bundle_updater { + #[cfg(windows)] + command.args(["--bundles", "msi", "nsis"]); + command .env("TAURI_PRIVATE_KEY", UPDATER_PRIVATE_KEY) .env("TAURI_KEY_PASSWORD", "") .args(["--bundles", "updater"]); + } else { + #[cfg(windows)] + command.args(["--bundles", target.name()]); } let status = command @@ -85,21 +95,62 @@ fn build_app(cli_bin_path: &Path, cwd: &Path, config: &Config, bundle_updater: b } } +#[derive(Copy, Clone)] +enum BundleTarget { + AppImage, + + App, + + Msi, + Nsis, +} + +impl BundleTarget { + fn name(self) -> &'static str { + match self { + Self::AppImage => "appimage", + Self::App => "app", + Self::Msi => "msi", + Self::Nsis => "nsis", + } + } +} + +impl Default for BundleTarget { + fn default() -> Self { + #[cfg(any(target_os = "macos", target_os = "ios"))] + return Self::App; + #[cfg(target_os = "linux")] + return Self::App; + #[cfg(windows)] + return Self::Nsis; + } +} + #[cfg(target_os = "linux")] -fn bundle_path(root_dir: &Path, version: &str) -> PathBuf { - root_dir.join(format!( - "target/debug/bundle/appimage/app-updater_{version}_amd64.AppImage" - )) +fn bundle_paths(root_dir: &Path, version: &str) -> Vec<(BundleTarget, PathBuf)> { + vec![( + BundleTarget::AppImage, + root_dir.join(format!( + "target/debug/bundle/appimage/app-updater_{version}_amd64.AppImage" + )), + )] } #[cfg(target_os = "macos")] -fn bundle_path(root_dir: &Path, _version: &str) -> PathBuf { - root_dir.join("target/debug/bundle/macos/app-updater.app") +fn bundle_paths(root_dir: &Path, _version: &str) -> Vec<(BundleTarget, PathBuf)> { + vec![( + BundleTarget::App, + root_dir.join(format!("target/debug/bundle/macos/app-updater.app")), + )] } #[cfg(target_os = "ios")] -fn bundle_path(root_dir: &Path, _version: &str) -> PathBuf { - root_dir.join(format!("target/debug/bundle/ios/app-updater.ipa")) +fn bundle_paths(root_dir: &Path, _version: &str) -> Vec<(BundleTarget, PathBuf)> { + vec![( + BundleTarget::App, + root_dir.join(format!("target/debug/bundle/ios/app-updater.ipa")), + )] } #[cfg(target_os = "android")] @@ -108,11 +159,21 @@ fn bundle_path(root_dir: &Path, _version: &str) -> PathBuf { } #[cfg(windows)] -fn bundle_path(root_dir: &Path, version: &str) -> PathBuf { - root_dir.join(format!( - "target/debug/bundle/msi/app-updater_{}_x64_en-US.msi", - version - )) +fn bundle_paths(root_dir: &Path, version: &str) -> Vec<(BundleTarget, PathBuf)> { + vec![ + ( + BundleTarget::Nsis, + root_dir.join(format!( + "target/debug/bundle/nsis/app-updater_{version}_x64-setup.exe" + )), + ), + ( + BundleTarget::Msi, + root_dir.join(format!( + "target/debug/bundle/msi/app-updater_{version}_x64_en-US.msi" + )), + ), + ] } #[test] @@ -144,99 +205,118 @@ fn update_app() { }; // bundle app update - build_app(&cli_bin_path, &manifest_dir, &config, true); + build_app( + &cli_bin_path, + &manifest_dir, + &config, + true, + Default::default(), + ); - let updater_ext = if cfg!(windows) { "zip" } else { "tar.gz" }; + let updater_zip_ext = if cfg!(windows) { "zip" } else { "tar.gz" }; - let out_bundle_path = bundle_path(&root_dir, "1.0.0"); - let signature_path = out_bundle_path.with_extension(format!( - "{}.{}.sig", - out_bundle_path.extension().unwrap().to_str().unwrap(), - updater_ext - )); - let signature = std::fs::read_to_string(&signature_path) - .unwrap_or_else(|_| panic!("failed to read signature file {}", signature_path.display())); - let out_updater_path = out_bundle_path.with_extension(format!( - "{}.{}", - out_bundle_path.extension().unwrap().to_str().unwrap(), - updater_ext - )); - let updater_path = root_dir.join(format!( - "target/debug/{}", - out_updater_path.file_name().unwrap().to_str().unwrap() - )); - std::fs::rename(&out_updater_path, &updater_path).expect("failed to rename bundle"); + for (bundle_target, out_bundle_path) in bundle_paths(&root_dir, "1.0.0") { + let bundle_updater_ext = out_bundle_path + .extension() + .unwrap() + .to_str() + .unwrap() + .replace("exe", "nsis"); + let signature_path = + out_bundle_path.with_extension(format!("{bundle_updater_ext}.{updater_zip_ext}.sig")); + let signature = std::fs::read_to_string(&signature_path) + .unwrap_or_else(|_| panic!("failed to read signature file {}", signature_path.display())); + let out_updater_path = + out_bundle_path.with_extension(format!("{}.{}", bundle_updater_ext, updater_zip_ext)); + let updater_path = root_dir.join(format!( + "target/debug/{}", + out_updater_path.file_name().unwrap().to_str().unwrap() + )); + std::fs::rename(&out_updater_path, &updater_path).expect("failed to rename bundle"); - std::thread::spawn(move || { - // start the updater server - let server = tiny_http::Server::http("localhost:3007").expect("failed to start updater server"); + let target = target.clone(); + std::thread::spawn(move || { + // start the updater server + let server = + tiny_http::Server::http("localhost:3007").expect("failed to start updater server"); - loop { - if let Ok(request) = server.recv() { - match request.url() { - "/" => { - let mut platforms = HashMap::new(); + loop { + if let Ok(request) = server.recv() { + match request.url() { + "/" => { + let mut platforms = HashMap::new(); - platforms.insert( - target.clone(), - PlatformUpdate { - signature: signature.clone(), - url: "http://localhost:3007/download", - with_elevated_task: false, - }, - ); - let body = serde_json::to_vec(&Update { - version: "1.0.0", - date: time::OffsetDateTime::now_utc() - .format(&time::format_description::well_known::Rfc3339) - .unwrap(), - platforms, - }) - .unwrap(); - let len = body.len(); - let response = tiny_http::Response::new( - tiny_http::StatusCode(200), - Vec::new(), - std::io::Cursor::new(body), - Some(len), - None, - ); - let _ = request.respond(response); + platforms.insert( + target.clone(), + PlatformUpdate { + signature: signature.clone(), + url: "http://localhost:3007/download", + with_elevated_task: false, + }, + ); + let body = serde_json::to_vec(&Update { + version: "1.0.0", + date: time::OffsetDateTime::now_utc() + .format(&time::format_description::well_known::Rfc3339) + .unwrap(), + platforms, + }) + .unwrap(); + let len = body.len(); + let response = tiny_http::Response::new( + tiny_http::StatusCode(200), + Vec::new(), + std::io::Cursor::new(body), + Some(len), + None, + ); + let _ = request.respond(response); + } + "/download" => { + let _ = request.respond(tiny_http::Response::from_file( + File::open(&updater_path).unwrap_or_else(|_| { + panic!("failed to open updater bundle {}", updater_path.display()) + }), + )); + // close server + return; + } + _ => (), } - "/download" => { - let _ = request.respond(tiny_http::Response::from_file( - File::open(&updater_path).unwrap_or_else(|_| { - panic!("failed to open updater bundle {}", updater_path.display()) - }), - )); - } - _ => (), } } + }); + + config.package.version = "0.1.0"; + + // bundle initial app version + build_app(&cli_bin_path, &manifest_dir, &config, false, bundle_target); + + let mut binary_cmd = if cfg!(windows) { + Command::new(root_dir.join("target/debug/app-updater.exe")) + } else if cfg!(target_os = "macos") { + Command::new( + bundle_paths(&root_dir, "0.1.0") + .first() + .unwrap() + .1 + .join("Contents/MacOS/app-updater"), + ) + } else if std::env::var("CI").map(|v| v == "true").unwrap_or_default() { + let mut c = Command::new("xvfb-run"); + c.arg("--auto-servernum") + .arg(&bundle_paths(&root_dir, "0.1.0").first().unwrap().1); + c + } else { + Command::new(&bundle_paths(&root_dir, "0.1.0").first().unwrap().1) + }; + + binary_cmd.env("TARGET", bundle_target.name()); + + let status = binary_cmd.status().expect("failed to run app"); + + if !status.success() { + panic!("failed to run app"); } - }); - - config.package.version = "0.1.0"; - - // bundle initial app version - build_app(&cli_bin_path, &manifest_dir, &config, false); - - let mut binary_cmd = if cfg!(windows) { - Command::new(root_dir.join("target/debug/app-updater.exe")) - } else if cfg!(target_os = "macos") { - Command::new(bundle_path(&root_dir, "0.1.0").join("Contents/MacOS/app-updater")) - } else if std::env::var("CI").map(|v| v == "true").unwrap_or_default() { - let mut c = Command::new("xvfb-run"); - c.arg("--auto-servernum") - .arg(bundle_path(&root_dir, "0.1.0")); - c - } else { - Command::new(bundle_path(&root_dir, "0.1.0")) - }; - - let status = binary_cmd.status().expect("failed to run app"); - - if !status.success() { - panic!("failed to run app"); } } diff --git a/examples/api/dist/assets/index.js b/examples/api/dist/assets/index.js index 6a4093e32..cc95040c0 100644 --- a/examples/api/dist/assets/index.js +++ b/examples/api/dist/assets/index.js @@ -1,46 +1,47 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerpolicy&&(o.referrerPolicy=l.referrerpolicy),l.crossorigin==="use-credentials"?o.credentials="include":l.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();function V(){}function bs(e){return e()}function jl(){return Object.create(null)}function ue(e){e.forEach(bs)}function to(e){return typeof e=="function"}function he(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let Un;function no(e,t){return Un||(Un=document.createElement("a")),Un.href=t,e===Un.href}function io(e){return Object.keys(e).length===0}function lo(e,...t){if(e==null)return V;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function gs(e,t,n){e.$$.on_destroy.push(lo(t,n))}function s(e,t){e.appendChild(t)}function m(e,t,n){e.insertBefore(t,n||null)}function p(e){e.parentNode.removeChild(e)}function ft(e,t){for(let n=0;ne.removeEventListener(t,n,i)}function Xn(e){return function(t){return t.preventDefault(),e.call(this,t)}}function r(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function re(e){return e===""?null:+e}function oo(e){return Array.from(e.childNodes)}function $(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function q(e,t){e.value=t==null?"":t}function zt(e,t){for(let n=0;n{Gn.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}else i&&i()}function Kn(e){e&&e.c()}function Vt(e,t,n,i){const{fragment:l,on_mount:o,on_destroy:u,after_update:d}=e.$$;l&&l.m(t,n),i||Dt(()=>{const c=o.map(bs).filter(to);u?u.push(...c):ue(c),e.$$.on_mount=[]}),d.forEach(Dt)}function Gt(e,t){const n=e.$$;n.fragment!==null&&(ue(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function fo(e,t){e.$$.dirty[0]===-1&&(jt.push(e),uo(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const g=v.length?v[0]:_;return f.ctx&&l(f.ctx[k],f.ctx[k]=g)&&(!f.skip_bound&&f.bound[k]&&f.bound[k](g),y&&fo(e,k)),_}):[],f.update(),y=!0,ue(f.before_update),f.fragment=i?i(f.ctx):!1,t.target){if(t.hydrate){const k=oo(t.target);f.fragment&&f.fragment.l(k),k.forEach(p)}else f.fragment&&f.fragment.c();t.intro&&Me(e.$$.fragment),Vt(e,t.target,t.anchor,t.customElement),vs()}qt(c)}class ye{$destroy(){Gt(this,1),this.$destroy=V}$on(t,n){const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const l=i.indexOf(n);l!==-1&&i.splice(l,1)}}$set(t){this.$$set&&!io(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Et=[];function ws(e,t=V){let n;const i=new Set;function l(d){if(he(e,d)&&(e=d,n)){const c=!Et.length;for(const f of i)f[1](),Et.push(f,e);if(c){for(let f=0;f{i.delete(f),i.size===0&&(n(),n=null)}}return{set:l,update:o,subscribe:u}}var po=Object.defineProperty,we=(e,t)=>{for(var n in t)po(e,n,{get:t[n],enumerable:!0})},mo={};we(mo,{convertFileSrc:()=>ks,invoke:()=>$n,transformCallback:()=>pt});function ho(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function pt(e,t=!1){let n=ho(),i=`_${n}`;return Object.defineProperty(window,i,{value:l=>(t&&Reflect.deleteProperty(window,i),e==null?void 0:e(l)),writable:!1,configurable:!0}),n}async function $n(e,t={}){return new Promise((n,i)=>{let l=pt(u=>{n(u),Reflect.deleteProperty(window,`_${o}`)},!0),o=pt(u=>{i(u),Reflect.deleteProperty(window,`_${l}`)},!0);window.__TAURI_IPC__({cmd:e,callback:l,error:o,...t})})}function ks(e,t="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${t}.localhost/${n}`:`${t}://localhost/${n}`}async function S(e){return $n("tauri",e)}var _o={};we(_o,{Child:()=>Ms,Command:()=>Oi,EventEmitter:()=>Jn,open:()=>Pi});async function bo(e,t,n=[],i){return typeof n=="object"&&Object.freeze(n),S({__tauriModule:"Shell",message:{cmd:"execute",program:t,args:n,options:i,onEventFn:pt(e)}})}var Jn=class{constructor(){this.eventListeners=Object.create(null)}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}on(e,t){return e in this.eventListeners?this.eventListeners[e].push(t):this.eventListeners[e]=[t],this}once(e,t){let n=(...i)=>{this.removeListener(e,n),t(...i)};return this.addListener(e,n)}off(e,t){return e in this.eventListeners&&(this.eventListeners[e]=this.eventListeners[e].filter(n=>n!==t)),this}removeAllListeners(e){return e?delete this.eventListeners[e]:this.eventListeners=Object.create(null),this}emit(e,...t){if(e in this.eventListeners){let n=this.eventListeners[e];for(let i of n)i(...t);return!0}return!1}listenerCount(e){return e in this.eventListeners?this.eventListeners[e].length:0}prependListener(e,t){return e in this.eventListeners?this.eventListeners[e].unshift(t):this.eventListeners[e]=[t],this}prependOnceListener(e,t){let n=(...i)=>{this.removeListener(e,n),t(...i)};return this.prependListener(e,n)}},Ms=class{constructor(e){this.pid=e}async write(e){return S({__tauriModule:"Shell",message:{cmd:"stdinWrite",pid:this.pid,buffer:typeof e=="string"?e:Array.from(e)}})}async kill(){return S({__tauriModule:"Shell",message:{cmd:"killChild",pid:this.pid}})}},Oi=class extends Jn{constructor(e,t=[],n){super(),this.stdout=new Jn,this.stderr=new Jn,this.program=e,this.args=typeof t=="string"?[t]:t,this.options=n!=null?n:{}}static sidecar(e,t=[],n){let i=new Oi(e,t,n);return i.options.sidecar=!0,i}async spawn(){return bo(e=>{switch(e.event){case"Error":this.emit("error",e.payload);break;case"Terminated":this.emit("close",e.payload);break;case"Stdout":this.stdout.emit("data",e.payload);break;case"Stderr":this.stderr.emit("data",e.payload);break}},this.program,this.args,this.options).then(e=>new Ms(e))}async execute(){return new Promise((e,t)=>{this.on("error",t);let n=[],i=[];this.stdout.on("data",l=>{n.push(l)}),this.stderr.on("data",l=>{i.push(l)}),this.on("close",l=>{e({code:l.code,signal:l.signal,stdout:n.join(` +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerpolicy&&(o.referrerPolicy=l.referrerpolicy),l.crossorigin==="use-credentials"?o.credentials="include":l.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();function V(){}function ws(e){return e()}function Vl(){return Object.create(null)}function se(e){e.forEach(ws)}function so(e){return typeof e=="function"}function _e(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let Gn;function oo(e,t){return Gn||(Gn=document.createElement("a")),Gn.href=t,e===Gn.href}function ao(e){return Object.keys(e).length===0}function ro(e,...t){if(e==null)return V;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function ks(e,t,n){e.$$.on_destroy.push(ro(t,n))}function s(e,t){e.appendChild(t)}function m(e,t,n){e.insertBefore(t,n||null)}function p(e){e.parentNode.removeChild(e)}function mt(e,t){for(let n=0;ne.removeEventListener(t,n,i)}function Zn(e){return function(t){return t.preventDefault(),e.call(this,t)}}function r(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function le(e){return e===""?null:+e}function co(e){return Array.from(e.childNodes)}function Q(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function q(e,t){e.value=t==null?"":t}function Dt(e,t){for(let n=0;n{Kn.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}else i&&i()}function xn(e){e&&e.c()}function Gt(e,t,n,i){const{fragment:l,on_mount:o,on_destroy:u,after_update:d}=e.$$;l&&l.m(t,n),i||Wt(()=>{const c=o.map(ws).filter(so);u?u.push(...c):se(c),e.$$.on_mount=[]}),d.forEach(Wt)}function Jt(e,t){const n=e.$$;n.fragment!==null&&(se(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function _o(e,t){e.$$.dirty[0]===-1&&(Ut.push(e),mo(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const y=v.length?v[0]:_;return f.ctx&&l(f.ctx[k],f.ctx[k]=y)&&(!f.skip_bound&&f.bound[k]&&f.bound[k](y),g&&_o(e,k)),_}):[],f.update(),g=!0,se(f.before_update),f.fragment=i?i(f.ctx):!1,t.target){if(t.hydrate){const k=co(t.target);f.fragment&&f.fragment.l(k),k.forEach(p)}else f.fragment&&f.fragment.c();t.intro&&Se(e.$$.fragment),Gt(e,t.target,t.anchor,t.customElement),Ts()}Bt(c)}class ve{$destroy(){Jt(this,1),this.$destroy=V}$on(t,n){const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const l=i.indexOf(n);l!==-1&&i.splice(l,1)}}$set(t){this.$$set&&!ao(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const zt=[];function Cs(e,t=V){let n;const i=new Set;function l(d){if(_e(e,d)&&(e=d,n)){const c=!zt.length;for(const f of i)f[1](),zt.push(f,e);if(c){for(let f=0;f{i.delete(f),i.size===0&&(n(),n=null)}}return{set:l,update:o,subscribe:u}}var bo=Object.defineProperty,Ce=(e,t)=>{for(var n in t)bo(e,n,{get:t[n],enumerable:!0})},go={};Ce(go,{convertFileSrc:()=>As,invoke:()=>ei,transformCallback:()=>ht});function yo(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function ht(e,t=!1){let n=yo(),i=`_${n}`;return Object.defineProperty(window,i,{value:l=>(t&&Reflect.deleteProperty(window,i),e==null?void 0:e(l)),writable:!1,configurable:!0}),n}async function ei(e,t={}){return new Promise((n,i)=>{let l=ht(u=>{n(u),Reflect.deleteProperty(window,`_${o}`)},!0),o=ht(u=>{i(u),Reflect.deleteProperty(window,`_${l}`)},!0);window.__TAURI_IPC__({cmd:e,callback:l,error:o,...t})})}function As(e,t="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${t}.localhost/${n}`:`${t}://localhost/${n}`}async function S(e){return ei("tauri",e)}var vo={};Ce(vo,{Child:()=>Ss,Command:()=>Hi,EventEmitter:()=>Qn,open:()=>Fi});async function wo(e,t,n=[],i){return typeof n=="object"&&Object.freeze(n),S({__tauriModule:"Shell",message:{cmd:"execute",program:t,args:n,options:i,onEventFn:ht(e)}})}var Qn=class{constructor(){this.eventListeners=Object.create(null)}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}on(e,t){return e in this.eventListeners?this.eventListeners[e].push(t):this.eventListeners[e]=[t],this}once(e,t){let n=(...i)=>{this.removeListener(e,n),t(...i)};return this.addListener(e,n)}off(e,t){return e in this.eventListeners&&(this.eventListeners[e]=this.eventListeners[e].filter(n=>n!==t)),this}removeAllListeners(e){return e?delete this.eventListeners[e]:this.eventListeners=Object.create(null),this}emit(e,...t){if(e in this.eventListeners){let n=this.eventListeners[e];for(let i of n)i(...t);return!0}return!1}listenerCount(e){return e in this.eventListeners?this.eventListeners[e].length:0}prependListener(e,t){return e in this.eventListeners?this.eventListeners[e].unshift(t):this.eventListeners[e]=[t],this}prependOnceListener(e,t){let n=(...i)=>{this.removeListener(e,n),t(...i)};return this.prependListener(e,n)}},Ss=class{constructor(e){this.pid=e}async write(e){return S({__tauriModule:"Shell",message:{cmd:"stdinWrite",pid:this.pid,buffer:typeof e=="string"?e:Array.from(e)}})}async kill(){return S({__tauriModule:"Shell",message:{cmd:"killChild",pid:this.pid}})}},Hi=class extends Qn{constructor(e,t=[],n){super(),this.stdout=new Qn,this.stderr=new Qn,this.program=e,this.args=typeof t=="string"?[t]:t,this.options=n!=null?n:{}}static sidecar(e,t=[],n){let i=new Hi(e,t,n);return i.options.sidecar=!0,i}async spawn(){return wo(e=>{switch(e.event){case"Error":this.emit("error",e.payload);break;case"Terminated":this.emit("close",e.payload);break;case"Stdout":this.stdout.emit("data",e.payload);break;case"Stderr":this.stderr.emit("data",e.payload);break}},this.program,this.args,this.options).then(e=>new Ss(e))}async execute(){return new Promise((e,t)=>{this.on("error",t);let n=[],i=[];this.stdout.on("data",l=>{n.push(l)}),this.stderr.on("data",l=>{i.push(l)}),this.on("close",l=>{e({code:l.code,signal:l.signal,stdout:n.join(` `),stderr:i.join(` -`)})}),this.spawn().catch(t)})}};async function Pi(e,t){return S({__tauriModule:"Shell",message:{cmd:"open",path:e,with:t}})}var go={};we(go,{TauriEvent:()=>Ss,emit:()=>ni,listen:()=>Xt,once:()=>Ls});async function Ts(e,t){return S({__tauriModule:"Event",message:{cmd:"unlisten",event:e,eventId:t}})}async function Cs(e,t,n){await S({__tauriModule:"Event",message:{cmd:"emit",event:e,windowLabel:t,payload:n}})}async function Ri(e,t,n){return S({__tauriModule:"Event",message:{cmd:"listen",event:e,windowLabel:t,handler:pt(n)}}).then(i=>async()=>Ts(e,i))}async function As(e,t,n){return Ri(e,t,i=>{n(i),Ts(e,i.id).catch(()=>{})})}var Ss=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e.CHECK_UPDATE="tauri://update",e.UPDATE_AVAILABLE="tauri://update-available",e.INSTALL_UPDATE="tauri://update-install",e.STATUS_UPDATE="tauri://update-status",e.DOWNLOAD_PROGRESS="tauri://update-download-progress",e))(Ss||{});async function Xt(e,t){return Ri(e,null,t)}async function Ls(e,t){return As(e,null,t)}async function ni(e,t){return Cs(e,void 0,t)}var yo={};we(yo,{CloseRequestedEvent:()=>Os,LogicalPosition:()=>Es,LogicalSize:()=>Qn,PhysicalPosition:()=>et,PhysicalSize:()=>dt,UserAttentionType:()=>Ii,WebviewWindow:()=>mt,WebviewWindowHandle:()=>Ds,WindowManager:()=>Ws,appWindow:()=>Ue,availableMonitors:()=>ko,currentMonitor:()=>vo,getAll:()=>zs,getCurrent:()=>Ut,primaryMonitor:()=>wo});var Qn=class{constructor(e,t){this.type="Logical",this.width=e,this.height=t}},dt=class{constructor(e,t){this.type="Physical",this.width=e,this.height=t}toLogical(e){return new Qn(this.width/e,this.height/e)}},Es=class{constructor(e,t){this.type="Logical",this.x=e,this.y=t}},et=class{constructor(e,t){this.type="Physical",this.x=e,this.y=t}toLogical(e){return new Es(this.x/e,this.y/e)}},Ii=(e=>(e[e.Critical=1]="Critical",e[e.Informational=2]="Informational",e))(Ii||{});function Ut(){return new mt(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})}function zs(){return window.__TAURI_METADATA__.__windows.map(e=>new mt(e.label,{skip:!0}))}var ql=["tauri://created","tauri://error"],Ds=class{constructor(e){this.label=e,this.listeners=Object.create(null)}async listen(e,t){return this._handleTauriEvent(e,t)?Promise.resolve(()=>{let n=this.listeners[e];n.splice(n.indexOf(t),1)}):Ri(e,this.label,t)}async once(e,t){return this._handleTauriEvent(e,t)?Promise.resolve(()=>{let n=this.listeners[e];n.splice(n.indexOf(t),1)}):As(e,this.label,t)}async emit(e,t){if(ql.includes(e)){for(let n of this.listeners[e]||[])n({event:e,id:-1,windowLabel:this.label,payload:t});return Promise.resolve()}return Cs(e,this.label,t)}_handleTauriEvent(e,t){return ql.includes(e)?(e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t],!0):!1}},Ws=class extends Ds{async scaleFactor(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"scaleFactor"}}}})}async innerPosition(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"innerPosition"}}}}).then(({x:e,y:t})=>new et(e,t))}async outerPosition(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"outerPosition"}}}}).then(({x:e,y:t})=>new et(e,t))}async innerSize(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"innerSize"}}}}).then(({width:e,height:t})=>new dt(e,t))}async outerSize(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"outerSize"}}}}).then(({width:e,height:t})=>new dt(e,t))}async isFullscreen(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isFullscreen"}}}})}async isMaximized(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isMaximized"}}}})}async isDecorated(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isDecorated"}}}})}async isResizable(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isResizable"}}}})}async isVisible(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isVisible"}}}})}async theme(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"theme"}}}})}async center(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"center"}}}})}async requestUserAttention(e){let t=null;return e&&(e===1?t={type:"Critical"}:t={type:"Informational"}),S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"requestUserAttention",payload:t}}}})}async setResizable(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setResizable",payload:e}}}})}async setTitle(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setTitle",payload:e}}}})}async maximize(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"maximize"}}}})}async unmaximize(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"unmaximize"}}}})}async toggleMaximize(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"toggleMaximize"}}}})}async minimize(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"minimize"}}}})}async unminimize(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"unminimize"}}}})}async show(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"show"}}}})}async hide(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"hide"}}}})}async close(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"close"}}}})}async setDecorations(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setDecorations",payload:e}}}})}async setShadow(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setShadow",payload:e}}}})}async setAlwaysOnTop(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setAlwaysOnTop",payload:e}}}})}async setSize(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setSize",payload:{type:e.type,data:{width:e.width,height:e.height}}}}}})}async setMinSize(e){if(e&&e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setMinSize",payload:e?{type:e.type,data:{width:e.width,height:e.height}}:null}}}})}async setMaxSize(e){if(e&&e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setMaxSize",payload:e?{type:e.type,data:{width:e.width,height:e.height}}:null}}}})}async setPosition(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setPosition",payload:{type:e.type,data:{x:e.x,y:e.y}}}}}})}async setFullscreen(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setFullscreen",payload:e}}}})}async setFocus(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setFocus"}}}})}async setIcon(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setIcon",payload:{icon:typeof e=="string"?e:Array.from(e)}}}}})}async setSkipTaskbar(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setSkipTaskbar",payload:e}}}})}async setCursorGrab(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorGrab",payload:e}}}})}async setCursorVisible(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorVisible",payload:e}}}})}async setCursorIcon(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorIcon",payload:e}}}})}async setCursorPosition(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorPosition",payload:{type:e.type,data:{x:e.x,y:e.y}}}}}})}async setIgnoreCursorEvents(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setIgnoreCursorEvents",payload:e}}}})}async startDragging(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"startDragging"}}}})}async onResized(e){return this.listen("tauri://resize",e)}async onMoved(e){return this.listen("tauri://move",e)}async onCloseRequested(e){return this.listen("tauri://close-requested",t=>{let n=new Os(t);Promise.resolve(e(n)).then(()=>{if(!n.isPreventDefault())return this.close()})})}async onFocusChanged(e){let t=await this.listen("tauri://focus",i=>{e({...i,payload:!0})}),n=await this.listen("tauri://blur",i=>{e({...i,payload:!1})});return()=>{t(),n()}}async onScaleChanged(e){return this.listen("tauri://scale-change",e)}async onMenuClicked(e){return this.listen("tauri://menu",e)}async onFileDropEvent(e){let t=await this.listen("tauri://file-drop",l=>{e({...l,payload:{type:"drop",paths:l.payload}})}),n=await this.listen("tauri://file-drop-hover",l=>{e({...l,payload:{type:"hover",paths:l.payload}})}),i=await this.listen("tauri://file-drop-cancelled",l=>{e({...l,payload:{type:"cancel"}})});return()=>{t(),n(),i()}}async onThemeChanged(e){return this.listen("tauri://theme-changed",e)}},Os=class{constructor(e){this._preventDefault=!1,this.event=e.event,this.windowLabel=e.windowLabel,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}},mt=class extends Ws{constructor(e,t={}){super(e),t!=null&&t.skip||S({__tauriModule:"Window",message:{cmd:"createWebview",data:{options:{label:e,...t}}}}).then(async()=>this.emit("tauri://created")).catch(async n=>this.emit("tauri://error",n))}static getByLabel(e){return zs().some(t=>t.label===e)?new mt(e,{skip:!0}):null}},Ue;"__TAURI_METADATA__"in window?Ue=new mt(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0}):(console.warn(`Could not find "window.__TAURI_METADATA__". The "appWindow" value will reference the "main" window label. -Note that this is not an issue if running this frontend on a browser instead of a Tauri window.`),Ue=new mt("main",{skip:!0}));function Hi(e){return e===null?null:{name:e.name,scaleFactor:e.scaleFactor,position:new et(e.position.x,e.position.y),size:new dt(e.size.width,e.size.height)}}async function vo(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"currentMonitor"}}}}).then(Hi)}async function wo(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"primaryMonitor"}}}}).then(Hi)}async function ko(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"availableMonitors"}}}}).then(e=>e.map(Hi))}function Mo(){return navigator.appVersion.includes("Win")}var To={};we(To,{EOL:()=>Co,arch:()=>Lo,platform:()=>Ps,tempdir:()=>Eo,type:()=>So,version:()=>Ao});var Co=Mo()?`\r +`)})}),this.spawn().catch(t)})}};async function Fi(e,t){return S({__tauriModule:"Shell",message:{cmd:"open",path:e,with:t}})}var ko={};Ce(ko,{TauriEvent:()=>Ds,emit:()=>oi,listen:()=>Yt,once:()=>Ws});async function Ls(e,t){return S({__tauriModule:"Event",message:{cmd:"unlisten",event:e,eventId:t}})}async function Es(e,t,n){await S({__tauriModule:"Event",message:{cmd:"emit",event:e,windowLabel:t,payload:n}})}async function Ni(e,t,n){return S({__tauriModule:"Event",message:{cmd:"listen",event:e,windowLabel:t,handler:ht(n)}}).then(i=>async()=>Ls(e,i))}async function zs(e,t,n){return Ni(e,t,i=>{n(i),Ls(e,i.id).catch(()=>{})})}var Ds=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e.CHECK_UPDATE="tauri://update",e.UPDATE_AVAILABLE="tauri://update-available",e.INSTALL_UPDATE="tauri://update-install",e.STATUS_UPDATE="tauri://update-status",e.DOWNLOAD_PROGRESS="tauri://update-download-progress",e))(Ds||{});async function Yt(e,t){return Ni(e,null,t)}async function Ws(e,t){return zs(e,null,t)}async function oi(e,t){return Es(e,void 0,t)}var Mo={};Ce(Mo,{CloseRequestedEvent:()=>Hs,LogicalPosition:()=>Ps,LogicalSize:()=>ti,PhysicalPosition:()=>nt,PhysicalSize:()=>pt,UserAttentionType:()=>ji,WebviewWindow:()=>_t,WebviewWindowHandle:()=>Rs,WindowManager:()=>Is,appWindow:()=>qe,availableMonitors:()=>Ao,currentMonitor:()=>To,getAll:()=>Os,getCurrent:()=>qt,primaryMonitor:()=>Co});var ti=class{constructor(e,t){this.type="Logical",this.width=e,this.height=t}},pt=class{constructor(e,t){this.type="Physical",this.width=e,this.height=t}toLogical(e){return new ti(this.width/e,this.height/e)}},Ps=class{constructor(e,t){this.type="Logical",this.x=e,this.y=t}},nt=class{constructor(e,t){this.type="Physical",this.x=e,this.y=t}toLogical(e){return new Ps(this.x/e,this.y/e)}},ji=(e=>(e[e.Critical=1]="Critical",e[e.Informational=2]="Informational",e))(ji||{});function qt(){return new _t(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})}function Os(){return window.__TAURI_METADATA__.__windows.map(e=>new _t(e.label,{skip:!0}))}var Jl=["tauri://created","tauri://error"],Rs=class{constructor(e){this.label=e,this.listeners=Object.create(null)}async listen(e,t){return this._handleTauriEvent(e,t)?Promise.resolve(()=>{let n=this.listeners[e];n.splice(n.indexOf(t),1)}):Ni(e,this.label,t)}async once(e,t){return this._handleTauriEvent(e,t)?Promise.resolve(()=>{let n=this.listeners[e];n.splice(n.indexOf(t),1)}):zs(e,this.label,t)}async emit(e,t){if(Jl.includes(e)){for(let n of this.listeners[e]||[])n({event:e,id:-1,windowLabel:this.label,payload:t});return Promise.resolve()}return Es(e,this.label,t)}_handleTauriEvent(e,t){return Jl.includes(e)?(e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t],!0):!1}},Is=class extends Rs{async scaleFactor(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"scaleFactor"}}}})}async innerPosition(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"innerPosition"}}}}).then(({x:e,y:t})=>new nt(e,t))}async outerPosition(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"outerPosition"}}}}).then(({x:e,y:t})=>new nt(e,t))}async innerSize(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"innerSize"}}}}).then(({width:e,height:t})=>new pt(e,t))}async outerSize(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"outerSize"}}}}).then(({width:e,height:t})=>new pt(e,t))}async isFullscreen(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isFullscreen"}}}})}async isMinimized(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isMinimized"}}}})}async isMaximized(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isMaximized"}}}})}async isDecorated(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isDecorated"}}}})}async isResizable(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isResizable"}}}})}async isVisible(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isVisible"}}}})}async title(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"title"}}}})}async theme(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"theme"}}}})}async center(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"center"}}}})}async requestUserAttention(e){let t=null;return e&&(e===1?t={type:"Critical"}:t={type:"Informational"}),S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"requestUserAttention",payload:t}}}})}async setResizable(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setResizable",payload:e}}}})}async setTitle(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setTitle",payload:e}}}})}async maximize(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"maximize"}}}})}async unmaximize(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"unmaximize"}}}})}async toggleMaximize(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"toggleMaximize"}}}})}async minimize(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"minimize"}}}})}async unminimize(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"unminimize"}}}})}async show(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"show"}}}})}async hide(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"hide"}}}})}async close(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"close"}}}})}async setDecorations(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setDecorations",payload:e}}}})}async setShadow(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setShadow",payload:e}}}})}async setAlwaysOnTop(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setAlwaysOnTop",payload:e}}}})}async setContentProtected(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setContentProtected",payload:e}}}})}async setSize(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setSize",payload:{type:e.type,data:{width:e.width,height:e.height}}}}}})}async setMinSize(e){if(e&&e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setMinSize",payload:e?{type:e.type,data:{width:e.width,height:e.height}}:null}}}})}async setMaxSize(e){if(e&&e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setMaxSize",payload:e?{type:e.type,data:{width:e.width,height:e.height}}:null}}}})}async setPosition(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setPosition",payload:{type:e.type,data:{x:e.x,y:e.y}}}}}})}async setFullscreen(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setFullscreen",payload:e}}}})}async setFocus(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setFocus"}}}})}async setIcon(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setIcon",payload:{icon:typeof e=="string"?e:Array.from(e)}}}}})}async setSkipTaskbar(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setSkipTaskbar",payload:e}}}})}async setCursorGrab(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorGrab",payload:e}}}})}async setCursorVisible(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorVisible",payload:e}}}})}async setCursorIcon(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorIcon",payload:e}}}})}async setCursorPosition(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorPosition",payload:{type:e.type,data:{x:e.x,y:e.y}}}}}})}async setIgnoreCursorEvents(e){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setIgnoreCursorEvents",payload:e}}}})}async startDragging(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"startDragging"}}}})}async onResized(e){return this.listen("tauri://resize",e)}async onMoved(e){return this.listen("tauri://move",e)}async onCloseRequested(e){return this.listen("tauri://close-requested",t=>{let n=new Hs(t);Promise.resolve(e(n)).then(()=>{if(!n.isPreventDefault())return this.close()})})}async onFocusChanged(e){let t=await this.listen("tauri://focus",i=>{e({...i,payload:!0})}),n=await this.listen("tauri://blur",i=>{e({...i,payload:!1})});return()=>{t(),n()}}async onScaleChanged(e){return this.listen("tauri://scale-change",e)}async onMenuClicked(e){return this.listen("tauri://menu",e)}async onFileDropEvent(e){let t=await this.listen("tauri://file-drop",l=>{e({...l,payload:{type:"drop",paths:l.payload}})}),n=await this.listen("tauri://file-drop-hover",l=>{e({...l,payload:{type:"hover",paths:l.payload}})}),i=await this.listen("tauri://file-drop-cancelled",l=>{e({...l,payload:{type:"cancel"}})});return()=>{t(),n(),i()}}async onThemeChanged(e){return this.listen("tauri://theme-changed",e)}},Hs=class{constructor(e){this._preventDefault=!1,this.event=e.event,this.windowLabel=e.windowLabel,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}},_t=class extends Is{constructor(e,t={}){super(e),t!=null&&t.skip||S({__tauriModule:"Window",message:{cmd:"createWebview",data:{options:{label:e,...t}}}}).then(async()=>this.emit("tauri://created")).catch(async n=>this.emit("tauri://error",n))}static getByLabel(e){return Os().some(t=>t.label===e)?new _t(e,{skip:!0}):null}},qe;"__TAURI_METADATA__"in window?qe=new _t(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0}):(console.warn(`Could not find "window.__TAURI_METADATA__". The "appWindow" value will reference the "main" window label. +Note that this is not an issue if running this frontend on a browser instead of a Tauri window.`),qe=new _t("main",{skip:!0}));function Ui(e){return e===null?null:{name:e.name,scaleFactor:e.scaleFactor,position:new nt(e.position.x,e.position.y),size:new pt(e.size.width,e.size.height)}}async function To(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"currentMonitor"}}}}).then(Ui)}async function Co(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"primaryMonitor"}}}}).then(Ui)}async function Ao(){return S({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"availableMonitors"}}}}).then(e=>e.map(Ui))}function So(){return navigator.appVersion.includes("Win")}var Lo={};Ce(Lo,{EOL:()=>Eo,arch:()=>Wo,platform:()=>Fs,tempdir:()=>Po,type:()=>Do,version:()=>zo});var Eo=So()?`\r `:` -`;async function Ps(){return S({__tauriModule:"Os",message:{cmd:"platform"}})}async function Ao(){return S({__tauriModule:"Os",message:{cmd:"version"}})}async function So(){return S({__tauriModule:"Os",message:{cmd:"osType"}})}async function Lo(){return S({__tauriModule:"Os",message:{cmd:"arch"}})}async function Eo(){return S({__tauriModule:"Os",message:{cmd:"tempdir"}})}var zo={};we(zo,{getName:()=>Is,getTauriVersion:()=>Hs,getVersion:()=>Rs,hide:()=>Ns,show:()=>Fs});async function Rs(){return S({__tauriModule:"App",message:{cmd:"getAppVersion"}})}async function Is(){return S({__tauriModule:"App",message:{cmd:"getAppName"}})}async function Hs(){return S({__tauriModule:"App",message:{cmd:"getTauriVersion"}})}async function Fs(){return S({__tauriModule:"App",message:{cmd:"show"}})}async function Ns(){return S({__tauriModule:"App",message:{cmd:"hide"}})}var Do={};we(Do,{exit:()=>js,relaunch:()=>Fi});async function js(e=0){return S({__tauriModule:"Process",message:{cmd:"exit",exitCode:e}})}async function Fi(){return S({__tauriModule:"Process",message:{cmd:"relaunch"}})}function Wo(e){let t,n,i,l,o,u,d,c,f,y,k,_,v,g,b,A,O,I,P,F,L,T,C,W,M,j;return{c(){t=a("p"),t.innerHTML=`This is a demo of Tauri's API capabilities using the @tauri-apps/api package. It's used as the main validation app, serving as the test bed of our +`;async function Fs(){return S({__tauriModule:"Os",message:{cmd:"platform"}})}async function zo(){return S({__tauriModule:"Os",message:{cmd:"version"}})}async function Do(){return S({__tauriModule:"Os",message:{cmd:"osType"}})}async function Wo(){return S({__tauriModule:"Os",message:{cmd:"arch"}})}async function Po(){return S({__tauriModule:"Os",message:{cmd:"tempdir"}})}var Oo={};Ce(Oo,{getName:()=>js,getTauriVersion:()=>Us,getVersion:()=>Ns,hide:()=>Bs,show:()=>qs});async function Ns(){return S({__tauriModule:"App",message:{cmd:"getAppVersion"}})}async function js(){return S({__tauriModule:"App",message:{cmd:"getAppName"}})}async function Us(){return S({__tauriModule:"App",message:{cmd:"getTauriVersion"}})}async function qs(){return S({__tauriModule:"App",message:{cmd:"show"}})}async function Bs(){return S({__tauriModule:"App",message:{cmd:"hide"}})}var Ro={};Ce(Ro,{exit:()=>Vs,relaunch:()=>qi});async function Vs(e=0){return S({__tauriModule:"Process",message:{cmd:"exit",exitCode:e}})}async function qi(){return S({__tauriModule:"Process",message:{cmd:"relaunch"}})}function Io(e){let t,n,i,l,o,u,d,c,f,g,k,_,v,y,b,C,W,I,O,j,E,M,A,P,T,F;return{c(){t=a("p"),t.innerHTML=`This is a demo of Tauri's API capabilities using the @tauri-apps/api package. It's used as the main validation app, serving as the test bed of our development process. In the future, this app will be used on Tauri's integration - tests.`,n=h(),i=a("br"),l=h(),o=a("br"),u=h(),d=a("pre"),c=z("App name: "),f=a("code"),y=z(e[2]),k=z(` -App version: `),_=a("code"),v=z(e[0]),g=z(` -Tauri version: `),b=a("code"),A=z(e[1]),O=z(` -`),I=h(),P=a("br"),F=h(),L=a("div"),T=a("button"),T.textContent="Close application",C=h(),W=a("button"),W.textContent="Relaunch application",r(T,"class","btn"),r(W,"class","btn"),r(L,"class","flex flex-wrap gap-1 shadow-")},m(U,J){m(U,t,J),m(U,n,J),m(U,i,J),m(U,l,J),m(U,o,J),m(U,u,J),m(U,d,J),s(d,c),s(d,f),s(f,y),s(d,k),s(d,_),s(_,v),s(d,g),s(d,b),s(b,A),s(d,O),m(U,I,J),m(U,P,J),m(U,F,J),m(U,L,J),s(L,T),s(L,C),s(L,W),M||(j=[E(T,"click",e[3]),E(W,"click",e[4])],M=!0)},p(U,[J]){J&4&&$(y,U[2]),J&1&&$(v,U[0]),J&2&&$(A,U[1])},i:V,o:V,d(U){U&&p(t),U&&p(n),U&&p(i),U&&p(l),U&&p(o),U&&p(u),U&&p(d),U&&p(I),U&&p(P),U&&p(F),U&&p(L),M=!1,ue(j)}}}function Oo(e,t,n){let i="0.0.0",l="0.0.0",o="Unknown";Is().then(c=>{n(2,o=c)}),Rs().then(c=>{n(0,i=c)}),Hs().then(c=>{n(1,l=c)});async function u(){await js()}async function d(){await Fi()}return[i,l,o,u,d]}class Po extends ye{constructor(t){super(),ge(this,t,Oo,Wo,he,{})}}var Ro={};we(Ro,{getMatches:()=>Us});async function Us(){return S({__tauriModule:"Cli",message:{cmd:"cliMatches"}})}function Io(e){let t,n,i,l,o,u,d,c,f,y,k,_,v;return{c(){t=a("p"),t.innerHTML=`This binary can be run from the terminal and takes the following arguments: + tests.`,n=h(),i=a("br"),l=h(),o=a("br"),u=h(),d=a("pre"),c=z("App name: "),f=a("code"),g=z(e[2]),k=z(` +App version: `),_=a("code"),v=z(e[0]),y=z(` +Tauri version: `),b=a("code"),C=z(e[1]),W=z(` +`),I=h(),O=a("br"),j=h(),E=a("div"),M=a("button"),M.textContent="Close application",A=h(),P=a("button"),P.textContent="Relaunch application",r(M,"class","btn"),r(P,"class","btn"),r(E,"class","flex flex-wrap gap-1 shadow-")},m(U,J){m(U,t,J),m(U,n,J),m(U,i,J),m(U,l,J),m(U,o,J),m(U,u,J),m(U,d,J),s(d,c),s(d,f),s(f,g),s(d,k),s(d,_),s(_,v),s(d,y),s(d,b),s(b,C),s(d,W),m(U,I,J),m(U,O,J),m(U,j,J),m(U,E,J),s(E,M),s(E,A),s(E,P),T||(F=[L(M,"click",e[3]),L(P,"click",e[4])],T=!0)},p(U,[J]){J&4&&Q(g,U[2]),J&1&&Q(v,U[0]),J&2&&Q(C,U[1])},i:V,o:V,d(U){U&&p(t),U&&p(n),U&&p(i),U&&p(l),U&&p(o),U&&p(u),U&&p(d),U&&p(I),U&&p(O),U&&p(j),U&&p(E),T=!1,se(F)}}}function Ho(e,t,n){let i="0.0.0",l="0.0.0",o="Unknown";js().then(c=>{n(2,o=c)}),Ns().then(c=>{n(0,i=c)}),Us().then(c=>{n(1,l=c)});async function u(){await Vs()}async function d(){await qi()}return[i,l,o,u,d]}class Fo extends ve{constructor(t){super(),ye(this,t,Ho,Io,_e,{})}}var No={};Ce(No,{getMatches:()=>Gs});async function Gs(){return S({__tauriModule:"Cli",message:{cmd:"cliMatches"}})}function jo(e){let t,n,i,l,o,u,d,c,f,g,k,_,v;return{c(){t=a("p"),t.innerHTML=`This binary can be run from the terminal and takes the following arguments:
  --config <PATH>
   --theme <light|dark|system>
   --verbose
- Additionally, it has a update --background subcommand.`,n=h(),i=a("br"),l=h(),o=a("div"),o.textContent="Note that the arguments are only parsed, not implemented.",u=h(),d=a("br"),c=h(),f=a("br"),y=h(),k=a("button"),k.textContent="Get matches",r(o,"class","note"),r(k,"class","btn"),r(k,"id","cli-matches")},m(g,b){m(g,t,b),m(g,n,b),m(g,i,b),m(g,l,b),m(g,o,b),m(g,u,b),m(g,d,b),m(g,c,b),m(g,f,b),m(g,y,b),m(g,k,b),_||(v=E(k,"click",e[0]),_=!0)},p:V,i:V,o:V,d(g){g&&p(t),g&&p(n),g&&p(i),g&&p(l),g&&p(o),g&&p(u),g&&p(d),g&&p(c),g&&p(f),g&&p(y),g&&p(k),_=!1,v()}}}function Ho(e,t,n){let{onMessage:i}=t;function l(){Us().then(i).catch(i)}return e.$$set=o=>{"onMessage"in o&&n(1,i=o.onMessage)},[l,i]}class Fo extends ye{constructor(t){super(),ge(this,t,Ho,Io,he,{onMessage:1})}}function No(e){let t,n,i,l,o,u,d,c;return{c(){t=a("div"),n=a("button"),n.textContent="Call Log API",i=h(),l=a("button"),l.textContent="Call Request (async) API",o=h(),u=a("button"),u.textContent="Send event to Rust",r(n,"class","btn"),r(n,"id","log"),r(l,"class","btn"),r(l,"id","request"),r(u,"class","btn"),r(u,"id","event")},m(f,y){m(f,t,y),s(t,n),s(t,i),s(t,l),s(t,o),s(t,u),d||(c=[E(n,"click",e[0]),E(l,"click",e[1]),E(u,"click",e[2])],d=!0)},p:V,i:V,o:V,d(f){f&&p(t),d=!1,ue(c)}}}function jo(e,t,n){let{onMessage:i}=t,l;ut(async()=>{l=await Xt("rust-event",i)}),Wi(()=>{l&&l()});function o(){$n("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function u(){$n("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)}function d(){ni("js-event","this is the payload string")}return e.$$set=c=>{"onMessage"in c&&n(3,i=c.onMessage)},[o,u,d,i]}class Uo extends ye{constructor(t){super(),ge(this,t,jo,No,he,{onMessage:3})}}var qo={};we(qo,{ask:()=>Bs,confirm:()=>Vo,message:()=>Bo,open:()=>Ni,save:()=>qs});async function Ni(e={}){return typeof e=="object"&&Object.freeze(e),S({__tauriModule:"Dialog",message:{cmd:"openDialog",options:e}})}async function qs(e={}){return typeof e=="object"&&Object.freeze(e),S({__tauriModule:"Dialog",message:{cmd:"saveDialog",options:e}})}async function Bo(e,t){var i;let n=typeof t=="string"?{title:t}:t;return S({__tauriModule:"Dialog",message:{cmd:"messageDialog",message:e.toString(),title:(i=n==null?void 0:n.title)==null?void 0:i.toString(),type:n==null?void 0:n.type}})}async function Bs(e,t){var i;let n=typeof t=="string"?{title:t}:t;return S({__tauriModule:"Dialog",message:{cmd:"askDialog",message:e.toString(),title:(i=n==null?void 0:n.title)==null?void 0:i.toString(),type:n==null?void 0:n.type}})}async function Vo(e,t){var i;let n=typeof t=="string"?{title:t}:t;return S({__tauriModule:"Dialog",message:{cmd:"confirmDialog",message:e.toString(),title:(i=n==null?void 0:n.title)==null?void 0:i.toString(),type:n==null?void 0:n.type}})}var Go={};we(Go,{BaseDirectory:()=>Jt,Dir:()=>Jt,copyFile:()=>$o,createDir:()=>Yo,exists:()=>xo,readBinaryFile:()=>ji,readDir:()=>Vs,readTextFile:()=>Jo,removeDir:()=>Ko,removeFile:()=>Qo,renameFile:()=>Zo,writeBinaryFile:()=>Xo,writeFile:()=>Di,writeTextFile:()=>Di});var Jt=(e=>(e[e.Audio=1]="Audio",e[e.Cache=2]="Cache",e[e.Config=3]="Config",e[e.Data=4]="Data",e[e.LocalData=5]="LocalData",e[e.Desktop=6]="Desktop",e[e.Document=7]="Document",e[e.Download=8]="Download",e[e.Executable=9]="Executable",e[e.Font=10]="Font",e[e.Home=11]="Home",e[e.Picture=12]="Picture",e[e.Public=13]="Public",e[e.Runtime=14]="Runtime",e[e.Template=15]="Template",e[e.Video=16]="Video",e[e.Resource=17]="Resource",e[e.App=18]="App",e[e.Log=19]="Log",e[e.Temp=20]="Temp",e[e.AppConfig=21]="AppConfig",e[e.AppData=22]="AppData",e[e.AppLocalData=23]="AppLocalData",e[e.AppCache=24]="AppCache",e[e.AppLog=25]="AppLog",e))(Jt||{});async function Jo(e,t={}){return S({__tauriModule:"Fs",message:{cmd:"readTextFile",path:e,options:t}})}async function ji(e,t={}){let n=await S({__tauriModule:"Fs",message:{cmd:"readFile",path:e,options:t}});return Uint8Array.from(n)}async function Di(e,t,n){typeof n=="object"&&Object.freeze(n),typeof e=="object"&&Object.freeze(e);let i={path:"",contents:""},l=n;return typeof e=="string"?i.path=e:(i.path=e.path,i.contents=e.contents),typeof t=="string"?i.contents=t!=null?t:"":l=t,S({__tauriModule:"Fs",message:{cmd:"writeFile",path:i.path,contents:Array.from(new TextEncoder().encode(i.contents)),options:l}})}async function Xo(e,t,n){typeof n=="object"&&Object.freeze(n),typeof e=="object"&&Object.freeze(e);let i={path:"",contents:[]},l=n;return typeof e=="string"?i.path=e:(i.path=e.path,i.contents=e.contents),t&&"dir"in t?l=t:typeof e=="string"&&(i.contents=t!=null?t:[]),S({__tauriModule:"Fs",message:{cmd:"writeFile",path:i.path,contents:Array.from(i.contents instanceof ArrayBuffer?new Uint8Array(i.contents):i.contents),options:l}})}async function Vs(e,t={}){return S({__tauriModule:"Fs",message:{cmd:"readDir",path:e,options:t}})}async function Yo(e,t={}){return S({__tauriModule:"Fs",message:{cmd:"createDir",path:e,options:t}})}async function Ko(e,t={}){return S({__tauriModule:"Fs",message:{cmd:"removeDir",path:e,options:t}})}async function $o(e,t,n={}){return S({__tauriModule:"Fs",message:{cmd:"copyFile",source:e,destination:t,options:n}})}async function Qo(e,t={}){return S({__tauriModule:"Fs",message:{cmd:"removeFile",path:e,options:t}})}async function Zo(e,t,n={}){return S({__tauriModule:"Fs",message:{cmd:"renameFile",oldPath:e,newPath:t,options:n}})}async function xo(e,t={}){return S({__tauriModule:"Fs",message:{cmd:"exists",path:e,options:t}})}function ea(e){let t,n,i,l,o,u,d,c,f,y,k,_,v,g,b,A,O,I,P,F,L,T,C,W;return{c(){t=a("div"),n=a("input"),i=h(),l=a("input"),o=h(),u=a("br"),d=h(),c=a("div"),f=a("input"),y=h(),k=a("label"),k.textContent="Multiple",_=h(),v=a("div"),g=a("input"),b=h(),A=a("label"),A.textContent="Directory",O=h(),I=a("br"),P=h(),F=a("button"),F.textContent="Open dialog",L=h(),T=a("button"),T.textContent="Open save dialog",r(n,"class","input"),r(n,"id","dialog-default-path"),r(n,"placeholder","Default path"),r(l,"class","input"),r(l,"id","dialog-filter"),r(l,"placeholder","Extensions filter, comma-separated"),r(t,"class","flex gap-2 children:grow"),r(f,"type","checkbox"),r(f,"id","dialog-multiple"),r(k,"for","dialog-multiple"),r(g,"type","checkbox"),r(g,"id","dialog-directory"),r(A,"for","dialog-directory"),r(F,"class","btn"),r(F,"id","open-dialog"),r(T,"class","btn"),r(T,"id","save-dialog")},m(M,j){m(M,t,j),s(t,n),q(n,e[0]),s(t,i),s(t,l),q(l,e[1]),m(M,o,j),m(M,u,j),m(M,d,j),m(M,c,j),s(c,f),f.checked=e[2],s(c,y),s(c,k),m(M,_,j),m(M,v,j),s(v,g),g.checked=e[3],s(v,b),s(v,A),m(M,O,j),m(M,I,j),m(M,P,j),m(M,F,j),m(M,L,j),m(M,T,j),C||(W=[E(n,"input",e[8]),E(l,"input",e[9]),E(f,"change",e[10]),E(g,"change",e[11]),E(F,"click",e[4]),E(T,"click",e[5])],C=!0)},p(M,[j]){j&1&&n.value!==M[0]&&q(n,M[0]),j&2&&l.value!==M[1]&&q(l,M[1]),j&4&&(f.checked=M[2]),j&8&&(g.checked=M[3])},i:V,o:V,d(M){M&&p(t),M&&p(o),M&&p(u),M&&p(d),M&&p(c),M&&p(_),M&&p(v),M&&p(O),M&&p(I),M&&p(P),M&&p(F),M&&p(L),M&&p(T),C=!1,ue(W)}}}function ta(e,t){var n=new Blob([e],{type:"application/octet-binary"}),i=new FileReader;i.onload=function(l){var o=l.target.result;t(o.substr(o.indexOf(",")+1))},i.readAsDataURL(n)}function na(e,t,n){let{onMessage:i}=t,{insecureRenderHtml:l}=t,o=null,u=null,d=!1,c=!1;function f(){Ni({title:"My wonderful open dialog",defaultPath:o,filters:u?[{name:"Tauri Example",extensions:u.split(",").map(b=>b.trim())}]:[],multiple:d,directory:c}).then(function(b){if(Array.isArray(b))i(b);else{var A=b,O=A.match(/\S+\.\S+$/g);ji(A).then(function(I){O&&(A.includes(".png")||A.includes(".jpg"))?ta(new Uint8Array(I),function(P){var F="data:image/png;base64,"+P;l('')}):i(b)}).catch(i(b))}}).catch(i)}function y(){qs({title:"My wonderful save dialog",defaultPath:o,filters:u?[{name:"Tauri Example",extensions:u.split(",").map(b=>b.trim())}]:[]}).then(i).catch(i)}function k(){o=this.value,n(0,o)}function _(){u=this.value,n(1,u)}function v(){d=this.checked,n(2,d)}function g(){c=this.checked,n(3,c)}return e.$$set=b=>{"onMessage"in b&&n(6,i=b.onMessage),"insecureRenderHtml"in b&&n(7,l=b.insecureRenderHtml)},[o,u,d,c,f,y,i,l,k,_,v,g]}class ia extends ye{constructor(t){super(),ge(this,t,na,ea,he,{onMessage:6,insecureRenderHtml:7})}}function Bl(e,t,n){const i=e.slice();return i[9]=t[n],i}function Vl(e){let t,n=e[9][0]+"",i;return{c(){t=a("option"),i=z(n),t.__value=e[9][1],t.value=t.__value},m(l,o){m(l,t,o),s(t,i)},p:V,d(l){l&&p(t)}}}function la(e){let t,n,i,l,o,u,d,c,f,y,k,_,v,g,b,A,O,I,P,F=e[2],L=[];for(let T=0;TisNaN(parseInt(_))).map(_=>[_,Jt[_]]);function c(){const _=o.match(/\S+\.\S+$/g),v={dir:Gl()};(_?ji(o,v):Vs(o,v)).then(function(b){if(_)if(o.includes(".png")||o.includes(".jpg"))sa(new Uint8Array(b),function(A){const O="data:image/png;base64,"+A;l('')});else{const A=String.fromCharCode.apply(null,b);l(''),setTimeout(()=>{const O=document.getElementById("file-response");O.value=A,document.getElementById("file-save").addEventListener("click",function(){Di(o,O.value,{dir:Gl()}).catch(i)})})}else i(b)}).catch(i)}function f(){n(1,u.src=ks(o),u)}function y(){o=this.value,n(0,o)}function k(_){Yn[_?"unshift":"push"](()=>{u=_,n(1,u)})}return e.$$set=_=>{"onMessage"in _&&n(5,i=_.onMessage),"insecureRenderHtml"in _&&n(6,l=_.insecureRenderHtml)},[o,u,d,c,f,i,l,y,k]}class aa extends ye{constructor(t){super(),ge(this,t,oa,la,he,{onMessage:5,insecureRenderHtml:6})}}var ra={};we(ra,{Body:()=>tt,Client:()=>Js,Response:()=>Gs,ResponseType:()=>Ui,fetch:()=>ua,getClient:()=>Zn});var Ui=(e=>(e[e.JSON=1]="JSON",e[e.Text=2]="Text",e[e.Binary=3]="Binary",e))(Ui||{}),tt=class{constructor(e,t){this.type=e,this.payload=t}static form(e){let t={},n=(i,l)=>{if(l!==null){let o;typeof l=="string"?o=l:l instanceof Uint8Array||Array.isArray(l)?o=Array.from(l):l instanceof File?o={file:l.name,mime:l.type,fileName:l.name}:typeof l.file=="string"?o={file:l.file,mime:l.mime,fileName:l.fileName}:o={file:Array.from(l.file),mime:l.mime,fileName:l.fileName},t[String(i)]=o}};if(e instanceof FormData)for(let[i,l]of e)n(i,l);else for(let[i,l]of Object.entries(e))n(i,l);return new tt("Form",t)}static json(e){return new tt("Json",e)}static text(e){return new tt("Text",e)}static bytes(e){return new tt("Bytes",Array.from(e instanceof ArrayBuffer?new Uint8Array(e):e))}},Gs=class{constructor(e){this.url=e.url,this.status=e.status,this.ok=this.status>=200&&this.status<300,this.headers=e.headers,this.rawHeaders=e.rawHeaders,this.data=e.data}},Js=class{constructor(e){this.id=e}async drop(){return S({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}})}async request(e){let t=!e.responseType||e.responseType===1;return t&&(e.responseType=2),S({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:e}}).then(n=>{let i=new Gs(n);if(t){try{i.data=JSON.parse(i.data)}catch(l){if(i.ok&&i.data==="")i.data={};else if(i.ok)throw Error(`Failed to parse response \`${i.data}\` as JSON: ${l}; - try setting the \`responseType\` option to \`ResponseType.Text\` or \`ResponseType.Binary\` if the API does not return a JSON response.`)}return i}return i})}async get(e,t){return this.request({method:"GET",url:e,...t})}async post(e,t,n){return this.request({method:"POST",url:e,body:t,...n})}async put(e,t,n){return this.request({method:"PUT",url:e,body:t,...n})}async patch(e,t){return this.request({method:"PATCH",url:e,...t})}async delete(e,t){return this.request({method:"DELETE",url:e,...t})}};async function Zn(e){return S({__tauriModule:"Http",message:{cmd:"createClient",options:e}}).then(t=>new Js(t))}var Li=null;async function ua(e,t){var n;return Li===null&&(Li=await Zn()),Li.request({url:e,method:(n=t==null?void 0:t.method)!=null?n:"GET",...t})}function Jl(e,t,n){const i=e.slice();return i[12]=t[n],i[14]=n,i}function Xl(e){let t,n,i,l,o,u,d,c,f,y,k,_,v,g,b,A,O,I=e[5],P=[];for(let C=0;CRe(P[C],1,1,()=>{P[C]=null});let L=!e[3]&&Ql(),T=!e[3]&&e[8]&&Zl();return{c(){t=a("span"),n=a("span"),i=z(e[6]),l=h(),o=a("ul");for(let C=0;C{y[g]=null}),ti(),o=y[l],o?o.p(_,v):(o=y[l]=f[l](_),o.c()),Me(o,1),o.m(t,u))},i(_){d||(Me(o),d=!0)},o(_){Re(o),d=!1},d(_){_&&p(t),c&&c.d(),y[l].d()}}}function Ql(e){let t;return{c(){t=a("span"),t.textContent=",",r(t,"class","comma svelte-gbh3pt")},m(n,i){m(n,t,i)},d(n){n&&p(t)}}}function Zl(e){let t;return{c(){t=a("span"),t.textContent=",",r(t,"class","comma svelte-gbh3pt")},m(n,i){m(n,t,i)},d(n){n&&p(t)}}}function fa(e){let t,n,i=e[5].length&&Xl(e);return{c(){i&&i.c(),t=xn()},m(l,o){i&&i.m(l,o),m(l,t,o),n=!0},p(l,[o]){l[5].length?i?(i.p(l,o),o&32&&Me(i,1)):(i=Xl(l),i.c(),Me(i,1),i.m(t.parentNode,t)):i&&(ei(),Re(i,1,1,()=>{i=null}),ti())},i(l){n||(Me(i),n=!0)},o(l){Re(i),n=!1},d(l){i&&i.d(l),l&&p(t)}}}const pa="...";function ma(e,t,n){let{json:i}=t,{depth:l=1/0}=t,{_lvl:o=0}=t,{_last:u=!0}=t;const d=b=>b===null?"null":typeof b;let c,f,y,k,_;const v=b=>{switch(d(b)){case"string":return`"${b}"`;case"function":return"f () {...}";case"symbol":return b.toString();default:return b}},g=()=>{n(8,_=!_)};return e.$$set=b=>{"json"in b&&n(0,i=b.json),"depth"in b&&n(1,l=b.depth),"_lvl"in b&&n(2,o=b._lvl),"_last"in b&&n(3,u=b._last)},e.$$.update=()=>{e.$$.dirty&17&&(n(5,c=d(i)==="object"?Object.keys(i):[]),n(4,f=Array.isArray(i)),n(6,y=f?"[":"{"),n(7,k=f?"]":"}")),e.$$.dirty&6&&n(8,_=le[9].call(n)),r(k,"class","input h-auto w-100%"),r(k,"id","request-body"),r(k,"placeholder","Request body"),r(k,"rows","5"),r(b,"class","btn"),r(b,"id","make-request"),r(T,"class","input"),r(W,"class","input"),r(L,"class","flex gap-2 children:grow"),r(ne,"type","checkbox"),r(K,"class","btn"),r(K,"type","button")},m(D,B){m(D,t,B),s(t,n),s(n,i),s(n,l),s(n,o),s(n,u),s(n,d),zt(n,e[0]),s(t,c),s(t,f),s(t,y),s(t,k),q(k,e[1]),s(t,_),s(t,v),s(t,g),s(t,b),m(D,A,B),m(D,O,B),m(D,I,B),m(D,P,B),m(D,F,B),m(D,L,B),s(L,T),q(T,e[2]),s(L,C),s(L,W),q(W,e[3]),m(D,M,B),m(D,j,B),m(D,U,B),m(D,J,B),s(J,ne),ne.checked=e[5],s(J,de),m(D,x,B),m(D,Y,B),m(D,fe,B),m(D,ee,B),m(D,H,B),m(D,K,B),m(D,te,B),m(D,pe,B),m(D,se,B),m(D,ae,B),m(D,_e,B),Vt(ce,D,B),ie=!0,Te||(Ce=[E(n,"change",e[9]),E(k,"input",e[10]),E(t,"submit",Xn(e[6])),E(T,"input",e[11]),E(W,"input",e[12]),E(ne,"change",e[13]),E(K,"click",e[7])],Te=!0)},p(D,[B]){B&1&&zt(n,D[0]),B&2&&q(k,D[1]),B&4&&T.value!==D[2]&&q(T,D[2]),B&8&&W.value!==D[3]&&q(W,D[3]),B&32&&(ne.checked=D[5]);const Ae={};B&16&&(Ae.json=D[4]),ce.$set(Ae)},i(D){ie||(Me(ce.$$.fragment,D),ie=!0)},o(D){Re(ce.$$.fragment,D),ie=!1},d(D){D&&p(t),D&&p(A),D&&p(O),D&&p(I),D&&p(P),D&&p(F),D&&p(L),D&&p(M),D&&p(j),D&&p(U),D&&p(J),D&&p(x),D&&p(Y),D&&p(fe),D&&p(ee),D&&p(H),D&&p(K),D&&p(te),D&&p(pe),D&&p(se),D&&p(ae),D&&p(_e),Gt(ce,D),Te=!1,ue(Ce)}}}function _a(e,t,n){let i="GET",l="",{onMessage:o}=t;async function u(){const O=await Zn().catch(F=>{throw o(F),F}),P={url:"http://localhost:3003",method:i||"GET"||"GET"};l.startsWith("{")&&l.endsWith("}")||l.startsWith("[")&&l.endsWith("]")?P.body=tt.json(JSON.parse(l)):l!==""&&(P.body=tt.text(l)),O.request(P).then(o).catch(o)}let d="baz",c="qux",f=null,y=!0;async function k(){const O=await Zn().catch(I=>{throw o(I),I});n(4,f=await O.request({url:"http://localhost:3003",method:"POST",body:tt.form({foo:d,bar:c}),headers:y?{"Content-Type":"multipart/form-data"}:void 0,responseType:Ui.Text}))}function _(){i=Ei(this),n(0,i)}function v(){l=this.value,n(1,l)}function g(){d=this.value,n(2,d)}function b(){c=this.value,n(3,c)}function A(){y=this.checked,n(5,y)}return e.$$set=O=>{"onMessage"in O&&n(8,o=O.onMessage)},[i,l,d,c,f,y,u,k,o,_,v,g,b,A]}class ba extends ye{constructor(t){super(),ge(this,t,_a,ha,he,{onMessage:8})}}function ga(e){let t,n,i;return{c(){t=a("button"),t.textContent="Send test notification",r(t,"class","btn"),r(t,"id","notification")},m(l,o){m(l,t,o),n||(i=E(t,"click",ya),n=!0)},p:V,i:V,o:V,d(l){l&&p(t),n=!1,i()}}}function ya(){new Notification("Notification title",{body:"This is the notification body"})}function va(e,t,n){let{onMessage:i}=t;return e.$$set=l=>{"onMessage"in l&&n(0,i=l.onMessage)},[i]}class wa extends ye{constructor(t){super(),ge(this,t,va,ga,he,{onMessage:0})}}function xl(e,t,n){const i=e.slice();return i[67]=t[n],i}function es(e,t,n){const i=e.slice();return i[70]=t[n],i}function ts(e){let t,n,i,l,o,u,d=Object.keys(e[1]),c=[];for(let f=0;fe[39].call(i))},m(f,y){m(f,t,y),m(f,n,y),m(f,i,y),s(i,l);for(let k=0;ke[57].call(je)),r($e,"class","input"),r($e,"type","number"),r(Qe,"class","input"),r(Qe,"type","number"),r(Ne,"class","flex gap-2"),r(Ze,"class","input grow"),r(Ze,"id","title"),r(Ft,"class","btn"),r(Ft,"type","submit"),r(at,"class","flex gap-1"),r(xe,"class","input grow"),r(xe,"id","url"),r(Nt,"class","btn"),r(Nt,"id","open-url"),r(rt,"class","flex gap-1"),r(ot,"class","flex flex-col gap-1")},m(w,R){m(w,t,R),m(w,n,R),m(w,i,R),s(i,l),s(i,o),s(i,u),s(i,d),s(i,c),s(i,f),s(i,y),s(i,k),s(i,_),m(w,v,R),m(w,g,R),m(w,b,R),m(w,A,R),s(A,O),s(O,I),s(O,P),P.checked=e[3],s(A,F),s(A,L),s(L,T),s(L,C),C.checked=e[2],s(A,W),s(A,M),s(M,j),s(M,U),U.checked=e[4],s(A,J),s(A,ne),s(ne,de),s(ne,x),x.checked=e[5],s(A,Y),s(A,fe),s(fe,ee),s(fe,H),H.checked=e[6],m(w,K,R),m(w,te,R),m(w,pe,R),m(w,se,R),s(se,ae),s(ae,_e),s(_e,ce),s(_e,ie),q(ie,e[13]),s(ae,Te),s(ae,Ce),s(Ce,D),s(Ce,B),q(B,e[14]),s(se,Ae),s(se,me),s(me,oe),s(oe,Le),s(oe,Q),q(Q,e[7]),s(me,Ee),s(me,Ie),s(Ie,ze),s(Ie,Z),q(Z,e[8]),s(se,N),s(se,le),s(le,G),s(G,We),s(G,Oe),q(Oe,e[9]),s(le,Yt),s(le,ht),s(ht,Kt),s(ht,Pe),q(Pe,e[10]),s(se,$t),s(se,qe),s(qe,_t),s(_t,Qt),s(_t,X),q(X,e[11]),s(qe,Wt),s(qe,nt),s(nt,Ot),s(nt,Se),q(Se,e[12]),m(w,bt,R),m(w,gt,R),m(w,yt,R),m(w,ke,R),s(ke,He),s(He,De),s(De,it),s(De,Pt),s(De,lt),s(lt,Rt),s(lt,vt),s(De,It),s(De,wt),s(wt,Bi),s(wt,ii),s(He,Vi),s(He,Be),s(Be,xt),s(Be,Gi),s(Be,en),s(en,Ji),s(en,li),s(Be,Xi),s(Be,nn),s(nn,Yi),s(nn,si),s(ke,Ki),s(ke,kt),s(kt,Ve),s(Ve,sn),s(Ve,$i),s(Ve,on),s(on,Qi),s(on,oi),s(Ve,Zi),s(Ve,rn),s(rn,xi),s(rn,ai),s(kt,el),s(kt,Ge),s(Ge,cn),s(Ge,tl),s(Ge,dn),s(dn,nl),s(dn,ri),s(Ge,il),s(Ge,pn),s(pn,ll),s(pn,ui),s(ke,sl),s(ke,Mt),s(Mt,Je),s(Je,hn),s(Je,ol),s(Je,_n),s(_n,al),s(_n,ci),s(Je,rl),s(Je,gn),s(gn,ul),s(gn,di),s(Mt,cl),s(Mt,Xe),s(Xe,vn),s(Xe,dl),s(Xe,wn),s(wn,fl),s(wn,fi),s(Xe,pl),s(Xe,Mn),s(Mn,ml),s(Mn,pi),s(ke,hl),s(ke,Tt),s(Tt,Ye),s(Ye,Cn),s(Ye,_l),s(Ye,An),s(An,bl),s(An,mi),s(Ye,gl),s(Ye,Ln),s(Ln,yl),s(Ln,hi),s(Tt,vl),s(Tt,Ke),s(Ke,zn),s(Ke,wl),s(Ke,Dn),s(Dn,kl),s(Dn,_i),s(Ke,Ml),s(Ke,On),s(On,Tl),s(On,bi),m(w,gi,R),m(w,yi,R),m(w,vi,R),m(w,Ht,R),m(w,wi,R),m(w,Fe,R),s(Fe,Rn),s(Rn,Ct),Ct.checked=e[15],s(Rn,Cl),s(Fe,Al),s(Fe,In),s(In,At),At.checked=e[16],s(In,Sl),s(Fe,Ll),s(Fe,Hn),s(Hn,St),St.checked=e[20],s(Hn,El),m(w,ki,R),m(w,Ne,R),s(Ne,Fn),s(Fn,zl),s(Fn,je);for(let be=0;be=1,y,k,_,v=f&&ts(e),g=e[1][e[0]]&&is(e);return{c(){t=a("div"),n=a("div"),i=a("input"),l=h(),o=a("button"),o.textContent="New window",u=h(),d=a("br"),c=h(),v&&v.c(),y=h(),g&&g.c(),r(i,"class","input grow"),r(i,"type","text"),r(i,"placeholder","New Window label.."),r(o,"class","btn"),r(n,"class","flex gap-1"),r(t,"class","flex flex-col children:grow gap-2")},m(b,A){m(b,t,A),s(t,n),s(n,i),q(i,e[21]),s(n,l),s(n,o),s(t,u),s(t,d),s(t,c),v&&v.m(t,null),s(t,y),g&&g.m(t,null),k||(_=[E(i,"input",e[38]),E(o,"click",e[35])],k=!0)},p(b,A){A[0]&2097152&&i.value!==b[21]&&q(i,b[21]),A[0]&2&&(f=Object.keys(b[1]).length>=1),f?v?v.p(b,A):(v=ts(b),v.c(),v.m(t,y)):v&&(v.d(1),v=null),b[1][b[0]]?g?g.p(b,A):(g=is(b),g.c(),g.m(t,null)):g&&(g.d(1),g=null)},i:V,o:V,d(b){b&&p(t),v&&v.d(),g&&g.d(),k=!1,ue(_)}}}function Ma(e,t,n){let i=Ue.label;const l={[Ue.label]:Ue},o=["default","crosshair","hand","arrow","move","text","wait","help","progress","notAllowed","contextMenu","cell","verticalText","alias","copy","noDrop","grab","grabbing","allScroll","zoomIn","zoomOut","eResize","nResize","neResize","nwResize","sResize","seResize","swResize","wResize","ewResize","nsResize","neswResize","nwseResize","colResize","rowResize"];let{onMessage:u}=t,d,c="https://tauri.app",f=!0,y=!1,k=!0,_=!1,v=!1,g=null,b=null,A=null,O=null,I=null,P=null,F=null,L=null,T=1,C=new et(F,L),W=new et(F,L),M=new dt(g,b),j=new dt(g,b),U,J,ne=!1,de=!0,x=null,Y=null,fe="default",ee=!1,H="Awesome Tauri Example!";function K(){Pi(c)}function te(){l[i].setTitle(H)}function pe(){l[i].hide(),setTimeout(l[i].show,2e3)}function se(){l[i].minimize(),setTimeout(l[i].unminimize,2e3)}function ae(){Ni({multiple:!1}).then(X=>{typeof X=="string"&&l[i].setIcon(X)})}function _e(){if(!d)return;const X=new mt(d);n(1,l[d]=X,l),X.once("tauri://error",function(){u("Error creating new webview")})}function ce(){l[i].innerSize().then(X=>{n(26,M=X),n(7,g=M.width),n(8,b=M.height)}),l[i].outerSize().then(X=>{n(27,j=X)})}function ie(){l[i].innerPosition().then(X=>{n(24,C=X)}),l[i].outerPosition().then(X=>{n(25,W=X),n(13,F=W.x),n(14,L=W.y)})}async function Te(X){!X||(U&&U(),J&&J(),J=await X.listen("tauri://move",ie),U=await X.listen("tauri://resize",ce))}async function Ce(){await l[i].minimize(),await l[i].requestUserAttention(Ii.Critical),await new Promise(X=>setTimeout(X,3e3)),await l[i].requestUserAttention(null)}function D(){d=this.value,n(21,d)}function B(){i=Ei(this),n(0,i),n(1,l)}const Ae=()=>l[i].center();function me(){y=this.checked,n(3,y)}function oe(){f=this.checked,n(2,f)}function Le(){k=this.checked,n(4,k)}function Q(){_=this.checked,n(5,_)}function Ee(){v=this.checked,n(6,v)}function Ie(){F=re(this.value),n(13,F)}function ze(){L=re(this.value),n(14,L)}function Z(){g=re(this.value),n(7,g)}function N(){b=re(this.value),n(8,b)}function le(){A=re(this.value),n(9,A)}function G(){O=re(this.value),n(10,O)}function We(){I=re(this.value),n(11,I)}function Oe(){P=re(this.value),n(12,P)}function Yt(){ne=this.checked,n(15,ne)}function ht(){de=this.checked,n(16,de)}function Kt(){ee=this.checked,n(20,ee)}function Pe(){fe=Ei(this),n(19,fe),n(29,o)}function $t(){x=re(this.value),n(17,x)}function qe(){Y=re(this.value),n(18,Y)}function _t(){H=this.value,n(28,H)}function Qt(){c=this.value,n(22,c)}return e.$$set=X=>{"onMessage"in X&&n(37,u=X.onMessage)},e.$$.update=()=>{var X,Wt,nt,Ot,Se,bt,gt,yt,ke,He,De,it,Pt,lt,Rt,st,vt,It;e.$$.dirty[0]&3&&(l[i],ie(),ce()),e.$$.dirty[0]&7&&((X=l[i])==null||X.setResizable(f)),e.$$.dirty[0]&11&&(y?(Wt=l[i])==null||Wt.maximize():(nt=l[i])==null||nt.unmaximize()),e.$$.dirty[0]&19&&((Ot=l[i])==null||Ot.setDecorations(k)),e.$$.dirty[0]&35&&((Se=l[i])==null||Se.setAlwaysOnTop(_)),e.$$.dirty[0]&67&&((bt=l[i])==null||bt.setFullscreen(v)),e.$$.dirty[0]&387&&g&&b&&((gt=l[i])==null||gt.setSize(new dt(g,b))),e.$$.dirty[0]&1539&&(A&&O?(yt=l[i])==null||yt.setMinSize(new Qn(A,O)):(ke=l[i])==null||ke.setMinSize(null)),e.$$.dirty[0]&6147&&(I>800&&P>400?(He=l[i])==null||He.setMaxSize(new Qn(I,P)):(De=l[i])==null||De.setMaxSize(null)),e.$$.dirty[0]&24579&&F!==null&&L!==null&&((it=l[i])==null||it.setPosition(new et(F,L))),e.$$.dirty[0]&3&&((Pt=l[i])==null||Pt.scaleFactor().then(wt=>n(23,T=wt))),e.$$.dirty[0]&3&&Te(l[i]),e.$$.dirty[0]&32771&&((lt=l[i])==null||lt.setCursorGrab(ne)),e.$$.dirty[0]&65539&&((Rt=l[i])==null||Rt.setCursorVisible(de)),e.$$.dirty[0]&524291&&((st=l[i])==null||st.setCursorIcon(fe)),e.$$.dirty[0]&393219&&x!==null&&Y!==null&&((vt=l[i])==null||vt.setCursorPosition(new et(x,Y))),e.$$.dirty[0]&1048579&&((It=l[i])==null||It.setIgnoreCursorEvents(ee))},[i,l,f,y,k,_,v,g,b,A,O,I,P,F,L,ne,de,x,Y,fe,ee,d,c,T,C,W,M,j,H,o,K,te,pe,se,ae,_e,Ce,u,D,B,Ae,me,oe,Le,Q,Ee,Ie,ze,Z,N,le,G,We,Oe,Yt,ht,Kt,Pe,$t,qe,_t,Qt]}class Ta extends ye{constructor(t){super(),ge(this,t,Ma,ka,he,{onMessage:37},null,[-1,-1,-1])}}var Ca={};we(Ca,{isRegistered:()=>Sa,register:()=>Ys,registerAll:()=>Aa,unregister:()=>Ks,unregisterAll:()=>$s});async function Ys(e,t){return S({__tauriModule:"GlobalShortcut",message:{cmd:"register",shortcut:e,handler:pt(t)}})}async function Aa(e,t){return S({__tauriModule:"GlobalShortcut",message:{cmd:"registerAll",shortcuts:e,handler:pt(t)}})}async function Sa(e){return S({__tauriModule:"GlobalShortcut",message:{cmd:"isRegistered",shortcut:e}})}async function Ks(e){return S({__tauriModule:"GlobalShortcut",message:{cmd:"unregister",shortcut:e}})}async function $s(){return S({__tauriModule:"GlobalShortcut",message:{cmd:"unregisterAll"}})}function ss(e,t,n){const i=e.slice();return i[9]=t[n],i}function os(e){let t,n=e[9]+"",i,l,o,u,d;function c(){return e[8](e[9])}return{c(){t=a("div"),i=z(n),l=h(),o=a("button"),o.textContent="Unregister",r(o,"class","btn"),r(o,"type","button"),r(t,"class","flex justify-between")},m(f,y){m(f,t,y),s(t,i),s(t,l),s(t,o),u||(d=E(o,"click",c),u=!0)},p(f,y){e=f,y&2&&n!==(n=e[9]+"")&&$(i,n)},d(f){f&&p(t),u=!1,d()}}}function as(e){let t,n,i,l,o;return{c(){t=a("br"),n=h(),i=a("button"),i.textContent="Unregister all",r(i,"class","btn"),r(i,"type","button")},m(u,d){m(u,t,d),m(u,n,d),m(u,i,d),l||(o=E(i,"click",e[5]),l=!0)},p:V,d(u){u&&p(t),u&&p(n),u&&p(i),l=!1,o()}}}function La(e){let t,n,i,l,o,u,d,c,f,y,k,_=e[1],v=[];for(let b=0;b<_.length;b+=1)v[b]=os(ss(e,_,b));let g=e[1].length>1&&as(e);return{c(){t=a("div"),n=a("input"),i=h(),l=a("button"),l.textContent="Register",o=h(),u=a("br"),d=h(),c=a("div");for(let b=0;b1?g?g.p(b,A):(g=as(b),g.c(),g.m(c,null)):g&&(g.d(1),g=null)},i:V,o:V,d(b){b&&p(t),b&&p(o),b&&p(u),b&&p(d),b&&p(c),ft(v,b),g&&g.d(),y=!1,ue(k)}}}function Ea(e,t,n){let i,{onMessage:l}=t;const o=ws([]);gs(e,o,_=>n(1,i=_));let u="CmdOrControl+X";function d(){const _=u;Ys(_,()=>{l(`Shortcut ${_} triggered`)}).then(()=>{o.update(v=>[...v,_]),l(`Shortcut ${_} registered successfully`)}).catch(l)}function c(_){const v=_;Ks(v).then(()=>{o.update(g=>g.filter(b=>b!==v)),l(`Shortcut ${v} unregistered`)}).catch(l)}function f(){$s().then(()=>{o.update(()=>[]),l("Unregistered all shortcuts")}).catch(l)}function y(){u=this.value,n(0,u)}const k=_=>c(_);return e.$$set=_=>{"onMessage"in _&&n(6,l=_.onMessage)},[u,i,o,d,c,f,l,y,k]}class za extends ye{constructor(t){super(),ge(this,t,Ea,La,he,{onMessage:6})}}function rs(e){let t,n,i,l,o,u,d;return{c(){t=a("br"),n=h(),i=a("input"),l=h(),o=a("button"),o.textContent="Write",r(i,"class","input"),r(i,"placeholder","write to stdin"),r(o,"class","btn")},m(c,f){m(c,t,f),m(c,n,f),m(c,i,f),q(i,e[4]),m(c,l,f),m(c,o,f),u||(d=[E(i,"input",e[14]),E(o,"click",e[8])],u=!0)},p(c,f){f&16&&i.value!==c[4]&&q(i,c[4])},d(c){c&&p(t),c&&p(n),c&&p(i),c&&p(l),c&&p(o),u=!1,ue(d)}}}function Da(e){let t,n,i,l,o,u,d,c,f,y,k,_,v,g,b,A,O,I,P,F,L,T,C,W,M=e[5]&&rs(e);return{c(){t=a("div"),n=a("div"),i=z(`Script: + Additionally, it has a update --background subcommand.`,n=h(),i=a("br"),l=h(),o=a("div"),o.textContent="Note that the arguments are only parsed, not implemented.",u=h(),d=a("br"),c=h(),f=a("br"),g=h(),k=a("button"),k.textContent="Get matches",r(o,"class","note"),r(k,"class","btn"),r(k,"id","cli-matches")},m(y,b){m(y,t,b),m(y,n,b),m(y,i,b),m(y,l,b),m(y,o,b),m(y,u,b),m(y,d,b),m(y,c,b),m(y,f,b),m(y,g,b),m(y,k,b),_||(v=L(k,"click",e[0]),_=!0)},p:V,i:V,o:V,d(y){y&&p(t),y&&p(n),y&&p(i),y&&p(l),y&&p(o),y&&p(u),y&&p(d),y&&p(c),y&&p(f),y&&p(g),y&&p(k),_=!1,v()}}}function Uo(e,t,n){let{onMessage:i}=t;function l(){Gs().then(i).catch(i)}return e.$$set=o=>{"onMessage"in o&&n(1,i=o.onMessage)},[l,i]}class qo extends ve{constructor(t){super(),ye(this,t,Uo,jo,_e,{onMessage:1})}}function Bo(e){let t,n,i,l,o,u,d,c;return{c(){t=a("div"),n=a("button"),n.textContent="Call Log API",i=h(),l=a("button"),l.textContent="Call Request (async) API",o=h(),u=a("button"),u.textContent="Send event to Rust",r(n,"class","btn"),r(n,"id","log"),r(l,"class","btn"),r(l,"id","request"),r(u,"class","btn"),r(u,"id","event")},m(f,g){m(f,t,g),s(t,n),s(t,i),s(t,l),s(t,o),s(t,u),d||(c=[L(n,"click",e[0]),L(l,"click",e[1]),L(u,"click",e[2])],d=!0)},p:V,i:V,o:V,d(f){f&&p(t),d=!1,se(c)}}}function Vo(e,t,n){let{onMessage:i}=t,l;dt(async()=>{l=await Yt("rust-event",i)}),Ii(()=>{l&&l()});function o(){ei("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function u(){ei("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)}function d(){oi("js-event","this is the payload string")}return e.$$set=c=>{"onMessage"in c&&n(3,i=c.onMessage)},[o,u,d,i]}class Go extends ve{constructor(t){super(),ye(this,t,Vo,Bo,_e,{onMessage:3})}}var Jo={};Ce(Jo,{ask:()=>Xs,confirm:()=>Yo,message:()=>Xo,open:()=>Bi,save:()=>Js});async function Bi(e={}){return typeof e=="object"&&Object.freeze(e),S({__tauriModule:"Dialog",message:{cmd:"openDialog",options:e}})}async function Js(e={}){return typeof e=="object"&&Object.freeze(e),S({__tauriModule:"Dialog",message:{cmd:"saveDialog",options:e}})}async function Xo(e,t){var i,l;let n=typeof t=="string"?{title:t}:t;return S({__tauriModule:"Dialog",message:{cmd:"messageDialog",message:e.toString(),title:(i=n==null?void 0:n.title)==null?void 0:i.toString(),type:n==null?void 0:n.type,buttonLabel:(l=n==null?void 0:n.okLabel)==null?void 0:l.toString()}})}async function Xs(e,t){var i,l,o,u,d;let n=typeof t=="string"?{title:t}:t;return S({__tauriModule:"Dialog",message:{cmd:"askDialog",message:e.toString(),title:(i=n==null?void 0:n.title)==null?void 0:i.toString(),type:n==null?void 0:n.type,buttonLabels:[(o=(l=n==null?void 0:n.okLabel)==null?void 0:l.toString())!=null?o:"Yes",(d=(u=n==null?void 0:n.cancelLabel)==null?void 0:u.toString())!=null?d:"No"]}})}async function Yo(e,t){var i,l,o,u,d;let n=typeof t=="string"?{title:t}:t;return S({__tauriModule:"Dialog",message:{cmd:"confirmDialog",message:e.toString(),title:(i=n==null?void 0:n.title)==null?void 0:i.toString(),type:n==null?void 0:n.type,buttonLabels:[(o=(l=n==null?void 0:n.okLabel)==null?void 0:l.toString())!=null?o:"Ok",(d=(u=n==null?void 0:n.cancelLabel)==null?void 0:u.toString())!=null?d:"Cancel"]}})}var Ko={};Ce(Ko,{BaseDirectory:()=>Xt,Dir:()=>Xt,copyFile:()=>ea,createDir:()=>$o,exists:()=>ia,readBinaryFile:()=>Vi,readDir:()=>Ys,readTextFile:()=>Qo,removeDir:()=>xo,removeFile:()=>ta,renameFile:()=>na,writeBinaryFile:()=>Zo,writeFile:()=>Ri,writeTextFile:()=>Ri});var Xt=(e=>(e[e.Audio=1]="Audio",e[e.Cache=2]="Cache",e[e.Config=3]="Config",e[e.Data=4]="Data",e[e.LocalData=5]="LocalData",e[e.Desktop=6]="Desktop",e[e.Document=7]="Document",e[e.Download=8]="Download",e[e.Executable=9]="Executable",e[e.Font=10]="Font",e[e.Home=11]="Home",e[e.Picture=12]="Picture",e[e.Public=13]="Public",e[e.Runtime=14]="Runtime",e[e.Template=15]="Template",e[e.Video=16]="Video",e[e.Resource=17]="Resource",e[e.App=18]="App",e[e.Log=19]="Log",e[e.Temp=20]="Temp",e[e.AppConfig=21]="AppConfig",e[e.AppData=22]="AppData",e[e.AppLocalData=23]="AppLocalData",e[e.AppCache=24]="AppCache",e[e.AppLog=25]="AppLog",e))(Xt||{});async function Qo(e,t={}){return S({__tauriModule:"Fs",message:{cmd:"readTextFile",path:e,options:t}})}async function Vi(e,t={}){let n=await S({__tauriModule:"Fs",message:{cmd:"readFile",path:e,options:t}});return Uint8Array.from(n)}async function Ri(e,t,n){typeof n=="object"&&Object.freeze(n),typeof e=="object"&&Object.freeze(e);let i={path:"",contents:""},l=n;return typeof e=="string"?i.path=e:(i.path=e.path,i.contents=e.contents),typeof t=="string"?i.contents=t!=null?t:"":l=t,S({__tauriModule:"Fs",message:{cmd:"writeFile",path:i.path,contents:Array.from(new TextEncoder().encode(i.contents)),options:l}})}async function Zo(e,t,n){typeof n=="object"&&Object.freeze(n),typeof e=="object"&&Object.freeze(e);let i={path:"",contents:[]},l=n;return typeof e=="string"?i.path=e:(i.path=e.path,i.contents=e.contents),t&&"dir"in t?l=t:typeof e=="string"&&(i.contents=t!=null?t:[]),S({__tauriModule:"Fs",message:{cmd:"writeFile",path:i.path,contents:Array.from(i.contents instanceof ArrayBuffer?new Uint8Array(i.contents):i.contents),options:l}})}async function Ys(e,t={}){return S({__tauriModule:"Fs",message:{cmd:"readDir",path:e,options:t}})}async function $o(e,t={}){return S({__tauriModule:"Fs",message:{cmd:"createDir",path:e,options:t}})}async function xo(e,t={}){return S({__tauriModule:"Fs",message:{cmd:"removeDir",path:e,options:t}})}async function ea(e,t,n={}){return S({__tauriModule:"Fs",message:{cmd:"copyFile",source:e,destination:t,options:n}})}async function ta(e,t={}){return S({__tauriModule:"Fs",message:{cmd:"removeFile",path:e,options:t}})}async function na(e,t,n={}){return S({__tauriModule:"Fs",message:{cmd:"renameFile",oldPath:e,newPath:t,options:n}})}async function ia(e,t={}){return S({__tauriModule:"Fs",message:{cmd:"exists",path:e,options:t}})}function la(e){let t,n,i,l,o,u,d,c,f,g,k,_,v,y,b,C,W,I,O,j,E,M,A,P;return{c(){t=a("div"),n=a("input"),i=h(),l=a("input"),o=h(),u=a("br"),d=h(),c=a("div"),f=a("input"),g=h(),k=a("label"),k.textContent="Multiple",_=h(),v=a("div"),y=a("input"),b=h(),C=a("label"),C.textContent="Directory",W=h(),I=a("br"),O=h(),j=a("button"),j.textContent="Open dialog",E=h(),M=a("button"),M.textContent="Open save dialog",r(n,"class","input"),r(n,"id","dialog-default-path"),r(n,"placeholder","Default path"),r(l,"class","input"),r(l,"id","dialog-filter"),r(l,"placeholder","Extensions filter, comma-separated"),r(t,"class","flex gap-2 children:grow"),r(f,"type","checkbox"),r(f,"id","dialog-multiple"),r(k,"for","dialog-multiple"),r(y,"type","checkbox"),r(y,"id","dialog-directory"),r(C,"for","dialog-directory"),r(j,"class","btn"),r(j,"id","open-dialog"),r(M,"class","btn"),r(M,"id","save-dialog")},m(T,F){m(T,t,F),s(t,n),q(n,e[0]),s(t,i),s(t,l),q(l,e[1]),m(T,o,F),m(T,u,F),m(T,d,F),m(T,c,F),s(c,f),f.checked=e[2],s(c,g),s(c,k),m(T,_,F),m(T,v,F),s(v,y),y.checked=e[3],s(v,b),s(v,C),m(T,W,F),m(T,I,F),m(T,O,F),m(T,j,F),m(T,E,F),m(T,M,F),A||(P=[L(n,"input",e[8]),L(l,"input",e[9]),L(f,"change",e[10]),L(y,"change",e[11]),L(j,"click",e[4]),L(M,"click",e[5])],A=!0)},p(T,[F]){F&1&&n.value!==T[0]&&q(n,T[0]),F&2&&l.value!==T[1]&&q(l,T[1]),F&4&&(f.checked=T[2]),F&8&&(y.checked=T[3])},i:V,o:V,d(T){T&&p(t),T&&p(o),T&&p(u),T&&p(d),T&&p(c),T&&p(_),T&&p(v),T&&p(W),T&&p(I),T&&p(O),T&&p(j),T&&p(E),T&&p(M),A=!1,se(P)}}}function sa(e,t){var n=new Blob([e],{type:"application/octet-binary"}),i=new FileReader;i.onload=function(l){var o=l.target.result;t(o.substr(o.indexOf(",")+1))},i.readAsDataURL(n)}function oa(e,t,n){let{onMessage:i}=t,{insecureRenderHtml:l}=t,o=null,u=null,d=!1,c=!1;function f(){Bi({title:"My wonderful open dialog",defaultPath:o,filters:u?[{name:"Tauri Example",extensions:u.split(",").map(b=>b.trim())}]:[],multiple:d,directory:c}).then(function(b){if(Array.isArray(b))i(b);else{var C=b,W=C.match(/\S+\.\S+$/g);Vi(C).then(function(I){W&&(C.includes(".png")||C.includes(".jpg"))?sa(new Uint8Array(I),function(O){var j="data:image/png;base64,"+O;l('')}):i(b)}).catch(i(b))}}).catch(i)}function g(){Js({title:"My wonderful save dialog",defaultPath:o,filters:u?[{name:"Tauri Example",extensions:u.split(",").map(b=>b.trim())}]:[]}).then(i).catch(i)}function k(){o=this.value,n(0,o)}function _(){u=this.value,n(1,u)}function v(){d=this.checked,n(2,d)}function y(){c=this.checked,n(3,c)}return e.$$set=b=>{"onMessage"in b&&n(6,i=b.onMessage),"insecureRenderHtml"in b&&n(7,l=b.insecureRenderHtml)},[o,u,d,c,f,g,i,l,k,_,v,y]}class aa extends ve{constructor(t){super(),ye(this,t,oa,la,_e,{onMessage:6,insecureRenderHtml:7})}}function Xl(e,t,n){const i=e.slice();return i[9]=t[n],i}function Yl(e){let t,n=e[9][0]+"",i;return{c(){t=a("option"),i=z(n),t.__value=e[9][1],t.value=t.__value},m(l,o){m(l,t,o),s(t,i)},p:V,d(l){l&&p(t)}}}function ra(e){let t,n,i,l,o,u,d,c,f,g,k,_,v,y,b,C,W,I,O,j=e[2],E=[];for(let M=0;MisNaN(parseInt(_))).map(_=>[_,Xt[_]]);function c(){const _=o.match(/\S+\.\S+$/g),v={dir:Kl()};(_?Vi(o,v):Ys(o,v)).then(function(b){if(_)if(o.includes(".png")||o.includes(".jpg"))ua(new Uint8Array(b),function(C){const W="data:image/png;base64,"+C;l('')});else{const C=String.fromCharCode.apply(null,b);l(''),setTimeout(()=>{const W=document.getElementById("file-response");W.value=C,document.getElementById("file-save").addEventListener("click",function(){Ri(o,W.value,{dir:Kl()}).catch(i)})})}else i(b)}).catch(i)}function f(){n(1,u.src=As(o),u)}function g(){o=this.value,n(0,o)}function k(_){$n[_?"unshift":"push"](()=>{u=_,n(1,u)})}return e.$$set=_=>{"onMessage"in _&&n(5,i=_.onMessage),"insecureRenderHtml"in _&&n(6,l=_.insecureRenderHtml)},[o,u,d,c,f,i,l,g,k]}class da extends ve{constructor(t){super(),ye(this,t,ca,ra,_e,{onMessage:5,insecureRenderHtml:6})}}var fa={};Ce(fa,{Body:()=>it,Client:()=>Qs,Response:()=>Ks,ResponseType:()=>Gi,fetch:()=>pa,getClient:()=>ni});var Gi=(e=>(e[e.JSON=1]="JSON",e[e.Text=2]="Text",e[e.Binary=3]="Binary",e))(Gi||{}),it=class{constructor(e,t){this.type=e,this.payload=t}static form(e){let t={},n=(i,l)=>{if(l!==null){let o;typeof l=="string"?o=l:l instanceof Uint8Array||Array.isArray(l)?o=Array.from(l):l instanceof File?o={file:l.name,mime:l.type,fileName:l.name}:typeof l.file=="string"?o={file:l.file,mime:l.mime,fileName:l.fileName}:o={file:Array.from(l.file),mime:l.mime,fileName:l.fileName},t[String(i)]=o}};if(e instanceof FormData)for(let[i,l]of e)n(i,l);else for(let[i,l]of Object.entries(e))n(i,l);return new it("Form",t)}static json(e){return new it("Json",e)}static text(e){return new it("Text",e)}static bytes(e){return new it("Bytes",Array.from(e instanceof ArrayBuffer?new Uint8Array(e):e))}},Ks=class{constructor(e){this.url=e.url,this.status=e.status,this.ok=this.status>=200&&this.status<300,this.headers=e.headers,this.rawHeaders=e.rawHeaders,this.data=e.data}},Qs=class{constructor(e){this.id=e}async drop(){return S({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}})}async request(e){let t=!e.responseType||e.responseType===1;return t&&(e.responseType=2),S({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:e}}).then(n=>{let i=new Ks(n);if(t){try{i.data=JSON.parse(i.data)}catch(l){if(i.ok&&i.data==="")i.data={};else if(i.ok)throw Error(`Failed to parse response \`${i.data}\` as JSON: ${l}; + try setting the \`responseType\` option to \`ResponseType.Text\` or \`ResponseType.Binary\` if the API does not return a JSON response.`)}return i}return i})}async get(e,t){return this.request({method:"GET",url:e,...t})}async post(e,t,n){return this.request({method:"POST",url:e,body:t,...n})}async put(e,t,n){return this.request({method:"PUT",url:e,body:t,...n})}async patch(e,t){return this.request({method:"PATCH",url:e,...t})}async delete(e,t){return this.request({method:"DELETE",url:e,...t})}};async function ni(e){return S({__tauriModule:"Http",message:{cmd:"createClient",options:e}}).then(t=>new Qs(t))}var Wi=null;async function pa(e,t){var n;return Wi===null&&(Wi=await ni()),Wi.request({url:e,method:(n=t==null?void 0:t.method)!=null?n:"GET",...t})}function Ql(e,t,n){const i=e.slice();return i[12]=t[n],i[14]=n,i}function Zl(e){let t,n,i,l,o,u,d,c,f,g,k,_,v,y,b,C,W,I=e[5],O=[];for(let A=0;AIe(O[A],1,1,()=>{O[A]=null});let E=!e[3]&&ts(),M=!e[3]&&e[8]&&ns();return{c(){t=a("span"),n=a("span"),i=z(e[6]),l=h(),o=a("ul");for(let A=0;A{g[y]=null}),si(),o=g[l],o?o.p(_,v):(o=g[l]=f[l](_),o.c()),Se(o,1),o.m(t,u))},i(_){d||(Se(o),d=!0)},o(_){Ie(o),d=!1},d(_){_&&p(t),c&&c.d(),g[l].d()}}}function ts(e){let t;return{c(){t=a("span"),t.textContent=",",r(t,"class","comma svelte-gbh3pt")},m(n,i){m(n,t,i)},d(n){n&&p(t)}}}function ns(e){let t;return{c(){t=a("span"),t.textContent=",",r(t,"class","comma svelte-gbh3pt")},m(n,i){m(n,t,i)},d(n){n&&p(t)}}}function _a(e){let t,n,i=e[5].length&&Zl(e);return{c(){i&&i.c(),t=ii()},m(l,o){i&&i.m(l,o),m(l,t,o),n=!0},p(l,[o]){l[5].length?i?(i.p(l,o),o&32&&Se(i,1)):(i=Zl(l),i.c(),Se(i,1),i.m(t.parentNode,t)):i&&(li(),Ie(i,1,1,()=>{i=null}),si())},i(l){n||(Se(i),n=!0)},o(l){Ie(i),n=!1},d(l){i&&i.d(l),l&&p(t)}}}const ba="...";function ga(e,t,n){let{json:i}=t,{depth:l=1/0}=t,{_lvl:o=0}=t,{_last:u=!0}=t;const d=b=>b===null?"null":typeof b;let c,f,g,k,_;const v=b=>{switch(d(b)){case"string":return`"${b}"`;case"function":return"f () {...}";case"symbol":return b.toString();default:return b}},y=()=>{n(8,_=!_)};return e.$$set=b=>{"json"in b&&n(0,i=b.json),"depth"in b&&n(1,l=b.depth),"_lvl"in b&&n(2,o=b._lvl),"_last"in b&&n(3,u=b._last)},e.$$.update=()=>{e.$$.dirty&17&&(n(5,c=d(i)==="object"?Object.keys(i):[]),n(4,f=Array.isArray(i)),n(6,g=f?"[":"{"),n(7,k=f?"]":"}")),e.$$.dirty&6&&n(8,_=le[9].call(n)),r(k,"class","input h-auto w-100%"),r(k,"id","request-body"),r(k,"placeholder","Request body"),r(k,"rows","5"),r(b,"class","btn"),r(b,"id","make-request"),r(M,"class","input"),r(P,"class","input"),r(E,"class","flex gap-2 children:grow"),r(ne,"type","checkbox"),r(X,"class","btn"),r(X,"type","button")},m(D,B){m(D,t,B),s(t,n),s(n,i),s(n,l),s(n,o),s(n,u),s(n,d),Dt(n,e[0]),s(t,c),s(t,f),s(t,g),s(t,k),q(k,e[1]),s(t,_),s(t,v),s(t,y),s(t,b),m(D,C,B),m(D,W,B),m(D,I,B),m(D,O,B),m(D,j,B),m(D,E,B),s(E,M),q(M,e[2]),s(E,A),s(E,P),q(P,e[3]),m(D,T,B),m(D,F,B),m(D,U,B),m(D,J,B),s(J,ne),ne.checked=e[5],s(J,ce),m(D,te,B),m(D,Y,B),m(D,oe,B),m(D,ee,B),m(D,H,B),m(D,X,B),m(D,$,B),m(D,be,B),m(D,fe,B),m(D,pe,B),m(D,we,B),Gt(ae,D,B),x=!0,me||(Le=[L(n,"change",e[9]),L(k,"input",e[10]),L(t,"submit",Zn(e[6])),L(M,"input",e[11]),L(P,"input",e[12]),L(ne,"change",e[13]),L(X,"click",e[7])],me=!0)},p(D,[B]){B&1&&Dt(n,D[0]),B&2&&q(k,D[1]),B&4&&M.value!==D[2]&&q(M,D[2]),B&8&&P.value!==D[3]&&q(P,D[3]),B&32&&(ne.checked=D[5]);const Ee={};B&16&&(Ee.json=D[4]),ae.$set(Ee)},i(D){x||(Se(ae.$$.fragment,D),x=!0)},o(D){Ie(ae.$$.fragment,D),x=!1},d(D){D&&p(t),D&&p(C),D&&p(W),D&&p(I),D&&p(O),D&&p(j),D&&p(E),D&&p(T),D&&p(F),D&&p(U),D&&p(J),D&&p(te),D&&p(Y),D&&p(oe),D&&p(ee),D&&p(H),D&&p(X),D&&p($),D&&p(be),D&&p(fe),D&&p(pe),D&&p(we),Jt(ae,D),me=!1,se(Le)}}}function va(e,t,n){let i="GET",l="",{onMessage:o}=t;async function u(){const W=await ni().catch(j=>{throw o(j),j}),O={url:"http://localhost:3003",method:i||"GET"||"GET"};l.startsWith("{")&&l.endsWith("}")||l.startsWith("[")&&l.endsWith("]")?O.body=it.json(JSON.parse(l)):l!==""&&(O.body=it.text(l)),W.request(O).then(o).catch(o)}let d="baz",c="qux",f=null,g=!0;async function k(){const W=await ni().catch(I=>{throw o(I),I});n(4,f=await W.request({url:"http://localhost:3003",method:"POST",body:it.form({foo:d,bar:c}),headers:g?{"Content-Type":"multipart/form-data"}:void 0,responseType:Gi.Text}))}function _(){i=Pi(this),n(0,i)}function v(){l=this.value,n(1,l)}function y(){d=this.value,n(2,d)}function b(){c=this.value,n(3,c)}function C(){g=this.checked,n(5,g)}return e.$$set=W=>{"onMessage"in W&&n(8,o=W.onMessage)},[i,l,d,c,f,g,u,k,o,_,v,y,b,C]}class wa extends ve{constructor(t){super(),ye(this,t,va,ya,_e,{onMessage:8})}}function ka(e){let t,n,i;return{c(){t=a("button"),t.textContent="Send test notification",r(t,"class","btn"),r(t,"id","notification")},m(l,o){m(l,t,o),n||(i=L(t,"click",Ma),n=!0)},p:V,i:V,o:V,d(l){l&&p(t),n=!1,i()}}}function Ma(){new Notification("Notification title",{body:"This is the notification body"})}function Ta(e,t,n){let{onMessage:i}=t;return e.$$set=l=>{"onMessage"in l&&n(0,i=l.onMessage)},[i]}class Ca extends ve{constructor(t){super(),ye(this,t,Ta,ka,_e,{onMessage:0})}}function is(e,t,n){const i=e.slice();return i[69]=t[n],i}function ls(e,t,n){const i=e.slice();return i[72]=t[n],i}function ss(e){let t,n,i,l,o,u,d=Object.keys(e[1]),c=[];for(let f=0;fe[40].call(i))},m(f,g){m(f,t,g),m(f,n,g),m(f,i,g),s(i,l);for(let k=0;ke[59].call(Ue)),r($e,"class","input"),r($e,"type","number"),r(xe,"class","input"),r(xe,"type","number"),r(je,"class","flex gap-2"),r(et,"class","input grow"),r(et,"id","title"),r(Nt,"class","btn"),r(Nt,"type","submit"),r(ut,"class","flex gap-1"),r(tt,"class","input grow"),r(tt,"id","url"),r(jt,"class","btn"),r(jt,"id","open-url"),r(ct,"class","flex gap-1"),r(rt,"class","flex flex-col gap-1")},m(w,R){m(w,t,R),m(w,n,R),m(w,i,R),s(i,l),s(i,o),s(i,u),s(i,d),s(i,c),s(i,f),s(i,g),s(i,k),s(i,_),m(w,v,R),m(w,y,R),m(w,b,R),m(w,C,R),s(C,W),s(W,I),s(W,O),O.checked=e[3],s(C,j),s(C,E),s(E,M),s(E,A),A.checked=e[2],s(C,P),s(C,T),s(T,F),s(T,U),U.checked=e[4],s(C,J),s(C,ne),s(ne,ce),s(ne,te),te.checked=e[5],s(C,Y),s(C,oe),s(oe,ee),s(oe,H),H.checked=e[6],s(C,X),s(C,$),s($,be),s($,fe),fe.checked=e[7],m(w,pe,R),m(w,we,R),m(w,ae,R),m(w,x,R),s(x,me),s(me,Le),s(Le,D),s(Le,B),q(B,e[14]),s(me,Ee),s(me,ke),s(ke,re),s(ke,de),q(de,e[15]),s(x,ue),s(x,Me),s(Me,He),s(He,We),s(He,Z),q(Z,e[8]),s(Me,N),s(Me,ie),s(ie,G),s(ie,he),q(he,e[9]),s(x,Kt),s(x,Be),s(Be,bt),s(bt,Qt),s(bt,Oe),q(Oe,e[10]),s(Be,Zt),s(Be,gt),s(gt,$t),s(gt,Re),q(Re,e[11]),s(x,xt),s(x,Ve),s(Ve,K),s(K,Pt),s(K,ze),q(ze,e[12]),s(Ve,Ot),s(Ve,lt),s(lt,Rt),s(lt,De),q(De,e[13]),m(w,yt,R),m(w,vt,R),m(w,wt,R),m(w,Ae,R),s(Ae,Fe),s(Fe,Pe),s(Pe,st),s(Pe,It),s(Pe,ot),s(ot,Ht),s(ot,kt),s(Pe,en),s(Pe,tn),s(tn,Xi),s(tn,ai),s(Fe,Yi),s(Fe,Ge),s(Ge,ln),s(Ge,Ki),s(Ge,sn),s(sn,Qi),s(sn,ri),s(Ge,Zi),s(Ge,an),s(an,$i),s(an,ui),s(Ae,xi),s(Ae,Mt),s(Mt,Je),s(Je,un),s(Je,el),s(Je,cn),s(cn,tl),s(cn,ci),s(Je,nl),s(Je,fn),s(fn,il),s(fn,di),s(Mt,ll),s(Mt,Xe),s(Xe,mn),s(Xe,sl),s(Xe,hn),s(hn,ol),s(hn,fi),s(Xe,al),s(Xe,bn),s(bn,rl),s(bn,pi),s(Ae,ul),s(Ae,Tt),s(Tt,Ye),s(Ye,yn),s(Ye,cl),s(Ye,vn),s(vn,dl),s(vn,mi),s(Ye,fl),s(Ye,kn),s(kn,pl),s(kn,hi),s(Tt,ml),s(Tt,Ke),s(Ke,Tn),s(Ke,hl),s(Ke,Cn),s(Cn,_l),s(Cn,_i),s(Ke,bl),s(Ke,Sn),s(Sn,gl),s(Sn,bi),s(Ae,yl),s(Ae,Ct),s(Ct,Qe),s(Qe,En),s(Qe,vl),s(Qe,zn),s(zn,wl),s(zn,gi),s(Qe,kl),s(Qe,Wn),s(Wn,Ml),s(Wn,yi),s(Ct,Tl),s(Ct,Ze),s(Ze,On),s(Ze,Cl),s(Ze,Rn),s(Rn,Al),s(Rn,vi),s(Ze,Sl),s(Ze,Hn),s(Hn,Ll),s(Hn,wi),m(w,ki,R),m(w,Mi,R),m(w,Ti,R),m(w,Ft,R),m(w,Ci,R),m(w,Ne,R),s(Ne,Nn),s(Nn,At),At.checked=e[16],s(Nn,El),s(Ne,zl),s(Ne,jn),s(jn,St),St.checked=e[17],s(jn,Dl),s(Ne,Wl),s(Ne,Un),s(Un,Lt),Lt.checked=e[21],s(Un,Pl),m(w,Ai,R),m(w,je,R),s(je,qn),s(qn,Ol),s(qn,Ue);for(let ge=0;ge=1,g,k,_,v=f&&ss(e),y=e[1][e[0]]&&as(e);return{c(){t=a("div"),n=a("div"),i=a("input"),l=h(),o=a("button"),o.textContent="New window",u=h(),d=a("br"),c=h(),v&&v.c(),g=h(),y&&y.c(),r(i,"class","input grow"),r(i,"type","text"),r(i,"placeholder","New Window label.."),r(o,"class","btn"),r(n,"class","flex gap-1"),r(t,"class","flex flex-col children:grow gap-2")},m(b,C){m(b,t,C),s(t,n),s(n,i),q(i,e[22]),s(n,l),s(n,o),s(t,u),s(t,d),s(t,c),v&&v.m(t,null),s(t,g),y&&y.m(t,null),k||(_=[L(i,"input",e[39]),L(o,"click",e[36])],k=!0)},p(b,C){C[0]&4194304&&i.value!==b[22]&&q(i,b[22]),C[0]&2&&(f=Object.keys(b[1]).length>=1),f?v?v.p(b,C):(v=ss(b),v.c(),v.m(t,g)):v&&(v.d(1),v=null),b[1][b[0]]?y?y.p(b,C):(y=as(b),y.c(),y.m(t,null)):y&&(y.d(1),y=null)},i:V,o:V,d(b){b&&p(t),v&&v.d(),y&&y.d(),k=!1,se(_)}}}function Sa(e,t,n){let i=qe.label;const l={[qe.label]:qe},o=["default","crosshair","hand","arrow","move","text","wait","help","progress","notAllowed","contextMenu","cell","verticalText","alias","copy","noDrop","grab","grabbing","allScroll","zoomIn","zoomOut","eResize","nResize","neResize","nwResize","sResize","seResize","swResize","wResize","ewResize","nsResize","neswResize","nwseResize","colResize","rowResize"];let{onMessage:u}=t,d,c="https://tauri.app",f=!0,g=!1,k=!0,_=!1,v=!0,y=!1,b=null,C=null,W=null,I=null,O=null,j=null,E=null,M=null,A=1,P=new nt(E,M),T=new nt(E,M),F=new pt(b,C),U=new pt(b,C),J,ne,ce=!1,te=!0,Y=null,oe=null,ee="default",H=!1,X="Awesome Tauri Example!";function $(){Fi(c)}function be(){l[i].setTitle(X)}function fe(){l[i].hide(),setTimeout(l[i].show,2e3)}function pe(){l[i].minimize(),setTimeout(l[i].unminimize,2e3)}function we(){Bi({multiple:!1}).then(K=>{typeof K=="string"&&l[i].setIcon(K)})}function ae(){if(!d)return;const K=new _t(d);n(1,l[d]=K,l),K.once("tauri://error",function(){u("Error creating new webview")})}function x(){l[i].innerSize().then(K=>{n(27,F=K),n(8,b=F.width),n(9,C=F.height)}),l[i].outerSize().then(K=>{n(28,U=K)})}function me(){l[i].innerPosition().then(K=>{n(25,P=K)}),l[i].outerPosition().then(K=>{n(26,T=K),n(14,E=T.x),n(15,M=T.y)})}async function Le(K){!K||(J&&J(),ne&&ne(),ne=await K.listen("tauri://move",me),J=await K.listen("tauri://resize",x))}async function D(){await l[i].minimize(),await l[i].requestUserAttention(ji.Critical),await new Promise(K=>setTimeout(K,3e3)),await l[i].requestUserAttention(null)}function B(){d=this.value,n(22,d)}function Ee(){i=Pi(this),n(0,i),n(1,l)}const ke=()=>l[i].center();function re(){g=this.checked,n(3,g)}function de(){f=this.checked,n(2,f)}function ue(){k=this.checked,n(4,k)}function Me(){_=this.checked,n(5,_)}function He(){v=this.checked,n(6,v)}function We(){y=this.checked,n(7,y)}function Z(){E=le(this.value),n(14,E)}function N(){M=le(this.value),n(15,M)}function ie(){b=le(this.value),n(8,b)}function G(){C=le(this.value),n(9,C)}function he(){W=le(this.value),n(10,W)}function Kt(){I=le(this.value),n(11,I)}function Be(){O=le(this.value),n(12,O)}function bt(){j=le(this.value),n(13,j)}function Qt(){ce=this.checked,n(16,ce)}function Oe(){te=this.checked,n(17,te)}function Zt(){H=this.checked,n(21,H)}function gt(){ee=Pi(this),n(20,ee),n(30,o)}function $t(){Y=le(this.value),n(18,Y)}function Re(){oe=le(this.value),n(19,oe)}function xt(){X=this.value,n(29,X)}function Ve(){c=this.value,n(23,c)}return e.$$set=K=>{"onMessage"in K&&n(38,u=K.onMessage)},e.$$.update=()=>{var K,Pt,ze,Ot,lt,Rt,De,yt,vt,wt,Ae,Fe,Pe,st,It,ot,Ht,at,kt;e.$$.dirty[0]&3&&(l[i],me(),x()),e.$$.dirty[0]&7&&((K=l[i])==null||K.setResizable(f)),e.$$.dirty[0]&11&&(g?(Pt=l[i])==null||Pt.maximize():(ze=l[i])==null||ze.unmaximize()),e.$$.dirty[0]&19&&((Ot=l[i])==null||Ot.setDecorations(k)),e.$$.dirty[0]&35&&((lt=l[i])==null||lt.setAlwaysOnTop(_)),e.$$.dirty[0]&67&&((Rt=l[i])==null||Rt.setContentProtected(v)),e.$$.dirty[0]&131&&((De=l[i])==null||De.setFullscreen(y)),e.$$.dirty[0]&771&&b&&C&&((yt=l[i])==null||yt.setSize(new pt(b,C))),e.$$.dirty[0]&3075&&(W&&I?(vt=l[i])==null||vt.setMinSize(new ti(W,I)):(wt=l[i])==null||wt.setMinSize(null)),e.$$.dirty[0]&12291&&(O>800&&j>400?(Ae=l[i])==null||Ae.setMaxSize(new ti(O,j)):(Fe=l[i])==null||Fe.setMaxSize(null)),e.$$.dirty[0]&49155&&E!==null&&M!==null&&((Pe=l[i])==null||Pe.setPosition(new nt(E,M))),e.$$.dirty[0]&3&&((st=l[i])==null||st.scaleFactor().then(en=>n(24,A=en))),e.$$.dirty[0]&3&&Le(l[i]),e.$$.dirty[0]&65539&&((It=l[i])==null||It.setCursorGrab(ce)),e.$$.dirty[0]&131075&&((ot=l[i])==null||ot.setCursorVisible(te)),e.$$.dirty[0]&1048579&&((Ht=l[i])==null||Ht.setCursorIcon(ee)),e.$$.dirty[0]&786435&&Y!==null&&oe!==null&&((at=l[i])==null||at.setCursorPosition(new nt(Y,oe))),e.$$.dirty[0]&2097155&&((kt=l[i])==null||kt.setIgnoreCursorEvents(H))},[i,l,f,g,k,_,v,y,b,C,W,I,O,j,E,M,ce,te,Y,oe,ee,H,d,c,A,P,T,F,U,X,o,$,be,fe,pe,we,ae,D,u,B,Ee,ke,re,de,ue,Me,He,We,Z,N,ie,G,he,Kt,Be,bt,Qt,Oe,Zt,gt,$t,Re,xt,Ve]}class La extends ve{constructor(t){super(),ye(this,t,Sa,Aa,_e,{onMessage:38},null,[-1,-1,-1])}}var Ea={};Ce(Ea,{isRegistered:()=>Da,register:()=>$s,registerAll:()=>za,unregister:()=>xs,unregisterAll:()=>eo});async function $s(e,t){return S({__tauriModule:"GlobalShortcut",message:{cmd:"register",shortcut:e,handler:ht(t)}})}async function za(e,t){return S({__tauriModule:"GlobalShortcut",message:{cmd:"registerAll",shortcuts:e,handler:ht(t)}})}async function Da(e){return S({__tauriModule:"GlobalShortcut",message:{cmd:"isRegistered",shortcut:e}})}async function xs(e){return S({__tauriModule:"GlobalShortcut",message:{cmd:"unregister",shortcut:e}})}async function eo(){return S({__tauriModule:"GlobalShortcut",message:{cmd:"unregisterAll"}})}function us(e,t,n){const i=e.slice();return i[9]=t[n],i}function cs(e){let t,n=e[9]+"",i,l,o,u,d;function c(){return e[8](e[9])}return{c(){t=a("div"),i=z(n),l=h(),o=a("button"),o.textContent="Unregister",r(o,"class","btn"),r(o,"type","button"),r(t,"class","flex justify-between")},m(f,g){m(f,t,g),s(t,i),s(t,l),s(t,o),u||(d=L(o,"click",c),u=!0)},p(f,g){e=f,g&2&&n!==(n=e[9]+"")&&Q(i,n)},d(f){f&&p(t),u=!1,d()}}}function ds(e){let t,n,i,l,o;return{c(){t=a("br"),n=h(),i=a("button"),i.textContent="Unregister all",r(i,"class","btn"),r(i,"type","button")},m(u,d){m(u,t,d),m(u,n,d),m(u,i,d),l||(o=L(i,"click",e[5]),l=!0)},p:V,d(u){u&&p(t),u&&p(n),u&&p(i),l=!1,o()}}}function Wa(e){let t,n,i,l,o,u,d,c,f,g,k,_=e[1],v=[];for(let b=0;b<_.length;b+=1)v[b]=cs(us(e,_,b));let y=e[1].length>1&&ds(e);return{c(){t=a("div"),n=a("input"),i=h(),l=a("button"),l.textContent="Register",o=h(),u=a("br"),d=h(),c=a("div");for(let b=0;b1?y?y.p(b,C):(y=ds(b),y.c(),y.m(c,null)):y&&(y.d(1),y=null)},i:V,o:V,d(b){b&&p(t),b&&p(o),b&&p(u),b&&p(d),b&&p(c),mt(v,b),y&&y.d(),g=!1,se(k)}}}function Pa(e,t,n){let i,{onMessage:l}=t;const o=Cs([]);ks(e,o,_=>n(1,i=_));let u="CmdOrControl+X";function d(){const _=u;$s(_,()=>{l(`Shortcut ${_} triggered`)}).then(()=>{o.update(v=>[...v,_]),l(`Shortcut ${_} registered successfully`)}).catch(l)}function c(_){const v=_;xs(v).then(()=>{o.update(y=>y.filter(b=>b!==v)),l(`Shortcut ${v} unregistered`)}).catch(l)}function f(){eo().then(()=>{o.update(()=>[]),l("Unregistered all shortcuts")}).catch(l)}function g(){u=this.value,n(0,u)}const k=_=>c(_);return e.$$set=_=>{"onMessage"in _&&n(6,l=_.onMessage)},[u,i,o,d,c,f,l,g,k]}class Oa extends ve{constructor(t){super(),ye(this,t,Pa,Wa,_e,{onMessage:6})}}function fs(e){let t,n,i,l,o,u,d;return{c(){t=a("br"),n=h(),i=a("input"),l=h(),o=a("button"),o.textContent="Write",r(i,"class","input"),r(i,"placeholder","write to stdin"),r(o,"class","btn")},m(c,f){m(c,t,f),m(c,n,f),m(c,i,f),q(i,e[4]),m(c,l,f),m(c,o,f),u||(d=[L(i,"input",e[14]),L(o,"click",e[8])],u=!0)},p(c,f){f&16&&i.value!==c[4]&&q(i,c[4])},d(c){c&&p(t),c&&p(n),c&&p(i),c&&p(l),c&&p(o),u=!1,se(d)}}}function Ra(e){let t,n,i,l,o,u,d,c,f,g,k,_,v,y,b,C,W,I,O,j,E,M,A,P,T=e[5]&&fs(e);return{c(){t=a("div"),n=a("div"),i=z(`Script: `),l=a("input"),o=h(),u=a("div"),d=z(`Encoding: - `),c=a("input"),f=h(),y=a("div"),k=z(`Working directory: - `),_=a("input"),v=h(),g=a("div"),b=z(`Arguments: - `),A=a("input"),O=h(),I=a("div"),P=a("button"),P.textContent="Run",F=h(),L=a("button"),L.textContent="Kill",T=h(),M&&M.c(),r(l,"class","grow input"),r(n,"class","flex items-center gap-1"),r(c,"class","grow input"),r(u,"class","flex items-center gap-1"),r(_,"class","grow input"),r(_,"placeholder","Working directory"),r(y,"class","flex items-center gap-1"),r(A,"class","grow input"),r(A,"placeholder","Environment variables"),r(g,"class","flex items-center gap-1"),r(P,"class","btn"),r(L,"class","btn"),r(I,"class","flex children:grow gap-1"),r(t,"class","flex flex-col childre:grow gap-1")},m(j,U){m(j,t,U),s(t,n),s(n,i),s(n,l),q(l,e[0]),s(t,o),s(t,u),s(u,d),s(u,c),q(c,e[3]),s(t,f),s(t,y),s(y,k),s(y,_),q(_,e[1]),s(t,v),s(t,g),s(g,b),s(g,A),q(A,e[2]),s(t,O),s(t,I),s(I,P),s(I,F),s(I,L),s(t,T),M&&M.m(t,null),C||(W=[E(l,"input",e[10]),E(c,"input",e[11]),E(_,"input",e[12]),E(A,"input",e[13]),E(P,"click",e[6]),E(L,"click",e[7])],C=!0)},p(j,[U]){U&1&&l.value!==j[0]&&q(l,j[0]),U&8&&c.value!==j[3]&&q(c,j[3]),U&2&&_.value!==j[1]&&q(_,j[1]),U&4&&A.value!==j[2]&&q(A,j[2]),j[5]?M?M.p(j,U):(M=rs(j),M.c(),M.m(t,null)):M&&(M.d(1),M=null)},i:V,o:V,d(j){j&&p(t),M&&M.d(),C=!1,ue(W)}}}function Wa(e,t,n){const i=navigator.userAgent.includes("Windows");let l=i?"cmd":"sh",o=i?["/C"]:["-c"],{onMessage:u}=t,d='echo "hello world"',c=null,f="SOMETHING=value ANOTHER=2",y="",k="",_;function v(){return f.split(" ").reduce((T,C)=>{let[W,M]=C.split("=");return{...T,[W]:M}},{})}function g(){n(5,_=null);const T=new Oi(l,[...o,d],{cwd:c||null,env:v(),encoding:y});T.on("close",C=>{u(`command finished with code ${C.code} and signal ${C.signal}`),n(5,_=null)}),T.on("error",C=>u(`command error: "${C}"`)),T.stdout.on("data",C=>u(`command stdout: "${C}"`)),T.stderr.on("data",C=>u(`command stderr: "${C}"`)),T.spawn().then(C=>{n(5,_=C)}).catch(u)}function b(){_.kill().then(()=>u("killed child process")).catch(u)}function A(){_.write(k).catch(u)}function O(){d=this.value,n(0,d)}function I(){y=this.value,n(3,y)}function P(){c=this.value,n(1,c)}function F(){f=this.value,n(2,f)}function L(){k=this.value,n(4,k)}return e.$$set=T=>{"onMessage"in T&&n(9,u=T.onMessage)},[d,c,f,y,k,_,g,b,A,u,O,I,P,F,L]}class Oa extends ye{constructor(t){super(),ge(this,t,Wa,Da,he,{onMessage:9})}}var Pa={};we(Pa,{checkUpdate:()=>Zs,installUpdate:()=>Qs,onUpdaterEvent:()=>qi});async function qi(e){return Xt("tauri://update-status",t=>{e(t==null?void 0:t.payload)})}async function Qs(){let e;function t(){e&&e(),e=void 0}return new Promise((n,i)=>{function l(o){if(o.error)return t(),i(o.error);if(o.status==="DONE")return t(),n()}qi(l).then(o=>{e=o}).catch(o=>{throw t(),o}),ni("tauri://update-install").catch(o=>{throw t(),o})})}async function Zs(){let e;function t(){e&&e(),e=void 0}return new Promise((n,i)=>{function l(u){return t(),n({manifest:u,shouldUpdate:!0})}function o(u){if(u.error)return t(),i(u.error);if(u.status==="UPTODATE")return t(),n({shouldUpdate:!1})}Ls("tauri://update-available",u=>{l(u==null?void 0:u.payload)}).catch(u=>{throw t(),u}),qi(o).then(u=>{e=u}).catch(u=>{throw t(),u}),ni("tauri://update").catch(u=>{throw t(),u})})}function Ra(e){let t;return{c(){t=a("button"),t.innerHTML='
',r(t,"class","btn text-accentText dark:text-darkAccentText flex items-center justify-center")},m(n,i){m(n,t,i)},p:V,d(n){n&&p(t)}}}function Ia(e){let t,n,i;return{c(){t=a("button"),t.textContent="Install update",r(t,"class","btn")},m(l,o){m(l,t,o),n||(i=E(t,"click",e[4]),n=!0)},p:V,d(l){l&&p(t),n=!1,i()}}}function Ha(e){let t,n,i;return{c(){t=a("button"),t.textContent="Check update",r(t,"class","btn")},m(l,o){m(l,t,o),n||(i=E(t,"click",e[3]),n=!0)},p:V,d(l){l&&p(t),n=!1,i()}}}function Fa(e){let t;function n(o,u){return!o[0]&&!o[2]?Ha:!o[1]&&o[2]?Ia:Ra}let i=n(e),l=i(e);return{c(){t=a("div"),l.c(),r(t,"class","flex children:grow children:h10")},m(o,u){m(o,t,u),l.m(t,null)},p(o,[u]){i===(i=n(o))&&l?l.p(o,u):(l.d(1),l=i(o),l&&(l.c(),l.m(t,null)))},i:V,o:V,d(o){o&&p(t),l.d()}}}function Na(e,t,n){let{onMessage:i}=t,l;ut(async()=>{l=await Xt("tauri://update-status",i)}),Wi(()=>{l&&l()});let o,u,d;async function c(){n(0,o=!0);try{const{shouldUpdate:y,manifest:k}=await Zs();i(`Should update: ${y}`),i(k),n(2,d=y)}catch(y){i(y)}finally{n(0,o=!1)}}async function f(){n(1,u=!0);try{await Qs(),i("Installation complete, restart required."),await Fi()}catch(y){i(y)}finally{n(1,u=!1)}}return e.$$set=y=>{"onMessage"in y&&n(5,i=y.onMessage)},[o,u,d,c,f,i]}class ja extends ye{constructor(t){super(),ge(this,t,Na,Fa,he,{onMessage:5})}}var Ua={};we(Ua,{readText:()=>eo,writeText:()=>xs});async function xs(e){return S({__tauriModule:"Clipboard",message:{cmd:"writeText",data:e}})}async function eo(){return S({__tauriModule:"Clipboard",message:{cmd:"readText",data:null}})}function qa(e){let t,n,i,l,o,u,d,c;return{c(){t=a("div"),n=a("input"),i=h(),l=a("button"),l.textContent="Write",o=h(),u=a("button"),u.textContent="Read",r(n,"class","grow input"),r(n,"placeholder","Text to write to the clipboard"),r(l,"class","btn"),r(l,"type","button"),r(u,"class","btn"),r(u,"type","button"),r(t,"class","flex gap-1")},m(f,y){m(f,t,y),s(t,n),q(n,e[0]),s(t,i),s(t,l),s(t,o),s(t,u),d||(c=[E(n,"input",e[4]),E(l,"click",e[1]),E(u,"click",e[2])],d=!0)},p(f,[y]){y&1&&n.value!==f[0]&&q(n,f[0])},i:V,o:V,d(f){f&&p(t),d=!1,ue(c)}}}function Ba(e,t,n){let{onMessage:i}=t,l="clipboard message";function o(){xs(l).then(()=>{i("Wrote to the clipboard")}).catch(i)}function u(){eo().then(c=>{i(`Clipboard contents: ${c}`)}).catch(i)}function d(){l=this.value,n(0,l)}return e.$$set=c=>{"onMessage"in c&&n(3,i=c.onMessage)},[l,o,u,i,d]}class Va extends ye{constructor(t){super(),ge(this,t,Ba,qa,he,{onMessage:3})}}function Ga(e){let t;return{c(){t=a("div"),t.innerHTML=`
Not available for Linux
- `,r(t,"class","flex flex-col gap-2")},m(n,i){m(n,t,i)},p:V,i:V,o:V,d(n){n&&p(t)}}}function Ja(e,t,n){let{onMessage:i}=t;const l=window.constraints={audio:!0,video:!0};function o(d){const c=document.querySelector("video"),f=d.getVideoTracks();i("Got stream with constraints:",l),i(`Using video device: ${f[0].label}`),window.stream=d,c.srcObject=d}function u(d){if(d.name==="ConstraintNotSatisfiedError"){const c=l.video;i(`The resolution ${c.width.exact}x${c.height.exact} px is not supported by your device.`)}else d.name==="PermissionDeniedError"&&i("Permissions have not been granted to use your camera and microphone, you need to allow the page access to your devices in order for the demo to work.");i(`getUserMedia error: ${d.name}`,d)}return ut(async()=>{try{const d=await navigator.mediaDevices.getUserMedia(l);o(d)}catch(d){u(d)}}),Wi(()=>{window.stream.getTracks().forEach(function(d){d.stop()})}),e.$$set=d=>{"onMessage"in d&&n(0,i=d.onMessage)},[i]}class Xa extends ye{constructor(t){super(),ge(this,t,Ja,Ga,he,{onMessage:0})}}function Ya(e){let t,n,i,l,o,u;return{c(){t=a("div"),n=a("button"),n.textContent="Show",i=h(),l=a("button"),l.textContent="Hide",r(n,"class","btn"),r(n,"id","show"),r(n,"title","Hides and shows the app after 2 seconds"),r(l,"class","btn"),r(l,"id","hide")},m(d,c){m(d,t,c),s(t,n),s(t,i),s(t,l),o||(u=[E(n,"click",e[0]),E(l,"click",e[1])],o=!0)},p:V,i:V,o:V,d(d){d&&p(t),o=!1,ue(u)}}}function Ka(e,t,n){let{onMessage:i}=t;function l(){o().then(()=>{setTimeout(()=>{Fs().then(()=>i("Shown app")).catch(i)},2e3)}).catch(i)}function o(){return Ns().then(()=>i("Hide app")).catch(i)}return e.$$set=u=>{"onMessage"in u&&n(2,i=u.onMessage)},[l,o,i]}class $a extends ye{constructor(t){super(),ge(this,t,Ka,Ya,he,{onMessage:2})}}function us(e,t,n){const i=e.slice();return i[32]=t[n],i}function cs(e,t,n){const i=e.slice();return i[35]=t[n],i}function ds(e){let t,n,i,l,o,u,d,c,f,y,k,_,v,g,b;function A(T,C){return T[3]?Za:Qa}let O=A(e),I=O(e);function P(T,C){return T[2]?er:xa}let F=P(e),L=F(e);return{c(){t=a("div"),n=a("span"),n.textContent="Tauri API Validation",i=h(),l=a("span"),o=a("span"),I.c(),d=h(),c=a("span"),c.innerHTML='
',f=h(),y=a("span"),L.c(),_=h(),v=a("span"),v.innerHTML='
',r(n,"class","lt-sm:pl-10 text-darkPrimaryText"),r(o,"title",u=e[3]?"Switch to Light mode":"Switch to Dark mode"),r(o,"class","hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"),r(c,"title","Minimize"),r(c,"class","hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"),r(y,"title",k=e[2]?"Restore":"Maximize"),r(y,"class","hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"),r(v,"title","Close"),r(v,"class","hover:bg-red-700 dark:hover:bg-red-700 hover:text-darkPrimaryText active:bg-red-700/90 dark:active:bg-red-700/90 active:text-darkPrimaryText "),r(l,"class","h-100% children:h-100% children:w-12 children:inline-flex children:items-center children:justify-center"),r(t,"class","w-screen select-none h-8 pl-2 flex justify-between items-center absolute text-primaryText dark:text-darkPrimaryText"),r(t,"data-tauri-drag-region","")},m(T,C){m(T,t,C),s(t,n),s(t,i),s(t,l),s(l,o),I.m(o,null),s(l,d),s(l,c),s(l,f),s(l,y),L.m(y,null),s(l,_),s(l,v),g||(b=[E(o,"click",e[12]),E(c,"click",e[9]),E(y,"click",e[10]),E(v,"click",e[11])],g=!0)},p(T,C){O!==(O=A(T))&&(I.d(1),I=O(T),I&&(I.c(),I.m(o,null))),C[0]&8&&u!==(u=T[3]?"Switch to Light mode":"Switch to Dark mode")&&r(o,"title",u),F!==(F=P(T))&&(L.d(1),L=F(T),L&&(L.c(),L.m(y,null))),C[0]&4&&k!==(k=T[2]?"Restore":"Maximize")&&r(y,"title",k)},d(T){T&&p(t),I.d(),L.d(),g=!1,ue(b)}}}function Qa(e){let t;return{c(){t=a("div"),r(t,"class","i-ph-moon")},m(n,i){m(n,t,i)},d(n){n&&p(t)}}}function Za(e){let t;return{c(){t=a("div"),r(t,"class","i-ph-sun")},m(n,i){m(n,t,i)},d(n){n&&p(t)}}}function xa(e){let t;return{c(){t=a("div"),r(t,"class","i-codicon-chrome-maximize")},m(n,i){m(n,t,i)},d(n){n&&p(t)}}}function er(e){let t;return{c(){t=a("div"),r(t,"class","i-codicon-chrome-restore")},m(n,i){m(n,t,i)},d(n){n&&p(t)}}}function tr(e){let t;return{c(){t=a("span"),r(t,"class","i-codicon-menu animate-duration-300ms animate-fade-in")},m(n,i){m(n,t,i)},d(n){n&&p(t)}}}function nr(e){let t;return{c(){t=a("span"),r(t,"class","i-codicon-close animate-duration-300ms animate-fade-in")},m(n,i){m(n,t,i)},d(n){n&&p(t)}}}function fs(e){let t,n,i,l,o,u,d,c,f;function y(v,g){return v[3]?lr:ir}let k=y(e),_=k(e);return{c(){t=a("a"),_.c(),n=h(),i=a("br"),l=h(),o=a("div"),u=h(),d=a("br"),r(t,"href","##"),r(t,"class","nv justify-between h-8"),r(o,"class","bg-white/5 h-2px")},m(v,g){m(v,t,g),_.m(t,null),m(v,n,g),m(v,i,g),m(v,l,g),m(v,o,g),m(v,u,g),m(v,d,g),c||(f=E(t,"click",e[12]),c=!0)},p(v,g){k!==(k=y(v))&&(_.d(1),_=k(v),_&&(_.c(),_.m(t,null)))},d(v){v&&p(t),_.d(),v&&p(n),v&&p(i),v&&p(l),v&&p(o),v&&p(u),v&&p(d),c=!1,f()}}}function ir(e){let t,n;return{c(){t=z(`Switch to Dark mode - `),n=a("div"),r(n,"class","i-ph-moon")},m(i,l){m(i,t,l),m(i,n,l)},d(i){i&&p(t),i&&p(n)}}}function lr(e){let t,n;return{c(){t=z(`Switch to Light mode - `),n=a("div"),r(n,"class","i-ph-sun")},m(i,l){m(i,t,l),m(i,n,l)},d(i){i&&p(t),i&&p(n)}}}function sr(e){let t,n,i,l,o=e[35].label+"",u,d,c,f;function y(){return e[20](e[35])}return{c(){t=a("a"),n=a("div"),i=h(),l=a("p"),u=z(o),r(n,"class",e[35].icon+" mr-2"),r(t,"href","##"),r(t,"class",d="nv "+(e[1]===e[35]?"nv_selected":""))},m(k,_){m(k,t,_),s(t,n),s(t,i),s(t,l),s(l,u),c||(f=E(t,"click",y),c=!0)},p(k,_){e=k,_[0]&2&&d!==(d="nv "+(e[1]===e[35]?"nv_selected":""))&&r(t,"class",d)},d(k){k&&p(t),c=!1,f()}}}function ps(e){let t,n=e[35]&&sr(e);return{c(){n&&n.c(),t=xn()},m(i,l){n&&n.m(i,l),m(i,t,l)},p(i,l){i[35]&&n.p(i,l)},d(i){n&&n.d(i),i&&p(t)}}}function ms(e){let t,n=e[32].html+"",i;return{c(){t=new ao(!1),i=xn(),t.a=i},m(l,o){t.m(n,l,o),m(l,i,o)},p(l,o){o[0]&64&&n!==(n=l[32].html+"")&&t.p(n)},d(l){l&&p(i),l&&t.d()}}}function or(e){let t,n,i,l,o,u,d,c,f,y,k,_,v,g,b,A,O,I,P,F,L,T,C,W,M,j,U=e[1].label+"",J,ne,de,x,Y,fe,ee,H,K,te,pe,se,ae,_e,ce,ie,Te,Ce,D=e[5]&&ds(e);function B(N,le){return N[0]?nr:tr}let Ae=B(e),me=Ae(e),oe=!e[5]&&fs(e),Le=e[7],Q=[];for(let N=0;N{let[P,T]=A.split("=");return{...M,[P]:T}},{})}function y(){n(5,_=null);const M=new Hi(l,[...o,d],{cwd:c||null,env:v(),encoding:g});M.on("close",A=>{u(`command finished with code ${A.code} and signal ${A.signal}`),n(5,_=null)}),M.on("error",A=>u(`command error: "${A}"`)),M.stdout.on("data",A=>u(`command stdout: "${A}"`)),M.stderr.on("data",A=>u(`command stderr: "${A}"`)),M.spawn().then(A=>{n(5,_=A)}).catch(u)}function b(){_.kill().then(()=>u("killed child process")).catch(u)}function C(){_.write(k).catch(u)}function W(){d=this.value,n(0,d)}function I(){g=this.value,n(3,g)}function O(){c=this.value,n(1,c)}function j(){f=this.value,n(2,f)}function E(){k=this.value,n(4,k)}return e.$$set=M=>{"onMessage"in M&&n(9,u=M.onMessage)},[d,c,f,g,k,_,y,b,C,u,W,I,O,j,E]}class Ha extends ve{constructor(t){super(),ye(this,t,Ia,Ra,_e,{onMessage:9})}}var Fa={};Ce(Fa,{checkUpdate:()=>no,installUpdate:()=>to,onUpdaterEvent:()=>Ji});async function Ji(e){return Yt("tauri://update-status",t=>{e(t==null?void 0:t.payload)})}async function to(){let e;function t(){e&&e(),e=void 0}return new Promise((n,i)=>{function l(o){if(o.error){t(),i(o.error);return}o.status==="DONE"&&(t(),n())}Ji(l).then(o=>{e=o}).catch(o=>{throw t(),o}),oi("tauri://update-install").catch(o=>{throw t(),o})})}async function no(){let e;function t(){e&&e(),e=void 0}return new Promise((n,i)=>{function l(u){t(),n({manifest:u,shouldUpdate:!0})}function o(u){if(u.error){t(),i(u.error);return}u.status==="UPTODATE"&&(t(),n({shouldUpdate:!1}))}Ws("tauri://update-available",u=>{l(u==null?void 0:u.payload)}).catch(u=>{throw t(),u}),Ji(o).then(u=>{e=u}).catch(u=>{throw t(),u}),oi("tauri://update").catch(u=>{throw t(),u})})}function Na(e){let t;return{c(){t=a("button"),t.innerHTML='
',r(t,"class","btn text-accentText dark:text-darkAccentText flex items-center justify-center")},m(n,i){m(n,t,i)},p:V,d(n){n&&p(t)}}}function ja(e){let t,n,i;return{c(){t=a("button"),t.textContent="Install update",r(t,"class","btn")},m(l,o){m(l,t,o),n||(i=L(t,"click",e[4]),n=!0)},p:V,d(l){l&&p(t),n=!1,i()}}}function Ua(e){let t,n,i;return{c(){t=a("button"),t.textContent="Check update",r(t,"class","btn")},m(l,o){m(l,t,o),n||(i=L(t,"click",e[3]),n=!0)},p:V,d(l){l&&p(t),n=!1,i()}}}function qa(e){let t;function n(o,u){return!o[0]&&!o[2]?Ua:!o[1]&&o[2]?ja:Na}let i=n(e),l=i(e);return{c(){t=a("div"),l.c(),r(t,"class","flex children:grow children:h10")},m(o,u){m(o,t,u),l.m(t,null)},p(o,[u]){i===(i=n(o))&&l?l.p(o,u):(l.d(1),l=i(o),l&&(l.c(),l.m(t,null)))},i:V,o:V,d(o){o&&p(t),l.d()}}}function Ba(e,t,n){let{onMessage:i}=t,l;dt(async()=>{l=await Yt("tauri://update-status",i)}),Ii(()=>{l&&l()});let o,u,d;async function c(){n(0,o=!0);try{const{shouldUpdate:g,manifest:k}=await no();i(`Should update: ${g}`),i(k),n(2,d=g)}catch(g){i(g)}finally{n(0,o=!1)}}async function f(){n(1,u=!0);try{await to(),i("Installation complete, restart required."),await qi()}catch(g){i(g)}finally{n(1,u=!1)}}return e.$$set=g=>{"onMessage"in g&&n(5,i=g.onMessage)},[o,u,d,c,f,i]}class Va extends ve{constructor(t){super(),ye(this,t,Ba,qa,_e,{onMessage:5})}}var Ga={};Ce(Ga,{readText:()=>lo,writeText:()=>io});async function io(e){return S({__tauriModule:"Clipboard",message:{cmd:"writeText",data:e}})}async function lo(){return S({__tauriModule:"Clipboard",message:{cmd:"readText",data:null}})}function Ja(e){let t,n,i,l,o,u,d,c;return{c(){t=a("div"),n=a("input"),i=h(),l=a("button"),l.textContent="Write",o=h(),u=a("button"),u.textContent="Read",r(n,"class","grow input"),r(n,"placeholder","Text to write to the clipboard"),r(l,"class","btn"),r(l,"type","button"),r(u,"class","btn"),r(u,"type","button"),r(t,"class","flex gap-1")},m(f,g){m(f,t,g),s(t,n),q(n,e[0]),s(t,i),s(t,l),s(t,o),s(t,u),d||(c=[L(n,"input",e[4]),L(l,"click",e[1]),L(u,"click",e[2])],d=!0)},p(f,[g]){g&1&&n.value!==f[0]&&q(n,f[0])},i:V,o:V,d(f){f&&p(t),d=!1,se(c)}}}function Xa(e,t,n){let{onMessage:i}=t,l="clipboard message";function o(){io(l).then(()=>{i("Wrote to the clipboard")}).catch(i)}function u(){lo().then(c=>{i(`Clipboard contents: ${c}`)}).catch(i)}function d(){l=this.value,n(0,l)}return e.$$set=c=>{"onMessage"in c&&n(3,i=c.onMessage)},[l,o,u,i,d]}class Ya extends ve{constructor(t){super(),ye(this,t,Xa,Ja,_e,{onMessage:3})}}function Ka(e){let t;return{c(){t=a("div"),t.innerHTML=`
Not available for Linux
+ `,r(t,"class","flex flex-col gap-2")},m(n,i){m(n,t,i)},p:V,i:V,o:V,d(n){n&&p(t)}}}function Qa(e,t,n){let{onMessage:i}=t;const l=window.constraints={audio:!0,video:!0};function o(d){const c=document.querySelector("video"),f=d.getVideoTracks();i("Got stream with constraints:",l),i(`Using video device: ${f[0].label}`),window.stream=d,c.srcObject=d}function u(d){if(d.name==="ConstraintNotSatisfiedError"){const c=l.video;i(`The resolution ${c.width.exact}x${c.height.exact} px is not supported by your device.`)}else d.name==="PermissionDeniedError"&&i("Permissions have not been granted to use your camera and microphone, you need to allow the page access to your devices in order for the demo to work.");i(`getUserMedia error: ${d.name}`,d)}return dt(async()=>{try{const d=await navigator.mediaDevices.getUserMedia(l);o(d)}catch(d){u(d)}}),Ii(()=>{window.stream.getTracks().forEach(function(d){d.stop()})}),e.$$set=d=>{"onMessage"in d&&n(0,i=d.onMessage)},[i]}class Za extends ve{constructor(t){super(),ye(this,t,Qa,Ka,_e,{onMessage:0})}}function $a(e){let t,n,i,l,o,u;return{c(){t=a("div"),n=a("button"),n.textContent="Show",i=h(),l=a("button"),l.textContent="Hide",r(n,"class","btn"),r(n,"id","show"),r(n,"title","Hides and shows the app after 2 seconds"),r(l,"class","btn"),r(l,"id","hide")},m(d,c){m(d,t,c),s(t,n),s(t,i),s(t,l),o||(u=[L(n,"click",e[0]),L(l,"click",e[1])],o=!0)},p:V,i:V,o:V,d(d){d&&p(t),o=!1,se(u)}}}function xa(e,t,n){let{onMessage:i}=t;function l(){o().then(()=>{setTimeout(()=>{qs().then(()=>i("Shown app")).catch(i)},2e3)}).catch(i)}function o(){return Bs().then(()=>i("Hide app")).catch(i)}return e.$$set=u=>{"onMessage"in u&&n(2,i=u.onMessage)},[l,o,i]}class er extends ve{constructor(t){super(),ye(this,t,xa,$a,_e,{onMessage:2})}}function ps(e,t,n){const i=e.slice();return i[32]=t[n],i}function ms(e,t,n){const i=e.slice();return i[35]=t[n],i}function hs(e){let t,n,i,l,o,u,d,c,f,g,k,_,v,y,b;function C(M,A){return M[3]?nr:tr}let W=C(e),I=W(e);function O(M,A){return M[2]?lr:ir}let j=O(e),E=j(e);return{c(){t=a("div"),n=a("span"),n.textContent="Tauri API Validation",i=h(),l=a("span"),o=a("span"),I.c(),d=h(),c=a("span"),c.innerHTML='
',f=h(),g=a("span"),E.c(),_=h(),v=a("span"),v.innerHTML='
',r(n,"class","lt-sm:pl-10 text-darkPrimaryText"),r(o,"title",u=e[3]?"Switch to Light mode":"Switch to Dark mode"),r(o,"class","hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"),r(c,"title","Minimize"),r(c,"class","hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"),r(g,"title",k=e[2]?"Restore":"Maximize"),r(g,"class","hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"),r(v,"title","Close"),r(v,"class","hover:bg-red-700 dark:hover:bg-red-700 hover:text-darkPrimaryText active:bg-red-700/90 dark:active:bg-red-700/90 active:text-darkPrimaryText "),r(l,"class","h-100% children:h-100% children:w-12 children:inline-flex children:items-center children:justify-center"),r(t,"class","w-screen select-none h-8 pl-2 flex justify-between items-center absolute text-primaryText dark:text-darkPrimaryText"),r(t,"data-tauri-drag-region","")},m(M,A){m(M,t,A),s(t,n),s(t,i),s(t,l),s(l,o),I.m(o,null),s(l,d),s(l,c),s(l,f),s(l,g),E.m(g,null),s(l,_),s(l,v),y||(b=[L(o,"click",e[12]),L(c,"click",e[9]),L(g,"click",e[10]),L(v,"click",e[11])],y=!0)},p(M,A){W!==(W=C(M))&&(I.d(1),I=W(M),I&&(I.c(),I.m(o,null))),A[0]&8&&u!==(u=M[3]?"Switch to Light mode":"Switch to Dark mode")&&r(o,"title",u),j!==(j=O(M))&&(E.d(1),E=j(M),E&&(E.c(),E.m(g,null))),A[0]&4&&k!==(k=M[2]?"Restore":"Maximize")&&r(g,"title",k)},d(M){M&&p(t),I.d(),E.d(),y=!1,se(b)}}}function tr(e){let t;return{c(){t=a("div"),r(t,"class","i-ph-moon")},m(n,i){m(n,t,i)},d(n){n&&p(t)}}}function nr(e){let t;return{c(){t=a("div"),r(t,"class","i-ph-sun")},m(n,i){m(n,t,i)},d(n){n&&p(t)}}}function ir(e){let t;return{c(){t=a("div"),r(t,"class","i-codicon-chrome-maximize")},m(n,i){m(n,t,i)},d(n){n&&p(t)}}}function lr(e){let t;return{c(){t=a("div"),r(t,"class","i-codicon-chrome-restore")},m(n,i){m(n,t,i)},d(n){n&&p(t)}}}function sr(e){let t;return{c(){t=a("span"),r(t,"class","i-codicon-menu animate-duration-300ms animate-fade-in")},m(n,i){m(n,t,i)},d(n){n&&p(t)}}}function or(e){let t;return{c(){t=a("span"),r(t,"class","i-codicon-close animate-duration-300ms animate-fade-in")},m(n,i){m(n,t,i)},d(n){n&&p(t)}}}function _s(e){let t,n,i,l,o,u,d,c,f;function g(v,y){return v[3]?rr:ar}let k=g(e),_=k(e);return{c(){t=a("a"),_.c(),n=h(),i=a("br"),l=h(),o=a("div"),u=h(),d=a("br"),r(t,"href","##"),r(t,"class","nv justify-between h-8"),r(o,"class","bg-white/5 h-2px")},m(v,y){m(v,t,y),_.m(t,null),m(v,n,y),m(v,i,y),m(v,l,y),m(v,o,y),m(v,u,y),m(v,d,y),c||(f=L(t,"click",e[12]),c=!0)},p(v,y){k!==(k=g(v))&&(_.d(1),_=k(v),_&&(_.c(),_.m(t,null)))},d(v){v&&p(t),_.d(),v&&p(n),v&&p(i),v&&p(l),v&&p(o),v&&p(u),v&&p(d),c=!1,f()}}}function ar(e){let t,n;return{c(){t=z(`Switch to Dark mode + `),n=a("div"),r(n,"class","i-ph-moon")},m(i,l){m(i,t,l),m(i,n,l)},d(i){i&&p(t),i&&p(n)}}}function rr(e){let t,n;return{c(){t=z(`Switch to Light mode + `),n=a("div"),r(n,"class","i-ph-sun")},m(i,l){m(i,t,l),m(i,n,l)},d(i){i&&p(t),i&&p(n)}}}function ur(e){let t,n,i,l,o=e[35].label+"",u,d,c,f;function g(){return e[20](e[35])}return{c(){t=a("a"),n=a("div"),i=h(),l=a("p"),u=z(o),r(n,"class",e[35].icon+" mr-2"),r(t,"href","##"),r(t,"class",d="nv "+(e[1]===e[35]?"nv_selected":""))},m(k,_){m(k,t,_),s(t,n),s(t,i),s(t,l),s(l,u),c||(f=L(t,"click",g),c=!0)},p(k,_){e=k,_[0]&2&&d!==(d="nv "+(e[1]===e[35]?"nv_selected":""))&&r(t,"class",d)},d(k){k&&p(t),c=!1,f()}}}function bs(e){let t,n=e[35]&&ur(e);return{c(){n&&n.c(),t=ii()},m(i,l){n&&n.m(i,l),m(i,t,l)},p(i,l){i[35]&&n.p(i,l)},d(i){n&&n.d(i),i&&p(t)}}}function gs(e){let t,n=e[32].html+"",i;return{c(){t=new fo(!1),i=ii(),t.a=i},m(l,o){t.m(n,l,o),m(l,i,o)},p(l,o){o[0]&64&&n!==(n=l[32].html+"")&&t.p(n)},d(l){l&&p(i),l&&t.d()}}}function cr(e){let t,n,i,l,o,u,d,c,f,g,k,_,v,y,b,C,W,I,O,j,E,M,A,P,T,F,U=e[1].label+"",J,ne,ce,te,Y,oe,ee,H,X,$,be,fe,pe,we,ae,x,me,Le,D=e[5]&&hs(e);function B(N,ie){return N[0]?or:sr}let Ee=B(e),ke=Ee(e),re=!e[5]&&_s(e),de=e[7],ue=[];for(let N=0;N`,k=h(),_=a("a"),_.innerHTML=`GitHub - `,v=h(),g=a("a"),g.innerHTML=`Source - `,b=h(),A=a("br"),O=h(),I=a("div"),P=h(),F=a("br"),L=h(),T=a("div");for(let N=0;N',_e=h(),ce=a("div");for(let N=0;N{Gt(G,1)}),ti()}Ee?(Y=new Ee(Ie(N)),Kn(Y.$$.fragment),Me(Y.$$.fragment,1),Vt(Y,x,null)):Y=null}if(le[0]&64){ze=N[6];let G;for(G=0;G{await confirm("Are you sure?")||H.preventDefault()}),Ue.onFileDropEvent(H=>{O(`File drop: ${JSON.stringify(H.payload)}`)});const l=navigator.userAgent.toLowerCase(),o=l.includes("android")||l.includes("iphone"),u=[{label:"Welcome",component:Po,icon:"i-ph-hand-waving"},{label:"Communication",component:Uo,icon:"i-codicon-radio-tower"},!o&&{label:"CLI",component:Fo,icon:"i-codicon-terminal"},!o&&{label:"Dialog",component:ia,icon:"i-codicon-multiple-windows"},{label:"File system",component:aa,icon:"i-codicon-files"},{label:"HTTP",component:ba,icon:"i-ph-globe-hemisphere-west"},!o&&{label:"Notifications",component:wa,icon:"i-codicon-bell-dot"},!o&&{label:"App",component:$a,icon:"i-codicon-hubot"},!o&&{label:"Window",component:Ta,icon:"i-codicon-window"},!o&&{label:"Shortcuts",component:za,icon:"i-codicon-record-keys"},{label:"Shell",component:Oa,icon:"i-codicon-terminal-bash"},!o&&{label:"Updater",component:ja,icon:"i-codicon-cloud-download"},!o&&{label:"Clipboard",component:Va,icon:"i-codicon-clippy"},{label:"WebRTC",component:Xa,icon:"i-ph-broadcast"}];let d=u[0];function c(H){n(1,d=H)}let f;ut(async()=>{const H=Ut();n(2,f=await H.isMaximized()),Xt("tauri://resize",async()=>{n(2,f=await H.isMaximized())})});function y(){Ut().minimize()}async function k(){const H=Ut();await H.isMaximized()?H.unmaximize():H.maximize()}let _=!1;async function v(){_||(_=await Bs("Are you sure that you want to close this window?",{title:"Tauri API"}),_&&Ut().close())}let g;ut(()=>{n(3,g=localStorage&&localStorage.getItem("theme")=="dark"),_s(g)});function b(){n(3,g=!g),_s(g)}let A=ws([]);gs(e,A,H=>n(6,i=H));function O(H){A.update(K=>[{html:`
[${new Date().toLocaleTimeString()}]: `+(typeof H=="string"?H:JSON.stringify(H,null,1))+"
"},...K])}function I(H){A.update(K=>[{html:`
[${new Date().toLocaleTimeString()}]: `+H+"
"},...K])}function P(){A.update(()=>[])}let F,L,T;function C(H){T=H.clientY;const K=window.getComputedStyle(F);L=parseInt(K.height,10);const te=se=>{const ae=se.clientY-T,_e=L-ae;n(4,F.style.height=`${_e{document.removeEventListener("mouseup",pe),document.removeEventListener("mousemove",te)};document.addEventListener("mouseup",pe),document.addEventListener("mousemove",te)}let W;ut(async()=>{n(5,W=await Ps()==="win32")});let M=!1,j,U,J=!1,ne=0,de=0;const x=(H,K,te)=>Math.min(Math.max(K,H),te);ut(()=>{n(18,j=document.querySelector("#sidebar")),U=document.querySelector("#sidebarToggle"),document.addEventListener("click",H=>{U.contains(H.target)?n(0,M=!M):M&&!j.contains(H.target)&&n(0,M=!1)}),document.addEventListener("touchstart",H=>{if(U.contains(H.target))return;const K=H.touches[0].clientX;(0{if(J){const K=H.touches[0].clientX;de=K;const te=(K-ne)/10;j.style.setProperty("--translate-x",`-${x(0,M?0-te:18.75-te,18.75)}rem`)}}),document.addEventListener("touchend",()=>{if(J){const H=(de-ne)/10;n(0,M=M?H>-(18.75/2):H>18.75/2)}J=!1})});const Y=()=>Pi("https://tauri.app/"),fe=H=>{c(H),n(0,M=!1)};function ee(H){Yn[H?"unshift":"push"](()=>{F=H,n(4,F)})}return e.$$.update=()=>{if(e.$$.dirty[0]&1){const H=document.querySelector("#sidebar");H&&ar(H,M)}},[M,d,f,g,F,W,i,u,c,y,k,v,b,A,O,I,P,C,j,Y,fe,ee]}class ur extends ye{constructor(t){super(),ge(this,t,rr,or,he,{},null,[-1,-1])}}new ur({target:document.querySelector("#app")}); + `,v=h(),y=a("a"),y.innerHTML=`Source + `,b=h(),C=a("br"),W=h(),I=a("div"),O=h(),j=a("br"),E=h(),M=a("div");for(let N=0;N',we=h(),ae=a("div");for(let N=0;N{Jt(G,1)}),si()}Me?(Y=new Me(He(N)),xn(Y.$$.fragment),Se(Y.$$.fragment,1),Gt(Y,te,null)):Y=null}if(ie[0]&64){We=N[6];let G;for(G=0;G{await confirm("Are you sure?")||H.preventDefault()}),qe.onFileDropEvent(H=>{W(`File drop: ${JSON.stringify(H.payload)}`)});const l=navigator.userAgent.toLowerCase(),o=l.includes("android")||l.includes("iphone"),u=[{label:"Welcome",component:Fo,icon:"i-ph-hand-waving"},{label:"Communication",component:Go,icon:"i-codicon-radio-tower"},!o&&{label:"CLI",component:qo,icon:"i-codicon-terminal"},!o&&{label:"Dialog",component:aa,icon:"i-codicon-multiple-windows"},{label:"File system",component:da,icon:"i-codicon-files"},{label:"HTTP",component:wa,icon:"i-ph-globe-hemisphere-west"},!o&&{label:"Notifications",component:Ca,icon:"i-codicon-bell-dot"},!o&&{label:"App",component:er,icon:"i-codicon-hubot"},!o&&{label:"Window",component:La,icon:"i-codicon-window"},!o&&{label:"Shortcuts",component:Oa,icon:"i-codicon-record-keys"},{label:"Shell",component:Ha,icon:"i-codicon-terminal-bash"},!o&&{label:"Updater",component:Va,icon:"i-codicon-cloud-download"},!o&&{label:"Clipboard",component:Ya,icon:"i-codicon-clippy"},{label:"WebRTC",component:Za,icon:"i-ph-broadcast"}];let d=u[0];function c(H){n(1,d=H)}let f;dt(async()=>{const H=qt();n(2,f=await H.isMaximized()),Yt("tauri://resize",async()=>{n(2,f=await H.isMaximized())})});function g(){qt().minimize()}async function k(){const H=qt();await H.isMaximized()?H.unmaximize():H.maximize()}let _=!1;async function v(){_||(_=await Xs("Are you sure that you want to close this window?",{title:"Tauri API"}),_&&qt().close())}let y;dt(()=>{n(3,y=localStorage&&localStorage.getItem("theme")=="dark"),vs(y)});function b(){n(3,y=!y),vs(y)}let C=Cs([]);ks(e,C,H=>n(6,i=H));function W(H){C.update(X=>[{html:`
[${new Date().toLocaleTimeString()}]: `+(typeof H=="string"?H:JSON.stringify(H,null,1))+"
"},...X])}function I(H){C.update(X=>[{html:`
[${new Date().toLocaleTimeString()}]: `+H+"
"},...X])}function O(){C.update(()=>[])}let j,E,M;function A(H){M=H.clientY;const X=window.getComputedStyle(j);E=parseInt(X.height,10);const $=fe=>{const pe=fe.clientY-M,we=E-pe;n(4,j.style.height=`${we{document.removeEventListener("mouseup",be),document.removeEventListener("mousemove",$)};document.addEventListener("mouseup",be),document.addEventListener("mousemove",$)}let P;dt(async()=>{n(5,P=await Fs()==="win32")});let T=!1,F,U,J=!1,ne=0,ce=0;const te=(H,X,$)=>Math.min(Math.max(X,H),$);dt(()=>{n(18,F=document.querySelector("#sidebar")),U=document.querySelector("#sidebarToggle"),document.addEventListener("click",H=>{U.contains(H.target)?n(0,T=!T):T&&!F.contains(H.target)&&n(0,T=!1)}),document.addEventListener("touchstart",H=>{if(U.contains(H.target))return;const X=H.touches[0].clientX;(0{if(J){const X=H.touches[0].clientX;ce=X;const $=(X-ne)/10;F.style.setProperty("--translate-x",`-${te(0,T?0-$:18.75-$,18.75)}rem`)}}),document.addEventListener("touchend",()=>{if(J){const H=(ce-ne)/10;n(0,T=T?H>-(18.75/2):H>18.75/2)}J=!1})});const Y=()=>Fi("https://tauri.app/"),oe=H=>{c(H),n(0,T=!1)};function ee(H){$n[H?"unshift":"push"](()=>{j=H,n(4,j)})}return e.$$.update=()=>{if(e.$$.dirty[0]&1){const H=document.querySelector("#sidebar");H&&dr(H,T)}},[T,d,f,y,j,P,i,u,c,g,k,v,b,C,W,I,O,A,F,Y,oe,ee]}class pr extends ve{constructor(t){super(),ye(this,t,fr,cr,_e,{},null,[-1,-1])}}new pr({target:document.querySelector("#app")}); diff --git a/examples/api/src-tauri/Cargo.lock b/examples/api/src-tauri/Cargo.lock index 6303237f6..0e72cba8c 100644 --- a/examples/api/src-tauri/Cargo.lock +++ b/examples/api/src-tauri/Cargo.lock @@ -10,30 +10,30 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aead" -version = "0.4.3" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" +checksum = "5c192eb8f11fc081b0fe4259ba5af04217d4e0faddd02417310a927911abd7c8" dependencies = [ + "crypto-common", "generic-array", ] [[package]] name = "aes" -version = "0.7.5" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" +checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" dependencies = [ "cfg-if", "cipher", "cpufeatures", - "opaque-debug", ] [[package]] name = "aes-gcm" -version = "0.9.4" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" +checksum = "82e1366e0c69c9f927b1fa5ce2c7bf9eafc8f9268c0b9800729e8b267612447c" dependencies = [ "aead", "aes", @@ -297,9 +297,9 @@ dependencies = [ [[package]] name = "cargo_toml" -version = "0.13.3" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497049e9477329f8f6a559972ee42e117487d01d1e8c2cc9f836ea6fa23a9e1a" +checksum = "2bfbc36312494041e2cdd5f06697b7e89d4b76f42773a0b5556ac290ff22acc2" dependencies = [ "serde", "toml", @@ -317,16 +317,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" -[[package]] -name = "cfb" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74f89d248799e3f15f91b70917f65381062a01bb8e222700ea0e5a7ff9785f9c" -dependencies = [ - "byteorder", - "uuid 0.8.2", -] - [[package]] name = "cfb" version = "0.7.3" @@ -335,7 +325,7 @@ checksum = "d38f2da7a0a2c4ccf0065be06397cc26a81f4e528be095826eee9d4adbb8c60f" dependencies = [ "byteorder", "fnv", - "uuid 1.3.0", + "uuid", ] [[package]] @@ -361,11 +351,12 @@ checksum = "cca491388666e04d7248af3f60f0c40cfb0991c72205595d7c396e3510207d1a" [[package]] name = "cipher" -version = "0.3.0" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" +checksum = "d1873270f8f7942c191139cb8a40fd228da6c3fd2fc376d7e92d47aa14aeb59e" dependencies = [ - "generic-array", + "crypto-common", + "inout", ] [[package]] @@ -530,6 +521,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] @@ -572,9 +564,9 @@ dependencies = [ [[package]] name = "ctr" -version = "0.8.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ "cipher", ] @@ -1044,9 +1036,9 @@ dependencies = [ [[package]] name = "ghash" -version = "0.4.4" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" +checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" dependencies = [ "opaque-debug", "polyval", @@ -1363,6 +1355,16 @@ dependencies = [ "png", ] +[[package]] +name = "ico" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3804960be0bb5e4edb1e1ad67afd321a9ecfd875c3e65c099468fd2717d7cae" +dependencies = [ + "byteorder", + "png", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -1420,22 +1422,31 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "infer" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20b2b533137b9cad970793453d4f921c2e91312a6d88b1085c07bc15fc51bb3b" -dependencies = [ - "cfb 0.6.1", -] - [[package]] name = "infer" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f178e61cdbfe084aa75a2f4f7a25a5bb09701a47ae1753608f194b15783c937a" dependencies = [ - "cfb 0.7.3", + "cfb", +] + +[[package]] +name = "infer" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a898e4b7951673fce96614ce5751d13c40fc5674bc2d759288e46c3ab62598b3" +dependencies = [ + "cfb", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", ] [[package]] @@ -1519,12 +1530,13 @@ dependencies = [ [[package]] name = "json-patch" -version = "0.2.7" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3fa5a61630976fc4c353c70297f2e93f1930e3ccee574d59d618ccbd5154ce" +checksum = "e712e62827c382a77b87f590532febb1f8b2fdbc3eefa1ee37fe7281687075ef" dependencies = [ "serde", "serde_json", + "thiserror", "treediff", ] @@ -1961,9 +1973,9 @@ dependencies = [ [[package]] name = "os_info" -version = "3.6.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c424bc68d15e0778838ac013b5b3449544d8133633d8016319e7e05a820b8c0" +checksum = "5209b2162b2c140df493a93689e04f8deab3a67634f5bc7a553c0a98e5b8d399" dependencies = [ "log", "serde", @@ -2218,9 +2230,9 @@ dependencies = [ [[package]] name = "polyval" -version = "0.5.3" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" +checksum = "7ef234e08c11dfcb2e56f79fd70f6f2eb7f025c0ce2333e82f4f0518ecad30c6" dependencies = [ "cfg-if", "cpufeatures", @@ -2973,7 +2985,7 @@ dependencies = [ "serde", "tao-macros", "unicode-segmentation", - "uuid 1.3.0", + "uuid", "windows 0.44.0", "windows-implement", "x11-dl", @@ -3007,7 +3019,7 @@ version = "2.0.0-alpha.3" dependencies = [ "anyhow", "attohttpc", - "base64 0.13.1", + "base64 0.21.0", "bytes", "clap", "cocoa", @@ -3021,7 +3033,7 @@ dependencies = [ "gtk", "heck 0.4.1", "http", - "ico", + "ico 0.2.0", "ignore", "infer 0.9.0", "jni", @@ -3060,7 +3072,7 @@ dependencies = [ "time", "tokio", "url", - "uuid 1.3.0", + "uuid", "webkit2gtk", "webview2-com", "win7-notifications", @@ -3079,21 +3091,22 @@ dependencies = [ "json-patch", "quote", "semver 1.0.16", + "serde", "serde_json", "swift-rs", "tauri-codegen", "tauri-utils", + "tauri-winres", "walkdir", - "winres", ] [[package]] name = "tauri-codegen" version = "2.0.0-alpha.1" dependencies = [ - "base64 0.13.1", + "base64 0.21.0", "brotli", - "ico", + "ico 0.3.0", "json-patch", "plist", "png", @@ -3108,7 +3121,7 @@ dependencies = [ "thiserror", "time", "url", - "uuid 1.3.0", + "uuid", "walkdir", ] @@ -3164,7 +3177,8 @@ dependencies = [ "serde_json", "tauri-utils", "thiserror", - "uuid 1.3.0", + "url", + "uuid", "webview2-com", "windows 0.44.0", ] @@ -3181,7 +3195,7 @@ dependencies = [ "raw-window-handle", "tauri-runtime", "tauri-utils", - "uuid 1.3.0", + "uuid", "webkit2gtk", "webview2-com", "windows 0.44.0", @@ -3199,7 +3213,7 @@ dependencies = [ "glob", "heck 0.4.1", "html5ever", - "infer 0.7.0", + "infer 0.12.0", "json-patch", "kuchiki", "memchr", @@ -3217,6 +3231,16 @@ dependencies = [ "windows 0.44.0", ] +[[package]] +name = "tauri-winres" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b7a78dc04f75fb5ab815e66ac561c81e92a968a40f29e7c21afd152d694fad8" +dependencies = [ + "toml", + "version_check", +] + [[package]] name = "tauri-winrt-notification" version = "0.1.0" @@ -3485,9 +3509,9 @@ dependencies = [ [[package]] name = "treediff" -version = "3.0.2" +version = "4.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "761e8d5ad7ce14bb82b7e61ccc0ca961005a275a060b9644a2431aa11553c2ff" +checksum = "52984d277bdf2a751072b5df30ec0377febdb02f7696d64c2d7d54630bac4303" dependencies = [ "serde_json", ] @@ -3548,11 +3572,11 @@ checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[package]] name = "universal-hash" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" +checksum = "7d3160b73c9a19f7e2939a2fdad446c57c1bbbbf4d919d3213ff1267a580d8b5" dependencies = [ - "generic-array", + "crypto-common", "subtle", ] @@ -3580,12 +3604,6 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5190c9442dcdaf0ddd50f37420417d219ae5261bbf5db120d0f9bab996c9cba1" -[[package]] -name = "uuid" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" - [[package]] name = "uuid" version = "1.3.0" @@ -4099,15 +4117,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "winres" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c" -dependencies = [ - "toml", -] - [[package]] name = "wry" version = "0.27.0" diff --git a/examples/api/src-tauri/Cargo.toml b/examples/api/src-tauri/Cargo.toml index 5d503e8b3..0f235d213 100644 --- a/examples/api/src-tauri/Cargo.toml +++ b/examples/api/src-tauri/Cargo.toml @@ -41,7 +41,6 @@ features = [ ] [features] -default = [ "custom-protocol" ] custom-protocol = [ "tauri/custom-protocol" ] # default to small, optimized release binaries diff --git a/examples/api/src-tauri/src/desktop.rs b/examples/api/src-tauri/src/desktop.rs index adbfce9a1..aabe918e3 100644 --- a/examples/api/src-tauri/src/desktop.rs +++ b/examples/api/src-tauri/src/desktop.rs @@ -1,7 +1,11 @@ use std::sync::atomic::{AtomicBool, Ordering}; use tauri::{ - api::dialog::ask, CustomMenuItem, GlobalShortcutManager, Manager, RunEvent, SystemTray, - SystemTrayEvent, SystemTrayMenu, WindowBuilder, WindowEvent, WindowUrl, + api::{ + dialog::{ask, MessageDialogBuilder, MessageDialogButtons}, + shell, + }, + CustomMenuItem, GlobalShortcutManager, Manager, RunEvent, SystemTray, SystemTrayEvent, + SystemTrayMenu, WindowBuilder, WindowEvent, WindowUrl, }; pub fn main() { @@ -71,6 +75,7 @@ fn create_tray(app: &tauri::App) -> tauri::Result<()> { tray_menu1 = tray_menu1 .add_item(CustomMenuItem::new("switch_menu", "Switch Menu")) + .add_item(CustomMenuItem::new("about", "About")) .add_item(CustomMenuItem::new("exit_app", "Quit")) .add_item(CustomMenuItem::new("destroy", "Destroy")); @@ -78,6 +83,7 @@ fn create_tray(app: &tauri::App) -> tauri::Result<()> { .add_item(CustomMenuItem::new("toggle", "Toggle")) .add_item(CustomMenuItem::new("new", "New window")) .add_item(CustomMenuItem::new("switch_menu", "Switch Menu")) + .add_item(CustomMenuItem::new("about", "About")) .add_item(CustomMenuItem::new("exit_app", "Quit")) .add_item(CustomMenuItem::new("destroy", "Destroy")); let is_menu1 = AtomicBool::new(true); @@ -87,6 +93,7 @@ fn create_tray(app: &tauri::App) -> tauri::Result<()> { SystemTray::new() .with_id(&tray_id) .with_menu(tray_menu1.clone()) + .with_tooltip("Tauri") .on_event(move |event| { let tray_handle = handle.tray_handle_by_id(&tray_id).unwrap(); match event { @@ -152,15 +159,29 @@ fn create_tray(app: &tauri::App) -> tauri::Result<()> { } "switch_menu" => { let flag = is_menu1.load(Ordering::Relaxed); - tray_handle - .set_menu(if flag { - tray_menu2.clone() - } else { - tray_menu1.clone() - }) - .unwrap(); + let (menu, tooltip) = if flag { + (tray_menu2.clone(), "Menu 2") + } else { + (tray_menu1.clone(), "Tauri") + }; + tray_handle.set_menu(menu).unwrap(); + tray_handle.set_tooltip(tooltip).unwrap(); is_menu1.store(!flag, Ordering::Relaxed); } + "about" => { + let window = handle.get_window("main").unwrap(); + MessageDialogBuilder::new("About app", "Tauri demo app") + .parent(&window) + .buttons(MessageDialogButtons::OkCancelWithLabels( + "Homepage".into(), + "know it".into(), + )) + .show(move |ok| { + if ok { + shell::open(&window.shell_scope(), "https://tauri.app/", None).unwrap(); + } + }); + } _ => {} } } diff --git a/examples/api/src-tauri/src/lib.rs b/examples/api/src-tauri/src/lib.rs index ca39d0630..748a142cc 100644 --- a/examples/api/src-tauri/src/lib.rs +++ b/examples/api/src-tauri/src/lib.rs @@ -78,7 +78,8 @@ impl AppBuilder { .user_agent("Tauri API") .title("Tauri API Validation") .inner_size(1000., 800.) - .min_inner_size(600., 400.); + .min_inner_size(600., 400.) + .content_protected(true); } #[cfg(target_os = "windows")] diff --git a/examples/api/src-tauri/src/main.rs b/examples/api/src-tauri/src/main.rs index 1ade16f98..542ed35e5 100644 --- a/examples/api/src-tauri/src/main.rs +++ b/examples/api/src-tauri/src/main.rs @@ -1,3 +1,8 @@ +#![cfg_attr( + all(not(debug_assertions), target_os = "windows"), + windows_subsystem = "windows" +)] + #[cfg(desktop)] mod desktop; diff --git a/examples/api/src/views/Window.svelte b/examples/api/src/views/Window.svelte index c117fea65..7ffd6523d 100644 --- a/examples/api/src/views/Window.svelte +++ b/examples/api/src/views/Window.svelte @@ -66,6 +66,7 @@ let maximized = false let decorations = true let alwaysOnTop = false + let contentProtected = true let fullscreen = false let width = null let height = null @@ -182,6 +183,7 @@ : windowMap[selectedWindow]?.unmaximize() $: windowMap[selectedWindow]?.setDecorations(decorations) $: windowMap[selectedWindow]?.setAlwaysOnTop(alwaysOnTop) + $: windowMap[selectedWindow]?.setContentProtected(contentProtected) $: windowMap[selectedWindow]?.setFullscreen(fullscreen) $: width && @@ -286,6 +288,10 @@ Always on top +
+

Welcome to Tauri!

+ +
+ +

+ Click on the Tauri, Vite, and Svelte logos to learn more. +

+ +
+ +
+ +
+ +
{@html response}
+
+ +
+ + diff --git a/tooling/cli/templates/plugin/with-api/examples/tauri-app/src/lib/Greet.svelte b/tooling/cli/templates/plugin/with-api/examples/tauri-app/src/lib/Greet.svelte new file mode 100644 index 000000000..d8a1bd7d6 --- /dev/null +++ b/tooling/cli/templates/plugin/with-api/examples/tauri-app/src/lib/Greet.svelte @@ -0,0 +1,22 @@ + + +
+
+ + +
+

{greetMsg}

+
+ diff --git a/tooling/cli/templates/plugin/with-api/examples/tauri-app/src/main.js b/tooling/cli/templates/plugin/with-api/examples/tauri-app/src/main.js new file mode 100644 index 000000000..6b4e1a969 --- /dev/null +++ b/tooling/cli/templates/plugin/with-api/examples/tauri-app/src/main.js @@ -0,0 +1,8 @@ +import "./style.css"; +import App from "./App.svelte"; + +const app = new App({ + target: document.getElementById("app"), +}); + +export default app; diff --git a/tooling/cli/templates/plugin/with-api/examples/tauri-app/src/style.css b/tooling/cli/templates/plugin/with-api/examples/tauri-app/src/style.css new file mode 100644 index 000000000..c0f9e3bc8 --- /dev/null +++ b/tooling/cli/templates/plugin/with-api/examples/tauri-app/src/style.css @@ -0,0 +1,102 @@ +:root { + font-family: Inter, Avenir, Helvetica, Arial, sans-serif; + font-size: 16px; + line-height: 24px; + font-weight: 400; + + color: #0f0f0f; + background-color: #f6f6f6; + + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-text-size-adjust: 100%; +} + +.container { + margin: 0; + padding-top: 10vh; + display: flex; + flex-direction: column; + justify-content: center; + text-align: center; +} + +.logo { + height: 6em; + padding: 1.5em; + will-change: filter; + transition: 0.75s; +} + +.logo.tauri:hover { + filter: drop-shadow(0 0 2em #24c8db); +} + +.row { + display: flex; + justify-content: center; +} + +a { + font-weight: 500; + color: #646cff; + text-decoration: inherit; +} + +a:hover { + color: #535bf2; +} + +h1 { + text-align: center; +} + +input, +button { + border-radius: 8px; + border: 1px solid transparent; + padding: 0.6em 1.2em; + font-size: 1em; + font-weight: 500; + font-family: inherit; + color: #0f0f0f; + background-color: #ffffff; + transition: border-color 0.25s; + box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2); +} + +button { + cursor: pointer; +} + +button:hover { + border-color: #396cd8; +} + +input, +button { + outline: none; +} + +#greet-input { + margin-right: 5px; +} + +@media (prefers-color-scheme: dark) { + :root { + color: #f6f6f6; + background-color: #2f2f2f; + } + + a:hover { + color: #24c8db; + } + + input, + button { + color: #ffffff; + background-color: #0f0f0f98; + } +} diff --git a/tooling/cli/templates/plugin/with-api/examples/tauri-app/src/vite-env.d.ts b/tooling/cli/templates/plugin/with-api/examples/tauri-app/src/vite-env.d.ts new file mode 100644 index 000000000..4078e7476 --- /dev/null +++ b/tooling/cli/templates/plugin/with-api/examples/tauri-app/src/vite-env.d.ts @@ -0,0 +1,2 @@ +/// +/// diff --git a/tooling/cli/templates/plugin/with-api/examples/tauri-app/vite.config.js b/tooling/cli/templates/plugin/with-api/examples/tauri-app/vite.config.js new file mode 100644 index 000000000..714f46d72 --- /dev/null +++ b/tooling/cli/templates/plugin/with-api/examples/tauri-app/vite.config.js @@ -0,0 +1,27 @@ +import { defineConfig } from "vite"; +import { svelte } from "@sveltejs/vite-plugin-svelte"; + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [svelte()], + + // Vite optons tailored for Tauri development and only applied in `tauri dev` or `tauri build` + // prevent vite from obscuring rust errors + clearScreen: false, + // tauri expects a fixed port, fail if that port is not available + server: { + port: 1420, + strictPort: true, + }, + // to make use of `TAURI_DEBUG` and other env variables + // https://tauri.studio/v1/api/config#buildconfig.beforedevcommand + envPrefix: ["VITE_", "TAURI_"], + build: { + // Tauri supports es2021 + target: ["es2021", "chrome100", "safari13"], + // don't minify for debug builds + minify: !process.env.TAURI_DEBUG ? "esbuild" : false, + // produce sourcemaps for debug builds + sourcemap: !!process.env.TAURI_DEBUG, + }, +}); diff --git a/tooling/webdriver/Cargo.lock b/tooling/webdriver/Cargo.lock index 31d3d2252..d0e96ed47 100644 --- a/tooling/webdriver/Cargo.lock +++ b/tooling/webdriver/Cargo.lock @@ -8,6 +8,12 @@ version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + [[package]] name = "bytes" version = "1.1.0" @@ -378,13 +384,13 @@ dependencies = [ [[package]] name = "tokio" -version = "1.19.2" +version = "1.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c51a52ed6686dd62c320f9b89299e9dfb46f730c7a48e635c19f21d116cb1439" +checksum = "eb78f30e4b41e98ca4cce5acb51168a033839a7af9e42b380355808e14e98ee0" dependencies = [ + "autocfg", "libc", "mio", - "once_cell", "pin-project-lite", "socket2", "tokio-macros",