diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..0c735597 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +node_modules +dist +.idea +yarn.lock +package-lock.json +.DS_Store +yarn-error.log +.yarnclean diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..1faf6c9c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "resources/themes"] + path = resources/themes + url = https://github.com/Apple-Music-Electron/Apple-Music-Electron-Themes.git diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile new file mode 100644 index 00000000..ff7a2046 --- /dev/null +++ b/.gitpod.Dockerfile @@ -0,0 +1,4 @@ +FROM gitpod/workspace-full-vnc +RUN sudo apt-get update && \ + sudo apt-get install -y libgtk-3-dev && \ + sudo rm -rf /var/lib/apt/lists/* \ No newline at end of file diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 00000000..6499bad0 --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,2 @@ +image: + file: .gitpod.Dockerfile \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..725da1eb --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,132 @@ +# Contributor Covenant Code of Conduct + +Translations for this Code of Conduct and the original ContributorCovenant organisation can be found below. +* [Translations](https://www.contributor-covenant.org/translations) +* [ContributorCovenant](https://github.com/EthicalSource/contributor_covenant0) + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +cryptofyre@protonmail.com. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..0bd87806 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,16 @@ +# Security Policy + +## Supported Versions + +Use this section to tell people about which versions of your project are +currently being supported with security updates. + +| Version | Supported | +| ------- | ------------------ | +| 2.0.0 > | :white_check_mark: | +| 1.5.9 | :x: | +| < 1.5.8 | :x: | + +## Reporting a Vulnerability + +Submit an issue or contact me in the Discussions tab and ill look into it. diff --git a/dockerfile b/dockerfile new file mode 100644 index 00000000..ff7a2046 --- /dev/null +++ b/dockerfile @@ -0,0 +1,4 @@ +FROM gitpod/workspace-full-vnc +RUN sudo apt-get update && \ + sudo apt-get install -y libgtk-3-dev && \ + sudo rm -rf /var/lib/apt/lists/* \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 00000000..c368d094 --- /dev/null +++ b/index.js @@ -0,0 +1,105 @@ +require('v8-compile-cache'); +const {app, session} = require('electron'); + +// Initialize the Preferences so verbose doesnt fuck up +const appFuncs = require('./resources/functions/app-init'); +app.ame = appFuncs() + +// Run all the Before App is Ready Stuff +app.ame.init.LoggingInit(); +app.ame.handler.LaunchHandler(); +app.ame.handler.InstanceHandler(); +app.ame.init.BaseInit(); +app.ame.wsapi.InitWebSockets() +app.ame.wsapi.InitWebServer() + +// Creating the Application Window and Calling all the Functions +function CreateWindow() { + if (app.isQuiting) { app.quit(); return; } + + app.win = app.ame.win.CreateBrowserWindow() // Create the BrowserWindow + + app.ame.handler.WindowStateHandler(); // Handling the Window + app.ame.handler.PlaybackStateHandler(); // Playback Change Listener + app.ame.handler.MediaStateHandler(); // Media Change Listener + app.ame.handler.LyricsHandler(); // Lyrics Handling + app.ame.handler.AudioHandler(); // Exclusive Audio Stuff + app.ame.handler.GoogleCastHandler(); // Chromecast + app.ame.handler.RendererListenerHandlers(); // Renderer Listeners + app.ame.handler.SettingsHandler(); // Handles updates to settings + + if (process.platform === 'win32' && app.transparency) { app.win.show() } // Show the window so SetThumbarButtons doesnt break + app.ame.win.SetButtons() // Set Inactive Thumbnail Toolbar Icons or TouchBar + app.ame.win.SetApplicationMenu() + app.ame.win.SetTaskList() + app.ame.utils.checkForUpdates() + + app.ame.win.HandleBrowserWindow(); +} + + +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* App Event Handlers +* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ + +app.on('ready', () => { + if (app.isQuiting) { app.quit(); return; } + + // Apple Header tomfoolery. + session.defaultSession.webRequest.onHeadersReceived((details, callback) => { + if(details.url.match(/^https:\/\/store-\d{3}\.blobstore\.apple\.com/) || details.url.startsWith("https://store-037.blobstore.apple.com")){ + details.responseHeaders['Access-Control-Allow-Origin'] = '*';} + if(details.url.includes('encoderWorker.umd.js')){ + details.responseHeaders['Content-Type'] = `text/javascript`; + } + details.responseHeaders['Content-Security-Policy'] = 'unsafe-inline' + callback({ responseHeaders: details.responseHeaders }) + }) + + const {AppReady} = require('./resources/functions/init') + AppReady() + + console.log('[Apple-Music-Electron] Application is Ready. Creating Window.') + CreateWindow() +}); + +// macOS Activate Handler +app.on('activate', () => { + if (app.win === null) { + CreateWindow() + } else { + app.win.show() + } +}) + +app.on('before-quit', () => { + console.verbose('before-quit'); + app.isQuiting = true; + app.ame.mpris.clearActivity(); + app.ame.discord.disconnect(); + console.warn('---------------------------------------------------------------------'); + console.warn(`${app.getName()} has closed.`); + console.warn('---------------------------------------------------------------------'); +}); + +app.on('will-quit', () => { console.verbose('will-quit'); }) +app.on('quit', () => { console.verbose('quit'); }) +app.on("window-all-closed", () => { console.verbose('window-all-closed'); if (process.platform !== 'darwin') app.quit(); }); + +// Widevine Stuff +app.on('widevine-ready', (version, lastVersion) => { + if (null !== lastVersion) { + console.log('[Apple-Music-Electron][Widevine] Widevine ' + version + ', upgraded from ' + lastVersion + ', is ready to be used!') + } else { + console.log('[Apple-Music-Electron][Widevine] Widevine ' + version + ' is ready to be used!') + } +}) + +app.on('widevine-update-pending', (currentVersion, pendingVersion) => { + console.log('[Apple-Music-Electron][Widevine] Widevine ' + currentVersion + ' is ready to be upgraded to ' + pendingVersion + '!') +}) + +app.on('widevine-error', (error) => { + console.log('[Apple-Music-Electron][Widevine] Widevine installation encountered an error: ' + error) + app.exit() +}) \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 00000000..7b7374df --- /dev/null +++ b/package.json @@ -0,0 +1,149 @@ +{ + "name": "apple-music-electron", + "applicationId": "AppleMusicElectron", + "productName": "Apple Music", + "version": "3.0.0", + "description": "An open-source, GPU-accelerated Electron application that emulates the Apple Music website in a customizable interface.", + "license": "MIT", + "author": "Apple Music Electron Team (https://applemusicelectron.com)", + "repository": "https://github.com/Apple-Music-Electron/Apple-Music-Electron.git", + "bugs": { + "url": "https://github.com/Apple-Music-Electron/Apple-Music-Electron/issues?q=is%3Aopen+is%3Aissue+label%3Abug" + }, + "homepage": "https://applemusicelectron.com/", + "buildResources": "resources", + "scripts": { + "init": "yarn install --force", + "start": "electron --enable-accelerated-mjpeg-decode --enable-accelerated-video --disable-gpu-driver-bug-workarounds --ignore-gpu-blacklist --enable-native-gpu-memory-buffers .", + "pack": "electron-builder --dir", + "dist": "electron-builder", + "postinstall": "electron-builder install-app-deps" + }, + "dependencies": { + "@sentry/electron": "^2.5.4", + "castv2-client": "github:vapormusic/node-castv2-client", + "chmodr": "^1.2.0", + "discord-rpc": "^4.0.1", + "electron-acrylic-window": "^0.5.9", + "electron-log": "^4.4.1", + "electron-store": "^8.0.1", + "electron-updater": "^4.3.9", + "electron-window-state": "^5.0.3", + "express": "^4.17.1", + "get-port": "^5.1.1", + "git-clone": "^0.2.0", + "lastfmapi": "^0.1.1", + "mdns-js": "github:bitfocus/node-mdns-js", + "mpris-service": "^2.1.2", + "naudiodon": "github:vapormusic/naudiodon", + "node-fetch": "^3.1.0", + "node-ssdp": "^4.0.1", + "opus-media-recorder": "^0.8.0", + "react": "^17.0.2", + "react-dom": "^17.0.2", + "regedit": "^5.0.0", + "register-scheme": "github:devsnek/node-register-scheme", + "request": "^2.88.2", + "rimraf": "^3.0.2", + "source-map-support": "^0.5.20", + "upnp-mediarenderer-client": "github:vapormusic/node-upnp-mediarenderer-client", + "v8-compile-cache": "^2.3.0", + "wavefile": "^11.0.0", + "ws": "^8.2.3", + "xml2js": "^0.4.23", + "youtube-search-without-api-key": "github:vapormusic/youtube-search" + }, + "devDependencies": { + "electron": "https://github.com/castlabs/electron-releases.git", + "electron-builder": "^22.13.1", + "electron-webpack": "^2.8.2", + "musickit-typescript": "^1.2.4", + "webpack": "~5.64.0" + }, + "fileAssociations": [ + { + "name": "Apple Music Electron", + "mimeType": "x-scheme-handler/ame;x-scheme-handler/itms;x-scheme-handler/itmss;x-scheme-handler/musics;x-scheme-handler/music;", + "schemes": [ + "ame", + "itms", + "itmss", + "musics", + "music" + ], + "protocols": [ + "ame", + "itms", + "itmss", + "musics", + "music" + ] + } + ], + "build": { + "electronVersion": "15.3.1", + "electronDownload": { + "version": "15.3.1-wvvmp", + "mirror": "https://github.com/castlabs/electron-releases/releases/download/v" + }, + "appId": "apple-music", + "protocols": [ + { + "name": "Apple Music Electron", + "schemes": [ + "ame", + "itms", + "itmss", + "musics", + "music" + ] + } + ], + "extends": null, + "files": [ + "**/*", + "./resources/icons/icon.*" + ], + "linux": { + "target": [ + "AppImage", + "deb", + "snap", + "rpm" + ], + "synopsis": "Electron wrapper for Apple Music Web App.", + "category": "AudioVideo", + "icon": "apple-music-electron", + "executableName": "apple-music-electron" + }, + "win": { + "target": [ + "nsis" + ], + "icon": "./resources/icons/icon.ico" + }, + "appx": { + "applicationId": "applemusicelectron", + "publisher": "CN=cryptofyre", + "displayName": "Apple Music Electron", + "identityName": "AppleMusicElectron", + "backgroundColor": "#CD001A", + "setBuildNumber": true + }, + "mac": { + "icon": "./resources/icons/icon.icns", + "category": "public.app-category.music", + "entitlements": "resources/entitlements.mac.plist", + "darkModeSupport": true + }, + "extraResources": [ + { + "from": "node_modules/regedit/vbs", + "to": "regedit/vbs", + "filter": [ + "**/*" + ] + } + ] + } +} diff --git a/resources/apple-music-electron.desktop b/resources/apple-music-electron.desktop new file mode 100644 index 00000000..a8aa1f7a --- /dev/null +++ b/resources/apple-music-electron.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=Apple Music +Exec="/opt/Apple Music/apple-music-electron" %U +Terminal=false +Type=Application +Icon=apple-music-electron +StartupWMClass=Apple Music +Comment=An open-source, GPU-accelerated Electron application that emulates the Apple Music website in a customizable interface. +MimeType=x-scheme-handler/ame;x-scheme-handler/itms;x-scheme-handler/itmss;x-scheme-handler/musics;x-scheme-handler/music; +Categories=AudioVideo; \ No newline at end of file diff --git a/resources/appx/Square150x150Logo.png b/resources/appx/Square150x150Logo.png new file mode 100644 index 00000000..552b0cc1 Binary files /dev/null and b/resources/appx/Square150x150Logo.png differ diff --git a/resources/appx/Square44x44Logo.png b/resources/appx/Square44x44Logo.png new file mode 100644 index 00000000..4b3f86b4 Binary files /dev/null and b/resources/appx/Square44x44Logo.png differ diff --git a/resources/appx/Wide310x150Logo.png b/resources/appx/Wide310x150Logo.png new file mode 100644 index 00000000..13a21777 Binary files /dev/null and b/resources/appx/Wide310x150Logo.png differ diff --git a/resources/appx/logo.png b/resources/appx/logo.png new file mode 100644 index 00000000..ce0ec5d7 Binary files /dev/null and b/resources/appx/logo.png differ diff --git a/resources/content/oobe/oobe.webm b/resources/content/oobe/oobe.webm new file mode 100644 index 00000000..14329d01 Binary files /dev/null and b/resources/content/oobe/oobe.webm differ diff --git a/resources/content/startup.webm b/resources/content/startup.webm new file mode 100644 index 00000000..b7a2a41f Binary files /dev/null and b/resources/content/startup.webm differ diff --git a/resources/css/ameframework.css b/resources/css/ameframework.css new file mode 100644 index 00000000..a7b524a3 --- /dev/null +++ b/resources/css/ameframework.css @@ -0,0 +1,1039 @@ +/* Simple CSS framework for Apple Music Electron */ + +.md-labeltext { + font-size: 14px; + text-transform: uppercase; + opacity: 0.75; + font-weight: 500; +} + +.md-option-container { + border-radius: 10px; + overflow: hidden; +} + +.md-option-line { + display: flex; + width: 100%; + padding: 14px; + background: var(--opaquePageBGColor); + font-size: 0.85em; +} + +.md-option-segment.md-option-segment_auto { + width: auto; +} + +.md-option-container .md-option-line:not(:last-child) { + border-bottom: 1px solid rgb(0 0 0 / 15%); +} + +input[type="range"].md-slider { + -webkit-appearance: none; + height: 7px; + background: rgba(255, 255, 255, 0.6); + border-radius: 5px; + background-size: 70% 100%; + background-repeat: no-repeat; +} + +input[type="range"].md-slider::-webkit-slider-thumb { + -webkit-appearance: none; + height: 20px; + width: 20px; + border-radius: 50%; + background: rgb(255 255 255); + cursor: ew-resize; + box-shadow: 0 0 2px 0 #555; +} + +input[type=range].md-slider::-webkit-slider-runnable-track { + -webkit-appearance: none; + box-shadow: none; + border: none; + background: transparent; +} + +.md-option-segment { + width: 100%; + display: flex; + justify-content: center; + flex-direction: column; +} + +.md-h1 { + font-size: 3em; + text-align: center; +} + +.md-header { + padding: 16px; +} + +.md-header-title { + padding: 18px; + font-weight: 600; + font-size: 16px; + height: 55px; + background: var(--opaquePageBGColor); + border-bottom: 1px solid rgb(0 0 0 / 15%); +} + +.md-footer { + padding: 16px; + text-align: center; +} + + +.md-close-btn { + -webkit-mask-image: url("ameres://icons/webui/close.svg"); + -webkit-mask-repeat: no-repeat; + -webkit-mask-position: center; + background-color: white; + opacity: 0.75; + -webkit-mask-size: contain; + height: 18px; + width: 18px; +} + +.md-btn { + background: rgba(100, 100, 100, 0.5); + padding: 8px 16px; + border-radius: 4px; + font-size: 15px; + border: 1px solid rgb(100 100 100 / 35%); + box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.3), 0px 1px 1px rgba(0, 0, 0, 0.4); +} + +.md-btn.md-btn-block { + display: block; +} + +.md-btn:active { + filter: brightness(75%); +} + +.md-select { + padding: 5px 10px; + font-size: 1em; + font-family: inherit; + border-radius: 4px; + border: 1px solid rgb(100 100 100 / 35%); + box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.3), 0px 1px 1px rgba(0, 0, 0, 0.4); +} + +.md-select:focus { + outline: none; +} + +.md-select > option { + font-size: 1em; + font-family: inherit; + padding: 8px 16px; +} + +.md-btn.md-btn-primary { + background: var(--keyColor); + color: white; +} + +.md-transparent { + background: transparent; +} + +.md-container { + display: flex; + flex-direction: column; + height: 100%; + position: absolute; + top: 0px; + left: 0px; + width: 100%; + padding: 32px; +} + +.md-container_panel { + padding: 0px; +} + +.md-body { + height: 100%; + padding: 16px; + font-size: 1.25em; +} + +@media (prefers-color-scheme: light) { + .md-btn { + background: rgb(255 255 255); + box-shadow: rgb(0 0 0 / 10%) 0px 0px 1px, rgb(0 0 0 / 20%) 0px 1px 1px; + border: 1px solid rgb(0 0 0 / 15%); + } + + .md-close-btn { + background-color: #000; + } +} + +/* Vue transitions */ +.fade_simple-enter-active, .fade_simple-leave-active { + transition: all .5s; +} + +.fade_simple-enter, .fade_simple-leave-to { + opacity: 0; +} + +.fade-enter-active, .fade-leave-active { + transition: all .5s; +} + +.fade-enter, .fade-leave-to { + opacity: 0; + transform: scale(0.95); +} + +/* CSS Grids */ + +.container, +.container-fluid, +.container-xxl, +.container-xl, +.container-lg, +.container-md, +.container-sm { + width: 100%; + padding-right: var(--bs-gutter-x, 0.75rem); + padding-left: var(--bs-gutter-x, 0.75rem); + margin-right: auto; + margin-left: auto; +} + +.row { + --bs-gutter-x: 1.5rem; + --bs-gutter-y: 0; + display: flex; + flex-wrap: wrap; + margin-top: calc(-1 * var(--bs-gutter-y)); + margin-right: calc(-0.5 * var(--bs-gutter-x)); + margin-left: calc(-0.5 * var(--bs-gutter-x)); +} + +.row > * { + box-sizing: border-box; + flex-shrink: 0; + width: 100%; + max-width: 100%; + padding-right: calc(var(--bs-gutter-x) * 0.5); + padding-left: calc(var(--bs-gutter-x) * 0.5); + margin-top: var(--bs-gutter-y); +} + +.col { + flex: 1 0 0%; +} + +.row-cols-auto > * { + flex: 0 0 auto; + width: auto; +} + +.row-cols-1 > * { + flex: 0 0 auto; + width: 100%; +} + +.row-cols-2 > * { + flex: 0 0 auto; + width: 50%; +} + +.row-cols-3 > * { + flex: 0 0 auto; + width: 33.3333333333%; +} + +.row-cols-4 > * { + flex: 0 0 auto; + width: 25%; +} + +.row-cols-5 > * { + flex: 0 0 auto; + width: 20%; +} + +.row-cols-6 > * { + flex: 0 0 auto; + width: 16.6666666667%; +} + +.col-auto { + flex: 0 0 auto; + width: auto; +} + +.col-1 { + flex: 0 0 auto; + width: 8.33333333%; +} + +.col-2 { + flex: 0 0 auto; + width: 16.66666667%; +} + +.col-3 { + flex: 0 0 auto; + width: 25%; +} + +.col-4 { + flex: 0 0 auto; + width: 33.33333333%; +} + +.col-5 { + flex: 0 0 auto; + width: 41.66666667%; +} + +.col-6 { + flex: 0 0 auto; + width: 50%; +} + +.col-7 { + flex: 0 0 auto; + width: 58.33333333%; +} + +.col-8 { + flex: 0 0 auto; + width: 66.66666667%; +} + +.col-9 { + flex: 0 0 auto; + width: 75%; +} + +.col-10 { + flex: 0 0 auto; + width: 83.33333333%; +} + +.col-11 { + flex: 0 0 auto; + width: 91.66666667%; +} + +.col-12 { + flex: 0 0 auto; + width: 100%; +} + +.offset-1 { + margin-left: 8.33333333%; +} + +.offset-2 { + margin-left: 16.66666667%; +} + +.offset-3 { + margin-left: 25%; +} + +.offset-4 { + margin-left: 33.33333333%; +} + +.offset-5 { + margin-left: 41.66666667%; +} + +.offset-6 { + margin-left: 50%; +} + +.offset-7 { + margin-left: 58.33333333%; +} + +.offset-8 { + margin-left: 66.66666667%; +} + +.offset-9 { + margin-left: 75%; +} + +.offset-10 { + margin-left: 83.33333333%; +} + +.offset-11 { + margin-left: 91.66666667%; +} + +.g-0, +.gx-0 { + --bs-gutter-x: 0; +} + +.g-0, +.gy-0 { + --bs-gutter-y: 0; +} + +.g-1, +.gx-1 { + --bs-gutter-x: 0.25rem; +} + +.g-1, +.gy-1 { + --bs-gutter-y: 0.25rem; +} + +.g-2, +.gx-2 { + --bs-gutter-x: 0.5rem; +} + +.g-2, +.gy-2 { + --bs-gutter-y: 0.5rem; +} + +.g-3, +.gx-3 { + --bs-gutter-x: 1rem; +} + +.g-3, +.gy-3 { + --bs-gutter-y: 1rem; +} + +.g-4, +.gx-4 { + --bs-gutter-x: 1.5rem; +} + +.g-4, +.gy-4 { + --bs-gutter-y: 1.5rem; +} + +.g-5, +.gx-5 { + --bs-gutter-x: 3rem; +} + +.g-5, +.gy-5 { + --bs-gutter-y: 3rem; +} + +.d-inline { + display: inline !important; +} + +.d-inline-block { + display: inline-block !important; +} + +.d-block { + display: block !important; +} + +.d-grid { + display: grid !important; +} + +.d-table { + display: table !important; +} + +.d-table-row { + display: table-row !important; +} + +.d-table-cell { + display: table-cell !important; +} + +.d-flex { + display: flex !important; +} + +.d-inline-flex { + display: inline-flex !important; +} + +.d-none { + display: none !important; +} + +.flex-fill { + flex: 1 1 auto !important; +} + +.flex-row { + flex-direction: row !important; +} + +.flex-column { + flex-direction: column !important; +} + +.flex-row-reverse { + flex-direction: row-reverse !important; +} + +.flex-column-reverse { + flex-direction: column-reverse !important; +} + +.flex-grow-0 { + flex-grow: 0 !important; +} + +.flex-grow-1 { + flex-grow: 1 !important; +} + +.flex-shrink-0 { + flex-shrink: 0 !important; +} + +.flex-shrink-1 { + flex-shrink: 1 !important; +} + +.flex-wrap { + flex-wrap: wrap !important; +} + +.flex-nowrap { + flex-wrap: nowrap !important; +} + +.flex-wrap-reverse { + flex-wrap: wrap-reverse !important; +} + +.justify-content-start { + justify-content: flex-start !important; +} + +.justify-content-end { + justify-content: flex-end !important; +} + +.justify-content-center { + justify-content: center !important; +} + +.justify-content-between { + justify-content: space-between !important; +} + +.justify-content-around { + justify-content: space-around !important; +} + +.justify-content-evenly { + justify-content: space-evenly !important; +} + +.align-items-start { + align-items: flex-start !important; +} + +.align-items-end { + align-items: flex-end !important; +} + +.align-items-center { + align-items: center !important; +} + +.align-items-baseline { + align-items: baseline !important; +} + +.align-items-stretch { + align-items: stretch !important; +} + +.align-content-start { + align-content: flex-start !important; +} + +.align-content-end { + align-content: flex-end !important; +} + +.align-content-center { + align-content: center !important; +} + +.align-content-between { + align-content: space-between !important; +} + +.align-content-around { + align-content: space-around !important; +} + +.align-content-stretch { + align-content: stretch !important; +} + +.align-self-auto { + align-self: auto !important; +} + +.align-self-start { + align-self: flex-start !important; +} + +.align-self-end { + align-self: flex-end !important; +} + +.align-self-center { + align-self: center !important; +} + +.align-self-baseline { + align-self: baseline !important; +} + +.align-self-stretch { + align-self: stretch !important; +} + +.order-first { + order: -1 !important; +} + +.order-0 { + order: 0 !important; +} + +.order-1 { + order: 1 !important; +} + +.order-2 { + order: 2 !important; +} + +.order-3 { + order: 3 !important; +} + +.order-4 { + order: 4 !important; +} + +.order-5 { + order: 5 !important; +} + +.order-last { + order: 6 !important; +} + +.m-0 { + margin: 0 !important; +} + +.m-1 { + margin: 0.25rem !important; +} + +.m-2 { + margin: 0.5rem !important; +} + +.m-3 { + margin: 1rem !important; +} + +.m-4 { + margin: 1.5rem !important; +} + +.m-5 { + margin: 3rem !important; +} + +.m-auto { + margin: auto !important; +} + +.mx-0 { + margin-right: 0 !important; + margin-left: 0 !important; +} + +.mx-1 { + margin-right: 0.25rem !important; + margin-left: 0.25rem !important; +} + +.mx-2 { + margin-right: 0.5rem !important; + margin-left: 0.5rem !important; +} + +.mx-3 { + margin-right: 1rem !important; + margin-left: 1rem !important; +} + +.mx-4 { + margin-right: 1.5rem !important; + margin-left: 1.5rem !important; +} + +.mx-5 { + margin-right: 3rem !important; + margin-left: 3rem !important; +} + +.mx-auto { + margin-right: auto !important; + margin-left: auto !important; +} + +.my-0 { + margin-top: 0 !important; + margin-bottom: 0 !important; +} + +.my-1 { + margin-top: 0.25rem !important; + margin-bottom: 0.25rem !important; +} + +.my-2 { + margin-top: 0.5rem !important; + margin-bottom: 0.5rem !important; +} + +.my-3 { + margin-top: 1rem !important; + margin-bottom: 1rem !important; +} + +.my-4 { + margin-top: 1.5rem !important; + margin-bottom: 1.5rem !important; +} + +.my-5 { + margin-top: 3rem !important; + margin-bottom: 3rem !important; +} + +.my-auto { + margin-top: auto !important; + margin-bottom: auto !important; +} + +.mt-0 { + margin-top: 0 !important; +} + +.mt-1 { + margin-top: 0.25rem !important; +} + +.mt-2 { + margin-top: 0.5rem !important; +} + +.mt-3 { + margin-top: 1rem !important; +} + +.mt-4 { + margin-top: 1.5rem !important; +} + +.mt-5 { + margin-top: 3rem !important; +} + +.mt-auto { + margin-top: auto !important; +} + +.me-0 { + margin-right: 0 !important; +} + +.me-1 { + margin-right: 0.25rem !important; +} + +.me-2 { + margin-right: 0.5rem !important; +} + +.me-3 { + margin-right: 1rem !important; +} + +.me-4 { + margin-right: 1.5rem !important; +} + +.me-5 { + margin-right: 3rem !important; +} + +.me-auto { + margin-right: auto !important; +} + +.mb-0 { + margin-bottom: 0 !important; +} + +.mb-1 { + margin-bottom: 0.25rem !important; +} + +.mb-2 { + margin-bottom: 0.5rem !important; +} + +.mb-3 { + margin-bottom: 1rem !important; +} + +.mb-4 { + margin-bottom: 1.5rem !important; +} + +.mb-5 { + margin-bottom: 3rem !important; +} + +.mb-auto { + margin-bottom: auto !important; +} + +.ms-0 { + margin-left: 0 !important; +} + +.ms-1 { + margin-left: 0.25rem !important; +} + +.ms-2 { + margin-left: 0.5rem !important; +} + +.ms-3 { + margin-left: 1rem !important; +} + +.ms-4 { + margin-left: 1.5rem !important; +} + +.ms-5 { + margin-left: 3rem !important; +} + +.ms-auto { + margin-left: auto !important; +} + +.p-0 { + padding: 0 !important; +} + +.p-1 { + padding: 0.25rem !important; +} + +.p-2 { + padding: 0.5rem !important; +} + +.p-3 { + padding: 1rem !important; +} + +.p-4 { + padding: 1.5rem !important; +} + +.p-5 { + padding: 3rem !important; +} + +.px-0 { + padding-right: 0 !important; + padding-left: 0 !important; +} + +.px-1 { + padding-right: 0.25rem !important; + padding-left: 0.25rem !important; +} + +.px-2 { + padding-right: 0.5rem !important; + padding-left: 0.5rem !important; +} + +.px-3 { + padding-right: 1rem !important; + padding-left: 1rem !important; +} + +.px-4 { + padding-right: 1.5rem !important; + padding-left: 1.5rem !important; +} + +.px-5 { + padding-right: 3rem !important; + padding-left: 3rem !important; +} + +.py-0 { + padding-top: 0 !important; + padding-bottom: 0 !important; +} + +.py-1 { + padding-top: 0.25rem !important; + padding-bottom: 0.25rem !important; +} + +.py-2 { + padding-top: 0.5rem !important; + padding-bottom: 0.5rem !important; +} + +.py-3 { + padding-top: 1rem !important; + padding-bottom: 1rem !important; +} + +.py-4 { + padding-top: 1.5rem !important; + padding-bottom: 1.5rem !important; +} + +.py-5 { + padding-top: 3rem !important; + padding-bottom: 3rem !important; +} + +.pt-0 { + padding-top: 0 !important; +} + +.pt-1 { + padding-top: 0.25rem !important; +} + +.pt-2 { + padding-top: 0.5rem !important; +} + +.pt-3 { + padding-top: 1rem !important; +} + +.pt-4 { + padding-top: 1.5rem !important; +} + +.pt-5 { + padding-top: 3rem !important; +} + +.pe-0 { + padding-right: 0 !important; +} + +.pe-1 { + padding-right: 0.25rem !important; +} + +.pe-2 { + padding-right: 0.5rem !important; +} + +.pe-3 { + padding-right: 1rem !important; +} + +.pe-4 { + padding-right: 1.5rem !important; +} + +.pe-5 { + padding-right: 3rem !important; +} + +.pb-0 { + padding-bottom: 0 !important; +} + +.pb-1 { + padding-bottom: 0.25rem !important; +} + +.pb-2 { + padding-bottom: 0.5rem !important; +} + +.pb-3 { + padding-bottom: 1rem !important; +} + +.pb-4 { + padding-bottom: 1.5rem !important; +} + +.pb-5 { + padding-bottom: 3rem !important; +} + +.ps-0 { + padding-left: 0 !important; +} + +.ps-1 { + padding-left: 0.25rem !important; +} + +.ps-2 { + padding-left: 0.5rem !important; +} + +.ps-3 { + padding-left: 1rem !important; +} + +.ps-4 { + padding-left: 1.5rem !important; +} + +.ps-5 { + padding-left: 3rem !important; +} \ No newline at end of file diff --git a/resources/css/custom-stylesheet.css b/resources/css/custom-stylesheet.css new file mode 100644 index 00000000..e7c29aaa --- /dev/null +++ b/resources/css/custom-stylesheet.css @@ -0,0 +1,778 @@ +:root { + --backButtonBar-height: 40px; +} + +body[platform="Linux x86_64"], +body[platform="Linux"], +body[platform="Linux x86"], +body[platform="Linux ARM"] +{ + font-family: -apple-system,BlinkMacSystemFont,"SF Pro","SF Pro Icons","Helvetica Neue",Helvetica,Arial,sans-serif; +} + +/* Back Button CSS */ + +body[back-button] .playlist .songs-list__header-col, .room .songs-list__header-col { + top: var(--backButtonBar-height)!important; +} + +#backButtonBar { + position: absolute; + width: calc(100vw - var(--web-navigation-width)); + top: 0; + height: var(--backButtonBar-height); + transition: 0.2s; + background-color: transparent; + padding: 5px 10px; + z-index: 9902; + opacity: 0.95; + top: 55px; +} + +#backButtonBar .button-area { + position: relative; + width: 50px; + height: 30px; + max-height: 30px; + cursor: pointer; + background-color: rgba(0, 0, 0, 0); + border-radius: 7px; + opacity: 1; + transition: 0.2s; +} + +#backButtonBar .button-area:active { + background-color: var(--segmentedControlSelectedBG) !important; + backdrop-filter: saturate(0%) blur(25px) !important; + box-shadow: 0 0 0.5px var(--segmentedControlSelectedBorder), + 0 3px 8px var(--segmentedControlSelectedShadow1), + 0 3px 1px var(--segmentedControlSelectedShadow2); +} + +#backButtonBar .button-area img:active { + opacity: 1 !important; +} + +#backButtonBar .button-area img { + display: block; + margin: auto; + width: auto; + height: auto; + opacity: 0.5; + z-index: 10000; + transition: 0.2s; +} + +#backButtonBar .button-area img:hover { + opacity: 1; +} + +@media only screen and (max-width: 483px) { + #backButtonBar { + width: 100%; + top: 44px; + } +} + +@media (prefers-color-scheme: dark) { + #backButtonBar .button-area img { + filter: brightness(0) invert(1); + } +} + +/* Settings Menu CSS */ + +.application-preferences { + width: 100%; + height: 100%; + padding-top: 50px; + display: grid; + grid-template-rows: auto auto auto auto; + grid-template-columns: auto; +} + +.app-prefs-section { + width: 100%; + height: auto; +} + +.app-prefs-section .settings-list { + padding: 0 10% +} + +span.app-prefs-title { + height: 10px !important; +} + +.settings-list { + margin: 50px 10px 50px 10px; +} + +.settings-list li { + margin: 30px 0 30px 10px; +} + +.settings-list li .list-element { + position: relative; + float: right; +} + +.application-preferences .app-prefs-section .header-nav-image { + width: auto; + height: 30px; + margin-right: 20px; +} + +@media (prefers-color-scheme: dark) { + .application-preferences .app-prefs-section .header-nav-image { + filter: invert(100%); + } +} + +.application-preferences .app-prefs-section #advanced { + transform: translateY(-2000px) translateZ(0); + visibility: hidden; + opacity: 0; + transition: opacity .3s ease 0s, transform 0s linear .9s; + position: absolute; +} + +.application-preferences .app-prefs-section .revealed { + transform: translateY(0px) !important; + visibility: visible !important; + opacity: 1 !important; + transition: top 0s linear 0s, opacity .3s ease .01s !important; + position: relative !important; +} + +/* Credits Section */ + +.app-prefs-credits { + margin-top: 20px; +} + +.app-prefs-credits .dt-footer__list .dt-footer__item { + margin-top: 20px; + display: grid; + grid-template-rows: 15px auto; + grid-template-columns: auto; +} + +.app-prefs-credits .dt-footer__list .dt-footer__item ul { + margin-top: 10px; +} + +.app-prefs-credits .dt-footer__list { + display: flex; + max-width: 800px; +} + +.app-prefs-credits .dt-footer__list .dt-footer__item .dt-footer__link { + grid-row: 1; + margin-bottom: 10px; +} + +.app-prefs-credits .dt-footer__list .dt-footer__item .dt-footer__list-item { + grid-row: 2; + color: var(--systemSecondary); + margin: 5px 0; +} + +.app-prefs-credits .dt-footer__list .dt-footer__item .dt-footer__list-item a { + color: var(--systemSecondary) !important; +} + +/* Help */ +.settings-list .app-prefs-help { + color: #808080; + margin: 0 0; + font-size: 12px; + display: block; +} + +.header-nav-content .app-prefs-help { + position: relative; + float: right; + color: #808080; + display: block; + font-size: 12px; + margin-bottom: 6px; + -webkit-margin-end: 25px; + margin-inline-end: 25px; +} + +.settings-list .app-prefs-divider .app-prefs-help { + font-size: 10px !important; + margin-left: 20px !important; +} + +/* Divider */ +.settings-list .app-prefs-divider { + margin: 0 0; +} + +/* Buttons */ +.settings-list li .list-button { + color: var(--systemPrimary); + padding: 5px 10px; + margin-left: 20px; + border-radius: 5px; + cursor: pointer; + font-size: 15px; + font-family: SF Pro Text, SF Pro Icons, Helvetica Neue, Helvetica, Arial, sans-serif; + border-color: #424245; + background-color: hsla(0, 0%, 100%, .04); + border-style: solid; + border-width: 1px; + transition: 0.7s; +} + +.success { + background-color: #57F287 !important; + color: #ffffff !important; + border-color: #57F287 !important; +} + +.failure { + background-color: #ED4245 !important; + color: #ffffff !important; + border-color: #ED4245 !important; +} + +/*LastFM Connect Button*/ +.settings-list li #lfmConnect { + background-color: #E4141E !important; + color: #ffffff !important; + border-color: #E4141E !important; +} + +/* Toggle Slider */ +.settings-list li .slider { + position: absolute; + cursor: pointer; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: #ccc; + -webkit-transition: 0.4s; + transition: 0.4s; + border-radius: 28px; +} + +.settings-list li .slider:before { + border-radius: 50%; + position: absolute; + content: ""; + height: 20px; + width: 20px; + background-color: white; + -webkit-transition: 0.4s; + transition: 0.4s; +} + +.settings-list li .toggle-element { + position: relative; + display: inline-block; + width: 40px; + height: 20px; + grid-column: 3; + margin: 5px 20px 0 20px; +} + +.settings-list li .toggle-element input { + opacity: 0; + width: 0; + height: 0; +} + +.settings-list li .toggle-element input:checked + .slider { + background-color: var(--keyColor); +} + +.settings-list li .toggle-element input:focus + .slider { + box-shadow: 0 0 1px var(--keyColor); +} + +.settings-list li .toggle-element input:checked + .slider:before { + -webkit-transform: translateX(20px); + -ms-transform: translateX(20px); + transform: translateX(20px); +} + +/* Dropdown */ +.settings-list li .form-dropdown-select { + color: var(--systemPrimary); + border-color: #424245; + background-color: hsla(0, 0%, 100%, .04); + padding: 5px 10px; + margin: 10px 0 10px 20px; + border-radius: 5px; + font-size: 15px; + font-family: SF Pro Text, SF Pro Icons, Helvetica Neue, Helvetica, Arial, sans-serif; + border-style: solid; + border-width: 1px; +} + +.settings-list li .form-dropdown-select option { + color: black; +} + +.settings-list li .form-dropdown-select option:disabled { + color: #808080; +} + +/* Artwork CSS (for miniPlayer) */ + +.web-chrome-playback-lcd #ember13.media-artwork-v2--downloaded::after { + content: ''; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + pointer-events: none; +} + +.web-chrome-playback-lcd #ember13.media-artwork-v2--downloaded:hover::after { + content: ''; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.5); + background-image: url("ameres://icons/webui/MiniPlayer_hover.svg"); + background-size: contain; + background-position: center; + z-index: 1; + pointer-events: none; +} + +/* Mini Player Context Menu */ +@media only screen and (max-width: 400px) { + + body[data-miniplayer] #web-main > .loading-inner, + body[data-miniplayer] #backButtonBar, + body[data-miniplayer] #web-navigation-container, + body[data-miniplayer] .web-chrome { + display: none; + } + + body[data-miniplayer] .menuicon { + display: none !important; + } + + body[data-miniplayer] li.context-menu__option { + font-size: 12px; + min-height: auto; + } + + body[data-miniplayer] .miniPlayerArtwork { + height: 100%; + width: 100%; + position: absolute; + top: 0; + left: 0; + background: black var(--musicKit-artwork) center; + background-size: cover; + z-index: 800; + } +} + +/* Buttons */ + +#airplayButton, #lyricsButton, button[aria-label="My Account"] { + cursor: pointer; +} + +/* Lyrics CSS */ +:root { + --appleEase: cubic-bezier(0.42, 0, 0.58, 1); + --panel-width: 300px; +} + +body { + background: black; + transition: background var(--appleEase) .10s; +} + +body.no-acrylic { + background: var(--pageBG) !important; +} + +.appleSidebar { + width: var(--panelWidth); + animation: 3s lyricsSlideOut forwards; + +} + +@keyframes lyricsSlideOut { + 0% { + transform: translateX(-300px); + } + 100% { + transform: translateX(0px); + } +} + +#backgroundImage { + width: 100%; + height: 100%; + filter: blur(16px) saturate(180%); + background-repeat: no-repeat; + object-fit: cover; + object-position: center center; + position: absolute; +} + +#lyricer { + width: 90%; + font-weight: 700; + font-family: SF Pro JP, SF Pro KR, SF Pro, "M PLUS 1p", "Hiragino Sans GB W6", Tahoma, Arial, sans-serif; + text-shadow: rgb(238, 238, 238) 0 0 1px; + color: rgb(102, 102, 102); + overflow: hidden scroll; + z-index: 2; + position: absolute; + margin-right: 20px; + margin-left: 5%; + height: 90%; + --lyricBlur: 1px; + font-size: 1.6rem; + -webkit-mask-image: -webkit-gradient(linear, left 95%, left bottom, from(rgba(0, 0, 0, 1)), to(rgba(0, 0, 0, 0))); + transition: all 1s var(--appleEase) !important; +} + +#lyricer:hover { + --lyricBlur: 0px; +} + +#lyricer > ul li:not(.lyricer-current-line) { + filter: blur(var(--lyricBlur)); +} + +#lyricer::-webkit-scrollbar { + display: none; +} + +#lyricer ul { + list-style-type: none; + padding: 10px; +} + +#lyricer ul li { + opacity: 0.9; + color: var(--systemQuaternary); + transform: scale(0.85); + transform-origin: left center; + margin-bottom: 14px; + -webkit-backface-visibility: hidden; + overflow: visible; + transition: all .25s var(--appleEase) !important; +} + +#lyricer ul li:hover::after { + content: ' '; + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + transform: scale(1.06); + background: rgba(200, 200, 200, 0.1); + pointer-events: none; + border-radius: 10px; + -webkit-backface-visibility: hidden; +} + +#lyricer .lyricer-current-line { + color: var(--systemPrimary); + /* text-shadow: rgb(169, 169, 169) 1.5px 1.5px 1.5px; */ + opacity: 1; + font-weight: 700; + transform: scale(1) !important; + transform-origin: left center; + filter: blur(0px) !important; + transition: all .25s var(--appleEase) !important; +} + +#lyricer ul li .lyrics-translation { + font-size: 1.3rem; + font-weight: 300; +} + +.lyricWaiting { + margin-top: 8px; + display: none; +} + +.lyricer-current-line .lyricWaiting { + display: inline-flex; + animation: lyricWaitingLine 6s cubic-bezier(0.42, 0, 0.58, 1) infinite; +} + + +.lyricWaiting > div { + width: 10px; + height: 10px; + background: var(--systemPrimary); + border-radius: 50%; + margin: 3px; +} + +@keyframes lyricWaitingLine { + 0% { + opacity: 0; + transform: scale(0.85); + } + 50% { + opacity: 1; + transform: scale(1); + } + 100% { + opacity: 0; + transform: scale(0.85); + } +} + +#unsynced { + font-weight: 600; + padding: 8px; +} + +#unsynced > div > p { + margin-top: 10px; +} + +#MVLyricsBox { + display: none; + font-size: 1rem; + position: absolute; + top: 80%; + text-align: center; + width: auto; + align-self: center; + left: 50%; + transform: translate(-50%, -50%); +} + +.ameModal-Backdrop { + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + z-index: 9999; + background: rgba(0, 0, 0, 0.45); + display: flex; + justify-content: center; + align-items: center; + transition: all .25s; +} + +.ameModal { + width: 80%; + height: 80%; + padding: 16px; + border-radius: 10px; + background: var(--modalBGColor); + overflow: overlay; + position: relative; + animation: ameModalIn 0.10s var(--appleEase); + will-change: opacity, transform; + box-shadow: 0 8px 40px var(--dialogShadowColor); +} + +/*.ameModal::after {*/ +/* content: '';*/ +/* width:100%;*/ +/* height:100%;*/ +/* box-shadow: inset 0 0.35px 0 1px rgba(255,255,255,0.1);*/ +/* overflow: hidden;*/ +/* position: absolute;*/ +/* top:0px;*/ +/* left:0px;*/ +/* border-radius: inherit;*/ +/* z-index:1;*/ +/* pointer-events: none;*/ +/*}*/ + +.ameModal-closing { + animation: ameModalOut 0.10s var(--appleEase) forwards; +} + + +/* @media (prefers-color-scheme: light) { + .ameModal { + background: rgb(255 255 255 / 92%); + } +} + +@media (prefers-color-scheme: dark) { + .ameModal { + background: rgb(31 31 31 / 85%); + } +} */ + +.ameUserMenu { + border-radius: 6px; + border: .5px solid rgba(0, 0, 0, .2); + box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2), 0 8px 40px var(--dialogShadowColor); + animation: unset; + background-color: var(--systemStandardThickMaterialSover); + -webkit-backdrop-filter: blur(60px) saturate(210%); + backdrop-filter: blur(60px) saturate(210%); + font-size: 1.0em; + padding: 0px; + overflow: hidden; +} + +@keyframes ameEQIn { + 0% { + top: 46px; + right: 142px; + width: 178px; + opacity: 0; + } + 100% { + top: 46px; + right: 42px; + width: 306px; + opacity: 1; + } +} + +@keyframes ameModalIn { + 0% { + transform: scale(0.85); + opacity: 0; + } + 100% { + transform: scale(1.0); + opacity: 1; + } +} + +@keyframes ameModalOut { + 0% { + transform: scale(1.0); + opacity: 1; + } + 100% { + transform: scale(0.85); + opacity: 0; + } +} + +.ameModal-Close { + position: absolute; + top: 24px; + left: 24px; + z-index: 2; + -webkit-mask-image: url("ameres://icons/webui/close.svg"); + -webkit-mask-repeat: no-repeat; + -webkit-mask-position: center; + background-color: white; + opacity: 0.75; + -webkit-mask-size: contain; + height: 18px; + width: 18px; +} + +.micaBackground { + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + pointer-events: none; + z-index: -1; + background: var(--user-wallpaper); + background-repeat: cover; + /*background-repeat: repeat;*/ + filter: blur(180px) saturate(180%) brightness(0.25); +} + +#lyrics_none { + height: 100%; + width: 100%; + text-align: center; + vertical-align: middle; + line-height: 100%; + display: flex; + align-items: center; + justify-content: center; + font-weight: 500; + font-size: 14px; +} + +#lyrics_none.lyrics_none_hidden { + display: none; + height: 0; +} + +/* Switch Checkbox */ +input[type=checkbox][switch] { + width: 38px; + appearance: none; + border-radius: 32px; + height: 24px; + zoom: 1; + top: 0; + cursor: pointer; + left: 0; + position: relative; + transform: scale(1); + background: var(--systemGray); + mix-blend-mode: screen; + padding: 0; + margin: 0; +} + +input[type=checkbox][switch]:focus, +input[type=checkbox][switch]:active { + outline: none; +} + +input[type=checkbox][switch]:checked { + background: var(--keyColor); + border: 0 solid var(--keyColor); + mix-blend-mode: unset; +} + +input[type=checkbox][switch]::before { + background: white; + width: 26px; + height: 26px; + top: -1px; + left: -1px; + position: absolute; + content: ' '; + border-radius: 32px; + transition: .10s left var(--appleEase); + transform: scale(.75); +} + + +input[type=checkbox][switch]:checked::before { + background: white; + top: -1px; + left: 13px; + transition: .10s left var(--appleEase); + transform: scale(.75); +} + +input[type=checkbox][switch]:disabled::before { + opacity: .5; +} + +input[type=checkbox][switch]:active::before { + left: 13px; +} + +input[type=checkbox][switch]:checked:active::before { + left: -1px; +} + +/* End Switch Checkbox */ \ No newline at end of file diff --git a/resources/css/frame_Windows.css b/resources/css/frame_Windows.css new file mode 100644 index 00000000..28f95ab2 --- /dev/null +++ b/resources/css/frame_Windows.css @@ -0,0 +1,142 @@ +.web-main-drag { + -webkit-app-region: drag; + width: calc(100vw - var(--web-navigation-width)); + height: 28px; + top: 0; + position: fixed; + right: 0; + background-color: var(--playerBackground); +} + +@media only screen and (max-width: 485px) { + .web-main-drag { + background-color: var(--webNavigationMobileBg) !important; + width: calc(100% - 50px) !important; + } +} + +.web-nav-window-controls { + -webkit-user-select: none; + -webkit-app-region: no-drag; + display: flex; + position: fixed; + right: 0; + top: 0; + z-index: 9904 !important; +} + +.web-chrome__auth-no-chrome { + margin-top: 32px !important; + height: 28px !important; +} + +@media only screen and (min-width: 485px) { + .web-chrome-window-controls { + height: 55px; + background-color: var(--playerBackground); + backdrop-filter: saturate(50%) blur(20px); + margin-left: auto; + -webkit-app-region: drag; + } +} + +@media only screen and (prefers-color-scheme: dark) and (min-width: 485px) { + .web-chrome-window-controls { + box-shadow: 0 1px 0 rgba(0,0,0,.05),0 1px 3px var(--playerDropShadow2),inset 0 -.5px 0 var(--playerInnerShadow); + clip-path: inset(-5px -5px -5px 0px); + } +} + +.web-nav-window-controls #minimize { + background-image: var(--gfx-minBtn); + background-color: transparent; + background-position: center; + background-repeat: no-repeat; + -webkit-app-region: no-drag; + width: 45px; + height: 28px; + display: inline-block; + z-index: 9999 !important; +} + +.web-nav-window-controls #maximize { + background-image: var(--gfx-maxBtn); + background-color: transparent; + background-position: center; + background-repeat: no-repeat; + -webkit-app-region: no-drag; + width: 45px; + height: 28px; + display: inline-block; + z-index: 9999 !important; +} + +.web-nav-window-controls #close { + background-image: var(--gfx-closeBtn); + background-color: transparent; + background-position: center; + background-repeat: no-repeat; + -webkit-app-region: no-drag; + width: 46px; + height: 28px; + display: inline-block; + z-index: 9999 !important; +} + +.web-nav-window-controls #close:hover { + background-color: rgb(196, 43, 28); +} + +span#maximize:hover, +span#minimize:hover { + background-color: rgba(200, 200, 200, 0.1); +} + +span#maximize.maxed { + background-image: var(--gfx-restoreBtn); +} + +@media (prefers-color-scheme: light) { + :root { + /* */ + --gfx-closeBtn: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAIn2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICAgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIgogICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iCiAgICB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iCiAgICB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIKICAgIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiCiAgICB4bWxuczpleGlmPSJodHRwOi8vbnMuYWRvYmUuY29tL2V4aWYvMS4wLyIKICAgZGM6Zm9ybWF0PSJpbWFnZS9wbmciCiAgIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiCiAgIHBob3Rvc2hvcDpJQ0NQcm9maWxlPSJzUkdCIElFQzYxOTY2LTIuMSIKICAgdGlmZjpJbWFnZUxlbmd0aD0iMTAiCiAgIHRpZmY6SW1hZ2VXaWR0aD0iMTAiCiAgIHRpZmY6UmVzb2x1dGlvblVuaXQ9IjIiCiAgIHRpZmY6WFJlc29sdXRpb249IjcyLjAiCiAgIHRpZmY6WVJlc29sdXRpb249IjcyLjAiCiAgIHhtcDpDcmVhdGVEYXRlPSIyMDIwLTAyLTE3VDEyOjU1OjM3WiIKICAgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiCiAgIHhtcDpNZXRhZGF0YURhdGU9IjIwMjEtMTAtMDVUMTQ6MjY6MjgtMDc6MDAiCiAgIHhtcDpNb2RpZnlEYXRlPSIyMDIxLTEwLTA1VDE0OjI2OjI4LTA3OjAwIgogICB4bXBNTTpEb2N1bWVudElEPSJhZG9iZTpkb2NpZDpwaG90b3Nob3A6ZTk5OWM2NWYtNDhhOS0wNjQyLWI2MTktZmJlYTExMmUxOGZiIgogICB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjY5MzMyOWNhLWNkNjctMzY0Zi04MzU1LTY5N2ZmYzI0ZDdlZCIKICAgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjgyZjQwYmU3LTE0YzItZjc0Ni1hZmE1LWQxYmIxNzAyMjM4OCIKICAgZXhpZjpQaXhlbFhEaW1lbnNpb249IjEwIgogICBleGlmOlBpeGVsWURpbWVuc2lvbj0iMTAiCiAgIGV4aWY6Q29sb3JTcGFjZT0iMSI+CiAgIDxwaG90b3Nob3A6VGV4dExheWVycz4KICAgIDxyZGY6U2VxPgogICAgIDxyZGY6bGkKICAgICAgcGhvdG9zaG9wOkxheWVyTmFtZT0i7qSiIgogICAgICBwaG90b3Nob3A6TGF5ZXJUZXh0PSLupKIiLz4KICAgIDwvcmRmOlNlcT4KICAgPC9waG90b3Nob3A6VGV4dExheWVycz4KICAgPHhtcE1NOkhpc3Rvcnk+CiAgICA8cmRmOlNlcT4KICAgICA8cmRmOmxpCiAgICAgIHhtcE1NOmFjdGlvbj0iY3JlYXRlZCIKICAgICAgeG1wTU06aW5zdGFuY2VJRD0ieG1wLmlpZDo4MmY0MGJlNy0xNGMyLWY3NDYtYWZhNS1kMWJiMTcwMjIzODgiCiAgICAgIHhtcE1NOnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE5IChXaW5kb3dzKSIKICAgICAgeG1wTU06d2hlbj0iMjAyMC0wMi0xN1QxMjo1NTozN1oiLz4KICAgICA8cmRmOmxpCiAgICAgIHhtcE1NOmFjdGlvbj0ic2F2ZWQiCiAgICAgIHhtcE1NOmNoYW5nZWQ9Ii8iCiAgICAgIHhtcE1NOmluc3RhbmNlSUQ9InhtcC5paWQ6NjkzMzI5Y2EtY2Q2Ny0zNjRmLTgzNTUtNjk3ZmZjMjRkN2VkIgogICAgICB4bXBNTTpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiCiAgICAgIHhtcE1NOndoZW49IjIwMjAtMDItMTdUMTI6NTU6MzdaIi8+CiAgICAgPHJkZjpsaQogICAgICBzdEV2dDphY3Rpb249InByb2R1Y2VkIgogICAgICBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZmZpbml0eSBQaG90byAxLjEwLjEiCiAgICAgIHN0RXZ0OndoZW49IjIwMjEtMTAtMDVUMTQ6MjY6MjgtMDc6MDAiLz4KICAgIDwvcmRmOlNlcT4KICAgPC94bXBNTTpIaXN0b3J5PgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KPD94cGFja2V0IGVuZD0iciI/PtPY89oAAAGCaUNDUHNSR0IgSUVDNjE5NjYtMi4xAAAokXWRv0tCURTHP2lhmGFRQUODhDVZlELU0qD0C6pBDbJa9OWPQO3xnhHRGrQKBVFLv4b6C2oNmoOgKIJoC5qLWkpe56mgRJ7Luedzv/eew73ngiWcVjJ6/QBksjktOOF3zUcWXLZX7DTQQSu+qKKrM6HxMDXt64E6M971mbVqn/vXmpbjugJ1jcKjiqrlhCeFp9dzqsm7wu1KKrosfC7s0eSCwvemHivxm8nJEv+YrIWDAbC0CLuSVRyrYiWlZYTl5bgz6TWlfB/zJY54di4ksVu8C50gE/hxMcUYAYYYZETmIfrw0i8rauQPFPNnWZVcRWaVDTRWSJIih0fUNakel5gQPS4jzYbZ/7991RM+b6m6ww8NL4bx0QO2HSjkDeP72DAKJ2B9hqtsJX/1CIY/Rc9XNPchOLfg4rqixfbgchs6n9SoFi1KVnFLIgHvZ9AcgbZbsC+Welbe5/QRwpvyVTewfwC9ct659At2bGftHD0UJwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAEpJREFUGJWNkMENwDAIA1Gh3F7sP0Ty7xD5JgpU+OuTLVvMmQohhRTCnCEK8TpfBl9eBpcBu/HXcsAZ9FQjSrWqW2Pa95gzGofPBQZRG2fS0899AAAAAElFTkSuQmCC'); + --gfx-maxBtn: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAIn2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICAgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIgogICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iCiAgICB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iCiAgICB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIKICAgIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiCiAgICB4bWxuczpleGlmPSJodHRwOi8vbnMuYWRvYmUuY29tL2V4aWYvMS4wLyIKICAgZGM6Zm9ybWF0PSJpbWFnZS9wbmciCiAgIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiCiAgIHBob3Rvc2hvcDpJQ0NQcm9maWxlPSJzUkdCIElFQzYxOTY2LTIuMSIKICAgdGlmZjpJbWFnZUxlbmd0aD0iMTAiCiAgIHRpZmY6SW1hZ2VXaWR0aD0iMTAiCiAgIHRpZmY6UmVzb2x1dGlvblVuaXQ9IjIiCiAgIHRpZmY6WFJlc29sdXRpb249IjcyLjAiCiAgIHRpZmY6WVJlc29sdXRpb249IjcyLjAiCiAgIHhtcDpDcmVhdGVEYXRlPSIyMDIwLTAyLTE3VDEyOjU1OjM3WiIKICAgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiCiAgIHhtcDpNZXRhZGF0YURhdGU9IjIwMjEtMTAtMDVUMTQ6MjU6NTItMDc6MDAiCiAgIHhtcDpNb2RpZnlEYXRlPSIyMDIxLTEwLTA1VDE0OjI1OjUyLTA3OjAwIgogICB4bXBNTTpEb2N1bWVudElEPSJhZG9iZTpkb2NpZDpwaG90b3Nob3A6ZTk5OWM2NWYtNDhhOS0wNjQyLWI2MTktZmJlYTExMmUxOGZiIgogICB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjY5MzMyOWNhLWNkNjctMzY0Zi04MzU1LTY5N2ZmYzI0ZDdlZCIKICAgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjgyZjQwYmU3LTE0YzItZjc0Ni1hZmE1LWQxYmIxNzAyMjM4OCIKICAgZXhpZjpQaXhlbFhEaW1lbnNpb249IjEwIgogICBleGlmOlBpeGVsWURpbWVuc2lvbj0iMTAiCiAgIGV4aWY6Q29sb3JTcGFjZT0iMSI+CiAgIDxwaG90b3Nob3A6VGV4dExheWVycz4KICAgIDxyZGY6U2VxPgogICAgIDxyZGY6bGkKICAgICAgcGhvdG9zaG9wOkxheWVyTmFtZT0i7qSiIgogICAgICBwaG90b3Nob3A6TGF5ZXJUZXh0PSLupKIiLz4KICAgIDwvcmRmOlNlcT4KICAgPC9waG90b3Nob3A6VGV4dExheWVycz4KICAgPHhtcE1NOkhpc3Rvcnk+CiAgICA8cmRmOlNlcT4KICAgICA8cmRmOmxpCiAgICAgIHhtcE1NOmFjdGlvbj0iY3JlYXRlZCIKICAgICAgeG1wTU06aW5zdGFuY2VJRD0ieG1wLmlpZDo4MmY0MGJlNy0xNGMyLWY3NDYtYWZhNS1kMWJiMTcwMjIzODgiCiAgICAgIHhtcE1NOnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE5IChXaW5kb3dzKSIKICAgICAgeG1wTU06d2hlbj0iMjAyMC0wMi0xN1QxMjo1NTozN1oiLz4KICAgICA8cmRmOmxpCiAgICAgIHhtcE1NOmFjdGlvbj0ic2F2ZWQiCiAgICAgIHhtcE1NOmNoYW5nZWQ9Ii8iCiAgICAgIHhtcE1NOmluc3RhbmNlSUQ9InhtcC5paWQ6NjkzMzI5Y2EtY2Q2Ny0zNjRmLTgzNTUtNjk3ZmZjMjRkN2VkIgogICAgICB4bXBNTTpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiCiAgICAgIHhtcE1NOndoZW49IjIwMjAtMDItMTdUMTI6NTU6MzdaIi8+CiAgICAgPHJkZjpsaQogICAgICBzdEV2dDphY3Rpb249InByb2R1Y2VkIgogICAgICBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZmZpbml0eSBQaG90byAxLjEwLjEiCiAgICAgIHN0RXZ0OndoZW49IjIwMjEtMTAtMDVUMTQ6MjU6NTItMDc6MDAiLz4KICAgIDwvcmRmOlNlcT4KICAgPC94bXBNTTpIaXN0b3J5PgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KPD94cGFja2V0IGVuZD0iciI/PntJ23wAAAGCaUNDUHNSR0IgSUVDNjE5NjYtMi4xAAAokXWRv0tCURTHP2lhmGFRQUODhDVZlELU0qD0C6pBDbJa9OWPQO3xnhHRGrQKBVFLv4b6C2oNmoOgKIJoC5qLWkpe56mgRJ7Luedzv/eew73ngiWcVjJ6/QBksjktOOF3zUcWXLZX7DTQQSu+qKKrM6HxMDXt64E6M971mbVqn/vXmpbjugJ1jcKjiqrlhCeFp9dzqsm7wu1KKrosfC7s0eSCwvemHivxm8nJEv+YrIWDAbC0CLuSVRyrYiWlZYTl5bgz6TWlfB/zJY54di4ksVu8C50gE/hxMcUYAYYYZETmIfrw0i8rauQPFPNnWZVcRWaVDTRWSJIih0fUNakel5gQPS4jzYbZ/7991RM+b6m6ww8NL4bx0QO2HSjkDeP72DAKJ2B9hqtsJX/1CIY/Rc9XNPchOLfg4rqixfbgchs6n9SoFi1KVnFLIgHvZ9AcgbZbsC+Welbe5/QRwpvyVTewfwC9ct659At2bGftHD0UJwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAEhJREFUGJVjYGBgmMzAwPCXgYHhPw78l4GBYTIjlKHHwMDwlAE7EGFgYLjJANUlgEMRDPxnIqAADoaKwn8MkCDABaShaogLcACWZRl4ajKVtAAAAABJRU5ErkJggg=='); + --gfx-restoreBtn: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAIn2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICAgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIgogICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iCiAgICB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iCiAgICB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIKICAgIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiCiAgICB4bWxuczpleGlmPSJodHRwOi8vbnMuYWRvYmUuY29tL2V4aWYvMS4wLyIKICAgZGM6Zm9ybWF0PSJpbWFnZS9wbmciCiAgIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiCiAgIHBob3Rvc2hvcDpJQ0NQcm9maWxlPSJzUkdCIElFQzYxOTY2LTIuMSIKICAgdGlmZjpJbWFnZUxlbmd0aD0iMTAiCiAgIHRpZmY6SW1hZ2VXaWR0aD0iMTAiCiAgIHRpZmY6UmVzb2x1dGlvblVuaXQ9IjIiCiAgIHRpZmY6WFJlc29sdXRpb249IjcyLjAiCiAgIHRpZmY6WVJlc29sdXRpb249IjcyLjAiCiAgIHhtcDpDcmVhdGVEYXRlPSIyMDIwLTAyLTE3VDEyOjU1OjM3WiIKICAgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiCiAgIHhtcDpNZXRhZGF0YURhdGU9IjIwMjEtMTAtMDVUMTQ6MjY6NTMtMDc6MDAiCiAgIHhtcDpNb2RpZnlEYXRlPSIyMDIxLTEwLTA1VDE0OjI2OjUzLTA3OjAwIgogICB4bXBNTTpEb2N1bWVudElEPSJhZG9iZTpkb2NpZDpwaG90b3Nob3A6ZTk5OWM2NWYtNDhhOS0wNjQyLWI2MTktZmJlYTExMmUxOGZiIgogICB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjY5MzMyOWNhLWNkNjctMzY0Zi04MzU1LTY5N2ZmYzI0ZDdlZCIKICAgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjgyZjQwYmU3LTE0YzItZjc0Ni1hZmE1LWQxYmIxNzAyMjM4OCIKICAgZXhpZjpQaXhlbFhEaW1lbnNpb249IjEwIgogICBleGlmOlBpeGVsWURpbWVuc2lvbj0iMTAiCiAgIGV4aWY6Q29sb3JTcGFjZT0iMSI+CiAgIDxwaG90b3Nob3A6VGV4dExheWVycz4KICAgIDxyZGY6U2VxPgogICAgIDxyZGY6bGkKICAgICAgcGhvdG9zaG9wOkxheWVyTmFtZT0i7qSiIgogICAgICBwaG90b3Nob3A6TGF5ZXJUZXh0PSLupKIiLz4KICAgIDwvcmRmOlNlcT4KICAgPC9waG90b3Nob3A6VGV4dExheWVycz4KICAgPHhtcE1NOkhpc3Rvcnk+CiAgICA8cmRmOlNlcT4KICAgICA8cmRmOmxpCiAgICAgIHhtcE1NOmFjdGlvbj0iY3JlYXRlZCIKICAgICAgeG1wTU06aW5zdGFuY2VJRD0ieG1wLmlpZDo4MmY0MGJlNy0xNGMyLWY3NDYtYWZhNS1kMWJiMTcwMjIzODgiCiAgICAgIHhtcE1NOnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE5IChXaW5kb3dzKSIKICAgICAgeG1wTU06d2hlbj0iMjAyMC0wMi0xN1QxMjo1NTozN1oiLz4KICAgICA8cmRmOmxpCiAgICAgIHhtcE1NOmFjdGlvbj0ic2F2ZWQiCiAgICAgIHhtcE1NOmNoYW5nZWQ9Ii8iCiAgICAgIHhtcE1NOmluc3RhbmNlSUQ9InhtcC5paWQ6NjkzMzI5Y2EtY2Q2Ny0zNjRmLTgzNTUtNjk3ZmZjMjRkN2VkIgogICAgICB4bXBNTTpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiCiAgICAgIHhtcE1NOndoZW49IjIwMjAtMDItMTdUMTI6NTU6MzdaIi8+CiAgICAgPHJkZjpsaQogICAgICBzdEV2dDphY3Rpb249InByb2R1Y2VkIgogICAgICBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZmZpbml0eSBQaG90byAxLjEwLjEiCiAgICAgIHN0RXZ0OndoZW49IjIwMjEtMTAtMDVUMTQ6MjY6NTMtMDc6MDAiLz4KICAgIDwvcmRmOlNlcT4KICAgPC94bXBNTTpIaXN0b3J5PgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KPD94cGFja2V0IGVuZD0iciI/PluKsJ0AAAGCaUNDUHNSR0IgSUVDNjE5NjYtMi4xAAAokXWRv0tCURTHP2lhmGFRQUODhDVZlELU0qD0C6pBDbJa9OWPQO3xnhHRGrQKBVFLv4b6C2oNmoOgKIJoC5qLWkpe56mgRJ7Luedzv/eew73ngiWcVjJ6/QBksjktOOF3zUcWXLZX7DTQQSu+qKKrM6HxMDXt64E6M971mbVqn/vXmpbjugJ1jcKjiqrlhCeFp9dzqsm7wu1KKrosfC7s0eSCwvemHivxm8nJEv+YrIWDAbC0CLuSVRyrYiWlZYTl5bgz6TWlfB/zJY54di4ksVu8C50gE/hxMcUYAYYYZETmIfrw0i8rauQPFPNnWZVcRWaVDTRWSJIih0fUNakel5gQPS4jzYbZ/7991RM+b6m6ww8NL4bx0QO2HSjkDeP72DAKJ2B9hqtsJX/1CIY/Rc9XNPchOLfg4rqixfbgchs6n9SoFi1KVnFLIgHvZ9AcgbZbsC+Welbe5/QRwpvyVTewfwC9ct659At2bGftHD0UJwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAGlJREFUGJWt0LEOgkAQhOFPShspSWyvMPFxKaDh0XgOq8tZuCqBIzRMMsXmn51slr9GlJVfmHC9LII3LGfoomCGHrnSloM9olnGE+3KKVgbi0oMNX1ZaXYCG50aLBj4HJwqgXuwn47eA95vgSGy6zr7OwAAAABJRU5ErkJggg=='); + --gfx-minBtn: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAACxMAAAsTAQCanBgAAAaxaVRYdFhNTDpjb20uYWRvYmUueG1wAAAAAAA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/Pg0KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDUgNzkuMTYzNDk5LCAyMDE4LzA4LzEzLTE2OjQwOjIyICAgICAgICAiPg0KICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPg0KICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE5IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjAtMDItMTdUMTM6MDA6MzJaIiB4bXA6TWV0YWRhdGFEYXRlPSIyMDIwLTAyLTE3VDEzOjAwOjMyWiIgeG1wOk1vZGlmeURhdGU9IjIwMjAtMDItMTdUMTM6MDA6MzJaIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjg1ZDBlZGIwLWZkMDAtYjY0Zi05ZWZiLWEyYjQ1ODcwNWE4YSIgeG1wTU06RG9jdW1lbnRJRD0iYWRvYmU6ZG9jaWQ6cGhvdG9zaG9wOmEzMDAxZTFhLTI5MTktZTQ0OS1iOTRjLWMyMTIyNDhhOWY4YSIgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjc4N2Y3OTljLTRiMTEtZTU0YS1iMjBkLTY4NjE3ZWQ5YzVlMiIgcGhvdG9zaG9wOkNvbG9yTW9kZT0iMyIgZGM6Zm9ybWF0PSJpbWFnZS9wbmciPg0KICAgICAgPHhtcE1NOkhpc3Rvcnk+DQogICAgICAgIDxyZGY6U2VxPg0KICAgICAgICAgIDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjc4N2Y3OTljLTRiMTEtZTU0YS1iMjBkLTY4NjE3ZWQ5YzVlMiIgc3RFdnQ6d2hlbj0iMjAyMC0wMi0xN1QxMzowMDozMloiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE5IChXaW5kb3dzKSIgLz4NCiAgICAgICAgICA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6ODVkMGVkYjAtZmQwMC1iNjRmLTllZmItYTJiNDU4NzA1YThhIiBzdEV2dDp3aGVuPSIyMDIwLTAyLTE3VDEzOjAwOjMyWiIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIiBzdEV2dDpjaGFuZ2VkPSIvIiAvPg0KICAgICAgICA8L3JkZjpTZXE+DQogICAgICA8L3htcE1NOkhpc3Rvcnk+DQogICAgICA8cGhvdG9zaG9wOlRleHRMYXllcnM+DQogICAgICAgIDxyZGY6QmFnPg0KICAgICAgICAgIDxyZGY6bGkgcGhvdG9zaG9wOkxheWVyTmFtZT0i7qShIiBwaG90b3Nob3A6TGF5ZXJUZXh0PSLupKEiIC8+DQogICAgICAgIDwvcmRmOkJhZz4NCiAgICAgIDwvcGhvdG9zaG9wOlRleHRMYXllcnM+DQogICAgPC9yZGY6RGVzY3JpcHRpb24+DQogIDwvcmRmOlJERj4NCjwveDp4bXBtZXRhPg0KPD94cGFja2V0IGVuZD0iciI/PmeGdrgAAAAVSURBVChTYxhOgBGI/0OYQx0wMAAAyp4BAZ26NiYAAAAASUVORK5CYII='); + } +} + +@media (prefers-color-scheme: dark) { + :root { + --gfx-closeBtn: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAIn2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICAgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIgogICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iCiAgICB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iCiAgICB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIKICAgIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiCiAgICB4bWxuczpleGlmPSJodHRwOi8vbnMuYWRvYmUuY29tL2V4aWYvMS4wLyIKICAgZGM6Zm9ybWF0PSJpbWFnZS9wbmciCiAgIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiCiAgIHBob3Rvc2hvcDpJQ0NQcm9maWxlPSJzUkdCIElFQzYxOTY2LTIuMSIKICAgdGlmZjpJbWFnZUxlbmd0aD0iMTAiCiAgIHRpZmY6SW1hZ2VXaWR0aD0iMTAiCiAgIHRpZmY6UmVzb2x1dGlvblVuaXQ9IjIiCiAgIHRpZmY6WFJlc29sdXRpb249IjcyLjAiCiAgIHRpZmY6WVJlc29sdXRpb249IjcyLjAiCiAgIHhtcDpDcmVhdGVEYXRlPSIyMDIwLTAyLTE3VDEyOjU1OjM3WiIKICAgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiCiAgIHhtcDpNZXRhZGF0YURhdGU9IjIwMjEtMTAtMDVUMTQ6Mjc6MzYtMDc6MDAiCiAgIHhtcDpNb2RpZnlEYXRlPSIyMDIxLTEwLTA1VDE0OjI3OjM2LTA3OjAwIgogICB4bXBNTTpEb2N1bWVudElEPSJhZG9iZTpkb2NpZDpwaG90b3Nob3A6ZTk5OWM2NWYtNDhhOS0wNjQyLWI2MTktZmJlYTExMmUxOGZiIgogICB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjY5MzMyOWNhLWNkNjctMzY0Zi04MzU1LTY5N2ZmYzI0ZDdlZCIKICAgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjgyZjQwYmU3LTE0YzItZjc0Ni1hZmE1LWQxYmIxNzAyMjM4OCIKICAgZXhpZjpQaXhlbFhEaW1lbnNpb249IjEwIgogICBleGlmOlBpeGVsWURpbWVuc2lvbj0iMTAiCiAgIGV4aWY6Q29sb3JTcGFjZT0iMSI+CiAgIDxwaG90b3Nob3A6VGV4dExheWVycz4KICAgIDxyZGY6U2VxPgogICAgIDxyZGY6bGkKICAgICAgcGhvdG9zaG9wOkxheWVyTmFtZT0i7qSiIgogICAgICBwaG90b3Nob3A6TGF5ZXJUZXh0PSLupKIiLz4KICAgIDwvcmRmOlNlcT4KICAgPC9waG90b3Nob3A6VGV4dExheWVycz4KICAgPHhtcE1NOkhpc3Rvcnk+CiAgICA8cmRmOlNlcT4KICAgICA8cmRmOmxpCiAgICAgIHhtcE1NOmFjdGlvbj0iY3JlYXRlZCIKICAgICAgeG1wTU06aW5zdGFuY2VJRD0ieG1wLmlpZDo4MmY0MGJlNy0xNGMyLWY3NDYtYWZhNS1kMWJiMTcwMjIzODgiCiAgICAgIHhtcE1NOnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE5IChXaW5kb3dzKSIKICAgICAgeG1wTU06d2hlbj0iMjAyMC0wMi0xN1QxMjo1NTozN1oiLz4KICAgICA8cmRmOmxpCiAgICAgIHhtcE1NOmFjdGlvbj0ic2F2ZWQiCiAgICAgIHhtcE1NOmNoYW5nZWQ9Ii8iCiAgICAgIHhtcE1NOmluc3RhbmNlSUQ9InhtcC5paWQ6NjkzMzI5Y2EtY2Q2Ny0zNjRmLTgzNTUtNjk3ZmZjMjRkN2VkIgogICAgICB4bXBNTTpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiCiAgICAgIHhtcE1NOndoZW49IjIwMjAtMDItMTdUMTI6NTU6MzdaIi8+CiAgICAgPHJkZjpsaQogICAgICBzdEV2dDphY3Rpb249InByb2R1Y2VkIgogICAgICBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZmZpbml0eSBQaG90byAxLjEwLjEiCiAgICAgIHN0RXZ0OndoZW49IjIwMjEtMTAtMDVUMTQ6Mjc6MzYtMDc6MDAiLz4KICAgIDwvcmRmOlNlcT4KICAgPC94bXBNTTpIaXN0b3J5PgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KPD94cGFja2V0IGVuZD0iciI/PmN2D9EAAAGCaUNDUHNSR0IgSUVDNjE5NjYtMi4xAAAokXWRv0tCURTHP2lhmGFRQUODhDVZlELU0qD0C6pBDbJa9OWPQO3xnhHRGrQKBVFLv4b6C2oNmoOgKIJoC5qLWkpe56mgRJ7Luedzv/eew73ngiWcVjJ6/QBksjktOOF3zUcWXLZX7DTQQSu+qKKrM6HxMDXt64E6M971mbVqn/vXmpbjugJ1jcKjiqrlhCeFp9dzqsm7wu1KKrosfC7s0eSCwvemHivxm8nJEv+YrIWDAbC0CLuSVRyrYiWlZYTl5bgz6TWlfB/zJY54di4ksVu8C50gE/hxMcUYAYYYZETmIfrw0i8rauQPFPNnWZVcRWaVDTRWSJIih0fUNakel5gQPS4jzYbZ/7991RM+b6m6ww8NL4bx0QO2HSjkDeP72DAKJ2B9hqtsJX/1CIY/Rc9XNPchOLfg4rqixfbgchs6n9SoFi1KVnFLIgHvZ9AcgbZbsC+Welbe5/QRwpvyVTewfwC9ct659At2bGftHD0UJwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAEtJREFUGJWNkMENwDAIA1FGY/8hkn8HOAqPfBsFKvz1yZYtbqwAlUIB6saUAH2NJ4MvL4PLgK/x13LAGTSqEaVa1a0x7XvcmI3D1wbntaRbB2haYwAAAABJRU5ErkJggg=='); + --gfx-maxBtn: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAIn2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICAgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIgogICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iCiAgICB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iCiAgICB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIKICAgIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiCiAgICB4bWxuczpleGlmPSJodHRwOi8vbnMuYWRvYmUuY29tL2V4aWYvMS4wLyIKICAgZGM6Zm9ybWF0PSJpbWFnZS9wbmciCiAgIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiCiAgIHBob3Rvc2hvcDpJQ0NQcm9maWxlPSJzUkdCIElFQzYxOTY2LTIuMSIKICAgdGlmZjpJbWFnZUxlbmd0aD0iMTAiCiAgIHRpZmY6SW1hZ2VXaWR0aD0iMTAiCiAgIHRpZmY6UmVzb2x1dGlvblVuaXQ9IjIiCiAgIHRpZmY6WFJlc29sdXRpb249IjcyLjAiCiAgIHRpZmY6WVJlc29sdXRpb249IjcyLjAiCiAgIHhtcDpDcmVhdGVEYXRlPSIyMDIwLTAyLTE3VDEyOjU1OjM3WiIKICAgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiCiAgIHhtcDpNZXRhZGF0YURhdGU9IjIwMjEtMTAtMDVUMTQ6Mjc6NTgtMDc6MDAiCiAgIHhtcDpNb2RpZnlEYXRlPSIyMDIxLTEwLTA1VDE0OjI3OjU4LTA3OjAwIgogICB4bXBNTTpEb2N1bWVudElEPSJhZG9iZTpkb2NpZDpwaG90b3Nob3A6ZTk5OWM2NWYtNDhhOS0wNjQyLWI2MTktZmJlYTExMmUxOGZiIgogICB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjY5MzMyOWNhLWNkNjctMzY0Zi04MzU1LTY5N2ZmYzI0ZDdlZCIKICAgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjgyZjQwYmU3LTE0YzItZjc0Ni1hZmE1LWQxYmIxNzAyMjM4OCIKICAgZXhpZjpQaXhlbFhEaW1lbnNpb249IjEwIgogICBleGlmOlBpeGVsWURpbWVuc2lvbj0iMTAiCiAgIGV4aWY6Q29sb3JTcGFjZT0iMSI+CiAgIDxwaG90b3Nob3A6VGV4dExheWVycz4KICAgIDxyZGY6U2VxPgogICAgIDxyZGY6bGkKICAgICAgcGhvdG9zaG9wOkxheWVyTmFtZT0i7qSiIgogICAgICBwaG90b3Nob3A6TGF5ZXJUZXh0PSLupKIiLz4KICAgIDwvcmRmOlNlcT4KICAgPC9waG90b3Nob3A6VGV4dExheWVycz4KICAgPHhtcE1NOkhpc3Rvcnk+CiAgICA8cmRmOlNlcT4KICAgICA8cmRmOmxpCiAgICAgIHhtcE1NOmFjdGlvbj0iY3JlYXRlZCIKICAgICAgeG1wTU06aW5zdGFuY2VJRD0ieG1wLmlpZDo4MmY0MGJlNy0xNGMyLWY3NDYtYWZhNS1kMWJiMTcwMjIzODgiCiAgICAgIHhtcE1NOnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE5IChXaW5kb3dzKSIKICAgICAgeG1wTU06d2hlbj0iMjAyMC0wMi0xN1QxMjo1NTozN1oiLz4KICAgICA8cmRmOmxpCiAgICAgIHhtcE1NOmFjdGlvbj0ic2F2ZWQiCiAgICAgIHhtcE1NOmNoYW5nZWQ9Ii8iCiAgICAgIHhtcE1NOmluc3RhbmNlSUQ9InhtcC5paWQ6NjkzMzI5Y2EtY2Q2Ny0zNjRmLTgzNTUtNjk3ZmZjMjRkN2VkIgogICAgICB4bXBNTTpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiCiAgICAgIHhtcE1NOndoZW49IjIwMjAtMDItMTdUMTI6NTU6MzdaIi8+CiAgICAgPHJkZjpsaQogICAgICBzdEV2dDphY3Rpb249InByb2R1Y2VkIgogICAgICBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZmZpbml0eSBQaG90byAxLjEwLjEiCiAgICAgIHN0RXZ0OndoZW49IjIwMjEtMTAtMDVUMTQ6Mjc6NTgtMDc6MDAiLz4KICAgIDwvcmRmOlNlcT4KICAgPC94bXBNTTpIaXN0b3J5PgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KPD94cGFja2V0IGVuZD0iciI/PlwQMBUAAAGCaUNDUHNSR0IgSUVDNjE5NjYtMi4xAAAokXWRv0tCURTHP2lhmGFRQUODhDVZlELU0qD0C6pBDbJa9OWPQO3xnhHRGrQKBVFLv4b6C2oNmoOgKIJoC5qLWkpe56mgRJ7Luedzv/eew73ngiWcVjJ6/QBksjktOOF3zUcWXLZX7DTQQSu+qKKrM6HxMDXt64E6M971mbVqn/vXmpbjugJ1jcKjiqrlhCeFp9dzqsm7wu1KKrosfC7s0eSCwvemHivxm8nJEv+YrIWDAbC0CLuSVRyrYiWlZYTl5bgz6TWlfB/zJY54di4ksVu8C50gE/hxMcUYAYYYZETmIfrw0i8rauQPFPNnWZVcRWaVDTRWSJIih0fUNakel5gQPS4jzYbZ/7991RM+b6m6ww8NL4bx0QO2HSjkDeP72DAKJ2B9hqtsJX/1CIY/Rc9XNPchOLfg4rqixfbgchs6n9SoFi1KVnFLIgHvZ9AcgbZbsC+Welbe5/QRwpvyVTewfwC9ct659At2bGftHD0UJwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAFBJREFUGJXV0LERgCAUBNHVsQADM3uwWWbojQIs47MEGhgAuS/eSw41qeFYqGlRA7iAm74DKLyrfRABoLrOgq+/hJXngi71BOoGZKBMHqhAbtMvQzel9pREAAAAAElFTkSuQmCC'); + --gfx-restoreBtn: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAIn2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICAgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIgogICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iCiAgICB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iCiAgICB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIKICAgIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiCiAgICB4bWxuczpleGlmPSJodHRwOi8vbnMuYWRvYmUuY29tL2V4aWYvMS4wLyIKICAgZGM6Zm9ybWF0PSJpbWFnZS9wbmciCiAgIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiCiAgIHBob3Rvc2hvcDpJQ0NQcm9maWxlPSJzUkdCIElFQzYxOTY2LTIuMSIKICAgdGlmZjpJbWFnZUxlbmd0aD0iMTAiCiAgIHRpZmY6SW1hZ2VXaWR0aD0iMTAiCiAgIHRpZmY6UmVzb2x1dGlvblVuaXQ9IjIiCiAgIHRpZmY6WFJlc29sdXRpb249IjcyLjAiCiAgIHRpZmY6WVJlc29sdXRpb249IjcyLjAiCiAgIHhtcDpDcmVhdGVEYXRlPSIyMDIwLTAyLTE3VDEyOjU1OjM3WiIKICAgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiCiAgIHhtcDpNZXRhZGF0YURhdGU9IjIwMjEtMTAtMDVUMTQ6Mjc6MjQtMDc6MDAiCiAgIHhtcDpNb2RpZnlEYXRlPSIyMDIxLTEwLTA1VDE0OjI3OjI0LTA3OjAwIgogICB4bXBNTTpEb2N1bWVudElEPSJhZG9iZTpkb2NpZDpwaG90b3Nob3A6ZTk5OWM2NWYtNDhhOS0wNjQyLWI2MTktZmJlYTExMmUxOGZiIgogICB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjY5MzMyOWNhLWNkNjctMzY0Zi04MzU1LTY5N2ZmYzI0ZDdlZCIKICAgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjgyZjQwYmU3LTE0YzItZjc0Ni1hZmE1LWQxYmIxNzAyMjM4OCIKICAgZXhpZjpQaXhlbFhEaW1lbnNpb249IjEwIgogICBleGlmOlBpeGVsWURpbWVuc2lvbj0iMTAiCiAgIGV4aWY6Q29sb3JTcGFjZT0iMSI+CiAgIDxwaG90b3Nob3A6VGV4dExheWVycz4KICAgIDxyZGY6U2VxPgogICAgIDxyZGY6bGkKICAgICAgcGhvdG9zaG9wOkxheWVyTmFtZT0i7qSiIgogICAgICBwaG90b3Nob3A6TGF5ZXJUZXh0PSLupKIiLz4KICAgIDwvcmRmOlNlcT4KICAgPC9waG90b3Nob3A6VGV4dExheWVycz4KICAgPHhtcE1NOkhpc3Rvcnk+CiAgICA8cmRmOlNlcT4KICAgICA8cmRmOmxpCiAgICAgIHhtcE1NOmFjdGlvbj0iY3JlYXRlZCIKICAgICAgeG1wTU06aW5zdGFuY2VJRD0ieG1wLmlpZDo4MmY0MGJlNy0xNGMyLWY3NDYtYWZhNS1kMWJiMTcwMjIzODgiCiAgICAgIHhtcE1NOnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE5IChXaW5kb3dzKSIKICAgICAgeG1wTU06d2hlbj0iMjAyMC0wMi0xN1QxMjo1NTozN1oiLz4KICAgICA8cmRmOmxpCiAgICAgIHhtcE1NOmFjdGlvbj0ic2F2ZWQiCiAgICAgIHhtcE1NOmNoYW5nZWQ9Ii8iCiAgICAgIHhtcE1NOmluc3RhbmNlSUQ9InhtcC5paWQ6NjkzMzI5Y2EtY2Q2Ny0zNjRmLTgzNTUtNjk3ZmZjMjRkN2VkIgogICAgICB4bXBNTTpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiCiAgICAgIHhtcE1NOndoZW49IjIwMjAtMDItMTdUMTI6NTU6MzdaIi8+CiAgICAgPHJkZjpsaQogICAgICBzdEV2dDphY3Rpb249InByb2R1Y2VkIgogICAgICBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZmZpbml0eSBQaG90byAxLjEwLjEiCiAgICAgIHN0RXZ0OndoZW49IjIwMjEtMTAtMDVUMTQ6Mjc6MjQtMDc6MDAiLz4KICAgIDwvcmRmOlNlcT4KICAgPC94bXBNTTpIaXN0b3J5PgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KPD94cGFja2V0IGVuZD0iciI/PqiFCFwAAAGCaUNDUHNSR0IgSUVDNjE5NjYtMi4xAAAokXWRv0tCURTHP2lhmGFRQUODhDVZlELU0qD0C6pBDbJa9OWPQO3xnhHRGrQKBVFLv4b6C2oNmoOgKIJoC5qLWkpe56mgRJ7Luedzv/eew73ngiWcVjJ6/QBksjktOOF3zUcWXLZX7DTQQSu+qKKrM6HxMDXt64E6M971mbVqn/vXmpbjugJ1jcKjiqrlhCeFp9dzqsm7wu1KKrosfC7s0eSCwvemHivxm8nJEv+YrIWDAbC0CLuSVRyrYiWlZYTl5bgz6TWlfB/zJY54di4ksVu8C50gE/hxMcUYAYYYZETmIfrw0i8rauQPFPNnWZVcRWaVDTRWSJIih0fUNakel5gQPS4jzYbZ/7991RM+b6m6ww8NL4bx0QO2HSjkDeP72DAKJ2B9hqtsJX/1CIY/Rc9XNPchOLfg4rqixfbgchs6n9SoFi1KVnFLIgHvZ9AcgbZbsC+Welbe5/QRwpvyVTewfwC9ct659At2bGftHD0UJwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAHNJREFUGJWtkKEOwlAMRc+QM5AwQYJFoPjZCWb2YRPIaeRTLwfTLQs0UxzX3tumtxCog78UdVTbZmM8AmsdXIABeKH2ak221dDuamnUCjyA+WtbB0zAGXgT0ycSFk31kBky/moUeBLpbsl91wi6Nnbfs/g+7XOQq6ifjfkAAAAASUVORK5CYII='); + --gfx-minBtn: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAGOmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDUgNzkuMTYzNDk5LCAyMDE4LzA4LzEzLTE2OjQwOjIyICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiIHhtcDpDcmVhdGVEYXRlPSIyMDIwLTAyLTE3VDEzOjAwOjMyWiIgeG1wOk1ldGFkYXRhRGF0ZT0iMjAyMC0wMi0xN1QxMzowMDozMloiIHhtcDpNb2RpZnlEYXRlPSIyMDIwLTAyLTE3VDEzOjAwOjMyWiIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo4NWQwZWRiMC1mZDAwLWI2NGYtOWVmYi1hMmI0NTg3MDVhOGEiIHhtcE1NOkRvY3VtZW50SUQ9ImFkb2JlOmRvY2lkOnBob3Rvc2hvcDphMzAwMWUxYS0yOTE5LWU0NDktYjk0Yy1jMjEyMjQ4YTlmOGEiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo3ODdmNzk5Yy00YjExLWU1NGEtYjIwZC02ODYxN2VkOWM1ZTIiIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIj4gPHhtcE1NOkhpc3Rvcnk+IDxyZGY6U2VxPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0iY3JlYXRlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo3ODdmNzk5Yy00YjExLWU1NGEtYjIwZC02ODYxN2VkOWM1ZTIiIHN0RXZ0OndoZW49IjIwMjAtMDItMTdUMTM6MDA6MzJaIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiLz4gPHJkZjpsaSBzdEV2dDphY3Rpb249InNhdmVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjg1ZDBlZGIwLWZkMDAtYjY0Zi05ZWZiLWEyYjQ1ODcwNWE4YSIgc3RFdnQ6d2hlbj0iMjAyMC0wMi0xN1QxMzowMDozMloiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE5IChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPHBob3Rvc2hvcDpUZXh0TGF5ZXJzPiA8cmRmOkJhZz4gPHJkZjpsaSBwaG90b3Nob3A6TGF5ZXJOYW1lPSLupKEiIHBob3Rvc2hvcDpMYXllclRleHQ9Iu6koSIvPiA8L3JkZjpCYWc+IDwvcGhvdG9zaG9wOlRleHRMYXllcnM+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+FwvRXAAAABdJREFUGNNj/P//PwMxgHGIKPw/XDwDAOr1HuzlELLnAAAAAElFTkSuQmCC'); + } +} + +/* Make Web-Chrome Draggable */ +@media only screen and (min-width: 485px) { + .web-chrome { + width: calc(100vw - var(--web-navigation-width) - 136px) !important; + left: var(--web-navigation-width) !important; + -webkit-app-region: drag; + } + + .web-chrome-controls-container { + -webkit-app-region: drag; + } + + /* add no-drag to child elements */ + .web-chrome-playback-controls>* { + -webkit-app-region: no-drag; + } + + .web-chrome-controls-container>* { + -webkit-app-region: no-drag; + } + + .web-chrome-playback-lcd { + -webkit-app-region: no-drag; + } +} \ No newline at end of file diff --git a/resources/css/frame_macOS_emulation.css b/resources/css/frame_macOS_emulation.css new file mode 100644 index 00000000..d02decb2 --- /dev/null +++ b/resources/css/frame_macOS_emulation.css @@ -0,0 +1,91 @@ +@media only screen and (min-width: 484px) { + .web-chrome::before { + display: none !important; + } +} + +.web-nav-window-controls-outer { + width: 100%; + height: 55px; + -webkit-app-region: no-drag; + background-color: transparent !important; + -webkit-user-select: none; + padding-left: 2px; + padding-top: 2px; +} + +.web-nav-window-controls { + -webkit-app-region: drag; + position: relative; + height: 100%; + width: 100%; + display: flex; + padding: 10px 0 0 10px; +} + +.web-nav-window-controls #close { /*Red*/ + height: 12px; + width: 12px; + background-color: rgb(255, 92, 92); + border-radius: 50%; + display: inline-block; + margin: auto 4px auto 10px; + -webkit-app-region: no-drag; +} + +.web-nav-window-controls #minimize { /*Yellow*/ + height: 12px; + width: 12px; + background-color: rgb(255, 189, 76); + border-radius: 50%; + display: inline-block; + margin: auto 4px; + -webkit-app-region: no-drag; +} + +.web-nav-window-controls #maximize { /*Green*/ + height: 12px; + width: 12px; + background-color: rgb(0, 202, 86); + border-radius: 50%; + display: inline-block; + margin: auto 4px; + color: rgb(130, 0, 5); + -webkit-app-region: no-drag; +} + +.web-nav-window-controls #close:hover, +.web-nav-window-controls #minimize:hover, +.web-nav-window-controls #maximize:hover { + filter: brightness(40%); +} + +@media only screen and (prefers-color-scheme: dark) and (min-width: 485px) { + #web-navigation-search-box { + box-shadow: 0 1px 0 rgba(0,0,0,.05),0 1px 3px var(--playerDropShadow2),inset 0 -.5px 0 var(--playerInnerShadow); + } +} + +@media only screen and (max-width: 485px) { + .web-nav-window-controls #maximize { + margin-right: 10px; + right: 0; + } + .web-nav-window-controls { + padding: 0 !important; + height: auto !important; + width: auto !important; + right: 0 !important; + position: fixed !important; + top: auto !important; + margin-top: 10px !important; + } + + .web-nav-window-controls-outer { + width: calc(100% - 50px) !important; + height: 44px !important; + position: fixed !important; + right: 0 !important; + -webkit-app-region: drag !important; + } +} \ No newline at end of file diff --git a/resources/css/frame_macOS_emulation_right.css b/resources/css/frame_macOS_emulation_right.css new file mode 100644 index 00000000..7d2826b4 --- /dev/null +++ b/resources/css/frame_macOS_emulation_right.css @@ -0,0 +1,123 @@ +.web-main-drag { + -webkit-app-region: drag; + width: calc(100vw - var(--web-navigation-width)); + height: 28px; + top: 0; + position: fixed; + right: 0; + background-color: var(--playerBackground); +} + +@media only screen and (max-width: 485px) { + .web-main-drag { + background-color: var(--webNavigationMobileBg) !important; + width: calc(100% - 50px) !important; + } + + .web-nav-window-controls { + margin-top: 10px + } +} + +.web-nav-window-controls { + -webkit-user-select: none; + -webkit-app-region: no-drag; + display: flex; + position: fixed; + right: 0; + top: 0; + z-index: 9904 !important; +} + +.web-chrome__auth-no-chrome { + margin-top: 32px !important; + height: 28px !important; +} + +@media only screen and (min-width: 485px) { + .web-chrome-window-controls { + height: 55px; + background-color: var(--playerBackground); + backdrop-filter: saturate(50%) blur(20px); + margin-left: auto; + -webkit-app-region: drag; + } +} + +@media only screen and (prefers-color-scheme: dark) and (min-width: 485px) { + .web-chrome-window-controls { + box-shadow: 0 1px 0 rgba(0, 0, 0, .05), 0 1px 3px var(--playerDropShadow2), inset 0 -.5px 0 var(--playerInnerShadow); + clip-path: inset(-5px -5px -5px 0px); + } +} + +.web-nav-window-controls #minimize { + background-color: rgb(255, 189, 76); + border-radius: 50%; + background-position: center; + background-repeat: no-repeat; + -webkit-app-region: no-drag; + width: 12px !important; + height: 12px !important; + display: inline-block; + z-index: 9999 !important; + margin: auto 4px; +} + +.web-nav-window-controls #maximize { + background-color: rgb(0, 202, 86); + border-radius: 50%; + background-position: center; + background-repeat: no-repeat; + -webkit-app-region: no-drag; + width: 12px !important; + height: 12px !important; + display: inline-block; + z-index: 9999 !important; + margin: auto 4px +} + +.web-nav-window-controls #close { + background-color: rgb(255, 92, 92); + border-radius: 50%; + background-position: center; + background-repeat: no-repeat; + -webkit-app-region: no-drag; + width: 12px !important; + height: 12px !important; + display: inline-block; + z-index: 9999 !important; + margin: auto 10px auto 4px; +} + +span#close:hover, +span#maximize:hover, +span#minimize:hover { + filter: brightness(40%); +} + +/* Make Web-Chrome Draggable */ +@media only screen and (min-width: 485px) { + .web-chrome { + width: calc(100vw - var(--web-navigation-width) - 66px) !important; + left: var(--web-navigation-width) !important; + -webkit-app-region: drag; + } + + .web-chrome-controls-container { + -webkit-app-region: drag; + } + + /* add no-drag to child elements */ + .web-chrome-playback-controls > * { + -webkit-app-region: no-drag; + } + + .web-chrome-controls-container > * { + -webkit-app-region: no-drag; + } + + .web-chrome-playback-lcd { + -webkit-app-region: no-drag; + } +} \ No newline at end of file diff --git a/resources/css/lyricer.css b/resources/css/lyricer.css new file mode 100644 index 00000000..21c307a3 --- /dev/null +++ b/resources/css/lyricer.css @@ -0,0 +1,182 @@ +:root { + --appleEase: cubic-bezier(0.42, 0, 0.58, 1); + --panel-width: 300px; +} + +body { + background: black; +} + +.appleSidebar { + width: var(--panelWidth); + animation: 3s lyricsSlideOut forwards; + +} + +@keyframes lyricsSlideOut { + 0% { + transform: translateX(-300px); + } + 100% { + transform: translateX(0px); + } +} + +#backgroundImage { + width: 100%; + height: 100%; + filter: blur(16px) saturate(180%); + background-repeat: no-repeat; + object-fit: cover; + object-position: center center; + position: absolute; +} + + +#albumart{ + z-index: 2; + border-radius: 6px; + top: 10%; + right: 55%; + width: 36%; + background-repeat: no-repeat; + object-fit: cover; + object-position: center center; + position: absolute; +} + +#title{ + font-family: "SF Pro", "M PLUS 1p", "Hiragino Sans GB W6", Tahoma, Arial, sans-serif; + color: whitesmoke; + z-index: 2; + top: 10vh + 40vw; + right: 58%; + width: 30%; + font-size: 1.5rem; + position: absolute; + text-align: center; +} + +#details{ + font-family: "SF Pro", "M PLUS 1p", "Hiragino Sans GB W6", Tahoma, Arial, sans-serif; + color: whitesmoke; + z-index: 2; + top: 10vh + 60vw; + right: 58%; + width: 30%; + font-size: 1.5rem; + position: absolute; + text-align: center; +} + +#lyricer { + z-index: 2; + top: 30%; + width: 40%; + font-weight: 700; + font-family: "SF Pro", "M PLUS 1p", "Hiragino Sans GB W6", Tahoma, Arial, sans-serif; + text-shadow: rgb(238, 238, 238) 0 0 1px; + color: rgb(102, 102, 102); + overflow: hidden scroll; + z-index: 2; + position: absolute; + right: 0; + float: right; + margin-right: 5%; + margin-left: 5%; + height: 70%; + --lyricBlur: 1px; + font-size: 4rem; + -webkit-mask-image: -webkit-gradient(linear, left 95%, left bottom, from(rgba(0,0,0,1)), to(rgba(0,0,0,0))); + transition: all 1s var(--appleEase) !important; +} +#lyricer:hover { + --lyricBlur: 0px; +} +#lyricer>ul li:not(.lyricer-current-line) { + filter: blur(var(--lyricBlur)); +} + +#lyricer::-webkit-scrollbar { + display: none; +} + +#lyricer ul { + list-style-type: none; + padding: 10px; +} + +#lyricer ul li { + opacity: 0.9; + color: var(--systemQuaternary); + transform: scale(0.85); + transform-origin:left center; + margin-bottom:14px; + -webkit-backface-visibility: hidden; + overflow:visible; + transition: all .25s var(--appleEase) !important; +} + +#lyricer ul li:hover::after { + content: ' '; + width: 100%; + height: 100%; + position: absolute; + top:0; + left:0; + transform: scale(1.06); + background: rgb(200 200 200 / 10%); + pointer-events: none; + border-radius: 10px; + -webkit-backface-visibility: hidden; +} + +#lyricer .lyricer-current-line { + color: whitesmoke; + /* text-shadow: rgb(169, 169, 169) 1.5px 1.5px 1.5px; */ + opacity: 1; + font-weight: 700; + transform: scale(1)!important; + transform-origin:left center; + filter: blur(0px)!important; + transition: all .25s var(--appleEase) !important; +} + +#lyricer ul li .lyrics-translation { + font-size: 1.3rem; + font-weight: 300; +} + +.lyricWaiting { + margin-top:8px; + display: none; +} + +.lyricer-current-line .lyricWaiting { + display: inline-flex; + animation: lyricWaitingLine 6s cubic-bezier(0.42, 0, 0.58, 1) infinite; +} + + +.lyricWaiting > div { + width: 10px; + height: 10px; + background: var(--systemPrimary); + border-radius: 50%; + margin: 3px; +} + +@keyframes lyricWaitingLine { + 0% { + opacity: 0; + transform: scale(0.85); + } + 50% { + opacity: 1; + transform: scale(1); + } + 100% { + opacity: 0; + transform: scale(0.85); + } +} \ No newline at end of file diff --git a/resources/css/macosScrollbar.css b/resources/css/macosScrollbar.css new file mode 100644 index 00000000..1c3a10f8 --- /dev/null +++ b/resources/css/macosScrollbar.css @@ -0,0 +1,27 @@ +/* Modern style overlay scrollbars */ +::-webkit-scrollbar { + width: 16px; + height: 24px; +} + +::-webkit-scrollbar-button { + display: none; +} + +::-webkit-scrollbar-track-piece { + background: transparent; +} + +::-webkit-scrollbar-thumb { + background: transparent; + border: 6px solid transparent; + box-shadow: inset 0px 0px 10px 10px rgb(200 200 200 / 50%); + border-radius: 16px; + min-height: 64px; + transition: border 1s; +} + +::-webkit-scrollbar-thumb:hover { + border: 5px solid transparent; + box-shadow: inset 0px 0px 10px 10px rgb(200 200 200 / 80%); +} \ No newline at end of file diff --git a/resources/css/streamerMode.css b/resources/css/streamerMode.css new file mode 100644 index 00000000..3ae7a32a --- /dev/null +++ b/resources/css/streamerMode.css @@ -0,0 +1,53 @@ +@media only screen and (max-width: 1000px) { + /* Block the Profile Picture */ + .web-navigation__auth { + display: none !important; + position: fixed !important; + overflow: hidden !important; + } +} + +@media only screen and (max-width: 700px) and (min-width: 485px) { + :root { + --web-navigation-width: 0 !important; + } + + /* Hide Entire Sidebar */ + #web-navigation-container { + display: none !important; + position: fixed !important; + overflow: hidden !important; + z-index: 9901 !important; + } + + .web-chrome { + width: 100vw !important; + } +} + +@media only screen and (max-height: 100px) and (max-width: 485px) { + #web-navigation-container, .menuicon { + display: none !important; + position: fixed !important; + overflow: hidden !important; + z-index: 9901 !important; + } + + .web-nav-window-controls, .web-nav-window-controls-outer { + display: none !important; + position: fixed !important; + overflow: hidden !important; + } +} + +/* Removes Apple Logo */ +.web-navigation__header--logo { + display: none !important; + overflow: hidden !important; +} + +/* Remove Upsell */ +.web-navigation__native-upsell { + display: none !important; + overflow: hidden !important; +} \ No newline at end of file diff --git a/resources/css/transparency.css b/resources/css/transparency.css new file mode 100644 index 00000000..0af6082e --- /dev/null +++ b/resources/css/transparency.css @@ -0,0 +1,41 @@ +/* Give the main page a background so its not all transparent */ + +.page-container { + background-color: var(--pageBG) !important; +} + +html body { + background-color: transparent !important; +} + +/* Make the search box transparent */ + +@media only screen and (min-width: 485px) { + #web-navigation-container { + background-color: transparent !important; + } +} + +.dt-search-box__input { + opacity: 0.5 !important; +} + +/* Set the sidebar to transparent so the transparency affect can do its stuff */ + +@media (prefers-color-scheme: dark) { + :root { + --transparency: #0f0f0f1A; + } +} + +@media (prefers-color-scheme: light) { + :root { + --transparency: #ffffff1A; + } +} + +/* Stop Apple from Overriding background colour */ + +html body { + background-color: transparent !important; +} \ No newline at end of file diff --git a/resources/entitlements.mac.plist b/resources/entitlements.mac.plist new file mode 100644 index 00000000..8fff4988 --- /dev/null +++ b/resources/entitlements.mac.plist @@ -0,0 +1,12 @@ + + + + + com.apple.security.cs.allow-unsigned-executable-memory + + com.apple.security.cs.disable-library-validation + + com.apple.security.cs.allow-dyld-environment-variables + + + diff --git a/resources/functions/app-init.js b/resources/functions/app-init.js new file mode 100644 index 00000000..0f70c23d --- /dev/null +++ b/resources/functions/app-init.js @@ -0,0 +1,163 @@ +const {app, protocol, dialog} = require("electron"), + {join, resolve} = require("path"), + {existsSync, createReadStream, unlink, rmSync} = require("fs"), + Store = require('electron-store'); + +module.exports = () => { + + /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Application Configuration Init + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ + app.setPath("userData", join(app.getPath("appData"), app.name.replace(/\s/g, ''))) // Set Linux to use .cache instead of .config and remove the space as its annoying + + // Set the Theme List based on css files in themes directory + app.userThemesPath = resolve(app.getPath('userData'), 'themes'); + app.userPluginsPath = resolve(app.getPath('userData'), 'plugins'); + let showIntro = false + + const migrationFunctions = { + clearElectronPrefs: () => { + if (existsSync(resolve(app.getPath('userData'), 'preferences.json'))) { + unlink(resolve(app.getPath('userData'), 'preferences.json'), (err) => { + if (err) console.error(err) + }) + } + if (existsSync(resolve(app.getPath('userData'), 'Preferences'))) { + unlink(resolve(app.getPath('userData'), 'Preferences'), (err) => { + if (err) console.error(err) + }) + } + }, + clearCache: () => { + if (existsSync(resolve(app.getPath('userData'), 'Cache'))) { + rmSync(resolve(app.getPath('userData'), 'Cache'), {recursive: true, force: true}) + } + }, + showDevelopmentMessage: () => { + app.whenReady().then(() => { + dialog.showMessageBox({ + title: "Version under Development!", + message: "This version is under development. Expect bugs and issues whilst using the application.", + type: "warning" + }) + }) + } + } + const storeDefaults = { + general: { + storefront: "", + incognitoMode: false, + playbackNotifications: "minimized", + trayTooltipSongName: true, + startupPage: "browse", + discordRPC: "ame-title", + discordClearActivityOnPause: true, + lastfm: false, + lastfmRemoveFeaturingArtists: true, + lastfmNowPlaying: true, + analyticsEnabled: true, + lastfmScrobbleDelay: 30 + }, + visual: { + theme: "default", + frameType: "", + transparencyEffect: "", + transparencyTheme: "appearance-based", + transparencyDisableBlur: true, + transparencyMaximumRefreshRate: "", + streamerMode: false, + removeUpsell: true, + removeAppleLogo: true, + removeFooter: true, + removeScrollbars: true, + useOperatingSystemAccent: false, + scaling: 1, + yton: false, + mxmon: false, + mxmlanguage: "en" + }, + audio: { + audioQuality: "auto", + seamlessAudioTransitions: false, + castingBitDepth: '16', + enableDLNA: false, + }, + window: { + appStartupBehavior: "", + closeButtonMinimize: true, + alwaysOnTop: false + }, + advanced: { + forceApplicationMode: "system", + hardwareAcceleration: true, + verboseLogging: false, + autoUpdaterBetaBuilds: false, + useBetaSite: true, + preventMediaKeyHijacking: false, + devToolsOnStartup: false, + allowMultipleInstances: false + }, + tokens: { + lastfm: "" + } + } + const storeMigrations = { + '>=3.0.0': store => { + showIntro = true + }, + + '<=3.0.0': store => { + migrationFunctions.clearElectronPrefs() + migrationFunctions.clearCache() + migrationFunctions.showDevelopmentMessage() + } + } + + app.cfg = new Store({ + defaults: storeDefaults, + migrations: storeMigrations + }) + app.cfg.watch = true; + app.isQuiting = false; + + app.whenReady().then(() => { + protocol.registerFileProtocol('themes', (request, callback) => { + const url = request.url.substr(7) + callback({ + path: join(app.userThemesPath, url.toLowerCase()) + }) + }) + protocol.registerFileProtocol('ameres', (request, callback) => { + const url = request.url.substr(7) + callback(createReadStream(join(join(__dirname, '../'), url.toLowerCase()))) + }) + protocol.registerFileProtocol('plugin', (request, callback) => { + const url = request.url.substr(7) + callback({ + path: join(app.userPluginsPath, url.toLowerCase()) + }) + }) + }) + + const handlersFuncs = require('./handler'), + initFuncs = require('./init'), + loadFuncs = require('./load'), + utilsFuncs = require('./utils'), + winFuncs = require('./win'), + discordFuncs = require('./media/discordrpc'), + lastfmFuncs = require('./media/lastfm'), + mprisFuncs = require('./media/mpris'); + + return { + handler: handlersFuncs, + init: initFuncs, + load: loadFuncs, + utils: utilsFuncs, + win: winFuncs, + discord: discordFuncs, + lastfm: lastfmFuncs, + mpris: mprisFuncs, + wsapi: require('./wsapi'), + showOOBE: showIntro + }; +} \ No newline at end of file diff --git a/resources/functions/handler.js b/resources/functions/handler.js new file mode 100644 index 00000000..179d86e3 --- /dev/null +++ b/resources/functions/handler.js @@ -0,0 +1,1467 @@ +const { + app, + Menu, + ipcMain, + shell, + dialog, + Notification, + BrowserWindow, + systemPreferences, + nativeTheme, + clipboard + } = require('electron'), + {join, resolve} = require('path'), + {readFile, readFileSync, writeFile, existsSync, watch} = require('fs'), + os = require('os'), + mdns = require('mdns-js'), + Client = require('node-ssdp').Client, + express = require('express'), + audioClient = require('castv2-client').Client, + MediaRendererClient = require('upnp-mediarenderer-client'), + DefaultMediaReceiver = require('castv2-client').DefaultMediaReceiver, + getPort = require('get-port'), + {Stream} = require('stream'), + regedit = require('regedit'), + WaveFile = require('wavefile').WaveFile, + {initAnalytics} = require('./utils'); +initAnalytics(); + +const handler = { + + LaunchHandler: () => { + // Version Fetch + if (app.commandLine.hasSwitch('version') || app.commandLine.hasSwitch('v')) { + console.log(app.getVersion()) + app.exit() + } + + // Verbose Check + if (app.commandLine.hasSwitch('verbose')) { + console.log("[Apple-Music-Electron] User has launched the application with --verbose"); + } + + // Log File Location + if (app.commandLine.hasSwitch('log') || app.commandLine.hasSwitch('l')) { + console.log(join(app.getPath('userData'), 'logs')) + app.exit() + } + }, + + InstanceHandler: () => { + console.verbose('[InstanceHandler] Started.') + + app.on('second-instance', (_e, argv) => { + console.warn(`[InstanceHandler][SecondInstanceHandler] Second Instance Started with args: [${argv.join(', ')}]`) + + // Checks if first instance is authorized and if second instance has protocol args + argv.forEach((value) => { + if (value.includes('ame://') || value.includes('itms://') || value.includes('itmss://') || value.includes('musics://') || value.includes('music://')) { + console.warn(`[InstanceHandler][SecondInstanceHandler] Found Protocol!`) + handler.LinkHandler(value); + } + }) + + if (argv.includes("--force-quit")) { + console.warn('[InstanceHandler][SecondInstanceHandler] Force Quit found. Quitting App.'); + app.isQuiting = true + app.quit() + } else if (app.win && !app.cfg.get('advanced.allowMultipleInstances')) { // If a Second Instance has Been Started + console.warn('[InstanceHandler][SecondInstanceHandler] Showing window.'); + app.win.show() + app.win.focus() + } + }) + + if (!app.requestSingleInstanceLock() && !app.cfg.get('advanced.allowMultipleInstances')) { + console.warn("[InstanceHandler] Existing Instance is Blocking Second Instance."); + app.quit(); + app.isQuiting = true + } + }, + + PlaybackStateHandler: () => { + console.verbose('[playbackStateDidChange] Started.'); + + ipcMain.on('playbackStateDidChange', (_event, a) => { + console.verbose('[handler] playbackStateDidChange received.'); + app.media = a; + + app.ame.win.SetButtons() + app.ame.win.SetTrayTooltip(a) + app.ame.discord.updateActivity(a) + app.ame.lastfm.scrobbleSong(a) + app.ame.lastfm.updateNowPlayingSong(a) + app.ame.mpris.updateState(a) + }); + }, + + MediaStateHandler: () => { + console.verbose('[MediaStateHandler] Started.'); + + ipcMain.on('nowPlayingItemDidChange', (_event, a) => { + console.verbose('[handler] nowPlayingItemDidChange received.'); + app.media = a; + + app.ame.win.CreateNotification(a); + app.ame.mpris.updateActivity(a); + + if (app.cfg.get('audio.seamlessAudioTransitions')) { + app.ame.win.SetButtons() + app.ame.win.SetTrayTooltip(a) + app.ame.discord.updateActivity(a) + app.ame.lastfm.scrobbleSong(a) + app.ame.lastfm.updateNowPlayingSong(a) + app.ame.mpris.updateState(a) + } + }); + }, + + WindowStateHandler: () => { + console.verbose('[WindowStateHandler] Started.'); + + app.win.webContents.setWindowOpenHandler(({url}) => { + shell.openExternal(url).then(() => console.log(`[WindowStateHandler] User has opened ${url} which has been redirected to browser.`)); + return { + action: 'deny' + } + }) + + let incognitoNotification; + app.win.webContents.on('did-finish-load', () => { + console.verbose('[did-finish-load] Completed.'); + app.ame.load.LoadOneTimeFiles(); + app.win.webContents.setZoomFactor(parseFloat(app.cfg.get("visual.scaling"))) + if (app.cfg.get('general.incognitoMode') && !incognitoNotification) { + incognitoNotification = new Notification({ + title: 'Incognito Mode Enabled', + body: `Listening activity is hidden.`, + icon: join(__dirname, '../icons/icon.png') + }) + incognitoNotification.show() + } + }); + + app.win.webContents.on('did-fail-load', (event, errCode, errDesc, url, mainFrame) => { + console.error(`Error Code: ${errCode}\nLoading: ${url}\n${errDesc}`) + if (mainFrame) { + app.exit() + } + }); + + // Windows specific: Handles window states + // Needed because Aero Snap events do not send the same way as clicking the frame buttons. + if (process.platform === "win32" && app.cfg.get('visual.frameType') !== 'mac' || app.cfg.get('visual.frameType') !== 'mac-right') { + var WND_STATE = { + MINIMIZED: 0, + NORMAL: 1, + MAXIMIZED: 2, + FULL_SCREEN: 3 + } + var wndState = WND_STATE.NORMAL + + app.win.on("resize", (_event) => { + const isMaximized = app.win.isMaximized() + const isMinimized = app.win.isMinimized() + const isFullScreen = app.win.isFullScreen() + const state = wndState; + if (isMinimized && state !== WND_STATE.MINIMIZED) { + wndState = WND_STATE.MINIMIZED + } else if (isFullScreen && state !== WND_STATE.FULL_SCREEN) { + wndState = WND_STATE.FULL_SCREEN + } else if (isMaximized && state !== WND_STATE.MAXIMIZED) { + wndState = WND_STATE.MAXIMIZED + app.win.webContents.executeJavaScript(`document.querySelector("#maximize").classList.add("maxed")`) + } else if (state !== WND_STATE.NORMAL) { + wndState = WND_STATE.NORMAL + app.win.webContents.executeJavaScript(`document.querySelector("#maximize").classList.remove("maxed")`) + } + }) + } + + app.win.on('unresponsive', () => { + dialog.showMessageBox({ + message: `${app.getName()} has become unresponsive`, + title: 'Do you want to try forcefully reloading the app?', + buttons: ['Yes', 'Quit', 'No'], + cancelId: 1 + }).then(({response}) => { + if (response === 0) { + app.win.contents.forcefullyCrashRenderer() + app.win.contents.reload() + } else if (response === 1) { + console.log("[WindowStateHandler] Application has become unresponsive and has been closed.") + app.exit(); + } + }) + }) + + app.win.on('page-title-updated', (event, title) => { + console.verbose(`[page-title-updated] Title updated Running necessary files. ('${title}')`) + app.ame.load.LoadFiles(); + }) + + app.win.on('close', (event) => { + if (app.isMiniplayerActive && !app.isQuiting) { + ipcMain.emit("set-miniplayer", false); + event.preventDefault() + } else if ((app.cfg.get('window.closeButtonMinimize') || process.platform === "darwin") && !app.isQuiting) { + app.win.hide() + app.ame.win.SetContextMenu(false) + event.preventDefault() + } else { + app.win.destroy() + if (app.lyrics.mxmWin) { + app.lyrics.mxmWin.destroy(); + } + if (app.lyrics.neteaseWin) { + app.lyrics.neteaseWin.destroy(); + } + if (app.lyrics.ytWin) { + app.lyrics.ytWin.destroy(); + } + } + }) + + app.win.on('maximize', (e) => { + if (app.isMiniplayerActive) { + e.preventDefault() + } + }) + + app.win.on('show', () => { + app.ame.win.SetContextMenu(true) + app.ame.win.SetButtons() + if (app.win.isVisible()) { + app.win.focus() + } + }); + + app.win.on('hide', () => { + app.ame.win.SetContextMenu(false) + if (app.pluginsEnabled) { + app.win.webContents.executeJavaScript(`_plugins.execute('OnHide')`) + } + }); + }, + + SettingsHandler: () => { + console.verbose('[SettingsHandler] Started.'); + let DialogMessage = false, + storedChanges = [], + handledConfigs = []; + + systemPreferences.on('accent-color-changed', (event, color) => { + if (color && app.cfg.get('visual.useOperatingSystemAccent') && (process.platform === "win32" || process.platform === "darwin")) { + const accent = '#' + color.slice(0, -2) + app.win.webContents.insertCSS(` + :root { + --keyColor: ${accent} !important; + --systemAccentBG: ${accent} !important; + --systemAccentBG-pressed: rgba(${app.ame.utils.hexToRgb(accent).r}, ${app.ame.utils.hexToRgb(accent).g}, ${app.ame.utils.hexToRgb(accent).b}, 0.75) !important; + --keyColor-rgb: ${app.ame.utils.hexToRgb(accent).r} ${app.ame.utils.hexToRgb(accent).g} ${app.ame.utils.hexToRgb(accent).b} !important; + }`).then((key) => { + app.injectedCSS['useOperatingSystemAccent'] = key + }) + } + }) + + /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * Restart Required Configuration Handling + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + + app.cfg.onDidAnyChange((newConfig, oldConfig) => { + let currentChanges = []; + + for (const [categoryTitle, categoryContents] of Object.entries(newConfig)) { + if (categoryContents !== oldConfig[categoryTitle]) { // This has gotten the changed category + for (const [settingTitle, settingValue] of Object.entries(newConfig[categoryTitle])) { + if (JSON.stringify(settingValue) !== JSON.stringify(oldConfig[categoryTitle][settingTitle])) { + currentChanges.push(`${categoryTitle}.${settingTitle}`) + if (!storedChanges.includes(`${categoryTitle}.${settingTitle}`)) { + storedChanges.push(`${categoryTitle}.${settingTitle}`) + } + } + } + } + } + + console.verbose(`[SettingsHandler] Found changes: ${currentChanges} | Total Changes: ${storedChanges}`); + + if (!DialogMessage && !handledConfigs.includes(currentChanges[0])) { + DialogMessage = dialog.showMessageBox({ + title: "Relaunch Required", + message: "A relaunch is required in order for the settings you have changed to apply.", + type: "warning", + buttons: ['Relaunch Now', 'Relaunch Later'] + }).then(({response}) => { + if (response === 0) { + app.relaunch() + app.quit() + } + }) + } + }) + + /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * Individually Handled Configuration Options + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + handledConfigs.push('advanced.devToolsOnStartup', 'general.storefront', 'tokens.lastfm', 'window.closeButtonMinimize') // Stuff for the restart to just ignore + + // Theme Changes + handledConfigs.push('visual.theme'); + app.cfg.onDidChange('visual.theme', (newValue, _oldValue) => { + app.win.webContents.executeJavaScript(`AMStyling.loadTheme("${(newValue === 'default' || !newValue) ? '' : newValue}");`).catch((e) => console.error(e)); + if (app.watcher) { + app.watcher.close(); + console.verbose('[Watcher] Removed old watcher.') + } + + if (existsSync(resolve(app.getPath('userData'), 'themes', `${newValue}.css`)) && newValue !== "default" && newValue) { + app.watcher = watch(resolve(app.getPath('userData'), 'themes', `${newValue}.css`), (event, fileName) => { + if (event === "change" && fileName === `${newValue}.css`) { + app.win.webContents.executeJavaScript(`AMStyling.loadTheme("${newValue}", true);`).catch((err) => console.error(err)); + } + }); + console.verbose(`[Watcher] Watching for changes: 'themes/${newValue}.css'`) + } + + const updatedVibrancy = app.ame.utils.fetchTransparencyOptions(); + if (app.transparency && updatedVibrancy && process.platform !== 'darwin') app.win.setVibrancy(updatedVibrancy); + }) + + // Transparency Changes + handledConfigs.push('visual.transparencyEffect', 'visual.transparencyTheme', 'visual.transparencyDisableBlur', 'visual.transparencyMaximumRefreshRate'); + app.cfg.onDidChange('visual.transparencyEffect' || 'visual.transparencyTheme' || 'visual.transparencyDisableBlur' || 'visual.transparencyMaximumRefreshRate', (_newValue, _oldValue) => { + const updatedVibrancy = app.ame.utils.fetchTransparencyOptions() + if (app.cfg.get("visual.transparencyEffect") === "mica" && process.platform !== 'darwin') { + app.win.webContents.executeJavaScript(`AMStyling.setMica(true);`).catch((e) => console.error(e)); + app.transparency = false; + app.win.setVibrancy(); + } else { + app.win.webContents.executeJavaScript(`AMStyling.setMica(false);`).catch((e) => console.error(e)); + } + if (app.transparency && updatedVibrancy && process.platform !== 'darwin') { + app.win.setVibrancy(updatedVibrancy); + app.win.webContents.executeJavaScript(`AMStyling.setTransparency(true);`).catch((e) => console.error(e)); + } else { + app.win.setVibrancy(); + app.win.webContents.executeJavaScript(`AMStyling.setTransparency(false);`).catch((e) => console.error(e)); + } + }) + + // Reload scripts + handledConfigs.push('visual.removeUpsell', 'visual.removeAppleLogo', 'visual.removeFooter', 'visual.useOperatingSystemAccent'); + app.cfg.onDidChange('visual.removeUpsell', (newValue, _oldValue) => { + app.ame.load.LoadFiles(); + }) + app.cfg.onDidChange('visual.removeAppleLogo', (newValue, _oldValue) => { + app.ame.load.LoadFiles(); + }) + app.cfg.onDidChange('visual.removeFooter', (newValue, _oldValue) => { + app.ame.load.LoadFiles(); + }) + app.cfg.onDidChange('visual.useOperatingSystemAccent', (newValue, _oldValue) => { + if (!newValue) { + app.ame.win.removeInsertedCSS('useOperatingSystemAccent') + } else { + app.ame.load.LoadFiles(); + } + }) + + // DiscordRPC + handledConfigs.push('general.discordRPC', 'general.discordClearActivityOnPause'); + app.cfg.onDidChange('general.discordRPC', (newValue, _oldValue) => { + if (newValue && !app.discord.isConnected) { + app.ame.discord.connect(); + } else { + app.ame.discord.disconnect(); + } + }) + + + // IncognitoMode Changes + handledConfigs.push('general.incognitoMode'); + app.cfg.onDidChange('general.incognitoMode', (newValue, _oldValue) => { + if (newValue) { + console.log("[Incognito] Incognito Mode enabled. DiscordRPC and LastFM updates are ignored.") + } + }) + + // Scaling Changes + handledConfigs.push('visual.scaling'); + app.cfg.onDidChange('visual.scaling', (newValue, _oldValue) => { + app.win.webContents.setZoomFactor(parseFloat(newValue)) + }); + + // Mode Changes + handledConfigs.push('advanced.forceApplicationMode'); + app.cfg.onDidChange('advanced.forceApplicationMode', (newValue, _oldValue) => { + nativeTheme.themeSource = newValue; + }); + }, + + RendererListenerHandlers: () => { + + // Showing the OOBE on first launch + ipcMain.on('showOOBE', (event) => { + event.returnValue = app.ame.showOOBE; + app.ame.showOOBE = false + }) + + // Themes Listing Update + ipcMain.handle('updateThemesListing', (_event) => { + return app.ame.utils.fetchThemesListing(); + }) + + // Plugins Listing Update + ipcMain.handle('fetchPluginsListing', (_event) => { + return app.ame.utils.fetchPluginsListing(); + }) + + // Get OS + ipcMain.handle('fetchOperatingSystem', () => { + return process.platform + }) + + // Acrylic Check + ipcMain.handle('isAcrylicSupported', (_event) => { + return app.ame.utils.isAcrylicSupported(); + }) + + // Electron-Store Renderer Handling for Getting Values + ipcMain.handle('getStoreValue', (event, key, defaultValue) => { + return (defaultValue ? app.cfg.get(key, true) : app.cfg.get(key)); + }); + + // Electron-Store Renderer Handling for Setting Values + ipcMain.handle('setStoreValue', (event, key, value) => { + app.cfg.set(key, value); + }); + + ipcMain.handle('themeFileExists', (event, fileName) => { + return existsSync(resolve(app.getPath('userData'), 'themes', `${fileName}.css`)) + }); + + // Copy Log File + ipcMain.on('copyLogFile', (event) => { + const data = readFileSync(app.log.transports.file.getFile().path, {encoding: 'utf8', flag: 'r'}); + clipboard.writeText(data) + event.returnValue = true + }); + + // Electron-Store Renderer Handling for Getting Configuration + ipcMain.on('getStore', (event) => { + event.returnValue = app.cfg.store + }) + + // Electron-Store Renderer Handling for Setting Configuration + ipcMain.on('setStore', (event, store) => { + app.cfg.store = store + }) + + // Update Themes + ipcMain.handle('updateThemes', () => { + return app.ame.utils.updateThemes() + }); + + // Authorization (This needs to be cleaned up a bit, an alternative to reload() would be good ) + ipcMain.on('authorizationStatusDidChange', (_event, authorized) => { + console.log(`authorization updated. status: ${authorized}`) + app.win.reload() + app.ame.load.LoadFiles() + app.isAuthorized = (authorized === 3) + }) + + // Window Navigation - Minimize + ipcMain.on('minimize', () => { // listen for minimize event + if (typeof app.win.minimize === 'function') { + app.win.minimize() + } + }); + + // Window Navigation - Maximize + ipcMain.on('maximize', () => { // listen for maximize event and perform restore/maximize depending on window state + + if (app.win.isMaximized()) { + app.win.unmaximize() + if (process.platform !== "win32") { + app.win.webContents.executeJavaScript(`document.querySelector("#maximize").classList.remove("maxed")`) + } + } else { + app.win.maximize() + if (process.platform !== "win32") { + app.win.webContents.executeJavaScript(`document.querySelector("#maximize").classList.add("maxed")`) + } + } + }) + + // Window Navigation - Close + ipcMain.on('close', () => { // listen for close event + app.win.close(); + }) + + // Window Navigation - Back + ipcMain.on('back', () => { // listen for back event + if (app.win.webContents.canGoBack()) { + app.win.webContents.goBack() + } + }) + + // Window Navigation - Resize + ipcMain.on("resize-window", (event, width, height) => { + app.win.setSize(width, height) + }) + + // miniPlayer + const minSize = app.win.getMinimumSize() + ipcMain.on("set-miniplayer", (event, val) => { + if (val) { + app.isMiniplayerActive = true; + app.win.setSize(300, 300); + app.win.setMinimumSize(300, 55); + app.win.setMaximumSize(300, 300); + app.win.maximizable = false; + app.win.webContents.executeJavaScript("_miniPlayer.setMiniPlayer(true)").catch((e) => console.error(e)); + if (app.win.isMaximized) { + app.win.unmaximize(); + } + } else { + app.isMiniplayerActive = false; + app.win.setMaximumSize(9999, 9999); + app.win.setMinimumSize(minSize[0], minSize[1]); + app.win.setSize(1024, 600); + app.win.maximizable = true; + app.win.webContents.executeJavaScript("_miniPlayer.setMiniPlayer(false)").catch((e) => console.error(e)); + } + }) + + ipcMain.on("show-miniplayer-menu", () => { + const menuOptions = [{ + type: "checkbox", + label: "Always On Top", + click: () => { + if (app.win.isAlwaysOnTop()) { + app.win.setAlwaysOnTop(false, 'screen') + } else { + app.win.setAlwaysOnTop(true, 'screen') + } + }, + checked: app.win.isAlwaysOnTop() + }, { + label: "Exit Mini Player", + click: () => { + ipcMain.emit("set-miniplayer", false) + } + }, + + ] + const menu = Menu.buildFromTemplate(menuOptions) + menu.popup(app.win) + }) + + ipcMain.on("alwaysOnTop", (event, val) => { + if (val) { + app.win.setAlwaysOnTop(true, 'screen') + } else { + app.win.setAlwaysOnTop(false, 'screen') + } + }) + + ipcMain.on("load-plugin", (event, plugin) => { + let path = join(app.userPluginsPath, plugin.toLowerCase() + ".js") + readFile(path, "utf-8", (error, data) => { + if (!error) { + try { + app.win.webContents.executeJavaScript(data).then(() => { + console.verbose(`[Plugins] Injected Plugin`) + }) + } catch (err) { + console.error(`[Plugins] error injecting plugin: ${path} - Error: ${err}`) + } + } else { + console.error(`[Plugins] error reading plugin: ${path} - Error: ${error}`) + } + }) + }) + + // Get Wallpaper + ipcMain.on("get-wallpaper", (event) => { + function base64_encode(file) { + const bitmap = readFileSync(file) + return `data:image/png;base64,${Buffer.from(bitmap).toString('base64')}` + } + + regedit.list(`HKCU\\Control Panel\\Desktop\\`, (err, result) => { + var path = (result['HKCU\\Control Panel\\Desktop\\\\']['values']['WallPaper']['value']) + event.returnValue = base64_encode(path) + }) + }) + + ipcMain.on("get-wallpaper-style", (event) => { + regedit.list(`HKCU\\Control Panel\\Desktop\\`, (err, result) => { + var value = (result['HKCU\\Control Panel\\Desktop\\\\']['values']['WallpaperStyle']['value']) + event.returnValue = parseInt(value) + }) + }) + + // Set BrowserWindow zoom factor + ipcMain.on("set-zoom-factor", (event, factor) => { + app.win.webContents.setZoomFactor(factor) + }) + + }, + + LinkHandler: (startArgs) => { + if (!startArgs || !app.win || !app.isAuthorized) return; + + + if (String(startArgs).includes('auth')) { + let authURI = String(startArgs).split('/auth/')[1] + if (authURI.startsWith('lastfm')) { // If we wanted more auth options + const authKey = authURI.split('lastfm?token=')[1]; + app.cfg.set('general.lastfm', true); + app.cfg.set('tokens.lastfm', authKey); + app.win.webContents.send('LastfmAuthenticated', authKey); + app.ame.lastfm.authenticate() + } + } else { + if (!app.isAuthorized) return + const formattedSongID = startArgs.replace('ame://', '').replace('/', ''); + console.warn(`[LinkHandler] Attempting to load song id: ${formattedSongID}`); + + // setQueue can be done with album, song, url, playlist id + app.win.webContents.executeJavaScript(` + MusicKit.getInstance().setQueue({ song: '${formattedSongID}'}).then(function(queue) { + MusicKit.getInstance().play(); + }); + `).catch((err) => console.error(err)); + } + + }, + + LyricsHandler: () => { + app.lyrics = { + neteaseWin: null, + mxmWin: null, + ytWin: null, + artworkURL: '', + savedLyric: '' + } + + app.lyrics.neteaseWin = new BrowserWindow({ + width: 1, + height: 1, + show: false, + autoHideMenuBar: true, + webPreferences: { + nodeIntegration: true, + contextIsolation: false + } + }); + app.lyrics.mxmWin = new BrowserWindow({ + width: 1, + height: 1, + show: false, + autoHideMenuBar: true, + webPreferences: { + nodeIntegration: true, + contextIsolation: false, + + }, + }); + + app.lyrics.ytWin = new BrowserWindow({ + width: 1, + height: 1, + show: false, + autoHideMenuBar: true, + webPreferences: { + nodeIntegration: true, + contextIsolation: false, + + }, + }); + + + ipcMain.on('YTTranslation', function (event, track, artist, lang) { + try { + if (app.lyrics.ytWin == null) { + app.lyrics.ytWin = new BrowserWindow({ + width: 1, + height: 1, + show: false, + autoHideMenuBar: true, + webPreferences: { + nodeIntegration: true, + contextIsolation: false, + } + }); + + + } else { + app.lyrics.ytWin.webContents.send('ytcors', track, artist, lang); + } + if (!app.lyrics.ytWin.webContents.getURL().includes('youtube.html')) { + app.lyrics.ytWin.loadFile(join(__dirname, '../lyrics/youtube.html')); + app.lyrics.ytWin.webContents.on('did-finish-load', () => { + app.lyrics.ytWin.webContents.send('ytcors', track, artist, lang); + }); + } + + app.lyrics.ytWin.on('closed', () => { + app.lyrics.ytWin = null + }); + + } catch (e) { + console.error(e) + } + }); + + ipcMain.on('MXMTranslation', function (event, track, artist, lang, time) { + try { + if (app.lyrics.mxmWin == null) { + app.lyrics.mxmWin = new BrowserWindow({ + width: 1, + height: 1, + show: false, + autoHideMenuBar: true, + webPreferences: { + nodeIntegration: true, + contextIsolation: false, + + } + }); + + + } else { + app.lyrics.mxmWin.webContents.send('mxmcors', track, artist, lang, time); + } + // try{ + + // const cookie = { url: 'https://apic-desktop.musixmatch.com/', name: 'x-mxm-user-id', value: '' } + // app.lyrics.mxmWin.webContents.session.defaultSession.cookies.set(cookie); + // } catch (e){} + if (!app.lyrics.mxmWin.webContents.getURL().includes('musixmatch.html')) { + app.lyrics.mxmWin.loadFile(join(__dirname, '../lyrics/musixmatch.html')); + app.lyrics.mxmWin.webContents.on('did-finish-load', () => { + app.lyrics.mxmWin.webContents.send('mxmcors', track, artist, lang, time); + }); + } + + app.lyrics.mxmWin.on('closed', () => { + app.lyrics.mxmWin = null + }); + + } catch (e) { + console.error(e) + } + }); + ipcMain.on('NetEaseLyricsHandler', function (event, data) { + try { + if (app.lyrics.neteaseWin == null) { + app.lyrics.neteaseWin = new BrowserWindow({ + width: 100, + height: 100, + show: false, + autoHideMenuBar: true, + webPreferences: { + nodeIntegration: true, + contextIsolation: false, + + } + }); + app.lyrics.neteaseWin.webContents.on('did-finish-load', () => { + app.lyrics.neteaseWin.webContents.send('neteasecors', data); + }); + } else { + app.lyrics.neteaseWin.webContents.on('did-finish-load', () => { + app.lyrics.neteaseWin.webContents.send('neteasecors', data); + }); + } + app.lyrics.neteaseWin.loadFile(join(__dirname, '../lyrics/netease.html')); + app.lyrics.neteaseWin.on('closed', () => { + app.lyrics.neteaseWin = null + }); + + } catch (e) { + console.log(e); + + app.lyrics.savedLyric = '[00:00] Instrumental. / Lyrics not found.'; + app.win.send('truelyrics', '[00:00] Instrumental. / Lyrics not found.'); + } + }); + + ipcMain.on('LyricsHandler', function (event, data, artworkURL) { + + app.win.send('truelyrics', data); + app.win.send('albumart', artworkURL); + app.lyrics.savedLyric = data; + app.lyrics.albumart = artworkURL; + }); + + ipcMain.on('updateMiniPlayerArt', function (event, artworkURL) { + app.lyrics.albumart = artworkURL; + + + }) + ipcMain.on('LyricsHandlerNE', function (event, data) { + + app.win.send('truelyrics', data); + app.lyrics.savedLyric = data; + }); + + ipcMain.on('LyricsHandlerTranslation', function (event, data) { + + app.win.send('lyricstranslation', data); + }); + + ipcMain.on('LyricsTimeUpdate', function (event, data) { + + app.win.send('ProgressTimeUpdate', data); + }); + + ipcMain.on('LyricsUpdate', function (event, data, artworkURL) { + + app.win.send('truelyrics', data); + app.win.send('albumart', artworkURL); + app.lyrics.savedLyric = data; + app.lyrics.albumart = artworkURL; + }); + + ipcMain.on('LyricsMXMFailed', function (_event, _data) { + app.win.send('backuplyrics', ''); + console.log("mxm failed"); + }); + + ipcMain.on('LyricsYTFailed', function (_event, _data) { + app.win.send('backuplyricsMV', ''); + }); + + ipcMain.on('ProgressTimeUpdateFromLyrics', function (event, data) { + app.win.webContents.executeJavaScript(`MusicKit.getInstance().seekToTime('${data}')`).catch((e) => console.error(e)); + }); + + + }, + + AudioHandler: () => { + ipcMain.on('muteAudio', function (event, mute) { + app.win.webContents.setAudioMuted(mute); + }); + + if (process.platform === "win32") { + const EAstream = new Stream.PassThrough(); + let ao; + const portAudio = require('naudiodon'); + + console.log(portAudio.getDevices()); + + ipcMain.on('getAudioDevices', function (_event) { + for (let id = 0; id < portAudio.getDevices().length; id++) { + if (portAudio.getDevices()[id].maxOutputChannels > 0) + app.win.webContents.executeJavaScript(`console.log('id:','${id}','${portAudio.getDevices()[id].name}','outputChannels:','${portAudio.getDevices()[id].maxOutputChannels}','preferedSampleRate','${portAudio.getDevices()[id].defaultSampleRate}','nativeFormats','${portAudio.getDevices()[id].hostAPIName}')`); + } + }) + + ipcMain.on('enableExclusiveAudio', function (event, id) { + ao = new portAudio.AudioIO({ + outOptions: { + + channelCount: 2, + sampleFormat: portAudio.SampleFormat24Bit, + sampleRate: 48000, + maxQueue: 100, + deviceId: id, + highwaterMark: 1024, // Use -1 or omit the deviceId to select the default device + closeOnError: false // Close the stream if an audio error is detected, if set false then just log the error + } + }); + // Create a stream to pipe into the AudioOutput + // Note that this does not strip the WAV header so a click will be heard at the beginning + EAstream.pipe(ao); + EAstream.once('data', (_data) => { + ao.start(); + }) + + // Start piping data and start streaming + + }) + + ipcMain.on('disableExclusiveAudio', function (_event, _data) { + if (ao) { + ao.quit(); + } + }) + + app.win.on('quit', () => { + if (ao) { + ao.quit(); + } + }) + + // mix the channels + function interleave(leftChannel, rightChannel) { + var length = leftChannel.length + rightChannel.length; + var result = new Float32Array(length); + + var inputIndex = 0; + + for (var index = 0; index < length;) { + result[index++] = leftChannel[inputIndex]; + result[index++] = rightChannel[inputIndex]; + inputIndex++; + } + return result; + } + + ipcMain.on('changeAudioMode', function (_event, _mode) { + console.log(portAudio.getHostAPIs()); + }); + + console.log(portAudio.getHostAPIs()); + + ipcMain.on('writePCM', function (event, buffer) { + // writeFile(join(app.getPath('userData'), 'buffertest5.raw'), Buffer.from(buffer,'binary').slice(44),{flag: 'a+'}, function (err) { + // if (err) throw err; + // console.log('It\'s saved!'); + // }); + // do anything with stereo pcm here + // buffer = Buffer.from(new Int8Array(interleave(Float32Array.from(leftpcm), Float32Array.from(rightpcm)).buffer)); + EAstream.write(Buffer.from(buffer).slice(44)); + + }); + + ipcMain.on('writeChunks', function (event, blob) { + writeFile(join(app.getPath('userData'), 'buffertest.raw'), Buffer.from(blob, 'binary'), {flag: 'a+'}, function (err) { + if (err) throw err; + console.log('It\'s saved!'); + }); + }) + + } + }, + + GoogleCastHandler: () => { + const devices = [], + castDevices = []; + + let GCRunning = false, + GCBuffer, + expectedConnections = 0, + currentConnections = 0, + activeConnections = [], + requests = [], + GCstream = new Stream.PassThrough(), + connectedHosts = {}, + port = false, + server = false, + bufcount = 0, + bufcount2 = 0, + headerSent = false; + + const audioserver = express(); + audioserver.get('/', playData.bind(this)); + + function playData(req, res) { + try{if(app.cfg.get('audio.castingBitDepth') == "24") + headerSent = false;} catch (e){} + console.log("Device requested: /"); + req.connection.setTimeout(Number.MAX_SAFE_INTEGER); + requests.push({req: req, res: res}); + const pos = requests.length - 1; + req.on("close", () => { + console.info("CLOSED", requests.length); + requests.splice(pos, 1); + console.info("CLOSED", requests.length); + headerSent = false; + }); + + + GCstream.on('data', (data) => { + try { + res.write(data); + } catch (ex) { + console.log("Dead", ex); + } + }) + + } + + audioserver.get('/a.wav', playData2.bind(this)); + + function playData2(req, res) { + console.log("Device requested: /a.wav"); + req.connection.setTimeout(Number.MAX_SAFE_INTEGER); + try{if(app.cfg.get('audio.castingBitDepth') == "24") + headerSent = false;} catch (e){} + res.setHeader('Accept-Ranges', 'bytes') + res.setHeader('Connection', 'keep-alive') + res.setHeader('Content-Type', 'audio/wav') + res.setHeader('Access-Control-Allow-Origin', '*'); + res.statusCode = 200; + res.setHeader('transferMode.dlna.org', 'Streaming'); + res.setHeader( + 'contentFeatures.dlna.org', + 'DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000' + ); + requests.push({req: req, res: res}); + const pos = requests.length - 1; + req.on("close", () => { + console.info("CLOSED", requests.length); + requests.splice(pos, 1); + console.info("CLOSED", requests.length); + headerSent = false; + }); + + + GCstream.on('data', (data) => { + try { + res.write(data); + } catch (ex) { + console.log("Dead", ex); + } + }) + + } + + ipcMain.on('writeOPUS', function (event, buffer) { + + const pcm = Buffer.from(buffer, 'binary').slice(44); //stereo, 48k, 16signed in 8bit buffer + + // Pipe it to something else (i.e. stdout) + + + // writeFile(join(app.getPath('userData'), 'buffertest3.raw'), Encoder.,{flag: 'a+'}, function (err) { + // if (err) throw err; + // console.log('It\'s saved!'); + // }); + // //GCstream.write(mp3Tmp); + + }) + + ipcMain.on('writeWAV', function (event, pcm, extremeAudio) { + let pcmData; + if (extremeAudio === '24') { + pcmData = Buffer.from(pcm, 'binary').slice(44); + if (!headerSent) { + const header = Buffer.from(pcm, 'binary').slice(0, 44) + header.writeUInt32LE(2147483600, 4) + header.writeUInt32LE(2147483600 + 44 - 8, 40) + GCstream.write(Buffer.concat([header, pcmData])); + headerSent = true; + console.log('done'); + } else { + GCstream.write(pcmData); + } + + } else { + //sample down to 16 (default) + let wav = new WaveFile(Buffer.from(pcm, 'binary')); + wav.toBitDepth("16"); + var newpcm = wav.toBuffer(); + pcmData = Buffer.from(newpcm, 'binary').slice(44); + if (!headerSent) { + const header = Buffer.from(newpcm, 'binary').slice(0, 44) + header.writeUInt32LE(2147483600, 4) + header.writeUInt32LE(2147483600 + 44 - 8, 40) + GCstream.write(Buffer.concat([header, pcmData])); + headerSent = true; + console.log('done'); + } else { + GCstream.write(pcmData); + } + } + } + ); + + function getServiceDescription(url, address) { + const request = require('request'); + request.get(url, (error, response, body) => { + if (!error && response.statusCode === 200) { + parseServiceDescription(body, address, url); + } + }); + } + + function ondeviceup(host, name, location, type) { + if (castDevices.findIndex((item) => item.host === host && item.name === name && item.location === location && item.type === type) === -1) { + castDevices.push({ + name: name, + host: host, + location: location, + type: type + }); + if (devices.indexOf(host) === -1) { + devices.push(host); + } + if (name) { + app.win.webContents.executeJavaScript(`console.log('deviceFound','ip: ${host} name:${name}')`).catch(err => console.error(err)); + console.log("deviceFound", host, name); + } + } else { + app.win.webContents.executeJavaScript(`console.log('deviceFound (added)','ip: ${host} name:${name}')`).catch(err => console.error(err)); + console.log("deviceFound (added)", host, name); + } + } + + function broadcastRemote() { + const myString = getIp(); + const encoded = new Buffer(myString).toString('base64'); + var x = mdns.tcp('ame-lg-client'); + let server2 = mdns.createAdvertisement(x, '3839', { name: encoded }); + server2.start(); + + let ssdpRemoteServer = express(); + ssdpRemoteServer.listen(3840, () => { + }); + ssdpRemoteServer.get('/', (req, res) => { + res.header("Content-Type", "application/xml"); + data = ` + + + 1 + 0 + + ${'http://' + getIp()} + + urn:schemas-upnp-org:device:MediaRenderer:1 + + AME Remote + ${encoded} + http://applemusicelectron.com + AME + AME + 3.0 + ${'http://' + getIp()} + manufacturer's serial number + uuid:75ebacfb-e890-4a21-a913-9a16858e9270 + Universal Product Code + + + urn:schemas-upnp-org:service:AVTransport:1 + urn:upnp-org:serviceId:AVTransport + + + + + + + + + ` + res.status(200).send(data); + }); + + let SSDP = require('node-ssdp').Server + , server = new SSDP({ + location : 'http://' + getIp() + ':3840', + allowWildcards : true, + adInterval : 5000, + + }) + ; + + // server.addUSN('upnp:rootdevice'); + server.addUSN('urn:schemas-upnp-org:device:MediaRenderer:1'); + server.addUSN('urn:schemas-upnp-org:service:AVTransport:1'); + + server.start().catch(e => { + console.log('Failed to start server:', e) + }) + .then(() => { + console.log('Server started.') + }) + + + process.on('exit', function(){ + server.stop() // advertise shutting down and stop listening + }) + } + + function searchForGCDevices() { + try { + + let browser = mdns.createBrowser(mdns.tcp('googlecast')); + browser.on('ready', browser.discover); + + browser.on('update', (service) => { + if (service.addresses && service.fullname) { + ondeviceup(service.addresses[0], service.fullname.substring(0, service.fullname.indexOf("._googlecast")) + " " + (service.type[0].description ?? ""), '', 'googlecast'); + } + }); + + // also do a SSDP/UPnP search + let ssdpBrowser = new Client(); + ssdpBrowser.on('response', (headers, statusCode, rinfo) => { + var location = getLocation(headers); + if (location != null) { + getServiceDescription(location, rinfo.address); + } + + }); + + function getLocation(headers) { + let location = null; + if (headers["LOCATION"] != null ){location = headers["LOCATION"]} + else if (headers["Location"] != null ){location = headers["Location"]} + return location; + } + + ssdpBrowser.search('urn:dial-multiscreen-org:device:dial:1'); + + // actual upnp devices + if (app.cfg.get("audio.enableDLNA")) { + let ssdpBrowser2 = new Client(); + ssdpBrowser2.on('response', (headers, statusCode, rinfo) => { + var location = getLocation(headers); + if (location != null) { + getServiceDescription(location, rinfo.address); + } + + }); + ssdpBrowser2.search('urn:schemas-upnp-org:device:MediaRenderer:1'); + + } + + + } catch (e) { + console.log('Search GC err', e); + } + } + + function setupGCServer() { + return new Promise((resolve, reject) => { + getPort() + .then(port2 => { + port = port2; + server = audioserver.listen(port, () => { + console.info('Example app listening at http://%s:%s', getIp(), port); + }); + GCRunning = true; + resolve() + }) + .catch(reject); + }); + } + broadcastRemote(); + function parseServiceDescription(body, address, url) { + const parseString = require('xml2js').parseString; + parseString(body, (err, result) => { + if (!err && result && result.root && result.root.device) { + const device = result.root.device[0]; + console.log('device', device); + let devicetype = 'googlecast'; + console.log() + if (device.deviceType && device.deviceType.toString() === 'urn:schemas-upnp-org:device:MediaRenderer:1') { + devicetype = 'upnp'; + } + ondeviceup(address, device.friendlyName.toString(), url, devicetype); + } + }); + } + + function loadMedia(client, song, artist, album, albumart, cb) { + const u = 'http://' + getIp() + ':' + server.address().port + '/'; + client.launch(DefaultMediaReceiver, (err, player) => { + if (err) { + console.log(err); + return; + } + let media = { + // Here you can plug an URL to any mp4, webm, mp3 or jpg file with the proper contentType. + contentId: u, + contentType: 'audio/wav', + streamType: 'LIVE', // or LIVE + + // Title and cover displayed while buffering + metadata: { + type: 0, + metadataType: 3, + title: song ?? "", + albumName: album ?? "", + artist: artist ?? "", + images: [ + {url: albumart ?? ""}] + } + }; + // ipcMain.on('setupNewTrack', function (event, song, artist, album, albumart) { + // try { + + // let newmedia = { + // // Here you can plug an URL to any mp4, webm, mp3 or jpg file with the proper contentType. + // contentId: u, + // contentType: 'audio/wav', + // streamType: 'LIVE', // or LIVE + + // // Title and cover displayed while buffering + // metadata: { + // type: 0, + // metadataType: 3, + // title: song ?? "", + // albumName: album ?? '', + // artist: artist ?? '', + // images: [ + // {url: albumart ?? ''}] + // } + // }; + // headerSent = false; + + // player.queueUpdate(newmedia, { + // autoplay: true + // }, (err, status) => { + // console.log('media loaded playerState=%s', status); + // }); + + // } catch (e) { + // console.log('GCerror', e) + // } + // }); + + + player.on('status', status => { + console.log('status broadcast playerState=%s', status); + }); + + console.log('app "%s" launched, loading media %s ...', player, media); + + player.load(media, { + autoplay: true + }, (err, status) => { + console.log('media loaded playerState=%s', status); + }); + + + client.getStatus((x, status) => { + if (status && status.volume) { + client.volume = status.volume.level; + client.muted = status.volume.muted; + client.stepInterval = status.volume.stepInterval; + } + }) + + }); + } + + function getIp() { + let ip = false; + let alias = 0; + let ifaces = os.networkInterfaces(); + for (var dev in ifaces) { + ifaces[dev].forEach(details => { + if (details.family === 'IPv4') { + if (!/(loopback|vmware|internal|hamachi|vboxnet|virtualbox)/gi.test(dev + (alias ? ':' + alias : ''))) { + if (details.address.substring(0, 8) === '192.168.' || + details.address.substring(0, 7) === '172.16.' || + details.address.substring(0, 3) === '10.' + ) { + ip = details.address; + ++alias; + } + } + } + }); + } + return ip; + } + + function stream(device, song, artist, album, albumart) { + let castMode = 'googlecast'; + let UPNPDesc = ''; + castMode = device.type; + UPNPDesc = device.location; + + let client; + if (castMode === 'googlecast') { + let client = new audioClient(); + client.volume = 100; + client.stepInterval = 0.5; + client.muted = false; + + client.connect(device.host, () => { + console.log('connected, launching app ...', 'http://' + getIp() + ':' + server.address().port + '/'); + if (!connectedHosts[device.host]) { + connectedHosts[device.host] = client; + activeConnections.push(client); + } + loadMedia(client, song, artist, album, albumart); + }); + + client.on('close', () => { + console.info("Client Closed"); + for (let i = activeConnections.length - 1; i >= 0; i--) { + if (activeConnections[i] === client) { + activeConnections.splice(i, 1); + return; + } + } + }); + + client.on('error', err => { + console.log('Error: %s', err.message); + client.close(); + delete connectedHosts[device.host]; + }); + + } else { + // upnp devices + try { + client = new MediaRendererClient(UPNPDesc); + const options = { + autoplay: true, + contentType: 'audio/x-wav', + dlnaFeatures: 'DLNA.ORG_PN=-;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000', + metadata: { + title: 'Apple Music Electron', + creator: 'Streaming ...', + type: 'audio', // can be 'video', 'audio' or 'image' + // url: 'http://' + getIp() + ':' + server.address().port + '/', + // protocolInfo: 'DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000; + } + }; + + client.load('http://' + getIp() + ':' + server.address().port + '/a.wav', options, function (err, _result) { + if (err) throw err; + console.log('playing ...'); + }); + + } catch (e) { + } + } + } + + ipcMain.on('getKnownCastDevices', function (event) { + event.returnValue = castDevices + }); + + ipcMain.on('performGCCast', function (event, device, song, artist, album, albumart) { + setupGCServer().then(function () { + app.win.webContents.setAudioMuted(true); + console.log(device); + stream(device, song, artist, album, albumart); + }) + }); + + ipcMain.on('getChromeCastDevices', function (_event, _data) { + searchForGCDevices(); + }); + + ipcMain.on('stopGCast', function (_event) { + app.win.webContents.setAudioMuted(false); + GCRunning = false; + expectedConnections = 0; + currentConnections = 0; + activeConnections = []; + requests = []; + GCstream = new Stream.PassThrough(); + connectedHosts = {}; + port = false; + server = false; + bufcount = 0; + bufcount2 = 0; + headerSent = false; + }) + } +} + +module.exports = handler diff --git a/resources/functions/init.js b/resources/functions/init.js new file mode 100644 index 00000000..01cfd4d1 --- /dev/null +++ b/resources/functions/init.js @@ -0,0 +1,234 @@ +const {app, nativeTheme, nativeImage, Tray} = require("electron"), + {join, resolve} = require("path"), + os = require("os"), + {existsSync, readdirSync} = require("fs"), + regedit = require("regedit"), + {initAnalytics} = require('./utils'); +initAnalytics(); + +const init = { + + BaseInit: () => { + const censoredConfig = app.cfg.store; + censoredConfig.tokens = {}; + + console.log('---------------------------------------------------------------------') + console.log(`${app.getName()} has started.`); + console.log(`Version: ${app.getVersion()} | Electron Version: ${process.versions.electron}`) + console.log(`Type: ${os.type} | Release: ${os.release()} ${app.ame.utils.fetchOperatingSystem() ? `(${app.ame.utils.fetchOperatingSystem()})` : ""} | Platform: ${os.platform()}`) + console.log(`User Data Path: '${app.getPath('userData')}'`) + console.log(`Current Configuration: ${JSON.stringify(censoredConfig)}`) + console.log("---------------------------------------------------------------------") + if (app.cfg.get('general.analyticsEnabled') && app.isPackaged) console.log('[Sentry] Sentry logging is enabled, any errors you receive will be presented to the development team to fix for the next release.') + console.verbose('[InitializeBase] Started.'); + + // Disable CORS + app.commandLine.appendSwitch('disable-features', 'OutOfBlinkCors') + app.commandLine.appendSwitch('high-dpi-support', 'true') + if (process.platform === "win32") { + app.commandLine.appendSwitch('force-device-scale-factor', '1') + } + + if (app.cfg.get('advanced.verboseLogging')) { + app.commandLine.appendSwitch('--enable-logging'); + app.commandLine.appendSwitch('--log-file', join(app.getPath('userData'), 'logs', 'renderer.log')); + console.verbose(`[InitializeBase] Renderer logging setup at ${join(app.getPath('userData'), 'logs', 'renderer.log')}`); + } + + // Media Key Hijacking + if (app.cfg.get('advanced.preventMediaKeyHijacking')) { + console.log("[Apple-Music-Electron] Hardware Media Key Handling disabled.") + app.commandLine.appendSwitch('disable-features', 'HardwareMediaKeyHandling,MediaSessionService'); + } + + // GPU Hardware Acceleration + if (!app.cfg.get('advanced.hardwareAcceleration')) { + app.commandLine.appendSwitch('disable-gpu') + } + + // Registry + if (process.platform === "win32") { + regedit.setExternalVBSLocation("resources/regedit/vbs") + } + + // Sets the ModelId (For windows notifications) + if (process.platform === "win32") app.setAppUserModelId(app.getName()); + + // Disable the Media Session to allow MPRIS to be the primary service + if (process.platform === "linux") app.commandLine.appendSwitch('disable-features', 'MediaSessionService'); + + // Assign Default Variables + app.isQuiting = (app.isQuiting ? app.isQuiting : false); + app.win = ''; + app.ipc = { + existingNotification: false + }; + + if (app.cfg.get('general.incognitoMode')) { + console.log("[Incognito] Incognito Mode enabled. DiscordRPC and LastFM updates are ignored.") + } + + /* Protocols for Link Handling */ + if (process.defaultApp) { + if (process.argv.length >= 2) { + app.setAsDefaultProtocolClient('ame', process.execPath, [resolve(process.argv[1])]) + app.setAsDefaultProtocolClient('itms', process.execPath, [resolve(process.argv[1])]) + app.setAsDefaultProtocolClient('itmss', process.execPath, [resolve(process.argv[1])]) + app.setAsDefaultProtocolClient('musics', process.execPath, [resolve(process.argv[1])]) + app.setAsDefaultProtocolClient('music', process.execPath, [resolve(process.argv[1])]) + } + } else { + app.setAsDefaultProtocolClient('ame') // Custom AME Protocol + app.setAsDefaultProtocolClient('itms') // iTunes HTTP Protocol + app.setAsDefaultProtocolClient('itmss') // iTunes HTTPS Protocol + app.setAsDefaultProtocolClient('musics') // macOS Client Protocol + app.setAsDefaultProtocolClient('music') // macOS Client Protocol + } + + app.on('open-url', (event, url) => { + event.preventDefault() + if (url.includes('ame://') || url.includes('itms://') || url.includes('itmss://') || url.includes('musics://') || url.includes('music://')) { + app.ame.handler.LinkHandler(url) + } + }) + + // Running the Application on Login + if (app.cfg.get('window.appStartupBehavior')) { + app.setLoginItemSettings({ + openAtLogin: true, + args: [ + '--process-start-args', `${app.cfg.get('window.appStartupBehavior') === 'hidden' ? "--hidden" : (app.cfg.get('window.appStartupBehavior') === 'minimized' ? "--minimized" : "")}` + ] + }) + } + + // Set Max Listener + require('events').EventEmitter.defaultMaxListeners = Infinity; + }, + + LoggingInit: () => { + app.log = require("electron-log"); + + if (app.commandLine.hasSwitch('verbose')) { + app.verboseLaunched = true + } + + app.log.transports.file.resolvePath = (vars) => { + return join(app.getPath('userData'), 'logs', vars.fileName); + } + + Object.assign(console, app.log.functions); + + console.verbose = () => { + }; + + if (app.cfg.get('advanced.verboseLogging') || app.verboseLaunched) { + console.verbose = app.log.debug + } else { + console.verbose = function (_data) { + return false + }; + } + }, + + ThemeInstallation: () => { + const themesPath = join(app.getPath('userData'), "themes"); + + // Check if the themes folder exists and check permissions + if (existsSync(join(themesPath, 'README.md'))) { + console.verbose('[ThemeInstallation] Themes Directory Exists. Running Permission Check.') + app.ame.utils.permissionsCheck(themesPath, 'README.md') + } else { + app.ame.utils.updateThemes().catch(err => console.error(err)) + } + + // Save all the file names to array and log it + if (existsSync(themesPath)) { + console.log(`[InitializeTheme] Files found in Themes Directory: [${readdirSync(themesPath).join(', ')}]`) + } + + // Set the default theme + if (app.cfg.get('advanced.forceApplicationMode')) { + nativeTheme.themeSource = app.cfg.get('advanced.forceApplicationMode') + } + }, + + PluginInstallation: () => { + if (!existsSync(resolve(app.getPath("userData"), "plugins"))) { + return; + } + + // Check if the plugins folder exists and check permissions + app.pluginsEnabled = true; + console.log("[PluginInstallation][existsSync] Plugins folder exists!"); + app.ame.utils.permissionsCheck(app.userPluginsPath, '/'); + app.ame.utils.fetchPluginsListing(); + + // Save all the file names to array and log it + console.log(`[PluginInstallation] Files found in Plugins Directory: [${readdirSync(resolve(app.getPath("userData"), "plugins")).join(', ')}]`); + }, + + AppReady: () => { + console.verbose('[ApplicationReady] Started.'); + app.pluginsEnabled = false; + + // Run the Functions + init.ThemeInstallation() + init.PluginInstallation() + init.TrayInit() + + app.ame.mpris.connect(); // M.P.R.I.S + app.ame.lastfm.authenticate(); // LastFM + app.ame.discord.connect(app.cfg.get('general.discordRPC') === 'ame-title' ? '749317071145533440' : '886578863147192350'); // Discord + + app.isAuthorized = false; + app.isMiniplayerActive = false; + app.injectedCSS = {} + app.media = {status: false, playParams: {id: 'no-id-found'}}; + + /** wsapi */ + // app.ame.wsapi.inAppUI() + /** wsapi */ + }, + + TrayInit: () => { + console.verbose('[InitializeTray] Started.'); + + const winTray = nativeImage.createFromPath(join(__dirname, `../icons/icon.ico`)).resize({ + width: 32, + height: 32 + }) + const macTray = nativeImage.createFromPath(join(__dirname, `../icons/icon.png`)).resize({ + width: 20, + height: 20 + }) + const linuxTray = nativeImage.createFromPath(join(__dirname, `../icons/icon.png`)).resize({ + width: 32, + height: 32 + }) + let trayIcon; + if (process.platform === "win32") { + trayIcon = winTray + } else if (process.platform === "linux") { + trayIcon = linuxTray + } else if (process.platform === "darwin") { + trayIcon = macTray + } + + app.tray = new Tray(trayIcon) + app.tray.setToolTip(app.getName()); + app.ame.win.SetContextMenu(true); + + app.tray.on('double-click', () => { + if (typeof app.win.show === 'function') { + if (app.win.isVisible()) { + app.win.focus() + } else { + app.win.show() + } + } + }) + } +} + +module.exports = init \ No newline at end of file diff --git a/resources/functions/load.js b/resources/functions/load.js new file mode 100644 index 00000000..83c4678b --- /dev/null +++ b/resources/functions/load.js @@ -0,0 +1,238 @@ +const {join, resolve} = require("path"), + {app, ipcMain, systemPreferences} = require("electron"), + {readFile, constants, chmodSync, existsSync, watch} = require("fs"), + {initAnalytics} = require('./utils'); +initAnalytics(); + +module.exports = { + + LoadCSS: function (path, theme, important) { + const fileName = path + if (theme) { + path = join(app.userThemesPath, path.toLowerCase()); + } else { + path = join(join(__dirname, '../css/'), path) + } + + // Check that the file exists + if (!existsSync(path)) { + console.warn(`[LoadCSS] ${path} not found.`) + return + } + + // Remove previous inject (If there is one) + if (app.injectedCSS[path]) { + app.win.webContents.removeInsertedCSS(app.injectedCSS[fileName]).then(r => { if (r) console.error(r); }); + } + + // Get the CSS to inject + readFile(path, "utf-8", function (error, data) { + if (error) { + console.error(`[LoadCSS] Error while injecting: '${path}' - ${error}`) + try { + chmodSync(path, constants.S_IRUSR | constants.S_IWUSR); + } catch (err) { + console.error(`[LoadCSS] ${err}`) + } + } else { + let formattedData = data.replace(/\s{2,10}/g, ' ').trim(); + app.win.webContents.insertCSS(formattedData, {cssOrigin: (important ? 'user' : 'author')}).then((key) => { + console.verbose(`[${theme ? 'LoadTheme' : 'LoadCSS'}] '${fileName}' successfully injected.`) + app.injectedCSS[fileName] = key + }); + } + }); + }, + + LoadJS: function (path, formatting = true) { + const fileName = path; + path = join(join(__dirname, '../js/'), path) + + readFile(path, "utf-8", function (error, data) { + if (!error) { + try { + let formattedData = data + if (formatting) { + formattedData = data.replace(/\s{2,10}/g, ' ').trim(); + } + app.win.webContents.executeJavaScript(formattedData).then(() => { + console.verbose(`[LoadJSFile] '${fileName}' successfully injected.`) + }); + } catch (err) { + console.error(`[LoadJSFile] Error while injecting: '${fileName}' - Error: ${err}`) + } + } else { + console.error(`[LoadJSFile] Error while reading: '${fileName}' - Error: ${error}`) + } + }); + }, + + LoadWebsite: function (win) { + if (!win) return; + + app.storefront = app.cfg.get('general.storefront'); + const urlBase = app.cfg.get('advanced.useBetaSite') ? 'https://beta.music.apple.com' : 'https://music.apple.com/' + app.cfg.get('general.storefront'), + urlFallback = `https://music.apple.com/`; + + ipcMain.once('userAuthorized', (e, args) => { + app.isAuthorized = true + console.log(`[LoadWebsite] User Authenticated. Setting page to: ${args}`) + win.webContents.clearHistory() + }) + + win.loadURL(urlBase).then(() => { + app.ame.load.LoadJS('checkAuth.js') + }).catch((err) => { + win.loadURL(urlFallback).then(() => console.error(`[LoadWebsite] '${urlBase}' was unavailable, falling back to '${urlFallback}' | ${err}`)) + }) + }, + + LoadFiles: function () { + app.ame.load.LoadJS('settingsPage.js'); + if (app.cfg.get('visual.removeAppleLogo')) { + app.win.webContents.insertCSS(` + @media only screen and (max-width: 483px) { + .web-navigation__nav-list { + margin-top: 50px; + } + } + } + `).catch((e) => console.error(e)); + } + + if (app.cfg.get('visual.useOperatingSystemAccent') && (process.platform === "win32" || process.platform === "darwin")) { + if (systemPreferences.getAccentColor()) { + const accent = '#' + systemPreferences.getAccentColor().slice(0, -2) + app.win.webContents.insertCSS(` + :root { + --keyColor: ${accent} !important; + --systemAccentBG: ${accent} !important; + --systemAccentBG-pressed: rgba(${app.ame.utils.hexToRgb(accent).r}, ${app.ame.utils.hexToRgb(accent).g}, ${app.ame.utils.hexToRgb(accent).b}, 0.75) !important; + --keyColor-rgb: ${app.ame.utils.hexToRgb(accent).r} ${app.ame.utils.hexToRgb(accent).g} ${app.ame.utils.hexToRgb(accent).b} !important; + }`).then((key) => { + app.injectedCSS['useOperatingSystemAccent'] = key + }) + } + } else { + app.ame.win.removeInsertedCSS('useOperatingSystemAccent') + } + + /* Load Window Frame */ + if (app.cfg.get('visual.frameType') === 'mac') { + app.ame.load.LoadJS('frame_macOS.js') + } else if ((app.cfg.get('visual.frameType') === 'mac-right')) { + app.ame.load.LoadJS('frame_Windows.js') + } else if (process.platform === 'darwin' && !app.cfg.get('visual.frameType')) { + app.ame.load.LoadJS('frame_macOS.js') + } else if (process.platform === 'win32' && !app.cfg.get('visual.frameType')) { + app.ame.load.LoadJS('frame_Windows.js') + if (app.win.isMaximized()) { + app.win.webContents.executeJavaScript(`if (document.querySelector("#maximize")) { document.querySelector("#maximize").classList.add("maxed"); }`).catch((e) => console.error(e)); + } + } + + const BackButtonChecks = (url) => { + if (!app.win.webContents.canGoBack()) return false + const backButtonBlacklist = [`*music.apple.com/*/listen-now*`, `*music.apple.com/*/browse*`, `*music.apple.com/*/radio*`, `*music.apple.com/*/search*`, `*music.apple.com/library/recently-added?l=*`, `*music.apple.com/library/albums?l=*`, `*music.apple.com/library/songs?l=*`, `*music.apple.com/library/made-for-you?l=*`, `*music.apple.com/library/recently-added`, `*music.apple.com/library/albums`, `*music.apple.com/library/made-for-you`, `*music.apple.com/library/songs*`, `*music.apple.com/library/artists/*`, `*music.apple.com/library/playlist/*`]; + let blacklistPassed = true + backButtonBlacklist.forEach((item) => { + if (!blacklistPassed) return; + if (app.ame.utils.matchRuleShort(url, item) || url === item) { + blacklistPassed = false + } + }); + return blacklistPassed + } + + /* Load Back Button */ + if (BackButtonChecks(app.win.webContents.getURL())) { + app.ame.load.LoadJS('backButton.js') + app.win.webContents.executeJavaScript(`document.body.setAttribute('back-button', 1)`) + } else { /* Removes the button if the check failed. */ + app.win.webContents.executeJavaScript(`if (document.querySelector('#backButtonBar')) { document.getElementById('backButtonBar').remove() };`).catch((e) => console.error(e)); + app.win.webContents.executeJavaScript(`document.body.removeAttribute('back-button')`) + } + + /* Load the Startup JavaScript Function */ + app.win.webContents.executeJavaScript('if (AMJavaScript) { AMJavaScript.LoadCustom(); }').catch((e) => console.error(e)); + }, + + LoadOneTimeFiles: function () { + // Inject the custom stylesheet + app.ame.load.LoadCSS('custom-stylesheet.css') + app.ame.load.LoadCSS('ameframework.css') + + // Inject Plugin Interaction + if (app.pluginsEnabled) { + app.ame.load.LoadJS('pluginSystem.js', false) + } + // Load this first so it doesn't stuck + app.ame.load.LoadJS('OpusMediaRecorder.umd.js') + app.ame.load.LoadJS('encoderWorker.umd.js') + + + // Lyrics + app.ame.load.LoadJS('lyrics.js') + + // Vue Test + app.ame.load.LoadJS('vue.js') + app.ame.load.LoadJS('utils.js', false) + app.ame.load.LoadJS('tests.js', false) + // wsapi + app.ame.load.LoadJS('WSAPI_Interop.js', false) + // wsapi + + // Bulk JavaScript Functions + app.ame.load.LoadJS('custom.js') + + // Audio Manuipulation Stuff + + app.ame.load.LoadJS('eq.js') + + + // Window Frames + if (app.cfg.get('visual.frameType') === 'mac') { + app.ame.load.LoadCSS('frame_macOS_emulation.css') + } else if (app.cfg.get('visual.frameType') === 'mac-right') { + app.ame.load.LoadCSS('frame_macOS_emulation_right.css') + } else if (process.platform === 'win32' && !app.cfg.get('visual.frameType')) { + app.ame.load.LoadCSS('frame_Windows.css') + } + + // Set the settings variables if needed + if (app.cfg.get('visual.frameType') === 'mac' || app.cfg.get('visual.frameType') === 'mac-right') { + app.cfg.set('visual.removeUpsell', true); + app.cfg.set('visual.removeAppleLogo', true); + } + + // Streamer Mode + if (app.cfg.get('visual.streamerMode')) { + app.ame.load.LoadCSS('streamerMode.css') + } + + /* Remove the Scrollbar */ + if (app.cfg.get('visual.removeScrollbars')) { + app.win.webContents.insertCSS('::-webkit-scrollbar { display: none; }').then() + } else { + app.ame.load.LoadCSS('macosScrollbar.css') + } + + /* Inject the MusicKitInterop file */ + app.win.webContents.executeJavaScript('MusicKitInterop.init()').catch((e) => console.error(e)); + + /* Watches for changes to a theme */ + if (app.watcher) { + app.watcher.close(); + console.verbose('[Watcher] Removed old watcher.') + } + + if (existsSync(resolve(app.getPath('userData'), 'themes', `${app.cfg.get('visual.theme')}.css`)) && app.cfg.get('visual.theme') !== "default" && app.cfg.get('visual.theme')) { + app.watcher = watch(resolve(app.getPath('userData'), 'themes', `${app.cfg.get('visual.theme')}.css`), (event, fileName) => { + if (event === "change" && fileName === `${app.cfg.get('visual.theme')}.css`) { + app.win.webContents.executeJavaScript(`AMStyling.loadTheme("${app.cfg.get('visual.theme')}", true);`).catch((err) => console.error(err)); + } + }); + console.verbose(`[Watcher] Watching for changes: 'themes/${app.cfg.get('visual.theme')}.css'`) + } + } +} \ No newline at end of file diff --git a/resources/functions/media/discordrpc.js b/resources/functions/media/discordrpc.js new file mode 100644 index 00000000..9bf8b426 --- /dev/null +++ b/resources/functions/media/discordrpc.js @@ -0,0 +1,121 @@ +const {app} = require('electron'), + DiscordRPC = require('discord-rpc'), + {initAnalytics} = require('../utils'); +initAnalytics(); + +module.exports = { + connect: function (clientId) { + app.discord = {isConnected: false}; + if (!app.cfg.get('general.discordRPC')) return; + + DiscordRPC.register(clientId) // Apparently needed for ask to join, join, spectate etc. + const client = new DiscordRPC.Client({ transport: "ipc" }); + app.discord = Object.assign(client,{error: false, activityCache: null, isConnected: false}); + + // Login to Discord + app.discord.login({ clientId }) + .then(() => { + app.discord.isConnected = true; + }) + .catch((e) => console.error(`[DiscordRPC][connect] ${e}`)); + + app.discord.on('ready', () => { + console.log(`[DiscordRPC][connect] Successfully Connected to Discord. Authed for user: ${client.user.username} (${client.user.id})`); + + if (app.discord.activityCache) { + client.setActivity(app.discord.activityCache).catch((e) => console.error(e)); + app.discord.activityCache = null; + } + }) + + // Handles Errors + app.discord.on('error', err => { + console.error(`[DiscordRPC] ${err}`); + this.disconnect() + app.discord.isConnected = false; + }); + }, + + disconnect: function () { + if (!app.cfg.get('general.discordRPC') || !app.discord.isConnected) return; + + try { + app.discord.destroy().then(() => { + app.discord.isConnected = false; + console.verbose('[DiscordRPC][disconnect] Disconnected from discord.') + }).catch((e) => console.error(`[DiscordRPC][disconnect] ${e}`)); + } catch (err) { + console.error(err) + } + }, + + updateActivity: function (attributes) { + if (!app.cfg.get('general.discordRPC') || app.cfg.get('general.incognitoMode')) return; + + if (!app.discord.isConnected) { + this.connect() + } + + if (!app.discord.isConnected) return; + + console.verbose('[DiscordRPC][updateActivity] Updating Discord Activity.') + + const listenURL = `https://applemusicelectron.com/p?id=${attributes.playParams.id}` + + let ActivityObject = { + details: attributes.name, + state: `by ${attributes.artistName}`, + startTimestamp: attributes.startTime, + endTimestamp: attributes.endTime, + largeImageKey: ((app.cfg.get('general.discordRPC') === 'am-title') ? 'apple' : 'logo'), + largeImageText: attributes.albumName, + smallImageKey: (attributes.status ? 'play' : 'pause'), + smallImageText: (attributes.status ? 'Playing': 'Paused'), + instance: true, + buttons: [ + {label: "Listen on AME", url: listenURL}, + ] + }; + console.verbose(`[LinkHandler] Listening URL has been set to: ${listenURL}`); + + if (app.cfg.get('general.discordClearActivityOnPause')) { + delete ActivityObject.smallImageKey + delete ActivityObject.smallImageText + } + + // Check all the values work + if (!((new Date(attributes.endTime)).getTime() > 0)) { + delete ActivityObject.startTimestamp + delete ActivityObject.endTimestamp + } + if (!attributes.artistName) { + delete ActivityObject.state + } + if (!ActivityObject.largeImageText || ActivityObject.largeImageText.length < 2) { + delete ActivityObject.largeImageText + } + + // Clear if if needed + if (!attributes.status) { + if (app.cfg.get('general.discordClearActivityOnPause')) { + app.discord.clearActivity().catch((e) => console.error(`[DiscordRPC][clearActivity] ${e}`)); + ActivityObject = null + } else { + delete ActivityObject.startTimestamp + delete ActivityObject.endTimestamp + ActivityObject.smallImageKey = 'pause' + ActivityObject.smallImageText = 'Paused' + } + } + + if (ActivityObject) { + try { + console.verbose(`[DiscordRPC][setActivity] Setting activity to ${JSON.stringify(ActivityObject)}`); + app.discord.setActivity(ActivityObject) + } catch (err) { + console.error(`[DiscordRPC][setActivity] ${err}`) + } + + } + }, +} \ No newline at end of file diff --git a/resources/functions/media/lastfm.js b/resources/functions/media/lastfm.js new file mode 100644 index 00000000..993ca75d --- /dev/null +++ b/resources/functions/media/lastfm.js @@ -0,0 +1,155 @@ +const {app, Notification} = require('electron'), + fs = require('fs'), + {resolve} = require('path'), + sessionPath = resolve(app.getPath('userData'), 'session.json'), + apiCredentials = require('../../lfmApiCredentials.json'), + LastfmAPI = require('lastfmapi'), + {initAnalytics} = require('../utils'); +initAnalytics(); + +const lfm = { + authenticateFromFile: function () { + let sessionData = require(sessionPath) + console.log("[LastFM][authenticateFromFile] Logging in with Session Info.") + app.lastfm.setSessionCredentials(sessionData.name, sessionData.key) + console.log("[LastFM][authenticateFromFile] Logged in.") + }, + + authenticate: function () { + if (app.cfg.get('tokens.lastfm')) { + app.cfg.set('general.lastfm', true); + } + + if (!app.cfg.get('general.lastfm') || !app.cfg.get('tokens.lastfm')) { + app.cfg.set('general.lastfm', false); + return + } + + const lfmAPI = new LastfmAPI({ + 'api_key': apiCredentials.key, + 'secret': apiCredentials.secret + }); + + app.lastfm = Object.assign(lfmAPI, {cachedAttributes: false, cachedNowPlayingAttributes: false}); + + fs.stat(sessionPath, function (err) { + if (err) { + console.error("[LastFM][Session] Session file couldn't be opened or doesn't exist,", err) + console.log("[LastFM][Auth] Beginning authentication from configuration") + app.lastfm.authenticate(app.cfg.get('tokens.lastfm'), function (err, session) { + if (err) { + throw err; + } + console.log("[LastFM] Successfully obtained LastFM session info,", session); // {"name": "LASTFM_USERNAME", "key": "THE_USER_SESSION_KEY"} + console.log("[LastFM] Saving session info to disk.") + let tempData = JSON.stringify(session) + fs.writeFile(sessionPath, tempData, (err) => { + if (err) + console.log("[LastFM][fs]", err) + else { + console.log("[LastFM][fs] File was written successfully.") + lfm.authenticateFromFile() + new Notification({ + title: app.getName(), + body: "Successfully logged into LastFM using Authentication Key." + }).show() + } + }) + }); + } else { + lfm.authenticateFromFile() + } + }) + }, + + scrobbleSong: async function (attributes) { + await new Promise(resolve => setTimeout(resolve, app.cfg.get('general.lastfmScrobbleDelay') * 1000)); + const currentAttributes = app.media; + + if (!app.lastfm || app.lastfm.cachedAttributes === attributes || app.cfg.get('general.incognitoMode')) { + return + } + + if (app.lastfm.cachedAttributes) { + if (app.lastfm.cachedAttributes.playParams.id === attributes.playParams.id) return; + } + + if (currentAttributes.status && currentAttributes === attributes) { + if (fs.existsSync(sessionPath)) { + // Scrobble playing song. + if (attributes.status === true) { + app.lastfm.track.scrobble({ + 'artist': lfm.filterArtistName(attributes.artistName), + 'track': attributes.name, + 'album': attributes.albumName, + 'albumArtist': this.filterArtistName(attributes.artistName), + 'timestamp': new Date().getTime() / 1000 + }, function (err, scrobbled) { + if (err) { + return console.error('[LastFM] An error occurred while scrobbling', err); + } + + console.verbose('[LastFM] Successfully scrobbled: ', scrobbled); + }); + app.lastfm.cachedAttributes = attributes + } + } else { + this.authenticate(); + } + } else { + return console.verbose('[LastFM] Did not add ', attributes.name , '-' , lfm.filterArtistName(attributes.artistName), 'because now playing a other song.'); + } + }, + + filterArtistName: function (artist) { + if (!app.cfg.get('general.lastfmRemoveFeaturingArtists')) return artist; + + artist = artist.split(' '); + if (artist.includes('&')) { + artist.length = artist.indexOf('&'); + } + if (artist.includes('and')) { + artist.length = artist.indexOf('and'); + } + artist = artist.join(' '); + if (artist.includes(',')) { + artist = artist.split(',') + artist = artist[0] + } + return artist.charAt(0).toUpperCase() + artist.slice(1); + }, + + updateNowPlayingSong: function (attributes) { + if (!app.lastfm ||app.lastfm.cachedNowPlayingAttributes === attributes || app.cfg.get('general.incognitoMode') || !app.cfg.get('general.lastfmNowPlaying')) { + return + } + + if (app.lastfm.cachedNowPlayingAttributes) { + if (app.lastfm.cachedNowPlayingAttributes.playParams.id === attributes.playParams.id) return; + } + + if (fs.existsSync(sessionPath)) { + // update Now Playing + if (attributes.status === true) { + app.lastfm.track.updateNowPlaying({ + 'artist': lfm.filterArtistName(attributes.artistName), + 'track': attributes.name, + 'album': attributes.albumName, + 'albumArtist': this.filterArtistName(attributes.artistName) + }, function (err, nowPlaying) { + if (err) { + return console.error('[LastFM] An error occurred while updating nowPlayingSong', err); + } + + console.verbose('[LastFM] Successfully updated nowPlayingSong', nowPlaying); + }); + app.lastfm.cachedNowPlayingAttributes = attributes + } + + } else { + this.authenticate() + } + } +} + +module.exports = lfm; \ No newline at end of file diff --git a/resources/functions/media/mpris.js b/resources/functions/media/mpris.js new file mode 100644 index 00000000..3c57e2fb --- /dev/null +++ b/resources/functions/media/mpris.js @@ -0,0 +1,119 @@ +const {app} = require('electron'), + Player = require('mpris-service'), + {initAnalytics} = require('../utils'); +initAnalytics(); + +// Remember to use playerctl when debugging this. +// I'm just putting this here as I keep forgetting the command. + +module.exports = { + connect: function () { + if (process.platform !== "linux") { + app.mpris = {active: false} + return; + } + console.log('[MPRIS][connect] Initializing Connection.') + + try { + app.mpris = Player({ + name: 'AppleMusic', + identity: 'Apple Music', + supportedUriSchemes: [], + supportedMimeTypes: [], + supportedInterfaces: ['player'] + }); + app.mpris = Object.assign(app.mpris, { active: false, canQuit: true, canControl: true, canPause: true, canPlay: true, canGoNext: true }) + } catch (err) { + app.mpris.active = false + console.error(`[MPRIS][connect] ${err}`) + return + } + + let pos_atr = {durationInMillis: 0}; + app.mpris.getPosition = function () { + const durationInMicro = pos_atr.durationInMillis * 1000; + const percentage = parseFloat(0) || 0; + return durationInMicro * percentage; + } + + app.mpris.active = true + + this.clearActivity() + this.stateHandler() + }, + + stateHandler: function () { + app.mpris.on('playpause', async () => { + app.win.webContents.executeJavaScript('MusicKitInterop.pausePlay()').catch(err => console.error(err)) + }); + + app.mpris.on('play', async () => { + app.win.webContents.executeJavaScript('MusicKitInterop.pausePlay()').catch(err => console.error(err)) + }); + + app.mpris.on('pause', async () => { + app.win.webContents.executeJavaScript('MusicKitInterop.pausePlay()').catch(err => console.error(err)) + }); + + app.mpris.on('next', async () => { + app.win.webContents.executeJavaScript('MusicKitInterop.nextTrack()').catch(err => console.error(err)) + }); + + app.mpris.on('previous', async () => { + app.win.webContents.executeJavaScript('MusicKitInterop.previousTrack()').catch(err => console.error(err)) + }); + }, + + updateActivity: function (attributes) { + if (!app.mpris.active) return; + + console.verbose('[MPRIS][updateActivity] Updating Song Activity.') + + const MetaData = { + 'mpris:trackid': app.mpris.objectPath(`track/${attributes.playParams.id.replace(/[.]+/g, "")}`), + 'mpris:length': attributes.durationInMillis * 1000, // In microseconds + 'mpris:artUrl': (attributes.artwork.url.replace('/{w}x{h}bb', '/512x512bb')).replace('/2000x2000bb', '/35x35bb'), + 'xesam:title': `${attributes.name}`, + 'xesam:album': `${attributes.albumName}`, + 'xesam:artist': [`${attributes.artistName}`,], + 'xesam:genre': attributes.genreNames + } + + if (app.mpris.metadata["mpris:trackid"] === MetaData["mpris:trackid"]) { + return + } + + app.mpris.metadata = MetaData + }, + + updateState: function (attributes) { + if (!app.mpris.active) return; + + console.verbose('[MPRIS][updateState] Updating Song Playback State.') + + function setPlaybackIfNeeded(status) { + if (app.mpris.playbackStatus === status) { + return + } + app.mpris.playbackStatus = status; + } + + switch (attributes.status) { + case true: // Playing + setPlaybackIfNeeded('Playing'); + break; + case false: // Paused + setPlaybackIfNeeded('Paused'); + break; + default: // Stopped + setPlaybackIfNeeded('Stopped'); + break; + } + }, + + clearActivity: function () { + if (!app.mpris.active) return; + app.mpris.metadata = {'mpris:trackid': '/org/mpris/MediaPlayer2/TrackList/NoTrack'} + app.mpris.playbackStatus = 'Stopped'; + }, +} \ No newline at end of file diff --git a/resources/functions/splash.js b/resources/functions/splash.js new file mode 100644 index 00000000..d6e482f1 --- /dev/null +++ b/resources/functions/splash.js @@ -0,0 +1,30 @@ +const { + BrowserWindow +} = require('electron'); + +const SplashScreen = { + win: null, + show: function () { + this.win = new BrowserWindow({ + width: 300, + height: 300, + resizable: false, + show: true, + center: true, + transparent: true, + frame: false, + alwaysOnTop: true, + // skipTaskbar: true, + webPreferences: { + nodeIntegration: true + } + }) + this.win.show() + this.win.loadFile('./resources/splash/index.html') + this.win.on("closed", () => { + this.win = null + }) + } +} + +module.exports = SplashScreen \ No newline at end of file diff --git a/resources/functions/utils.js b/resources/functions/utils.js new file mode 100644 index 00000000..b73d7fe7 --- /dev/null +++ b/resources/functions/utils.js @@ -0,0 +1,395 @@ +const {app, nativeImage, nativeTheme, Notification, dialog} = require("electron"), + {existsSync, readFileSync, readdirSync, constants, access, writeFileSync, copyFileSync} = require("fs"), + {readdir, mkdir} = require("fs/promises"), + {join, resolve} = require("path"), + {autoUpdater} = require("electron-updater"), + os = require("os"), + rimraf = require("rimraf"), + chmod = require("chmodr"), + clone = require("git-clone/promise"), + trayIconDir = (nativeTheme.shouldUseDarkColors ? join(__dirname, `../icons/media/light/`) : join(__dirname, `../icons/media/dark/`)), + ElectronSentry = require("@sentry/electron"); + +const Utils = { + + /* hexToRgb - Converts hex codes to rgb */ + hexToRgb: (hex) => { + const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); + return result ? { + r: parseInt(result[1], 16), + g: parseInt(result[2], 16), + b: parseInt(result[3], 16) + } : null; + }, + + /* matchRuleShort - Used for wildcards */ + matchRuleShort: (str, rule) => { + var escapeRegex = (str) => str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1"); + return new RegExp("^" + rule.split("*").map(escapeRegex).join(".*") + "$").test(str); + }, + + /* isVibrancySupported - Checks if the operating system support electron-acrylic-window (Windows 10 or greater) */ + isVibrancySupported: () => { + return (process.platform === 'win32' && parseInt(os.release().split('.')[0]) >= 10) + }, + + /* isAcrylicSupported - Checks if the operating system supports the acrylic transparency affect (Windows RS3 (Redstone 3) 1709 or Greater) */ + isAcrylicSupported: () => { + return (process.platform === 'win32' && parseInt(os.release().replace(/\./g, "").replace(',', '.')) >= 10016299) + }, + + /* fetchThemeMeta - Fetches the meta data associated to a theme */ + fetchThemeMeta: (fileName) => { + const filePath = resolve(app.getPath("userData"), "themes", `${fileName}.css`); + + let fileMeta = { + name: null, + author: null, + description: null, + transparency: {dark: null, light: null}, + options: [] + }; + + if (!existsSync(filePath)) return fileMeta; + const file = readFileSync(filePath, "utf8"); + if (!file) return; + + file.split(/\r?\n/).forEach((line) => { + if (line.includes("@name")) { + fileMeta.name = line.split("@name ")[1].trim(); + } + + if (line.includes("@author")) { + fileMeta.author = line.split("@author ")[1].trim(); + } + + if (line.includes("@description")) { + fileMeta.description = line.split("@description ")[1] + } + + if (line.includes("@option")) { + var themeOption = line.split("@option ")[1].trim().split("|") + fileMeta.options.push({ + key: themeOption[0], + name: themeOption[1], + defaultValue: themeOption[2] + }) + } + + if (line.includes("--lightTransparency")) { + fileMeta.transparency.light = line.split("--lightTransparency: ")[1].trim().split(' ')[0]; + } + + if (line.includes("--darkTransparency")) { + fileMeta.transparency.dark = line.split("--darkTransparency: ")[1].trim().split(' ')[0]; + } + + if (fileMeta.transparency.dark && fileMeta.transparency.light) { + fileMeta.transparency = nativeTheme.shouldUseDarkColors ? fileMeta.transparency.dark : fileMeta.transparency.light + } + + if (!fileMeta.transparency.dark || !fileMeta.transparency.light) { + if (line.includes("--transparency")) { + fileMeta.transparency = line.split("--transparency: ")[1].split(' ')[0]; + } + } + }); + + if (typeof fileMeta.transparency == "object") { + if (!fileMeta.transparency.dark || !fileMeta.transparency.light) { + fileMeta.transparency = false; + } + } + + console.verbose(`[fetchThemeMeta] Returning ${JSON.stringify(fileMeta)}`); + return fileMeta + }, + + /* fetchTransparencyOptions - Fetches the transparency options */ + fetchTransparencyOptions: () => { + if (process.platform === "darwin" && (!app.cfg.get('visual.transparencyEffect') || !Utils.isVibrancySupported())) { + app.transparency = true; + return "fullscreen-ui" + } else if (!app.cfg.get('visual.transparencyEffect') || !Utils.isVibrancySupported()) { + console.verbose(`[fetchTransparencyOptions] Vibrancy not created. Required options not met. (transparencyEffect: ${app.cfg.get('visual.transparencyEffect')} | isVibrancySupported: ${Utils.isVibrancySupported()})`); + app.transparency = false; + return false + } else if (process.platform === "win32" && app.cfg.get('visual.transparencyEffect') === "mica") { + return false + } + + console.log('[fetchTransparencyOptions] Fetching Transparency Options') + let transparencyOptions = { + theme: null, + effect: app.cfg.get('visual.transparencyEffect'), + debug: app.cfg.get('advanced.verboseLogging'), + } + + //------------------------------------------ + // Disable on blur for acrylic + //------------------------------------------ + if (app.cfg.get('visual.transparencyEffect') === 'acrylic') { + transparencyOptions.disableOnBlur = app.cfg.get('visual.transparencyDisableBlur'); + } + + //------------------------------------------ + // Set the transparency theme + //------------------------------------------ + if (app.cfg.get('visual.transparencyTheme') === 'appearance-based') { + if (app.cfg.get('visual.theme') && app.cfg.get('visual.theme') !== "default") { + transparencyOptions.theme = Utils.fetchThemeMeta(app.cfg.get('visual.theme')).transparency; /* Fetch the Transparency from the Themes Folder */ + } else if ((!app.cfg.get('visual.theme') || app.cfg.get('visual.theme') === "default") && app.cfg.get('visual.transparencyEffect') === 'acrylic') { + transparencyOptions.theme = (nativeTheme.shouldUseDarkColors ? '#3C3C4307' : '#EBEBF507') /* Default Theme when Using Acrylic */ + } else { // Fallback + transparencyOptions.theme = (nativeTheme.shouldUseDarkColors ? 'dark' : 'light') + } + } else { + transparencyOptions.theme = app.cfg.get('visual.transparencyTheme'); + } + + //------------------------------------------ + // Set the refresh rate + //------------------------------------------ + if (app.cfg.get('visual.transparencyMaximumRefreshRate')) { + transparencyOptions.useCustomWindowRefreshMethod = true + transparencyOptions.maximumRefreshRate = app.cfg.get('visual.transparencyMaximumRefreshRate') + } + + app.transparency = true + console.log(`[fetchTransparencyOptions] Returning: ${JSON.stringify(transparencyOptions)}`) + return transparencyOptions + }, + + /* fetchThemesListing - Fetches the themes directory listing (Lists .css files) */ + fetchThemesListing: () => { + if (!existsSync(resolve(app.getPath("userData"), "themes"))) return; + + let themesFileNames = [], themesListing = {}; + + + readdirSync(resolve(app.getPath("userData"), "themes")).forEach((value) => { + if (value.split('.').pop() === 'css') { + themesFileNames.push(value.split('.').shift()) + } + }); + + // Get the Info + themesFileNames.forEach((themeFileName) => { + const themeData = Utils.fetchThemeMeta(themeFileName); + if (themeData && themeData.name && themeData.description && themeData.author) { + themesListing[themeFileName] = themeData; + } + }) + + return themesListing + }, + + /* fetchPluginsListing - Fetches the plugins directory listing (Lists .js files) */ + fetchPluginsListing: () => { + if (!existsSync(resolve(app.getPath("userData"), "plugins"))) return; + + let pluginsFileNames = [], pluginsListing = {}; + + + readdirSync(resolve(app.getPath("userData"), "plugins")).forEach((value) => { + if (value.split('.').pop() === 'js') { + pluginsFileNames.push(value.split('.').shift()) + } + }); + + console.log(pluginsFileNames) + + return pluginsFileNames + }, + + /* fetchOperatingSystem - Fetches the operating system name */ + fetchOperatingSystem: () => { + if (process.platform === "win32") { + const release = parseInt(os.release().replaceAll('.', '')) + if (release >= 10022000) { + return 'Windows 11' + } else if (release < 10022000 && release >= 10010240) { + return 'Windows 10' + } + } + }, + + /* updateThemes - Purges the themes directory and clones a fresh copy of the themes */ + updateThemes: async () => { + if (app.watcher) { + app.watcher.close() + } + + const tmpDir = join(os.tmpdir(), "ame-themes") + const themesDir = join(app.getPath("userData"), "themes") + + if (existsSync(themesDir)) { + if (existsSync(tmpDir)) { + rimraf(tmpDir, [], async (err) => { + if (err) return err + await clone('https://github.com/Apple-Music-Electron/Apple-Music-Electron-Themes', tmpDir, [], (err) => console.log(err)) + }) + } else { + await mkdir(tmpDir, {recursive: true}) + await clone('https://github.com/Apple-Music-Electron/Apple-Music-Electron-Themes', tmpDir, [], (err) => console.log(err)) + } + + // Base Line Directory Comparison + const updateList = await readdir(tmpDir); + const foundChanges = {}; + + for (const file of updateList) { + if (file.split('.').pop() === 'css' && file !== "Template.css") { // Reduces listing compare down to css files + console.verbose(`[compareDirectories] Comparing ${file}`) + + if (!existsSync(join(themesDir, file))) { + copyFileSync(join(tmpDir, file), join(themesDir, file)) + foundChanges[file] = 'added' + } else { + const updateFile = readFileSync(join(tmpDir, file)); + const origFile = readFileSync(join(themesDir, file)); + + if (origFile.toString() !== updateFile.toString()) { + writeFileSync(join(themesDir, file), updateFile) + foundChanges[file] = 'updated' + } + } + } + } + + return foundChanges + } else { + await mkdir(tmpDir, {recursive: true}) + await clone('https://github.com/Apple-Music-Electron/Apple-Music-Electron-Themes', themesDir, [], (err) => console.log(err)) + return {'initial': true} + } + + + }, + + /* permissionsCheck - Checks of the file can be read and written to, if it cannot be chmod -r is run on the directory */ + permissionsCheck: (folder, file) => { + console.verbose(`[permissionsCheck] Running check on ${join(folder, file)}`) + access(join(folder, file), constants.R_OK | constants.W_OK, (err) => { + if (err) { // File cannot be read after cloning + console.error(`[permissionsCheck][access] ${err}`) + chmod(folder, 0o777, (err) => { + if (err) { + console.error(`[permissionsCheck][chmod] ${err} - Theme set to default to prevent application launch halt.`); + } + }); + } else { + console.verbose('[permissionsCheck] Check passed.') + } + }) + }, + + /* initAnalytics - Sentry Analytics */ + initAnalytics: () => { + if (app.cfg.get('general.analyticsEnabled') && app.isPackaged) { + ElectronSentry.init({dsn: "https://20e1c34b19d54dfcb8231e3ef7975240@o954055.ingest.sentry.io/5903033"}); + } + }, + + /* checkForUpdates - Checks for update using electron-updater (Part of electron-builder) */ + checkForUpdates: (manual) => { + if (!app.isPackaged || process.env.NODE_ENV !== 'production') return; + + autoUpdater.logger = require("electron-log"); + autoUpdater.logger.transports.file.resolvePath = (vars) => { + return join(app.getPath('userData'), 'logs', vars.fileName); + } + autoUpdater.logger.transports.file.level = "info"; + + if (app.cfg.get('advanced.autoUpdaterBetaBuilds')) { + autoUpdater.allowPrerelease = true + autoUpdater.allowDowngrade = false + } + + autoUpdater.on('update-not-available', () => { + if (manual === true) { + let bodyVer = `You are on the latest version. (v${app.getVersion()})` + new Notification({title: "Apple Music", body: bodyVer}).show() + } + }) + + autoUpdater.on('download-progress', (progress) => { + let convertedProgress = parseFloat(progress); + app.win.setProgressBar(convertedProgress) + }) + + autoUpdater.on("error", function (error) { + console.error(`[checkForUpdates] Error ${error}`) + }); + + autoUpdater.on('update-downloaded', (updateInfo) => { + console.warn('[checkForUpdates] New version downloaded. Starting user prompt.'); + + dialog.showMessageBox({ + type: 'info', + title: 'Updates Available', + message: `Update was found and downloaded, would you like to install the update now?`, + details: updateInfo, + buttons: ['Sure', 'No'] + }).then(({response}) => { + if (response === 0) { + const isSilent = true; + const isForceRunAfter = true; + autoUpdater.quitAndInstall(isSilent, isForceRunAfter); + } else { + updater.enabled = true + updater = null + } + }) + + }) + + autoUpdater.checkForUpdates() + .then(r => { + console.verbose(`[checkForUpdates] Check for updates completed. Response: ${r}`) + }) + .catch(err => { + console.error(`[checkUpdates] An error occurred while checking for updates: ${err}`) + }) + }, + + /* Media Controlling Functions (Pause/Play/Skip/Previous) */ + media: { + pausePlay() { + console.verbose('[AppleMusic] pausePlay run.') + app.win.webContents.executeJavaScript("MusicKitInterop.pausePlay()").catch((err) => console.error(err)) + }, + + nextTrack() { + console.verbose('[AppleMusic] nextTrack run.') + app.win.webContents.executeJavaScript("MusicKitInterop.nextTrack()").catch((err) => console.error(err)) + }, + + previousTrack() { + console.verbose('[AppleMusic] previousTrack run.') + app.win.webContents.executeJavaScript("MusicKitInterop.previousTrack()").catch((err) => console.error(err)) + } + }, + + /* Media-associated Icons (Used for Thumbar and TouchBar) */ + icons: { + pause: nativeImage.createFromPath(join(trayIconDir, 'pause.png')).resize({width: 32, height: 32}), + play: nativeImage.createFromPath(join(trayIconDir, 'play.png')).resize({width: 32, height: 32}), + nextTrack: nativeImage.createFromPath(join(trayIconDir, 'next.png')).resize({width: 32, height: 32}), + previousTrack: nativeImage.createFromPath(join(trayIconDir, 'previous.png')).resize({width: 32, height: 32}), + inactive: { + play: nativeImage.createFromPath(join(trayIconDir, 'play-inactive.png')).resize({width: 32, height: 32}), + nextTrack: nativeImage.createFromPath(join(trayIconDir, 'next-inactive.png')).resize({ + width: 32, + height: 32 + }), + previousTrack: nativeImage.createFromPath(join(trayIconDir, 'previous-inactive.png')).resize({ + width: 32, + height: 32 + }), + } + } +} + +Utils.initAnalytics() +module.exports = Utils; \ No newline at end of file diff --git a/resources/functions/win.js b/resources/functions/win.js new file mode 100644 index 00000000..ca5ee26e --- /dev/null +++ b/resources/functions/win.js @@ -0,0 +1,407 @@ +const {app, Menu, Notification, TouchBar, BrowserWindow} = require("electron"), + {TouchBarButton, TouchBarLabel, TouchBarSpacer} = TouchBar, + {join} = require("path"), + windowStateKeeper = require("electron-window-state"), + {initAnalytics} = require('./utils'); +initAnalytics(); + +module.exports = { + + SetApplicationMenu: () => { + if (process.platform !== "darwin") return; + + Menu.setApplicationMenu(Menu.buildFromTemplate([ + { + label: app.getName(), + submenu: [ + { role: 'about' }, + { type: 'separator' }, + { role: 'services' }, + { type: 'separator' }, + { role: 'hide' }, + { role: 'hideOthers' }, + { role: 'unhide' }, + { type: 'separator' }, + { role: 'quit' } + ] + }, + { + label: 'View', + submenu: [ + { role: 'reload' }, + { role: 'forceReload' }, + { role: 'toggleDevTools' }, + { type: 'separator' }, + { role: 'resetZoom' }, + { role: 'zoomIn' }, + { role: 'zoomOut' }, + { type: 'separator' }, + { role: 'togglefullscreen' } + ] + }, + { + label: 'Window', + role: 'window', + submenu: [ + { role: 'minimize' }, + { role: 'zoom' }, + { type: 'separator' }, + { role: 'front' }, + { type: 'separator' }, + { role: 'window' } + ] + }, + { + label: 'Support', + role: 'help', + submenu: [ + { + label: 'Discord', + click() { + require("shell").openExternal("https://discord.gg/CezHYdXHEM") + } + }, + { + label: 'GitHub Wiki', + click() { + require("shell").openExternal("https://github.com/Apple-Music-Electron/Apple-Music-Electron/wiki") + } + }, + { type: 'separator' }, + { + label: 'View License', + click() { + require("shell").openExternal("https://github.com/Apple-Music-Electron/Apple-Music-Electron/blob/master/LICENSE") + } + }, + { type: 'separator' }, + { + label: 'Toggle Developer Tools', + accelerator: 'Option+CommandOrControl+I', + click() { + app.win.webContents.openDevTools() + } + }, + { + label: 'Open Configuration File in Editor', + click() { + app.cfg.openInEditor() + } + } + ] + }, + ])); + }, + + SetContextMenu: (visibility) => { + + if (visibility) { + app.tray.setContextMenu(Menu.buildFromTemplate([ + { + label: 'Check for Updates', + click: function () { + app.ame.utils.checkForUpdates(true) + } + }, + { + label: 'Minimize to Tray', + click: function () { + if (typeof app.win.hide === 'function') { + app.win.hide(); + } + } + }, + { + label: 'Quit', + click: function () { + app.quit(); + } + } + ])); + } else { + app.tray.setContextMenu(Menu.buildFromTemplate([ + { + label: 'Check for Updates', + click: function () { + app.ame.utils.checkForUpdates(true) + } + }, + { + label: `Show ${app.getName()}`, + click: function () { + if (typeof app.win.show === 'function') { + app.win.show(); + } + } + }, + { + label: 'Quit', + click: function () { + app.quit(); + } + } + ])); + } + return true + + }, + + SetTaskList: () => { + if (process.platform !== "win32") return; + + app.setUserTasks([ + { + program: process.execPath, + arguments: '--force-quit', + iconPath: process.execPath, + iconIndex: 0, + title: `Quit ${app.getName()}` + } + ]); + return true + }, + + SetButtons: () => { + + if (process.platform === 'win32') { // Set the Windows Thumbnail Toolbar Buttons + if (app.media.playParams.id !== 'no-id-found') { + app.win.setThumbarButtons([ + { + tooltip: 'Previous', + icon: app.ame.utils.icons.previousTrack, + click() { + app.ame.utils.media.previousTrack() + } + }, + { + tooltip: app.media.status ? 'Pause' : 'Play', + icon: app.media.status ? app.ame.utils.icons.pause : app.ame.utils.icons.play, + click() { + app.ame.utils.media.pausePlay() + } + }, + { + tooltip: 'Next', + icon: app.ame.utils.icons.nextTrack, + click() { + app.ame.utils.media.nextTrack() + } + } + ]); + } else { + app.win.setThumbarButtons([ + { + tooltip: 'Previous', + icon: app.ame.utils.icons.inactive.previousTrack, + flags: ["disabled"] + }, + { + tooltip: 'Play', + icon: app.ame.utils.icons.inactive.play, + flags: ["disabled"] + }, + { + tooltip: 'Next', + icon: app.ame.utils.icons.inactive.nextTrack, + flags: ["disabled"] + } + ]); + } + } else if (process.platform === 'darwin') { // Set the macOS Touchbar + if (!app.media || app.media.playParams.id === 'no-id-found') return; + + const nextTrack = new TouchBarButton({ + icon: app.ame.utils.icons.nextTrack, + click: () => { + app.ame.utils.media.nextTrack() + } + }) + + const previousTrack = new TouchBarButton({ + icon: app.ame.utils.icons.previousTrack, + click: () => { + app.ame.utils.media.previousTrack() + } + }) + + const playPause = new TouchBarButton({ + icon: app.media.status ? app.ame.utils.icons.pause : app.ame.utils.icons.play, + click: () => { + app.ame.utils.media.pausePlay() + } + }) + + const trackInfo = new TouchBarLabel({ + label: app.media.name ? `${app.media.name} by ${app.media.artistName}` : `Nothing is Playing` + }) + + const touchBar = new TouchBar({ + items: [ + previousTrack, + playPause, + nextTrack, + new TouchBarSpacer({size: 'flexible'}), + trackInfo, + new TouchBarSpacer({size: 'flexible'}) + ] + }) + + app.win.setTouchBar(touchBar) + } + }, + + SetTrayTooltip: (attributes) => { + if (!app.cfg.get('general.trayTooltipSongName')) return; + + console.verbose(`[UpdateTooltip] Updating Tooltip for ${attributes.name} to ${attributes.status}`) + + if (attributes.status === true) { + app.tray.setToolTip(`Playing ${attributes.name} by ${attributes.artistName} on ${attributes.albumName}`); + } else { + app.tray.setToolTip(`Paused ${attributes.name} by ${attributes.artistName} on ${attributes.albumName}`); + } + }, + + CreateNotification: (attributes) => { + if (!Notification.isSupported() || !(app.cfg.get('general.playbackNotifications') || app.cfg.get('general.playbackNotifications') === 'minimized')) return; + + if (app.cfg.get('general.playbackNotifications') === "minimized" && !(!app.win.isVisible() || app.win.isMinimized())) { + return; + } + + console.verbose(`[CreateNotification] Notification Generating | Function Parameters: SongName: ${attributes.name} | Artist: ${attributes.artistName} | Album: ${attributes.albumName}`) + + if (app.ipc.existingNotification) { + console.log("[CreateNotification] Existing Notification Found - Removing. ") + app.ipc.existingNotification.close() + app.ipc.existingNotification = false + } + + const NOTIFICATION_OBJECT = { + title: attributes.name, + body: `${attributes.artistName} - ${attributes.albumName}`, + silent: true, + icon: join(__dirname, '../icons/icon.png'), + actions: [{ + type: 'button', + text: 'Skip' + }] + } + + app.ipc.existingNotification = new Notification(NOTIFICATION_OBJECT) + app.ipc.existingNotification.show() + + + app.ipc.existingNotification.addListener('action', (_event) => { + app.ame.utils.media.nextTrack() + }); + }, + + CreateBrowserWindow: () => { + console.log('[CreateBrowserWindow] Initializing Browser Window Creation.') + // Set default window sizes + const mainWindowState = windowStateKeeper({ + defaultWidth: 1024, + defaultHeight: 600 + }); + + const options = { + icon: join(__dirname, `../icons/icon.ico`), + width: mainWindowState.width, + height: mainWindowState.height, + x: mainWindowState.x, + y: mainWindowState.y, + minWidth: (app.cfg.get('visual.streamerMode') ? 400 : 300), + minHeight: ((app.cfg.get('visual.frameType') === 'mac' || app.cfg.get('visual.frameType') === 'mac-right') ? (app.cfg.get('visual.streamerMode')? 55 : 300) : (app.cfg.get('visual.streamerMode') ? 115 : 300)), + frame: (process.platform !== 'win32' && !(app.cfg.get('visual.frameType') === 'mac' || app.cfg.get('visual.frameType') === 'mac-right')), + title: app.getName(), + resizable: true, + // Enables DRM + webPreferences: { + plugins: true, + preload: join(__dirname, '../js/MusicKitInterop.js'), + allowRunningInsecureContent: true, + nodeIntegration: false, + nodeIntegrationInWorker: false, + contextIsolation: false, + webSecurity: true, + sandbox: true, + nativeWindowOpen: true + } + }; + + // Fetch the transparency options + const transparencyOptions = app.ame.utils.fetchTransparencyOptions() + + if (process.platform === 'darwin' && !app.cfg.get('visual.frameType')) { // macOS Frame and transparency + options.titleBarStyle = 'hidden' + options.titleBarOverlay = true + options.frame = true + options.trafficLightPosition = {x: 20, y: 20} + options.transparent = (app.transparency && transparencyOptions) + } + + // Create the Browser Window + console.log('[CreateBrowserWindow] Creating BrowserWindow.') + let win; + if (process.platform === "darwin" || process.platform === "linux") { + win = new BrowserWindow(options) + } else { + const {BrowserWindow} = require("electron-acrylic-window"); + if (app.transparency && transparencyOptions) { + console.log('[CreateBrowserWindow] Setting Vibrancy') + options.vibrancy = transparencyOptions + } + win = new BrowserWindow(options) + } + + // Set the transparency + if (app.transparency && transparencyOptions && process.platform === "darwin") { + console.log('[CreateBrowserWindow] Setting Vibrancy') + win.setVibrancy(transparencyOptions) + } + + // alwaysOnTop + if (!app.cfg.get('window.alwaysOnTop')) { + win.setAlwaysOnTop(false) + } else { + win.setAlwaysOnTop(true) + } + + win.setMenuBarVisibility(false); // Hide that nasty menu bar + if (app.cfg.get('advanced.devToolsOnStartup')) win.webContents.openDevTools({mode: 'detach'}); // Enables Detached DevTools + + // Register listeners on Window to track size and position of the Window. + mainWindowState.manage(win); + + // Load the Website + app.ame.load.LoadWebsite(win) + + return win + }, + + HandleBrowserWindow: () => { + // Detect if the application has been opened with --minimized + if (app.commandLine.hasSwitch('minimized') || process.argv.includes('--minimized')) { + console.log("[Apple-Music-Electron] Application opened with '--minimized'"); + if (typeof app.win.minimize === 'function') { + app.win.minimize(); + } + } + + // Detect if the application has been opened with --hidden + if (app.commandLine.hasSwitch('hidden') || process.argv.includes('--hidden')) { + console.log("[Apple-Music-Electron] Application opened with '--hidden'"); + if (typeof app.win.hide === 'function') { + app.win.hide() + } + } + }, + + removeInsertedCSS: (index) => { + if (app.injectedCSS[index]) { + app.win.webContents.removeInsertedCSS(app.injectedCSS[index]).then(r => { if (r) { console.error(r); }}); + } + + } +} \ No newline at end of file diff --git a/resources/functions/wsapi.js b/resources/functions/wsapi.js new file mode 100644 index 00000000..7788e83a --- /dev/null +++ b/resources/functions/wsapi.js @@ -0,0 +1,292 @@ +const ws = require('ws'); +const http = require('http'); +const WebSocketServer = ws.Server; +const WebSocket = ws.WebSocket; +const url = require('url'); +const fs = require('fs'); +const path = require('path'); +const port = process.argv[2] || 9000; +const express = require('express'); +const router = express.Router(); +const { + ipcMain, + app, + BrowserWindow +} = require('electron'); + +const wsapi = { + standardResponse: function (status, data, message, type = "generic") { + this.status = status; + this.message = message; + this.data = data; + this.type = type; + }, + port: 26369, + wss: null, + clients: [], + createId() { + // create random guid + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { + var r = Math.random() * 16 | 0, + v = c == 'x' ? r : (r & 0x3 | 0x8); + return v.toString(16); + }); + }, + InitWebSockets() { + ipcMain.on('wsapi-updatePlaybackState', (event, arg) => { + wsapi.updatePlaybackState(arg); + }) + + ipcMain.on('wsapi-returnQueue', (event, arg) => { + wsapi.returnQueue(JSON.parse(arg)); + }); + + ipcMain.on('wsapi-returnSearch', (event, arg) => { + wsapi.returnSearch(JSON.parse(arg)); + }); + + ipcMain.on('wsapi-returnSearchLibrary', (event, arg) => { + wsapi.returnSearchLibrary(JSON.parse(arg)); + }); + + ipcMain.on('wsapi-returnLyrics', (event, arg) => { + wsapi.returnLyrics(JSON.parse(arg)); + }); + + wss = new WebSocketServer({ + port: 26369, + perMessageDeflate: { + zlibDeflateOptions: { + // See zlib defaults. + chunkSize: 1024, + memLevel: 7, + level: 3 + }, + zlibInflateOptions: { + chunkSize: 10 * 1024 + }, + // Other options settable: + clientNoContextTakeover: true, // Defaults to negotiated value. + serverNoContextTakeover: true, // Defaults to negotiated value. + serverMaxWindowBits: 10, // Defaults to negotiated value. + // Below options specified as default values. + concurrencyLimit: 10, // Limits zlib concurrency for perf. + threshold: 1024 // Size (in bytes) below which messages + // should not be compressed if context takeover is disabled. + } + }) + + const defaultResponse = new wsapi.standardResponse(0, {}, "OK"); + + console.log(`WebSocketServer started on port: ${this.port}`); + wss.on('connection', function connection(ws) { + ws.id = wsapi.createId(); + console.log(`Client ${ws.id} connected`) + wsapi.clients.push(ws); + ws.on('message', function incoming(message) { + + }); + // ws on message + ws.on('message', function incoming(message) { + let data = JSON.parse(message); + let response = new wsapi.standardResponse(0, {}, "OK");; + if (data.action) { + data.action.toLowerCase(); + } + switch (data.action) { + default: + response.message = "Action not found"; + break; + case "identify": + response.message = "Thanks for identifying!" + response.data = { + id: ws.id + } + ws.identity = { + name: data.name, + author: data.author, + description: data.description, + version: data.version + } + break; + case "play-next": + app.win.webContents.executeJavaScript(`wsapi.playNext(\`${data.type}\`,\`${data.id}\`)`); + response.message = "Play Next"; + break; + case "play-later": + app.win.webContents.executeJavaScript(`wsapi.playLater(\`${data.type}\`,\`${data.id}\`)`); + response.message = "Play Later"; + break; + case "quick-play": + app.win.webContents.executeJavaScript(`wsapi.quickPlay(\`${data.term}\`)`); + response.message = "Quick Play"; + break; + case "get-lyrics": + app.win.webContents.executeJavaScript(`wsapi.getLyrics()`); + break; + case "shuffle": + app.win.webContents.executeJavaScript(`wsapi.toggleShuffle()`); + break; + case "repeat": + app.win.webContents.executeJavaScript(`wsapi.toggleRepeat()`); + break; + case "seek": + app.win.webContents.executeJavaScript(`MusicKit.getInstance().seekToTime(${parseFloat(data.time)})`); + response.message = "Seek"; + break; + case "pause": + app.win.webContents.executeJavaScript(`MusicKit.getInstance().pause()`); + response.message = "Paused"; + break; + case "play": + app.win.webContents.executeJavaScript(`MusicKit.getInstance().play()`); + response.message = "Playing"; + break; + case "stop": + app.win.webContents.executeJavaScript(`MusicKit.getInstance().stop()`); + response.message = "Stopped"; + break; + case "volume": + app.win.webContents.executeJavaScript(`MusicKit.getInstance().volume = ${parseFloat(data.volume)}`); + response.message = "Volume"; + break; + case "mute": + app.win.webContents.executeJavaScript(`MusicKit.getInstance().mute()`); + response.message = "Muted"; + break; + case "unmute": + app.win.webContents.executeJavaScript(`MusicKit.getInstance().unmute()`); + response.message = "Unmuted"; + break; + case "next": + app.win.webContents.executeJavaScript(`MusicKit.getInstance().skipToNextItem()`); + response.message = "Next"; + break; + case "previous": + app.win.webContents.executeJavaScript(`MusicKit.getInstance().skipToPreviousItem()`); + response.message = "Previous"; + break; + case "musickit-api": + + break; + case "musickit-library-api": + + break; + case "set-autoplay": + app.win.webContents.executeJavaScript(`wsapi.setAutoplay(${data.autoplay})`); + break; + case "queue-move": + app.win.webContents.executeJavaScript(`wsapi.moveQueueItem(${data.from},${data.to})`); + break; + case "get-queue": + app.win.webContents.executeJavaScript(`wsapi.getQueue()`); + break; + case "search": + if (!data.limit) { + data.limit = 10; + } + app.win.webContents.executeJavaScript(`wsapi.search(\`${data.term}\`, \`${data.limit}\`)`); + break; + case "library-search": + if (!data.limit) { + data.limit = 10; + } + app.win.webContents.executeJavaScript(`wsapi.searchLibrary(\`${data.term}\`, \`${data.limit}\`)`); + break; + case "show-window": + app.win.show() + break; + case "hide-window": + app.win.hide() + break; + case "play-mediaitem": + app.win.webContents.executeJavaScript(`wsapi.playTrackById(${data.id})`); + response.message = "Playing track"; + break; + case "get-status": + response.data = { + isAuthorized: true + }; + response.message = "Status"; + break; + case "get-currentmediaitem": + app.win.webContents.executeJavaScript(`wsapi.getPlaybackState()`); + break; + } + ws.send(JSON.stringify(response)); + }); + + ws.on('close', function close() { + // remove client from list + wsapi.clients.splice(wsapi.clients.indexOf(ws), 1); + console.log(`Client ${ws.id} disconnected`); + }); + ws.send(JSON.stringify(defaultResponse)); + }); + }, + sendToClient(id) { + // replace the clients.forEach with a filter to find the client that requested + }, + win: null, + inAppUI() { + // create a browserwindow and load "localhost:8090" + this.win = new BrowserWindow({ + width: 800, + height: 600, + webPreferences: { + nodeIntegration: true + } + }); + this.win.loadURL(`http://localhost:${this.webRemotePort}`); + this.win.show() + this.win.on('closed', () => { + this.win = null; + }); + }, + updatePlaybackState(attr) { + const response = new wsapi.standardResponse(0, attr, "OK", "playbackStateUpdate"); + wsapi.clients.forEach(function each(client) { + client.send(JSON.stringify(response)); + }); + }, + returnLyrics(results) { + const response = new wsapi.standardResponse(0, results, "OK", "lyrics"); + wsapi.clients.forEach(function each(client) { + client.send(JSON.stringify(response)); + }); + }, + returnSearch(results) { + const response = new wsapi.standardResponse(0, results, "OK", "searchResults"); + wsapi.clients.forEach(function each(client) { + client.send(JSON.stringify(response)); + }); + }, + returnSearchLibrary(results) { + const response = new wsapi.standardResponse(0, results, "OK", "searchResultsLibrary"); + wsapi.clients.forEach(function each(client) { + client.send(JSON.stringify(response)); + }); + }, + returnQueue(queue) { + const response = new wsapi.standardResponse(0, queue, "OK", "queue"); + wsapi.clients.forEach(function each(client) { + client.send(JSON.stringify(response)); + }); + }, + webRemotePort: 8090, + InitWebServer() { + // Web Remote + // express server that will serve static files in the "../web-remote" folder + const webapp = express(); + const webRemotePath = path.join(__dirname, '../web-remote'); + webapp.use(express.static(webRemotePath)); + webapp.get('/', function (req, res) { + res.sendFile(path.join(webRemotePath, 'index.html')); + }); + webapp.listen(wsapi.webRemotePort, function () { + console.log(`Web Remote listening on port ${wsapi.webRemotePort}`); + }); + } +} + +module.exports = wsapi \ No newline at end of file diff --git a/resources/html/cast_device.html b/resources/html/cast_device.html new file mode 100644 index 00000000..efe83135 --- /dev/null +++ b/resources/html/cast_device.html @@ -0,0 +1,86 @@ +
+
+
+
+ +
+
+ Cast To Device +
+
+ +
+
+
+
+
Chromecast
+
+ + +
+
AirPlay
+
+
+
+ AirPlay is still under development +
+
+
+
+ +
+ \ No newline at end of file diff --git a/resources/html/eq.html b/resources/html/eq.html new file mode 100644 index 00000000..0a558d7b --- /dev/null +++ b/resources/html/eq.html @@ -0,0 +1,45 @@ +
+
+
+
+
+ +
+
+ Equalizer +
+
+ +
+
+
+
+
+
+
Bass ({{ bass }})
+
+ +
+
+
+
Treble ({{ treble }})
+
+ +
+
+
+
Gain ({{ gain }})
+
+ +
+
+
+
+ +
+
\ No newline at end of file diff --git a/resources/html/itunes_remote.html b/resources/html/itunes_remote.html new file mode 100644 index 00000000..fa4e72aa --- /dev/null +++ b/resources/html/itunes_remote.html @@ -0,0 +1,80 @@ +
+
+
+
+ +
+
+ Add Remote for iPhone, Apple Watch, iPod touch & iPad +
+
+ +
+
+
+
+
+
Please enter the passcode displayed on "Device Name" to allow it to control
Apple Music Electron.
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+ Please wait... +
+
+ There was an error pairing to your remote, please try again. + +
+
+ Your Remote is now able to control Apple Music Electron. + +
+
+ +
+ + \ No newline at end of file diff --git a/resources/html/oobe.html b/resources/html/oobe.html new file mode 100644 index 00000000..97b67d74 --- /dev/null +++ b/resources/html/oobe.html @@ -0,0 +1,827 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + \ No newline at end of file diff --git a/resources/html/outputdevice.html b/resources/html/outputdevice.html new file mode 100644 index 00000000..f2df20d4 --- /dev/null +++ b/resources/html/outputdevice.html @@ -0,0 +1,23 @@ +
+
+

Output Device

+
+
+
+
+ + +
+
+
+ +
\ No newline at end of file diff --git a/resources/html/preferences-footer.html b/resources/html/preferences-footer.html new file mode 100644 index 00000000..2c489314 --- /dev/null +++ b/resources/html/preferences-footer.html @@ -0,0 +1,31 @@ + + \ No newline at end of file diff --git a/resources/html/preferences-main.html b/resources/html/preferences-main.html new file mode 100644 index 00000000..4d9353b4 --- /dev/null +++ b/resources/html/preferences-main.html @@ -0,0 +1,768 @@ +
+
+
+
+

General Settings

+
+
+
    +
  • + Incognito Mode + + Music played in this app will not be viewable by your followers on Apple Music and will no longer influence the recommendations you get in 'Listen Now'. + This will also disable updates to various additions in the application. (Such as DiscordRPC and LastFM). +
  • +
  • + + + Enabling this means you will get notifications when + you change song. The minimized option forces notifications to only appear if the app is hidden / + minimized. +
  • +
  • + Show song name as tray icon tooltip + + Enabling this option allows you to see the song + name in the tooltip on the taskbar when the application is minimized to the tray. +
  • +
  • + + + Select what page you wish to be placed on when you + start the application. +
  • +
  • + Allow statistics to be collected when errors or crashes + occur + + These logs when enabled allow us to fix bugs and + errors that may occur during your listening sessions to better improve the application. We + understand if you're not comfortable with them on, but it helps us out immensely in figuring out + widespread issues. (Note: We do not gather personal information, only stuff that shows to you as an + error in the code.) +
  • +
  • +

    Discord Rich Presence

    + These settings are for managing how you display + your status on Discord. You must have 'Display current activity as status message.' turned on in + your Discord settings for the song to be shown. +
  • +
  • + + +
  • +
  • + Clear activity on pause + + With this disabled your status will show a + Pause/Play icon whenever you are playing or have a song paused. When you enable this, it is replaced + with a branch icon (Nightly / Stable) and a version title when you hover. +
  • +
  • +

    LastFM

    +
  • +
  • + LastFM Account + +
  • +
  • + Remove featuring artists from song title + + Enabling this will remove the featuring artists + from the scrobbled data, meaning on LastFM only the primary artist will be shown. +
  • +
  • + Enable now playing + + Enabling this will display what song you are + playing on LastFM. +
  • +
  • + + + Sets the wait time before current song is added to scrobble list. +
  • +
+
+
+
+
+

Appearance

+
+
+
    +
  • + + + You will need to restart the application in order + for the default themes to be populated. You can preview all the themes here. +
  • +
  • + Theme Options + + Configure the selected theme +
  • +
  • + Update Themes + + Running this will + delete the 'themes' directory. If you have made a theme, store it elsewhere until it says + Updated. +
  • +
  • + + + macOS Emulation shows the 'stoplights' that are + well known for all macOS users and adjusts other UI elements to resemble the macOS Music App. + Selecting the right option shows a more Windows-like representation with the stoplights replacing + the usual close, minimize and maximize buttons. For macOS users its suggested that you disable this + for the best experience. Having this disabled will make the application use the operating system's + frame. +
  • +
  • +

    Transparency Configuration

    + Here you can configure the transparency options for + the window. Transparency only works on certain systems, so read the descriptions of each setting. It + is not advised to use transparency on platforms other than Windows or macOS. +
  • +
  • + + + Sets the type of Windows transparency effect, + either 'acrylic', 'blur' or leave it empty to disable it. Changing the transparency blur type can + improve performance and compatibility with older hardware and systems. +
  • +
  • + + + Sets color of acrylic effect. Can be 'light', + 'dark', 'appearance-based' or a hex color code with alpha ('#0f0f0f00'). +
  • +
  • + Disable Transparency when Unfocused (Acrylic Only) + + If enabled, acrylic effect will be disabled when + the window loses focus, to mimic the behaviour of normal UWP apps. +
  • +
  • + + + Use custom window resize/move handler for + performance. You can set the maximum refresh rate that the application uses. Disabled would default + to 60hz. +
  • +
  • +

    Lyrics

    +
  • +
  • + Enable Musixmatch Lyrics + + Less stable, but allows for lyrics translation and + better lyrics detection +
  • +
  • + Enable Youtube Lyrics (MVs only) + + (NOT RECOMMENDED!) Better timings on some Music Video, also better lyrics on Selected Tracks (e.g JP AMVs) +
  • +
  • + + + (Only when Musixmatch Lyrics / Youtube Lyrics is enabled) Select the + targeted language for translated lyrics +
  • +
  • +

    Miscellaneous Options

    + Various options allowing you to adjust the user + interface to your preference. +
  • +
  • + Streaming Mode + + Removes certain UI elements and has unique scaling + properties. +
  • +
  • + Remove Upsell + + Removes the Open in iTunes and Exit Beta + Buttons. +
  • +
  • + Remove Apple Music Logo + + Removes the Apple Music Logo and moves search bar + up. +
  • +
  • + Remove Footer + + Removes the Apple Music footer. +
  • +
  • + Remove Scrollbars + + Currently, the scrollbar is experimental and + incomplete. It is recommended to leave this on. +
  • +
  • + Use OS Accent as Application Accent + + Force the application to use your operating + systems' accent. +
  • +
  • + + + Set the scale that you would like the interface sized at. +
  • +
+
+
+
+
+

Audio Settings

+
+
+
    +
  • + + + Allows the user to select a preferred audio bitrate + for music playback. NOTE: This may not work on all songs. Extreme mode can have the side effects of + high CPU Usage. +
  • +
  • + Seamless Audio Transitions + + Reduces or completely removes the delay between + songs providing a smooth audio experience. +
  • +
  • + + + Audio Casting bit-depth, all devices should support 16-bit + audio, however 24-bit preserves quality from original audio (it is sometimes not + supported by cheap / old Chromecast devices). + +
  • +
  • + Enable DLNA casting + + DLNA is supported by a wide variety of devices, however a large + number of them don't support live radio (e.g LG TVs). + +
  • +
+
+
+
+
+

Startup and Window Behavior

+
+
+
    +
  • + + +
  • +
  • + Close button should minimize Apple Music + +
  • +
  • + Show window always on top + + This will make the application persist above all + other windows. Best used for mini player usage. +
  • +
+
+
+
+
+

Advanced Settings

+
+ Open Category +
+
    +
  • + + +
  • +
  • + Hardware Acceleration + + Turn on Hardware Acceleration, which uses your GPU to make the application smoother. Turn it off to reduce the overall resource consumption of the application, at the cost of some rendering not being as smooth. +
  • +
  • + Verbose Logging + + When enabled more logs will be posted, used for + debugging. +
  • + +
  • + Copy Log File to Clipboard + + Copy your log file to your clipboard, so you can easily paste it into the Discord server or GitHub. +
  • + +
  • + Auto Update Beta Builds + + This will make the autoUpdater perform updates when + a new pre-release is made on GitHub. +
  • +
  • + Use Apple Music Beta Site + + Enabling this makes the application load beta.music.apple.com instead of music.apple.com. Disabling this will provide a limited + experience on the app. +
  • +
  • + Prevent Media Key Hijacking + + This prevents the Chromium window from hijacking + your media key. If you experience issues with pausing or playing videos/media on other applications, + enable this. +
  • +
  • +

    Advanced Development Settings

    + These settings are for the use of application + developers. +
  • +
  • + Open DevTools on Startup + + This makes the Chromium Dev Tools appear on startup. Read more about them here. +
  • +
  • + Allow Multiple Instances + + Allows multiple instance of the application to be + opened. +
  • +
+
+
\ No newline at end of file diff --git a/resources/html/theme-options.html b/resources/html/theme-options.html new file mode 100644 index 00000000..c1547247 --- /dev/null +++ b/resources/html/theme-options.html @@ -0,0 +1,29 @@ +
+
+
+
+ +
+
+ {{ theme }} +
+
+ +
+
+
+
+
+
+
+ {{ option.name }} +
+
+ +
+
+
+
+ +
\ No newline at end of file diff --git a/resources/html/usermenu.html b/resources/html/usermenu.html new file mode 100644 index 00000000..6adf9745 --- /dev/null +++ b/resources/html/usermenu.html @@ -0,0 +1,55 @@ +
+ +
+ + \ No newline at end of file diff --git a/resources/html/zoo.html b/resources/html/zoo.html new file mode 100644 index 00000000..ec3a7be1 --- /dev/null +++ b/resources/html/zoo.html @@ -0,0 +1,32 @@ +
+
+

Header

+
+
+ + + +
+
+
Switch
+
+ +
+
+
+
Select
+
+ +
+
+
+
+ +
\ No newline at end of file diff --git a/resources/icons/icon.icns b/resources/icons/icon.icns new file mode 100644 index 00000000..df1163c6 Binary files /dev/null and b/resources/icons/icon.icns differ diff --git a/resources/icons/icon.ico b/resources/icons/icon.ico new file mode 100644 index 00000000..f54e857d Binary files /dev/null and b/resources/icons/icon.ico differ diff --git a/resources/icons/icon.png b/resources/icons/icon.png new file mode 100644 index 00000000..8ce4539a Binary files /dev/null and b/resources/icons/icon.png differ diff --git a/resources/icons/media/dark/next-inactive.png b/resources/icons/media/dark/next-inactive.png new file mode 100644 index 00000000..6e8f950b Binary files /dev/null and b/resources/icons/media/dark/next-inactive.png differ diff --git a/resources/icons/media/dark/next.png b/resources/icons/media/dark/next.png new file mode 100644 index 00000000..f56fefd4 Binary files /dev/null and b/resources/icons/media/dark/next.png differ diff --git a/resources/icons/media/dark/pause-inactive.png b/resources/icons/media/dark/pause-inactive.png new file mode 100644 index 00000000..8bf5bb72 Binary files /dev/null and b/resources/icons/media/dark/pause-inactive.png differ diff --git a/resources/icons/media/dark/pause.png b/resources/icons/media/dark/pause.png new file mode 100644 index 00000000..a71ca9a9 Binary files /dev/null and b/resources/icons/media/dark/pause.png differ diff --git a/resources/icons/media/dark/play-inactive.png b/resources/icons/media/dark/play-inactive.png new file mode 100644 index 00000000..aa4ee6a9 Binary files /dev/null and b/resources/icons/media/dark/play-inactive.png differ diff --git a/resources/icons/media/dark/play.png b/resources/icons/media/dark/play.png new file mode 100644 index 00000000..af1d3bd5 Binary files /dev/null and b/resources/icons/media/dark/play.png differ diff --git a/resources/icons/media/dark/previous-inactive.png b/resources/icons/media/dark/previous-inactive.png new file mode 100644 index 00000000..4a76213f Binary files /dev/null and b/resources/icons/media/dark/previous-inactive.png differ diff --git a/resources/icons/media/dark/previous.png b/resources/icons/media/dark/previous.png new file mode 100644 index 00000000..52b66d8f Binary files /dev/null and b/resources/icons/media/dark/previous.png differ diff --git a/resources/icons/media/light/next-inactive.png b/resources/icons/media/light/next-inactive.png new file mode 100644 index 00000000..2ff1bf16 Binary files /dev/null and b/resources/icons/media/light/next-inactive.png differ diff --git a/resources/icons/media/light/next.png b/resources/icons/media/light/next.png new file mode 100644 index 00000000..bf203ba0 Binary files /dev/null and b/resources/icons/media/light/next.png differ diff --git a/resources/icons/media/light/pause-inactive.png b/resources/icons/media/light/pause-inactive.png new file mode 100644 index 00000000..ccd75d91 Binary files /dev/null and b/resources/icons/media/light/pause-inactive.png differ diff --git a/resources/icons/media/light/pause.png b/resources/icons/media/light/pause.png new file mode 100644 index 00000000..94b21e41 Binary files /dev/null and b/resources/icons/media/light/pause.png differ diff --git a/resources/icons/media/light/play-inactive.png b/resources/icons/media/light/play-inactive.png new file mode 100644 index 00000000..fadd6e2b Binary files /dev/null and b/resources/icons/media/light/play-inactive.png differ diff --git a/resources/icons/media/light/play.png b/resources/icons/media/light/play.png new file mode 100644 index 00000000..a0776aba Binary files /dev/null and b/resources/icons/media/light/play.png differ diff --git a/resources/icons/media/light/previous-inactive.png b/resources/icons/media/light/previous-inactive.png new file mode 100644 index 00000000..f8f69f2e Binary files /dev/null and b/resources/icons/media/light/previous-inactive.png differ diff --git a/resources/icons/media/light/previous.png b/resources/icons/media/light/previous.png new file mode 100644 index 00000000..1b089dae Binary files /dev/null and b/resources/icons/media/light/previous.png differ diff --git a/resources/icons/webui/cast.svg b/resources/icons/webui/cast.svg new file mode 100644 index 00000000..54b23d3b --- /dev/null +++ b/resources/icons/webui/cast.svg @@ -0,0 +1,18 @@ + + + + ic_cast_black_24dp + Created with Sketch. + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/icons/webui/cast_white.svg b/resources/icons/webui/cast_white.svg new file mode 100644 index 00000000..a84aed59 --- /dev/null +++ b/resources/icons/webui/cast_white.svg @@ -0,0 +1,18 @@ + + + + ic_cast_black_24dp + Created with Sketch. + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/icons/webui/close.svg b/resources/icons/webui/close.svg new file mode 100644 index 00000000..b548eaf3 --- /dev/null +++ b/resources/icons/webui/close.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/icons/webui/down.svg b/resources/icons/webui/down.svg new file mode 100644 index 00000000..61576d77 --- /dev/null +++ b/resources/icons/webui/down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/icons/webui/miniplayer_hover.svg b/resources/icons/webui/miniplayer_hover.svg new file mode 100644 index 00000000..fe7fccbe --- /dev/null +++ b/resources/icons/webui/miniplayer_hover.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/resources/icons/webui/up.svg b/resources/icons/webui/up.svg new file mode 100644 index 00000000..08641ae5 --- /dev/null +++ b/resources/icons/webui/up.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/js/MusicKitInterop.js b/resources/js/MusicKitInterop.js new file mode 100644 index 00000000..9606cecf --- /dev/null +++ b/resources/js/MusicKitInterop.js @@ -0,0 +1,148 @@ +// preload.js +const electron = require('electron'); + + + +let cache = {playParams: {id: 0}, status: null, remainingTime: 0}, + playbackCache = {status: null, time: Date.now()}; + +const MusicKitInterop = { + init: function () { + const self = this; + MusicKit.getInstance().addEventListener(MusicKit.Events.playbackStateDidChange, () => { + /** wsapi */ + ipcRenderer.send('wsapi-updatePlaybackState', self.getAttributes()); + /** wsapi */ + + if (MusicKitInterop.filterTrack(MusicKitInterop.getAttributes(), true, false)) { + global.ipcRenderer.send('playbackStateDidChange', MusicKitInterop.getAttributes()) + if (typeof _plugins != "undefined") { + _plugins.execute("OnPlaybackStateChanged", {Attributes: MusicKitInterop.getAttributes()}) + } + const nowPlayingItem = MusicKit.getInstance().nowPlayingItem; + if (typeof nowPlayingItem != "undefined") { + if (nowPlayingItem["type"] === "musicVideo") { + document.querySelector(`.web-chrome`).setAttribute('style', 'height: 20px !important'); + document.querySelector(`#MVLyricsBox`).style.display = 'block'; + } else { + document.querySelector(`.web-chrome`).setAttribute('style', 'height: 55px !important'); + if (nowPlayingItem["type"] !== "song"){ + document.querySelector(`.web-chrome__grid-container`).setAttribute('style', 'margin: 15px auto 0') + } else { + document.querySelector(`.web-chrome__grid-container`).setAttribute('style', 'margin: dsds');} + document.querySelector(`#MVLyricsBox`).style.display = 'none'; + } + } + } else { + document.querySelector(`.web-chrome`).setAttribute('style', 'height: 55px !important'); + document.querySelector(`#MVLyricsBox`).style.display = 'none'; + try { + const nowPlayingItem = MusicKit.getInstance().nowPlayingItem; + if (typeof nowPlayingItem != "undefined") { + if (nowPlayingItem["type"] === "musicVideo") { + document.querySelector(`.web-chrome`).setAttribute('style', 'height: 20px !important'); + document.querySelector(`#MVLyricsBox`).style.display = 'block'; + } else { + document.querySelector(`.web-chrome`).setAttribute('style', 'height: 55px !important'); + if (nowPlayingItem["type"] !== "song"){ + document.querySelector(`.web-chrome__grid-container`).setAttribute('style', 'margin: 15px auto 0') + } else { + document.querySelector(`.web-chrome__grid-container`).setAttribute('style', 'margin: dsds');} + document.querySelector(`#MVLyricsBox`).style.display = 'none'; + } + } + } catch (e) { + console.error(e); + } + } + }); + + /** wsapi */ + MusicKit.getInstance().addEventListener(MusicKit.Events.playbackTimeDidChange, () => { + ipcRenderer.send('wsapi-updatePlaybackState', self.getAttributes()); + }); + /** wsapi */ + + MusicKit.getInstance().addEventListener(MusicKit.Events.nowPlayingItemDidChange, () => { + if (MusicKitInterop.filterTrack(MusicKitInterop.getAttributes(), false, true)) { + global.ipcRenderer.send('nowPlayingItemDidChange', MusicKitInterop.getAttributes()); + AMStyling.updateMeta() + } + }); + + MusicKit.getInstance().addEventListener(MusicKit.Events.authorizationStatusDidChange, () => { + global.ipcRenderer.send('authorizationStatusDidChange', MusicKit.getInstance().authorizationStatus) + }) + + MusicKit.getInstance().addEventListener(MusicKit.Events.mediaPlaybackError, (e) => { + console.warn(`[mediaPlaybackError] ${e}`); + }) + }, + + getAttributes: function () { + const mk = MusicKit.getInstance(); + const nowPlayingItem = mk.nowPlayingItem; + const isPlayingExport = mk.isPlaying; + const remainingTimeExport = mk.currentPlaybackTimeRemaining; + const attributes = (nowPlayingItem != null ? nowPlayingItem.attributes : {}); + + attributes.status = isPlayingExport ? isPlayingExport : false; + attributes.name = attributes.name ? attributes.name : 'No Title Found'; + attributes.artwork = attributes.artwork ? attributes.artwork : {url: ''}; + attributes.artwork.url = attributes.artwork.url ? attributes.artwork.url : ''; + attributes.playParams = attributes.playParams ? attributes.playParams : {id: 'no-id-found'}; + attributes.playParams.id = attributes.playParams.id ? attributes.playParams.id : 'no-id-found'; + attributes.albumName = attributes.albumName ? attributes.albumName : ''; + attributes.artistName = attributes.artistName ? attributes.artistName : ''; + attributes.genreNames = attributes.genreNames ? attributes.genreNames : []; + attributes.remainingTime = remainingTimeExport ? (remainingTimeExport * 1000) : 0; + attributes.durationInMillis = attributes.durationInMillis ? attributes.durationInMillis : 0; + attributes.startTime = Date.now(); + attributes.endTime = Math.round((attributes.playParams.id === cache.playParams.id ? (Date.now() + attributes.remainingTime) : (attributes.startTime + attributes.durationInMillis))); + attributes.endTime = attributes.endTime ? attributes.endTime : Date.now(); + attributes.volume = mk.volume; + attributes.shuffleMode = mk.shuffleMode; + attributes.repeatMode = mk.repeatMode; + attributes.autoplayEnabled = mk.autoplayEnabled; + return attributes + }, + + filterTrack: function (a, playbackCheck, mediaCheck) { + if (a.title === "No Title Found" || a.playParams.id === "no-id-found") { + return; + } else if (mediaCheck && a.playParams.id === cache.playParams.id) { + return; + } else if (playbackCheck && a.status === playbackCache.status) { + return; + } else if (playbackCheck && !a.status && a.remainingTime === playbackCache.time) { /* Pretty much have to do this to prevent multiple runs when a song starts playing */ + return; + } + cache = a; + if (playbackCheck) playbackCache = {status: a.status, time: a.remainingTime}; + return true; + }, + + pausePlay: function () { + if (MusicKit.getInstance().isPlaying) { + MusicKit.getInstance().pause(); + } else if (MusicKit.getInstance().nowPlayingItem != null) { + MusicKit.getInstance().play().then(r => console.log(`[MusicKitInterop] Playing ${r}`)); + } + }, + + nextTrack: function () { + MusicKit.getInstance().skipToNextItem().then(r => console.log(`[MusicKitInterop] Skipping to Next ${r}`)); + }, + + previousTrack: function () { + MusicKit.getInstance().skipToPreviousItem().then(r => console.log(`[MusicKitInterop] Skipping to Previous ${r}`)); + } + +} + +process.once('loaded', () => { + global.ipcRenderer = electron.ipcRenderer; + global.MusicKitInterop = MusicKitInterop; +}); +// MusicKit.getInstance().addEventListener( MusicKit.Events.queueItemsDidChange,logIt ); +// MusicKit.getInstance().addEventListener( MusicKit.Events.queuePositionDidChange, logIt ); \ No newline at end of file diff --git a/resources/js/OpusMediaRecorder.umd.js b/resources/js/OpusMediaRecorder.umd.js new file mode 100644 index 00000000..c87ff372 --- /dev/null +++ b/resources/js/OpusMediaRecorder.umd.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.OpusMediaRecorder=t():e.OpusMediaRecorder=t()}("undefined"!=typeof self?self:this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){(function(t){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var s,a=e[Symbol.iterator]();!(r=(s=a.next()).done)&&(n.push(s.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==a.return||a.return()}finally{if(o)throw i}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};s(this,f);var o=n.mimeType,i=n.audioBitsPerSecond,a=(n.videoBitsPerSecond,n.bitsPerSecond),c=r.encoderWorkerFactory,u=r.OggOpusEncoderWasmPath,p=r.WebMOpusEncoderWasmPath;if((t=l.call(this))._stream=e,t._state="inactive",t._mimeType=o||"",t._audioBitsPerSecond=i||a,t.workerState="inactive",!f.isTypeSupported(t._mimeType))throw new TypeError("invalid arguments, a MIME Type is not supported");switch(f._parseType(t._mimeType).subtype){case"wave":case"wav":t._mimeType="audio/wave";break;case"webm":t._mimeType="audio/webm";break;case"ogg":t._mimeType="audio/ogg";break;default:switch(m&&m.name){case"chrome":t._mimeType="audio/webm";break;case"firefox":t._mimeType="audio/ogg";break;case"edge":t._mimeType="audio/webm";break;case"ios":case"safari":t._mimeType="audio/wave";break;default:t._mimeType="audio/webm"}}switch(t._mimeType){case"audio/wave":t._wasmPath="";break;case"audio/webm":t._wasmPath=p||"";break;case"audio/ogg":t._wasmPath=u||"";break;default:throw new Error("Internal Error: Unexpected MIME Type: ".concat(t._mimeType))}var d="";return document.currentScript?d=document.currentScript.src:self.location&&(d=self.location.href),d=d.substr(0,d.lastIndexOf("/"))+"/encoderWorker.umd.js","function"==typeof f.encoderWorker&&(d=URL.createObjectURL(new Blob(["(".concat(f.encoderWorker,")()")]))),t._workerFactory="function"==typeof c?c:function(e){return new Worker(d)},t._spawnWorker(),t}return n=f,i=[{key:"isTypeSupported",value:function(e){if("string"==typeof e&&!e)return!0;try{var t=f._parseType(e),n=t.type,r=t.subtype,o=t.codec}catch(e){return!1}if("audio"!==n||"ogg"!==r&&"webm"!==r&&"wave"!==r&&"wav"!==r)return!1;switch(r){case"ogg":case"webm":if("opus"!==o&&o)return!1;break;case"wave":case"wav":if(o)return!1}return!0}},{key:"_parseType",value:function(e){try{var t=o(e.match(/^(\w+)\/(\w+)(;\s*codecs=(\w+))?$/),5),n=t[1],r=t[2],i=t[4]}catch(t){return"string"!=typeof e||e?null:{type:"",subtype:"",codec:""}}return{type:n,subtype:r,codec:i}}}],(r=[{key:"_spawnWorker",value:function(){var e=this;this.worker=this._workerFactory(),this.worker.onmessage=function(t){return e._onmessageFromWorker(t)},this.worker.onerror=function(t){return e._onerrorFromWorker(t)},this._postMessageToWorker("loadEncoder",{mimeType:this._mimeType,wasmPath:this._wasmPath})}},{key:"_postMessageToWorker",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(e){case"loadEncoder":var r=n.mimeType,o=n.wasmPath;this.worker.postMessage({command:e,mimeType:r,wasmPath:o});break;case"init":var i=n.sampleRate,s=n.channelCount,a=n.bitsPerSecond;this.worker.postMessage({command:e,sampleRate:i,channelCount:s,bitsPerSecond:a}),this.workerState="encoding",this.source.connect(this.processor),this.processor.connect(this.context.destination);var c=new t.Event("start");this.dispatchEvent(c);break;case"pushInputData":var u=n.channelBuffers,l=n.length,f=n.duration;this.worker.postMessage({command:e,channelBuffers:u,length:l,duration:f});break;case"getEncodedData":case"done":this.worker.postMessage({command:e});break;default:throw new Error("Internal Error: Incorrect postMessage requested.")}}},{key:"_onmessageFromWorker",value:function(e){var n,r=e.data,o=r.command,i=r.buffers;switch(o){case"readyToInit":var s=this.sampleRate,a=this.channelCount;this.workerState="readyToInit","recording"===this.state&&this._postMessageToWorker("init",{sampleRate:s,channelCount:a,bitsPerSecond:this.audioBitsPerSecond});break;case"encodedData":case"lastEncodedData":var c=new Blob(i,{type:this._mimeType});(n=new t.Event("dataavailable")).data=c,this.dispatchEvent(n),"lastEncodedData"===o&&(n=new t.Event("stop"),this.dispatchEvent(n),this.workerState="closed")}}},{key:"_onerrorFromWorker",value:function(e){this.source.disconnect(),this.processor.disconnect(),this.worker.terminate(),this.workerState="closed";var n=["FileName: "+e.filename,"LineNumber: "+e.lineno,"Message: "+e.message].join(" - "),r=new t.Event("error");r.name="UnknownError",r.message=n,this.dispatchEvent(r)}},{key:"_enableAudioProcessCallback",value:function(e){var t=this,n=0;this.processor.onaudioprocess=function(r){for(var o=r.inputBuffer,i=(r.playbackTime,o.sampleRate,o.length),s=o.duration,a=o.numberOfChannels,c=new Array(a),u=0;u=e&&(t._postMessageToWorker("getEncodedData"),n=0)}}},{key:"start",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.MAX_SAFE_INTEGER;if("inactive"!==this.state)throw new Error("DOMException: INVALID_STATE_ERR, state must be inactive.");if(e<0)throw new TypeError("invalid arguments, timeslice should be 0 or higher.");e/=1e3,"closed"===this.workerState&&this._spawnWorker(),this.context=new v;var t=this.stream.getAudioTracks();if(!t[0])throw new Error("DOMException: UnkownError, media track not found.");if(this.channelCount=t[0].getSettings().channelCount||1,this.sampleRate=this.context.sampleRate,this.source=this.context.createMediaStreamSource(this.stream),this.processor=this.context.createScriptProcessor(4096,this.channelCount,this.channelCount),this._state="recording",this._enableAudioProcessCallback(e),"readyToInit"===this.workerState){var n=this.sampleRate,r=this.channelCount;this._postMessageToWorker("init",{sampleRate:n,channelCount:r,bitsPerSecond:this.audioBitsPerSecond})}}},{key:"stop",value:function(){if("inactive"===this.state)throw new Error("DOMException: INVALID_STATE_ERR, state must NOT be inactive.");this.source.disconnect(),this.processor.disconnect(),this.context.close(),this._postMessageToWorker("done"),this._state="inactive"}},{key:"pause",value:function(){if("inactive"===this.state)throw new Error("DOMException: INVALID_STATE_ERR, state must NOT be inactive.");this.source.disconnect(),this.processor.disconnect();var e=new t.Event("pause");this.dispatchEvent(e),this._state="paused"}},{key:"resume",value:function(){if("inactive"===this.state)throw new Error("DOMException: INVALID_STATE_ERR, state must NOT be inactive.");this.source.connect(this.processor),this.processor.connect(this.context.destination);var e=new t.Event("resume");this.dispatchEvent(e),this._state="recording"}},{key:"requestData",value:function(){if("inactive"===this.state)throw new Error("DOMException: INVALID_STATE_ERR, state must NOT be inactive.");this._postMessageToWorker("getEncodedData")}},{key:"stream",get:function(){return this._stream}},{key:"mimeType",get:function(){return this._mimeType}},{key:"state",get:function(){return this._state}},{key:"videoBitsPerSecond",get:function(){}},{key:"audioBitsPerSecond",get:function(){return this._audioBitsPerSecond}}])&&a(n.prototype,r),i&&a(n,i),f}(h);["start","stop","dataavailable","pause","resume","error"].forEach((function(e){return y(w.prototype,e)})),m&&"edge"===m.name&&(p=Worker.prototype.postMessage,Worker.prototype.postMessage=function(e){p.apply(this,[e])}),e.exports=w}).call(this,n(1))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";n.r(t),n.d(t,"defineEventAttribute",(function(){return y})),n.d(t,"EventTarget",(function(){return v}));const r=new WeakMap,o=new WeakMap;function i(e){const t=r.get(e);return console.assert(null!=t,"'this' is expected an Event object, but got",e),t}function s(e,t){r.set(this,{eventTarget:e,event:t,eventPhase:2,currentTarget:e,canceled:!1,stopped:!1,passiveListener:null,timeStamp:t.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const n=Object.keys(t);for(let e=0;e0){const e=new Array(arguments.length);for(let t=0;t1)for(var n=1;n{ + ipcRenderer.send('wsapi-returnSearch', JSON.stringify(results)) + }) + }, + searchLibrary(term, limit) { + MusicKit.getInstance().api.library.search(term, {limit: limit, types: 'library-songs,library-artists,library-albums'}).then((results)=>{ + ipcRenderer.send('wsapi-returnSearchLibrary', JSON.stringify(results)) + }) + }, + moveQueueItem(oldPosition, newPosition) { + MusicKit.getInstance().queue._queueItems.splice(newPosition,0,MusicKit.getInstance().queue._queueItems.splice(oldPosition,1)[0]) + MusicKit.getInstance().queue._reindex() + }, + setAutoplay(value) { + MusicKit.getInstance().autoplayEnabled = value + }, + getPlaybackState () { + ipcRenderer.send('wsapi-updatePlaybackState', MusicKitInterop.getAttributes()); + }, + getLyrics() { + _lyrics.GetLyrics(1, false) + }, + getQueue() { + ipcRenderer.send('wsapi-returnQueue', JSON.stringify(MusicKit.getInstance().queue)) + }, + playNext(type, id) { + var request = {} + request[type] = id + MusicKit.getInstance().playNext(request) + }, + playLater(type, id) { + var request = {} + request[type] = id + MusicKit.getInstance().playLater(request) + }, + love() { + + }, + playTrackById(id) { + MusicKit.getInstance().setQueue({ song: id }).then(function (queue) { + MusicKit.getInstance().play() + }) + }, + quickPlay(term) { + // Quick play by song name + MusicKit.getInstance().api.search(term, { limit: 2, types: 'songs' }).then(function (data) { + MusicKit.getInstance().setQueue({ song: data["songs"][0]["id"] }).then(function (queue) { + MusicKit.getInstance().play() + }) + }) + }, + toggleShuffle() { + MusicKit.getInstance().shuffleMode = MusicKit.getInstance().shuffleMode === 0 ? 1 : 0 + }, + toggleRepeat() { + if(MusicKit.getInstance().repeatMode == 0) { + MusicKit.getInstance().repeatMode = 2 + }else if(MusicKit.getInstance().repeatMode == 2){ + MusicKit.getInstance().repeatMode = 1 + }else{ + MusicKit.getInstance().repeatMode = 0 + } + } +} \ No newline at end of file diff --git a/resources/js/backButton.js b/resources/js/backButton.js new file mode 100644 index 00000000..424d5091 --- /dev/null +++ b/resources/js/backButton.js @@ -0,0 +1,32 @@ +try { + if (MusicKit.getInstance().isAuthorized) { + + if (!document.querySelector('#backButtonBar')) { + document.getElementById('web-main').insertAdjacentHTML("afterbegin", ` +
+
+ Back Button +
+
+ `); + } + + if (document.getElementsByClassName('dragDiv right-aligned').length > 0) { + document.getElementById('backButtonBar').style.top = '25px' + } + + document.getElementById('web-main').addEventListener('scroll', function () { + if (document.getElementById('web-main').scrollTop > 80) { + document.getElementById('backButtonBar').style.backgroundColor = 'var(--playerBackground)'; + document.getElementById('backButtonBar').style.position = 'fixed'; + } else { + document.getElementById('backButtonBar').style.backgroundColor = 'transparent'; + document.getElementById('backButtonBar').style.position = 'absolute'; + } + }); + + + } +} catch (e) { + console.error("[JS] Error while trying to apply backButton.js", e); +} \ No newline at end of file diff --git a/resources/js/checkAuth.js b/resources/js/checkAuth.js new file mode 100644 index 00000000..ba77412e --- /dev/null +++ b/resources/js/checkAuth.js @@ -0,0 +1,19 @@ +try { + const preferences = ipcRenderer.sendSync('getStore'); + + if (MusicKit.getInstance().isAuthorized) { + let url = window.location.href; + if (preferences.general.startupPage !== "browse") { + if (preferences.general.startupPage.includes('library/')) { + url = `${window.location.origin}/${preferences.general.startupPage}`; + } else { + url = `${window.location.origin}/${MusicKit.getInstance().storefrontId}/${preferences.general.startupPage}`; + } + window.location.href = url; + } + + ipcRenderer.send('userAuthorized', url); + } +} catch (e) { + console.error("[JS] Error while trying to apply CheckAuth.js", e); +} \ No newline at end of file diff --git a/resources/js/custom.js b/resources/js/custom.js new file mode 100644 index 00000000..090140a8 --- /dev/null +++ b/resources/js/custom.js @@ -0,0 +1,1466 @@ + +try { + /* Add AM Lyrics Font JP, JR */ + var headID = document.getElementsByTagName('head')[0]; + var link = document.createElement('link'); + link.type = 'text/css'; + link.rel = 'stylesheet'; + link.setAttribute('name','fonts'); + headID.appendChild(link); + link.href = "//www.apple.com/wss/fonts?families=SF+Pro,v3|SF+Pro+Icons,v3|SF+Pro+KR,v2|SF+Pro+JP,v1"; + function GetXPath(path) { + return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; + } + + var setInnerHTML = function (elm, html) { + elm.innerHTML = html; + Array.from(elm.querySelectorAll("script")).forEach(oldScript => { + const newScript = document.createElement("script"); + Array.from(oldScript.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value)); + newScript.appendChild(document.createTextNode(oldScript.innerHTML)); + oldScript.parentNode.replaceChild(newScript, oldScript); + }); + }; + + function matchRuleShort(str, rule) { + var escapeRegex = (str) => str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1"); + return new RegExp("^" + rule.split("*").map(escapeRegex).join(".*") + "$").test(str); + } + + if (typeof activeEventListeners == "undefined") { + var activeEventListeners = {} + } + + var preferences = ipcRenderer.sendSync('getStore'); + + /* Variables that are utilised by the renderer */ + if (typeof AM == "undefined") { + var AM = { + acrylicSupported: false, + themesListing: [], + } + } + + /* Create the miniPlayer Functions */ + if (typeof _miniPlayer == "undefined") { + var _miniPlayer = { + active: false, + init() { + const webChrome = document.querySelector(".web-chrome"); + const elements = { + artwork: document.createElement("div"), + webNavContainer: document.querySelector("#web-navigation-container"), + menuicon: document.querySelector(".menuicon") + }; + elements.artwork.classList.add("miniPlayerArtwork"); + elements.artwork.style.display = "none"; + elements.artwork.addEventListener("contextmenu", () => { + ipcRenderer.send("show-miniplayer-menu"); + }); + elements.artwork.addEventListener("click", () => { + if (webChrome.style.display === "") { + webChrome.style.display = "flex"; + } else { + webChrome.style.display = ""; + } + }); + document.querySelector("#web-main").appendChild(elements.artwork); + if (window.innerWidth < 500) { + /* Resize if window was closed in Mini Player */ + ipcRenderer.send("resize-window", 1024, 600); + } + }, + setMiniPlayer(val) { + const webChrome = document.querySelector(".web-chrome"); + const artwork = document.querySelector(".miniPlayerArtwork"); + if (val) { + self.active = true; + document.body.setAttribute("data-miniplayer", 1); + artwork.style.display = "block"; + } else { + self.active = false; + webChrome.style.display = ""; + document.body.removeAttribute("data-miniplayer"); + artwork.style.display = "none"; + } + } + }; + } + + /* Lyrics Functions */ + if (typeof _lyrics == "undefined") { + var _lyrics = { + current: [], + events: [], + onchange (fn = ()=>{}) { + this.events.push(fn) + }, + setLyrics(lyrics) { + this.current = lyrics; + this.events.forEach((event)=>{ + event(lyrics); + }); + }, + CreateButton: () => { + + const mediaControlsElement = document.querySelector('.web-chrome-controls-container'); + + /* Chromecast / Airplay Button */ + if (!document.querySelector('#airplayButton') && mediaControlsElement) { + const lyricsButton = document.createElement("div"); + lyricsButton.style.height = "22px"; + lyricsButton.style.width = "30px"; + lyricsButton.style.marginInlineEnd = "12px"; + lyricsButton.style.zIndex = "9999"; + lyricsButton.innerHTML = ``; + lyricsButton.id = "airplayButton"; + lyricsButton.className = "web-chrome-playback-controls__platter-toggle-buttons web-chrome-playback-controls__meta-btn"; + mediaControlsElement.insertBefore(lyricsButton, mediaControlsElement.childNodes[4]); + } + /* Create the Button */ + if (!document.querySelector('[aria-label="Lyrics"]') && mediaControlsElement) { + const lyricsButton = document.createElement("div"); + lyricsButton.classList.add('web-chrome-playback-controls__platter-toggle-buttons', 'web-chrome-playback-control__lyrics-button'); + lyricsButton.style.marginInlineEnd = "0"; + lyricsButton.style.width = "auto"; + lyricsButton.style.zIndex = "9999"; + lyricsButton.innerHTML = ` + + `; + mediaControlsElement.insertBefore(lyricsButton, mediaControlsElement.childNodes[5]); + + + + let clonedElement2; + + clonedElement2 = document.querySelector('#airplayButton').cloneNode(true); + document.querySelector('#airplayButton').replaceWith(clonedElement2); + + document.getElementById("airplayButton").addEventListener('click', function () { + try{AudioOutputs.castUI(); + }catch(e){} + }); + + + /* Lyric View for MV */ + if (!document.querySelector('#MVLyricsBox')){ + const lyricsMV = document.createElement("div"); + lyricsMV.id = "MVLyricsBox"; + lyricsMV.style.zIndex = 9999999; + lyricsMV.style.backgroundColor= "rgba(0,0,0,0.7)"; + lyricsMV.style.display = "none"; + lyricsMV.style.color = "yellow"; + try{ + document.body.appendChild(lyricsMV);} + catch(e){} + lyricsMV.innerHTML = `
`; + + } + + /* Lyrics Button Click Event Handling */ + + const upNextSideBarToggle = mediaControlsElement.childNodes[6].getElementsByTagName('button')[0]; + let clonedElement; + if (document.querySelector("#lyricsButton") && upNextSideBarToggle) { + + function openLyrics() { + document.body.classList.add("web-chrome-drawer-open"); + document.body.classList.remove("web-chrome-drawer-opening"); + document.querySelector('.web-chrome-drawer').removeEventListener('animationend', openLyrics, true); + document.querySelector('#lyricsButton').style.fill = 'var(--playerPlatterButtonIconFill)'; + document.querySelector('#lyricsButton').style.boxShadow = '0 1px 1px rgb(0 0 0 / 10%)'; + document.querySelector('#lyricsButton').style.background = 'var(--playerPlatterButtonBGFill)'; + if (MusicKit.getInstance().nowPlayingItem == null) { + try { + document.getElementById('lyrics_none').classList.remove('lyrics_none_hidden'); + } catch (e) { + } + } else { + try { + document.getElementById('lyrics_none').classList.add('lyrics_none_hidden'); + } catch (e) { + } + } + if (document.getElementById('lyricer').childNodes[0].childNodes.length == null || document.getElementById('lyricer').childNodes[0].childNodes.length <= 1) { + _lyrics.GetLyrics(1, false); + } + } + function closeLyrics() { + document.body.classList.remove("web-chrome-drawer-open"); + document.body.classList.remove("web-chrome-drawer-closing"); + document.querySelector('.web-chrome-drawer').removeEventListener('animationend', closeLyrics, true); + document.querySelector('#lyricsButton').style.fill = 'var(--systemSecondary)'; + document.querySelector('#lyricsButton').style.boxShadow = 'none'; + document.querySelector('#lyricsButton').style.background = '0 0'; + } + + clonedElement = document.querySelector('#lyricsButton').cloneNode(true); + document.querySelector('#lyricsButton').replaceWith(clonedElement); + + + if (!document.getElementById("lyricer")) { + + const sidebar = document.querySelector('.web-chrome-drawer'); + if (sidebar) { + sidebar.innerHTML = `
Play a song to see the lyrics here.
`; + } + + let text = ""; + let lrc = new Lyricer(); + ipcRenderer.on('truelyrics', function (event, lrcfile) { + if (lrcfile.startsWith("netease=")) { + ipcRenderer.send('NetEaseLyricsHandler', lrcfile); + } else { + if (lrcfile!= null && lrcfile.length > 0) + + lrc.setLrc(lrcfile); + + } + }); + + ipcRenderer.on('lyricstranslation', function (event, data) { + lrc.setMXMTranslation(data); + }); + + ipcRenderer.on('backuplyrics', function (_event, _data) { + _lyrics.GetLyrics(1, true); + }); + + ipcRenderer.on('backuplyricsMV', function (_event, _data) { + _lyrics.GetLyrics(1, false); + }); + + ipcRenderer.on('ProgressTimeUpdate', function (event, data) { + if (data < 0) { + data = 0 + } + lrc.move(data); + }); + + + lrc.setLrc(text); + document.addEventListener("lyricerclick", function (e) { + ipcRenderer.send('ProgressTimeUpdateFromLyrics', e.detail.time); + document.body.setAttribute("background-color", `var(--systemToolbarTitlebarMaterialSover-inactive)`); + }); + + _lyrics.GetLyrics(2, false); + } + + document.getElementById("lyricsButton").addEventListener('click', function () { + if (document.querySelector('.web-chrome-drawer').querySelector('.web-navigation__up-next.web-chrome-up-next.up-next') == null) { + + if (document.getElementsByClassName("web-chrome-drawer-open").length === 0) { + document.querySelector('.web-chrome-drawer').addEventListener('animationend', openLyrics, true); + document.body.classList.add("web-chrome-drawer-opening"); + } else { + document.querySelector('.web-chrome-drawer').addEventListener('animationend', closeLyrics, true); + document.body.classList.add("web-chrome-drawer-closing"); + } + } else { + try { + /* Checks for clicks on the up next sidebar toggle button */ + if (upNextSideBarToggle.classList.contains('active')) { + upNextSideBarToggle.click(); + document.querySelector('.web-chrome-drawer').addEventListener('animationend', openLyrics, true); + document.body.classList.add("web-chrome-drawer-opening"); + } else { + document.querySelector('.web-chrome-drawer').style.backgroundColor = ""; + document.querySelector('.web-chrome-drawer').removeEventListener('animationend', openLyrics, true); + document.querySelector('.web-chrome-drawer').removeEventListener('animationend', closeLyrics, true); + } + } catch (e) { + console.error(e); + } + } + if (!document.getElementById("lyricer")) { + + const sidebar = document.querySelector('.web-chrome-drawer'); + if (sidebar) { + sidebar.innerHTML = `
Play a song to see the lyrics here.
`; + } + + let text = ""; + let lrc = new Lyricer(); + ipcRenderer.on('truelyrics', function (event, lrcfile) { + if (lrcfile.startsWith("netease=")) { + ipcRenderer.send('NetEaseLyricsHandler', lrcfile); + } else { + if (lrcfile!= null && lrcfile.length > 0) + lrc.setLrc(lrcfile); + } + }); + + ipcRenderer.on('lyricstranslation', function (event, data) { + lrc.setMXMTranslation(data); + }); + + ipcRenderer.on('backuplyrics', function (_event, _data) { + _lyrics.GetLyrics(1, true); + }); + + ipcRenderer.on('backuplyricsMV', function (_event, _data) { + _lyrics.GetLyrics(1, false); + }); + + ipcRenderer.on('ProgressTimeUpdate', function (event, data) { + if (data < 0) { + data = 0 + } + lrc.move(data); + }); + + + lrc.setLrc(text); + document.addEventListener("lyricerclick", function (e) { + ipcRenderer.send('ProgressTimeUpdateFromLyrics', e.detail.time); + document.body.setAttribute("background-color", `var(--systemToolbarTitlebarMaterialSover-inactive)`); + }); + + _lyrics.GetLyrics(2, false); + } + }, false); + + + upNextSideBarToggle.addEventListener('click', function () { + if (document.querySelector('#lyricsButton').style.fill === "var(--playerPlatterButtonIconFill)") { + document.querySelector('#lyricsButton').style.fill = 'var(--systemSecondary)'; + document.querySelector('#lyricsButton').style.boxShadow = 'none'; + document.querySelector('#lyricsButton').style.background = '0 0'; + } + }, false); + } + }}, + + GetLyrics: (mode, mxmfail) => { + const musicType = (MusicKit.getInstance().nowPlayingItem != null) ? MusicKit.getInstance().nowPlayingItem["type"] ?? '' : ''; + const trackName = encodeURIComponent((MusicKit.getInstance().nowPlayingItem != null) ? MusicKit.getInstance().nowPlayingItem.title ?? '' : ''); + const artistName = encodeURIComponent((MusicKit.getInstance().nowPlayingItem != null) ? MusicKit.getInstance().nowPlayingItem.artistName ?? '' : ''); + const songID = (MusicKit.getInstance().nowPlayingItem != null) ? MusicKit.getInstance().nowPlayingItem["_songId"] ?? -1 : -1; + const duration = encodeURIComponent(Math.round(MusicKitInterop.getAttributes()["durationInMillis"] / 1000)); + if (trackName !== '' && !(trackName === "No Title Found" && artistName === '')) { + /* MusixMatch Lyrics*/ + if(musicType === "musicVideo" && preferences.visual.yton){ + ipcRenderer.send('YTTranslation', trackName, artistName, preferences.visual.mxmlanguage); + } else/* MusixMatch Lyrics*/ + if (!mxmfail && preferences.visual.mxmon) { + ipcRenderer.send('MXMTranslation', trackName, artistName, preferences.visual.mxmlanguage, duration); + } + /* Apple Lyrics (from api lyric query) */ + else if (songID !== -1) { + MusicKit.getInstance().api.lyric(songID) + .then((response) => { + let seconds, + minutes, + hours, + rawTime, + milliseconds, + lrcTime; + + try { + const ttmlLyrics = response["ttml"]; + let lyrics = ""; + let synced = true; + const parser = new DOMParser(); + const doc = parser.parseFromString(ttmlLyrics, "text/xml"); + console.log('sdx',doc.getElementsByTagName('tt')[0].getAttribute("itunes:timing") === "None"); + if (doc.getElementsByTagName('tt')[0].getAttribute("itunes:timing") === "None"){ + synced = false; + } + const lyricsLines = doc.getElementsByTagName('p'); + const endTime = [0]; + if (synced) { + try { + for (let element of lyricsLines) { + rawTime = element.getAttribute('begin').match(/(\d+:)?(\d+:)?(\d+)(\.\d+)?/); + hours = (rawTime[2] != null) ? (rawTime[1].replace(":", "")) : "0"; + minutes = (rawTime[2] != null) ? (hours * 60 + rawTime[2].replace(":", "") * 1 + ":") : ((rawTime[1] != null) ? rawTime[1] : "00:"); + seconds = (rawTime[3] != null) ? (rawTime[3]) : "00"; + milliseconds = (rawTime[4] != null) ? (rawTime[4]) : ".000"; + lrcTime = minutes + seconds + milliseconds; + const rawTime2 = element.getAttribute('end').match(/(\d+:)?(\d+:)?(\d+)(\.\d+)?/); + const hours2 = (rawTime2[2] != null) ? (rawTime2[1].replace(":", "")) : "0"; + const minutes2 = (rawTime2[2] != null) ? (hours2 * 60 + rawTime2[2].replace(":", "") * 1 + ":") : ((rawTime2[1] != null) ? rawTime2[1] : "00:"); + const seconds2 = (rawTime2[3] != null) ? (rawTime2[3]) : "00"; + const milliseconds2 = (rawTime2[4] != null) ? (rawTime2[4]) : ".000"; + const lrcTime2 = minutes2 + seconds2 + milliseconds2; + if (minutes.replace(":", "") * 60 + seconds * 1 - endTime[endTime.length - 1] > 10) { + const time = endTime[endTime.length - 1]; + const minutes = Math.floor(time / 60); + const secs = time - minutes * 60; + lyrics = lyrics.concat(`[${minutes}:${secs}]lrcInstrumental` + "\r\n"); + } + endTime.push(minutes2.replace(":", "") * 60 + seconds2 * 1); + lyrics = lyrics.concat(`[${lrcTime}]${element.textContent}` + "\r\n"); + } + } catch { + lyrics = ""; + for (let element of lyricsLines) { + rawTime = element.getAttribute('begin').match(/(\d+:)?(\d+:)?(\d+)(\.\d+)?/); + hours = (rawTime[2] != null) ? (rawTime[1].replace(":", "")) : "0"; + minutes = (rawTime[2] != null) ? (hours * 60 + rawTime[2].replace(":", "") * 1 + ":") : ((rawTime[1] != null) ? rawTime[1] : "00:"); + seconds = (rawTime[3] != null) ? (rawTime[3]) : "00"; + milliseconds = (rawTime[4] != null) ? (rawTime[4]) : ".000"; + lrcTime = minutes + seconds + milliseconds; + lyrics = lyrics.concat(`[${lrcTime}]${element.textContent}` + "\r\n"); + } + }} + else { + try{ + var body = doc.getElementsByTagName('body')[0].innerHTML; + if (document.getElementById("lyricer")) { + var u = document.createElement('div'); + u.id = "unsynced"; + u.innerHTML = body; + if (!document.getElementById("unsynced")){ + document.getElementById("lyricer").appendChild(u);} else {console.log('duped')} + } + } catch(e){} + + } + let artworkURL = ((MusicKit.getInstance().nowPlayingItem != null) ? MusicKit.getInstance().nowPlayingItem.artworkURL : '').replace("{w}", 256).replace("{h}", 256); + if (artworkURL == null) { + artworkURL = "https://beta.music.apple.com/assets/product/MissingArtworkMusic.svg"; + } + if (mode === 1) { + ipcRenderer.send('LyricsUpdate', lyrics, artworkURL); + } else { + ipcRenderer.send('LyricsHandler', lyrics, artworkURL); + } + } catch (e) { + console.error(e); + if (mode === 1) { + ipcRenderer.send('LyricsUpdate', "netease=" + trackName + " " + artistName, artworkURL); + } else { + ipcRenderer.send('LyricsHandler', "netease=" + trackName + " " + artistName, artworkURL); + } + } + }) + .catch((err) => { + console.log(err); + let artworkURL = (MusicKitInterop.getAttributes()["artwork"]["url"]).replace("{w}", 256).replace("{h}", 256); + if (artworkURL == null) { + artworkURL = "https://beta.music.apple.com/assets/product/MissingArtworkMusic.svg"; + } + if (mode === 1) { + ipcRenderer.send('LyricsUpdate', "netease=" + trackName + " " + artistName, artworkURL); + } else { + ipcRenderer.send('LyricsHandler', "netease=" + trackName + " " + artistName, artworkURL); + } + }); + } + /* Apple Lyrics (from api song query */ + else { + try { + MusicKit.getInstance().api.library.song(MusicKit.getInstance().nowPlayingItem.id).then((data) => { + try { + if (data != null && data !== "") { + artworkURL = data["artwork"]["url"]; + } else { + artworkURL = "https://beta.music.apple.com/assets/product/MissingArtworkMusic.svg"; + } + } catch (e) { + artworkURL = "https://beta.music.apple.com/assets/product/MissingArtworkMusic.svg"; + } + if (mode === 1) { + ipcRenderer.send('LyricsUpdate', "netease=" + trackName + " " + artistName, artworkURL); + } else { + ipcRenderer.send('LyricsHandler', "netease=" + trackName + " " + artistName, artworkURL); + } + }); + } catch (e) { + console.error(e); + if (mode === 1) { + ipcRenderer.send('LyricsUpdate', "netease=" + trackName + " " + artistName, ''); + } else { + ipcRenderer.send('LyricsHandler', "netease=" + trackName + " " + artistName, ''); + } + } + } + } + } + } + + } + + /* Create the AMStyling Functions */ + if (typeof AMStyling == "undefined") { + var AMStyling = { + _styleSheets: { + Transparency: new CSSStyleSheet(), + Theme: new CSSStyleSheet(), + Meta: new CSSStyleSheet(), + Metrics: new CSSStyleSheet(), + Scaling: new CSSStyleSheet() + }, + wallpaper: "", + lastTheme: "", + micaActive: false, + metrics: { + lastScreenX: 0, + lastScreenY: 0 + }, + showThemeOptions() { + function throwNoTheme() { + new AMEModal({ + content: `
This theme has no available options.
`, + Style: { + width: "325px", + height: "200px" + } + }); + } + + if (this.lastTheme === "default" || this.lastTheme === "") { + throwNoTheme(); + return; + } + if (AM.themesListing[AMStyling.lastTheme]["options"].length === 0) { + throwNoTheme(); + return; + } + AMJavaScript.getRequest("ameres://html/theme-options.html", (content) => { + var vm = new Vue({ + data: { + options: AM.themesListing[AMStyling.lastTheme]["options"], + userOptions: AMStyling.getThemeOptions(AMStyling.lastTheme), + theme: AM.themesListing[AMStyling.lastTheme]["name"] + }, + methods: { + saveOptions() { + AMStyling.setThemeOptions(AMStyling.lastTheme, this.userOptions); + }, + close() { + modal.close(); + } + } + }); + var modal = new AMEModal({ + content: content, + CloseButton: false, + OnCreate() { + vm.$mount("#themeOptions-vue") + }, + OnClose() { + _vues.destroy(vm) + }, + Style: { + width: "50%", + height: "80%" + } + }) + }); + }, + getThemeOptions(theme) { + if (!localStorage.getItem("ThemeOptions")) { + localStorage.setItem("ThemeOptions", "{}"); + } + var userOptions = JSON.parse(localStorage.getItem("ThemeOptions")); + if (!userOptions[theme]) { + userOptions[theme] = {}; + } + + function parseBool(val) { + return !(val === 0 || val === "false" || val === false); + } + + AM.themesListing[theme]["options"].forEach((option) => { + if (typeof userOptions[theme][option.key] == "undefined" || userOptions[theme][option.key] == null) { + userOptions[theme][option.key] = parseBool(option.defaultValue); + } + }); + localStorage.setItem("ThemeOptions", JSON.stringify(userOptions)); + return userOptions[theme]; + }, + setThemeOptions(theme, options = {}) { + if (!localStorage.getItem("ThemeOptions")) { + localStorage.setItem("ThemeOptions", "{}"); + } + let userOptions = JSON.parse(localStorage.getItem("ThemeOptions")); + if (!userOptions[theme]) { + userOptions[theme] = {}; + } + userOptions[theme] = options; + localStorage.setItem("ThemeOptions", JSON.stringify(userOptions)); + this.refresh(); + }, + getWallpaper() { + this.wallpaper = ipcRenderer.sendSync("get-wallpaper"); + this.updateMetrics() + }, + updateMetrics() { + this._styleSheets.Metrics.replaceSync(` + :root { + --user-wallpaper: url('${this.wallpaper}'); + --screenX: ${window.screenX}px; + --screenY: ${window.screenY}px; + --screenHeight: ${screen.height}px; + --screenWidth: ${screen.width}px; + } + body::before { + display: none; + } + `); + this.refresh(); + }, + windowsWallpaperStyles: { + fill: 10, + fit: 6, + stretch: 2, + tile: 0, + span: 22 + }, + updateMica() { + if (!this.micaActive) { + return; + } + var micaElement = document.querySelector(".micaBackground"); + var style = ipcRenderer.sendSync("get-wallpaper-style"); + switch (style) { + default: + case 0: + case 2: + case 6: + case 10: + micaElement.style.backgroundSize = "repeat"; + break; + case 22: + micaElement.style.backgroundSize = "cover"; + break; + } + + }, + setMica(val = false) { + if (val) { + this.enableMica(); + } else { + this.disableMica(); + } + }, + disableMica() { + if (!this.micaActive) { + return; + } + this.micaActive = false; + document.querySelector(".micaBackground").remove(); + }, + enableMica() { + let self = this; + if (this.micaActive) { + console.log("Mica is already active"); + return; + } + if (this.lastTheme !== "winui") { + if (confirm("This feature currently requires the Eleven theme, enable now?")) { + this.loadTheme("winui"); + } + } + this.micaActive = true; + var micaDOM = document.createElement("div"); + micaDOM.classList.add("micaBackground"); + document.body.appendChild(micaDOM); + this.getWallpaper(); + this.setTransparency(false); + + function onScreenMove(cb) { + let lastScreenX; + let lastScreenY; + + function detectScreenMove() { + if (lastScreenY !== window.screenY || lastScreenX !== window.screenX) { + lastScreenY = window.screenY; + lastScreenX = window.screenX; + cb(); + } + if (self.micaActive) { + requestAnimationFrame(detectScreenMove); + } + } + + if (self.micaActive) { + requestAnimationFrame(detectScreenMove); + } + } + + onScreenMove(function () { + micaDOM.style.backgroundPosition = `${window.screenX * -1}px ${window.screenY * -1}px`; + /**micaDOM.style.backgroundSize = `${screen.width}px ${screen.height}px`;**/ + micaDOM.style.backgroundSize = `cover`; + }); + }, + loadTheme(path = "", reload = false) { + if (path === this.lastTheme && !reload) { + return; + } + this.lastTheme = path; + let self = this; + if (path === "" || path === " " || path === "default") { + self._styleSheets.Theme.replaceSync(""); + self.refresh(); + return; + } + + ipcRenderer.invoke('themeFileExists', path).then((r) => { + if (r) { + const xhttp = new XMLHttpRequest(); + xhttp.onload = function () { + self._styleSheets.Theme.replaceSync(this.responseText); + self.refresh(); + }; + xhttp.open("GET", `themes://${path}.css`, true); + xhttp.send(); + console.warn("[Custom] Applied Theme"); + } else { + console.error(`[Custom] ${path} does not exist.`) + } + }) + + + }, + updateMeta() { + + if (MusicKit.getInstance().nowPlayingItem == null) { + try { + document.getElementById('lyrics_none').classList.remove('lyrics_none_hidden'); + } catch (e) { + } + } else { + try { + document.getElementById('lyrics_none').classList.add('lyrics_none_hidden'); + } catch (e) { + } + } + + console.warn("[Custom] Refreshed Meta CSS"); + /** Exposes artwork and other metadata to CSS for themes */ + let artwork = MusicKit.getInstance().nowPlayingItem["attributes"]["artwork"]["url"]; + /* Fix Itunes Match album arts not showing */ + if (artwork === '' || !artwork) { + try { + MusicKit.getInstance().api.library.song(MusicKit.getInstance().nowPlayingItem.id).then((data) => { + if (data !== "") { + artwork = data["artwork"]["url"]; + document.querySelector('#ember13').getElementsByTagName('img')[0].src = artwork; + this._styleSheets.Meta.replaceSync(` + :root { + --musicKit-artwork-64: url("${artwork.replace("{w}", 64).replace("{h}", 64)}"); + --musicKit-artwork-256: url("${artwork.replace("{w}", 256).replace("{h}", 256)}"); + --musicKit-artwork-512: url("${artwork.replace("{w}", 512).replace("{h}", 512)}"); + --musicKit-artwork: url("${artwork.replace("{w}", 2000).replace("{h}", 2000)}"); + } + `); + + if (MusicKit.getInstance().nowPlayingItem.title != "" & !(MusicKit.getInstance().nowPlayingItem.title == "No Title Found" && MusicKit.getInstance().nowPlayingItem.artistName == "")){ + ipcRenderer.send('updateMiniPlayerArt',artwork.replace("{w}", 2000).replace("{h}", 2000)); + ipcRenderer.send('updateMiniPlayerMetaData',MusicKit.getInstance().nowPlayingItem.title,MusicKit.getInstance().nowPlayingItem.artistName,MusicKit.getInstance().nowPlayingItem.albumName); + ipcRenderer.send('setupNewTrack',MusicKit.getInstance().nowPlayingItem.title,MusicKit.getInstance().nowPlayingItem.artistName,MusicKit.getInstance().nowPlayingItem.albumName,artwork.replace("{w}", 256).replace("{h}", 256));} + + + this.refresh(); + } + }); + } catch (e) { + console.error(e); + } + } + + this._styleSheets.Meta.replaceSync(` + :root { + --musicKit-artwork-64: url("${artwork.replace("{w}", 64).replace("{h}", 64)}"); + --musicKit-artwork-256: url("${artwork.replace("{w}", 256).replace("{h}", 256)}"); + --musicKit-artwork-512: url("${artwork.replace("{w}", 512).replace("{h}", 512)}"); + --musicKit-artwork: url("${artwork.replace("{w}", 2000).replace("{h}", 2000)}"); + } + `); + if ( (artwork === '' || !artwork) && MusicKit.getInstance().nowPlayingItem.title != "" & !(MusicKit.getInstance().nowPlayingItem.title == "No Title Found" && MusicKit.getInstance().nowPlayingItem.artistName == "")){ + ipcRenderer.send('updateMiniPlayerArt',artwork.replace("{w}", 2000).replace("{h}", 2000)); + ipcRenderer.send('updateMiniPlayerMetaData',MusicKit.getInstance().nowPlayingItem.title,MusicKit.getInstance().nowPlayingItem.artistName,MusicKit.getInstance().nowPlayingItem.albumName); + ipcRenderer.send('setupNewTrack',MusicKit.getInstance().nowPlayingItem.title,MusicKit.getInstance().nowPlayingItem.artistName,MusicKit.getInstance().nowPlayingItem.albumName,artwork.replace("{w}", 256).replace("{h}", 256));} + + this.refresh(); + }, + setTransparency(val) { + let self = this; + if (val) { + const xhttp = new XMLHttpRequest(); + xhttp.onload = function () { + self._styleSheets.Transparency.replaceSync(this.responseText); + self.refresh(); + }; + xhttp.open("GET", `ameres://css/transparency.css`, true); + xhttp.send(); + } else { + self._styleSheets.Transparency.replaceSync(`html body { background-color: var(--pageBG) !important; }`); + } + }, + refresh() { + document.adoptedStyleSheets = Object.values(this._styleSheets); + /** Theme Options **/ + if (AM.themesListing[this.lastTheme]) { + var themeOptions = (this.getThemeOptions(this.lastTheme)); + Object.keys(themeOptions).forEach((option) => { + if (themeOptions[option]) { + document.body.setAttribute(`theme-${option}`, 1); + } else { + document.body.removeAttribute(`theme-${option}`); + } + }) + } + }, + lerp: (start, end, l) => { + return start + (end - start) * l; + } + }; + } + + /* Bulk AME JavaScript Functions */ + if (typeof AMJavaScript == "undefined") { + var AMJavaScript = { + getQuery(q) { + return (window.location.search.match(new RegExp('[?&]' + q + '=([^&]+)')) || [undefined, null])[1]; + }, + getRequest: (url, callback = () => { + }) => { + const xhttp = new XMLHttpRequest(); + xhttp.onload = function () { + callback(this.responseText); + }; + xhttp.open("GET", url, true); + xhttp.send(); + }, + LoadCustomStartup: async () => { + const preferences = ipcRenderer.sendSync('getStore'); + + /** Plugins */ + if (typeof _plugins != "undefined") { + await ipcRenderer.invoke("fetchPluginsListing").then((plugins) => { + console.log(plugins); + plugins.forEach((plugin) => { + _plugins.loadPlugin(plugin); + }); + }) + } + /** End Plugins */ + + /** Expose platform to CSS */ + document.body.setAttribute("platform", navigator.platform); + + if (preferences.visual.frameType === "") { + document.body.setAttribute("frame-type", "disabled"); + } else { + document.body.setAttribute("frame-type", preferences.visual.frameType); + } + + /* MiniPlayer Event Listener */ + MusicKit.getInstance().addEventListener(MusicKit.Events.mediaElementCreated, () => { + if (!document.querySelector('.media-artwork-v2__image').classList.contains('media-artwork-v2__image--fallback')) { + const artwork = document.querySelector('#ember13'); + artwork.onclick = function () { + ipcRenderer.send("set-miniplayer", true); + }; + /* Picture-in-picture icon should be overlayed over artwork when mouse over */ + } + }); + + /* Audio Quality Selector */ + if (preferences.audio.audioQuality === 'extreme') { + console.warn("[Custom] Setting bitrate to 990."); + MusicKit.getInstance().bitrate = 990; + } else if (preferences.audio.audioQuality === 'high') { + console.warn("[Custom] Setting bitrate to 256."); + MusicKit.getInstance().bitrate = 256; + } else if (preferences.audio.audioQuality === 'standard') { + console.warn("[Custom] Setting bitrate to 64."); + MusicKit.getInstance().bitrate = 64; + } + + /* Seamless (Apple dont know how to spell) Audio Playback */ + if (preferences.audio.seamlessAudioTransitions) { + console.warn("[Custom] Seamless Audio Transitions enabled."); + MusicKit.getInstance()._bag.features["seamless-audio-transitions"] = true; + } + + /* Incognito Mode */ + if (preferences.general.incognitoMode) { + MusicKit.privateEnabled = true + } + + /* Event Listener for Lyrics Update */ + MusicKit.getInstance().addEventListener(MusicKit.Events.playbackTimeDidChange, function () { + ipcRenderer.send('LyricsTimeUpdate', MusicKit.getInstance().currentPlaybackTime + 0.250); + }); + MusicKit.getInstance().addEventListener(MusicKit.Events.nowPlayingItemDidChange, function () { + var EAtmpdisable = false; + var tempOutputID = -1; + try{ + if (MusicKit.getInstance().nowPlayingItem["type"] === "musicVideo") { + try{ + if(!GCOverride ){ + MVsource = AMEx.context.createMediaElementSource(document.querySelector('apple-music-video-player').shadowRoot.querySelector('amp-video-player-internal').shadowRoot.querySelector('amp-video-player').shadowRoot.getElementById('apple-music-video-player')); + MVsource.connect(windowAudioNode); + } + + } catch(e){console.log(e);} + } else{ + if (!GCOverride ) { + try{ + AMEx.result.source.connect(windowAudioNode);} + catch(e){}} + } + }catch(e){} + try{ + if (MusicKit.getInstance().nowPlayingItem["type"] === "musicVideo") { + document.querySelector(`#MVLyricsBox`).style.display = 'block'; + } else { + document.querySelector(`#MVLyricsBox`).style.display = 'none'; + } + document.querySelector(`#MVLyricsBox`).childNodes[0].innerHTML= ""; + document.querySelector(`#MVLyricsBox`).childNodes[1].innerHTML= ""; + } + catch (e){} + try { + GetXPath("/html/body/div[4]/div[3]/div[3]/div/div[2]/div[1]/img").src = "https://music.apple.com/assets/product/MissingArtworkMusic.svg"; + } catch (e) { + } + try { + let lrc = new Lyricer(); + lrc.setLrc(""); + lrc = null; + } catch (e) { + } + + const sidebar = document.querySelector('.web-chrome-drawer'); + if ((sidebar && document.body.classList.contains('web-chrome-drawer-open')) || (MusicKit.getInstance().nowPlayingItem != null && MusicKit.getInstance().nowPlayingItem["type"] == "musicVideo")) { + _lyrics.GetLyrics(1, false); + } + + + }); + + /* Mutation Observer to disable "seek error" alert */ + let observer = new MutationObserver(function (mutationList) { + for (const mutation of mutationList) { + for (const child of mutation.addedNodes) { + try { + if (document.getElementById("mk-dialog-title").textContent === "cancelled" || document.getElementById("mk-dialog-title").textContent.includes("The play") || document.getElementById("mk-dialog-title").textContent.includes("MEDIA_KEY")) { + document.getElementById("musickit-dialog").remove(); + document.getElementById("musickit-dialog-scrim").remove(); + break; + } + } catch (e) { + break; + } + } + } + + }); + observer.observe(document.body, {childList: true}); + + /* Load Themes and Transparency */ + AMStyling.loadTheme(preferences["visual"]["theme"]); + if (preferences["visual"]["transparencyEffect"] !== "" && preferences["visual"]["transparencyEffect"] !== "mica") { + AMStyling.setTransparency(true); + } else { + AMStyling.setTransparency(false); + } + + if (preferences["visual"]["transparencyEffect"] === "mica") { + AMStyling.setMica(true); + } else { + AMStyling.setMica(false); + } + + AM.themesListing = await ipcRenderer.invoke('updateThemesListing'); + AM.acrylicSupported = await ipcRenderer.invoke('isAcrylicSupported'); + + if (await ipcRenderer.invoke('getStoreValue', 'general.storefront') !== MusicKit.getInstance().storefrontId) { + await ipcRenderer.invoke('setStoreValue', 'general.storefront', MusicKit.getInstance().storefrontId); + } + + /** Need a better way to find the user menu asap, this is embarrassing **/ + if(MusicKit.getInstance().authorizationStatus !== 0) { + var checkForUserMenu = setInterval(function () { + if (document.querySelectorAll(".web-chrome-controls-container>.web-navigation__auth").length) { + _tests.usermenuinit(); + clearInterval(checkForUserMenu); + } + }, 100); + } + + }, + LoadCustom: () => { + const preferences = ipcRenderer.sendSync('getStore'); + + /* Execute plugins OnNavigation */ + if (typeof _plugins != "undefined") { + _plugins.execute("OnNavigation"); + } + + /* Remove the Region Banner */ + while (document.getElementsByClassName('locale-switcher-banner').length > 0) { + document.getElementsByClassName('locale-switcher-banner')[0].remove() + } + + /* Create the Custom Settings Context Menu */ + const buttonPath = (preferences.visual.frameType === 'mac-right' ? '//*[@id="web-main"]/div[4]/div/div[3]/div[3]/button' : '//*[@id="web-main"]/div[3]/div/div[3]/div[3]/button'); + if (GetXPath(buttonPath)) { + GetXPath(buttonPath).addEventListener('click', function () { + try { + if (document.querySelector('.context-menu__option--app-settings')) { + if (preferences.advanced.verboseLogging) console.log("[settingsInit] Preventing second button."); + return; + } + + const ul = GetXPath("/html/body/div[6]/ul"); + + const amPreferences = GetXPath('/html/body/div[6]/ul/li[2]'); + GetXPath('/html/body/div[6]/ul/li[2]/span/span').innerHTML = 'Preferences'; + ul.insertBefore(amPreferences, ul.childNodes[9]); + + const amSettings = document.createElement("li"); + amSettings.innerHTML = ` + + Account Settings + + + + + + `; + amSettings.classList.add("context-menu__option--am-settings"); + amSettings.classList.add("context-menu__option"); + amSettings.onclick = function () { + window.open(`https://music.apple.com/account/settings`) + }; + ul.insertBefore(amSettings, ul.childNodes[8]); + + const amDiscord = document.createElement("li"); + amDiscord.innerHTML = ` + + Discord + + + + + `; + amDiscord.classList.add("context-menu__option--am-discord"); + amDiscord.classList.add("context-menu__option"); + amDiscord.onclick = function () { + window.open(`https://discord.gg/CezHYdXHEM`) + }; + ul.insertBefore(amDiscord, ul.childNodes[4]); + + if (typeof _plugins != "undefined") { + /** Plugin menu items */ + _plugins.menuitems.forEach((item) => { + var element = document.createElement("li"); + var textSpan = document.createElement("span"); + textSpan.classList.add("context-menu__option-text"); + element.appendChild(textSpan); + textSpan.innerHTML = item.Text; + element.addEventListener("click", item.OnClick); + element.addEventListener("click", () => { + document.querySelector(".context-menu-outside-click-area").dispatchEvent(new Event("click")); + }); + element.classList.add("context-menu__option"); + ul.appendChild(element); + }); + /** End plugin menu items */ + } + } catch (e) {}}); + } + + /* Scroll Volume */ + if (document.querySelector('.web-chrome-playback-lcd__volume') && typeof volumeChange === 'undefined' && document.querySelector('.web-chrome-playback-lcd__volume').getAttribute('listener') !== 'true' && !activeEventListeners['web-chrome-playback-lcd__volume']) { + function checkScrollDirectionIsUp(event) { + if (event.wheelDelta) { + return event.wheelDelta > 0; + } + return event.deltaY < 0; + } + + function volumeChange(event) { + if (checkScrollDirectionIsUp(event)) { + if (MusicKit.getInstance().volume <= 1) { + if ((MusicKit.getInstance().volume + 0.05) > 1) { + MusicKit.getInstance().volume = 1 + } else { + MusicKit.getInstance().volume += 0.05; + } + } + } else { + if (MusicKit.getInstance().volume >= 0) { + if ((MusicKit.getInstance().volume - 0.05) < 0) { + MusicKit.getInstance().volume = 0; + } else { + MusicKit.getInstance().volume -= 0.05; + } + } + } + } + + document.getElementsByClassName('web-chrome-playback-lcd__volume')[0].addEventListener('wheel', volumeChange); + activeEventListeners['web-chrome-playback-lcd__volume'] = true + } + + /* Context Menu Creation (From PR #221 by @SiverDX) */ + const SongContextMenu = { + simulateClick: (element, clientX, clientY) => { + let event = new MouseEvent('click', { + clientX: clientX, + clientY: clientY + }); + + element.dispatchEvent(event); + }, + + createListeners: () => { + /* Check if the user is on the library song list or on playlist/album */ + const clickRegion = (document.getElementsByClassName("songs-list-row").length === 0 ? document.getElementsByClassName("library-track") : document.getElementsByClassName("songs-list-row")); + + /* Loop through each row/song and add event listener */ + for (let area of clickRegion) { + area.addEventListener('contextmenu', function (event) { + event.preventDefault(); + + let control = area.getElementsByClassName("context-menu__overflow ")[0]; + + if (control) { + SongContextMenu.simulateClick(control, event.clientX, event.clientY); + } + }); + } + + } + }; + SongContextMenu.createListeners(); + + /* Remove Apple Logo */ + if (preferences['visual']['removeAppleLogo']) { + while (document.getElementsByClassName('web-navigation__header web-navigation__header--logo').length > 0) { + document.getElementsByClassName('web-navigation__header web-navigation__header--logo')[0].remove(); + } + } + + /* Remove Footer */ + if (!matchRuleShort(window.location.href, '*settings*') && document.getElementsByClassName('application-preferences').length === 0) { + if (preferences['visual']['removeFooter'] && document.querySelector('footer').style.display !== "none") { + document.querySelector('.dt-footer').style.display = "none"; + } else if (!preferences['visual']['removeFooter'] && document.querySelector('footer').style.display === "none") { + document.querySelector('.dt-footer').style.display = "block"; + } + } + + + /* Remove Upsell */ + if (preferences['visual']['removeUpsell']) { + while (document.getElementsByClassName('web-navigation__native-upsell').length > 0) { + document.getElementsByClassName('web-navigation__native-upsell')[0].remove(); + } + } + + /* Initialize the miniPlayer */ + _miniPlayer.init(); + + /* Create the Lyrics Button */ + _lyrics.CreateButton(); + + if(typeof wsapi !== "undefined") { + _lyrics.onchange((lyrics)=>{ + ipcRenderer.send('wsapi-returnLyrics', JSON.stringify(lyrics)); + }); + }else{ + console.warn("WSAPI not found"); + } + } + }; + + /* Load the Startup Files as This is the First Time its been Run */ + AMJavaScript.LoadCustomStartup().catch((e) => console.error(e)); + } + + /* Functions used in Settings Page */ + if (typeof AMSettings == "undefined") { + var AMSettings = { + revealCollapse: () => { + const elem = document.querySelector('#advanced'); + if (elem.classList.contains('revealed')) { + /* Collapse Category */ + elem.classList.remove('revealed'); + document.querySelector('.header-nav-image').src = 'ameres://icons/webui/down.svg'; + } else { + /* Reveal the Category */ + elem.classList.add('revealed'); + document.querySelector('.header-nav-image').src = 'ameres://icons/webui/up.svg'; + } + }, + + lastfm: { + LastFMDeauthorize: () => { + ipcRenderer.invoke('setStoreValue', 'general.lastfm', false).catch((e) => console.error(e)); + ipcRenderer.invoke('setStoreValue', 'tokens.lastfm', '').catch((e) => console.error(e)); + const element = document.getElementById('lfmConnect'); + element.innerHTML = 'Connect'; + element.onclick = AMSettings.lastfm.LastFMAuthenticate; + }, + LastFMAuthenticate: () => { + const element = document.getElementById('lfmConnect'); + window.open('https://www.last.fm/api/auth?api_key=174905d201451602407b428a86e8344d&cb=ame://auth/lastfm'); + element.innerText = 'Connecting...'; + + /* Just a timeout for the button */ + setTimeout(() => { + if (element.innerText === 'Connecting...') { + element.innerText = 'Connect'; + console.warn('[LastFM] Attempted connection timed out.'); + } + }, 20000); + + ipcRenderer.on('LastfmAuthenticated', function (_event, lfmAuthKey) { + element.innerHTML = `Disconnect\n

(Authed: ${lfmAuthKey})

`; + element.onclick = AMSettings.lastfm.LastFMDeauthorize; + }); + } + }, + + createNotification: (changed) => { + if (typeof changed !== 'object' || !changed || (Object.keys(changed).length === 0 && changed.constructor === Object)) { + return; + } + + let changedHTML = ``, + changedFull = ``, + addedHTML = ``, + addedFull = ``; + + for (let [key, value] of Object.entries(changed)) { + key = key.split('.')[0]; + key = key.charAt(0).toUpperCase() + key.slice(1); + + if (value === 'updated') { + changedHTML += `
  • ${key}
  • `; + } else if (value === 'added') { + addedHTML += `
  • ${key}
  • `; + } + } + + if (changedHTML !== '') { + changedFull = ` +

    The following themes have been updated:

    +
      + ${changedHTML} +
    + ` + } + + if (addedHTML !== '') { + addedFull = ` +

    The following themes have been added:

    +
      + ${addedHTML} +
    + ` + } + + new AMEModal({ + content: ` +
    + ${changedFull} + ${addedFull} +
    `, + Style: { + width: "auto", + minWidth: "386px", + maxWidth: "100%", + minHeight: "300px", + maxHeight: "100%", + height: "auto", + padding: "46px", + } + }); + }, + + themes: { + updateThemesListing: (listing) => { + let themesListingHTML = `\n`; + for (const [fileName, theme] of Object.entries(listing)) { + themesListingHTML = themesListingHTML + `\n`; + } + document.getElementById('theme').innerHTML = themesListingHTML; + console.warn('[Custom][updateThemes] Themes Listing Updated!'); + }, + updateThemes: () => { + document.getElementById('updateThemes').innerText = 'Updating...'; + ipcRenderer.invoke('updateThemes').then(listing => { + setTimeout(async () => { + AM.themesListing = await ipcRenderer.invoke('updateThemesListing'); + AMSettings.themes.updateThemesListing(AM.themesListing); + document.querySelector('#updateThemes').innerHTML = (AM.themesListing ? 'Themes Updated' : 'Error'); + document.querySelector('#updateThemes').classList.add(AM.themesListing ? 'success' : 'failure'); + AMSettings.createNotification(listing); + }, 2000) + }) + } + }, + + copyLogFile: () => { + const returnValue = ipcRenderer.sendSync('copyLogFile'); + document.querySelector('#copyLogFile').innerHTML = (returnValue ? 'Copied to Clipboard' : 'Copy Failed'); + document.querySelector('#copyLogFile').classList.add(returnValue ? 'success' : 'failure'); + }, + + hasParentClass: (child, classname) => { + if (child.className.split(' ').indexOf(classname) >= 0) return true; + try { + return child.parentNode && AMSettings.hasParentClass(child.parentNode, classname); + } catch (TypeError) { + return false; + } + }, + + HandleField: (element) => { + const field = document.getElementById(element); + if (!field) { + console.error('[HandleField] Element Not Found'); + return; + } + + let category; + if (AMSettings.hasParentClass(field, 'general')) { + category = 'general'; + } else if (AMSettings.hasParentClass(field, 'visual')) { + category = 'visual'; + } else if (AMSettings.hasParentClass(field, 'audio')) { + category = 'audio'; + } else if (AMSettings.hasParentClass(field, 'window')) { + category = 'window'; + } else if (AMSettings.hasParentClass(field, 'advanced')) { + category = 'advanced'; + } else { + console.error('[HandleField] No Parent Category Found.'); + return; + } + + /* Toggles */ + if (AMSettings.hasParentClass(field, 'toggle-element')) { + field.checked = preferences[category][element]; + field.addEventListener('change', (event) => { + ipcRenderer.invoke('setStoreValue', `${category}.${element}`, event.target.checked).catch((err) => console.error(err)); + }); + console.warn(`[HandleField] Event listener created for ${category}.${element}`) + } + /* Dropdowns */ + else if (field.classList.contains('form-dropdown-select')) { + field.value = preferences[category][element]; + field.addEventListener('change', (event) => { + ipcRenderer.invoke('setStoreValue', `${category}.${element}`, event.target.value).catch((err) => console.error(err)); + }); + console.warn(`[HandleField] Event listener created for ${category}.${element}`) + } + /* LastFM Connect Button */ + else if (field.id === "lfmConnect") { + ipcRenderer.invoke('getStoreValue', 'tokens.lastfm').then((token) => { + if (token) { + field.innerHTML = `Disconnect\n

    (Authed: ${token})

    `; + field.onclick = AMSettings.lastfm.LastFMDeauthorize; + } + }) + } + }, + + CreateMenu: (parent) => { + preferences = ipcRenderer.sendSync('getStore'); + + AMJavaScript.getRequest("ameres://html/preferences-main.html", (content) => { + document.getElementsByClassName(parent)[0].innerHTML = content; + + if (document.querySelector('footer')) { + document.querySelector('.dt-footer').style.display = "block"; + document.querySelector('.dt-footer').classList.add('app-prefs-credits'); + AMJavaScript.getRequest("ameres://html/preferences-footer.html", (content) => { + document.querySelector('.dt-footer').innerHTML = content; + }) + } + + AMSettings.themes.updateThemesListing(AM.themesListing); + + /* Adjust Preferences Menu if Acrylic is not Supported */ + if (AM.acrylicSupported) { + document.getElementById('transparencyEffect').innerHTML = document.getElementById('transparencyEffect').innerHTML + "\n"; + document.getElementById('transparencyEffect').innerHTML = document.getElementById('transparencyEffect').innerHTML + "\n"; + } else { + document.getElementById('transparencyDisableBlurToggleLI').remove(); + } + + /* Remove System Accent Toggle if its not win32/darwin */ + ipcRenderer.invoke('fetchOperatingSystem').then((platform) => { + if (platform !== "win32" && platform !== "darwin") { + document.getElementById('useOperatingSystemAccentToggleLI').remove(); + } + }); + + /* General Settings */ + AMSettings.HandleField('incognitoMode'); + AMSettings.HandleField('playbackNotifications'); + AMSettings.HandleField('trayTooltipSongName'); + AMSettings.HandleField('startupPage'); + AMSettings.HandleField('analyticsEnabled'); + AMSettings.HandleField('discordRPC'); + AMSettings.HandleField('discordClearActivityOnPause'); + AMSettings.HandleField('lfmConnect'); + AMSettings.HandleField('lastfmRemoveFeaturingArtists'); + AMSettings.HandleField('lastfmNowPlaying'); + AMSettings.HandleField('lastfmScrobbleDelay'); + + /* Visual Settings */ + AMSettings.HandleField('theme'); + AMSettings.HandleField('frameType'); + AMSettings.HandleField('transparencyEffect'); + AMSettings.HandleField('transparencyTheme'); + AMSettings.HandleField('transparencyDisableBlur'); + AMSettings.HandleField('transparencyMaximumRefreshRate'); + AMSettings.HandleField('yton'); + AMSettings.HandleField('mxmon'); + AMSettings.HandleField('mxmlanguage'); + AMSettings.HandleField('streamerMode'); + AMSettings.HandleField('removeUpsell'); + AMSettings.HandleField('removeAppleLogo'); + AMSettings.HandleField('removeFooter'); + AMSettings.HandleField('removeScrollbars'); + AMSettings.HandleField('useOperatingSystemAccent'); + AMSettings.HandleField('scaling'); + + /* Audio Settings */ + AMSettings.HandleField('audioQuality'); + AMSettings.HandleField('seamlessAudioTransitions'); + AMSettings.HandleField('castingBitDepth'); + AMSettings.HandleField('enableDLNA'); + AMSettings.HandleField('volume'); + + + /* Window Settings */ + AMSettings.HandleField('appStartupBehavior'); + AMSettings.HandleField('closeButtonMinimize'); + + /* Advanced Settings */ + AMSettings.HandleField('forceApplicationMode'); + AMSettings.HandleField('hardwareAcceleration'); + AMSettings.HandleField('verboseLogging'); + AMSettings.HandleField('alwaysOnTop'); + AMSettings.HandleField('autoUpdaterBetaBuilds'); + AMSettings.HandleField('useBetaSite'); + AMSettings.HandleField('preventMediaKeyHijacking'); + AMSettings.HandleField('devToolsOnStartup'); + AMSettings.HandleField('allowMultipleInstances'); + }) + } + } + } + +} catch (e) { + console.error("[JS] Error while trying to apply custom.js", e); +} \ No newline at end of file diff --git a/resources/js/encoderWorker.umd.js b/resources/js/encoderWorker.umd.js new file mode 100644 index 00000000..52b73acc --- /dev/null +++ b/resources/js/encoderWorker.umd.js @@ -0,0 +1,1747 @@ +(function OpusMediaWorkerUMD(root, factory) { + if (typeof WorkerGlobalScope !== 'undefined' && + self instanceof WorkerGlobalScope) { + var initWorker = factory(); + initWorker(); + } else if (typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if (typeof define === 'function' && define.amd) + define([], factory); + else if (typeof exports === 'object') + exports["encoderWorker"] = factory(); + else + root["encoderWorker"] = factory(); +})(typeof OpusMediaRecorder !== 'undefined' ? OpusMediaRecorder : typeof self !== 'undefined' ? self : this, function() { + return function() { + ! function(e) { + var t = {}; + + function n(r) { + if (t[r]) return t[r].exports; + var o = t[r] = { + i: r, + l: !1, + exports: {} + }; + return e[r].call(o.exports, o, o.exports, n), o.l = !0, o.exports + } + n.m = e, n.c = t, n.d = function(e, t, r) { + n.o(e, t) || Object.defineProperty(e, t, { + enumerable: !0, + get: r + }) + }, n.r = function(e) { + "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { + value: "Module" + }), Object.defineProperty(e, "__esModule", { + value: !0 + }) + }, n.t = function(e, t) { + if (1 & t && (e = n(e)), 8 & t) return e; + if (4 & t && "object" == typeof e && e && e.__esModule) return e; + var r = Object.create(null); + if (n.r(r), Object.defineProperty(r, "default", { + enumerable: !0, + value: e + }), 2 & t && "string" != typeof e) + for (var o in e) n.d(r, o, function(t) { + return e[t] + }.bind(null, o)); + return r + }, n.n = function(e) { + var t = e && e.__esModule ? function() { + return e.default + } : function() { + return e + }; + return n.d(t, "a", t), t + }, n.o = function(e, t) { + return Object.prototype.hasOwnProperty.call(e, t) + }, n.p = "", n(n.s = 5) + }([function(e, t, n) { + (function(e) { + function n(e, t) { + for (var n = 0, r = e.length - 1; r >= 0; r--) { + var o = e[r]; + "." === o ? e.splice(r, 1) : ".." === o ? (e.splice(r, 1), n++) : n && (e.splice(r, 1), n--) + } + if (t) + for (; n--; n) e.unshift(".."); + return e + } + + function r(e, t) { + if (e.filter) return e.filter(t); + for (var n = [], r = 0; r < e.length; r++) t(e[r], r, e) && n.push(e[r]); + return n + } + t.resolve = function() { + for (var t = "", o = !1, i = arguments.length - 1; i >= -1 && !o; i--) { + var u = i >= 0 ? arguments[i] : e.cwd(); + if ("string" != typeof u) throw new TypeError("Arguments to path.resolve must be strings"); + u && (t = u + "/" + t, o = "/" === u.charAt(0)) + } + return (o ? "/" : "") + (t = n(r(t.split("/"), (function(e) { + return !!e + })), !o).join("/")) || "." + }, t.normalize = function(e) { + var i = t.isAbsolute(e), + u = "/" === o(e, -1); + return (e = n(r(e.split("/"), (function(e) { + return !!e + })), !i).join("/")) || i || (e = "."), e && u && (e += "/"), (i ? "/" : "") + e + }, t.isAbsolute = function(e) { + return "/" === e.charAt(0) + }, t.join = function() { + var e = Array.prototype.slice.call(arguments, 0); + return t.normalize(r(e, (function(e, t) { + if ("string" != typeof e) throw new TypeError("Arguments to path.join must be strings"); + return e + })).join("/")) + }, t.relative = function(e, n) { + function r(e) { + for (var t = 0; t < e.length && "" === e[t]; t++); + for (var n = e.length - 1; n >= 0 && "" === e[n]; n--); + return t > n ? [] : e.slice(t, n - t + 1) + } + e = t.resolve(e).substr(1), n = t.resolve(n).substr(1); + for (var o = r(e.split("/")), i = r(n.split("/")), u = Math.min(o.length, i.length), a = u, s = 0; s < u; s++) + if (o[s] !== i[s]) { + a = s; + break + } var c = []; + for (s = a; s < o.length; s++) c.push(".."); + return (c = c.concat(i.slice(a))).join("/") + }, t.sep = "/", t.delimiter = ":", t.dirname = function(e) { + if ("string" != typeof e && (e += ""), 0 === e.length) return "."; + for (var t = e.charCodeAt(0), n = 47 === t, r = -1, o = !0, i = e.length - 1; i >= 1; --i) + if (47 === (t = e.charCodeAt(i))) { + if (!o) { + r = i; + break + } + } else o = !1; + return -1 === r ? n ? "/" : "." : n && 1 === r ? "/" : e.slice(0, r) + }, t.basename = function(e, t) { + var n = function(e) { + "string" != typeof e && (e += ""); + var t, n = 0, + r = -1, + o = !0; + for (t = e.length - 1; t >= 0; --t) + if (47 === e.charCodeAt(t)) { + if (!o) { + n = t + 1; + break + } + } else -1 === r && (o = !1, r = t + 1); + return -1 === r ? "" : e.slice(n, r) + }(e); + return t && n.substr(-1 * t.length) === t && (n = n.substr(0, n.length - t.length)), n + }, t.extname = function(e) { + "string" != typeof e && (e += ""); + for (var t = -1, n = 0, r = -1, o = !0, i = 0, u = e.length - 1; u >= 0; --u) { + var a = e.charCodeAt(u); + if (47 !== a) - 1 === r && (o = !1, r = u + 1), 46 === a ? -1 === t ? t = u : 1 !== i && (i = 1) : -1 !== t && (i = -1); + else if (!o) { + n = u + 1; + break + } + } + return -1 === t || -1 === r || 0 === i || 1 === i && t === r - 1 && t === n + 1 ? "" : e.slice(t, r) + }; + var o = "b" === "ab".substr(-1) ? function(e, t, n) { + return e.substr(t, n) + } : function(e, t, n) { + return t < 0 && (t = e.length + t), e.substr(t, n) + } + }).call(this, n(2)) + }, function(e, t) { + function n(e) { + return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { + return typeof e + } : function(e) { + return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e + })(e) + } + + function r(e, t) { + if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function"); + e.prototype = Object.create(t && t.prototype, { + constructor: { + value: e, + writable: !0, + configurable: !0 + } + }), t && o(e, t) + } + + function o(e, t) { + return (o = Object.setPrototypeOf || function(e, t) { + return e.__proto__ = t, e + })(e, t) + } + + function i(e) { + var t = function() { + if ("undefined" == typeof Reflect || !Reflect.construct) return !1; + if (Reflect.construct.sham) return !1; + if ("function" == typeof Proxy) return !0; + try { + return Date.prototype.toString.call(Reflect.construct(Date, [], (function() {}))), !0 + } catch (e) { + return !1 + } + }(); + return function() { + var n, r = a(e); + if (t) { + var o = a(this).constructor; + n = Reflect.construct(r, arguments, o) + } else n = r.apply(this, arguments); + return u(this, n) + } + } + + function u(e, t) { + return !t || "object" !== n(t) && "function" != typeof t ? function(e) { + if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return e + }(e) : t + } + + function a(e) { + return (a = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) { + return e.__proto__ || Object.getPrototypeOf(e) + })(e) + } + + function s(e, t) { + if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") + } + + function c(e, t) { + for (var n = 0; n < t.length; n++) { + var r = t[n]; + r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) + } + } + + function f(e, t, n) { + return t && c(e.prototype, t), n && c(e, n), e + } + var l = function() { + function e(t, n, r, o) { + switch (s(this, e), this._size = n, this._module = t, this._size) { + case 1: + this._heapArray = r ? this._module.HEAP8 : this._module.HEAPU8; + break; + case 2: + this._heapArray = r ? this._module.HEAP16 : this._module.HEAPU16; + break; + case 4: + this._heapArray = r ? this._module.HEAP32 : this._module.HEAPU32; + break; + default: + this._heapArray = this._module.HEAPU8 + } + o && (this._size = 4, this._heapArray = this._module.HEAPF32), this._pointer = this._module._malloc(n) + } + return f(e, [{ + key: "free", + value: function() { + this._module._free(this.pointer) + } + }, { + key: "pointer", + get: function() { + return this._pointer + } + }, { + key: "value", + get: function() { + var e = 0; + switch (this._size) { + case 2: + e = 1; + break; + case 4: + e = 2; + break; + default: + throw new Error("Pointer can be only deferenced as integer-sized") + } + return this._heapArray[this.pointer >> e] + }, + set: function(e) { + var t = 0; + switch (this._size) { + case 2: + t = 1; + break; + case 4: + t = 2; + break; + default: + throw new Error("Pointer can be only deferenced as integer-sized") + } + this._heapArray[this.pointer >> t] = e + } + }]), e + }(), + p = function(e) { + r(n, e); + var t = i(n); + + function n(e, r) { + var o; + return s(this, n), o = t.call(this, e, 4, !0, !1), void 0 !== r && (o.value = r), o + } + return n + }(l), + _ = function(e) { + r(n, e); + var t = i(n); + + function n(e, r) { + var o; + return s(this, n), o = t.call(this, e, 4, !1, !1), void 0 !== r && (o.value = r), o + } + return n + }(l), + d = function(e) { + r(n, e); + var t = i(n); + + function n(e, r, o, i, u) { + var a; + s(this, n), a = t.call(this, e, r * o, i, u); + var c = 0; + switch (o) { + case 1: + a._heapArray = i ? a._module.HEAP8 : a._module.HEAPU8, c = 0; + break; + case 2: + a._heapArray = i ? a._module.HEAP16 : a._module.HEAPU16, c = 1; + break; + case 4: + a._heapArray = i ? a._module.HEAP32 : a._module.HEAPU32, c = 2; + break; + default: + throw new Error("Unit size must be an integer-size") + } + u && (a._heapArray = a._module.HEAPF32, c = 2); + var f = a._pointer >> c; + return a._buffer = a._heapArray.subarray(f, f + r), a._length = r, a + } + return f(n, [{ + key: "set", + value: function(e, t) { + this._buffer.set(e, t) + } + }, { + key: "subarray", + value: function(e, t) { + return this._buffer.subarray(e, t) + } + }, { + key: "length", + get: function() { + return this._length + } + }]), n + }(l), + h = function(e) { + r(n, e); + var t = i(n); + + function n(e, r) { + return s(this, n), t.call(this, e, r, 4, !0, !0) + } + return n + }(d), + m = function(e) { + r(n, e); + var t = i(n); + + function n(e, r) { + return s(this, n), t.call(this, e, r, 1, !1, !1) + } + return n + }(d), + y = function() { + function e(t) { + s(this, e), this._module = t + } + return f(e, [{ + key: "mallocInt32", + value: function(e) { + return new p(this._module, e) + } + }, { + key: "mallocUint32", + value: function(e) { + return new _(this._module, e) + } + }, { + key: "mallocUint8Buffer", + value: function(e) { + return new m(this._module, e) + } + }, { + key: "mallocFloat32Buffer", + value: function(e) { + return new h(this._module, e) + } + }]), e + }(); + e.exports = { + writeString: function(e, t, n) { + for (var r = 0; r < n.length; r++) e.setUint8(t + r, n.charCodeAt(r)) + }, + EmscriptenMemoryAllocator: y + } + }, function(e, t) { + var n, r, o = e.exports = {}; + + function i() { + throw new Error("setTimeout has not been defined") + } + + function u() { + throw new Error("clearTimeout has not been defined") + } + + function a(e) { + if (n === setTimeout) return setTimeout(e, 0); + if ((n === i || !n) && setTimeout) return n = setTimeout, setTimeout(e, 0); + try { + return n(e, 0) + } catch (t) { + try { + return n.call(null, e, 0) + } catch (t) { + return n.call(this, e, 0) + } + } + }! function() { + try { + n = "function" == typeof setTimeout ? setTimeout : i + } catch (e) { + n = i + } + try { + r = "function" == typeof clearTimeout ? clearTimeout : u + } catch (e) { + r = u + } + }(); + var s, c = [], + f = !1, + l = -1; + + function p() { + f && s && (f = !1, s.length ? c = s.concat(c) : l = -1, c.length && _()) + } + + function _() { + if (!f) { + var e = a(p); + f = !0; + for (var t = c.length; t;) { + for (s = c, c = []; ++l < t;) s && s[l].run(); + l = -1, t = c.length + } + s = null, f = !1, + function(e) { + if (r === clearTimeout) return clearTimeout(e); + if ((r === u || !r) && clearTimeout) return r = clearTimeout, clearTimeout(e); + try { + r(e) + } catch (t) { + try { + return r.call(null, e) + } catch (t) { + return r.call(this, e) + } + } + }(e) + } + } + + function d(e, t) { + this.fun = e, this.array = t + } + + function h() {} + o.nextTick = function(e) { + var t = new Array(arguments.length - 1); + if (arguments.length > 1) + for (var n = 1; n < arguments.length; n++) t[n - 1] = arguments[n]; + c.push(new d(e, t)), 1 !== c.length || f || a(_) + }, d.prototype.run = function() { + this.fun.apply(null, this.array) + }, o.title = "browser", o.browser = !0, o.env = {}, o.argv = [], o.version = "", o.versions = {}, o.on = h, o.addListener = h, o.once = h, o.off = h, o.removeListener = h, o.removeAllListeners = h, o.emit = h, o.prependListener = h, o.prependOnceListener = h, o.listeners = function(e) { + return [] + }, o.binding = function(e) { + throw new Error("process.binding is not supported") + }, o.cwd = function() { + return "/" + }, o.chdir = function(e) { + throw new Error("process.chdir is not supported") + }, o.umask = function() { + return 0 + } + }, function(e, t) { + e.exports = function(e) { + return e.webpackPolyfill || (e.deprecate = function() {}, e.paths = [], e.children || (e.children = []), Object.defineProperty(e, "loaded", { + enumerable: !0, + get: function() { + return e.l + } + }), Object.defineProperty(e, "id", { + enumerable: !0, + get: function() { + return e.i + } + }), e.webpackPolyfill = 1), e + } + }, function(e, t) {}, function(e, t, n) { + function r(e) { + var t, r = n(6), + o = n(7), + i = n(8); + e.onmessage = function(e) { + var n = e.data.command; + switch (n) { + case "loadEncoder": + var u, a = e.data, + s = a.mimeType, + c = a.wasmPath; + switch (s) { + case "audio/wav": + case "audio/wave": + u = r; + break; + case "audio/webm": + u = o; + break; + case "audio/ogg": + u = i + } + var f = {}; + c && (f.locateFile = function(e, t) { + return e.match(/.wasm/) ? c : t + e + }), u(f).then((function(e) { + t = e, self.postMessage({ + command: "readyToInit" + }) + })); + break; + case "init": + var l = e.data, + p = l.sampleRate, + _ = l.channelCount, + d = l.bitsPerSecond; + t.init(p, _, d); + break; + case "pushInputData": + for (var h = e.data, m = h.channelBuffers, y = (h.length, h.duration, 0); y < m.length; y++) m[y] = new Float32Array(m[y].buffer); + t.encode(m); + break; + case "getEncodedData": + case "done": + "done" === n && t.close(); + var v = t.flush(); + self.postMessage({ + command: "done" === n ? "lastEncodedData" : "encodedData", + buffers: v + }, v), "done" === n && self.close() + } + } + } + "undefined" != typeof WorkerGlobalScope && self instanceof WorkerGlobalScope && r(self), e.exports = r + }, function(e, t, n) { + function r(e) { + return function(e) { + if (Array.isArray(e)) return o(e) + }(e) || function(e) { + if ("undefined" != typeof Symbol && Symbol.iterator in Object(e)) return Array.from(e) + }(e) || function(e, t) { + if (!e) return; + if ("string" == typeof e) return o(e, t); + var n = Object.prototype.toString.call(e).slice(8, -1); + "Object" === n && e.constructor && (n = e.constructor.name); + if ("Map" === n || "Set" === n) return Array.from(e); + if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return o(e, t) + }(e) || function() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.") + }() + } + + function o(e, t) { + (null == t || t > e.length) && (t = e.length); + for (var n = 0, r = new Array(t); n < t; n++) r[n] = e[n]; + return r + } + + function i(e, t) { + for (var n = 0; n < t.length; n++) { + var r = t[n]; + r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) + } + } + var u = n(1).writeString, + a = 3, + s = function() { + function e(t, n, r) { + ! function(e, t) { + if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") + }(this, e), this.config = { + inputSampleRate: t, + channelCount: n + }, this.encodedBuffers = [] + } + var t, n, r; + return t = e, (n = [{ + key: "encode", + value: function(e) { + for (var t = e[0].length, n = new ArrayBuffer(t * a * this.config.channelCount), r = new DataView(n), o = 0; o < this.config.channelCount; o++) + for (var i = e[o], u = 0; u < t; u++) { + var s = 8388607 * i[u] | 0; + s > 8388607 ? s = 8388607 : s < -8388608 && (s = -8388608 ); + var c = (u * this.config.channelCount + o) * a; + var valz = 0 | s; + var uinx = valz & 0xff; + r.setUint8(c, uinx); + var uiny =(valz & 0xff00) >> 8; + r.setUint8(c+1, uiny); + var uinz =(valz & 0xff0000) >> 16; + r.setUint8(c+2, uinz); + } + this.encodedBuffers.push(n) + } + }, { + key: "getHeader", + value: function() { + var e = this.encodedBuffers.reduce((function(e, t) { + return e + t.byteLength + }), 0), + t = new ArrayBuffer(44), + n = new DataView(t); + return u(n, 0, "RIFF"), n.setUint32(4, 36 + e, !0), u(n, 8, "WAVE"), u(n, 12, "fmt "), n.setUint32(16, 16, !0), n.setUint16(20, 1, !0), n.setUint16(22, this.config.channelCount, !0), n.setUint32(24, this.config.inputSampleRate, !0), n.setUint32(28, this.config.inputSampleRate * a * this.config.channelCount, !0), n.setUint16(32, a * this.config.channelCount, !0), n.setUint16(34, 8 * a, !0), u(n, 36, "data"), n.setUint32(40, e, !0), t + } + }]) && i(t.prototype, n), r && i(t, r), e + }(); + e.exports = function(e) { + return new Promise((function(t, n) { + (e = void 0 !== e && e || {}).init = function(t, n, r) { + e.encoder = new s(t, n, r) + }, e.encode = function(t) { + e.encoder.encode(t) + }, e.flush = function() { + var t = e.encoder.getHeader(), + n = e.encoder.encodedBuffers.splice(0, e.encoder.encodedBuffers.length); + return [t].concat(r(n)) + }, e.close = function() {}, t(e) + })) + } + }, function(e, t, n) { + (function(e, r, o, i) { + var u; + + function a(e) { + return (a = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { + return typeof e + } : function(e) { + return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e + })(e) + } + + function s(e, t) { + if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") + } + + function c(e, t) { + for (var n = 0; n < t.length; n++) { + var r = t[n]; + r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) + } + } + + function f(e, t, n) { + return t && c(e.prototype, t), n && c(e, n), e + } + var l, p = (l = (l = "undefined" != typeof document && document.currentScript ? document.currentScript.src : void 0) || e, function(e) { + e = void 0 !== (e = e || {}) ? e : {}; + var t = n(1), + i = t.EmscriptenMemoryAllocator, + u = 2049, + c = 48e3, + p = 4e3, + _ = 20, + d = 6, + h = 4096, + m = 0, + y = 4002, + v = 0, + b = function() { + function t(n, r) { + var o = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0; + s(this, t), this.config = { + inputSampleRate: n, + channelCount: r + }, this.memory = new i(e), this._opus_encoder_create = e._opus_encoder_create, this._opus_encoder_ctl = e._opus_encoder_ctl, this._opus_encode_float = e._opus_encode_float, this._opus_encoder_destroy = e._opus_encoder_destroy, this._speex_resampler_init = e._speex_resampler_init, this._speex_resampler_process_interleaved_float = e._speex_resampler_process_interleaved_float, this._speex_resampler_destroy = e._speex_resampler_destroy, this._container = new e.Container, this._container.init(c, r, Math.floor(4294967295 * Math.random())), this.OpusInitCodec(c, r, o), this.SpeexInitResampler(n, c, r), this.inputSamplesPerChannel = n * _ / 1e3, this.outputSamplePerChannel = c * _ / 1e3, this.inputBufferIndex = 0, this.mInputBuffer = this.memory.mallocFloat32Buffer(this.inputSamplesPerChannel * r), this.mResampledBuffer = this.memory.mallocFloat32Buffer(this.outputSamplePerChannel * r), this.mOutputBuffer = this.memory.mallocUint8Buffer(p), this.interleavedBuffers = 1 !== r ? new Float32Array(h * r) : void 0 + } + return f(t, [{ + key: "encode", + value: function(e) { + for (var t = this.interleave(e), n = 0; n < t.length;) { + var r = Math.min(this.mInputBuffer.length - this.inputBufferIndex, t.length - n); + if (this.mInputBuffer.set(t.subarray(n, n + r), this.inputBufferIndex), this.inputBufferIndex += r, this.inputBufferIndex >= this.mInputBuffer.length) { + var o = this.memory.mallocUint32(this.inputSamplesPerChannel), + i = this.memory.mallocUint32(this.outputSamplePerChannel), + u = this._speex_resampler_process_interleaved_float(this.resampler, this.mInputBuffer.pointer, o.pointer, this.mResampledBuffer.pointer, i.pointer); + if (o.free(), i.free(), u !== v) throw new Error("Resampling error."); + var a = this._opus_encode_float(this.encoder, this.mResampledBuffer.pointer, this.outputSamplePerChannel, this.mOutputBuffer.pointer, this.mOutputBuffer.length); + if (a < 0) throw new Error("Opus encoding error."); + this._container.writeFrame(this.mOutputBuffer.pointer, a, this.outputSamplePerChannel), this.inputBufferIndex = 0 + } + n += r + } + } + }, { + key: "close", + value: function() { + for (var t = this.config.channelCount, n = [], r = 0; r < t; ++r) n.push(new Float32Array(h - this.inputBufferIndex / t)); + this.encode(n), e.destroy(this._container), this.mInputBuffer.free(), this.mResampledBuffer.free(), this.mOutputBuffer.free(), this._opus_encoder_destroy(this.encoder), this._speex_resampler_destroy(this.resampler) + } + }, { + key: "interleave", + value: function(e) { + var t = e.length; + if (1 === t) return e[0]; + for (var n = 0; n < t; n++) + for (var r = e[n], o = 0; o < r.length; o++) this.interleavedBuffers[o * t + n] = r[o]; + return this.interleavedBuffers + } + }, { + key: "OpusInitCodec", + value: function(e, t) { + var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0, + r = this.memory.mallocUint32(void 0); + this.encoder = this._opus_encoder_create(e, t, u, r.pointer); + var o = r.value; + if (r.free(), o !== m) throw new Error("Opus encodor initialization failed."); + n && this.OpusSetOpusControl(y, n) + } + }, { + key: "OpusSetOpusControl", + value: function(e, t) { + var n = this.memory.mallocInt32(t); + this._opus_encoder_ctl(this.encoder, e, n.pointer), n.free() + } + }, { + key: "SpeexInitResampler", + value: function(e, t, n) { + var r = this.memory.mallocUint32(void 0); + this.resampler = this._speex_resampler_init(n, e, t, d, r.pointer); + var o = r.value; + if (r.free(), o !== v) throw new Error("Initializing resampler failed.") + } + }]), t + }(); + e.init = function(t, n, r) { + e.encodedBuffers = [], e.encoder = new b(t, n, r) + }, e.encode = function(t) { + e.encoder.encode(t) + }, e.flush = function() { + return e.encodedBuffers.splice(0, e.encodedBuffers.length) + }, e.close = function() { + e.encoder.close() + }; + var g, w = {}; + for (g in e) e.hasOwnProperty(g) && (w[g] = e[g]); + var A = [], + C = !1, + S = !1, + x = !1, + P = !1; + C = "object" === ("undefined" == typeof window ? "undefined" : a(window)), S = "function" == typeof importScripts, x = "object" === (void 0 === r ? "undefined" : a(r)) && "object" === a(r.versions) && "string" == typeof r.versions.node, P = !C && !x && !S; + var E, B, I, R, O = ""; + + function j(t) { + return e.locateFile ? e.locateFile(t, O) : O + t + } + x ? (O = S ? n(0).dirname(O) + "/" : o + "/", E = function(e, t) { + return I || (I = n(4)), R || (R = n(0)), e = R.normalize(e), I.readFileSync(e, t ? null : "utf8") + }, B = function(e) { + var t = E(e, !0); + return t.buffer || (t = new Uint8Array(t)), W(t.buffer), t + }, r.argv.length > 1 && r.argv[1].replace(/\\/g, "/"), A = r.argv.slice(2), r.on("uncaughtException", (function(e) { + if (!(e instanceof qe)) throw e + })), r.on("unhandledRejection", _e), e.inspect = function() { + return "[Emscripten Module object]" + }) : P ? ("undefined" != typeof read && (E = function(e) { + return read(e) + }), B = function(e) { + var t; + return "function" == typeof readbuffer ? new Uint8Array(readbuffer(e)) : (W("object" === a(t = read(e, "binary"))), t) + }, "undefined" != typeof scriptArgs ? A = scriptArgs : void 0 !== arguments && (A = arguments), "undefined" != typeof print && ("undefined" == typeof console && (console = {}), console.log = print, console.warn = console.error = "undefined" != typeof printErr ? printErr : print)) : (C || S) && (S ? O = self.location.href : document.currentScript && (O = document.currentScript.src), l && (O = l), O = 0 !== O.indexOf("blob:") ? O.substr(0, O.lastIndexOf("/") + 1) : "", E = function(e) { + var t = new XMLHttpRequest; + return t.open("GET", e, !1), t.send(null), t.responseText + }, S && (B = function(e) { + var t = new XMLHttpRequest; + return t.open("GET", e, !1), t.responseType = "arraybuffer", t.send(null), new Uint8Array(t.response) + })); + var k, U, T = e.print || console.log.bind(console), + F = e.printErr || console.warn.bind(console); + for (g in w) w.hasOwnProperty(g) && (e[g] = w[g]); + w = null, e.arguments && (A = e.arguments), e.thisProgram && e.thisProgram, e.quit && e.quit, e.wasmBinary && (k = e.wasmBinary), e.noExitRuntime && e.noExitRuntime, "object" !== ("undefined" == typeof WebAssembly ? "undefined" : a(WebAssembly)) && F("no native wasm support detected"); + var H = new WebAssembly.Table({ + initial: 60, + maximum: 60, + element: "anyfunc" + }), + M = !1; + + function W(e, t) { + e || _e("Assertion failed: " + t) + } + var D = "undefined" != typeof TextDecoder ? new TextDecoder("utf8") : void 0; + + function z(e, t, n) { + for (var r = t + n, o = t; e[o] && !(o >= r);) ++o; + if (o - t > 16 && e.subarray && D) return D.decode(e.subarray(t, o)); + for (var i = ""; t < o;) { + var u = e[t++]; + if (128 & u) { + var a = 63 & e[t++]; + if (192 != (224 & u)) { + var s = 63 & e[t++]; + if ((u = 224 == (240 & u) ? (15 & u) << 12 | a << 6 | s : (7 & u) << 18 | a << 12 | s << 6 | 63 & e[t++]) < 65536) i += String.fromCharCode(u); + else { + var c = u - 65536; + i += String.fromCharCode(55296 | c >> 10, 56320 | 1023 & c) + } + } else i += String.fromCharCode((31 & u) << 6 | a) + } else i += String.fromCharCode(u) + } + return i + } + + function L(e, t) { + return e ? z(q, e, t) : "" + } + "undefined" != typeof TextDecoder && new TextDecoder("utf-16le"); + var V, q, N, G = 65536; + + function X(t) { + V = t, e.HEAP8 = new Int8Array(t), e.HEAP16 = new Int16Array(t), e.HEAP32 = N = new Int32Array(t), e.HEAPU8 = q = new Uint8Array(t), e.HEAPU16 = new Uint16Array(t), e.HEAPU32 = new Uint32Array(t), e.HEAPF32 = new Float32Array(t), e.HEAPF64 = new Float64Array(t) + } + var Y = 5289024, + $ = 45984, + J = e.INITIAL_MEMORY || 16777216; + + function K(t) { + for (; t.length > 0;) { + var n = t.shift(); + if ("function" != typeof n) { + var r = n.func; + "number" == typeof r ? void 0 === n.arg ? e.dynCall_v(r) : e.dynCall_vi(r, n.arg) : r(void 0 === n.arg ? null : n.arg) + } else n() + } + }(U = e.wasmMemory ? e.wasmMemory : new WebAssembly.Memory({ + initial: J / G, + maximum: J / G + })) && (V = U.buffer), J = V.byteLength, X(V), N[$ >> 2] = Y; + var Q = [], + Z = [], + ee = [], + te = []; + + function ne() { + if (e.preRun) + for ("function" == typeof e.preRun && (e.preRun = [e.preRun]); e.preRun.length;) ue(e.preRun.shift()); + K(Q) + } + + function re() { + K(Z) + } + + function oe() { + K(ee) + } + + function ie() { + if (e.postRun) + for ("function" == typeof e.postRun && (e.postRun = [e.postRun]); e.postRun.length;) ae(e.postRun.shift()); + K(te) + } + + function ue(e) { + Q.unshift(e) + } + + function ae(e) { + te.unshift(e) + } + var se = 0, + ce = null, + fe = null; + + function le(t) { + se++, e.monitorRunDependencies && e.monitorRunDependencies(se) + } + + function pe(t) { + if (se--, e.monitorRunDependencies && e.monitorRunDependencies(se), 0 == se && (null !== ce && (clearInterval(ce), ce = null), fe)) { + var n = fe; + fe = null, n() + } + } + + function _e(t) { + throw e.onAbort && e.onAbort(t), T(t += ""), F(t), M = !0, t = "abort(" + t + "). Build with -s ASSERTIONS=1 for more info.", new WebAssembly.RuntimeError(t) + } + e.preloadedImages = {}, e.preloadedAudios = {}; + var de = "data:application/octet-stream;base64,"; + + function he(e) { + return String.prototype.startsWith ? e.startsWith(de) : 0 === e.indexOf(de) + } + var me = "WebMOpusEncoder.wasm"; + + function ye() { + try { + if (k) return new Uint8Array(k); + if (B) return B(me); + throw "both async and sync fetching of the wasm failed" + } catch (e) { + _e(e) + } + } + + function ve() { + return k || !C && !S || "function" != typeof fetch ? new Promise((function(e, t) { + e(ye()) + })) : fetch(me, { + credentials: "same-origin" + }).then((function(e) { + if (!e.ok) throw "failed to load wasm binary file at '" + me + "'"; + return e.arrayBuffer() + })).catch((function() { + return ye() + })) + } + + function be() { + var t = { + a: Te + }; + + function n(t, n) { + var r = t.exports; + e.asm = r, pe() + } + + function r(e) { + n(e.instance) + } + + function o(e) { + return ve().then((function(e) { + return WebAssembly.instantiate(e, t) + })).then(e, (function(e) { + F("failed to asynchronously prepare wasm: " + e), _e(e) + })) + } + if (le(), e.instantiateWasm) try { + return e.instantiateWasm(t, n) + } catch (e) { + return F("Module.instantiateWasm callback failed with error: " + e), !1 + } + return function() { + if (k || "function" != typeof WebAssembly.instantiateStreaming || he(me) || "function" != typeof fetch) return o(r); + fetch(me, { + credentials: "same-origin" + }).then((function(e) { + return WebAssembly.instantiateStreaming(e, t).then(r, (function(e) { + F("wasm streaming compile failed: " + e), F("falling back to ArrayBuffer instantiation"), o(r) + })) + })) + }(), {} + } + + function ge(t, n) { + var r = new Uint8Array(e.HEAPU8.buffer, t, n); + e.encodedBuffers.push(new Uint8Array(r).buffer) + } + + function we(e, t, n, r) { + _e("Assertion failed: " + L(e) + ", at: " + [t ? L(t) : "unknown filename", n, r ? L(r) : "unknown function"]) + } + he(me) || (me = j(me)), Z.push({ + func: function() { + Me() + } + }); + var Ae = { + mappings: {}, + buffers: [null, [], + [] + ], + printChar: function(e, t) { + var n = Ae.buffers[e]; + 0 === t || 10 === t ? ((1 === e ? T : F)(z(n, 0)), n.length = 0) : n.push(t) + }, + varargs: void 0, + get: function() { + return Ae.varargs += 4, N[Ae.varargs - 4 >> 2] + }, + getStr: function(e) { + return L(e) + }, + get64: function(e, t) { + return e + } + }; + + function Ce(e, t, n) { + return Ae.varargs = n, 0 + } + + function Se(e, t, n) { + Ae.varargs = n + } + + function xe(e, t, n) { + return Ae.varargs = n, 0 + } + + function Pe() { + _e() + } + + function Ee(e, t, n) { + q.copyWithin(e, t, t + n) + } + + function Be(e) { + _e("OOM") + } + + function Ie(e) { + Be() + } + + function Re(e) { + return 0 + } + + function Oe(e, t, n, r) { + var o = Ae.getStreamFromFD(e), + i = Ae.doReadv(o, t, n); + return N[r >> 2] = i, 0 + } + + function je(e, t, n, r, o) {} + + function ke(e, t, n, r) { + for (var o = 0, i = 0; i < n; i++) { + for (var u = N[t + 8 * i >> 2], a = N[t + (8 * i + 4) >> 2], s = 0; s < a; s++) Ae.printChar(e, q[u + s]); + o += a + } + return N[r >> 2] = o, 0 + } + + function Ue(e) { + var t = Date.now() / 1e3 | 0; + return e && (N[e >> 2] = t), t + } + var Te = { + a: we, + e: Ce, + h: Se, + g: xe, + b: Pe, + m: ge, + k: Ee, + l: Ie, + c: Re, + f: Oe, + j: je, + d: ke, + memory: U, + table: H, + i: Ue + }, + Fe = be(); + e.asm = Fe; + var He, Me = e.___wasm_call_ctors = function() { + return (Me = e.___wasm_call_ctors = e.asm.n).apply(null, arguments) + }, + We = (e.___em_js__emscriptenPushBuffer = function() { + return (e.___em_js__emscriptenPushBuffer = e.asm.o).apply(null, arguments) + }, e._emscripten_bind_VoidPtr___destroy___0 = function() { + return (We = e._emscripten_bind_VoidPtr___destroy___0 = e.asm.p).apply(null, arguments) + }), + De = e._emscripten_bind_Container_Container_0 = function() { + return (De = e._emscripten_bind_Container_Container_0 = e.asm.q).apply(null, arguments) + }, + ze = e._emscripten_bind_Container_init_3 = function() { + return (ze = e._emscripten_bind_Container_init_3 = e.asm.r).apply(null, arguments) + }, + Le = e._emscripten_bind_Container_writeFrame_3 = function() { + return (Le = e._emscripten_bind_Container_writeFrame_3 = e.asm.s).apply(null, arguments) + }, + Ve = e._emscripten_bind_Container___destroy___0 = function() { + return (Ve = e._emscripten_bind_Container___destroy___0 = e.asm.t).apply(null, arguments) + }; + + function qe(e) { + this.name = "ExitStatus", this.message = "Program terminated with exit(" + e + ")", this.status = e + } + + function Ne(t) { + function n() { + He || (He = !0, e.calledRun = !0, M || (re(), oe(), e.onRuntimeInitialized && e.onRuntimeInitialized(), ie())) + } + t = t || A, se > 0 || (ne(), se > 0 || (e.setStatus ? (e.setStatus("Running..."), setTimeout((function() { + setTimeout((function() { + e.setStatus("") + }), 1), n() + }), 1)) : n())) + } + if (e._opus_encoder_create = function() { + return (e._opus_encoder_create = e.asm.u).apply(null, arguments) + }, e._opus_encode_float = function() { + return (e._opus_encode_float = e.asm.v).apply(null, arguments) + }, e._opus_encoder_ctl = function() { + return (e._opus_encoder_ctl = e.asm.w).apply(null, arguments) + }, e._opus_encoder_destroy = function() { + return (e._opus_encoder_destroy = e.asm.x).apply(null, arguments) + }, e._speex_resampler_init = function() { + return (e._speex_resampler_init = e.asm.y).apply(null, arguments) + }, e._speex_resampler_destroy = function() { + return (e._speex_resampler_destroy = e.asm.z).apply(null, arguments) + }, e._speex_resampler_process_interleaved_float = function() { + return (e._speex_resampler_process_interleaved_float = e.asm.A).apply(null, arguments) + }, e._free = function() { + return (e._free = e.asm.B).apply(null, arguments) + }, e._malloc = function() { + return (e._malloc = e.asm.C).apply(null, arguments) + }, e.dynCall_vi = function() { + return (e.dynCall_vi = e.asm.D).apply(null, arguments) + }, e.dynCall_v = function() { + return (e.dynCall_v = e.asm.E).apply(null, arguments) + }, e.asm = Fe, e.then = function(t) { + if (He) t(e); + else { + var n = e.onRuntimeInitialized; + e.onRuntimeInitialized = function() { + n && n(), t(e) + } + } + return e + }, fe = function e() { + He || Ne(), He || (fe = e) + }, e.run = Ne, e.preInit) + for ("function" == typeof e.preInit && (e.preInit = [e.preInit]); e.preInit.length > 0;) e.preInit.pop()(); + + function Ge() {} + + function Xe(e) { + return (e || Ge).__cache__ + } + + function Ye(e, t) { + var n = Xe(t), + r = n[e]; + return r || ((r = Object.create((t || Ge).prototype)).ptr = e, n[e] = r) + } + + function $e(e, t) { + return Ye(e.ptr, t) + } + + function Je(e) { + if (!e.__destroy__) throw "Error: Cannot destroy object. (Did you create it yourself?)"; + e.__destroy__(), delete Xe(e.__class__)[e.ptr] + } + + function Ke(e, t) { + return e.ptr === t.ptr + } + + function Qe(e) { + return e.ptr + } + + function Ze(e) { + return e.__class__ + } + + function et() { + throw "cannot construct a VoidPtr, no constructor in IDL" + } + + function tt() { + this.ptr = De(), Xe(tt)[this.ptr] = this + } + return Ne(), Ge.prototype = Object.create(Ge.prototype), Ge.prototype.constructor = Ge, Ge.prototype.__class__ = Ge, Ge.__cache__ = {}, e.WrapperObject = Ge, e.getCache = Xe, e.wrapPointer = Ye, e.castObject = $e, e.NULL = Ye(0), e.destroy = Je, e.compare = Ke, e.getPointer = Qe, e.getClass = Ze, et.prototype = Object.create(Ge.prototype), et.prototype.constructor = et, et.prototype.__class__ = et, et.__cache__ = {}, e.VoidPtr = et, et.prototype.__destroy__ = et.prototype.__destroy__ = function() { + var e = this.ptr; + We(e) + }, tt.prototype = Object.create(Ge.prototype), tt.prototype.constructor = tt, tt.prototype.__class__ = tt, tt.__cache__ = {}, e.Container = tt, tt.prototype.init = tt.prototype.init = function(e, t, n) { + var r = this.ptr; + e && "object" === a(e) && (e = e.ptr), t && "object" === a(t) && (t = t.ptr), n && "object" === a(n) && (n = n.ptr), ze(r, e, t, n) + }, tt.prototype.writeFrame = tt.prototype.writeFrame = function(e, t, n) { + var r = this.ptr; + e && "object" === a(e) && (e = e.ptr), t && "object" === a(t) && (t = t.ptr), n && "object" === a(n) && (n = n.ptr), Le(r, e, t, n) + }, tt.prototype.__destroy__ = tt.prototype.__destroy__ = function() { + var e = this.ptr; + Ve(e) + }, e + }); + "object" === a(t) && "object" === a(i) ? i.exports = p : void 0 === (u = function() { + return p + }.apply(t, [])) || (i.exports = u) + }).call(this, "/index.js", n(2), "/", n(3)(e)) + }, function(e, t, n) { + (function(e, r, o, i) { + var u; + + function a(e) { + return (a = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { + return typeof e + } : function(e) { + return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e + })(e) + } + + function s(e, t) { + if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") + } + + function c(e, t) { + for (var n = 0; n < t.length; n++) { + var r = t[n]; + r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) + } + } + + function f(e, t, n) { + return t && c(e.prototype, t), n && c(e, n), e + } + var l, p = (l = (l = "undefined" != typeof document && document.currentScript ? document.currentScript.src : void 0) || e, function(e) { + e = void 0 !== (e = e || {}) ? e : {}; + var t = n(1), + i = t.EmscriptenMemoryAllocator, + u = 2049, + c = 48e3, + p = 4e3, + _ = 20, + d = 6, + h = 4096, + m = 0, + y = 4002, + v = 0, + b = function() { + function t(n, r) { + var o = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0; + s(this, t), this.config = { + inputSampleRate: n, + channelCount: r + }, this.memory = new i(e), this._opus_encoder_create = e._opus_encoder_create, this._opus_encoder_ctl = e._opus_encoder_ctl, this._opus_encode_float = e._opus_encode_float, this._opus_encoder_destroy = e._opus_encoder_destroy, this._speex_resampler_init = e._speex_resampler_init, this._speex_resampler_process_interleaved_float = e._speex_resampler_process_interleaved_float, this._speex_resampler_destroy = e._speex_resampler_destroy, this._container = new e.Container, this._container.init(c, r, Math.floor(4294967295 * Math.random())), this.OpusInitCodec(c, r, o), this.SpeexInitResampler(n, c, r), this.inputSamplesPerChannel = n * _ / 1e3, this.outputSamplePerChannel = c * _ / 1e3, this.inputBufferIndex = 0, this.mInputBuffer = this.memory.mallocFloat32Buffer(this.inputSamplesPerChannel * r), this.mResampledBuffer = this.memory.mallocFloat32Buffer(this.outputSamplePerChannel * r), this.mOutputBuffer = this.memory.mallocUint8Buffer(p), this.interleavedBuffers = 1 !== r ? new Float32Array(h * r) : void 0 + } + return f(t, [{ + key: "encode", + value: function(e) { + for (var t = this.interleave(e), n = 0; n < t.length;) { + var r = Math.min(this.mInputBuffer.length - this.inputBufferIndex, t.length - n); + if (this.mInputBuffer.set(t.subarray(n, n + r), this.inputBufferIndex), this.inputBufferIndex += r, this.inputBufferIndex >= this.mInputBuffer.length) { + var o = this.memory.mallocUint32(this.inputSamplesPerChannel), + i = this.memory.mallocUint32(this.outputSamplePerChannel), + u = this._speex_resampler_process_interleaved_float(this.resampler, this.mInputBuffer.pointer, o.pointer, this.mResampledBuffer.pointer, i.pointer); + if (o.free(), i.free(), u !== v) throw new Error("Resampling error."); + var a = this._opus_encode_float(this.encoder, this.mResampledBuffer.pointer, this.outputSamplePerChannel, this.mOutputBuffer.pointer, this.mOutputBuffer.length); + if (a < 0) throw new Error("Opus encoding error."); + this._container.writeFrame(this.mOutputBuffer.pointer, a, this.outputSamplePerChannel), this.inputBufferIndex = 0 + } + n += r + } + } + }, { + key: "close", + value: function() { + for (var t = this.config.channelCount, n = [], r = 0; r < t; ++r) n.push(new Float32Array(h - this.inputBufferIndex / t)); + this.encode(n), e.destroy(this._container), this.mInputBuffer.free(), this.mResampledBuffer.free(), this.mOutputBuffer.free(), this._opus_encoder_destroy(this.encoder), this._speex_resampler_destroy(this.resampler) + } + }, { + key: "interleave", + value: function(e) { + var t = e.length; + if (1 === t) return e[0]; + for (var n = 0; n < t; n++) + for (var r = e[n], o = 0; o < r.length; o++) this.interleavedBuffers[o * t + n] = r[o]; + return this.interleavedBuffers + } + }, { + key: "OpusInitCodec", + value: function(e, t) { + var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0, + r = this.memory.mallocUint32(void 0); + this.encoder = this._opus_encoder_create(e, t, u, r.pointer); + var o = r.value; + if (r.free(), o !== m) throw new Error("Opus encodor initialization failed."); + n && this.OpusSetOpusControl(y, n) + } + }, { + key: "OpusSetOpusControl", + value: function(e, t) { + var n = this.memory.mallocInt32(t); + this._opus_encoder_ctl(this.encoder, e, n.pointer), n.free() + } + }, { + key: "SpeexInitResampler", + value: function(e, t, n) { + var r = this.memory.mallocUint32(void 0); + this.resampler = this._speex_resampler_init(n, e, t, d, r.pointer); + var o = r.value; + if (r.free(), o !== v) throw new Error("Initializing resampler failed.") + } + }]), t + }(); + e.init = function(t, n, r) { + e.encodedBuffers = [], e.encoder = new b(t, n, r) + }, e.encode = function(t) { + e.encoder.encode(t) + }, e.flush = function() { + return e.encodedBuffers.splice(0, e.encodedBuffers.length) + }, e.close = function() { + e.encoder.close() + }; + var g, w = {}; + for (g in e) e.hasOwnProperty(g) && (w[g] = e[g]); + var A = [], + C = !1, + S = !1, + x = !1, + P = !1; + C = "object" === ("undefined" == typeof window ? "undefined" : a(window)), S = "function" == typeof importScripts, x = "object" === (void 0 === r ? "undefined" : a(r)) && "object" === a(r.versions) && "string" == typeof r.versions.node, P = !C && !x && !S; + var E, B, I, R, O = ""; + + function j(t) { + return e.locateFile ? e.locateFile(t, O) : O + t + } + x ? (O = S ? n(0).dirname(O) + "/" : o + "/", E = function(e, t) { + return I || (I = n(4)), R || (R = n(0)), e = R.normalize(e), I.readFileSync(e, t ? null : "utf8") + }, B = function(e) { + var t = E(e, !0); + return t.buffer || (t = new Uint8Array(t)), W(t.buffer), t + }, r.argv.length > 1 && r.argv[1].replace(/\\/g, "/"), A = r.argv.slice(2), r.on("uncaughtException", (function(e) { + if (!(e instanceof We)) throw e + })), r.on("unhandledRejection", _e), e.inspect = function() { + return "[Emscripten Module object]" + }) : P ? ("undefined" != typeof read && (E = function(e) { + return read(e) + }), B = function(e) { + var t; + return "function" == typeof readbuffer ? new Uint8Array(readbuffer(e)) : (W("object" === a(t = read(e, "binary"))), t) + }, "undefined" != typeof scriptArgs ? A = scriptArgs : void 0 !== arguments && (A = arguments), "undefined" != typeof print && ("undefined" == typeof console && (console = {}), console.log = print, console.warn = console.error = "undefined" != typeof printErr ? printErr : print)) : (C || S) && (S ? O = self.location.href : document.currentScript && (O = document.currentScript.src), l && (O = l), O = 0 !== O.indexOf("blob:") ? O.substr(0, O.lastIndexOf("/") + 1) : "", E = function(e) { + var t = new XMLHttpRequest; + return t.open("GET", e, !1), t.send(null), t.responseText + }, S && (B = function(e) { + var t = new XMLHttpRequest; + return t.open("GET", e, !1), t.responseType = "arraybuffer", t.send(null), new Uint8Array(t.response) + })); + var k, U, T = e.print || console.log.bind(console), + F = e.printErr || console.warn.bind(console); + for (g in w) w.hasOwnProperty(g) && (e[g] = w[g]); + w = null, e.arguments && (A = e.arguments), e.thisProgram && e.thisProgram, e.quit && e.quit, e.wasmBinary && (k = e.wasmBinary), e.noExitRuntime && e.noExitRuntime, "object" !== ("undefined" == typeof WebAssembly ? "undefined" : a(WebAssembly)) && F("no native wasm support detected"); + var H = new WebAssembly.Table({ + initial: 36, + maximum: 36, + element: "anyfunc" + }), + M = !1; + + function W(e, t) { + e || _e("Assertion failed: " + t) + } + var D = "undefined" != typeof TextDecoder ? new TextDecoder("utf8") : void 0; + + function z(e, t, n) { + for (var r = t + n, o = t; e[o] && !(o >= r);) ++o; + if (o - t > 16 && e.subarray && D) return D.decode(e.subarray(t, o)); + for (var i = ""; t < o;) { + var u = e[t++]; + if (128 & u) { + var a = 63 & e[t++]; + if (192 != (224 & u)) { + var s = 63 & e[t++]; + if ((u = 224 == (240 & u) ? (15 & u) << 12 | a << 6 | s : (7 & u) << 18 | a << 12 | s << 6 | 63 & e[t++]) < 65536) i += String.fromCharCode(u); + else { + var c = u - 65536; + i += String.fromCharCode(55296 | c >> 10, 56320 | 1023 & c) + } + } else i += String.fromCharCode((31 & u) << 6 | a) + } else i += String.fromCharCode(u) + } + return i + } + + function L(e, t) { + return e ? z(q, e, t) : "" + } + "undefined" != typeof TextDecoder && new TextDecoder("utf-16le"); + var V, q, N, G = 65536; + + function X(t) { + V = t, e.HEAP8 = new Int8Array(t), e.HEAP16 = new Int16Array(t), e.HEAP32 = N = new Int32Array(t), e.HEAPU8 = q = new Uint8Array(t), e.HEAPU16 = new Uint16Array(t), e.HEAPU32 = new Uint32Array(t), e.HEAPF32 = new Float32Array(t), e.HEAPF64 = new Float64Array(t) + } + var Y = 5289728, + $ = 46688, + J = e.INITIAL_MEMORY || 16777216; + + function K(t) { + for (; t.length > 0;) { + var n = t.shift(); + if ("function" != typeof n) { + var r = n.func; + "number" == typeof r ? void 0 === n.arg ? e.dynCall_v(r) : e.dynCall_vi(r, n.arg) : r(void 0 === n.arg ? null : n.arg) + } else n() + } + }(U = e.wasmMemory ? e.wasmMemory : new WebAssembly.Memory({ + initial: J / G, + maximum: J / G + })) && (V = U.buffer), J = V.byteLength, X(V), N[$ >> 2] = Y; + var Q = [], + Z = [], + ee = [], + te = []; + + function ne() { + if (e.preRun) + for ("function" == typeof e.preRun && (e.preRun = [e.preRun]); e.preRun.length;) ue(e.preRun.shift()); + K(Q) + } + + function re() { + K(Z) + } + + function oe() { + K(ee) + } + + function ie() { + if (e.postRun) + for ("function" == typeof e.postRun && (e.postRun = [e.postRun]); e.postRun.length;) ae(e.postRun.shift()); + K(te) + } + + function ue(e) { + Q.unshift(e) + } + + function ae(e) { + te.unshift(e) + } + var se = 0, + ce = null, + fe = null; + + function le(t) { + se++, e.monitorRunDependencies && e.monitorRunDependencies(se) + } + + function pe(t) { + if (se--, e.monitorRunDependencies && e.monitorRunDependencies(se), 0 == se && (null !== ce && (clearInterval(ce), ce = null), fe)) { + var n = fe; + fe = null, n() + } + } + + function _e(t) { + throw e.onAbort && e.onAbort(t), T(t += ""), F(t), M = !0, t = "abort(" + t + "). Build with -s ASSERTIONS=1 for more info.", new WebAssembly.RuntimeError(t) + } + e.preloadedImages = {}, e.preloadedAudios = {}; + var de = "data:application/octet-stream;base64,"; + + function he(e) { + return String.prototype.startsWith ? e.startsWith(de) : 0 === e.indexOf(de) + } + var me = "OggOpusEncoder.wasm"; + + function ye() { + try { + if (k) return new Uint8Array(k); + if (B) return B(me); + throw "both async and sync fetching of the wasm failed" + } catch (e) { + _e(e) + } + } + + function ve() { + return k || !C && !S || "function" != typeof fetch ? new Promise((function(e, t) { + e(ye()) + })) : fetch(me, { + credentials: "same-origin" + }).then((function(e) { + if (!e.ok) throw "failed to load wasm binary file at '" + me + "'"; + return e.arrayBuffer() + })).catch((function() { + return ye() + })) + } + + function be() { + var t = { + a: Re + }; + + function n(t, n) { + var r = t.exports; + e.asm = r, pe() + } + + function r(e) { + n(e.instance) + } + + function o(e) { + return ve().then((function(e) { + return WebAssembly.instantiate(e, t) + })).then(e, (function(e) { + F("failed to asynchronously prepare wasm: " + e), _e(e) + })) + } + if (le(), e.instantiateWasm) try { + return e.instantiateWasm(t, n) + } catch (e) { + return F("Module.instantiateWasm callback failed with error: " + e), !1 + } + return function() { + if (k || "function" != typeof WebAssembly.instantiateStreaming || he(me) || "function" != typeof fetch) return o(r); + fetch(me, { + credentials: "same-origin" + }).then((function(e) { + return WebAssembly.instantiateStreaming(e, t).then(r, (function(e) { + F("wasm streaming compile failed: " + e), F("falling back to ArrayBuffer instantiation"), o(r) + })) + })) + }(), {} + } + + function ge(t, n) { + var r = new Uint8Array(e.HEAPU8.buffer, t, n); + e.encodedBuffers.push(new Uint8Array(r).buffer) + } + + function we(e, t, n, r) { + _e("Assertion failed: " + L(e) + ", at: " + [t ? L(t) : "unknown filename", n, r ? L(r) : "unknown function"]) + } + + function Ae() { + _e() + } + + function Ce(e, t, n) { + q.copyWithin(e, t, t + n) + } + + function Se(e) { + _e("OOM") + } + + function xe(e) { + Se() + } + he(me) || (me = j(me)), Z.push({ + func: function() { + ke() + } + }); + var Pe = { + mappings: {}, + buffers: [null, [], + [] + ], + printChar: function(e, t) { + var n = Pe.buffers[e]; + 0 === t || 10 === t ? ((1 === e ? T : F)(z(n, 0)), n.length = 0) : n.push(t) + }, + varargs: void 0, + get: function() { + return Pe.varargs += 4, N[Pe.varargs - 4 >> 2] + }, + getStr: function(e) { + return L(e) + }, + get64: function(e, t) { + return e + } + }; + + function Ee(e) { + return 0 + } + + function Be(e, t, n, r, o) {} + + function Ie(e, t, n, r) { + for (var o = 0, i = 0; i < n; i++) { + for (var u = N[t + 8 * i >> 2], a = N[t + (8 * i + 4) >> 2], s = 0; s < a; s++) Pe.printChar(e, q[u + s]); + o += a + } + return N[r >> 2] = o, 0 + } + var Re = { + a: we, + c: Ae, + d: ge, + f: Ce, + g: xe, + h: Ee, + e: Be, + b: Ie, + memory: U, + table: H + }, + Oe = be(); + e.asm = Oe; + var je, ke = e.___wasm_call_ctors = function() { + return (ke = e.___wasm_call_ctors = e.asm.i).apply(null, arguments) + }, + Ue = (e.___em_js__emscriptenPushBuffer = function() { + return (e.___em_js__emscriptenPushBuffer = e.asm.j).apply(null, arguments) + }, e._emscripten_bind_VoidPtr___destroy___0 = function() { + return (Ue = e._emscripten_bind_VoidPtr___destroy___0 = e.asm.k).apply(null, arguments) + }), + Te = e._emscripten_bind_Container_Container_0 = function() { + return (Te = e._emscripten_bind_Container_Container_0 = e.asm.l).apply(null, arguments) + }, + Fe = e._emscripten_bind_Container_init_3 = function() { + return (Fe = e._emscripten_bind_Container_init_3 = e.asm.m).apply(null, arguments) + }, + He = e._emscripten_bind_Container_writeFrame_3 = function() { + return (He = e._emscripten_bind_Container_writeFrame_3 = e.asm.n).apply(null, arguments) + }, + Me = e._emscripten_bind_Container___destroy___0 = function() { + return (Me = e._emscripten_bind_Container___destroy___0 = e.asm.o).apply(null, arguments) + }; + + function We(e) { + this.name = "ExitStatus", this.message = "Program terminated with exit(" + e + ")", this.status = e + } + + function De(t) { + function n() { + je || (je = !0, e.calledRun = !0, M || (re(), oe(), e.onRuntimeInitialized && e.onRuntimeInitialized(), ie())) + } + t = t || A, se > 0 || (ne(), se > 0 || (e.setStatus ? (e.setStatus("Running..."), setTimeout((function() { + setTimeout((function() { + e.setStatus("") + }), 1), n() + }), 1)) : n())) + } + if (e._opus_encoder_create = function() { + return (e._opus_encoder_create = e.asm.p).apply(null, arguments) + }, e._opus_encode_float = function() { + return (e._opus_encode_float = e.asm.q).apply(null, arguments) + }, e._opus_encoder_ctl = function() { + return (e._opus_encoder_ctl = e.asm.r).apply(null, arguments) + }, e._opus_encoder_destroy = function() { + return (e._opus_encoder_destroy = e.asm.s).apply(null, arguments) + }, e._malloc = function() { + return (e._malloc = e.asm.t).apply(null, arguments) + }, e._free = function() { + return (e._free = e.asm.u).apply(null, arguments) + }, e._speex_resampler_init = function() { + return (e._speex_resampler_init = e.asm.v).apply(null, arguments) + }, e._speex_resampler_destroy = function() { + return (e._speex_resampler_destroy = e.asm.w).apply(null, arguments) + }, e._speex_resampler_process_interleaved_float = function() { + return (e._speex_resampler_process_interleaved_float = e.asm.x).apply(null, arguments) + }, e.dynCall_vi = function() { + return (e.dynCall_vi = e.asm.y).apply(null, arguments) + }, e.dynCall_v = function() { + return (e.dynCall_v = e.asm.z).apply(null, arguments) + }, e.asm = Oe, e.then = function(t) { + if (je) t(e); + else { + var n = e.onRuntimeInitialized; + e.onRuntimeInitialized = function() { + n && n(), t(e) + } + } + return e + }, fe = function e() { + je || De(), je || (fe = e) + }, e.run = De, e.preInit) + for ("function" == typeof e.preInit && (e.preInit = [e.preInit]); e.preInit.length > 0;) e.preInit.pop()(); + + function ze() {} + + function Le(e) { + return (e || ze).__cache__ + } + + function Ve(e, t) { + var n = Le(t), + r = n[e]; + return r || ((r = Object.create((t || ze).prototype)).ptr = e, n[e] = r) + } + + function qe(e, t) { + return Ve(e.ptr, t) + } + + function Ne(e) { + if (!e.__destroy__) throw "Error: Cannot destroy object. (Did you create it yourself?)"; + e.__destroy__(), delete Le(e.__class__)[e.ptr] + } + + function Ge(e, t) { + return e.ptr === t.ptr + } + + function Xe(e) { + return e.ptr + } + + function Ye(e) { + return e.__class__ + } + + function $e() { + throw "cannot construct a VoidPtr, no constructor in IDL" + } + + function Je() { + this.ptr = Te(), Le(Je)[this.ptr] = this + } + return De(), ze.prototype = Object.create(ze.prototype), ze.prototype.constructor = ze, ze.prototype.__class__ = ze, ze.__cache__ = {}, e.WrapperObject = ze, e.getCache = Le, e.wrapPointer = Ve, e.castObject = qe, e.NULL = Ve(0), e.destroy = Ne, e.compare = Ge, e.getPointer = Xe, e.getClass = Ye, $e.prototype = Object.create(ze.prototype), $e.prototype.constructor = $e, $e.prototype.__class__ = $e, $e.__cache__ = {}, e.VoidPtr = $e, $e.prototype.__destroy__ = $e.prototype.__destroy__ = function() { + var e = this.ptr; + Ue(e) + }, Je.prototype = Object.create(ze.prototype), Je.prototype.constructor = Je, Je.prototype.__class__ = Je, Je.__cache__ = {}, e.Container = Je, Je.prototype.init = Je.prototype.init = function(e, t, n) { + var r = this.ptr; + e && "object" === a(e) && (e = e.ptr), t && "object" === a(t) && (t = t.ptr), n && "object" === a(n) && (n = n.ptr), Fe(r, e, t, n) + }, Je.prototype.writeFrame = Je.prototype.writeFrame = function(e, t, n) { + var r = this.ptr; + e && "object" === a(e) && (e = e.ptr), t && "object" === a(t) && (t = t.ptr), n && "object" === a(n) && (n = n.ptr), He(r, e, t, n) + }, Je.prototype.__destroy__ = Je.prototype.__destroy__ = function() { + var e = this.ptr; + Me(e) + }, e + }); + "object" === a(t) && "object" === a(i) ? i.exports = p : void 0 === (u = function() { + return p + }.apply(t, [])) || (i.exports = u) + }).call(this, "/index.js", n(2), "/", n(3)(e)) + }]); + } +}); \ No newline at end of file diff --git a/resources/js/eq.js b/resources/js/eq.js new file mode 100644 index 00000000..ce17071d --- /dev/null +++ b/resources/js/eq.js @@ -0,0 +1,591 @@ +var EAOverride = true; +var AErecorderNode; +var GCOverride = true; +var outputID = -1; +var EAoutputID = -1; +var queueExclusive = false; +var queueChromecast = false; +var selectedGC ; +var MVsource; +var windowAudioNode; +const workerOptions = { + OggOpusEncoderWasmPath: 'https://cdn.jsdelivr.net/npm/opus-media-recorder@latest/OggOpusEncoder.wasm', + WebMOpusEncoderWasmPath: 'https://cdn.jsdelivr.net/npm/opus-media-recorder@latest/WebMOpusEncoder.wasm' +}; +var recorder; + +window.MediaRecorder = OpusMediaRecorder; + +var audioWorklet = `class RecorderWorkletProcessor extends AudioWorkletProcessor { + static get parameterDescriptors() { + return [{ + name: 'isRecording', + defaultValue: 0 + }, + { + name: 'numberOfChannels', + defaultValue: 2 + } + ]; + } + + constructor() { + super(); + this._bufferSize = 32768; + this._buffers = null; + this._initBuffer(); + } + + _initBuffers(numberOfChannels) { + this._buffers = []; + for (let channel=0; channel < numberOfChannels; channel++) { + this._buffers.push(new Float32Array(this._bufferSize)); + } + } + + _initBuffer() { + this._bytesWritten = 0; + } + + _isBufferEmpty() { + return this._bytesWritten === 0; + } + + _isBufferFull() { + return this._bytesWritten === this._bufferSize; + } + + + _pushToBuffers(audioRawData, numberOfChannels) { + if (this._isBufferFull()) { + this._flush(); + } + + let dataLength = audioRawData[0].length; + + for (let idx=0; idx { + if (this._bytesWritten < this._bufferSize) { + buffer = buffer.slice(0, this._bytesWritten); + } + buffers[channel] = buffer; + }); + this.port.postMessage({ + eventType: 'data', + audioBuffer: buffers, + bufferSize: this._bufferSize + }); + this._initBuffer(); + } + + _recordingStopped() { + this.port.postMessage({ + eventType: 'stop' + }); + } + + process(inputs, outputs, parameters) { + const isRecordingValues = parameters.isRecording; + const numberOfChannels = parameters.numberOfChannels[0]; + if (this._buffers === null) { + this._initBuffers(numberOfChannels); + } + + for (let dataIndex = 0; dataIndex < isRecordingValues.length; dataIndex++) + { + const shouldRecord = isRecordingValues[dataIndex] === 1; + if (!shouldRecord && !this._isBufferEmpty()) { + this._flush(); + this._recordingStopped(); + } + + if (shouldRecord) { + let audioRawData = inputs[0]; + this._pushToBuffers(audioRawData, numberOfChannels); + } + } + return true; + } + + } + + registerProcessor('recorder-worklet', RecorderWorkletProcessor);`; +var GCstream; +var searchInt; +var AMEx = { + context: new AudioContext(), + result: {}, + filter: [], + EQRanges: [{ + f: 32, + type: 'lowshelf' + }, { + f: 64, + type: 'peaking' + }, { + f: 125, + type: 'peaking' + }, { + f: 250, + type: 'peaking' + }, { + f: 500, + type: 'peaking' + }, { + f: 1000, + type: 'peaking' + }, { + f: 2000, + type: 'peaking' + }, { + f: 4000, + type: 'peaking' + }, { + f: 8000, + type: 'peaking' + }, { + f: 16000, + type: 'highshelf' + }] +}; +var bassFilter; +var trebleFilter; + +var AudioOutputs = { + fInit: false, + eqReady: false, + activeCasts: [], + castUI() { + AMJavaScript.getRequest("ameres://html/cast_device.html", (content) => { + var vm = new Vue({ + data: { + devices: { + cast: [], + airplay: [] + }, + scanning: false, + activeCasts: AudioOutputs.activeCasts + }, + methods: { + scan() { + let self = this; + this.scanning = true; + AudioOutputs.getGCDevices(); + setTimeout(()=>{ + self.devices.cast = ipcRenderer.sendSync("getKnownCastDevices"); + self.scanning = false; + }, 2000); + console.log(this.devices); + vm.$forceUpdate(); + }, + setCast(device) { + console.log(`requesting: ${device}`); + AudioOutputs.playGC(device); + }, + stopCasting() { + AudioOutputs.stopGC(); + this.activeCasts = AudioOutputs.activeCasts; + vm.$forceUpdate(); + }, + close() { + modal.close(); + } + } + }); + var modal = new AMEModal({ + content: content, + CloseButton: false, + Style: { + maxWidth: "600px" + }, + OnCreate() { + vm.$mount("#castdevices-vue"); + vm.scan(); + }, + OnClose() { + _vues.destroy(vm); + } + }); + }) + }, + init: function (cb = function () {}) { + AudioOutputs.fInit = true; + searchInt = setInterval(function () { + if (document.getElementById("apple-music-player")) { + AudioOutputs.eqReady = true; + document.getElementById("apple-music-player").crossOrigin = "anonymous"; + AudioOutputs.amplifyMedia(document.getElementById("apple-music-player"), 0); + var context = AMEx.context; + var source = AMEx.result.source; + bassFilter = context.createBiquadFilter(); + bassFilter.type = "lowshelf"; + bassFilter.frequency.value = 200; + bassFilter.gain.value = 0; + + trebleFilter = context.createBiquadFilter(); + trebleFilter.type = "highshelf"; + trebleFilter.frequency.value = 2000; + trebleFilter.gain.value = 0; + + source.connect(bassFilter); + bassFilter.connect(trebleFilter); + trebleFilter.connect(context.destination); + console.log("Attached EQ"); + + if (queueExclusive){ + console.log('we good'); + AudioOutputs.startExclusiveAudio(outputID); } + + cb(); + clearInterval(searchInt); + } + }, 1000); + waitFor(()=>{return queueChromecast && + ((document.getElementById("apple-music-player") != null&& + document.getElementById("apple-music-player").readyState == 4) || ( + document.querySelector('apple-music-video-player') && + document.querySelector('apple-music-video-player').shadowRoot && + document.querySelector('apple-music-video-player').shadowRoot.querySelector('amp-video-player-internal') && + document.querySelector('apple-music-video-player').shadowRoot.querySelector('amp-video-player-internal').shadowRoot && + document.querySelector('apple-music-video-player').shadowRoot.querySelector('amp-video-player-internal').shadowRoot.querySelector('amp-video-player') && + document.querySelector('apple-music-video-player').shadowRoot.querySelector('amp-video-player-internal').shadowRoot.querySelector('amp-video-player').shadowRoot && + document.querySelector('apple-music-video-player').shadowRoot.querySelector('amp-video-player-internal').shadowRoot.querySelector('amp-video-player').shadowRoot.getElementById('apple-music-video-player') && + document.querySelector('apple-music-video-player').shadowRoot.querySelector('amp-video-player-internal').shadowRoot.querySelector('amp-video-player').shadowRoot.getElementById('apple-music-video-player').readyState == 4)) ;},() => AudioOutputs.playGC(selectedGC)) + + }, + amplifyMedia: function (mediaElem, multiplier) { + AMEx.context = new(window.AudioContext || window.webkitAudioContext), + AMEx.result = { + context: AMEx.context, + source: AMEx.context.createMediaElementSource(mediaElem), + gain: AMEx.context.createGain(), + media: mediaElem, + amplify: function (multiplier) { + AMEx.result.gain.gain.value = multiplier; + }, + getAmpLevel: function () { + return AMEx.result.gain.gain.value; + } + }; + AMEx.result.source.connect(AMEx.result.gain); + AMEx.result.gain.connect(AMEx.context.destination); + AMEx.result.amplify(multiplier); + return AMEx.result; + }, + popup_generic: function ({ + title = "", + content = document.createElement("div"), + closefn = function () {}, + transparentBg = false, + windowStyle = {}, + backdropStyle = {} + }) { + let backdrop = document.createElement("div"); + backdrop.style.width = "100%"; + backdrop.style.height = "100%"; + backdrop.style.position = "fixed"; + backdrop.style.top = 0; + backdrop.style.left = 0; + if (!transparentBg) { + backdrop.style.background = "rgba(0,0,0,0.5)"; + } else { + backdrop.style.background = "rgba(0,0,0,0.0)"; + }; + backdrop.style.zIndex = 10000; + backdrop.style.display = "flex"; + backdrop.style.alignItems = "center"; + backdrop.style.justifyContent = "center"; + let win = document.createElement("div"); + win.style.width = "300px"; + win.style.background = "var(--modalBGColor)"; + win.style.zIndex = 10000; + win.style.padding = "16px"; + win.style.borderRadius = "10px"; + Object.assign(backdrop.style, backdropStyle); + Object.assign(win.style, windowStyle); + let closeBtn = document.createElement("button"); + closeBtn.style.background = "var(--primaryColor)"; + closeBtn.style.borderRadius = "4px"; + closeBtn.style.padding = "8px 0px 8px 0px"; + closeBtn.style.width = "100%"; + closeBtn.style.fontWeight = "bold"; + closeBtn.style.margin = "12px 0px 0px 0px"; + closeBtn.innerHTML = "Close"; + closeBtn.id = "eq-close"; + closeBtn.addEventListener("click", function () { + backdrop.remove(); + closefn(); + }); + let titleText = document.createElement("div"); + titleText.innerHTML = (title); + titleText.style.fontWeight = "bold"; + + + win.appendChild(titleText); + win.appendChild(content); + win.appendChild(closeBtn); + + backdrop.appendChild(win); + document.body.appendChild(backdrop); + }, + ShowEQ: function () { + if (!AudioOutputs.eqReady) { + alert("Audio is not ready, Play a song to use this function."); + }; + let backdrop = document.createElement("div"); + backdrop.style.width = "100%"; + backdrop.style.height = "100%"; + backdrop.style.position = "fixed"; + backdrop.style.top = 0; + backdrop.style.left = 0; + backdrop.style.background = "rgba(0,0,0,0.5)"; + backdrop.style.zIndex = 9999; + backdrop.style.display = "flex"; + backdrop.style.alignItems = "center"; + backdrop.style.justifyContent = "center"; + backdrop.style.backdropFilter = "blur(12px) saturate(180%)"; + + let win = document.createElement("div"); + win.style.width = "300px"; + win.style.background = "var(--modalBGColor)"; + win.style.zIndex = 10000; + win.style.padding = "16px"; + win.style.borderRadius = "10px"; + + + let closeBtn = document.createElement("button"); + closeBtn.style.background = "var(--primaryColor)"; + closeBtn.style.borderRadius = "4px"; + closeBtn.style.padding = "8px 0px 8px 0px"; + closeBtn.style.width = "100%"; + closeBtn.style.fontWeight = "bold"; + closeBtn.style.margin = "12px 0px 0px 0px"; + + closeBtn.innerHTML = "Close"; + closeBtn.addEventListener("click", function () { + backdrop.remove() + }); + + let titleText = document.createElement("div"); + let bassText = document.createElement("div"); + let trebleText = document.createElement("div"); + let gainText = document.createElement("div"); + titleText.id = 'eq-menu'; + titleText.innerHTML = (`Equalizer`); + titleText.style.fontWeight = "bold"; + bassText.innerHTML = (`Bass (${bassFilter.gain.value})`); + trebleText.innerHTML = (`Treble (${trebleFilter.gain.value})`); + gainText.innerHTML = (`Gain (${AMEx.result.gain.gain.value})`); + + + let bassAdjust = document.createElement("input"); + bassAdjust.style.width = "100%"; + bassAdjust.type = "range"; + bassAdjust.min = -10; + bassAdjust.max = 10; + bassAdjust.value = bassFilter.gain.value; + bassAdjust.addEventListener("input", function () { + bassFilter.gain.value = this.value; + bassText.innerHTML = `Bass (${bassFilter.gain.value})`; + }); + + let trebleAdjust = document.createElement("input"); + trebleAdjust.style.width = "100%"; + trebleAdjust.min = -10; + trebleAdjust.max = 10; + trebleAdjust.type = "range"; + trebleAdjust.value = trebleFilter.gain.value; + trebleAdjust.addEventListener("input", function () { + trebleFilter.gain.value = this.value; + trebleText.innerHTML = `Treble (${trebleFilter.gain.value})`; + }); + + let gainAdjust = document.createElement("input"); + gainAdjust.style.width = "100%"; + gainAdjust.min = -1; + gainAdjust.max = 1; + gainAdjust.type = "range"; + gainAdjust.value = AMEx.result.gain.gain.value; + gainAdjust.addEventListener("input", function () { + AMEx.result.gain.gain.value = this.value; + gainText.innerHTML = `Gain (${AMEx.result.gain.gain.value})`; + }); + + let bassLabel = document.createElement("label"); + let trebleLabel = document.createElement("label"); + let gainLabel = document.createElement("label"); + + bassLabel.appendChild(bassText); + trebleLabel.appendChild(trebleText); + gainLabel.appendChild(gainText); + + bassLabel.appendChild(bassAdjust); + bassLabel.appendChild(document.createElement("br")); + trebleLabel.appendChild(trebleAdjust); + trebleLabel.appendChild(document.createElement("br")); + gainLabel.appendChild(gainAdjust); + + win.appendChild(titleText); + win.appendChild(bassLabel); + win.appendChild(trebleLabel); + win.appendChild(gainLabel); + win.appendChild(closeBtn); + + backdrop.appendChild(win); + document.body.appendChild(backdrop); + }, + getAudioDevices: function(){ + ipcRenderer.send('getAudioDevices',''); + }, + startExclusiveAudio: async function(id){ + + if(AMEx.result.source != null || MVsource != null){ + if(EAoutputID!= id){ + EAoutputID = id; + EAOverride = false; + ipcRenderer.send('muteAudio',true); + ipcRenderer.send('enableExclusiveAudio',id); + windowAudioNode = AMEx.context.createGain(); + try{ + AMEx.result.source.connect(windowAudioNode);} + catch(e){} + + var options = { + mimeType : 'audio/wav' + }; + var destnode = AMEx.context.createMediaStreamDestination(); + windowAudioNode.connect(destnode); + if(!recorder){ + recorder = new MediaRecorder(destnode.stream,options,workerOptions); + recorder.start(1); + + recorder.ondataavailable = function(e) { + e.data.arrayBuffer().then(buffer => { + if(!GCOverride) {ipcRenderer.send('writeWAV',buffer,preferences.audio.castingBitDepth);} + if(!EAOverride) {ipcRenderer.send('writePCM',buffer);} + } + ); + }} + + } else {console.log('device already in exclusive mode');} + } else { + outputID = id; + queueExclusive = true; + } + }, + stopExclusiveAudio: function(){ + try{ + recorder.stop(); + recorder = null; + } catch(e){} + EAOverride = true; + EAoutputID = -1; + outputID = -1; + queueExclusive = false; + ipcRenderer.send('muteAudio',false); + ipcRenderer.send('disableExclusiveAudio',''); + + }, + getGCDevices: function(){ + ipcRenderer.send('getChromeCastDevices',''); + }, + playGC : async function(device){ + console.log('wot'); + AudioOutputs.activeCasts.push(device); + GCOverride = false; + if(AMEx.result.source != null || MVsource != null ){ + queueChromecast = false; + const musicType = (MusicKit.getInstance().nowPlayingItem != null) ? MusicKit.getInstance().nowPlayingItem["type"] ?? '' : ''; + const trackName = ((MusicKit.getInstance().nowPlayingItem != null) ? MusicKit.getInstance().nowPlayingItem.title ?? '' : ''); + const artistName = ((MusicKit.getInstance().nowPlayingItem != null) ? MusicKit.getInstance().nowPlayingItem.artistName ?? '' : ''); + const albumName = ((MusicKit.getInstance().nowPlayingItem != null) ? MusicKit.getInstance().nowPlayingItem.albumName ?? '' : ''); + ipcRenderer.send('performGCCast',device, "Apple Music Electron","Playing ...","3.0.0 beta",''); + windowAudioNode = AMEx.context.createGain(); + try{ + AMEx.result.source.connect(windowAudioNode);} + catch(e){} + + var options = { + mimeType : 'audio/wav' + }; + var destnode = AMEx.context.createMediaStreamDestination(); + windowAudioNode.connect(destnode); + if(!recorder){ + recorder = new MediaRecorder(destnode.stream,options,workerOptions); + recorder.start(1); + + recorder.ondataavailable = function(e) { + e.data.arrayBuffer().then(buffer => { + if(!GCOverride) { + ipcRenderer.send('writeWAV',buffer,preferences.audio.castingBitDepth); + } + if(!EAOverride) {ipcRenderer.send('writePCM',buffer);} + } + ); + }} + + } else {queueChromecast = true; selectedGC = device} + + + }, + stopGC : function(){ + queueChromecast = false; + try{ + recorder.stop(); + recorder = null; + } catch(e){} + GCOverride = true; + this.activeCasts = []; + ipcRenderer.send('stopGCast',''); + } +}; + + + +document.addEventListener('keydown', function (event) { + if (event.ctrlKey || event.metaKey) { + switch (String.fromCharCode(event.which).toLowerCase()) { + case "2": + if (document.getElementById('eq-menu')){ + document.getElementById('eq-menu').parentNode.getElementsByTagName('button')[0].click(); + } + else{AudioOutputs.ShowEQ();} + break; + case "3": + (EAOverride) ? (EAOverride = false) : (EAOverride = true); + break; + } + } +}); + +function waitFor(condition, callback) { + if(condition() == null || !condition() ) { + window.setTimeout(waitFor.bind(null, condition, callback), 1000); + } else { + callback(); + } +} + +function setIntervalX(callback, delay, repetitions) { + var x = 0; + var intervalID = window.setInterval(function () { + + callback(); + + if (++x === repetitions) { + window.clearInterval(intervalID); + } + }, delay); +} + +AudioOutputs.init() \ No newline at end of file diff --git a/resources/js/frame_Windows.js b/resources/js/frame_Windows.js new file mode 100644 index 00000000..940887f2 --- /dev/null +++ b/resources/js/frame_Windows.js @@ -0,0 +1,91 @@ +try { + if (document.querySelector('.web-nav-window-controls') === null && document.getElementsByClassName('web-nav-window-controls').length === 0) { + + class ClassWatcher { + + constructor(targetNode, classToWatch, classAddedCallback, classRemovedCallback) { + this.targetNode = targetNode; + this.classToWatch = classToWatch; + this.classAddedCallback = classAddedCallback; + this.classRemovedCallback = classRemovedCallback; + this.observer = null; + this.lastClassState = targetNode.classList.contains(this.classToWatch); + + this.init(); + }; + + init() { + this.observer = new MutationObserver(this.mutationCallback); + this.observe(); + } + + observe() { + this.observer.observe(this.targetNode, { attributes: true }) + }; + + disconnect() { + this.observer.disconnect() + }; + + mutationCallback = mutationsList => { + for(let mutation of mutationsList) { + if (mutation.type === 'attributes' && mutation.attributeName === 'class') { + let currentClassState = mutation.target.classList.contains(this.classToWatch); + if(this.lastClassState !== currentClassState) { + this.lastClassState = currentClassState; + if(currentClassState) { + this.classAddedCallback(); + } + else { + this.classRemovedCallback(); + } + } + } + } + } + } + + function UserAuthorized() { /* When user is authenticated (Signed In) and web-chrome appears */ + document.getElementsByClassName('web-nav-window-controls')[0].classList.add('web-chrome-window-controls'); + document.getElementsByClassName('web-main-drag')[0].style.zIndex = '1'; /* Hide the drag bar */ + } + + function UserUnauthorized() { /* When user is unauthenticated (Signed Out) and web-chrome display: none */ + if (document.getElementsByClassName('web-chrome-window-controls').length !== 0) { + console.log(`Length: ${document.getElementsByClassName('web-chrome-window-controls').length}`); + document.getElementsByClassName('web-chrome-window-controls')[0].classList.remove('web-chrome-window-controls'); + } + document.getElementsByClassName('web-main-drag')[0].style.zIndex = '2'; /* Show the drag bar */ + document.getElementsByClassName('header-nav')[0].style.margin = '5px var(--bodyGutter) 0' + } + + new ClassWatcher(document.body, 'not-authenticated', UserUnauthorized, UserAuthorized); + + document.getElementsByClassName('web-navigation')[0].insertAdjacentHTML('afterbegin', ` +
    +
    +
    + + + +
    + `); + + if ((document.getElementsByClassName('web-chrome')[0].style.display === 'none' || document.body.classList.contains('not-authenticated')) && document.getElementsByClassName('web-nav-window-controls').length > 0) { + UserUnauthorized(); + } else { + UserAuthorized(); + } + + /* Clean Up Search bar */ + if (document.getElementsByClassName('search-box dt-search-box web-navigation__search-box').length > 0) { + document.getElementsByClassName('search-box dt-search-box web-navigation__search-box')[0].style.marginTop = '15px'; + } + + if (document.getElementById('web-navigation-container')) { + document.getElementById('web-navigation-container').style.gridTemplateRows = 'auto auto 1fr auto' + } + } +} catch (e) { + console.error("[CSS] Error while trying to apply frame_Windows.js", e); +} \ No newline at end of file diff --git a/resources/js/frame_macOS.js b/resources/js/frame_macOS.js new file mode 100644 index 00000000..691325be --- /dev/null +++ b/resources/js/frame_macOS.js @@ -0,0 +1,30 @@ +try { + if (document.getElementById('web-navigation-search-box') && !document.querySelector('.web-nav-window-controls')) { + + document.getElementById('web-navigation-search-box').insertAdjacentHTML('beforebegin', ` +
    +
    + + + +
    +
    + `); + + if (document.getElementById('web-navigation-search-box')) { + document.getElementById('web-navigation-search-box').style.gridArea = "auto !important"; + document.getElementById('web-navigation-search-box').style.marginTop = '0px !important'; + } + + if (document.getElementById('web-navigation-container')) { + document.getElementById('web-navigation-container').style.gridTemplateRows = '55px auto 1fr auto !important'; + } + + if (document.querySelector('.web-chrome')) { + document.querySelector('.web-chrome').style.width = "calc(100vw - var(--web-navigation-width))"; + } + + } +} catch (e) { + console.error("[JS] Error while trying to apply frame_macOS.js", e); +} \ No newline at end of file diff --git a/resources/js/lyrics.js b/resources/js/lyrics.js new file mode 100644 index 00000000..dce4fcfc --- /dev/null +++ b/resources/js/lyrics.js @@ -0,0 +1,213 @@ +(function () { + const lineClicked = function (self, id) { + return function () { + const detail = {"time": self.rangeLrc[id].startTime}; + const e = new CustomEvent(self.clickEventName, { + 'detail': detail, + "bubbles": true + }); + const elem = document.getElementById(self.lineidPrefix + id); + elem.dispatchEvent(e); + }; + }; + const setHtml = function (self) { + let i; + self.currentLine = 0; + + const container = document.getElementById(self.divID); + if(!container) { + return; + } + container.innerHTML = ""; + const ul = document.createElement("ul"); + container.appendChild(ul); + for (i = 0; i < self.totalLines; i++) { + const li = document.createElement("li"); + if (self.rangeLrc[i].line === 'lrcInstrumental'){ + li.innerHTML = `
    `; + } else { + li.innerHTML = self.rangeLrc[i].line; + if (!li.innerHTML) { + li.innerHTML = " " + }} + li.setAttribute("id", self.lineidPrefix + i); + if (self.clickable) { + li.onclick = lineClicked(self, i); + li.style.cursor = 'pointer'; + } + ul.appendChild(li); + } + + /* hide the later ones*/ + for (i = self.totalLines; i < self.totalLines; i++) { + document.getElementById(self.lineidPrefix + i).style.display = "block"; + } + }; + const moveToLine = function (self, line) { + const startShow = line - self.showLines; + const endShow = line + self.showLines; + for (let i = 0; i < self.totalLines; i++) { + const li = document.getElementById(self.lineidPrefix + i); + if (i >= startShow && i <= endShow) { + try{ + li.style.display = "block";} + catch(e){} + } else { + li.style.display = "block"; + } + if (i === line) { + li.classList.add(self.currentcss); + if(this.focus == 'start'){ + li.scrollIntoView({behavior: 'smooth', block: 'start'}); + }else{ + li.scrollIntoView({behavior: 'smooth', block: 'center'})}; + try{ + if (li.innerText == ' '){ + document.querySelector(`#MVLyricsBox`).style.display = 'none'; + } else if (MusicKit.getInstance().nowPlayingItem["type"] === "musicVideo"){ + document.querySelector(`#MVLyricsBox`).style.display = 'block'; + } + var u = ''; + if (li.getElementsByClassName('lyrics-translation').length > 0 ){ + try{ + if(!li.innerText.includes('Instrumental. / Lyrics not found.')){ + u = li.getElementsByClassName('lyrics-translation')[0].innerText; + document.querySelector(`#MVLyricsBox`).childNodes[1].innerHTML= li.getElementsByClassName('lyrics-translation')[0].innerText; + document.querySelector(`#MVLyricsBox`).childNodes[0].innerHTML= (li.innerText).replace(u,'');} + } catch(e){} + } else { + if(!li.innerText.includes('Instrumental. / Lyrics not found.')){ + document.querySelector(`#MVLyricsBox`).childNodes[0].innerHTML= li.innerText; + document.querySelector(`#MVLyricsBox`).childNodes[1].innerHTML= ''; } + } + + + + } catch(e){console.log('mverr',e);} + } else { + try{ + li.classList.remove(self.currentcss); + } catch(e){} + } + } + }; + /* The constructor can be empty or passed in the lrc string*/ + const Lyricer = function (options) { + this.divID = "lyricer"; /* the default html container id */ + this.currentcss = "lyricer-current-line"; /* this css for the line current playing*/ + this.lineidPrefix = "lyricer-line"; /* the id prefix for each line*/ + this.showLines = 8; /*lines showing before and after;*/ + this.clickable = true; + this.clickEventName = "lyricerclick"; + this.focus = 'center'; + if (options) { + for (const prop in options) { + if (typeof this[prop] != "undefined" && options.hasOwnProperty(prop)) { + this[prop] = options[prop]; + } + } + } + }; + Lyricer.prototype.setFocus = function(focus2){ + this.focus = focus2; + }; + + Lyricer.prototype.setLrc = function (rawLrc) { + let i; + this.tags = {}; + this.lrc = []; + this.rangeLrc = []; + + const tagRegex = /\[([a-z]+):(.*)].*/; + const lrcAllRegex = /(\[[0-9.:\[\]]*])+(.*)/; + const timeRegex = /\[([0-9]+):([0-9.]+)]/; + const rawLrcArray = rawLrc.split(/[\r\n]/); + for (i = 0; i < rawLrcArray.length; i++) { + /* handle tags first*/ + const tag = tagRegex.exec(rawLrcArray[i]); + if (tag && tag[0]) { + this.tags[tag[1]] = tag[2]; + continue; + } + /* handle lrc*/ + const lrc = lrcAllRegex.exec(rawLrcArray[i]); + if (lrc && lrc[0]) { + const times = lrc[1].replace(/]\[/g, "],[").split(","); + for (let j = 0; j < times.length; j++) { + const time = timeRegex.exec(times[j]); + if (time && time[0]) { + this.lrc.push({"startTime": parseInt(time[1], 10) * 60 + parseFloat(time[2]), "line": lrc[2]}); + } + } + } + } + + /*sort lrc array*/ + this.lrc.sort(function (a, b) { + return a.startTime - b.startTime; + }); + + /* crate the range lrc array*/ + /* dummy lines*/ + /* for (var i = 0; i < rawLrcArray.length; i++) { + /* this.rangeLrc.push( { "startTime": -1, "endTime": 0, "line": " " } ); + /* }; + /* real data*/ + let startTime = 0; + let line = ""; + for (i = 0; i < this.lrc.length; i++) { + endTime = parseFloat(this.lrc[i].startTime); + if (startTime == 10 && line == 'lrcInstrumental') startTime=0; + if (!this.rangeLrc.includes({"startTime": startTime, "endTime": endTime, "line": line})){ + this.rangeLrc.push({"startTime": startTime, "endTime": endTime, "line": line});} else {console.log('blocked');} + startTime = endTime; + line = this.lrc[i].line; + } + this.rangeLrc.push({"startTime": startTime, "endTime": 999.99, "line": line}); + /* dummy lines + /* for (var i = 0; i < this.showLines; i++) { + /* this.rangeLrc.push( { "startTime": -1, "endTime": 0, "line": " " } ); + /* };*/ + this.totalLines = this.rangeLrc.length; + console.log(this.rangeLrc); + + /* set html and move to start*/ + setHtml(this); + this.move(0); + if(typeof _lyrics !== "undefined") { + _lyrics.setLyrics(this.rangeLrc); + } + }; + + Lyricer.prototype.move = function (time) { + for (let i = 0; i < this.totalLines; i++) { + if (time >= this.rangeLrc[i].startTime && time < this.rangeLrc[i].endTime) { + if (this.currentLine !== i) { + this.currentLine = i; + moveToLine(this, this.currentLine); + } + return; + } + } + }; + + Lyricer.prototype.setMXMTranslation = function (translation_list) { + const container = document.getElementById(this.divID); + const lines = container.getElementsByTagName('li'); + for (var line of lines){ + for (var trans_line of translation_list){ + if (line.textContent == " "+trans_line["translation"]["matched_line"]){ + const trans = document.createElement("div"); + trans.className = "lyrics-translation"; + trans.textContent = trans_line["translation"]["description"]; + line.appendChild(trans); + break; + } + } + } + + }; + + window.Lyricer = Lyricer; /*exposed to global*/ + +})(); diff --git a/resources/js/pluginSystem.js b/resources/js/pluginSystem.js new file mode 100644 index 00000000..716e647a --- /dev/null +++ b/resources/js/pluginSystem.js @@ -0,0 +1,118 @@ +var _plugins = { + events: { + Start: [], + OnNavigation: [], + OnPlaybackStateChanged: [], + OnExit: [], + OnHide: [], + OnShow: [] + }, + plugins: [], + menuitems: [], + chromeitems: [], + loadPlugin(plugin = "") { + if (plugin == "") { + return + } + ipcRenderer.send("load-plugin", plugin) + }, + execute(type = "Start", args = {}) { + let self = this + if (!this.events[type]) { + console.warn(`[Plugins] Event type: ${type} not found!`) + return + } else { + console.info(`[Plugins] Event type: ${type} called`) //info makes it more distingishable in the console (more Beginner friendly) + } + this.events[type].forEach(element => { + element(args) + }); + } +}; + +class AMEPlugin_Menuitem { + constructor() { + this.Text = "" + this.Icon = "" + this.OnClick = () => {} + } + get() { + JSON.stringify(this) + } +} + +class AMEPluginHelper { + constructor() { + /** + * Adds all events to the _plugins event queue + */ + _plugins.events.Start.push(this.Start) + _plugins.events.OnNavigation.push(this.OnNavigation) + _plugins.events.OnPlaybackStateChanged.push(this.OnPlaybackStateChanged) + _plugins.events.OnExit.push(this.OnExit) + _plugins.events.OnHide.push(this.OnHide) + _plugins.events.OnShow.push(this.OnShow) + this.name = "Plugin Name" + this.Start() + this.Announce() + } + /** + * Announces that the plugin has loaded in console + */ + Announce() { + console.info(`[Plugins] Plugin: ${this.name} loaded.`) + } + /** + * Excutes when the web player has fully loaded + */ + Start() {} + /** + * Executes when playback state is changed (WIP) + */ + OnPlaybackStateChanged() {} + /** + * Executes when the user changes pages on the site or opens a context menu + * ex: Songs to Playlist screen + */ + OnNavigation() {} + /** + * Executes when the application exits (WIP) + */ + OnExit() {} + /** + * Executes when the application is hidden to the taskbar + */ + OnHide() {} + /** + * Executes when the application is unhidden (WIP) + */ + OnShow() {} + /** + * Adds a menu item to the profile menu (WIP) + */ + AddMenuItem({ + Text = "", + Icon = "", + OnClick = () => {} + }) { + var menuitem = new AMEPlugin_Menuitem() + menuitem.Text = Text + menuitem.Icon = Icon + menuitem.OnClick = OnClick + _plugins.menuitems.push(menuitem) + } + /** + * Adds a button to the web chrome after the volume meter (WIP) + */ + AddChromeButton({ + text = "", + style = {}, + onclick = () => {} + }) { + var btn = document.createElement("button") + btn.classList.add("button-reset") + var btnStyle = { + width: 38 + } + } +} \ No newline at end of file diff --git a/resources/js/settingsPage.js b/resources/js/settingsPage.js new file mode 100644 index 00000000..b4b06cc2 --- /dev/null +++ b/resources/js/settingsPage.js @@ -0,0 +1,19 @@ +try { + function matchRuleShort(str, rule) { + var escapeRegex = (str) => str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1"); + return new RegExp("^" + rule.split("*").map(escapeRegex).join(".*") + "$").test(str); + } + if(AMJavaScript.getQuery("amesettings")) { + if (!storedInnerHTML && document.getElementsByTagName('footer').length !== 0) { + var storedInnerHTML = document.getElementsByTagName('footer')[0].innerHTML; + } + + if (matchRuleShort(window.location.href, '*settings*') && document.getElementsByClassName('application-preferences').length === 0) { + AMSettings.CreateMenu('commerce-full-content'); + } else if (document.getElementsByTagName('footer').length === 1) { + document.getElementsByTagName('footer')[0].innerHTML = storedInnerHTML; /* Revert the footer */ + } + } +} catch (e) { + console.error("[JS] Error while trying to apply settingsPage.js", e); +} \ No newline at end of file diff --git a/resources/js/tests.js b/resources/js/tests.js new file mode 100644 index 00000000..c219e271 --- /dev/null +++ b/resources/js/tests.js @@ -0,0 +1,542 @@ +var _tests = { + remoteUI() { + AMJavaScript.getRequest("ameres://html/itunes_remote.html", (content)=>{ + var vm = new Vue({ + data: { + passcode: { + 0: "", + 1: "", + 2: "", + 3: "" + }, + state: "pin" + }, + methods: { + close() { + modal.close() + }, + jumpToNum(num) { + document.querySelector(`#passcode-num-${num}`).focus() + document.querySelector(`#passcode-num-${num}`).select() + }, + retry() { + this.passcode = {0:"",1:"",2:"",3:""} + this.state = "pin" + }, + connect() { + let self = this + this.state = "connecting" + setTimeout(()=>{ + self.state = "success" + }, 2000) + } + } + + }) + var modal = new AMEModal({ + content: content, + CloseButton: false, + Dismissible: false, + Style: { + maxWidth: "700px", + maxHeight: "400px" + }, + OnCreate() { + vm.$mount("#itunes-remote-vue") + vm.jumpToNum(0) + }, + OnClose() { + _vues.destroy(vm) + } + }) + }) + }, + usermenuinit() { + // MOVE ME ONCE IMPLEMENTED! + + // Clone the user menu + var umClone = document.querySelector(".web-chrome-controls-container>.web-navigation__auth").cloneNode(true) + // Hide the existing menu + document.querySelector(".web-chrome-controls-container>.web-navigation__auth").style.display = "none" + // Append cloned menu + document.querySelector(".web-chrome-controls-container").append(umClone) + // Set cloned menu events + + umClone.addEventListener("click", (e)=>{ + _tests.usermenu(e) + }) + }, + usermenu(e) { + + // MOVE ME ONCE IMPLEMENTED! + AMJavaScript.getRequest("ameres://html/usermenu.html", (content) => { + var vm = new Vue({ + data: { + menuitems: [ + { + label: "Help", + visible: true, + icon: "", + svg: ``, + + onclick: () => { + window.open(`https://support.apple.com/guide/music-web`) + } + + }, + { + label: "Discord", + visible: true, + icon: "", + svg: ` + + `, + + onclick: () => { + window.open(`https://discord.gg/CezHYdXHEM`) + } + + }, + { + label: "Account Settings", + visible: true, + icon: "", + svg: ` + + + `, + + onclick: () => { + + history.pushState("settings", "Settings", "/account/settings/") + window.location.href = "#" + } + }, + { + label: "Preferences", + visible: true, + icon: "", + svg: ``, + + onclick: () => { + + history.pushState("settings", "Settings", "/account/settings/?amesettings=1") + window.location.href = "#" + } + }, + { + label: "Equalizer", + + visible: AudioOutputs.eqReady, + + svg: ` + + + + + + + + + + + +`, + + onclick: () => { + + _tests.eq() + } + }, + { + label: "Sign Out", + visible: true, + icon: "", + style: { + color: "var(--systemRed)" + }, + + onclick: () => { + MusicKit.getInstance().unauthorize() + } + + } + ] + }, + methods: { + close() { + modal.close() + } + } + }) + var calc = { + width: 185, + left: e.clientX - (185 / 2) + } + + // calculate the position of the menu based on the mouse position and the width of the menu itself + if (calc.left + calc.width > window.innerWidth) { + calc.left = (window.innerWidth - calc.width) + } + if (calc.left < 0) { + calc.left = 0 + } + + var modal = new AMEModal({ + content: content, + CloseButton: false, + ModalClasses: ["ameUserMenu"], + BackdropStyle: { + background: "transparent" + }, + Style: { + height: "auto", + + width: `${calc["width"]}px`, + position: "absolute", + // top: "46px", + // right: "142px" + top: `46px`, + left: `${calc.left}px` + }, + OnCreate() { + vm.$mount("#usermenu-vue") + if(typeof _plugins != "undefined") { + _plugins.menuitems.forEach((menuitem)=>{ + vm.menuitems.unshift({ + label: menuitem["Text"], + onclick: menuitem["OnClick"], + icon: "", + visible: true + }) + }) + } + + }, + OnClose() { + _vues.destroy(vm) + } + }) + }) + }, + eq() { + AMJavaScript.getRequest("ameres://html/eq.html", (content) => { + var vm = new Vue({ + data: { + manualEntry: false, + bass: bassFilter.gain.value.toFixed(2), + treble: trebleFilter.gain.value.toFixed(2), + gain: AMEx.result.gain.gain.value.toFixed(2) + }, + methods: { + reset() { + this.bass = 0 + bassFilter.gain.value = 0 + this.treble = 0 + trebleFilter.gain.value = 0 + this.gain = 0 + AMEx.result.gain.gain.value = 0 + }, + close() { + modal.close() + } + } + }) + var modal = new AMEModal({ + content: content, + CloseButton: false, + ModalClasses: ["ameUserMenu"], + BackdropStyle: { + background: "transparent" + }, + + Style: { + + animation: "ameEQIn .10s var(--appleEase)", + width: "306px", + height: "254px", + position: "absolute", + top: "46px", + right: "42px" + }, + OnCreate() { + vm.$mount("#eq-vm") + } + }) + }) + }, + zoo() { + AMJavaScript.getRequest("ameres://html/zoo.html", (content) => { + var modal = new AMEModal({ + content: content + }) + }) + }, + outputDevice() { + AMJavaScript.getRequest("ameres://html/outputdevice.html", (content) => { + var vm = new Vue({ + data: { + selected: "", + audio: document.querySelector("#apple-music-player"), + devices: [] + }, + methods: { + setOutputDevice(id) { + if (this.audio) { + selected = id + sessionStorage.setItem("outputDevice", id) + this.audio.setSinkId(id) + } + } + } + }) + var modal = new AMEModal({ + content: content, + Style: { + width: "30%", + minWidth: "500px" + }, + OnCreate() { + vm.$mount("#outputdevices-vue") + if (vm.audio) { + vm.selected = audio.sinkId + } else { + vm.selected = "default" + } + navigator.mediaDevices.enumerateDevices() + .then(function (devices) { + vm.devices = devices.filter((device) => { + if (device.kind == "audiooutput") { + return device + } + }) + }) + .catch(function (err) { + console.log(err.name + ": " + err.message) + }) + }, + OnClose() { + _vues.destroy(vm) + } + }) + }) + }, + stats() { + var container = document.createElement("div") + var frameRate = document.createElement("div") + var listeners = document.createElement("div") + Object.assign(container.style, + { + textAlign: "center", + position: "absolute", + fontSize: "18px", + bottom: "16px", + right: "16px", + pointerEvents: "none", + zIndex: 99991, + color: "white", + webkitTextStroke: "0.2px black" + }) + document.body.appendChild(container) + container.appendChild(frameRate) + container.appendChild(listeners) + + const times = []; + let fps; + + function refreshLoop() { + window.requestAnimationFrame(() => { + const now = performance.now(); + while (times.length > 0 && times[0] <= now - 1000) { + times.shift(); + } + times.push(now); + fps = times.length; + frameRate.innerText = `${fps} FPS` + refreshLoop(); + }); + } + + refreshLoop(); + }, + oobe(skipIntro = false, closeBtn = false) { + // MOVE ME ONCE IMPLEMENTED! + + AMJavaScript.getRequest("ameres://html/oobe.html", (content) => { + var vm = new Vue({ + data: { + prefs: { + general: { + storefront: "us", + discordRPC: "", + analyticsEnabled: true + }, + visual: { + theme: "", + transparencyEffect: "", + useOperatingSystemAccent: false, + scaling: 1, + mxmon: false, + yton: false, + mxmlanguage: "en", + removeScrollbars: true + }, + audio: { + audioQuality: "auto", + seamlessAudioTransitions: true, + castingBitDepth: '16', + enableDLNA: false, + }, + window: { + closeButtonMinimize: true + } + }, + page: "intro", + }, + methods: { + btn() { + console.info("Button clicked") + }, + getPrefs() { + let self = this + ipcRenderer.invoke("getStoreValue", "audio.audioQuality").then((result) => { + self.prefs.audio.audioQuality = result + }) + + ipcRenderer.invoke("getStoreValue", "audio.seamlessAudioTransitions").then((result) => { + self.prefs.audio.seamlessAudioTransitions = result + }) + + ipcRenderer.invoke("getStoreValue", "audio.castingBitDepth").then((result) => { + self.prefs.audio.castingBitDepth = result + }) + + ipcRenderer.invoke("getStoreValue", "audio.enableDLNA").then((result) => { + self.prefs.audio.enableDLNA = result + }) + + ipcRenderer.invoke("getStoreValue", "general.storefront").then((result) => { + self.prefs.general.storefront = result + }) + + ipcRenderer.invoke("getStoreValue", "general.discordRPC").then((result) => { + self.prefs.general.discordRPC = result + }) + + ipcRenderer.invoke("getStoreValue", "general.analyticsEnabled").then((result) => { + self.prefs.general.analyticsEnabled = result + }) + + ipcRenderer.invoke("getStoreValue", "window.closeButtonMinimize").then((result) => { + self.prefs.window.closeButtonMinimize = result + }) + + ipcRenderer.invoke("getStoreValue", "visual.theme").then((result) => { + self.prefs.visual.theme = result + }) + + ipcRenderer.invoke("getStoreValue", "visual.transparencyEffect").then((result) => { + self.prefs.visual.transparencyEffect = result + }) + + ipcRenderer.invoke("getStoreValue", "visual.useOperatingSystemAccent").then((result) => { + self.prefs.visual.useOperatingSystemAccent = result + }) + + ipcRenderer.invoke("getStoreValue", "visual.mxmon").then((result) => { + self.prefs.visual.mxmon = result + }) + + + ipcRenderer.invoke("getStoreValue", "visual.yton").then((result) => { + self.prefs.visual.yton = result + }) + + ipcRenderer.invoke("getStoreValue", "visual.mxmlanguage").then((result) => { + self.prefs.visual.mxmlanguage = result + }) + + ipcRenderer.invoke("getStoreValue", "visual.removeScrollbars").then((result) => { + self.prefs.visual.removeScrollbars = result + }) + }, + setPrefs() { + let self = this + ipcRenderer.invoke("setStoreValue", "audio.audioQuality", self.prefs.audio.audioQuality) + ipcRenderer.invoke("setStoreValue", "audio.seamlessAudioTransitions", self.prefs.audio.seamlessAudioTransitions) + ipcRenderer.invoke("setStoreValue", "audio.castingBitDepth", self.prefs.audio.castingBitDepth) + ipcRenderer.invoke("setStoreValue", "audio.enableDLNA", self.prefs.audio.enableDLNA) + ipcRenderer.invoke("setStoreValue", "general.storefront", self.prefs.general.storefront) + ipcRenderer.invoke("setStoreValue", "general.discordRPC", self.prefs.general.discordRPC) + ipcRenderer.invoke("setStoreValue", "general.analyticsEnabled", self.prefs.general.analyticsEnabled) + ipcRenderer.invoke("setStoreValue", "window.closeButtonMinimize", self.prefs.window.closeButtonMinimize) + ipcRenderer.invoke("setStoreValue", "visual.theme", self.prefs.visual.theme) + ipcRenderer.invoke("setStoreValue", "visual.transparencyEffect", self.prefs.visual.transparencyEffect) + ipcRenderer.invoke("setStoreValue", "visual.useOperatingSystemAccent", self.prefs.visual.useOperatingSystemAccent) + ipcRenderer.invoke("setStoreValue", "visual.mxmon", self.prefs.visual.mxmon) + + ipcRenderer.invoke("setStoreValue", "visual.yton", self.prefs.visual.yton) + + ipcRenderer.invoke("setStoreValue", "visual.mxmlanguage", self.prefs.visual.mxmlanguage) + ipcRenderer.invoke("setStoreValue", "visual.removeScrollbars", self.prefs.visual.removeScrollbars) + }, + promptRelaunch() { + var relaunch = confirm( + "Relaunch Required\nA relaunch is required in order for the settings you have changed to apply." + ) + if (relaunch) { + ipcRenderer.send("relaunchApp") + } + }, + close() { + this.setPrefs() + // this.promptRelaunch() + modal.close() + }, + init() { + let self = this + document.getElementById('introVideo').addEventListener('ended', () => { + self.page = "welcome" + }, false); + this.getPrefs() + }, + enableBlur() { + modal.setStyle("backdrop", { + backdropFilter: "blur(16px) saturate(180%)" + }) + }, + disableBlur() { + modal.setStyle("backdrop", { + backdropFilter: "blur(0px)" + }) + } + } + }) + var modal = new AMEModal({ + content: content, + CloseButton: closeBtn, + Dismissible: closeBtn, + OnCreate() { + vm.$mount("#oobe-vue") + if (skipIntro) { + vm.page = "welcome" + } else { + vm.init() + } + }, + OnClose() { + _vues.destroy(vm); + if (!MusicKit.getInstance().isAuthorized) { + MusicKit.getInstance().authorize(); + } + } + }) + }) + } +}; + +if (ipcRenderer.sendSync('showOOBE')) { + setTimeout(() => { + _tests.oobe(); + }, 200) +} diff --git a/resources/js/utils.js b/resources/js/utils.js new file mode 100644 index 00000000..17b81e0c --- /dev/null +++ b/resources/js/utils.js @@ -0,0 +1,147 @@ +var _vues = { + instances: [], + killVue(id) { + let self = this + this.instances = this.instances.filter((instance) => { + console.warn(`Requested destroy: ${id}`) + if (instance["_amID"] != id) { + console.warn("Found vue") + console.warn("Destroying Vue") + instance.$destroy() + } else { + return instance + } + }) + }, + gc() { + var needsGC = this.instances.every((val, i, arr) => val == undefined) + if (needsGC) { + this.instances = [] + } + }, + destroy(vue) { + vue.$destroy() + vue = undefined + console.info("Destroyed Vue instance") + }, + killAll() { + // Kill all Vue instances + this.instances.forEach((instance) => { + instance.$destroy() + instance = null + }) + this.instances = [] + } +}; + +class AMEModal { + constructor({ + content = "", + OnCreate = () => { + }, + OnClose = () => { + }, + CloseButton = true, + Style = {}, + ModalClasses = [], + BackdropStyle = {}, + Dismissible = true + }) { + this.Style = Style + this.BackdropStyle = BackdropStyle + this.ModalClasses = ModalClasses + this.closeButton = CloseButton + this.content = content + this.OnClose = OnClose + this.OnCreate = OnCreate + this.Dismissible = Dismissible + this.modal = {} + this.create() + } + + create() { + let self = this + var backdrop = document.createElement("div") + var dismissArea = document.createElement("div") + var modalWin = document.createElement("div") + var modalCloseBtn = document.createElement("button") + var modalContent = document.createElement("div") + backdrop.classList.add("ameModal-Backdrop") + modalWin.classList.add("ameModal") + modalCloseBtn.classList.add("ameModal-Close") + modalCloseBtn.innerHTML = ("Close") + modalCloseBtn.addEventListener("click", () => { + self.close() + }, {once: true}) + Object.assign(dismissArea.style, { + width: "100%", + height: "100%", + position: "absolute", + top: "0px", + left: "0px", + cursor: "pointer" + }) + modalContent.style.height = "100%" + setInnerHTML(modalContent, this.content) + if(this.closeButton) { + modalWin.appendChild(modalCloseBtn) + } + if(this.Dismissible) { + dismissArea.addEventListener("click",()=>{ + self.close() + }, {once: true}) + document.addEventListener("keyup", (e)=>{ + if(e.key == "Escape") { + self.close() + } + }, {once: true}) + backdrop.appendChild(dismissArea) + } + modalWin.appendChild(modalContent) + Object.assign(backdrop.style, this.BackdropStyle) + this.ModalClasses.forEach((cssClass)=>{ + modalWin.classList.add(cssClass) + }) + if(document.querySelectorAll(".ameModal").length == 0) { + document.body.classList.add("no-acrylic") + } + Object.assign(modalWin.style, this.Style) + backdrop.appendChild(modalWin) + document.body.appendChild(backdrop) + this.modal = { + backdrop: backdrop, + window: modalWin, + content: modalContent, + closeBtn: modalCloseBtn + } + this.OnCreate() + } + + close() { + this.OnClose() + this.modal.backdrop.style.background = "transparent" + this.modal.window.classList.add("ameModal-closing") + setTimeout(()=>{ + this.modal.backdrop.remove() + if(document.querySelectorAll(".ameModal").length == 0) { + document.body.classList.remove("no-acrylic") + } + }, 100) + } + + setStyle (element, style = {}) { + if(this.modal[element]) { + Object.assign(this.modal[element].style, style) + }else{ + console.warn(`Undefined modal element "${element}", available modals are: "backdrop", "window", "closeBtn"`) + } + } + + OnCreate() { + + } + + OnClose() { + + } +}; \ No newline at end of file diff --git a/resources/js/vue.js b/resources/js/vue.js new file mode 100644 index 00000000..d998ff72 --- /dev/null +++ b/resources/js/vue.js @@ -0,0 +1,6 @@ +/*! + * Vue.js v2.6.14 + * (c) 2014-2021 Evan You + * Released under the MIT License. + */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Vue=t()}(this,function(){"use strict";var e=Object.freeze({});function t(e){return null==e}function n(e){return null!=e}function r(e){return!0===e}function i(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}function o(e){return null!==e&&"object"==typeof e}var a=Object.prototype.toString;function s(e){return"[object Object]"===a.call(e)}function c(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function u(e){return n(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function l(e){return null==e?"":Array.isArray(e)||s(e)&&e.toString===a?JSON.stringify(e,null,2):String(e)}function f(e){var t=parseFloat(e);return isNaN(t)?e:t}function p(e,t){for(var n=Object.create(null),r=e.split(","),i=0;i-1)return e.splice(n,1)}}var m=Object.prototype.hasOwnProperty;function y(e,t){return m.call(e,t)}function g(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var _=/-(\w)/g,b=g(function(e){return e.replace(_,function(e,t){return t?t.toUpperCase():""})}),$=g(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}),w=/\B([A-Z])/g,C=g(function(e){return e.replace(w,"-$1").toLowerCase()});var x=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function k(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function A(e,t){for(var n in t)e[n]=t[n];return e}function O(e){for(var t={},n=0;n0,Z=J&&J.indexOf("edge/")>0,G=(J&&J.indexOf("android"),J&&/iphone|ipad|ipod|ios/.test(J)||"ios"===K),X=(J&&/chrome\/\d+/.test(J),J&&/phantomjs/.test(J),J&&J.match(/firefox\/(\d+)/)),Y={}.watch,Q=!1;if(V)try{var ee={};Object.defineProperty(ee,"passive",{get:function(){Q=!0}}),window.addEventListener("test-passive",null,ee)}catch(e){}var te=function(){return void 0===B&&(B=!V&&!z&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),B},ne=V&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function re(e){return"function"==typeof e&&/native code/.test(e.toString())}var ie,oe="undefined"!=typeof Symbol&&re(Symbol)&&"undefined"!=typeof Reflect&&re(Reflect.ownKeys);ie="undefined"!=typeof Set&&re(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var ae=S,se=0,ce=function(){this.id=se++,this.subs=[]};ce.prototype.addSub=function(e){this.subs.push(e)},ce.prototype.removeSub=function(e){h(this.subs,e)},ce.prototype.depend=function(){ce.target&&ce.target.addDep(this)},ce.prototype.notify=function(){for(var e=this.subs.slice(),t=0,n=e.length;t-1)if(o&&!y(i,"default"))a=!1;else if(""===a||a===C(e)){var c=Re(String,i.type);(c<0||s0&&(ct((u=e(u,(a||"")+"_"+c))[0])&&ct(f)&&(s[l]=he(f.text+u[0].text),u.shift()),s.push.apply(s,u)):i(u)?ct(f)?s[l]=he(f.text+u):""!==u&&s.push(he(u)):ct(u)&&ct(f)?s[l]=he(f.text+u.text):(r(o._isVList)&&n(u.tag)&&t(u.key)&&n(a)&&(u.key="__vlist"+a+"_"+c+"__"),s.push(u)));return s}(e):void 0}function ct(e){return n(e)&&n(e.text)&&!1===e.isComment}function ut(e,t){if(e){for(var n=Object.create(null),r=oe?Reflect.ownKeys(e):Object.keys(e),i=0;i0,a=t?!!t.$stable:!o,s=t&&t.$key;if(t){if(t._normalized)return t._normalized;if(a&&r&&r!==e&&s===r.$key&&!o&&!r.$hasNormal)return r;for(var c in i={},t)t[c]&&"$"!==c[0]&&(i[c]=vt(n,c,t[c]))}else i={};for(var u in n)u in i||(i[u]=ht(n,u));return t&&Object.isExtensible(t)&&(t._normalized=i),R(i,"$stable",a),R(i,"$key",s),R(i,"$hasNormal",o),i}function vt(e,t,n){var r=function(){var e=arguments.length?n.apply(null,arguments):n({}),t=(e=e&&"object"==typeof e&&!Array.isArray(e)?[e]:st(e))&&e[0];return e&&(!t||1===e.length&&t.isComment&&!pt(t))?void 0:e};return n.proxy&&Object.defineProperty(e,t,{get:r,enumerable:!0,configurable:!0}),r}function ht(e,t){return function(){return e[t]}}function mt(e,t){var r,i,a,s,c;if(Array.isArray(e)||"string"==typeof e)for(r=new Array(e.length),i=0,a=e.length;idocument.createEvent("Event").timeStamp&&(cn=function(){return un.now()})}function ln(){var e,t;for(sn=cn(),on=!0,en.sort(function(e,t){return e.id-t.id}),an=0;anan&&en[n].id>e.id;)n--;en.splice(n+1,0,e)}else en.push(e);rn||(rn=!0,Qe(ln))}}(this)},pn.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||o(e)||this.deep){var t=this.value;if(this.value=e,this.user){var n='callback for watcher "'+this.expression+'"';Be(this.cb,this.vm,[e,t],this.vm,n)}else this.cb.call(this.vm,e,t)}}},pn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},pn.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},pn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||h(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var dn={enumerable:!0,configurable:!0,get:S,set:S};function vn(e,t,n){dn.get=function(){return this[t][n]},dn.set=function(e){this[t][n]=e},Object.defineProperty(e,n,dn)}function hn(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var n=e.$options.propsData||{},r=e._props={},i=e.$options._propKeys=[];e.$parent&&$e(!1);var o=function(o){i.push(o);var a=Ie(o,t,n,e);xe(r,o,a),o in e||vn(e,"_props",o)};for(var a in t)o(a);$e(!0)}(e,t.props),t.methods&&function(e,t){e.$options.props;for(var n in t)e[n]="function"!=typeof t[n]?S:x(t[n],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;s(t=e._data="function"==typeof t?function(e,t){le();try{return e.call(t,t)}catch(e){return He(e,t,"data()"),{}}finally{fe()}}(t,e):t||{})||(t={});var n=Object.keys(t),r=e.$options.props,i=(e.$options.methods,n.length);for(;i--;){var o=n[i];r&&y(r,o)||(a=void 0,36!==(a=(o+"").charCodeAt(0))&&95!==a&&vn(e,"_data",o))}var a;Ce(t,!0)}(e):Ce(e._data={},!0),t.computed&&function(e,t){var n=e._computedWatchers=Object.create(null),r=te();for(var i in t){var o=t[i],a="function"==typeof o?o:o.get;r||(n[i]=new pn(e,a||S,S,mn)),i in e||yn(e,i,o)}}(e,t.computed),t.watch&&t.watch!==Y&&function(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var i=0;i-1:"string"==typeof e?e.split(",").indexOf(t)>-1:(n=e,"[object RegExp]"===a.call(n)&&e.test(t));var n}function On(e,t){var n=e.cache,r=e.keys,i=e._vnode;for(var o in n){var a=n[o];if(a){var s=a.name;s&&!t(s)&&Sn(n,o,r,i)}}}function Sn(e,t,n,r){var i=e[t];!i||r&&i.tag===r.tag||i.componentInstance.$destroy(),e[t]=null,h(n,t)}!function(t){t.prototype._init=function(t){var n=this;n._uid=$n++,n._isVue=!0,t&&t._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var i=r.componentOptions;n.propsData=i.propsData,n._parentListeners=i.listeners,n._renderChildren=i.children,n._componentTag=i.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(n,t):n.$options=De(wn(n.constructor),t||{},n),n._renderProxy=n,n._self=n,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(n),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&Wt(e,t)}(n),function(t){t._vnode=null,t._staticTrees=null;var n=t.$options,r=t.$vnode=n._parentVnode,i=r&&r.context;t.$slots=lt(n._renderChildren,i),t.$scopedSlots=e,t._c=function(e,n,r,i){return Ht(t,e,n,r,i,!1)},t.$createElement=function(e,n,r,i){return Ht(t,e,n,r,i,!0)};var o=r&&r.data;xe(t,"$attrs",o&&o.attrs||e,null,!0),xe(t,"$listeners",n._parentListeners||e,null,!0)}(n),Qt(n,"beforeCreate"),function(e){var t=ut(e.$options.inject,e);t&&($e(!1),Object.keys(t).forEach(function(n){xe(e,n,t[n])}),$e(!0))}(n),hn(n),function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(n),Qt(n,"created"),n.$options.el&&n.$mount(n.$options.el)}}(Cn),function(e){var t={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=ke,e.prototype.$delete=Ae,e.prototype.$watch=function(e,t,n){if(s(t))return bn(this,e,t,n);(n=n||{}).user=!0;var r=new pn(this,e,t,n);if(n.immediate){var i='callback for immediate watcher "'+r.expression+'"';le(),Be(t,this,[r.value],this,i),fe()}return function(){r.teardown()}}}(Cn),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this;if(Array.isArray(e))for(var i=0,o=e.length;i1?k(t):t;for(var n=k(arguments,1),r='event handler for "'+e+'"',i=0,o=t.length;iparseInt(this.max)&&Sn(e,t[0],t,this._vnode),this.vnodeToCache=null}}},created:function(){this.cache=Object.create(null),this.keys=[]},destroyed:function(){for(var e in this.cache)Sn(this.cache,e,this.keys)},mounted:function(){var e=this;this.cacheVNode(),this.$watch("include",function(t){On(e,function(e){return An(t,e)})}),this.$watch("exclude",function(t){On(e,function(e){return!An(t,e)})})},updated:function(){this.cacheVNode()},render:function(){var e=this.$slots.default,t=zt(e),n=t&&t.componentOptions;if(n){var r=kn(n),i=this.include,o=this.exclude;if(i&&(!r||!An(i,r))||o&&r&&An(o,r))return t;var a=this.cache,s=this.keys,c=null==t.key?n.Ctor.cid+(n.tag?"::"+n.tag:""):t.key;a[c]?(t.componentInstance=a[c].componentInstance,h(s,c),s.push(c)):(this.vnodeToCache=t,this.keyToCache=c),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return F}};Object.defineProperty(e,"config",t),e.util={warn:ae,extend:A,mergeOptions:De,defineReactive:xe},e.set=ke,e.delete=Ae,e.nextTick=Qe,e.observable=function(e){return Ce(e),e},e.options=Object.create(null),I.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,A(e.options.components,Nn),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=k(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=De(this.options,e),this}}(e),xn(e),function(e){I.forEach(function(t){e[t]=function(e,n){return n?("component"===t&&s(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}})}(e)}(Cn),Object.defineProperty(Cn.prototype,"$isServer",{get:te}),Object.defineProperty(Cn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(Cn,"FunctionalRenderContext",{value:Et}),Cn.version="2.6.14";var En=p("style,class"),jn=p("input,textarea,option,select,progress"),Dn=function(e,t,n){return"value"===n&&jn(e)&&"button"!==t||"selected"===n&&"option"===e||"checked"===n&&"input"===e||"muted"===n&&"video"===e},Ln=p("contenteditable,draggable,spellcheck"),In=p("events,caret,typing,plaintext-only"),Mn=function(e,t){return Bn(t)||"false"===t?"false":"contenteditable"===e&&In(t)?t:"true"},Fn=p("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,truespeed,typemustmatch,visible"),Pn="http://www.w3.org/1999/xlink",Rn=function(e){return":"===e.charAt(5)&&"xlink"===e.slice(0,5)},Hn=function(e){return Rn(e)?e.slice(6,e.length):""},Bn=function(e){return null==e||!1===e};function Un(e){for(var t=e.data,r=e,i=e;n(i.componentInstance);)(i=i.componentInstance._vnode)&&i.data&&(t=Vn(i.data,t));for(;n(r=r.parent);)r&&r.data&&(t=Vn(t,r.data));return function(e,t){if(n(e)||n(t))return zn(e,Kn(t));return""}(t.staticClass,t.class)}function Vn(e,t){return{staticClass:zn(e.staticClass,t.staticClass),class:n(e.class)?[e.class,t.class]:t.class}}function zn(e,t){return e?t?e+" "+t:e:t||""}function Kn(e){return Array.isArray(e)?function(e){for(var t,r="",i=0,o=e.length;i-1?mr(e,t,n):Fn(t)?Bn(n)?e.removeAttribute(t):(n="allowfullscreen"===t&&"EMBED"===e.tagName?"true":t,e.setAttribute(t,n)):Ln(t)?e.setAttribute(t,Mn(t,n)):Rn(t)?Bn(n)?e.removeAttributeNS(Pn,Hn(t)):e.setAttributeNS(Pn,t,n):mr(e,t,n)}function mr(e,t,n){if(Bn(n))e.removeAttribute(t);else{if(q&&!W&&"TEXTAREA"===e.tagName&&"placeholder"===t&&""!==n&&!e.__ieph){var r=function(t){t.stopImmediatePropagation(),e.removeEventListener("input",r)};e.addEventListener("input",r),e.__ieph=!0}e.setAttribute(t,n)}}var yr={create:vr,update:vr};function gr(e,r){var i=r.elm,o=r.data,a=e.data;if(!(t(o.staticClass)&&t(o.class)&&(t(a)||t(a.staticClass)&&t(a.class)))){var s=Un(r),c=i._transitionClasses;n(c)&&(s=zn(s,Kn(c))),s!==i._prevClass&&(i.setAttribute("class",s),i._prevClass=s)}}var _r,br,$r,wr,Cr,xr,kr={create:gr,update:gr},Ar=/[\w).+\-_$\]]/;function Or(e){var t,n,r,i,o,a=!1,s=!1,c=!1,u=!1,l=0,f=0,p=0,d=0;for(r=0;r=0&&" "===(h=e.charAt(v));v--);h&&Ar.test(h)||(u=!0)}}else void 0===i?(d=r+1,i=e.slice(0,r).trim()):m();function m(){(o||(o=[])).push(e.slice(d,r).trim()),d=r+1}if(void 0===i?i=e.slice(0,r).trim():0!==d&&m(),o)for(r=0;r-1?{exp:e.slice(0,wr),key:'"'+e.slice(wr+1)+'"'}:{exp:e,key:null};br=e,wr=Cr=xr=0;for(;!zr();)Kr($r=Vr())?qr($r):91===$r&&Jr($r);return{exp:e.slice(0,Cr),key:e.slice(Cr+1,xr)}}(e);return null===n.key?e+"="+t:"$set("+n.exp+", "+n.key+", "+t+")"}function Vr(){return br.charCodeAt(++wr)}function zr(){return wr>=_r}function Kr(e){return 34===e||39===e}function Jr(e){var t=1;for(Cr=wr;!zr();)if(Kr(e=Vr()))qr(e);else if(91===e&&t++,93===e&&t--,0===t){xr=wr;break}}function qr(e){for(var t=e;!zr()&&(e=Vr())!==t;);}var Wr,Zr="__r",Gr="__c";function Xr(e,t,n){var r=Wr;return function i(){null!==t.apply(null,arguments)&&ei(e,i,n,r)}}var Yr=Ke&&!(X&&Number(X[1])<=53);function Qr(e,t,n,r){if(Yr){var i=sn,o=t;t=o._wrapper=function(e){if(e.target===e.currentTarget||e.timeStamp>=i||e.timeStamp<=0||e.target.ownerDocument!==document)return o.apply(this,arguments)}}Wr.addEventListener(e,t,Q?{capture:n,passive:r}:n)}function ei(e,t,n,r){(r||Wr).removeEventListener(e,t._wrapper||t,n)}function ti(e,r){if(!t(e.data.on)||!t(r.data.on)){var i=r.data.on||{},o=e.data.on||{};Wr=r.elm,function(e){if(n(e[Zr])){var t=q?"change":"input";e[t]=[].concat(e[Zr],e[t]||[]),delete e[Zr]}n(e[Gr])&&(e.change=[].concat(e[Gr],e.change||[]),delete e[Gr])}(i),it(i,o,Qr,ei,Xr,r.context),Wr=void 0}}var ni,ri={create:ti,update:ti};function ii(e,r){if(!t(e.data.domProps)||!t(r.data.domProps)){var i,o,a=r.elm,s=e.data.domProps||{},c=r.data.domProps||{};for(i in n(c.__ob__)&&(c=r.data.domProps=A({},c)),s)i in c||(a[i]="");for(i in c){if(o=c[i],"textContent"===i||"innerHTML"===i){if(r.children&&(r.children.length=0),o===s[i])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===i&&"PROGRESS"!==a.tagName){a._value=o;var u=t(o)?"":String(o);oi(a,u)&&(a.value=u)}else if("innerHTML"===i&&Wn(a.tagName)&&t(a.innerHTML)){(ni=ni||document.createElement("div")).innerHTML=""+o+"";for(var l=ni.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}else if(o!==s[i])try{a[i]=o}catch(e){}}}}function oi(e,t){return!e.composing&&("OPTION"===e.tagName||function(e,t){var n=!0;try{n=document.activeElement!==e}catch(e){}return n&&e.value!==t}(e,t)||function(e,t){var r=e.value,i=e._vModifiers;if(n(i)){if(i.number)return f(r)!==f(t);if(i.trim)return r.trim()!==t.trim()}return r!==t}(e,t))}var ai={create:ii,update:ii},si=g(function(e){var t={},n=/:(.+)/;return e.split(/;(?![^(]*\))/g).forEach(function(e){if(e){var r=e.split(n);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t});function ci(e){var t=ui(e.style);return e.staticStyle?A(e.staticStyle,t):t}function ui(e){return Array.isArray(e)?O(e):"string"==typeof e?si(e):e}var li,fi=/^--/,pi=/\s*!important$/,di=function(e,t,n){if(fi.test(t))e.style.setProperty(t,n);else if(pi.test(n))e.style.setProperty(C(t),n.replace(pi,""),"important");else{var r=hi(t);if(Array.isArray(n))for(var i=0,o=n.length;i-1?t.split(gi).forEach(function(t){return e.classList.add(t)}):e.classList.add(t);else{var n=" "+(e.getAttribute("class")||"")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function bi(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(gi).forEach(function(t){return e.classList.remove(t)}):e.classList.remove(t),e.classList.length||e.removeAttribute("class");else{for(var n=" "+(e.getAttribute("class")||"")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?e.setAttribute("class",n):e.removeAttribute("class")}}function $i(e){if(e){if("object"==typeof e){var t={};return!1!==e.css&&A(t,wi(e.name||"v")),A(t,e),t}return"string"==typeof e?wi(e):void 0}}var wi=g(function(e){return{enterClass:e+"-enter",enterToClass:e+"-enter-to",enterActiveClass:e+"-enter-active",leaveClass:e+"-leave",leaveToClass:e+"-leave-to",leaveActiveClass:e+"-leave-active"}}),Ci=V&&!W,xi="transition",ki="animation",Ai="transition",Oi="transitionend",Si="animation",Ti="animationend";Ci&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(Ai="WebkitTransition",Oi="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Si="WebkitAnimation",Ti="webkitAnimationEnd"));var Ni=V?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(e){return e()};function Ei(e){Ni(function(){Ni(e)})}function ji(e,t){var n=e._transitionClasses||(e._transitionClasses=[]);n.indexOf(t)<0&&(n.push(t),_i(e,t))}function Di(e,t){e._transitionClasses&&h(e._transitionClasses,t),bi(e,t)}function Li(e,t,n){var r=Mi(e,t),i=r.type,o=r.timeout,a=r.propCount;if(!i)return n();var s=i===xi?Oi:Ti,c=0,u=function(){e.removeEventListener(s,l),n()},l=function(t){t.target===e&&++c>=a&&u()};setTimeout(function(){c0&&(n=xi,l=a,f=o.length):t===ki?u>0&&(n=ki,l=u,f=c.length):f=(n=(l=Math.max(a,u))>0?a>u?xi:ki:null)?n===xi?o.length:c.length:0,{type:n,timeout:l,propCount:f,hasTransform:n===xi&&Ii.test(r[Ai+"Property"])}}function Fi(e,t){for(;e.length1}function Vi(e,t){!0!==t.data.show&&Ri(t)}var zi=function(e){var o,a,s={},c=e.modules,u=e.nodeOps;for(o=0;ov?_(e,t(i[y+1])?null:i[y+1].elm,i,d,y,o):d>y&&$(r,p,v)}(p,h,y,o,l):n(y)?(n(e.text)&&u.setTextContent(p,""),_(p,null,y,0,y.length-1,o)):n(h)?$(h,0,h.length-1):n(e.text)&&u.setTextContent(p,""):e.text!==i.text&&u.setTextContent(p,i.text),n(v)&&n(d=v.hook)&&n(d=d.postpatch)&&d(e,i)}}}function k(e,t,i){if(r(i)&&n(e.parent))e.parent.data.pendingInsert=t;else for(var o=0;o-1,a.selected!==o&&(a.selected=o);else if(E(Zi(a),r))return void(e.selectedIndex!==s&&(e.selectedIndex=s));i||(e.selectedIndex=-1)}}function Wi(e,t){return t.every(function(t){return!E(t,e)})}function Zi(e){return"_value"in e?e._value:e.value}function Gi(e){e.target.composing=!0}function Xi(e){e.target.composing&&(e.target.composing=!1,Yi(e.target,"input"))}function Yi(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)}function Qi(e){return!e.componentInstance||e.data&&e.data.transition?e:Qi(e.componentInstance._vnode)}var eo={model:Ki,show:{bind:function(e,t,n){var r=t.value,i=(n=Qi(n)).data&&n.data.transition,o=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display;r&&i?(n.data.show=!0,Ri(n,function(){e.style.display=o})):e.style.display=r?o:"none"},update:function(e,t,n){var r=t.value;!r!=!t.oldValue&&((n=Qi(n)).data&&n.data.transition?(n.data.show=!0,r?Ri(n,function(){e.style.display=e.__vOriginalDisplay}):Hi(n,function(){e.style.display="none"})):e.style.display=r?e.__vOriginalDisplay:"none")},unbind:function(e,t,n,r,i){i||(e.style.display=e.__vOriginalDisplay)}}},to={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function no(e){var t=e&&e.componentOptions;return t&&t.Ctor.options.abstract?no(zt(t.children)):e}function ro(e){var t={},n=e.$options;for(var r in n.propsData)t[r]=e[r];var i=n._parentListeners;for(var o in i)t[b(o)]=i[o];return t}function io(e,t){if(/\d-keep-alive$/.test(t.tag))return e("keep-alive",{props:t.componentOptions.propsData})}var oo=function(e){return e.tag||pt(e)},ao=function(e){return"show"===e.name},so={name:"transition",props:to,abstract:!0,render:function(e){var t=this,n=this.$slots.default;if(n&&(n=n.filter(oo)).length){var r=this.mode,o=n[0];if(function(e){for(;e=e.parent;)if(e.data.transition)return!0}(this.$vnode))return o;var a=no(o);if(!a)return o;if(this._leaving)return io(e,o);var s="__transition-"+this._uid+"-";a.key=null==a.key?a.isComment?s+"comment":s+a.tag:i(a.key)?0===String(a.key).indexOf(s)?a.key:s+a.key:a.key;var c=(a.data||(a.data={})).transition=ro(this),u=this._vnode,l=no(u);if(a.data.directives&&a.data.directives.some(ao)&&(a.data.show=!0),l&&l.data&&!function(e,t){return t.key===e.key&&t.tag===e.tag}(a,l)&&!pt(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){var f=l.data.transition=A({},c);if("out-in"===r)return this._leaving=!0,ot(f,"afterLeave",function(){t._leaving=!1,t.$forceUpdate()}),io(e,o);if("in-out"===r){if(pt(a))return u;var p,d=function(){p()};ot(c,"afterEnter",d),ot(c,"enterCancelled",d),ot(f,"delayLeave",function(e){p=e})}}return o}}},co=A({tag:String,moveClass:String},to);function uo(e){e.elm._moveCb&&e.elm._moveCb(),e.elm._enterCb&&e.elm._enterCb()}function lo(e){e.data.newPos=e.elm.getBoundingClientRect()}function fo(e){var t=e.data.pos,n=e.data.newPos,r=t.left-n.left,i=t.top-n.top;if(r||i){e.data.moved=!0;var o=e.elm.style;o.transform=o.WebkitTransform="translate("+r+"px,"+i+"px)",o.transitionDuration="0s"}}delete co.mode;var po={Transition:so,TransitionGroup:{props:co,beforeMount:function(){var e=this,t=this._update;this._update=function(n,r){var i=Gt(e);e.__patch__(e._vnode,e.kept,!1,!0),e._vnode=e.kept,i(),t.call(e,n,r)}},render:function(e){for(var t=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,i=this.$slots.default||[],o=this.children=[],a=ro(this),s=0;s-1?Xn[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:Xn[e]=/HTMLUnknownElement/.test(t.toString())},A(Cn.options.directives,eo),A(Cn.options.components,po),Cn.prototype.__patch__=V?zi:S,Cn.prototype.$mount=function(e,t){return function(e,t,n){var r;return e.$el=t,e.$options.render||(e.$options.render=ve),Qt(e,"beforeMount"),r=function(){e._update(e._render(),n)},new pn(e,r,S,{before:function(){e._isMounted&&!e._isDestroyed&&Qt(e,"beforeUpdate")}},!0),n=!1,null==e.$vnode&&(e._isMounted=!0,Qt(e,"mounted")),e}(this,e=e&&V?Qn(e):void 0,t)},V&&setTimeout(function(){F.devtools&&ne&&ne.emit("init",Cn)},0);var vo=/\{\{((?:.|\r?\n)+?)\}\}/g,ho=/[-.*+?^${}()|[\]\/\\]/g,mo=g(function(e){var t=e[0].replace(ho,"\\$&"),n=e[1].replace(ho,"\\$&");return new RegExp(t+"((?:.|\\n)+?)"+n,"g")});var yo={staticKeys:["staticClass"],transformNode:function(e,t){t.warn;var n=Pr(e,"class");n&&(e.staticClass=JSON.stringify(n));var r=Fr(e,"class",!1);r&&(e.classBinding=r)},genData:function(e){var t="";return e.staticClass&&(t+="staticClass:"+e.staticClass+","),e.classBinding&&(t+="class:"+e.classBinding+","),t}};var go,_o={staticKeys:["staticStyle"],transformNode:function(e,t){t.warn;var n=Pr(e,"style");n&&(e.staticStyle=JSON.stringify(si(n)));var r=Fr(e,"style",!1);r&&(e.styleBinding=r)},genData:function(e){var t="";return e.staticStyle&&(t+="staticStyle:"+e.staticStyle+","),e.styleBinding&&(t+="style:("+e.styleBinding+"),"),t}},bo=function(e){return(go=go||document.createElement("div")).innerHTML=e,go.textContent},$o=p("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),wo=p("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),Co=p("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),xo=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,ko=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,Ao="[a-zA-Z_][\\-\\.0-9_a-zA-Z"+P.source+"]*",Oo="((?:"+Ao+"\\:)?"+Ao+")",So=new RegExp("^<"+Oo),To=/^\s*(\/?)>/,No=new RegExp("^<\\/"+Oo+"[^>]*>"),Eo=/^]+>/i,jo=/^",""":'"',"&":"&"," ":"\n"," ":"\t","'":"'"},Fo=/&(?:lt|gt|quot|amp|#39);/g,Po=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,Ro=p("pre,textarea",!0),Ho=function(e,t){return e&&Ro(e)&&"\n"===t[0]};function Bo(e,t){var n=t?Po:Fo;return e.replace(n,function(e){return Mo[e]})}var Uo,Vo,zo,Ko,Jo,qo,Wo,Zo,Go=/^@|^v-on:/,Xo=/^v-|^@|^:|^#/,Yo=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,Qo=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,ea=/^\(|\)$/g,ta=/^\[.*\]$/,na=/:(.*)$/,ra=/^:|^\.|^v-bind:/,ia=/\.[^.\]]+(?=[^\]]*$)/g,oa=/^v-slot(:|$)|^#/,aa=/[\r\n]/,sa=/[ \f\t\r\n]+/g,ca=g(bo),ua="_empty_";function la(e,t,n){return{type:1,tag:e,attrsList:t,attrsMap:ya(t),rawAttrsMap:{},parent:n,children:[]}}function fa(e,t){Uo=t.warn||Tr,qo=t.isPreTag||T,Wo=t.mustUseProp||T,Zo=t.getTagNamespace||T;t.isReservedTag;zo=Nr(t.modules,"transformNode"),Ko=Nr(t.modules,"preTransformNode"),Jo=Nr(t.modules,"postTransformNode"),Vo=t.delimiters;var n,r,i=[],o=!1!==t.preserveWhitespace,a=t.whitespace,s=!1,c=!1;function u(e){if(l(e),s||e.processed||(e=pa(e,t)),i.length||e===n||n.if&&(e.elseif||e.else)&&va(n,{exp:e.elseif,block:e}),r&&!e.forbidden)if(e.elseif||e.else)a=e,(u=function(e){var t=e.length;for(;t--;){if(1===e[t].type)return e[t];e.pop()}}(r.children))&&u.if&&va(u,{exp:a.elseif,block:a});else{if(e.slotScope){var o=e.slotTarget||'"default"';(r.scopedSlots||(r.scopedSlots={}))[o]=e}r.children.push(e),e.parent=r}var a,u;e.children=e.children.filter(function(e){return!e.slotScope}),l(e),e.pre&&(s=!1),qo(e.tag)&&(c=!1);for(var f=0;f]*>)","i")),p=e.replace(f,function(e,n,r){return u=r.length,Lo(l)||"noscript"===l||(n=n.replace(//g,"$1").replace(//g,"$1")),Ho(l,n)&&(n=n.slice(1)),t.chars&&t.chars(n),""});c+=e.length-p.length,e=p,A(l,c-u,c)}else{var d=e.indexOf("<");if(0===d){if(jo.test(e)){var v=e.indexOf("--\x3e");if(v>=0){t.shouldKeepComment&&t.comment(e.substring(4,v),c,c+v+3),C(v+3);continue}}if(Do.test(e)){var h=e.indexOf("]>");if(h>=0){C(h+2);continue}}var m=e.match(Eo);if(m){C(m[0].length);continue}var y=e.match(No);if(y){var g=c;C(y[0].length),A(y[1],g,c);continue}var _=x();if(_){k(_),Ho(_.tagName,e)&&C(1);continue}}var b=void 0,$=void 0,w=void 0;if(d>=0){for($=e.slice(d);!(No.test($)||So.test($)||jo.test($)||Do.test($)||(w=$.indexOf("<",1))<0);)d+=w,$=e.slice(d);b=e.substring(0,d)}d<0&&(b=e),b&&C(b.length),t.chars&&b&&t.chars(b,c-b.length,c)}if(e===n){t.chars&&t.chars(e);break}}function C(t){c+=t,e=e.substring(t)}function x(){var t=e.match(So);if(t){var n,r,i={tagName:t[1],attrs:[],start:c};for(C(t[0].length);!(n=e.match(To))&&(r=e.match(ko)||e.match(xo));)r.start=c,C(r[0].length),r.end=c,i.attrs.push(r);if(n)return i.unarySlash=n[1],C(n[0].length),i.end=c,i}}function k(e){var n=e.tagName,c=e.unarySlash;o&&("p"===r&&Co(n)&&A(r),s(n)&&r===n&&A(n));for(var u=a(n)||!!c,l=e.attrs.length,f=new Array(l),p=0;p=0&&i[a].lowerCasedTag!==s;a--);else a=0;if(a>=0){for(var u=i.length-1;u>=a;u--)t.end&&t.end(i[u].tag,n,o);i.length=a,r=a&&i[a-1].tag}else"br"===s?t.start&&t.start(e,[],!0,n,o):"p"===s&&(t.start&&t.start(e,[],!1,n,o),t.end&&t.end(e,n,o))}A()}(e,{warn:Uo,expectHTML:t.expectHTML,isUnaryTag:t.isUnaryTag,canBeLeftOpenTag:t.canBeLeftOpenTag,shouldDecodeNewlines:t.shouldDecodeNewlines,shouldDecodeNewlinesForHref:t.shouldDecodeNewlinesForHref,shouldKeepComment:t.comments,outputSourceRange:t.outputSourceRange,start:function(e,o,a,l,f){var p=r&&r.ns||Zo(e);q&&"svg"===p&&(o=function(e){for(var t=[],n=0;nc&&(s.push(o=e.slice(c,i)),a.push(JSON.stringify(o)));var u=Or(r[1].trim());a.push("_s("+u+")"),s.push({"@binding":u}),c=i+r[0].length}return c-1"+("true"===o?":("+t+")":":_q("+t+","+o+")")),Mr(e,"change","var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+o+"):("+a+");if(Array.isArray($$a)){var $$v="+(r?"_n("+i+")":i)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+Ur(t,"$$a.concat([$$v])")+")}else{$$i>-1&&("+Ur(t,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+Ur(t,"$$c")+"}",null,!0)}(e,r,i);else if("input"===o&&"radio"===a)!function(e,t,n){var r=n&&n.number,i=Fr(e,"value")||"null";Er(e,"checked","_q("+t+","+(i=r?"_n("+i+")":i)+")"),Mr(e,"change",Ur(t,i),null,!0)}(e,r,i);else if("input"===o||"textarea"===o)!function(e,t,n){var r=e.attrsMap.type,i=n||{},o=i.lazy,a=i.number,s=i.trim,c=!o&&"range"!==r,u=o?"change":"range"===r?Zr:"input",l="$event.target.value";s&&(l="$event.target.value.trim()"),a&&(l="_n("+l+")");var f=Ur(t,l);c&&(f="if($event.target.composing)return;"+f),Er(e,"value","("+t+")"),Mr(e,u,f,null,!0),(s||a)&&Mr(e,"blur","$forceUpdate()")}(e,r,i);else if(!F.isReservedTag(o))return Br(e,r,i),!1;return!0},text:function(e,t){t.value&&Er(e,"textContent","_s("+t.value+")",t)},html:function(e,t){t.value&&Er(e,"innerHTML","_s("+t.value+")",t)}},isPreTag:function(e){return"pre"===e},isUnaryTag:$o,mustUseProp:Dn,canBeLeftOpenTag:wo,isReservedTag:Zn,getTagNamespace:Gn,staticKeys:function(e){return e.reduce(function(e,t){return e.concat(t.staticKeys||[])},[]).join(",")}($a)},ka=g(function(e){return p("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(e?","+e:""))});function Aa(e,t){e&&(wa=ka(t.staticKeys||""),Ca=t.isReservedTag||T,function e(t){t.static=function(e){if(2===e.type)return!1;if(3===e.type)return!0;return!(!e.pre&&(e.hasBindings||e.if||e.for||d(e.tag)||!Ca(e.tag)||function(e){for(;e.parent;){if("template"!==(e=e.parent).tag)return!1;if(e.for)return!0}return!1}(e)||!Object.keys(e).every(wa)))}(t);if(1===t.type){if(!Ca(t.tag)&&"slot"!==t.tag&&null==t.attrsMap["inline-template"])return;for(var n=0,r=t.children.length;n|^function(?:\s+[\w$]+)?\s*\(/,Sa=/\([^)]*?\);*$/,Ta=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,Na={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},Ea={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},ja=function(e){return"if("+e+")return null;"},Da={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:ja("$event.target !== $event.currentTarget"),ctrl:ja("!$event.ctrlKey"),shift:ja("!$event.shiftKey"),alt:ja("!$event.altKey"),meta:ja("!$event.metaKey"),left:ja("'button' in $event && $event.button !== 0"),middle:ja("'button' in $event && $event.button !== 1"),right:ja("'button' in $event && $event.button !== 2")};function La(e,t){var n=t?"nativeOn:":"on:",r="",i="";for(var o in e){var a=Ia(e[o]);e[o]&&e[o].dynamic?i+=o+","+a+",":r+='"'+o+'":'+a+","}return r="{"+r.slice(0,-1)+"}",i?n+"_d("+r+",["+i.slice(0,-1)+"])":n+r}function Ia(e){if(!e)return"function(){}";if(Array.isArray(e))return"["+e.map(function(e){return Ia(e)}).join(",")+"]";var t=Ta.test(e.value),n=Oa.test(e.value),r=Ta.test(e.value.replace(Sa,""));if(e.modifiers){var i="",o="",a=[];for(var s in e.modifiers)if(Da[s])o+=Da[s],Na[s]&&a.push(s);else if("exact"===s){var c=e.modifiers;o+=ja(["ctrl","shift","alt","meta"].filter(function(e){return!c[e]}).map(function(e){return"$event."+e+"Key"}).join("||"))}else a.push(s);return a.length&&(i+=function(e){return"if(!$event.type.indexOf('key')&&"+e.map(Ma).join("&&")+")return null;"}(a)),o&&(i+=o),"function($event){"+i+(t?"return "+e.value+".apply(null, arguments)":n?"return ("+e.value+").apply(null, arguments)":r?"return "+e.value:e.value)+"}"}return t||n?e.value:"function($event){"+(r?"return "+e.value:e.value)+"}"}function Ma(e){var t=parseInt(e,10);if(t)return"$event.keyCode!=="+t;var n=Na[e],r=Ea[e];return"_k($event.keyCode,"+JSON.stringify(e)+","+JSON.stringify(n)+",$event.key,"+JSON.stringify(r)+")"}var Fa={on:function(e,t){e.wrapListeners=function(e){return"_g("+e+","+t.value+")"}},bind:function(e,t){e.wrapData=function(n){return"_b("+n+",'"+e.tag+"',"+t.value+","+(t.modifiers&&t.modifiers.prop?"true":"false")+(t.modifiers&&t.modifiers.sync?",true":"")+")"}},cloak:S},Pa=function(e){this.options=e,this.warn=e.warn||Tr,this.transforms=Nr(e.modules,"transformCode"),this.dataGenFns=Nr(e.modules,"genData"),this.directives=A(A({},Fa),e.directives);var t=e.isReservedTag||T;this.maybeComponent=function(e){return!!e.component||!t(e.tag)},this.onceId=0,this.staticRenderFns=[],this.pre=!1};function Ra(e,t){var n=new Pa(t);return{render:"with(this){return "+(e?"script"===e.tag?"null":Ha(e,n):'_c("div")')+"}",staticRenderFns:n.staticRenderFns}}function Ha(e,t){if(e.parent&&(e.pre=e.pre||e.parent.pre),e.staticRoot&&!e.staticProcessed)return Ba(e,t);if(e.once&&!e.onceProcessed)return Ua(e,t);if(e.for&&!e.forProcessed)return za(e,t);if(e.if&&!e.ifProcessed)return Va(e,t);if("template"!==e.tag||e.slotTarget||t.pre){if("slot"===e.tag)return function(e,t){var n=e.slotName||'"default"',r=Wa(e,t),i="_t("+n+(r?",function(){return "+r+"}":""),o=e.attrs||e.dynamicAttrs?Xa((e.attrs||[]).concat(e.dynamicAttrs||[]).map(function(e){return{name:b(e.name),value:e.value,dynamic:e.dynamic}})):null,a=e.attrsMap["v-bind"];!o&&!a||r||(i+=",null");o&&(i+=","+o);a&&(i+=(o?"":",null")+","+a);return i+")"}(e,t);var n;if(e.component)n=function(e,t,n){var r=t.inlineTemplate?null:Wa(t,n,!0);return"_c("+e+","+Ka(t,n)+(r?","+r:"")+")"}(e.component,e,t);else{var r;(!e.plain||e.pre&&t.maybeComponent(e))&&(r=Ka(e,t));var i=e.inlineTemplate?null:Wa(e,t,!0);n="_c('"+e.tag+"'"+(r?","+r:"")+(i?","+i:"")+")"}for(var o=0;o>>0}(a):"")+")"}(e,e.scopedSlots,t)+","),e.model&&(n+="model:{value:"+e.model.value+",callback:"+e.model.callback+",expression:"+e.model.expression+"},"),e.inlineTemplate){var o=function(e,t){var n=e.children[0];if(n&&1===n.type){var r=Ra(n,t.options);return"inlineTemplate:{render:function(){"+r.render+"},staticRenderFns:["+r.staticRenderFns.map(function(e){return"function(){"+e+"}"}).join(",")+"]}"}}(e,t);o&&(n+=o+",")}return n=n.replace(/,$/,"")+"}",e.dynamicAttrs&&(n="_b("+n+',"'+e.tag+'",'+Xa(e.dynamicAttrs)+")"),e.wrapData&&(n=e.wrapData(n)),e.wrapListeners&&(n=e.wrapListeners(n)),n}function Ja(e){return 1===e.type&&("slot"===e.tag||e.children.some(Ja))}function qa(e,t){var n=e.attrsMap["slot-scope"];if(e.if&&!e.ifProcessed&&!n)return Va(e,t,qa,"null");if(e.for&&!e.forProcessed)return za(e,t,qa);var r=e.slotScope===ua?"":String(e.slotScope),i="function("+r+"){return "+("template"===e.tag?e.if&&n?"("+e.if+")?"+(Wa(e,t)||"undefined")+":undefined":Wa(e,t)||"undefined":Ha(e,t))+"}",o=r?"":",proxy:true";return"{key:"+(e.slotTarget||'"default"')+",fn:"+i+o+"}"}function Wa(e,t,n,r,i){var o=e.children;if(o.length){var a=o[0];if(1===o.length&&a.for&&"template"!==a.tag&&"slot"!==a.tag){var s=n?t.maybeComponent(a)?",1":",0":"";return""+(r||Ha)(a,t)+s}var c=n?function(e,t){for(var n=0,r=0;r':'
    ',ns.innerHTML.indexOf(" ")>0}var as=!!V&&os(!1),ss=!!V&&os(!0),cs=g(function(e){var t=Qn(e);return t&&t.innerHTML}),us=Cn.prototype.$mount;return Cn.prototype.$mount=function(e,t){if((e=e&&Qn(e))===document.body||e===document.documentElement)return this;var n=this.$options;if(!n.render){var r=n.template;if(r)if("string"==typeof r)"#"===r.charAt(0)&&(r=cs(r));else{if(!r.nodeType)return this;r=r.innerHTML}else e&&(r=function(e){if(e.outerHTML)return e.outerHTML;var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}(e));if(r){var i=is(r,{outputSourceRange:!1,shouldDecodeNewlines:as,shouldDecodeNewlinesForHref:ss,delimiters:n.delimiters,comments:n.comments},this),o=i.render,a=i.staticRenderFns;n.render=o,n.staticRenderFns=a}}return us.call(this,e,t)},Cn.compile=is,Cn}); \ No newline at end of file diff --git a/resources/lfmApiCredentials.json b/resources/lfmApiCredentials.json new file mode 100644 index 00000000..18a973d7 --- /dev/null +++ b/resources/lfmApiCredentials.json @@ -0,0 +1,4 @@ +{ + "key": "174905d201451602407b428a86e8344d", + "secret": "be61d4081f6adec150f0130939f854bb" +} diff --git a/resources/lyrics/Vibrant.js b/resources/lyrics/Vibrant.js new file mode 100644 index 00000000..94f2c5ee --- /dev/null +++ b/resources/lyrics/Vibrant.js @@ -0,0 +1,872 @@ +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o b) ? 1 : 0); + }, + sum: function(array, f) { + var o = {}; + return array.reduce(f ? function(p, d, i) { + o.index = i; + return p + f.call(o, d); + } : function(p, d) { + return p + d; + }, 0); + }, + max: function(array, f) { + return Math.max.apply(null, f ? pv.map(array, f) : array); + } + } +} + +/** + * Basic Javascript port of the MMCQ (modified median cut quantization) + * algorithm from the Leptonica library (http://www.leptonica.com/). + * Returns a color map you can use to map original pixels to the reduced + * palette. Still a work in progress. + * + * @author Nick Rabinowitz + * @example + +// array of pixels as [R,G,B] arrays +var myPixels = [[190,197,190], [202,204,200], [207,214,210], [211,214,211], [205,207,207] + // etc + ]; +var maxColors = 4; + +var cmap = MMCQ.quantize(myPixels, maxColors); +var newPalette = cmap.palette(); +var newPixels = myPixels.map(function(p) { + return cmap.map(p); +}); + + */ +var MMCQ = (function() { + // private constants + var sigbits = 5, + rshift = 8 - sigbits, + maxIterations = 1000, + fractByPopulations = 0.75; + + // get reduced-space color index for a pixel + + function getColorIndex(r, g, b) { + return (r << (2 * sigbits)) + (g << sigbits) + b; + } + + // Simple priority queue + + function PQueue(comparator) { + var contents = [], + sorted = false; + + function sort() { + contents.sort(comparator); + sorted = true; + } + + return { + push: function(o) { + contents.push(o); + sorted = false; + }, + peek: function(index) { + if (!sorted) sort(); + if (index === undefined) index = contents.length - 1; + return contents[index]; + }, + pop: function() { + if (!sorted) sort(); + return contents.pop(); + }, + size: function() { + return contents.length; + }, + map: function(f) { + return contents.map(f); + }, + debug: function() { + if (!sorted) sort(); + return contents; + } + }; + } + + // 3d color space box + + function VBox(r1, r2, g1, g2, b1, b2, histo) { + var vbox = this; + vbox.r1 = r1; + vbox.r2 = r2; + vbox.g1 = g1; + vbox.g2 = g2; + vbox.b1 = b1; + vbox.b2 = b2; + vbox.histo = histo; + } + VBox.prototype = { + volume: function(force) { + var vbox = this; + if (!vbox._volume || force) { + vbox._volume = ((vbox.r2 - vbox.r1 + 1) * (vbox.g2 - vbox.g1 + 1) * (vbox.b2 - vbox.b1 + 1)); + } + return vbox._volume; + }, + count: function(force) { + var vbox = this, + histo = vbox.histo; + if (!vbox._count_set || force) { + var npix = 0, + i, j, k; + for (i = vbox.r1; i <= vbox.r2; i++) { + for (j = vbox.g1; j <= vbox.g2; j++) { + for (k = vbox.b1; k <= vbox.b2; k++) { + index = getColorIndex(i, j, k); + npix += (histo[index] || 0); + } + } + } + vbox._count = npix; + vbox._count_set = true; + } + return vbox._count; + }, + copy: function() { + var vbox = this; + return new VBox(vbox.r1, vbox.r2, vbox.g1, vbox.g2, vbox.b1, vbox.b2, vbox.histo); + }, + avg: function(force) { + var vbox = this, + histo = vbox.histo; + if (!vbox._avg || force) { + var ntot = 0, + mult = 1 << (8 - sigbits), + rsum = 0, + gsum = 0, + bsum = 0, + hval, + i, j, k, histoindex; + for (i = vbox.r1; i <= vbox.r2; i++) { + for (j = vbox.g1; j <= vbox.g2; j++) { + for (k = vbox.b1; k <= vbox.b2; k++) { + histoindex = getColorIndex(i, j, k); + hval = histo[histoindex] || 0; + ntot += hval; + rsum += (hval * (i + 0.5) * mult); + gsum += (hval * (j + 0.5) * mult); + bsum += (hval * (k + 0.5) * mult); + } + } + } + if (ntot) { + vbox._avg = [~~(rsum / ntot), ~~ (gsum / ntot), ~~ (bsum / ntot)]; + } else { + //console.log('empty box'); + vbox._avg = [~~(mult * (vbox.r1 + vbox.r2 + 1) / 2), ~~ (mult * (vbox.g1 + vbox.g2 + 1) / 2), ~~ (mult * (vbox.b1 + vbox.b2 + 1) / 2)]; + } + } + return vbox._avg; + }, + contains: function(pixel) { + var vbox = this, + rval = pixel[0] >> rshift; + gval = pixel[1] >> rshift; + bval = pixel[2] >> rshift; + return (rval >= vbox.r1 && rval <= vbox.r2 && + gval >= vbox.g1 && gval <= vbox.g2 && + bval >= vbox.b1 && bval <= vbox.b2); + } + }; + + // Color map + + function CMap() { + this.vboxes = new PQueue(function(a, b) { + return pv.naturalOrder( + a.vbox.count() * a.vbox.volume(), + b.vbox.count() * b.vbox.volume() + ) + });; + } + CMap.prototype = { + push: function(vbox) { + this.vboxes.push({ + vbox: vbox, + color: vbox.avg() + }); + }, + palette: function() { + return this.vboxes.map(function(vb) { + return vb.color + }); + }, + size: function() { + return this.vboxes.size(); + }, + map: function(color) { + var vboxes = this.vboxes; + for (var i = 0; i < vboxes.size(); i++) { + if (vboxes.peek(i).vbox.contains(color)) { + return vboxes.peek(i).color; + } + } + return this.nearest(color); + }, + nearest: function(color) { + var vboxes = this.vboxes, + d1, d2, pColor; + for (var i = 0; i < vboxes.size(); i++) { + d2 = Math.sqrt( + Math.pow(color[0] - vboxes.peek(i).color[0], 2) + + Math.pow(color[1] - vboxes.peek(i).color[1], 2) + + Math.pow(color[2] - vboxes.peek(i).color[2], 2) + ); + if (d2 < d1 || d1 === undefined) { + d1 = d2; + pColor = vboxes.peek(i).color; + } + } + return pColor; + }, + forcebw: function() { + // XXX: won't work yet + var vboxes = this.vboxes; + vboxes.sort(function(a, b) { + return pv.naturalOrder(pv.sum(a.color), pv.sum(b.color)) + }); + + // force darkest color to black if everything < 5 + var lowest = vboxes[0].color; + if (lowest[0] < 5 && lowest[1] < 5 && lowest[2] < 5) + vboxes[0].color = [0, 0, 0]; + + // force lightest color to white if everything > 251 + var idx = vboxes.length - 1, + highest = vboxes[idx].color; + if (highest[0] > 251 && highest[1] > 251 && highest[2] > 251) + vboxes[idx].color = [255, 255, 255]; + } + }; + + // histo (1-d array, giving the number of pixels in + // each quantized region of color space), or null on error + + function getHisto(pixels) { + var histosize = 1 << (3 * sigbits), + histo = new Array(histosize), + index, rval, gval, bval; + pixels.forEach(function(pixel) { + rval = pixel[0] >> rshift; + gval = pixel[1] >> rshift; + bval = pixel[2] >> rshift; + index = getColorIndex(rval, gval, bval); + histo[index] = (histo[index] || 0) + 1; + }); + return histo; + } + + function vboxFromPixels(pixels, histo) { + var rmin = 1000000, + rmax = 0, + gmin = 1000000, + gmax = 0, + bmin = 1000000, + bmax = 0, + rval, gval, bval; + // find min/max + pixels.forEach(function(pixel) { + rval = pixel[0] >> rshift; + gval = pixel[1] >> rshift; + bval = pixel[2] >> rshift; + if (rval < rmin) rmin = rval; + else if (rval > rmax) rmax = rval; + if (gval < gmin) gmin = gval; + else if (gval > gmax) gmax = gval; + if (bval < bmin) bmin = bval; + else if (bval > bmax) bmax = bval; + }); + return new VBox(rmin, rmax, gmin, gmax, bmin, bmax, histo); + } + + function medianCutApply(histo, vbox) { + if (!vbox.count()) return; + + var rw = vbox.r2 - vbox.r1 + 1, + gw = vbox.g2 - vbox.g1 + 1, + bw = vbox.b2 - vbox.b1 + 1, + maxw = pv.max([rw, gw, bw]); + // only one pixel, no split + if (vbox.count() == 1) { + return [vbox.copy()] + } + /* Find the partial sum arrays along the selected axis. */ + var total = 0, + partialsum = [], + lookaheadsum = [], + i, j, k, sum, index; + if (maxw == rw) { + for (i = vbox.r1; i <= vbox.r2; i++) { + sum = 0; + for (j = vbox.g1; j <= vbox.g2; j++) { + for (k = vbox.b1; k <= vbox.b2; k++) { + index = getColorIndex(i, j, k); + sum += (histo[index] || 0); + } + } + total += sum; + partialsum[i] = total; + } + } else if (maxw == gw) { + for (i = vbox.g1; i <= vbox.g2; i++) { + sum = 0; + for (j = vbox.r1; j <= vbox.r2; j++) { + for (k = vbox.b1; k <= vbox.b2; k++) { + index = getColorIndex(j, i, k); + sum += (histo[index] || 0); + } + } + total += sum; + partialsum[i] = total; + } + } else { /* maxw == bw */ + for (i = vbox.b1; i <= vbox.b2; i++) { + sum = 0; + for (j = vbox.r1; j <= vbox.r2; j++) { + for (k = vbox.g1; k <= vbox.g2; k++) { + index = getColorIndex(j, k, i); + sum += (histo[index] || 0); + } + } + total += sum; + partialsum[i] = total; + } + } + partialsum.forEach(function(d, i) { + lookaheadsum[i] = total - d + }); + + function doCut(color) { + var dim1 = color + '1', + dim2 = color + '2', + left, right, vbox1, vbox2, d2, count2 = 0; + for (i = vbox[dim1]; i <= vbox[dim2]; i++) { + if (partialsum[i] > total / 2) { + vbox1 = vbox.copy(); + vbox2 = vbox.copy(); + left = i - vbox[dim1]; + right = vbox[dim2] - i; + if (left <= right) + d2 = Math.min(vbox[dim2] - 1, ~~ (i + right / 2)); + else d2 = Math.max(vbox[dim1], ~~ (i - 1 - left / 2)); + // avoid 0-count boxes + while (!partialsum[d2]) d2++; + count2 = lookaheadsum[d2]; + while (!count2 && partialsum[d2 - 1]) count2 = lookaheadsum[--d2]; + // set dimensions + vbox1[dim2] = d2; + vbox2[dim1] = vbox1[dim2] + 1; + // console.log('vbox counts:', vbox.count(), vbox1.count(), vbox2.count()); + return [vbox1, vbox2]; + } + } + + } + // determine the cut planes + return maxw == rw ? doCut('r') : + maxw == gw ? doCut('g') : + doCut('b'); + } + + function quantize(pixels, maxcolors) { + // short-circuit + if (!pixels.length || maxcolors < 2 || maxcolors > 256) { + // console.log('wrong number of maxcolors'); + return false; + } + + // XXX: check color content and convert to grayscale if insufficient + + var histo = getHisto(pixels), + histosize = 1 << (3 * sigbits); + + // check that we aren't below maxcolors already + var nColors = 0; + histo.forEach(function() { + nColors++ + }); + if (nColors <= maxcolors) { + // XXX: generate the new colors from the histo and return + } + + // get the beginning vbox from the colors + var vbox = vboxFromPixels(pixels, histo), + pq = new PQueue(function(a, b) { + return pv.naturalOrder(a.count(), b.count()) + }); + pq.push(vbox); + + // inner function to do the iteration + + function iter(lh, target) { + var ncolors = 1, + niters = 0, + vbox; + while (niters < maxIterations) { + vbox = lh.pop(); + if (!vbox.count()) { /* just put it back */ + lh.push(vbox); + niters++; + continue; + } + // do the cut + var vboxes = medianCutApply(histo, vbox), + vbox1 = vboxes[0], + vbox2 = vboxes[1]; + + if (!vbox1) { + // console.log("vbox1 not defined; shouldn't happen!"); + return; + } + lh.push(vbox1); + if (vbox2) { /* vbox2 can be null */ + lh.push(vbox2); + ncolors++; + } + if (ncolors >= target) return; + if (niters++ > maxIterations) { + // console.log("infinite loop; perhaps too few pixels!"); + return; + } + } + } + + // first set of colors, sorted by population + iter(pq, fractByPopulations * maxcolors); + // console.log(pq.size(), pq.debug().length, pq.debug().slice()); + + // Re-sort by the product of pixel occupancy times the size in color space. + var pq2 = new PQueue(function(a, b) { + return pv.naturalOrder(a.count() * a.volume(), b.count() * b.volume()) + }); + while (pq.size()) { + pq2.push(pq.pop()); + } + + // next set - generate the median cuts using the (npix * vol) sorting. + iter(pq2, maxcolors - pq2.size()); + + // calculate the actual colors + var cmap = new CMap(); + while (pq2.size()) { + cmap.push(pq2.pop()); + } + + return cmap; + } + + return { + quantize: quantize + } +})(); + +module.exports = MMCQ.quantize + +},{}],2:[function(require,module,exports){ + +/* + Vibrant.js + by Jari Zwarts + + Color algorithm class that finds variations on colors in an image. + + Credits + -------- + Lokesh Dhakar (http://www.lokeshdhakar.com) - Created ColorThief + Google - Palette support library in Android + */ + +(function() { + var CanvasImage, Swatch, Vibrant, + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + slice = [].slice; + + window.Swatch = Swatch = (function() { + Swatch.prototype.hsl = void 0; + + Swatch.prototype.rgb = void 0; + + Swatch.prototype.population = 1; + + Swatch.yiq = 0; + + function Swatch(rgb, population) { + this.rgb = rgb; + this.population = population; + } + + Swatch.prototype.getHsl = function() { + if (!this.hsl) { + return this.hsl = Vibrant.rgbToHsl(this.rgb[0], this.rgb[1], this.rgb[2]); + } else { + return this.hsl; + } + }; + + Swatch.prototype.getPopulation = function() { + return this.population; + }; + + Swatch.prototype.getRgb = function() { + return this.rgb; + }; + + Swatch.prototype.getHex = function() { + return "#" + ((1 << 24) + (this.rgb[0] << 16) + (this.rgb[1] << 8) + this.rgb[2]).toString(16).slice(1, 7); + }; + + Swatch.prototype.getTitleTextColor = function() { + this._ensureTextColors(); + if (this.yiq < 200) { + return "#fff"; + } else { + return "#000"; + } + }; + + Swatch.prototype.getBodyTextColor = function() { + this._ensureTextColors(); + if (this.yiq < 150) { + return "#fff"; + } else { + return "#000"; + } + }; + + Swatch.prototype._ensureTextColors = function() { + if (!this.yiq) { + return this.yiq = (this.rgb[0] * 299 + this.rgb[1] * 587 + this.rgb[2] * 114) / 1000; + } + }; + + return Swatch; + + })(); + + window.Vibrant = Vibrant = (function() { + Vibrant.prototype.quantize = require('quantize'); + + Vibrant.prototype._swatches = []; + + Vibrant.prototype.TARGET_DARK_LUMA = 0.26; + + Vibrant.prototype.MAX_DARK_LUMA = 0.45; + + Vibrant.prototype.MIN_LIGHT_LUMA = 0.55; + + Vibrant.prototype.TARGET_LIGHT_LUMA = 0.74; + + Vibrant.prototype.MIN_NORMAL_LUMA = 0.3; + + Vibrant.prototype.TARGET_NORMAL_LUMA = 0.5; + + Vibrant.prototype.MAX_NORMAL_LUMA = 0.7; + + Vibrant.prototype.TARGET_MUTED_SATURATION = 0.3; + + Vibrant.prototype.MAX_MUTED_SATURATION = 0.4; + + Vibrant.prototype.TARGET_VIBRANT_SATURATION = 1; + + Vibrant.prototype.MIN_VIBRANT_SATURATION = 0.35; + + Vibrant.prototype.WEIGHT_SATURATION = 3; + + Vibrant.prototype.WEIGHT_LUMA = 6; + + Vibrant.prototype.WEIGHT_POPULATION = 1; + + Vibrant.prototype.VibrantSwatch = void 0; + + Vibrant.prototype.MutedSwatch = void 0; + + Vibrant.prototype.DarkVibrantSwatch = void 0; + + Vibrant.prototype.DarkMutedSwatch = void 0; + + Vibrant.prototype.LightVibrantSwatch = void 0; + + Vibrant.prototype.LightMutedSwatch = void 0; + + Vibrant.prototype.HighestPopulation = 0; + + function Vibrant(sourceImage, colorCount, quality) { + this.swatches = bind(this.swatches, this); + var a, allPixels, b, cmap, g, i, image, imageData, offset, pixelCount, pixels, r; + if (typeof colorCount === 'undefined') { + colorCount = 64; + } + if (typeof quality === 'undefined') { + quality = 5; + } + image = new CanvasImage(sourceImage); + imageData = image.getImageData(); + pixels = imageData.data; + pixelCount = image.getPixelCount(); + allPixels = []; + i = 0; + while (i < pixelCount) { + offset = i * 4; + r = pixels[offset + 0]; + g = pixels[offset + 1]; + b = pixels[offset + 2]; + a = pixels[offset + 3]; + if (a >= 125) { + if (!(r > 250 && g > 250 && b > 250)) { + allPixels.push([r, g, b]); + } + } + i = i + quality; + } + cmap = this.quantize(allPixels, colorCount); + this._swatches = cmap.vboxes.map((function(_this) { + return function(vbox) { + return new Swatch(vbox.color, vbox.vbox.count()); + }; + })(this)); + this.maxPopulation = this.findMaxPopulation; + this.generateVarationColors(); + this.generateEmptySwatches(); + image.removeCanvas(); + } + + Vibrant.prototype.generateVarationColors = function() { + this.VibrantSwatch = this.findColorVariation(this.TARGET_NORMAL_LUMA, this.MIN_NORMAL_LUMA, this.MAX_NORMAL_LUMA, this.TARGET_VIBRANT_SATURATION, this.MIN_VIBRANT_SATURATION, 1); + this.LightVibrantSwatch = this.findColorVariation(this.TARGET_LIGHT_LUMA, this.MIN_LIGHT_LUMA, 1, this.TARGET_VIBRANT_SATURATION, this.MIN_VIBRANT_SATURATION, 1); + this.DarkVibrantSwatch = this.findColorVariation(this.TARGET_DARK_LUMA, 0, this.MAX_DARK_LUMA, this.TARGET_VIBRANT_SATURATION, this.MIN_VIBRANT_SATURATION, 1); + this.MutedSwatch = this.findColorVariation(this.TARGET_NORMAL_LUMA, this.MIN_NORMAL_LUMA, this.MAX_NORMAL_LUMA, this.TARGET_MUTED_SATURATION, 0, this.MAX_MUTED_SATURATION); + this.LightMutedSwatch = this.findColorVariation(this.TARGET_LIGHT_LUMA, this.MIN_LIGHT_LUMA, 1, this.TARGET_MUTED_SATURATION, 0, this.MAX_MUTED_SATURATION); + return this.DarkMutedSwatch = this.findColorVariation(this.TARGET_DARK_LUMA, 0, this.MAX_DARK_LUMA, this.TARGET_MUTED_SATURATION, 0, this.MAX_MUTED_SATURATION); + }; + + Vibrant.prototype.generateEmptySwatches = function() { + var hsl; + if (this.VibrantSwatch === void 0) { + if (this.DarkVibrantSwatch !== void 0) { + hsl = this.DarkVibrantSwatch.getHsl(); + hsl[2] = this.TARGET_NORMAL_LUMA; + this.VibrantSwatch = new Swatch(Vibrant.hslToRgb(hsl[0], hsl[1], hsl[2]), 0); + } + } + if (this.DarkVibrantSwatch === void 0) { + if (this.VibrantSwatch !== void 0) { + hsl = this.VibrantSwatch.getHsl(); + hsl[2] = this.TARGET_DARK_LUMA; + return this.DarkVibrantSwatch = new Swatch(Vibrant.hslToRgb(hsl[0], hsl[1], hsl[2]), 0); + } + } + }; + + Vibrant.prototype.findMaxPopulation = function() { + var j, len, population, ref, swatch; + population = 0; + ref = this._swatches; + for (j = 0, len = ref.length; j < len; j++) { + swatch = ref[j]; + population = Math.max(population, swatch.getPopulation()); + } + return population; + }; + + Vibrant.prototype.findColorVariation = function(targetLuma, minLuma, maxLuma, targetSaturation, minSaturation, maxSaturation) { + var j, len, luma, max, maxValue, ref, sat, swatch, value; + max = void 0; + maxValue = 0; + ref = this._swatches; + for (j = 0, len = ref.length; j < len; j++) { + swatch = ref[j]; + sat = swatch.getHsl()[1]; + luma = swatch.getHsl()[2]; + if (sat >= minSaturation && sat <= maxSaturation && luma >= minLuma && luma <= maxLuma && !this.isAlreadySelected(swatch)) { + value = this.createComparisonValue(sat, targetSaturation, luma, targetLuma, swatch.getPopulation(), this.HighestPopulation); + if (max === void 0 || value > maxValue) { + max = swatch; + maxValue = value; + } + } + } + return max; + }; + + Vibrant.prototype.createComparisonValue = function(saturation, targetSaturation, luma, targetLuma, population, maxPopulation) { + return this.weightedMean(this.invertDiff(saturation, targetSaturation), this.WEIGHT_SATURATION, this.invertDiff(luma, targetLuma), this.WEIGHT_LUMA, population / maxPopulation, this.WEIGHT_POPULATION); + }; + + Vibrant.prototype.invertDiff = function(value, targetValue) { + return 1 - Math.abs(value - targetValue); + }; + + Vibrant.prototype.weightedMean = function() { + var i, sum, sumWeight, value, values, weight; + values = 1 <= arguments.length ? slice.call(arguments, 0) : []; + sum = 0; + sumWeight = 0; + i = 0; + while (i < values.length) { + value = values[i]; + weight = values[i + 1]; + sum += value * weight; + sumWeight += weight; + i += 2; + } + return sum / sumWeight; + }; + + Vibrant.prototype.swatches = function() { + return { + Vibrant: this.VibrantSwatch, + Muted: this.MutedSwatch, + DarkVibrant: this.DarkVibrantSwatch, + DarkMuted: this.DarkMutedSwatch, + LightVibrant: this.LightVibrantSwatch, + LightMuted: this.LightMuted + }; + }; + + Vibrant.prototype.isAlreadySelected = function(swatch) { + return this.VibrantSwatch === swatch || this.DarkVibrantSwatch === swatch || this.LightVibrantSwatch === swatch || this.MutedSwatch === swatch || this.DarkMutedSwatch === swatch || this.LightMutedSwatch === swatch; + }; + + Vibrant.rgbToHsl = function(r, g, b) { + var d, h, l, max, min, s; + r /= 255; + g /= 255; + b /= 255; + max = Math.max(r, g, b); + min = Math.min(r, g, b); + h = void 0; + s = void 0; + l = (max + min) / 2; + if (max === min) { + h = s = 0; + } else { + d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + switch (max) { + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + case g: + h = (b - r) / d + 2; + break; + case b: + h = (r - g) / d + 4; + } + h /= 6; + } + return [h, s, l]; + }; + + Vibrant.hslToRgb = function(h, s, l) { + var b, g, hue2rgb, p, q, r; + r = void 0; + g = void 0; + b = void 0; + hue2rgb = function(p, q, t) { + if (t < 0) { + t += 1; + } + if (t > 1) { + t -= 1; + } + if (t < 1 / 6) { + return p + (q - p) * 6 * t; + } + if (t < 1 / 2) { + return q; + } + if (t < 2 / 3) { + return p + (q - p) * (2 / 3 - t) * 6; + } + return p; + }; + if (s === 0) { + r = g = b = l; + } else { + q = l < 0.5 ? l * (1 + s) : l + s - (l * s); + p = 2 * l - q; + r = hue2rgb(p, q, h + 1 / 3); + g = hue2rgb(p, q, h); + b = hue2rgb(p, q, h - (1 / 3)); + } + return [r * 255, g * 255, b * 255]; + }; + + return Vibrant; + + })(); + + + /* + CanvasImage Class + Class that wraps the html image element and canvas. + It also simplifies some of the canvas context manipulation + with a set of helper functions. + Stolen from https://github.com/lokesh/color-thief + */ + + window.CanvasImage = CanvasImage = (function() { + function CanvasImage(image) { + this.canvas = document.createElement('canvas'); + this.context = this.canvas.getContext('2d'); + document.body.appendChild(this.canvas); + this.width = this.canvas.width = image.width; + this.height = this.canvas.height = image.height; + this.context.drawImage(image, 0, 0, this.width, this.height); + } + + CanvasImage.prototype.clear = function() { + return this.context.clearRect(0, 0, this.width, this.height); + }; + + CanvasImage.prototype.update = function(imageData) { + return this.context.putImageData(imageData, 0, 0); + }; + + CanvasImage.prototype.getPixelCount = function() { + return this.width * this.height; + }; + + CanvasImage.prototype.getImageData = function() { + return this.context.getImageData(0, 0, this.width, this.height); + }; + + CanvasImage.prototype.removeCanvas = function() { + return this.canvas.parentNode.removeChild(this.canvas); + }; + + return CanvasImage; + + })(); + +}).call(this); + +},{"quantize":1}]},{},[2]); diff --git a/resources/lyrics/index.html b/resources/lyrics/index.html new file mode 100644 index 00000000..b50bc95d --- /dev/null +++ b/resources/lyrics/index.html @@ -0,0 +1,90 @@ + + + + + Lyrics + + + + + + + + +
    +
    + +
    +
    +
    + +
    +
    + + + \ No newline at end of file diff --git a/resources/lyrics/musixmatch.html b/resources/lyrics/musixmatch.html new file mode 100644 index 00000000..dd5d4a8a --- /dev/null +++ b/resources/lyrics/musixmatch.html @@ -0,0 +1,190 @@ + + + + + Lyrics + + + + + + Background Image +
    +
    +
    + + + \ No newline at end of file diff --git a/resources/lyrics/netease.html b/resources/lyrics/netease.html new file mode 100644 index 00000000..b248fad5 --- /dev/null +++ b/resources/lyrics/netease.html @@ -0,0 +1,81 @@ + + + + + Lyrics + + + + + + Background Image +
    +
    +
    + + + \ No newline at end of file diff --git a/resources/lyrics/youtube.html b/resources/lyrics/youtube.html new file mode 100644 index 00000000..a54101bf --- /dev/null +++ b/resources/lyrics/youtube.html @@ -0,0 +1,121 @@ + + + + + Lyrics + + + + + + Background Image +
    +
    +
    + + + \ No newline at end of file diff --git a/resources/splash/index.html b/resources/splash/index.html new file mode 100644 index 00000000..22bc0be3 --- /dev/null +++ b/resources/splash/index.html @@ -0,0 +1,26 @@ + + + + + + + Splash Screen + + + + + \ No newline at end of file diff --git a/resources/themes/README.md b/resources/themes/README.md new file mode 100644 index 00000000..03abfddf --- /dev/null +++ b/resources/themes/README.md @@ -0,0 +1,6 @@ +# Apple-Music-Electron-Themes +Simple theme repository for use with https://github.com/Apple-Music-Electron/Apple-Music-Electron + +## [Instructions](https://github.com/Apple-Music-Electron/Apple-Music-Electron/wiki/Theme-Creation#instructions) + +## [Theme Preview Images](https://github.com/Apple-Music-Electron/Apple-Music-Electron/wiki/Theme-Preview-Images) \ No newline at end of file diff --git a/resources/themes/Template.css b/resources/themes/Template.css new file mode 100644 index 00000000..80886cc0 --- /dev/null +++ b/resources/themes/Template.css @@ -0,0 +1,508 @@ +:root { + --bodyGutter:25px; + color-scheme:light dark; + --systemRed:#ff3b30; + --systemRed-vibrant:#f53126; + --systemRed-default_IC:#d70015; + --systemRed-vibrant_IC:#c20618; + --systemOrange:#ff9500; + --systemOrange-vibrant:#f58b00; + --systemOrange-default_IC:#c93400; + --systemOrange-vibrant_IC:#ad3a00; + --systemYellow:#ffcc00; + --systemYellow-vibrant:#f5c200; + --systemYellow-default_IC:#a05a00; + --systemYellow-vibrant_IC:#925100; + --systemGreen:#28cd41; + --systemGreen-vibrant:#1ec337; + --systemGreen-default_IC:#007d1b; + --systemGreen-vibrant_IC:#007018; + --systemMint:#00c7be; + --systemMint-vibrant:#00bdb4; + --systemMint-default_IC:#0c817b; + --systemMint-vibrant_IC:#0b7570; + --systemTeal:#59adc4; + --systemTeal-vibrant:#2ea7bd; + --systemTeal-default_IC:#008299; + --systemTeal-vibrant_IC:#00778c; + --systemCyan:#55bef0; + --systemCyan-vibrant:#41afdc; + --systemCyan-default_IC:#0071a4; + --systemCyan-vibrant_IC:#006796; + --systemBlue:#007aff; + --systemBlue-vibrant:#0070f5; + --systemBlue-default_IC:#0040dd; + --systemBlue-vibrant_IC:#0040dd; + --systemBlue-rollover:#0045b7; + --systemBlue-pressed:#005cd7; + --systemBlue-deepPressed:#0045b7; + --systemBlue-disabled:rgba(0, 122, 255, 0.35); + --systemIndigo:#5856d6; + --systemIndigo-vibrant:#5452cc; + --systemIndigo-default_IC:#3634a3; + --systemIndigo-vibrant_IC:#3634a3; + --systemPurple:#af52de; + --systemPurple-vibrant:#9f4bc9; + --systemPurple-default_IC:#ad44ab; + --systemPurple-vibrant_IC:#ad44ab; + --systemPink:#ff2d55; + --systemPink-vibrant:#f5234b; + --systemPink-default_IC:#d30f45; + --systemPink-vibrant_IC:#c11032; + --systemBrown:#a2845e; + --systemBrown-vibrant:#987a54; + --systemBrown-default_IC:#7f6545; + --systemBrown-vibrant_IC:#775d3b; + --systemGray:#8e8e93; + --systemGray-vibrant:#848489; + --systemGray-default_IC:#69696e; + --systemGray-vibrant_IC:#616165; + --systemPrimary:rgba(0, 0, 0, 0.85); + --systemPrimary-vibrant:#4c4c4c; + --systemPrimary-vibrant-rgb:76,76,76; + --systemPrimary-default_IC:black; + --systemPrimary-default_IC-rgb:0,0,0; + --systemPrimary-vibrant_IC:black; + --systemPrimary-vibrant_IC-rgb:0,0,0; + --systemSecondary:rgba(0, 0, 0, 0.5); + --systemSecondary-vibrant:gray; + --systemSecondary-default_IC:rgba(0, 0, 0, 0.76); + --systemSecondary-vibrant_IC:rgba(0, 0, 0, 0.76); + --systemTertiary:rgba(0, 0, 0, 0.25); + --systemTertiary-vibrant:#bfbfbf; + --systemTertiary-default_IC:rgba(0, 0, 0, 0.56); + --systemTertiary-vibrant_IC:rgba(0, 0, 0, 0.56); + --systemQuaternary:rgba(0, 0, 0, 0.1); + --systemQuaternary-vibrant:#e6e6e6; + --systemQuaternary-default_IC:rgba(0, 0, 0, 0.35); + --systemQuaternary-vibrant_IC:rgba(0, 0, 0, 0.35); + --systemQuinary:rgba(0, 0, 0, 0.05); + --systemQuinary-vibrant:#f2f2f2; + --systemQuinary-default_IC:rgba(0, 0, 0, 0.1); + --systemQuinary-vibrant_IC:rgba(0, 0, 0, 0.1); + --keyColor:#fa233b; + --keyColor-rgb:250,35,59; + --keyColor-rollover:#c60007; + --keyColor-rollover-rgb:198,0,7; + --keyColor-pressed:#e00921; + --keyColor-pressed-rgb:224,9,33; + --keyColor-deepPressed:#c60007; + --keyColor-deepPressed-rgb:198,0,7; + --keyColor-disabled:rgba(250, 35, 59, 0.35); + --keyColor-default_IC:#d60017; + --keyColor-default_IC-rgb:214,0,23; + --keyColor-rollover_IC:#a20000; + --keyColor-rollover_IC-rgb:162,0,0; + --keyColor-pressed_IC:#bb0000; + --keyColor-pressed_IC-rgb:187,0,0; + --keyColor-deepPressed_IC:#a20000; + --keyColor-deepPressed_IC-rgb:162,0,0; + --keyColor-disabled_IC:rgba(214, 0, 23, 0.25); + --systemStandardUltrathinMaterialSover:rgba(246, 246, 246, 0.36); + --systemStandardUltrathinMaterialSover-inactive:#f0f0f0; + --systemStandardUltrathinMaterialSover-default_IC:#d2d2d2; + --systemStandardUltrathinMaterialSover-inactive_IC:#ececec; + --systemStandardThinMaterialSover:rgba(246, 246, 246, 0.48); + --systemStandardThinMaterialSover-inactive:#f0f0f0; + --systemStandardThinMaterialSover-default_IC:gainsboro; + --systemStandardThinMaterialSover-inactive_IC:#ececec; + --systemStandardMediumMaterialSover:rgba(246, 246, 246, 0.6); + --systemStandardMediumMaterialSover-inactive:#f0f0f0; + --systemStandardMediumMaterialSover-default_IC:#e6e6e6; + --systemStandardMediumMaterialSover-inactive_IC:#ececec; + --systemStandardThickMaterialSover:rgba(246, 246, 246, 0.72); + --systemStandardThickMaterialSover-inactive:#f0f0f0; + --systemStandardThickMaterialSover-default_IC:#f0f0f0; + --systemStandardThickMaterialSover-inactive_IC:#ececec; + --systemStandardUltrathickMaterialSover:rgba(246, 246, 246, 0.84); + --systemStandardUltrathickMaterialSover-inactive:#f0f0f0; + --systemStandardUltrathickMaterialSover-default_IC:#fafafa; + --systemStandardUltrathickMaterialSover-inactive_IC:#ececec; + --systemHeaderMaterialSover:rgba(255, 255, 255, 0.8); + --systemHeaderMaterialSover-default_IC:white; + --systemToolbarTitlebarMaterialSover:rgba(253, 253, 253, 0.8); + --systemToolbarTitlebarMaterialSover-inactive:#f0f0f0; + --systemToolbarTitlebarMaterialSover-default_IC:white; + --systemToolbarTitlebarMaterialSover-inactive_IC:#ececec; + --labelDivider:rgba(0, 0, 0, 0.15); + --vibrantDivider:rgba(60, 60, 67, 0.29); + --pageBG:white; + --shelfBG:rgba(0, 0, 0, 0.05); + --genericJoeColor:#ebebeb; + --fallbackMaterialBG:rgba(255, 255, 255, 0.97); + --musicKeyColor:#fa233b; + --musicKeyColor-rollover:#c60007; + --musicKeyColor-pressed:#e00921; + --musicKeyColor-deepPressed:#c60007; + --musicKeyColor-disabled:rgba(250, 35, 59, 0.35); + --musicKeyColor-default_IC:#d60017; + --musicKeyColor-rollover_IC:#a20000; + --musicKeyColor-pressed_IC:#bb0000; + --musicKeyColor-deepPressed_IC:#a20000; + --musicKeyColor-disabled_IC:rgba(214, 0, 23, 0.25); + --systemAccentBG:#fa233b; + --systemAccentBG-rollover:#c60007; + --systemAccentBG-pressed:#e00921; + --systemAccentBG-deepPressed:#c60007; + --systemAccentBG-disabled:rgba(250, 35, 59, 0.35); + --systemAccentBG-default_IC:#d60017; + --systemAccentBG-rollover_IC:#a20000; + --systemAccentBG-pressed_IC:#bb0000; + --systemAccentBG-deepPressed_IC:#a20000; + --systemAccentBG-disabled_IC:rgba(214, 0, 23, 0.25); + --musicBrandBG:#fa233b; + --musicBrandBG-default_IC:#d60017; + --modalBGColor:white; + --modalBGColor-rgb:255,255,255; + --modalBGHeaderColor:rgba(255, 255, 255, 0.97); + --modalScrimColor:rgba(0, 0, 0, 0.45); + --opaqueShelfBG:#f2f2f2; + --profileBadgeJoeColor:#e2e4e7; + --selectionColor:#dd1f34; + --selectionColor-default_IC:#d60017; + --selectionColorRollover:#af0007; + --selectionColorRollover-default_IC:#a20000; + --selectionColorPressed:#c6081d; + --selectionColorPressed-default_IC:#bb0000; + --selectionColorDeepPressed:#af0007; + --selectionColorDeepPressed-default_IC:#a20000; + --selectionColorDisabled:rgba(250, 35, 59, 0.35); + --selectionColorDisabled-default_IC:rgba(214, 0, 23, 0.25); + --topResultsBGColor:rgba(0, 0, 0, 0.1); + --lockupHoverBGColor:rgba(51, 51, 51, 0.3); + --opaquePageBGColor:white; + --replayCardBG:#f7f3eb; + --replayComponentBG:#fbf9f5; + --barButtonDeselectedGradientTop:#fefefe; + --barButtonDeselectedGradientBottom:#fafafa; + --barButtonSelectedBGFill:#7f7f7f; + --barButtonSelectedTextColor:white; + --lockupSuperlabelPrimary:rgba(255, 255, 255, 0.95); + --lockupChinScrim:rgba(0, 0, 0, 0.2); + --lovedBGColor:#fa233b; + --playerDropShadow2:rgba(0, 0, 0, 0.07); + --playerInnerShadow:rgba(255, 255, 255, 0.45); + --powerSwooshAlgoRadioLockupChinScrim:rgba(44, 44, 46, 0.4); + --socialSearchBG:rgba(0, 0, 0, 0.15); + --socialModalFooter:rgba(255, 255, 255, 0.7); + --tracklistAltRowColor:rgba(0, 0, 0, 0.015); + --tracklistAltRowColor-default_IC:rgba(0, 0, 0, 0.05); + --tracklistHoverColor:rgba(0, 0, 0, 0.06); + --tracklistHoverColor-default_IC:rgba(0, 0, 0, 0.1); + --tracklistWorksTrackHoverColor:rgba(0, 0, 0, 0.12); + --tracklistWorksTrackHoverColor-default_IC:rgba(0, 0, 0, 0.18); + --viewLoading:white; + --circularArtistHeaderGradientBottom:rgba(0, 0, 0, 0.05); + --dialogScrimColor:rgba(255, 255, 255, 0.8); + --monogramPlaceholderColor:#9a9aa2; + --listItemAddDownloadBG:rgba(0, 0, 0, 0.5); + --listItemProgressBG:rgba(0, 0, 0, 0.25); + --radiosityShadowColor:rgba(0, 0, 0, 0.1); + --dialogShadowColor:rgba(0, 0, 0, 0.25); + --contextMenuBorderColor:rgba(0, 0, 0, 0.15); + --contextMenuTextColor:rgba(0, 0, 0, 0.85); + --footerBG:#fbfbfb; + --frostedFallbackHover:rgba(142, 142, 147, 0.8); + --iPhoneNowPlayingBackdropBG:#dbccc4; + --searchBorder:rgba(0, 0, 0, 0.15); + --searchIconDropShadow:rgba(0, 0, 0, 0.15); + --searchHintsBG:rgba(232, 232, 232, 0.9); + --searchHintsBGHover:rgba(201, 204, 203, 0.9); + --sidebar:rgba(60, 60, 67, 0.03); + --sidebar-default_IC:#fafafa; + --sidebarBorderRule:rgba(0, 0, 0, 0.1); + --sidebarSelectedState:rgba(60, 60, 67, 0.1); + --sidebarNativeUpsellBackgroundFallback:rgba(255, 255, 255, 0.97); + --webNavigationMobileBg:white; + --playerScrubberPlayhead:gray; + --playerScrubberFill:rgba(0, 0, 0, 0.5); + --playerScrubberTrack:rgba(0, 0, 0, 0.1); + --playerBackgroundFallback:rgba(255, 255, 255, 0.97); + --playerBackgroundFallback-default_IC:#fafafa; + --playerBackground:rgba(255, 255, 255, 0.88); + --playerBackground-default_IC:#fafafa; + --playerGradientTop:rgba(255, 255, 255, 0.25); + --playerGradientBottom:rgba(255, 255, 255, 0); + --playerLCDLogo:rgba(0, 0, 0, 0.5); + --playerLCDBGFill:white; + --playerLCDBGFill-rgb:255,255,255; + --playerLCDBGOuterStroke:rgba(0, 0, 0, 0.2); + --playerArtworkKeyline:rgba(0, 0, 0, 0.1); + --playerVolumePlayhead:white; + --playerVolumePlayheadActive:#e5e5e5; + --playerVolumeFill:rgba(0, 0, 0, 0.5); + --playerVolumeTrack:rgba(0, 0, 0, 0.15); + --playerVolumeIconFill:rgba(0, 0, 0, 0.4); + --trackBackgroundEven:rgba(0, 0, 0, 0.02); + --trackHoverColor:rgba(255, 255, 255, 0.97); + --playerPlatterButtonBGFill:#6c6c6c; + --playerPlatterButtonIconFill:white; + --librarySongsTrackInactiveBG:rgba(0, 0, 0, 0.14); + --searchScopeDeselectedGradientTop:#fefefe; + --searchScopeDeselectedGradientBottom:#fafafa; + --searchScopeSelectedBGFill:#7f7f7f; + --searchScopeSelectedTextColor:white; + --searchBoxIconFill:rgba(0, 0, 0, 0.65); + --segmentedControlBG:rgba(118, 118, 128, 0.12); + --segmentedControlSelectedBG:white; + --segmentedControlSelectedShadow1:rgba(0, 0, 0, 0.12); + --segmentedControlSelectedShadow2:rgba(0, 0, 0, 0.04); + --segmentedControlSelectedBorder:rgba(0, 0, 0, 0.04); + --searchBarBorderColor:rgba(0, 0, 0, 0.15); + --viewport-default:"xsmall"; + --viewport-grid-layout:"grid-layout:xs-1"; + --viewport-sidebar:"sidebar:hidden"; + --viewport-search-landing-grid:"search-landing-grid:1"; + --web-navigation-width:164px +} + +@media (prefers-color-scheme:dark) { + :root { + --systemRed:#ff453a; + --systemRed-vibrant:#ff4f44; + --systemRed-default_IC:#ff6961; + --systemRed-vibrant_IC:#ff4136; + --systemOrange:#ff9f0a; + --systemOrange-vibrant:#ffa914; + --systemOrange-default_IC:#ffb340; + --systemOrange-vibrant_IC:#ffb340; + --systemYellow:#ffd60a; + --systemYellow-vibrant:#ffe014; + --systemYellow-default_IC:#ffd426; + --systemYellow-vibrant_IC:#ffd426; + --systemGreen:#32d74b; + --systemGreen-vibrant:#3ce155; + --systemGreen-default_IC:#31de4b; + --systemGreen-vibrant_IC:#31de4b; + --systemMint:#63e6e2; + --systemMint-vibrant:#6ce0db; + --systemMint-default_IC:#63e6e2; + --systemMint-vibrant_IC:#63e6e2; + --systemTeal:#6ac4dc; + --systemTeal-vibrant:#44d4ed; + --systemTeal-default_IC:#5de6ff; + --systemTeal-vibrant_IC:#5de6ff; + --systemCyan:#5ac8f5; + --systemCyan-vibrant:#5acdfa; + --systemCyan-default_IC:#70d7ff; + --systemCyan-vibrant_IC:#70d7ff; + --systemBlue:#0a84ff; + --systemBlue-vibrant:#148eff; + --systemBlue-default_IC:#409cff; + --systemBlue-vibrant_IC:#409cff; + --systemBlue-rollover:#47c1ff; + --systemBlue-pressed:#38b2ff; + --systemBlue-deepPressed:#47c1ff; + --systemBlue-disabled:rgba(10, 132, 255, 0.5); + --systemIndigo:#5e5ce6; + --systemIndigo-vibrant:#6361f2; + --systemIndigo-default_IC:#7d7aff; + --systemIndigo-vibrant_IC:#7d7aff; + --systemPurple:#bf5af2; + --systemPurple-vibrant:#cc65ff; + --systemPurple-default_IC:#da8fff; + --systemPurple-vibrant_IC:#da8fff; + --systemPink:#ff375f; + --systemPink-vibrant:#ff4169; + --systemPink-default_IC:#ff6482; + --systemPink-vibrant_IC:#ff3a5f; + --systemBrown:#ac8e68; + --systemBrown-vibrant:#b69872; + --systemBrown-default_IC:#b59469; + --systemBrown-vibrant_IC:#b59469; + --systemGray:#98989d; + --systemGray-vibrant:#a2a2a7; + --systemGray-default_IC:#98989d; + --systemGray-vibrant_IC:#98989d; + --systemPrimary:rgba(255, 255, 255, 0.85); + --systemPrimary-vibrant:#e5e5e5; + --systemPrimary-vibrant-rgb:229,229,229; + --systemPrimary-default_IC:white; + --systemPrimary-default_IC-rgb:255,255,255; + --systemPrimary-vibrant_IC:white; + --systemPrimary-vibrant_IC-rgb:255,255,255; + --systemSecondary:rgba(255, 255, 255, 0.55); + --systemSecondary-vibrant:#7c7c7c; + --systemSecondary-default_IC:rgba(255, 255, 255, 0.7); + --systemSecondary-vibrant_IC:rgba(255, 255, 255, 0.7); + --systemTertiary:rgba(255, 255, 255, 0.25); + --systemTertiary-vibrant:#414141; + --systemTertiary-default_IC:rgba(255, 255, 255, 0.5); + --systemTertiary-vibrant_IC:rgba(255, 255, 255, 0.5); + --systemQuaternary:rgba(255, 255, 255, 0.1); + --systemQuaternary-vibrant:#232323; + --systemQuaternary-default_IC:rgba(255, 255, 255, 0.3); + --systemQuaternary-vibrant_IC:rgba(255, 255, 255, 0.3); + --systemQuinary:rgba(255, 255, 255, 0.05); + --systemQuinary-vibrant:#080808; + --systemQuinary-default_IC:rgba(255, 255, 255, 0.1); + --systemQuinary-vibrant_IC:rgba(255, 255, 255, 0.1); + --keyColor:#fa2d48; + --keyColor-rgb:250,45,72; + --keyColor-rollover:#ff5f7a; + --keyColor-rollover-rgb:255,95,122; + --keyColor-pressed:#ff4661; + --keyColor-pressed-rgb:255,70,97; + --keyColor-deepPressed:#ff5f7a; + --keyColor-deepPressed-rgb:255,95,122; + --keyColor-disabled:rgba(250, 45, 72, 0.35); + --keyColor-default_IC:#fa586a; + --keyColor-default_IC-rgb:250,88,106; + --keyColor-rollover_IC:#ff8a9c; + --keyColor-rollover_IC-rgb:255,138,156; + --keyColor-pressed_IC:#ff7183; + --keyColor-pressed_IC-rgb:255,113,131; + --keyColor-deepPressed_IC:#ff8a9c; + --keyColor-deepPressed_IC-rgb:255,138,156; + --keyColor-disabled_IC:rgba(250, 88, 106, 0.35); + --systemStandardUltrathinMaterialSover:rgba(40, 40, 40, 0.4); + --systemStandardUltrathinMaterialSover-inactive:#282828; + --systemStandardUltrathinMaterialSover-default_IC:black; + --systemStandardUltrathinMaterialSover-inactive_IC:#141414; + --systemStandardThinMaterialSover:rgba(40, 40, 40, 0.5); + --systemStandardThinMaterialSover-inactive:#282828; + --systemStandardThinMaterialSover-default_IC:#0a0a0a; + --systemStandardThinMaterialSover-inactive_IC:#141414; + --systemStandardMediumMaterialSover:rgba(40, 40, 40, 0.6); + --systemStandardMediumMaterialSover-inactive:#282828; + --systemStandardMediumMaterialSover-default_IC:#141414; + --systemStandardMediumMaterialSover-inactive_IC:#141414; + --systemStandardThickMaterialSover:rgba(40, 40, 40, 0.7); + --systemStandardThickMaterialSover-inactive:#282828; + --systemStandardThickMaterialSover-default_IC:#1e1e1e; + --systemStandardThickMaterialSover-inactive_IC:#141414; + --systemStandardUltrathickMaterialSover:rgba(40, 40, 40, 0.8); + --systemStandardUltrathickMaterialSover-inactive:#282828; + --systemStandardUltrathickMaterialSover-default_IC:#282828; + --systemStandardUltrathickMaterialSover-inactive_IC:#141414; + --systemHeaderMaterialSover:rgba(30, 30, 30, 0.8); + --systemHeaderMaterialSover-default_IC:#1e1e1e; + --systemToolbarTitlebarMaterialSover:rgba(60, 60, 60, 0.8); + --systemToolbarTitlebarMaterialSover-inactive:#282828; + --systemToolbarTitlebarMaterialSover-default_IC:#262626; + --systemToolbarTitlebarMaterialSover-inactive_IC:#141414; + --labelDivider:rgba(255, 255, 255, 0.1); + --vibrantDivider:rgba(235, 235, 245, 0.19); + --pageBG:#1f1f1f; + --shelfBG:rgba(255, 255, 255, 0.05); + --genericJoeColor:#323232; + --fallbackMaterialBG:rgba(31, 31, 31, 0.97); + --musicKeyColor:#fa2d48; + --musicKeyColor-rollover:#ff5f7a; + --musicKeyColor-pressed:#ff4661; + --musicKeyColor-deepPressed:#ff5f7a; + --musicKeyColor-disabled:rgba(250, 45, 72, 0.35); + --musicKeyColor-default_IC:#fa586a; + --musicKeyColor-rollover_IC:#ff8a9c; + --musicKeyColor-pressed_IC:#ff7183; + --musicKeyColor-deepPressed_IC:#ff8a9c; + --musicKeyColor-disabled_IC:rgba(250, 88, 106, 0.35); + --systemAccentBG:#fa233b; + --systemAccentBG-rollover:#c60007; + --systemAccentBG-pressed:#e00921; + --systemAccentBG-deepPressed:#c60007; + --systemAccentBG-disabled:rgba(250, 35, 59, 0.35); + --systemAccentBG-default_IC:#d60017; + --systemAccentBG-rollover_IC:#a20000; + --systemAccentBG-pressed_IC:#bb0000; + --systemAccentBG-deepPressed_IC:#a20000; + --systemAccentBG-disabled_IC:rgba(214, 0, 23, 0.25); + --musicBrandBG:#fa233b; + --musicBrandBG-default_IC:#d60017; + --modalBGColor:#1f1f1f; + --modalBGColor-rgb:31,31,31; + --modalBGHeaderColor:rgba(31, 31, 31, 0.97); + --modalScrimColor:rgba(0, 0, 0, 0.55); + --opaqueShelfBG:#2b2b2b; + --profileBadgeJoeColor:#e2e4e7; + --selectionColor:#c11b2e; + --selectionColor-default_IC:#a60012; + --selectionColorRollover:#990006; + --selectionColorRollover-default_IC:#7d0000; + --selectionColorPressed:#ad0719; + --selectionColorPressed-default_IC:#900000; + --selectionColorDeepPressed:#990006; + --selectionColorDeepPressed-default_IC:#7d0000; + --selectionColorDisabled:rgba(250, 45, 72, 0.35); + --selectionColorDisabled-default_IC:rgba(66, 0, 7, 0.421075); + --topResultsBGColor:rgba(255, 255, 255, 0.1); + --lockupHoverBGColor:rgba(51, 51, 51, 0.3); + --opaquePageBGColor:#2d2d2d; + --replayCardBG:#1a1a1a; + --replayComponentBG:#2e2e2e; + --barButtonDeselectedGradientTop:#595a5c; + --barButtonDeselectedGradientBottom:#565759; + --barButtonSelectedBGFill:#aeaeb2; + --barButtonSelectedTextColor:#4c4c4c; + --lockupSuperlabelPrimary:rgba(0, 0, 0, 0.95); + --lockupChinScrim:rgba(0, 0, 0, 0.2); + --lovedBGColor:#fa2d48; + --playerDropShadow2:rgba(0, 0, 0, 0.1); + --playerInnerShadow:rgba(255, 255, 255, 0.1); + --powerSwooshAlgoRadioLockupChinScrim:rgba(44, 44, 46, 0.4); + --socialSearchBG:rgba(255, 255, 255, 0.15); + --socialModalFooter:rgba(0, 0, 0, 0.7); + --tracklistAltRowColor:rgba(255, 255, 255, 0.015); + --tracklistAltRowColor-default_IC:rgba(255, 255, 255, 0.05); + --tracklistHoverColor:rgba(255, 255, 255, 0.06); + --tracklistHoverColor-default_IC:rgba(255, 255, 255, 0.1); + --tracklistWorksTrackHoverColor:rgba(255, 255, 255, 0.12); + --tracklistWorksTrackHoverColor-default_IC:rgba(255, 255, 255, 0.18); + --viewLoading:transparent; + --circularArtistHeaderGradientBottom:rgba(255, 255, 255, 0.03); + --dialogScrimColor:rgba(38, 38, 38, 0.8); + --monogramPlaceholderColor:#5a5a5a; + --listItemAddDownloadBG:rgba(255, 255, 255, 0.55); + --listItemProgressBG:rgba(255, 255, 255, 0.25); + --radiosityShadowColor:rgba(0, 0, 0, 0.3); + --dialogShadowColor:rgba(0, 0, 0, 0.55); + --contextMenuBorderColor:rgba(255, 255, 255, 0.1); + --contextMenuTextColor:rgba(255, 255, 255, 0.85); + --footerBG:#323232; + --frostedFallbackHover:rgba(152, 152, 157, 0.8); + --iPhoneNowPlayingBackdropBG:#dbccc4; + --searchBorder:rgba(255, 255, 255, 0.15); + --searchIconDropShadow:rgba(0, 0, 0, 0.25); + --searchHintsBG:rgba(44, 46, 48, 0.9); + --searchHintsBGHover:rgba(45, 47, 50, 0.9); + --sidebar:rgba(235, 235, 245, 0.03); + --sidebar-default_IC:#282828; + --sidebarBorderRule:rgba(255, 255, 255, 0.1); + --sidebarSelectedState:rgba(235, 235, 245, 0.1); + --sidebarNativeUpsellBackgroundFallback:rgba(60, 60, 67, 0.95); + --webNavigationMobileBg:#2e2e2e; + --playerScrubberPlayhead:#7c7c7c; + --playerScrubberFill:rgba(255, 255, 255, 0.6); + --playerScrubberTrack:rgba(255, 255, 255, 0.1); + --playerBackgroundFallback:rgba(45, 45, 45, 0.97); + --playerBackgroundFallback-default_IC:#282828; + --playerBackground:rgba(45, 45, 45, 0.88); + --playerBackground-default_IC:#282828; + --playerGradientTop:transparent; + --playerGradientBottom:transparent; + --playerLCDLogo:rgba(255, 255, 255, 0.55); + --playerLCDBGFill:#4d4d4d; + --playerLCDBGFill-rgb:77,77,77; + --playerLCDBGOuterStroke:rgba(0, 0, 0, 0.2); + --playerArtworkKeyline:rgba(255, 255, 255, 0.1); + --playerVolumePlayhead:#2c2c2c; + --playerVolumePlayheadActive:#413e40; + --playerVolumeFill:rgba(255, 255, 255, 0.6); + --playerVolumeTrack:rgba(255, 255, 255, 0.15); + --playerVolumeIconFill:rgba(255, 255, 255, 0.4); + --trackBackgroundEven:rgba(255, 255, 255, 0.05); + --trackHoverColor:rgba(0, 0, 0, 0.37); + --playerPlatterButtonBGFill:white; + --playerPlatterButtonIconFill:rgba(0, 0, 0, 0.7); + --librarySongsTrackInactiveBG:rgba(255, 255, 240, 0.12); + --searchScopeDeselectedGradientTop:#595a5c; + --searchScopeDeselectedGradientBottom:#565759; + --searchScopeSelectedBGFill:#aeaeb2; + --searchScopeSelectedTextColor:#4c4c4c; + --searchBoxIconFill:rgba(255, 255, 255, 0.9); + --segmentedControlBG:rgba(118, 118, 128, 0.24); + --segmentedControlSelectedBG:#636366; + --segmentedControlSelectedShadow1:transparent; + --segmentedControlSelectedShadow2:transparent; + --searchBarBorderColor:rgba(0, 0, 0, 0.15) + } diff --git a/resources/themes/acrylic.css b/resources/themes/acrylic.css new file mode 100644 index 00000000..9745c8d2 --- /dev/null +++ b/resources/themes/acrylic.css @@ -0,0 +1,23 @@ +/** + * @name Acrylic + * @author cryptofyre + * @description Transparent theme for use with Acrylic themesets. +*/ + +@media (prefers-color-scheme: dark) { + :root { + --transparency: #0f0f0f00 !important; + --sidebar: #0f0f0f00 !important; + --pageBG: #0f0f0f00 !important; + --playerBackground: #0f0f0f00 !important; + --systemHeaderMaterialSover-default_IC: #0f0f0f00 !important; + --systemHeaderMaterialSover: #0f0f0f00 !important; + --playerLCDBGFill: transparent!important; + --playerLCDBGOuterStroke: transparent!important; + + } + + .dt-search-box__input { + background-color: #0f0f0f00 !important; + } +} diff --git a/resources/themes/blurple.css b/resources/themes/blurple.css new file mode 100644 index 00000000..0ad65c32 --- /dev/null +++ b/resources/themes/blurple.css @@ -0,0 +1,34 @@ +/* + * @name Blurple + * @author Core#1034 + * @description Cool blurple theme, uses similar colors to discord but a bit darker. +*/ + +@media (prefers-color-scheme:dark) { + :root { + /* accent colors */ + --keyColor: #5865f2 !important; + --keyColor-rgb: 88, 101, 242 !important; + --systemAccentBG: #5865f2 !important; + --systemAccentBG-pressed: #404eed !important; + --selectionColor: #5865f2 !important; + + /* main colors */ + --transparency: #13151957 !important; + --sidebar: #131519 !important; + --footerBG: #131519 !important; + --pageBG: #171a1f !important; + + /* search bar */ + --systemHeaderMaterialSover-default_IC: #131519 !important; + --systemHeaderMaterialSover: #131519 !important; + + /* web-chrome */ + --playerBackground: #131519 !important; + --playerLCDBGFill: #131519 !important; + + /* up-next */ + --systemToolbarTitlebarMaterialSover-inactive: #131519 !important; + --systemToolbarTitlebarMaterialSover: rgba(19, 21, 25, 0.8) !important; + } +} \ No newline at end of file diff --git a/resources/themes/dracula.css b/resources/themes/dracula.css new file mode 100644 index 00000000..812cf02f --- /dev/null +++ b/resources/themes/dracula.css @@ -0,0 +1,48 @@ +/* Dracula theme by zenorocha + * converted by floookay + * fixed up a bit by cryptofyre + * + * Background #282a36 + * Current Line #44475a + * Foreground #f8f8f2 + * Comment #6272a4 + * Cyan #8be9fd + * Green #50fa7b + * Orange #ffb86c + * Pink #ff79c6 + * Purple #bd93f9 + * Red #ff5555 + * Yellow #f1fa8c +*/ + +@media (prefers-color-scheme:dark) { + :root { + --primaryColor: #bd93f9 !important; + --sidebar: #21222c !important; + --transparency: #21222c18 !important; + --footerBG: #44475a !important; + --pageBG: #282a36 !important; + --playerBackground: #21222c !important; + --playerLCDBGFill: #44475a !important; + --playerVolumeIconFill: #6272a4 !important; + --systemGreen: #50fa7b !important; + --systemRed: #ff5555 !important; + --lovedBGColor: #ff79c6 !important; + + --modalBGColor: #282a36 !important; + --systemHeaderMaterialSover: #282a36 !important; + --systemPrimary: #f8f8f2 !important; + --systemSecondary: #6272a4 !important; + --systemQuaternary: #44475a !important; + --selectionColor: #bd93f9 !important; + + --systemHeaderMaterialSoverIncreaseContrast: #282a36 !important; + --segmentedControlSelectedBG: #44475a !important; + --modalBGHeaderColor: #21222c !important; + --tracklistHoverColor: #44475a !important; + --sidebarSelectedState: #44475a !important; + + --playerPlatterButtonBGFill: #bd93f9 !important; + --playerPlatterButtonIconFill: #f8f8f2 !important; + } +} diff --git a/resources/themes/jungle.css b/resources/themes/jungle.css new file mode 100644 index 00000000..6232f3ff --- /dev/null +++ b/resources/themes/jungle.css @@ -0,0 +1,24 @@ +/** + * @name Jungle + * @author devilAPI#0361 + * @description Jungle Theme +*/ + +@media (prefers-color-scheme:dark) { + :root { + --primaryColor: #D8E4FF !important; + --primaryColor-rgb: 216, 228, 255 !important; + --sidebar: #00120 !important; + --transparency: #00120b18 !important; + --footerBG: #24423E !important; + --pageBG: #00120B !important; + --pageBG-rgb: rgba(0, 18, 11, 0.1) !important; + --playerBackground: #24423E !important; + --playerLCDBGFill: #24423E !important; + + --modalBGColor: var(--pageBG) !important; + --systemHeaderMaterialSover: var(--pageBG) !important; + --systemQuaternary: var(--pageBG-rgb) !important; + --selectionColor: var(--primaryColor) !important; + } +} \ No newline at end of file diff --git a/resources/themes/nord.css b/resources/themes/nord.css new file mode 100644 index 00000000..be9d993b --- /dev/null +++ b/resources/themes/nord.css @@ -0,0 +1,84 @@ +/* Nord theme: https://www.nordtheme.com + * Base CSS from: floookay's Dracular theme + */ + +@media (prefers-color-scheme:dark) { + :root { + + /* accent colors */ + --keyColor: #88c0d0 !important; + --keyColor-rgb: 136, 192, 208 !important; + --systemAccentBG: #88c0d0 !important; + --systemAccentBG-pressed: #81a1c1 !important; + --selectionColor: #81a1c1 !important; + + /*everything else*/ + --primaryColor: #88C0D0 !important; + --sidebar: #3B4252 !important; + --transparency: #3b425202 !important; + --footerBG: #434C5E !important; + --pageBG: #2E3440 !important; + --playerBackground: #3B4252 !important; + --playerLCDBGFill: #434C5E !important; + --playerVolumeIconFill: #88C0D0 !important; + --systemGreen: #A3BE8C !important; + --systemRed: #BF616A !important; + --lovedBGColor: #B48EAD !important; + --systemVibrantTextPrimary: #ECEFF4 !important; + --systemVibrantTextTertiary: #ECEFF4 !important; + --modalBGColor: #2E3440 !important; + --systemHeaderMaterialSover: #2E3440 !important; + --systemPrimary: #ECEFF4 !important; + --systemSecondary: #ECEFF4 !important; + --systemQuaternary: #434C5E !important; + --selectionColor: #88C0D0 !important; + --systemHeaderMaterialSoverIncreaseContrast: #2E3440 !important; + --segmentedControlSelectedBG: #434C5E !important; + --modalBGHeaderColor: #3B4252 !important; + --tracklistHoverColor: #434C5E !important; + --sidebarSelectedState: #434C5E !important; + --playerPlatterButtonBGFill: #88C0D0 !important; + --playerPlatterButtonIconFill: #ECEFF4 !important; + --primaryColor-rgb: transparent !important; + --playerVolumeFill: #88C0D0 !important; + --systemStandardThickMaterialSover: #3B4252 !important; + --systemSecondary-vibrantText: #D8DEE9 !important; + --systemPrimary-vibrantText: #ECEFF4 !important; + --contextMenuBorderColor: #2E3440 !important; + --systemTertiary-vibrant: #2E3440 !important; + } + + body > div { + color: #ECEFF4 !important; + } + + .dt-search-box__input { + border-color: #88C0D0 !important; + } + + .web-navigation__header-button:hover, + .web-navigation__header-text { + color: #ECEFF4 !important; + opacity: 1.0 !important; + } + + .songs-list__col--heart-and-star { + background-color: transparent !important; + } + + .media-artwork-v2--error, + .media-artwork-v2--error, + .media-artwork-v2__image, + .media-artwork-v2--feature-recommended, + .media-artwork-v2--feature-recommended + .media-artwork-v2__image, + .media-artwork-v2:not(.media-artwork-v2--downloaded), + .media-artwork-v2:not(.media-artwork-v2--downloaded) + .media-artwork-v2__image { + background-color: transparent !important; + } + + ::placeholder { + color: #ECEFF4 !important; + } +} diff --git a/resources/themes/oled.css b/resources/themes/oled.css new file mode 100644 index 00000000..51fff644 --- /dev/null +++ b/resources/themes/oled.css @@ -0,0 +1,18 @@ +/** + * @name Oled Black + * @author cryptofyre + * @description Sexy oled black theme +*/ + +@media (prefers-color-scheme: dark) { + :root { + --transparency: #0f0f0f10 !important; + --sidebar: #0c0c0c !important; + --pageBG: rgb(0, 0, 0) !important; + --playerBackground: #131313 !important; + } + + .dt-search-box__input { + background-color: #00000013 !important; + } +} \ No newline at end of file diff --git a/resources/themes/spotify.css b/resources/themes/spotify.css new file mode 100644 index 00000000..2a3158af --- /dev/null +++ b/resources/themes/spotify.css @@ -0,0 +1,34 @@ +/** + * @name Spotify + * @author devilAPI#0361 (Upgraded by Core#1034) + * @description Spotify Theme +*/ + +@media (prefers-color-scheme:dark) { + :root { + /* accent colors */ + --keyColor: #1DB954 !important; + --keyColor-rgb: 30, 215, 96 !important; + --systemAccentBG: #1DB954 !important; + --systemAccentBG-pressed: #15853c !important; + --selectionColor: #1DB954 !important; + + /* main colors */ + --transparency: #0c0c0c57 !important; + --sidebar: #000000 !important; + --footerBG: #121212 !important; + --pageBG: #121212 !important; + + /* search bar */ + --systemHeaderMaterialSover-default_IC: #121212 !important; + --systemHeaderMaterialSover: #121212 !important; + + /* web-chrome */ + --playerBackground: #121212 !important; + --playerLCDBGFill: #121212 !important; + + /* up-next */ + --systemToolbarTitlebarMaterialSover-inactive: #121212 !important; + --systemToolbarTitlebarMaterialSover: rgba(25, 20, 20, 0.8) !important; + } +} \ No newline at end of file diff --git a/resources/web-remote/ameframework.css b/resources/web-remote/ameframework.css new file mode 100644 index 00000000..a7b524a3 --- /dev/null +++ b/resources/web-remote/ameframework.css @@ -0,0 +1,1039 @@ +/* Simple CSS framework for Apple Music Electron */ + +.md-labeltext { + font-size: 14px; + text-transform: uppercase; + opacity: 0.75; + font-weight: 500; +} + +.md-option-container { + border-radius: 10px; + overflow: hidden; +} + +.md-option-line { + display: flex; + width: 100%; + padding: 14px; + background: var(--opaquePageBGColor); + font-size: 0.85em; +} + +.md-option-segment.md-option-segment_auto { + width: auto; +} + +.md-option-container .md-option-line:not(:last-child) { + border-bottom: 1px solid rgb(0 0 0 / 15%); +} + +input[type="range"].md-slider { + -webkit-appearance: none; + height: 7px; + background: rgba(255, 255, 255, 0.6); + border-radius: 5px; + background-size: 70% 100%; + background-repeat: no-repeat; +} + +input[type="range"].md-slider::-webkit-slider-thumb { + -webkit-appearance: none; + height: 20px; + width: 20px; + border-radius: 50%; + background: rgb(255 255 255); + cursor: ew-resize; + box-shadow: 0 0 2px 0 #555; +} + +input[type=range].md-slider::-webkit-slider-runnable-track { + -webkit-appearance: none; + box-shadow: none; + border: none; + background: transparent; +} + +.md-option-segment { + width: 100%; + display: flex; + justify-content: center; + flex-direction: column; +} + +.md-h1 { + font-size: 3em; + text-align: center; +} + +.md-header { + padding: 16px; +} + +.md-header-title { + padding: 18px; + font-weight: 600; + font-size: 16px; + height: 55px; + background: var(--opaquePageBGColor); + border-bottom: 1px solid rgb(0 0 0 / 15%); +} + +.md-footer { + padding: 16px; + text-align: center; +} + + +.md-close-btn { + -webkit-mask-image: url("ameres://icons/webui/close.svg"); + -webkit-mask-repeat: no-repeat; + -webkit-mask-position: center; + background-color: white; + opacity: 0.75; + -webkit-mask-size: contain; + height: 18px; + width: 18px; +} + +.md-btn { + background: rgba(100, 100, 100, 0.5); + padding: 8px 16px; + border-radius: 4px; + font-size: 15px; + border: 1px solid rgb(100 100 100 / 35%); + box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.3), 0px 1px 1px rgba(0, 0, 0, 0.4); +} + +.md-btn.md-btn-block { + display: block; +} + +.md-btn:active { + filter: brightness(75%); +} + +.md-select { + padding: 5px 10px; + font-size: 1em; + font-family: inherit; + border-radius: 4px; + border: 1px solid rgb(100 100 100 / 35%); + box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.3), 0px 1px 1px rgba(0, 0, 0, 0.4); +} + +.md-select:focus { + outline: none; +} + +.md-select > option { + font-size: 1em; + font-family: inherit; + padding: 8px 16px; +} + +.md-btn.md-btn-primary { + background: var(--keyColor); + color: white; +} + +.md-transparent { + background: transparent; +} + +.md-container { + display: flex; + flex-direction: column; + height: 100%; + position: absolute; + top: 0px; + left: 0px; + width: 100%; + padding: 32px; +} + +.md-container_panel { + padding: 0px; +} + +.md-body { + height: 100%; + padding: 16px; + font-size: 1.25em; +} + +@media (prefers-color-scheme: light) { + .md-btn { + background: rgb(255 255 255); + box-shadow: rgb(0 0 0 / 10%) 0px 0px 1px, rgb(0 0 0 / 20%) 0px 1px 1px; + border: 1px solid rgb(0 0 0 / 15%); + } + + .md-close-btn { + background-color: #000; + } +} + +/* Vue transitions */ +.fade_simple-enter-active, .fade_simple-leave-active { + transition: all .5s; +} + +.fade_simple-enter, .fade_simple-leave-to { + opacity: 0; +} + +.fade-enter-active, .fade-leave-active { + transition: all .5s; +} + +.fade-enter, .fade-leave-to { + opacity: 0; + transform: scale(0.95); +} + +/* CSS Grids */ + +.container, +.container-fluid, +.container-xxl, +.container-xl, +.container-lg, +.container-md, +.container-sm { + width: 100%; + padding-right: var(--bs-gutter-x, 0.75rem); + padding-left: var(--bs-gutter-x, 0.75rem); + margin-right: auto; + margin-left: auto; +} + +.row { + --bs-gutter-x: 1.5rem; + --bs-gutter-y: 0; + display: flex; + flex-wrap: wrap; + margin-top: calc(-1 * var(--bs-gutter-y)); + margin-right: calc(-0.5 * var(--bs-gutter-x)); + margin-left: calc(-0.5 * var(--bs-gutter-x)); +} + +.row > * { + box-sizing: border-box; + flex-shrink: 0; + width: 100%; + max-width: 100%; + padding-right: calc(var(--bs-gutter-x) * 0.5); + padding-left: calc(var(--bs-gutter-x) * 0.5); + margin-top: var(--bs-gutter-y); +} + +.col { + flex: 1 0 0%; +} + +.row-cols-auto > * { + flex: 0 0 auto; + width: auto; +} + +.row-cols-1 > * { + flex: 0 0 auto; + width: 100%; +} + +.row-cols-2 > * { + flex: 0 0 auto; + width: 50%; +} + +.row-cols-3 > * { + flex: 0 0 auto; + width: 33.3333333333%; +} + +.row-cols-4 > * { + flex: 0 0 auto; + width: 25%; +} + +.row-cols-5 > * { + flex: 0 0 auto; + width: 20%; +} + +.row-cols-6 > * { + flex: 0 0 auto; + width: 16.6666666667%; +} + +.col-auto { + flex: 0 0 auto; + width: auto; +} + +.col-1 { + flex: 0 0 auto; + width: 8.33333333%; +} + +.col-2 { + flex: 0 0 auto; + width: 16.66666667%; +} + +.col-3 { + flex: 0 0 auto; + width: 25%; +} + +.col-4 { + flex: 0 0 auto; + width: 33.33333333%; +} + +.col-5 { + flex: 0 0 auto; + width: 41.66666667%; +} + +.col-6 { + flex: 0 0 auto; + width: 50%; +} + +.col-7 { + flex: 0 0 auto; + width: 58.33333333%; +} + +.col-8 { + flex: 0 0 auto; + width: 66.66666667%; +} + +.col-9 { + flex: 0 0 auto; + width: 75%; +} + +.col-10 { + flex: 0 0 auto; + width: 83.33333333%; +} + +.col-11 { + flex: 0 0 auto; + width: 91.66666667%; +} + +.col-12 { + flex: 0 0 auto; + width: 100%; +} + +.offset-1 { + margin-left: 8.33333333%; +} + +.offset-2 { + margin-left: 16.66666667%; +} + +.offset-3 { + margin-left: 25%; +} + +.offset-4 { + margin-left: 33.33333333%; +} + +.offset-5 { + margin-left: 41.66666667%; +} + +.offset-6 { + margin-left: 50%; +} + +.offset-7 { + margin-left: 58.33333333%; +} + +.offset-8 { + margin-left: 66.66666667%; +} + +.offset-9 { + margin-left: 75%; +} + +.offset-10 { + margin-left: 83.33333333%; +} + +.offset-11 { + margin-left: 91.66666667%; +} + +.g-0, +.gx-0 { + --bs-gutter-x: 0; +} + +.g-0, +.gy-0 { + --bs-gutter-y: 0; +} + +.g-1, +.gx-1 { + --bs-gutter-x: 0.25rem; +} + +.g-1, +.gy-1 { + --bs-gutter-y: 0.25rem; +} + +.g-2, +.gx-2 { + --bs-gutter-x: 0.5rem; +} + +.g-2, +.gy-2 { + --bs-gutter-y: 0.5rem; +} + +.g-3, +.gx-3 { + --bs-gutter-x: 1rem; +} + +.g-3, +.gy-3 { + --bs-gutter-y: 1rem; +} + +.g-4, +.gx-4 { + --bs-gutter-x: 1.5rem; +} + +.g-4, +.gy-4 { + --bs-gutter-y: 1.5rem; +} + +.g-5, +.gx-5 { + --bs-gutter-x: 3rem; +} + +.g-5, +.gy-5 { + --bs-gutter-y: 3rem; +} + +.d-inline { + display: inline !important; +} + +.d-inline-block { + display: inline-block !important; +} + +.d-block { + display: block !important; +} + +.d-grid { + display: grid !important; +} + +.d-table { + display: table !important; +} + +.d-table-row { + display: table-row !important; +} + +.d-table-cell { + display: table-cell !important; +} + +.d-flex { + display: flex !important; +} + +.d-inline-flex { + display: inline-flex !important; +} + +.d-none { + display: none !important; +} + +.flex-fill { + flex: 1 1 auto !important; +} + +.flex-row { + flex-direction: row !important; +} + +.flex-column { + flex-direction: column !important; +} + +.flex-row-reverse { + flex-direction: row-reverse !important; +} + +.flex-column-reverse { + flex-direction: column-reverse !important; +} + +.flex-grow-0 { + flex-grow: 0 !important; +} + +.flex-grow-1 { + flex-grow: 1 !important; +} + +.flex-shrink-0 { + flex-shrink: 0 !important; +} + +.flex-shrink-1 { + flex-shrink: 1 !important; +} + +.flex-wrap { + flex-wrap: wrap !important; +} + +.flex-nowrap { + flex-wrap: nowrap !important; +} + +.flex-wrap-reverse { + flex-wrap: wrap-reverse !important; +} + +.justify-content-start { + justify-content: flex-start !important; +} + +.justify-content-end { + justify-content: flex-end !important; +} + +.justify-content-center { + justify-content: center !important; +} + +.justify-content-between { + justify-content: space-between !important; +} + +.justify-content-around { + justify-content: space-around !important; +} + +.justify-content-evenly { + justify-content: space-evenly !important; +} + +.align-items-start { + align-items: flex-start !important; +} + +.align-items-end { + align-items: flex-end !important; +} + +.align-items-center { + align-items: center !important; +} + +.align-items-baseline { + align-items: baseline !important; +} + +.align-items-stretch { + align-items: stretch !important; +} + +.align-content-start { + align-content: flex-start !important; +} + +.align-content-end { + align-content: flex-end !important; +} + +.align-content-center { + align-content: center !important; +} + +.align-content-between { + align-content: space-between !important; +} + +.align-content-around { + align-content: space-around !important; +} + +.align-content-stretch { + align-content: stretch !important; +} + +.align-self-auto { + align-self: auto !important; +} + +.align-self-start { + align-self: flex-start !important; +} + +.align-self-end { + align-self: flex-end !important; +} + +.align-self-center { + align-self: center !important; +} + +.align-self-baseline { + align-self: baseline !important; +} + +.align-self-stretch { + align-self: stretch !important; +} + +.order-first { + order: -1 !important; +} + +.order-0 { + order: 0 !important; +} + +.order-1 { + order: 1 !important; +} + +.order-2 { + order: 2 !important; +} + +.order-3 { + order: 3 !important; +} + +.order-4 { + order: 4 !important; +} + +.order-5 { + order: 5 !important; +} + +.order-last { + order: 6 !important; +} + +.m-0 { + margin: 0 !important; +} + +.m-1 { + margin: 0.25rem !important; +} + +.m-2 { + margin: 0.5rem !important; +} + +.m-3 { + margin: 1rem !important; +} + +.m-4 { + margin: 1.5rem !important; +} + +.m-5 { + margin: 3rem !important; +} + +.m-auto { + margin: auto !important; +} + +.mx-0 { + margin-right: 0 !important; + margin-left: 0 !important; +} + +.mx-1 { + margin-right: 0.25rem !important; + margin-left: 0.25rem !important; +} + +.mx-2 { + margin-right: 0.5rem !important; + margin-left: 0.5rem !important; +} + +.mx-3 { + margin-right: 1rem !important; + margin-left: 1rem !important; +} + +.mx-4 { + margin-right: 1.5rem !important; + margin-left: 1.5rem !important; +} + +.mx-5 { + margin-right: 3rem !important; + margin-left: 3rem !important; +} + +.mx-auto { + margin-right: auto !important; + margin-left: auto !important; +} + +.my-0 { + margin-top: 0 !important; + margin-bottom: 0 !important; +} + +.my-1 { + margin-top: 0.25rem !important; + margin-bottom: 0.25rem !important; +} + +.my-2 { + margin-top: 0.5rem !important; + margin-bottom: 0.5rem !important; +} + +.my-3 { + margin-top: 1rem !important; + margin-bottom: 1rem !important; +} + +.my-4 { + margin-top: 1.5rem !important; + margin-bottom: 1.5rem !important; +} + +.my-5 { + margin-top: 3rem !important; + margin-bottom: 3rem !important; +} + +.my-auto { + margin-top: auto !important; + margin-bottom: auto !important; +} + +.mt-0 { + margin-top: 0 !important; +} + +.mt-1 { + margin-top: 0.25rem !important; +} + +.mt-2 { + margin-top: 0.5rem !important; +} + +.mt-3 { + margin-top: 1rem !important; +} + +.mt-4 { + margin-top: 1.5rem !important; +} + +.mt-5 { + margin-top: 3rem !important; +} + +.mt-auto { + margin-top: auto !important; +} + +.me-0 { + margin-right: 0 !important; +} + +.me-1 { + margin-right: 0.25rem !important; +} + +.me-2 { + margin-right: 0.5rem !important; +} + +.me-3 { + margin-right: 1rem !important; +} + +.me-4 { + margin-right: 1.5rem !important; +} + +.me-5 { + margin-right: 3rem !important; +} + +.me-auto { + margin-right: auto !important; +} + +.mb-0 { + margin-bottom: 0 !important; +} + +.mb-1 { + margin-bottom: 0.25rem !important; +} + +.mb-2 { + margin-bottom: 0.5rem !important; +} + +.mb-3 { + margin-bottom: 1rem !important; +} + +.mb-4 { + margin-bottom: 1.5rem !important; +} + +.mb-5 { + margin-bottom: 3rem !important; +} + +.mb-auto { + margin-bottom: auto !important; +} + +.ms-0 { + margin-left: 0 !important; +} + +.ms-1 { + margin-left: 0.25rem !important; +} + +.ms-2 { + margin-left: 0.5rem !important; +} + +.ms-3 { + margin-left: 1rem !important; +} + +.ms-4 { + margin-left: 1.5rem !important; +} + +.ms-5 { + margin-left: 3rem !important; +} + +.ms-auto { + margin-left: auto !important; +} + +.p-0 { + padding: 0 !important; +} + +.p-1 { + padding: 0.25rem !important; +} + +.p-2 { + padding: 0.5rem !important; +} + +.p-3 { + padding: 1rem !important; +} + +.p-4 { + padding: 1.5rem !important; +} + +.p-5 { + padding: 3rem !important; +} + +.px-0 { + padding-right: 0 !important; + padding-left: 0 !important; +} + +.px-1 { + padding-right: 0.25rem !important; + padding-left: 0.25rem !important; +} + +.px-2 { + padding-right: 0.5rem !important; + padding-left: 0.5rem !important; +} + +.px-3 { + padding-right: 1rem !important; + padding-left: 1rem !important; +} + +.px-4 { + padding-right: 1.5rem !important; + padding-left: 1.5rem !important; +} + +.px-5 { + padding-right: 3rem !important; + padding-left: 3rem !important; +} + +.py-0 { + padding-top: 0 !important; + padding-bottom: 0 !important; +} + +.py-1 { + padding-top: 0.25rem !important; + padding-bottom: 0.25rem !important; +} + +.py-2 { + padding-top: 0.5rem !important; + padding-bottom: 0.5rem !important; +} + +.py-3 { + padding-top: 1rem !important; + padding-bottom: 1rem !important; +} + +.py-4 { + padding-top: 1.5rem !important; + padding-bottom: 1.5rem !important; +} + +.py-5 { + padding-top: 3rem !important; + padding-bottom: 3rem !important; +} + +.pt-0 { + padding-top: 0 !important; +} + +.pt-1 { + padding-top: 0.25rem !important; +} + +.pt-2 { + padding-top: 0.5rem !important; +} + +.pt-3 { + padding-top: 1rem !important; +} + +.pt-4 { + padding-top: 1.5rem !important; +} + +.pt-5 { + padding-top: 3rem !important; +} + +.pe-0 { + padding-right: 0 !important; +} + +.pe-1 { + padding-right: 0.25rem !important; +} + +.pe-2 { + padding-right: 0.5rem !important; +} + +.pe-3 { + padding-right: 1rem !important; +} + +.pe-4 { + padding-right: 1.5rem !important; +} + +.pe-5 { + padding-right: 3rem !important; +} + +.pb-0 { + padding-bottom: 0 !important; +} + +.pb-1 { + padding-bottom: 0.25rem !important; +} + +.pb-2 { + padding-bottom: 0.5rem !important; +} + +.pb-3 { + padding-bottom: 1rem !important; +} + +.pb-4 { + padding-bottom: 1.5rem !important; +} + +.pb-5 { + padding-bottom: 3rem !important; +} + +.ps-0 { + padding-left: 0 !important; +} + +.ps-1 { + padding-left: 0.25rem !important; +} + +.ps-2 { + padding-left: 0.5rem !important; +} + +.ps-3 { + padding-left: 1rem !important; +} + +.ps-4 { + padding-left: 1.5rem !important; +} + +.ps-5 { + padding-left: 3rem !important; +} \ No newline at end of file diff --git a/resources/web-remote/assets/arrow-left.svg b/resources/web-remote/assets/arrow-left.svg new file mode 100644 index 00000000..41098a56 --- /dev/null +++ b/resources/web-remote/assets/arrow-left.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/web-remote/assets/backward.svg b/resources/web-remote/assets/backward.svg new file mode 100644 index 00000000..4c445c05 --- /dev/null +++ b/resources/web-remote/assets/backward.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/web-remote/assets/forward.svg b/resources/web-remote/assets/forward.svg new file mode 100644 index 00000000..37b509f1 --- /dev/null +++ b/resources/web-remote/assets/forward.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/web-remote/assets/list.svg b/resources/web-remote/assets/list.svg new file mode 100644 index 00000000..5a8ca2c3 --- /dev/null +++ b/resources/web-remote/assets/list.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/web-remote/assets/pause.svg b/resources/web-remote/assets/pause.svg new file mode 100644 index 00000000..2e9ab6fd --- /dev/null +++ b/resources/web-remote/assets/pause.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/web-remote/assets/play.svg b/resources/web-remote/assets/play.svg new file mode 100644 index 00000000..f6296da5 --- /dev/null +++ b/resources/web-remote/assets/play.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/web-remote/assets/quote-right.svg b/resources/web-remote/assets/quote-right.svg new file mode 100644 index 00000000..629ab4ee --- /dev/null +++ b/resources/web-remote/assets/quote-right.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/web-remote/assets/repeat.svg b/resources/web-remote/assets/repeat.svg new file mode 100644 index 00000000..0c283cf4 --- /dev/null +++ b/resources/web-remote/assets/repeat.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/web-remote/assets/search.svg b/resources/web-remote/assets/search.svg new file mode 100644 index 00000000..62953986 --- /dev/null +++ b/resources/web-remote/assets/search.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/web-remote/assets/shuffle.svg b/resources/web-remote/assets/shuffle.svg new file mode 100644 index 00000000..5ac0b6ae --- /dev/null +++ b/resources/web-remote/assets/shuffle.svg @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/web-remote/assets/volume-down.svg b/resources/web-remote/assets/volume-down.svg new file mode 100644 index 00000000..87c9f9fc --- /dev/null +++ b/resources/web-remote/assets/volume-down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/web-remote/assets/volume-up.svg b/resources/web-remote/assets/volume-up.svg new file mode 100644 index 00000000..05db44e8 --- /dev/null +++ b/resources/web-remote/assets/volume-up.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/web-remote/icon-192x192.png b/resources/web-remote/icon-192x192.png new file mode 100644 index 00000000..05834da2 Binary files /dev/null and b/resources/web-remote/icon-192x192.png differ diff --git a/resources/web-remote/icon-256x256.png b/resources/web-remote/icon-256x256.png new file mode 100644 index 00000000..cb75e71b Binary files /dev/null and b/resources/web-remote/icon-256x256.png differ diff --git a/resources/web-remote/icon-384x384.png b/resources/web-remote/icon-384x384.png new file mode 100644 index 00000000..46293e22 Binary files /dev/null and b/resources/web-remote/icon-384x384.png differ diff --git a/resources/web-remote/icon-512x512.png b/resources/web-remote/icon-512x512.png new file mode 100644 index 00000000..f4a96312 Binary files /dev/null and b/resources/web-remote/icon-512x512.png differ diff --git a/resources/web-remote/index.html b/resources/web-remote/index.html new file mode 100644 index 00000000..17922e21 --- /dev/null +++ b/resources/web-remote/index.html @@ -0,0 +1,626 @@ + + + + + + + + Web Remote + + + + + + + + +
    + + +
    +
    + +
    +
    +
    + Loading... +
    +
    +

    Connection Interrupted

    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    + +
    +
    +
    + + + + + \ No newline at end of file diff --git a/resources/web-remote/index.js b/resources/web-remote/index.js new file mode 100644 index 00000000..48b20014 --- /dev/null +++ b/resources/web-remote/index.js @@ -0,0 +1,500 @@ +var socket; + +// vue instance +var app = new Vue({ + el: '#app', + data: { + screen: "player", + player: { + currentMediaItem: {}, + songActions: false, + lyrics: {}, + lyricsMediaItem: {}, + lyricsDebug: { + current: 0, + start: 0, + end: 0 + }, + queue: {}, + lowerPanelState: "controls", + userInteraction: false + }, + queue: { + temp: [] + }, + search: { + query: "", + results: [], + state: 0, + tab: "all", + searchType: "applemusic", + trackSelect: false, + selected: {}, + queue: {}, + }, + connectedState: 0, + url: window.location.hostname, + // url: "localhost", + }, + methods: { + resetPlayerUI() { + this.player.lowerPanelState = "controls"; + }, + musicAppVariant() { + if (navigator.userAgent.match(/Android/i)) { + return "Apple Music"; + } else if (navigator.userAgent.match(/iPhone|iPad|iPod/i)) { + return "Music"; + } else { + if (navigator.userAgent.indexOf('Mac') > 0) { + return 'Music'; + } else if (navigator.userAgent.indexOf('Win') > 0) { + return 'Apple Music Electron'; + } else { + return 'Apple Music Electron'; + } + } + }, + checkOrientation() { + // check orientation of device + if (window.innerHeight > window.innerWidth) { + return 'portrait' + } else { + return 'landscape'; + } + }, + checkPlatformMD() { + // check if platfom is desktop or mobile + if (navigator.userAgent.match(/Android/i)) { + return "mobile"; + } else if (navigator.userAgent.match(/iPhone|iPad|iPod/i)) { + return "mobile"; + } else { + if (navigator.userAgent.indexOf('Mac') > 0) { + return 'desktop'; + } else if (navigator.userAgent.indexOf('Win') > 0) { + return 'desktop'; + } else { + return 'desktop'; + } + } + }, + checkPlatform() { + if (navigator.userAgent.match(/Android/i)) { + return "android"; + } else if (navigator.userAgent.match(/iPhone|iPad|iPod/i)) { + return "ios"; + } else { + if (navigator.userAgent.indexOf('Mac') > 0) { + return 'mac'; + } else if (navigator.userAgent.indexOf('Win') > 0) { + return 'win'; + } else { + return 'linux'; + } + } + }, + artworkPlaying() { + if (this.player.currentMediaItem.status) { + return + } else { + return ["paused"] + } + }, + setAutoplay(value) { + socket.send(JSON.stringify({ + "action": "set-autoplay", + "autoplay": value + })); + this.getCurrentMediaItem() + if (value) { + setTimeout(() => { + this.getQueue() + }, 1000) + }else{ + this.getQueue() + } + }, + seekTo(time, adjust = true) { + if (adjust) { + time = parseInt(time / 1000) + } + socket.send(JSON.stringify({ + action: "seek", + time: time + })); + }, + setVolume(volume) { + socket.send(JSON.stringify({ + action: "volume", + volume: volume + })); + }, + getQueue() { + socket.send(JSON.stringify({ + action: "get-queue" + })) + }, + play() { + socket.send(JSON.stringify({ + action: "play" + })) + }, + pause() { + socket.send(JSON.stringify({ + action: "pause" + })) + }, + next() { + socket.send(JSON.stringify({ + action: "next" + })) + }, + previous() { + socket.send(JSON.stringify({ + action: "previous" + })) + }, + searchArtist() { + this.search.query = this.player.currentMediaItem.artistName; + this.screen = "search"; + this.searchQuery(); + }, + trackSelect(song) { + this.search.selected = song; + this.search.trackSelect = true + }, + clearSelectedTrack() { + this.search.selected = {} + this.search.trackSelect = false + }, + getArtworkColor(hex) { + return `#${hex}` + }, + playMediaItemById(id) { + socket.send(JSON.stringify({ + action: "play-mediaitem", + id: id + })) + this.screen = "player"; + }, + playNext(type, id) { + socket.send(JSON.stringify({ + action: "play-next", + type: type, + id: id + })) + }, + playLater(type, id) { + socket.send(JSON.stringify({ + action: "play-later", + type: type, + id: id + })) + }, + searchQuery() { + if (this.search.query.length == 0) { + this.search.state = 0; + return; + } + this.search.state = 1; + var actionType = "search" + if (this.search.searchType == "library") { + actionType = "library-search" + } + socket.send(JSON.stringify({ + "action": actionType, + "term": this.search.query, + "limit": 20 + })) + }, + quickSearch() { + var search = prompt("Search for a song", "") + if (search == null || search == "") { + return + } + + socket.send(JSON.stringify({ + action: "quick-play", + term: search + })) + }, + parseTime(value) { + var minutes = Math.floor(value / 60000); + var seconds = ((value % 60000) / 1000).toFixed(0); + return minutes + ":" + (seconds < 10 ? '0' : '') + seconds; + }, + parseTimeDecimal(value) { + var minutes = Math.floor(value / 60000); + var seconds = ((value % 60000) / 1000).toFixed(0); + return minutes + "." + (seconds < 10 ? '0' : '') + seconds; + }, + hmsToSecondsOnly(str) { + var p = str.split(':'), + s = 0, + m = 1; + + while (p.length > 0) { + s += m * parseInt(p.pop(), 10); + m *= 60; + } + + return s; + }, + getCurrentTime() { + return parseFloat(this.hmsToSecondsOnly(this.parseTime(this.player.currentMediaItem.durationInMillis - this.player.currentMediaItem.remainingTime))); + }, + percentage(partial, full) { + return (100 * partial) / full + }, + getLyricBGStyle(start, end) { + var currentTime = this.getCurrentTime(); + var duration = this.player.currentMediaItem.durationInMillis + var start2 = this.hmsToSecondsOnly(start) + var end2 = this.hmsToSecondsOnly(end) + var currentProgress = ((100 * (currentTime)) / (end2)) + // check if currenttime is between start and end + this.player.lyricsDebug.start = start2 + this.player.lyricsDebug.end = end2 + this.player.lyricsDebug.current = currentTime + if (currentTime >= start2 && currentTime <= end2) { + return { + "--bgSpeed": `${(end2 - start2)}s` + } + } else { + return {} + } + }, + getLyricClass(start, end) { + var currentTime = this.getCurrentTime(); + // check if currenttime is between start and end + if (currentTime >= start && currentTime <= end) { + setTimeout(() => { + if (document.querySelector(".lyric-line.active")) { + document.querySelector(".lyric-line.active").scrollIntoView({ + behavior: "smooth", + block: "center" + }) + } + }, 200) + return "active" + } else { + return "" + } + }, + getAlbumArtUrl(size = 600) { + if (this.player.currentMediaItem.artwork) { + return `url("${this.player.currentMediaItem.artwork.url.replace('{w}', size).replace('{h}', size)}")`; + } else { + return ""; + } + }, + getAlbumArtUrlList(url, size = 64) { + return `url("${url.replace('{w}', size).replace('{h}', size)}")`; + }, + searchTabClass(tab) { + if (tab == this.search.tab) { + return "active"; + } + }, + searchTypeClass(type) { + if (type == this.search.searchType) { + return "active"; + } + }, + getQueuePositionClass(position) { + if (this.player.queue["_position"] == position) { + return ["playing", "passed"] + } else if (this.player.queue["_position"] > position) { + return ["passed"] + } + }, + showQueue() { + this.queue.temp = this.player["queue"]["_queueItems"] + this.screen = "queue" + this.getQueue() + }, + queueMove(evt) { + console.log(evt) + console.log(`new: ${evt.moved.newIndex} old: ${evt.moved.oldIndex}`) + this.queue.temp.splice(evt.moved.newIndex, 0, this.queue.temp.splice(evt.moved.oldIndex, 1)[0]) + socket.send(JSON.stringify({ + action: "queue-move", + from: evt.moved.oldIndex, + to: evt.moved.newIndex + })) + this.getQueue() + return true + }, + repeat() { + socket.send(JSON.stringify({ + action: "repeat" + })) + this.getCurrentMediaItem() + }, + shuffle() { + socket.send(JSON.stringify({ + action: "shuffle" + })) + this.getCurrentMediaItem() + }, + getLyrics() { + socket.send(JSON.stringify({ + action: "get-lyrics", + })) + }, + showLyrics() { + this.getLyrics() + this.screen = "lyrics" + }, + showLyricsInline() { + this.getLyrics() + this.player.lowerPanelState = "lyrics" + }, + parseLyrics() { + var xml = this.stringToXml(this.player.lyricsMediaItem.ttml) + var json = xmlToJson(xml); + this.player.lyrics = json + }, + stringToXml(st) { + // string to xml + var xml = (new DOMParser()).parseFromString(st, "text/xml"); + return xml; + }, + canShowSearchTab(tab) { + if (tab == this.search.tab || this.search.tab == "all") { + return true; + } else { + return false; + } + }, + getCurrentMediaItem() { + socket.send(JSON.stringify({ + action: "get-currentmediaitem" + })) + }, + connect() { + let self = this; + this.connectedState = 0; + if (this.url === "") { + this.url = prompt("Host IP", "localhost") + } + socket = new WebSocket(`ws://${this.url}:26369`); + socket.onopen = (e) => { + console.log(e); + console.log('connected'); + app.connectedState = 1; + self.screen = "player" + self.clearSelectedTrack() + } + + socket.onclose = (e) => { + console.log(e); + console.log('disconnected'); + app.connectedState = 2; + } + + socket.onerror = (e) => { + console.log(e); + console.log('error'); + app.connectedState = 2; + } + + socket.onmessage = (e) => { + const response = JSON.parse(e.data); + switch (response.type) { + default: + + break; + case "queue": + self.player.queue = response.data; + self.queue.temp = response.data["_queueItems"]; + self.$forceUpdate() + if (self.screen == "queue") { + setTimeout(() => { + document.querySelector(".playing").scrollIntoView({ + behavior: "smooth", + block: "start" + }) + }, 200) + } + break; + case "lyrics": + self.player.lyrics = response.data; + self.$forceUpdate() + break; + case "searchResultsLibrary": + self.search.results = response.data; + self.search.state = 2; + break; + case "searchResults": + self.search.results = response.data; + self.search.state = 2; + break; + case "playbackStateUpdate": + if (!self.player.userInteraction) { + self.updatePlaybackState(response.data) + } + break; + } + // console.log(e.data); + } + }, + updatePlaybackState(mediaitem) { + var lyricsDisplayed = this.screen == "lyrics" || this.player.lowerPanelState == "lyrics" + if (this.player.currentMediaItem["isrc"] != mediaitem["isrc"]) { + if (lyricsDisplayed) { + this.getLyrics() + } + if (this.screen == "queue") { + this.getQueue() + } + } + this.player.currentMediaItem = mediaitem + } + }, +}); + +function xmlToJson(xml) { + + // Create the return object + var obj = {}; + + if (xml.nodeType == 1) { // element + // do attributes + if (xml.attributes.length > 0) { + obj["@attributes"] = {}; + for (var j = 0; j < xml.attributes.length; j++) { + var attribute = xml.attributes.item(j); + obj["@attributes"][attribute.nodeName] = attribute.nodeValue; + } + } + } else if (xml.nodeType == 3) { // text + obj = xml.nodeValue; + } + + // do children + if (xml.hasChildNodes()) { + for (var i = 0; i < xml.childNodes.length; i++) { + var item = xml.childNodes.item(i); + var nodeName = item.nodeName; + if (typeof (obj[nodeName]) == "undefined") { + obj[nodeName] = xmlToJson(item); + } else { + if (typeof (obj[nodeName].push) == "undefined") { + var old = obj[nodeName]; + obj[nodeName] = []; + obj[nodeName].push(old); + } + obj[nodeName].push(xmlToJson(item)); + } + } + } + return obj; +}; + +window.onresize = function () { + app.resetPlayerUI() +} + +app.connect() \ No newline at end of file diff --git a/resources/web-remote/manifest.json b/resources/web-remote/manifest.json new file mode 100644 index 00000000..3e68fce5 --- /dev/null +++ b/resources/web-remote/manifest.json @@ -0,0 +1,32 @@ +{ + "theme_color": "#000000", + "background_color": "#000000", + "display": "standalone", + "scope": "/", + "start_url": "/", + "name": "AME Remote", + "short_name": "AME Remote", + "description": "Apple Music Electron Remote", + "icons": [ + { + "src": "/icon-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/icon-256x256.png", + "sizes": "256x256", + "type": "image/png" + }, + { + "src": "/icon-384x384.png", + "sizes": "384x384", + "type": "image/png" + }, + { + "src": "/icon-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ] +} \ No newline at end of file diff --git a/resources/web-remote/manifest2.json b/resources/web-remote/manifest2.json new file mode 100644 index 00000000..0f47e665 --- /dev/null +++ b/resources/web-remote/manifest2.json @@ -0,0 +1,20 @@ +{ + "name": "AME", + "short_name": "AME", + "description": "AME", + "icons": [ + { + "src": "images/icon.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "images/icon.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "display": "fullscreen", + "start_url": "/web-remote/index.html", + "orientation": "portrait" +} diff --git a/resources/web-remote/sortable.min.js b/resources/web-remote/sortable.min.js new file mode 100644 index 00000000..7ba6b590 --- /dev/null +++ b/resources/web-remote/sortable.min.js @@ -0,0 +1,2 @@ +/*! Sortable 1.14.0 - MIT | git://github.com/SortableJS/Sortable.git */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Sortable=e()}(this,function(){"use strict";function e(e,t){var n,o=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)),o}function A(o){for(var t=1;tt.length)&&(e=t.length);for(var n=0,o=new Array(e);n"===e[0]&&(e=e.substring(1)),t))try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return}}function N(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"!==e[0]||t.parentNode===n)&&p(t,e)||o&&t===n)return t}while(t!==n&&(t=(i=t).host&&i!==document&&i.host.nodeType?i.host:i.parentNode))}var i;return null}var g,m=/\s+/g;function I(t,e,n){var o;t&&e&&(t.classList?t.classList[n?"add":"remove"](e):(o=(" "+t.className+" ").replace(m," ").replace(" "+e+" "," "),t.className=(o+(n?" "+e:"")).replace(m," ")))}function P(t,e,n){var o=t&&t.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];o[e=!(e in o||-1!==e.indexOf("webkit"))?"-webkit-"+e:e]=n+("string"==typeof n?"":"px")}}function v(t,e){var n="";if("string"==typeof t)n=t;else do{var o=P(t,"transform")}while(o&&"none"!==o&&(n=o+" "+n),!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function b(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i=n.left-e&&i<=n.right+e,e=r>=n.top-e&&r<=n.bottom+e;return o&&e?a=t:void 0}}),a);if(e){var n,o={};for(n in t)t.hasOwnProperty(n)&&(o[n]=t[n]);o.target=o.rootEl=e,o.preventDefault=void 0,o.stopPropagation=void 0,e[j]._onDragOver(o)}}var i,r,a}function Yt(t){q&&q.parentNode[j]._isOutsideThisEl(t.target)}function Bt(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=a({},e),t[j]=this;var n,o,i={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return It(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==Bt.supportPointer&&"PointerEvent"in window&&!u,emptyInsertThreshold:5};for(n in K.initializePlugins(this,t,i),i)n in e||(e[n]=i[n]);for(o in Pt(e),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!e.forceFallback&&At,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?h(t,"pointerdown",this._onTapStart):(h(t,"mousedown",this._onTapStart),h(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(h(t,"dragover",this),h(t,"dragenter",this)),Et.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),a(this,x())}function Ft(t,e,n,o,i,r,a,l){var s,c,u=t[j],d=u.options.onMove;return!window.CustomEvent||y||w?(s=document.createEvent("Event")).initEvent("move",!0,!0):s=new CustomEvent("move",{bubbles:!0,cancelable:!0}),s.to=e,s.from=t,s.dragged=n,s.draggedRect=o,s.related=i||e,s.relatedRect=r||k(e),s.willInsertAfter=l,s.originalEvent=a,t.dispatchEvent(s),c=d?d.call(u,s,a):c}function jt(t){t.draggable=!1}function Ht(){Ct=!1}function Lt(t){return setTimeout(t,0)}function Kt(t){return clearTimeout(t)}Bt.prototype={constructor:Bt,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(gt=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,q):this.options.direction},_onTapStart:function(e){if(e.cancelable){var n=this,o=this.el,t=this.options,i=t.preventOnFilter,r=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,l=(a||e).target,s=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||l,c=t.filter;if(!function(t){Tt.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&Tt.push(o)}}(o),!q&&!(/mousedown|pointerdown/.test(r)&&0!==e.button||t.disabled)&&!s.isContentEditable&&(this.nativeDraggable||!u||!l||"SELECT"!==l.tagName.toUpperCase())&&!((l=N(l,t.draggable,o,!1))&&l.animated||J===l)){if(nt=B(l),it=B(l,t.draggable),"function"==typeof c){if(c.call(this,e,l,this))return U({sortable:n,rootEl:s,name:"filter",targetEl:l,toEl:o,fromEl:o}),z("filter",n,{evt:e}),void(i&&e.cancelable&&e.preventDefault())}else if(c=c&&c.split(",").some(function(t){if(t=N(s,t.trim(),o,!1))return U({sortable:n,rootEl:t,name:"filter",targetEl:l,fromEl:o,toEl:o}),z("filter",n,{evt:e}),!0}))return void(i&&e.cancelable&&e.preventDefault());t.handle&&!N(s,t.handle,o,!1)||this._prepareDragStart(e,a,l)}}},_prepareDragStart:function(t,e,n){var o,i=this,r=i.el,a=i.options,l=r.ownerDocument;n&&!q&&n.parentNode===r&&(o=k(n),$=r,V=(q=n).parentNode,Q=q.nextSibling,J=n,at=a.group,st={target:Bt.dragged=q,clientX:(e||t).clientX,clientY:(e||t).clientY},ht=st.clientX-o.left,ft=st.clientY-o.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,q.style["will-change"]="all",o=function(){z("delayEnded",i,{evt:t}),Bt.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!s&&i.nativeDraggable&&(q.draggable=!0),i._triggerDragStart(t,e),U({sortable:i,name:"choose",originalEvent:t}),I(q,a.chosenClass,!0))},a.ignore.split(",").forEach(function(t){b(q,t.trim(),jt)}),h(l,"dragover",Xt),h(l,"mousemove",Xt),h(l,"touchmove",Xt),h(l,"mouseup",i._onDrop),h(l,"touchend",i._onDrop),h(l,"touchcancel",i._onDrop),s&&this.nativeDraggable&&(this.options.touchStartThreshold=4,q.draggable=!0),z("delayStart",this,{evt:t}),!a.delay||a.delayOnTouchOnly&&!e||this.nativeDraggable&&(w||y)?o():Bt.eventCanceled?this._onDrop():(h(l,"mouseup",i._disableDelayedDrag),h(l,"touchend",i._disableDelayedDrag),h(l,"touchcancel",i._disableDelayedDrag),h(l,"mousemove",i._delayedDragTouchMoveHandler),h(l,"touchmove",i._delayedDragTouchMoveHandler),a.supportPointer&&h(l,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(o,a.delay)))},_delayedDragTouchMoveHandler:function(t){t=t.touches?t.touches[0]:t;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){q&&jt(q),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;f(t,"mouseup",this._disableDelayedDrag),f(t,"touchend",this._disableDelayedDrag),f(t,"touchcancel",this._disableDelayedDrag),f(t,"mousemove",this._delayedDragTouchMoveHandler),f(t,"touchmove",this._delayedDragTouchMoveHandler),f(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?h(document,"pointermove",this._onTouchMove):h(document,e?"touchmove":"mousemove",this._onTouchMove):(h(q,"dragend",this),h($,"dragstart",this._onDragStart));try{document.selection?Lt(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){var n;yt=!1,$&&q?(z("dragStarted",this,{evt:e}),this.nativeDraggable&&h(document,"dragover",Yt),n=this.options,t||I(q,n.dragClass,!1),I(q,n.ghostClass,!0),Bt.active=this,t&&this._appendGhost(),U({sortable:this,name:"start",originalEvent:e})):this._nulling()},_emulateDragOver:function(){if(ct){this._lastX=ct.clientX,this._lastY=ct.clientY,kt();for(var t=document.elementFromPoint(ct.clientX,ct.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(ct.clientX,ct.clientY))!==e;)e=t;if(q.parentNode[j]._isOutsideThisEl(t),e)do{if(e[j])if(e[j]._onDragOver({clientX:ct.clientX,clientY:ct.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}while(e=(t=e).parentNode);Rt()}},_onTouchMove:function(t){if(st){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=Z&&v(Z,!0),a=Z&&r&&r.a,l=Z&&r&&r.d,e=Ot&&bt&&E(bt),a=(i.clientX-st.clientX+o.x)/(a||1)+(e?e[0]-_t[0]:0)/(a||1),l=(i.clientY-st.clientY+o.y)/(l||1)+(e?e[1]-_t[1]:0)/(l||1);if(!Bt.active&&!yt){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))n.right+10||t.clientX<=n.right&&t.clientY>n.bottom&&t.clientX>=n.left:t.clientX>n.right&&t.clientY>n.top||t.clientX<=n.right&&t.clientY>n.bottom+10}(n,r,this)&&!g.animated){if(g===q)return O(!1);if((l=g&&a===n.target?g:l)&&(w=k(l)),!1!==Ft($,a,q,o,l,w,n,!!l))return x(),a.appendChild(q),V=a,M(),O(!0)}else if(g&&function(t,e,n){n=k(X(n.el,0,n.options,!0));return e?t.clientX div { + width: 10px; + height: 10px; + background: white; + border-radius: 50%; + margin: 3px; +} + +@keyframes lyricWaitingLine { + 0% { + opacity: 0; + transform: scale(0.85); + } + 50% { + opacity: 1; + transform: scale(1); + } + 100% { + opacity: 0; + transform: scale(0.85); + } +} + + +.lyric-line2:before { + background: var(--keyColor); + content: ''; + width: 0%; + height: 6px; + position: absolute; + bottom: -8px; + left: 0; + border-radius: 10px; + z-index: -1; + transition: width var(--bgSpeed); +} + +.lyric-line2.active:before { + width: 100%; + transition: width var(--bgSpeed); +} + +.player_top { + height: 100%; +} + +/* Small Screen */ +@media only screen and (max-height: 668px) { + #app { + zoom: 0.8; + } +} + +/* Big Screen */ + + +@media only screen and (orientation: landscape) { + #app { + max-width: 100%; + } + + .player-panel { + display: flex; + flex-direction: row; + } + + .player_top { + width: 100%; + } + + .player_bottom { + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + width: 100%; + margin: 0 auto; + } + + .media-artwork { + width: 45vw; + height: 45vw; + margin: 60px; + } + + .player-song-title { + font-size: 2em; + } + + .player-song-artist { + font-size: 1.25em; + } + + .search-panel { + } + + .md-footer { + width: 100%; + } +} + + +/* Transitions */ +.wpfade-enter-active, +.wpfade-leave-active { + transition: opacity .1s var(--appleEase); +} + +.wpfade-enter, +.wpfade-leave-to { + opacity: 0; +} \ No newline at end of file diff --git a/resources/web-remote/vue.js b/resources/web-remote/vue.js new file mode 100644 index 00000000..d998ff72 --- /dev/null +++ b/resources/web-remote/vue.js @@ -0,0 +1,6 @@ +/*! + * Vue.js v2.6.14 + * (c) 2014-2021 Evan You + * Released under the MIT License. + */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Vue=t()}(this,function(){"use strict";var e=Object.freeze({});function t(e){return null==e}function n(e){return null!=e}function r(e){return!0===e}function i(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}function o(e){return null!==e&&"object"==typeof e}var a=Object.prototype.toString;function s(e){return"[object Object]"===a.call(e)}function c(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function u(e){return n(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function l(e){return null==e?"":Array.isArray(e)||s(e)&&e.toString===a?JSON.stringify(e,null,2):String(e)}function f(e){var t=parseFloat(e);return isNaN(t)?e:t}function p(e,t){for(var n=Object.create(null),r=e.split(","),i=0;i-1)return e.splice(n,1)}}var m=Object.prototype.hasOwnProperty;function y(e,t){return m.call(e,t)}function g(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var _=/-(\w)/g,b=g(function(e){return e.replace(_,function(e,t){return t?t.toUpperCase():""})}),$=g(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}),w=/\B([A-Z])/g,C=g(function(e){return e.replace(w,"-$1").toLowerCase()});var x=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function k(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function A(e,t){for(var n in t)e[n]=t[n];return e}function O(e){for(var t={},n=0;n0,Z=J&&J.indexOf("edge/")>0,G=(J&&J.indexOf("android"),J&&/iphone|ipad|ipod|ios/.test(J)||"ios"===K),X=(J&&/chrome\/\d+/.test(J),J&&/phantomjs/.test(J),J&&J.match(/firefox\/(\d+)/)),Y={}.watch,Q=!1;if(V)try{var ee={};Object.defineProperty(ee,"passive",{get:function(){Q=!0}}),window.addEventListener("test-passive",null,ee)}catch(e){}var te=function(){return void 0===B&&(B=!V&&!z&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),B},ne=V&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function re(e){return"function"==typeof e&&/native code/.test(e.toString())}var ie,oe="undefined"!=typeof Symbol&&re(Symbol)&&"undefined"!=typeof Reflect&&re(Reflect.ownKeys);ie="undefined"!=typeof Set&&re(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var ae=S,se=0,ce=function(){this.id=se++,this.subs=[]};ce.prototype.addSub=function(e){this.subs.push(e)},ce.prototype.removeSub=function(e){h(this.subs,e)},ce.prototype.depend=function(){ce.target&&ce.target.addDep(this)},ce.prototype.notify=function(){for(var e=this.subs.slice(),t=0,n=e.length;t-1)if(o&&!y(i,"default"))a=!1;else if(""===a||a===C(e)){var c=Re(String,i.type);(c<0||s0&&(ct((u=e(u,(a||"")+"_"+c))[0])&&ct(f)&&(s[l]=he(f.text+u[0].text),u.shift()),s.push.apply(s,u)):i(u)?ct(f)?s[l]=he(f.text+u):""!==u&&s.push(he(u)):ct(u)&&ct(f)?s[l]=he(f.text+u.text):(r(o._isVList)&&n(u.tag)&&t(u.key)&&n(a)&&(u.key="__vlist"+a+"_"+c+"__"),s.push(u)));return s}(e):void 0}function ct(e){return n(e)&&n(e.text)&&!1===e.isComment}function ut(e,t){if(e){for(var n=Object.create(null),r=oe?Reflect.ownKeys(e):Object.keys(e),i=0;i0,a=t?!!t.$stable:!o,s=t&&t.$key;if(t){if(t._normalized)return t._normalized;if(a&&r&&r!==e&&s===r.$key&&!o&&!r.$hasNormal)return r;for(var c in i={},t)t[c]&&"$"!==c[0]&&(i[c]=vt(n,c,t[c]))}else i={};for(var u in n)u in i||(i[u]=ht(n,u));return t&&Object.isExtensible(t)&&(t._normalized=i),R(i,"$stable",a),R(i,"$key",s),R(i,"$hasNormal",o),i}function vt(e,t,n){var r=function(){var e=arguments.length?n.apply(null,arguments):n({}),t=(e=e&&"object"==typeof e&&!Array.isArray(e)?[e]:st(e))&&e[0];return e&&(!t||1===e.length&&t.isComment&&!pt(t))?void 0:e};return n.proxy&&Object.defineProperty(e,t,{get:r,enumerable:!0,configurable:!0}),r}function ht(e,t){return function(){return e[t]}}function mt(e,t){var r,i,a,s,c;if(Array.isArray(e)||"string"==typeof e)for(r=new Array(e.length),i=0,a=e.length;idocument.createEvent("Event").timeStamp&&(cn=function(){return un.now()})}function ln(){var e,t;for(sn=cn(),on=!0,en.sort(function(e,t){return e.id-t.id}),an=0;anan&&en[n].id>e.id;)n--;en.splice(n+1,0,e)}else en.push(e);rn||(rn=!0,Qe(ln))}}(this)},pn.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||o(e)||this.deep){var t=this.value;if(this.value=e,this.user){var n='callback for watcher "'+this.expression+'"';Be(this.cb,this.vm,[e,t],this.vm,n)}else this.cb.call(this.vm,e,t)}}},pn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},pn.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},pn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||h(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var dn={enumerable:!0,configurable:!0,get:S,set:S};function vn(e,t,n){dn.get=function(){return this[t][n]},dn.set=function(e){this[t][n]=e},Object.defineProperty(e,n,dn)}function hn(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var n=e.$options.propsData||{},r=e._props={},i=e.$options._propKeys=[];e.$parent&&$e(!1);var o=function(o){i.push(o);var a=Ie(o,t,n,e);xe(r,o,a),o in e||vn(e,"_props",o)};for(var a in t)o(a);$e(!0)}(e,t.props),t.methods&&function(e,t){e.$options.props;for(var n in t)e[n]="function"!=typeof t[n]?S:x(t[n],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;s(t=e._data="function"==typeof t?function(e,t){le();try{return e.call(t,t)}catch(e){return He(e,t,"data()"),{}}finally{fe()}}(t,e):t||{})||(t={});var n=Object.keys(t),r=e.$options.props,i=(e.$options.methods,n.length);for(;i--;){var o=n[i];r&&y(r,o)||(a=void 0,36!==(a=(o+"").charCodeAt(0))&&95!==a&&vn(e,"_data",o))}var a;Ce(t,!0)}(e):Ce(e._data={},!0),t.computed&&function(e,t){var n=e._computedWatchers=Object.create(null),r=te();for(var i in t){var o=t[i],a="function"==typeof o?o:o.get;r||(n[i]=new pn(e,a||S,S,mn)),i in e||yn(e,i,o)}}(e,t.computed),t.watch&&t.watch!==Y&&function(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var i=0;i-1:"string"==typeof e?e.split(",").indexOf(t)>-1:(n=e,"[object RegExp]"===a.call(n)&&e.test(t));var n}function On(e,t){var n=e.cache,r=e.keys,i=e._vnode;for(var o in n){var a=n[o];if(a){var s=a.name;s&&!t(s)&&Sn(n,o,r,i)}}}function Sn(e,t,n,r){var i=e[t];!i||r&&i.tag===r.tag||i.componentInstance.$destroy(),e[t]=null,h(n,t)}!function(t){t.prototype._init=function(t){var n=this;n._uid=$n++,n._isVue=!0,t&&t._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var i=r.componentOptions;n.propsData=i.propsData,n._parentListeners=i.listeners,n._renderChildren=i.children,n._componentTag=i.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(n,t):n.$options=De(wn(n.constructor),t||{},n),n._renderProxy=n,n._self=n,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(n),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&Wt(e,t)}(n),function(t){t._vnode=null,t._staticTrees=null;var n=t.$options,r=t.$vnode=n._parentVnode,i=r&&r.context;t.$slots=lt(n._renderChildren,i),t.$scopedSlots=e,t._c=function(e,n,r,i){return Ht(t,e,n,r,i,!1)},t.$createElement=function(e,n,r,i){return Ht(t,e,n,r,i,!0)};var o=r&&r.data;xe(t,"$attrs",o&&o.attrs||e,null,!0),xe(t,"$listeners",n._parentListeners||e,null,!0)}(n),Qt(n,"beforeCreate"),function(e){var t=ut(e.$options.inject,e);t&&($e(!1),Object.keys(t).forEach(function(n){xe(e,n,t[n])}),$e(!0))}(n),hn(n),function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(n),Qt(n,"created"),n.$options.el&&n.$mount(n.$options.el)}}(Cn),function(e){var t={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=ke,e.prototype.$delete=Ae,e.prototype.$watch=function(e,t,n){if(s(t))return bn(this,e,t,n);(n=n||{}).user=!0;var r=new pn(this,e,t,n);if(n.immediate){var i='callback for immediate watcher "'+r.expression+'"';le(),Be(t,this,[r.value],this,i),fe()}return function(){r.teardown()}}}(Cn),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this;if(Array.isArray(e))for(var i=0,o=e.length;i1?k(t):t;for(var n=k(arguments,1),r='event handler for "'+e+'"',i=0,o=t.length;iparseInt(this.max)&&Sn(e,t[0],t,this._vnode),this.vnodeToCache=null}}},created:function(){this.cache=Object.create(null),this.keys=[]},destroyed:function(){for(var e in this.cache)Sn(this.cache,e,this.keys)},mounted:function(){var e=this;this.cacheVNode(),this.$watch("include",function(t){On(e,function(e){return An(t,e)})}),this.$watch("exclude",function(t){On(e,function(e){return!An(t,e)})})},updated:function(){this.cacheVNode()},render:function(){var e=this.$slots.default,t=zt(e),n=t&&t.componentOptions;if(n){var r=kn(n),i=this.include,o=this.exclude;if(i&&(!r||!An(i,r))||o&&r&&An(o,r))return t;var a=this.cache,s=this.keys,c=null==t.key?n.Ctor.cid+(n.tag?"::"+n.tag:""):t.key;a[c]?(t.componentInstance=a[c].componentInstance,h(s,c),s.push(c)):(this.vnodeToCache=t,this.keyToCache=c),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return F}};Object.defineProperty(e,"config",t),e.util={warn:ae,extend:A,mergeOptions:De,defineReactive:xe},e.set=ke,e.delete=Ae,e.nextTick=Qe,e.observable=function(e){return Ce(e),e},e.options=Object.create(null),I.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,A(e.options.components,Nn),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=k(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=De(this.options,e),this}}(e),xn(e),function(e){I.forEach(function(t){e[t]=function(e,n){return n?("component"===t&&s(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}})}(e)}(Cn),Object.defineProperty(Cn.prototype,"$isServer",{get:te}),Object.defineProperty(Cn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(Cn,"FunctionalRenderContext",{value:Et}),Cn.version="2.6.14";var En=p("style,class"),jn=p("input,textarea,option,select,progress"),Dn=function(e,t,n){return"value"===n&&jn(e)&&"button"!==t||"selected"===n&&"option"===e||"checked"===n&&"input"===e||"muted"===n&&"video"===e},Ln=p("contenteditable,draggable,spellcheck"),In=p("events,caret,typing,plaintext-only"),Mn=function(e,t){return Bn(t)||"false"===t?"false":"contenteditable"===e&&In(t)?t:"true"},Fn=p("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,truespeed,typemustmatch,visible"),Pn="http://www.w3.org/1999/xlink",Rn=function(e){return":"===e.charAt(5)&&"xlink"===e.slice(0,5)},Hn=function(e){return Rn(e)?e.slice(6,e.length):""},Bn=function(e){return null==e||!1===e};function Un(e){for(var t=e.data,r=e,i=e;n(i.componentInstance);)(i=i.componentInstance._vnode)&&i.data&&(t=Vn(i.data,t));for(;n(r=r.parent);)r&&r.data&&(t=Vn(t,r.data));return function(e,t){if(n(e)||n(t))return zn(e,Kn(t));return""}(t.staticClass,t.class)}function Vn(e,t){return{staticClass:zn(e.staticClass,t.staticClass),class:n(e.class)?[e.class,t.class]:t.class}}function zn(e,t){return e?t?e+" "+t:e:t||""}function Kn(e){return Array.isArray(e)?function(e){for(var t,r="",i=0,o=e.length;i-1?mr(e,t,n):Fn(t)?Bn(n)?e.removeAttribute(t):(n="allowfullscreen"===t&&"EMBED"===e.tagName?"true":t,e.setAttribute(t,n)):Ln(t)?e.setAttribute(t,Mn(t,n)):Rn(t)?Bn(n)?e.removeAttributeNS(Pn,Hn(t)):e.setAttributeNS(Pn,t,n):mr(e,t,n)}function mr(e,t,n){if(Bn(n))e.removeAttribute(t);else{if(q&&!W&&"TEXTAREA"===e.tagName&&"placeholder"===t&&""!==n&&!e.__ieph){var r=function(t){t.stopImmediatePropagation(),e.removeEventListener("input",r)};e.addEventListener("input",r),e.__ieph=!0}e.setAttribute(t,n)}}var yr={create:vr,update:vr};function gr(e,r){var i=r.elm,o=r.data,a=e.data;if(!(t(o.staticClass)&&t(o.class)&&(t(a)||t(a.staticClass)&&t(a.class)))){var s=Un(r),c=i._transitionClasses;n(c)&&(s=zn(s,Kn(c))),s!==i._prevClass&&(i.setAttribute("class",s),i._prevClass=s)}}var _r,br,$r,wr,Cr,xr,kr={create:gr,update:gr},Ar=/[\w).+\-_$\]]/;function Or(e){var t,n,r,i,o,a=!1,s=!1,c=!1,u=!1,l=0,f=0,p=0,d=0;for(r=0;r=0&&" "===(h=e.charAt(v));v--);h&&Ar.test(h)||(u=!0)}}else void 0===i?(d=r+1,i=e.slice(0,r).trim()):m();function m(){(o||(o=[])).push(e.slice(d,r).trim()),d=r+1}if(void 0===i?i=e.slice(0,r).trim():0!==d&&m(),o)for(r=0;r-1?{exp:e.slice(0,wr),key:'"'+e.slice(wr+1)+'"'}:{exp:e,key:null};br=e,wr=Cr=xr=0;for(;!zr();)Kr($r=Vr())?qr($r):91===$r&&Jr($r);return{exp:e.slice(0,Cr),key:e.slice(Cr+1,xr)}}(e);return null===n.key?e+"="+t:"$set("+n.exp+", "+n.key+", "+t+")"}function Vr(){return br.charCodeAt(++wr)}function zr(){return wr>=_r}function Kr(e){return 34===e||39===e}function Jr(e){var t=1;for(Cr=wr;!zr();)if(Kr(e=Vr()))qr(e);else if(91===e&&t++,93===e&&t--,0===t){xr=wr;break}}function qr(e){for(var t=e;!zr()&&(e=Vr())!==t;);}var Wr,Zr="__r",Gr="__c";function Xr(e,t,n){var r=Wr;return function i(){null!==t.apply(null,arguments)&&ei(e,i,n,r)}}var Yr=Ke&&!(X&&Number(X[1])<=53);function Qr(e,t,n,r){if(Yr){var i=sn,o=t;t=o._wrapper=function(e){if(e.target===e.currentTarget||e.timeStamp>=i||e.timeStamp<=0||e.target.ownerDocument!==document)return o.apply(this,arguments)}}Wr.addEventListener(e,t,Q?{capture:n,passive:r}:n)}function ei(e,t,n,r){(r||Wr).removeEventListener(e,t._wrapper||t,n)}function ti(e,r){if(!t(e.data.on)||!t(r.data.on)){var i=r.data.on||{},o=e.data.on||{};Wr=r.elm,function(e){if(n(e[Zr])){var t=q?"change":"input";e[t]=[].concat(e[Zr],e[t]||[]),delete e[Zr]}n(e[Gr])&&(e.change=[].concat(e[Gr],e.change||[]),delete e[Gr])}(i),it(i,o,Qr,ei,Xr,r.context),Wr=void 0}}var ni,ri={create:ti,update:ti};function ii(e,r){if(!t(e.data.domProps)||!t(r.data.domProps)){var i,o,a=r.elm,s=e.data.domProps||{},c=r.data.domProps||{};for(i in n(c.__ob__)&&(c=r.data.domProps=A({},c)),s)i in c||(a[i]="");for(i in c){if(o=c[i],"textContent"===i||"innerHTML"===i){if(r.children&&(r.children.length=0),o===s[i])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===i&&"PROGRESS"!==a.tagName){a._value=o;var u=t(o)?"":String(o);oi(a,u)&&(a.value=u)}else if("innerHTML"===i&&Wn(a.tagName)&&t(a.innerHTML)){(ni=ni||document.createElement("div")).innerHTML=""+o+"";for(var l=ni.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}else if(o!==s[i])try{a[i]=o}catch(e){}}}}function oi(e,t){return!e.composing&&("OPTION"===e.tagName||function(e,t){var n=!0;try{n=document.activeElement!==e}catch(e){}return n&&e.value!==t}(e,t)||function(e,t){var r=e.value,i=e._vModifiers;if(n(i)){if(i.number)return f(r)!==f(t);if(i.trim)return r.trim()!==t.trim()}return r!==t}(e,t))}var ai={create:ii,update:ii},si=g(function(e){var t={},n=/:(.+)/;return e.split(/;(?![^(]*\))/g).forEach(function(e){if(e){var r=e.split(n);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t});function ci(e){var t=ui(e.style);return e.staticStyle?A(e.staticStyle,t):t}function ui(e){return Array.isArray(e)?O(e):"string"==typeof e?si(e):e}var li,fi=/^--/,pi=/\s*!important$/,di=function(e,t,n){if(fi.test(t))e.style.setProperty(t,n);else if(pi.test(n))e.style.setProperty(C(t),n.replace(pi,""),"important");else{var r=hi(t);if(Array.isArray(n))for(var i=0,o=n.length;i-1?t.split(gi).forEach(function(t){return e.classList.add(t)}):e.classList.add(t);else{var n=" "+(e.getAttribute("class")||"")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function bi(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(gi).forEach(function(t){return e.classList.remove(t)}):e.classList.remove(t),e.classList.length||e.removeAttribute("class");else{for(var n=" "+(e.getAttribute("class")||"")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?e.setAttribute("class",n):e.removeAttribute("class")}}function $i(e){if(e){if("object"==typeof e){var t={};return!1!==e.css&&A(t,wi(e.name||"v")),A(t,e),t}return"string"==typeof e?wi(e):void 0}}var wi=g(function(e){return{enterClass:e+"-enter",enterToClass:e+"-enter-to",enterActiveClass:e+"-enter-active",leaveClass:e+"-leave",leaveToClass:e+"-leave-to",leaveActiveClass:e+"-leave-active"}}),Ci=V&&!W,xi="transition",ki="animation",Ai="transition",Oi="transitionend",Si="animation",Ti="animationend";Ci&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(Ai="WebkitTransition",Oi="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Si="WebkitAnimation",Ti="webkitAnimationEnd"));var Ni=V?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(e){return e()};function Ei(e){Ni(function(){Ni(e)})}function ji(e,t){var n=e._transitionClasses||(e._transitionClasses=[]);n.indexOf(t)<0&&(n.push(t),_i(e,t))}function Di(e,t){e._transitionClasses&&h(e._transitionClasses,t),bi(e,t)}function Li(e,t,n){var r=Mi(e,t),i=r.type,o=r.timeout,a=r.propCount;if(!i)return n();var s=i===xi?Oi:Ti,c=0,u=function(){e.removeEventListener(s,l),n()},l=function(t){t.target===e&&++c>=a&&u()};setTimeout(function(){c0&&(n=xi,l=a,f=o.length):t===ki?u>0&&(n=ki,l=u,f=c.length):f=(n=(l=Math.max(a,u))>0?a>u?xi:ki:null)?n===xi?o.length:c.length:0,{type:n,timeout:l,propCount:f,hasTransform:n===xi&&Ii.test(r[Ai+"Property"])}}function Fi(e,t){for(;e.length1}function Vi(e,t){!0!==t.data.show&&Ri(t)}var zi=function(e){var o,a,s={},c=e.modules,u=e.nodeOps;for(o=0;ov?_(e,t(i[y+1])?null:i[y+1].elm,i,d,y,o):d>y&&$(r,p,v)}(p,h,y,o,l):n(y)?(n(e.text)&&u.setTextContent(p,""),_(p,null,y,0,y.length-1,o)):n(h)?$(h,0,h.length-1):n(e.text)&&u.setTextContent(p,""):e.text!==i.text&&u.setTextContent(p,i.text),n(v)&&n(d=v.hook)&&n(d=d.postpatch)&&d(e,i)}}}function k(e,t,i){if(r(i)&&n(e.parent))e.parent.data.pendingInsert=t;else for(var o=0;o-1,a.selected!==o&&(a.selected=o);else if(E(Zi(a),r))return void(e.selectedIndex!==s&&(e.selectedIndex=s));i||(e.selectedIndex=-1)}}function Wi(e,t){return t.every(function(t){return!E(t,e)})}function Zi(e){return"_value"in e?e._value:e.value}function Gi(e){e.target.composing=!0}function Xi(e){e.target.composing&&(e.target.composing=!1,Yi(e.target,"input"))}function Yi(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)}function Qi(e){return!e.componentInstance||e.data&&e.data.transition?e:Qi(e.componentInstance._vnode)}var eo={model:Ki,show:{bind:function(e,t,n){var r=t.value,i=(n=Qi(n)).data&&n.data.transition,o=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display;r&&i?(n.data.show=!0,Ri(n,function(){e.style.display=o})):e.style.display=r?o:"none"},update:function(e,t,n){var r=t.value;!r!=!t.oldValue&&((n=Qi(n)).data&&n.data.transition?(n.data.show=!0,r?Ri(n,function(){e.style.display=e.__vOriginalDisplay}):Hi(n,function(){e.style.display="none"})):e.style.display=r?e.__vOriginalDisplay:"none")},unbind:function(e,t,n,r,i){i||(e.style.display=e.__vOriginalDisplay)}}},to={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function no(e){var t=e&&e.componentOptions;return t&&t.Ctor.options.abstract?no(zt(t.children)):e}function ro(e){var t={},n=e.$options;for(var r in n.propsData)t[r]=e[r];var i=n._parentListeners;for(var o in i)t[b(o)]=i[o];return t}function io(e,t){if(/\d-keep-alive$/.test(t.tag))return e("keep-alive",{props:t.componentOptions.propsData})}var oo=function(e){return e.tag||pt(e)},ao=function(e){return"show"===e.name},so={name:"transition",props:to,abstract:!0,render:function(e){var t=this,n=this.$slots.default;if(n&&(n=n.filter(oo)).length){var r=this.mode,o=n[0];if(function(e){for(;e=e.parent;)if(e.data.transition)return!0}(this.$vnode))return o;var a=no(o);if(!a)return o;if(this._leaving)return io(e,o);var s="__transition-"+this._uid+"-";a.key=null==a.key?a.isComment?s+"comment":s+a.tag:i(a.key)?0===String(a.key).indexOf(s)?a.key:s+a.key:a.key;var c=(a.data||(a.data={})).transition=ro(this),u=this._vnode,l=no(u);if(a.data.directives&&a.data.directives.some(ao)&&(a.data.show=!0),l&&l.data&&!function(e,t){return t.key===e.key&&t.tag===e.tag}(a,l)&&!pt(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){var f=l.data.transition=A({},c);if("out-in"===r)return this._leaving=!0,ot(f,"afterLeave",function(){t._leaving=!1,t.$forceUpdate()}),io(e,o);if("in-out"===r){if(pt(a))return u;var p,d=function(){p()};ot(c,"afterEnter",d),ot(c,"enterCancelled",d),ot(f,"delayLeave",function(e){p=e})}}return o}}},co=A({tag:String,moveClass:String},to);function uo(e){e.elm._moveCb&&e.elm._moveCb(),e.elm._enterCb&&e.elm._enterCb()}function lo(e){e.data.newPos=e.elm.getBoundingClientRect()}function fo(e){var t=e.data.pos,n=e.data.newPos,r=t.left-n.left,i=t.top-n.top;if(r||i){e.data.moved=!0;var o=e.elm.style;o.transform=o.WebkitTransform="translate("+r+"px,"+i+"px)",o.transitionDuration="0s"}}delete co.mode;var po={Transition:so,TransitionGroup:{props:co,beforeMount:function(){var e=this,t=this._update;this._update=function(n,r){var i=Gt(e);e.__patch__(e._vnode,e.kept,!1,!0),e._vnode=e.kept,i(),t.call(e,n,r)}},render:function(e){for(var t=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,i=this.$slots.default||[],o=this.children=[],a=ro(this),s=0;s-1?Xn[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:Xn[e]=/HTMLUnknownElement/.test(t.toString())},A(Cn.options.directives,eo),A(Cn.options.components,po),Cn.prototype.__patch__=V?zi:S,Cn.prototype.$mount=function(e,t){return function(e,t,n){var r;return e.$el=t,e.$options.render||(e.$options.render=ve),Qt(e,"beforeMount"),r=function(){e._update(e._render(),n)},new pn(e,r,S,{before:function(){e._isMounted&&!e._isDestroyed&&Qt(e,"beforeUpdate")}},!0),n=!1,null==e.$vnode&&(e._isMounted=!0,Qt(e,"mounted")),e}(this,e=e&&V?Qn(e):void 0,t)},V&&setTimeout(function(){F.devtools&&ne&&ne.emit("init",Cn)},0);var vo=/\{\{((?:.|\r?\n)+?)\}\}/g,ho=/[-.*+?^${}()|[\]\/\\]/g,mo=g(function(e){var t=e[0].replace(ho,"\\$&"),n=e[1].replace(ho,"\\$&");return new RegExp(t+"((?:.|\\n)+?)"+n,"g")});var yo={staticKeys:["staticClass"],transformNode:function(e,t){t.warn;var n=Pr(e,"class");n&&(e.staticClass=JSON.stringify(n));var r=Fr(e,"class",!1);r&&(e.classBinding=r)},genData:function(e){var t="";return e.staticClass&&(t+="staticClass:"+e.staticClass+","),e.classBinding&&(t+="class:"+e.classBinding+","),t}};var go,_o={staticKeys:["staticStyle"],transformNode:function(e,t){t.warn;var n=Pr(e,"style");n&&(e.staticStyle=JSON.stringify(si(n)));var r=Fr(e,"style",!1);r&&(e.styleBinding=r)},genData:function(e){var t="";return e.staticStyle&&(t+="staticStyle:"+e.staticStyle+","),e.styleBinding&&(t+="style:("+e.styleBinding+"),"),t}},bo=function(e){return(go=go||document.createElement("div")).innerHTML=e,go.textContent},$o=p("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),wo=p("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),Co=p("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),xo=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,ko=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,Ao="[a-zA-Z_][\\-\\.0-9_a-zA-Z"+P.source+"]*",Oo="((?:"+Ao+"\\:)?"+Ao+")",So=new RegExp("^<"+Oo),To=/^\s*(\/?)>/,No=new RegExp("^<\\/"+Oo+"[^>]*>"),Eo=/^]+>/i,jo=/^",""":'"',"&":"&"," ":"\n"," ":"\t","'":"'"},Fo=/&(?:lt|gt|quot|amp|#39);/g,Po=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,Ro=p("pre,textarea",!0),Ho=function(e,t){return e&&Ro(e)&&"\n"===t[0]};function Bo(e,t){var n=t?Po:Fo;return e.replace(n,function(e){return Mo[e]})}var Uo,Vo,zo,Ko,Jo,qo,Wo,Zo,Go=/^@|^v-on:/,Xo=/^v-|^@|^:|^#/,Yo=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,Qo=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,ea=/^\(|\)$/g,ta=/^\[.*\]$/,na=/:(.*)$/,ra=/^:|^\.|^v-bind:/,ia=/\.[^.\]]+(?=[^\]]*$)/g,oa=/^v-slot(:|$)|^#/,aa=/[\r\n]/,sa=/[ \f\t\r\n]+/g,ca=g(bo),ua="_empty_";function la(e,t,n){return{type:1,tag:e,attrsList:t,attrsMap:ya(t),rawAttrsMap:{},parent:n,children:[]}}function fa(e,t){Uo=t.warn||Tr,qo=t.isPreTag||T,Wo=t.mustUseProp||T,Zo=t.getTagNamespace||T;t.isReservedTag;zo=Nr(t.modules,"transformNode"),Ko=Nr(t.modules,"preTransformNode"),Jo=Nr(t.modules,"postTransformNode"),Vo=t.delimiters;var n,r,i=[],o=!1!==t.preserveWhitespace,a=t.whitespace,s=!1,c=!1;function u(e){if(l(e),s||e.processed||(e=pa(e,t)),i.length||e===n||n.if&&(e.elseif||e.else)&&va(n,{exp:e.elseif,block:e}),r&&!e.forbidden)if(e.elseif||e.else)a=e,(u=function(e){var t=e.length;for(;t--;){if(1===e[t].type)return e[t];e.pop()}}(r.children))&&u.if&&va(u,{exp:a.elseif,block:a});else{if(e.slotScope){var o=e.slotTarget||'"default"';(r.scopedSlots||(r.scopedSlots={}))[o]=e}r.children.push(e),e.parent=r}var a,u;e.children=e.children.filter(function(e){return!e.slotScope}),l(e),e.pre&&(s=!1),qo(e.tag)&&(c=!1);for(var f=0;f]*>)","i")),p=e.replace(f,function(e,n,r){return u=r.length,Lo(l)||"noscript"===l||(n=n.replace(//g,"$1").replace(//g,"$1")),Ho(l,n)&&(n=n.slice(1)),t.chars&&t.chars(n),""});c+=e.length-p.length,e=p,A(l,c-u,c)}else{var d=e.indexOf("<");if(0===d){if(jo.test(e)){var v=e.indexOf("--\x3e");if(v>=0){t.shouldKeepComment&&t.comment(e.substring(4,v),c,c+v+3),C(v+3);continue}}if(Do.test(e)){var h=e.indexOf("]>");if(h>=0){C(h+2);continue}}var m=e.match(Eo);if(m){C(m[0].length);continue}var y=e.match(No);if(y){var g=c;C(y[0].length),A(y[1],g,c);continue}var _=x();if(_){k(_),Ho(_.tagName,e)&&C(1);continue}}var b=void 0,$=void 0,w=void 0;if(d>=0){for($=e.slice(d);!(No.test($)||So.test($)||jo.test($)||Do.test($)||(w=$.indexOf("<",1))<0);)d+=w,$=e.slice(d);b=e.substring(0,d)}d<0&&(b=e),b&&C(b.length),t.chars&&b&&t.chars(b,c-b.length,c)}if(e===n){t.chars&&t.chars(e);break}}function C(t){c+=t,e=e.substring(t)}function x(){var t=e.match(So);if(t){var n,r,i={tagName:t[1],attrs:[],start:c};for(C(t[0].length);!(n=e.match(To))&&(r=e.match(ko)||e.match(xo));)r.start=c,C(r[0].length),r.end=c,i.attrs.push(r);if(n)return i.unarySlash=n[1],C(n[0].length),i.end=c,i}}function k(e){var n=e.tagName,c=e.unarySlash;o&&("p"===r&&Co(n)&&A(r),s(n)&&r===n&&A(n));for(var u=a(n)||!!c,l=e.attrs.length,f=new Array(l),p=0;p=0&&i[a].lowerCasedTag!==s;a--);else a=0;if(a>=0){for(var u=i.length-1;u>=a;u--)t.end&&t.end(i[u].tag,n,o);i.length=a,r=a&&i[a-1].tag}else"br"===s?t.start&&t.start(e,[],!0,n,o):"p"===s&&(t.start&&t.start(e,[],!1,n,o),t.end&&t.end(e,n,o))}A()}(e,{warn:Uo,expectHTML:t.expectHTML,isUnaryTag:t.isUnaryTag,canBeLeftOpenTag:t.canBeLeftOpenTag,shouldDecodeNewlines:t.shouldDecodeNewlines,shouldDecodeNewlinesForHref:t.shouldDecodeNewlinesForHref,shouldKeepComment:t.comments,outputSourceRange:t.outputSourceRange,start:function(e,o,a,l,f){var p=r&&r.ns||Zo(e);q&&"svg"===p&&(o=function(e){for(var t=[],n=0;nc&&(s.push(o=e.slice(c,i)),a.push(JSON.stringify(o)));var u=Or(r[1].trim());a.push("_s("+u+")"),s.push({"@binding":u}),c=i+r[0].length}return c-1"+("true"===o?":("+t+")":":_q("+t+","+o+")")),Mr(e,"change","var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+o+"):("+a+");if(Array.isArray($$a)){var $$v="+(r?"_n("+i+")":i)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+Ur(t,"$$a.concat([$$v])")+")}else{$$i>-1&&("+Ur(t,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+Ur(t,"$$c")+"}",null,!0)}(e,r,i);else if("input"===o&&"radio"===a)!function(e,t,n){var r=n&&n.number,i=Fr(e,"value")||"null";Er(e,"checked","_q("+t+","+(i=r?"_n("+i+")":i)+")"),Mr(e,"change",Ur(t,i),null,!0)}(e,r,i);else if("input"===o||"textarea"===o)!function(e,t,n){var r=e.attrsMap.type,i=n||{},o=i.lazy,a=i.number,s=i.trim,c=!o&&"range"!==r,u=o?"change":"range"===r?Zr:"input",l="$event.target.value";s&&(l="$event.target.value.trim()"),a&&(l="_n("+l+")");var f=Ur(t,l);c&&(f="if($event.target.composing)return;"+f),Er(e,"value","("+t+")"),Mr(e,u,f,null,!0),(s||a)&&Mr(e,"blur","$forceUpdate()")}(e,r,i);else if(!F.isReservedTag(o))return Br(e,r,i),!1;return!0},text:function(e,t){t.value&&Er(e,"textContent","_s("+t.value+")",t)},html:function(e,t){t.value&&Er(e,"innerHTML","_s("+t.value+")",t)}},isPreTag:function(e){return"pre"===e},isUnaryTag:$o,mustUseProp:Dn,canBeLeftOpenTag:wo,isReservedTag:Zn,getTagNamespace:Gn,staticKeys:function(e){return e.reduce(function(e,t){return e.concat(t.staticKeys||[])},[]).join(",")}($a)},ka=g(function(e){return p("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(e?","+e:""))});function Aa(e,t){e&&(wa=ka(t.staticKeys||""),Ca=t.isReservedTag||T,function e(t){t.static=function(e){if(2===e.type)return!1;if(3===e.type)return!0;return!(!e.pre&&(e.hasBindings||e.if||e.for||d(e.tag)||!Ca(e.tag)||function(e){for(;e.parent;){if("template"!==(e=e.parent).tag)return!1;if(e.for)return!0}return!1}(e)||!Object.keys(e).every(wa)))}(t);if(1===t.type){if(!Ca(t.tag)&&"slot"!==t.tag&&null==t.attrsMap["inline-template"])return;for(var n=0,r=t.children.length;n|^function(?:\s+[\w$]+)?\s*\(/,Sa=/\([^)]*?\);*$/,Ta=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,Na={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},Ea={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},ja=function(e){return"if("+e+")return null;"},Da={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:ja("$event.target !== $event.currentTarget"),ctrl:ja("!$event.ctrlKey"),shift:ja("!$event.shiftKey"),alt:ja("!$event.altKey"),meta:ja("!$event.metaKey"),left:ja("'button' in $event && $event.button !== 0"),middle:ja("'button' in $event && $event.button !== 1"),right:ja("'button' in $event && $event.button !== 2")};function La(e,t){var n=t?"nativeOn:":"on:",r="",i="";for(var o in e){var a=Ia(e[o]);e[o]&&e[o].dynamic?i+=o+","+a+",":r+='"'+o+'":'+a+","}return r="{"+r.slice(0,-1)+"}",i?n+"_d("+r+",["+i.slice(0,-1)+"])":n+r}function Ia(e){if(!e)return"function(){}";if(Array.isArray(e))return"["+e.map(function(e){return Ia(e)}).join(",")+"]";var t=Ta.test(e.value),n=Oa.test(e.value),r=Ta.test(e.value.replace(Sa,""));if(e.modifiers){var i="",o="",a=[];for(var s in e.modifiers)if(Da[s])o+=Da[s],Na[s]&&a.push(s);else if("exact"===s){var c=e.modifiers;o+=ja(["ctrl","shift","alt","meta"].filter(function(e){return!c[e]}).map(function(e){return"$event."+e+"Key"}).join("||"))}else a.push(s);return a.length&&(i+=function(e){return"if(!$event.type.indexOf('key')&&"+e.map(Ma).join("&&")+")return null;"}(a)),o&&(i+=o),"function($event){"+i+(t?"return "+e.value+".apply(null, arguments)":n?"return ("+e.value+").apply(null, arguments)":r?"return "+e.value:e.value)+"}"}return t||n?e.value:"function($event){"+(r?"return "+e.value:e.value)+"}"}function Ma(e){var t=parseInt(e,10);if(t)return"$event.keyCode!=="+t;var n=Na[e],r=Ea[e];return"_k($event.keyCode,"+JSON.stringify(e)+","+JSON.stringify(n)+",$event.key,"+JSON.stringify(r)+")"}var Fa={on:function(e,t){e.wrapListeners=function(e){return"_g("+e+","+t.value+")"}},bind:function(e,t){e.wrapData=function(n){return"_b("+n+",'"+e.tag+"',"+t.value+","+(t.modifiers&&t.modifiers.prop?"true":"false")+(t.modifiers&&t.modifiers.sync?",true":"")+")"}},cloak:S},Pa=function(e){this.options=e,this.warn=e.warn||Tr,this.transforms=Nr(e.modules,"transformCode"),this.dataGenFns=Nr(e.modules,"genData"),this.directives=A(A({},Fa),e.directives);var t=e.isReservedTag||T;this.maybeComponent=function(e){return!!e.component||!t(e.tag)},this.onceId=0,this.staticRenderFns=[],this.pre=!1};function Ra(e,t){var n=new Pa(t);return{render:"with(this){return "+(e?"script"===e.tag?"null":Ha(e,n):'_c("div")')+"}",staticRenderFns:n.staticRenderFns}}function Ha(e,t){if(e.parent&&(e.pre=e.pre||e.parent.pre),e.staticRoot&&!e.staticProcessed)return Ba(e,t);if(e.once&&!e.onceProcessed)return Ua(e,t);if(e.for&&!e.forProcessed)return za(e,t);if(e.if&&!e.ifProcessed)return Va(e,t);if("template"!==e.tag||e.slotTarget||t.pre){if("slot"===e.tag)return function(e,t){var n=e.slotName||'"default"',r=Wa(e,t),i="_t("+n+(r?",function(){return "+r+"}":""),o=e.attrs||e.dynamicAttrs?Xa((e.attrs||[]).concat(e.dynamicAttrs||[]).map(function(e){return{name:b(e.name),value:e.value,dynamic:e.dynamic}})):null,a=e.attrsMap["v-bind"];!o&&!a||r||(i+=",null");o&&(i+=","+o);a&&(i+=(o?"":",null")+","+a);return i+")"}(e,t);var n;if(e.component)n=function(e,t,n){var r=t.inlineTemplate?null:Wa(t,n,!0);return"_c("+e+","+Ka(t,n)+(r?","+r:"")+")"}(e.component,e,t);else{var r;(!e.plain||e.pre&&t.maybeComponent(e))&&(r=Ka(e,t));var i=e.inlineTemplate?null:Wa(e,t,!0);n="_c('"+e.tag+"'"+(r?","+r:"")+(i?","+i:"")+")"}for(var o=0;o>>0}(a):"")+")"}(e,e.scopedSlots,t)+","),e.model&&(n+="model:{value:"+e.model.value+",callback:"+e.model.callback+",expression:"+e.model.expression+"},"),e.inlineTemplate){var o=function(e,t){var n=e.children[0];if(n&&1===n.type){var r=Ra(n,t.options);return"inlineTemplate:{render:function(){"+r.render+"},staticRenderFns:["+r.staticRenderFns.map(function(e){return"function(){"+e+"}"}).join(",")+"]}"}}(e,t);o&&(n+=o+",")}return n=n.replace(/,$/,"")+"}",e.dynamicAttrs&&(n="_b("+n+',"'+e.tag+'",'+Xa(e.dynamicAttrs)+")"),e.wrapData&&(n=e.wrapData(n)),e.wrapListeners&&(n=e.wrapListeners(n)),n}function Ja(e){return 1===e.type&&("slot"===e.tag||e.children.some(Ja))}function qa(e,t){var n=e.attrsMap["slot-scope"];if(e.if&&!e.ifProcessed&&!n)return Va(e,t,qa,"null");if(e.for&&!e.forProcessed)return za(e,t,qa);var r=e.slotScope===ua?"":String(e.slotScope),i="function("+r+"){return "+("template"===e.tag?e.if&&n?"("+e.if+")?"+(Wa(e,t)||"undefined")+":undefined":Wa(e,t)||"undefined":Ha(e,t))+"}",o=r?"":",proxy:true";return"{key:"+(e.slotTarget||'"default"')+",fn:"+i+o+"}"}function Wa(e,t,n,r,i){var o=e.children;if(o.length){var a=o[0];if(1===o.length&&a.for&&"template"!==a.tag&&"slot"!==a.tag){var s=n?t.maybeComponent(a)?",1":",0":"";return""+(r||Ha)(a,t)+s}var c=n?function(e,t){for(var n=0,r=0;r':'
    ',ns.innerHTML.indexOf(" ")>0}var as=!!V&&os(!1),ss=!!V&&os(!0),cs=g(function(e){var t=Qn(e);return t&&t.innerHTML}),us=Cn.prototype.$mount;return Cn.prototype.$mount=function(e,t){if((e=e&&Qn(e))===document.body||e===document.documentElement)return this;var n=this.$options;if(!n.render){var r=n.template;if(r)if("string"==typeof r)"#"===r.charAt(0)&&(r=cs(r));else{if(!r.nodeType)return this;r=r.innerHTML}else e&&(r=function(e){if(e.outerHTML)return e.outerHTML;var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}(e));if(r){var i=is(r,{outputSourceRange:!1,shouldDecodeNewlines:as,shouldDecodeNewlinesForHref:ss,delimiters:n.delimiters,comments:n.comments},this),o=i.render,a=i.staticRenderFns;n.render=o,n.staticRenderFns=a}}return us.call(this,e,t)},Cn.compile=is,Cn}); \ No newline at end of file diff --git a/resources/web-remote/vuedraggable.umd.min.js b/resources/web-remote/vuedraggable.umd.min.js new file mode 100644 index 00000000..dee16afe --- /dev/null +++ b/resources/web-remote/vuedraggable.umd.min.js @@ -0,0 +1,2 @@ +(function(t,n){"object"===typeof exports&&"object"===typeof module?module.exports=n(require("sortablejs")):"function"===typeof define&&define.amd?define(["sortablejs"],n):"object"===typeof exports?exports["vuedraggable"]=n(require("sortablejs")):t["vuedraggable"]=n(t["Sortable"])})("undefined"!==typeof self?self:this,function(t){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s="fb15")}({"02f4":function(t,n,e){var r=e("4588"),o=e("be13");t.exports=function(t){return function(n,e){var i,u,c=String(o(n)),a=r(e),f=c.length;return a<0||a>=f?t?"":void 0:(i=c.charCodeAt(a),i<55296||i>56319||a+1===f||(u=c.charCodeAt(a+1))<56320||u>57343?t?c.charAt(a):i:t?c.slice(a,a+2):u-56320+(i-55296<<10)+65536)}}},"0390":function(t,n,e){"use strict";var r=e("02f4")(!0);t.exports=function(t,n,e){return n+(e?r(t,n).length:1)}},"07e3":function(t,n){var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},"0bfb":function(t,n,e){"use strict";var r=e("cb7c");t.exports=function(){var t=r(this),n="";return t.global&&(n+="g"),t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.unicode&&(n+="u"),t.sticky&&(n+="y"),n}},"0fc9":function(t,n,e){var r=e("3a38"),o=Math.max,i=Math.min;t.exports=function(t,n){return t=r(t),t<0?o(t+n,0):i(t,n)}},1654:function(t,n,e){"use strict";var r=e("71c1")(!0);e("30f1")(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,n=this._t,e=this._i;return e>=n.length?{value:void 0,done:!0}:(t=r(n,e),this._i+=t.length,{value:t,done:!1})})},1691:function(t,n){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},"1af6":function(t,n,e){var r=e("63b6");r(r.S,"Array",{isArray:e("9003")})},"1bc3":function(t,n,e){var r=e("f772");t.exports=function(t,n){if(!r(t))return t;var e,o;if(n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;if("function"==typeof(e=t.valueOf)&&!r(o=e.call(t)))return o;if(!n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},"1ec9":function(t,n,e){var r=e("f772"),o=e("e53d").document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},"20fd":function(t,n,e){"use strict";var r=e("d9f6"),o=e("aebd");t.exports=function(t,n,e){n in t?r.f(t,n,o(0,e)):t[n]=e}},"214f":function(t,n,e){"use strict";e("b0c5");var r=e("2aba"),o=e("32e9"),i=e("79e5"),u=e("be13"),c=e("2b4c"),a=e("520a"),f=c("species"),s=!i(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")}),l=function(){var t=/(?:)/,n=t.exec;t.exec=function(){return n.apply(this,arguments)};var e="ab".split(t);return 2===e.length&&"a"===e[0]&&"b"===e[1]}();t.exports=function(t,n,e){var p=c(t),d=!i(function(){var n={};return n[p]=function(){return 7},7!=""[t](n)}),v=d?!i(function(){var n=!1,e=/a/;return e.exec=function(){return n=!0,null},"split"===t&&(e.constructor={},e.constructor[f]=function(){return e}),e[p](""),!n}):void 0;if(!d||!v||"replace"===t&&!s||"split"===t&&!l){var h=/./[p],b=e(u,p,""[t],function(t,n,e,r,o){return n.exec===a?d&&!o?{done:!0,value:h.call(n,e,r)}:{done:!0,value:t.call(e,n,r)}:{done:!1}}),g=b[0],y=b[1];r(String.prototype,t,g),o(RegExp.prototype,p,2==n?function(t,n){return y.call(t,this,n)}:function(t){return y.call(t,this)})}}},"230e":function(t,n,e){var r=e("d3f4"),o=e("7726").document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},"23c6":function(t,n,e){var r=e("2d95"),o=e("2b4c")("toStringTag"),i="Arguments"==r(function(){return arguments}()),u=function(t,n){try{return t[n]}catch(e){}};t.exports=function(t){var n,e,c;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(e=u(n=Object(t),o))?e:i?r(n):"Object"==(c=r(n))&&"function"==typeof n.callee?"Arguments":c}},"241e":function(t,n,e){var r=e("25eb");t.exports=function(t){return Object(r(t))}},"25eb":function(t,n){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},"294c":function(t,n){t.exports=function(t){try{return!!t()}catch(n){return!0}}},"2aba":function(t,n,e){var r=e("7726"),o=e("32e9"),i=e("69a8"),u=e("ca5a")("src"),c=e("fa5b"),a="toString",f=(""+c).split(a);e("8378").inspectSource=function(t){return c.call(t)},(t.exports=function(t,n,e,c){var a="function"==typeof e;a&&(i(e,"name")||o(e,"name",n)),t[n]!==e&&(a&&(i(e,u)||o(e,u,t[n]?""+t[n]:f.join(String(n)))),t===r?t[n]=e:c?t[n]?t[n]=e:o(t,n,e):(delete t[n],o(t,n,e)))})(Function.prototype,a,function(){return"function"==typeof this&&this[u]||c.call(this)})},"2b4c":function(t,n,e){var r=e("5537")("wks"),o=e("ca5a"),i=e("7726").Symbol,u="function"==typeof i,c=t.exports=function(t){return r[t]||(r[t]=u&&i[t]||(u?i:o)("Symbol."+t))};c.store=r},"2d00":function(t,n){t.exports=!1},"2d95":function(t,n){var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},"2fdb":function(t,n,e){"use strict";var r=e("5ca1"),o=e("d2c8"),i="includes";r(r.P+r.F*e("5147")(i),"String",{includes:function(t){return!!~o(this,t,i).indexOf(t,arguments.length>1?arguments[1]:void 0)}})},"30f1":function(t,n,e){"use strict";var r=e("b8e3"),o=e("63b6"),i=e("9138"),u=e("35e8"),c=e("481b"),a=e("8f60"),f=e("45f2"),s=e("53e2"),l=e("5168")("iterator"),p=!([].keys&&"next"in[].keys()),d="@@iterator",v="keys",h="values",b=function(){return this};t.exports=function(t,n,e,g,y,x,m){a(e,n,g);var w,O,S,j=function(t){if(!p&&t in C)return C[t];switch(t){case v:return function(){return new e(this,t)};case h:return function(){return new e(this,t)}}return function(){return new e(this,t)}},_=n+" Iterator",M=y==h,T=!1,C=t.prototype,E=C[l]||C[d]||y&&C[y],A=E||j(y),P=y?M?j("entries"):A:void 0,I="Array"==n&&C.entries||E;if(I&&(S=s(I.call(new t)),S!==Object.prototype&&S.next&&(f(S,_,!0),r||"function"==typeof S[l]||u(S,l,b))),M&&E&&E.name!==h&&(T=!0,A=function(){return E.call(this)}),r&&!m||!p&&!T&&C[l]||u(C,l,A),c[n]=A,c[_]=b,y)if(w={values:M?A:j(h),keys:x?A:j(v),entries:P},m)for(O in w)O in C||i(C,O,w[O]);else o(o.P+o.F*(p||T),n,w);return w}},"32a6":function(t,n,e){var r=e("241e"),o=e("c3a1");e("ce7e")("keys",function(){return function(t){return o(r(t))}})},"32e9":function(t,n,e){var r=e("86cc"),o=e("4630");t.exports=e("9e1e")?function(t,n,e){return r.f(t,n,o(1,e))}:function(t,n,e){return t[n]=e,t}},"32fc":function(t,n,e){var r=e("e53d").document;t.exports=r&&r.documentElement},"335c":function(t,n,e){var r=e("6b4c");t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},"355d":function(t,n){n.f={}.propertyIsEnumerable},"35e8":function(t,n,e){var r=e("d9f6"),o=e("aebd");t.exports=e("8e60")?function(t,n,e){return r.f(t,n,o(1,e))}:function(t,n,e){return t[n]=e,t}},"36c3":function(t,n,e){var r=e("335c"),o=e("25eb");t.exports=function(t){return r(o(t))}},3702:function(t,n,e){var r=e("481b"),o=e("5168")("iterator"),i=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||i[o]===t)}},"3a38":function(t,n){var e=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:e)(t)}},"40c3":function(t,n,e){var r=e("6b4c"),o=e("5168")("toStringTag"),i="Arguments"==r(function(){return arguments}()),u=function(t,n){try{return t[n]}catch(e){}};t.exports=function(t){var n,e,c;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(e=u(n=Object(t),o))?e:i?r(n):"Object"==(c=r(n))&&"function"==typeof n.callee?"Arguments":c}},4588:function(t,n){var e=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:e)(t)}},"45f2":function(t,n,e){var r=e("d9f6").f,o=e("07e3"),i=e("5168")("toStringTag");t.exports=function(t,n,e){t&&!o(t=e?t:t.prototype,i)&&r(t,i,{configurable:!0,value:n})}},4630:function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},"469f":function(t,n,e){e("6c1c"),e("1654"),t.exports=e("7d7b")},"481b":function(t,n){t.exports={}},"4aa6":function(t,n,e){t.exports=e("dc62")},"4bf8":function(t,n,e){var r=e("be13");t.exports=function(t){return Object(r(t))}},"4ee1":function(t,n,e){var r=e("5168")("iterator"),o=!1;try{var i=[7][r]();i["return"]=function(){o=!0},Array.from(i,function(){throw 2})}catch(u){}t.exports=function(t,n){if(!n&&!o)return!1;var e=!1;try{var i=[7],c=i[r]();c.next=function(){return{done:e=!0}},i[r]=function(){return c},t(i)}catch(u){}return e}},"50ed":function(t,n){t.exports=function(t,n){return{value:n,done:!!t}}},5147:function(t,n,e){var r=e("2b4c")("match");t.exports=function(t){var n=/./;try{"/./"[t](n)}catch(e){try{return n[r]=!1,!"/./"[t](n)}catch(o){}}return!0}},5168:function(t,n,e){var r=e("dbdb")("wks"),o=e("62a0"),i=e("e53d").Symbol,u="function"==typeof i,c=t.exports=function(t){return r[t]||(r[t]=u&&i[t]||(u?i:o)("Symbol."+t))};c.store=r},5176:function(t,n,e){t.exports=e("51b6")},"51b6":function(t,n,e){e("a3c3"),t.exports=e("584a").Object.assign},"520a":function(t,n,e){"use strict";var r=e("0bfb"),o=RegExp.prototype.exec,i=String.prototype.replace,u=o,c="lastIndex",a=function(){var t=/a/,n=/b*/g;return o.call(t,"a"),o.call(n,"a"),0!==t[c]||0!==n[c]}(),f=void 0!==/()??/.exec("")[1],s=a||f;s&&(u=function(t){var n,e,u,s,l=this;return f&&(e=new RegExp("^"+l.source+"$(?!\\s)",r.call(l))),a&&(n=l[c]),u=o.call(l,t),a&&u&&(l[c]=l.global?u.index+u[0].length:n),f&&u&&u.length>1&&i.call(u[0],e,function(){for(s=1;s1?arguments[1]:void 0,b=void 0!==h,g=0,y=s(p);if(b&&(h=r(h,v>2?arguments[2]:void 0,2)),void 0==y||d==Array&&c(y))for(n=a(p.length),e=new d(n);n>g;g++)f(e,g,b?h(p[g],g):p[g]);else for(l=y.call(p),e=new d;!(o=l.next()).done;g++)f(e,g,b?u(l,h,[o.value,g],!0):o.value);return e.length=g,e}})},"54a1":function(t,n,e){e("6c1c"),e("1654"),t.exports=e("95d5")},5537:function(t,n,e){var r=e("8378"),o=e("7726"),i="__core-js_shared__",u=o[i]||(o[i]={});(t.exports=function(t,n){return u[t]||(u[t]=void 0!==n?n:{})})("versions",[]).push({version:r.version,mode:e("2d00")?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},5559:function(t,n,e){var r=e("dbdb")("keys"),o=e("62a0");t.exports=function(t){return r[t]||(r[t]=o(t))}},"584a":function(t,n){var e=t.exports={version:"2.6.5"};"number"==typeof __e&&(__e=e)},"5b4e":function(t,n,e){var r=e("36c3"),o=e("b447"),i=e("0fc9");t.exports=function(t){return function(n,e,u){var c,a=r(n),f=o(a.length),s=i(u,f);if(t&&e!=e){while(f>s)if(c=a[s++],c!=c)return!0}else for(;f>s;s++)if((t||s in a)&&a[s]===e)return t||s||0;return!t&&-1}}},"5ca1":function(t,n,e){var r=e("7726"),o=e("8378"),i=e("32e9"),u=e("2aba"),c=e("9b43"),a="prototype",f=function(t,n,e){var s,l,p,d,v=t&f.F,h=t&f.G,b=t&f.S,g=t&f.P,y=t&f.B,x=h?r:b?r[n]||(r[n]={}):(r[n]||{})[a],m=h?o:o[n]||(o[n]={}),w=m[a]||(m[a]={});for(s in h&&(e=n),e)l=!v&&x&&void 0!==x[s],p=(l?x:e)[s],d=y&&l?c(p,r):g&&"function"==typeof p?c(Function.call,p):p,x&&u(x,s,p,t&f.U),m[s]!=p&&i(m,s,d),g&&w[s]!=p&&(w[s]=p)};r.core=o,f.F=1,f.G=2,f.S=4,f.P=8,f.B=16,f.W=32,f.U=64,f.R=128,t.exports=f},"5d73":function(t,n,e){t.exports=e("469f")},"5f1b":function(t,n,e){"use strict";var r=e("23c6"),o=RegExp.prototype.exec;t.exports=function(t,n){var e=t.exec;if("function"===typeof e){var i=e.call(t,n);if("object"!==typeof i)throw new TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==r(t))throw new TypeError("RegExp#exec called on incompatible receiver");return o.call(t,n)}},"626a":function(t,n,e){var r=e("2d95");t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},"62a0":function(t,n){var e=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+r).toString(36))}},"63b6":function(t,n,e){var r=e("e53d"),o=e("584a"),i=e("d864"),u=e("35e8"),c=e("07e3"),a="prototype",f=function(t,n,e){var s,l,p,d=t&f.F,v=t&f.G,h=t&f.S,b=t&f.P,g=t&f.B,y=t&f.W,x=v?o:o[n]||(o[n]={}),m=x[a],w=v?r:h?r[n]:(r[n]||{})[a];for(s in v&&(e=n),e)l=!d&&w&&void 0!==w[s],l&&c(x,s)||(p=l?w[s]:e[s],x[s]=v&&"function"!=typeof w[s]?e[s]:g&&l?i(p,r):y&&w[s]==p?function(t){var n=function(n,e,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(n);case 2:return new t(n,e)}return new t(n,e,r)}return t.apply(this,arguments)};return n[a]=t[a],n}(p):b&&"function"==typeof p?i(Function.call,p):p,b&&((x.virtual||(x.virtual={}))[s]=p,t&f.R&&m&&!m[s]&&u(m,s,p)))};f.F=1,f.G=2,f.S=4,f.P=8,f.B=16,f.W=32,f.U=64,f.R=128,t.exports=f},6762:function(t,n,e){"use strict";var r=e("5ca1"),o=e("c366")(!0);r(r.P,"Array",{includes:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),e("9c6c")("includes")},6821:function(t,n,e){var r=e("626a"),o=e("be13");t.exports=function(t){return r(o(t))}},"69a8":function(t,n){var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},"6a99":function(t,n,e){var r=e("d3f4");t.exports=function(t,n){if(!r(t))return t;var e,o;if(n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;if("function"==typeof(e=t.valueOf)&&!r(o=e.call(t)))return o;if(!n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},"6b4c":function(t,n){var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},"6c1c":function(t,n,e){e("c367");for(var r=e("e53d"),o=e("35e8"),i=e("481b"),u=e("5168")("toStringTag"),c="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),a=0;a=f?t?"":void 0:(i=c.charCodeAt(a),i<55296||i>56319||a+1===f||(u=c.charCodeAt(a+1))<56320||u>57343?t?c.charAt(a):i:t?c.slice(a,a+2):u-56320+(i-55296<<10)+65536)}}},7726:function(t,n){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},"774e":function(t,n,e){t.exports=e("d2d5")},"77f1":function(t,n,e){var r=e("4588"),o=Math.max,i=Math.min;t.exports=function(t,n){return t=r(t),t<0?o(t+n,0):i(t,n)}},"794b":function(t,n,e){t.exports=!e("8e60")&&!e("294c")(function(){return 7!=Object.defineProperty(e("1ec9")("div"),"a",{get:function(){return 7}}).a})},"79aa":function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},"79e5":function(t,n){t.exports=function(t){try{return!!t()}catch(n){return!0}}},"7cd6":function(t,n,e){var r=e("40c3"),o=e("5168")("iterator"),i=e("481b");t.exports=e("584a").getIteratorMethod=function(t){if(void 0!=t)return t[o]||t["@@iterator"]||i[r(t)]}},"7d7b":function(t,n,e){var r=e("e4ae"),o=e("7cd6");t.exports=e("584a").getIterator=function(t){var n=o(t);if("function"!=typeof n)throw TypeError(t+" is not iterable!");return r(n.call(t))}},"7e90":function(t,n,e){var r=e("d9f6"),o=e("e4ae"),i=e("c3a1");t.exports=e("8e60")?Object.defineProperties:function(t,n){o(t);var e,u=i(n),c=u.length,a=0;while(c>a)r.f(t,e=u[a++],n[e]);return t}},8378:function(t,n){var e=t.exports={version:"2.6.5"};"number"==typeof __e&&(__e=e)},8436:function(t,n){t.exports=function(){}},"86cc":function(t,n,e){var r=e("cb7c"),o=e("c69a"),i=e("6a99"),u=Object.defineProperty;n.f=e("9e1e")?Object.defineProperty:function(t,n,e){if(r(t),n=i(n,!0),r(e),o)try{return u(t,n,e)}catch(c){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(t[n]=e.value),t}},"8aae":function(t,n,e){e("32a6"),t.exports=e("584a").Object.keys},"8e60":function(t,n,e){t.exports=!e("294c")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},"8f60":function(t,n,e){"use strict";var r=e("a159"),o=e("aebd"),i=e("45f2"),u={};e("35e8")(u,e("5168")("iterator"),function(){return this}),t.exports=function(t,n,e){t.prototype=r(u,{next:o(1,e)}),i(t,n+" Iterator")}},9003:function(t,n,e){var r=e("6b4c");t.exports=Array.isArray||function(t){return"Array"==r(t)}},9138:function(t,n,e){t.exports=e("35e8")},9306:function(t,n,e){"use strict";var r=e("c3a1"),o=e("9aa9"),i=e("355d"),u=e("241e"),c=e("335c"),a=Object.assign;t.exports=!a||e("294c")(function(){var t={},n={},e=Symbol(),r="abcdefghijklmnopqrst";return t[e]=7,r.split("").forEach(function(t){n[t]=t}),7!=a({},t)[e]||Object.keys(a({},n)).join("")!=r})?function(t,n){var e=u(t),a=arguments.length,f=1,s=o.f,l=i.f;while(a>f){var p,d=c(arguments[f++]),v=s?r(d).concat(s(d)):r(d),h=v.length,b=0;while(h>b)l.call(d,p=v[b++])&&(e[p]=d[p])}return e}:a},9427:function(t,n,e){var r=e("63b6");r(r.S,"Object",{create:e("a159")})},"95d5":function(t,n,e){var r=e("40c3"),o=e("5168")("iterator"),i=e("481b");t.exports=e("584a").isIterable=function(t){var n=Object(t);return void 0!==n[o]||"@@iterator"in n||i.hasOwnProperty(r(n))}},"9aa9":function(t,n){n.f=Object.getOwnPropertySymbols},"9b43":function(t,n,e){var r=e("d8e8");t.exports=function(t,n,e){if(r(t),void 0===n)return t;switch(e){case 1:return function(e){return t.call(n,e)};case 2:return function(e,r){return t.call(n,e,r)};case 3:return function(e,r,o){return t.call(n,e,r,o)}}return function(){return t.apply(n,arguments)}}},"9c6c":function(t,n,e){var r=e("2b4c")("unscopables"),o=Array.prototype;void 0==o[r]&&e("32e9")(o,r,{}),t.exports=function(t){o[r][t]=!0}},"9def":function(t,n,e){var r=e("4588"),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},"9e1e":function(t,n,e){t.exports=!e("79e5")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},a159:function(t,n,e){var r=e("e4ae"),o=e("7e90"),i=e("1691"),u=e("5559")("IE_PROTO"),c=function(){},a="prototype",f=function(){var t,n=e("1ec9")("iframe"),r=i.length,o="<",u=">";n.style.display="none",e("32fc").appendChild(n),n.src="javascript:",t=n.contentWindow.document,t.open(),t.write(o+"script"+u+"document.F=Object"+o+"/script"+u),t.close(),f=t.F;while(r--)delete f[a][i[r]];return f()};t.exports=Object.create||function(t,n){var e;return null!==t?(c[a]=r(t),e=new c,c[a]=null,e[u]=t):e=f(),void 0===n?e:o(e,n)}},a352:function(n,e){n.exports=t},a3c3:function(t,n,e){var r=e("63b6");r(r.S+r.F,"Object",{assign:e("9306")})},a481:function(t,n,e){"use strict";var r=e("cb7c"),o=e("4bf8"),i=e("9def"),u=e("4588"),c=e("0390"),a=e("5f1b"),f=Math.max,s=Math.min,l=Math.floor,p=/\$([$&`']|\d\d?|<[^>]*>)/g,d=/\$([$&`']|\d\d?)/g,v=function(t){return void 0===t?t:String(t)};e("214f")("replace",2,function(t,n,e,h){return[function(r,o){var i=t(this),u=void 0==r?void 0:r[n];return void 0!==u?u.call(r,i,o):e.call(String(i),r,o)},function(t,n){var o=h(e,t,this,n);if(o.done)return o.value;var l=r(t),p=String(this),d="function"===typeof n;d||(n=String(n));var g=l.global;if(g){var y=l.unicode;l.lastIndex=0}var x=[];while(1){var m=a(l,p);if(null===m)break;if(x.push(m),!g)break;var w=String(m[0]);""===w&&(l.lastIndex=c(p,i(l.lastIndex),y))}for(var O="",S=0,j=0;j=S&&(O+=p.slice(S,M)+P,S=M+_.length)}return O+p.slice(S)}];function b(t,n,r,i,u,c){var a=r+t.length,f=i.length,s=d;return void 0!==u&&(u=o(u),s=p),e.call(c,s,function(e,o){var c;switch(o.charAt(0)){case"$":return"$";case"&":return t;case"`":return n.slice(0,r);case"'":return n.slice(a);case"<":c=u[o.slice(1,-1)];break;default:var s=+o;if(0===s)return e;if(s>f){var p=l(s/10);return 0===p?e:p<=f?void 0===i[p-1]?o.charAt(1):i[p-1]+o.charAt(1):e}c=i[s-1]}return void 0===c?"":c})}})},a4bb:function(t,n,e){t.exports=e("8aae")},a745:function(t,n,e){t.exports=e("f410")},aae3:function(t,n,e){var r=e("d3f4"),o=e("2d95"),i=e("2b4c")("match");t.exports=function(t){var n;return r(t)&&(void 0!==(n=t[i])?!!n:"RegExp"==o(t))}},aebd:function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},b0c5:function(t,n,e){"use strict";var r=e("520a");e("5ca1")({target:"RegExp",proto:!0,forced:r!==/./.exec},{exec:r})},b0dc:function(t,n,e){var r=e("e4ae");t.exports=function(t,n,e,o){try{return o?n(r(e)[0],e[1]):n(e)}catch(u){var i=t["return"];throw void 0!==i&&r(i.call(t)),u}}},b447:function(t,n,e){var r=e("3a38"),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},b8e3:function(t,n){t.exports=!0},be13:function(t,n){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},c366:function(t,n,e){var r=e("6821"),o=e("9def"),i=e("77f1");t.exports=function(t){return function(n,e,u){var c,a=r(n),f=o(a.length),s=i(u,f);if(t&&e!=e){while(f>s)if(c=a[s++],c!=c)return!0}else for(;f>s;s++)if((t||s in a)&&a[s]===e)return t||s||0;return!t&&-1}}},c367:function(t,n,e){"use strict";var r=e("8436"),o=e("50ed"),i=e("481b"),u=e("36c3");t.exports=e("30f1")(Array,"Array",function(t,n){this._t=u(t),this._i=0,this._k=n},function(){var t=this._t,n=this._k,e=this._i++;return!t||e>=t.length?(this._t=void 0,o(1)):o(0,"keys"==n?e:"values"==n?t[e]:[e,t[e]])},"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},c3a1:function(t,n,e){var r=e("e6f3"),o=e("1691");t.exports=Object.keys||function(t){return r(t,o)}},c649:function(t,n,e){"use strict";(function(t){e.d(n,"c",function(){return l}),e.d(n,"a",function(){return f}),e.d(n,"b",function(){return u}),e.d(n,"d",function(){return s});e("a481");var r=e("4aa6"),o=e.n(r);function i(){return"undefined"!==typeof window?window.console:t.console}var u=i();function c(t){var n=o()(null);return function(e){var r=n[e];return r||(n[e]=t(e))}}var a=/-(\w)/g,f=c(function(t){return t.replace(a,function(t,n){return n?n.toUpperCase():""})});function s(t){null!==t.parentElement&&t.parentElement.removeChild(t)}function l(t,n,e){var r=0===e?t.children[0]:t.children[e-1].nextSibling;t.insertBefore(n,r)}}).call(this,e("c8ba"))},c69a:function(t,n,e){t.exports=!e("9e1e")&&!e("79e5")(function(){return 7!=Object.defineProperty(e("230e")("div"),"a",{get:function(){return 7}}).a})},c8ba:function(t,n){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(r){"object"===typeof window&&(e=window)}t.exports=e},c8bb:function(t,n,e){t.exports=e("54a1")},ca5a:function(t,n){var e=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+r).toString(36))}},cb7c:function(t,n,e){var r=e("d3f4");t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},ce7e:function(t,n,e){var r=e("63b6"),o=e("584a"),i=e("294c");t.exports=function(t,n){var e=(o.Object||{})[t]||Object[t],u={};u[t]=n(e),r(r.S+r.F*i(function(){e(1)}),"Object",u)}},d2c8:function(t,n,e){var r=e("aae3"),o=e("be13");t.exports=function(t,n,e){if(r(n))throw TypeError("String#"+e+" doesn't accept regex!");return String(o(t))}},d2d5:function(t,n,e){e("1654"),e("549b"),t.exports=e("584a").Array.from},d3f4:function(t,n){t.exports=function(t){return"object"===typeof t?null!==t:"function"===typeof t}},d864:function(t,n,e){var r=e("79aa");t.exports=function(t,n,e){if(r(t),void 0===n)return t;switch(e){case 1:return function(e){return t.call(n,e)};case 2:return function(e,r){return t.call(n,e,r)};case 3:return function(e,r,o){return t.call(n,e,r,o)}}return function(){return t.apply(n,arguments)}}},d8e8:function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},d9f6:function(t,n,e){var r=e("e4ae"),o=e("794b"),i=e("1bc3"),u=Object.defineProperty;n.f=e("8e60")?Object.defineProperty:function(t,n,e){if(r(t),n=i(n,!0),r(e),o)try{return u(t,n,e)}catch(c){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(t[n]=e.value),t}},dbdb:function(t,n,e){var r=e("584a"),o=e("e53d"),i="__core-js_shared__",u=o[i]||(o[i]={});(t.exports=function(t,n){return u[t]||(u[t]=void 0!==n?n:{})})("versions",[]).push({version:r.version,mode:e("b8e3")?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},dc62:function(t,n,e){e("9427");var r=e("584a").Object;t.exports=function(t,n){return r.create(t,n)}},e4ae:function(t,n,e){var r=e("f772");t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},e53d:function(t,n){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},e6f3:function(t,n,e){var r=e("07e3"),o=e("36c3"),i=e("5b4e")(!1),u=e("5559")("IE_PROTO");t.exports=function(t,n){var e,c=o(t),a=0,f=[];for(e in c)e!=u&&r(c,e)&&f.push(e);while(n.length>a)r(c,e=n[a++])&&(~i(f,e)||f.push(e));return f}},f410:function(t,n,e){e("1af6"),t.exports=e("584a").Array.isArray},f559:function(t,n,e){"use strict";var r=e("5ca1"),o=e("9def"),i=e("d2c8"),u="startsWith",c=""[u];r(r.P+r.F*e("5147")(u),"String",{startsWith:function(t){var n=i(this,t,u),e=o(Math.min(arguments.length>1?arguments[1]:void 0,n.length)),r=String(t);return c?c.call(n,r,e):n.slice(e,e+r.length)===r}})},f772:function(t,n){t.exports=function(t){return"object"===typeof t?null!==t:"function"===typeof t}},fa5b:function(t,n,e){t.exports=e("5537")("native-function-to-string",Function.toString)},fb15:function(t,n,e){"use strict";var r;(e.r(n),"undefined"!==typeof window)&&((r=window.document.currentScript)&&(r=r.src.match(/(.+\/)[^\/]+\.js(\?.*)?$/))&&(e.p=r[1]));var o=e("5176"),i=e.n(o),u=(e("f559"),e("a4bb")),c=e.n(u),a=(e("6762"),e("2fdb"),e("a745")),f=e.n(a);function s(t){if(f()(t))return t}var l=e("5d73"),p=e.n(l);function d(t,n){var e=[],r=!0,o=!1,i=void 0;try{for(var u,c=p()(t);!(r=(u=c.next()).done);r=!0)if(e.push(u.value),n&&e.length===n)break}catch(a){o=!0,i=a}finally{try{r||null==c["return"]||c["return"]()}finally{if(o)throw i}}return e}function v(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function h(t,n){return s(t)||d(t,n)||v()}function b(t){if(f()(t)){for(var n=0,e=new Array(t.length);n=i?o.length:o.indexOf(t)});return e?u.filter(function(t){return-1!==t}):u}function A(t,n){var e=this;this.$nextTick(function(){return e.$emit(t.toLowerCase(),n)})}function P(t){var n=this;return function(e){null!==n.realList&&n["onDrag"+t](e),A.call(n,t,e)}}function I(t){if(!t||1!==t.length)return!1;var n=h(t,1),e=n[0].componentOptions;return!!e&&["transition-group","TransitionGroup"].includes(e.tag)}function L(t,n){var e=n.header,r=n.footer,o=0,i=0;return e&&(o=e.length,t=t?[].concat(S(e),S(t)):S(e)),r&&(i=r.length,t=t?[].concat(S(t),S(r)):S(r)),{children:t,headerOffset:o,footerOffset:i}}function F(t,n){var e=null,r=function(t,n){e=T(e,t,n)},o=c()(t).filter(function(t){return"id"===t||t.startsWith("data-")}).reduce(function(n,e){return n[e]=t[e],n},{});if(r("attrs",o),!n)return e;var u=n.on,a=n.props,f=n.attrs;return r("on",u),r("props",a),i()(e.attrs,f),e}var $=["Start","Add","Remove","Update","End"],k=["Choose","Sort","Filter","Clone"],D=["Move"].concat($,k).map(function(t){return"on"+t}),R=null,V={options:Object,list:{type:Array,required:!1,default:null},value:{type:Array,required:!1,default:null},noTransitionOnDrag:{type:Boolean,default:!1},clone:{type:Function,default:function(t){return t}},element:{type:String,default:"div"},tag:{type:String,default:null},move:{type:Function,default:null},componentData:{type:Object,required:!1,default:null}},N={name:"draggable",inheritAttrs:!1,props:V,data:function(){return{transitionMode:!1,noneFunctionalComponentMode:!1,init:!1}},render:function(t){var n=this.$slots.default;this.transitionMode=I(n);var e=L(n,this.$slots),r=e.children,o=e.headerOffset,i=e.footerOffset;this.headerOffset=o,this.footerOffset=i;var u=F(this.$attrs,this.componentData);return t(this.getTag(),u,r)},created:function(){null!==this.list&&null!==this.value&&M["b"].error("Value and list props are mutually exclusive! Please set one or another."),"div"!==this.element&&M["b"].warn("Element props is deprecated please use tag props instead. See https://github.com/SortableJS/Vue.Draggable/blob/master/documentation/migrate.md#element-props"),void 0!==this.options&&M["b"].warn("Options props is deprecated, add sortable options directly as vue.draggable item, or use v-bind. See https://github.com/SortableJS/Vue.Draggable/blob/master/documentation/migrate.md#options-props")},mounted:function(){var t=this;if(this.noneFunctionalComponentMode=this.getTag().toLowerCase()!==this.$el.nodeName.toLowerCase(),this.noneFunctionalComponentMode&&this.transitionMode)throw new Error("Transition-group inside component is not supported. Please alter tag value or remove transition-group. Current tag value: ".concat(this.getTag()));var n={};$.forEach(function(e){n["on"+e]=P.call(t,e)}),k.forEach(function(e){n["on"+e]=A.bind(t,e)});var e=c()(this.$attrs).reduce(function(n,e){return n[Object(M["a"])(e)]=t.$attrs[e],n},{}),r=i()({},this.options,e,n,{onMove:function(n,e){return t.onDragMove(n,e)}});!("draggable"in r)&&(r.draggable=">*"),this._sortable=new _.a(this.rootContainer,r),this.computeIndexes()},beforeDestroy:function(){void 0!==this._sortable&&this._sortable.destroy()},computed:{rootContainer:function(){return this.transitionMode?this.$el.children[0]:this.$el},realList:function(){return this.list?this.list:this.value}},watch:{options:{handler:function(t){this.updateOptions(t)},deep:!0},$attrs:{handler:function(t){this.updateOptions(t)},deep:!0},realList:function(){this.computeIndexes()}},methods:{getTag:function(){return this.tag||this.element},updateOptions:function(t){for(var n in t){var e=Object(M["a"])(n);-1===D.indexOf(e)&&this._sortable.option(e,t[n])}},getChildrenNodes:function(){if(this.init||(this.noneFunctionalComponentMode=this.noneFunctionalComponentMode&&1===this.$children.length,this.init=!0),this.noneFunctionalComponentMode)return this.$children[0].$slots.default;var t=this.$slots.default;return this.transitionMode?t[0].child.$slots.default:t},computeIndexes:function(){var t=this;this.$nextTick(function(){t.visibleIndexes=E(t.getChildrenNodes(),t.rootContainer.children,t.transitionMode,t.footerOffset)})},getUnderlyingVm:function(t){var n=C(this.getChildrenNodes()||[],t);if(-1===n)return null;var e=this.realList[n];return{index:n,element:e}},getUnderlyingPotencialDraggableComponent:function(t){var n=t.__vue__;return n&&n.$options&&"transition-group"===n.$options._componentTag?n.$parent:n},emitChanges:function(t){var n=this;this.$nextTick(function(){n.$emit("change",t)})},alterList:function(t){if(this.list)t(this.list);else{var n=S(this.value);t(n),this.$emit("input",n)}},spliceList:function(){var t=arguments,n=function(n){return n.splice.apply(n,S(t))};this.alterList(n)},updatePosition:function(t,n){var e=function(e){return e.splice(n,0,e.splice(t,1)[0])};this.alterList(e)},getRelatedContextFromMoveEvent:function(t){var n=t.to,e=t.related,r=this.getUnderlyingPotencialDraggableComponent(n);if(!r)return{component:r};var o=r.realList,u={list:o,component:r};if(n!==e&&o&&r.getUnderlyingVm){var c=r.getUnderlyingVm(e);if(c)return i()(c,u)}return u},getVmIndex:function(t){var n=this.visibleIndexes,e=n.length;return t>e-1?e:n[t]},getComponent:function(){return this.$slots.default[0].componentInstance},resetTransitionData:function(t){if(this.noTransitionOnDrag&&this.transitionMode){var n=this.getChildrenNodes();n[t].data=null;var e=this.getComponent();e.children=[],e.kept=void 0}},onDragStart:function(t){this.context=this.getUnderlyingVm(t.item),t.item._underlying_vm_=this.clone(this.context.element),R=t.item},onDragAdd:function(t){var n=t.item._underlying_vm_;if(void 0!==n){Object(M["d"])(t.item);var e=this.getVmIndex(t.newIndex);this.spliceList(e,0,n),this.computeIndexes();var r={element:n,newIndex:e};this.emitChanges({added:r})}},onDragRemove:function(t){if(Object(M["c"])(this.rootContainer,t.item,t.oldIndex),"clone"!==t.pullMode){var n=this.context.index;this.spliceList(n,1);var e={element:this.context.element,oldIndex:n};this.resetTransitionData(n),this.emitChanges({removed:e})}else Object(M["d"])(t.clone)},onDragUpdate:function(t){Object(M["d"])(t.item),Object(M["c"])(t.from,t.item,t.oldIndex);var n=this.context.index,e=this.getVmIndex(t.newIndex);this.updatePosition(n,e);var r={element:this.context.element,oldIndex:n,newIndex:e};this.emitChanges({moved:r})},updateProperty:function(t,n){t.hasOwnProperty(n)&&(t[n]+=this.headerOffset)},computeFutureIndex:function(t,n){if(!t.element)return 0;var e=S(n.to.children).filter(function(t){return"none"!==t.style["display"]}),r=e.indexOf(n.related),o=t.component.getVmIndex(r),i=-1!==e.indexOf(R);return i||!n.willInsertAfter?o:o+1},onDragMove:function(t,n){var e=this.move;if(!e||!this.realList)return!0;var r=this.getRelatedContextFromMoveEvent(t),o=this.context,u=this.computeFutureIndex(r,t);i()(o,{futureIndex:u});var c=i()({},t,{relatedContext:r,draggedContext:o});return e(c,n)},onDragEnd:function(){this.computeIndexes(),R=null}}};"undefined"!==typeof window&&"Vue"in window&&window.Vue.component("draggable",N);var U=N;n["default"]=U}})["default"]}); +//# sourceMappingURL=vuedraggable.umd.min.js.map \ No newline at end of file