From 053623bdaccfcb9353f1ed96b5e3aa033c6e6e27 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Tue, 14 Oct 2025 10:26:41 -0400 Subject: [PATCH] Refactor beacon runtime to design system modules --- package-lock.json | 41 -- package.json | 5 - scripts/build-beacon.mjs | 11 +- scripts/check-inline-styles.mjs | 4 - torrent/app.js | 907 ++++++++++++++++++++------------ torrent/beacon.html | 243 ++++++++- torrent/dist/beacon.js | 1 + torrent/dist/beacon.vendor.js | 84 --- torrent/src/beacon-vendor.js | 60 ++- torrent/ui/toastService.js | 8 +- torrent/ui/torrentTable.js | 303 +++++++---- torrent/views/full.html | 290 ---------- 12 files changed, 1069 insertions(+), 888 deletions(-) create mode 100644 torrent/dist/beacon.js delete mode 100644 torrent/dist/beacon.vendor.js delete mode 100644 torrent/views/full.html diff --git a/package-lock.json b/package-lock.json index cfbdb820..d33e39ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,11 +9,6 @@ "version": "1.0.0", "license": "GPL-3.0-or-later", "dependencies": { - "angular": "^1.8.3", - "angular-route": "^1.8.3", - "angular-sanitize": "^1.8.3", - "moment": "^2.30.1", - "ng-file-upload": "^12.2.13", "webtorrent": "^1.9.7" }, "devDependencies": { @@ -1028,27 +1023,6 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/angular": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/angular/-/angular-1.8.3.tgz", - "integrity": "sha512-5qjkWIQQVsHj4Sb5TcEs4WZWpFeVFHXwxEBHUhrny41D8UrBAd6T/6nPPAsLngJCReIOqi95W3mxdveveutpZw==", - "deprecated": "For the actively supported Angular, see https://www.npmjs.com/package/@angular/core. AngularJS support has officially ended. For extended AngularJS support options, see https://goo.gle/angularjs-path-forward.", - "license": "MIT" - }, - "node_modules/angular-route": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/angular-route/-/angular-route-1.8.3.tgz", - "integrity": "sha512-kpIcRmDR2+o1FxDVVYy8Rvfab86/7LDbOgTRb9T+X9ewPQiBRuDEnZtM3oJYBiQLvAXDYTJXHV48n/bGE9Mv2g==", - "deprecated": "For the actively supported Angular, see https://www.npmjs.com/package/@angular/core. AngularJS support has officially ended. For extended AngularJS support options, see https://goo.gle/angularjs-path-forward.", - "license": "MIT" - }, - "node_modules/angular-sanitize": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/angular-sanitize/-/angular-sanitize-1.8.3.tgz", - "integrity": "sha512-2rxdqzlUVafUeWOwvY/FtyWk1pFTyCtzreeiTytG9m4smpuAEKaIJAjYeVwWsoV+nlTOcgpwV4W1OCmR+BQbUg==", - "deprecated": "For the actively supported Angular, see https://www.npmjs.com/package/@angular/core. AngularJS support has officially ended. For extended AngularJS support options, see https://goo.gle/angularjs-path-forward.", - "license": "MIT" - }, "node_modules/ansi-regex": { "version": "6.2.2", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", @@ -3699,15 +3673,6 @@ "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", "license": "MIT" }, - "node_modules/moment": { - "version": "2.30.1", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", - "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==", - "license": "MIT", - "engines": { - "node": "*" - } - }, "node_modules/mp4-box-encoding": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/mp4-box-encoding/-/mp4-box-encoding-1.4.1.tgz", @@ -3788,12 +3753,6 @@ "integrity": "sha512-IXGPhl/yAiUU597gz+k5OYxYZkmLSWTcPPcpQjWABud9OK6m/ZNLrVdcEu4e7NgmOObFIhgZVg1jecPYT/6AoA==", "license": "MIT" }, - "node_modules/ng-file-upload": { - "version": "12.2.13", - "resolved": "https://registry.npmjs.org/ng-file-upload/-/ng-file-upload-12.2.13.tgz", - "integrity": "sha512-YFjxwmVcNssYc8hq8eCbtYSliPnrObozSZRC9yg4GoDtI0xGKUeHgEcOh+nsMF/9cTzMB/lQZAYdf29oyQgF0g==", - "license": "MIT" - }, "node_modules/node-gyp-build": { "version": "4.8.4", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz", diff --git a/package.json b/package.json index 7ce35295..d29bef65 100644 --- a/package.json +++ b/package.json @@ -37,11 +37,6 @@ }, "license": "GPL-3.0-or-later", "dependencies": { - "angular": "^1.8.3", - "angular-route": "^1.8.3", - "angular-sanitize": "^1.8.3", - "moment": "^2.30.1", - "ng-file-upload": "^12.2.13", "webtorrent": "^1.9.7" } } diff --git a/scripts/build-beacon.mjs b/scripts/build-beacon.mjs index ab6786d7..b85fd20a 100755 --- a/scripts/build-beacon.mjs +++ b/scripts/build-beacon.mjs @@ -10,19 +10,20 @@ const __dirname = path.dirname(__filename); const repoRoot = path.resolve(__dirname, ".."); const entryPoint = path.join(repoRoot, "torrent/src/beacon-vendor.js"); const outDir = path.join(repoRoot, "torrent/dist"); +const outFile = path.join(outDir, "beacon.js"); await mkdir(outDir, { recursive: true }); await build({ bundle: true, - entryPoints: { "beacon.vendor": entryPoint }, - outdir: outDir, - format: "iife", + entryPoints: [entryPoint], + outfile: outFile, + format: "esm", + splitting: false, platform: "browser", - target: ["es2019"], + target: ["es2020"], minify: true, sourcemap: false, - entryNames: "[name]", loader: { ".css": "css", ".woff": "dataurl", diff --git a/scripts/check-inline-styles.mjs b/scripts/check-inline-styles.mjs index 3bbdd516..d43aec48 100644 --- a/scripts/check-inline-styles.mjs +++ b/scripts/check-inline-styles.mjs @@ -40,10 +40,6 @@ const IGNORED_FILES = new Set([ ]); const VIOLATION_ALLOWLIST = new Map([ - [ - "torrent/dist/beacon.vendor.js", - new Set(["Direct .style usage", "style.cssText usage"]), - ], ["js/ui/utils/floatingPanelStyles.js", new Set(["Direct .style usage"])], ]); diff --git a/torrent/app.js b/torrent/app.js index 684125ce..ac10efbd 100644 --- a/torrent/app.js +++ b/torrent/app.js @@ -1,381 +1,624 @@ -/* global WebTorrent, angular, moment */ -import { registerBeaconToast } from "./ui/toastService.js"; -import { registerTorrentTable } from "./ui/torrentTable.js"; +import { createBeaconToast } from "./ui/toastService.js"; +import { createTorrentTable } from "./ui/torrentTable.js"; -const VERSION = "1.1"; +const VERSION = "2.0"; -// A smaller set of WebSocket trackers for reliability. -const trackers = [ +const TRACKERS = [ "wss://tracker.btorrent.xyz", "wss://tracker.openwebtorrent.com", ]; -// Basic torrent options. -const torrentOpts = { announce: trackers }; -const trackerOpts = { announce: trackers }; +const TORRENT_OPTIONS = { announce: TRACKERS }; +const TRACKER_OPTIONS = { announce: TRACKERS }; -// Simple debug logger. -function dbg(msg) { - console.log("[DEBUG]", msg); +function formatBytes(num, speed = false) { + if (typeof num !== "number" || Number.isNaN(num)) { + return ""; + } + + if (num < 1) { + return speed ? "" : "0 B"; + } + + const units = ["B", "kB", "MB", "GB", "TB"]; + const exponent = Math.min(Math.floor(Math.log(num) / Math.log(1000)), units.length - 1); + const value = (num / Math.pow(1000, exponent)).toFixed(1); + return `${value} ${units[exponent]}${speed ? "/s" : ""}`; } -// Create a WebTorrent client. -const client = new WebTorrent({ tracker: trackerOpts }); +function formatProgress(value) { + if (typeof value !== "number" || Number.isNaN(value)) { + return ""; + } -// Angular app definition. -const app = angular.module("BTorrent", ["ngRoute", "ngFileUpload"]); + return `${(value * 100).toFixed(1)}%`; +} -registerBeaconToast(app); -registerTorrentTable(app); +function formatRatio(value) { + if (typeof value !== "number" || !Number.isFinite(value)) { + return "0.00"; + } -// Configure Angular routes. -app.config([ - "$compileProvider", - "$locationProvider", - "$routeProvider", - function ($compileProvider, $locationProvider, $routeProvider) { - // Allow magnet, blob, etc. in Angular URLs. - $compileProvider.aHrefSanitizationWhitelist( - /^\s*(https?|magnet|blob|javascript):/ - ); - $locationProvider.html5Mode(false).hashPrefix(""); + return value.toFixed(2); +} - // Define basic routes. - $routeProvider - .when("/view", { - templateUrl: "views/view.html", - controller: "ViewCtrl", - }) - .when("/download", { - templateUrl: "views/download.html", - controller: "DownloadCtrl", - }) - .otherwise({ - templateUrl: "views/full.html", - controller: "FullCtrl", - }); - }, -]); +function torrentsMatch(a, b) { + if (!a || !b) { + return false; + } -// Warn user before they unload if torrents are still active. -app.run([ - "$rootScope", - function ($rootScope) { - window.addEventListener("beforeunload", (e) => { - if ($rootScope.client && $rootScope.client.torrents.length > 0) { - e.preventDefault(); - e.returnValue = - "Transfers are in progress. Are you sure you want to leave or refresh?"; - return e.returnValue; - } - }); - }, -]); + if (a === b) { + return true; + } -// Main BTorrent controller. -app.controller("BTorrentCtrl", [ - "$scope", - "$rootScope", - "$http", - "$log", - "beaconToast", - function ($scope, $rootScope, $http, $log, beaconToast) { - dbg("Starting app.js version " + VERSION); + if (a.infoHash && b.infoHash && a.infoHash === b.infoHash) { + return true; + } - if (!WebTorrent.WEBRTC_SUPPORT) { - beaconToast.error("Please use a browser with WebRTC support.", { sticky: true }); + if (a.magnetURI && b.magnetURI && a.magnetURI === b.magnetURI) { + return true; + } + + return false; +} + +function prepareTorrentFiles(torrent) { + if (!torrent || !Array.isArray(torrent.files)) { + return; + } + + torrent.files.forEach((file) => { + if (typeof file.priority !== "string") { + file.priority = "0"; } - $rootScope.client = client; - $rootScope.selectedTorrent = null; - $rootScope.processing = false; - - // Global error handler. - client.on("error", (err) => { - dbg("Torrent client error: " + err); - beaconToast.error(err.message || err); - $rootScope.processing = false; - }); - - /** - * Called whenever a new torrent is added or we seed files. - */ - $rootScope.onTorrent = function (torrent, isSeed) { - dbg("Torrent added: " + torrent.magnetURI); - $rootScope.processing = false; - - if (!isSeed) { - beaconToast.info(`Received ${torrent.name} metadata`); - } - if (!$rootScope.selectedTorrent) { - $rootScope.selectedTorrent = torrent; - } - - // Generate file.blobURL for direct downloading in the file table. - torrent.files.forEach((file) => { - file.getBlobURL((err, url) => { - if (!err) { - file.url = url; - } - }); + if (typeof file.getBlobURL === "function") { + file.getBlobURL((error, url) => { + if (error || !url) { + return; + } + file.url = url; }); - }; + } + }); - /** - * Add a magnet link or .torrent URL. - */ - $rootScope.addMagnet = function (magnet) { - if (!magnet) return; - $rootScope.processing = true; - dbg("Adding magnet: " + magnet); - client.add(magnet, torrentOpts, (torrent) => { - $rootScope.onTorrent(torrent, false); - $scope.$applyAsync(); + if (torrent.torrentFile && typeof Blob === "function" && typeof URL !== "undefined") { + try { + const blob = new Blob([torrent.torrentFile], { + type: "application/x-bittorrent", }); - }; - - /** - * Seed local files. - */ - $rootScope.seedFiles = function (files) { - if (!files || !files.length) return; - $rootScope.processing = true; - dbg(`Seeding ${files.length} file(s)`); - client.seed(files, torrentOpts, (torrent) => { - $rootScope.onTorrent(torrent, true); - $scope.$applyAsync(); - }); - }; - - /** - * Remove/destroy a selected torrent. - */ - $rootScope.destroyedTorrent = function (err) { - if (err) { - console.error("Failed to destroy torrent:", err); + torrent.torrentFileBlobURL = URL.createObjectURL(blob); + if (!torrent.fileName) { + const name = torrent.name || "download"; + torrent.fileName = `${name}.torrent`; } - dbg("Destroyed torrent", $rootScope.selectedTorrent); - $rootScope.selectedTorrent = null; - $rootScope.processing = false; - }; + } catch (error) { + console.warn("[beacon] Failed to create torrent blob URL", error); + } + } +} - /** - * Change the priority of an individual file (high, low, or don't download). - */ - $rootScope.changePriority = function (file) { - if (file.priority === "-1") { - file.deselect(); - dbg("Deselected file", file); +function setFilePriority(file, value) { + if (!file) { + return; + } + + const priorityValue = typeof value === "string" ? value : String(value ?? "0"); + file.priority = priorityValue; + + if (priorityValue === "-1") { + if (typeof file.deselect === "function") { + file.deselect(); + } + return; + } + + const numericPriority = Number.parseInt(priorityValue, 10); + if (!Number.isFinite(numericPriority)) { + return; + } + + if (typeof file.select === "function") { + file.select(numericPriority); + } +} + +function selectNextTorrent(current, torrents) { + if (!Array.isArray(torrents) || torrents.length === 0) { + return null; + } + + if (!current) { + return torrents[0]; + } + + const existing = torrents.find((torrent) => torrentsMatch(torrent, current)); + if (existing) { + return existing; + } + + return torrents[0]; +} + +export function createBeaconApp({ + documentRef = typeof document !== "undefined" ? document : null, + WebTorrentCtor, +} = {}) { + if (!documentRef) { + throw new Error("createBeaconApp requires a document reference"); + } + + const view = documentRef.defaultView || globalThis; + const WebTorrentClass = + typeof WebTorrentCtor === "function" + ? WebTorrentCtor + : typeof view?.WebTorrent === "function" + ? view.WebTorrent + : null; + + if (!WebTorrentClass) { + throw new Error("createBeaconApp requires a WebTorrent constructor"); + } + + const toast = createBeaconToast(documentRef); + const client = new WebTorrentClass({ tracker: TRACKER_OPTIONS }); + + const elements = { + form: documentRef.querySelector('[data-beacon="magnet-form"]'), + magnetInput: documentRef.querySelector('[data-beacon="magnet-input"]'), + seedButton: documentRef.querySelector('[data-beacon="seed-button"]'), + seedInput: documentRef.querySelector('[data-beacon="seed-input"]'), + tableRoot: documentRef.querySelector('[data-beacon="torrent-table"]'), + selectedSection: documentRef.querySelector('[data-beacon="selected"]'), + selectedName: documentRef.querySelector('[data-beacon="selected-name"]'), + pauseButton: documentRef.querySelector('[data-beacon-action="pause"]'), + resumeButton: documentRef.querySelector('[data-beacon-action="resume"]'), + downloadAllButton: documentRef.querySelector('[data-beacon-action="download-all"]'), + removeButton: documentRef.querySelector('[data-beacon-action="remove"]'), + copyMagnetButton: documentRef.querySelector('[data-beacon-action="copy-magnet"]'), + infoHashValue: documentRef.querySelector('[data-beacon="info-hash"]'), + fileList: documentRef.querySelector('[data-beacon="file-list"]'), + stats: documentRef.querySelector('[data-beacon="client-stats"]'), + overlay: documentRef.querySelector('[data-beacon="processing-overlay"]'), + }; + + const table = elements.tableRoot + ? createTorrentTable({ + documentRef, + root: elements.tableRoot, + formatters: { + bytes: (value, speed = false) => formatBytes(value, speed), + progress: (value) => formatProgress(value), + ratio: (value) => formatRatio(value), + integer: (value) => (typeof value === "number" && Number.isFinite(value) ? Math.floor(value).toString() : "0"), + bytesPerSecond: (value) => formatBytes(value, true), + }, + onSelect(torrent) { + state.selectedTorrent = torrent; + renderSelectedTorrent(); + }, + }) + : null; + + const state = { + selectedTorrent: null, + processing: false, + }; + + const cleanupTasks = []; + const intervalHandles = []; + + function addCleanup(task) { + cleanupTasks.push(task); + } + + function setProcessing(flag) { + state.processing = Boolean(flag); + if (elements.overlay) { + elements.overlay.hidden = !state.processing; + } + } + + function getTorrents() { + return Array.isArray(client.torrents) ? [...client.torrents] : []; + } + + function updateStats() { + if (!elements.stats) { + return; + } + + const download = formatBytes(client.downloadSpeed, true) || "0 B/s"; + const upload = formatBytes(client.uploadSpeed, true) || "0 B/s"; + const ratio = formatRatio(client.ratio); + + elements.stats.textContent = `Client stats: ↓ ${download} · ↑ ${upload} · Ratio: ${ratio}`; + } + + function renderFileList(torrent) { + if (!elements.fileList) { + return; + } + + elements.fileList.innerHTML = ""; + if (!torrent || !Array.isArray(torrent.files) || !torrent.files.length) { + return; + } + + torrent.files.forEach((file, index) => { + const row = documentRef.createElement("tr"); + row.className = "align-top"; + + const nameCell = documentRef.createElement("td"); + nameCell.className = "px-3 py-2"; + if (file.done && file.url) { + const link = documentRef.createElement("a"); + link.className = "text-info hover:text-info-strong"; + link.href = file.url; + link.download = file.name || `file-${index + 1}`; + link.textContent = file.name || `File ${index + 1}`; + nameCell.appendChild(link); } else { - file.select(file.priority); - dbg(`Selected with priority ${file.priority}`, file); + const span = documentRef.createElement("span"); + span.textContent = file.name || `File ${index + 1}`; + nameCell.appendChild(span); } - }; + row.appendChild(nameCell); - /** - * Download all files in the selected torrent if it's 100% done. - * Creates a blob for each file, triggers a native download with . - */ - $rootScope.downloadAll = function (torrent) { - if (!torrent) return; - if (torrent.progress < 1) { - alert("Torrent is not finished downloading yet."); + const sizeCell = documentRef.createElement("td"); + sizeCell.className = "px-3 py-2 text-muted-strong"; + sizeCell.textContent = formatBytes(file.length) || "0 B"; + row.appendChild(sizeCell); + + const priorityCell = documentRef.createElement("td"); + priorityCell.className = "px-3 py-2"; + const select = documentRef.createElement("select"); + select.className = "select"; + select.name = `${file.name || `file-${index + 1}`}-priority`; + select.setAttribute("aria-label", `Set priority for ${file.name || `file ${index + 1}`}`); + + const options = [ + { value: "1", label: "High priority" }, + { value: "0", label: "Low priority" }, + { value: "-1", label: "Don't download" }, + ]; + + options.forEach((option) => { + const optionEl = documentRef.createElement("option"); + optionEl.value = option.value; + optionEl.textContent = option.label; + if (option.value === file.priority) { + optionEl.selected = true; + } + select.appendChild(optionEl); + }); + + select.value = file.priority ?? "0"; + select.addEventListener("change", (event) => { + setFilePriority(file, event.target.value); + }); + + priorityCell.appendChild(select); + row.appendChild(priorityCell); + + elements.fileList.appendChild(row); + }); + } + + function renderSelectedTorrent() { + if (!elements.selectedSection) { + return; + } + + const torrents = getTorrents(); + state.selectedTorrent = selectNextTorrent(state.selectedTorrent, torrents); + + const torrent = state.selectedTorrent; + elements.selectedSection.hidden = !torrent; + + if (!torrent) { + return; + } + + if (elements.selectedName) { + elements.selectedName.textContent = torrent.name || "Untitled torrent"; + } + + if (elements.pauseButton) { + elements.pauseButton.hidden = torrent.paused === true; + elements.pauseButton.disabled = torrent.paused === true; + } + + if (elements.resumeButton) { + elements.resumeButton.hidden = torrent.paused !== true; + elements.resumeButton.disabled = torrent.paused !== true; + } + + if (elements.downloadAllButton) { + elements.downloadAllButton.disabled = !(torrent.progress >= 1); + } + + if (elements.infoHashValue) { + elements.infoHashValue.textContent = torrent.infoHash || ""; + } + + renderFileList(torrent); + } + + function handleTorrentReady(torrent, { isSeed = false } = {}) { + setProcessing(false); + prepareTorrentFiles(torrent); + + if (!isSeed) { + toast.info(`Received ${torrent.name || "torrent"} metadata`); + } + + if (!state.selectedTorrent) { + state.selectedTorrent = torrent; + } + + renderSelectedTorrent(); + table?.render(getTorrents(), state.selectedTorrent); + } + + function addMagnet(magnet) { + const trimmed = typeof magnet === "string" ? magnet.trim() : ""; + if (!trimmed) { + return; + } + + setProcessing(true); + client.add(trimmed, TORRENT_OPTIONS, (torrent) => { + handleTorrentReady(torrent, { isSeed: false }); + }); + } + + function seedFiles(files) { + if (!Array.isArray(files) || files.length === 0) { + return; + } + + setProcessing(true); + client.seed(files, TORRENT_OPTIONS, (torrent) => { + handleTorrentReady(torrent, { isSeed: true }); + toast.success(`Seeding ${torrent.files.length} file(s)`); + }); + } + + function downloadAll(torrent) { + if (!torrent) { + return; + } + + if (torrent.progress < 1) { + toast.warn("Torrent is not finished downloading yet."); + return; + } + + torrent.files.forEach((file) => { + if (typeof file.getBlob !== "function") { return; } - torrent.files.forEach((file) => { - file.getBlob((err, blob) => { - if (err) { - console.error("Failed to get blob for file:", file.name, err); - return; - } - // Create an anchor to trigger the download. - const blobUrl = URL.createObjectURL(blob); - const a = document.createElement("a"); - a.classList.add("beacon-hidden-download"); - a.setAttribute("data-beacon-hidden-download", "true"); - a.href = blobUrl; - a.download = file.name; - // Append, click, remove, revoke. - document.body.appendChild(a); - a.click(); - document.body.removeChild(a); - URL.revokeObjectURL(blobUrl); - }); - }); - }; - /** - * Copy the magnet URI of a torrent to the clipboard. - */ - $rootScope.copyMagnetURI = function (torrent) { - if (!torrent || !torrent.magnetURI) return; - const magnetURI = torrent.magnetURI; - if (navigator.clipboard && navigator.clipboard.writeText) { - navigator.clipboard - .writeText(magnetURI) - .then(() => - beaconToast.success("Magnet URI copied to clipboard!") - ) - .catch((err) => { - console.error("Clipboard error:", err); - beaconToast.error("Failed to copy magnet URI"); - }); - } else { - try { - const textarea = document.createElement("textarea"); - textarea.value = magnetURI; - textarea.classList.add("beacon-clipboard-offscreen"); - textarea.setAttribute("data-beacon-clipboard-state", "offscreen"); - document.body.appendChild(textarea); - textarea.select(); - document.execCommand("copy"); - document.body.removeChild(textarea); - beaconToast.success("Magnet URI copied (fallback)!"); - } catch (err) { - console.error("Clipboard fallback error:", err); - beaconToast.error("Failed to copy magnet URI"); + file.getBlob((err, blob) => { + if (err || !blob) { + console.error("[beacon] Failed to get blob for file", file?.name, err); + toast.error("Failed to prepare file for download."); + return; } - } - }; - /** - * Save the .torrent file itself (via torrent.torrentFileBlobURL). - */ - $rootScope.saveTorrentFile = function (torrent) { - if (!torrent || !torrent.torrentFileBlobURL) return; - const fileName = torrent.fileName || `${torrent.name}.torrent`; - // Create a hidden to force download of the .torrent file. - const a = document.createElement("a"); - a.classList.add("beacon-hidden-download"); - a.setAttribute("data-beacon-hidden-download", "true"); - a.href = torrent.torrentFileBlobURL; - a.download = fileName; - document.body.appendChild(a); - a.click(); - document.body.removeChild(a); - }; - }, -]); + const blobUrl = URL.createObjectURL(blob); + const anchor = documentRef.createElement("a"); + anchor.className = "beacon-hidden-download"; + anchor.setAttribute("data-beacon-hidden-download", "true"); + anchor.href = blobUrl; + anchor.download = file.name || "download"; + documentRef.body.appendChild(anchor); + anchor.click(); + documentRef.body.removeChild(anchor); + URL.revokeObjectURL(blobUrl); + }); + }); + } -// FullCtrl: handles the magnet input and torrent table for /full route. -app.controller("FullCtrl", [ - "$scope", - "$rootScope", - "$location", - "$interval", - function ($scope, $rootScope, $location, $interval) { - // Handle magnet input - $scope.addMagnet = function () { - $rootScope.addMagnet($scope.torrentInput); - $scope.torrentInput = ""; - }; - - // If we have a #magnet in the URL, add it automatically - if ($location.hash()) { - $rootScope.addMagnet($location.hash()); + function copyMagnet(torrent) { + if (!torrent?.magnetURI) { + return; } - const syncTorrents = () => { - const torrents = ($rootScope.client && $rootScope.client.torrents) || []; - $scope.torrentRows = torrents; + const magnet = torrent.magnetURI; + const clipboard = view?.navigator?.clipboard; - if ($rootScope.selectedTorrent) { - const stillPresent = torrents.some((torrent) => { - return ( - torrent === $rootScope.selectedTorrent || - (torrent?.magnetURI && - torrent.magnetURI === $rootScope.selectedTorrent.magnetURI) || - (torrent?.infoHash && - torrent.infoHash === $rootScope.selectedTorrent.infoHash) - ); + if (clipboard && typeof clipboard.writeText === "function") { + clipboard + .writeText(magnet) + .then(() => { + toast.success("Magnet URI copied to clipboard!"); + }) + .catch((error) => { + console.error("[beacon] Clipboard error", error); + toast.error("Failed to copy magnet URI"); }); + return; + } - if (!stillPresent) { - $rootScope.selectedTorrent = torrents[0] || null; - } - } else if (torrents.length) { - $rootScope.selectedTorrent = torrents[0]; + try { + const textarea = documentRef.createElement("textarea"); + textarea.value = magnet; + textarea.className = "beacon-clipboard-offscreen"; + textarea.setAttribute("data-beacon-clipboard-state", "offscreen"); + documentRef.body.appendChild(textarea); + textarea.select(); + documentRef.execCommand?.("copy"); + documentRef.body.removeChild(textarea); + toast.success("Magnet URI copied (fallback)!"); + } catch (error) { + console.error("[beacon] Clipboard fallback error", error); + toast.error("Failed to copy magnet URI"); + } + } + + function removeTorrent(torrent) { + if (!torrent) { + return; + } + + torrent.destroy((error) => { + if (error) { + console.error("[beacon] Failed to destroy torrent", error); + toast.error("Failed to remove torrent"); } + + const torrents = getTorrents(); + state.selectedTorrent = selectNextTorrent(null, torrents); + table?.render(torrents, state.selectedTorrent); + renderSelectedTorrent(); + }); + } + + function mount() { + console.log(`[beacon] Starting beacon runtime v${VERSION}`); + + if (!toast) { + console.warn("[beacon] Toast service unavailable"); + } + + if (!WebTorrentClass.WEBRTC_SUPPORT) { + toast?.error("Please use a browser with WebRTC support.", { sticky: true }); + } + + if (elements.form) { + const submitHandler = (event) => { + event.preventDefault(); + addMagnet(elements.magnetInput?.value || ""); + if (elements.magnetInput) { + elements.magnetInput.value = ""; + } + }; + elements.form.addEventListener("submit", submitHandler); + addCleanup(() => elements.form.removeEventListener("submit", submitHandler)); + } + + if (elements.seedButton && elements.seedInput) { + const seedClickHandler = () => { + elements.seedInput.click(); + }; + const seedChangeHandler = () => { + const files = Array.from(elements.seedInput.files || []); + elements.seedInput.value = ""; + seedFiles(files); + }; + elements.seedButton.addEventListener("click", seedClickHandler); + elements.seedInput.addEventListener("change", seedChangeHandler); + addCleanup(() => { + elements.seedButton.removeEventListener("click", seedClickHandler); + elements.seedInput.removeEventListener("change", seedChangeHandler); + }); + } + + if (elements.pauseButton) { + const handler = () => { + if (state.selectedTorrent && typeof state.selectedTorrent.pause === "function") { + state.selectedTorrent.pause(); + renderSelectedTorrent(); + } + }; + elements.pauseButton.addEventListener("click", handler); + addCleanup(() => elements.pauseButton.removeEventListener("click", handler)); + } + + if (elements.resumeButton) { + const handler = () => { + if (state.selectedTorrent && typeof state.selectedTorrent.resume === "function") { + state.selectedTorrent.resume(); + renderSelectedTorrent(); + } + }; + elements.resumeButton.addEventListener("click", handler); + addCleanup(() => elements.resumeButton.removeEventListener("click", handler)); + } + + if (elements.downloadAllButton) { + const handler = () => downloadAll(state.selectedTorrent); + elements.downloadAllButton.addEventListener("click", handler); + addCleanup(() => elements.downloadAllButton.removeEventListener("click", handler)); + } + + if (elements.removeButton) { + const handler = () => removeTorrent(state.selectedTorrent); + elements.removeButton.addEventListener("click", handler); + addCleanup(() => elements.removeButton.removeEventListener("click", handler)); + } + + if (elements.copyMagnetButton) { + const handler = () => copyMagnet(state.selectedTorrent); + elements.copyMagnetButton.addEventListener("click", handler); + addCleanup(() => elements.copyMagnetButton.removeEventListener("click", handler)); + } + + const errorHandler = (error) => { + console.error("[beacon] Torrent client error", error); + toast?.error(error?.message || String(error)); + setProcessing(false); }; + client.on("error", errorHandler); + addCleanup(() => client.removeListener("error", errorHandler)); - $scope.selectTorrent = function (torrent) { - $rootScope.selectedTorrent = torrent; + const beforeUnloadHandler = (event) => { + if (client.torrents && client.torrents.length > 0) { + event.preventDefault(); + event.returnValue = + "Transfers are in progress. Are you sure you want to leave or refresh?"; + return event.returnValue; + } + return undefined; }; + if (view && typeof view.addEventListener === "function") { + view.addEventListener("beforeunload", beforeUnloadHandler); + addCleanup(() => view.removeEventListener("beforeunload", beforeUnloadHandler)); + } - syncTorrents(); - const poller = $interval(syncTorrents, 1000); + table?.render(getTorrents(), state.selectedTorrent); + renderSelectedTorrent(); + updateStats(); + setProcessing(false); - $scope.$on("$destroy", function () { - if (poller) { - $interval.cancel(poller); + const intervalId = view.setInterval(() => { + table?.render(getTorrents(), state.selectedTorrent); + renderSelectedTorrent(); + updateStats(); + }, 1000); + intervalHandles.push(intervalId); + + const hash = view?.location?.hash; + if (typeof hash === "string" && hash.length > 1) { + addMagnet(hash.slice(1)); + } + } + + function destroy() { + intervalHandles.forEach((id) => view.clearInterval(id)); + intervalHandles.length = 0; + + cleanupTasks.forEach((task) => { + try { + task(); + } catch (error) { + console.warn("[beacon] Cleanup task failed", error); } }); - }, -]); + cleanupTasks.length = 0; -// DownloadCtrl / ViewCtrl are minimal in this example. -app.controller("DownloadCtrl", [ - "$scope", - "$rootScope", - "$location", - function ($scope, $rootScope, $location) { - $scope.addMagnet = function () { - $rootScope.addMagnet($scope.torrentInput); - $scope.torrentInput = ""; - }; - if ($location.hash()) { - $rootScope.addMagnet($location.hash()); + table?.destroy(); + + try { + client.destroy(); + } catch (error) { + console.warn("[beacon] Failed to destroy client", error); } - }, -]); + } -app.controller("ViewCtrl", [ - "$scope", - "$rootScope", - "$location", - function ($scope, $rootScope, $location) { - $scope.addMagnet = function () { - $rootScope.addMagnet($scope.torrentInput); - $scope.torrentInput = ""; - }; - if ($location.hash()) { - $rootScope.addMagnet($location.hash()); - } - }, -]); + return { mount, destroy }; +} -// Angular filters for size, progress, etc. -app.filter("pbytes", function () { - return function (num, speed) { - if (isNaN(num)) return ""; - if (num < 1) return speed ? "" : "0 B"; - const units = ["B", "kB", "MB", "GB", "TB"]; - const exponent = Math.min(Math.floor(Math.log(num) / Math.log(1000)), 4); - const val = (num / Math.pow(1000, exponent)).toFixed(1) * 1; - return `${val} ${units[exponent]}${speed ? "/s" : ""}`; - }; -}); - -app.filter("progress", function () { - return function (val) { - if (typeof val !== "number") return ""; - return (val * 100).toFixed(1) + "%"; - }; -}); - -app.filter("html", [ - "$sce", - function ($sce) { - return function (input) { - return $sce.trustAsHtml(input); - }; - }, -]); - -app.filter("humanTime", function () { - return function (millis) { - if (millis < 1000) return ""; - const duration = moment.duration(millis).humanize(); - return duration.charAt(0).toUpperCase() + duration.slice(1); - }; -}); +export default createBeaconApp; diff --git a/torrent/beacon.html b/torrent/beacon.html index 2a8ae261..1102fa9a 100644 --- a/torrent/beacon.html +++ b/torrent/beacon.html @@ -1,5 +1,5 @@ - + @@ -13,20 +13,16 @@ content="bitvid, client, webtorrent, browser, torrent, stream, bittorrent, torrenting, sharing, filesharing" /> - - - - + + - - - +
- -
-
+
+
+
+
+ + +
+ +
+ + + + + +
+
+
+ +
+
+
+ + + +
+ Client stats: ↓ 0 B/s · ↑ 0 B/s · Ratio: 0.00 +
+
- - - - diff --git a/torrent/dist/beacon.js b/torrent/dist/beacon.js new file mode 100644 index 00000000..7a36c52d --- /dev/null +++ b/torrent/dist/beacon.js @@ -0,0 +1 @@ +var O={info:"torrent-toast torrent-toast--info",success:"torrent-toast torrent-toast--success",error:"torrent-toast torrent-toast--error",warn:"torrent-toast torrent-toast--warn"},V="transition duration-200 ease-out",Y="beacon-toast-motion",q="data-beacon-motion";function J(e,t){let a=e?.defaultView;if(a&&typeof a.requestAnimationFrame=="function"){a.requestAnimationFrame(t);return}setTimeout(t,16)}function Q(e){let t=e||(typeof document<"u"?document:null);if(!t)return null;let a=t.getElementById("beacon-toast-container");if(!a){a=t.createElement("div"),a.id="beacon-toast-container",a.setAttribute("role","region"),a.setAttribute("aria-live","polite"),a.className=["pointer-events-none","fixed","inset-x-0","top-4","z-[70]","flex","flex-col","items-center","gap-3","px-4"].join(" ");let i=t.body||t.getElementsByTagName?.("body")?.[0];i&&i.appendChild(a)}return a}function X(e,t,a){let i=e.createElement("div");i.className=[V,a].join(" "),i.setAttribute("role","status"),i.setAttribute("tabindex","0"),i.textContent=t;let o=e.createElement("button");o.type="button",o.className=["absolute","right-3","top-3","rounded","p-1","text-current/70","hover:text-current","focus-visible:outline","focus-visible:outline-2","focus-visible:outline-offset-2","focus-visible:outline-info"].join(" "),o.setAttribute("aria-label","Dismiss notification"),o.innerHTML='';let d=e.createElement("div");return d.className=["relative","w-full",V,Y].join(" "),d.setAttribute(q,"exit"),d.appendChild(i),i.appendChild(o),{wrapper:d,toast:i,closeButton:o}}function Z(e,t=setTimeout,a=clearTimeout){return{show(i,o={}){if(!i)return;let d=o.type&&O[o.type]?o.type:"info",n=Q(e);if(!n)return;let{wrapper:m,toast:c,closeButton:T}=X(e,i,O[d]);n.appendChild(m),J(e,()=>{m.setAttribute(q,"enter")});let w=typeof o.duration=="number"?o.duration:3500,p=()=>{m.setAttribute(q,"exit");let S=t(()=>{m.parentNode&&m.parentNode.removeChild(m)},200);return T.removeEventListener("click",E),c.removeEventListener("keydown",h),T.removeEventListener("keydown",h),S},E=()=>p(),h=S=>{S.key==="Escape"&&(S.stopPropagation(),p())};T.addEventListener("click",E),c.addEventListener("keydown",h),T.addEventListener("keydown",h);let N=null;return o.sticky||(N=t(()=>{p()},w)),{dismiss(){N&&a(N),p()}}},set(i,o){return typeof o=="string"?this.show(i,{type:o}):this.show(i,o)},info(i,o={}){return this.show(i,{...o,type:"info"})},success(i,o={}){return this.show(i,{...o,type:"success"})},error(i,o={}){return this.show(i,{...o,type:"error"})},warn(i,o={}){return this.show(i,{...o,type:"warn"})}}}function R(e,t=setTimeout,a=clearTimeout){return Z(e,t,a)}var $=[{key:"name",label:"Name",headerClass:"w-full sm:w-1/3 text-left",cellClass:"font-medium text-text truncate"},{key:"progress",label:"Progress",headerClass:"w-24 text-right",cellClass:"tabular-nums text-right",formatter:"progress"},{key:"downloadSpeed",label:"\u2193 Speed",headerClass:"w-24 text-right",cellClass:"tabular-nums text-right",formatter:"bytesPerSecond"},{key:"uploadSpeed",label:"\u2191 Speed",headerClass:"w-24 text-right",cellClass:"tabular-nums text-right",formatter:"bytesPerSecond"},{key:"numPeers",label:"Peers",headerClass:"w-20 text-right",cellClass:"tabular-nums text-right",formatter:"integer"},{key:"ratio",label:"Ratio",headerClass:"w-20 text-right",cellClass:"tabular-nums text-right",formatter:"ratio"}];function ee(e){return e?e.infoHash||e.magnetURI||e.name||String(Math.random()):""}function te(e,t){return!e||!t?!1:e===t||e.magnetURI&&e.magnetURI===t.magnetURI||e.infoHash&&e.infoHash===t.infoHash}function ne(e){return typeof e!="number"||Number.isNaN(e)?"":`${(e*100).toFixed(1)}%`}function re(e){return typeof e!="number"||!Number.isFinite(e)?"0.00":e.toFixed(2)}function oe(e){return typeof e!="number"||!Number.isFinite(e)?"0":Math.max(0,Math.floor(e)).toString()}function ae(e,t){if(typeof t=="function")return t(e,!0)||"";if(typeof e!="number"||Number.isNaN(e)||e<1)return"";let a=["B","kB","MB","GB","TB"],i=Math.min(Math.floor(Math.log(e)/Math.log(1e3)),a.length-1);return`${(e/Math.pow(1e3,i)).toFixed(1)} ${a[i]}/s`}function se(e,t){let a=e.formatter;if(typeof a=="function")return a;let i=t?.[a];if(typeof i=="function")return i;switch(a){case"progress":return ne;case"ratio":return re;case"integer":return oe;case"bytesPerSecond":return o=>ae(o,t?.bytes);default:return o=>o}}function W({documentRef:e=typeof document<"u"?document:null,root:t,onSelect:a,formatters:i={}}={}){if(!e)throw new Error("createTorrentTable requires a document reference");if(!(t instanceof e.defaultView.HTMLElement))throw new Error("createTorrentTable requires a valid root element");let o=e;t.innerHTML="";let d=o.createElement("div");d.className="overflow-hidden rounded-xl border border-border-translucent bg-surface shadow-sm";let n=o.createElement("div");n.className="overflow-x-auto",d.appendChild(n);let m=o.createElement("table");m.className="min-w-full divide-y divide-border-translucent text-sm",n.appendChild(m);let c=o.createElement("thead");c.className="bg-surface-alt text-muted-strong";let T=o.createElement("tr");$.forEach(y=>{let x=o.createElement("th");x.setAttribute("scope","col"),x.className="px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide",y.headerClass&&(x.className+=` ${y.headerClass}`),x.textContent=y.label,T.appendChild(x)}),c.appendChild(T),m.appendChild(c);let w=o.createElement("tbody");w.className="divide-y divide-border-translucent",m.appendChild(w);let p=o.createElement("tbody"),E=o.createElement("tr"),h=o.createElement("td");h.className="px-4 py-8 text-center text-sm text-muted",h.colSpan=$.length,h.textContent="No active torrents yet. Add a magnet link to get started.",E.appendChild(h),p.appendChild(E),m.appendChild(p),t.appendChild(d);function N(y=[],x=null){let k=Array.isArray(y)?y:[];if(w.innerHTML="",!k.length){w.hidden=!0,p.hidden=!1;return}w.hidden=!1,p.hidden=!0;for(let B of k){let v=o.createElement("tr");v.className=["group","align-middle","cursor-pointer","transition","hover:bg-panel-hover","focus-visible:outline","focus-visible:outline-2","focus-visible:outline-offset-2","focus-visible:outline-info"].join(" "),v.setAttribute("role","button"),v.setAttribute("tabindex","0"),v.dataset.torrentId=ee(B),te(x,B)?(v.classList.add("bg-info/10","text-text"),v.setAttribute("aria-pressed","true")):v.setAttribute("aria-pressed","false"),v.addEventListener("click",()=>{typeof a=="function"&&a(B)}),v.addEventListener("keydown",C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),typeof a=="function"&&a(B))}),$.forEach(C=>{let A=o.createElement("td");A.className="px-4 py-3",C.cellClass&&(A.className+=` ${C.cellClass}`);let H=B?B[C.key]:void 0,r=se(C,i)(H,B,C),s=o.createElement("span");s.textContent=r==null?"":String(r),A.appendChild(s),v.appendChild(A)}),w.appendChild(v)}}function S(){t.innerHTML=""}return{render:N,destroy:S}}var ie="2.0",z=["wss://tracker.btorrent.xyz","wss://tracker.openwebtorrent.com"],j={announce:z},le={announce:z};function M(e,t=!1){if(typeof e!="number"||Number.isNaN(e))return"";if(e<1)return t?"":"0 B";let a=["B","kB","MB","GB","TB"],i=Math.min(Math.floor(Math.log(e)/Math.log(1e3)),a.length-1);return`${(e/Math.pow(1e3,i)).toFixed(1)} ${a[i]}${t?"/s":""}`}function ce(e){return typeof e!="number"||Number.isNaN(e)?"":`${(e*100).toFixed(1)}%`}function _(e){return typeof e!="number"||!Number.isFinite(e)?"0.00":e.toFixed(2)}function de(e,t){return!e||!t?!1:!!(e===t||e.infoHash&&t.infoHash&&e.infoHash===t.infoHash||e.magnetURI&&t.magnetURI&&e.magnetURI===t.magnetURI)}function ue(e){if(!(!e||!Array.isArray(e.files))&&(e.files.forEach(t=>{typeof t.priority!="string"&&(t.priority="0"),typeof t.getBlobURL=="function"&&t.getBlobURL((a,i)=>{a||!i||(t.url=i)})}),e.torrentFile&&typeof Blob=="function"&&typeof URL<"u"))try{let t=new Blob([e.torrentFile],{type:"application/x-bittorrent"});if(e.torrentFileBlobURL=URL.createObjectURL(t),!e.fileName){let a=e.name||"download";e.fileName=`${a}.torrent`}}catch(t){console.warn("[beacon] Failed to create torrent blob URL",t)}}function fe(e,t){if(!e)return;let a=typeof t=="string"?t:String(t??"0");if(e.priority=a,a==="-1"){typeof e.deselect=="function"&&e.deselect();return}let i=Number.parseInt(a,10);Number.isFinite(i)&&typeof e.select=="function"&&e.select(i)}function D(e,t){if(!Array.isArray(t)||t.length===0)return null;if(!e)return t[0];let a=t.find(i=>de(i,e));return a||t[0]}function G({documentRef:e=typeof document<"u"?document:null,WebTorrentCtor:t}={}){if(!e)throw new Error("createBeaconApp requires a document reference");let a=e.defaultView||globalThis,i=typeof t=="function"?t:typeof a?.WebTorrent=="function"?a.WebTorrent:null;if(!i)throw new Error("createBeaconApp requires a WebTorrent constructor");let o=R(e),d=new i({tracker:le}),n={form:e.querySelector('[data-beacon="magnet-form"]'),magnetInput:e.querySelector('[data-beacon="magnet-input"]'),seedButton:e.querySelector('[data-beacon="seed-button"]'),seedInput:e.querySelector('[data-beacon="seed-input"]'),tableRoot:e.querySelector('[data-beacon="torrent-table"]'),selectedSection:e.querySelector('[data-beacon="selected"]'),selectedName:e.querySelector('[data-beacon="selected-name"]'),pauseButton:e.querySelector('[data-beacon-action="pause"]'),resumeButton:e.querySelector('[data-beacon-action="resume"]'),downloadAllButton:e.querySelector('[data-beacon-action="download-all"]'),removeButton:e.querySelector('[data-beacon-action="remove"]'),copyMagnetButton:e.querySelector('[data-beacon-action="copy-magnet"]'),infoHashValue:e.querySelector('[data-beacon="info-hash"]'),fileList:e.querySelector('[data-beacon="file-list"]'),stats:e.querySelector('[data-beacon="client-stats"]'),overlay:e.querySelector('[data-beacon="processing-overlay"]')},m=n.tableRoot?W({documentRef:e,root:n.tableRoot,formatters:{bytes:(r,s=!1)=>M(r,s),progress:r=>ce(r),ratio:r=>_(r),integer:r=>typeof r=="number"&&Number.isFinite(r)?Math.floor(r).toString():"0",bytesPerSecond:r=>M(r,!0)},onSelect(r){c.selectedTorrent=r,y()}}):null,c={selectedTorrent:null,processing:!1},T=[],w=[];function p(r){T.push(r)}function E(r){c.processing=!!r,n.overlay&&(n.overlay.hidden=!c.processing)}function h(){return Array.isArray(d.torrents)?[...d.torrents]:[]}function N(){if(!n.stats)return;let r=M(d.downloadSpeed,!0)||"0 B/s",s=M(d.uploadSpeed,!0)||"0 B/s",f=_(d.ratio);n.stats.textContent=`Client stats: \u2193 ${r} \xB7 \u2191 ${s} \xB7 Ratio: ${f}`}function S(r){n.fileList&&(n.fileList.innerHTML="",!(!r||!Array.isArray(r.files)||!r.files.length)&&r.files.forEach((s,f)=>{let u=e.createElement("tr");u.className="align-top";let l=e.createElement("td");if(l.className="px-3 py-2",s.done&&s.url){let g=e.createElement("a");g.className="text-info hover:text-info-strong",g.href=s.url,g.download=s.name||`file-${f+1}`,g.textContent=s.name||`File ${f+1}`,l.appendChild(g)}else{let g=e.createElement("span");g.textContent=s.name||`File ${f+1}`,l.appendChild(g)}u.appendChild(l);let b=e.createElement("td");b.className="px-3 py-2 text-muted-strong",b.textContent=M(s.length)||"0 B",u.appendChild(b);let I=e.createElement("td");I.className="px-3 py-2";let L=e.createElement("select");L.className="select",L.name=`${s.name||`file-${f+1}`}-priority`,L.setAttribute("aria-label",`Set priority for ${s.name||`file ${f+1}`}`),[{value:"1",label:"High priority"},{value:"0",label:"Low priority"},{value:"-1",label:"Don't download"}].forEach(g=>{let U=e.createElement("option");U.value=g.value,U.textContent=g.label,g.value===s.priority&&(U.selected=!0),L.appendChild(U)}),L.value=s.priority??"0",L.addEventListener("change",g=>{fe(s,g.target.value)}),I.appendChild(L),u.appendChild(I),n.fileList.appendChild(u)}))}function y(){if(!n.selectedSection)return;let r=h();c.selectedTorrent=D(c.selectedTorrent,r);let s=c.selectedTorrent;n.selectedSection.hidden=!s,s&&(n.selectedName&&(n.selectedName.textContent=s.name||"Untitled torrent"),n.pauseButton&&(n.pauseButton.hidden=s.paused===!0,n.pauseButton.disabled=s.paused===!0),n.resumeButton&&(n.resumeButton.hidden=s.paused!==!0,n.resumeButton.disabled=s.paused!==!0),n.downloadAllButton&&(n.downloadAllButton.disabled=!(s.progress>=1)),n.infoHashValue&&(n.infoHashValue.textContent=s.infoHash||""),S(s))}function x(r,{isSeed:s=!1}={}){E(!1),ue(r),s||o.info(`Received ${r.name||"torrent"} metadata`),c.selectedTorrent||(c.selectedTorrent=r),y(),m?.render(h(),c.selectedTorrent)}function k(r){let s=typeof r=="string"?r.trim():"";s&&(E(!0),d.add(s,j,f=>{x(f,{isSeed:!1})}))}function B(r){!Array.isArray(r)||r.length===0||(E(!0),d.seed(r,j,s=>{x(s,{isSeed:!0}),o.success(`Seeding ${s.files.length} file(s)`)}))}function v(r){if(r){if(r.progress<1){o.warn("Torrent is not finished downloading yet.");return}r.files.forEach(s=>{typeof s.getBlob=="function"&&s.getBlob((f,u)=>{if(f||!u){console.error("[beacon] Failed to get blob for file",s?.name,f),o.error("Failed to prepare file for download.");return}let l=URL.createObjectURL(u),b=e.createElement("a");b.className="beacon-hidden-download",b.setAttribute("data-beacon-hidden-download","true"),b.href=l,b.download=s.name||"download",e.body.appendChild(b),b.click(),e.body.removeChild(b),URL.revokeObjectURL(l)})})}}function C(r){if(!r?.magnetURI)return;let s=r.magnetURI,f=a?.navigator?.clipboard;if(f&&typeof f.writeText=="function"){f.writeText(s).then(()=>{o.success("Magnet URI copied to clipboard!")}).catch(u=>{console.error("[beacon] Clipboard error",u),o.error("Failed to copy magnet URI")});return}try{let u=e.createElement("textarea");u.value=s,u.className="beacon-clipboard-offscreen",u.setAttribute("data-beacon-clipboard-state","offscreen"),e.body.appendChild(u),u.select(),e.execCommand?.("copy"),e.body.removeChild(u),o.success("Magnet URI copied (fallback)!")}catch(u){console.error("[beacon] Clipboard fallback error",u),o.error("Failed to copy magnet URI")}}function A(r){r&&r.destroy(s=>{s&&(console.error("[beacon] Failed to destroy torrent",s),o.error("Failed to remove torrent"));let f=h();c.selectedTorrent=D(null,f),m?.render(f,c.selectedTorrent),y()})}function H(){if(console.log(`[beacon] Starting beacon runtime v${ie}`),o||console.warn("[beacon] Toast service unavailable"),i.WEBRTC_SUPPORT||o?.error("Please use a browser with WebRTC support.",{sticky:!0}),n.form){let l=b=>{b.preventDefault(),k(n.magnetInput?.value||""),n.magnetInput&&(n.magnetInput.value="")};n.form.addEventListener("submit",l),p(()=>n.form.removeEventListener("submit",l))}if(n.seedButton&&n.seedInput){let l=()=>{n.seedInput.click()},b=()=>{let I=Array.from(n.seedInput.files||[]);n.seedInput.value="",B(I)};n.seedButton.addEventListener("click",l),n.seedInput.addEventListener("change",b),p(()=>{n.seedButton.removeEventListener("click",l),n.seedInput.removeEventListener("change",b)})}if(n.pauseButton){let l=()=>{c.selectedTorrent&&typeof c.selectedTorrent.pause=="function"&&(c.selectedTorrent.pause(),y())};n.pauseButton.addEventListener("click",l),p(()=>n.pauseButton.removeEventListener("click",l))}if(n.resumeButton){let l=()=>{c.selectedTorrent&&typeof c.selectedTorrent.resume=="function"&&(c.selectedTorrent.resume(),y())};n.resumeButton.addEventListener("click",l),p(()=>n.resumeButton.removeEventListener("click",l))}if(n.downloadAllButton){let l=()=>v(c.selectedTorrent);n.downloadAllButton.addEventListener("click",l),p(()=>n.downloadAllButton.removeEventListener("click",l))}if(n.removeButton){let l=()=>A(c.selectedTorrent);n.removeButton.addEventListener("click",l),p(()=>n.removeButton.removeEventListener("click",l))}if(n.copyMagnetButton){let l=()=>C(c.selectedTorrent);n.copyMagnetButton.addEventListener("click",l),p(()=>n.copyMagnetButton.removeEventListener("click",l))}let r=l=>{console.error("[beacon] Torrent client error",l),o?.error(l?.message||String(l)),E(!1)};d.on("error",r),p(()=>d.removeListener("error",r));let s=l=>{if(d.torrents&&d.torrents.length>0)return l.preventDefault(),l.returnValue="Transfers are in progress. Are you sure you want to leave or refresh?",l.returnValue};a&&typeof a.addEventListener=="function"&&(a.addEventListener("beforeunload",s),p(()=>a.removeEventListener("beforeunload",s))),m?.render(h(),c.selectedTorrent),y(),N(),E(!1);let f=a.setInterval(()=>{m?.render(h(),c.selectedTorrent),y(),N()},1e3);w.push(f);let u=a?.location?.hash;typeof u=="string"&&u.length>1&&k(u.slice(1))}function P(){w.forEach(r=>a.clearInterval(r)),w.length=0,T.forEach(r=>{try{r()}catch(s){console.warn("[beacon] Cleanup task failed",s)}}),T.length=0,m?.destroy();try{d.destroy()}catch(r){console.warn("[beacon] Failed to destroy client",r)}}return{mount:H,destroy:P}}function pe(){let e=typeof window<"u"&&window||typeof globalThis<"u"&&globalThis||null;if(e&&typeof e.WebTorrent=="function")return e.WebTorrent;throw new Error("WebTorrent runtime is not available on the global scope")}var F=null;function K(){if(F)return F;if(typeof document>"u")throw new Error("Beacon runtime requires a document environment");let e=pe();return F=G({documentRef:document,WebTorrentCtor:e}),F.mount(),F}if(typeof document<"u")if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",()=>{try{K()}catch(e){console.error("[beacon] Failed to mount app",e)}});else try{K()}catch(e){console.error("[beacon] Failed to mount app",e)}export{G as createBeaconApp,K as mountBeaconApp}; diff --git a/torrent/dist/beacon.vendor.js b/torrent/dist/beacon.vendor.js deleted file mode 100644 index f90ff244..00000000 --- a/torrent/dist/beacon.vendor.js +++ /dev/null @@ -1,84 +0,0 @@ -(()=>{var gu=Object.create;var zf=Object.defineProperty;var vu=Object.getOwnPropertyDescriptor;var bu=Object.getOwnPropertyNames;var yu=Object.getPrototypeOf,_u=Object.prototype.hasOwnProperty;var Ni=(yt=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(yt,{get:(Ke,ct)=>(typeof require!="undefined"?require:Ke)[ct]}):yt)(function(yt){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+yt+'" is not supported')});var _i=(yt,Ke)=>()=>(Ke||yt((Ke={exports:{}}).exports,Ke),Ke.exports);var wu=(yt,Ke,ct,ut)=>{if(Ke&&typeof Ke=="object"||typeof Ke=="function")for(let rt of bu(Ke))!_u.call(yt,rt)&&rt!==ct&&zf(yt,rt,{get:()=>Ke[rt],enumerable:!(ut=vu(Ke,rt))||ut.enumerable});return yt};var eo=(yt,Ke,ct)=>(ct=yt!=null?gu(yu(yt)):{},wu(Ke||!yt||!yt.__esModule?zf(ct,"default",{value:yt,enumerable:!0}):ct,yt));var Wf=_i(()=>{(function(yt){"use strict";var Ke={objectMaxDepth:5,urlErrorParamsEnabled:!0};function ct(t){if(U(t))x(t.objectMaxDepth)&&(Ke.objectMaxDepth=ut(t.objectMaxDepth)?t.objectMaxDepth:NaN),x(t.urlErrorParamsEnabled)&&Y(t.urlErrorParamsEnabled)&&(Ke.urlErrorParamsEnabled=t.urlErrorParamsEnabled);else return Ke}function ut(t){return ee(t)&&t>0}function rt(t,d){d=d||Error;var w="https://errors.angularjs.org/1.8.3/",A=w.replace(".","\\.")+"[\\s\\S]*",L=new RegExp(A,"g");return function(){var Z=arguments[0],W=arguments[1],z="["+(t?t+":":"")+Z+"] ",H=J(arguments,2).map(function(ce){return Ue(ce,Ke.objectMaxDepth)}),ne,ie;if(z+=W.replace(/\{\d+\}/g,function(ce){var de=+ce.slice(1,-1);return de=0&&d-1 in t||typeof t.item=="function")}function n(t,d,w){var A,L;if(t)if(B(t))for(A in t)A!=="prototype"&&A!=="length"&&A!=="name"&&t.hasOwnProperty(A)&&d.call(w,t[A],A,t);else if(G(t)||p(t)){var Z=typeof t!="object";for(A=0,L=t.length;A=0&&t.splice(w,1),w}function ze(t,d,w){var A=[],L=[];if(w=ut(w)?w:NaN,d){if(le(d)||be(d))throw R("cpta","Can't copy! TypedArray destination cannot be mutated.");if(t===d)throw R("cpi","Can't copy! Source and destination are identical.");return G(d)?d.length=0:n(d,function(H,ne){ne!=="$$hashKey"&&delete d[ne]}),A.push(t),L.push(d),Z(t,d,w)}return W(t,w);function Z(H,ne,ie){if(ie--,ie<0)return"...";var ce=ne.$$hashKey,de;if(G(H))for(var Ee=0,Se=H.length;Ee2?J(arguments,2):[];return B(d)&&!(d instanceof RegExp)?w.length?function(){return arguments.length?d.apply(t,F(w,arguments,0)):d.apply(t,w)}:function(){return arguments.length?d.apply(t,arguments):d.call(t)}:d}function ve(t,d){var w=d;return typeof t=="string"&&t.charAt(0)==="$"&&t.charAt(1)==="$"?w=void 0:b(d)?w="$WINDOW":d&&yt.document===d?w="$DOCUMENT":C(d)&&(w="$SCOPE"),w}function Pe(t,d){if(!E(t))return ee(d)||(d=d?2:null),JSON.stringify(t,ve,d)}function Ie(t){return X(t)?JSON.parse(t):t}var vt=/:/g;function pt(t,d){t=t.replace(vt,"");var w=Date.parse("Jan 01, 1970 00:00:00 "+t)/6e4;return c(w)?d:w}function Ve(t,d){return t=new Date(t.getTime()),t.setMinutes(t.getMinutes()+d),t}function Ot(t,d,w){w=w?-1:1;var A=t.getTimezoneOffset(),L=pt(d,A);return Ve(t,w*(L-A))}function bt(t){t=Re(t).clone().empty();var d=Re("
").append(t).html();try{return t[0].nodeType===nn?Ce(d):d.match(/^(<[^>]+>)/)[1].replace(/^<([\w-]+)/,function(w,A){return"<"+Ce(A)})}catch{return Ce(d)}}function Pt(t){try{return decodeURIComponent(t)}catch{}}function vn(t){var d={};return n((t||"").split("&"),function(w){var A,L,Z;w&&(L=w=w.replace(/\+/g,"%20"),A=w.indexOf("="),A!==-1&&(L=w.substring(0,A),Z=w.substring(A+1)),L=Pt(L),x(L)&&(Z=x(Z)?Pt(Z):!0,fe.call(d,L)?G(d[L])?d[L].push(Z):d[L]=[d[L],Z]:d[L]=Z))}),d}function Et(t){var d=[];return n(t,function(w,A){G(w)?n(w,function(L){d.push(qt(A,!0)+(L===!0?"":"="+qt(L,!0)))}):d.push(qt(A,!0)+(w===!0?"":"="+qt(w,!0)))}),d.length?d.join("&"):""}function Vt(t){return qt(t,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function qt(t,d){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,d?"%20":"+")}var Kt=["ng-","data-ng-","ng:","x-ng-"];function cn(t,d){var w,A,L=Kt.length;for(A=0;A protocol indicates an extension, document.location.href does not match.");return}L.strictDi=cn(w,"strict-di")!==null,d(w,A?[A]:[],L)}}function Zn(t,d,w){U(w)||(w={});var A={strictDi:!1};w=e(A,w);var L=function(){if(t=Re(t),t.injector()){var z=t[0]===yt.document?"document":bt(t);throw R("btstrpd","App already bootstrapped with this element '{0}'",z.replace(//,">"))}d=d||[],d.unshift(["$provide",function(ne){ne.value("$rootElement",t)}]),w.debugInfoEnabled&&d.push(["$compileProvider",function(ne){ne.debugInfoEnabled(!0)}]),d.unshift("ng");var H=di(d,w.strictDi);return H.invoke(["$rootScope","$rootElement","$compile","$injector",function(ie,ce,de,Ee){ie.$apply(function(){ce.data("$injector",Ee),de(ce)(ie)})}]),H},Z=/^NG_ENABLE_DEBUG_INFO!/,W=/^NG_DEFER_BOOTSTRAP!/;if(yt&&Z.test(yt.name)&&(w.debugInfoEnabled=!0,yt.name=yt.name.replace(Z,"")),yt&&!W.test(yt.name))return L();yt.name=yt.name.replace(W,""),l.resumeBootstrap=function(z){return n(z,function(H){d.push(H)}),L()},B(l.resumeDeferredBootstrap)&&l.resumeDeferredBootstrap()}function Gt(){yt.name="NG_ENABLE_DEBUG_INFO!"+yt.name,yt.location.reload()}function tn(t){var d=l.element(t).injector();if(!d)throw R("test","no injector found for element argument to getTestability");return d.get("$$testability")}var Vn=/[A-Z]/g;function sn(t,d){return d=d||"_",t.replace(Vn,function(w,A){return(A?d:"")+w.toLowerCase()})}var dn=!1;function or(){var t;if(!dn){var d=P();Xe=E(d)?yt.jQuery:d?yt[d]:void 0,Xe&&Xe.fn.on?(Re=Xe,e(Xe.fn,{scope:hi.scope,isolateScope:hi.isolateScope,controller:hi.controller,injector:hi.injector,inheritedData:hi.inheritedData})):Re=zn,t=Re.cleanData,Re.cleanData=function(w){for(var A,L=0,Z;(Z=w[L])!=null;L++)A=(Re._data(Z)||{}).events,A&&A.$destroy&&Re(Z).triggerHandler("$destroy");t(w)},l.element=Re,dn=!0}}function Zt(){zn.legacyXHTMLReplacement=!0}function on(t,d,w){if(!t)throw R("areq","Argument '{0}' is {1}",d||"?",w||"required");return t}function Rr(t,d,w){return w&&G(t)&&(t=t[t.length-1]),on(B(t),d,"not a function, got "+(t&&typeof t=="object"?t.constructor.name||"Object":typeof t)),t}function en(t,d){if(t==="hasOwnProperty")throw R("badname","hasOwnProperty is not a valid {0} name",d)}function fn(t,d,w){if(!d)return t;for(var A=d.split("."),L,Z=t,W=A.length,z=0;z=0)return"...";w.push(L)}return L})}function Ue(t,d){return typeof t=="function"?t.toString().replace(/ \{[\s\S]*$/,""):E(t)?"undefined":typeof t!="string"?Ae(t,d):t}var ae={full:"1.8.3",major:1,minor:8,dot:3,codeName:"ultimate-farewell"};function Fe(t){e(t,{errorHandlingConfig:ct,bootstrap:Zn,copy:ze,extend:e,merge:r,equals:Dt,element:Re,forEach:n,injector:di,noop:g,bind:oe,toJson:Pe,fromJson:Ie,identity:S,isUndefined:E,isDefined:x,isString:X,isFunction:B,isObject:U,isNumber:ee,isElement:Ze,isArray:G,version:ae,isDate:ue,callbacks:{$$counter:0},getTestability:tn,reloadWithDebugInfo:Gt,UNSAFE_restoreLegacyJqLiteXHTMLReplacement:Zt,$$minErr:rt,$$csp:q,$$encodeUriSegment:Vt,$$encodeUriQuery:qt,$$lowercase:Ce,$$stringify:ln,$$uppercase:$}),y=Ne(yt),y("ng",["ngLocale"],["$provide",function(w){w.provider({$$sanitizeUri:hc}),w.provider("$compile",po).directive({a:Bc,input:pf,textarea:pf,form:Nc,script:Kh,select:Jh,option:Qh,ngBind:mh,ngBindHtml:vh,ngBindTemplate:gh,ngClass:yh,ngClassEven:wh,ngClassOdd:_h,ngCloak:Eh,ngController:Sh,ngForm:Ys,ngHide:Hh,ngIf:$h,ngInclude:kh,ngInit:Th,ngNonBindable:Dh,ngPluralize:Uh,ngRef:Nh,ngRepeat:Fh,ngShow:jh,ngStyle:zh,ngSwitch:Wh,ngSwitchWhen:Vh,ngSwitchDefault:Yh,ngOptions:Bh,ngTransclude:qh,ngModel:Ih,ngList:Ch,ngChange:bh,pattern:kf,ngPattern:kf,required:$f,ngRequired:$f,minlength:Tf,ngMinlength:Tf,maxlength:Af,ngMaxlength:Af,ngValue:ph,ngModelOptions:Ph}).directive({ngInclude:Ah,input:dh}).directive(hs).directive(mf),w.provider({$anchorScroll:_a,$animate:xa,$animateCss:ka,$$animateJs:Sa,$$animateQueue:As,$$AnimateRunner:$a,$$animateAsyncRun:Ts,$browser:Ca,$cacheFactory:lo,$controller:Ia,$document:Cs,$$isDocumentHidden:Rs,$exceptionHandler:Is,$filter:Wo,$$forceReflow:Oa,$interpolate:Eo,$interval:Ha,$$intervalFactory:za,$http:Na,$httpParamSerializer:La,$httpParamSerializerJQLike:Ba,$httpBackend:wo,$xhrFactory:_o,$jsonpCallbacks:Wa,$location:ko,$log:Ao,$parse:sc,$rootScope:fc,$q:oc,$$q:ac,$sce:pc,$sceDelegate:lc,$sniffer:No,$$taskTrackerFactory:mc,$templateCache:Un,$templateRequest:vc,$$testability:bc,$timeout:Qr,$window:zo,$$rAF:cc,$$jqLite:la,$$Map:Yr,$$cookieReader:Sc})}]).info({angularVersion:"1.8.3"})}zn.expando="ng339";var cr=zn.cache={},gr=1;zn._data=function(t){return this.cache[t[this.expando]]||{}};function Ir(){return++gr}var Mr=/-([a-z])/g,Lr=/^-ms-/,vr={mouseleave:"mouseout",mouseenter:"mouseover"},br=rt("jqLite");function Jn(t){return ur(t.replace(Lr,"ms-"))}function yr(t,d){return d.toUpperCase()}function ur(t){return t.replace(Mr,yr)}var dr=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,Qn=/<|&#?\w+;/,jt=/<([\w:-]+)/,me=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,Rt={thead:["table"],col:["colgroup","table"],tr:["tbody","table"],td:["tr","tbody","table"]};Rt.tbody=Rt.tfoot=Rt.colgroup=Rt.caption=Rt.thead,Rt.th=Rt.td;var hn={option:[1,'"],_default:[0,"",""]};for(var bn in Rt){var Ln=Rt[bn],In=Ln.slice().reverse();hn[bn]=[In.length,"<"+In.join("><")+">",""]}hn.optgroup=hn.option;function rr(t){return!Qn.test(t)}function fr(t){var d=t.nodeType;return d===ar||!d||d===pn}function $n(t){for(var d in cr[t.ng339])return!0;return!1}function Sr(t,d){var w,A,L,Z,W=d.createDocumentFragment(),z=[],H;if(rr(t))z.push(d.createTextNode(t));else{if(w=W.appendChild(d.createElement("div")),A=(jt.exec(t)||["",""])[1].toLowerCase(),Z=zn.legacyXHTMLReplacement?t.replace(me,"<$1>"):t,Ye<10)for(L=hn[A]||hn._default,w.innerHTML=L[1]+Z+L[2],H=L[0];H--;)w=w.firstChild;else{for(L=Rt[A]||[],H=L.length;--H>-1;)w.appendChild(yt.document.createElement(L[H])),w=w.firstChild;w.innerHTML=Z}z=F(z,w.childNodes),w=W.firstChild,w.textContent=""}return W.textContent="",W.innerHTML="",n(z,function(ne){W.appendChild(ne)}),W}function Xr(t,d){d=d||yt.document;var w;return(w=dr.exec(t))?[d.createElement(w[1])]:(w=Sr(t,d))?w.childNodes:[]}function wi(t,d){var w=t.parentNode;w&&w.replaceChild(d,t),d.appendChild(t)}var _s=yt.Node.prototype.contains||function(t){return!!(this.compareDocumentPosition(t)&16)};function zn(t){if(t instanceof zn)return t;var d;if(X(t)&&(t=we(t),d=!0),!(this instanceof zn)){if(d&&t.charAt(0)!=="<")throw br("nosel","Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element");return new zn(t)}d?Ei(this,Xr(t)):B(t)?so(t):Ei(this,t)}function ws(t){return t.cloneNode(!0)}function Fi(t,d){!d&&fr(t)&&Re.cleanData([t]),t.querySelectorAll&&Re.cleanData(t.querySelectorAll("*"))}function no(t){var d;for(d in t)return!1;return!0}function ro(t){var d=t.ng339,w=d&&cr[d],A=w&&w.events,L=w&&w.data;(!L||no(L))&&(!A||no(A))&&(delete cr[d],t.ng339=void 0)}function io(t,d,w,A){if(x(A))throw br("offargs","jqLite#off() does not support the `selector` argument");var L=ji(t),Z=L&&L.events,W=L&&L.handle;if(W){if(d){var z=function(H){var ne=Z[H];x(w)&&Le(ne||[],w),x(w)&&ne&&ne.length>0||(t.removeEventListener(H,W),delete Z[H])};n(d.split(" "),function(H){z(H),vr[H]&&z(vr[H])})}else for(d in Z)d!=="$destroy"&&t.removeEventListener(d,W),delete Z[d];ro(t)}}function Es(t,d){var w=t.ng339,A=w&&cr[w];A&&(d?delete A.data[d]:A.data={},ro(t))}function ji(t,d){var w=t.ng339,A=w&&cr[w];return d&&!A&&(t.ng339=w=Ir(),A=cr[w]={events:{},data:{},handle:void 0}),A}function Ss(t,d,w){if(fr(t)){var A,L=x(w),Z=!L&&d&&!U(d),W=!d,z=ji(t,!Z),H=z&&z.data;if(L)H[ur(d)]=w;else{if(W)return H;if(Z)return H&&H[ur(d)];for(A in d)H[ur(A)]=d[A]}}}function Hi(t,d){return t.getAttribute?(" "+(t.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").indexOf(" "+d+" ")>-1:!1}function zi(t,d){if(d&&t.setAttribute){var w=(" "+(t.getAttribute("class")||"")+" ").replace(/[\n\t]/g," "),A=w;n(d.split(" "),function(L){L=we(L),A=A.replace(" "+L+" "," ")}),A!==w&&t.setAttribute("class",we(A))}}function Wi(t,d){if(d&&t.setAttribute){var w=(" "+(t.getAttribute("class")||"")+" ").replace(/[\n\t]/g," "),A=w;n(d.split(" "),function(L){L=we(L),A.indexOf(" "+L+" ")===-1&&(A+=L+" ")}),A!==w&&t.setAttribute("class",we(A))}}function Ei(t,d){if(d)if(d.nodeType)t[t.length++]=d;else{var w=d.length;if(typeof w=="number"&&d.window!==d){if(w)for(var A=0;A=0?Re(this[t]):Re(this[this.length+t])},length:0,push:_t,sort:[].sort,splice:[].splice},Gi={};n("multiple,selected,checked,disabled,readOnly,required,open".split(","),function(t){Gi[Ce(t)]=t});var $s={};n("input,select,option,textarea,button,form,details".split(","),function(t){$s[t]=!0});var Bn={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max",ngPattern:"pattern",ngStep:"step"};function ui(t,d){var w=Gi[d.toLowerCase()];return w&&$s[st(t)]&&w}function xi(t){return Bn[t]}n({data:Ss,removeData:Es,hasData:$n,cleanData:function(d){for(var w=0,A=d.length;w1&&(Z=se(Z));for(var ne=0;ne=0?w.split(" "):[w],ne=H.length,ie=function(ce,de,Ee){var Se=W[ce];Se||(Se=W[ce]=[],Se.specialHandlerWrapper=de,ce!=="$destroy"&&!Ee&&d.addEventListener(ce,z)),Se.push(A)};ne--;)w=H[ne],vr[w]?(ie(vr[w],da),ie(w,void 0,!0)):ie(w)}},off:io,one:function(t,d,w){t=Re(t),t.on(d,function A(){t.off(d,w),t.off(d,A)}),t.on(d,w)},replaceWith:function(t,d){var w,A=t.parentNode;Fi(t),n(new zn(d),function(L){w?A.insertBefore(L,w.nextSibling):A.replaceChild(L,t),w=L})},children:function(t){var d=[];return n(t.childNodes,function(w){w.nodeType===ar&&d.push(w)}),d},contents:function(t){return t.contentDocument||t.childNodes||[]},append:function(t,d){var w=t.nodeType;if(!(w!==ar&&w!==mn)){d=new zn(d);for(var A=0,L=d.length;A/,ks=/^[^(]*\(\s*([^)]*)\)/m,ma=/,/,ga=/^\s*(_?)(\S+?)\1\s*$/,va=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,Nr=rt("$injector");function Xi(t){return Function.prototype.toString.call(t)}function ao(t){var d=Xi(t).replace(va,""),w=d.match(pa)||d.match(ks);return w}function ba(t){var d=ao(t);return d?"function("+(d[1]||"").replace(/[\s\r\n]+/," ")+")":"fn"}function ya(t,d,w){var A,L,Z;if(typeof t=="function"){if(!(A=t.$inject)){if(A=[],t.length){if(d)throw(!X(w)||!w)&&(w=t.name||ba(t)),Nr("strictdi","{0} is not using explicit annotation and cannot be invoked in strict mode",w);L=ao(t),n(L[1].split(ma),function(W){W.replace(ga,function(z,H,ne){A.push(ne)})})}t.$inject=A}}else G(t)?(Z=t.length-1,Rr(t[Z],"fn"),A=t.slice(0,Z)):Rr(t,"fn",!0);return A}function di(t,d){d=d===!0;var w={},A="Provider",L=[],Z=new Ki,W={$provide:{provider:de(Ee),factory:de(tt),service:de(mt),value:de(nt),constant:de(et),decorator:Qe}},z=W.$injector=Oe(W,function(He,ye){throw l.isString(ye)&&L.push(ye),Nr("unpr","Unknown provider: {0}",L.join(" <- "))}),H={},ne=Oe(H,function(He,ye){var ge=z.get(He+A,ye);return ie.invoke(ge.$get,ge,void 0,He)}),ie=ne;W["$injector"+A]={$get:k(ne)},ie.modules=z.modules=Ft();var ce=ot(t);return ie=ne.get("$injector"),ie.strictDi=d,n(ce,function(He){He&&ie.invoke(He)}),ie.loadNewModules=function(He){n(ot(He),function(ye){ye&&ie.invoke(ye)})},ie;function de(He){return function(ye,ge){if(U(ye))n(ye,o(He));else return He(ye,ge)}}function Ee(He,ye){if(en(He,"service"),(B(ye)||G(ye))&&(ye=z.instantiate(ye)),!ye.$get)throw Nr("pget","Provider '{0}' must define $get factory method.",He);return W[He+A]=ye}function Se(He,ye){return function(){var $e=ie.invoke(ye,this);if(E($e))throw Nr("undef","Provider '{0}' must return a value from $get factory method.",He);return $e}}function tt(He,ye,ge){return Ee(He,{$get:ge!==!1?Se(He,ye):ye})}function mt(He,ye){return tt(He,["$injector",function(ge){return ge.instantiate(ye)}])}function nt(He,ye){return tt(He,k(ye),!1)}function et(He,ye){en(He,"constant"),W[He]=ye,H[He]=ye}function Qe(He,ye){var ge=z.get(He+A),$e=ge.$get;ge.$get=function(){var ke=ie.invoke($e,ge);return ie.invoke(ye,null,{$delegate:ke})}}function ot(He){on(E(He)||G(He),"modulesToLoad","not an array");var ye=[],ge;return n(He,function($e){if(Z.get($e))return;Z.set($e,!0);function ke(Ge){var at,Je;for(at=0,Je=Ge.length;at1)&&t(function(){for(var L=0;Lz&&this.remove(ie.key),Se}},get:function(Ee){if(z0&&Je.addClass(this.$$element,Me)},$removeClass:function(Me){Me&&Me.length>0&&Je.removeClass(this.$$element,Me)},$updateClass:function(Me,We){var it=Ai(Me,We);it&&it.length&&Je.addClass(this.$$element,it);var dt=Ai(We,Me);dt&&dt.length&&Je.removeClass(this.$$element,dt)},$set:function(Me,We,it,dt){var $t=this.$$element[0],At=ui($t,Me),Mt=xi(Me),an=Me,Lt;At?(this.$$element.prop(Me,We),dt=At):Mt&&(this[Mt]=We,an=Mt),this[Me]=We,dt?this.$attr[Me]=dt:(dt=this.$attr[Me],dt||(this.$attr[Me]=dt=sn(Me,"-"))),Lt=st(this.$$element),Lt==="img"&&Me==="srcset"&&(this[Me]=We=un(We,"$set('srcset', value)")),it!==!1&&(We===null||E(We)?this.$$element.removeAttr(dt):lt.test(dt)?At&&We===!1?this.$$element.removeAttr(dt):this.$$element.attr(dt,We):An(this.$$element[0],dt,We));var Bt=this.$$observers;Bt&&n(Bt[an],function(Ut){try{Ut(We)}catch(zt){ye(zt)}})},$observe:function(Me,We){var it=this,dt=it.$$observers||(it.$$observers=Ft()),$t=dt[Me]||(dt[Me]=[]);return $t.push(We),Ge.$evalAsync(function(){!$t.$$inter&&it.hasOwnProperty(Me)&&!E(it[Me])&&We(it[Me])}),function(){Le($t,We)}}};function An(Me,We,it){xt.innerHTML="";var dt=xt.firstChild.attributes,$t=dt[0];dt.removeNamedItem($t.name),$t.value=it,Me.attributes.setNamedItem($t)}function On(Me,We){try{Me.addClass(We)}catch{}}var Gn=He.startSymbol(),jn=He.endSymbol(),pr=Gn==="{{"&&jn==="}}"?S:function(We){return We.replace(/\{\{/g,Gn).replace(/}}/g,jn)},nr=/^ng(Attr|Prop|On)([A-Z].*)$/,hr=/^(.+)Start$/;return Wn.$$addBindingInfo=tt?function(We,it){var dt=We.data("$binding")||[];G(it)?dt=dt.concat(it):dt.push(it),We.data("$binding",dt)}:g,Wn.$$addBindingClass=tt?function(We){On(We,"ng-binding")}:g,Wn.$$addScopeInfo=tt?function(We,it,dt,$t){var At=dt?$t?"$isolateScopeNoTemplate":"$isolateScope":"$scope";We.data(At,it)}:g,Wn.$$addScopeClass=tt?function(We,it){On(We,it?"ng-isolate-scope":"ng-scope")}:g,Wn.$$createComment=function(Me,We){var it="";return tt&&(it=" "+(Me||"")+": ",We&&(it+=We+" ")),yt.document.createComment(it)},Wn;function Wn(Me,We,it,dt,$t){Me instanceof Re||(Me=Re(Me));var At=Li(Me,We,Me,it,dt,$t);Wn.$$addScopeClass(Me);var Mt=null;return function(Lt,Bt,Ut){if(!Me)throw Yn("multilink","This element has already been linked.");on(Lt,"scope"),$t&&$t.needsNewScope&&(Lt=Lt.$parent.$new()),Ut=Ut||{};var zt=Ut.parentBoundTranscludeFn,Ct=Ut.transcludeControllers,Qt=Ut.futureParentElement;zt&&zt.$$boundTransclude&&(zt=zt.$$boundTransclude),Mt||(Mt=Mi(Qt));var yn;if(Mt!=="html"?yn=Re(Kc(Mt,Re("
").append(Me).html())):Bt?yn=hi.clone.call(Me):yn=Me,Ct)for(var Pn in Ct)yn.data("$"+Pn+"Controller",Ct[Pn].instance);return Wn.$$addScopeInfo(yn,Lt),Bt&&Bt(yn,Lt),At&&At(Lt,yn,yn,zt),Bt||(Me=At=null),yn}}function Mi(Me){var We=Me&&Me[0];return We&&st(We)!=="foreignobject"&&_.call(We).match(/SVG/)?"svg":"html"}function Li(Me,We,it,dt,$t,At){for(var Mt=[],an=G(Me)||Me instanceof Re,Lt,Bt,Ut,zt,Ct,Qt,yn,Pn=0;Pn0);else dt.push(Me);return Re(dt)}function Rf(Me,We,it){return function($t,At,Mt,an,Lt){return At=Xs(At[0],We,it),Me($t,At,Mt,an,Lt)}}function qc(Me,We,it,dt,$t,At){var Mt;return Me?Wn(We,it,dt,$t,At):function(){return Mt||(Mt=Wn(We,it,dt,$t,At),We=it=At=null),Mt.apply(this,arguments)}}function If(Me,We,it,dt,$t,At,Mt,an,Lt){Lt=Lt||{};for(var Bt=-Number.MAX_VALUE,Ut=Lt.newScopeDirective,zt=Lt.controllerDirectives,Ct=Lt.newIsolateScopeDirective,Qt=Lt.templateDirective,yn=Lt.nonTlbTranscludeDirective,Pn=!1,Rn=!1,_n=Lt.hasElementTranscludeDirective,wn=it.$$element=Re(We),Nt,Cn,Tn,Kn=At,Xn=dt,qn,Dn=!1,mr=!1,ir,xr=0,ei=Me.length;xrNt.priority)break;if(ir=Nt.scope,ir&&(Nt.templateUrl||(U(ir)?(ps("new/isolated scope",Ct||Ut,Nt,wn),Ct=Nt):ps("new/isolated scope",Ct,Nt,wn)),Ut=Ut||Nt),Cn=Nt.name,!Dn&&(Nt.replace&&(Nt.templateUrl||Nt.template)||Nt.transclude&&!Nt.$$tlb)){for(var gs,uu=xr+1;gs=Me[uu++];)if(gs.transclude&&!gs.$$tlb||gs.replace&&(gs.templateUrl||gs.template)){mr=!0;break}Dn=!0}if(!Nt.templateUrl&&Nt.controller&&(zt=zt||Ft(),ps("'"+Cn+"' controller",zt[Cn],Nt,wn),zt[Cn]=Nt),ir=Nt.transclude,ir)if(Pn=!0,Nt.$$tlb||(ps("transclusion",yn,Nt,wn),yn=Nt),ir==="element")_n=!0,Bt=Nt.priority,Tn=wn,wn=it.$$element=Re(Wn.$$createComment(Cn,it[Cn])),We=wn[0],oa($t,J(Tn),We),Xn=qc(mr,Tn,dt,Bt,Kn&&Kn.name,{nonTlbTranscludeDirective:yn});else{var fi=Ft();if(!U(ir))Tn=Re(ws(We)).contents();else{Tn=yt.document.createDocumentFragment();var Bf=Ft(),Zc=Ft();n(ir,function(Hn,Mn){var Kr=Hn.charAt(0)==="?";Hn=Kr?Hn.substring(1):Hn,Bf[Hn]=Mn,fi[Mn]=null,Zc[Mn]=Kr}),n(wn.contents(),function(Hn){var Mn=Bf[Br(st(Hn))];Mn?(Zc[Mn]=!0,fi[Mn]=fi[Mn]||yt.document.createDocumentFragment(),fi[Mn].appendChild(Hn)):Tn.appendChild(Hn)}),n(Zc,function(Hn,Mn){if(!Hn)throw Yn("reqslot","Required transclusion slot `{0}` was not filled.",Mn)});for(var Jc in fi)if(fi[Jc]){var du=Re(fi[Jc].childNodes);fi[Jc]=qc(mr,du,dt)}Tn=Re(Tn.childNodes)}wn.empty(),Xn=qc(mr,Tn,dt,void 0,void 0,{needsNewScope:Nt.$$isolateScope||Nt.$$newScope}),Xn.$$slots=fi}if(Nt.template)if(Rn=!0,ps("template",Qt,Nt,wn),Qt=Nt,ir=B(Nt.template)?Nt.template(wn,it):Nt.template,ir=pr(ir),Nt.replace){if(Kn=Nt,rr(ir)?Tn=[]:Tn=Ti(Kc(Nt.templateNamespace,we(ir))),We=Tn[0],Tn.length!==1||We.nodeType!==ar)throw Yn("tplrt","Template for directive '{0}' must have exactly one root element. {1}",Cn,"");oa($t,wn,We);var Uf={$attr:{}},Nf=bi(We,[],Uf),lu=Me.splice(xr+1,Me.length-(xr+1));(Ct||Ut)&&Of(Nf,Ct,Ut),Me=Me.concat(Nf).concat(lu),Pf(it,Uf),ei=Me.length}else wn.html(ir);if(Nt.templateUrl)Rn=!0,ps("template",Qt,Nt,wn),Qt=Nt,Nt.replace&&(Kn=Nt),Bi=nu(Me.splice(xr,Me.length-xr),wn,it,$t,Pn&&Xn,Mt,an,{controllerDirectives:zt,newScopeDirective:Ut!==Nt&&Ut,newIsolateScopeDirective:Ct,templateDirective:Qt,nonTlbTranscludeDirective:yn}),ei=Me.length;else if(Nt.compile)try{qn=Nt.compile(wn,it,Xn);var Qc=Nt.$$originalDirective||Nt;B(qn)?Ff(null,oe(Qc,qn),ms,Xc):qn&&Ff(oe(Qc,qn.pre),oe(Qc,qn.post),ms,Xc)}catch(Hn){ye(Hn,bt(wn))}Nt.terminal&&(Bi.terminal=!0,Bt=Math.max(Bt,Nt.priority))}return Bi.scope=Ut&&Ut.scope===!0,Bi.transcludeOnThisElement=Pn,Bi.templateOnThisElement=Rn,Bi.transclude=Xn,Lt.hasElementTranscludeDirective=_n,Bi;function Ff(Hn,Mn,Kr,ef){Hn&&(Kr&&(Hn=Rf(Hn,Kr,ef)),Hn.require=Nt.require,Hn.directiveName=Cn,(Ct===Nt||Nt.$$isolateScope)&&(Hn=Df(Hn,{isolateScope:!0})),Mt.push(Hn)),Mn&&(Kr&&(Mn=Rf(Mn,Kr,ef)),Mn.require=Nt.require,Mn.directiveName=Cn,(Ct===Nt||Nt.$$isolateScope)&&(Mn=Df(Mn,{isolateScope:!0})),an.push(Mn))}function Bi(Hn,Mn,Kr,ef,vs){var yi,jf,Wr,ti,Js,ni,bs,Ar,Ui,tf;We===Kr?(Ui=it,Ar=it.$$element):(Ar=Re(Kr),Ui=new En(Ar,it)),Js=Mn,Ct?ti=Mn.$new(!0):Ut&&(Js=Mn.$parent),vs&&(bs=mu,bs.$$boundTransclude=vs,bs.isSlotFilled=function(Tr){return!!vs.$$slots[Tr]}),zt&&(ni=eu(Ar,Ui,bs,zt,ti,Mn,Ct)),Ct&&(Wn.$$addScopeInfo(Ar,ti,!0,!(Qt&&(Qt===Ct||Qt===Ct.$$originalDirective))),Wn.$$addScopeClass(Ar,!0),ti.$$isolateBindings=Ct.$$isolateBindings,tf=Lf(Mn,Ui,ti,ti.$$isolateBindings,Ct),tf.removeWatches&&ti.$on("$destroy",tf.removeWatches));for(var Hf in ni){var nf=zt[Hf],Qs=ni[Hf],pu=nf.$$bindings.bindToController;Qs.instance=Qs(),Ar.data("$"+nf.name+"Controller",Qs.instance),Qs.bindingInfo=Lf(Js,Ui,Qs.instance,pu,nf)}for(n(zt,function(Tr,sr){var Cr=Tr.require;Tr.bindToController&&!G(Cr)&&U(Cr)&&e(ni[sr].instance,Zs(sr,Cr,Ar,ni))}),n(ni,function(Tr){var sr=Tr.instance;if(B(sr.$onChanges))try{sr.$onChanges(Tr.bindingInfo.initialChanges)}catch(Cr){ye(Cr)}if(B(sr.$onInit))try{sr.$onInit()}catch(Cr){ye(Cr)}B(sr.$doCheck)&&(Js.$watch(function(){sr.$doCheck()}),sr.$doCheck()),B(sr.$onDestroy)&&Js.$on("$destroy",function(){sr.$onDestroy()})}),yi=0,jf=Mt.length;yi=0;yi--)Wr=an[yi],Mf(Wr,Wr.isolateScope?ti:Mn,Ar,Ui,Wr.require&&Zs(Wr.directiveName,Wr.require,Ar,ni),bs);n(ni,function(Tr){var sr=Tr.instance;B(sr.$postLink)&&sr.$postLink()});function mu(Tr,sr,Cr,fa){var rf;if(C(Tr)||(fa=Cr,Cr=sr,sr=Tr,Tr=void 0),_n&&(rf=ni),Cr||(Cr=_n?Ar.parent():Ar),fa){var sf=vs.$$slots[fa];if(sf)return sf(Tr,sr,rf,Cr,ca);if(E(sf))throw Yn("noslot",'No parent directive that requires a transclusion with slot name "{0}". Element: {1}',fa,bt(Ar))}else return vs(Tr,sr,rf,Cr,ca)}}}function Zs(Me,We,it,dt){var $t;if(X(We)){var At=We.match(z),Mt=We.substring(At[0].length),an=At[1]||At[3],Lt=At[2]==="?";if(an==="^^"?it=it.parent():($t=dt&&dt[Mt],$t=$t&&$t.instance),!$t){var Bt="$"+Mt+"Controller";an==="^^"&&it[0]&&it[0].nodeType===pn?$t=null:$t=an?it.inheritedData(Bt):it.data(Bt)}if(!$t&&!Lt)throw Yn("ctreq","Controller '{0}', required by directive '{1}', can't be found!",Mt,Me)}else if(G(We)){$t=[];for(var Ut=0,zt=We.length;UtLt.priority)&&Lt.restrict.indexOf(it)!==-1){if(At&&(Lt=h(Lt,{$$start:At,$$end:Mt})),!Lt.$$bindings){var Ct=Lt.$$bindings=ce(Lt,Lt.name);U(Ct.isolateScope)&&(Lt.$$isolateBindings=Ct.isolateScope)}Me.push(Lt),an=Lt}}return an}function tu(Me){if(w.hasOwnProperty(Me)){for(var We,it=Oe.get(Me+A),dt=0,$t=it.length;dt<$t;dt++)if(We=it[dt],We.multiElement)return!0}return!1}function Pf(Me,We){var it=We.$attr,dt=Me.$attr;n(Me,function($t,At){At.charAt(0)!=="$"&&(We[At]&&We[At]!==$t&&($t.length?$t+=(At==="style"?";":" ")+We[At]:$t=We[At]),Me.$set(At,$t,!0,it[At]))}),n(We,function($t,At){!Me.hasOwnProperty(At)&&At.charAt(0)!=="$"&&(Me[At]=$t,At!=="class"&&At!=="style"&&(dt[At]=it[At]))})}function nu(Me,We,it,dt,$t,At,Mt,an){var Lt=[],Bt,Ut,zt=We[0],Ct=Me.shift(),Qt=h(Ct,{templateUrl:null,transclude:null,replace:null,$$originalDirective:Ct}),yn=B(Ct.templateUrl)?Ct.templateUrl(We,it):Ct.templateUrl,Pn=Ct.templateNamespace;return We.empty(),ge(yn).then(function(Rn){var _n,wn,Nt,Cn;if(Rn=pr(Rn),Ct.replace){if(rr(Rn)?Nt=[]:Nt=Ti(Kc(Pn,we(Rn))),_n=Nt[0],Nt.length!==1||_n.nodeType!==ar)throw Yn("tplrt","Template for directive '{0}' must have exactly one root element. {1}",Ct.name,yn);wn={$attr:{}},oa(dt,We,_n);var Tn=bi(_n,[],wn);U(Ct.scope)&&Of(Tn,!0),Me=Tn.concat(Me),Pf(it,wn)}else _n=zt,We.html(Rn);for(Me.unshift(Qt),Bt=If(Me,_n,it,$t,We,Ct,At,Mt,an),n(dt,function(xr,ei){xr===_n&&(dt[ei]=We[0])}),Ut=Li(We[0].childNodes,$t);Lt.length;){var Kn=Lt.shift(),Xn=Lt.shift(),qn=Lt.shift(),Dn=Lt.shift(),mr=We[0];if(!Kn.$$destroyed){if(Xn!==zt){var ir=Xn.className;an.hasElementTranscludeDirective&&Ct.replace||(mr=ws(_n)),oa(qn,Re(Xn),mr),On(Re(mr),ir)}Bt.transcludeOnThisElement?Cn=qr(Kn,Bt.transclude,Dn):Cn=Dn,Bt(Ut,Kn,mr,dt,Cn)}}Lt=null}).catch(function(Rn){T(Rn)&&ye(Rn)}),function(_n,wn,Nt,Cn,Tn){var Kn=Tn;wn.$$destroyed||(Lt?Lt.push(wn,Nt,Cn,Kn):(Bt.transcludeOnThisElement&&(Kn=qr(wn,Bt.transclude,Tn)),Bt(Ut,wn,Nt,Cn,Kn)))}}function ru(Me,We){var it=We.priority-Me.priority;return it!==0?it:Me.name!==We.name?Me.name"+We+"",it.childNodes[0].childNodes;default:return We}}function su(Me,We){if(We==="srcdoc")return at.HTML;if(We==="src"||We==="ngSrc")return["img","video","audio","source","track"].indexOf(Me)===-1?at.RESOURCE_URL:at.MEDIA_URL;if(We==="xlinkHref")return Me==="image"?at.MEDIA_URL:Me==="a"?at.URL:at.RESOURCE_URL;if(Me==="form"&&We==="action"||Me==="base"&&We==="href"||Me==="link"&&We==="href")return at.RESOURCE_URL;if(Me==="a"&&(We==="href"||We==="ngHref"))return at.URL}function ou(Me,We){var it=We.toLowerCase();return ot[Me+"|"+it]||ot["*|"+it]}function au(Me){return un(at.valueOf(Me),"ng-prop-srcset")}function cu(Me,We,it,dt){if(H.test(dt))throw Yn("nodomevents","Property bindings for HTML DOM event properties are disallowed");var $t=st(Me),At=ou($t,dt),Mt=S;dt==="srcset"&&($t==="img"||$t==="source")?Mt=au:At&&(Mt=at.getTrusted.bind(at,At)),We.push({priority:100,compile:function(Lt,Bt){var Ut=$e(Bt[it]),zt=$e(Bt[it],function(Qt){return at.valueOf(Qt)});return{pre:function(Qt,yn){function Pn(){var Rn=Ut(Qt);yn[0][dt]=Mt(Rn)}Pn(),Qt.$watch(zt,Pn)}}}})}function fu(Me,We,it){Me.push(gf($e,Ge,ye,We,it,!1))}function hu(Me,We,it,dt,$t){var At=st(Me),Mt=su(At,dt),an=!$t,Lt=W[dt]||$t,Bt=He(it,an,Mt,Lt);if(Bt){if(dt==="multiple"&&At==="select")throw Yn("selmulti","Binding to the 'multiple' attribute is not supported. Element: {0}",bt(Me));if(H.test(dt))throw Yn("nodomevents","Interpolations for HTML DOM event attributes are disallowed");We.push({priority:100,compile:function(){return{pre:function(zt,Ct,Qt){var yn=Qt.$$observers||(Qt.$$observers=Ft()),Pn=Qt[dt];Pn!==it&&(Bt=Pn&&He(Pn,!0,Mt,Lt),it=Pn),Bt&&(Qt[dt]=Bt(zt),(yn[dt]||(yn[dt]=[])).$$inter=!0,(Qt.$$observers&&Qt.$$observers[dt].$$scope||zt).$watch(Bt,function(_n,wn){dt==="class"&&_n!==wn?Qt.$updateClass(_n,wn):Qt.$set(dt,_n)}))}}}})}}function oa(Me,We,it){var dt=We[0],$t=We.length,At=dt.parentNode,Mt,an;if(Me){for(Mt=0,an=Me.length;Mt0?" ":"")+W}return w}function Ti(t){t=Re(t);var d=t.length;if(d<=1)return t;for(;d--;){var w=t[d];(w.nodeType===$r||w.nodeType===nn&&w.nodeValue.trim()==="")&&je.call(t,d,1)}return t}var Qi=rt("$controller"),go=/^(\S+)(\s+as\s+([\w$]+))?$/;function vo(t,d){if(d&&X(d))return d;if(X(t)){var w=go.exec(t);if(w)return w[3]}}function Ia(){var t={};this.has=function(d){return t.hasOwnProperty(d)},this.register=function(d,w){en(d,"controller"),U(d)?e(t,d):t[d]=w},this.$get=["$injector",function(d){return function(L,Z,W,z){var H,ne,ie,ce;if(W=W===!0,z&&X(z)&&(ce=z),X(L)){if(ne=L.match(go),!ne)throw Qi("ctrlfmt","Badly formed controller string '{0}'. Must match `__name__ as __id__` or `__name__`.",L);if(ie=ne[1],ce=ce||ne[3],L=t.hasOwnProperty(ie)?t[ie]:fn(Z.$scope,ie,!0),!L)throw Qi("ctrlreg","The controller with the name '{0}' is not registered.",ie);Rr(L,ie,!0)}if(W){var de=(G(L)?L[L.length-1]:L).prototype;return H=Object.create(de||null),ce&&w(Z,ce,H,ie||L.name),e(function(){var Se=d.invoke(L,H,Z,ie);return Se!==H&&(U(Se)||B(Se))&&(H=Se,ce&&w(Z,ce,H,ie||L.name)),H},{instance:H,identifier:ce})}return H=d.instantiate(L,Z,ie),ce&&w(Z,ce,H,ie||L.name),H};function w(A,L,Z,W){if(!(A&&U(A.$scope)))throw rt("$controller")("noscp","Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.",W,L);A.$scope[L]=Z}}]}function Cs(){this.$get=["$window",function(t){return Re(t.document)}]}function Rs(){this.$get=["$document","$rootScope",function(t,d){var w=t[0],A=w&&w.hidden;t.on("visibilitychange",L),d.$on("$destroy",function(){t.off("visibilitychange",L)});function L(){A=w.hidden}return function(){return A}}]}function Is(){this.$get=["$log",function(t){return function(d,w){t.error.apply(t,arguments)}}]}var Oa=function(){this.$get=["$document",function(t){return function(d){return d?!d.nodeType&&d instanceof Re&&(d=d[0]):d=t[0].body,d.offsetWidth+1}}]},bo="application/json",Os={"Content-Type":bo+";charset=utf-8"},Pa=/^\[|^\{(?!\{)/,Da={"[":/]$/,"{":/}$/},Ma=/^\)]\}',?\n/,es=rt("$http");function Ps(t){return U(t)?ue(t)?t.toISOString():Pe(t):t}function La(){this.$get=function(){return function(d){if(!d)return"";var w=[];return u(d,function(A,L){A===null||E(A)||B(A)||(G(A)?n(A,function(Z){w.push(qt(L)+"="+qt(Ps(Z)))}):w.push(qt(L)+"="+qt(Ps(A))))}),w.join("&")}}}function Ba(){this.$get=function(){return function(d){if(!d)return"";var w=[];return A(d,"",!0),w.join("&");function A(L,Z,W){G(L)?n(L,function(z,H){A(z,Z+"["+(U(z)?H:"")+"]")}):U(L)&&!ue(L)?u(L,function(z,H){A(z,Z+(W?"":"[")+H+(W?"":"]"))}):(B(L)&&(L=L()),w.push(qt(Z)+"="+(L==null?"":qt(Ps(L)))))}}}}function ts(t,d){if(X(t)){var w=t.replace(Ma,"").trim();if(w){var A=d("Content-Type"),L=A&&A.indexOf(bo)===0;if(L||Ua(w))try{t=Ie(w)}catch(Z){if(!L)return t;throw es("baddata",'Data must be a valid JSON object. Received: "{0}". Parse error: "{1}"',t,Z)}}}return t}function Ua(t){var d=t.match(Pa);return d&&Da[d[0]].test(t)}function yo(t){var d=Ft(),w;function A(L,Z){L&&(d[L]=d[L]?d[L]+", "+Z:Z)}return X(t)?n(t.split(` -`),function(L){w=L.indexOf(":"),A(Ce(we(L.substr(0,w))),we(L.substr(w+1)))}):U(t)&&n(t,function(L,Z){A(Ce(Z),we(L))}),d}function Pr(t){var d;return function(w){if(d||(d=yo(t)),w){var A=d[Ce(w)];return A===void 0&&(A=null),A}return d}}function Jr(t,d,w,A){return B(A)?A(t,d,w):(n(A,function(L){t=L(t,d,w)}),t)}function ns(t){return 200<=t&&t<300}function Na(){var t=this.defaults={transformResponse:[ts],transformRequest:[function(L){return U(L)&&!N(L)&&!D(L)&&!V(L)?Pe(L):L}],headers:{common:{Accept:"application/json, text/plain, */*"},post:se(Os),put:se(Os),patch:se(Os)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",paramSerializer:"$httpParamSerializer",jsonpCallbackParam:"callback"},d=!1;this.useApplyAsync=function(L){return x(L)?(d=!!L,this):d};var w=this.interceptors=[],A=this.xsrfTrustedOrigins=[];Object.defineProperty(this,"xsrfWhitelistedOrigins",{get:function(){return this.xsrfTrustedOrigins},set:function(L){this.xsrfTrustedOrigins=L}}),this.$get=["$browser","$httpBackend","$$cookieReader","$cacheFactory","$rootScope","$q","$injector","$sce",function(L,Z,W,z,H,ne,ie,ce){var de=z("$http");t.paramSerializer=X(t.paramSerializer)?ie.get(t.paramSerializer):t.paramSerializer;var Ee=[];n(w,function(Oe){Ee.unshift(X(Oe)?ie.get(Oe):ie.invoke(Oe))});var Se=Ho(A);function tt(Oe){if(!U(Oe))throw rt("$http")("badreq","Http request configuration must be an object. Received: {0}",Oe);if(!X(ce.valueOf(Oe.url)))throw rt("$http")("badreq","Http request configuration url must be a string or a $sce trusted object. Received: {0}",Oe.url);var He=e({method:"get",transformRequest:t.transformRequest,transformResponse:t.transformResponse,paramSerializer:t.paramSerializer,jsonpCallbackParam:t.jsonpCallbackParam},Oe);He.headers=Je(Oe),He.method=$(He.method),He.paramSerializer=X(He.paramSerializer)?ie.get(He.paramSerializer):He.paramSerializer,L.$$incOutstandingRequestCount("$http");var ye=[],ge=[],$e=ne.resolve(He);return n(Ee,function(Tt){(Tt.request||Tt.requestError)&&ye.unshift(Tt.request,Tt.requestError),(Tt.response||Tt.responseError)&&ge.push(Tt.response,Tt.responseError)}),$e=ke($e,ye),$e=$e.then(lt),$e=ke($e,ge),$e=$e.finally(Ge),$e;function ke(Tt,wt){for(var It=0,Jt=wt.length;It=-1?un:0,(ns(un)?ye.resolve:ye.reject)({data:Yt,status:un,headers:Pr(En),config:Oe,statusText:An,xhrStatus:On})}function It(Yt){wt(Yt.data,Yt.status,se(Yt.headers()),Yt.statusText,Yt.xhrStatus)}function Jt(){var Yt=tt.pendingRequests.indexOf(Oe);Yt!==-1&&tt.pendingRequests.splice(Yt,1)}}function Qe(Oe,He){return He.length>0&&(Oe+=(Oe.indexOf("?")===-1?"?":"&")+He),Oe}function ot(Oe,He){var ye=Oe.split("?");if(ye.length>2)throw es("badjsonp",'Illegal use more than one "?", in url, "{1}"',Oe);var ge=vn(ye[1]);return n(ge,function($e,ke){if($e==="JSON_CALLBACK")throw es("badjsonp",'Illegal use of JSON_CALLBACK in url, "{0}"',Oe);if(ke===He)throw es("badjsonp",'Illegal use of callback param, "{0}", in url, "{1}"',He,Oe)}),Oe+=(Oe.indexOf("?")===-1?"?":"&")+He+"=JSON_CALLBACK",Oe}}]}function _o(){this.$get=function(){return function(){return new yt.XMLHttpRequest}}}function wo(){this.$get=["$browser","$jsonpCallbacks","$document","$xhrFactory",function(t,d,w,A){return Fa(t,A,t.defer,d,w[0])}]}function Fa(t,d,w,A,L){return function(W,z,H,ne,ie,ce,de,Ee,Se,tt){if(z=z||t.url(),Ce(W)==="jsonp")var mt=A.createCallback(z),nt=Z(z,mt,function(ke,Ge){var at=ke===200&&A.getResponse(mt);$e(ne,ke,at,"",Ge,"complete"),A.removeCallback(mt)});else{var et=d(W,z),Qe=!1;et.open(W,z,!0),n(ie,function(ke,Ge){x(ke)&&et.setRequestHeader(Ge,ke)}),et.onload=function(){var Ge=et.statusText||"",at="response"in et?et.response:et.responseText,Je=et.status===1223?204:et.status;Je===0&&(Je=at?200:St(z).protocol==="file"?404:0),$e(ne,Je,at,et.getAllResponseHeaders(),Ge,"complete")};var ot=function(){$e(ne,-1,null,null,"","error")},Oe=function(){$e(ne,-1,null,null,"",Qe?"timeout":"abort")},He=function(){$e(ne,-1,null,null,"","timeout")};if(et.onerror=ot,et.ontimeout=He,et.onabort=Oe,n(Se,function(ke,Ge){et.addEventListener(Ge,ke)}),n(tt,function(ke,Ge){et.upload.addEventListener(Ge,ke)}),de&&(et.withCredentials=!0),Ee)try{et.responseType=Ee}catch(ke){if(Ee!=="json")throw ke}et.send(E(H)?null:H)}if(ce>0)var ye=w(function(){ge("timeout")},ce);else te(ce)&&ce.then(function(){ge(x(ce.$$timeoutId)?"timeout":"abort")});function ge(ke){Qe=ke==="timeout",nt&&nt(),et&&et.abort()}function $e(ke,Ge,at,Je,lt,xt){x(ye)&&w.cancel(ye),nt=et=null,ke(Ge,at,Je,lt,xt)}};function Z(W,z,H){W=W.replace("JSON_CALLBACK",z);var ne=L.createElement("script"),ie=null;return ne.type="text/javascript",ne.src=W,ne.async=!0,ie=function(ce){ne.removeEventListener("load",ie),ne.removeEventListener("error",ie),L.body.removeChild(ne),ne=null;var de=-1,Ee="unknown";ce&&(ce.type==="load"&&!A.wasCalled(z)&&(ce={type:"error"}),Ee=ce.type,de=ce.type==="error"?404:200),H&&H(de,Ee)},ne.addEventListener("load",ie),ne.addEventListener("error",ie),L.body.appendChild(ne),ie}}var ri=l.$interpolateMinErr=rt("$interpolate");ri.throwNoconcat=function(t){throw ri("noconcat",`Error while interpolating: {0} -Strict Contextual Escaping disallows interpolations that concatenate multiple expressions when a trusted value is required. See http://docs.angularjs.org/api/ng.$sce`,t)},ri.interr=function(t,d){return ri("interr",`Can't interpolate: {0} -{1}`,t,d.toString())};function Eo(){var t="{{",d="}}";this.startSymbol=function(w){return w?(t=w,this):t},this.endSymbol=function(w){return w?(d=w,this):d},this.$get=["$parse","$exceptionHandler","$sce",function(w,A,L){var Z=t.length,W=d.length,z=new RegExp(t.replace(/./g,ne),"g"),H=new RegExp(d.replace(/./g,ne),"g");function ne(Ee){return"\\\\\\"+Ee}function ie(Ee){return Ee.replace(z,t).replace(H,d)}function ce(Ee,Se,tt,mt){var nt=Ee.$watch(function(Qe){return nt(),mt(Qe)},Se,tt);return nt}function de(Ee,Se,tt,mt){var nt=tt===L.URL||tt===L.MEDIA_URL;if(!Ee.length||Ee.indexOf(t)===-1){if(Se)return;var et=ie(Ee);nt&&(et=L.getTrusted(tt,et));var Qe=k(et);return Qe.exp=Ee,Qe.expressions=[],Qe.$$watchDelegate=ce,Qe}mt=!!mt;for(var ot,Oe,He=0,ye=[],ge,$e=Ee.length,ke,Ge=[],at=[],Je;He<$e;)if((ot=Ee.indexOf(t,He))!==-1&&(Oe=Ee.indexOf(d,ot+Z))!==-1)He!==ot&&Ge.push(ie(Ee.substring(He,ot))),ke=Ee.substring(ot+Z,Oe),ye.push(ke),He=Oe+W,at.push(Ge.length),Ge.push("");else{He!==$e&&Ge.push(ie(Ee.substring(He)));break}Je=Ge.length===1&&at.length===1;var lt=nt&&Je?void 0:Tt;if(ge=ye.map(function(wt){return w(wt,lt)}),!Se||ye.length){var xt=function(wt){for(var It=0,Jt=ye.length;It1&&ri.throwNoconcat(Ee),Ge.join(""))};return e(function(It){var Jt=0,Yt=ye.length,un=new Array(Yt);try{for(;Jt4,Ee=de?J(arguments,4):[],Se=0,tt=x(ce)&&!ce,mt=(tt?w:d).defer(),nt=mt.promise;ie=x(ie)?ie:0;function et(){de?H.apply(null,Ee):H(Se)}function Qe(){tt?t.defer(et):A.$evalAsync(et),mt.notify(Se++),ie>0&&Se>=ie&&(mt.resolve(Se),W(nt.$$intervalId)),tt||A.$apply()}return nt.$$intervalId=Z(Qe,ne,mt,tt),nt}}}]}var Wa=function(){this.$get=function(){var t=l.callbacks,d={};function w(A){var L=function(Z){L.data=Z,L.called=!0};return L.id=A,L}return{createCallback:function(A){var L="_"+(t.$$counter++).toString(36),Z="angular.callbacks."+L,W=w(L);return d[Z]=t[L]=W,Z},wasCalled:function(A){return d[A].called},getResponse:function(A){return d[A].data},removeCallback:function(A){var L=d[A];delete t[L.id],delete d[A]}}}},Va=/^([^?#]*)(\?([^#]*))?(#(.*))?$/,Ya={http:80,https:443,ftp:21},Ci=rt("$location");function Ga(t){for(var d=t.split("/"),w=d.length;w--;)d[w]=Vt(d[w].replace(/%2F/g,"/"));return d.join("/")}function qa(t,d){for(var w=t.split("/"),A=w.length;A--;)w[A]=decodeURIComponent(w[A]),d&&(w[A]=w[A].replace(/\//g,"%2F"));return w.join("/")}function Ka(t,d,w){var A=Et(d),L=w?"#"+Vt(w):"",Z=Ga(t);return Z+(A?"?"+A:"")+L}function So(t,d){var w=St(t);d.$$protocol=w.protocol,d.$$host=w.hostname,d.$$port=i(w.port)||Ya[w.protocol]||null}var Xa=/^\s*[\\/]{2,}/;function xo(t,d,w){if(Xa.test(t))throw Ci("badpath",'Invalid url "{0}".',t);var A=t.charAt(0)!=="/";A&&(t="/"+t);var L=St(t),Z=A&&L.pathname.charAt(0)==="/"?L.pathname.substring(1):L.pathname;d.$$path=qa(Z,w),d.$$search=vn(L.search),d.$$hash=decodeURIComponent(L.hash),d.$$path&&d.$$path.charAt(0)!=="/"&&(d.$$path="/"+d.$$path)}function Ds(t,d){return t.slice(0,d.length)===d}function Dr(t,d){if(Ds(d,t))return d.substr(t.length)}function ii(t){var d=t.indexOf("#");return d===-1?t:t.substr(0,d)}function Za(t){return t.substr(0,ii(t).lastIndexOf("/")+1)}function Ja(t){return t.substring(0,t.indexOf("/",t.indexOf("//")+2))}function Ms(t,d,w){this.$$html5=!0,w=w||"",So(t,this),this.$$parse=function(A){var L=Dr(d,A);if(!X(L))throw Ci("ipthprfx",'Invalid url "{0}", missing path prefix "{1}".',A,d);xo(L,this,!0),this.$$path||(this.$$path="/"),this.$$compose()},this.$$normalizeUrl=function(A){return d+A.substr(1)},this.$$parseLinkUrl=function(A,L){if(L&&L[0]==="#")return this.hash(L.slice(1)),!0;var Z,W,z;return x(Z=Dr(t,A))?(W=Z,w&&x(Z=Dr(w,Z))?z=d+(Dr("/",Z)||Z):z=t+W):x(Z=Dr(d,A))?z=d+Z:d===A+"/"&&(z=d),z&&this.$$parse(z),!!z}}function Ls(t,d,w){So(t,this),this.$$parse=function(A){var L=Dr(t,A)||Dr(d,A),Z;!E(L)&&L.charAt(0)==="#"?(Z=Dr(w,L),E(Z)&&(Z=L)):this.$$html5?Z=L:(Z="",E(L)&&(t=A,this.replace())),xo(Z,this,!1),this.$$path=W(this.$$path,Z,t),this.$$compose();function W(z,H,ne){var ie=/^\/[A-Z]:(\/.*)/,ce;return Ds(H,ne)&&(H=H.replace(ne,"")),ie.exec(H)?z:(ce=ie.exec(z),ce?ce[1]:z)}},this.$$normalizeUrl=function(A){return t+(A?w+A:"")},this.$$parseLinkUrl=function(A,L){return ii(t)===ii(A)?(this.$$parse(A),!0):!1}}function $o(t,d,w){this.$$html5=!0,Ls.apply(this,arguments),this.$$parseLinkUrl=function(A,L){if(L&&L[0]==="#")return this.hash(L.slice(1)),!0;var Z,W;return t===ii(A)?Z=A:(W=Dr(d,A))?Z=t+w+W:d===A+"/"&&(Z=d),Z&&this.$$parse(Z),!!Z},this.$$normalizeUrl=function(A){return t+w+A}}var Qa={$$absUrl:"",$$html5:!1,$$replace:!1,$$compose:function(){this.$$url=Ka(this.$$path,this.$$search,this.$$hash),this.$$absUrl=this.$$normalizeUrl(this.$$url),this.$$urlUpdatedByLocation=!0},absUrl:rs("$$absUrl"),url:function(t){if(E(t))return this.$$url;var d=Va.exec(t);return(d[1]||t==="")&&this.path(decodeURIComponent(d[1])),(d[2]||d[1]||t==="")&&this.search(d[3]||""),this.hash(d[5]||""),this},protocol:rs("$$protocol"),host:rs("$$host"),port:rs("$$port"),path:Bs("$$path",function(t){return t=t!==null?t.toString():"",t.charAt(0)==="/"?t:"/"+t}),search:function(t,d){switch(arguments.length){case 0:return this.$$search;case 1:if(X(t)||ee(t))t=t.toString(),this.$$search=vn(t);else if(U(t))t=ze(t,{}),n(t,function(w,A){w==null&&delete t[A]}),this.$$search=t;else throw Ci("isrcharg","The first argument of the `$location#search()` call must be a string or an object.");break;default:E(d)||d===null?delete this.$$search[t]:this.$$search[t]=d}return this.$$compose(),this},hash:Bs("$$hash",function(t){return t!==null?t.toString():""}),replace:function(){return this.$$replace=!0,this}};n([$o,Ls,Ms],function(t){t.prototype=Object.create(Qa),t.prototype.state=function(d){if(!arguments.length)return this.$$state;if(t!==Ms||!this.$$html5)throw Ci("nostate","History API state support is available only in HTML5 mode and only in browsers supporting HTML5 History API");return this.$$state=E(d)?null:d,this.$$urlUpdatedByLocation=!0,this}});function rs(t){return function(){return this[t]}}function Bs(t,d){return function(w){return E(w)?this[t]:(this[t]=d(w),this.$$compose(),this)}}function ko(){var t="!",d={enabled:!1,requireBase:!0,rewriteLinks:!0};this.hashPrefix=function(w){return x(w)?(t=w,this):t},this.html5Mode=function(w){return Y(w)?(d.enabled=w,this):U(w)?(Y(w.enabled)&&(d.enabled=w.enabled),Y(w.requireBase)&&(d.requireBase=w.requireBase),(Y(w.rewriteLinks)||X(w.rewriteLinks))&&(d.rewriteLinks=w.rewriteLinks),this):d},this.$get=["$rootScope","$browser","$sniffer","$rootElement","$window",function(w,A,L,Z,W){var z,H,ne=A.baseHref(),ie=A.url(),ce;if(d.enabled){if(!ne&&d.requireBase)throw Ci("nobase","$location in HTML5 mode requires a tag to be present!");ce=Ja(ie)+(ne||"/"),H=L.history?Ms:$o}else ce=ii(ie),H=Ls;var de=Za(ce);z=new H(ce,de,"#"+t),z.$$parseLinkUrl(ie,ie),z.$$state=A.state();var Ee=/^\s*(javascript|mailto):/i;function Se(et,Qe){return et===Qe||St(et).href===St(Qe).href}function tt(et,Qe,ot){var Oe=z.url(),He=z.$$state;try{A.url(et,Qe,ot),z.$$state=A.state()}catch(ye){throw z.url(Oe),z.$$state=He,ye}}Z.on("click",function(et){var Qe=d.rewriteLinks;if(!(!Qe||et.ctrlKey||et.metaKey||et.shiftKey||et.which===2||et.button===2)){for(var ot=Re(et.target);st(ot[0])!=="a";)if(ot[0]===Z[0]||!(ot=ot.parent())[0])return;if(!(X(Qe)&&E(ot.attr(Qe)))){var Oe=ot.prop("href"),He=ot.attr("href")||ot.attr("xlink:href");U(Oe)&&Oe.toString()==="[object SVGAnimatedString]"&&(Oe=St(Oe.animVal).href),!Ee.test(Oe)&&Oe&&!ot.attr("target")&&!et.isDefaultPrevented()&&z.$$parseLinkUrl(Oe,He)&&(et.preventDefault(),z.absUrl()!==A.url()&&w.$apply())}}}),z.absUrl()!==ie&&A.url(z.absUrl(),!0);var mt=!0;return A.onUrlChange(function(et,Qe){if(!Ds(et,de)){W.location.href=et;return}w.$evalAsync(function(){var ot=z.absUrl(),Oe=z.$$state,He;z.$$parse(et),z.$$state=Qe,He=w.$broadcast("$locationChangeStart",et,ot,Qe,Oe).defaultPrevented,z.absUrl()===et&&(He?(z.$$parse(ot),z.$$state=Oe,tt(ot,!1,Oe)):(mt=!1,nt(ot,Oe)))}),w.$$phase||w.$digest()}),w.$watch(function(){if(mt||z.$$urlUpdatedByLocation){z.$$urlUpdatedByLocation=!1;var Qe=A.url(),ot=z.absUrl(),Oe=A.state(),He=z.$$replace,ye=!Se(Qe,ot)||z.$$html5&&L.history&&Oe!==z.$$state;(mt||ye)&&(mt=!1,w.$evalAsync(function(){var ge=z.absUrl(),$e=w.$broadcast("$locationChangeStart",ge,Qe,z.$$state,Oe).defaultPrevented;z.absUrl()===ge&&($e?(z.$$parse(Qe),z.$$state=Oe):(ye&&tt(ge,He,Oe===z.$$state?null:z.$$state),nt(Qe,Oe)))}))}z.$$replace=!1}),z;function nt(et,Qe){w.$broadcast("$locationChangeSuccess",z.absUrl(),et,z.$$state,Qe)}}]}function Ao(){var t=!0,d=this;this.debugEnabled=function(w){return x(w)?(t=w,this):t},this.$get=["$window",function(w){var A=Ye||/\bEdge\//.test(w.navigator&&w.navigator.userAgent);return{log:Z("log"),info:Z("info"),warn:Z("warn"),error:Z("error"),debug:(function(){var W=Z("debug");return function(){t&&W.apply(d,arguments)}})()};function L(W){return T(W)&&(W.stack&&A?W=W.message&&W.stack.indexOf(W.message)===-1?"Error: "+W.message+` -`+W.stack:W.stack:W.sourceURL&&(W=W.message+` -`+W.sourceURL+":"+W.line)),W}function Z(W){var z=w.console||{},H=z[W]||z.log||g;return function(){var ne=[];return n(arguments,function(ie){ne.push(L(ie))}),Function.prototype.apply.call(H,z,ne)}}}]}var Gr=rt("$parse"),li={}.constructor.prototype.valueOf;function Ri(t){return t+""}var Ii=Ft();n("+ - * / % === !== == != < > <= >= && || ! = |".split(" "),function(t){Ii[t]=!0});var pi={n:` -`,f:"\f",r:"\r",t:" ",v:"\v","'":"'",'"':'"'},Oi=function(d){this.options=d};Oi.prototype={constructor:Oi,lex:function(t){for(this.text=t,this.index=0,this.tokens=[];this.index=55296&&w<=56319&&A>=56320&&A<=57343?t+d:t},isExpOperator:function(t){return t==="-"||t==="+"||this.isNumber(t)},throwError:function(t,d,w){w=w||this.index;var A=x(d)?"s "+d+"-"+this.index+" ["+this.text.substring(d,w)+"]":" "+w;throw Gr("lexerr","Lexer Error: {0} at column{1} in expression [{2}].",t,A,this.text)},readNumber:function(){for(var t="",d=this.index;this.index0&&!this.peek("}",")",";","]")&&t.push(this.expressionStatement()),!this.expect(";"))return{type:kt.Program,body:t}},expressionStatement:function(){return{type:kt.ExpressionStatement,expression:this.filterChain()}},filterChain:function(){for(var t=this.expression();this.expect("|");)t=this.filter(t);return t},expression:function(){return this.assignment()},assignment:function(){var t=this.ternary();if(this.expect("=")){if(!Oo(t))throw Gr("lval","Trying to assign a value to a non l-value");t={type:kt.AssignmentExpression,left:t,right:this.assignment(),operator:"="}}return t},ternary:function(){var t=this.logicalOR(),d,w;return this.expect("?")&&(d=this.expression(),this.consume(":"))?(w=this.expression(),{type:kt.ConditionalExpression,test:t,alternate:d,consequent:w}):t},logicalOR:function(){for(var t=this.logicalAND();this.expect("||");)t={type:kt.LogicalExpression,operator:"||",left:t,right:this.logicalAND()};return t},logicalAND:function(){for(var t=this.equality();this.expect("&&");)t={type:kt.LogicalExpression,operator:"&&",left:t,right:this.equality()};return t},equality:function(){for(var t=this.relational(),d;d=this.expect("==","!=","===","!==");)t={type:kt.BinaryExpression,operator:d.text,left:t,right:this.relational()};return t},relational:function(){for(var t=this.additive(),d;d=this.expect("<",">","<=",">=");)t={type:kt.BinaryExpression,operator:d.text,left:t,right:this.additive()};return t},additive:function(){for(var t=this.multiplicative(),d;d=this.expect("+","-");)t={type:kt.BinaryExpression,operator:d.text,left:t,right:this.multiplicative()};return t},multiplicative:function(){for(var t=this.unary(),d;d=this.expect("*","/","%");)t={type:kt.BinaryExpression,operator:d.text,left:t,right:this.unary()};return t},unary:function(){var t;return(t=this.expect("+","-","!"))?{type:kt.UnaryExpression,operator:t.text,prefix:!0,argument:this.unary()}:this.primary()},primary:function(){var t;this.expect("(")?(t=this.filterChain(),this.consume(")")):this.expect("[")?t=this.arrayDeclaration():this.expect("{")?t=this.object():this.selfReferential.hasOwnProperty(this.peek().text)?t=ze(this.selfReferential[this.consume().text]):this.options.literals.hasOwnProperty(this.peek().text)?t={type:kt.Literal,value:this.options.literals[this.consume().text]}:this.peek().identifier?t=this.identifier():this.peek().constant?t=this.constant():this.throwError("not a primary expression",this.peek());for(var d;d=this.expect("(","[",".");)d.text==="("?(t={type:kt.CallExpression,callee:t,arguments:this.parseArguments()},this.consume(")")):d.text==="["?(t={type:kt.MemberExpression,object:t,property:this.expression(),computed:!0},this.consume("]")):d.text==="."?t={type:kt.MemberExpression,object:t,property:this.identifier(),computed:!1}:this.throwError("IMPOSSIBLE");return t},filter:function(t){for(var d=[t],w={type:kt.CallExpression,callee:this.identifier(),arguments:d,filter:!0};this.expect(":");)d.push(this.expression());return w},parseArguments:function(){var t=[];if(this.peekToken().text!==")")do t.push(this.filterChain());while(this.expect(","));return t},identifier:function(){var t=this.consume();return t.identifier||this.throwError("is not a valid identifier",t),{type:kt.Identifier,name:t.text}},constant:function(){return{type:kt.Literal,value:this.consume().value}},arrayDeclaration:function(){var t=[];if(this.peekToken().text!=="]")do{if(this.peek("]"))break;t.push(this.expression())}while(this.expect(","));return this.consume("]"),{type:kt.ArrayExpression,elements:t}},object:function(){var t=[],d;if(this.peekToken().text!=="}")do{if(this.peek("}"))break;d={type:kt.Property,kind:"init"},this.peek().constant?(d.key=this.constant(),d.computed=!1,this.consume(":"),d.value=this.expression()):this.peek().identifier?(d.key=this.identifier(),d.computed=!1,this.peek(":")?(this.consume(":"),d.value=this.expression()):d.value=d.key):this.peek("[")?(this.consume("["),d.key=this.expression(),this.consume("]"),d.computed=!0,this.consume(":"),d.value=this.expression()):this.throwError("invalid key",this.peek()),t.push(d)}while(this.expect(","));return this.consume("}"),{type:kt.ObjectExpression,properties:t}},throwError:function(t,d){throw Gr("syntax","Syntax Error: Token '{0}' {1} at column {2} of the expression [{3}] starting at [{4}].",d.text,t,d.index+1,this.text,this.text.substring(d.index))},consume:function(t){if(this.tokens.length===0)throw Gr("ueoe","Unexpected end of expression: {0}",this.text);var d=this.expect(t);return d||this.throwError("is unexpected, expecting ["+t+"]",this.peek()),d},peekToken:function(){if(this.tokens.length===0)throw Gr("ueoe","Unexpected end of expression: {0}",this.text);return this.tokens[0]},peek:function(t,d,w,A){return this.peekAhead(0,t,d,w,A)},peekAhead:function(t,d,w,A,L){if(this.tokens.length>t){var Z=this.tokens[t],W=Z.text;if(W===d||W===w||W===A||W===L||!d&&!w&&!A&&!L)return Z}return!1},expect:function(t,d,w,A){var L=this.peek(t,d,w,A);return L?(this.tokens.shift(),L):!1},selfReferential:{this:{type:kt.ThisExpression},$locals:{type:kt.LocalsExpression}}};function ec(t,d){return typeof t!="undefined"?t:d}function To(t,d){return typeof t=="undefined"?d:typeof d=="undefined"?t:t+d}function tc(t,d){var w=t(d);return!w.$stateful}var Co=1,Ro=2;function nc(t,d){switch(t.type){case kt.MemberExpression:if(t.computed)return!1;break;case kt.UnaryExpression:return Co;case kt.BinaryExpression:return t.operator!=="+"?Co:!1;case kt.CallExpression:return!1}return d===void 0?Ro:d}function er(t,d,w){var A,L,Z,W=t.isPure=nc(t,w);switch(t.type){case kt.Program:A=!0,n(t.body,function(z){er(z.expression,d,W),A=A&&z.expression.constant}),t.constant=A;break;case kt.Literal:t.constant=!0,t.toWatch=[];break;case kt.UnaryExpression:er(t.argument,d,W),t.constant=t.argument.constant,t.toWatch=t.argument.toWatch;break;case kt.BinaryExpression:er(t.left,d,W),er(t.right,d,W),t.constant=t.left.constant&&t.right.constant,t.toWatch=t.left.toWatch.concat(t.right.toWatch);break;case kt.LogicalExpression:er(t.left,d,W),er(t.right,d,W),t.constant=t.left.constant&&t.right.constant,t.toWatch=t.constant?[]:[t];break;case kt.ConditionalExpression:er(t.test,d,W),er(t.alternate,d,W),er(t.consequent,d,W),t.constant=t.test.constant&&t.alternate.constant&&t.consequent.constant,t.toWatch=t.constant?[]:[t];break;case kt.Identifier:t.constant=!1,t.toWatch=[t];break;case kt.MemberExpression:er(t.object,d,W),t.computed&&er(t.property,d,W),t.constant=t.object.constant&&(!t.computed||t.property.constant),t.toWatch=t.constant?[]:[t];break;case kt.CallExpression:Z=t.filter?tc(d,t.callee.name):!1,A=Z,L=[],n(t.arguments,function(z){er(z,d,W),A=A&&z.constant,L.push.apply(L,z.toWatch)}),t.constant=A,t.toWatch=Z?L:[t];break;case kt.AssignmentExpression:er(t.left,d,W),er(t.right,d,W),t.constant=t.left.constant&&t.right.constant,t.toWatch=[t];break;case kt.ArrayExpression:A=!0,L=[],n(t.elements,function(z){er(z,d,W),A=A&&z.constant,L.push.apply(L,z.toWatch)}),t.constant=A,t.toWatch=L;break;case kt.ObjectExpression:A=!0,L=[],n(t.properties,function(z){er(z.value,d,W),A=A&&z.value.constant,L.push.apply(L,z.value.toWatch),z.computed&&(er(z.key,d,!1),A=A&&z.key.constant,L.push.apply(L,z.key.toWatch))}),t.constant=A,t.toWatch=L;break;case kt.ThisExpression:t.constant=!1,t.toWatch=[];break;case kt.LocalsExpression:t.constant=!1,t.toWatch=[];break}}function Io(t){if(t.length===1){var d=t[0].expression,w=d.toWatch;return w.length!==1||w[0]!==d?w:void 0}}function Oo(t){return t.type===kt.Identifier||t.type===kt.MemberExpression}function Po(t){if(t.body.length===1&&Oo(t.body[0].expression))return{type:kt.AssignmentExpression,left:t.body[0].expression,right:{type:kt.NGValueParameter},operator:"="}}function rc(t){return t.body.length===0||t.body.length===1&&(t.body[0].expression.type===kt.Literal||t.body[0].expression.type===kt.ArrayExpression||t.body[0].expression.type===kt.ObjectExpression)}function ic(t){return t.constant}function Do(t){this.$filter=t}Do.prototype={compile:function(t){var d=this;this.state={nextId:0,filters:{},fn:{vars:[],body:[],own:{}},assign:{vars:[],body:[],own:{}},inputs:[]},er(t,d.$filter);var w="",A;if(this.stage="assign",A=Po(t)){this.state.computing="assign";var L=this.nextId();this.recurse(A,L),this.return_(L),w="fn.assign="+this.generateFunction("assign","s,v,l")}var Z=Io(t.body);d.stage="inputs",n(Z,function(H,ne){var ie="fn"+ne;d.state[ie]={vars:[],body:[],own:{}},d.state.computing=ie;var ce=d.nextId();d.recurse(H,ce),d.return_(ce),d.state.inputs.push({name:ie,isPure:H.isPure}),H.watchId=ne}),this.state.computing="fn",this.stage="main",this.recurse(t);var W='"'+this.USE+" "+this.STRICT+`"; -`+this.filterPrefix()+"var fn="+this.generateFunction("fn","s,l,a,i")+w+this.watchFns()+"return fn;",z=new Function("$filter","getStringValue","ifDefined","plus",W)(this.$filter,Ri,ec,To);return this.state=this.stage=void 0,z},USE:"use",STRICT:"strict",watchFns:function(){var t=[],d=this.state.inputs,w=this;return n(d,function(A){t.push("var "+A.name+"="+w.generateFunction(A.name,"s")),A.isPure&&t.push(A.name,".isPure="+JSON.stringify(A.isPure)+";")}),d.length&&t.push("fn.inputs=["+d.map(function(A){return A.name}).join(",")+"];"),t.join("")},generateFunction:function(t,d){return"function("+d+"){"+this.varsPrefix(t)+this.body(t)+"};"},filterPrefix:function(){var t=[],d=this;return n(this.state.filters,function(w,A){t.push(w+"=$filter("+d.escape(A)+")")}),t.length?"var "+t.join(",")+";":""},varsPrefix:function(t){return this.state[t].vars.length?"var "+this.state[t].vars.join(",")+";":""},body:function(t){return this.state[t].body.join("")},recurse:function(t,d,w,A,L,Z){var W,z,H=this,ne,ie,ce;if(A=A||g,!Z&&x(t.watchId)){d=d||this.nextId(),this.if_("i",this.lazyAssign(d,this.computedMember("i",t.watchId)),this.lazyRecurse(t,d,w,A,L,!0));return}switch(t.type){case kt.Program:n(t.body,function(de,Ee){H.recurse(de.expression,void 0,void 0,function(Se){z=Se}),Ee!==t.body.length-1?H.current().body.push(z,";"):H.return_(z)});break;case kt.Literal:ie=this.escape(t.value),this.assign(d,ie),A(d||ie);break;case kt.UnaryExpression:this.recurse(t.argument,void 0,void 0,function(de){z=de}),ie=t.operator+"("+this.ifDefined(z,0)+")",this.assign(d,ie),A(ie);break;case kt.BinaryExpression:this.recurse(t.left,void 0,void 0,function(de){W=de}),this.recurse(t.right,void 0,void 0,function(de){z=de}),t.operator==="+"?ie=this.plus(W,z):t.operator==="-"?ie=this.ifDefined(W,0)+t.operator+this.ifDefined(z,0):ie="("+W+")"+t.operator+"("+z+")",this.assign(d,ie),A(ie);break;case kt.LogicalExpression:d=d||this.nextId(),H.recurse(t.left,d),H.if_(t.operator==="&&"?d:H.not(d),H.lazyRecurse(t.right,d)),A(d);break;case kt.ConditionalExpression:d=d||this.nextId(),H.recurse(t.test,d),H.if_(d,H.lazyRecurse(t.alternate,d),H.lazyRecurse(t.consequent,d)),A(d);break;case kt.Identifier:d=d||this.nextId(),w&&(w.context=H.stage==="inputs"?"s":this.assign(this.nextId(),this.getHasOwnProperty("l",t.name)+"?l:s"),w.computed=!1,w.name=t.name),H.if_(H.stage==="inputs"||H.not(H.getHasOwnProperty("l",t.name)),function(){H.if_(H.stage==="inputs"||"s",function(){L&&L!==1&&H.if_(H.isNull(H.nonComputedMember("s",t.name)),H.lazyAssign(H.nonComputedMember("s",t.name),"{}")),H.assign(d,H.nonComputedMember("s",t.name))})},d&&H.lazyAssign(d,H.nonComputedMember("l",t.name))),A(d);break;case kt.MemberExpression:W=w&&(w.context=this.nextId())||this.nextId(),d=d||this.nextId(),H.recurse(t.object,W,void 0,function(){H.if_(H.notNull(W),function(){t.computed?(z=H.nextId(),H.recurse(t.property,z),H.getStringValue(z),L&&L!==1&&H.if_(H.not(H.computedMember(W,z)),H.lazyAssign(H.computedMember(W,z),"{}")),ie=H.computedMember(W,z),H.assign(d,ie),w&&(w.computed=!0,w.name=z)):(L&&L!==1&&H.if_(H.isNull(H.nonComputedMember(W,t.property.name)),H.lazyAssign(H.nonComputedMember(W,t.property.name),"{}")),ie=H.nonComputedMember(W,t.property.name),H.assign(d,ie),w&&(w.computed=!1,w.name=t.property.name))},function(){H.assign(d,"undefined")}),A(d)},!!L);break;case kt.CallExpression:d=d||this.nextId(),t.filter?(z=H.filter(t.callee.name),ne=[],n(t.arguments,function(de){var Ee=H.nextId();H.recurse(de,Ee),ne.push(Ee)}),ie=z+"("+ne.join(",")+")",H.assign(d,ie),A(d)):(z=H.nextId(),W={},ne=[],H.recurse(t.callee,z,W,function(){H.if_(H.notNull(z),function(){n(t.arguments,function(de){H.recurse(de,t.constant?void 0:H.nextId(),void 0,function(Ee){ne.push(Ee)})}),W.name?ie=H.member(W.context,W.name,W.computed)+"("+ne.join(",")+")":ie=z+"("+ne.join(",")+")",H.assign(d,ie)},function(){H.assign(d,"undefined")}),A(d)}));break;case kt.AssignmentExpression:z=this.nextId(),W={},this.recurse(t.left,void 0,W,function(){H.if_(H.notNull(W.context),function(){H.recurse(t.right,z),ie=H.member(W.context,W.name,W.computed)+t.operator+z,H.assign(d,ie),A(d||ie)})},1);break;case kt.ArrayExpression:ne=[],n(t.elements,function(de){H.recurse(de,t.constant?void 0:H.nextId(),void 0,function(Ee){ne.push(Ee)})}),ie="["+ne.join(",")+"]",this.assign(d,ie),A(d||ie);break;case kt.ObjectExpression:ne=[],ce=!1,n(t.properties,function(de){de.computed&&(ce=!0)}),ce?(d=d||this.nextId(),this.assign(d,"{}"),n(t.properties,function(de){de.computed?(W=H.nextId(),H.recurse(de.key,W)):W=de.key.type===kt.Identifier?de.key.name:""+de.key.value,z=H.nextId(),H.recurse(de.value,z),H.assign(H.member(d,W,de.computed),z)})):(n(t.properties,function(de){H.recurse(de.value,t.constant?void 0:H.nextId(),void 0,function(Ee){ne.push(H.escape(de.key.type===kt.Identifier?de.key.name:""+de.key.value)+":"+Ee)})}),ie="{"+ne.join(",")+"}",this.assign(d,ie)),A(d||ie);break;case kt.ThisExpression:this.assign(d,"s"),A(d||"s");break;case kt.LocalsExpression:this.assign(d,"l"),A(d||"l");break;case kt.NGValueParameter:this.assign(d,"v"),A(d||"v");break}},getHasOwnProperty:function(t,d){var w=t+"."+d,A=this.current().own;return A.hasOwnProperty(w)||(A[w]=this.nextId(!1,t+"&&("+this.escape(d)+" in "+t+")")),A[w]},assign:function(t,d){if(t)return this.current().body.push(t,"=",d,";"),t},filter:function(t){return this.state.filters.hasOwnProperty(t)||(this.state.filters[t]=this.nextId(!0)),this.state.filters[t]},ifDefined:function(t,d){return"ifDefined("+t+","+this.escape(d)+")"},plus:function(t,d){return"plus("+t+","+d+")"},return_:function(t){this.current().body.push("return ",t,";")},if_:function(t,d,w){if(t===!0)d();else{var A=this.current().body;A.push("if(",t,"){"),d(),A.push("}"),w&&(A.push("else{"),w(),A.push("}"))}},not:function(t){return"!("+t+")"},isNull:function(t){return t+"==null"},notNull:function(t){return t+"!=null"},nonComputedMember:function(t,d){var w=/^[$_a-zA-Z][$_a-zA-Z0-9]*$/,A=/[^$_a-zA-Z0-9]/g;return w.test(d)?t+"."+d:t+'["'+d.replace(A,this.stringEscapeFn)+'"]'},computedMember:function(t,d){return t+"["+d+"]"},member:function(t,d,w){return w?this.computedMember(t,d):this.nonComputedMember(t,d)},getStringValue:function(t){this.assign(t,"getStringValue("+t+")")},lazyRecurse:function(t,d,w,A,L,Z){var W=this;return function(){W.recurse(t,d,w,A,L,Z)}},lazyAssign:function(t,d){var w=this;return function(){w.assign(t,d)}},stringEscapeRegex:/[^ a-zA-Z0-9]/g,stringEscapeFn:function(t){return"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)},escape:function(t){if(X(t))return"'"+t.replace(this.stringEscapeRegex,this.stringEscapeFn)+"'";if(ee(t))return t.toString();if(t===!0)return"true";if(t===!1)return"false";if(t===null)return"null";if(typeof t=="undefined")return"undefined";throw Gr("esc","IMPOSSIBLE")},nextId:function(t,d){var w="v"+this.state.nextId++;return t||this.current().vars.push(w+(d?"="+d:"")),w},current:function(){return this.state[this.state.computing]}};function Mo(t){this.$filter=t}Mo.prototype={compile:function(t){var d=this;er(t,d.$filter);var w,A;(w=Po(t))&&(A=this.recurse(w));var L=Io(t.body),Z;L&&(Z=[],n(L,function(H,ne){var ie=d.recurse(H);ie.isPure=H.isPure,H.input=ie,Z.push(ie),H.watchId=ne}));var W=[];n(t.body,function(H){W.push(d.recurse(H.expression))});var z=t.body.length===0?g:t.body.length===1?W[0]:function(H,ne){var ie;return n(W,function(ce){ie=ce(H,ne)}),ie};return A&&(z.assign=function(H,ne,ie){return A(H,ie,ne)}),Z&&(z.inputs=Z),z},recurse:function(t,d,w){var A,L,Z=this,W;if(t.input)return this.inputs(t.input,t.watchId);switch(t.type){case kt.Literal:return this.value(t.value,d);case kt.UnaryExpression:return L=this.recurse(t.argument),this["unary"+t.operator](L,d);case kt.BinaryExpression:return A=this.recurse(t.left),L=this.recurse(t.right),this["binary"+t.operator](A,L,d);case kt.LogicalExpression:return A=this.recurse(t.left),L=this.recurse(t.right),this["binary"+t.operator](A,L,d);case kt.ConditionalExpression:return this["ternary?:"](this.recurse(t.test),this.recurse(t.alternate),this.recurse(t.consequent),d);case kt.Identifier:return Z.identifier(t.name,d,w);case kt.MemberExpression:return A=this.recurse(t.object,!1,!!w),t.computed||(L=t.property.name),t.computed&&(L=this.recurse(t.property)),t.computed?this.computedMember(A,L,d,w):this.nonComputedMember(A,L,d,w);case kt.CallExpression:return W=[],n(t.arguments,function(z){W.push(Z.recurse(z))}),t.filter&&(L=this.$filter(t.callee.name)),t.filter||(L=this.recurse(t.callee,!0)),t.filter?function(z,H,ne,ie){for(var ce=[],de=0;de":function(t,d,w){return function(A,L,Z,W){var z=t(A,L,Z,W)>d(A,L,Z,W);return w?{value:z}:z}},"binary<=":function(t,d,w){return function(A,L,Z,W){var z=t(A,L,Z,W)<=d(A,L,Z,W);return w?{value:z}:z}},"binary>=":function(t,d,w){return function(A,L,Z,W){var z=t(A,L,Z,W)>=d(A,L,Z,W);return w?{value:z}:z}},"binary&&":function(t,d,w){return function(A,L,Z,W){var z=t(A,L,Z,W)&&d(A,L,Z,W);return w?{value:z}:z}},"binary||":function(t,d,w){return function(A,L,Z,W){var z=t(A,L,Z,W)||d(A,L,Z,W);return w?{value:z}:z}},"ternary?:":function(t,d,w,A){return function(L,Z,W,z){var H=t(L,Z,W,z)?d(L,Z,W,z):w(L,Z,W,z);return A?{value:H}:H}},value:function(t,d){return function(){return d?{context:void 0,name:void 0,value:t}:t}},identifier:function(t,d,w){return function(A,L,Z,W){var z=L&&t in L?L:A;w&&w!==1&&z&&z[t]==null&&(z[t]={});var H=z?z[t]:void 0;return d?{context:z,name:t,value:H}:H}},computedMember:function(t,d,w,A){return function(L,Z,W,z){var H=t(L,Z,W,z),ne,ie;return H!=null&&(ne=d(L,Z,W,z),ne=Ri(ne),A&&A!==1&&H&&!H[ne]&&(H[ne]={}),ie=H[ne]),w?{context:H,name:ne,value:ie}:ie}},nonComputedMember:function(t,d,w,A){return function(L,Z,W,z){var H=t(L,Z,W,z);A&&A!==1&&H&&H[d]==null&&(H[d]={});var ne=H!=null?H[d]:void 0;return w?{context:H,name:d,value:ne}:ne}},inputs:function(t,d){return function(w,A,L,Z){return Z?Z[d]:t(w,A,L)}}};function is(t,d,w){this.ast=new kt(t,w),this.astCompiler=w.csp?new Mo(d):new Do(d)}is.prototype={constructor:is,parse:function(t){var d=this.getAst(t),w=this.astCompiler.compile(d.ast);return w.literal=rc(d.ast),w.constant=ic(d.ast),w.oneTime=d.oneTime,w},getAst:function(t){var d=!1;return t=t.trim(),t.charAt(0)===":"&&t.charAt(1)===":"&&(d=!0,t=t.substring(2)),{ast:this.ast.ast(t),oneTime:d}}};function Us(t){return B(t.valueOf)?t.valueOf():li.call(t)}function sc(){var t=Ft(),d={true:!0,false:!1,null:null,undefined:void 0},w,A;this.addLiteral=function(L,Z){d[L]=Z},this.setIdentifierFns=function(L,Z){return w=L,A=Z,this},this.$get=["$filter",function(L){var Z=q().noUnsafeEval,W={csp:Z,literals:ze(d),isIdentifierStart:B(w)&&w,isIdentifierContinue:B(A)&&A};return z.$$getAst=H,z;function z(nt,et){var Qe,ot;switch(typeof nt){case"string":if(nt=nt.trim(),ot=nt,Qe=t[ot],!Qe){var Oe=new Oi(W),He=new is(Oe,L,W);Qe=He.parse(nt),t[ot]=Se(Qe)}return mt(Qe,et);case"function":return mt(nt,et);default:return mt(g,et)}}function H(nt){var et=new Oi(W),Qe=new is(et,L,W);return Qe.getAst(nt).ast}function ne(nt,et,Qe){return nt==null||et==null?nt===et:typeof nt=="object"&&(nt=Us(nt),typeof nt=="object"&&!Qe)?!1:nt===et||nt!==nt&&et!==et}function ie(nt,et,Qe,ot,Oe){var He=ot.inputs,ye;if(He.length===1){var ge=ne;return He=He[0],nt.$watch(function(lt){var xt=He(lt);return ne(xt,ge,He.isPure)||(ye=ot(lt,void 0,void 0,[xt]),ge=xt&&Us(xt)),ye},et,Qe,Oe)}for(var $e=[],ke=[],Ge=0,at=He.length;Ge0&&ce(this.$$state),Ge},catch:function(ge){return this.then(null,ge)},finally:function(ge,$e){return this.then(function(ke){return et(ke,ot,ge)},function(ke){return et(ke,nt,ge)},$e)}});function ne(ge){var $e,ke,Ge;Ge=ge.pending,ge.processScheduled=!1,ge.pending=void 0;try{for(var at=0,Je=Ge.length;at=0&&(et(Je,-1),wt1,lt=0,xt=W(ye,Yt),Tt=[],wt={},It=!0,Jt=0;function Yt(En){ke=En;var An,On,Gn,jn,pr;if(!E(ke)){if(!U(ke))Ge!==ke&&(Ge=ke,lt++);else if(p(ke)){Ge!==Tt&&(Ge=Tt,Jt=Ge.length=0,lt++),An=ke.length,Jt!==An&&(lt++,Ge.length=Jt=An);for(var nr=0;nrAn){lt++;for(On in Ge)fe.call(ke,On)||(Jt--,delete Ge[On])}}return lt}}function un(){if(It?(It=!1,ge(ke,ke,$e)):ge(ke,at,$e),Je)if(!U(ke))at=ke;else if(p(ke)){at=new Array(ke.length);for(var En=0;En-1)throw Fr("iwcard","Illegal sequence *** in string matcher. String: {0}",t);return t=Be(t).replace(/\\\*\\\*/g,".*").replace(/\\\*/g,"[^:/.?&;]*"),new RegExp("^"+t+"$")}else{if(I(t))return new RegExp("^"+t.source+"$");throw Fr("imatcher",'Matchers may only be "self", string patterns or RegExp objects')}}function Uo(t){var d=[];return x(t)&&n(t,function(w){d.push(dc(w))}),d}function lc(){this.SCE_CONTEXTS=Nn;var t=["self"],d=[];this.trustedResourceUrlList=function(w){return arguments.length&&(t=Uo(w)),t},Object.defineProperty(this,"resourceUrlWhitelist",{get:function(){return this.trustedResourceUrlList},set:function(w){this.trustedResourceUrlList=w}}),this.bannedResourceUrlList=function(w){return arguments.length&&(d=Uo(w)),d},Object.defineProperty(this,"resourceUrlBlacklist",{get:function(){return this.bannedResourceUrlList},set:function(w){this.bannedResourceUrlList=w}}),this.$get=["$injector","$$sanitizeUri",function(w,A){var L=function(Se){throw Fr("unsafe","Attempting to use an unsafe value in a safe context.")};w.has("$sanitize")&&(L=w.get("$sanitize"));function Z(Ee,Se){return Ee==="self"?wc(Se)||Ec(Se):!!Ee.exec(Se.href)}function W(Ee){var Se=St(Ee.toString()),tt,mt,nt=!1;for(tt=0,mt=t.length;tt to the top of your HTML document. See http://docs.angularjs.org/api/ng.$sce for more information.");var A=se(Nn);A.isEnabled=function(){return t},A.trustAs=w.trustAs,A.getTrusted=w.getTrusted,A.valueOf=w.valueOf,t||(A.trustAs=A.getTrusted=function(z,H){return H},A.valueOf=S),A.parseAs=function(H,ne){var ie=d(ne);return ie.literal&&ie.constant?ie:d(ne,function(ce){return A.getTrusted(H,ce)})};var L=A.parseAs,Z=A.getTrusted,W=A.trustAs;return n(Nn,function(z,H){var ne=Ce(H);A[Fs("parse_as_"+ne)]=function(ie){return L(z,ie)},A[Fs("get_trusted_"+ne)]=function(ie){return Z(z,ie)},A[Fs("trust_as_"+ne)]=function(ie){return W(z,ie)}}),A}]}function No(){this.$get=["$window","$document",function(t,d){var w={},A=t.nw&&t.nw.process,L=!A&&t.chrome&&(t.chrome.app&&t.chrome.app.runtime||!t.chrome.app&&t.chrome.runtime&&t.chrome.runtime.id),Z=!L&&t.history&&t.history.pushState,W=i((/android (\d+)/.exec(Ce((t.navigator||{}).userAgent))||[])[1]),z=/Boxee/i.test((t.navigator||{}).userAgent),H=d[0]||{},ne=H.body&&H.body.style,ie=!1,ce=!1;return ne&&(ie="transition"in ne||"webkitTransition"in ne,ce="animation"in ne||"webkitAnimation"in ne),{history:!!(Z&&!(W<4)&&!z),hasEvent:function(de){if(de==="input"&&Ye)return!1;if(E(w[de])){var Ee=H.createElement("div");w[de]="on"+de in Ee}return w[de]},csp:q(),transitions:ie,animations:ce,android:W}}]}function mc(){this.$get=k(function(t){return new gc(t)})}function gc(t){var d=this,w={},A=[],L=d.ALL_TASKS_TYPE="$$all$$",Z=d.DEFAULT_TASK_TYPE="$$default$$";d.completeTask=W,d.incTaskCount=ie,d.notifyWhenNoPendingTasks=ce;function W(de,Ee){Ee=Ee||Z;try{de()}finally{z(Ee);var Se=w[Ee],tt=w[L];if(!tt||!Se)for(var mt=tt?ne:H,nt;nt=mt(Ee);)try{nt()}catch(et){t.error(et)}}}function z(de){de=de||Z,w[de]&&(w[de]--,w[L]--)}function H(){var de=A.pop();return de&&de.cb}function ne(de){for(var Ee=A.length-1;Ee>=0;--Ee){var Se=A[Ee];if(Se.type===de)return A.splice(Ee,1),Se.cb}}function ie(de){de=de||Z,w[de]=(w[de]||0)+1,w[L]=(w[L]||0)+1}function ce(de,Ee){Ee=Ee||L,w[Ee]?A.push({type:Ee,cb:de}):de()}}var Fo=rt("$templateRequest");function vc(){var t;this.httpOptions=function(d){return d?(t=d,this):t},this.$get=["$exceptionHandler","$templateCache","$http","$q","$sce",function(d,w,A,L,Z){function W(z,H){W.totalPendingRequests++,(!X(z)||E(w.get(z)))&&(z=Z.getTrustedResourceUrl(z));var ne=A.defaults&&A.defaults.transformResponse;return G(ne)?ne=ne.filter(function(ce){return ce!==ts}):ne===ts&&(ne=null),A.get(z,e({cache:w,transformResponse:ne},t)).finally(function(){W.totalPendingRequests--}).then(function(ce){return w.put(z,ce.data)},ie);function ie(ce){return H||(ce=Fo("tpload","Failed to load template: {0} (HTTP status: {1} {2})",z,ce.status,ce.statusText),d(ce)),L.reject(ce)}}return W.totalPendingRequests=0,W}]}function bc(){this.$get=["$rootScope","$browser","$location",function(t,d,w){var A={};return A.findBindings=function(L,Z,W){var z=L.getElementsByClassName("ng-binding"),H=[];return n(z,function(ne){var ie=l.element(ne).data("$binding");ie&&n(ie,function(ce){if(W){var de=new RegExp("(^|\\s)"+Be(Z)+"(\\s|\\||$)");de.test(ce)&&H.push(ne)}else ce.indexOf(Z)!==-1&&H.push(ne)})}),H},A.findModels=function(L,Z,W){for(var z=["ng-","data-ng-","ng\\:"],H=0;H-1&&(w="["+w+"]"),{href:tr.href,protocol:tr.protocol?tr.protocol.replace(/:$/,""):"",host:tr.host,search:tr.search?tr.search.replace(/^\?/,""):"",hash:tr.hash?tr.hash.replace(/^#/,""):"",hostname:w,port:tr.port,pathname:tr.pathname.charAt(0)==="/"?tr.pathname:"/"+tr.pathname}}function wc(t){return kn(t,jo)}function Ec(t){return kn(t,os())}function Ho(t){var d=[jo].concat(t.map(St));return function(A){var L=St(A);return d.some(kn.bind(null,L))}}function kn(t,d){return t=St(t),d=St(d),t.protocol===d.protocol&&t.host===d.host}function os(){return yt.document.baseURI?yt.document.baseURI:(mi||(mi=yt.document.createElement("a"),mi.href=".",mi=mi.cloneNode(!1)),mi.href)}function zo(){this.$get=k(yt)}function as(t){var d=t[0]||{},w={},A="";function L(W){try{return W.cookie||""}catch{return""}}function Z(W){try{return decodeURIComponent(W)}catch{return W}}return function(){var W,z,H,ne,ie,ce=L(d);if(ce!==A)for(A=ce,W=A.split("; "),w={},H=0;H0&&(ie=Z(z.substring(0,ne)),E(w[ie])&&(w[ie]=Z(z.substring(ne+1))));return w}}as.$inject=["$document"];function Sc(){this.$get=as}Wo.$inject=["$provide"];function Wo(t){var d="Filter";function w(A,L){if(U(A)){var Z={};return n(A,function(W,z){Z[z]=w(z,W)}),Z}else return t.factory(A+d,L)}this.register=w,this.$get=["$injector",function(A){return function(L){return A.get(L+d)}}],w("currency",Yo),w("date",Xo),w("filter",xc),w("json",oi),w("limitTo",Lc),w("lowercase",Dc),w("number",zs),w("orderBy",Zo),w("uppercase",Mc)}function xc(){return function(t,d,w,A){if(!p(t)){if(t==null)return t;throw rt("filter")("notarray","Expected array but received: {0}",t)}A=A||"$";var L=Ur(d),Z,W;switch(L){case"function":Z=d;break;case"boolean":case"null":case"number":case"string":W=!0;case"object":Z=$c(d,w,A,W);break;default:return t}return Array.prototype.filter.call(t,Z)}}function $c(t,d,w,A){var L=U(t)&&w in t,Z;return d===!0?d=Dt:B(d)||(d=function(W,z){return E(W)?!1:W===null||z===null?W===z:U(z)||U(W)&&!M(W)?!1:(W=Ce(""+W),z=Ce(""+z),W.indexOf(z)!==-1)}),Z=function(W){return L&&!U(W)?si(W,t[w],d,w,!1):si(W,t,d,w,A)},Z}function si(t,d,w,A,L,Z){var W=Ur(t),z=Ur(d);if(z==="string"&&d.charAt(0)==="!")return!si(t,d.substring(1),w,A,L);if(G(t))return t.some(function(de){return si(de,d,w,A,L)});switch(W){case"object":var H;if(L){for(H in t)if(H.charAt&&H.charAt(0)!=="$"&&si(t[H],d,w,A,!0))return!0;return Z?!1:si(t,d,w,A,!1)}else if(z==="object"){for(H in d){var ne=d[H];if(!(B(ne)||E(ne))){var ie=H===A,ce=ie?t:t[H];if(!si(ce,ne,w,A,ie,ie))return!1}}return!0}else return w(t,d);case"function":return!1;default:return w(t,d)}}function Ur(t){return t===null?"null":typeof t}var Vo=22,js=".",Hs="0";Yo.$inject=["$locale"];function Yo(t){var d=t.NUMBER_FORMATS;return function(w,A,L){E(A)&&(A=d.CURRENCY_SYM),E(L)&&(L=d.PATTERNS[1].maxFrac);var Z=A?/\u00A4/g:/\s*\u00A4\s*/g;return w==null?w:cs(w,d.PATTERNS[1],d.GROUP_SEP,d.DECIMAL_SEP,L).replace(Z,A)}}zs.$inject=["$locale"];function zs(t){var d=t.NUMBER_FORMATS;return function(w,A){return w==null?w:cs(w,d.PATTERNS[0],d.GROUP_SEP,d.DECIMAL_SEP,A)}}function kc(t){var d=0,w,A,L,Z,W;for((A=t.indexOf(js))>-1&&(t=t.replace(js,"")),(L=t.search(/e/i))>0?(A<0&&(A=L),A+=+t.slice(L+1),t=t.substring(0,L)):A<0&&(A=t.length),L=0;t.charAt(L)===Hs;L++);if(L===(W=t.length))w=[0],A=1;else{for(W--;t.charAt(W)===Hs;)W--;for(A-=L,w=[],Z=0;L<=W;L++,Z++)w[Z]=+t.charAt(L)}return A>Vo&&(w=w.splice(0,Vo-1),d=A-1,A=1),{d:w,e:d,i:A}}function Go(t,d,w,A){var L=t.d,Z=L.length-t.i;d=E(d)?Math.min(Math.max(w,Z),A):+d;var W=d+t.i,z=L[W];if(W>0){L.splice(Math.max(t.i,W));for(var H=W;H=5)if(W-1<0){for(var ie=0;ie>W;ie--)L.unshift(0),t.i++;L.unshift(1),t.i++}else L[W-1]++;for(;Z0?Ee=ie.splice(ce,ie.length):(Ee=ie,ie=[0]);var Se=[];for(ie.length>=d.lgSize&&Se.unshift(ie.splice(-d.lgSize,ie.length).join(""));ie.length>d.gSize;)Se.unshift(ie.splice(-d.gSize,ie.length).join(""));ie.length&&Se.unshift(ie.join("")),H=Se.join(w),Ee.length&&(H+=A+Ee.join("")),de&&(H+="e+"+de)}return t<0&&!W?d.negPre+H+d.negSuf:d.posPre+H+d.posSuf}function fs(t,d,w,A){var L="";for((t<0||A&&t<=0)&&(A?t=-t+1:(t=-t,L="-")),t=""+t;t.length0||W>-w)&&(W+=w),W===0&&w===-12&&(W=12),fs(W,d,A,L)}}function gi(t,d,w){return function(A,L){var Z=A["get"+t](),W=(w?"STANDALONE":"")+(d?"SHORT":""),z=$(W+t);return L[z][Z]}}function Ac(t,d,w){var A=-1*w,L=A>=0?"+":"";return L+=fs(Math[A>0?"floor":"ceil"](A/60),2)+fs(Math.abs(A%60),2),L}function qo(t){var d=new Date(t,0,1).getDay();return new Date(t,0,(d<=4?5:12)-d)}function Tc(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+(4-t.getDay()))}function Ko(t){return function(d){var w=qo(d.getFullYear()),A=Tc(d),L=+A-+w,Z=1+Math.round(L/6048e5);return fs(Z,t)}}function Cc(t,d){return t.getHours()<12?d.AMPMS[0]:d.AMPMS[1]}function Ws(t,d){return t.getFullYear()<=0?d.ERAS[0]:d.ERAS[1]}function Rc(t,d){return t.getFullYear()<=0?d.ERANAMES[0]:d.ERANAMES[1]}var Ic={yyyy:Fn("FullYear",4,0,!1,!0),yy:Fn("FullYear",2,0,!0,!0),y:Fn("FullYear",1,0,!1,!0),MMMM:gi("Month"),MMM:gi("Month",!0),MM:Fn("Month",2,1),M:Fn("Month",1,1),LLLL:gi("Month",!1,!0),dd:Fn("Date",2),d:Fn("Date",1),HH:Fn("Hours",2),H:Fn("Hours",1),hh:Fn("Hours",2,-12),h:Fn("Hours",1,-12),mm:Fn("Minutes",2),m:Fn("Minutes",1),ss:Fn("Seconds",2),s:Fn("Seconds",1),sss:Fn("Milliseconds",3),EEEE:gi("Day"),EEE:gi("Day",!0),a:Cc,Z:Ac,ww:Ko(2),w:Ko(1),G:Ws,GG:Ws,GGG:Ws,GGGG:Rc},Oc=/((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))([\s\S]*)/,Pc=/^-?\d+$/;Xo.$inject=["$locale"];function Xo(t){var d=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;function w(A){var L;if(L=A.match(d)){var Z=new Date(0),W=0,z=0,H=L[8]?Z.setUTCFullYear:Z.setFullYear,ne=L[8]?Z.setUTCHours:Z.setHours;L[9]&&(W=i(L[9]+L[10]),z=i(L[9]+L[11])),H.call(Z,i(L[1]),i(L[2])-1,i(L[3]));var ie=i(L[4]||0)-W,ce=i(L[5]||0)-z,de=i(L[6]||0),Ee=Math.round(parseFloat("0."+(L[7]||0))*1e3);return ne.call(Z,ie,ce,de,Ee),Z}return A}return function(A,L,Z){var W="",z=[],H,ne;if(L=L||"mediumDate",L=t.DATETIME_FORMATS[L]||L,X(A)&&(A=Pc.test(A)?i(A):w(A)),ee(A)&&(A=new Date(A)),!ue(A)||!isFinite(A.getTime()))return A;for(;L;)ne=Oc.exec(L),ne?(z=F(z,ne,1),L=z.pop()):(z.push(L),L=null);var ie=A.getTimezoneOffset();return Z&&(ie=pt(Z,ie),A=Ot(A,Z,!0)),n(z,function(ce){H=Ic[ce],W+=H?H(A,t.DATETIME_FORMATS,ie):ce==="''"?"'":ce.replace(/(^'|'$)/g,"").replace(/''/g,"'")}),W}}function oi(){return function(t,d){return E(d)&&(d=2),Pe(t,d)}}var Dc=k(Ce),Mc=k($);function Lc(){return function(t,d,w){return Math.abs(Number(d))===1/0?d=Number(d):d=i(d),c(d)||(ee(t)&&(t=t.toString()),!p(t))?t:(w=!w||isNaN(w)?0:i(w),w=w<0?Math.max(0,t.length+w):w,d>=0?Vs(t,w,w+d):w===0?Vs(t,d,t.length):Vs(t,Math.max(0,w+d),w))}}function Vs(t,d,w){return X(t)?t.slice(d,w):xe.call(t,d,w)}Zo.$inject=["$parse"];function Zo(t){return function(W,z,H,ne){if(W==null)return W;if(!p(W))throw rt("orderBy")("notarray","Expected array but received: {0}",W);G(z)||(z=[z]),z.length===0&&(z=["+"]);var ie=d(z),ce=H?-1:1,de=B(ne)?ne:Z,Ee=Array.prototype.map.call(W,Se);return Ee.sort(tt),W=Ee.map(function(mt){return mt.value}),W;function Se(mt,nt){return{value:mt,tieBreaker:{value:nt,type:"number",index:nt},predicateValues:ie.map(function(et){return L(et.get(mt),nt)})}}function tt(mt,nt){for(var et=0,Qe=ie.length;et=nt},z.$observe("min",function(ge){ge!==mt&&(nt=Oe(ge),mt=ge,H.$validate())})}if(x(z.max)||z.ngMax){var et=z.max||de(z.ngMax)(Z),Qe=Oe(et);H.$validators.max=function(ge){return!ot(ge)||E(Qe)||w(ge)<=Qe},z.$observe("max",function(ge){ge!==et&&(Qe=Oe(ge),et=ge,H.$validate())})}function ot(ge){return ge&&!(ge.getTime&&ge.getTime()!==ge.getTime())}function Oe(ge){return x(ge)&&!ue(ge)?He(ge)||void 0:ge}function He(ge,$e){var ke=H.$options.getOption("timezone");tt&&tt!==ke&&($e=Ve($e,pt(tt)));var Ge=w(ge,$e);return!isNaN(Ge)&&ke&&(Ge=Ot(Ge,ke)),Ge}function ye(ge,$e){var ke=A;Ee&&X(H.$options.getOption("timeSecondsFormat"))&&(ke=A.replace("ss.sss",H.$options.getOption("timeSecondsFormat")).replace(/:$/,""));var Ge=ce("date")(ge,ke,$e);return Ee&&H.$options.getOption("timeStripZeroSeconds")&&(Ge=Ge.replace(/(?::00)?(?:\.000)?$/,"")),Ge}}}function Fc(t,d,w,A,L){var Z=d[0],W=A.$$hasNativeValidators=U(Z.validity);W&&A.$parsers.push(function(z){var H=d.prop(Te)||{};if(H.badInput||H.typeMismatch){A.$$parserName=L;return}return z})}function uf(t){t.$parsers.push(function(d){if(t.$isEmpty(d))return null;if(re.test(d))return parseFloat(d);t.$$parserName="number"}),t.$formatters.push(function(d){if(!t.$isEmpty(d)){if(!ee(d))throw Ks("numfmt","Expected `{0}` to be a number",d);d=d.toString()}return d})}function zr(t){return x(t)&&!ee(t)&&(t=parseFloat(t)),c(t)?void 0:t}function jc(t){return(t|0)===t}function Hc(t){var d=t.toString(),w=d.indexOf(".");if(w===-1){if(-1=H},w.$observe("min",function(Se){Se!==ne&&(H=zr(Se),ne=Se,A.$validate())})}if(x(w.max)||w.ngMax){var ie=w.max||z(w.ngMax)(t),ce=zr(ie);A.$validators.max=function(Se,tt){return A.$isEmpty(tt)||E(ce)||tt<=ce},w.$observe("max",function(Se){Se!==ie&&(ce=zr(Se),ie=Se,A.$validate())})}if(x(w.step)||w.ngStep){var de=w.step||z(w.ngStep)(t),Ee=zr(de);A.$validators.step=function(Se,tt){return A.$isEmpty(tt)||E(Ee)||df(tt,H||0,Ee)},w.$observe("step",function(Se){Se!==de&&(Ee=zr(Se),de=Se,A.$validate())})}}function ah(t,d,w,A,L,Z){Fc(t,d,w,A,"range"),uf(A),ds(t,d,w,A,L,Z);var W=A.$$hasNativeValidators&&d[0].type==="range",z=W?0:void 0,H=W?100:void 0,ne=W?1:void 0,ie=d[0].validity,ce=x(w.min),de=x(w.max),Ee=x(w.step),Se=A.$render;A.$render=W&&x(ie.rangeUnderflow)&&x(ie.rangeOverflow)?function(){Se(),A.$setViewValue(d.val())}:Se,ce&&(z=zr(w.min),A.$validators.min=W?function(){return!0}:function(ot,Oe){return A.$isEmpty(Oe)||E(z)||Oe>=z},tt("min",mt)),de&&(H=zr(w.max),A.$validators.max=W?function(){return!0}:function(ot,Oe){return A.$isEmpty(Oe)||E(H)||Oe<=H},tt("max",nt)),Ee&&(ne=zr(w.step),A.$validators.step=W?function(){return!ie.stepMismatch}:function(ot,Oe){return A.$isEmpty(Oe)||E(ne)||df(Oe,z||0,ne)},tt("step",et));function tt(Qe,ot){d.attr(Qe,w[Qe]);var Oe=w[Qe];w.$observe(Qe,function(ye){ye!==Oe&&(Oe=ye,ot(ye))})}function mt(Qe){if(z=zr(Qe),!c(A.$modelValue))if(W){var ot=d.val();z>ot&&(ot=z,d.val(ot)),A.$setViewValue(ot)}else A.$validate()}function nt(Qe){if(H=zr(Qe),!c(A.$modelValue))if(W){var ot=d.val();H0||ie[He])&&(ie[He]=(ie[He]||0)+ot,ie[He]===+(ot>0)&&Oe.push(He))}),Oe.join(" ")}function nt(Qe){Qe===d?Ee(de):Se(de),ce=Qe}function et(Qe){ce===d&&tt(de,Qe),de=Qe}}}}];function A(W,z){if(!W||!W.length)return[];if(!z||!z.length)return W;var H=[];e:for(var ne=0;ne0?this.$$pendingDebounce=this.$$timeout(function(){w.$commitViewValue()},d):this.$$rootScope.$$phase?this.$commitViewValue():this.$$scope.$apply(function(){w.$commitViewValue()})},$overrideModelOptions:function(t){this.$options=this.$options.createChild(t),this.$$setUpdateOnEvents()},$processModelValue:function(){var t=this.$$format();this.$viewValue!==t&&(this.$$updateEmptyClasses(t),this.$viewValue=this.$$lastCommittedViewValue=t,this.$render(),this.$$runValidators(this.$modelValue,this.$viewValue,g))},$$format:function(){for(var t=this.$formatters,d=t.length,w=this.$modelValue;d--;)w=t[d](w);return w},$$setModelValue:function(t){this.$modelValue=this.$$rawModelValue=t,this.$$parserValid=void 0,this.$processModelValue()},$$setUpdateOnEvents:function(){this.$$updateEvents&&this.$$element.off(this.$$updateEvents,this.$$updateEventHandler),this.$$updateEvents=this.$options.getOption("updateOn"),this.$$updateEvents&&this.$$element.on(this.$$updateEvents,this.$$updateEventHandler)},$$updateEventHandler:function(t){this.$$debounceViewValueCommit(t&&t.type)}};function Rh(t){t.$$scope.$watch(function(w){var A=t.$$ngModelGet(w);return A!==t.$modelValue&&(t.$modelValue===t.$modelValue||A===A)&&t.$$setModelValue(A),A})}Pi({clazz:na,set:function(t,d){t[d]=!0},unset:function(t,d){delete t[d]}});var Ih=["$rootScope",function(t){return{restrict:"A",require:["ngModel","^?form","^?ngModelOptions"],controller:na,priority:1,compile:function(w){return w.addClass(ls).addClass(Wc).addClass(qs),{pre:function(L,Z,W,z){var H=z[0],ne=z[1]||H.$$parentForm,ie=z[2];ie&&(H.$options=ie.$options),H.$$initGetterSetters(),ne.$addControl(H),W.$observe("name",function(ce){H.$name!==ce&&H.$$parentForm.$$renameControl(H,ce)}),L.$on("$destroy",function(){H.$$parentForm.$removeControl(H)})},post:function(L,Z,W,z){var H=z[0];H.$$setUpdateOnEvents();function ne(){H.$setTouched()}Z.on("blur",function(){H.$touched||(t.$$phase?L.$evalAsync(ne):L.$apply(ne))})}}}}}],ra,Oh=/(\s+|^)default(\s+|$)/;function Vc(t){this.$$options=t}Vc.prototype={getOption:function(t){return this.$$options[t]},createChild:function(t){var d=!1;return t=e({},t),n(t,function(w,A){w==="$inherit"?A==="*"?d=!0:(t[A]=this.$$options[A],A==="updateOn"&&(t.updateOnDefault=this.$$options.updateOnDefault)):A==="updateOn"&&(t.updateOnDefault=!1,t[A]=we(w.replace(Oh,function(){return t.updateOnDefault=!0," "})))},this),d&&(delete t["*"],wf(t,this.$$options)),wf(t,ra.$$options),new Vc(t)}},ra=new Vc({updateOn:"",updateOnDefault:!0,debounce:0,getterSetter:!1,allowInvalid:!1,timezone:null});var Ph=function(){t.$inject=["$attrs","$scope"];function t(d,w){this.$$attrs=d,this.$$scope=w}return t.prototype={$onInit:function(){var d=this.parentCtrl?this.parentCtrl.$options:ra,w=this.$$scope.$eval(this.$$attrs.ngModelOptions);this.$options=d.createChild(w)}},{restrict:"A",priority:10,require:{parentCtrl:"?^^ngModelOptions"},bindToController:!0,controller:t}};function wf(t,d){n(d,function(w,A){x(t[A])||(t[A]=w)})}var Dh=vi({terminal:!0,priority:1e3}),Mh=rt("ngOptions"),Lh=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([$\w][$\w]*)|(?:\(\s*([$\w][$\w]*)\s*,\s*([$\w][$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,Bh=["$compile","$document","$parse",function(t,d,w){function A(z,H,ne){var ie=z.match(Lh);if(!ie)throw Mh("iexp","Expected expression in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got '{0}'. Element: {1}",z,bt(H));var ce=ie[5]||ie[7],de=ie[6],Ee=/ as /.test(ie[0])&&ie[1],Se=ie[9],tt=w(ie[2]?ie[1]:ce),mt=Ee&&w(Ee),nt=mt||tt,et=Se&&w(Se),Qe=Se?function(Je,lt){return et(ne,lt)}:function(lt){return Vr(lt)},ot=function(Je,lt){return Qe(Je,ke(Je,lt))},Oe=w(ie[2]||ie[1]),He=w(ie[3]||""),ye=w(ie[4]||""),ge=w(ie[8]),$e={},ke=de?function(Je,lt){return $e[de]=lt,$e[ce]=Je,$e}:function(Je){return $e[ce]=Je,$e};function Ge(Je,lt,xt,Tt,wt){this.selectValue=Je,this.viewValue=lt,this.label=xt,this.group=Tt,this.disabled=wt}function at(Je){var lt;if(!de&&p(Je))lt=Je;else{lt=[];for(var xt in Je)Je.hasOwnProperty(xt)&&xt.charAt(0)!=="$"&<.push(xt)}return lt}return{trackBy:Se,getTrackByValue:ot,getWatchables:w(ge,function(Je){var lt=[];Je=Je||[];for(var xt=at(Je),Tt=xt.length,wt=0;wt=0;Ge--){var at=Qe.items[Ge];x(at.group)?Si(at.element.parentNode):Si(at.element)}Qe=ot.getOptions();var Je={};if(Qe.items.forEach(function(wt){var It;x(wt.group)?(It=Je[wt.group],It||(It=Z.cloneNode(!1),Oe.appendChild(It),It.label=wt.group===null?"null":wt.group,Je[wt.group]=It),He(wt,It)):He(wt,Oe)}),H[0].appendChild(Oe),de.$render(),!de.$isEmpty(ke)){var lt=ce.readValue(),xt=ot.trackBy||Ee;(xt?!Dt(ke,lt):ke!==lt)&&(de.$setViewValue(lt),de.$render())}}}return{restrict:"A",terminal:!0,require:["select","ngModel"],link:{pre:function(H,ne,ie,ce){ce[0].registerOption=g},post:W}}}],Uh=["$locale","$interpolate","$log",function(t,d,w){var A=/{}/g,L=/^when(Minus)?(.+)$/;return{link:function(Z,W,z){var H=z.count,ne=z.$attr.when&&W.attr(z.$attr.when),ie=z.offset||0,ce=Z.$eval(ne)||{},de={},Ee=d.startSymbol(),Se=d.endSymbol(),tt=Ee+H+"-"+ie+Se,mt=l.noop,nt;n(z,function(Qe,ot){var Oe=L.exec(ot);if(Oe){var He=(Oe[1]?"-":"")+Ce(Oe[2]);ce[He]=W.attr(z.$attr[ot])}}),n(ce,function(Qe,ot){de[ot]=d(Qe.replace(A,tt))}),Z.$watch(H,function(ot){var Oe=parseFloat(ot),He=c(Oe);if(!He&&!(Oe in ce)&&(Oe=t.pluralCat(Oe-ie)),Oe!==nt&&!(He&&c(nt))){mt();var ye=de[Oe];E(ye)?(ot!=null&&w.debug("ngPluralize: no rule defined for '"+Oe+"' in "+ne),mt=g,et()):mt=Z.$watch(ye,et),nt=Oe}});function et(Qe){W.text(Qe||"")}}}}],Ef=rt("ngRef"),Nh=["$parse",function(t){return{priority:-1,restrict:"A",compile:function(d,w){var A=Br(st(d)),L=t(w.ngRef),Z=L.assign||function(){throw Ef("nonassign",'Expression in ngRef="{0}" is non-assignable!',w.ngRef)};return function(W,z,H){var ne;if(H.hasOwnProperty("ngRefRead")){if(H.ngRefRead==="$element")ne=z;else if(ne=z.data("$"+H.ngRefRead+"Controller"),!ne)throw Ef("noctrl",'The controller for ngRefRead="{0}" could not be found on ngRef="{1}"',H.ngRefRead,w.ngRef)}else ne=z.data("$"+A+"Controller");ne=ne||z,Z(W,ne),z.on("$destroy",function(){L(W)===ne&&Z(W,null)})}}}}],Fh=["$parse","$animate","$compile",function(t,d,w){var A="$$NG_REMOVED",L=rt("ngRepeat"),Z=function(ie,ce,de,Ee,Se,tt,mt){ie[de]=Ee,Se&&(ie[Se]=tt),ie.$index=ce,ie.$first=ce===0,ie.$last=ce===mt-1,ie.$middle=!(ie.$first||ie.$last),ie.$odd=!(ie.$even=(ce&1)===0)},W=function(ie){return ie.clone[0]},z=function(ie){return ie.clone[ie.clone.length-1]},H=function(ie,ce,de){return Vr(de)},ne=function(ie,ce){return ce};return{restrict:"A",multiElement:!0,transclude:"element",priority:1e3,terminal:!0,$$tlb:!0,compile:function(ce,de){var Ee=de.ngRepeat,Se=w.$$createComment("end ngRepeat",Ee),tt=Ee.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);if(!tt)throw L("iexp","Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",Ee);var mt=tt[1],nt=tt[2],et=tt[3],Qe=tt[4];if(tt=mt.match(/^(?:(\s*[$\w]+)|\(\s*([$\w]+)\s*,\s*([$\w]+)\s*\))$/),!tt)throw L("iidexp","'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.",mt);var ot=tt[3]||tt[1],Oe=tt[2];if(et&&(!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(et)||/^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent|\$root|\$id)$/.test(et)))throw L("badident","alias '{0}' is invalid --- must be a valid JS identifier which is not a reserved name.",et);var He;if(Qe){var ye={$id:Vr},ge=t(Qe);He=function($e,ke,Ge,at){return Oe&&(ye[Oe]=ke),ye[ot]=Ge,ye.$index=at,ge($e,ye)}}return function(ke,Ge,at,Je,lt){var xt=Ft();ke.$watchCollection(nt,function(wt){var It,Jt,Yt=Ge[0],un,En=Ft(),An,On,Gn,jn,pr,nr,hr,Wn,Mi;if(et&&(ke[et]=wt),p(wt))nr=wt,pr=He||H;else{pr=He||ne,nr=[];for(var Li in wt)fe.call(wt,Li)&&Li.charAt(0)!=="$"&&nr.push(Li)}for(An=nr.length,Wn=new Array(An),It=0;It=W}}}}}];function Cf(t,d,w){if(t){if(X(t)&&(t=new RegExp("^"+t+"$")),!t.test)throw rt("ngPattern")("noregexp","Expected {0} to be a RegExp but was {1}. Element: {2}",d,t,bt(w));return t}}function ia(t){var d=i(t);return c(d)?-1:d}if(yt.angular.bootstrap){yt.console&&console.log("WARNING: Tried to load AngularJS more than once.");return}or(),Fe(l),l.module("ngLocale",[],["$provide",function(t){var d={ZERO:"zero",ONE:"one",TWO:"two",FEW:"few",MANY:"many",OTHER:"other"};function w(L){L=L+"";var Z=L.indexOf(".");return Z==-1?0:L.length-Z-1}function A(L,Z){var W=Z;W===void 0&&(W=Math.min(w(L),3));var z=Math.pow(10,W),H=(L*z|0)%z;return{v:W,f:H}}t.value("$locale",{DATETIME_FORMATS:{AMPMS:["AM","PM"],DAY:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ERANAMES:["Before Christ","Anno Domini"],ERAS:["BC","AD"],FIRSTDAYOFWEEK:6,MONTH:["January","February","March","April","May","June","July","August","September","October","November","December"],SHORTDAY:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],SHORTMONTH:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],STANDALONEMONTH:["January","February","March","April","May","June","July","August","September","October","November","December"],WEEKENDRANGE:[5,6],fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",medium:"MMM d, y h:mm:ss a",mediumDate:"MMM d, y",mediumTime:"h:mm:ss a",short:"M/d/yy h:mm a",shortDate:"M/d/yy",shortTime:"h:mm a"},NUMBER_FORMATS:{CURRENCY_SYM:"$",DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2,minFrac:2,minInt:1,negPre:"-\xA4",negSuf:"",posPre:"\xA4",posSuf:""}]},id:"en-us",localeID:"en_US",pluralCat:function(L,Z){var W=L|0,z=A(L,Z);return W==1&&z.v==0?d.ONE:d.OTHER}})}]),Re(function(){rn(yt.document,Zn)})})(window);!window.angular.$$csp().noInlineStyle&&window.angular.element(document.head).prepend(window.angular.element("