mirror of
https://github.com/informaticker/discord-jellyfin-bot.git
synced 2024-11-30 21:21:56 +01:00
4 lines
72 KiB
JavaScript
4 lines
72 KiB
JavaScript
|
const fetch = require('node-fetch')
|
||
|
|
||
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["jellyfin-apiclient"]=t():e["jellyfin-apiclient"]=t()}(this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";function n(e,t){if(!e)throw new Error("obj cannot be null!");e._callbacks=e._callbacks||{};var r=e._callbacks[t];return r||(e._callbacks[t]=[],r=e._callbacks[t]),r}r.r(t);var i={on:function(e,t,r){n(e,t).push(r)},off:function(e,t,r){var i=n(e,t),o=i.indexOf(r);-1!==o&&i.splice(o,1)},trigger:function(e,t){var r={type:t},i=[];i.push(r);for(var o=arguments[2]||[],a=0,s=o.length;a<s;a++)i.push(o[a]);var l=n(e,t).slice(0);l.forEach((function(t){t.apply(e,i)}))}};function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e){console.log(e)}function s(e){var t=e.cache;t&&t.put("data",new Response(JSON.stringify(e.localData))).catch(a)}function l(e){this.cache=e,this.localData={}}var u=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);try{self.caches&&caches.open("embydata").then(l.bind(this))}catch(e){console.log("Error opening cache: ".concat(e))}}var t,r,n;return t=e,n=[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}],(r=[{key:"setItem",value:function(e,t){localStorage.setItem(e,t);var r=this.localData;r&&r[e]!==t&&(r[e]=t,s(this))}},{key:"getItem",value:function(e){return localStorage.getItem(e)}},{key:"removeItem",value:function(e){localStorage.removeItem(e);var t=this.localData;t&&(t[e]=null,delete t[e],s(this))}}])&&o(t.prototype,r),n&&o(t,n),e}().getInstance();function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var h={timeupdate:1e4,volumechange:3e3};function v(e){g(e),e.accessToken()&&!1!==e.enableAutomaticBitrateDetection&&setTimeout(f.bind(e),6e3)}function f(){this.accessToken()&&this.detectBitrate()}function g(e){e.detectTimeout&&clearTimeout(e.detectTimeout)}function p(e,t,r){var n=new RegExp(t,"ig");return e.replace(n,r)}function y(e,t,r){i.trigger(e,"requestfail",[{url:t,status:r.status,errorCode:r.headers?r.headers.get("X-Application-Error-Code"):null}])}function m(e){var t=[];for(var r in e){var n=e[r];null!=n&&""!==n&&t.push("".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(n)))}return t.join("&")}function I(e,t,r){return new Promise((function(n,i){var o=setTimeout(i,r);(t=t||{}).credentials="same-origin",fetch(e,t).then((function(e){clearTimeout(o),n(e)})).catch((function(e){clearTimeout(o),i(e)}))}))}function S(e){var t=e.headers||{};"json"===e.dataType&&(t.accept="application/json");var r={headers:t,method:e.type,credentials:"same-origin"},n=e.contentType;retu
|
||
|
//# sourceMappingURL=jellyfin-apiclient.js.map
|