# Golden publish lock — DO NOT change without full online re-test matrix.
# Any agent or script that embeds a different menu/bridge for PUBLISH breaks online.

$script:GoldenPublish = [ordered]@{
    PublishExeName       = 'AKMenu-July2-WORKING.exe'
    PublishExeMd5        = '087b78578c66bcbc0d68998bd754a1ef'
    PublishExeSize       = 24017920
    MenuDllBytes         = 8261120
    MenuDllMd5           = '49a24d6d7afd32afb2839fb4a4d8ccfa'
    MenuBuildId          = 'AK-2026-07-01-akmenu-v43-no-fsl'
    BridgeDllBytes       = 15389696
    BridgeDllMd5         = '5be196f5952b7354784ee7f3132af430'
    RejectedBridgeBytes  = 17103360
    SyncHookRva          = '0x11E15C'
    SyncHookPlainBytes   = '488b5b184885'   # unpatched — required for publish
    SyncHookBannedPrefix = @('33db', 'eb02', 'e966')  # xor/jmp/conditional redirect = not publish yet
    LauncherBuildId      = 'AK-2026-07-02-akmenu-v46-launcher'
    ResourceMenuId       = 101
    ResourceBridgeId     = 102
}

# Menu sizes that MUST NOT ship for online (recompiled / broken)
$script:GoldenBannedMenuSizes = @(
    8273920, 8275456, 8265728, 8263168, 8277504, 8010752,
    8250880, 7799296   # LAB-FULL (ALERT), LAB-b3-ui baseline
)

function Get-GoldenBaselineDir {
    if ($PSScriptRoot) {
        return (Resolve-Path (Join-Path $PSScriptRoot '..\baseline')).Path
    }
    throw 'Cannot resolve baseline directory'
}

function Get-GoldenPublishExe {
    param([string]$OverridePath)
    if ($OverridePath -and (Test-Path $OverridePath)) { return (Resolve-Path $OverridePath).Path }
    $p = Join-Path (Get-GoldenBaselineDir) $GoldenPublish.PublishExeName
    if (-not (Test-Path $p)) { throw "Missing golden publish exe: $p" }
    return $p
}
