// ==UserScript==
// @name yt-playlists-delete-enhancer
// @description Add a button to remove videos watched with more than X percent from watch later playlist.
// @version 1.7.2
// @author Andrew Valleteau <avallete@student.42.fr>
// @grant none
// @match *://youtube.com/*
// @match *://www.youtube.com/*
// @namespace greasyfork-namespace-url
// @noframes
// @homepageURL https://github.com/avallete/yt-playlists-delete-enhancer#readme
// @supportURL https://github.com/avallete/yt-playlists-delete-enhancer/issues
// @run-at document-idle
// @license MIT
// ==/UserScript==
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 28);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Component", function() { return b; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Fragment", function() { return g; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cloneElement", function() { return E; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createContext", function() { return F; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createElement", function() { return y; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createRef", function() { return _; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return y; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hydrate", function() { return B; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValidElement", function() { return t; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "options", function() { return l; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return q; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toChildArray", function() { return $; });
var n,l,u,t,i,o,r,f,e,c={},s=[],a=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,h=Array.isArray;function v(n,l){for(var u in l)n[u]=l[u];return n}function p(n){var l=n.parentNode;l&&l.removeChild(n)}function y(l,u,t){var i,o,r,f={};for(r in u)"key"==r?i=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return d(l,f,i,o,null)}function d(n,t,i,o,r){var f={type:n,props:t,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++u:r,__i:-1,__u:0};return null==r&&null!=l.vnode&&l.vnode(f),f}function _(){return{current:null}}function g(n){return n.children}function b(n,l){this.props=n,this.context=l}function m(n,l){if(null==l)return n.__?m(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return"function"==typeof n.type?m(n):null}function w(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return w(n)}}function k(n){(!n.__d&&(n.__d=!0)&&i.push(n)&&!x.__r++||o!==l.debounceRendering)&&((o=l.debounceRendering)||r)(x)}function x(){var n,u,t,o,r,e,c,s,a;for(i.sort(f);n=i.shift();)n.__d&&(u=i.length,o=void 0,e=(r=(t=n).__v).__e,s=[],a=[],(c=t.__P)&&((o=v({},r)).__v=r.__v+1,l.vnode&&l.vnode(o),L(c,o,r,t.__n,void 0!==c.ownerSVGElement,32&r.__u?[e]:null,s,null==e?m(r):e,!!(32&r.__u),a),o.__v=r.__v,o.__.__k[o.__i]=o,M(s,o,a),o.__e!=e&&w(o)),i.length>u&&i.sort(f));x.__r=0}function C(n,l,u,t,i,o,r,f,e,a,h){var v,p,y,d,_,g=t&&t.__k||s,b=l.length;for(u.__d=e,P(u,l,g),e=u.__d,v=0;v<b;v++)null!=(y=u.__k[v])&&"boolean"!=typeof y&&"function"!=typeof y&&(p=-1===y.__i?c:g[y.__i]||c,y.__i=v,L(n,y,p,i,o,r,f,e,a,h),d=y.__e,y.ref&&p.ref!=y.ref&&(p.ref&&z(p.ref,null,y),h.push(y.ref,y.__c||d,y)),null==_&&null!=d&&(_=d),65536&y.__u||p.__k===y.__k?(d||p.__e!=e||(e=m(p)),e=S(y,e,n)):"function"==typeof y.type&&void 0!==y.__d?e=y.__d:d&&(e=d.nextSibling),y.__d=void 0,y.__u&=-196609);u.__d=e,u.__e=_}function P(n,l,u){var t,i,o,r,f,e=l.length,c=u.length,s=c,a=0;for(n.__k=[],t=0;t<e;t++)r=t+a,null!=(i=n.__k[t]=null==(i=l[t])||"boolean"==typeof i||"function"==typeof i?null:"string"==typeof i||"number"==typeof i||"bigint"==typeof i||i.constructor==String?d(null,i,null,null,null):h(i)?d(g,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?d(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=n,i.__b=n.__b+1,f=H(i,u,r,s),i.__i=f,o=null,-1!==f&&(s--,(o=u[f])&&(o.__u|=131072)),null==o||null===o.__v?(-1==f&&a--,"function"!=typeof i.type&&(i.__u|=65536)):f!==r&&(f===r+1?a++:f>r?s>e-r?a+=f-r:a--:f<r?f==r-1&&(a=f-r):a=0,f!==t+a&&(i.__u|=65536))):(o=u[r])&&null==o.key&&o.__e&&0==(131072&o.__u)&&(o.__e==n.__d&&(n.__d=m(o)),N(o,o,!1),u[r]=null,s--);if(s)for(t=0;t<c;t++)null!=(o=u[t])&&0==(131072&o.__u)&&(o.__e==n.__d&&(n.__d=m(o)),N(o,o))}function S(n,l,u){var t,i;if("function"==typeof n.type){for(t=n.__k,i=0;t&&i<t.length;i++)t[i]&&(t[i].__=n,l=S(t[i],l,u));return l}n.__e!=l&&(u.insertBefore(n.__e,l||null),l=n.__e);do{l=l&&l.nextSibling}while(null!=l&&8===l.nodeType);return l}function $(n,l){return l=l||[],null==n||"boolean"==typeof n||(h(n)?n.some(function(n){$(n,l)}):l.push(n)),l}function H(n,l,u,t){var i=n.key,o=n.type,r=u-1,f=u+1,e=l[u];if(null===e||e&&i==e.key&&o===e.type&&0==(131072&e.__u))return u;if(t>(null!=e&&0==(131072&e.__u)?1:0))for(;r>=0||f<l.length;){if(r>=0){if((e=l[r])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return r;r--}if(f<l.length){if((e=l[f])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return f;f++}}return-1}function I(n,l,u){"-"===l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||a.test(l)?u:u+"px"}function T(n,l,u,t,i){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else{if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||I(n.style,l,"");if(u)for(l in u)t&&u[l]===t[l]||I(n.style,l,u[l])}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/(PointerCapture)$|Capture$/i,"$1")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?t?u.u=t.u:(u.u=Date.now(),n.addEventListener(l,o?D:A,o)):n.removeEventListener(l,o?D:A,o);else{if(i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==l&&"height"!==l&&"href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&"rowSpan"!==l&&"colSpan"!==l&&"role"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&"-"!==l[4]?n.removeAttribute(l):n.setAttribute(l,u))}}function A(n){if(this.l){var u=this.l[n.type+!1];if(n.t){if(n.t<=u.u)return}else n.t=Date.now();return u(l.event?l.event(n):n)}}function D(n){if(this.l)return this.l[n.type+!0](l.event?l.event(n):n)}function L(n,u,t,i,o,r,f,e,c,s){var a,p,y,d,_,m,w,k,x,P,S,$,H,I,T,A=u.type;if(void 0!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),r=[e=u.__e=t.__e]),(a=l.__b)&&a(u);n:if("function"==typeof A)try{if(k=u.props,x=(a=A.contextType)&&i[a.__c],P=a?x?x.props.value:a.__:i,t.__c?w=(p=u.__c=t.__c).__=p.__E:("prototype"in A&&A.prototype.render?u.__c=p=new A(k,P):(u.__c=p=new b(k,P),p.constructor=A,p.render=O),x&&x.sub(p),p.props=k,p.state||(p.state={}),p.context=P,p.__n=i,y=p.__d=!0,p.__h=[],p._sb=[]),null==p.__s&&(p.__s=p.state),null!=A.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=v({},p.__s)),v(p.__s,A.getDerivedStateFromProps(k,p.__s))),d=p.props,_=p.state,p.__v=u,y)null==A.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(null==A.getDerivedStateFromProps&&k!==d&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(k,P),!p.__e&&(null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(k,p.__s,P)||u.__v===t.__v)){for(u.__v!==t.__v&&(p.props=k,p.state=p.__s,p.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.forEach(function(n){n&&(n.__=u)}),S=0;S<p._sb.length;S++)p.__h.push(p._sb[S]);p._sb=[],p.__h.length&&f.push(p);break n}null!=p.componentWillUpdate&&p.componentWillUpdate(k,p.__s,P),null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(d,_,m)})}if(p.context=P,p.props=k,p.__P=n,p.__e=!1,$=l.__r,H=0,"prototype"in A&&A.prototype.render){for(p.state=p.__s,p.__d=!1,$&&$(u),a=p.render(p.props,p.state,p.context),I=0;I<p._sb.length;I++)p.__h.push(p._sb[I]);p._sb=[]}else do{p.__d=!1,$&&$(u),a=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++H<25);p.state=p.__s,null!=p.getChildContext&&(i=v(v({},i),p.getChildContext())),y||null==p.getSnapshotBeforeUpdate||(m=p.getSnapshotBeforeUpdate(d,_)),C(n,h(T=null!=a&&a.type===g&&null==a.key?a.props.children:a)?T:[T],u,t,i,o,r,f,e,c,s),p.base=u.__e,u.__u&=-161,p.__h.length&&f.push(p),w&&(p.__E=p.__=null)}catch(n){u.__v=null,c||null!=r?(u.__e=e,u.__u|=c?160:32,r[r.indexOf(e)]=null):(u.__e=t.__e,u.__k=t.__k),l.__e(n,u,t)}else null==r&&u.__v===t.__v?(u.__k=t.__k,u.__e=t.__e):u.__e=j(t.__e,u,t,i,o,r,f,c,s);(a=l.diffed)&&a(u)}function M(n,u,t){u.__d=void 0;for(var i=0;i<t.length;i++)z(t[i],t[++i],t[++i]);l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u)})}catch(n){l.__e(n,u.__v)}})}function j(l,u,t,i,o,r,f,e,s){var a,v,y,d,_,g,b,w=t.props,k=u.props,x=u.type;if("svg"===x&&(o=!0),null!=r)for(a=0;a<r.length;a++)if((_=r[a])&&"setAttribute"in _==!!x&&(x?_.localName===x:3===_.nodeType)){l=_,r[a]=null;break}if(null==l){if(null===x)return document.createTextNode(k);l=o?document.createElementNS("http://www.w3.org/2000/svg",x):document.createElement(x,k.is&&k),r=null,e=!1}if(null===x)w===k||e&&l.data===k||(l.data=k);else{if(r=r&&n.call(l.childNodes),w=t.props||c,!e&&null!=r)for(w={},a=0;a<l.attributes.length;a++)w[(_=l.attributes[a]).name]=_.value;for(a in w)_=w[a],"children"==a||("dangerouslySetInnerHTML"==a?y=_:"key"===a||a in k||T(l,a,null,_,o));for(a in k)_=k[a],"children"==a?d=_:"dangerouslySetInnerHTML"==a?v=_:"value"==a?g=_:"checked"==a?b=_:"key"===a||e&&"function"!=typeof _||w[a]===_||T(l,a,_,w[a],o);if(v)e||y&&(v.__html===y.__html||v.__html===l.innerHTML)||(l.innerHTML=v.__html),u.__k=[];else if(y&&(l.innerHTML=""),C(l,h(d)?d:[d],u,t,i,o&&"foreignObject"!==x,r,f,r?r[0]:t.__k&&m(t,0),e,s),null!=r)for(a=r.length;a--;)null!=r[a]&&p(r[a]);e||(a="value",void 0!==g&&(g!==l[a]||"progress"===x&&!g||"option"===x&&g!==w[a])&&T(l,a,g,w[a],!1),a="checked",void 0!==b&&b!==l[a]&&T(l,a,b,w[a],!1))}return l}function z(n,u,t){try{"function"==typeof n?n(u):n.current=u}catch(n){l.__e(n,t)}}function N(n,u,t){var i,o;if(l.unmount&&l.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||z(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(n){l.__e(n,u)}i.base=i.__P=null,n.__c=void 0}if(i=n.__k)for(o=0;o<i.length;o++)i[o]&&N(i[o],u,t||"function"!=typeof n.type);t||null==n.__e||p(n.__e),n.__=n.__e=n.__d=void 0}function O(n,l,u){return this.constructor(n,u)}function q(u,t,i){var o,r,f,e;l.__&&l.__(u,t),r=(o="function"==typeof i)?null:i&&i.__k||t.__k,f=[],e=[],L(t,u=(!o&&i||t).__k=y(g,null,[u]),r||c,c,void 0!==t.ownerSVGElement,!o&&i?[i]:r?null:t.firstChild?n.call(t.childNodes):null,f,!o&&i?i:r?r.__e:t.firstChild,o,e),M(f,u,e)}function B(n,l){q(n,l,B)}function E(l,u,t){var i,o,r,f,e=v({},l.props);for(r in l.type&&l.type.defaultProps&&(f=l.type.defaultProps),u)"key"==r?i=u[r]:"ref"==r?o=u[r]:e[r]=void 0===u[r]&&void 0!==f?f[r]:u[r];return arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),d(l.type,e,i||l.key,o||l.ref,null)}function F(n,l){var u={__c:l="__cC"+e++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,t;return this.getChildContext||(u=[],(t={})[l]=this,this.getChildContext=function(){return t},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(function(n){n.__e=!0,k(n)})},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n)}}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=s.slice,l={__e:function(n,l,u,t){for(var i,o,r;l=l.__;)if((i=l.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(n)),r=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),r=i.__d),r)return i.__E=i}catch(l){n=l}throw n}},u=0,t=function(n){return null!=n&&null==n.constructor},b.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=v({},this.state),"function"==typeof n&&(n=n(v({},u),this.props)),n&&v(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),k(this))},b.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),k(this))},b.prototype.render=g,i=[],r="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f=function(n,l){return n.__v.__b-l.__v.__b},x.__r=0,e=0;
//# sourceMappingURL=preact.module.js.map
/***/ }),
/* 1 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/**
* @license
* Copyright 2016 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* @template A
*/
class MDCFoundation {
/** @return enum{cssClasses} */
static get cssClasses() {
// Classes extending MDCFoundation should implement this method to return an object which exports every
// CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}
return {};
}
/** @return enum{strings} */
static get strings() {
// Classes extending MDCFoundation should implement this method to return an object which exports all
// semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
return {};
}
/** @return enum{numbers} */
static get numbers() {
// Classes extending MDCFoundation should implement this method to return an object which exports all
// of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}
return {};
}
/** @return {!Object} */
static get defaultAdapter() {
// Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient
// way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter
// validation.
return {};
}
/**
* @param {A=} adapter
*/
constructor(adapter = {}) {
/** @protected {!A} */
this.adapter_ = adapter;
}
init() {
// Subclasses should override this method to perform initialization routines (registering events, etc.)
}
destroy() {
// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
}
}
/* harmony default export */ __webpack_exports__["a"] = (MDCFoundation);
/***/ }),
/* 2 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _foundation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
/**
* @license
* Copyright 2016 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* @template F
*/
class MDCComponent {
/**
* @param {!Element} root
* @return {!MDCComponent}
*/
static attachTo(root) {
// Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and
// returns an instantiated component with its root set to that element. Also note that in the cases of
// subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized
// from getDefaultFoundation().
return new MDCComponent(root, new _foundation__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]());
}
/**
* @param {!Element} root
* @param {F=} foundation
* @param {...?} args
*/
constructor(root, foundation = undefined, ...args) {
/** @protected {!Element} */
this.root_ = root;
this.initialize(...args);
// Note that we initialize foundation here and not within the constructor's default param so that
// this.root_ is defined and can be used within the foundation class.
/** @protected {!F} */
this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation;
this.foundation_.init();
this.initialSyncWithDOM();
}
initialize(/* ...args */) {
// Subclasses can override this to do any additional setup work that would be considered part of a
// "constructor". Essentially, it is a hook into the parent constructor before the foundation is
// initialized. Any additional arguments besides root and foundation will be passed in here.
}
/**
* @return {!F} foundation
*/
getDefaultFoundation() {
// Subclasses must override this method to return a properly configured foundation class for the
// component.
throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' +
'foundation class');
}
initialSyncWithDOM() {
// Subclasses should override this method if they need to perform work to synchronize with a host DOM
// object. An example of this would be a form control wrapper that needs to synchronize its internal state
// to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM
// reads/writes that would cause layout / paint, as this is called synchronously from within the constructor.
}
destroy() {
// Subclasses may implement this method to release any resources / deregister any listeners they have
// attached. An example of this might be deregistering a resize event from the window object.
this.foundation_.destroy();
}
/**
* Wrapper method to add an event listener to the component's root element. This is most useful when
* listening for custom events.
* @param {string} evtType
* @param {!Function} handler
*/
listen(evtType, handler) {
this.root_.addEventListener(evtType, handler);
}
/**
* Wrapper method to remove an event listener to the component's root element. This is most useful when
* unlistening for custom events.
* @param {string} evtType
* @param {!Function} handler
*/
unlisten(evtType, handler) {
this.root_.removeEventListener(evtType, handler);
}
/**
* Fires a cross-browser-compatible custom event from the component root of the given type,
* with the given data.
* @param {string} evtType
* @param {!Object} evtData
* @param {boolean=} shouldBubble
*/
emit(evtType, evtData, shouldBubble = false) {
let evt;
if (typeof CustomEvent === 'function') {
evt = new CustomEvent(evtType, {
detail: evtData,
bubbles: shouldBubble,
});
} else {
evt = document.createEvent('CustomEvent');
evt.initCustomEvent(evtType, shouldBubble, false, evtData);
}
this.root_.dispatchEvent(evt);
}
}
/* harmony default export */ __webpack_exports__["a"] = (MDCComponent);
/***/ }),
/* 3 */
/***/ (function(module, exports) {
function _getPrototypeOf(t) {
return (module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
return t.__proto__ || Object.getPrototypeOf(t);
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _getPrototypeOf(t);
}
module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/* 4 */
/***/ (function(module, exports) {
function _interopRequireDefault(e) {
return e && e.__esModule ? e : {
"default": e
};
}
module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/* 5 */
/***/ (function(module, exports) {
function _classCallCheck(a, n) {
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
}
module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
var toPropertyKey = __webpack_require__(37);
function _defineProperties(e, r) {
for (var t = 0; t < r.length; t++) {
var o = r[t];
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
}
}
function _createClass(e, r, t) {
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
writable: !1
}), e;
}
module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
var _typeof = __webpack_require__(13)["default"];
var assertThisInitialized = __webpack_require__(39);
function _possibleConstructorReturn(t, e) {
if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
return assertThisInitialized(t);
}
module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
var setPrototypeOf = __webpack_require__(41);
function _inherits(t, e) {
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
t.prototype = Object.create(e && e.prototype, {
constructor: {
value: t,
writable: !0,
configurable: !0
}
}), Object.defineProperty(t, "prototype", {
writable: !1
}), e && setPrototypeOf(t, e);
}
module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/* 9 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return transformStyleProperties; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getCorrectEventName; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getCorrectPropertyName; });
/**
* @license
* Copyright 2016 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* @typedef {{
* noPrefix: string,
* webkitPrefix: string,
* styleProperty: string
* }}
*/
let VendorPropertyMapType;
/** @const {Object<string, !VendorPropertyMapType>} */
const eventTypeMap = {
'animationstart': {
noPrefix: 'animationstart',
webkitPrefix: 'webkitAnimationStart',
styleProperty: 'animation',
},
'animationend': {
noPrefix: 'animationend',
webkitPrefix: 'webkitAnimationEnd',
styleProperty: 'animation',
},
'animationiteration': {
noPrefix: 'animationiteration',
webkitPrefix: 'webkitAnimationIteration',
styleProperty: 'animation',
},
'transitionend': {
noPrefix: 'transitionend',
webkitPrefix: 'webkitTransitionEnd',
styleProperty: 'transition',
},
};
/** @const {Object<string, !VendorPropertyMapType>} */
const cssPropertyMap = {
'animation': {
noPrefix: 'animation',
webkitPrefix: '-webkit-animation',
},
'transform': {
noPrefix: 'transform',
webkitPrefix: '-webkit-transform',
},
'transition': {
noPrefix: 'transition',
webkitPrefix: '-webkit-transition',
},
};
/**
* @param {!Object} windowObj
* @return {boolean}
*/
function hasProperShape(windowObj) {
return (windowObj['document'] !== undefined && typeof windowObj['document']['createElement'] === 'function');
}
/**
* @param {string} eventType
* @return {boolean}
*/
function eventFoundInMaps(eventType) {
return (eventType in eventTypeMap || eventType in cssPropertyMap);
}
/**
* @param {string} eventType
* @param {!Object<string, !VendorPropertyMapType>} map
* @param {!Element} el
* @return {string}
*/
function getJavaScriptEventName(eventType, map, el) {
return map[eventType].styleProperty in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix;
}
/**
* Helper function to determine browser prefix for CSS3 animation events
* and property names.
* @param {!Object} windowObj
* @param {string} eventType
* @return {string}
*/
function getAnimationName(windowObj, eventType) {
if (!hasProperShape(windowObj) || !eventFoundInMaps(eventType)) {
return eventType;
}
const map = /** @type {!Object<string, !VendorPropertyMapType>} */ (
eventType in eventTypeMap ? eventTypeMap : cssPropertyMap
);
const el = windowObj['document']['createElement']('div');
let eventName = '';
if (map === eventTypeMap) {
eventName = getJavaScriptEventName(eventType, map, el);
} else {
eventName = map[eventType].noPrefix in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix;
}
return eventName;
}
// Public functions to access getAnimationName() for JavaScript events or CSS
// property names.
const transformStyleProperties = ['transform', 'WebkitTransform', 'MozTransform', 'OTransform', 'MSTransform'];
/**
* @param {!Object} windowObj
* @param {string} eventType
* @return {string}
*/
function getCorrectEventName(windowObj, eventType) {
return getAnimationName(windowObj, eventType);
}
/**
* @param {!Object} windowObj
* @param {string} eventType
* @return {string}
*/
function getCorrectPropertyName(windowObj, eventType) {
return getAnimationName(windowObj, eventType);
}
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.XPATH = void 0;
exports.XPATH = {
// We need two class selectors because youtube "custom playlist" and watch later have slightly different ui
APP_RENDER_ROOT: '//div[@class="metadata-wrapper style-scope ytd-playlist-header-renderer" or @class="style-scope ytd-playlist-sidebar-primary-info-renderer"]',
YT_PLAYLIST_VIDEO_RENDERERS: '//ytd-playlist-video-renderer',
YT_PLAYLIST_VIDEO_MENU: '//ytd-playlist-video-renderer//div[@id="menu"]',
YT_NUMBER_OF_VIDEOS_IN_PLAYLIST: '//ytd-playlist-byline-renderer//div/yt-formatted-string/span[1]',
YT_SIDEBAR_CONTAINER: '//div[@class="immersive-header-content style-scope ytd-playlist-header-renderer"]',
};
exports.default = {
XPATH: exports.XPATH,
};
/***/ }),
/* 11 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jsx", function() { return u; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jsxAttr", function() { return l; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jsxDEV", function() { return u; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jsxEscape", function() { return _; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jsxTemplate", function() { return a; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jsxs", function() { return u; });
/* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Fragment", function() { return preact__WEBPACK_IMPORTED_MODULE_0__["Fragment"]; });
var t=/["&<]/;function n(r){if(0===r.length||!1===t.test(r))return r;for(var e=0,n=0,o="",f="";n<r.length;n++){switch(r.charCodeAt(n)){case 34:f=""";break;case 38:f="&";break;case 60:f="<";break;default:continue}n!==e&&(o+=r.slice(e,n)),o+=f,e=n+1}return n!==e&&(o+=r.slice(e,n)),o}var o=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,f=0,i=Array.isArray;function u(e,t,n,o,i,u){var a,c,p={};for(c in t)"ref"==c?a=t[c]:p[c]=t[c];var l={type:e,props:p,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--f,__i:-1,__u:0,__source:i,__self:u};if("function"==typeof e&&(a=e.defaultProps))for(c in a)void 0===p[c]&&(p[c]=a[c]);return preact__WEBPACK_IMPORTED_MODULE_0__["options"].vnode&&preact__WEBPACK_IMPORTED_MODULE_0__["options"].vnode(l),l}function a(r){var t=u(preact__WEBPACK_IMPORTED_MODULE_0__["Fragment"],{tpl:r,exprs:[].slice.call(arguments,1)});return t.key=t.__v,t}var c={},p=/[A-Z]/g;function l(e,t){if(preact__WEBPACK_IMPORTED_MODULE_0__["options"].attr){var f=preact__WEBPACK_IMPORTED_MODULE_0__["options"].attr(e,t);if("string"==typeof f)return f}if("ref"===e||"key"===e)return"";if("style"===e&&"object"==typeof t){var i="";for(var u in t){var a=t[u];if(null!=a&&""!==a){var l="-"==u[0]?u:c[u]||(c[u]=u.replace(p,"-$&").toLowerCase()),_=";";"number"!=typeof a||l.startsWith("--")||o.test(l)||(_="px;"),i=i+l+":"+a+_}}return e+'="'+i+'"'}return null==t||!1===t||"function"==typeof t||"object"==typeof t?"":!0===t?e:e+'="'+n(t)+'"'}function _(r){if(null==r||"boolean"==typeof r||"function"==typeof r)return null;if("object"==typeof r){if(void 0===r.constructor)return r;if(i(r)){for(var e=0;e<r.length;e++)r[e]=_(r[e]);return r}}return n(""+r)}
//# sourceMappingURL=jsxRuntime.module.js.map
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Query DOM Xpath and return an array of Node
// Usage is similar to $x in console
function getElementsByXPath(xpath, parent) {
const results = [];
const query = document.evaluate(xpath, parent || document, undefined, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE);
const length = query.snapshotLength;
for (let index = 0; index < length; index += 1) {
results.push(query.snapshotItem(index));
}
// force cast since we keep into snapshotLength limit, no item should be null
return results;
}
exports.default = getElementsByXPath;
/***/ }),
/* 13 */
/***/ (function(module, exports) {
function _typeof(o) {
"@babel/helpers - typeof";
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
}
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(4);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.MaterialComponent = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(5));
var _createClass2 = _interopRequireDefault(__webpack_require__(6));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(7));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(3));
var _inherits2 = _interopRequireDefault(__webpack_require__(8));
var _typeof2 = _interopRequireDefault(__webpack_require__(13));
var _ripple = __webpack_require__(22);
var _bindDecorator = __webpack_require__(25);
var _preact = __webpack_require__(0);
var __decorate = void 0 && (void 0).__decorate || function (decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if ((typeof Reflect === "undefined" ? "undefined" : (0, _typeof2.default)(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
}
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var doNotRemoveProps = ['disabled'];
/**
* Base class for every Material component in this package
* NOTE: every component should add a ref by the name of `control` to its root dom for autoInit Properties
*
* @export
* @class MaterialComponent
* @extends {Component}
*/
var MaterialComponent =
/*#__PURE__*/
function (_Component) {
(0, _inherits2.default)(MaterialComponent, _Component);
function MaterialComponent() {
(0, _classCallCheck2.default)(this, MaterialComponent);
return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(MaterialComponent).apply(this, arguments));
}
(0, _createClass2.default)(MaterialComponent, [{
key: "render",
value: function render(props) {
if (!this.classText) {
this.classText = this.buildClassName(props);
} // Fetch a VNode
var componentProps = props;
var userDefinedClasses = componentProps.className || componentProps.class || ''; // We delete class props and add them later in the final
// step so every component does not need to handle user specified classes.
if (componentProps.class) {
delete componentProps.class;
}
if (componentProps.className) {
delete componentProps.className;
}
var element = this.materialDom(componentProps);
var propName = 'attributes';
if ('props' in element) {
propName = 'props'; // @ts-ignore
element.props = element.props || {};
} else {
element.attributes = element.attributes || {};
} // @ts-ignore
element[propName].className = "".concat(userDefinedClasses, " ").concat(this.getClassName(element)).split(' ').filter(function (value, index, self) {
return self.indexOf(value) === index && value !== '';
}) // Unique + exclude empty class names
.join(' '); // Clean this shit of proxy attributes
this.mdcProps.forEach(function (prop) {
// TODO: Fix this better
if (prop in doNotRemoveProps) {
return;
} // @ts-ignore
delete element[propName][prop];
});
return element;
}
/** Attach the ripple effect */
}, {
key: "componentDidMount",
value: function componentDidMount() {
if (this.props.ripple && this.control) {
this.ripple = new _ripple.MDCRipple(this.control);
}
}
}, {
key: "componentWillReceiveProps",
value: function componentWillReceiveProps(nextProps) {
if (this.MDComponent && this.mdcNotifyProps) {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = this.mdcNotifyProps[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var prop = _step.value;
if (this.props[prop] !== nextProps[prop]) {
this.MDComponent[prop] = nextProps[prop];
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = this.mdcProps[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var _prop = _step2.value;
if (this.props[_prop] !== nextProps[_prop]) {
this.classText = this.buildClassName(nextProps);
break;
}
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
_iterator2.return();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
if (this.ripple) {
this.ripple.destroy();
}
}
}, {
key: "afterComponentDidMount",
value: function afterComponentDidMount() {
if (this.MDComponent && this.mdcNotifyProps) {
var _iteratorNormalCompletion3 = true;
var _didIteratorError3 = false;
var _iteratorError3 = undefined;
try {
for (var _iterator3 = this.mdcNotifyProps[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
var prop = _step3.value;
this.MDComponent[prop] = this.props[prop];
}
} catch (err) {
_didIteratorError3 = true;
_iteratorError3 = err;
} finally {
try {
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
_iterator3.return();
}
} finally {
if (_didIteratorError3) {
throw _iteratorError3;
}
}
}
}
} // Shared setter for the root element ref
}, {
key: "setControlRef",
value: function setControlRef(control) {
this.control = control;
}
/** Build the className based on component names and mdc props */
}, {
key: "buildClassName",
value: function buildClassName(props) {
// Class name based on component name
var classText = 'mdc-' + this.componentName; // Loop over mdcProps to turn them into classNames
for (var propKey in props) {
if (props.hasOwnProperty(propKey)) {
var prop = props[propKey];
if (typeof prop === 'boolean' && prop) {
if (this.mdcProps.indexOf(propKey) !== -1) {
classText += " mdc-".concat(this.componentName, "--").concat(propKey);
}
}
}
}
return classText;
}
/** Returns the class name for element */
}, {
key: "getClassName",
value: function getClassName(element) {
if (!element) {
return '';
}
var propName = 'attributes';
if ('props' in element) {
propName = 'props'; // @ts-ignore
element.props = element.props || {};
} else {
element.attributes = element.attributes || {};
} // @ts-ignore
var attrs = element[propName] = element[propName] || {};
var classText = this.classText;
if (attrs.class) {
classText += ' ' + attrs.class;
}
if (attrs.className && attrs.className !== attrs.class) {
classText += ' ' + attrs.className;
}
return classText;
}
}]);
return MaterialComponent;
}(_preact.Component);
exports.MaterialComponent = MaterialComponent;
__decorate([_bindDecorator.bind], MaterialComponent.prototype, "setControlRef", null);
var _default = MaterialComponent;
exports.default = _default;
//# sourceMappingURL=MaterialComponent.js.map
/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
// eslint-disable-next-line func-names
module.exports = function (useSourceMap) {
var list = []; // return the list of modules as css string
list.toString = function toString() {
return this.map(function (item) {
var content = cssWithMappingToString(item, useSourceMap);
if (item[2]) {
return "@media ".concat(item[2], " {").concat(content, "}");
}
return content;
}).join('');
}; // import a list of modules into the list
// eslint-disable-next-line func-names
list.i = function (modules, mediaQuery, dedupe) {
if (typeof modules === 'string') {
// eslint-disable-next-line no-param-reassign
modules = [[null, modules, '']];
}
var alreadyImportedModules = {};
if (dedupe) {
for (var i = 0; i < this.length; i++) {
// eslint-disable-next-line prefer-destructuring
var id = this[i][0];
if (id != null) {
alreadyImportedModules[id] = true;
}
}
}
for (var _i = 0; _i < modules.length; _i++) {
var item = [].concat(modules[_i]);
if (dedupe && alreadyImportedModules[item[0]]) {
// eslint-disable-next-line no-continue
continue;
}
if (mediaQuery) {
if (!item[2]) {
item[2] = mediaQuery;
} else {
item[2] = "".concat(mediaQuery, " and ").concat(item[2]);
}
}
list.push(item);
}
};
return list;
};
function cssWithMappingToString(item, useSourceMap) {
var content = item[1] || ''; // eslint-disable-next-line prefer-destructuring
var cssMapping = item[3];
if (!cssMapping) {
return content;
}
if (useSourceMap && typeof btoa === 'function') {
var sourceMapping = toComment(cssMapping);
var sourceURLs = cssMapping.sources.map(function (source) {
return "/*# sourceURL=".concat(cssMapping.sourceRoot || '').concat(source, " */");
});
return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
}
return [content].join('\n');
} // Adapted from convert-source-map (MIT)
function toComment(sourceMap) {
// eslint-disable-next-line no-undef
var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64);
return "/*# ".concat(data, " */");
}
/***/ }),
/* 16 */
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stylesheet", function() { return stylesheet; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insert", function() { return insert; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "enable", function() { return enable; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "disable", function() { return disable; });
const MATCH_ALL = "all";
const MATCH_NONE = "not all";
function stylesheet(spec) {
return spec;
}
function insert(stylesheets) {
const fragment = document.createDocumentFragment();
Object.entries(stylesheets).forEach(([_, sheet]) => {
const style = document.createElement("style");
if (sheet.id !== undefined)
style.id = sheet.id;
style.textContent = sheet.css;
style.media = sheet.condition(window) ? MATCH_ALL : MATCH_NONE;
fragment.appendChild(style);
});
document.documentElement.appendChild(fragment);
}
const setMediaQuery = (m) => (s) => {
const element = document.getElementById(s.id);
if (element !== null) {
element.setAttribute("media", m);
}
};
const enable = setMediaQuery(MATCH_ALL);
const disable = setMediaQuery(MATCH_NONE);
/***/ }),
/* 17 */
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, "operation", function() { return /* binding */ operation; });
__webpack_require__.d(__webpack_exports__, "run", function() { return /* binding */ run; });
// CONCATENATED MODULE: ./node_modules/ts-type-guards/dist/is.mjs
const TYPE_GUARDS_PRIMITIVE = [isBoolean, isNumber, isString, isSymbol, isNull, isUndefined];
function isBoolean(x) {
return typeof x === "boolean";
}
function isNumber(x) {
return typeof x === "number";
}
function isString(x) {
return typeof x === "string";
}
function isSymbol(x) {
return typeof x === "symbol";
}
function isNull(x) {
return x === null;
}
function isUndefined(x) {
return x === undefined;
}
function isPrimitive(x) {
return TYPE_GUARDS_PRIMITIVE.some(f => f(x));
}
function isNonPrimitive(x) {
return !isPrimitive(x);
}
function namedFunction(name, fun) {
return Object.defineProperty(fun, "name", { value: name, writable: false });
}
function namedTypeGuard(creator, type, typeGuard) {
return namedFunction(`${creator.name}(${type.name})`, typeGuard);
}
function is(type) {
if (isPrimitive(type)) {
return (_) => false;
}
return namedTypeGuard(is, type, (x) => x instanceof type);
}
function isLike(reference) {
for (const f of TYPE_GUARDS_PRIMITIVE) {
if (f(reference)) {
return (x) => f(x);
}
}
if (is(Array)(reference)) {
const referenceAsArray = reference;
return (x) => is(Array)(x) && (referenceAsArray.length > 0 ? x.every(isLike(referenceAsArray[0])) : true);
}
if (reference.constructor === Object) {
return (x) => (![undefined, null].includes(x)
&&
Object.keys(reference).every(k => isLike(reference[k])(x[k])));
}
if (reference.constructor instanceof Function) {
return is(reference.constructor);
}
throw new TypeError(isLike.name + ` cannot use this object as reference because it has no constructor: ` + JSON.stringify(reference));
}
//# sourceMappingURL=is.js.map
// CONCATENATED MODULE: ./node_modules/userscripter/lib/operations.mjs
const SUCCESS = undefined;
function operation(spec) {
return spec;
}
function run(plan) {
function recurse(operations, failures, triesLeft) {
const lastTry = isNumber(triesLeft) && triesLeft <= 0;
const operationsToRunNow = [];
const remaining = [];
const readyState = document.readyState;
for (const o of operations) {
const shouldRunNow = o.deferUntil === undefined || o.deferUntil(readyState);
(shouldRunNow ? operationsToRunNow : remaining).push(o);
}
for (const o of operationsToRunNow) {
const result = tryToPerform(o);
if (result !== SUCCESS) {
switch (result.reason) {
case 0:
if (lastTry) {
failures.push({ result, operation: o });
}
else {
remaining.push(o);
}
break;
case 1:
failures.push({ result, operation: o });
break;
}
}
}
if (remaining.length > 0) {
setTimeout(() => recurse(remaining, failures, (isNumber(triesLeft)
? triesLeft - 1
: plan.tryUntil(readyState) ? plan.extraTries : undefined)), plan.interval);
}
else if (failures.length > 0) {
plan.handleFailures(failures);
}
}
recurse(plan.operations.filter(o => o.condition(window)), []);
}
function tryToPerform(o) {
const dependencies = o.dependencies === undefined ? {} : o.dependencies;
const queryResults = Object.entries(dependencies).map(([key, selector]) => ({
key, selector,
element: document.querySelector(selector),
}));
const missingDependencies = queryResults.filter(x => isNull(x.element));
if (missingDependencies.length > 0) {
return { reason: 0, dependencies: missingDependencies };
}
const e = queryResults.reduce((acc, x) => Object.defineProperty(acc, x.key, { value: x.element }), {});
return fromActionResult(o.action(e));
}
function fromActionResult(r) {
return isString(r) ? { reason: 1, message: r } : SUCCESS;
}
/***/ }),
/* 18 */
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ALWAYS", function() { return ALWAYS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NEVER", function() { return NEVER; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DOMCONTENTLOADED", function() { return DOMCONTENTLOADED; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOAD", function() { return LOAD; });
const ALWAYS = () => true;
const NEVER = () => false;
const DOMCONTENTLOADED = (state) => state !== "loading";
const LOAD = (state) => state === "complete";
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
// This file is generated from package.json with build-config-from-package-json command
// if you need to add or remove data from it, see package.json script section
// Additional details: https://github.com/avallete/userscripter-boilerplate/issues/30
const metadata_config_json_1 = __importDefault(__webpack_require__(33));
const userscriptMetadata = {
id: metadata_config_json_1.default.name, // Used to generate the final dist files (like so: `${id}.user.js`)
name: metadata_config_json_1.default.name, // Used into metadata and manifest.json as extension/userscript name
description: metadata_config_json_1.default.description,
version: metadata_config_json_1.default.version, // Automatically match the userscript metadata version to the package.json one
author: metadata_config_json_1.default.author,
homepage: metadata_config_json_1.default.homepage,
support: metadata_config_json_1.default.bugs.url,
hostname: 'youtube.com', // Will be used to generate matches (see: metadata.ts)
sitename: 'youtube',
repositoryURL: metadata_config_json_1.default.repository.url, // Used to generate the downloadURL of your userscript into metadata.ts
license: metadata_config_json_1.default.license,
run_at: 'document-idle',
// Will be used to generate the downloadURL into metadata.ts
// Make sure it match the branch where final release are pushed (see .github/workflow/deploy-gh-pages.yml)
releaseBranch: 'gh-pages',
};
exports.default = userscriptMetadata;
/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {
var superPropBase = __webpack_require__(40);
function _get() {
return (module.exports = _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) {
var p = superPropBase(e, t);
if (p) {
var n = Object.getOwnPropertyDescriptor(p, t);
return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value;
}
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _get.apply(null, arguments);
}
module.exports = _get, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/* 21 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useCallback", function() { return x; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useContext", function() { return P; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useDebugValue", function() { return V; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useEffect", function() { return _; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useErrorBoundary", function() { return b; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useId", function() { return g; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useImperativeHandle", function() { return T; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useLayoutEffect", function() { return A; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useMemo", function() { return q; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useReducer", function() { return y; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useRef", function() { return F; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useState", function() { return p; });
/* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
var t,r,u,i,o=0,f=[],c=[],e=preact__WEBPACK_IMPORTED_MODULE_0__["options"],a=e.__b,v=e.__r,l=e.diffed,m=e.__c,s=e.unmount,d=e.__;function h(n,t){e.__h&&e.__h(r,n,o||t),o=0;var u=r.__H||(r.__H={__:[],__h:[]});return n>=u.__.length&&u.__.push({__V:c}),u.__[n]}function p(n){return o=1,y(D,n)}function y(n,u,i){var o=h(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):D(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}))}],o.__c=r,!r.u)){var f=function(n,t,r){if(!o.__c.__H)return!0;var u=o.__c.__H.__.filter(function(n){return!!n.__c});if(u.every(function(n){return!n.__N}))return!c||c.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0)}}),!(!i&&o.__c.props===n)&&(!c||c.call(this,n,t,r))};r.u=!0;var c=r.shouldComponentUpdate,e=r.componentWillUpdate;r.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u}e&&e.call(this,n,t,r)},r.shouldComponentUpdate=f}return o.__N||o.__}function _(n,u){var i=h(t++,3);!e.__s&&C(i.__H,u)&&(i.__=n,i.i=u,r.__H.__h.push(i))}function A(n,u){var i=h(t++,4);!e.__s&&C(i.__H,u)&&(i.__=n,i.i=u,r.__h.push(i))}function F(n){return o=5,q(function(){return{current:n}},[])}function T(n,t,r){o=6,A(function(){return"function"==typeof n?(n(t()),function(){return n(null)}):n?(n.current=t(),function(){return n.current=null}):void 0},null==r?r:r.concat(n))}function q(n,r){var u=h(t++,7);return C(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function x(n,t){return o=8,q(function(){return n},t)}function P(n){var u=r.context[n.__c],i=h(t++,9);return i.c=n,u?(null==i.__&&(i.__=!0,u.sub(r)),u.props.value):n.__}function V(n,t){e.useDebugValue&&e.useDebugValue(t?t(n):n)}function b(n){var u=h(t++,10),i=p();return u.__=n,r.componentDidCatch||(r.componentDidCatch=function(n,t){u.__&&u.__(n,t),i[1](n)}),[i[0],function(){i[1](void 0)}]}function g(){var n=h(t++,11);if(!n.__){for(var u=r.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;var i=u.__m||(u.__m=[0,0]);n.__="P"+i[0]+"-"+i[1]++}return n.__}function j(){for(var n;n=f.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(z),n.__H.__h.forEach(B),n.__H.__h=[]}catch(t){n.__H.__h=[],e.__e(t,n.__v)}}e.__b=function(n){r=null,a&&a(n)},e.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),d&&d(n,t)},e.__r=function(n){v&&v(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c,n.__N=n.i=void 0})):(i.__h.forEach(z),i.__h.forEach(B),i.__h=[],t=0)),u=r},e.diffed=function(n){l&&l(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(1!==f.push(t)&&i===e.requestAnimationFrame||((i=e.requestAnimationFrame)||w)(j)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c&&(n.__=n.__V),n.i=void 0,n.__V=c})),u=r=null},e.__c=function(n,t){t.some(function(n){try{n.__h.forEach(z),n.__h=n.__h.filter(function(n){return!n.__||B(n)})}catch(r){t.some(function(n){n.__h&&(n.__h=[])}),t=[],e.__e(r,n.__v)}}),m&&m(n,t)},e.unmount=function(n){s&&s(n);var t,r=n.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{z(n)}catch(n){t=n}}),r.__H=void 0,t&&e.__e(t,r.__v))};var k="function"==typeof requestAnimationFrame;function w(n){var t,r=function(){clearTimeout(u),k&&cancelAnimationFrame(t),setTimeout(n)},u=setTimeout(r,100);k&&(t=requestAnimationFrame(r))}function z(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t}function B(n){var t=r;n.__c=n.__(),r=t}function C(n,t){return!n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function D(n,t){return"function"==typeof t?t(n):t}
//# sourceMappingURL=hooks.module.js.map
/***/ }),
/* 22 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, "MDCRipple", function() { return /* binding */ ripple_MDCRipple; });
__webpack_require__.d(__webpack_exports__, "MDCRippleFoundation", function() { return /* reexport */ ripple_foundation; });
__webpack_require__.d(__webpack_exports__, "RippleCapableSurface", function() { return /* binding */ RippleCapableSurface; });
__webpack_require__.d(__webpack_exports__, "util", function() { return /* reexport */ util_namespaceObject; });
// NAMESPACE OBJECT: ./node_modules/@material/ripple/util.js
var util_namespaceObject = {};
__webpack_require__.r(util_namespaceObject);
__webpack_require__.d(util_namespaceObject, "supportsCssVariables", function() { return supportsCssVariables; });
__webpack_require__.d(util_namespaceObject, "applyPassive", function() { return applyPassive; });
__webpack_require__.d(util_namespaceObject, "getMatchesProperty", function() { return getMatchesProperty; });
__webpack_require__.d(util_namespaceObject, "getNormalizedEventCoords", function() { return getNormalizedEventCoords; });
// EXTERNAL MODULE: ./node_modules/@material/base/component.js
var component = __webpack_require__(2);
// CONCATENATED MODULE: ./node_modules/@material/ripple/adapter.js
/**
* @license
* Copyright 2016 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/* eslint no-unused-vars: [2, {"args": "none"}] */
/**
* Adapter for MDC Ripple. Provides an interface for managing
* - classes
* - dom
* - CSS variables
* - position
* - dimensions
* - scroll position
* - event handlers
* - unbounded, active and disabled states
*
* Additionally, provides type information for the adapter to the Closure
* compiler.
*
* Implement this adapter for your framework of choice to delegate updates to
* the component in your framework of choice. See architecture documentation
* for more details.
* https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
*
* @record
*/
class MDCRippleAdapter {
/** @return {boolean} */
browserSupportsCssVars() {}
/** @return {boolean} */
isUnbounded() {}
/** @return {boolean} */
isSurfaceActive() {}
/** @return {boolean} */
isSurfaceDisabled() {}
/** @param {string} className */
addClass(className) {}
/** @param {string} className */
removeClass(className) {}
/** @param {!EventTarget} target */
containsEventTarget(target) {}
/**
* @param {string} evtType
* @param {!Function} handler
*/
registerInteractionHandler(evtType, handler) {}
/**
* @param {string} evtType
* @param {!Function} handler
*/
deregisterInteractionHandler(evtType, handler) {}
/**
* @param {string} evtType
* @param {!Function} handler
*/
registerDocumentInteractionHandler(evtType, handler) {}
/**
* @param {string} evtType
* @param {!Function} handler
*/
deregisterDocumentInteractionHandler(evtType, handler) {}
/**
* @param {!Function} handler
*/
registerResizeHandler(handler) {}
/**
* @param {!Function} handler
*/
deregisterResizeHandler(handler) {}
/**
* @param {string} varName
* @param {?number|string} value
*/
updateCssVariable(varName, value) {}
/** @return {!ClientRect} */
computeBoundingRect() {}
/** @return {{x: number, y: number}} */
getWindowPageOffset() {}
}
/* harmony default export */ var adapter = (MDCRippleAdapter);
// EXTERNAL MODULE: ./node_modules/@material/base/foundation.js
var foundation = __webpack_require__(1);
// CONCATENATED MODULE: ./node_modules/@material/ripple/constants.js
/**
* @license
* Copyright 2016 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
const cssClasses = {
// Ripple is a special case where the "root" component is really a "mixin" of sorts,
// given that it's an 'upgrade' to an existing component. That being said it is the root
// CSS class that all other CSS classes derive from.
ROOT: 'mdc-ripple-upgraded',
UNBOUNDED: 'mdc-ripple-upgraded--unbounded',
BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',
};
const strings = {
VAR_LEFT: '--mdc-ripple-left',
VAR_TOP: '--mdc-ripple-top',
VAR_FG_SIZE: '--mdc-ripple-fg-size',
VAR_FG_SCALE: '--mdc-ripple-fg-scale',
VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',
};
const numbers = {
PADDING: 10,
INITIAL_ORIGIN_SCALE: 0.6,
DEACTIVATION_TIMEOUT_MS: 225, // Corresponds to $mdc-ripple-translate-duration (i.e. activation animation duration)
FG_DEACTIVATION_MS: 150, // Corresponds to $mdc-ripple-fade-out-duration (i.e. deactivation animation duration)
TAP_DELAY_MS: 300, // Delay between touch and simulated mouse events on touch devices
};
// CONCATENATED MODULE: ./node_modules/@material/ripple/util.js
/**
* @license
* Copyright 2016 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* Stores result from supportsCssVariables to avoid redundant processing to detect CSS custom variable support.
* @private {boolean|undefined}
*/
let supportsCssVariables_;
/**
* Stores result from applyPassive to avoid redundant processing to detect passive event listener support.
* @private {boolean|undefined}
*/
let supportsPassive_;
/**
* @param {!Window} windowObj
* @return {boolean}
*/
function detectEdgePseudoVarBug(windowObj) {
// Detect versions of Edge with buggy var() support
// See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/
const document = windowObj.document;
const node = document.createElement('div');
node.className = 'mdc-ripple-surface--test-edge-var-bug';
document.body.appendChild(node);
// The bug exists if ::before style ends up propagating to the parent element.
// Additionally, getComputedStyle returns null in iframes with display: "none" in Firefox,
// but Firefox is known to support CSS custom properties correctly.
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397
const computedStyle = windowObj.getComputedStyle(node);
const hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid';
node.remove();
return hasPseudoVarBug;
}
/**
* @param {!Window} windowObj
* @param {boolean=} forceRefresh
* @return {boolean|undefined}
*/
function supportsCssVariables(windowObj, forceRefresh = false) {
let supportsCssVariables = supportsCssVariables_;
if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
return supportsCssVariables;
}
const supportsFunctionPresent = windowObj.CSS && typeof windowObj.CSS.supports === 'function';
if (!supportsFunctionPresent) {
return;
}
const explicitlySupportsCssVars = windowObj.CSS.supports('--css-vars', 'yes');
// See: https://bugs.webkit.org/show_bug.cgi?id=154669
// See: README section on Safari
const weAreFeatureDetectingSafari10plus = (
windowObj.CSS.supports('(--css-vars: yes)') &&
windowObj.CSS.supports('color', '#00000000')
);
if (explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus) {
supportsCssVariables = !detectEdgePseudoVarBug(windowObj);
} else {
supportsCssVariables = false;
}
if (!forceRefresh) {
supportsCssVariables_ = supportsCssVariables;
}
return supportsCssVariables;
}
//
/**
* Determine whether the current browser supports passive event listeners, and if so, use them.
* @param {!Window=} globalObj
* @param {boolean=} forceRefresh
* @return {boolean|{passive: boolean}}
*/
function applyPassive(globalObj = window, forceRefresh = false) {
if (supportsPassive_ === undefined || forceRefresh) {
let isSupported = false;
try {
globalObj.document.addEventListener('test', null, {get passive() {
isSupported = true;
}});
} catch (e) { }
supportsPassive_ = isSupported;
}
return supportsPassive_ ? {passive: true} : false;
}
/**
* @param {!Object} HTMLElementPrototype
* @return {!Array<string>}
*/
function getMatchesProperty(HTMLElementPrototype) {
return [
'webkitMatchesSelector', 'msMatchesSelector', 'matches',
].filter((p) => p in HTMLElementPrototype).pop();
}
/**
* @param {!Event} ev
* @param {{x: number, y: number}} pageOffset
* @param {!ClientRect} clientRect
* @return {{x: number, y: number}}
*/
function getNormalizedEventCoords(ev, pageOffset, clientRect) {
const {x, y} = pageOffset;
const documentX = x + clientRect.left;
const documentY = y + clientRect.top;
let normalizedX;
let normalizedY;
// Determine touch point relative to the ripple container.
if (ev.type === 'touchstart') {
normalizedX = ev.changedTouches[0].pageX - documentX;
normalizedY = ev.changedTouches[0].pageY - documentY;
} else {
normalizedX = ev.pageX - documentX;
normalizedY = ev.pageY - documentY;
}
return {x: normalizedX, y: normalizedY};
}
// CONCATENATED MODULE: ./node_modules/@material/ripple/foundation.js
/**
* @license
* Copyright 2016 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* @typedef {{
* isActivated: (boolean|undefined),
* hasDeactivationUXRun: (boolean|undefined),
* wasActivatedByPointer: (boolean|undefined),
* wasElementMadeActive: (boolean|undefined),
* activationEvent: Event,
* isProgrammatic: (boolean|undefined)
* }}
*/
let ActivationStateType;
/**
* @typedef {{
* activate: (string|undefined),
* deactivate: (string|undefined),
* focus: (string|undefined),
* blur: (string|undefined)
* }}
*/
let ListenerInfoType;
/**
* @typedef {{
* activate: function(!Event),
* deactivate: function(!Event),
* focus: function(),
* blur: function()
* }}
*/
let ListenersType;
/**
* @typedef {{
* x: number,
* y: number
* }}
*/
let PointType;
// Activation events registered on the root element of each instance for activation
const ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown'];
// Deactivation events registered on documentElement when a pointer-related down event occurs
const POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup'];
// Tracks activations that have occurred on the current frame, to avoid simultaneous nested activations
/** @type {!Array<!EventTarget>} */
let activatedTargets = [];
/**
* @extends {MDCFoundation<!MDCRippleAdapter>}
*/
class foundation_MDCRippleFoundation extends foundation["a" /* default */] {
static get cssClasses() {
return cssClasses;
}
static get strings() {
return strings;
}
static get numbers() {
return numbers;
}
static get defaultAdapter() {
return {
browserSupportsCssVars: () => /* boolean - cached */ {},
isUnbounded: () => /* boolean */ {},
isSurfaceActive: () => /* boolean */ {},
isSurfaceDisabled: () => /* boolean */ {},
addClass: (/* className: string */) => {},
removeClass: (/* className: string */) => {},
containsEventTarget: (/* target: !EventTarget */) => {},
registerInteractionHandler: (/* evtType: string, handler: EventListener */) => {},
deregisterInteractionHandler: (/* evtType: string, handler: EventListener */) => {},
registerDocumentInteractionHandler: (/* evtType: string, handler: EventListener */) => {},
deregisterDocumentInteractionHandler: (/* evtType: string, handler: EventListener */) => {},
registerResizeHandler: (/* handler: EventListener */) => {},
deregisterResizeHandler: (/* handler: EventListener */) => {},
updateCssVariable: (/* varName: string, value: string */) => {},
computeBoundingRect: () => /* ClientRect */ {},
getWindowPageOffset: () => /* {x: number, y: number} */ {},
};
}
constructor(adapter) {
super(Object.assign(foundation_MDCRippleFoundation.defaultAdapter, adapter));
/** @private {number} */
this.layoutFrame_ = 0;
/** @private {!ClientRect} */
this.frame_ = /** @type {!ClientRect} */ ({width: 0, height: 0});
/** @private {!ActivationStateType} */
this.activationState_ = this.defaultActivationState_();
/** @private {number} */
this.initialSize_ = 0;
/** @private {number} */
this.maxRadius_ = 0;
/** @private {function(!Event)} */
this.activateHandler_ = (e) => this.activate_(e);
/** @private {function(!Event)} */
this.deactivateHandler_ = (e) => this.deactivate_(e);
/** @private {function(?Event=)} */
this.focusHandler_ = () => this.handleFocus();
/** @private {function(?Event=)} */
this.blurHandler_ = () => this.handleBlur();
/** @private {!Function} */
this.resizeHandler_ = () => this.layout();
/** @private {{left: number, top:number}} */
this.unboundedCoords_ = {
left: 0,
top: 0,
};
/** @private {number} */
this.fgScale_ = 0;
/** @private {number} */
this.activationTimer_ = 0;
/** @private {number} */
this.fgDeactivationRemovalTimer_ = 0;
/** @private {boolean} */
this.activationAnimationHasEnded_ = false;
/** @private {!Function} */
this.activationTimerCallback_ = () => {
this.activationAnimationHasEnded_ = true;
this.runDeactivationUXLogicIfReady_();
};
/** @private {?Event} */
this.previousActivationEvent_ = null;
}
/**
* We compute this property so that we are not querying information about the client
* until the point in time where the foundation requests it. This prevents scenarios where
* client-side feature-detection may happen too early, such as when components are rendered on the server
* and then initialized at mount time on the client.
* @return {boolean}
* @private
*/
supportsPressRipple_() {
return this.adapter_.browserSupportsCssVars();
}
/**
* @return {!ActivationStateType}
*/
defaultActivationState_() {
return {
isActivated: false,
hasDeactivationUXRun: false,
wasActivatedByPointer: false,
wasElementMadeActive: false,
activationEvent: null,
isProgrammatic: false,
};
}
/** @override */
init() {
const supportsPressRipple = this.supportsPressRipple_();
this.registerRootHandlers_(supportsPressRipple);
if (supportsPressRipple) {
const {ROOT, UNBOUNDED} = foundation_MDCRippleFoundation.cssClasses;
requestAnimationFrame(() => {
this.adapter_.addClass(ROOT);
if (this.adapter_.isUnbounded()) {
this.adapter_.addClass(UNBOUNDED);
// Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple
this.layoutInternal_();
}
});
}
}
/** @override */
destroy() {
if (this.supportsPressRipple_()) {
if (this.activationTimer_) {
clearTimeout(this.activationTimer_);
this.activationTimer_ = 0;
this.adapter_.removeClass(foundation_MDCRippleFoundation.cssClasses.FG_ACTIVATION);
}
if (this.fgDeactivationRemovalTimer_) {
clearTimeout(this.fgDeactivationRemovalTimer_);
this.fgDeactivationRemovalTimer_ = 0;
this.adapter_.removeClass(foundation_MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
}
const {ROOT, UNBOUNDED} = foundation_MDCRippleFoundation.cssClasses;
requestAnimationFrame(() => {
this.adapter_.removeClass(ROOT);
this.adapter_.removeClass(UNBOUNDED);
this.removeCssVars_();
});
}
this.deregisterRootHandlers_();
this.deregisterDeactivationHandlers_();
}
/**
* @param {boolean} supportsPressRipple Passed from init to save a redundant function call
* @private
*/
registerRootHandlers_(supportsPressRipple) {
if (supportsPressRipple) {
ACTIVATION_EVENT_TYPES.forEach((type) => {
this.adapter_.registerInteractionHandler(type, this.activateHandler_);
});
if (this.adapter_.isUnbounded()) {
this.adapter_.registerResizeHandler(this.resizeHandler_);
}
}
this.adapter_.registerInteractionHandler('focus', this.focusHandler_);
this.adapter_.registerInteractionHandler('blur', this.blurHandler_);
}
/**
* @param {!Event} e
* @private
*/
registerDeactivationHandlers_(e) {
if (e.type === 'keydown') {
this.adapter_.registerInteractionHandler('keyup', this.deactivateHandler_);
} else {
POINTER_DEACTIVATION_EVENT_TYPES.forEach((type) => {
this.adapter_.registerDocumentInteractionHandler(type, this.deactivateHandler_);
});
}
}
/** @private */
deregisterRootHandlers_() {
ACTIVATION_EVENT_TYPES.forEach((type) => {
this.adapter_.deregisterInteractionHandler(type, this.activateHandler_);
});
this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_);
this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_);
if (this.adapter_.isUnbounded()) {
this.adapter_.deregisterResizeHandler(this.resizeHandler_);
}
}
/** @private */
deregisterDeactivationHandlers_() {
this.adapter_.deregisterInteractionHandler('keyup', this.deactivateHandler_);
POINTER_DEACTIVATION_EVENT_TYPES.forEach((type) => {
this.adapter_.deregisterDocumentInteractionHandler(type, this.deactivateHandler_);
});
}
/** @private */
removeCssVars_() {
const {strings} = foundation_MDCRippleFoundation;
Object.keys(strings).forEach((k) => {
if (k.indexOf('VAR_') === 0) {
this.adapter_.updateCssVariable(strings[k], null);
}
});
}
/**
* @param {?Event} e
* @private
*/
activate_(e) {
if (this.adapter_.isSurfaceDisabled()) {
return;
}
const activationState = this.activationState_;
if (activationState.isActivated) {
return;
}
// Avoid reacting to follow-on events fired by touch device after an already-processed user interaction
const previousActivationEvent = this.previousActivationEvent_;
const isSameInteraction = previousActivationEvent && e && previousActivationEvent.type !== e.type;
if (isSameInteraction) {
return;
}
activationState.isActivated = true;
activationState.isProgrammatic = e === null;
activationState.activationEvent = e;
activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : (
e.type === 'mousedown' || e.type === 'touchstart' || e.type === 'pointerdown'
);
const hasActivatedChild =
e && activatedTargets.length > 0 && activatedTargets.some((target) => this.adapter_.containsEventTarget(target));
if (hasActivatedChild) {
// Immediately reset activation state, while preserving logic that prevents touch follow-on events
this.resetActivationState_();
return;
}
if (e) {
activatedTargets.push(/** @type {!EventTarget} */ (e.target));
this.registerDeactivationHandlers_(e);
}
activationState.wasElementMadeActive = this.checkElementMadeActive_(e);
if (activationState.wasElementMadeActive) {
this.animateActivation_();
}
requestAnimationFrame(() => {
// Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples
activatedTargets = [];
if (!activationState.wasElementMadeActive && (e.key === ' ' || e.keyCode === 32)) {
// If space was pressed, try again within an rAF call to detect :active, because different UAs report
// active states inconsistently when they're called within event handling code:
// - https://bugs.chromium.org/p/chromium/issues/detail?id=635971
// - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741
// We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS
// variable is set within a rAF callback for a submit button interaction (#2241).
activationState.wasElementMadeActive = this.checkElementMadeActive_(e);
if (activationState.wasElementMadeActive) {
this.animateActivation_();
}
}
if (!activationState.wasElementMadeActive) {
// Reset activation state immediately if element was not made active.
this.activationState_ = this.defaultActivationState_();
}
});
}
/**
* @param {?Event} e
* @private
*/
checkElementMadeActive_(e) {
return (e && e.type === 'keydown') ? this.adapter_.isSurfaceActive() : true;
}
/**
* @param {?Event=} event Optional event containing position information.
*/
activate(event = null) {
this.activate_(event);
}
/** @private */
animateActivation_() {
const {VAR_FG_TRANSLATE_START, VAR_FG_TRANSLATE_END} = foundation_MDCRippleFoundation.strings;
const {FG_DEACTIVATION, FG_ACTIVATION} = foundation_MDCRippleFoundation.cssClasses;
const {DEACTIVATION_TIMEOUT_MS} = foundation_MDCRippleFoundation.numbers;
this.layoutInternal_();
let translateStart = '';
let translateEnd = '';
if (!this.adapter_.isUnbounded()) {
const {startPoint, endPoint} = this.getFgTranslationCoordinates_();
translateStart = `${startPoint.x}px, ${startPoint.y}px`;
translateEnd = `${endPoint.x}px, ${endPoint.y}px`;
}
this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
// Cancel any ongoing activation/deactivation animations
clearTimeout(this.activationTimer_);
clearTimeout(this.fgDeactivationRemovalTimer_);
this.rmBoundedActivationClasses_();
this.adapter_.removeClass(FG_DEACTIVATION);
// Force layout in order to re-trigger the animation.
this.adapter_.computeBoundingRect();
this.adapter_.addClass(FG_ACTIVATION);
this.activationTimer_ = setTimeout(() => this.activationTimerCallback_(), DEACTIVATION_TIMEOUT_MS);
}
/**
* @private
* @return {{startPoint: PointType, endPoint: PointType}}
*/
getFgTranslationCoordinates_() {
const {activationEvent, wasActivatedByPointer} = this.activationState_;
let startPoint;
if (wasActivatedByPointer) {
startPoint = getNormalizedEventCoords(
/** @type {!Event} */ (activationEvent),
this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect()
);
} else {
startPoint = {
x: this.frame_.width / 2,
y: this.frame_.height / 2,
};
}
// Center the element around the start point.
startPoint = {
x: startPoint.x - (this.initialSize_ / 2),
y: startPoint.y - (this.initialSize_ / 2),
};
const endPoint = {
x: (this.frame_.width / 2) - (this.initialSize_ / 2),
y: (this.frame_.height / 2) - (this.initialSize_ / 2),
};
return {startPoint, endPoint};
}
/** @private */
runDeactivationUXLogicIfReady_() {
// This method is called both when a pointing device is released, and when the activation animation ends.
// The deactivation animation should only run after both of those occur.
const {FG_DEACTIVATION} = foundation_MDCRippleFoundation.cssClasses;
const {hasDeactivationUXRun, isActivated} = this.activationState_;
const activationHasEnded = hasDeactivationUXRun || !isActivated;
if (activationHasEnded && this.activationAnimationHasEnded_) {
this.rmBoundedActivationClasses_();
this.adapter_.addClass(FG_DEACTIVATION);
this.fgDeactivationRemovalTimer_ = setTimeout(() => {
this.adapter_.removeClass(FG_DEACTIVATION);
}, numbers.FG_DEACTIVATION_MS);
}
}
/** @private */
rmBoundedActivationClasses_() {
const {FG_ACTIVATION} = foundation_MDCRippleFoundation.cssClasses;
this.adapter_.removeClass(FG_ACTIVATION);
this.activationAnimationHasEnded_ = false;
this.adapter_.computeBoundingRect();
}
resetActivationState_() {
this.previousActivationEvent_ = this.activationState_.activationEvent;
this.activationState_ = this.defaultActivationState_();
// Touch devices may fire additional events for the same interaction within a short time.
// Store the previous event until it's safe to assume that subsequent events are for new interactions.
setTimeout(() => this.previousActivationEvent_ = null, foundation_MDCRippleFoundation.numbers.TAP_DELAY_MS);
}
/**
* @param {?Event} e
* @private
*/
deactivate_(e) {
const activationState = this.activationState_;
// This can happen in scenarios such as when you have a keyup event that blurs the element.
if (!activationState.isActivated) {
return;
}
const state = /** @type {!ActivationStateType} */ (Object.assign({}, activationState));
if (activationState.isProgrammatic) {
const evtObject = null;
requestAnimationFrame(() => this.animateDeactivation_(evtObject, state));
this.resetActivationState_();
} else {
this.deregisterDeactivationHandlers_();
requestAnimationFrame(() => {
this.activationState_.hasDeactivationUXRun = true;
this.animateDeactivation_(e, state);
this.resetActivationState_();
});
}
}
/**
* @param {?Event=} event Optional event containing position information.
*/
deactivate(event = null) {
this.deactivate_(event);
}
/**
* @param {Event} e
* @param {!ActivationStateType} options
* @private
*/
animateDeactivation_(e, {wasActivatedByPointer, wasElementMadeActive}) {
if (wasActivatedByPointer || wasElementMadeActive) {
this.runDeactivationUXLogicIfReady_();
}
}
layout() {
if (this.layoutFrame_) {
cancelAnimationFrame(this.layoutFrame_);
}
this.layoutFrame_ = requestAnimationFrame(() => {
this.layoutInternal_();
this.layoutFrame_ = 0;
});
}
/** @private */
layoutInternal_() {
this.frame_ = this.adapter_.computeBoundingRect();
const maxDim = Math.max(this.frame_.height, this.frame_.width);
// Surface diameter is treated differently for unbounded vs. bounded ripples.
// Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately
// to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically
// square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter
// (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via
// `overflow: hidden`.
const getBoundedRadius = () => {
const hypotenuse = Math.sqrt(Math.pow(this.frame_.width, 2) + Math.pow(this.frame_.height, 2));
return hypotenuse + foundation_MDCRippleFoundation.numbers.PADDING;
};
this.maxRadius_ = this.adapter_.isUnbounded() ? maxDim : getBoundedRadius();
// Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform
this.initialSize_ = maxDim * foundation_MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE;
this.fgScale_ = this.maxRadius_ / this.initialSize_;
this.updateLayoutCssVars_();
}
/** @private */
updateLayoutCssVars_() {
const {
VAR_FG_SIZE, VAR_LEFT, VAR_TOP, VAR_FG_SCALE,
} = foundation_MDCRippleFoundation.strings;
this.adapter_.updateCssVariable(VAR_FG_SIZE, `${this.initialSize_}px`);
this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_);
if (this.adapter_.isUnbounded()) {
this.unboundedCoords_ = {
left: Math.round((this.frame_.width / 2) - (this.initialSize_ / 2)),
top: Math.round((this.frame_.height / 2) - (this.initialSize_ / 2)),
};
this.adapter_.updateCssVariable(VAR_LEFT, `${this.unboundedCoords_.left}px`);
this.adapter_.updateCssVariable(VAR_TOP, `${this.unboundedCoords_.top}px`);
}
}
/** @param {boolean} unbounded */
setUnbounded(unbounded) {
const {UNBOUNDED} = foundation_MDCRippleFoundation.cssClasses;
if (unbounded) {
this.adapter_.addClass(UNBOUNDED);
} else {
this.adapter_.removeClass(UNBOUNDED);
}
}
handleFocus() {
requestAnimationFrame(() =>
this.adapter_.addClass(foundation_MDCRippleFoundation.cssClasses.BG_FOCUSED));
}
handleBlur() {
requestAnimationFrame(() =>
this.adapter_.removeClass(foundation_MDCRippleFoundation.cssClasses.BG_FOCUSED));
}
}
/* harmony default export */ var ripple_foundation = (foundation_MDCRippleFoundation);
// CONCATENATED MODULE: ./node_modules/@material/ripple/index.js
/**
* @license
* Copyright 2016 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* @extends MDCComponent<!MDCRippleFoundation>
*/
class ripple_MDCRipple extends component["a" /* default */] {
/** @param {...?} args */
constructor(...args) {
super(...args);
/** @type {boolean} */
this.disabled = false;
/** @private {boolean} */
this.unbounded_;
}
/**
* @param {!Element} root
* @param {{isUnbounded: (boolean|undefined)}=} options
* @return {!MDCRipple}
*/
static attachTo(root, {isUnbounded = undefined} = {}) {
const ripple = new ripple_MDCRipple(root);
// Only override unbounded behavior if option is explicitly specified
if (isUnbounded !== undefined) {
ripple.unbounded = /** @type {boolean} */ (isUnbounded);
}
return ripple;
}
/**
* @param {!RippleCapableSurface} instance
* @return {!MDCRippleAdapter}
*/
static createAdapter(instance) {
const MATCHES = getMatchesProperty(HTMLElement.prototype);
return {
browserSupportsCssVars: () => supportsCssVariables(window),
isUnbounded: () => instance.unbounded,
isSurfaceActive: () => instance.root_[MATCHES](':active'),
isSurfaceDisabled: () => instance.disabled,
addClass: (className) => instance.root_.classList.add(className),
removeClass: (className) => instance.root_.classList.remove(className),
containsEventTarget: (target) => instance.root_.contains(target),
registerInteractionHandler: (evtType, handler) =>
instance.root_.addEventListener(evtType, handler, applyPassive()),
deregisterInteractionHandler: (evtType, handler) =>
instance.root_.removeEventListener(evtType, handler, applyPassive()),
registerDocumentInteractionHandler: (evtType, handler) =>
document.documentElement.addEventListener(evtType, handler, applyPassive()),
deregisterDocumentInteractionHandler: (evtType, handler) =>
document.documentElement.removeEventListener(evtType, handler, applyPassive()),
registerResizeHandler: (handler) => window.addEventListener('resize', handler),
deregisterResizeHandler: (handler) => window.removeEventListener('resize', handler),
updateCssVariable: (varName, value) => instance.root_.style.setProperty(varName, value),
computeBoundingRect: () => instance.root_.getBoundingClientRect(),
getWindowPageOffset: () => ({x: window.pageXOffset, y: window.pageYOffset}),
};
}
/** @return {boolean} */
get unbounded() {
return this.unbounded_;
}
/** @param {boolean} unbounded */
set unbounded(unbounded) {
this.unbounded_ = Boolean(unbounded);
this.setUnbounded_();
}
/**
* Closure Compiler throws an access control error when directly accessing a
* protected or private property inside a getter/setter, like unbounded above.
* By accessing the protected property inside a method, we solve that problem.
* That's why this function exists.
* @private
*/
setUnbounded_() {
this.foundation_.setUnbounded(this.unbounded_);
}
activate() {
this.foundation_.activate();
}
deactivate() {
this.foundation_.deactivate();
}
layout() {
this.foundation_.layout();
}
/**
* @return {!MDCRippleFoundation}
* @override
*/
getDefaultFoundation() {
return new ripple_foundation(ripple_MDCRipple.createAdapter(this));
}
/** @override */
initialSyncWithDOM() {
this.unbounded = 'mdcRippleIsUnbounded' in this.root_.dataset;
}
}
/**
* See Material Design spec for more details on when to use ripples.
* https://material.io/guidelines/motion/choreography.html#choreography-creation
* @record
*/
class RippleCapableSurface {}
/** @protected {!Element} */
RippleCapableSurface.prototype.root_;
/**
* Whether or not the ripple bleeds out of the bounds of the element.
* @type {boolean|undefined}
*/
RippleCapableSurface.prototype.unbounded;
/**
* Whether or not the ripple is attached to a disabled component.
* @type {boolean|undefined}
*/
RippleCapableSurface.prototype.disabled;
/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// This file cannot contain Webpack-resolved imports (e.g. "~src/foo").
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.YT_LOCATION_CHANGE_EVENT = exports.APP_ROOT_ID = exports.HOSTNAME = exports.NAME = void 0;
const userscript_1 = __importDefault(__webpack_require__(19));
exports.NAME = userscript_1.default.sitename;
exports.HOSTNAME = userscript_1.default.hostname;
exports.APP_ROOT_ID = userscript_1.default.id;
exports.YT_LOCATION_CHANGE_EVENT = 'yt-navigate-finish';
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(4);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.LinearProgress = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(5));
var _createClass2 = _interopRequireDefault(__webpack_require__(6));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(7));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(3));
var _get2 = _interopRequireDefault(__webpack_require__(20));
var _inherits2 = _interopRequireDefault(__webpack_require__(8));
var _linearProgress = __webpack_require__(72);
var _preact = __webpack_require__(0);
var _MaterialComponent2 = _interopRequireDefault(__webpack_require__(14));
var LinearProgress =
/*#__PURE__*/
function (_MaterialComponent) {
(0, _inherits2.default)(LinearProgress, _MaterialComponent);
function LinearProgress() {
var _this;
(0, _classCallCheck2.default)(this, LinearProgress);
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(LinearProgress).apply(this, arguments));
_this.componentName = 'linear-progress';
_this.mdcProps = ['reversed', 'indeterminate'];
_this.themeProps = ['primary', 'secondary'];
_this.mdcNotifyProps = ['progress'];
return _this;
}
(0, _createClass2.default)(LinearProgress, [{
key: "componentDidMount",
value: function componentDidMount() {
(0, _get2.default)((0, _getPrototypeOf2.default)(LinearProgress.prototype), "componentDidMount", this).call(this);
if (this.control) {
this.MDComponent = new _linearProgress.MDCLinearProgress(this.control);
this.MDComponent.determinate = !this.props.indeterminate;
this.MDComponent.reverse = !!this.props.reversed;
}
this.afterComponentDidMount();
}
}, {
key: "componentWillReceiveProps",
value: function componentWillReceiveProps(nextProps) {
(0, _get2.default)((0, _getPrototypeOf2.default)(LinearProgress.prototype), "componentWillReceiveProps", this).call(this, nextProps);
if (this.MDComponent) {
this.MDComponent.determinate = !this.props.indeterminate;
this.MDComponent.reverse = !!nextProps.reversed;
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
(0, _get2.default)((0, _getPrototypeOf2.default)(LinearProgress.prototype), "componentWillUnmount", this).call(this);
if (this.MDComponent) {
this.MDComponent.destroy();
}
}
}, {
key: "materialDom",
value: function materialDom(props) {
// TODO: Fix theme props
return (0, _preact.h)("div", Object.assign({
role: "progressbar"
}, props, {
ref: this.setControlRef
}), (0, _preact.h)("div", {
className: "mdc-linear-progress__buffering-dots"
}), (0, _preact.h)("div", {
className: "mdc-linear-progress__buffer"
}), (0, _preact.h)("div", {
className: "mdc-linear-progress__bar mdc-linear-progress__primary-bar"
}, (0, _preact.h)("span", {
className: "mdc-linear-progress__bar-inner"
})), (0, _preact.h)("div", {
className: "mdc-linear-progress__bar mdc-linear-progress__secondary-bar"
}, (0, _preact.h)("span", {
className: "mdc-linear-progress__bar-inner"
})));
}
}]);
return LinearProgress;
}(_MaterialComponent2.default);
exports.LinearProgress = LinearProgress;
var _default = LinearProgress;
exports.default = _default;
//# sourceMappingURL=index.js.map
/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var constants;
(function (constants) {
constants.typeOfFunction = 'function';
constants.boolTrue = true;
})(constants || (constants = {}));
function bind(target, propertyKey, descriptor) {
if (!descriptor || (typeof descriptor.value !== constants.typeOfFunction)) {
throw new TypeError("Only methods can be decorated with @bind. <" + propertyKey + "> is not a method!");
}
return {
configurable: constants.boolTrue,
get: function () {
var bound = descriptor.value.bind(this);
// Credits to https://github.com/andreypopp/autobind-decorator for memoizing the result of bind against a symbol on the instance.
Object.defineProperty(this, propertyKey, {
value: bound,
configurable: constants.boolTrue,
writable: constants.boolTrue
});
return bound;
}
};
}
exports.bind = bind;
exports.default = bind;
/***/ }),
/* 26 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(4);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.IconButton = exports.Icon = void 0;
var _get2 = _interopRequireDefault(__webpack_require__(20));
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(5));
var _createClass2 = _interopRequireDefault(__webpack_require__(6));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(7));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(3));
var _inherits2 = _interopRequireDefault(__webpack_require__(8));
var _iconButton = __webpack_require__(74);
var _preact = __webpack_require__(0);
var _MaterialComponent3 = _interopRequireDefault(__webpack_require__(14));
var Icon =
/*#__PURE__*/
function (_MaterialComponent) {
(0, _inherits2.default)(Icon, _MaterialComponent);
function Icon() {
var _this;
(0, _classCallCheck2.default)(this, Icon);
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Icon).apply(this, arguments));
_this.componentName = 'icon-button__icon';
_this.mdcProps = ['on'];
return _this;
}
(0, _createClass2.default)(Icon, [{
key: "materialDom",
value: function materialDom(props) {
var IconElement = props.element || 'i';
return (0, _preact.h)(IconElement, Object.assign({
class: "material-icons"
}, props), props.children);
}
}]);
return Icon;
}(_MaterialComponent3.default);
exports.Icon = Icon;
var IconButton =
/*#__PURE__*/
function (_MaterialComponent2) {
(0, _inherits2.default)(IconButton, _MaterialComponent2);
function IconButton() {
var _this2;
(0, _classCallCheck2.default)(this, IconButton);
_this2 = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(IconButton).apply(this, arguments));
_this2.componentName = 'icon-button';
_this2.mdcProps = [];
return _this2;
}
(0, _createClass2.default)(IconButton, [{
key: "componentDidMount",
value: function componentDidMount() {
(0, _get2.default)((0, _getPrototypeOf2.default)(IconButton.prototype), "componentDidMount", this).call(this);
this.MDComponent = new _iconButton.MDCIconButtonToggle(this.control);
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
(0, _get2.default)((0, _getPrototypeOf2.default)(IconButton.prototype), "componentWillUnmount", this).call(this);
if (this.MDComponent) {
this.MDComponent.destroy();
}
}
}, {
key: "materialDom",
value: function materialDom(props) {
return (0, _preact.h)("button", Object.assign({
ref: this.setControlRef
}, props), this.props.children);
}
}]);
return IconButton;
}(_MaterialComponent3.default);
exports.IconButton = IconButton;
var default_1 =
/*#__PURE__*/
function (_IconButton) {
(0, _inherits2.default)(default_1, _IconButton);
function default_1() {
(0, _classCallCheck2.default)(this, default_1);
return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(default_1).apply(this, arguments));
}
return default_1;
}(IconButton);
exports.default = default_1;
default_1.Icon = Icon;
//# sourceMappingURL=index.js.map
/***/ }),
/* 27 */
/***/ (function(module, exports) {
var charenc = {
// UTF-8 encoding
utf8: {
// Convert a string to a byte array
stringToBytes: function(str) {
return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
},
// Convert a byte array to a string
bytesToString: function(bytes) {
return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
}
},
// Binary encoding
bin: {
// Convert a string to a byte array
stringToBytes: function(str) {
for (var bytes = [], i = 0; i < str.length; i++)
bytes.push(str.charCodeAt(i) & 0xFF);
return bytes;
},
// Convert a byte array to a string
bytesToString: function(bytes) {
for (var str = [], i = 0; i < bytes.length; i++)
str.push(String.fromCharCode(bytes[i]));
return str.join('');
}
}
};
module.exports = charenc;
/***/ }),
/* 28 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const compose_1 = __webpack_require__(75);
const userscripter_1 = __webpack_require__(71);
const CONFIG = __importStar(__webpack_require__(29));
const operations_1 = __importDefault(__webpack_require__(30));
const SITE = __importStar(__webpack_require__(23));
const stylesheets_1 = __importDefault(__webpack_require__(64));
const userscript_1 = __importDefault(__webpack_require__(19));
const describeFailure = userscripter_1.errors.failureDescriber({
siteName: SITE.NAME,
extensionName: userscript_1.default.name,
location: document.location,
});
userscripter_1.userscripter.run({
id: userscript_1.default.id,
name: userscript_1.default.name,
initialAction: () => userscripter_1.log.log(`${userscript_1.default.name} ${userscript_1.default.version}`),
stylesheets: stylesheets_1.default,
operationsPlan: {
operations: operations_1.default,
interval: CONFIG.OPERATIONS_INTERVAL,
tryUntil: userscripter_1.environment.DOMCONTENTLOADED,
extraTries: CONFIG.OPERATIONS_EXTRA_TRIES,
// eslint-disable-next-line unicorn/no-array-for-each
handleFailures: (failures) => failures.forEach((0, compose_1.compose)(userscripter_1.log.error, describeFailure)),
},
});
/***/ }),
/* 29 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// This file cannot contain Webpack-resolved imports (e.g. "~src/foo").
Object.defineProperty(exports, "__esModule", { value: true });
exports.OPERATIONS_EXTRA_TRIES = exports.OPERATIONS_INTERVAL = void 0;
exports.OPERATIONS_INTERVAL = 200; // ms
exports.OPERATIONS_EXTRA_TRIES = 3;
/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const operations_1 = __webpack_require__(17);
const environment_1 = __webpack_require__(18);
const js_cookie_1 = __webpack_require__(31);
const add_location_change_event_hook_1 = __importDefault(__webpack_require__(32));
const is_on_playlist_page_1 = __importDefault(__webpack_require__(34));
const selectors_1 = __webpack_require__(10);
const append_app_to_dom_1 = __importDefault(__webpack_require__(35));
function mainWrapper() {
const url = new URL(window.location.href);
const playlistName = url.searchParams.get('list');
/* eslint-disable no-underscore-dangle */
const config = {
DEVICE: window.ytcfg.data_.DEVICE,
DELEGATED_SESSION_ID: window.ytcfg.data_.DELEGATED_SESSION_ID,
ID_TOKEN: window.ytcfg.data_.ID_TOKEN,
INNERTUBE_API_KEY: window.ytcfg.data_.INNERTUBE_API_KEY,
INNERTUBE_CONTEXT_CLIENT_NAME: window.ytcfg.data_.INNERTUBE_CONTEXT_CLIENT_NAME,
INNERTUBE_CONTEXT_CLIENT_VERSION: window.ytcfg.data_.INNERTUBE_CONTEXT_CLIENT_VERSION,
PAGE_BUILD_LABEL: window.ytcfg.data_.PAGE_BUILD_LABEL,
PAGE_CL: window.ytcfg.data_.PAGE_CL,
VISITOR_DATA: window.ytcfg.data_.VISITOR_DATA,
SAPISID: (0, js_cookie_1.get)('SAPISID'),
ORIGIN_URL: new URL(document.URL).origin,
};
document.addEventListener('yt-action', (event) => {
if (event.detail.actionName === 'yt-service-request') {
(0, append_app_to_dom_1.default)(config, playlistName, selectors_1.XPATH.APP_RENDER_ROOT);
}
});
}
// Called every time app navigation occurs
function protectedMainWrapper() {
if ((0, is_on_playlist_page_1.default)(window)) {
mainWrapper();
}
}
const OPERATIONS = [
(0, operations_1.operation)({
description: 'run main if the script start on playlist page',
condition: is_on_playlist_page_1.default,
action: () => {
mainWrapper();
},
deferUntil: environment_1.DOMCONTENTLOADED,
}),
(0, operations_1.operation)({
description: 'init yt-navigate-finish hooks to watch in-app navigation',
condition: environment_1.ALWAYS,
action: () => {
(0, add_location_change_event_hook_1.default)(protectedMainWrapper);
},
deferUntil: environment_1.DOMCONTENTLOADED,
}),
];
exports.default = OPERATIONS;
/***/ }),
/* 31 */
/***/ (function(module, exports, __webpack_require__) {
/*! js-cookie v3.0.5 | MIT */
;
(function (global, factory) {
true ? module.exports = factory() :
undefined;
})(this, (function () { 'use strict';
/* eslint-disable no-var */
function assign (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
target[key] = source[key];
}
}
return target
}
/* eslint-enable no-var */
/* eslint-disable no-var */
var defaultConverter = {
read: function (value) {
if (value[0] === '"') {
value = value.slice(1, -1);
}
return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
},
write: function (value) {
return encodeURIComponent(value).replace(
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
decodeURIComponent
)
}
};
/* eslint-enable no-var */
/* eslint-disable no-var */
function init (converter, defaultAttributes) {
function set (name, value, attributes) {
if (typeof document === 'undefined') {
return
}
attributes = assign({}, defaultAttributes, attributes);
if (typeof attributes.expires === 'number') {
attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
}
if (attributes.expires) {
attributes.expires = attributes.expires.toUTCString();
}
name = encodeURIComponent(name)
.replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
.replace(/[()]/g, escape);
var stringifiedAttributes = '';
for (var attributeName in attributes) {
if (!attributes[attributeName]) {
continue
}
stringifiedAttributes += '; ' + attributeName;
if (attributes[attributeName] === true) {
continue
}
// Considers RFC 6265 section 5.2:
// ...
// 3. If the remaining unparsed-attributes contains a %x3B (";")
// character:
// Consume the characters of the unparsed-attributes up to,
// not including, the first %x3B (";") character.
// ...
stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
}
return (document.cookie =
name + '=' + converter.write(value, name) + stringifiedAttributes)
}
function get (name) {
if (typeof document === 'undefined' || (arguments.length && !name)) {
return
}
// To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all.
var cookies = document.cookie ? document.cookie.split('; ') : [];
var jar = {};
for (var i = 0; i < cookies.length; i++) {
var parts = cookies[i].split('=');
var value = parts.slice(1).join('=');
try {
var found = decodeURIComponent(parts[0]);
jar[found] = converter.read(value, found);
if (name === found) {
break
}
} catch (e) {}
}
return name ? jar[name] : jar
}
return Object.create(
{
set,
get,
remove: function (name, attributes) {
set(
name,
'',
assign({}, attributes, {
expires: -1
})
);
},
withAttributes: function (attributes) {
return init(this.converter, assign({}, this.attributes, attributes))
},
withConverter: function (converter) {
return init(assign({}, this.converter, converter), this.attributes)
}
},
{
attributes: { value: Object.freeze(defaultAttributes) },
converter: { value: Object.freeze(converter) }
}
)
}
var api = init(defaultConverter, { path: '/' });
/* eslint-enable no-var */
return api;
}));
/***/ }),
/* 32 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const site_1 = __webpack_require__(23);
// Add location change event hooks
function addLocationChangeEventHooks(callback) {
window.addEventListener(site_1.YT_LOCATION_CHANGE_EVENT, callback);
}
exports.default = addLocationChangeEventHooks;
/***/ }),
/* 33 */
/***/ (function(module) {
module.exports = JSON.parse("{\"name\":\"yt-playlists-delete-enhancer\",\"description\":\"Add a button to remove videos watched with more than X percent from watch later playlist.\",\"repository\":{\"type\":\"git\",\"url\":\"git@github.com:avallete/yt-playlists-delete-enhancer.git\"},\"bugs\":{\"url\":\"https://github.com/avallete/yt-playlists-delete-enhancer/issues\"},\"version\":\"1.7.2\",\"homepage\":\"https://github.com/avallete/yt-playlists-delete-enhancer#readme\",\"license\":\"MIT\",\"author\":\"Andrew Valleteau <avallete@student.42.fr>\"}");
/***/ }),
/* 34 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const PLAYLIST_URL_PATHNAME = '/playlist';
const isOnPlaylistPage = (window_) => {
const url = new URL(window_.location.href);
return url.pathname === PLAYLIST_URL_PATHNAME;
};
exports.default = isOnPlaylistPage;
/***/ }),
/* 35 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = __webpack_require__(11);
const preact_1 = __webpack_require__(0);
const get_elements_by_xpath_1 = __importDefault(__webpack_require__(12));
const remove_video_enhancer_app_1 = __importDefault(__webpack_require__(36));
const userscript_1 = __importDefault(__webpack_require__(19));
function appendAppToDom(config, playlistName, xpathRoot) {
const existingElement = document.querySelector(`#${userscript_1.default.id}${playlistName}`);
if (!existingElement) {
const elementToAppendTo = (0, get_elements_by_xpath_1.default)(xpathRoot)
// get only currently visibles elements because youtube hide elements instead of removing them from the DOM
.find((element) => element.offsetHeight > 0 || element.offsetWidth > 0);
// Use Date.now() to force re-mount component to trigger playlist fetch after yt-navigate-finish events
// See: #62
const AppContainer = ((0, jsx_runtime_1.jsx)("div", { id: `${userscript_1.default.id}${playlistName}`, children: (0, jsx_runtime_1.jsx)(remove_video_enhancer_app_1.default, { config: config, playlistName: playlistName }, Date.now()) }, Date.now()));
if (elementToAppendTo) {
(0, preact_1.render)(AppContainer, elementToAppendTo, elementToAppendTo.lastElementChild);
}
else {
throw new Error(`Cannot found ${xpathRoot} in the DOM`);
}
}
}
exports.default = appendAppToDom;
/***/ }),
/* 36 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = __webpack_require__(11);
const preact_1 = __webpack_require__(0);
const LinearProgress_1 = __importDefault(__webpack_require__(24));
const remove_video_enhancer_container_1 = __importDefault(__webpack_require__(42));
const yt_api_1 = __webpack_require__(49);
const partition_1 = __importDefault(__webpack_require__(58));
const remove_watched_from_playlist_ui_1 = __importDefault(__webpack_require__(59));
const remove_videos_from_playlist_ui_1 = __importDefault(__webpack_require__(60));
class RemoveVideoEnhancerApp extends preact_1.Component {
constructor(properties) {
super(properties);
this.state = {};
this.removeVideoWatchedPercentHandler = this.removeVideoWatchedPercentHandler.bind(this);
this.resetVideoHandler = this.resetVideoHandler.bind(this);
this.removeVideoHandler = this.removeVideoHandler.bind(this);
}
componentDidMount() {
return __awaiter(this, void 0, void 0, function* () {
try {
const playlist = yield (0, yt_api_1.fetchAllPlaylistContent)(this.props.config, this.props.playlistName);
this.setState({ playlist });
}
catch (error) {
this.setState({ errorMessages: [error.message] });
}
});
}
resetVideoHandler(videoId) {
return __awaiter(this, void 0, void 0, function* () {
try {
yield (0, yt_api_1.removeWatchHistoryForVideo)(this.props.config, videoId);
(0, remove_watched_from_playlist_ui_1.default)(videoId);
const { playlist } = this.state;
if (playlist) {
for (const v of playlist.continuations[0].videos) {
if (v.videoId === videoId) {
v.percentDurationWatched = 0;
}
}
}
else {
throw new Error('Playlist not found');
}
}
catch (error) {
this.setState(Object.assign(Object.assign({}, this.state), { errorMessages: [error.message] }));
}
});
}
removeVideoWatchedPercentHandler(watchTimeValue) {
return __awaiter(this, void 0, void 0, function* () {
const { playlist } = this.state;
if (playlist && playlist.continuations[0].videos.length > 0) {
const [toDeleteVideos, toKeepVideos] = (0, partition_1.default)(playlist.continuations[0].videos, (v) => v.percentDurationWatched >= watchTimeValue);
if (toDeleteVideos.length > 0) {
try {
yield (0, yt_api_1.removeVideosFromPlaylist)(this.props.config, playlist === null || playlist === void 0 ? void 0 : playlist.playlistId, toDeleteVideos);
playlist.continuations[0].videos = toKeepVideos;
(0, remove_videos_from_playlist_ui_1.default)(toDeleteVideos);
this.setState(Object.assign(Object.assign({}, this.state), { playlist }));
}
catch (error) {
this.setState(Object.assign(Object.assign({}, this.state), { errorMessages: [error.message] }));
}
}
}
});
}
removeVideoHandler(videoId) {
return __awaiter(this, void 0, void 0, function* () {
const { playlist } = this.state;
if (playlist && playlist.continuations[0].videos.length > 0) {
const [toDeleteVideos, toKeepVideos] = (0, partition_1.default)(playlist.continuations[0].videos, (v) => v.videoId === videoId);
if (toDeleteVideos.length > 0) {
try {
yield (0, yt_api_1.removeVideosFromPlaylist)(this.props.config, playlist === null || playlist === void 0 ? void 0 : playlist.playlistId, toDeleteVideos);
playlist.continuations[0].videos = toKeepVideos;
(0, remove_videos_from_playlist_ui_1.default)(toDeleteVideos);
this.setState(Object.assign(Object.assign({}, this.state), { playlist }));
}
catch (error) {
this.setState(Object.assign(Object.assign({}, this.state), { errorMessages: [error.message] }));
}
}
}
});
}
shouldComponentUpdate(nextProperties) {
var _a, _b;
return nextProperties.playlistName !== ((_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.playlist) === null || _b === void 0 ? void 0 : _b.playlistId);
}
componentDidUpdate(previousProperties) {
return __awaiter(this, void 0, void 0, function* () {
if (previousProperties.playlistName !== this.props.playlistName) {
try {
this.setState({ playlist: undefined, errorMessages: undefined });
const playlist = yield (0, yt_api_1.fetchAllPlaylistContent)(this.props.config, this.props.playlistName);
this.setState({ playlist });
}
catch (error) {
this.setState({ errorMessages: [error.message] });
}
}
});
}
render() {
var _a, _b, _c, _d;
if ((_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.errorMessages) === null || _b === void 0 ? void 0 : _b.length) {
return (0, jsx_runtime_1.jsx)("div", { children: (_c = this.state) === null || _c === void 0 ? void 0 : _c.errorMessages.join(' ') });
}
if ((_d = this.state) === null || _d === void 0 ? void 0 : _d.playlist) {
if (this.state.playlist.isEditable) {
return ((0, jsx_runtime_1.jsx)(remove_video_enhancer_container_1.default, { removeVideoWatchedPercentHandler: this.removeVideoWatchedPercentHandler, resetVideoHandler: this.resetVideoHandler, removeVideoHandler: this.removeVideoHandler }));
}
return (0, jsx_runtime_1.jsx)("div", { children: "Playlist isn't editable" });
}
return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(LinearProgress_1.default, { indeterminate: true }) }));
}
}
exports.default = RemoveVideoEnhancerApp;
/***/ }),
/* 37 */
/***/ (function(module, exports, __webpack_require__) {
var _typeof = __webpack_require__(13)["default"];
var toPrimitive = __webpack_require__(38);
function toPropertyKey(t) {
var i = toPrimitive(t, "string");
return "symbol" == _typeof(i) ? i : i + "";
}
module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/* 38 */
/***/ (function(module, exports, __webpack_require__) {
var _typeof = __webpack_require__(13)["default"];
function toPrimitive(t, r) {
if ("object" != _typeof(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/* 39 */
/***/ (function(module, exports) {
function _assertThisInitialized(e) {
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return e;
}
module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/* 40 */
/***/ (function(module, exports, __webpack_require__) {
var getPrototypeOf = __webpack_require__(3);
function _superPropBase(t, o) {
for (; !{}.hasOwnProperty.call(t, o) && null !== (t = getPrototypeOf(t)););
return t;
}
module.exports = _superPropBase, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/* 41 */
/***/ (function(module, exports) {
function _setPrototypeOf(t, e) {
return (module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
return t.__proto__ = e, t;
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _setPrototypeOf(t, e);
}
module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/* 42 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.REMOVE_BUTTON_ALT = exports.INPUT_ALT = void 0;
const jsx_runtime_1 = __webpack_require__(11);
const preact_1 = __webpack_require__(0);
const hooks_1 = __webpack_require__(21);
const Button_1 = __importDefault(__webpack_require__(43));
const Slider_1 = __importDefault(__webpack_require__(46));
const LinearProgress_1 = __importDefault(__webpack_require__(24));
const get_elements_by_xpath_1 = __importDefault(__webpack_require__(12));
const selectors_1 = __webpack_require__(10);
const video_item_quick_reset_button_1 = __importDefault(__webpack_require__(47));
const video_item_quick_delete_button_1 = __importDefault(__webpack_require__(48));
exports.INPUT_ALT = 'Input number between 0 and 100 to choose under how much percentage of watched time a video should be removed';
exports.REMOVE_BUTTON_ALT = 'Remove button to start removing videos';
function validate(value) {
const numberValue = Number(value);
return !!(Number.isSafeInteger(numberValue) && numberValue >= 0 && numberValue <= 100);
}
function RemoveVideoEnhancerContainer({ removeVideoWatchedPercentHandler, initialValue = 100, resetVideoHandler, removeVideoHandler, }) {
const [inputValue, setValue] = (0, hooks_1.useState)(initialValue);
const [isReadyToRemove, setIsReadyToRemove] = (0, hooks_1.useState)(true);
function onChange({ detail }) {
// eslint-disable-next-line no-underscore-dangle
const value = detail.foundation_.value_;
if (validate(value)) {
setValue(value);
}
}
const removeVideo = (0, hooks_1.useCallback)((videoId) => __awaiter(this, void 0, void 0, function* () {
yield removeVideoHandler(videoId);
}), []);
const resetVideo = (0, hooks_1.useCallback)((videoId) => __awaiter(this, void 0, void 0, function* () {
yield resetVideoHandler(videoId);
}), []);
(0, hooks_1.useEffect)(() => {
var _a, _b;
const menus = (0, get_elements_by_xpath_1.default)(selectors_1.XPATH.YT_PLAYLIST_VIDEO_MENU);
for (const element of menus) {
element.style.display = 'inline-flex';
(0, preact_1.render)([
(0, preact_1.h)(video_item_quick_reset_button_1.default, {
// @ts-ignore element.data does not exists on types
videoId: (_a = element.parentElement) === null || _a === void 0 ? void 0 : _a.data.videoId,
onClick: resetVideo,
}),
(0, preact_1.h)(video_item_quick_delete_button_1.default, {
// @ts-ignore element.data does not exists on types
videoId: (_b = element.parentElement) === null || _b === void 0 ? void 0 : _b.data.videoId,
onClick: removeVideo,
}),
], element);
}
const sidebar = (0, get_elements_by_xpath_1.default)(selectors_1.XPATH.YT_SIDEBAR_CONTAINER);
if (sidebar.length > 0) {
sidebar[0].style.overflow = 'visible';
}
}, []);
return ((0, jsx_runtime_1.jsx)("div", { className: 'style-scope ytd-playlist-sidebar-renderer', children: (0, jsx_runtime_1.jsxs)("div", { className: 'style-scope ytd-menu-service-item-renderer', role: 'option', "aria-disabled": 'false', children: [(0, jsx_runtime_1.jsxs)("p", { children: ["Remove all videos that have been watched to at least ", inputValue, "%"] }), (0, jsx_runtime_1.jsx)(Slider_1.default, { min: 0, max: 100, step: 5, value: inputValue, onChange: onChange, alt: exports.INPUT_ALT, discrete: true }), (0, jsx_runtime_1.jsxs)(Button_1.default, { raised: true, ripple: true, secondary: true, alt: exports.REMOVE_BUTTON_ALT, disabled: !isReadyToRemove, onClick: () => __awaiter(this, void 0, void 0, function* () {
setIsReadyToRemove(false);
yield removeVideoWatchedPercentHandler(inputValue);
setIsReadyToRemove(true);
}), children: [!isReadyToRemove && (0, jsx_runtime_1.jsx)(LinearProgress_1.default, { indeterminate: true }), isReadyToRemove && (0, jsx_runtime_1.jsx)("div", { children: "Remove!" })] })] }) }));
}
exports.default = RemoveVideoEnhancerContainer;
/***/ }),
/* 43 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(4);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.Button = exports.ButtonIcon = void 0;
var _createClass2 = _interopRequireDefault(__webpack_require__(6));
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(5));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(7));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(3));
var _inherits2 = _interopRequireDefault(__webpack_require__(8));
var _preact = __webpack_require__(0);
var _MaterialComponent2 = _interopRequireDefault(__webpack_require__(14));
var _Icon2 = _interopRequireDefault(__webpack_require__(44));
var _generateThemeClass = _interopRequireDefault(__webpack_require__(45));
var ButtonIcon =
/*#__PURE__*/
function (_Icon) {
(0, _inherits2.default)(ButtonIcon, _Icon);
function ButtonIcon() {
var _this;
(0, _classCallCheck2.default)(this, ButtonIcon);
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(ButtonIcon).apply(this, arguments));
_this.componentName = 'button__icon';
return _this;
}
return ButtonIcon;
}(_Icon2.default);
exports.ButtonIcon = ButtonIcon;
var Button =
/*#__PURE__*/
function (_MaterialComponent) {
(0, _inherits2.default)(Button, _MaterialComponent);
function Button() {
var _this2;
(0, _classCallCheck2.default)(this, Button);
_this2 = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Button).apply(this, arguments));
_this2.componentName = 'button';
_this2.mdcProps = ['dense', 'raised', 'unelevated', 'outlined'];
_this2.themeProps = ['primary', 'secondary'];
return _this2;
}
(0, _createClass2.default)(Button, [{
key: "materialDom",
value: function materialDom(props) {
var ButtonElement = props.href ? 'a' : 'button';
var className = '';
this.themeProps.forEach(function (themeProp) {
if (themeProp in props && props[themeProp] !== false) {
className += (0, _generateThemeClass.default)(themeProp) + ' ';
}
});
return (0, _preact.h)(ButtonElement, Object.assign({
ref: this.setControlRef
}, props, {
className: className
}), this.props.children);
}
}]);
return Button;
}(_MaterialComponent2.default);
exports.Button = Button;
var default_1 =
/*#__PURE__*/
function (_Button) {
(0, _inherits2.default)(default_1, _Button);
function default_1() {
(0, _classCallCheck2.default)(this, default_1);
return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(default_1).apply(this, arguments));
}
return default_1;
}(Button);
exports.default = default_1;
default_1.Icon = ButtonIcon;
//# sourceMappingURL=index.js.map
/***/ }),
/* 44 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(4);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.Icon = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(5));
var _createClass2 = _interopRequireDefault(__webpack_require__(6));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(7));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(3));
var _inherits2 = _interopRequireDefault(__webpack_require__(8));
var _preact = __webpack_require__(0);
var _MaterialComponent2 = _interopRequireDefault(__webpack_require__(14));
var Icon =
/*#__PURE__*/
function (_MaterialComponent) {
(0, _inherits2.default)(Icon, _MaterialComponent);
function Icon() {
var _this;
(0, _classCallCheck2.default)(this, Icon);
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Icon).apply(this, arguments));
_this.componentName = 'icon';
_this.mdcProps = [];
return _this;
}
(0, _createClass2.default)(Icon, [{
key: "materialDom",
value: function materialDom(props) {
var classes = ['material-icons']; // CardActionIcon sends className
if (props.className) {
classes.push(props.className);
}
return (0, _preact.h)("i", Object.assign({}, props, {
className: classes.join(' ')
}), props.children);
}
}]);
return Icon;
}(_MaterialComponent2.default);
exports.Icon = Icon;
var _default = Icon;
exports.default = _default;
//# sourceMappingURL=index.js.map
/***/ }),
/* 45 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default(prop) {
return "mdc-theme--".concat(prop, "-bg");
}
//# sourceMappingURL=generateThemeClass.js.map
/***/ }),
/* 46 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(4);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.Slider = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(5));
var _createClass2 = _interopRequireDefault(__webpack_require__(6));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(7));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(3));
var _get2 = _interopRequireDefault(__webpack_require__(20));
var _inherits2 = _interopRequireDefault(__webpack_require__(8));
var _typeof2 = _interopRequireDefault(__webpack_require__(13));
var _slider = __webpack_require__(73);
var _bindDecorator = __webpack_require__(25);
var _preact = __webpack_require__(0);
var _MaterialComponent2 = _interopRequireDefault(__webpack_require__(14));
var __decorate = void 0 && (void 0).__decorate || function (decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if ((typeof Reflect === "undefined" ? "undefined" : (0, _typeof2.default)(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
}
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __rest = void 0 && (void 0).__rest || function (s, e) {
var t = {};
for (var p in s) {
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
}
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
var Slider =
/*#__PURE__*/
function (_MaterialComponent) {
(0, _inherits2.default)(Slider, _MaterialComponent);
function Slider() {
var _this;
(0, _classCallCheck2.default)(this, Slider);
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Slider).apply(this, arguments));
_this.componentName = 'slider';
_this.mdcProps = ['discrete'];
return _this;
}
(0, _createClass2.default)(Slider, [{
key: "componentDidMount",
value: function componentDidMount() {
(0, _get2.default)((0, _getPrototypeOf2.default)(Slider.prototype), "componentDidMount", this).call(this);
if (this.control) {
this.MDComponent = new _slider.MDCSlider(this.control);
this.MDComponent.listen('MDCSlider:change', this.onChange);
this.MDComponent.listen('MDCSlider:input', this.onInput);
}
this.setValue(this.props.value); // set initial value programatically because of error if min is greater than initial max
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
(0, _get2.default)((0, _getPrototypeOf2.default)(Slider.prototype), "componentWillUnmount", this).call(this);
if (this.MDComponent) {
this.MDComponent.unlisten('MDCSlider:change', this.onChange);
this.MDComponent.unlisten('MDCSlider:input', this.onInput);
this.MDComponent.destroy();
}
}
}, {
key: "getValue",
value: function getValue() {
if (this.MDComponent) {
return this.MDComponent.value;
}
}
}, {
key: "setValue",
value: function setValue(value) {
var _this$props = this.props,
_this$props$disabled = _this$props.disabled,
disabled = _this$props$disabled === void 0 ? false : _this$props$disabled,
_this$props$min = _this$props.min,
min = _this$props$min === void 0 ? 0 : _this$props$min,
_this$props$max = _this$props.max,
max = _this$props$max === void 0 ? 100 : _this$props$max,
step = _this$props.step;
if (this.MDComponent) {
if (min > this.MDComponent.max) {
this.MDComponent.max = max;
this.MDComponent.min = min;
} else {
this.MDComponent.min = min;
this.MDComponent.max = max;
}
if (value) {
this.MDComponent.value = value;
}
this.MDComponent.disabled = disabled;
if (step) {
this.MDComponent.step = step;
}
}
}
}, {
key: "onChange",
value: function onChange(e) {
if (this.props.onChange) {
this.props.onChange(e);
}
}
}, {
key: "onInput",
value: function onInput(e) {
if (this.props.onInput) {
this.props.onInput(e);
}
}
}, {
key: "materialDom",
value: function materialDom(allprops) {
var _allprops$tabindex = allprops.tabindex,
tabIndex = _allprops$tabindex === void 0 ? 0 : _allprops$tabindex,
props = __rest(allprops, ["tabindex"]);
this.setValue(allprops);
return (0, _preact.h)("div", Object.assign({
tabIndex: tabIndex,
role: "slider",
"aria-label": "Select Value",
ref: this.setControlRef
}, props), (0, _preact.h)("div", {
class: "mdc-slider__track-container"
}, (0, _preact.h)("div", {
class: "mdc-slider__track"
})), (0, _preact.h)("div", {
class: "mdc-slider__thumb-container"
}, props.discrete && (0, _preact.h)("div", {
class: "mdc-slider__pin"
}, (0, _preact.h)("span", {
class: "mdc-slider__pin-value-marker"
})), (0, _preact.h)("svg", {
class: "mdc-slider__thumb",
width: "21",
height: "21"
}, (0, _preact.h)("circle", {
cx: "10.5",
cy: "10.5",
r: "7.875"
})), (0, _preact.h)("div", {
class: "mdc-slider__focus-ring"
})));
}
}]);
return Slider;
}(_MaterialComponent2.default);
exports.Slider = Slider;
__decorate([_bindDecorator.bind], Slider.prototype, "onChange", null);
__decorate([_bindDecorator.bind], Slider.prototype, "onInput", null);
var _default = Slider;
exports.default = _default;
//# sourceMappingURL=index.js.map
/***/ }),
/* 47 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = __webpack_require__(11);
const hooks_1 = __webpack_require__(21);
const IconButton_1 = __importDefault(__webpack_require__(26));
function VideoItemQuickResetButton(properties) {
const [loading, setLoading] = (0, hooks_1.useState)(false);
return ((0, jsx_runtime_1.jsx)(IconButton_1.default
// we use this order -1 to avoid the button sometimes being render AFTER the row menu when swtiching between playlist
, {
// we use this order -1 to avoid the button sometimes being render AFTER the row menu when swtiching between playlist
style: { order: -1 }, onClick: () => __awaiter(this, void 0, void 0, function* () {
setLoading(true);
yield properties.onClick(properties.videoId);
setLoading(false);
}), disabled: loading, title: 'Mark as unwatched', children: (0, jsx_runtime_1.jsx)(IconButton_1.default.Icon, { style: { color: '#e10000' }, children: "refresh" }) }));
}
exports.default = VideoItemQuickResetButton;
/***/ }),
/* 48 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = __webpack_require__(11);
const hooks_1 = __webpack_require__(21);
const IconButton_1 = __importDefault(__webpack_require__(26));
function VideoItemQuickDeleteButton(properties) {
const [loading, setLoading] = (0, hooks_1.useState)(false);
return ((0, jsx_runtime_1.jsx)(IconButton_1.default
// we use this order -1 to avoid the button sometimes being render AFTER the row menu when swtiching between playlist
, {
// we use this order -1 to avoid the button sometimes being render AFTER the row menu when swtiching between playlist
style: { order: -1 }, onClick: () => __awaiter(this, void 0, void 0, function* () {
setLoading(true);
yield properties.onClick(properties.videoId);
setLoading(false);
}), disabled: loading, title: 'Remove video', children: (0, jsx_runtime_1.jsx)(IconButton_1.default.Icon, { style: { color: '#e10000' }, children: "delete" }) }));
}
exports.default = VideoItemQuickDeleteButton;
/***/ }),
/* 49 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeVideosFromPlaylist = exports.removeWatchHistoryForVideo = exports.fetchAllPlaylistContent = void 0;
const sha1_1 = __importDefault(__webpack_require__(50));
const errors_1 = __webpack_require__(57);
const API_BASE_URL = new URL('https://www.youtube.com/youtubei/v1');
const API_GET_PLAYLIST_VIDEOS_URL = new URL(`${API_BASE_URL}/browse`);
const API_EDIT_PLAYLIST_VIDEOS_URL = new URL(`${API_GET_PLAYLIST_VIDEOS_URL}/edit_playlist`);
const BASE_REFERER_URL = new URL('https://www.youtube.com/playlist');
const API_V1_REQUIRED_HEADERS = [
'Content-Type',
'Authorization',
'X-Goog-Visitor-Id',
'X-YouTube-Client-Name',
'X-YouTube-Client-Version',
'X-Goog-AuthUser',
'X-Goog-PageId',
];
const API_REQUIRED_HEADERS = [
'X-YouTube-Client-Name',
'X-YouTube-Client-Version',
'X-YouTube-Device',
'X-YouTube-Identity-Token',
'X-YouTube-Page-CL',
'X-YouTube-Page-Label',
];
function generateSAPISIDHASH(origin, sapisid, date = new Date()) {
const roundedTimestamp = Math.floor(date.getTime() / 1000);
// deepcode ignore InsecureHash: we need to replicate youtube webapp behavior
// eslint-disable-next-line sonarjs/no-nested-template-literals
return `${roundedTimestamp}_${(0, sha1_1.default)(`${roundedTimestamp} ${sapisid} ${origin}`)}`;
}
function generateRequestHeaders(config, headerKeys = []) {
const allHeaders = {
'Content-Type': 'application/json',
'X-Goog-Visitor-Id': config.VISITOR_DATA,
'X-YouTube-Client-Name': config.INNERTUBE_CONTEXT_CLIENT_NAME,
'X-YouTube-Client-Version': config.INNERTUBE_CONTEXT_CLIENT_VERSION,
'X-YouTube-Device': config.DEVICE,
'X-YouTube-Identity-Token': config.ID_TOKEN,
'X-YouTube-Page-CL': config.PAGE_CL,
'X-YouTube-Page-Label': config.PAGE_BUILD_LABEL,
// Those two are mandatory together to successfully perform request
'X-Goog-AuthUser': '1',
'X-Goog-PageId': config.DELEGATED_SESSION_ID,
Authorization: `SAPISIDHASH ${generateSAPISIDHASH(config.ORIGIN_URL, config.SAPISID)}`,
};
const result = {};
// Add each wanted header key to result headers
for (const headerKey of headerKeys) {
result[headerKey] = allHeaders[headerKey];
}
return result;
}
function extractPlaylistVideoListRendererContents(playlistVideoListContents) {
return playlistVideoListContents.map((item) => {
var _a;
return {
videoId: item.playlistVideoRenderer.videoId,
percentDurationWatched: ((_a = item.playlistVideoRenderer.thumbnailOverlays[1].thumbnailOverlayResumePlaybackRenderer) === null || _a === void 0 ? void 0 : _a.percentDurationWatched) || 0,
};
});
}
function extractPlaylistContinuation(playlistContents) {
// ContinuationToken should be in the last item of the playlist contents
const lastItem = playlistContents.at(-1);
if (lastItem && lastItem.continuationItemRenderer) {
// Remove last item from playlist contents since it contain continuationItem
playlistContents.pop();
return {
videos: extractPlaylistVideoListRendererContents(playlistContents),
continuationToken: lastItem.continuationItemRenderer.continuationEndpoint.continuationCommand.token,
};
}
return {
videos: extractPlaylistVideoListRendererContents(playlistContents),
};
}
function fetchPlaylistInitialData(config, playlistName) {
return __awaiter(this, void 0, void 0, function* () {
const url = new URL(`${BASE_REFERER_URL}`);
const headers = generateRequestHeaders(config, API_REQUIRED_HEADERS);
url.searchParams.append('list', playlistName);
// Get the first page data for the playlist
url.searchParams.append('pbj', '1');
const response = yield fetch(`${url}`, {
credentials: 'include',
headers,
method: 'GET',
mode: 'cors',
});
const respJson = yield response.json();
const data = respJson.response.contents.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer
.contents[0].itemSectionRenderer.contents[0].playlistVideoListRenderer;
if (!data) {
throw errors_1.PlaylistEmptyError;
}
return {
playlistId: data.playlistId,
isEditable: data.isEditable,
canReorder: data.canReorder,
continuations: [extractPlaylistContinuation(data.contents)],
};
});
}
function fetchPlaylistContinuation(config, continuation) {
return __awaiter(this, void 0, void 0, function* () {
const url = new URL(`${API_GET_PLAYLIST_VIDEOS_URL}`);
const headers = generateRequestHeaders(config, API_V1_REQUIRED_HEADERS);
const body = {
context: {
client: {
clientName: config.INNERTUBE_CONTEXT_CLIENT_NAME,
clientVersion: config.INNERTUBE_CONTEXT_CLIENT_VERSION,
},
},
continuation: continuation.continuationToken,
};
url.searchParams.append('key', config.INNERTUBE_API_KEY);
const response = yield fetch(`${url}`, {
credentials: 'include',
headers,
body: JSON.stringify(body),
method: 'POST',
mode: 'cors',
});
const responseJson = yield response.json();
const data = responseJson.onResponseReceivedActions[0].appendContinuationItemsAction.continuationItems;
return extractPlaylistContinuation(data);
});
}
function fetchAllPlaylistContent(config, playlistName) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const playlist = yield fetchPlaylistInitialData(config, playlistName);
if (playlist.isEditable) {
// If all data has been retrieved, the last continuation item token will be undefined
while (((_a = playlist.continuations.at(-1)) === null || _a === void 0 ? void 0 : _a.continuationToken) !== undefined) {
playlist.continuations.push(
// We need the next continuationToken to launch the next request
// eslint-disable-next-line no-await-in-loop
yield fetchPlaylistContinuation(config, playlist.continuations.at(-1)));
}
// Merge all the videos into a single PlaylistContinuation
let videos = [];
for (const continuation of playlist.continuations) {
// eslint-disable-next-line unicorn/prefer-spread
videos = [...videos, ...continuation.videos];
}
playlist.continuations = [{ videos }];
return playlist;
}
throw errors_1.PlaylistNotEditableError;
});
}
exports.fetchAllPlaylistContent = fetchAllPlaylistContent;
function getRemoveFromHistoryToken(videoId) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
const initDataRegex = /(?:window\["ytInitialData"]|ytInitialData)\W?=\W?({.*?});/;
const result = yield fetch('https://www.youtube.com/feed/history', {
credentials: 'include',
method: 'GET',
mode: 'cors',
});
const body = yield result.text();
try {
const matchedData = body.match(initDataRegex);
if (!matchedData || !matchedData[1])
throw new Error('Failed to parse initData');
const initData = JSON.parse(matchedData[1]);
const groups = (_g = (_f = (_e = (_d = (_c = (_b = (_a = initData === null || initData === void 0 ? void 0 : initData.contents) === null || _a === void 0 ? void 0 : _a.twoColumnBrowseResultsRenderer) === null || _b === void 0 ? void 0 : _b.tabs) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.tabRenderer) === null || _e === void 0 ? void 0 : _e.content) === null || _f === void 0 ? void 0 : _f.sectionListRenderer) === null || _g === void 0 ? void 0 : _g.contents.map((group) => group.itemSectionRenderer).filter(Boolean);
let matchingVideo;
for (const item of groups) {
for (const { videoRenderer } of item.contents) {
if ((videoRenderer === null || videoRenderer === void 0 ? void 0 : videoRenderer.videoId) && videoId === (videoRenderer === null || videoRenderer === void 0 ? void 0 : videoRenderer.videoId)) {
matchingVideo = videoRenderer;
break;
}
}
}
if (!matchingVideo) {
throw new Error('Video not found in watch history');
}
return (_p = (_o = (_m = (_l = (_k = (_j = (_h = matchingVideo === null || matchingVideo === void 0 ? void 0 : matchingVideo.menu) === null || _h === void 0 ? void 0 : _h.menuRenderer) === null || _j === void 0 ? void 0 : _j.topLevelButtons) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.buttonRenderer) === null || _m === void 0 ? void 0 : _m.serviceEndpoint) === null || _o === void 0 ? void 0 : _o.feedbackEndpoint) === null || _p === void 0 ? void 0 : _p.feedbackToken;
}
catch (error) {
// eslint-disable-next-line no-console
console.log(error);
throw new Error('Failed to parse initData');
}
});
}
const makeFeedbackPayload = (feedbackToken) => ({
context: {
client: {
hl: 'en',
clientName: 'WEB',
clientVersion: '2.20210711.07.00',
},
user: {
lockedSafetyMode: false,
},
request: {
useSsl: true,
internalExperimentFlags: [],
consistencyTokenJars: [],
},
},
isFeedbackTokenUnencrypted: false,
shouldMerge: false,
feedbackTokens: [feedbackToken],
});
function sendFeedbackRequest(config, feedbackToken) {
return __awaiter(this, void 0, void 0, function* () {
const url = `https://www.youtube.com/youtubei/v1/feedback?key=${config.INNERTUBE_API_KEY}`;
const rawResponse = yield fetch(url, {
method: 'POST',
headers: generateRequestHeaders(config, API_V1_REQUIRED_HEADERS),
body: JSON.stringify(makeFeedbackPayload(feedbackToken)),
});
const response = yield rawResponse.json();
if (!response.feedbackResponses[0].isProcessed) {
throw new Error('Failed to remove video from watch history');
}
});
}
function removeWatchHistoryForVideo(config, videoId) {
return __awaiter(this, void 0, void 0, function* () {
const feedbackToken = yield getRemoveFromHistoryToken(videoId);
if (feedbackToken) {
yield sendFeedbackRequest(config, feedbackToken);
}
});
}
exports.removeWatchHistoryForVideo = removeWatchHistoryForVideo;
function removeVideosFromPlaylist(config, playlistId, videosToRemove) {
return __awaiter(this, void 0, void 0, function* () {
const url = new URL(`${API_EDIT_PLAYLIST_VIDEOS_URL}`);
const headers = generateRequestHeaders(config, API_V1_REQUIRED_HEADERS);
const body = {
actions: videosToRemove.map(({ videoId }) => ({
removedVideoId: videoId,
action: 'ACTION_REMOVE_VIDEO_BY_VIDEO_ID',
})),
context: {
client: {
clientName: config.INNERTUBE_CONTEXT_CLIENT_NAME,
clientVersion: config.INNERTUBE_CONTEXT_CLIENT_VERSION,
},
},
params: 'CAFAAQ%3D%3D',
playlistId,
};
url.searchParams.append('key', config.INNERTUBE_API_KEY);
const response = yield fetch(`${url}`, {
credentials: 'include',
headers,
body: JSON.stringify(body),
method: 'POST',
mode: 'cors',
});
const data = yield response.json();
return data.status !== 'STATUS_SUCCEEDED';
});
}
exports.removeVideosFromPlaylist = removeVideosFromPlaylist;
/***/ }),
/* 50 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {(function() {
var crypt = __webpack_require__(56),
utf8 = __webpack_require__(27).utf8,
bin = __webpack_require__(27).bin,
// The core
sha1 = function (message) {
// Convert to byte array
if (message.constructor == String)
message = utf8.stringToBytes(message);
else if (typeof Buffer !== 'undefined' && typeof Buffer.isBuffer == 'function' && Buffer.isBuffer(message))
message = Array.prototype.slice.call(message, 0);
else if (!Array.isArray(message))
message = message.toString();
// otherwise assume byte array
var m = crypt.bytesToWords(message),
l = message.length * 8,
w = [],
H0 = 1732584193,
H1 = -271733879,
H2 = -1732584194,
H3 = 271733878,
H4 = -1009589776;
// Padding
m[l >> 5] |= 0x80 << (24 - l % 32);
m[((l + 64 >>> 9) << 4) + 15] = l;
for (var i = 0; i < m.length; i += 16) {
var a = H0,
b = H1,
c = H2,
d = H3,
e = H4;
for (var j = 0; j < 80; j++) {
if (j < 16)
w[j] = m[i + j];
else {
var n = w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16];
w[j] = (n << 1) | (n >>> 31);
}
var t = ((H0 << 5) | (H0 >>> 27)) + H4 + (w[j] >>> 0) + (
j < 20 ? (H1 & H2 | ~H1 & H3) + 1518500249 :
j < 40 ? (H1 ^ H2 ^ H3) + 1859775393 :
j < 60 ? (H1 & H2 | H1 & H3 | H2 & H3) - 1894007588 :
(H1 ^ H2 ^ H3) - 899497514);
H4 = H3;
H3 = H2;
H2 = (H1 << 30) | (H1 >>> 2);
H1 = H0;
H0 = t;
}
H0 += a;
H1 += b;
H2 += c;
H3 += d;
H4 += e;
}
return [H0, H1, H2, H3, H4];
},
// Public API
api = function (message, options) {
var digestbytes = crypt.wordsToBytes(sha1(message));
return options && options.asBytes ? digestbytes :
options && options.asString ? bin.bytesToString(digestbytes) :
crypt.bytesToHex(digestbytes);
};
api._blocksize = 16;
api._digestsize = 20;
module.exports = api;
})();
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(51).Buffer))
/***/ }),
/* 51 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/
/* eslint-disable no-proto */
var base64 = __webpack_require__(53)
var ieee754 = __webpack_require__(54)
var isArray = __webpack_require__(55)
exports.Buffer = Buffer
exports.SlowBuffer = SlowBuffer
exports.INSPECT_MAX_BYTES = 50
/**
* If `Buffer.TYPED_ARRAY_SUPPORT`:
* === true Use Uint8Array implementation (fastest)
* === false Use Object implementation (most compatible, even IE6)
*
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
* Opera 11.6+, iOS 4.2+.
*
* Due to various browser bugs, sometimes the Object implementation will be used even
* when the browser supports typed arrays.
*
* Note:
*
* - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
* See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
*
* - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
*
* - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
* incorrect length in some situations.
* We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
* get the Object implementation, which is slower but behaves correctly.
*/
Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
? global.TYPED_ARRAY_SUPPORT
: typedArraySupport()
/*
* Export kMaxLength after typed array support is determined.
*/
exports.kMaxLength = kMaxLength()
function typedArraySupport () {
try {
var arr = new Uint8Array(1)
arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
return arr.foo() === 42 && // typed array instances can be augmented
typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
} catch (e) {
return false
}
}
function kMaxLength () {
return Buffer.TYPED_ARRAY_SUPPORT
? 0x7fffffff
: 0x3fffffff
}
function createBuffer (that, length) {
if (kMaxLength() < length) {
throw new RangeError('Invalid typed array length')
}
if (Buffer.TYPED_ARRAY_SUPPORT) {
// Return an augmented `Uint8Array` instance, for best performance
that = new Uint8Array(length)
that.__proto__ = Buffer.prototype
} else {
// Fallback: Return an object instance of the Buffer class
if (that === null) {
that = new Buffer(length)
}
that.length = length
}
return that
}
/**
* The Buffer constructor returns instances of `Uint8Array` that have their
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
* returns a single octet.
*
* The `Uint8Array` prototype remains unmodified.
*/
function Buffer (arg, encodingOrOffset, length) {
if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
return new Buffer(arg, encodingOrOffset, length)
}
// Common case.
if (typeof arg === 'number') {
if (typeof encodingOrOffset === 'string') {
throw new Error(
'If encoding is specified then the first argument must be a string'
)
}
return allocUnsafe(this, arg)
}
return from(this, arg, encodingOrOffset, length)
}
Buffer.poolSize = 8192 // not used by this implementation
// TODO: Legacy, not needed anymore. Remove in next major version.
Buffer._augment = function (arr) {
arr.__proto__ = Buffer.prototype
return arr
}
function from (that, value, encodingOrOffset, length) {
if (typeof value === 'number') {
throw new TypeError('"value" argument must not be a number')
}
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
return fromArrayBuffer(that, value, encodingOrOffset, length)
}
if (typeof value === 'string') {
return fromString(that, value, encodingOrOffset)
}
return fromObject(that, value)
}
/**
* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
* if value is a number.
* Buffer.from(str[, encoding])
* Buffer.from(array)
* Buffer.from(buffer)
* Buffer.from(arrayBuffer[, byteOffset[, length]])
**/
Buffer.from = function (value, encodingOrOffset, length) {
return from(null, value, encodingOrOffset, length)
}
if (Buffer.TYPED_ARRAY_SUPPORT) {
Buffer.prototype.__proto__ = Uint8Array.prototype
Buffer.__proto__ = Uint8Array
if (typeof Symbol !== 'undefined' && Symbol.species &&
Buffer[Symbol.species] === Buffer) {
// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
Object.defineProperty(Buffer, Symbol.species, {
value: null,
configurable: true
})
}
}
function assertSize (size) {
if (typeof size !== 'number') {
throw new TypeError('"size" argument must be a number')
} else if (size < 0) {
throw new RangeError('"size" argument must not be negative')
}
}
function alloc (that, size, fill, encoding) {
assertSize(size)
if (size <= 0) {
return createBuffer(that, size)
}
if (fill !== undefined) {
// Only pay attention to encoding if it's a string. This
// prevents accidentally sending in a number that would
// be interpretted as a start offset.
return typeof encoding === 'string'
? createBuffer(that, size).fill(fill, encoding)
: createBuffer(that, size).fill(fill)
}
return createBuffer(that, size)
}
/**
* Creates a new filled Buffer instance.
* alloc(size[, fill[, encoding]])
**/
Buffer.alloc = function (size, fill, encoding) {
return alloc(null, size, fill, encoding)
}
function allocUnsafe (that, size) {
assertSize(size)
that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
if (!Buffer.TYPED_ARRAY_SUPPORT) {
for (var i = 0; i < size; ++i) {
that[i] = 0
}
}
return that
}
/**
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
* */
Buffer.allocUnsafe = function (size) {
return allocUnsafe(null, size)
}
/**
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
*/
Buffer.allocUnsafeSlow = function (size) {
return allocUnsafe(null, size)
}
function fromString (that, string, encoding) {
if (typeof encoding !== 'string' || encoding === '') {
encoding = 'utf8'
}
if (!Buffer.isEncoding(encoding)) {
throw new TypeError('"encoding" must be a valid string encoding')
}
var length = byteLength(string, encoding) | 0
that = createBuffer(that, length)
var actual = that.write(string, encoding)
if (actual !== length) {
// Writing a hex string, for example, that contains invalid characters will
// cause everything after the first invalid character to be ignored. (e.g.
// 'abxxcd' will be treated as 'ab')
that = that.slice(0, actual)
}
return that
}
function fromArrayLike (that, array) {
var length = array.length < 0 ? 0 : checked(array.length) | 0
that = createBuffer(that, length)
for (var i = 0; i < length; i += 1) {
that[i] = array[i] & 255
}
return that
}
function fromArrayBuffer (that, array, byteOffset, length) {
array.byteLength // this throws if `array` is not a valid ArrayBuffer
if (byteOffset < 0 || array.byteLength < byteOffset) {
throw new RangeError('\'offset\' is out of bounds')
}
if (array.byteLength < byteOffset + (length || 0)) {
throw new RangeError('\'length\' is out of bounds')
}
if (byteOffset === undefined && length === undefined) {
array = new Uint8Array(array)
} else if (length === undefined) {
array = new Uint8Array(array, byteOffset)
} else {
array = new Uint8Array(array, byteOffset, length)
}
if (Buffer.TYPED_ARRAY_SUPPORT) {
// Return an augmented `Uint8Array` instance, for best performance
that = array
that.__proto__ = Buffer.prototype
} else {
// Fallback: Return an object instance of the Buffer class
that = fromArrayLike(that, array)
}
return that
}
function fromObject (that, obj) {
if (Buffer.isBuffer(obj)) {
var len = checked(obj.length) | 0
that = createBuffer(that, len)
if (that.length === 0) {
return that
}
obj.copy(that, 0, 0, len)
return that
}
if (obj) {
if ((typeof ArrayBuffer !== 'undefined' &&
obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
if (typeof obj.length !== 'number' || isnan(obj.length)) {
return createBuffer(that, 0)
}
return fromArrayLike(that, obj)
}
if (obj.type === 'Buffer' && isArray(obj.data)) {
return fromArrayLike(that, obj.data)
}
}
throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
}
function checked (length) {
// Note: cannot use `length < kMaxLength()` here because that fails when
// length is NaN (which is otherwise coerced to zero.)
if (length >= kMaxLength()) {
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
'size: 0x' + kMaxLength().toString(16) + ' bytes')
}
return length | 0
}
function SlowBuffer (length) {
if (+length != length) { // eslint-disable-line eqeqeq
length = 0
}
return Buffer.alloc(+length)
}
Buffer.isBuffer = function isBuffer (b) {
return !!(b != null && b._isBuffer)
}
Buffer.compare = function compare (a, b) {
if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
throw new TypeError('Arguments must be Buffers')
}
if (a === b) return 0
var x = a.length
var y = b.length
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
if (a[i] !== b[i]) {
x = a[i]
y = b[i]
break
}
}
if (x < y) return -1
if (y < x) return 1
return 0
}
Buffer.isEncoding = function isEncoding (encoding) {
switch (String(encoding).toLowerCase()) {
case 'hex':
case 'utf8':
case 'utf-8':
case 'ascii':
case 'latin1':
case 'binary':
case 'base64':
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return true
default:
return false
}
}
Buffer.concat = function concat (list, length) {
if (!isArray(list)) {
throw new TypeError('"list" argument must be an Array of Buffers')
}
if (list.length === 0) {
return Buffer.alloc(0)
}
var i
if (length === undefined) {
length = 0
for (i = 0; i < list.length; ++i) {
length += list[i].length
}
}
var buffer = Buffer.allocUnsafe(length)
var pos = 0
for (i = 0; i < list.length; ++i) {
var buf = list[i]
if (!Buffer.isBuffer(buf)) {
throw new TypeError('"list" argument must be an Array of Buffers')
}
buf.copy(buffer, pos)
pos += buf.length
}
return buffer
}
function byteLength (string, encoding) {
if (Buffer.isBuffer(string)) {
return string.length
}
if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
(ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
return string.byteLength
}
if (typeof string !== 'string') {
string = '' + string
}
var len = string.length
if (len === 0) return 0
// Use a for loop to avoid recursion
var loweredCase = false
for (;;) {
switch (encoding) {
case 'ascii':
case 'latin1':
case 'binary':
return len
case 'utf8':
case 'utf-8':
case undefined:
return utf8ToBytes(string).length
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return len * 2
case 'hex':
return len >>> 1
case 'base64':
return base64ToBytes(string).length
default:
if (loweredCase) return utf8ToBytes(string).length // assume utf8
encoding = ('' + encoding).toLowerCase()
loweredCase = true
}
}
}
Buffer.byteLength = byteLength
function slowToString (encoding, start, end) {
var loweredCase = false
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
// property of a typed array.
// This behaves neither like String nor Uint8Array in that we set start/end
// to their upper/lower bounds if the value passed is out of range.
// undefined is handled specially as per ECMA-262 6th Edition,
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
if (start === undefined || start < 0) {
start = 0
}
// Return early if start > this.length. Done here to prevent potential uint32
// coercion fail below.
if (start > this.length) {
return ''
}
if (end === undefined || end > this.length) {
end = this.length
}
if (end <= 0) {
return ''
}
// Force coersion to uint32. This will also coerce falsey/NaN values to 0.
end >>>= 0
start >>>= 0
if (end <= start) {
return ''
}
if (!encoding) encoding = 'utf8'
while (true) {
switch (encoding) {
case 'hex':
return hexSlice(this, start, end)
case 'utf8':
case 'utf-8':
return utf8Slice(this, start, end)
case 'ascii':
return asciiSlice(this, start, end)
case 'latin1':
case 'binary':
return latin1Slice(this, start, end)
case 'base64':
return base64Slice(this, start, end)
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return utf16leSlice(this, start, end)
default:
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
encoding = (encoding + '').toLowerCase()
loweredCase = true
}
}
}
// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
// Buffer instances.
Buffer.prototype._isBuffer = true
function swap (b, n, m) {
var i = b[n]
b[n] = b[m]
b[m] = i
}
Buffer.prototype.swap16 = function swap16 () {
var len = this.length
if (len % 2 !== 0) {
throw new RangeError('Buffer size must be a multiple of 16-bits')
}
for (var i = 0; i < len; i += 2) {
swap(this, i, i + 1)
}
return this
}
Buffer.prototype.swap32 = function swap32 () {
var len = this.length
if (len % 4 !== 0) {
throw new RangeError('Buffer size must be a multiple of 32-bits')
}
for (var i = 0; i < len; i += 4) {
swap(this, i, i + 3)
swap(this, i + 1, i + 2)
}
return this
}
Buffer.prototype.swap64 = function swap64 () {
var len = this.length
if (len % 8 !== 0) {
throw new RangeError('Buffer size must be a multiple of 64-bits')
}
for (var i = 0; i < len; i += 8) {
swap(this, i, i + 7)
swap(this, i + 1, i + 6)
swap(this, i + 2, i + 5)
swap(this, i + 3, i + 4)
}
return this
}
Buffer.prototype.toString = function toString () {
var length = this.length | 0
if (length === 0) return ''
if (arguments.length === 0) return utf8Slice(this, 0, length)
return slowToString.apply(this, arguments)
}
Buffer.prototype.equals = function equals (b) {
if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
if (this === b) return true
return Buffer.compare(this, b) === 0
}
Buffer.prototype.inspect = function inspect () {
var str = ''
var max = exports.INSPECT_MAX_BYTES
if (this.length > 0) {
str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
if (this.length > max) str += ' ... '
}
return '<Buffer ' + str + '>'
}
Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
if (!Buffer.isBuffer(target)) {
throw new TypeError('Argument must be a Buffer')
}
if (start === undefined) {
start = 0
}
if (end === undefined) {
end = target ? target.length : 0
}
if (thisStart === undefined) {
thisStart = 0
}
if (thisEnd === undefined) {
thisEnd = this.length
}
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
throw new RangeError('out of range index')
}
if (thisStart >= thisEnd && start >= end) {
return 0
}
if (thisStart >= thisEnd) {
return -1
}
if (start >= end) {
return 1
}
start >>>= 0
end >>>= 0
thisStart >>>= 0
thisEnd >>>= 0
if (this === target) return 0
var x = thisEnd - thisStart
var y = end - start
var len = Math.min(x, y)
var thisCopy = this.slice(thisStart, thisEnd)
var targetCopy = target.slice(start, end)
for (var i = 0; i < len; ++i) {
if (thisCopy[i] !== targetCopy[i]) {
x = thisCopy[i]
y = targetCopy[i]
break
}
}
if (x < y) return -1
if (y < x) return 1
return 0
}
// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
//
// Arguments:
// - buffer - a Buffer to search
// - val - a string, Buffer, or number
// - byteOffset - an index into `buffer`; will be clamped to an int32
// - encoding - an optional encoding, relevant is val is a string
// - dir - true for indexOf, false for lastIndexOf
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
// Empty buffer means no match
if (buffer.length === 0) return -1
// Normalize byteOffset
if (typeof byteOffset === 'string') {
encoding = byteOffset
byteOffset = 0
} else if (byteOffset > 0x7fffffff) {
byteOffset = 0x7fffffff
} else if (byteOffset < -0x80000000) {
byteOffset = -0x80000000
}
byteOffset = +byteOffset // Coerce to Number.
if (isNaN(byteOffset)) {
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
byteOffset = dir ? 0 : (buffer.length - 1)
}
// Normalize byteOffset: negative offsets start from the end of the buffer
if (byteOffset < 0) byteOffset = buffer.length + byteOffset
if (byteOffset >= buffer.length) {
if (dir) return -1
else byteOffset = buffer.length - 1
} else if (byteOffset < 0) {
if (dir) byteOffset = 0
else return -1
}
// Normalize val
if (typeof val === 'string') {
val = Buffer.from(val, encoding)
}
// Finally, search either indexOf (if dir is true) or lastIndexOf
if (Buffer.isBuffer(val)) {
// Special case: looking for empty string/buffer always fails
if (val.length === 0) {
return -1
}
return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
} else if (typeof val === 'number') {
val = val & 0xFF // Search for a byte value [0-255]
if (Buffer.TYPED_ARRAY_SUPPORT &&
typeof Uint8Array.prototype.indexOf === 'function') {
if (dir) {
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
} else {
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
}
}
return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
}
throw new TypeError('val must be string, number or Buffer')
}
function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
var indexSize = 1
var arrLength = arr.length
var valLength = val.length
if (encoding !== undefined) {
encoding = String(encoding).toLowerCase()
if (encoding === 'ucs2' || encoding === 'ucs-2' ||
encoding === 'utf16le' || encoding === 'utf-16le') {
if (arr.length < 2 || val.length < 2) {
return -1
}
indexSize = 2
arrLength /= 2
valLength /= 2
byteOffset /= 2
}
}
function read (buf, i) {
if (indexSize === 1) {
return buf[i]
} else {
return buf.readUInt16BE(i * indexSize)
}
}
var i
if (dir) {
var foundIndex = -1
for (i = byteOffset; i < arrLength; i++) {
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
if (foundIndex === -1) foundIndex = i
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
} else {
if (foundIndex !== -1) i -= i - foundIndex
foundIndex = -1
}
}
} else {
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
for (i = byteOffset; i >= 0; i--) {
var found = true
for (var j = 0; j < valLength; j++) {
if (read(arr, i + j) !== read(val, j)) {
found = false
break
}
}
if (found) return i
}
}
return -1
}
Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
return this.indexOf(val, byteOffset, encoding) !== -1
}
Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
}
Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
}
function hexWrite (buf, string, offset, length) {
offset = Number(offset) || 0
var remaining = buf.length - offset
if (!length) {
length = remaining
} else {
length = Number(length)
if (length > remaining) {
length = remaining
}
}
// must be an even number of digits
var strLen = string.length
if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
if (length > strLen / 2) {
length = strLen / 2
}
for (var i = 0; i < length; ++i) {
var parsed = parseInt(string.substr(i * 2, 2), 16)
if (isNaN(parsed)) return i
buf[offset + i] = parsed
}
return i
}
function utf8Write (buf, string, offset, length) {
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
}
function asciiWrite (buf, string, offset, length) {
return blitBuffer(asciiToBytes(string), buf, offset, length)
}
function latin1Write (buf, string, offset, length) {
return asciiWrite(buf, string, offset, length)
}
function base64Write (buf, string, offset, length) {
return blitBuffer(base64ToBytes(string), buf, offset, length)
}
function ucs2Write (buf, string, offset, length) {
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
}
Buffer.prototype.write = function write (string, offset, length, encoding) {
// Buffer#write(string)
if (offset === undefined) {
encoding = 'utf8'
length = this.length
offset = 0
// Buffer#write(string, encoding)
} else if (length === undefined && typeof offset === 'string') {
encoding = offset
length = this.length
offset = 0
// Buffer#write(string, offset[, length][, encoding])
} else if (isFinite(offset)) {
offset = offset | 0
if (isFinite(length)) {
length = length | 0
if (encoding === undefined) encoding = 'utf8'
} else {
encoding = length
length = undefined
}
// legacy write(string, encoding, offset, length) - remove in v0.13
} else {
throw new Error(
'Buffer.write(string, encoding, offset[, length]) is no longer supported'
)
}
var remaining = this.length - offset
if (length === undefined || length > remaining) length = remaining
if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
throw new RangeError('Attempt to write outside buffer bounds')
}
if (!encoding) encoding = 'utf8'
var loweredCase = false
for (;;) {
switch (encoding) {
case 'hex':
return hexWrite(this, string, offset, length)
case 'utf8':
case 'utf-8':
return utf8Write(this, string, offset, length)
case 'ascii':
return asciiWrite(this, string, offset, length)
case 'latin1':
case 'binary':
return latin1Write(this, string, offset, length)
case 'base64':
// Warning: maxLength not taken into account in base64Write
return base64Write(this, string, offset, length)
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return ucs2Write(this, string, offset, length)
default:
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
encoding = ('' + encoding).toLowerCase()
loweredCase = true
}
}
}
Buffer.prototype.toJSON = function toJSON () {
return {
type: 'Buffer',
data: Array.prototype.slice.call(this._arr || this, 0)
}
}
function base64Slice (buf, start, end) {
if (start === 0 && end === buf.length) {
return base64.fromByteArray(buf)
} else {
return base64.fromByteArray(buf.slice(start, end))
}
}
function utf8Slice (buf, start, end) {
end = Math.min(buf.length, end)
var res = []
var i = start
while (i < end) {
var firstByte = buf[i]
var codePoint = null
var bytesPerSequence = (firstByte > 0xEF) ? 4
: (firstByte > 0xDF) ? 3
: (firstByte > 0xBF) ? 2
: 1
if (i + bytesPerSequence <= end) {
var secondByte, thirdByte, fourthByte, tempCodePoint
switch (bytesPerSequence) {
case 1:
if (firstByte < 0x80) {
codePoint = firstByte
}
break
case 2:
secondByte = buf[i + 1]
if ((secondByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
if (tempCodePoint > 0x7F) {
codePoint = tempCodePoint
}
}
break
case 3:
secondByte = buf[i + 1]
thirdByte = buf[i + 2]
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
codePoint = tempCodePoint
}
}
break
case 4:
secondByte = buf[i + 1]
thirdByte = buf[i + 2]
fourthByte = buf[i + 3]
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
codePoint = tempCodePoint
}
}
}
}
if (codePoint === null) {
// we did not generate a valid codePoint so insert a
// replacement char (U+FFFD) and advance only 1 byte
codePoint = 0xFFFD
bytesPerSequence = 1
} else if (codePoint > 0xFFFF) {
// encode to utf16 (surrogate pair dance)
codePoint -= 0x10000
res.push(codePoint >>> 10 & 0x3FF | 0xD800)
codePoint = 0xDC00 | codePoint & 0x3FF
}
res.push(codePoint)
i += bytesPerSequence
}
return decodeCodePointsArray(res)
}
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
// the lowest limit is Chrome, with 0x10000 args.
// We go 1 magnitude less, for safety
var MAX_ARGUMENTS_LENGTH = 0x1000
function decodeCodePointsArray (codePoints) {
var len = codePoints.length
if (len <= MAX_ARGUMENTS_LENGTH) {
return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
}
// Decode in chunks to avoid "call stack size exceeded".
var res = ''
var i = 0
while (i < len) {
res += String.fromCharCode.apply(
String,
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
)
}
return res
}
function asciiSlice (buf, start, end) {
var ret = ''
end = Math.min(buf.length, end)
for (var i = start; i < end; ++i) {
ret += String.fromCharCode(buf[i] & 0x7F)
}
return ret
}
function latin1Slice (buf, start, end) {
var ret = ''
end = Math.min(buf.length, end)
for (var i = start; i < end; ++i) {
ret += String.fromCharCode(buf[i])
}
return ret
}
function hexSlice (buf, start, end) {
var len = buf.length
if (!start || start < 0) start = 0
if (!end || end < 0 || end > len) end = len
var out = ''
for (var i = start; i < end; ++i) {
out += toHex(buf[i])
}
return out
}
function utf16leSlice (buf, start, end) {
var bytes = buf.slice(start, end)
var res = ''
for (var i = 0; i < bytes.length; i += 2) {
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
}
return res
}
Buffer.prototype.slice = function slice (start, end) {
var len = this.length
start = ~~start
end = end === undefined ? len : ~~end
if (start < 0) {
start += len
if (start < 0) start = 0
} else if (start > len) {
start = len
}
if (end < 0) {
end += len
if (end < 0) end = 0
} else if (end > len) {
end = len
}
if (end < start) end = start
var newBuf
if (Buffer.TYPED_ARRAY_SUPPORT) {
newBuf = this.subarray(start, end)
newBuf.__proto__ = Buffer.prototype
} else {
var sliceLen = end - start
newBuf = new Buffer(sliceLen, undefined)
for (var i = 0; i < sliceLen; ++i) {
newBuf[i] = this[i + start]
}
}
return newBuf
}
/*
* Need to make sure that buffer isn't trying to write out of bounds.
*/
function checkOffset (offset, ext, length) {
if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
}
Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
offset = offset | 0
byteLength = byteLength | 0
if (!noAssert) checkOffset(offset, byteLength, this.length)
var val = this[offset]
var mul = 1
var i = 0
while (++i < byteLength && (mul *= 0x100)) {
val += this[offset + i] * mul
}
return val
}
Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
offset = offset | 0
byteLength = byteLength | 0
if (!noAssert) {
checkOffset(offset, byteLength, this.length)
}
var val = this[offset + --byteLength]
var mul = 1
while (byteLength > 0 && (mul *= 0x100)) {
val += this[offset + --byteLength] * mul
}
return val
}
Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
if (!noAssert) checkOffset(offset, 1, this.length)
return this[offset]
}
Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 2, this.length)
return this[offset] | (this[offset + 1] << 8)
}
Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 2, this.length)
return (this[offset] << 8) | this[offset + 1]
}
Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length)
return ((this[offset]) |
(this[offset + 1] << 8) |
(this[offset + 2] << 16)) +
(this[offset + 3] * 0x1000000)
}
Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length)
return (this[offset] * 0x1000000) +
((this[offset + 1] << 16) |
(this[offset + 2] << 8) |
this[offset + 3])
}
Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
offset = offset | 0
byteLength = byteLength | 0
if (!noAssert) checkOffset(offset, byteLength, this.length)
var val = this[offset]
var mul = 1
var i = 0
while (++i < byteLength && (mul *= 0x100)) {
val += this[offset + i] * mul
}
mul *= 0x80
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
return val
}
Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
offset = offset | 0
byteLength = byteLength | 0
if (!noAssert) checkOffset(offset, byteLength, this.length)
var i = byteLength
var mul = 1
var val = this[offset + --i]
while (i > 0 && (mul *= 0x100)) {
val += this[offset + --i] * mul
}
mul *= 0x80
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
return val
}
Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
if (!noAssert) checkOffset(offset, 1, this.length)
if (!(this[offset] & 0x80)) return (this[offset])
return ((0xff - this[offset] + 1) * -1)
}
Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 2, this.length)
var val = this[offset] | (this[offset + 1] << 8)
return (val & 0x8000) ? val | 0xFFFF0000 : val
}
Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 2, this.length)
var val = this[offset + 1] | (this[offset] << 8)
return (val & 0x8000) ? val | 0xFFFF0000 : val
}
Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length)
return (this[offset]) |
(this[offset + 1] << 8) |
(this[offset + 2] << 16) |
(this[offset + 3] << 24)
}
Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length)
return (this[offset] << 24) |
(this[offset + 1] << 16) |
(this[offset + 2] << 8) |
(this[offset + 3])
}
Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length)
return ieee754.read(this, offset, true, 23, 4)
}
Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length)
return ieee754.read(this, offset, false, 23, 4)
}
Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 8, this.length)
return ieee754.read(this, offset, true, 52, 8)
}
Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 8, this.length)
return ieee754.read(this, offset, false, 52, 8)
}
function checkInt (buf, value, offset, ext, max, min) {
if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
if (offset + ext > buf.length) throw new RangeError('Index out of range')
}
Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
value = +value
offset = offset | 0
byteLength = byteLength | 0
if (!noAssert) {
var maxBytes = Math.pow(2, 8 * byteLength) - 1
checkInt(this, value, offset, byteLength, maxBytes, 0)
}
var mul = 1
var i = 0
this[offset] = value & 0xFF
while (++i < byteLength && (mul *= 0x100)) {
this[offset + i] = (value / mul) & 0xFF
}
return offset + byteLength
}
Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
value = +value
offset = offset | 0
byteLength = byteLength | 0
if (!noAssert) {
var maxBytes = Math.pow(2, 8 * byteLength) - 1
checkInt(this, value, offset, byteLength, maxBytes, 0)
}
var i = byteLength - 1
var mul = 1
this[offset + i] = value & 0xFF
while (--i >= 0 && (mul *= 0x100)) {
this[offset + i] = (value / mul) & 0xFF
}
return offset + byteLength
}
Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
this[offset] = (value & 0xff)
return offset + 1
}
function objectWriteUInt16 (buf, value, offset, littleEndian) {
if (value < 0) value = 0xffff + value + 1
for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
(littleEndian ? i : 1 - i) * 8
}
}
Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value & 0xff)
this[offset + 1] = (value >>> 8)
} else {
objectWriteUInt16(this, value, offset, true)
}
return offset + 2
}
Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 8)
this[offset + 1] = (value & 0xff)
} else {
objectWriteUInt16(this, value, offset, false)
}
return offset + 2
}
function objectWriteUInt32 (buf, value, offset, littleEndian) {
if (value < 0) value = 0xffffffff + value + 1
for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
}
}
Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset + 3] = (value >>> 24)
this[offset + 2] = (value >>> 16)
this[offset + 1] = (value >>> 8)
this[offset] = (value & 0xff)
} else {
objectWriteUInt32(this, value, offset, true)
}
return offset + 4
}
Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 24)
this[offset + 1] = (value >>> 16)
this[offset + 2] = (value >>> 8)
this[offset + 3] = (value & 0xff)
} else {
objectWriteUInt32(this, value, offset, false)
}
return offset + 4
}
Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) {
var limit = Math.pow(2, 8 * byteLength - 1)
checkInt(this, value, offset, byteLength, limit - 1, -limit)
}
var i = 0
var mul = 1
var sub = 0
this[offset] = value & 0xFF
while (++i < byteLength && (mul *= 0x100)) {
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
sub = 1
}
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
}
return offset + byteLength
}
Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) {
var limit = Math.pow(2, 8 * byteLength - 1)
checkInt(this, value, offset, byteLength, limit - 1, -limit)
}
var i = byteLength - 1
var mul = 1
var sub = 0
this[offset + i] = value & 0xFF
while (--i >= 0 && (mul *= 0x100)) {
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
sub = 1
}
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
}
return offset + byteLength
}
Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
if (value < 0) value = 0xff + value + 1
this[offset] = (value & 0xff)
return offset + 1
}
Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value & 0xff)
this[offset + 1] = (value >>> 8)
} else {
objectWriteUInt16(this, value, offset, true)
}
return offset + 2
}
Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 8)
this[offset + 1] = (value & 0xff)
} else {
objectWriteUInt16(this, value, offset, false)
}
return offset + 2
}
Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value & 0xff)
this[offset + 1] = (value >>> 8)
this[offset + 2] = (value >>> 16)
this[offset + 3] = (value >>> 24)
} else {
objectWriteUInt32(this, value, offset, true)
}
return offset + 4
}
Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
if (value < 0) value = 0xffffffff + value + 1
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 24)
this[offset + 1] = (value >>> 16)
this[offset + 2] = (value >>> 8)
this[offset + 3] = (value & 0xff)
} else {
objectWriteUInt32(this, value, offset, false)
}
return offset + 4
}
function checkIEEE754 (buf, value, offset, ext, max, min) {
if (offset + ext > buf.length) throw new RangeError('Index out of range')
if (offset < 0) throw new RangeError('Index out of range')
}
function writeFloat (buf, value, offset, littleEndian, noAssert) {
if (!noAssert) {
checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
}
ieee754.write(buf, value, offset, littleEndian, 23, 4)
return offset + 4
}
Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
return writeFloat(this, value, offset, true, noAssert)
}
Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
return writeFloat(this, value, offset, false, noAssert)
}
function writeDouble (buf, value, offset, littleEndian, noAssert) {
if (!noAssert) {
checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
}
ieee754.write(buf, value, offset, littleEndian, 52, 8)
return offset + 8
}
Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
return writeDouble(this, value, offset, true, noAssert)
}
Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
return writeDouble(this, value, offset, false, noAssert)
}
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
Buffer.prototype.copy = function copy (target, targetStart, start, end) {
if (!start) start = 0
if (!end && end !== 0) end = this.length
if (targetStart >= target.length) targetStart = target.length
if (!targetStart) targetStart = 0
if (end > 0 && end < start) end = start
// Copy 0 bytes; we're done
if (end === start) return 0
if (target.length === 0 || this.length === 0) return 0
// Fatal error conditions
if (targetStart < 0) {
throw new RangeError('targetStart out of bounds')
}
if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
if (end < 0) throw new RangeError('sourceEnd out of bounds')
// Are we oob?
if (end > this.length) end = this.length
if (target.length - targetStart < end - start) {
end = target.length - targetStart + start
}
var len = end - start
var i
if (this === target && start < targetStart && targetStart < end) {
// descending copy from end
for (i = len - 1; i >= 0; --i) {
target[i + targetStart] = this[i + start]
}
} else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
// ascending copy from start
for (i = 0; i < len; ++i) {
target[i + targetStart] = this[i + start]
}
} else {
Uint8Array.prototype.set.call(
target,
this.subarray(start, start + len),
targetStart
)
}
return len
}
// Usage:
// buffer.fill(number[, offset[, end]])
// buffer.fill(buffer[, offset[, end]])
// buffer.fill(string[, offset[, end]][, encoding])
Buffer.prototype.fill = function fill (val, start, end, encoding) {
// Handle string cases:
if (typeof val === 'string') {
if (typeof start === 'string') {
encoding = start
start = 0
end = this.length
} else if (typeof end === 'string') {
encoding = end
end = this.length
}
if (val.length === 1) {
var code = val.charCodeAt(0)
if (code < 256) {
val = code
}
}
if (encoding !== undefined && typeof encoding !== 'string') {
throw new TypeError('encoding must be a string')
}
if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
throw new TypeError('Unknown encoding: ' + encoding)
}
} else if (typeof val === 'number') {
val = val & 255
}
// Invalid ranges are not set to a default, so can range check early.
if (start < 0 || this.length < start || this.length < end) {
throw new RangeError('Out of range index')
}
if (end <= start) {
return this
}
start = start >>> 0
end = end === undefined ? this.length : end >>> 0
if (!val) val = 0
var i
if (typeof val === 'number') {
for (i = start; i < end; ++i) {
this[i] = val
}
} else {
var bytes = Buffer.isBuffer(val)
? val
: utf8ToBytes(new Buffer(val, encoding).toString())
var len = bytes.length
for (i = 0; i < end - start; ++i) {
this[i + start] = bytes[i % len]
}
}
return this
}
// HELPER FUNCTIONS
// ================
var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
function base64clean (str) {
// Node strips out invalid characters like \n and \t from the string, base64-js does not
str = stringtrim(str).replace(INVALID_BASE64_RE, '')
// Node converts strings with length < 2 to ''
if (str.length < 2) return ''
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
while (str.length % 4 !== 0) {
str = str + '='
}
return str
}
function stringtrim (str) {
if (str.trim) return str.trim()
return str.replace(/^\s+|\s+$/g, '')
}
function toHex (n) {
if (n < 16) return '0' + n.toString(16)
return n.toString(16)
}
function utf8ToBytes (string, units) {
units = units || Infinity
var codePoint
var length = string.length
var leadSurrogate = null
var bytes = []
for (var i = 0; i < length; ++i) {
codePoint = string.charCodeAt(i)
// is surrogate component
if (codePoint > 0xD7FF && codePoint < 0xE000) {
// last char was a lead
if (!leadSurrogate) {
// no lead yet
if (codePoint > 0xDBFF) {
// unexpected trail
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
continue
} else if (i + 1 === length) {
// unpaired lead
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
continue
}
// valid lead
leadSurrogate = codePoint
continue
}
// 2 leads in a row
if (codePoint < 0xDC00) {
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
leadSurrogate = codePoint
continue
}
// valid surrogate pair
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
} else if (leadSurrogate) {
// valid bmp char, but last char was a lead
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
}
leadSurrogate = null
// encode utf8
if (codePoint < 0x80) {
if ((units -= 1) < 0) break
bytes.push(codePoint)
} else if (codePoint < 0x800) {
if ((units -= 2) < 0) break
bytes.push(
codePoint >> 0x6 | 0xC0,
codePoint & 0x3F | 0x80
)
} else if (codePoint < 0x10000) {
if ((units -= 3) < 0) break
bytes.push(
codePoint >> 0xC | 0xE0,
codePoint >> 0x6 & 0x3F | 0x80,
codePoint & 0x3F | 0x80
)
} else if (codePoint < 0x110000) {
if ((units -= 4) < 0) break
bytes.push(
codePoint >> 0x12 | 0xF0,
codePoint >> 0xC & 0x3F | 0x80,
codePoint >> 0x6 & 0x3F | 0x80,
codePoint & 0x3F | 0x80
)
} else {
throw new Error('Invalid code point')
}
}
return bytes
}
function asciiToBytes (str) {
var byteArray = []
for (var i = 0; i < str.length; ++i) {
// Node's code seems to be doing this and not & 0x7F..
byteArray.push(str.charCodeAt(i) & 0xFF)
}
return byteArray
}
function utf16leToBytes (str, units) {
var c, hi, lo
var byteArray = []
for (var i = 0; i < str.length; ++i) {
if ((units -= 2) < 0) break
c = str.charCodeAt(i)
hi = c >> 8
lo = c % 256
byteArray.push(lo)
byteArray.push(hi)
}
return byteArray
}
function base64ToBytes (str) {
return base64.toByteArray(base64clean(str))
}
function blitBuffer (src, dst, offset, length) {
for (var i = 0; i < length; ++i) {
if ((i + offset >= dst.length) || (i >= src.length)) break
dst[i + offset] = src[i]
}
return i
}
function isnan (val) {
return val !== val // eslint-disable-line no-self-compare
}
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(52)))
/***/ }),
/* 52 */
/***/ (function(module, exports) {
var g;
// This works in non-strict mode
g = (function() {
return this;
})();
try {
// This works if eval is allowed (see CSP)
g = g || new Function("return this")();
} catch (e) {
// This works if the window reference is available
if (typeof window === "object") g = window;
}
// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module.exports = g;
/***/ }),
/* 53 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.byteLength = byteLength
exports.toByteArray = toByteArray
exports.fromByteArray = fromByteArray
var lookup = []
var revLookup = []
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
for (var i = 0, len = code.length; i < len; ++i) {
lookup[i] = code[i]
revLookup[code.charCodeAt(i)] = i
}
// Support decoding URL-safe base64 strings, as Node.js does.
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
revLookup['-'.charCodeAt(0)] = 62
revLookup['_'.charCodeAt(0)] = 63
function getLens (b64) {
var len = b64.length
if (len % 4 > 0) {
throw new Error('Invalid string. Length must be a multiple of 4')
}
// Trim off extra bytes after placeholder bytes are found
// See: https://github.com/beatgammit/base64-js/issues/42
var validLen = b64.indexOf('=')
if (validLen === -1) validLen = len
var placeHoldersLen = validLen === len
? 0
: 4 - (validLen % 4)
return [validLen, placeHoldersLen]
}
// base64 is 4/3 + up to two characters of the original data
function byteLength (b64) {
var lens = getLens(b64)
var validLen = lens[0]
var placeHoldersLen = lens[1]
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
}
function _byteLength (b64, validLen, placeHoldersLen) {
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
}
function toByteArray (b64) {
var tmp
var lens = getLens(b64)
var validLen = lens[0]
var placeHoldersLen = lens[1]
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
var curByte = 0
// if there are placeholders, only get up to the last complete 4 chars
var len = placeHoldersLen > 0
? validLen - 4
: validLen
var i
for (i = 0; i < len; i += 4) {
tmp =
(revLookup[b64.charCodeAt(i)] << 18) |
(revLookup[b64.charCodeAt(i + 1)] << 12) |
(revLookup[b64.charCodeAt(i + 2)] << 6) |
revLookup[b64.charCodeAt(i + 3)]
arr[curByte++] = (tmp >> 16) & 0xFF
arr[curByte++] = (tmp >> 8) & 0xFF
arr[curByte++] = tmp & 0xFF
}
if (placeHoldersLen === 2) {
tmp =
(revLookup[b64.charCodeAt(i)] << 2) |
(revLookup[b64.charCodeAt(i + 1)] >> 4)
arr[curByte++] = tmp & 0xFF
}
if (placeHoldersLen === 1) {
tmp =
(revLookup[b64.charCodeAt(i)] << 10) |
(revLookup[b64.charCodeAt(i + 1)] << 4) |
(revLookup[b64.charCodeAt(i + 2)] >> 2)
arr[curByte++] = (tmp >> 8) & 0xFF
arr[curByte++] = tmp & 0xFF
}
return arr
}
function tripletToBase64 (num) {
return lookup[num >> 18 & 0x3F] +
lookup[num >> 12 & 0x3F] +
lookup[num >> 6 & 0x3F] +
lookup[num & 0x3F]
}
function encodeChunk (uint8, start, end) {
var tmp
var output = []
for (var i = start; i < end; i += 3) {
tmp =
((uint8[i] << 16) & 0xFF0000) +
((uint8[i + 1] << 8) & 0xFF00) +
(uint8[i + 2] & 0xFF)
output.push(tripletToBase64(tmp))
}
return output.join('')
}
function fromByteArray (uint8) {
var tmp
var len = uint8.length
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
var parts = []
var maxChunkLength = 16383 // must be multiple of 3
// go through the array every three bytes, we'll deal with trailing stuff later
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
}
// pad the end with zeros, but make sure to not forget the extra bytes
if (extraBytes === 1) {
tmp = uint8[len - 1]
parts.push(
lookup[tmp >> 2] +
lookup[(tmp << 4) & 0x3F] +
'=='
)
} else if (extraBytes === 2) {
tmp = (uint8[len - 2] << 8) + uint8[len - 1]
parts.push(
lookup[tmp >> 10] +
lookup[(tmp >> 4) & 0x3F] +
lookup[(tmp << 2) & 0x3F] +
'='
)
}
return parts.join('')
}
/***/ }),
/* 54 */
/***/ (function(module, exports) {
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
var e, m
var eLen = (nBytes * 8) - mLen - 1
var eMax = (1 << eLen) - 1
var eBias = eMax >> 1
var nBits = -7
var i = isLE ? (nBytes - 1) : 0
var d = isLE ? -1 : 1
var s = buffer[offset + i]
i += d
e = s & ((1 << (-nBits)) - 1)
s >>= (-nBits)
nBits += eLen
for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
m = e & ((1 << (-nBits)) - 1)
e >>= (-nBits)
nBits += mLen
for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
if (e === 0) {
e = 1 - eBias
} else if (e === eMax) {
return m ? NaN : ((s ? -1 : 1) * Infinity)
} else {
m = m + Math.pow(2, mLen)
e = e - eBias
}
return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
}
exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
var e, m, c
var eLen = (nBytes * 8) - mLen - 1
var eMax = (1 << eLen) - 1
var eBias = eMax >> 1
var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
var i = isLE ? 0 : (nBytes - 1)
var d = isLE ? 1 : -1
var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
value = Math.abs(value)
if (isNaN(value) || value === Infinity) {
m = isNaN(value) ? 1 : 0
e = eMax
} else {
e = Math.floor(Math.log(value) / Math.LN2)
if (value * (c = Math.pow(2, -e)) < 1) {
e--
c *= 2
}
if (e + eBias >= 1) {
value += rt / c
} else {
value += rt * Math.pow(2, 1 - eBias)
}
if (value * c >= 2) {
e++
c /= 2
}
if (e + eBias >= eMax) {
m = 0
e = eMax
} else if (e + eBias >= 1) {
m = ((value * c) - 1) * Math.pow(2, mLen)
e = e + eBias
} else {
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
e = 0
}
}
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
e = (e << mLen) | m
eLen += mLen
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
buffer[offset + i - d] |= s * 128
}
/***/ }),
/* 55 */
/***/ (function(module, exports) {
var toString = {}.toString;
module.exports = Array.isArray || function (arr) {
return toString.call(arr) == '[object Array]';
};
/***/ }),
/* 56 */
/***/ (function(module, exports) {
(function() {
var base64map
= 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
crypt = {
// Bit-wise rotation left
rotl: function(n, b) {
return (n << b) | (n >>> (32 - b));
},
// Bit-wise rotation right
rotr: function(n, b) {
return (n << (32 - b)) | (n >>> b);
},
// Swap big-endian to little-endian and vice versa
endian: function(n) {
// If number given, swap endian
if (n.constructor == Number) {
return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
}
// Else, assume array and swap all items
for (var i = 0; i < n.length; i++)
n[i] = crypt.endian(n[i]);
return n;
},
// Generate an array of any length of random bytes
randomBytes: function(n) {
for (var bytes = []; n > 0; n--)
bytes.push(Math.floor(Math.random() * 256));
return bytes;
},
// Convert a byte array to big-endian 32-bit words
bytesToWords: function(bytes) {
for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
words[b >>> 5] |= bytes[i] << (24 - b % 32);
return words;
},
// Convert big-endian 32-bit words to a byte array
wordsToBytes: function(words) {
for (var bytes = [], b = 0; b < words.length * 32; b += 8)
bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
return bytes;
},
// Convert a byte array to a hex string
bytesToHex: function(bytes) {
for (var hex = [], i = 0; i < bytes.length; i++) {
hex.push((bytes[i] >>> 4).toString(16));
hex.push((bytes[i] & 0xF).toString(16));
}
return hex.join('');
},
// Convert a hex string to a byte array
hexToBytes: function(hex) {
for (var bytes = [], c = 0; c < hex.length; c += 2)
bytes.push(parseInt(hex.substr(c, 2), 16));
return bytes;
},
// Convert a byte array to a base-64 string
bytesToBase64: function(bytes) {
for (var base64 = [], i = 0; i < bytes.length; i += 3) {
var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
for (var j = 0; j < 4; j++)
if (i * 8 + j * 6 <= bytes.length * 8)
base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
else
base64.push('=');
}
return base64.join('');
},
// Convert a base-64 string to a byte array
base64ToBytes: function(base64) {
// Remove non-base-64 characters
base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
imod4 = ++i % 4) {
if (imod4 == 0) continue;
bytes.push(((base64map.indexOf(base64.charAt(i - 1))
& (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
| (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
}
return bytes;
}
};
module.exports = crypt;
})();
/***/ }),
/* 57 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PlaylistEmptyError = exports.PlaylistVideosRemoveError = exports.PlaylistDataFetchError = exports.PlaylistNotEditableError = void 0;
exports.PlaylistNotEditableError = new Error('playlist is not editable');
exports.PlaylistDataFetchError = new Error('cannot fetch some data for the playlist');
exports.PlaylistVideosRemoveError = new Error('cannot remove videos from playlist');
exports.PlaylistEmptyError = new Error('playlist is empty');
/***/ }),
/* 58 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Creates an array of elements split into two groups, the first of which
* contains elements `predicate` returns truthy for, the second of which
* contains elements `predicate` returns falsey for. The predicate is
* invoked with one argument: (value).
*/
function partition(collection, predicate) {
const result = [[], []];
for (const item of collection) {
result[predicate(item) ? 0 : 1].push(item);
}
return result;
}
exports.default = partition;
/***/ }),
/* 59 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const get_elements_by_xpath_1 = __importDefault(__webpack_require__(12));
const selectors_1 = __webpack_require__(10);
function removeWatchedFromPlaylistUI(videoId) {
const playlistVideoRendererNodes = (0, get_elements_by_xpath_1.default)(selectors_1.XPATH.YT_PLAYLIST_VIDEO_RENDERERS);
for (const video of playlistVideoRendererNodes) {
if (video.data.videoId === videoId) {
video.querySelector('#overlays ytd-thumbnail-overlay-resume-playback-renderer').remove();
}
}
}
exports.default = removeWatchedFromPlaylistUI;
/***/ }),
/* 60 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeVideoFromPlaylistUI = void 0;
const remove_videos_from_playlist_1 = __importDefault(__webpack_require__(61));
const decrement_number_of_videos_in_playlist_1 = __importDefault(__webpack_require__(63));
function removeVideoFromPlaylistUI(videoId) {
try {
(0, remove_videos_from_playlist_1.default)([{ videoId, percentDurationWatched: 100 }]);
(0, decrement_number_of_videos_in_playlist_1.default)(1);
}
catch (error) {
// eslint-disable-next-line no-console
console.error(error);
// If an error occurs while trying to dynamically update the UI
// reload the page to update the UI
window.location.reload();
}
}
exports.removeVideoFromPlaylistUI = removeVideoFromPlaylistUI;
function removeVideosFromPlaylistUI(toDeleteVideos) {
try {
(0, remove_videos_from_playlist_1.default)(toDeleteVideos);
(0, decrement_number_of_videos_in_playlist_1.default)(toDeleteVideos.length);
}
catch (error) {
// eslint-disable-next-line no-console
console.error(error);
// If an error occurs while trying to dynamically update the UI
// reload the page to update the UI
window.location.reload();
}
}
exports.default = removeVideosFromPlaylistUI;
/***/ }),
/* 61 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const selectors_1 = __webpack_require__(10);
const get_elements_by_xpath_1 = __importDefault(__webpack_require__(12));
const list_map_search_1 = __importDefault(__webpack_require__(62));
function removeVideoWithYtAction(videoId) {
document.querySelectorAll('ytd-app')[0].dispatchEvent(new CustomEvent('yt-action', {
detail: {
actionName: 'yt-playlist-remove-videos-action',
args: [
{
playlistRemoveVideosAction: {
setVideoIds: [videoId],
},
},
],
returnValue: [],
},
}));
}
function removeVideosFromPlaylist(videosToDelete) {
// cast Node as any to access .data property availlable on ytd-playlist-video-renderer elements
const playlistVideoRendererNodes = (0, get_elements_by_xpath_1.default)(selectors_1.XPATH.YT_PLAYLIST_VIDEO_RENDERERS);
// All videos to remove MAY be present in the UI because if there is more videos to remove
// than videos found into the UI, some removed videos aren't loaded in the UI
const uniqueVideosToDelete = [...new Map(videosToDelete.map((item) => [item.videoId, item])).values()];
if (playlistVideoRendererNodes.length >= videosToDelete.length) {
const searchMap = (0, list_map_search_1.default)(uniqueVideosToDelete, playlistVideoRendererNodes, (video) => video.videoId, (node) => node.data.videoId);
// if all videos to remove are present in the UI
if (searchMap) {
const htmlElements = Object.values(searchMap);
for (const element of htmlElements) {
// eslint-disable-next-line no-underscore-dangle
const videoId = element.data.setVideoId;
removeVideoWithYtAction(videoId);
}
return;
}
}
throw new Error('some videos are missing from the UI, cannot dynamically delete');
}
exports.default = removeVideosFromPlaylist;
/***/ }),
/* 62 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Search into two lists of objects needles and haystack using hashmap
* If all elements from needles has been found into haystack it return the hashmap
* If some elements are missing into haystack, we return false.
*
* The hashmap keys are generated using needleGetter and haystackGetter
* The needles must not contain duplicates
*
* @param needles unique list of element to search
* @param haystack list of elements to search in
* @param needleKeyGetter get the value to use as key from needles
* @param haystackKeyGetter get the value to match with needle key
*/
function listMapSearch(needles, haystack, needleKeyGetter, haystackKeyGetter) {
const searchMap = {};
// We cannot found all our needles into our haystack
if (haystack.length < needles.length) {
return false;
}
// Fill our searchMap keys with needles to search
for (const needle of needles) {
searchMap[needleKeyGetter(needle)] = undefined;
}
// matches elements from needles with haystack
let found = 0;
for (const item of haystack) {
const itemKey = haystackKeyGetter(item);
// if key exist in the searchMap and value is still undefined
if (Object.prototype.hasOwnProperty.call(searchMap, itemKey) === true && searchMap[itemKey] === undefined) {
searchMap[itemKey] = item;
found += 1;
// early break if all elements have already been found
if (found === needles.length) {
return searchMap;
}
}
}
return found === needles.length ? searchMap : false;
}
exports.default = listMapSearch;
/***/ }),
/* 63 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const selectors_1 = __webpack_require__(10);
const get_elements_by_xpath_1 = __importDefault(__webpack_require__(12));
// Decrement the numbers of videos in the playlist in the UI
function decrementNumberOfVideosInPlaylist(value) {
const spanElement = (0, get_elements_by_xpath_1.default)(selectors_1.XPATH.YT_NUMBER_OF_VIDEOS_IN_PLAYLIST)[0];
if (spanElement) {
const newValue = Number(spanElement.textContent) - value;
spanElement.textContent = `${newValue}`;
}
else {
// A reload is performed to properly restore the state of an empty playlist:
// - The "There are no videos in this playlist yet" text
// - The "No videos" text
// Both strings are not part of the `yt.msgs_` object to use for localization
// eslint-disable-next-line no-console
console.log('empty playlist reload');
window.location.reload();
}
}
exports.default = decrementNumberOfVideosInPlaylist;
/***/ }),
/* 64 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const environment_1 = __webpack_require__(18);
const stylesheets_1 = __webpack_require__(16);
const preact_material_scss_1 = __importDefault(__webpack_require__(65));
const STYLESHEETS = {
preactMaterial: (0, stylesheets_1.stylesheet)({
condition: environment_1.ALWAYS,
css: preact_material_scss_1.default,
}),
};
// This trick uncovers type errors in STYLESHEETS
// while retaining the static knowledge of its properties
// (so we can still write e.g. STYLESHEETS.foo):
const style = STYLESHEETS;
// eslint-disable-next-line no-void
void style;
exports.default = STYLESHEETS;
/***/ }),
/* 65 */
/***/ (function(module, exports, __webpack_require__) {
var result = __webpack_require__(66);
if (result && result.__esModule) {
result = result.default;
}
if (typeof result === "string") {
module.exports = result;
} else {
module.exports = result.toString();
}
/***/ }),
/* 66 */
/***/ (function(module, exports, __webpack_require__) {
// Imports
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(15);
var ___CSS_LOADER_AT_RULE_IMPORT_0___ = __webpack_require__(67);
var ___CSS_LOADER_AT_RULE_IMPORT_1___ = __webpack_require__(68);
var ___CSS_LOADER_AT_RULE_IMPORT_2___ = __webpack_require__(69);
var ___CSS_LOADER_AT_RULE_IMPORT_3___ = __webpack_require__(70);
exports = ___CSS_LOADER_API_IMPORT___(false);
exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___);
exports.i(___CSS_LOADER_AT_RULE_IMPORT_1___);
exports.i(___CSS_LOADER_AT_RULE_IMPORT_2___);
exports.i(___CSS_LOADER_AT_RULE_IMPORT_3___);
// Module
exports.push([module.i, "#yt-playlists-delete-enhancer{--mdc-theme-primary: #e10000;--mdc-theme-on-primary: #fff;--mdc-theme-accent: #e10000;--mdc-theme-secondary: #e10000;--mdc-theme-on-secondary: #fff;--mdc-theme-background: #fff;--mdc-theme-surface: #fff;--mdc-theme-on-surface: #fff}@font-face{font-family:\"Material Icons\";font-style:normal;font-weight:400;src:url(https://fonts.gstatic.com/s/materialicons/v139/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2) format(\"woff2\")}.material-icons{font-family:\"Material Icons\";font-weight:normal;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-moz-font-feature-settings:\"liga\";-moz-osx-font-smoothing:grayscale}", ""]);
// Exports
exports.locals = {
"yt-playlists-delete-enhancer": "yt-playlists-delete-enhancer",
"material-icons": "material-icons"
};
module.exports = exports;
/***/ }),
/* 67 */
/***/ (function(module, exports, __webpack_require__) {
// Imports
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(15);
exports = ___CSS_LOADER_API_IMPORT___(false);
// Module
exports.push([module.i, "/*!\n Material Components for the Web\n Copyright (c) 2018 Google Inc.\n License: MIT\n*/\n@-webkit-keyframes mdc-ripple-fg-radius-in {\n from {\n -webkit-animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n -webkit-transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1);\n transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1); }\n to {\n -webkit-transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));\n transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1)); } }\n\n@keyframes mdc-ripple-fg-radius-in {\n from {\n -webkit-animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n -webkit-transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1);\n transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1); }\n to {\n -webkit-transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));\n transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1)); } }\n\n@-webkit-keyframes mdc-ripple-fg-opacity-in {\n from {\n -webkit-animation-timing-function: linear;\n animation-timing-function: linear;\n opacity: 0; }\n to {\n opacity: var(--mdc-ripple-fg-opacity, 0); } }\n\n@keyframes mdc-ripple-fg-opacity-in {\n from {\n -webkit-animation-timing-function: linear;\n animation-timing-function: linear;\n opacity: 0; }\n to {\n opacity: var(--mdc-ripple-fg-opacity, 0); } }\n\n@-webkit-keyframes mdc-ripple-fg-opacity-out {\n from {\n -webkit-animation-timing-function: linear;\n animation-timing-function: linear;\n opacity: var(--mdc-ripple-fg-opacity, 0); }\n to {\n opacity: 0; } }\n\n@keyframes mdc-ripple-fg-opacity-out {\n from {\n -webkit-animation-timing-function: linear;\n animation-timing-function: linear;\n opacity: var(--mdc-ripple-fg-opacity, 0); }\n to {\n opacity: 0; } }\n\n.mdc-ripple-surface--test-edge-var-bug {\n --mdc-ripple-surface-test-edge-var: 1px solid #000;\n visibility: hidden; }\n .mdc-ripple-surface--test-edge-var-bug::before {\n border: var(--mdc-ripple-surface-test-edge-var); }\n\n.mdc-button {\n font-family: Roboto, sans-serif;\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n font-size: 0.875rem;\n line-height: 2.25rem;\n font-weight: 500;\n letter-spacing: 0.08929em;\n text-decoration: none;\n text-transform: uppercase;\n --mdc-ripple-fg-size: 0;\n --mdc-ripple-left: 0;\n --mdc-ripple-top: 0;\n --mdc-ripple-fg-scale: 1;\n --mdc-ripple-fg-translate-end: 0;\n --mdc-ripple-fg-translate-start: 0;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n will-change: transform, opacity;\n padding: 0 8px 0 8px;\n display: inline-flex;\n position: relative;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n min-width: 64px;\n height: 36px;\n border: none;\n outline: none;\n /* @alternate */\n line-height: inherit;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n -webkit-appearance: none;\n overflow: hidden;\n vertical-align: middle;\n border-radius: 2px; }\n .mdc-button::before, .mdc-button::after {\n position: absolute;\n border-radius: 50%;\n opacity: 0;\n pointer-events: none;\n content: \"\"; }\n .mdc-button::before {\n transition: opacity 15ms linear;\n z-index: 1; }\n .mdc-button.mdc-ripple-upgraded::before {\n -webkit-transform: scale(var(--mdc-ripple-fg-scale, 1));\n transform: scale(var(--mdc-ripple-fg-scale, 1)); }\n .mdc-button.mdc-ripple-upgraded::after {\n top: 0;\n /* @noflip */\n left: 0;\n -webkit-transform: scale(0);\n transform: scale(0);\n -webkit-transform-origin: center center;\n transform-origin: center center; }\n .mdc-button.mdc-ripple-upgraded--unbounded::after {\n top: var(--mdc-ripple-top, 0);\n /* @noflip */\n left: var(--mdc-ripple-left, 0); }\n .mdc-button.mdc-ripple-upgraded--foreground-activation::after {\n -webkit-animation: 225ms :local(mdc-ripple-fg-radius-in) forwards, 75ms :local(mdc-ripple-fg-opacity-in) forwards;\n animation: 225ms :local(mdc-ripple-fg-radius-in) forwards, 75ms :local(mdc-ripple-fg-opacity-in) forwards; }\n .mdc-button.mdc-ripple-upgraded--foreground-deactivation::after {\n -webkit-animation: 150ms :local(mdc-ripple-fg-opacity-out);\n animation: 150ms :local(mdc-ripple-fg-opacity-out);\n -webkit-transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));\n transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1)); }\n .mdc-button::before, .mdc-button::after {\n top: calc(50% - 100%);\n /* @noflip */\n left: calc(50% - 100%);\n width: 200%;\n height: 200%; }\n .mdc-button.mdc-ripple-upgraded::after {\n width: var(--mdc-ripple-fg-size, 100%);\n height: var(--mdc-ripple-fg-size, 100%); }\n .mdc-button::-moz-focus-inner {\n padding: 0;\n border: 0; }\n .mdc-button:active {\n outline: none; }\n .mdc-button:hover {\n cursor: pointer; }\n .mdc-button:disabled {\n background-color: transparent;\n color: rgba(0, 0, 0, 0.37);\n cursor: default;\n pointer-events: none; }\n .mdc-button:not(:disabled) {\n background-color: transparent; }\n .mdc-button:not(:disabled) {\n color: #6200ee;\n /* @alternate */\n color: var(--mdc-theme-primary, #6200ee); }\n .mdc-button::before, .mdc-button::after {\n background-color: #6200ee; }\n @supports not (-ms-ime-align: auto) {\n .mdc-button::before, .mdc-button::after {\n /* @alternate */\n background-color: var(--mdc-theme-primary, #6200ee); } }\n .mdc-button:hover::before {\n opacity: 0.04; }\n .mdc-button:not(.mdc-ripple-upgraded):focus::before, .mdc-button.mdc-ripple-upgraded--background-focused::before {\n transition-duration: 75ms;\n opacity: 0.12; }\n .mdc-button:not(.mdc-ripple-upgraded)::after {\n transition: opacity 150ms linear; }\n .mdc-button:not(.mdc-ripple-upgraded):active::after {\n transition-duration: 75ms;\n opacity: 0.16; }\n .mdc-button.mdc-ripple-upgraded {\n --mdc-ripple-fg-opacity: 0.16; }\n .mdc-button .mdc-button__icon {\n /* @noflip */\n margin-left: 0;\n /* @noflip */\n margin-right: 8px;\n display: inline-block;\n width: 18px;\n height: 18px;\n font-size: 18px;\n vertical-align: top; }\n [dir=\"rtl\"] .mdc-button .mdc-button__icon, .mdc-button .mdc-button__icon[dir=\"rtl\"] {\n /* @noflip */\n margin-left: 8px;\n /* @noflip */\n margin-right: 0; }\n .mdc-button svg.mdc-button__icon {\n fill: currentColor; }\n\n.mdc-button--raised .mdc-button__icon,\n.mdc-button--unelevated .mdc-button__icon,\n.mdc-button--outlined .mdc-button__icon {\n /* @noflip */\n margin-left: -4px;\n /* @noflip */\n margin-right: 8px; }\n [dir=\"rtl\"] .mdc-button--raised .mdc-button__icon, .mdc-button--raised .mdc-button__icon[dir=\"rtl\"], [dir=\"rtl\"]\n .mdc-button--unelevated .mdc-button__icon,\n .mdc-button--unelevated .mdc-button__icon[dir=\"rtl\"], [dir=\"rtl\"]\n .mdc-button--outlined .mdc-button__icon,\n .mdc-button--outlined .mdc-button__icon[dir=\"rtl\"] {\n /* @noflip */\n margin-left: 8px;\n /* @noflip */\n margin-right: -4px; }\n\n.mdc-button--raised,\n.mdc-button--unelevated {\n padding: 0 16px 0 16px; }\n .mdc-button--raised:disabled,\n .mdc-button--unelevated:disabled {\n background-color: rgba(0, 0, 0, 0.12);\n color: rgba(0, 0, 0, 0.37); }\n .mdc-button--raised:not(:disabled),\n .mdc-button--unelevated:not(:disabled) {\n background-color: #6200ee; }\n @supports not (-ms-ime-align: auto) {\n .mdc-button--raised:not(:disabled),\n .mdc-button--unelevated:not(:disabled) {\n /* @alternate */\n background-color: var(--mdc-theme-primary, #6200ee); } }\n .mdc-button--raised:not(:disabled),\n .mdc-button--unelevated:not(:disabled) {\n color: #fff;\n /* @alternate */\n color: var(--mdc-theme-on-primary, #fff); }\n .mdc-button--raised::before, .mdc-button--raised::after,\n .mdc-button--unelevated::before,\n .mdc-button--unelevated::after {\n background-color: #fff; }\n @supports not (-ms-ime-align: auto) {\n .mdc-button--raised::before, .mdc-button--raised::after,\n .mdc-button--unelevated::before,\n .mdc-button--unelevated::after {\n /* @alternate */\n background-color: var(--mdc-theme-on-primary, #fff); } }\n .mdc-button--raised:hover::before,\n .mdc-button--unelevated:hover::before {\n opacity: 0.08; }\n .mdc-button--raised:not(.mdc-ripple-upgraded):focus::before, .mdc-button--raised.mdc-ripple-upgraded--background-focused::before,\n .mdc-button--unelevated:not(.mdc-ripple-upgraded):focus::before,\n .mdc-button--unelevated.mdc-ripple-upgraded--background-focused::before {\n transition-duration: 75ms;\n opacity: 0.24; }\n .mdc-button--raised:not(.mdc-ripple-upgraded)::after,\n .mdc-button--unelevated:not(.mdc-ripple-upgraded)::after {\n transition: opacity 150ms linear; }\n .mdc-button--raised:not(.mdc-ripple-upgraded):active::after,\n .mdc-button--unelevated:not(.mdc-ripple-upgraded):active::after {\n transition-duration: 75ms;\n opacity: 0.32; }\n .mdc-button--raised.mdc-ripple-upgraded,\n .mdc-button--unelevated.mdc-ripple-upgraded {\n --mdc-ripple-fg-opacity: 0.32; }\n\n.mdc-button--raised {\n box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);\n transition: box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1); }\n .mdc-button--raised:hover, .mdc-button--raised:focus {\n box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12); }\n .mdc-button--raised:active {\n box-shadow: 0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12); }\n .mdc-button--raised:disabled {\n box-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12); }\n\n.mdc-button--outlined {\n border-style: solid;\n padding: 0 14px 0 14px;\n border-width: 2px; }\n .mdc-button--outlined:disabled {\n border-color: rgba(0, 0, 0, 0.37); }\n .mdc-button--outlined:not(:disabled) {\n border-color: #6200ee;\n /* @alternate */\n border-color: var(--mdc-theme-primary, #6200ee); }\n\n.mdc-button--dense {\n height: 32px;\n font-size: .8125rem; }", ""]);
// Exports
exports.locals = {
"mdc-ripple-surface--test-edge-var-bug": "mdc-ripple-surface--test-edge-var-bug",
"mdc-button": "mdc-button",
"mdc-ripple-upgraded": "mdc-ripple-upgraded",
"mdc-ripple-upgraded--unbounded": "mdc-ripple-upgraded--unbounded",
"mdc-ripple-upgraded--foreground-activation": "mdc-ripple-upgraded--foreground-activation",
"mdc-ripple-upgraded--foreground-deactivation": "mdc-ripple-upgraded--foreground-deactivation",
"mdc-ripple-upgraded--background-focused": "mdc-ripple-upgraded--background-focused",
"mdc-button__icon": "mdc-button__icon",
"mdc-button--raised": "mdc-button--raised",
"mdc-button--unelevated": "mdc-button--unelevated",
"mdc-button--outlined": "mdc-button--outlined",
"mdc-button--dense": "mdc-button--dense",
"mdc-ripple-fg-radius-in": "mdc-ripple-fg-radius-in",
"mdc-ripple-fg-opacity-in": "mdc-ripple-fg-opacity-in",
"mdc-ripple-fg-opacity-out": "mdc-ripple-fg-opacity-out"
};
module.exports = exports;
/***/ }),
/* 68 */
/***/ (function(module, exports, __webpack_require__) {
// Imports
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(15);
exports = ___CSS_LOADER_API_IMPORT___(false);
// Module
exports.push([module.i, "/*!\n Material Components for the Web\n Copyright (c) 2018 Google Inc.\n License: MIT\n*/\n@-webkit-keyframes mdc-slider-emphasize {\n 0% {\n -webkit-animation-timing-function: ease-out;\n animation-timing-function: ease-out; }\n 50% {\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in;\n -webkit-transform: scale(0.85);\n transform: scale(0.85); }\n 100% {\n -webkit-transform: scale(0.571);\n transform: scale(0.571); } }\n\n@keyframes mdc-slider-emphasize {\n 0% {\n -webkit-animation-timing-function: ease-out;\n animation-timing-function: ease-out; }\n 50% {\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in;\n -webkit-transform: scale(0.85);\n transform: scale(0.85); }\n 100% {\n -webkit-transform: scale(0.571);\n transform: scale(0.571); } }\n\n.mdc-slider {\n position: relative;\n width: 100%;\n height: 48px;\n cursor: pointer;\n touch-action: pan-x;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0); }\n .mdc-slider:not(.mdc-slider--disabled) .mdc-slider__track {\n background-color: #018786;\n /* @alternate */\n background-color: var(--mdc-theme-secondary, #018786); }\n .mdc-slider:not(.mdc-slider--disabled) .mdc-slider__track-container {\n background-color: rgba(1, 135, 134, 0.26); }\n .mdc-slider:not(.mdc-slider--disabled) .mdc-slider__track-marker::after,\n .mdc-slider:not(.mdc-slider--disabled) .mdc-slider__track-marker-container::after {\n background-color: #018786;\n /* @alternate */\n background-color: var(--mdc-theme-secondary, #018786); }\n .mdc-slider:not(.mdc-slider--disabled) .mdc-slider__thumb {\n fill: #018786;\n /* @alternate */\n fill: var(--mdc-theme-secondary, #018786);\n stroke: #018786;\n /* @alternate */\n stroke: var(--mdc-theme-secondary, #018786); }\n .mdc-slider:not(.mdc-slider--disabled) .mdc-slider__focus-ring {\n background-color: #018786;\n /* @alternate */\n background-color: var(--mdc-theme-secondary, #018786); }\n .mdc-slider:not(.mdc-slider--disabled) .mdc-slider__pin {\n background-color: #018786;\n /* @alternate */\n background-color: var(--mdc-theme-secondary, #018786); }\n .mdc-slider:not(.mdc-slider--disabled) .mdc-slider__pin {\n color: white;\n /* @alternate */\n color: var(--mdc-theme-text-primary-on-dark, white); }\n .mdc-slider--disabled {\n cursor: auto; }\n .mdc-slider--disabled .mdc-slider__track {\n background-color: #9a9a9a; }\n .mdc-slider--disabled .mdc-slider__track-container {\n background-color: rgba(154, 154, 154, 0.26); }\n .mdc-slider--disabled .mdc-slider__track-marker::after,\n .mdc-slider--disabled .mdc-slider__track-marker-container::after {\n background-color: #9a9a9a; }\n .mdc-slider--disabled .mdc-slider__thumb {\n fill: #9a9a9a;\n stroke: #9a9a9a; }\n .mdc-slider--disabled .mdc-slider__thumb {\n /* @alternate */\n stroke: white;\n stroke: var(--mdc-slider-bg-color-behind-component, white); }\n .mdc-slider:focus {\n outline: none; }\n .mdc-slider__track-container {\n position: absolute;\n top: 50%;\n width: 100%;\n height: 2px;\n overflow: hidden; }\n .mdc-slider__track {\n position: absolute;\n width: 100%;\n height: 100%;\n -webkit-transform-origin: left top;\n transform-origin: left top;\n will-change: transform; }\n .mdc-slider[dir=\"rtl\"] .mdc-slider__track,\n [dir=\"rtl\"] .mdc-slider .mdc-slider__track {\n -webkit-transform-origin: right top;\n transform-origin: right top; }\n .mdc-slider__track-marker-container {\n display: flex;\n margin-right: 0;\n margin-left: -1px;\n visibility: hidden; }\n .mdc-slider[dir=\"rtl\"] .mdc-slider__track-marker-container,\n [dir=\"rtl\"] .mdc-slider .mdc-slider__track-marker-container {\n margin-right: -1px;\n margin-left: 0; }\n .mdc-slider__track-marker-container::after {\n display: block;\n width: 2px;\n height: 2px;\n content: \"\"; }\n .mdc-slider__track-marker {\n flex: 1; }\n .mdc-slider__track-marker::after {\n display: block;\n width: 2px;\n height: 2px;\n content: \"\"; }\n .mdc-slider__track-marker:first-child::after {\n width: 3px; }\n .mdc-slider__thumb-container {\n position: absolute;\n top: 15px;\n left: 0;\n width: 21px;\n height: 100%;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n will-change: transform; }\n .mdc-slider__thumb {\n position: absolute;\n top: 0;\n left: 0;\n -webkit-transform: scale(0.571);\n transform: scale(0.571);\n transition: fill 100ms ease-out, stroke 100ms ease-out, -webkit-transform 100ms ease-out;\n transition: transform 100ms ease-out, fill 100ms ease-out, stroke 100ms ease-out;\n transition: transform 100ms ease-out, fill 100ms ease-out, stroke 100ms ease-out, -webkit-transform 100ms ease-out;\n stroke-width: 3.5; }\n .mdc-slider__focus-ring {\n width: 21px;\n height: 21px;\n transition: opacity 266.67ms ease-out, background-color 266.67ms ease-out, -webkit-transform 266.67ms ease-out;\n transition: transform 266.67ms ease-out, opacity 266.67ms ease-out, background-color 266.67ms ease-out;\n transition: transform 266.67ms ease-out, opacity 266.67ms ease-out, background-color 266.67ms ease-out, -webkit-transform 266.67ms ease-out;\n border-radius: 50%;\n opacity: 0; }\n .mdc-slider__pin {\n display: flex;\n position: absolute;\n top: 0;\n left: 0;\n align-items: center;\n justify-content: center;\n width: 26px;\n height: 26px;\n margin-top: -2px;\n margin-left: -2px;\n -webkit-transform: rotate(-45deg) scale(0) translate(0, 0);\n transform: rotate(-45deg) scale(0) translate(0, 0);\n transition: -webkit-transform 100ms ease-out;\n transition: transform 100ms ease-out;\n transition: transform 100ms ease-out, -webkit-transform 100ms ease-out;\n border-radius: 50% 50% 50% 0%;\n z-index: 1; }\n .mdc-slider__pin-value-marker {\n font-family: Roboto, sans-serif;\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n font-size: 0.875rem;\n line-height: 1.25rem;\n font-weight: 400;\n letter-spacing: 0.01786em;\n text-decoration: inherit;\n text-transform: inherit;\n -webkit-transform: rotate(45deg);\n transform: rotate(45deg); }\n\n.mdc-slider--active .mdc-slider__thumb {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); }\n\n.mdc-slider--focus .mdc-slider__thumb {\n -webkit-animation: mdc-slider-emphasize 266.67ms linear;\n animation: mdc-slider-emphasize 266.67ms linear; }\n\n.mdc-slider--focus .mdc-slider__focus-ring {\n -webkit-transform: scale3d(1.55, 1.55, 1.55);\n transform: scale3d(1.55, 1.55, 1.55);\n opacity: .25; }\n\n.mdc-slider--in-transit .mdc-slider__thumb {\n transition-delay: 140ms; }\n\n.mdc-slider--in-transit .mdc-slider__thumb-container,\n.mdc-slider--in-transit .mdc-slider__track,\n.mdc-slider:focus:not(.mdc-slider--active) .mdc-slider__thumb-container,\n.mdc-slider:focus:not(.mdc-slider--active) .mdc-slider__track {\n transition: -webkit-transform 80ms ease;\n transition: transform 80ms ease;\n transition: transform 80ms ease, -webkit-transform 80ms ease; }\n\n.mdc-slider--discrete.mdc-slider--active .mdc-slider__thumb {\n -webkit-transform: scale(calc(12 / 21));\n transform: scale(calc(12 / 21)); }\n\n.mdc-slider--discrete.mdc-slider--active .mdc-slider__pin {\n -webkit-transform: rotate(-45deg) scale(1) translate(19px, -20px);\n transform: rotate(-45deg) scale(1) translate(19px, -20px); }\n\n.mdc-slider--discrete.mdc-slider--focus .mdc-slider__thumb {\n -webkit-animation: none;\n animation: none; }\n\n.mdc-slider--discrete.mdc-slider--display-markers .mdc-slider__track-marker-container {\n visibility: visible; }", ""]);
// Exports
exports.locals = {
"mdc-slider": "mdc-slider",
"mdc-slider--disabled": "mdc-slider--disabled",
"mdc-slider__track": "mdc-slider__track",
"mdc-slider__track-container": "mdc-slider__track-container",
"mdc-slider__track-marker": "mdc-slider__track-marker",
"mdc-slider__track-marker-container": "mdc-slider__track-marker-container",
"mdc-slider__thumb": "mdc-slider__thumb",
"mdc-slider__focus-ring": "mdc-slider__focus-ring",
"mdc-slider__pin": "mdc-slider__pin",
"mdc-slider__thumb-container": "mdc-slider__thumb-container",
"mdc-slider__pin-value-marker": "mdc-slider__pin-value-marker",
"mdc-slider--active": "mdc-slider--active",
"mdc-slider--focus": "mdc-slider--focus",
"mdc-slider-emphasize": "mdc-slider-emphasize",
"mdc-slider--in-transit": "mdc-slider--in-transit",
"mdc-slider--discrete": "mdc-slider--discrete",
"mdc-slider--display-markers": "mdc-slider--display-markers"
};
module.exports = exports;
/***/ }),
/* 69 */
/***/ (function(module, exports, __webpack_require__) {
// Imports
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(15);
exports = ___CSS_LOADER_API_IMPORT___(false);
// Module
exports.push([module.i, "/*!\n Material Components for the Web\n Copyright (c) 2018 Google Inc.\n License: MIT\n*/\n@-webkit-keyframes primary-indeterminate-translate {\n 0% {\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 20% {\n -webkit-animation-timing-function: cubic-bezier(0.5, 0, 0.70173, 0.49582);\n animation-timing-function: cubic-bezier(0.5, 0, 0.70173, 0.49582);\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 59.15% {\n -webkit-animation-timing-function: cubic-bezier(0.30244, 0.38135, 0.55, 0.95635);\n animation-timing-function: cubic-bezier(0.30244, 0.38135, 0.55, 0.95635);\n -webkit-transform: translateX(83.67142%);\n transform: translateX(83.67142%); }\n 100% {\n -webkit-transform: translateX(200.61106%);\n transform: translateX(200.61106%); } }\n\n@keyframes primary-indeterminate-translate {\n 0% {\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 20% {\n -webkit-animation-timing-function: cubic-bezier(0.5, 0, 0.70173, 0.49582);\n animation-timing-function: cubic-bezier(0.5, 0, 0.70173, 0.49582);\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 59.15% {\n -webkit-animation-timing-function: cubic-bezier(0.30244, 0.38135, 0.55, 0.95635);\n animation-timing-function: cubic-bezier(0.30244, 0.38135, 0.55, 0.95635);\n -webkit-transform: translateX(83.67142%);\n transform: translateX(83.67142%); }\n 100% {\n -webkit-transform: translateX(200.61106%);\n transform: translateX(200.61106%); } }\n\n@-webkit-keyframes primary-indeterminate-scale {\n 0% {\n -webkit-transform: scaleX(0.08);\n transform: scaleX(0.08); }\n 36.65% {\n -webkit-animation-timing-function: cubic-bezier(0.33473, 0.12482, 0.78584, 1);\n animation-timing-function: cubic-bezier(0.33473, 0.12482, 0.78584, 1);\n -webkit-transform: scaleX(0.08);\n transform: scaleX(0.08); }\n 69.15% {\n -webkit-animation-timing-function: cubic-bezier(0.06, 0.11, 0.6, 1);\n animation-timing-function: cubic-bezier(0.06, 0.11, 0.6, 1);\n -webkit-transform: scaleX(0.66148);\n transform: scaleX(0.66148); }\n 100% {\n -webkit-transform: scaleX(0.08);\n transform: scaleX(0.08); } }\n\n@keyframes primary-indeterminate-scale {\n 0% {\n -webkit-transform: scaleX(0.08);\n transform: scaleX(0.08); }\n 36.65% {\n -webkit-animation-timing-function: cubic-bezier(0.33473, 0.12482, 0.78584, 1);\n animation-timing-function: cubic-bezier(0.33473, 0.12482, 0.78584, 1);\n -webkit-transform: scaleX(0.08);\n transform: scaleX(0.08); }\n 69.15% {\n -webkit-animation-timing-function: cubic-bezier(0.06, 0.11, 0.6, 1);\n animation-timing-function: cubic-bezier(0.06, 0.11, 0.6, 1);\n -webkit-transform: scaleX(0.66148);\n transform: scaleX(0.66148); }\n 100% {\n -webkit-transform: scaleX(0.08);\n transform: scaleX(0.08); } }\n\n@-webkit-keyframes secondary-indeterminate-translate {\n 0% {\n -webkit-animation-timing-function: cubic-bezier(0.15, 0, 0.51506, 0.40969);\n animation-timing-function: cubic-bezier(0.15, 0, 0.51506, 0.40969);\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 25% {\n -webkit-animation-timing-function: cubic-bezier(0.31033, 0.28406, 0.8, 0.73371);\n animation-timing-function: cubic-bezier(0.31033, 0.28406, 0.8, 0.73371);\n -webkit-transform: translateX(37.65191%);\n transform: translateX(37.65191%); }\n 48.35% {\n -webkit-animation-timing-function: cubic-bezier(0.4, 0.62704, 0.6, 0.90203);\n animation-timing-function: cubic-bezier(0.4, 0.62704, 0.6, 0.90203);\n -webkit-transform: translateX(84.38617%);\n transform: translateX(84.38617%); }\n 100% {\n -webkit-transform: translateX(160.27778%);\n transform: translateX(160.27778%); } }\n\n@keyframes secondary-indeterminate-translate {\n 0% {\n -webkit-animation-timing-function: cubic-bezier(0.15, 0, 0.51506, 0.40969);\n animation-timing-function: cubic-bezier(0.15, 0, 0.51506, 0.40969);\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 25% {\n -webkit-animation-timing-function: cubic-bezier(0.31033, 0.28406, 0.8, 0.73371);\n animation-timing-function: cubic-bezier(0.31033, 0.28406, 0.8, 0.73371);\n -webkit-transform: translateX(37.65191%);\n transform: translateX(37.65191%); }\n 48.35% {\n -webkit-animation-timing-function: cubic-bezier(0.4, 0.62704, 0.6, 0.90203);\n animation-timing-function: cubic-bezier(0.4, 0.62704, 0.6, 0.90203);\n -webkit-transform: translateX(84.38617%);\n transform: translateX(84.38617%); }\n 100% {\n -webkit-transform: translateX(160.27778%);\n transform: translateX(160.27778%); } }\n\n@-webkit-keyframes secondary-indeterminate-scale {\n 0% {\n -webkit-animation-timing-function: cubic-bezier(0.20503, 0.05705, 0.57661, 0.45397);\n animation-timing-function: cubic-bezier(0.20503, 0.05705, 0.57661, 0.45397);\n -webkit-transform: scaleX(0.08);\n transform: scaleX(0.08); }\n 19.15% {\n -webkit-animation-timing-function: cubic-bezier(0.15231, 0.19643, 0.64837, 1.00432);\n animation-timing-function: cubic-bezier(0.15231, 0.19643, 0.64837, 1.00432);\n -webkit-transform: scaleX(0.4571);\n transform: scaleX(0.4571); }\n 44.15% {\n -webkit-animation-timing-function: cubic-bezier(0.25776, -0.00316, 0.21176, 1.38179);\n animation-timing-function: cubic-bezier(0.25776, -0.00316, 0.21176, 1.38179);\n -webkit-transform: scaleX(0.72796);\n transform: scaleX(0.72796); }\n 100% {\n -webkit-transform: scaleX(0.08);\n transform: scaleX(0.08); } }\n\n@keyframes secondary-indeterminate-scale {\n 0% {\n -webkit-animation-timing-function: cubic-bezier(0.20503, 0.05705, 0.57661, 0.45397);\n animation-timing-function: cubic-bezier(0.20503, 0.05705, 0.57661, 0.45397);\n -webkit-transform: scaleX(0.08);\n transform: scaleX(0.08); }\n 19.15% {\n -webkit-animation-timing-function: cubic-bezier(0.15231, 0.19643, 0.64837, 1.00432);\n animation-timing-function: cubic-bezier(0.15231, 0.19643, 0.64837, 1.00432);\n -webkit-transform: scaleX(0.4571);\n transform: scaleX(0.4571); }\n 44.15% {\n -webkit-animation-timing-function: cubic-bezier(0.25776, -0.00316, 0.21176, 1.38179);\n animation-timing-function: cubic-bezier(0.25776, -0.00316, 0.21176, 1.38179);\n -webkit-transform: scaleX(0.72796);\n transform: scaleX(0.72796); }\n 100% {\n -webkit-transform: scaleX(0.08);\n transform: scaleX(0.08); } }\n\n@-webkit-keyframes buffering {\n to {\n -webkit-transform: translateX(-10px);\n transform: translateX(-10px); } }\n\n@keyframes buffering {\n to {\n -webkit-transform: translateX(-10px);\n transform: translateX(-10px); } }\n\n@-webkit-keyframes primary-indeterminate-translate-reverse {\n 0% {\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 20% {\n -webkit-animation-timing-function: cubic-bezier(0.5, 0, 0.70173, 0.49582);\n animation-timing-function: cubic-bezier(0.5, 0, 0.70173, 0.49582);\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 59.15% {\n -webkit-animation-timing-function: cubic-bezier(0.30244, 0.38135, 0.55, 0.95635);\n animation-timing-function: cubic-bezier(0.30244, 0.38135, 0.55, 0.95635);\n -webkit-transform: translateX(-83.67142%);\n transform: translateX(-83.67142%); }\n 100% {\n -webkit-transform: translateX(-200.61106%);\n transform: translateX(-200.61106%); } }\n\n@keyframes primary-indeterminate-translate-reverse {\n 0% {\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 20% {\n -webkit-animation-timing-function: cubic-bezier(0.5, 0, 0.70173, 0.49582);\n animation-timing-function: cubic-bezier(0.5, 0, 0.70173, 0.49582);\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 59.15% {\n -webkit-animation-timing-function: cubic-bezier(0.30244, 0.38135, 0.55, 0.95635);\n animation-timing-function: cubic-bezier(0.30244, 0.38135, 0.55, 0.95635);\n -webkit-transform: translateX(-83.67142%);\n transform: translateX(-83.67142%); }\n 100% {\n -webkit-transform: translateX(-200.61106%);\n transform: translateX(-200.61106%); } }\n\n@-webkit-keyframes secondary-indeterminate-translate-reverse {\n 0% {\n -webkit-animation-timing-function: cubic-bezier(0.15, 0, 0.51506, 0.40969);\n animation-timing-function: cubic-bezier(0.15, 0, 0.51506, 0.40969);\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 25% {\n -webkit-animation-timing-function: cubic-bezier(0.31033, 0.28406, 0.8, 0.73371);\n animation-timing-function: cubic-bezier(0.31033, 0.28406, 0.8, 0.73371);\n -webkit-transform: translateX(-37.65191%);\n transform: translateX(-37.65191%); }\n 48.35% {\n -webkit-animation-timing-function: cubic-bezier(0.4, 0.62704, 0.6, 0.90203);\n animation-timing-function: cubic-bezier(0.4, 0.62704, 0.6, 0.90203);\n -webkit-transform: translateX(-84.38617%);\n transform: translateX(-84.38617%); }\n 100% {\n -webkit-transform: translateX(-160.27778%);\n transform: translateX(-160.27778%); } }\n\n@keyframes secondary-indeterminate-translate-reverse {\n 0% {\n -webkit-animation-timing-function: cubic-bezier(0.15, 0, 0.51506, 0.40969);\n animation-timing-function: cubic-bezier(0.15, 0, 0.51506, 0.40969);\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 25% {\n -webkit-animation-timing-function: cubic-bezier(0.31033, 0.28406, 0.8, 0.73371);\n animation-timing-function: cubic-bezier(0.31033, 0.28406, 0.8, 0.73371);\n -webkit-transform: translateX(-37.65191%);\n transform: translateX(-37.65191%); }\n 48.35% {\n -webkit-animation-timing-function: cubic-bezier(0.4, 0.62704, 0.6, 0.90203);\n animation-timing-function: cubic-bezier(0.4, 0.62704, 0.6, 0.90203);\n -webkit-transform: translateX(-84.38617%);\n transform: translateX(-84.38617%); }\n 100% {\n -webkit-transform: translateX(-160.27778%);\n transform: translateX(-160.27778%); } }\n\n@-webkit-keyframes buffering-reverse {\n to {\n -webkit-transform: translateX(10px);\n transform: translateX(10px); } }\n\n@keyframes buffering-reverse {\n to {\n -webkit-transform: translateX(10px);\n transform: translateX(10px); } }\n\n.mdc-linear-progress {\n position: relative;\n width: 100%;\n height: 4px;\n -webkit-transform: translateZ(0);\n transform: translateZ(0);\n transition: opacity 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1);\n overflow: hidden; }\n .mdc-linear-progress__bar {\n position: absolute;\n width: 100%;\n height: 100%;\n -webkit-animation: none;\n animation: none;\n -webkit-transform-origin: top left;\n transform-origin: top left;\n transition: -webkit-transform 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1);\n transition: transform 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1);\n transition: transform 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1), -webkit-transform 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1); }\n .mdc-linear-progress__bar-inner {\n display: inline-block;\n position: absolute;\n width: 100%;\n height: 100%;\n -webkit-animation: none;\n animation: none; }\n .mdc-linear-progress__buffering-dots {\n position: absolute;\n width: 100%;\n height: 100%;\n -webkit-animation: buffering 250ms infinite linear;\n animation: buffering 250ms infinite linear;\n background-repeat: repeat-x;\n background-size: 10px 4px; }\n .mdc-linear-progress__buffer {\n position: absolute;\n width: 100%;\n height: 100%;\n -webkit-transform-origin: top left;\n transform-origin: top left;\n transition: -webkit-transform 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1);\n transition: transform 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1);\n transition: transform 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1), -webkit-transform 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1); }\n .mdc-linear-progress__primary-bar {\n -webkit-transform: scaleX(0);\n transform: scaleX(0); }\n .mdc-linear-progress__secondary-bar {\n visibility: hidden; }\n .mdc-linear-progress--indeterminate .mdc-linear-progress__bar {\n transition: none; }\n .mdc-linear-progress--indeterminate .mdc-linear-progress__primary-bar {\n left: -145.166611%;\n -webkit-animation: primary-indeterminate-translate 2s infinite linear;\n animation: primary-indeterminate-translate 2s infinite linear; }\n .mdc-linear-progress--indeterminate .mdc-linear-progress__primary-bar > .mdc-linear-progress__bar-inner {\n -webkit-animation: primary-indeterminate-scale 2s infinite linear;\n animation: primary-indeterminate-scale 2s infinite linear; }\n .mdc-linear-progress--indeterminate .mdc-linear-progress__secondary-bar {\n left: -54.888891%;\n -webkit-animation: secondary-indeterminate-translate 2s infinite linear;\n animation: secondary-indeterminate-translate 2s infinite linear;\n visibility: visible; }\n .mdc-linear-progress--indeterminate .mdc-linear-progress__secondary-bar > .mdc-linear-progress__bar-inner {\n -webkit-animation: secondary-indeterminate-scale 2s infinite linear;\n animation: secondary-indeterminate-scale 2s infinite linear; }\n .mdc-linear-progress--reversed .mdc-linear-progress__bar,\n .mdc-linear-progress--reversed .mdc-linear-progress__buffer {\n right: 0;\n -webkit-transform-origin: center right;\n transform-origin: center right; }\n .mdc-linear-progress--reversed .mdc-linear-progress__primary-bar {\n -webkit-animation-name: primary-indeterminate-translate-reverse;\n animation-name: primary-indeterminate-translate-reverse; }\n .mdc-linear-progress--reversed .mdc-linear-progress__secondary-bar {\n -webkit-animation-name: secondary-indeterminate-translate-reverse;\n animation-name: secondary-indeterminate-translate-reverse; }\n .mdc-linear-progress--reversed .mdc-linear-progress__buffering-dots {\n -webkit-animation: buffering-reverse 250ms infinite linear;\n animation: buffering-reverse 250ms infinite linear; }\n .mdc-linear-progress--closed {\n opacity: 0; }\n\n.mdc-linear-progress__bar-inner {\n background-color: #6200ee;\n /* @alternate */\n background-color: var(--mdc-theme-primary, #6200ee); }\n\n.mdc-linear-progress__buffering-dots {\n background-image: url(\"data:image/svg+xml,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' enable-background='new 0 0 5 2' xml:space='preserve' viewBox='0 0 5 2' preserveAspectRatio='none slice'%3E%3Ccircle cx='1' cy='1' r='1' fill='%23e6e6e6'/%3E%3C/svg%3E\"); }\n\n.mdc-linear-progress__buffer {\n background-color: #e6e6e6; }\n\n.mdc-linear-progress--indeterminate.mdc-linear-progress--reversed .mdc-linear-progress__primary-bar {\n right: -145.166611%;\n left: auto; }\n\n.mdc-linear-progress--indeterminate.mdc-linear-progress--reversed .mdc-linear-progress__secondary-bar {\n right: -54.888891%;\n left: auto; }", ""]);
// Exports
exports.locals = {
"mdc-linear-progress": "mdc-linear-progress",
"mdc-linear-progress__bar": "mdc-linear-progress__bar",
"mdc-linear-progress__bar-inner": "mdc-linear-progress__bar-inner",
"mdc-linear-progress__buffering-dots": "mdc-linear-progress__buffering-dots",
"buffering": "buffering",
"mdc-linear-progress__buffer": "mdc-linear-progress__buffer",
"mdc-linear-progress__primary-bar": "mdc-linear-progress__primary-bar",
"mdc-linear-progress__secondary-bar": "mdc-linear-progress__secondary-bar",
"mdc-linear-progress--indeterminate": "mdc-linear-progress--indeterminate",
"primary-indeterminate-translate": "primary-indeterminate-translate",
"primary-indeterminate-scale": "primary-indeterminate-scale",
"secondary-indeterminate-translate": "secondary-indeterminate-translate",
"secondary-indeterminate-scale": "secondary-indeterminate-scale",
"mdc-linear-progress--reversed": "mdc-linear-progress--reversed",
"primary-indeterminate-translate-reverse": "primary-indeterminate-translate-reverse",
"secondary-indeterminate-translate-reverse": "secondary-indeterminate-translate-reverse",
"buffering-reverse": "buffering-reverse",
"mdc-linear-progress--closed": "mdc-linear-progress--closed"
};
module.exports = exports;
/***/ }),
/* 70 */
/***/ (function(module, exports, __webpack_require__) {
// Imports
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(15);
exports = ___CSS_LOADER_API_IMPORT___(false);
// Module
exports.push([module.i, "/*!\n Material Components for the Web\n Copyright (c) 2018 Google Inc.\n License: MIT\n*/\n@-webkit-keyframes mdc-ripple-fg-radius-in {\n from {\n -webkit-animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n -webkit-transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1);\n transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1); }\n to {\n -webkit-transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));\n transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1)); } }\n\n@keyframes mdc-ripple-fg-radius-in {\n from {\n -webkit-animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n -webkit-transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1);\n transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1); }\n to {\n -webkit-transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));\n transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1)); } }\n\n@-webkit-keyframes mdc-ripple-fg-opacity-in {\n from {\n -webkit-animation-timing-function: linear;\n animation-timing-function: linear;\n opacity: 0; }\n to {\n opacity: var(--mdc-ripple-fg-opacity, 0); } }\n\n@keyframes mdc-ripple-fg-opacity-in {\n from {\n -webkit-animation-timing-function: linear;\n animation-timing-function: linear;\n opacity: 0; }\n to {\n opacity: var(--mdc-ripple-fg-opacity, 0); } }\n\n@-webkit-keyframes mdc-ripple-fg-opacity-out {\n from {\n -webkit-animation-timing-function: linear;\n animation-timing-function: linear;\n opacity: var(--mdc-ripple-fg-opacity, 0); }\n to {\n opacity: 0; } }\n\n@keyframes mdc-ripple-fg-opacity-out {\n from {\n -webkit-animation-timing-function: linear;\n animation-timing-function: linear;\n opacity: var(--mdc-ripple-fg-opacity, 0); }\n to {\n opacity: 0; } }\n\n.mdc-ripple-surface--test-edge-var-bug {\n --mdc-ripple-surface-test-edge-var: 1px solid #000;\n visibility: hidden; }\n .mdc-ripple-surface--test-edge-var-bug::before {\n border: var(--mdc-ripple-surface-test-edge-var); }\n\n.mdc-icon-button {\n --mdc-ripple-fg-size: 0;\n --mdc-ripple-left: 0;\n --mdc-ripple-top: 0;\n --mdc-ripple-fg-scale: 1;\n --mdc-ripple-fg-translate-end: 0;\n --mdc-ripple-fg-translate-start: 0;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n will-change: transform, opacity;\n width: 48px;\n height: 48px;\n padding: 12px;\n font-size: 24px;\n display: inline-block;\n position: relative;\n box-sizing: border-box;\n border: none;\n outline: none;\n background-color: transparent;\n fill: currentColor;\n color: inherit;\n text-decoration: none;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none; }\n .mdc-icon-button::before, .mdc-icon-button::after {\n position: absolute;\n border-radius: 50%;\n opacity: 0;\n pointer-events: none;\n content: \"\"; }\n .mdc-icon-button::before {\n transition: opacity 15ms linear;\n z-index: 1; }\n .mdc-icon-button.mdc-ripple-upgraded::before {\n -webkit-transform: scale(var(--mdc-ripple-fg-scale, 1));\n transform: scale(var(--mdc-ripple-fg-scale, 1)); }\n .mdc-icon-button.mdc-ripple-upgraded::after {\n top: 0;\n /* @noflip */\n left: 0;\n -webkit-transform: scale(0);\n transform: scale(0);\n -webkit-transform-origin: center center;\n transform-origin: center center; }\n .mdc-icon-button.mdc-ripple-upgraded--unbounded::after {\n top: var(--mdc-ripple-top, 0);\n /* @noflip */\n left: var(--mdc-ripple-left, 0); }\n .mdc-icon-button.mdc-ripple-upgraded--foreground-activation::after {\n -webkit-animation: 225ms :local(mdc-ripple-fg-radius-in) forwards, 75ms :local(mdc-ripple-fg-opacity-in) forwards;\n animation: 225ms :local(mdc-ripple-fg-radius-in) forwards, 75ms :local(mdc-ripple-fg-opacity-in) forwards; }\n .mdc-icon-button.mdc-ripple-upgraded--foreground-deactivation::after {\n -webkit-animation: 150ms :local(mdc-ripple-fg-opacity-out);\n animation: 150ms :local(mdc-ripple-fg-opacity-out);\n -webkit-transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));\n transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1)); }\n .mdc-icon-button::before, .mdc-icon-button::after {\n top: calc(50% - 50%);\n /* @noflip */\n left: calc(50% - 50%);\n width: 100%;\n height: 100%; }\n .mdc-icon-button.mdc-ripple-upgraded::before, .mdc-icon-button.mdc-ripple-upgraded::after {\n top: var(--mdc-ripple-top, calc(50% - 50%));\n /* @noflip */\n left: var(--mdc-ripple-left, calc(50% - 50%));\n width: var(--mdc-ripple-fg-size, 100%);\n height: var(--mdc-ripple-fg-size, 100%); }\n .mdc-icon-button.mdc-ripple-upgraded::after {\n width: var(--mdc-ripple-fg-size, 100%);\n height: var(--mdc-ripple-fg-size, 100%); }\n .mdc-icon-button svg,\n .mdc-icon-button img {\n width: 24px;\n height: 24px; }\n .mdc-icon-button:disabled {\n color: rgba(0, 0, 0, 0.38);\n /* @alternate */\n color: var(--mdc-theme-text-disabled-on-light, rgba(0, 0, 0, 0.38));\n cursor: default;\n pointer-events: none; }\n .mdc-icon-button::before, .mdc-icon-button::after {\n background-color: black; }\n .mdc-icon-button:hover::before {\n opacity: 0.04; }\n .mdc-icon-button:not(.mdc-ripple-upgraded):focus::before, .mdc-icon-button.mdc-ripple-upgraded--background-focused::before {\n transition-duration: 75ms;\n opacity: 0.12; }\n .mdc-icon-button:not(.mdc-ripple-upgraded)::after {\n transition: opacity 150ms linear; }\n .mdc-icon-button:not(.mdc-ripple-upgraded):active::after {\n transition-duration: 75ms;\n opacity: 0.16; }\n .mdc-icon-button.mdc-ripple-upgraded {\n --mdc-ripple-fg-opacity: 0.16; }\n\n.mdc-icon-button__icon {\n display: inline-block; }\n .mdc-icon-button__icon.mdc-icon-button__icon--on {\n display: none; }\n\n.mdc-icon-button--on .mdc-icon-button__icon {\n display: none; }\n .mdc-icon-button--on .mdc-icon-button__icon.mdc-icon-button__icon--on {\n display: inline-block; }", ""]);
// Exports
exports.locals = {
"mdc-ripple-surface--test-edge-var-bug": "mdc-ripple-surface--test-edge-var-bug",
"mdc-icon-button": "mdc-icon-button",
"mdc-ripple-upgraded": "mdc-ripple-upgraded",
"mdc-ripple-upgraded--unbounded": "mdc-ripple-upgraded--unbounded",
"mdc-ripple-upgraded--foreground-activation": "mdc-ripple-upgraded--foreground-activation",
"mdc-ripple-upgraded--foreground-deactivation": "mdc-ripple-upgraded--foreground-deactivation",
"mdc-ripple-upgraded--background-focused": "mdc-ripple-upgraded--background-focused",
"mdc-icon-button__icon": "mdc-icon-button__icon",
"mdc-icon-button__icon--on": "mdc-icon-button__icon--on",
"mdc-icon-button--on": "mdc-icon-button--on",
"mdc-ripple-fg-radius-in": "mdc-ripple-fg-radius-in",
"mdc-ripple-fg-opacity-in": "mdc-ripple-fg-opacity-in",
"mdc-ripple-fg-opacity-out": "mdc-ripple-fg-opacity-out"
};
module.exports = exports;
/***/ }),
/* 71 */
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, "environment", function() { return /* reexport */ environment; });
__webpack_require__.d(__webpack_exports__, "errors", function() { return /* reexport */ errors_namespaceObject; });
__webpack_require__.d(__webpack_exports__, "log", function() { return /* reexport */ log_namespaceObject; });
__webpack_require__.d(__webpack_exports__, "operations", function() { return /* reexport */ operations; });
__webpack_require__.d(__webpack_exports__, "preferences", function() { return /* reexport */ preferences_namespaceObject; });
__webpack_require__.d(__webpack_exports__, "stylesheets", function() { return /* reexport */ stylesheets; });
__webpack_require__.d(__webpack_exports__, "userscripter", function() { return /* reexport */ userscripter_namespaceObject; });
// NAMESPACE OBJECT: ./node_modules/userscripter/lib/errors.mjs
var errors_namespaceObject = {};
__webpack_require__.r(errors_namespaceObject);
__webpack_require__.d(errors_namespaceObject, "explanation", function() { return explanation; });
__webpack_require__.d(errors_namespaceObject, "failureDescriber", function() { return failureDescriber; });
// NAMESPACE OBJECT: ./node_modules/userscripter/lib/log.mjs
var log_namespaceObject = {};
__webpack_require__.r(log_namespaceObject);
__webpack_require__.d(log_namespaceObject, "setPrefix", function() { return setPrefix; });
__webpack_require__.d(log_namespaceObject, "setLogger", function() { return setLogger; });
__webpack_require__.d(log_namespaceObject, "log", function() { return log; });
__webpack_require__.d(log_namespaceObject, "info", function() { return info; });
__webpack_require__.d(log_namespaceObject, "warning", function() { return warning; });
__webpack_require__.d(log_namespaceObject, "error", function() { return error; });
// NAMESPACE OBJECT: ./node_modules/userscripter/lib/preferences.mjs
var preferences_namespaceObject = {};
__webpack_require__.r(preferences_namespaceObject);
__webpack_require__.d(preferences_namespaceObject, "subscriptable", function() { return subscriptable; });
__webpack_require__.d(preferences_namespaceObject, "loggingResponseHandler", function() { return loggingResponseHandler; });
__webpack_require__.d(preferences_namespaceObject, "noopResponseHandler", function() { return noopResponseHandler; });
// NAMESPACE OBJECT: ./node_modules/userscripter/lib/userscripter.mjs
var userscripter_namespaceObject = {};
__webpack_require__.r(userscripter_namespaceObject);
__webpack_require__.d(userscripter_namespaceObject, "run", function() { return run; });
// EXTERNAL MODULE: ./node_modules/userscripter/lib/environment.mjs
var environment = __webpack_require__(18);
// CONCATENATED MODULE: ./node_modules/lines-unlines/dist/index.mjs
function lines(s) {
return s === "" ? [] : s.replace(/\n$/, "").split("\n");
}
function unlines(ls) {
return ls.map(line => line + "\n").join("");
}
//# sourceMappingURL=index.js.map
// CONCATENATED MODULE: ./node_modules/userscripter/lib/errors.mjs
const INDENTATION = " ";
function formatDependency(d) {
return INDENTATION + d.key + ": " + d.selector;
}
function explanation(failure) {
switch (failure.result.reason) {
case 0:
return unlines([
`These dependencies were not found:`,
``,
unlines(failure.result.dependencies.map(formatDependency)),
]);
case 1:
return unlines([
`The operation failed with this error:`,
``,
failure.result.message,
]);
}
}
function failureDescriber(context) {
return failure => unlines([
`Could not ${failure.operation.description} on this page:`,
``,
INDENTATION + location.href,
``,
explanation(failure).trim(),
``,
`This problem might be caused by ${context.siteName} changing its content/structure, in which case ${context.extensionName} needs to be updated accordingly. Otherwise, it's probably a bug in ${context.extensionName}.`,
``,
`If you file a bug report, please include this message.`,
]);
}
// CONCATENATED MODULE: ./node_modules/userscripter/lib/log.mjs
let prefix = "";
let logger = console;
function setPrefix(p) {
prefix = p;
}
function setLogger(l) {
logger = l;
}
function log(str) {
logger.log(prefix, str);
}
function info(str) {
logger.info(prefix, str);
}
function warning(str) {
logger.warn(prefix, str);
}
function error(str) {
logger.error(prefix, str);
}
// EXTERNAL MODULE: ./node_modules/userscripter/lib/operations.mjs + 1 modules
var operations = __webpack_require__(17);
// CONCATENATED MODULE: ./node_modules/userscripter/lib/preferences.mjs
function subscriptable(handler) {
const changeListeners = new Set();
return {
subscribe: (listener) => { changeListeners.add(listener); },
unsubscribe: (listener) => { changeListeners.delete(listener); },
handler: (summary, preferences) => {
if (summary.action === "set") {
changeListeners.forEach(f => f(summary.preference));
}
return handler(summary, preferences);
},
};
}
function loggingResponseHandler(summary, preferences) {
const response = summary.response;
switch (response.status) {
case 0:
return response;
case 1:
if (summary.action === "get") {
warning(`The saved value for preference '${summary.preference.key}' (${JSON.stringify(response.saved)}) was invalid. Replacing it with ${JSON.stringify(response.value)}.`);
preferences.set(summary.preference, response.value);
}
if (summary.action === "set") {
warning(`Could not set value ${JSON.stringify(response.value)} for preference '${summary.preference.key}' because it was invalid.`);
}
return response;
case 2:
if (summary.action === "get") {
warning(`The saved value for preference '${summary.preference.key}' had the wrong type. Replacing it with ${JSON.stringify(response.value)}.`);
preferences.set(summary.preference, response.value);
}
return response;
case 3:
if (summary.action === "get") {
warning(`The saved value for preference '${summary.preference.key}' could not be parsed. Replacing it with ${JSON.stringify(response.value)}.`);
preferences.set(summary.preference, response.value);
}
return response;
case 4:
switch (summary.action) {
case "get":
error(`Could not read preference '${summary.preference.key}' because localStorage could not be accessed. Using value ${JSON.stringify(summary.preference.default)}.`);
break;
case "set":
error(`Could not save value ${JSON.stringify(summary.response.value)} for preference '${summary.preference.key}' because localStorage could not be accessed.`);
break;
default:
assertUnreachable(summary.action);
}
return response;
default:
return assertUnreachable(response.status);
}
}
function noopResponseHandler(summary, _) {
return summary.response;
}
function assertUnreachable(x) {
throw new Error("assertUnreachable: " + x);
}
// EXTERNAL MODULE: ./node_modules/userscripter/lib/stylesheets.mjs
var stylesheets = __webpack_require__(16);
// CONCATENATED MODULE: ./node_modules/userscripter/lib/userscripter.mjs
function run(userscript) {
setPrefix(`[${userscript.name}]`);
const attr = attribute(userscript.id);
if (document.documentElement.hasAttribute(attr)) {
warning(`It looks as though ${userscript.name} has already run (because the attribute "${attr}" was found on <head>). Stopping.`);
}
else {
document.documentElement.setAttribute(attr, "");
userscript.initialAction();
stylesheets["insert"](userscript.stylesheets);
operations["run"](userscript.operationsPlan);
}
}
function attribute(id) {
return "data-" + id + "-has-run";
}
// CONCATENATED MODULE: ./node_modules/userscripter/lib/index.mjs
/***/ }),
/* 72 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, "MDCLinearProgressFoundation", function() { return /* reexport */ foundation_MDCLinearProgressFoundation; });
__webpack_require__.d(__webpack_exports__, "MDCLinearProgress", function() { return /* binding */ linear_progress_MDCLinearProgress; });
// EXTERNAL MODULE: ./node_modules/@material/base/foundation.js
var foundation = __webpack_require__(1);
// EXTERNAL MODULE: ./node_modules/@material/base/component.js
var component = __webpack_require__(2);
// CONCATENATED MODULE: ./node_modules/@material/base/index.js
/**
* @license
* Copyright 2016 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
// EXTERNAL MODULE: ./node_modules/@material/animation/index.js
var animation = __webpack_require__(9);
// CONCATENATED MODULE: ./node_modules/@material/linear-progress/constants.js
/**
* @license
* Copyright 2017 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
const cssClasses = {
CLOSED_CLASS: 'mdc-linear-progress--closed',
INDETERMINATE_CLASS: 'mdc-linear-progress--indeterminate',
REVERSED_CLASS: 'mdc-linear-progress--reversed',
};
const strings = {
PRIMARY_BAR_SELECTOR: '.mdc-linear-progress__primary-bar',
BUFFER_SELECTOR: '.mdc-linear-progress__buffer',
};
// CONCATENATED MODULE: ./node_modules/@material/linear-progress/foundation.js
/**
* @license
* Copyright 2017 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
class foundation_MDCLinearProgressFoundation extends foundation["a" /* default */] {
static get cssClasses() {
return cssClasses;
}
static get strings() {
return strings;
}
static get defaultAdapter() {
return {
addClass: (/* className: string */) => {},
getPrimaryBar: () => /* el: Element */ {},
getBuffer: () => /* el: Element */ {},
hasClass: (/* className: string */) => false,
removeClass: (/* className: string */) => {},
setStyle: (/* el: Element, styleProperty: string, value: string */) => {},
};
}
constructor(adapter) {
super(Object.assign(foundation_MDCLinearProgressFoundation.defaultAdapter, adapter));
}
init() {
this.determinate_ = !this.adapter_.hasClass(cssClasses.INDETERMINATE_CLASS);
this.reverse_ = this.adapter_.hasClass(cssClasses.REVERSED_CLASS);
this.progress_ = 0;
}
setDeterminate(isDeterminate) {
this.determinate_ = isDeterminate;
if (this.determinate_) {
this.adapter_.removeClass(cssClasses.INDETERMINATE_CLASS);
this.setScale_(this.adapter_.getPrimaryBar(), this.progress_);
} else {
this.adapter_.addClass(cssClasses.INDETERMINATE_CLASS);
this.setScale_(this.adapter_.getPrimaryBar(), 1);
this.setScale_(this.adapter_.getBuffer(), 1);
}
}
setProgress(value) {
this.progress_ = value;
if (this.determinate_) {
this.setScale_(this.adapter_.getPrimaryBar(), value);
}
}
setBuffer(value) {
if (this.determinate_) {
this.setScale_(this.adapter_.getBuffer(), value);
}
}
setReverse(isReversed) {
this.reverse_ = isReversed;
if (this.reverse_) {
this.adapter_.addClass(cssClasses.REVERSED_CLASS);
} else {
this.adapter_.removeClass(cssClasses.REVERSED_CLASS);
}
}
open() {
this.adapter_.removeClass(cssClasses.CLOSED_CLASS);
}
close() {
this.adapter_.addClass(cssClasses.CLOSED_CLASS);
}
setScale_(el, scaleValue) {
const value = 'scaleX(' + scaleValue + ')';
animation["c" /* transformStyleProperties */].forEach((transformStyleProperty) => {
this.adapter_.setStyle(el, transformStyleProperty, value);
});
}
}
// CONCATENATED MODULE: ./node_modules/@material/linear-progress/index.js
/**
* @license
* Copyright 2017 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
class linear_progress_MDCLinearProgress extends component["a" /* default */] {
static attachTo(root) {
return new linear_progress_MDCLinearProgress(root);
}
set determinate(value) {
this.foundation_.setDeterminate(value);
}
set progress(value) {
this.foundation_.setProgress(value);
}
set buffer(value) {
this.foundation_.setBuffer(value);
}
set reverse(value) {
this.foundation_.setReverse(value);
}
open() {
this.foundation_.open();
}
close() {
this.foundation_.close();
}
getDefaultFoundation() {
return new foundation_MDCLinearProgressFoundation({
addClass: (className) => this.root_.classList.add(className),
getPrimaryBar: () => this.root_.querySelector(foundation_MDCLinearProgressFoundation.strings.PRIMARY_BAR_SELECTOR),
getBuffer: () => this.root_.querySelector(foundation_MDCLinearProgressFoundation.strings.BUFFER_SELECTOR),
hasClass: (className) => this.root_.classList.contains(className),
removeClass: (className) => this.root_.classList.remove(className),
setStyle: (el, styleProperty, value) => el.style[styleProperty] = value,
});
}
}
/***/ }),
/* 73 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, "MDCSliderFoundation", function() { return /* reexport */ slider_foundation; });
__webpack_require__.d(__webpack_exports__, "MDCSlider", function() { return /* binding */ slider_MDCSlider; });
// EXTERNAL MODULE: ./node_modules/@material/base/component.js
var component = __webpack_require__(2);
// CONCATENATED MODULE: ./node_modules/@material/slider/constants.js
/**
* @license
* Copyright 2017 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/** @enum {string} */
const cssClasses = {
ACTIVE: 'mdc-slider--active',
DISABLED: 'mdc-slider--disabled',
DISCRETE: 'mdc-slider--discrete',
FOCUS: 'mdc-slider--focus',
IN_TRANSIT: 'mdc-slider--in-transit',
IS_DISCRETE: 'mdc-slider--discrete',
HAS_TRACK_MARKER: 'mdc-slider--display-markers',
};
/** @enum {string} */
const strings = {
TRACK_SELECTOR: '.mdc-slider__track',
TRACK_MARKER_CONTAINER_SELECTOR: '.mdc-slider__track-marker-container',
LAST_TRACK_MARKER_SELECTOR: '.mdc-slider__track-marker:last-child',
THUMB_CONTAINER_SELECTOR: '.mdc-slider__thumb-container',
PIN_VALUE_MARKER_SELECTOR: '.mdc-slider__pin-value-marker',
ARIA_VALUEMIN: 'aria-valuemin',
ARIA_VALUEMAX: 'aria-valuemax',
ARIA_VALUENOW: 'aria-valuenow',
ARIA_DISABLED: 'aria-disabled',
STEP_DATA_ATTR: 'data-step',
CHANGE_EVENT: 'MDCSlider:change',
INPUT_EVENT: 'MDCSlider:input',
};
/** @enum {number} */
const numbers = {
PAGE_FACTOR: 4,
};
// CONCATENATED MODULE: ./node_modules/@material/slider/adapter.js
/**
* @license
* Copyright 2017 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/* eslint-disable no-unused-vars */
/**
* Adapter for MDC Slider.
*
* Defines the shape of the adapter expected by the foundation. Implement this
* adapter to integrate the Slider into your framework. See
* https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md
* for more information.
*
* @record
*/
class MDCSliderAdapter {
/**
* Returns true if className exists for the slider Element
* @param {string} className
* @return {boolean}
*/
hasClass(className) {}
/**
* Adds a class to the slider Element
* @param {string} className
*/
addClass(className) {}
/**
* Removes a class from the slider Element
* @param {string} className
*/
removeClass(className) {}
/**
* Returns a string if attribute name exists on the slider Element,
* otherwise returns null
* @param {string} name
* @return {?string}
*/
getAttribute(name) {}
/**
* Sets attribute name on slider Element to value
* @param {string} name
* @param {string} value
*/
setAttribute(name, value) {}
/**
* Removes attribute name from slider Element
* @param {string} name
*/
removeAttribute(name) {}
/**
* Returns the bounding client rect for the slider Element
* @return {?ClientRect}
*/
computeBoundingRect() {}
/**
* Returns the tab index of the slider Element
* @return {number}
*/
getTabIndex() {}
/**
* Registers an event handler on the root element for a given event.
* @param {string} type
* @param {function(!Event): undefined} handler
*/
registerInteractionHandler(type, handler) {}
/**
* Deregisters an event handler on the root element for a given event.
* @param {string} type
* @param {function(!Event): undefined} handler
*/
deregisterInteractionHandler(type, handler) {}
/**
* Registers an event handler on the thumb container element for a given event.
* @param {string} type
* @param {function(!Event): undefined} handler
*/
registerThumbContainerInteractionHandler(type, handler) {}
/**
* Deregisters an event handler on the thumb container element for a given event.
* @param {string} type
* @param {function(!Event): undefined} handler
*/
deregisterThumbContainerInteractionHandler(type, handler) {}
/**
* Registers an event handler on the body for a given event.
* @param {string} type
* @param {function(!Event): undefined} handler
*/
registerBodyInteractionHandler(type, handler) {}
/**
* Deregisters an event handler on the body for a given event.
* @param {string} type
* @param {function(!Event): undefined} handler
*/
deregisterBodyInteractionHandler(type, handler) {}
/**
* Registers an event handler for the window resize event
* @param {function(!Event): undefined} handler
*/
registerResizeHandler(handler) {}
/**
* Deregisters an event handler for the window resize event
* @param {function(!Event): undefined} handler
*/
deregisterResizeHandler(handler) {}
/**
* Emits a custom event MDCSlider:input from the root
*/
notifyInput() {}
/**
* Emits a custom event MDCSlider:change from the root
*/
notifyChange() {}
/**
* Sets a style property of the thumb container element to the passed value
* @param {string} propertyName
* @param {string} value
*/
setThumbContainerStyleProperty(propertyName, value) {}
/**
* Sets a style property of the track element to the passed value
* @param {string} propertyName
* @param {string} value
*/
setTrackStyleProperty(propertyName, value) {}
/**
* Sets the inner text of the pin marker to the passed value
* @param {number} value
*/
setMarkerValue(value) {}
/**
* Appends the passed number of track markers to the track mark container element
* @param {number} numMarkers
*/
appendTrackMarkers(numMarkers) {}
/**
* Removes all track markers fromt he track mark container element
*/
removeTrackMarkers() {}
/**
* Sets a style property of the last track marker to the passed value
* @param {string} propertyName
* @param {string} value
*/
setLastTrackMarkersStyleProperty(propertyName, value) {}
/**
* Returns true if the root element is RTL, otherwise false
* @return {boolean}
*/
isRTL() {}
}
/* harmony default export */ var adapter = (MDCSliderAdapter);
// EXTERNAL MODULE: ./node_modules/@material/animation/index.js
var animation = __webpack_require__(9);
// EXTERNAL MODULE: ./node_modules/@material/base/foundation.js
var foundation = __webpack_require__(1);
// CONCATENATED MODULE: ./node_modules/@material/slider/foundation.js
/**
* @license
* Copyright 2017 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/** @enum {string} */
const KEY_IDS = {
ARROW_LEFT: 'ArrowLeft',
ARROW_RIGHT: 'ArrowRight',
ARROW_UP: 'ArrowUp',
ARROW_DOWN: 'ArrowDown',
HOME: 'Home',
END: 'End',
PAGE_UP: 'PageUp',
PAGE_DOWN: 'PageDown',
};
/** @enum {string} */
const MOVE_EVENT_MAP = {
'mousedown': 'mousemove',
'touchstart': 'touchmove',
'pointerdown': 'pointermove',
};
const DOWN_EVENTS = ['mousedown', 'pointerdown', 'touchstart'];
const UP_EVENTS = ['mouseup', 'pointerup', 'touchend'];
/**
* @extends {MDCFoundation<!MDCSliderAdapter>}
*/
class foundation_MDCSliderFoundation extends foundation["a" /* default */] {
/** @return enum {cssClasses} */
static get cssClasses() {
return cssClasses;
}
/** @return enum {strings} */
static get strings() {
return strings;
}
/** @return enum {numbers} */
static get numbers() {
return numbers;
}
/** @return {!MDCSliderAdapter} */
static get defaultAdapter() {
return /** @type {!MDCSliderAdapter} */ ({
hasClass: (/* className: string */) => /* boolean */ false,
addClass: (/* className: string */) => {},
removeClass: (/* className: string */) => {},
getAttribute: (/* name: string */) => /* string|null */ null,
setAttribute: (/* name: string, value: string */) => {},
removeAttribute: (/* name: string */) => {},
computeBoundingRect: () => /* ClientRect */ ({
top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0,
}),
getTabIndex: () => /* number */ 0,
registerInteractionHandler: (/* type: string, handler: EventListener */) => {},
deregisterInteractionHandler: (/* type: string, handler: EventListener */) => {},
registerThumbContainerInteractionHandler: (/* type: string, handler: EventListener */) => {},
deregisterThumbContainerInteractionHandler: (/* type: string, handler: EventListener */) => {},
registerBodyInteractionHandler: (/* type: string, handler: EventListener */) => {},
deregisterBodyInteractionHandler: (/* type: string, handler: EventListener */) => {},
registerResizeHandler: (/* handler: EventListener */) => {},
deregisterResizeHandler: (/* handler: EventListener */) => {},
notifyInput: () => {},
notifyChange: () => {},
setThumbContainerStyleProperty: (/* propertyName: string, value: string */) => {},
setTrackStyleProperty: (/* propertyName: string, value: string */) => {},
setMarkerValue: (/* value: number */) => {},
appendTrackMarkers: (/* numMarkers: number */) => {},
removeTrackMarkers: () => {},
setLastTrackMarkersStyleProperty: (/* propertyName: string, value: string */) => {},
isRTL: () => /* boolean */ false,
});
}
/**
* Creates a new instance of MDCSliderFoundation
* @param {?MDCSliderAdapter} adapter
*/
constructor(adapter) {
super(Object.assign(foundation_MDCSliderFoundation.defaultAdapter, adapter));
/** @private {?ClientRect} */
this.rect_ = null;
// We set this to NaN since we want it to be a number, but we can't use '0' or '-1'
// because those could be valid tabindices set by the client code.
this.savedTabIndex_ = NaN;
this.active_ = false;
this.inTransit_ = false;
this.isDiscrete_ = false;
this.hasTrackMarker_ = false;
this.handlingThumbTargetEvt_ = false;
this.min_ = 0;
this.max_ = 100;
this.step_ = 0;
this.value_ = 0;
this.disabled_ = false;
this.preventFocusState_ = false;
this.updateUIFrame_ = 0;
this.thumbContainerPointerHandler_ = () => {
this.handlingThumbTargetEvt_ = true;
};
this.interactionStartHandler_ = (evt) => this.handleDown_(evt);
this.keydownHandler_ = (evt) => this.handleKeydown_(evt);
this.focusHandler_ = () => this.handleFocus_();
this.blurHandler_ = () => this.handleBlur_();
this.resizeHandler_ = () => this.layout();
}
init() {
this.isDiscrete_ = this.adapter_.hasClass(cssClasses.IS_DISCRETE);
this.hasTrackMarker_ = this.adapter_.hasClass(cssClasses.HAS_TRACK_MARKER);
DOWN_EVENTS.forEach((evtName) => this.adapter_.registerInteractionHandler(evtName, this.interactionStartHandler_));
this.adapter_.registerInteractionHandler('keydown', this.keydownHandler_);
this.adapter_.registerInteractionHandler('focus', this.focusHandler_);
this.adapter_.registerInteractionHandler('blur', this.blurHandler_);
DOWN_EVENTS.forEach((evtName) => {
this.adapter_.registerThumbContainerInteractionHandler(evtName, this.thumbContainerPointerHandler_);
});
this.adapter_.registerResizeHandler(this.resizeHandler_);
this.layout();
// At last step, provide a reasonable default value to discrete slider
if (this.isDiscrete_ && this.getStep() == 0) {
this.step_ = 1;
}
}
destroy() {
DOWN_EVENTS.forEach((evtName) => {
this.adapter_.deregisterInteractionHandler(evtName, this.interactionStartHandler_);
});
this.adapter_.deregisterInteractionHandler('keydown', this.keydownHandler_);
this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_);
this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_);
DOWN_EVENTS.forEach((evtName) => {
this.adapter_.deregisterThumbContainerInteractionHandler(evtName, this.thumbContainerPointerHandler_);
});
this.adapter_.deregisterResizeHandler(this.resizeHandler_);
}
setupTrackMarker() {
if (this.isDiscrete_ && this.hasTrackMarker_&& this.getStep() != 0) {
const min = this.getMin();
const max = this.getMax();
const step = this.getStep();
let numMarkers = (max - min) / step;
// In case distance between max & min is indivisible to step,
// we place the secondary to last marker proportionally at where thumb
// could reach and place the last marker at max value
const indivisible = Math.ceil(numMarkers) !== numMarkers;
if (indivisible) {
numMarkers = Math.ceil(numMarkers);
}
this.adapter_.removeTrackMarkers();
this.adapter_.appendTrackMarkers(numMarkers);
if (indivisible) {
const lastStepRatio = (max - numMarkers * step) / step + 1;
const flex = Object(animation["b" /* getCorrectPropertyName */])(window, 'flex');
this.adapter_.setLastTrackMarkersStyleProperty(flex, String(lastStepRatio));
}
}
}
layout() {
this.rect_ = this.adapter_.computeBoundingRect();
this.updateUIForCurrentValue_();
}
/** @return {number} */
getValue() {
return this.value_;
}
/** @param {number} value */
setValue(value) {
this.setValue_(value, false);
}
/** @return {number} */
getMax() {
return this.max_;
}
/** @param {number} max */
setMax(max) {
if (max < this.min_) {
throw new Error('Cannot set max to be less than the slider\'s minimum value');
}
this.max_ = max;
this.setValue_(this.value_, false, true);
this.adapter_.setAttribute(strings.ARIA_VALUEMAX, String(this.max_));
this.setupTrackMarker();
}
/** @return {number} */
getMin() {
return this.min_;
}
/** @param {number} min */
setMin(min) {
if (min > this.max_) {
throw new Error('Cannot set min to be greater than the slider\'s maximum value');
}
this.min_ = min;
this.setValue_(this.value_, false, true);
this.adapter_.setAttribute(strings.ARIA_VALUEMIN, String(this.min_));
this.setupTrackMarker();
}
/** @return {number} */
getStep() {
return this.step_;
}
/** @param {number} step */
setStep(step) {
if (step < 0) {
throw new Error('Step cannot be set to a negative number');
}
if (this.isDiscrete_ && (typeof(step) !== 'number' || step < 1)) {
step = 1;
}
this.step_ = step;
this.setValue_(this.value_, false, true);
this.setupTrackMarker();
}
/** @return {boolean} */
isDisabled() {
return this.disabled_;
}
/** @param {boolean} disabled */
setDisabled(disabled) {
this.disabled_ = disabled;
this.toggleClass_(cssClasses.DISABLED, this.disabled_);
if (this.disabled_) {
this.savedTabIndex_ = this.adapter_.getTabIndex();
this.adapter_.setAttribute(strings.ARIA_DISABLED, 'true');
this.adapter_.removeAttribute('tabindex');
} else {
this.adapter_.removeAttribute(strings.ARIA_DISABLED);
if (!isNaN(this.savedTabIndex_)) {
this.adapter_.setAttribute('tabindex', String(this.savedTabIndex_));
}
}
}
/**
* Called when the user starts interacting with the slider
* @param {!Event} evt
* @private
*/
handleDown_(evt) {
if (this.disabled_) {
return;
}
this.preventFocusState_ = true;
this.setInTransit_(!this.handlingThumbTargetEvt_);
this.handlingThumbTargetEvt_ = false;
this.setActive_(true);
const moveHandler = (evt) => {
this.handleMove_(evt);
};
// Note: upHandler is [de]registered on ALL potential pointer-related release event types, since some browsers
// do not always fire these consistently in pairs.
// (See https://github.com/material-components/material-components-web/issues/1192)
const upHandler = () => {
this.handleUp_();
this.adapter_.deregisterBodyInteractionHandler(MOVE_EVENT_MAP[evt.type], moveHandler);
UP_EVENTS.forEach((evtName) => this.adapter_.deregisterBodyInteractionHandler(evtName, upHandler));
};
this.adapter_.registerBodyInteractionHandler(MOVE_EVENT_MAP[evt.type], moveHandler);
UP_EVENTS.forEach((evtName) => this.adapter_.registerBodyInteractionHandler(evtName, upHandler));
this.setValueFromEvt_(evt);
}
/**
* Called when the user moves the slider
* @param {!Event} evt
* @private
*/
handleMove_(evt) {
evt.preventDefault();
this.setValueFromEvt_(evt);
}
/**
* Called when the user's interaction with the slider ends
* @private
*/
handleUp_() {
this.setActive_(false);
this.adapter_.notifyChange();
}
/**
* Returns the pageX of the event
* @param {!Event} evt
* @return {number}
* @private
*/
getPageX_(evt) {
if (evt.targetTouches && evt.targetTouches.length > 0) {
return evt.targetTouches[0].pageX;
}
return evt.pageX;
}
/**
* Sets the slider value from an event
* @param {!Event} evt
* @private
*/
setValueFromEvt_(evt) {
const pageX = this.getPageX_(evt);
const value = this.computeValueFromPageX_(pageX);
this.setValue_(value, true);
}
/**
* Computes the new value from the pageX position
* @param {number} pageX
* @return {number}
*/
computeValueFromPageX_(pageX) {
const {max_: max, min_: min} = this;
const xPos = pageX - this.rect_.left;
let pctComplete = xPos / this.rect_.width;
if (this.adapter_.isRTL()) {
pctComplete = 1 - pctComplete;
}
// Fit the percentage complete between the range [min,max]
// by remapping from [0, 1] to [min, min+(max-min)].
return min + pctComplete * (max - min);
}
/**
* Handles keydown events
* @param {!Event} evt
*/
handleKeydown_(evt) {
const keyId = this.getKeyId_(evt);
const value = this.getValueForKeyId_(keyId);
if (isNaN(value)) {
return;
}
// Prevent page from scrolling due to key presses that would normally scroll the page
evt.preventDefault();
this.adapter_.addClass(cssClasses.FOCUS);
this.setValue_(value, true);
this.adapter_.notifyChange();
}
/**
* Returns the computed name of the event
* @param {!Event} kbdEvt
* @return {string}
*/
getKeyId_(kbdEvt) {
if (kbdEvt.key === KEY_IDS.ARROW_LEFT || kbdEvt.keyCode === 37) {
return KEY_IDS.ARROW_LEFT;
}
if (kbdEvt.key === KEY_IDS.ARROW_RIGHT || kbdEvt.keyCode === 39) {
return KEY_IDS.ARROW_RIGHT;
}
if (kbdEvt.key === KEY_IDS.ARROW_UP || kbdEvt.keyCode === 38) {
return KEY_IDS.ARROW_UP;
}
if (kbdEvt.key === KEY_IDS.ARROW_DOWN || kbdEvt.keyCode === 40) {
return KEY_IDS.ARROW_DOWN;
}
if (kbdEvt.key === KEY_IDS.HOME || kbdEvt.keyCode === 36) {
return KEY_IDS.HOME;
}
if (kbdEvt.key === KEY_IDS.END || kbdEvt.keyCode === 35) {
return KEY_IDS.END;
}
if (kbdEvt.key === KEY_IDS.PAGE_UP || kbdEvt.keyCode === 33) {
return KEY_IDS.PAGE_UP;
}
if (kbdEvt.key === KEY_IDS.PAGE_DOWN || kbdEvt.keyCode === 34) {
return KEY_IDS.PAGE_DOWN;
}
return '';
}
/**
* Computes the value given a keyboard key ID
* @param {string} keyId
* @return {number}
*/
getValueForKeyId_(keyId) {
const {max_: max, min_: min, step_: step} = this;
let delta = step || (max - min) / 100;
const valueNeedsToBeFlipped = this.adapter_.isRTL() && (
keyId === KEY_IDS.ARROW_LEFT || keyId === KEY_IDS.ARROW_RIGHT
);
if (valueNeedsToBeFlipped) {
delta = -delta;
}
switch (keyId) {
case KEY_IDS.ARROW_LEFT:
case KEY_IDS.ARROW_DOWN:
return this.value_ - delta;
case KEY_IDS.ARROW_RIGHT:
case KEY_IDS.ARROW_UP:
return this.value_ + delta;
case KEY_IDS.HOME:
return this.min_;
case KEY_IDS.END:
return this.max_;
case KEY_IDS.PAGE_UP:
return this.value_ + delta * numbers.PAGE_FACTOR;
case KEY_IDS.PAGE_DOWN:
return this.value_ - delta * numbers.PAGE_FACTOR;
default:
return NaN;
}
}
handleFocus_() {
if (this.preventFocusState_) {
return;
}
this.adapter_.addClass(cssClasses.FOCUS);
}
handleBlur_() {
this.preventFocusState_ = false;
this.adapter_.removeClass(cssClasses.FOCUS);
}
/**
* Sets the value of the slider
* @param {number} value
* @param {boolean} shouldFireInput
* @param {boolean=} force
*/
setValue_(value, shouldFireInput, force = false) {
if (value === this.value_ && !force) {
return;
}
const {min_: min, max_: max} = this;
const valueSetToBoundary = value === min || value === max;
if (this.step_ && !valueSetToBoundary) {
value = this.quantize_(value);
}
if (value < min) {
value = min;
} else if (value > max) {
value = max;
}
this.value_ = value;
this.adapter_.setAttribute(strings.ARIA_VALUENOW, String(this.value_));
this.updateUIForCurrentValue_();
if (shouldFireInput) {
this.adapter_.notifyInput();
if (this.isDiscrete_) {
this.adapter_.setMarkerValue(value);
}
}
}
/**
* Calculates the quantized value
* @param {number} value
* @return {number}
*/
quantize_(value) {
const numSteps = Math.round(value / this.step_);
const quantizedVal = numSteps * this.step_;
return quantizedVal;
}
updateUIForCurrentValue_() {
const {max_: max, min_: min, value_: value} = this;
const pctComplete = (value - min) / (max - min);
let translatePx = pctComplete * this.rect_.width;
if (this.adapter_.isRTL()) {
translatePx = this.rect_.width - translatePx;
}
const transformProp = Object(animation["b" /* getCorrectPropertyName */])(window, 'transform');
const transitionendEvtName = Object(animation["a" /* getCorrectEventName */])(window, 'transitionend');
if (this.inTransit_) {
const onTransitionEnd = () => {
this.setInTransit_(false);
this.adapter_.deregisterThumbContainerInteractionHandler(transitionendEvtName, onTransitionEnd);
};
this.adapter_.registerThumbContainerInteractionHandler(transitionendEvtName, onTransitionEnd);
}
this.updateUIFrame_ = requestAnimationFrame(() => {
// NOTE(traviskaufman): It would be nice to use calc() here,
// but IE cannot handle calcs in transforms correctly.
// See: https://goo.gl/NC2itk
// Also note that the -50% offset is used to center the slider thumb.
this.adapter_.setThumbContainerStyleProperty(transformProp, `translateX(${translatePx}px) translateX(-50%)`);
this.adapter_.setTrackStyleProperty(transformProp, `scaleX(${pctComplete})`);
});
}
/**
* Toggles the active state of the slider
* @param {boolean} active
*/
setActive_(active) {
this.active_ = active;
this.toggleClass_(cssClasses.ACTIVE, this.active_);
}
/**
* Toggles the inTransit state of the slider
* @param {boolean} inTransit
*/
setInTransit_(inTransit) {
this.inTransit_ = inTransit;
this.toggleClass_(cssClasses.IN_TRANSIT, this.inTransit_);
}
/**
* Conditionally adds or removes a class based on shouldBePresent
* @param {string} className
* @param {boolean} shouldBePresent
*/
toggleClass_(className, shouldBePresent) {
if (shouldBePresent) {
this.adapter_.addClass(className);
} else {
this.adapter_.removeClass(className);
}
}
}
/* harmony default export */ var slider_foundation = (foundation_MDCSliderFoundation);
// CONCATENATED MODULE: ./node_modules/@material/slider/index.js
/**
* @license
* Copyright 2017 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* @extends MDCComponent<!MDCSliderFoundation>
*/
class slider_MDCSlider extends component["a" /* default */] {
static attachTo(root) {
return new slider_MDCSlider(root);
}
constructor(...args) {
super(...args);
/** @type {?Element} */
this.thumbContainer_;
/** @type {?Element} */
this.track_;
/** @type {?Element} */
this.pinValueMarker_;
/** @type {?Element} */
this.trackMarkerContainer_;
}
/** @return {number} */
get value() {
return this.foundation_.getValue();
}
/** @param {number} value */
set value(value) {
this.foundation_.setValue(value);
}
/** @return {number} */
get min() {
return this.foundation_.getMin();
}
/** @param {number} min */
set min(min) {
this.foundation_.setMin(min);
}
/** @return {number} */
get max() {
return this.foundation_.getMax();
}
/** @param {number} max */
set max(max) {
this.foundation_.setMax(max);
}
/** @return {number} */
get step() {
return this.foundation_.getStep();
}
/** @param {number} step */
set step(step) {
this.foundation_.setStep(step);
}
/** @return {boolean} */
get disabled() {
return this.foundation_.isDisabled();
}
/** @param {boolean} disabled */
set disabled(disabled) {
this.foundation_.setDisabled(disabled);
}
initialize() {
this.thumbContainer_ = this.root_.querySelector(strings.THUMB_CONTAINER_SELECTOR);
this.track_ = this.root_.querySelector(strings.TRACK_SELECTOR);
this.pinValueMarker_ = this.root_.querySelector(strings.PIN_VALUE_MARKER_SELECTOR);
this.trackMarkerContainer_ = this.root_.querySelector(strings.TRACK_MARKER_CONTAINER_SELECTOR);
}
/**
* @return {!MDCSliderFoundation}
*/
getDefaultFoundation() {
return new slider_foundation(
/** @type {!MDCSliderAdapter} */ ({
hasClass: (className) => this.root_.classList.contains(className),
addClass: (className) => this.root_.classList.add(className),
removeClass: (className) => this.root_.classList.remove(className),
getAttribute: (name) => this.root_.getAttribute(name),
setAttribute: (name, value) => this.root_.setAttribute(name, value),
removeAttribute: (name) => this.root_.removeAttribute(name),
computeBoundingRect: () => this.root_.getBoundingClientRect(),
getTabIndex: () => this.root_.tabIndex,
registerInteractionHandler: (type, handler) => {
this.root_.addEventListener(type, handler);
},
deregisterInteractionHandler: (type, handler) => {
this.root_.removeEventListener(type, handler);
},
registerThumbContainerInteractionHandler: (type, handler) => {
this.thumbContainer_.addEventListener(type, handler);
},
deregisterThumbContainerInteractionHandler: (type, handler) => {
this.thumbContainer_.removeEventListener(type, handler);
},
registerBodyInteractionHandler: (type, handler) => {
document.body.addEventListener(type, handler);
},
deregisterBodyInteractionHandler: (type, handler) => {
document.body.removeEventListener(type, handler);
},
registerResizeHandler: (handler) => {
window.addEventListener('resize', handler);
},
deregisterResizeHandler: (handler) => {
window.removeEventListener('resize', handler);
},
notifyInput: () => {
this.emit(strings.INPUT_EVENT, this);
},
notifyChange: () => {
this.emit(strings.CHANGE_EVENT, this);
},
setThumbContainerStyleProperty: (propertyName, value) => {
this.thumbContainer_.style.setProperty(propertyName, value);
},
setTrackStyleProperty: (propertyName, value) => {
this.track_.style.setProperty(propertyName, value);
},
setMarkerValue: (value) => {
this.pinValueMarker_.innerText = value;
},
appendTrackMarkers: (numMarkers) => {
const frag = document.createDocumentFragment();
for (let i = 0; i < numMarkers; i++) {
const marker = document.createElement('div');
marker.classList.add('mdc-slider__track-marker');
frag.appendChild(marker);
}
this.trackMarkerContainer_.appendChild(frag);
},
removeTrackMarkers: () => {
while (this.trackMarkerContainer_.firstChild) {
this.trackMarkerContainer_.removeChild(this.trackMarkerContainer_.firstChild);
}
},
setLastTrackMarkersStyleProperty: (propertyName, value) => {
// We remove and append new nodes, thus, the last track marker must be dynamically found.
const lastTrackMarker = this.root_.querySelector(strings.LAST_TRACK_MARKER_SELECTOR);
lastTrackMarker.style.setProperty(propertyName, value);
},
isRTL: () => getComputedStyle(this.root_).direction === 'rtl',
})
);
}
initialSyncWithDOM() {
const origValueNow = parseFloat(this.root_.getAttribute(strings.ARIA_VALUENOW));
this.min = parseFloat(this.root_.getAttribute(strings.ARIA_VALUEMIN)) || this.min;
this.max = parseFloat(this.root_.getAttribute(strings.ARIA_VALUEMAX)) || this.max;
this.step = parseFloat(this.root_.getAttribute(strings.STEP_DATA_ATTR)) || this.step;
this.value = origValueNow || this.value;
this.disabled = (
this.root_.hasAttribute(strings.ARIA_DISABLED) &&
this.root_.getAttribute(strings.ARIA_DISABLED) !== 'false'
);
this.foundation_.setupTrackMarker();
}
layout() {
this.foundation_.layout();
}
/** @param {number=} amount */
stepUp(amount = (this.step || 1)) {
this.value += amount;
}
/** @param {number=} amount */
stepDown(amount = (this.step || 1)) {
this.value -= amount;
}
}
/***/ }),
/* 74 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, "MDCIconButtonToggle", function() { return /* binding */ icon_button_MDCIconButtonToggle; });
__webpack_require__.d(__webpack_exports__, "MDCIconButtonToggleFoundation", function() { return /* reexport */ icon_button_foundation; });
// EXTERNAL MODULE: ./node_modules/@material/base/component.js
var component = __webpack_require__(2);
// EXTERNAL MODULE: ./node_modules/@material/base/foundation.js
var foundation = __webpack_require__(1);
// CONCATENATED MODULE: ./node_modules/@material/icon-button/adapter.js
/**
* @license
* Copyright 2018 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/* eslint no-unused-vars: [2, {"args": "none"}] */
/**
* Adapter for MDC Icon Button Toggle. Provides an interface for managing
* - classes
* - dom
* - inner text
* - event handlers
* - event dispatch
*
* Additionally, provides type information for the adapter to the Closure
* compiler.
*
* Implement this adapter for your framework of choice to delegate updates to
* the component in your framework of choice. See architecture documentation
* for more details.
* https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
*
* @record
*/
class MDCIconButtonToggleAdapter {
/** @param {string} className */
addClass(className) {}
/** @param {string} className */
removeClass(className) {}
/**
* @param {string} className
* @return {boolean}
* */
hasClass(className) {}
/**
* @param {string} attrName
* @param {string} attrValue
*/
setAttr(attrName, attrValue) {}
/** @param {!IconButtonToggleEvent} evtData */
notifyChange(evtData) {}
}
/**
* @typedef {{
* isOn: boolean,
* }}
*/
let IconButtonToggleEvent;
// CONCATENATED MODULE: ./node_modules/@material/icon-button/constants.js
/**
* @license
* Copyright 2018 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/** @enum {string} */
const cssClasses = {
ROOT: 'mdc-icon-button',
ICON_BUTTON_ON: 'mdc-icon-button--on',
};
/** @enum {string} */
const strings = {
ARIA_PRESSED: 'aria-pressed',
ARIA_LABEL: 'aria-label',
CHANGE_EVENT: 'MDCIconButtonToggle:change',
};
// CONCATENATED MODULE: ./node_modules/@material/icon-button/foundation.js
/**
* @license
* Copyright 2018 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/* eslint-disable no-unused-vars */
/**
* @extends {MDCFoundation<!MDCIconButtonToggleAdapter>}
*/
class foundation_MDCIconButtonToggleFoundation extends foundation["a" /* default */] {
static get cssClasses() {
return cssClasses;
}
static get strings() {
return strings;
}
static get defaultAdapter() {
return {
addClass: () => {},
removeClass: () => {},
hasClass: () => {},
setAttr: () => {},
notifyChange: () => {},
};
}
constructor(adapter) {
super(Object.assign(foundation_MDCIconButtonToggleFoundation.defaultAdapter, adapter));
/** @private {boolean} */
this.disabled_ = false;
}
init() {
this.adapter_.setAttr(strings.ARIA_PRESSED, `${this.isOn()}`);
}
handleClick() {
this.toggle();
this.adapter_.notifyChange(/** @type {!IconButtonToggleEvent} */ ({isOn: this.isOn()}));
}
/** @return {boolean} */
isOn() {
return this.adapter_.hasClass(cssClasses.ICON_BUTTON_ON);
}
/** @param {boolean=} isOn */
toggle(isOn = !this.isOn()) {
if (isOn) {
this.adapter_.addClass(cssClasses.ICON_BUTTON_ON);
} else {
this.adapter_.removeClass(cssClasses.ICON_BUTTON_ON);
}
this.adapter_.setAttr(strings.ARIA_PRESSED, `${isOn}`);
}
}
/** @record */
class IconButtonToggleState {}
/* harmony default export */ var icon_button_foundation = (foundation_MDCIconButtonToggleFoundation);
// EXTERNAL MODULE: ./node_modules/@material/ripple/index.js + 4 modules
var _material_ripple = __webpack_require__(22);
// CONCATENATED MODULE: ./node_modules/@material/icon-button/index.js
/**
* @license
* Copyright 2018 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* @extends {MDCComponent<!MDCIconButtonToggleFoundation>}
*/
class icon_button_MDCIconButtonToggle extends component["a" /* default */] {
static attachTo(root) {
return new icon_button_MDCIconButtonToggle(root);
}
constructor(...args) {
super(...args);
/** @private {!MDCRipple} */
this.ripple_ = this.initRipple_();
/** @private {!Function} */
this.handleClick_;
}
/**
* @return {!MDCRipple}
* @private
*/
initRipple_() {
const ripple = new _material_ripple["MDCRipple"](this.root_);
ripple.unbounded = true;
return ripple;
}
destroy() {
this.root_.removeEventListener('click', this.handleClick_);
this.ripple_.destroy();
super.destroy();
}
/** @return {!MDCIconButtonToggleFoundation} */
getDefaultFoundation() {
return new icon_button_foundation({
addClass: (className) => this.root_.classList.add(className),
removeClass: (className) => this.root_.classList.remove(className),
hasClass: (className) => this.root_.classList.contains(className),
setAttr: (attrName, attrValue) => this.root_.setAttribute(attrName, attrValue),
notifyChange: (evtData) => this.emit(icon_button_foundation.strings.CHANGE_EVENT, evtData),
});
}
initialSyncWithDOM() {
this.handleClick_ = this.foundation_.handleClick.bind(this.foundation_);
this.root_.addEventListener('click', this.handleClick_);
}
/** @return {!MDCRipple} */
get ripple() {
return this.ripple_;
}
/** @return {boolean} */
get on() {
return this.foundation_.isOn();
}
/** @param {boolean} isOn */
set on(isOn) {
this.foundation_.toggle(isOn);
}
}
/***/ }),
/* 75 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, "compose", function() { return /* reexport */ compose; });
// CONCATENATED MODULE: ./node_modules/@typed/compose/lib.es2015/compose.js
function compose() {
switch (arguments.length) {
case 1: return _compose1(arguments[0]);
case 2: return _compose2(arguments[0], arguments[1]);
case 3: return _compose3(arguments[0], arguments[1], arguments[2]);
case 4: return _compose4(arguments[0], arguments[1], arguments[2], arguments[3]);
case 5: return _compose5(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]);
}
;
}
function _compose1(f) {
return function compose1Fn(a) {
return f(a);
};
}
function _compose2(g, f) {
return function compose2Fn(a) {
return g(f(a));
};
}
function _compose3(h, g, f) {
return function compose3Fn(a) {
return h(g(f(a)));
};
}
function _compose4(i, h, g, f) {
return function compose3Fn(a) {
return i(h(g(f(a))));
};
}
function _compose5(j, i, h, g, f) {
return function compose5Fn(a) {
return j(i(h(g(f(a)))));
};
}
//# sourceMappingURL=compose.js.map
// CONCATENATED MODULE: ./node_modules/@typed/compose/lib.es2015/index.js
//# sourceMappingURL=index.js.map
/***/ })
/******/ ]);