Socket
Socket
Sign inDemoInstall

crypto-convert

Package Overview
Dependencies
27
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.6 to 2.1.7

2

cdn/crypto-convert.min.js
/*! For license information please see crypto-convert.min.js.LICENSE.txt */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("FormData"),require("fetch")):"function"==typeof define&&define.amd?define(["FormData","fetch"],e):"object"==typeof exports?exports.CryptoConvert=e(require("FormData"),require("fetch")):t.CryptoConvert=e(t.FormData,t.fetch)}(this,((__WEBPACK_EXTERNAL_MODULE__88__,__WEBPACK_EXTERNAL_MODULE__265__)=>(()=>{"use strict";var __webpack_modules__={945:function(t,e,i){var r=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(o,n){function s(t){try{l(r.next(t))}catch(t){n(t)}}function a(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((r=r.apply(t,e||[])).next())}))};function o(t,e){const n="undefined"!=typeof window?null===window||void 0===window?void 0:window.fetch:i(265),s="undefined"!=typeof window?null===window||void 0===window?void 0:window.FormData:i(88);if(!n)throw new Error("Fetch API is not installed. If you are using Node please run `npm install node-fetch`");if(!s)throw new Error("FormData is not installed. If you are using Node please run `npm install form-data`");const a=t=>Object.assign(Object.assign({},t),{headers:Object.assign({},t.headers),params:Object.assign({},t.params),values:Object.assign({},t.values)}),l=t=>{var e,i;if("Object"!=(null===(i=null===(e=null==t?void 0:t.__proto__)||void 0===e?void 0:e.constructor)||void 0===i?void 0:i.name))throw new Error("Invalid $options object.");let r=a(t.$options||{});return delete t.$options,Object.assign(Object.assign({},r),{values:Object.assign(Object.assign({},r.values),t)})},c=(t,e,i=!1)=>{let r=i?t||{}:a(t||{}),o=a(e||{});return o.headers=Object.assign(Object.assign({},r.headers),o.headers),o.params=Object.assign(Object.assign({},r.params),o.params),o.values=Object.assign(Object.assign({},r.values),o.values),Object.assign(r,o),r};t=Object.assign({},t);let d={base:"",headers:{"User-Agent":"Rests JS (v1.1.0)"},params:{},values:{},on_error:void 0,on_success:void 0,on_request:void 0,fetch_agent:null};c(d,(null==t?void 0:t.$options)||{},!0),c(d,e,!0);const u={json:"application/json",form:"multipart/form-data",urlencoded:"application/x-www-form-urlencoded",text:"text/plain"},p=Object.values(u),h=["headers","body","query","path"],y={POST:"body",GET:"query"},m={"multipart/form-data":function(){var t=new s;return t.toString=function(){return this},t},"application/x-www-form-urlencoded":function(){return new URLSearchParams},"application/json":function(){return{append:function(t,e){this.data=this.data||{},this.data[t]=e},toString:function(){return JSON.stringify(this.data)},isEmpty:function(){return!this.data||0==Object.keys(this.data).length}}},"text/plain":function(){return{append:function(t,e){return this.data=this.data||[],this.data.push(e)},toString:function(){return this.data.join("")},isEmpty:function(){return!this.data||0==this.data.length}}}},f=t=>null==t,_=(...t)=>{for(var e=0;e<t.length;e++)if(null!==t[e]&&void 0!==t[e])return t[e];return null},v=(t,e,i,o)=>r(this,void 0,void 0,(function*(){return n(t,e).then((function(t){var e;return r(this,void 0,void 0,(function*(){try{var r=t.headers.get("Content-Type")||"";let n;try{n=t.type}catch(t){}let s={statusCode:t.status,statusText:t.statusText,headers:t.headers,type:n,ok:t.ok},a={"application/json":"json","text/plain":"text","(multipart/form-data|application/x-www-form-urlencoded)":"formData",blob:"blob",text:"text"},l=Object.keys(a).find((t=>new RegExp(t).test(r)))||"text";if(s[a[l]]=yield t[a[l]](),s.message=(null===(e=null==s?void 0:s.json)||void 0===e?void 0:e.message)||(t.ok?"Success.":"Something went wrong."),!t.ok)throw s;if(i.on_success){let t=i.on_success(s,o);if(void 0!==t)return t}return s}catch(t){if(i.on_error){let e=i.on_error(t,o);if(void 0!==e)return e}return Promise.reject(t)}}))}))}));function b(t,e,i){t.method=(t.method||"get").toUpperCase(),t.params=t.params||{};const o=function(n){var s,a,l,k,w,C;return r(this,void 0,void 0,(function*(){if(this instanceof o)throw new Error("This is an endpoint, you can't initialize this.");var r=c(d,e);r.on_request=t.on_request||r.on_request,r.on_success=t.on_success||r.on_success,r.on_error=t.on_error||r.on_error;var g=`${r.base}${t.path}`;((null==n?void 0:n.$sandbox)||(null===(s=null==r?void 0:r.values)||void 0===s?void 0:s.$sandbox))&&(g=`${r.sandboxBase||r.base}${t.path}`);var O,T,A={method:t.method,headers:Object.assign({},r.headers),agent:r.fetch_agent},E=p.includes(t.enctype)?t.enctype:u[t.enctype||"json"],S=Object.assign({},r.params,t.params),P=m[E](),N=new URLSearchParams;for(var R in"FormData"==(null===(a=null==n?void 0:n.constructor)||void 0===a?void 0:a.name)?(O=n,n=Object.fromEntries(Array.from(O.keys(),(t=>t.endsWith("[]")?[t.slice(0,-2),O.getAll(t)]:[t,O.get(t)])))):n=n||{},S){var D=S[R],I=n[R],L=null===(l=null==r?void 0:r.values)||void 0===l?void 0:l[R],x=D.default,U=(null==n?void 0:n.$sandbox)||(null===(k=null==r?void 0:r.values)||void 0===k?void 0:k.$sandbox)?D.example:void 0,B=_(I,L,U,x),j=D.name||R,M=D.help||`The '${R}' field is invalid.`;if(D.required&&f(B))throw(X=new Error(M)).field=R,X;if(!f(B)){if("function"==typeof D.format)try{B=D.format(B)}catch(t){throw(X=new Error(t.message||M)).field=R,X}if(D.type&&"any"!==D.type&&((X=new Error(M)).field=R,["string","boolean","number"].includes(D.type)&&typeof B!=D.type||"array"==D.type&&!Array.isArray(B)||"object"==D.type&&(!B||"Object"!==B.__proto__.constructor.name)))throw X;if(D.validate&&("RegExp"==(null===(C=null===(w=D.validate)||void 0===w?void 0:w.constructor)||void 0===C?void 0:C.name)&&(D.validate.toJSON=function(){return D.validate.toString().replace(/^\//g,"").replace(/\/$/g,"")}),!new RegExp(D.validate).test(B)))throw(X=new Error(M)).field=R,X;if("number"==D.type){var X;if(D.hasOwnProperty("max")&&!isNaN(D.max)&&Number(B)>Number(D.max))throw(X=new Error(`The maximum allowed value allowed for the ${j} parameter is ${D.max}`)).field=R,X;if(D.hasOwnProperty("min")&&!isNaN(D.min)&&Number(B)<Number(D.min))throw(X=new Error(`The minimum allowed value allowed for the ${j} parameter is ${D.min}`)).field=R,X}if(D.in&&Array.isArray(D.in)&&!D.in.includes(B))throw(X=new Error(`The ${j} parameter should be one of these values: ${D.in}`)).field=R,X;var F="string"==typeof D.location?D.location.toLowerCase():y[A.method];if(!F||!h.includes(F))throw new Error(`Invalid location for '${R}' field.`);"headers"!=F?"body"!=F?"query"!=F?"path"==F&&(g=g.replace(new RegExp(`{${(T=j,T.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).trim()}}`),B)):N.append(j,B):P.append(j,B):(A.headers=A.headers||{},A.headers[j]=B)}}var H=N.toString();H&&(g=`${g}?${H}`),P.keys&&(t=>{for(var e of t)return!1;return!0})(P.keys())||P.getLengthSync&&0==P.getLengthSync()||P.isEmpty&&P.isEmpty()||(A.body=P.toString()),A.body&&"multipart/form-data"!==E&&(A.headers=A.headers||{},A.headers["Content-Type"]=E);let G={url:g,options:A,params:n,key:i,instance:d.__$root_instance__,self:b(t,e,i)};if(r.on_request){var $=yield Promise.resolve(r.on_request(G));if($){if(!(null==$?void 0:$.url)&&!(null==$?void 0:$.options))return $;g=$.url||g,A=$.options||A}if(!1===$)return!1}return v(g,A,r,G)}))};return o}function k(e,i,r,n){var s={[e=e||"Rests"]:function(a){if(!(this instanceof s[e]))throw new Error("This is a category, you can initalize this category to update values using 'new' command.");if(n)throw new Error("This is already initialized, you can use 'set' instead.");let u=c(d,i),p=l(a),h=c(u,p);return o(r?(y=t,r.split(".").reduce(((t,e)=>null==t?void 0:t[e]),y)):t,h);var y}};return n&&(s[e].set=function(t){if(this instanceof s[e].set)throw new Error("The set object can't be initialized.");let i=l(t);return c(d,i,!0),s[e]}),s[e]}const w=Object.defineProperty(k("Rests",d,void 0,!0),"__schema__",{value:{schema:t,options:d},writable:!1,enumerable:!1});return d.__$root_instance__=w,function t(e,i,r,o){for(var n in i){var s=i[n];if(!s||"object"!=typeof s)continue;if(void 0!==e[n]){console.warn(`Skipping ${n} as it confilicts with another key in the object`);continue}let l=`${o?o+".":""}${n}`;if(s.hasOwnProperty("path")){var a=s;e[n]=b(a,r,l)}else{if("$"===n.substr(0,1))continue;let i=r;(null==s?void 0:s.$options)&&(i=c(r,null==s?void 0:s.$options)),e[n]=t(k(n,i,l),s,i,l)}}return e}(w,t,{})}Object.defineProperty(e,"__esModule",{value:!0}),o.default=o,e.default=o,t.exports=o},203:function(t,e,i){var r=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(o,n){function s(t){try{l(r.next(t))}catch(t){n(t)}}function a(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((r=r.apply(t,e||[])).next())}))},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=o(i(945)),s=i(382);let a,l;const c=(0,n.default)({binance:{$options:{base:"https://api.binance.com/api/v3"},bookTicker:{path:"/ticker/bookTicker",on_success:t=>t.json},ticker:{path:"/ticker/price",on_request(t){return r(this,void 0,void 0,(function*(){if(!l){const e=yield t.instance.binance.bookTicker();l=e.map((t=>parseFloat(t.askPrice)<=0&&t.symbol)).filter((t=>t))}}))},on_success(t,e){const i={USDT:"USD",USDC:"USD",BUSD:"USD"},r=t.json;if(!r||!Array.isArray(r))throw new Error(`Invalid response from Binance: ${JSON.stringify(r)}`);return r.reduce(((t,e)=>{if(l&&-1!==l.indexOf(e.symbol))return t;const r=(0,s.symbolMap)(e.symbol,i),o=parseFloat(e.price);return t[r]=o,t}),{})}}},bitfinex:{$options:{base:"https://api-pub.bitfinex.com/v2"},ticker:{path:"/tickers",params:{symbols:{help:"The symbols you want information about as a comma separated list, or ALL for every symbol. (Examples of possible symbols: tBTCUSD, tETHUSD, fUSD, fBTC)",default:"ALL",type:"string"}},on_success:function(t){const e={BAB:"BCH",DSH:"DASH"},i=t.json;if(!i||!Array.isArray(i))throw new Error(`Invalid response from Bitfinex: ${JSON.stringify(i)}`);return i.reduce(((t,i)=>{if(!i[0].startsWith("t"))return t;const r=(0,s.symbolMap)(i[0].replace(/^t/,""),e,!0).replace(":",""),o=parseFloat(i[7]);return t[r]=o,t}),{})}}},coinbase:{$options:{base:"https://api.coinbase.com/v2"},ticker:{path:"/exchange-rates",params:{currency:{help:"The exchange currency (default USD)"}},on_success:t=>{var e;const i=null===(e=null==t?void 0:t.json)||void 0===e?void 0:e.data;if(!i)throw new Error(`Invalid response from Coinbase: ${i}`);return Object.keys(i.rates).reduce(((t,e,r)=>{const o=e+i.currency,n=(0,s.formatNumber)(1/parseFloat(i.rates[e]),8);return t[o]=n,t}),{})}}},kraken:{$options:{base:"https://api.kraken.com/0/public"},pairs:{path:"/AssetPairs",on_success:t=>Object.keys(t.json.result)},ticker:{path:"/Ticker",on_request:t=>r(void 0,void 0,void 0,(function*(){if(!a){const e=yield t.instance.kraken.pairs();a=e}return{url:t.url+"?pair="+a}})),on_success:t=>{var e;const i={XETC:"ETC",XETH:"ETH",XLTC:"LTC",XMLN:"MLN",XREP:"REP",XXBT:"BTC",XXDG:"XDG",XXLM:"XLM",XXMR:"XMR",XXRP:"XRP",XZEC:"ZEC",XBT:"BTC",ZAUD:"AUD",ZEUR:"EUR",ZGBP:"GBP",ZUSD:"USD",ZCAD:"CAD",ZJPY:"JPY"},r=null===(e=t.json)||void 0===e?void 0:e.result;if(!r)throw new Error(`Invalid response from Kraken: ${JSON.stringify(r)}`);return Object.keys(r).reduce(((t,e)=>{const o=(0,s.symbolMap)(e,i,!0),n=parseFloat(r[e].c[0]);return t[o]=n,t}),{})}}},coinmarketcap:{$options:{base:"https://api.coinmarketcap.com/data-api/v3"},top:{path:"/map/all",params:{limit:{default:"150"},listing_status:{default:"active"}},on_success:function(t){const e=t.json;if(!e||!e.data||!Array.isArray(e.data.cryptoCurrencyMap))throw new Error(`Invalid response from CoinMarketCap: ${JSON.stringify(e)}`);return e.data.cryptoCurrencyMap.reduce(((t,e)=>(t[e.symbol]={id:e.id,title:e.name,symbol:e.symbol,logo:`https://s2.coinmarketcap.com/static/img/coins/128x128/${e.id}.png`,rank:e.rank},t)),{})}}},fiat:{all:{path:"https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml",on_success:function(t){var e=t.text,i=[...e.matchAll(/currency=["']([A-Za-z]+)["']/gi)],r=[...e.matchAll(/rate=["']([.0-9]+)["']/gi)],o=i.reduce(((t,e,i)=>Object.assign(Object.assign({},t),{[e[1]]:r[i][1]})),{});return o.EUR=1,o}}},coinconvert:{$options:{base:"https://api.coinconvert.net"},ticker:{path:"/v2/ticker",params:{v:{default:"2.1.6"},filterExchanges:{type:"array"},noAverage:{type:"boolean"}},on_success:t=>t.json},list:{path:"/v2/list?v=2.1.6",on_success:t=>t.json}}});e.default=c},866:function(t,e,i){var r=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(o,n){function s(t){try{l(r.next(t))}catch(t){n(t)}}function a(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const o=i(827);e.default=class{constructor(){this.ticker={},this.list=[],this.workers={},this.workersPromises=[]}ready(){return r(this,void 0,void 0,(function*(){return Promise.all(this.workersPromises)}))}addCurrency(t,e,i,n){return r(this,void 0,void 0,(function*(){if("string"!=typeof t||"string"!=typeof e||!o.initialCoinList.fiat.includes(e))throw new Error("Invalid currency pair.");if("function"!=typeof i)throw new Error("No function specified.");if(t=t.toUpperCase(),e=e.toUpperCase(),(this.ticker[t+e]||this.ticker[e+t]||-1!=this.list.indexOf(t))&&(console.warn("This custom currency already exists, it will be overriden."),this.removeCurrency(t)),this.list.push(t),n){if("number"!=typeof n)throw new Error("Invalid interval specfied.");this.workers[t+e]=setInterval((()=>Promise.resolve(i()).then((i=>{this.ticker[t+e]=Number(i)}))),n)}const r=Promise.resolve(i()).then((i=>{this.ticker[t+e]=Number(i)}));return this.workersPromises.push(r),r}))}removeCurrency(t,e){t=t.toUpperCase(),e=e?e.toUpperCase():"";for(const i in this.workers)i.includes(t+e)&&(clearInterval(this.workers[i]),delete this.ticker[i]);this.list=this.list.filter((e=>e!==t))}}},382:(t,e)=>{function i(t,e){if("number"!=typeof t&&(t=Number(t),isNaN(t)))return NaN;let i="number"==typeof e?t.toFixed(e):t+"",r=i.match(/\./)&&!i.match(/[eE]/)?i.replace(/0+$/g,"").replace(/\.+$/g,""):i;return parseFloat(r)}Object.defineProperty(e,"__esModule",{value:!0}),e.isBrowser=e.isValidUrl=e.isEmpty=e.formatNumber=e.getAverage=e.symbolMap=void 0,e.symbolMap=function t(e,i,r=!1){const o=Object.keys(i);for(var n=0;n<o.length;n++)if(e.length>=o[n].length+3&&(e.endsWith(o[n])||e.startsWith(o[n]))){const s=e.replace(o[n],i[o[n]]);return r?t(s,i,!1):s}return e},e.getAverage=function(t){return t.length?t.flatMap((t=>Object.keys(t))).filter(((t,e,i)=>i.indexOf(t)==e)).reduce(((e,r)=>{let o=t.map((t=>t[r])).filter((t=>t)),n=i(o.reduce(((t,e)=>t+e),0)/o.length,8);return e[r]=n,e}),{}):{}},e.formatNumber=i,e.isEmpty=function(t){if(!t)return!0;for(var e in t)return!1;return!0},e.isValidUrl=function(t){try{return/^https?\:\/\//.test(new URL(t).protocol)}catch(t){return!1}},e.isBrowser="undefined"!=typeof window&&window.document},607:function(module,exports,__webpack_require__){var __awaiter=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(o,n){function s(t){try{l(r.next(t))}catch(t){n(t)}}function a(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((r=r.apply(t,e||[])).next())}))},__classPrivateFieldGet=this&&this.__classPrivateFieldGet||function(t,e,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(t):r?r.value:e.get(t)},__importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},_CryptoConvert_instances,_CryptoConvert_getPrice,_CryptoConvert_wrapper,_CryptoConvert_isSafeKey,_CryptoConvert_setExtendedOptions,_CryptoConvert_populate;Object.defineProperty(exports,"__esModule",{value:!0});const helpers_1=__webpack_require__(382),worker_1=__importDefault(__webpack_require__(827)),custom_1=__importDefault(__webpack_require__(866)),customWorkers=new custom_1.default;class CryptoConvert{constructor(t={}){if(_CryptoConvert_instances.add(this),this.precision={fiat:4,crypto:8},helpers_1.isBrowser){if(window.__ccInitialized)throw new Error("You have already initalized one instance of crypto-convert. You cannot initialize multiple instances.");window.__ccInitialized=!0}__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_setExtendedOptions).call(this,t),this.worker=new worker_1.default(t),this.workerReady=this.worker.run(),this.internalMethods=Object.getOwnPropertyNames(CryptoConvert.prototype),Promise.resolve(this.workerReady).then((()=>{__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_populate).call(this),this.worker.onCryptoListRefresh=()=>{__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_populate).call(this)}}))}get isReady(){return this.worker.isReady}get list(){return{crypto:this.worker.list.crypto.concat(customWorkers.list),fiat:this.worker.list.fiat}}get cryptoInfo(){return this.worker.cryptoInfo}get lastUpdated(){return this.worker.data.crypto.last_updated}get ticker(){return this.worker.data}setOptions(t){if(__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_setExtendedOptions).call(this,t),(t.cryptoInterval||t.fiatInterval)&&(t.cryptoInterval!==this.worker.options.cryptoInterval||t.fiatInterval!==this.worker.options.fiatInterval)||t.hasOwnProperty("refreshCryptoList")&&t.refreshCryptoList!==this.worker.options.refreshCryptoList||t.hasOwnProperty("useHostedAPI")&&t.useHostedAPI!==this.worker.options.useHostedAPI||t.listLimit&&t.listLimit!=this.worker.options.listLimit){if(!this.worker.isReady)throw new Error("You cannot set these options here because CryptoConvert is not ready yet. Instead set the options on the constructor parameter.");return this.workerReady=Promise.resolve(this.worker.setOptions(t)).then((()=>__awaiter(this,void 0,void 0,(function*(){return yield this.worker.restart(),t.listLimit&&__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_populate).call(this),this.worker})))),this.worker}return this.worker.setOptions(t)}stop(){return this.worker.stop()}restart(){return this.workerReady=this.worker.restart(),this.workerReady}ready(){return __awaiter(this,void 0,void 0,(function*(){return yield Promise.resolve(this.workerReady),yield Promise.resolve(customWorkers.ready()),this}))}addCurrency(t,...e){return __awaiter(this,void 0,void 0,(function*(){if(this.hasOwnProperty(t))throw new Error("This property already exists.");return Promise.resolve(customWorkers.addCurrency.apply(customWorkers,[t,...e])).then((()=>{this.worker.isReady&&__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_populate).call(this)}))}))}removeCurrency(t,e){var i,r;if(customWorkers.list.includes(t)&&__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_isSafeKey).call(this,t)){delete this[t];const e=this.worker.list.crypto.concat(this.worker.list.fiat,customWorkers.list);for(const o of e)(null===(i=this[o])||void 0===i?void 0:i[t])&&(null===(r=this[o])||void 0===r||delete r[t])}return customWorkers.removeCurrency(t,e)}}_CryptoConvert_instances=new WeakSet,_CryptoConvert_getPrice=function(t,e="USD"){var i=customWorkers.ticker[t+e]||(customWorkers.ticker[e+t]?1/customWorkers.ticker[e+t]:null),r=this.worker.data.crypto.current[t+e]||(this.worker.data.crypto.current[e+t]?1/this.worker.data.crypto.current[e+t]:null);return i||r},_CryptoConvert_wrapper=function t(e,i){var r=i;return function(i){if((0,helpers_1.isEmpty)(this.worker.data.crypto.current)||(0,helpers_1.isEmpty)(this.worker.data.fiat.current))return console.warn("[~] Prices are loading.\nYou should use `await convert.ready()` to make sure prices are loaded before calling convert."),!1;if(!i)return!1;if(i=(0,helpers_1.formatNumber)(i),isNaN(i))return!1;const o=this.worker.data.fiat.current,n=this.worker.list.crypto.concat(customWorkers.list);if(r==e)return i;if(n.includes(e)&&n.includes(r)){let o=__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_getPrice).call(this,e,r)||__classPrivateFieldGet(this,_CryptoConvert_instances,"m",t).call(this,"USD",r)(__classPrivateFieldGet(this,_CryptoConvert_instances,"m",t).call(this,e,"USD")(1));return(0,helpers_1.formatNumber)(o*i,this.precision.crypto)}if(o[e]&&o[r])return(0,helpers_1.formatNumber)(i/o[e]*o[r],this.precision.fiat);var s=function(e){return __classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_getPrice).call(this,e)||__classPrivateFieldGet(this,_CryptoConvert_instances,"m",t).call(this,"BTC","USD")(__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_getPrice).call(this,e,"BTC"))||__classPrivateFieldGet(this,_CryptoConvert_instances,"m",t).call(this,"ETH","USD")(__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_getPrice).call(this,e,"ETH"))}.bind(this);if(o[r]){let t=s(e)/o.USD*o[r];return(0,helpers_1.formatNumber)(t*i,this.precision.crypto)}if(o[e]){let t=s(r)/o.USD*o[e];return(0,helpers_1.formatNumber)(i/t,this.precision.crypto)}return null}.bind(this)},_CryptoConvert_isSafeKey=function(t){return!this.internalMethods.includes(t)&&!t.startsWith("__")&&!function(){}[t]},_CryptoConvert_setExtendedOptions=function(t){if(t.precision)for(const e in t.precision)["crypto","fiat"].includes(e)&&"number"==typeof t.precision[e]&&(this.precision[e]=t.precision[e])},_CryptoConvert_populate=function _CryptoConvert_populate(){let types="";types+="type amount = (amount: number | string) => number | false | null;",types+="\nexport interface Pairs {";const all_currencies=this.worker.list.crypto.concat(this.worker.list.fiat,customWorkers.list);for(var i=0;i<all_currencies.length;i++){var coin=all_currencies[i];if(coin&&"string"==typeof coin&&__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_isSafeKey).call(this,coin)){this[coin]||(this[coin]={}),types+=`\n\t'${coin.replace(/\'/g,"\\'")}': {`;for(var a=0;a<all_currencies.length;a++){var currency=all_currencies[a];currency&&"string"==typeof currency&&__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_isSafeKey).call(this,coin)&&(this[coin][currency]=__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_wrapper).call(this,coin,currency),types+=`\n\t\t'${currency.replace(/\'/g,"\\'")}': amount,`)}types+="\n},"}}types+="\n}","undefined"==typeof window&&"undefined"!=typeof process&&function(){__awaiter(this,void 0,void 0,(function*(){try{eval("\n\t\t\t\t\t\tconst fs = require('fs');\n\t\t\t\t\t\tconst path = require('path');\n\t\t\t\t\t\tconst isDist = path.basename(__dirname) == 'dist';\n\t\t\t\t\t\tconst typesFile = path.join(__dirname, isDist ? 'paris.d.ts' : 'paris.ts');\n\n\t\t\t\t\t\tfs.writeFileSync(typesFile, types, 'utf-8');\n\t\t\t\t\t")}catch(t){console.warn(t)}}))}()},CryptoConvert.default=CryptoConvert,module.exports&&(module.exports=CryptoConvert),exports.default=CryptoConvert},827:function(t,e,i){var r=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(o,n){function s(t){try{l(r.next(t))}catch(t){n(t)}}function a(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((r=r.apply(t,e||[])).next())}))},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.initialCoinList=void 0;const n=o(i(203)),s=i(382);e.initialCoinList={crypto:["BTC","ETH","USDT","USDC","BNB","XRP","BUSD","ADA","SOL","DOGE","DOT","DAI","MATIC","SHIB","TRX","AVAX","UNI","WBTC","LEO","LTC","ETC","LINK","ATOM","FTT","XLM","NEAR","CRO","XMR","ALGO","BCH","LUNC","FLOW","QNT","VET","TON","FIL","APE","ICP","CHZ","HBAR","MANA","XTZ","SAND","EOS","EGLD","THETA","AAVE","AXS","OKB","USDP","BSV","KCS","TUSD","ZEC","MIOTA","XEC","USDD","MKR","BTT","HT","GRT","USDN","HNT","CAKE","NEO","KLAY","FTM","SNX","PAXG","RUNE","NEXO","LDO","CRV","GT","DASH","ENJ","BAT","COMP","STX","KAVA","RVN","ZIL","WAVES","FEI","MINA","RSR","XDC","LRC","GMT","DCR","TWT","CELO","XEM","BTG","KSM","HOT","1INCH","CEL","CVX","BNX","AR","GNO","LUNA","ROSE","ENS","USTC","GUSD","QTUM","YFI","ANKR","TFUEL","GALA","GLM","IOTX","KDA","BTRST","ONE","OMG","BAL","ZRX","LPT","POLY","JST","FLUX","ICX","BORA","IOST","HIVE","AMP","OP","KNC","XYM","SRM","ONT","WAXP","STORJ","MXC","CSPR","IMX","SC","ZEN","AUDIO","GLMR","SXP","XCH","ABBC","CHSB","VGX","UMA","WOO"],fiat:["USD","JPY","BGN","CZK","DKK","GBP","HUF","PLN","RON","SEK","CHF","ISK","NOK","HRK","RUB","TRY","AUD","BRL","CAD","CNY","HKD","IDR","ILS","INR","KRW","MXN","MYR","NZD","PHP","SGD","THB","ZAR","EUR"]},e.default=class{constructor(t){this.exchanges=["binance","bitfinex","coinbase","kraken"],this.list=e.initialCoinList,this.cryptoInfo=[{id:1,title:"Bitcoin",symbol:"BTC",rank:1},{id:1027,title:"Ethereum",symbol:"ETH",rank:2},{id:825,title:"Tether",symbol:"USDT",rank:3},{id:3408,title:"USD Coin",symbol:"USDC",rank:4},{id:1839,title:"BNB",symbol:"BNB",rank:5},{id:52,title:"XRP",symbol:"XRP",rank:6},{id:4687,title:"Binance USD",symbol:"BUSD",rank:7},{id:2010,title:"Cardano",symbol:"ADA",rank:8},{id:5426,title:"Solana",symbol:"SOL",rank:9},{id:74,title:"Dogecoin",symbol:"DOGE",rank:10},{id:6636,title:"Polkadot",symbol:"DOT",rank:11},{id:4943,title:"Dai",symbol:"DAI",rank:12},{id:3890,title:"Polygon",symbol:"MATIC",rank:13},{id:5994,title:"Shiba Inu",symbol:"SHIB",rank:14},{id:1958,title:"TRON",symbol:"TRX",rank:15},{id:5805,title:"Avalanche",symbol:"AVAX",rank:16},{id:7083,title:"Uniswap",symbol:"UNI",rank:17},{id:3717,title:"Wrapped Bitcoin",symbol:"WBTC",rank:18},{id:3957,title:"UNUS SED LEO",symbol:"LEO",rank:19},{id:2,title:"Litecoin",symbol:"LTC",rank:20},{id:1321,title:"Ethereum Classic",symbol:"ETC",rank:21},{id:1975,title:"Chainlink",symbol:"LINK",rank:22},{id:3794,title:"Cosmos",symbol:"ATOM",rank:23},{id:4195,title:"FTX Token",symbol:"FTT",rank:24},{id:512,title:"Stellar",symbol:"XLM",rank:25},{id:6535,title:"NEAR Protocol",symbol:"NEAR",rank:26},{id:3635,title:"Cronos",symbol:"CRO",rank:27},{id:328,title:"Monero",symbol:"XMR",rank:28},{id:4030,title:"Algorand",symbol:"ALGO",rank:29},{id:1831,title:"Bitcoin Cash",symbol:"BCH",rank:30},{id:4172,title:"Terra Classic",symbol:"LUNC",rank:31},{id:4558,title:"Flow",symbol:"FLOW",rank:32},{id:3155,title:"Quant",symbol:"QNT",rank:33},{id:3077,title:"VeChain",symbol:"VET",rank:34},{id:11419,title:"Toncoin",symbol:"TON",rank:35},{id:2280,title:"Filecoin",symbol:"FIL",rank:36},{id:18876,title:"ApeCoin",symbol:"APE",rank:37},{id:8916,title:"Internet Computer",symbol:"ICP",rank:38},{id:4066,title:"Chiliz",symbol:"CHZ",rank:39},{id:4642,title:"Hedera",symbol:"HBAR",rank:40},{id:1966,title:"Decentraland",symbol:"MANA",rank:41},{id:2011,title:"Tezos",symbol:"XTZ",rank:42},{id:6210,title:"The Sandbox",symbol:"SAND",rank:43},{id:1765,title:"EOS",symbol:"EOS",rank:44},{id:6892,title:"Elrond",symbol:"EGLD",rank:45},{id:2416,title:"Theta Network",symbol:"THETA",rank:46},{id:7278,title:"Aave",symbol:"AAVE",rank:47},{id:6783,title:"Axie Infinity",symbol:"AXS",rank:48},{id:3897,title:"OKB",symbol:"OKB",rank:49},{id:3330,title:"Pax Dollar",symbol:"USDP",rank:50},{id:3602,title:"Bitcoin SV",symbol:"BSV",rank:51},{id:2087,title:"KuCoin Token",symbol:"KCS",rank:52},{id:2563,title:"TrueUSD",symbol:"TUSD",rank:53},{id:1437,title:"Zcash",symbol:"ZEC",rank:54},{id:1720,title:"IOTA",symbol:"MIOTA",rank:55},{id:10791,title:"eCash",symbol:"XEC",rank:56},{id:19891,title:"USDD",symbol:"USDD",rank:57},{id:1518,title:"Maker",symbol:"MKR",rank:58},{id:16086,title:"BitTorrent-New",symbol:"BTT",rank:59},{id:2502,title:"Huobi Token",symbol:"HT",rank:60},{id:6719,title:"The Graph",symbol:"GRT",rank:61},{id:5068,title:"Neutrino USD",symbol:"USDN",rank:62},{id:5665,title:"Helium",symbol:"HNT",rank:63},{id:7186,title:"PancakeSwap",symbol:"CAKE",rank:64},{id:1376,title:"Neo",symbol:"NEO",rank:65},{id:4256,title:"Klaytn",symbol:"KLAY",rank:66},{id:3513,title:"Fantom",symbol:"FTM",rank:67},{id:2586,title:"Synthetix",symbol:"SNX",rank:68},{id:4705,title:"PAX Gold",symbol:"PAXG",rank:69},{id:4157,title:"THORChain",symbol:"RUNE",rank:70},{id:2694,title:"Nexo",symbol:"NEXO",rank:71},{id:8e3,title:"Lido DAO",symbol:"LDO",rank:72},{id:6538,title:"Curve DAO Token",symbol:"CRV",rank:73},{id:4269,title:"GateToken",symbol:"GT",rank:74},{id:131,title:"Dash",symbol:"DASH",rank:75},{id:2130,title:"Enjin Coin",symbol:"ENJ",rank:76},{id:1697,title:"Basic Attention Token",symbol:"BAT",rank:77},{id:5692,title:"Compound",symbol:"COMP",rank:78},{id:4847,title:"Stacks",symbol:"STX",rank:79},{id:4846,title:"Kava",symbol:"KAVA",rank:80},{id:2577,title:"Ravencoin",symbol:"RVN",rank:81},{id:2469,title:"Zilliqa",symbol:"ZIL",rank:82},{id:1274,title:"Waves",symbol:"WAVES",rank:83},{id:8642,title:"Fei USD",symbol:"FEI",rank:84},{id:8646,title:"Mina",symbol:"MINA",rank:85},{id:3964,title:"Reserve Rights",symbol:"RSR",rank:86},{id:2634,title:"XDC Network",symbol:"XDC",rank:87},{id:1934,title:"Loopring",symbol:"LRC",rank:88},{id:18069,title:"STEPN",symbol:"GMT",rank:89},{id:1168,title:"Decred",symbol:"DCR",rank:90},{id:5964,title:"Trust Wallet Token",symbol:"TWT",rank:91},{id:5567,title:"Celo",symbol:"CELO",rank:92},{id:873,title:"NEM",symbol:"XEM",rank:93},{id:2083,title:"Bitcoin Gold",symbol:"BTG",rank:94},{id:5034,title:"Kusama",symbol:"KSM",rank:95},{id:2682,title:"Holo",symbol:"HOT",rank:96},{id:8104,title:"1inch Network",symbol:"1INCH",rank:97},{id:2700,title:"Celsius",symbol:"CEL",rank:98},{id:9903,title:"Convex Finance",symbol:"CVX",rank:99},{id:9891,title:"BinaryX",symbol:"BNX",rank:100},{id:5632,title:"Arweave",symbol:"AR",rank:101},{id:1659,title:"Gnosis",symbol:"GNO",rank:102},{id:20314,title:"Terra",symbol:"LUNA",rank:103},{id:7653,title:"Oasis Network",symbol:"ROSE",rank:104},{id:13855,title:"Ethereum Name Service",symbol:"ENS",rank:105},{id:7129,title:"TerraClassicUSD",symbol:"USTC",rank:106},{id:3306,title:"Gemini Dollar",symbol:"GUSD",rank:107},{id:1684,title:"Qtum",symbol:"QTUM",rank:108},{id:5864,title:"yearn.finance",symbol:"YFI",rank:109},{id:3783,title:"Ankr",symbol:"ANKR",rank:110},{id:3822,title:"Theta Fuel",symbol:"TFUEL",rank:111},{id:7080,title:"Gala",symbol:"GALA",rank:112},{id:1455,title:"Golem",symbol:"GLM",rank:113},{id:2777,title:"IoTeX",symbol:"IOTX",rank:114},{id:5647,title:"Kadena",symbol:"KDA",rank:115},{id:11584,title:"Braintrust",symbol:"BTRST",rank:116},{id:3945,title:"Harmony",symbol:"ONE",rank:117},{id:1808,title:"OMG Network",symbol:"OMG",rank:118},{id:5728,title:"Balancer",symbol:"BAL",rank:119},{id:1896,title:"0x",symbol:"ZRX",rank:120},{id:3640,title:"Livepeer",symbol:"LPT",rank:121},{id:2496,title:"Polymath",symbol:"POLY",rank:122},{id:5488,title:"JUST",symbol:"JST",rank:123},{id:3029,title:"Flux",symbol:"FLUX",rank:124},{id:2099,title:"ICON",symbol:"ICX",rank:125},{id:3801,title:"BORA",symbol:"BORA",rank:126},{id:2405,title:"IOST",symbol:"IOST",rank:127},{id:5370,title:"Hive",symbol:"HIVE",rank:128},{id:6945,title:"Amp",symbol:"AMP",rank:129},{id:11840,title:"Optimism",symbol:"OP",rank:130},{id:9444,title:"Kyber Network Crystal v2",symbol:"KNC",rank:131},{id:8677,title:"Symbol",symbol:"XYM",rank:132},{id:6187,title:"Serum",symbol:"SRM",rank:133},{id:2566,title:"Ontology",symbol:"ONT",rank:134},{id:2300,title:"WAX",symbol:"WAXP",rank:135},{id:1772,title:"Storj",symbol:"STORJ",rank:136},{id:3628,title:"MXC",symbol:"MXC",rank:137},{id:5899,title:"Casper",symbol:"CSPR",rank:138},{id:10603,title:"Immutable X",symbol:"IMX",rank:139},{id:1042,title:"Siacoin",symbol:"SC",rank:140},{id:1698,title:"Horizen",symbol:"ZEN",rank:141},{id:7455,title:"Audius",symbol:"AUDIO",rank:142},{id:6836,title:"Moonbeam",symbol:"GLMR",rank:143},{id:4279,title:"SXP",symbol:"SXP",rank:144},{id:9258,title:"Chia",symbol:"XCH",rank:145},{id:3437,title:"ABBC Coin",symbol:"ABBC",rank:146},{id:2499,title:"SwissBorg",symbol:"CHSB",rank:147},{id:1817,title:"Voyager Token",symbol:"VGX",rank:148},{id:5617,title:"UMA",symbol:"UMA",rank:149},{id:7501,title:"WOO Network",symbol:"WOO",rank:150}].reduce(((t,e)=>(t[e.symbol]=Object.assign(Object.assign({},t),{logo:`https://s2.coinmarketcap.com/static/img/coins/128x128/${e.id}.png`}),t)),{}),this.data={crypto:{last_updated:null,current:null},fiat:{last_updated:null,current:null}},this.options=Object.assign({cryptoInterval:s.isBrowser?15e3:5e3,fiatInterval:36e5,calculateAverage:!0,onUpdate:void 0,serverHost:"https://api.coinconvert.net",useHostedAPI:!1,refreshCryptoList:!0,listLimit:150,disableExchangeMode:"saveLastCache"},this.exchanges.reduce(((t,e)=>Object.assign(Object.assign({},t),{[e]:!0})),{})),this.isReady=!1,this.isRunning=!1,t&&this.setOptions(t),this.hostedAPI||(this.hostedAPI=new n.default.coinconvert({$options:{base:this.options.serverHost}}))}log(...t){var e,i;!s.isBrowser&&(null===(i=null===(e=null===process||void 0===process?void 0:process.env)||void 0===e?void 0:e.NODE_ENV)||void 0===i?void 0:i.startsWith("dev"))&&Array.from(arguments).forEach((t=>{console.log(t)}))}setOptions(t){let e="function"==typeof t?t(Object.assign({},this.options)):t||{};s.isBrowser&&!isNaN(e.cryptoInterval)&&e.cryptoInterval<1e4&&console.error("The minimum allowed interval on frontend is 10s. You should host your own server API if you want to go lower.\n\t\t\t\n\t\t\tFor the server API routes see the CoinConvert schema on https://github.com/coinconvert/crypto-convert/blob/main/src/api.ts;\n\t\t\t");let i=!1,r=e.hasOwnProperty("calculateAverage")&&e.calculateAverage!==this.options.calculateAverage,o="saveAllCache"===e.disableExchangeMode&&"saveAllCache"!==this.options.disableExchangeMode;for(const t of this.exchanges)if(e.hasOwnProperty(t)&&e[t]!==this.options[t]){i=!0;break}if(e.hasOwnProperty("HTTPAgent")&&n.default.set({$options:{fetch_agent:e.HTTPAgent}}),e.serverHost&&(0,s.isValidUrl)(e.serverHost)&&(this.options.serverHost=e.serverHost,this.hostedAPI=new n.default.coinconvert({$options:{base:e.serverHost}})),this.options=Object.assign(Object.assign(Object.assign({},this.options),e),{cryptoInterval:isNaN(e.cryptoInterval)?this.options.cryptoInterval:Math.max(s.isBrowser&&!this.isCustomServerHost?1e4:1e3,e.cryptoInterval),fiatInterval:isNaN(e.fiatInterval)?this.options.fiatInterval:Math.max(18e5,e.fiatInterval),listLimit:isNaN(e.listLimit)?this.options.listLimit:Math.max(1,Math.min(1e3,parseInt(e.listLimit+"")))}),(i||r)&&this.isReady){if(s.isBrowser||this.options.useHostedAPI)return this.browserTicker();if("noCache"===this.options.disableExchangeMode||o)return this.updateCrypto();this.data.crypto.current=this.joinPrices(this.data)}return this}get isCustomServerHost(){return!/^https?:\/\/api\.coinconvert\.net/i.test(this.options.serverHost)}updateCrypto(){return r(this,void 0,void 0,(function*(){this.data.crypto.last_updated||this.log("Updating crypto...");const t=this.exchanges.reduce(((t,e)=>Object.assign(Object.assign({},t),{[e]:n.default[e].ticker})),{});let e=[],i={};for(const r in t)if(this.options[r]||"saveAllCache"===this.options.disableExchangeMode)try{this.data.crypto[r]=yield t[r](),this.options[r]&&(e.push(this.data.crypto[r]),i=Object.assign(Object.assign({},i),this.data.crypto[r]),this.data.crypto.last_updated=+new Date)}catch(t){this.data.crypto[r]=null,console.error(`Failed fetching prices from ${r}`,t)}return e.length&&(this.data.crypto.current=this.options.calculateAverage?Object.assign(Object.assign({},i),(0,s.getAverage)(e)):i,"function"==typeof this.options.onUpdate&&this.options.onUpdate(this.data.crypto)),this}))}updateFiat(){return r(this,void 0,void 0,(function*(){this.log("Updating fiat...");try{this.data.fiat.current=yield n.default.fiat.all(),this.data.fiat.last_updated=+new Date,"function"==typeof this.options.onUpdate&&this.options.onUpdate(this.data.fiat,!0)}catch(t){console.error("Failed fetching fiat prices from ECB",t)}return this}))}updateLists(){return r(this,void 0,void 0,(function*(){this.data.crypto.last_updated||this.log("Updating top currency list...");try{const t=yield n.default.coinmarketcap.top({limit:this.options.listLimit+""});this.list.crypto=Object.keys(t),this.cryptoInfo=t,"function"==typeof this.onCryptoListRefresh&&this.isReady&&this.onCryptoListRefresh(this.list.crypto)}catch(t){console.error("Failed fetching fiat prices from ECB",t)}return this}))}joinPrices(t){const e=this.exchanges.reduce(((e,i)=>Object.assign(Object.assign({},e),{[i]:t.crypto[i]})),{});let i=[],r={};for(const t in e)this.options[t]&&e[t]&&(i.push(e[t]),r=Object.assign(Object.assign({},r),e[t]));return this.options.calculateAverage?Object.assign(Object.assign({},r),(0,s.getAverage)(i)):r}browserTicker(){return r(this,void 0,void 0,(function*(){try{const t=this.options,e=this.exchanges.filter((e=>!t[e])),i=yield this.hostedAPI.ticker(e.length?{filterExchanges:e,noAverage:!this.options.calculateAverage||void 0}:{});this.data=i,"function"==typeof this.options.onUpdate&&this.options.onUpdate(this.data)}catch(t){console.error("Failed fetching prices from API",t)}return this}))}browserLists(){return r(this,void 0,void 0,(function*(){try{const t=yield this.hostedAPI.list();this.list.crypto=Object.keys(t.crypto),this.list.fiat=t.fiat,this.cryptoInfo=t.crypto,"function"==typeof this.onCryptoListRefresh&&this.isReady&&this.onCryptoListRefresh(this.list.crypto)}catch(t){console.error("Failed fetching currencies list from API",t)}return this}))}runBrowser(){return r(this,void 0,void 0,(function*(){if("undefined"!=typeof window&&window.__ccRunning)throw new Error("The crypto-convert worker seems to be already running. \n\t\t\t- There might be an issue with the way your app imports javascript dependencies. \n\t\t\t- Make sure to call 'convert.stop()' on component unmounts if you are using SPA frameworks (e.g React).");if(!this.isReady){if(yield this.browserTicker(),yield this.browserLists(),!this.isRunning)return!1;!s.isBrowser&&this.options.useHostedAPI&&this.options.refreshCryptoList&&(this.lists_worker=setInterval(this.browserLists.bind(this),86400))}return this.crypto_worker=setInterval(this.browserTicker.bind(this),this.options.cryptoInterval),this.isReady=!0,"undefined"!=typeof window&&(window.__ccRunning=!0,window.__ccRunID&&clearInterval(window.__ccRunID),window.__ccRunID=this.crypto_worker),this}))}runServer(){return r(this,void 0,void 0,(function*(){return yield this.updateLists(),yield this.updateFiat(),yield this.updateCrypto(),!!this.isRunning&&(this.isReady=!0,this.crypto_worker=setInterval(this.updateCrypto.bind(this),this.options.cryptoInterval),this.fiat_worker=setInterval(this.updateFiat.bind(this),this.options.fiatInterval),this.options.refreshCryptoList&&(this.lists_worker=setInterval(this.updateLists.bind(this),86400)),this)}))}run(){if(this.isRunning||this.crypto_worker)throw new Error("Crypto-convert is already running.");return this.isRunning=!0,s.isBrowser||this.options.useHostedAPI?this.runBrowser():this.runServer()}stop(){return this.isRunning=!1,clearInterval(this.crypto_worker),clearInterval(this.fiat_worker),this.crypto_worker=null,this.fiat_worker=null,this.lists_worker&&(clearInterval(this.lists_worker),this.lists_worker=null),"undefined"!=typeof window&&(window.__ccRunning=!1),this}restart(){return this.stop().run()}}},88:t=>{t.exports=__WEBPACK_EXTERNAL_MODULE__88__},265:t=>{t.exports=__WEBPACK_EXTERNAL_MODULE__265__}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var i=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(i.exports,i,i.exports,__webpack_require__),i.exports}var __webpack_exports__=__webpack_require__(607);return __webpack_exports__})()));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("FormData"),require("fetch")):"function"==typeof define&&define.amd?define(["FormData","fetch"],e):"object"==typeof exports?exports.CryptoConvert=e(require("FormData"),require("fetch")):t.CryptoConvert=e(t.FormData,t.fetch)}(this,((__WEBPACK_EXTERNAL_MODULE__88__,__WEBPACK_EXTERNAL_MODULE__265__)=>(()=>{"use strict";var __webpack_modules__={945:function(t,e,i){var r=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(o,n){function s(t){try{l(r.next(t))}catch(t){n(t)}}function a(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((r=r.apply(t,e||[])).next())}))};function o(t,e){const n="undefined"!=typeof window?null===window||void 0===window?void 0:window.fetch:i(265),s="undefined"!=typeof window?null===window||void 0===window?void 0:window.FormData:i(88);if(!n)throw new Error("Fetch API is not installed. If you are using Node please run `npm install node-fetch`");if(!s)throw new Error("FormData is not installed. If you are using Node please run `npm install form-data`");const a=t=>Object.assign(Object.assign({},t),{headers:Object.assign({},t.headers),params:Object.assign({},t.params),values:Object.assign({},t.values)}),l=t=>{var e,i;if("Object"!=(null===(i=null===(e=null==t?void 0:t.__proto__)||void 0===e?void 0:e.constructor)||void 0===i?void 0:i.name))throw new Error("Invalid $options object.");let r=a(t.$options||{});return delete t.$options,Object.assign(Object.assign({},r),{values:Object.assign(Object.assign({},r.values),t)})},c=(t,e,i=!1)=>{let r=i?t||{}:a(t||{}),o=a(e||{});return o.headers=Object.assign(Object.assign({},r.headers),o.headers),o.params=Object.assign(Object.assign({},r.params),o.params),o.values=Object.assign(Object.assign({},r.values),o.values),Object.assign(r,o),r};t=Object.assign({},t);let d={base:"",headers:{"User-Agent":"Rests JS (v1.1.0)"},params:{},values:{},on_error:void 0,on_success:void 0,on_request:void 0,fetch_agent:null};c(d,(null==t?void 0:t.$options)||{},!0),c(d,e,!0);const u={json:"application/json",form:"multipart/form-data",urlencoded:"application/x-www-form-urlencoded",text:"text/plain"},p=Object.values(u),h=["headers","body","query","path"],y={POST:"body",GET:"query"},m={"multipart/form-data":function(){var t=new s;return t.toString=function(){return this},t},"application/x-www-form-urlencoded":function(){return new URLSearchParams},"application/json":function(){return{append:function(t,e){this.data=this.data||{},this.data[t]=e},toString:function(){return JSON.stringify(this.data)},isEmpty:function(){return!this.data||0==Object.keys(this.data).length}}},"text/plain":function(){return{append:function(t,e){return this.data=this.data||[],this.data.push(e)},toString:function(){return this.data.join("")},isEmpty:function(){return!this.data||0==this.data.length}}}},f=t=>null==t,_=(...t)=>{for(var e=0;e<t.length;e++)if(null!==t[e]&&void 0!==t[e])return t[e];return null},v=(t,e,i,o)=>r(this,void 0,void 0,(function*(){return n(t,e).then((function(t){var e;return r(this,void 0,void 0,(function*(){try{var r=t.headers.get("Content-Type")||"";let n;try{n=t.type}catch(t){}let s={statusCode:t.status,statusText:t.statusText,headers:t.headers,type:n,ok:t.ok},a={"application/json":"json","text/plain":"text","(multipart/form-data|application/x-www-form-urlencoded)":"formData",blob:"blob",text:"text"},l=Object.keys(a).find((t=>new RegExp(t).test(r)))||"text";if(s[a[l]]=yield t[a[l]](),s.message=(null===(e=null==s?void 0:s.json)||void 0===e?void 0:e.message)||(t.ok?"Success.":"Something went wrong."),!t.ok)throw s;if(i.on_success){let t=i.on_success(s,o);if(void 0!==t)return t}return s}catch(t){if(i.on_error){let e=i.on_error(t,o);if(void 0!==e)return e}return Promise.reject(t)}}))}))}));function b(t,e,i){t.method=(t.method||"get").toUpperCase(),t.params=t.params||{};const o=function(n){var s,a,l,k,w,C;return r(this,void 0,void 0,(function*(){if(this instanceof o)throw new Error("This is an endpoint, you can't initialize this.");var r=c(d,e);r.on_request=t.on_request||r.on_request,r.on_success=t.on_success||r.on_success,r.on_error=t.on_error||r.on_error;var g=`${r.base}${t.path}`;((null==n?void 0:n.$sandbox)||(null===(s=null==r?void 0:r.values)||void 0===s?void 0:s.$sandbox))&&(g=`${r.sandboxBase||r.base}${t.path}`);var O,T,A={method:t.method,headers:Object.assign({},r.headers),agent:r.fetch_agent},E=p.includes(t.enctype)?t.enctype:u[t.enctype||"json"],S=Object.assign({},r.params,t.params),P=m[E](),N=new URLSearchParams;for(var R in"FormData"==(null===(a=null==n?void 0:n.constructor)||void 0===a?void 0:a.name)?(O=n,n=Object.fromEntries(Array.from(O.keys(),(t=>t.endsWith("[]")?[t.slice(0,-2),O.getAll(t)]:[t,O.get(t)])))):n=n||{},S){var D=S[R],I=n[R],L=null===(l=null==r?void 0:r.values)||void 0===l?void 0:l[R],x=D.default,U=(null==n?void 0:n.$sandbox)||(null===(k=null==r?void 0:r.values)||void 0===k?void 0:k.$sandbox)?D.example:void 0,B=_(I,L,U,x),j=D.name||R,M=D.help||`The '${R}' field is invalid.`;if(D.required&&f(B))throw(X=new Error(M)).field=R,X;if(!f(B)){if("function"==typeof D.format)try{B=D.format(B)}catch(t){throw(X=new Error(t.message||M)).field=R,X}if(D.type&&"any"!==D.type&&((X=new Error(M)).field=R,["string","boolean","number"].includes(D.type)&&typeof B!=D.type||"array"==D.type&&!Array.isArray(B)||"object"==D.type&&(!B||"Object"!==B.__proto__.constructor.name)))throw X;if(D.validate&&("RegExp"==(null===(C=null===(w=D.validate)||void 0===w?void 0:w.constructor)||void 0===C?void 0:C.name)&&(D.validate.toJSON=function(){return D.validate.toString().replace(/^\//g,"").replace(/\/$/g,"")}),!new RegExp(D.validate).test(B)))throw(X=new Error(M)).field=R,X;if("number"==D.type){var X;if(D.hasOwnProperty("max")&&!isNaN(D.max)&&Number(B)>Number(D.max))throw(X=new Error(`The maximum allowed value allowed for the ${j} parameter is ${D.max}`)).field=R,X;if(D.hasOwnProperty("min")&&!isNaN(D.min)&&Number(B)<Number(D.min))throw(X=new Error(`The minimum allowed value allowed for the ${j} parameter is ${D.min}`)).field=R,X}if(D.in&&Array.isArray(D.in)&&!D.in.includes(B))throw(X=new Error(`The ${j} parameter should be one of these values: ${D.in}`)).field=R,X;var F="string"==typeof D.location?D.location.toLowerCase():y[A.method];if(!F||!h.includes(F))throw new Error(`Invalid location for '${R}' field.`);"headers"!=F?"body"!=F?"query"!=F?"path"==F&&(g=g.replace(new RegExp(`{${(T=j,T.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).trim()}}`),B)):N.append(j,B):P.append(j,B):(A.headers=A.headers||{},A.headers[j]=B)}}var H=N.toString();H&&(g=`${g}?${H}`),P.keys&&(t=>{for(var e of t)return!1;return!0})(P.keys())||P.getLengthSync&&0==P.getLengthSync()||P.isEmpty&&P.isEmpty()||(A.body=P.toString()),A.body&&"multipart/form-data"!==E&&(A.headers=A.headers||{},A.headers["Content-Type"]=E);let G={url:g,options:A,params:n,key:i,instance:d.__$root_instance__,self:b(t,e,i)};if(r.on_request){var $=yield Promise.resolve(r.on_request(G));if($){if(!(null==$?void 0:$.url)&&!(null==$?void 0:$.options))return $;g=$.url||g,A=$.options||A}if(!1===$)return!1}return v(g,A,r,G)}))};return o}function k(e,i,r,n){var s={[e=e||"Rests"]:function(a){if(!(this instanceof s[e]))throw new Error("This is a category, you can initalize this category to update values using 'new' command.");if(n)throw new Error("This is already initialized, you can use 'set' instead.");let u=c(d,i),p=l(a),h=c(u,p);return o(r?(y=t,r.split(".").reduce(((t,e)=>null==t?void 0:t[e]),y)):t,h);var y}};return n&&(s[e].set=function(t){if(this instanceof s[e].set)throw new Error("The set object can't be initialized.");let i=l(t);return c(d,i,!0),s[e]}),s[e]}const w=Object.defineProperty(k("Rests",d,void 0,!0),"__schema__",{value:{schema:t,options:d},writable:!1,enumerable:!1});return d.__$root_instance__=w,function t(e,i,r,o){for(var n in i){var s=i[n];if(!s||"object"!=typeof s)continue;if(void 0!==e[n]){console.warn(`Skipping ${n} as it confilicts with another key in the object`);continue}let l=`${o?o+".":""}${n}`;if(s.hasOwnProperty("path")){var a=s;e[n]=b(a,r,l)}else{if("$"===n.substr(0,1))continue;let i=r;(null==s?void 0:s.$options)&&(i=c(r,null==s?void 0:s.$options)),e[n]=t(k(n,i,l),s,i,l)}}return e}(w,t,{})}Object.defineProperty(e,"__esModule",{value:!0}),o.default=o,e.default=o,t.exports=o},203:function(t,e,i){var r=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(o,n){function s(t){try{l(r.next(t))}catch(t){n(t)}}function a(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((r=r.apply(t,e||[])).next())}))},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=o(i(945)),s=i(382);let a,l;const c=(0,n.default)({binance:{$options:{base:"https://api.binance.com/api/v3"},bookTicker:{path:"/ticker/bookTicker",on_success:t=>t.json},ticker:{path:"/ticker/price",on_request(t){return r(this,void 0,void 0,(function*(){if(!l){const e=yield t.instance.binance.bookTicker();l=e.map((t=>parseFloat(t.askPrice)<=0&&t.symbol)).filter((t=>t))}}))},on_success(t,e){const i={USDT:"USD",USDC:"USD",BUSD:"USD"},r=t.json;if(!r||!Array.isArray(r))throw new Error(`Invalid response from Binance: ${JSON.stringify(r)}`);return r.reduce(((t,e)=>{if(l&&-1!==l.indexOf(e.symbol))return t;const r=(0,s.symbolMap)(e.symbol,i),o=parseFloat(e.price);return t[r]=o,t}),{})}}},bitfinex:{$options:{base:"https://api-pub.bitfinex.com/v2"},ticker:{path:"/tickers",params:{symbols:{help:"The symbols you want information about as a comma separated list, or ALL for every symbol. (Examples of possible symbols: tBTCUSD, tETHUSD, fUSD, fBTC)",default:"ALL",type:"string"}},on_success:function(t){const e={BAB:"BCH",DSH:"DASH"},i=t.json;if(!i||!Array.isArray(i))throw new Error(`Invalid response from Bitfinex: ${JSON.stringify(i)}`);return i.reduce(((t,i)=>{if(!i[0].startsWith("t"))return t;const r=(0,s.symbolMap)(i[0].replace(/^t/,""),e,!0).replace(":",""),o=parseFloat(i[7]);return t[r]=o,t}),{})}}},coinbase:{$options:{base:"https://api.coinbase.com/v2"},ticker:{path:"/exchange-rates",params:{currency:{help:"The exchange currency (default USD)"}},on_success:t=>{var e;const i=null===(e=null==t?void 0:t.json)||void 0===e?void 0:e.data;if(!i)throw new Error(`Invalid response from Coinbase: ${i}`);return Object.keys(i.rates).reduce(((t,e,r)=>{const o=e+i.currency,n=(0,s.formatNumber)(1/parseFloat(i.rates[e]),8);return t[o]=n,t}),{})}}},kraken:{$options:{base:"https://api.kraken.com/0/public"},pairs:{path:"/AssetPairs",on_success:t=>Object.keys(t.json.result)},ticker:{path:"/Ticker",on_request:t=>r(void 0,void 0,void 0,(function*(){if(!a){const e=yield t.instance.kraken.pairs();a=e}return{url:t.url+"?pair="+a}})),on_success:t=>{var e;const i={XETC:"ETC",XETH:"ETH",XLTC:"LTC",XMLN:"MLN",XREP:"REP",XXBT:"BTC",XXDG:"XDG",XXLM:"XLM",XXMR:"XMR",XXRP:"XRP",XZEC:"ZEC",XBT:"BTC",ZAUD:"AUD",ZEUR:"EUR",ZGBP:"GBP",ZUSD:"USD",ZCAD:"CAD",ZJPY:"JPY"},r=null===(e=t.json)||void 0===e?void 0:e.result;if(!r)throw new Error(`Invalid response from Kraken: ${JSON.stringify(r)}`);return Object.keys(r).reduce(((t,e)=>{const o=(0,s.symbolMap)(e,i,!0),n=parseFloat(r[e].c[0]);return t[o]=n,t}),{})}}},coinmarketcap:{$options:{base:"https://api.coinmarketcap.com/data-api/v3"},top:{path:"/map/all",params:{limit:{default:"150"},listing_status:{default:"active"}},on_success:function(t){const e=t.json;if(!e||!e.data||!Array.isArray(e.data.cryptoCurrencyMap))throw new Error(`Invalid response from CoinMarketCap: ${JSON.stringify(e)}`);return e.data.cryptoCurrencyMap.reduce(((t,e)=>(t[e.symbol]={id:e.id,title:e.name,symbol:e.symbol,logo:`https://s2.coinmarketcap.com/static/img/coins/128x128/${e.id}.png`,rank:e.rank},t)),{})}}},fiat:{all:{path:"https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml",on_success:function(t){var e=t.text,i=[...e.matchAll(/currency=["']([A-Za-z]+)["']/gi)],r=[...e.matchAll(/rate=["']([.0-9]+)["']/gi)],o=i.reduce(((t,e,i)=>Object.assign(Object.assign({},t),{[e[1]]:r[i][1]})),{});return o.EUR=1,o}}},coinconvert:{$options:{base:"https://api.coinconvert.net"},ticker:{path:"/v2/ticker",params:{v:{default:"2.1.7"},filterExchanges:{type:"array"},noAverage:{type:"boolean"}},on_success:t=>t.json},list:{path:"/v2/list?v=2.1.7",on_success:t=>t.json}}});e.default=c},866:function(t,e,i){var r=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(o,n){function s(t){try{l(r.next(t))}catch(t){n(t)}}function a(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const o=i(827);e.default=class{constructor(){this.ticker={},this.list=[],this.workers={},this.workersPromises=[]}ready(){return r(this,void 0,void 0,(function*(){return Promise.all(this.workersPromises)}))}addCurrency(t,e,i,n){return r(this,void 0,void 0,(function*(){if("string"!=typeof t||"string"!=typeof e||!o.initialCoinList.fiat.includes(e))throw new Error("Invalid currency pair.");if("function"!=typeof i)throw new Error("No function specified.");if(t=t.toUpperCase(),e=e.toUpperCase(),(this.ticker[t+e]||this.ticker[e+t]||-1!=this.list.indexOf(t))&&(console.warn("This custom currency already exists, it will be overriden."),this.removeCurrency(t)),this.list.push(t),n){if("number"!=typeof n)throw new Error("Invalid interval specfied.");this.workers[t+e]=setInterval((()=>Promise.resolve(i()).then((i=>{this.ticker[t+e]=Number(i)}))),n)}const r=Promise.resolve(i()).then((i=>{this.ticker[t+e]=Number(i)}));return this.workersPromises.push(r),r}))}removeCurrency(t,e){t=t.toUpperCase(),e=e?e.toUpperCase():"";for(const i in this.workers)i.includes(t+e)&&(clearInterval(this.workers[i]),delete this.ticker[i]);this.list=this.list.filter((e=>e!==t))}}},382:(t,e)=>{function i(t,e){if("number"!=typeof t&&(t=Number(t),isNaN(t)))return NaN;let i="number"==typeof e?t.toFixed(e):t+"",r=i.match(/\./)&&!i.match(/[eE]/)?i.replace(/0+$/g,"").replace(/\.+$/g,""):i;return parseFloat(r)}Object.defineProperty(e,"__esModule",{value:!0}),e.isBrowser=e.isValidUrl=e.isEmpty=e.formatNumber=e.getAverage=e.symbolMap=void 0,e.symbolMap=function t(e,i,r=!1){const o=Object.keys(i);for(var n=0;n<o.length;n++)if(e.length>=o[n].length+3&&(e.endsWith(o[n])||e.startsWith(o[n]))){const s=e.replace(o[n],i[o[n]]);return r?t(s,i,!1):s}return e},e.getAverage=function(t){return t.length?t.flatMap((t=>Object.keys(t))).filter(((t,e,i)=>i.indexOf(t)==e)).reduce(((e,r)=>{let o=t.map((t=>t[r])).filter((t=>t)),n=i(o.reduce(((t,e)=>t+e),0)/o.length,8);return e[r]=n,e}),{}):{}},e.formatNumber=i,e.isEmpty=function(t){if(!t)return!0;for(var e in t)return!1;return!0},e.isValidUrl=function(t){try{return/^https?\:\/\//.test(new URL(t).protocol)}catch(t){return!1}},e.isBrowser="undefined"!=typeof window&&window.document},607:function(module,exports,__webpack_require__){var __awaiter=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(o,n){function s(t){try{l(r.next(t))}catch(t){n(t)}}function a(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((r=r.apply(t,e||[])).next())}))},__classPrivateFieldGet=this&&this.__classPrivateFieldGet||function(t,e,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(t):r?r.value:e.get(t)},__importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},_CryptoConvert_instances,_CryptoConvert_getPrice,_CryptoConvert_wrapper,_CryptoConvert_isSafeKey,_CryptoConvert_setExtendedOptions,_CryptoConvert_populate;Object.defineProperty(exports,"__esModule",{value:!0});const helpers_1=__webpack_require__(382),worker_1=__importDefault(__webpack_require__(827)),custom_1=__importDefault(__webpack_require__(866)),customWorkers=new custom_1.default;class CryptoConvert{constructor(t={}){if(_CryptoConvert_instances.add(this),this.precision={fiat:4,crypto:8},helpers_1.isBrowser){if(window.__ccInitialized)throw new Error("You have already initalized one instance of crypto-convert. You cannot initialize multiple instances.");window.__ccInitialized=!0}__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_setExtendedOptions).call(this,t),this.worker=new worker_1.default(t),this.workerReady=this.worker.run(),this.internalMethods=Object.getOwnPropertyNames(CryptoConvert.prototype),Promise.resolve(this.workerReady).then((()=>{__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_populate).call(this),this.worker.onCryptoListRefresh=()=>{__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_populate).call(this)}}))}get isReady(){return this.worker.isReady}get list(){return{crypto:this.worker.list.crypto.concat(customWorkers.list),fiat:this.worker.list.fiat}}get cryptoInfo(){return this.worker.cryptoInfo}get lastUpdated(){return this.worker.data.crypto.last_updated}get ticker(){return this.worker.data}setOptions(t){if(__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_setExtendedOptions).call(this,t),(t.cryptoInterval||t.fiatInterval)&&(t.cryptoInterval!==this.worker.options.cryptoInterval||t.fiatInterval!==this.worker.options.fiatInterval)||t.hasOwnProperty("refreshCryptoList")&&t.refreshCryptoList!==this.worker.options.refreshCryptoList||t.hasOwnProperty("useHostedAPI")&&t.useHostedAPI!==this.worker.options.useHostedAPI||t.listLimit&&t.listLimit!=this.worker.options.listLimit){if(!this.worker.isReady)throw new Error("You cannot set these options here because CryptoConvert is not ready yet. Instead set the options on the constructor parameter.");return this.workerReady=Promise.resolve(this.worker.setOptions(t)).then((()=>__awaiter(this,void 0,void 0,(function*(){return yield this.worker.restart(),t.listLimit&&__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_populate).call(this),this.worker})))),this.worker}return this.worker.setOptions(t)}stop(){return this.worker.stop()}restart(){return this.workerReady=this.worker.restart(),this.workerReady}ready(){return __awaiter(this,void 0,void 0,(function*(){return yield Promise.resolve(this.workerReady),yield Promise.resolve(customWorkers.ready()),this}))}addCurrency(t,...e){return __awaiter(this,void 0,void 0,(function*(){if(this.hasOwnProperty(t))throw new Error("This property already exists.");return Promise.resolve(customWorkers.addCurrency.apply(customWorkers,[t,...e])).then((()=>{this.worker.isReady&&__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_populate).call(this)}))}))}removeCurrency(t,e){var i,r;if(customWorkers.list.includes(t)&&__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_isSafeKey).call(this,t)){delete this[t];const e=this.worker.list.crypto.concat(this.worker.list.fiat,customWorkers.list);for(const o of e)(null===(i=this[o])||void 0===i?void 0:i[t])&&(null===(r=this[o])||void 0===r||delete r[t])}return customWorkers.removeCurrency(t,e)}}_CryptoConvert_instances=new WeakSet,_CryptoConvert_getPrice=function(t,e="USD"){var i=customWorkers.ticker[t+e]||(customWorkers.ticker[e+t]?1/customWorkers.ticker[e+t]:null),r=this.worker.data.crypto.current[t+e]||(this.worker.data.crypto.current[e+t]?1/this.worker.data.crypto.current[e+t]:null);return i||r},_CryptoConvert_wrapper=function t(e,i){var r=i;return function(i){if((0,helpers_1.isEmpty)(this.worker.data.crypto.current)||(0,helpers_1.isEmpty)(this.worker.data.fiat.current))return console.warn("[~] Prices are loading.\nYou should use `await convert.ready()` to make sure prices are loaded before calling convert."),!1;if(!i)return!1;if(i=(0,helpers_1.formatNumber)(i),isNaN(i))return!1;const o=this.worker.data.fiat.current,n=this.worker.list.crypto.concat(customWorkers.list);if(r==e)return i;if(n.includes(e)&&n.includes(r)){let o=__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_getPrice).call(this,e,r)||__classPrivateFieldGet(this,_CryptoConvert_instances,"m",t).call(this,"USD",r)(__classPrivateFieldGet(this,_CryptoConvert_instances,"m",t).call(this,e,"USD")(1));return(0,helpers_1.formatNumber)(o*i,this.precision.crypto)}if(o[e]&&o[r])return(0,helpers_1.formatNumber)(i/o[e]*o[r],this.precision.fiat);var s=function(e){return __classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_getPrice).call(this,e)||__classPrivateFieldGet(this,_CryptoConvert_instances,"m",t).call(this,"BTC","USD")(__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_getPrice).call(this,e,"BTC"))||__classPrivateFieldGet(this,_CryptoConvert_instances,"m",t).call(this,"ETH","USD")(__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_getPrice).call(this,e,"ETH"))}.bind(this);if(o[r]){let t=s(e)/o.USD*o[r];return(0,helpers_1.formatNumber)(t*i,this.precision.crypto)}if(o[e]){let t=s(r)/o.USD*o[e];return(0,helpers_1.formatNumber)(i/t,this.precision.crypto)}return null}.bind(this)},_CryptoConvert_isSafeKey=function(t){return!this.internalMethods.includes(t)&&!t.startsWith("__")&&!function(){}[t]},_CryptoConvert_setExtendedOptions=function(t){if(t.precision)for(const e in t.precision)["crypto","fiat"].includes(e)&&"number"==typeof t.precision[e]&&(this.precision[e]=t.precision[e])},_CryptoConvert_populate=function _CryptoConvert_populate(){let types="";types+="type amount = (amount: number | string) => number | false | null;",types+="\nexport interface Pairs {";const all_currencies=this.worker.list.crypto.concat(this.worker.list.fiat,customWorkers.list),all_currencies_unique=all_currencies.filter(((t,e)=>all_currencies.indexOf(t)==e));for(var i=0;i<all_currencies_unique.length;i++){var coin=all_currencies_unique[i];if(coin&&"string"==typeof coin&&__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_isSafeKey).call(this,coin)){this[coin]||(this[coin]={}),types+=`\n\t'${coin.replace(/\'/g,"\\'")}': {`;for(var a=0;a<all_currencies_unique.length;a++){var currency=all_currencies_unique[a];currency&&"string"==typeof currency&&__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_isSafeKey).call(this,coin)&&(this[coin][currency]=__classPrivateFieldGet(this,_CryptoConvert_instances,"m",_CryptoConvert_wrapper).call(this,coin,currency),types+=`\n\t\t'${currency.replace(/\'/g,"\\'")}': amount,`)}types+="\n},"}}types+="\n}","undefined"==typeof window&&"undefined"!=typeof process&&function(){__awaiter(this,void 0,void 0,(function*(){try{eval("\n\t\t\t\t\t\tconst fs = require('fs');\n\t\t\t\t\t\tconst path = require('path');\n\t\t\t\t\t\tconst isDist = path.basename(__dirname) == 'dist';\n\t\t\t\t\t\tconst typesFile = path.join(__dirname, isDist ? 'paris.d.ts' : 'paris.ts');\n\n\t\t\t\t\t\tfs.writeFileSync(typesFile, types, 'utf-8');\n\t\t\t\t\t")}catch(t){console.warn(t)}}))}()},CryptoConvert.default=CryptoConvert,module.exports&&(module.exports=CryptoConvert),exports.default=CryptoConvert},827:function(t,e,i){var r=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(o,n){function s(t){try{l(r.next(t))}catch(t){n(t)}}function a(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((r=r.apply(t,e||[])).next())}))},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.initialCoinList=void 0;const n=o(i(203)),s=i(382);e.initialCoinList={crypto:["BTC","ETH","USDT","USDC","BNB","XRP","BUSD","ADA","SOL","DOGE","DOT","DAI","MATIC","SHIB","TRX","AVAX","UNI","WBTC","LEO","LTC","ETC","LINK","ATOM","FTT","XLM","NEAR","CRO","XMR","ALGO","BCH","LUNC","FLOW","QNT","VET","TON","FIL","APE","ICP","CHZ","HBAR","MANA","XTZ","SAND","EOS","EGLD","THETA","AAVE","AXS","OKB","USDP","BSV","KCS","TUSD","ZEC","MIOTA","XEC","USDD","MKR","BTT","HT","GRT","USDN","HNT","CAKE","NEO","KLAY","FTM","SNX","PAXG","RUNE","NEXO","LDO","CRV","GT","DASH","ENJ","BAT","COMP","STX","KAVA","RVN","ZIL","WAVES","FEI","MINA","RSR","XDC","LRC","GMT","DCR","TWT","CELO","XEM","BTG","KSM","HOT","1INCH","CEL","CVX","BNX","AR","GNO","LUNA","ROSE","ENS","USTC","GUSD","QTUM","YFI","ANKR","TFUEL","GALA","GLM","IOTX","KDA","BTRST","ONE","OMG","BAL","ZRX","LPT","POLY","JST","FLUX","ICX","BORA","IOST","HIVE","AMP","OP","KNC","XYM","SRM","ONT","WAXP","STORJ","MXC","CSPR","IMX","SC","ZEN","AUDIO","GLMR","SXP","XCH","ABBC","CHSB","VGX","UMA","WOO"],fiat:["USD","JPY","BGN","CZK","DKK","GBP","HUF","PLN","RON","SEK","CHF","ISK","NOK","HRK","RUB","TRY","AUD","BRL","CAD","CNY","HKD","IDR","ILS","INR","KRW","MXN","MYR","NZD","PHP","SGD","THB","ZAR","EUR"]},e.default=class{constructor(t){this.exchanges=["binance","bitfinex","coinbase","kraken"],this.list=e.initialCoinList,this.cryptoInfo=[{id:1,title:"Bitcoin",symbol:"BTC",rank:1},{id:1027,title:"Ethereum",symbol:"ETH",rank:2},{id:825,title:"Tether",symbol:"USDT",rank:3},{id:3408,title:"USD Coin",symbol:"USDC",rank:4},{id:1839,title:"BNB",symbol:"BNB",rank:5},{id:52,title:"XRP",symbol:"XRP",rank:6},{id:4687,title:"Binance USD",symbol:"BUSD",rank:7},{id:2010,title:"Cardano",symbol:"ADA",rank:8},{id:5426,title:"Solana",symbol:"SOL",rank:9},{id:74,title:"Dogecoin",symbol:"DOGE",rank:10},{id:6636,title:"Polkadot",symbol:"DOT",rank:11},{id:4943,title:"Dai",symbol:"DAI",rank:12},{id:3890,title:"Polygon",symbol:"MATIC",rank:13},{id:5994,title:"Shiba Inu",symbol:"SHIB",rank:14},{id:1958,title:"TRON",symbol:"TRX",rank:15},{id:5805,title:"Avalanche",symbol:"AVAX",rank:16},{id:7083,title:"Uniswap",symbol:"UNI",rank:17},{id:3717,title:"Wrapped Bitcoin",symbol:"WBTC",rank:18},{id:3957,title:"UNUS SED LEO",symbol:"LEO",rank:19},{id:2,title:"Litecoin",symbol:"LTC",rank:20},{id:1321,title:"Ethereum Classic",symbol:"ETC",rank:21},{id:1975,title:"Chainlink",symbol:"LINK",rank:22},{id:3794,title:"Cosmos",symbol:"ATOM",rank:23},{id:4195,title:"FTX Token",symbol:"FTT",rank:24},{id:512,title:"Stellar",symbol:"XLM",rank:25},{id:6535,title:"NEAR Protocol",symbol:"NEAR",rank:26},{id:3635,title:"Cronos",symbol:"CRO",rank:27},{id:328,title:"Monero",symbol:"XMR",rank:28},{id:4030,title:"Algorand",symbol:"ALGO",rank:29},{id:1831,title:"Bitcoin Cash",symbol:"BCH",rank:30},{id:4172,title:"Terra Classic",symbol:"LUNC",rank:31},{id:4558,title:"Flow",symbol:"FLOW",rank:32},{id:3155,title:"Quant",symbol:"QNT",rank:33},{id:3077,title:"VeChain",symbol:"VET",rank:34},{id:11419,title:"Toncoin",symbol:"TON",rank:35},{id:2280,title:"Filecoin",symbol:"FIL",rank:36},{id:18876,title:"ApeCoin",symbol:"APE",rank:37},{id:8916,title:"Internet Computer",symbol:"ICP",rank:38},{id:4066,title:"Chiliz",symbol:"CHZ",rank:39},{id:4642,title:"Hedera",symbol:"HBAR",rank:40},{id:1966,title:"Decentraland",symbol:"MANA",rank:41},{id:2011,title:"Tezos",symbol:"XTZ",rank:42},{id:6210,title:"The Sandbox",symbol:"SAND",rank:43},{id:1765,title:"EOS",symbol:"EOS",rank:44},{id:6892,title:"Elrond",symbol:"EGLD",rank:45},{id:2416,title:"Theta Network",symbol:"THETA",rank:46},{id:7278,title:"Aave",symbol:"AAVE",rank:47},{id:6783,title:"Axie Infinity",symbol:"AXS",rank:48},{id:3897,title:"OKB",symbol:"OKB",rank:49},{id:3330,title:"Pax Dollar",symbol:"USDP",rank:50},{id:3602,title:"Bitcoin SV",symbol:"BSV",rank:51},{id:2087,title:"KuCoin Token",symbol:"KCS",rank:52},{id:2563,title:"TrueUSD",symbol:"TUSD",rank:53},{id:1437,title:"Zcash",symbol:"ZEC",rank:54},{id:1720,title:"IOTA",symbol:"MIOTA",rank:55},{id:10791,title:"eCash",symbol:"XEC",rank:56},{id:19891,title:"USDD",symbol:"USDD",rank:57},{id:1518,title:"Maker",symbol:"MKR",rank:58},{id:16086,title:"BitTorrent-New",symbol:"BTT",rank:59},{id:2502,title:"Huobi Token",symbol:"HT",rank:60},{id:6719,title:"The Graph",symbol:"GRT",rank:61},{id:5068,title:"Neutrino USD",symbol:"USDN",rank:62},{id:5665,title:"Helium",symbol:"HNT",rank:63},{id:7186,title:"PancakeSwap",symbol:"CAKE",rank:64},{id:1376,title:"Neo",symbol:"NEO",rank:65},{id:4256,title:"Klaytn",symbol:"KLAY",rank:66},{id:3513,title:"Fantom",symbol:"FTM",rank:67},{id:2586,title:"Synthetix",symbol:"SNX",rank:68},{id:4705,title:"PAX Gold",symbol:"PAXG",rank:69},{id:4157,title:"THORChain",symbol:"RUNE",rank:70},{id:2694,title:"Nexo",symbol:"NEXO",rank:71},{id:8e3,title:"Lido DAO",symbol:"LDO",rank:72},{id:6538,title:"Curve DAO Token",symbol:"CRV",rank:73},{id:4269,title:"GateToken",symbol:"GT",rank:74},{id:131,title:"Dash",symbol:"DASH",rank:75},{id:2130,title:"Enjin Coin",symbol:"ENJ",rank:76},{id:1697,title:"Basic Attention Token",symbol:"BAT",rank:77},{id:5692,title:"Compound",symbol:"COMP",rank:78},{id:4847,title:"Stacks",symbol:"STX",rank:79},{id:4846,title:"Kava",symbol:"KAVA",rank:80},{id:2577,title:"Ravencoin",symbol:"RVN",rank:81},{id:2469,title:"Zilliqa",symbol:"ZIL",rank:82},{id:1274,title:"Waves",symbol:"WAVES",rank:83},{id:8642,title:"Fei USD",symbol:"FEI",rank:84},{id:8646,title:"Mina",symbol:"MINA",rank:85},{id:3964,title:"Reserve Rights",symbol:"RSR",rank:86},{id:2634,title:"XDC Network",symbol:"XDC",rank:87},{id:1934,title:"Loopring",symbol:"LRC",rank:88},{id:18069,title:"STEPN",symbol:"GMT",rank:89},{id:1168,title:"Decred",symbol:"DCR",rank:90},{id:5964,title:"Trust Wallet Token",symbol:"TWT",rank:91},{id:5567,title:"Celo",symbol:"CELO",rank:92},{id:873,title:"NEM",symbol:"XEM",rank:93},{id:2083,title:"Bitcoin Gold",symbol:"BTG",rank:94},{id:5034,title:"Kusama",symbol:"KSM",rank:95},{id:2682,title:"Holo",symbol:"HOT",rank:96},{id:8104,title:"1inch Network",symbol:"1INCH",rank:97},{id:2700,title:"Celsius",symbol:"CEL",rank:98},{id:9903,title:"Convex Finance",symbol:"CVX",rank:99},{id:9891,title:"BinaryX",symbol:"BNX",rank:100},{id:5632,title:"Arweave",symbol:"AR",rank:101},{id:1659,title:"Gnosis",symbol:"GNO",rank:102},{id:20314,title:"Terra",symbol:"LUNA",rank:103},{id:7653,title:"Oasis Network",symbol:"ROSE",rank:104},{id:13855,title:"Ethereum Name Service",symbol:"ENS",rank:105},{id:7129,title:"TerraClassicUSD",symbol:"USTC",rank:106},{id:3306,title:"Gemini Dollar",symbol:"GUSD",rank:107},{id:1684,title:"Qtum",symbol:"QTUM",rank:108},{id:5864,title:"yearn.finance",symbol:"YFI",rank:109},{id:3783,title:"Ankr",symbol:"ANKR",rank:110},{id:3822,title:"Theta Fuel",symbol:"TFUEL",rank:111},{id:7080,title:"Gala",symbol:"GALA",rank:112},{id:1455,title:"Golem",symbol:"GLM",rank:113},{id:2777,title:"IoTeX",symbol:"IOTX",rank:114},{id:5647,title:"Kadena",symbol:"KDA",rank:115},{id:11584,title:"Braintrust",symbol:"BTRST",rank:116},{id:3945,title:"Harmony",symbol:"ONE",rank:117},{id:1808,title:"OMG Network",symbol:"OMG",rank:118},{id:5728,title:"Balancer",symbol:"BAL",rank:119},{id:1896,title:"0x",symbol:"ZRX",rank:120},{id:3640,title:"Livepeer",symbol:"LPT",rank:121},{id:2496,title:"Polymath",symbol:"POLY",rank:122},{id:5488,title:"JUST",symbol:"JST",rank:123},{id:3029,title:"Flux",symbol:"FLUX",rank:124},{id:2099,title:"ICON",symbol:"ICX",rank:125},{id:3801,title:"BORA",symbol:"BORA",rank:126},{id:2405,title:"IOST",symbol:"IOST",rank:127},{id:5370,title:"Hive",symbol:"HIVE",rank:128},{id:6945,title:"Amp",symbol:"AMP",rank:129},{id:11840,title:"Optimism",symbol:"OP",rank:130},{id:9444,title:"Kyber Network Crystal v2",symbol:"KNC",rank:131},{id:8677,title:"Symbol",symbol:"XYM",rank:132},{id:6187,title:"Serum",symbol:"SRM",rank:133},{id:2566,title:"Ontology",symbol:"ONT",rank:134},{id:2300,title:"WAX",symbol:"WAXP",rank:135},{id:1772,title:"Storj",symbol:"STORJ",rank:136},{id:3628,title:"MXC",symbol:"MXC",rank:137},{id:5899,title:"Casper",symbol:"CSPR",rank:138},{id:10603,title:"Immutable X",symbol:"IMX",rank:139},{id:1042,title:"Siacoin",symbol:"SC",rank:140},{id:1698,title:"Horizen",symbol:"ZEN",rank:141},{id:7455,title:"Audius",symbol:"AUDIO",rank:142},{id:6836,title:"Moonbeam",symbol:"GLMR",rank:143},{id:4279,title:"SXP",symbol:"SXP",rank:144},{id:9258,title:"Chia",symbol:"XCH",rank:145},{id:3437,title:"ABBC Coin",symbol:"ABBC",rank:146},{id:2499,title:"SwissBorg",symbol:"CHSB",rank:147},{id:1817,title:"Voyager Token",symbol:"VGX",rank:148},{id:5617,title:"UMA",symbol:"UMA",rank:149},{id:7501,title:"WOO Network",symbol:"WOO",rank:150}].reduce(((t,e)=>(t[e.symbol]=Object.assign(Object.assign({},t),{logo:`https://s2.coinmarketcap.com/static/img/coins/128x128/${e.id}.png`}),t)),{}),this.data={crypto:{last_updated:null,current:null},fiat:{last_updated:null,current:null}},this.options=Object.assign({cryptoInterval:s.isBrowser?15e3:5e3,fiatInterval:36e5,calculateAverage:!0,onUpdate:void 0,serverHost:"https://api.coinconvert.net",useHostedAPI:!1,refreshCryptoList:!0,listLimit:150,disableExchangeMode:"saveLastCache"},this.exchanges.reduce(((t,e)=>Object.assign(Object.assign({},t),{[e]:!0})),{})),this.isReady=!1,this.isRunning=!1,t&&this.setOptions(t),this.hostedAPI||(this.hostedAPI=new n.default.coinconvert({$options:{base:this.options.serverHost}}))}log(...t){var e,i;!s.isBrowser&&(null===(i=null===(e=null===process||void 0===process?void 0:process.env)||void 0===e?void 0:e.NODE_ENV)||void 0===i?void 0:i.startsWith("dev"))&&Array.from(arguments).forEach((t=>{console.log(t)}))}setOptions(t){let e="function"==typeof t?t(Object.assign({},this.options)):t||{};s.isBrowser&&!isNaN(e.cryptoInterval)&&e.cryptoInterval<1e4&&console.error("The minimum allowed interval on frontend is 10s. You should host your own server API if you want to go lower.\n\t\t\t\n\t\t\tFor the server API routes see the CoinConvert schema on https://github.com/coinconvert/crypto-convert/blob/main/src/api.ts;\n\t\t\t");let i=!1,r=e.hasOwnProperty("calculateAverage")&&e.calculateAverage!==this.options.calculateAverage,o="saveAllCache"===e.disableExchangeMode&&"saveAllCache"!==this.options.disableExchangeMode;for(const t of this.exchanges)if(e.hasOwnProperty(t)&&e[t]!==this.options[t]){i=!0;break}if(e.hasOwnProperty("HTTPAgent")&&n.default.set({$options:{fetch_agent:e.HTTPAgent}}),e.serverHost&&(0,s.isValidUrl)(e.serverHost)&&(this.options.serverHost=e.serverHost,this.hostedAPI=new n.default.coinconvert({$options:{base:e.serverHost}})),this.options=Object.assign(Object.assign(Object.assign({},this.options),e),{cryptoInterval:isNaN(e.cryptoInterval)?this.options.cryptoInterval:Math.max(s.isBrowser&&!this.isCustomServerHost?1e4:1e3,e.cryptoInterval),fiatInterval:isNaN(e.fiatInterval)?this.options.fiatInterval:Math.max(18e5,e.fiatInterval),listLimit:isNaN(e.listLimit)?this.options.listLimit:Math.max(1,Math.min(1e3,parseInt(e.listLimit+"")))}),(i||r)&&this.isReady){if(s.isBrowser||this.options.useHostedAPI)return this.browserTicker();if("noCache"===this.options.disableExchangeMode||o)return this.updateCrypto();this.data.crypto.current=this.joinPrices(this.data)}return this}get isCustomServerHost(){return!/^https?:\/\/api\.coinconvert\.net/i.test(this.options.serverHost)}updateCrypto(){return r(this,void 0,void 0,(function*(){this.data.crypto.last_updated||this.log("Updating crypto...");const t=this.exchanges.reduce(((t,e)=>Object.assign(Object.assign({},t),{[e]:n.default[e].ticker})),{});let e=[],i={};for(const r in t)if(this.options[r]||"saveAllCache"===this.options.disableExchangeMode)try{this.data.crypto[r]=yield t[r](),this.options[r]&&(e.push(this.data.crypto[r]),i=Object.assign(Object.assign({},i),this.data.crypto[r]),this.data.crypto.last_updated=+new Date)}catch(t){this.data.crypto[r]=null,console.error(`Failed fetching prices from ${r}`,t)}return e.length&&(this.data.crypto.current=this.options.calculateAverage?Object.assign(Object.assign({},i),(0,s.getAverage)(e)):i,"function"==typeof this.options.onUpdate&&this.options.onUpdate(this.data.crypto)),this}))}updateFiat(){return r(this,void 0,void 0,(function*(){this.log("Updating fiat...");try{this.data.fiat.current=yield n.default.fiat.all(),this.data.fiat.last_updated=+new Date,"function"==typeof this.options.onUpdate&&this.options.onUpdate(this.data.fiat,!0)}catch(t){console.error("Failed fetching fiat prices from ECB",t)}return this}))}updateLists(){return r(this,void 0,void 0,(function*(){this.data.crypto.last_updated||this.log("Updating top currency list...");try{const t=yield n.default.coinmarketcap.top({limit:this.options.listLimit+""});this.list.crypto=Object.keys(t),this.cryptoInfo=t,"function"==typeof this.onCryptoListRefresh&&this.isReady&&this.onCryptoListRefresh(this.list.crypto)}catch(t){console.error("Failed fetching fiat prices from ECB",t)}return this}))}joinPrices(t){const e=this.exchanges.reduce(((e,i)=>Object.assign(Object.assign({},e),{[i]:t.crypto[i]})),{});let i=[],r={};for(const t in e)this.options[t]&&e[t]&&(i.push(e[t]),r=Object.assign(Object.assign({},r),e[t]));return this.options.calculateAverage?Object.assign(Object.assign({},r),(0,s.getAverage)(i)):r}browserTicker(){return r(this,void 0,void 0,(function*(){try{const t=this.options,e=this.exchanges.filter((e=>!t[e])),i=yield this.hostedAPI.ticker(e.length?{filterExchanges:e,noAverage:!this.options.calculateAverage||void 0}:{});this.data=i,"function"==typeof this.options.onUpdate&&this.options.onUpdate(this.data)}catch(t){console.error("Failed fetching prices from API",t)}return this}))}browserLists(){return r(this,void 0,void 0,(function*(){try{const t=yield this.hostedAPI.list();this.list.crypto=Object.keys(t.crypto),this.list.fiat=t.fiat,this.cryptoInfo=t.crypto,"function"==typeof this.onCryptoListRefresh&&this.isReady&&this.onCryptoListRefresh(this.list.crypto)}catch(t){console.error("Failed fetching currencies list from API",t)}return this}))}runBrowser(){return r(this,void 0,void 0,(function*(){if("undefined"!=typeof window&&window.__ccRunning)throw new Error("The crypto-convert worker seems to be already running. \n\t\t\t- There might be an issue with the way your app imports javascript dependencies. \n\t\t\t- Make sure to call 'convert.stop()' on component unmounts if you are using SPA frameworks (e.g React).");if(!this.isReady){if(yield this.browserTicker(),yield this.browserLists(),!this.isRunning)return!1;!s.isBrowser&&this.options.useHostedAPI&&this.options.refreshCryptoList&&(this.lists_worker=setInterval(this.browserLists.bind(this),86400))}return this.crypto_worker=setInterval(this.browserTicker.bind(this),this.options.cryptoInterval),this.isReady=!0,"undefined"!=typeof window&&(window.__ccRunning=!0,window.__ccRunID&&clearInterval(window.__ccRunID),window.__ccRunID=this.crypto_worker),this}))}runServer(){return r(this,void 0,void 0,(function*(){return yield this.updateLists(),yield this.updateFiat(),yield this.updateCrypto(),!!this.isRunning&&(this.isReady=!0,this.crypto_worker=setInterval(this.updateCrypto.bind(this),this.options.cryptoInterval),this.fiat_worker=setInterval(this.updateFiat.bind(this),this.options.fiatInterval),this.options.refreshCryptoList&&(this.lists_worker=setInterval(this.updateLists.bind(this),86400)),this)}))}run(){if(this.isRunning||this.crypto_worker)throw new Error("Crypto-convert is already running.");return this.isRunning=!0,s.isBrowser||this.options.useHostedAPI?this.runBrowser():this.runServer()}stop(){return this.isRunning=!1,clearInterval(this.crypto_worker),clearInterval(this.fiat_worker),this.crypto_worker=null,this.fiat_worker=null,this.lists_worker&&(clearInterval(this.lists_worker),this.lists_worker=null),"undefined"!=typeof window&&(window.__ccRunning=!1),this}restart(){return this.stop().run()}}},88:t=>{t.exports=__WEBPACK_EXTERNAL_MODULE__88__},265:t=>{t.exports=__WEBPACK_EXTERNAL_MODULE__265__}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var i=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(i.exports,i,i.exports,__webpack_require__),i.exports}var __webpack_exports__=__webpack_require__(607);return __webpack_exports__})()));

@@ -236,3 +236,3 @@ "use strict";

v: {
default: '2.1.6'
default: '2.1.7'
},

@@ -249,3 +249,3 @@ filterExchanges: {

list: {
path: "/v2/list?v=2.1.6",
path: "/v2/list?v=2.1.7",
on_success: (response) => (response.json)

@@ -252,0 +252,0 @@ }

@@ -257,4 +257,5 @@ "use strict";

const all_currencies = this.worker.list.crypto.concat(this.worker.list.fiat, customWorkers.list);
for (var i = 0; i < all_currencies.length; i++) {
var coin = all_currencies[i];
const all_currencies_unique = all_currencies.filter((v, i) => all_currencies.indexOf(v) == i);
for (var i = 0; i < all_currencies_unique.length; i++) {
var coin = all_currencies_unique[i];
if (!coin || typeof coin !== "string" || !__classPrivateFieldGet(this, _CryptoConvert_instances, "m", _CryptoConvert_isSafeKey).call(this, coin)) {

@@ -267,4 +268,4 @@ continue;

types += `\n\t'${coin.replace(/\'/g, "\\'")}': {`;
for (var a = 0; a < all_currencies.length; a++) {
var currency = all_currencies[a];
for (var a = 0; a < all_currencies_unique.length; a++) {
var currency = all_currencies_unique[a];
if (!currency || typeof currency !== "string" || !__classPrivateFieldGet(this, _CryptoConvert_instances, "m", _CryptoConvert_isSafeKey).call(this, coin)) {

@@ -271,0 +272,0 @@ continue;

{
"name": "crypto-convert",
"version": "2.1.6",
"version": "2.1.7",
"description": "Convert crypto to fiat and vice-versa instantly.",

@@ -47,3 +47,6 @@ "main": "dist/index.js",

"webpack-cli": "^4.5.0"
},
"engines": {
"node": ">=18.0.0"
}
}

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc