{
    "version": "131.0.5877.24",
    "description": "A fast, secure, easy-to-use browser.",
    "homepage": "https://www.opera.com",
    "license": {
        "identifier": "Freeware",
        "url": "https://www.opera.com/eula/computers"
    },
    "architecture": {
        "64bit": {
            "url": "https://get.geo.opera.com/pub/opera/desktop/131.0.5877.24/win/Opera_131.0.5877.24_Setup_x64.exe",
            "hash": "bfcd17a0d920a03feb6fcc060487476181926d0c2696ee432408085f53b87d2a"
        },
        "32bit": {
            "url": "https://get.geo.opera.com/pub/opera/desktop/131.0.5877.24/win/Opera_131.0.5877.24_Setup.exe",
            "hash": "21b173acbc55f407f08455883a3cba282dbf4259bf21fdb94a096e466c5bddce"
        },
        "arm64": {
            "url": "https://get.geo.opera.com/pub/opera/desktop/131.0.5877.24/win/Opera_131.0.5877.24_Setup_arm64.exe",
            "hash": "780bfdb51e8ed091f7b9f5efd2576bdd8c129df5c555180f1a63a941b5c25b0b"
        }
    },
    "installer": {
        "script": [
            "$version, 'autoupdate' | ForEach-Object { ensure \"$dir\\$_\" | Out-Null }",
            "Expand-7zipArchive -Path \"$dir\\$fname\" -Switches '-x!*_list -xr!unins*' -Removal",
            "Move-Item -Path \"$dir\\opera_autoupdate*\" -Destination \"$dir\\autoupdate\" -Force",
            "$exclude_list = @('Assets', $version, 'autoupdate', 'Resources.pri', 'opera.visualelementsmanifest.xml')",
            "Move-Item -Path \"$dir\\*\" -Destination \"$dir\\$version\" -Exclude $exclude_list -Force -ErrorAction SilentlyContinue",
            "Copy-Item -Path \"$dir\\$version\\opera.exe\" -Destination $dir -Force",
            "$cfg = @{ 'autoupdate' = $false; 'enable_stats' = $false; 'single_profile' = $true } | ConvertTo-Json -Depth 5 -Compress",
            "Set-Content -Path \"$dir\\installer_prefs.json\" -Value $cfg -NoNewline -Encoding utf8"
        ]
    },
    "shortcuts": [
        [
            "opera.exe",
            "Opera"
        ]
    ],
    "persist": "profile",
    "checkver": {
        "script": [
            "$path_regex = '^(?!\\.)[\\d.]+/$'",
            "$version_sort = { [version]$_.href.TrimEnd('/') }",
            "$releases_url = 'https://get.geo.opera.com/pub/opera/desktop/'",
            "$releases_page = Invoke-WebRequest -Uri $releases_url -UseBasicParsing -ErrorAction Stop",
            "$path_segments = $releases_page.links | Where-Object { $_.href -match $path_regex } |",
            "        Sort-Object -Property $version_sort -Descending | ForEach-Object -MemberName href",
            "foreach ($path_segment in $path_segments.TrimEnd('/')) {",
            "    $release_url = 'https://get.geo.opera.com/pub/opera/desktop/{0}/win/' -f $path_segment",
            "    $download_page = Invoke-WebRequest -Uri $release_url -UseBasicParsing -ErrorAction Stop",
            "    $installer_name = $download_page.Links | Where-Object { $_.href -match '(?<=Setup\\w+)\\.exe$' } |",
            "            Select-Object -ExpandProperty href -First 1",
            "    if ($null -ne $installer_name) { Write-Output $installer_name; break }",
            "}"
        ],
        "regex": "Opera_([\\d.]+)_Setup"
    },
    "autoupdate": {
        "architecture": {
            "64bit": {
                "url": "https://get.geo.opera.com/pub/opera/desktop/$version/win/Opera_$version_Setup_x64.exe"
            },
            "32bit": {
                "url": "https://get.geo.opera.com/pub/opera/desktop/$version/win/Opera_$version_Setup.exe"
            },
            "arm64": {
                "url": "https://get.geo.opera.com/pub/opera/desktop/$version/win/Opera_$version_Setup_arm64.exe"
            }
        },
        "hash": {
            "url": "$url.sha256sum"
        }
    }
}
