{
    "version": "1.24.10921.0",
    "description": "The new Windows Terminal, and the original Windows console host - all in the same place!",
    "homepage": "https://github.com/microsoft/terminal",
    "license": "MIT",
    "notes": "Add Windows Terminal as a context menu option by running `reg import \"$dir\\install-context.reg\"`",
    "suggest": {
        "vcredist": "extras/vcredist2022"
    },
    "architecture": {
        "64bit": {
            "url": "https://github.com/microsoft/terminal/releases/download/v1.24.10921.0/Microsoft.WindowsTerminal_1.24.10921.0_x64.zip",
            "hash": "4f64736da2f075a517e0f40ecac2a8acc9cd22076e6a7eddf84a86a3917b725e"
        },
        "32bit": {
            "url": "https://github.com/microsoft/terminal/releases/download/v1.24.10921.0/Microsoft.WindowsTerminal_1.24.10921.0_x86.zip",
            "hash": "9a06cd1e6cef4ca05506ea7b5aead8b7e3e0bb36ab01feb01010637e5cf2889e"
        },
        "arm64": {
            "url": "https://github.com/microsoft/terminal/releases/download/v1.24.10921.0/Microsoft.WindowsTerminal_1.24.10921.0_arm64.zip",
            "hash": "58c3984c7beab38c87d905d5d98bafe5448defbf6f19aef827880dc74d9368cc"
        }
    },
    "extract_dir": "terminal-1.24.10921.0",
    "pre_install": [
        "# Remove this hint in 2023-12-01",
        "$settings_path = \"$env:LOCALAPPDATA\\Packages\\Microsoft.WindowsTerminal_8wekyb3d8bbwe\\LocalState\"",
        "if (!(Test-Path \"$persist_dir\\settings\") -and (Test-Path $settings_path)) {",
        "  $current_setings = $dir.Replace($version, 'current') + \"\\settings\"",
        "  warn \"Portable mode is enabled from version 1.17.11391.0, please migrate the settings manually:\"",
        "  warn \"Original settings dir: `'$settings_path`'\"",
        "  warn \"Portable settings dir: `'$current_setings`'\"",
        "}"
    ],
    "installer": {
        "script": [
            "$winVer = [Environment]::OSVersion.Version",
            "if (($winver.Major -lt '10') -or ($winVer.Build -lt 19041)) { warn 'At least Windows 10 20H1 (build 19041) is required.' }",
            "if (!(Test-Path \"$persist_dir\\.portable\")) { Add-Content \"$dir\\.portable\" '' -Encoding Ascii }"
        ]
    },
    "post_install": [
        "'install-context', 'uninstall-context' | ForEach-Object {",
        "    if (Test-Path \"$bucketsdir\\extras\\scripts\\windows-terminal\\$_.reg\") {",
        "        $wtPath = \"$dir\\wt.exe\".Replace('\\', '\\\\')",
        "        $content = (Get-Content \"$bucketsdir\\extras\\scripts\\windows-terminal\\$_.reg\").Replace('$wt', $wtPath)",
        "        if ($global) { $content = $content.Replace('HKEY_CURRENT_USER', 'HKEY_LOCAL_MACHINE') }",
        "        Set-Content \"$dir\\$_.reg\" $content -Encoding Ascii -Force",
        "    }",
        "}"
    ],
    "bin": [
        "WindowsTerminal.exe",
        "wt.exe"
    ],
    "shortcuts": [
        [
            "WindowsTerminal.exe",
            "Windows Terminal"
        ]
    ],
    "persist": [
        ".portable",
        "settings"
    ],
    "pre_uninstall": "if ($cmd -eq 'uninstall') { reg import \"$dir\\uninstall-context.reg\" }",
    "checkver": "github",
    "autoupdate": {
        "architecture": {
            "64bit": {
                "url": "https://github.com/microsoft/terminal/releases/download/v$version/Microsoft.WindowsTerminal_$version_x64.zip"
            },
            "32bit": {
                "url": "https://github.com/microsoft/terminal/releases/download/v$version/Microsoft.WindowsTerminal_$version_x86.zip"
            },
            "arm64": {
                "url": "https://github.com/microsoft/terminal/releases/download/v$version/Microsoft.WindowsTerminal_$version_arm64.zip"
            }
        },
        "hash": {
            "url": "https://github.com/microsoft/terminal/releases/tag/v$version",
            "regex": "(?s)$basename.*?$sha256"
        },
        "extract_dir": "terminal-$version"
    }
}
