cask "firefox@esr" do
  version "140.13.0"

  language "af" do
    sha256 "a86722716a6eaca8157132ba498ee91278609e31dd6943bc415195591023fa74"
    "af"
  end
  language "ar" do
    sha256 "eb5d0b25c15c8823772e1b9155fa9066467c63325b5cdd4c163641271daec1e2"
    "ar"
  end
  language "be" do
    sha256 "d6f193e809f573a9b319bd83db346187889c4173437db14a5f8becabd5273a7f"
    "be"
  end
  language "bg" do
    sha256 "19ac434d764af858524da4889fa992d3b1526ff4af75f64d83fced3b1597c280"
    "bg"
  end
  language "bn" do
    sha256 "d81cd04bdf7730ba32de4f237728af5b2971a4f99aef4c7b7c0924b2a27105f8"
    "bn"
  end
  language "ca" do
    sha256 "21fc65f8d6a5171de3f552d488daf0743da19cfc037e02248aec2edd798a11b8"
    "ca"
  end
  language "cs" do
    sha256 "a781e90f3ae283c1c57f3914597e3d0c70ef602f7ecc7ece074b50e160a27537"
    "cs"
  end
  language "de" do
    sha256 "c4a5811b9b592e1b4068a6cdd1fdce967aa8931647a1a17ca4eacdba0dc9ba4c"
    "de"
  end
  language "en-CA" do
    sha256 "9bb98b32ed9be66a043b59c023084fadb1b9cb9b29fc2632b2166e96465b3146"
    "en-CA"
  end
  language "en-GB" do
    sha256 "fb7c5a0db82a61c3577c656e27c9c986a6a3fe0b66dae70dea42d3ef3b7f8da7"
    "en-GB"
  end
  language "en", default: true do
    sha256 "0a7c51def21ab65d295d839c270405d0a2c2a04d589e8ce92c5e238eeb3f1827"
    "en-US"
  end
  language "eo" do
    sha256 "e7aa9231a9a192703fb530c598969a33fb72680a7ae14ead54bff136658a24cc"
    "eo"
  end
  language "es-AR" do
    sha256 "d3acd33bd337273ff943cdde07214d309b193a89dfc714c967c44f449036122a"
    "es-AR"
  end
  language "es-CL" do
    sha256 "ceaa87e13722dd97cc138823c2e6620212cd7da6a8ef07315bec756f3fd8a28b"
    "es-CL"
  end
  language "es-ES" do
    sha256 "e1cfb04061cac11f5ca0df62b3409a756c1d14528804bf3784bb1d64a0a78f21"
    "es-ES"
  end
  language "fa" do
    sha256 "fa79d69e03c38c509f0734b18f4ee58ee4fe6c0e2b2df9925ea92ef70f4cdf74"
    "fa"
  end
  language "ff" do
    sha256 "ac99e435e03e2d61ef513c679c05eabb5db9964efc328cea3d96255656d57ef1"
    "ff"
  end
  language "fi" do
    sha256 "6457cdd0ac719905441fd0f5cf6710f4073eebcd3743085d53c16558cff33c0a"
    "fi"
  end
  language "fr" do
    sha256 "9552f0241a7356a8116d37750c5ea3196673f2d1bf2de556b1ff6646b0406c4d"
    "fr"
  end
  language "gl" do
    sha256 "46752045aec977aeb3691abacc423722c7a3c863cca2289e8d72ad2194327692"
    "gl"
  end
  language "gn" do
    sha256 "1788b19758a511ade3cea500a3b6273cb0b54ad4b71e6591e830518da655ef9a"
    "gn"
  end
  language "gu" do
    sha256 "4c7446f368ee67a0f064ae478c913f05aaefce9a29d146c27d645d30b4a082df"
    "gu-IN"
  end
  language "he" do
    sha256 "7890de243afa4feeeaf2067d6d64451f2bf31362dc095b8ab6bf4faf8b02b920"
    "he"
  end
  language "hi" do
    sha256 "06187155260b9b6d2121dd9ec0b27f7a64f117a153a07f69f28b4994c3b78f5a"
    "hi-IN"
  end
  language "in" do
    sha256 "06187155260b9b6d2121dd9ec0b27f7a64f117a153a07f69f28b4994c3b78f5a"
    "hi-IN"
  end
  language "it" do
    sha256 "d9154e710cb0c8029d859375ca4d019479f296a69583105c201e6d8b63cc8aba"
    "it"
  end
  language "ja" do
    sha256 "0738ab3a2160f58bc5fdc8acd7b100712dd9b23f4cb9bd5989912ffef652f1dd"
    "ja-JP-mac"
  end
  language "ka" do
    sha256 "85524bf3ba4b1a06114722552418f6a80ebe8d6c7321b5e1dddc12580a713fb2"
    "ka"
  end
  language "ko" do
    sha256 "1614a9d2e79584de7cca2a11a402e6853918c921fa4ce3700af123eb5e50a003"
    "ko"
  end
  language "mr" do
    sha256 "3f8a742e09a6fd5a055407b4f315d48eb483ee6cae47a3de63a5d59b24df2413"
    "mr"
  end
  language "my" do
    sha256 "7d855e403a9e75664caed6fa9a750bb0ed7af2543d8ec848dda9711884522b86"
    "my"
  end
  language "ne" do
    sha256 "87eb94fe42a7949a0cae42d9e818dff557a2586414f5104f76575b85416d20f5"
    "ne-NP"
  end
  language "nl" do
    sha256 "0bb7edb743ac94e4eeb014d10e92b7331c0c27f681b743ea9e85a82dbcf02b0c"
    "nl"
  end
  language "pa-IN" do
    sha256 "698461d000a3fd70eff0423cacfb5c63c682b2cb2b7cee9e9f8aba92217fe731"
    "pa-IN"
  end
  language "pl" do
    sha256 "c9253021254d578f510fa9ed9965040d20aa9b237d2d59846b2f2c949a5fce6c"
    "pl"
  end
  language "pt-BR" do
    sha256 "f67d10649c18f3d22d8e4f7164db6f3fc1a9f566d0125fba74a5b0f57afe9396"
    "pt-BR"
  end
  language "pt" do
    sha256 "c17f075e5969edf5e2d5c82a0cfe420340a17eb79ed721c44032513c422b0108"
    "pt-PT"
  end
  language "ru" do
    sha256 "5786967680cb365ec484a5f478e9b0683614db5d68d4d28a196219e372642419"
    "ru"
  end
  language "si" do
    sha256 "38ddf3c68ccc13e3496f0a8944f86159c8412e3567fb991917b6178142d332c2"
    "si"
  end
  language "sq" do
    sha256 "e42b9d1b8a3c83a4da25e8af91474e3e600cb9881a28bfd9dcee32e07205878b"
    "sq"
  end
  language "sr" do
    sha256 "47a66aa70a844b7e377d8e031f8a2b565407f762cfa2a809ce3bf4c587af799d"
    "sr"
  end
  language "sv" do
    sha256 "c804a80345bc4ccbd21e8e75c39a8623a8fd2eb9c1b7dcb64df89b3ef93041f8"
    "sv-SE"
  end
  language "ta" do
    sha256 "def85d117c4d62a302052e64df42812bdb0d806e1e2fef047eb143f06de27d90"
    "ta"
  end
  language "te" do
    sha256 "c30de8b3da3f7cb0953997e4b7250876e5eda4ca1ab9dabd5b3d2fa1e28380e8"
    "te"
  end
  language "th" do
    sha256 "7da9beb642c283bc319db77df2c9c2382a9d964a4be369c91736ee61ab618cf7"
    "th"
  end
  language "tl" do
    sha256 "6cbeae7a0d20921c3e952ae8af318efa03457bca7323465ac5306efaf476f7fe"
    "tl"
  end
  language "tr" do
    sha256 "80ecca29b97f05f0b3023b6bb94c7c03d8456744ddc2306b0ca13b8c9b95dbdf"
    "tr"
  end
  language "uk" do
    sha256 "0d5312ef5bfdf5e7cd73158109e3fc21bbec7a0b3a993e98cec96d7f14d9793b"
    "uk"
  end
  language "ur" do
    sha256 "ecb663d1b4eed2d6a91187812a8a808bc5df16c4dff7d815220e8db2dd132658"
    "ur"
  end
  language "zh-TW" do
    sha256 "abd2324c2616e4ac6d96802a220831da312178754b634002aae6474aeebd8b16"
    "zh-TW"
  end
  language "zh" do
    sha256 "6b393b2d1c97fb0c531d1f5f8fe1b60291dc2c9d1f59e97fd0149e6e3cd24401"
    "zh-CN"
  end

  url "https://download-installer.cdn.mozilla.net/pub/firefox/releases/#{version}esr/mac/#{language}/Firefox%20#{version}esr.dmg",
      verified: "download-installer.cdn.mozilla.net/pub/firefox/releases/"
  name "Mozilla Firefox ESR"
  name "Mozilla Firefox Extended Support Release"
  desc "Web browser"
  homepage "https://www.mozilla.org/en-US/firefox/all/#product-desktop-esr"

  livecheck do
    url "https://product-details.mozilla.org/1.0/firefox_versions.json"
    regex(/v?(\d+(?:\.\d+)+)/i)
    strategy :json do |json, regex|
      match = json["FIREFOX_ESR"]&.match(regex)
      next if match.blank?

      match[1]
    end
  end

  auto_updates true
  conflicts_with cask: [
    "firefox",
    "firefox@beta",
    "firefox@cn",
  ]
  depends_on :macos

  app "Firefox.app"

  uninstall quit:   "org.mozilla.firefox",
            delete: "/Library/Logs/DiagnosticReports/firefox_*"

  zap trash: [
        "~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/org.mozilla.firefox.sfl*",
        "~/Library/Application Support/CrashReporter/firefox_*",
        "~/Library/Application Support/Firefox",
        "~/Library/Caches/Firefox",
        "~/Library/Caches/Mozilla/updates/Applications/Firefox",
        "~/Library/Caches/org.mozilla.crashreporter",
        "~/Library/Caches/org.mozilla.firefox",
        "~/Library/Preferences/org.mozilla.crashreporter.plist",
        "~/Library/Preferences/org.mozilla.firefox.plist",
        "~/Library/Saved Application State/org.mozilla.firefox.savedState",
        "~/Library/WebKit/org.mozilla.firefox",
      ],
      rmdir: [
        "~/Library/Application Support/Mozilla", #  May also contain non-Firefox data
        "~/Library/Caches/Mozilla",
        "~/Library/Caches/Mozilla/updates",
        "~/Library/Caches/Mozilla/updates/Applications",
      ]
end
