UNPKG

tradingraph

Version:

Based on rpiontik chart https://github.com/rpiontik/crypto-chart

1 lines 32.7 kB
(function(t){var n={};function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var i in t)e.d(r,i,function(n){return t[n]}.bind(null,i));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s="da2a")})({"01f9":function(t,n,e){"use strict";var r=e("2d00"),i=e("5ca1"),a=e("2aba"),o=e("32e9"),c=e("84f2"),u=e("41a0"),s=e("7f20"),f=e("38fd"),l=e("2b4c")("iterator"),h=!([].keys&&"next"in[].keys()),d="@@iterator",p="keys",v="values",g=function(){return this};t.exports=function(t,n,e,y,b,m,w){u(e,n,y);var x,P,S,E=function(t){if(!h&&t in L)return L[t];switch(t){case p:return function(){return new e(this,t)};case v:return function(){return new e(this,t)}}return function(){return new e(this,t)}},O=n+" Iterator",A=b==v,_=!1,L=t.prototype,k=L[l]||L[d]||b&&L[b],M=k||E(b),T=b?A?E("entries"):M:void 0,j="Array"==n&&L.entries||k;if(j&&(S=f(j.call(new t)),S!==Object.prototype&&S.next&&(s(S,O,!0),r||"function"==typeof S[l]||o(S,l,g))),A&&k&&k.name!==v&&(_=!0,M=function(){return k.call(this)}),r&&!w||!h&&!_&&L[l]||o(L,l,M),c[n]=M,c[O]=g,b)if(x={values:A?M:E(v),keys:m?M:E(p),entries:T},w)for(P in x)P in L||a(L,P,x[P]);else i(i.P+i.F*(h||_),n,x);return x}},"09fa":function(t,n,e){var r=e("4588"),i=e("9def");t.exports=function(t){if(void 0===t)return 0;var n=r(t),e=i(n);if(n!==e)throw RangeError("Wrong length!");return e}},"0a49":function(t,n,e){var r=e("9b43"),i=e("626a"),a=e("4bf8"),o=e("9def"),c=e("cd1c");t.exports=function(t,n){var e=1==t,u=2==t,s=3==t,f=4==t,l=6==t,h=5==t||l,d=n||c;return function(n,c,p){for(var v,g,y=a(n),b=i(y),m=r(c,p,3),w=o(b.length),x=0,P=e?d(n,w):u?d(n,0):void 0;w>x;x++)if((h||x in b)&&(v=b[x],g=m(v,x,y),t))if(e)P[x]=g;else if(g)switch(t){case 3:return!0;case 5:return v;case 6:return x;case 2:P.push(v)}else if(f)return!1;return l?-1:s||f?f:P}}},"0d58":function(t,n,e){var r=e("ce10"),i=e("e11e");t.exports=Object.keys||function(t){return r(t,i)}},"0f88":function(t,n,e){var r,i=e("7726"),a=e("32e9"),o=e("ca5a"),c=o("typed_array"),u=o("view"),s=!(!i.ArrayBuffer||!i.DataView),f=s,l=0,h=9,d="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");while(l<h)(r=i[d[l++]])?(a(r.prototype,c,!0),a(r.prototype,u,!0)):f=!1;t.exports={ABV:s,CONSTR:f,TYPED:c,VIEW:u}},1169:function(t,n,e){var r=e("2d95");t.exports=Array.isArray||function(t){return"Array"==r(t)}},"11e9":function(t,n,e){var r=e("52a7"),i=e("4630"),a=e("6821"),o=e("6a99"),c=e("69a8"),u=e("c69a"),s=Object.getOwnPropertyDescriptor;n.f=e("9e1e")?s:function(t,n){if(t=a(t),n=o(n,!0),u)try{return s(t,n)}catch(t){}if(c(t,n))return i(!r.f.call(t,n),t[n])}},1495:function(t,n,e){var r=e("86cc"),i=e("cb7c"),a=e("0d58");t.exports=e("9e1e")?Object.defineProperties:function(t,n){i(t);var e,o=a(n),c=o.length,u=0;while(c>u)r.f(t,e=o[u++],n[e]);return t}},"230e":function(t,n,e){var r=e("d3f4"),i=e("7726").document,a=r(i)&&r(i.createElement);t.exports=function(t){return a?i.createElement(t):{}}},"23c6":function(t,n,e){var r=e("2d95"),i=e("2b4c")("toStringTag"),a="Arguments"==r(function(){return arguments}()),o=function(t,n){try{return t[n]}catch(t){}};t.exports=function(t){var n,e,c;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(e=o(n=Object(t),i))?e:a?r(n):"Object"==(c=r(n))&&"function"==typeof n.callee?"Arguments":c}},2621:function(t,n){n.f=Object.getOwnPropertySymbols},"27ee":function(t,n,e){var r=e("23c6"),i=e("2b4c")("iterator"),a=e("84f2");t.exports=e("8378").getIteratorMethod=function(t){if(void 0!=t)return t[i]||t["@@iterator"]||a[r(t)]}},"2aba":function(t,n,e){var r=e("7726"),i=e("32e9"),a=e("69a8"),o=e("ca5a")("src"),c="toString",u=Function[c],s=(""+u).split(c);e("8378").inspectSource=function(t){return u.call(t)},(t.exports=function(t,n,e,c){var u="function"==typeof e;u&&(a(e,"name")||i(e,"name",n)),t[n]!==e&&(u&&(a(e,o)||i(e,o,t[n]?""+t[n]:s.join(String(n)))),t===r?t[n]=e:c?t[n]?t[n]=e:i(t,n,e):(delete t[n],i(t,n,e)))})(Function.prototype,c,function(){return"function"==typeof this&&this[o]||u.call(this)})},"2aeb":function(t,n,e){var r=e("cb7c"),i=e("1495"),a=e("e11e"),o=e("613b")("IE_PROTO"),c=function(){},u="prototype",s=function(){var t,n=e("230e")("iframe"),r=a.length,i="<",o=">";n.style.display="none",e("fab2").appendChild(n),n.src="javascript:",t=n.contentWindow.document,t.open(),t.write(i+"script"+o+"document.F=Object"+i+"/script"+o),t.close(),s=t.F;while(r--)delete s[u][a[r]];return s()};t.exports=Object.create||function(t,n){var e;return null!==t?(c[u]=r(t),e=new c,c[u]=null,e[o]=t):e=s(),void 0===n?e:i(e,n)}},"2b4c":function(t,n,e){var r=e("5537")("wks"),i=e("ca5a"),a=e("7726").Symbol,o="function"==typeof a,c=t.exports=function(t){return r[t]||(r[t]=o&&a[t]||(o?a:i)("Symbol."+t))};c.store=r},"2d00":function(t,n){t.exports=!1},"2d95":function(t,n){var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},"2f21":function(t,n,e){"use strict";var r=e("79e5");t.exports=function(t,n){return!!t&&r(function(){n?t.call(null,function(){},1):t.call(null)})}},"32e9":function(t,n,e){var r=e("86cc"),i=e("4630");t.exports=e("9e1e")?function(t,n,e){return r.f(t,n,i(1,e))}:function(t,n,e){return t[n]=e,t}},"33a4":function(t,n,e){var r=e("84f2"),i=e("2b4c")("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||a[i]===t)}},"36bd":function(t,n,e){"use strict";var r=e("4bf8"),i=e("77f1"),a=e("9def");t.exports=function(t){var n=r(this),e=a(n.length),o=arguments.length,c=i(o>1?arguments[1]:void 0,e),u=o>2?arguments[2]:void 0,s=void 0===u?e:i(u,e);while(s>c)n[c++]=t;return n}},"38fd":function(t,n,e){var r=e("69a8"),i=e("4bf8"),a=e("613b")("IE_PROTO"),o=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=i(t),r(t,a)?t[a]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?o:null}},"41a0":function(t,n,e){"use strict";var r=e("2aeb"),i=e("4630"),a=e("7f20"),o={};e("32e9")(o,e("2b4c")("iterator"),function(){return this}),t.exports=function(t,n,e){t.prototype=r(o,{next:i(1,e)}),a(t,n+" Iterator")}},"456d":function(t,n,e){var r=e("4bf8"),i=e("0d58");e("5eda")("keys",function(){return function(t){return i(r(t))}})},4588:function(t,n){var e=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:e)(t)}},4630:function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},"4bf8":function(t,n,e){var r=e("be13");t.exports=function(t){return Object(r(t))}},"52a7":function(t,n){n.f={}.propertyIsEnumerable},5537:function(t,n,e){var r=e("8378"),i=e("7726"),a="__core-js_shared__",o=i[a]||(i[a]={});(t.exports=function(t,n){return o[t]||(o[t]=void 0!==n?n:{})})("versions",[]).push({version:r.version,mode:e("2d00")?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},"55dd":function(t,n,e){"use strict";var r=e("5ca1"),i=e("d8e8"),a=e("4bf8"),o=e("79e5"),c=[].sort,u=[1,2,3];r(r.P+r.F*(o(function(){u.sort(void 0)})||!o(function(){u.sort(null)})||!e("2f21")(c)),"Array",{sort:function(t){return void 0===t?c.call(a(this)):c.call(a(this),i(t))}})},"5ca1":function(t,n,e){var r=e("7726"),i=e("8378"),a=e("32e9"),o=e("2aba"),c=e("9b43"),u="prototype",s=function(t,n,e){var f,l,h,d,p=t&s.F,v=t&s.G,g=t&s.S,y=t&s.P,b=t&s.B,m=v?r:g?r[n]||(r[n]={}):(r[n]||{})[u],w=v?i:i[n]||(i[n]={}),x=w[u]||(w[u]={});for(f in v&&(e=n),e)l=!p&&m&&void 0!==m[f],h=(l?m:e)[f],d=b&&l?c(h,r):y&&"function"==typeof h?c(Function.call,h):h,m&&o(m,f,h,t&s.U),w[f]!=h&&a(w,f,d),y&&x[f]!=h&&(x[f]=h)};r.core=i,s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,t.exports=s},"5cc5":function(t,n,e){var r=e("2b4c")("iterator"),i=!1;try{var a=[7][r]();a["return"]=function(){i=!0},Array.from(a,function(){throw 2})}catch(t){}t.exports=function(t,n){if(!n&&!i)return!1;var e=!1;try{var a=[7],o=a[r]();o.next=function(){return{done:e=!0}},a[r]=function(){return o},t(a)}catch(t){}return e}},"5eda":function(t,n,e){var r=e("5ca1"),i=e("8378"),a=e("79e5");t.exports=function(t,n){var e=(i.Object||{})[t]||Object[t],o={};o[t]=n(e),r(r.S+r.F*a(function(){e(1)}),"Object",o)}},"613b":function(t,n,e){var r=e("5537")("keys"),i=e("ca5a");t.exports=function(t){return r[t]||(r[t]=i(t))}},"626a":function(t,n,e){var r=e("2d95");t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},"63d9":function(t,n,e){e("ec30")("Float32",4,function(t){return function(n,e,r){return t(this,n,e,r)}})},6821:function(t,n,e){var r=e("626a"),i=e("be13");t.exports=function(t){return r(i(t))}},"69a8":function(t,n){var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},"6a99":function(t,n,e){var r=e("d3f4");t.exports=function(t,n){if(!r(t))return t;var e,i;if(n&&"function"==typeof(e=t.toString)&&!r(i=e.call(t)))return i;if("function"==typeof(e=t.valueOf)&&!r(i=e.call(t)))return i;if(!n&&"function"==typeof(e=t.toString)&&!r(i=e.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},7333:function(t,n,e){"use strict";var r=e("0d58"),i=e("2621"),a=e("52a7"),o=e("4bf8"),c=e("626a"),u=Object.assign;t.exports=!u||e("79e5")(function(){var t={},n={},e=Symbol(),r="abcdefghijklmnopqrst";return t[e]=7,r.split("").forEach(function(t){n[t]=t}),7!=u({},t)[e]||Object.keys(u({},n)).join("")!=r})?function(t,n){var e=o(t),u=arguments.length,s=1,f=i.f,l=a.f;while(u>s){var h,d=c(arguments[s++]),p=f?r(d).concat(f(d)):r(d),v=p.length,g=0;while(v>g)l.call(d,h=p[g++])&&(e[h]=d[h])}return e}:u},7726:function(t,n){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},"77f1":function(t,n,e){var r=e("4588"),i=Math.max,a=Math.min;t.exports=function(t,n){return t=r(t),t<0?i(t+n,0):a(t,n)}},"79e5":function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},"7a56":function(t,n,e){"use strict";var r=e("7726"),i=e("86cc"),a=e("9e1e"),o=e("2b4c")("species");t.exports=function(t){var n=r[t];a&&n&&!n[o]&&i.f(n,o,{configurable:!0,get:function(){return this}})}},"7f20":function(t,n,e){var r=e("86cc").f,i=e("69a8"),a=e("2b4c")("toStringTag");t.exports=function(t,n,e){t&&!i(t=e?t:t.prototype,a)&&r(t,a,{configurable:!0,value:n})}},8378:function(t,n){var e=t.exports={version:"2.5.7"};"number"==typeof __e&&(__e=e)},"84f2":function(t,n){t.exports={}},"86cc":function(t,n,e){var r=e("cb7c"),i=e("c69a"),a=e("6a99"),o=Object.defineProperty;n.f=e("9e1e")?Object.defineProperty:function(t,n,e){if(r(t),n=a(n,!0),r(e),i)try{return o(t,n,e)}catch(t){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(t[n]=e.value),t}},9093:function(t,n,e){var r=e("ce10"),i=e("e11e").concat("length","prototype");n.f=Object.getOwnPropertyNames||function(t){return r(t,i)}},"9b43":function(t,n,e){var r=e("d8e8");t.exports=function(t,n,e){if(r(t),void 0===n)return t;switch(e){case 1:return function(e){return t.call(n,e)};case 2:return function(e,r){return t.call(n,e,r)};case 3:return function(e,r,i){return t.call(n,e,r,i)}}return function(){return t.apply(n,arguments)}}},"9c29":function(t,n,e){e("ec30")("Uint32",4,function(t){return function(n,e,r){return t(this,n,e,r)}})},"9c6c":function(t,n,e){var r=e("2b4c")("unscopables"),i=Array.prototype;void 0==i[r]&&e("32e9")(i,r,{}),t.exports=function(t){i[r][t]=!0}},"9def":function(t,n,e){var r=e("4588"),i=Math.min;t.exports=function(t){return t>0?i(r(t),9007199254740991):0}},"9e1e":function(t,n,e){t.exports=!e("79e5")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},ac6a:function(t,n,e){for(var r=e("cadf"),i=e("0d58"),a=e("2aba"),o=e("7726"),c=e("32e9"),u=e("84f2"),s=e("2b4c"),f=s("iterator"),l=s("toStringTag"),h=u.Array,d={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},p=i(d),v=0;v<p.length;v++){var g,y=p[v],b=d[y],m=o[y],w=m&&m.prototype;if(w&&(w[f]||c(w,f,h),w[l]||c(w,l,y),u[y]=h,b))for(g in r)w[g]||a(w,g,r[g],!0)}},ba92:function(t,n,e){"use strict";var r=e("4bf8"),i=e("77f1"),a=e("9def");t.exports=[].copyWithin||function(t,n){var e=r(this),o=a(e.length),c=i(t,o),u=i(n,o),s=arguments.length>2?arguments[2]:void 0,f=Math.min((void 0===s?o:i(s,o))-u,o-c),l=1;u<c&&c<u+f&&(l=-1,u+=f-1,c+=f-1);while(f-- >0)u in e?e[c]=e[u]:delete e[c],c+=l,u+=l;return e}},be13:function(t,n){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},c366:function(t,n,e){var r=e("6821"),i=e("9def"),a=e("77f1");t.exports=function(t){return function(n,e,o){var c,u=r(n),s=i(u.length),f=a(o,s);if(t&&e!=e){while(s>f)if(c=u[f++],c!=c)return!0}else for(;s>f;f++)if((t||f in u)&&u[f]===e)return t||f||0;return!t&&-1}}},c69a:function(t,n,e){t.exports=!e("9e1e")&&!e("79e5")(function(){return 7!=Object.defineProperty(e("230e")("div"),"a",{get:function(){return 7}}).a})},ca5a:function(t,n){var e=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+r).toString(36))}},cadf:function(t,n,e){"use strict";var r=e("9c6c"),i=e("d53b"),a=e("84f2"),o=e("6821");t.exports=e("01f9")(Array,"Array",function(t,n){this._t=o(t),this._i=0,this._k=n},function(){var t=this._t,n=this._k,e=this._i++;return!t||e>=t.length?(this._t=void 0,i(1)):i(0,"keys"==n?e:"values"==n?t[e]:[e,t[e]])},"values"),a.Arguments=a.Array,r("keys"),r("values"),r("entries")},cb7c:function(t,n,e){var r=e("d3f4");t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},cd1c:function(t,n,e){var r=e("e853");t.exports=function(t,n){return new(r(t))(n)}},ce10:function(t,n,e){var r=e("69a8"),i=e("6821"),a=e("c366")(!1),o=e("613b")("IE_PROTO");t.exports=function(t,n){var e,c=i(t),u=0,s=[];for(e in c)e!=o&&r(c,e)&&s.push(e);while(n.length>u)r(c,e=n[u++])&&(~a(s,e)||s.push(e));return s}},d3f4:function(t,n){t.exports=function(t){return"object"===typeof t?null!==t:"function"===typeof t}},d53b:function(t,n){t.exports=function(t,n){return{value:n,done:!!t}}},d8e8:function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},da2a:function(t,n,e){"use strict";e.r(n);e("ac6a"),e("456d"),e("55dd"),e("f751"),e("63d9"),e("9c29");function r(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function i(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,n,e){return n&&i(t.prototype,n),e&&i(t,e),t}var o=10,c=.3,u=function(){function t(){r(this,t),this.data={treeReady:!1,rawBinary:[],rawParsed:[],rawAverageBinary:[],rawAverageParsed:[],firstEntry:0,lastResolution:0,start:null,width:null,tree:[]},this.params={empty:!1,candleWidths:[],defaultExposition:30,fileSizes:{},resolutions:[],packetSize:0,dataRequestPending:!1,isInitialLoading:!1},this.requestInitialParams()}return a(t,[{key:"requestInitialParams",value:function(){this.sendMessage("REQUEST_PARAMS",{inner:["candleWidths"],outer:["fileSizes","resolutions","packetSize"]})}},{key:"initialLoading",value:function(t){var n=this.params.fileSizes[t],e=this.rebaseExposition(n,n),r=this.rebaseOffset(n-e,n);this.params.dataRequestPending=!0,this.params.isInitialLoading=!0,this.sendMessage("REQUEST_DATA",{offset:r,end:n-1,resolution:t})}},{key:"rebaseOffset",value:function(t,n){return t<0?0:t>n-1?n-1:t}},{key:"rebaseExposition",value:function(t,n){return t>n?n:t}},{key:"append",value:function(t){this.data.treeReady=!1,this.params.dataRequestPending=!1,this.appendedData=["candleData"],this.data.rawBinary=t,this.data.rawParsed=this.parseChartData(this.data.rawBinary),!0===this.params.isInitialLoading&&(this.appendedData.push("averageData"),this.data.averageBinary=t,this.data.averageParsed=this.data.rawParsed.slice(),this.params.isInitialLoading=!1),this.makeTree(),this.sendMessage("APPENDED",{type:this.appendedData})}},{key:"parseEntity",value:function(t){return{timestamp:new Uint32Array(t,0,1)[0],volume:new Float32Array(t,4,1)[0],open:new Float32Array(t,8,1)[0],high:new Float32Array(t,12,1)[0],low:new Float32Array(t,16,1)[0],close:new Float32Array(t,20,1)[0],average:new Float32Array(t,24,1)[0]}}},{key:"parseChartData",value:function(t){for(var n=[],e=0,r=0;e<t.byteLength;e+=this.params.packetSize,r++)n[r]=this.parseEntity(t.slice(e,e+this.params.packetSize));return n}},{key:"makeTree",value:function(){var t=this;this.data.rawParsed.length>0&&(this.data.start=this.data.rawParsed[0].timestamp,this.data.end=this.data.rawParsed[this.data.rawParsed.length-1].timestamp,this.params.candleWidths.map(function(n){t.data.tree[n]=[];var e=null;t.data.rawParsed.map(function(r){var i=r.timestamp-r.timestamp%n;e&&i===e.id?(e.low=r.low<e.low?r.low:e.low,e.high=r.high>e.high?r.high:e.high,e.close=r.close,e.volume+=r.volume):(e&&t.data.tree[n].push(e),e={id:i,timestamp:r.timestamp,open:r.open,low:r.low,high:r.high,close:r.close,volume:r.volume})}),e&&t.data.tree[n].push(e)}),this.data.treeReady=!0)}},{key:"findCandleWidthForUse",value:function(t,n){var e=n/o,r=null,i=0;return this.params.candleWidths.map(function(n){if(r){var a=Math.abs(Math.round(e-t/n));a<i&&(i=a,r=n)}else r=n,i=Math.abs(Math.round(e-t/n))}),r}},{key:"renderCandles",value:function(t,n,e,r){this.data.treeReady||this.makeTree();var i={low:null,high:null,maxVolume:null,width:null,candles:[],candlesPositivePath:[],candlesNegativePath:[],volumePath:[]},a=this.findCandleWidthForUse(n,e),o=this.data.tree[a],u=e/n;i.width=a*u;var s=0;if(o&&this.data.lastResolution===a){var f=o.length;t>this.data.start&&(s=-Math.floor((t-this.data.start)/a));for(var l=-s;l<f;l++){var h=o[l];if(!(h.timestamp<=t)){if(h.timestamp>t+n){f=l;break}s<0&&(s=l),(null==i.low||i.low>h.low)&&(i.low=h.low),(null==i.high||i.high<h.high)&&(i.high=h.high),(null==i.maxVolume||i.maxVolume<h.volume)&&(i.maxVolume=h.volume)}}s=Math.abs(s),null==f&&(f=o.length);for(var d=r/(i.high-i.low),p=r*c/i.maxVolume,v=a*u*.25,g=s;g<f;g++){var y=o[g],b=(y.timestamp-t)*u,m="M".concat(b," ").concat((i.high-y.low)*d," L").concat(b," ").concat((i.high-y.high)*d," "),w="M".concat(b-v," ").concat((i.high-y.close)*d," L").concat(b+v," ").concat((i.high-y.close)*d," ")+"L".concat(b+v," ").concat((i.high-y.open)*d," L").concat(b-v," ").concat((i.high-y.open)*d," "),x=Object.assign({},y);y.open<=y.close?(x.class="positive",x.candlePathIndex=i.candlesPositivePath.push(m+w)-1):(x.class="negative",x.candlePathIndex=i.candlesNegativePath.push(m+w)-1),x.volumePathIndex=i.volumePath.push("M".concat(b-v," ").concat(r-y.volume*p," L").concat(b+v," ").concat(r-y.volume*p," ")+"L".concat(b+v," ").concat(r," L").concat(b-v," ").concat(r," "))-1,x.x=b,i.candles.push(x)}}else this.params.dataRequestPending||(this.params.dataRequestPending=!0,this.sendMessage("NEED_DATA",{offset:t,exposition:this.params.defaultExposition,resolution:a}));this.data.start>0&&this.data.start<=t||!this.params.dataRequestPending&&t>this.params.firstTimestamp&&(this.params.dataRequestPending=!0,this.sendMessage("NEED_DATA",{offset:t,exposition:this.params.defaultExposition,resolution:a})),this.data.lastResolution=a,this.sendMessage("RENDERED",i)}},{key:"renderAverage",value:function(t,n){var e=this.data.averageParsed.length;if(e){var r=t/e,i={minTimestamp:this.data.averageParsed[0].timestamp,maxTimestamp:this.data.averageParsed[e-1].timestamp,path:[]},a=this.data.averageParsed.slice().sort(function(t,n){return t.average-n.average}),o=a[e-1].average,c=a[0].average,u=n/(o-c);i.path.push("M6 ".concat(u*(o-this.data.averageParsed[0].average)));for(var s=1;s<e;s++)i.path.push("L".concat(r*s," ").concat(u*(o-this.data.averageParsed[s].average)));this.sendMessage("RENDERED",{data:i,type:"average"})}}},{key:"setParams",value:function(t){var n=this;Object.keys(t).map(function(e){n.params[e]=t[e]}),this.data.treeReady=!1}},{key:"messageHandler",value:function(t){switch(t.data.task){case"SET_PARAMS":this.setParams(t.data.params),Object.keys(this.params.fileSizes).length>0&&this.params.resolutions.length>0&&this.params.fileSizes[this.params.resolutions[this.params.resolutions.length-1]]>0&&this.params.packetSize&&!this.params.dataRequestPending&&!this.params.initialLoading&&this.initialLoading(this.params.resolutions[this.params.resolutions.length-1]);break;case"APPEND":this.append(t.data.data);break;case"RENDER":switch(t.data.params.type){case"average":this.renderAverage(t.data.params.params.viewWidth,t.data.params.params.viewHeight);break;default:break}default:break}}},{key:"sendMessage",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;postMessage({type:t,body:n})}}]),t}(),s=new u;onmessage=function(t){s.messageHandler(t)}},dcbc:function(t,n,e){var r=e("2aba");t.exports=function(t,n,e){for(var i in n)r(t,i,n[i],e);return t}},e11e:function(t,n){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},e853:function(t,n,e){var r=e("d3f4"),i=e("1169"),a=e("2b4c")("species");t.exports=function(t){var n;return i(t)&&(n=t.constructor,"function"!=typeof n||n!==Array&&!i(n.prototype)||(n=void 0),r(n)&&(n=n[a],null===n&&(n=void 0))),void 0===n?Array:n}},ebd6:function(t,n,e){var r=e("cb7c"),i=e("d8e8"),a=e("2b4c")("species");t.exports=function(t,n){var e,o=r(t).constructor;return void 0===o||void 0==(e=r(o)[a])?n:i(e)}},ec30:function(t,n,e){"use strict";if(e("9e1e")){var r=e("2d00"),i=e("7726"),a=e("79e5"),o=e("5ca1"),c=e("0f88"),u=e("ed0b"),s=e("9b43"),f=e("f605"),l=e("4630"),h=e("32e9"),d=e("dcbc"),p=e("4588"),v=e("9def"),g=e("09fa"),y=e("77f1"),b=e("6a99"),m=e("69a8"),w=e("23c6"),x=e("d3f4"),P=e("4bf8"),S=e("33a4"),E=e("2aeb"),O=e("38fd"),A=e("9093").f,_=e("27ee"),L=e("ca5a"),k=e("2b4c"),M=e("0a49"),T=e("c366"),j=e("ebd6"),R=e("cadf"),I=e("84f2"),F=e("5cc5"),D=e("7a56"),N=e("36bd"),U=e("ba92"),V=e("86cc"),W=e("11e9"),C=V.f,B=W.f,q=i.RangeError,z=i.TypeError,G=i.Uint8Array,H="ArrayBuffer",Y="Shared"+H,Q="BYTES_PER_ELEMENT",J="prototype",K=Array[J],X=u.ArrayBuffer,Z=u.DataView,$=M(0),tt=M(2),nt=M(3),et=M(4),rt=M(5),it=M(6),at=T(!0),ot=T(!1),ct=R.values,ut=R.keys,st=R.entries,ft=K.lastIndexOf,lt=K.reduce,ht=K.reduceRight,dt=K.join,pt=K.sort,vt=K.slice,gt=K.toString,yt=K.toLocaleString,bt=k("iterator"),mt=k("toStringTag"),wt=L("typed_constructor"),xt=L("def_constructor"),Pt=c.CONSTR,St=c.TYPED,Et=c.VIEW,Ot="Wrong length!",At=M(1,function(t,n){return Tt(j(t,t[xt]),n)}),_t=a(function(){return 1===new G(new Uint16Array([1]).buffer)[0]}),Lt=!!G&&!!G[J].set&&a(function(){new G(1).set({})}),kt=function(t,n){var e=p(t);if(e<0||e%n)throw q("Wrong offset!");return e},Mt=function(t){if(x(t)&&St in t)return t;throw z(t+" is not a typed array!")},Tt=function(t,n){if(!(x(t)&&wt in t))throw z("It is not a typed array constructor!");return new t(n)},jt=function(t,n){return Rt(j(t,t[xt]),n)},Rt=function(t,n){var e=0,r=n.length,i=Tt(t,r);while(r>e)i[e]=n[e++];return i},It=function(t,n,e){C(t,n,{get:function(){return this._d[e]}})},Ft=function(t){var n,e,r,i,a,o,c=P(t),u=arguments.length,f=u>1?arguments[1]:void 0,l=void 0!==f,h=_(c);if(void 0!=h&&!S(h)){for(o=h.call(c),r=[],n=0;!(a=o.next()).done;n++)r.push(a.value);c=r}for(l&&u>2&&(f=s(f,arguments[2],2)),n=0,e=v(c.length),i=Tt(this,e);e>n;n++)i[n]=l?f(c[n],n):c[n];return i},Dt=function(){var t=0,n=arguments.length,e=Tt(this,n);while(n>t)e[t]=arguments[t++];return e},Nt=!!G&&a(function(){yt.call(new G(1))}),Ut=function(){return yt.apply(Nt?vt.call(Mt(this)):Mt(this),arguments)},Vt={copyWithin:function(t,n){return U.call(Mt(this),t,n,arguments.length>2?arguments[2]:void 0)},every:function(t){return et(Mt(this),t,arguments.length>1?arguments[1]:void 0)},fill:function(t){return N.apply(Mt(this),arguments)},filter:function(t){return jt(this,tt(Mt(this),t,arguments.length>1?arguments[1]:void 0))},find:function(t){return rt(Mt(this),t,arguments.length>1?arguments[1]:void 0)},findIndex:function(t){return it(Mt(this),t,arguments.length>1?arguments[1]:void 0)},forEach:function(t){$(Mt(this),t,arguments.length>1?arguments[1]:void 0)},indexOf:function(t){return ot(Mt(this),t,arguments.length>1?arguments[1]:void 0)},includes:function(t){return at(Mt(this),t,arguments.length>1?arguments[1]:void 0)},join:function(t){return dt.apply(Mt(this),arguments)},lastIndexOf:function(t){return ft.apply(Mt(this),arguments)},map:function(t){return At(Mt(this),t,arguments.length>1?arguments[1]:void 0)},reduce:function(t){return lt.apply(Mt(this),arguments)},reduceRight:function(t){return ht.apply(Mt(this),arguments)},reverse:function(){var t,n=this,e=Mt(n).length,r=Math.floor(e/2),i=0;while(i<r)t=n[i],n[i++]=n[--e],n[e]=t;return n},some:function(t){return nt(Mt(this),t,arguments.length>1?arguments[1]:void 0)},sort:function(t){return pt.call(Mt(this),t)},subarray:function(t,n){var e=Mt(this),r=e.length,i=y(t,r);return new(j(e,e[xt]))(e.buffer,e.byteOffset+i*e.BYTES_PER_ELEMENT,v((void 0===n?r:y(n,r))-i))}},Wt=function(t,n){return jt(this,vt.call(Mt(this),t,n))},Ct=function(t){Mt(this);var n=kt(arguments[1],1),e=this.length,r=P(t),i=v(r.length),a=0;if(i+n>e)throw q(Ot);while(a<i)this[n+a]=r[a++]},Bt={entries:function(){return st.call(Mt(this))},keys:function(){return ut.call(Mt(this))},values:function(){return ct.call(Mt(this))}},qt=function(t,n){return x(t)&&t[St]&&"symbol"!=typeof n&&n in t&&String(+n)==String(n)},zt=function(t,n){return qt(t,n=b(n,!0))?l(2,t[n]):B(t,n)},Gt=function(t,n,e){return!(qt(t,n=b(n,!0))&&x(e)&&m(e,"value"))||m(e,"get")||m(e,"set")||e.configurable||m(e,"writable")&&!e.writable||m(e,"enumerable")&&!e.enumerable?C(t,n,e):(t[n]=e.value,t)};Pt||(W.f=zt,V.f=Gt),o(o.S+o.F*!Pt,"Object",{getOwnPropertyDescriptor:zt,defineProperty:Gt}),a(function(){gt.call({})})&&(gt=yt=function(){return dt.call(this)});var Ht=d({},Vt);d(Ht,Bt),h(Ht,bt,Bt.values),d(Ht,{slice:Wt,set:Ct,constructor:function(){},toString:gt,toLocaleString:Ut}),It(Ht,"buffer","b"),It(Ht,"byteOffset","o"),It(Ht,"byteLength","l"),It(Ht,"length","e"),C(Ht,mt,{get:function(){return this[St]}}),t.exports=function(t,n,e,u){u=!!u;var s=t+(u?"Clamped":"")+"Array",l="get"+t,d="set"+t,p=i[s],y=p||{},b=p&&O(p),m=!p||!c.ABV,P={},S=p&&p[J],_=function(t,e){var r=t._d;return r.v[l](e*n+r.o,_t)},L=function(t,e,r){var i=t._d;u&&(r=(r=Math.round(r))<0?0:r>255?255:255&r),i.v[d](e*n+i.o,r,_t)},k=function(t,n){C(t,n,{get:function(){return _(this,n)},set:function(t){return L(this,n,t)},enumerable:!0})};m?(p=e(function(t,e,r,i){f(t,p,s,"_d");var a,o,c,u,l=0,d=0;if(x(e)){if(!(e instanceof X||(u=w(e))==H||u==Y))return St in e?Rt(p,e):Ft.call(p,e);a=e,d=kt(r,n);var y=e.byteLength;if(void 0===i){if(y%n)throw q(Ot);if(o=y-d,o<0)throw q(Ot)}else if(o=v(i)*n,o+d>y)throw q(Ot);c=o/n}else c=g(e),o=c*n,a=new X(o);h(t,"_d",{b:a,o:d,l:o,e:c,v:new Z(a)});while(l<c)k(t,l++)}),S=p[J]=E(Ht),h(S,"constructor",p)):a(function(){p(1)})&&a(function(){new p(-1)})&&F(function(t){new p,new p(null),new p(1.5),new p(t)},!0)||(p=e(function(t,e,r,i){var a;return f(t,p,s),x(e)?e instanceof X||(a=w(e))==H||a==Y?void 0!==i?new y(e,kt(r,n),i):void 0!==r?new y(e,kt(r,n)):new y(e):St in e?Rt(p,e):Ft.call(p,e):new y(g(e))}),$(b!==Function.prototype?A(y).concat(A(b)):A(y),function(t){t in p||h(p,t,y[t])}),p[J]=S,r||(S.constructor=p));var M=S[bt],T=!!M&&("values"==M.name||void 0==M.name),j=Bt.values;h(p,wt,!0),h(S,St,s),h(S,Et,!0),h(S,xt,p),(u?new p(1)[mt]==s:mt in S)||C(S,mt,{get:function(){return s}}),P[s]=p,o(o.G+o.W+o.F*(p!=y),P),o(o.S,s,{BYTES_PER_ELEMENT:n}),o(o.S+o.F*a(function(){y.of.call(p,1)}),s,{from:Ft,of:Dt}),Q in S||h(S,Q,n),o(o.P,s,Vt),D(s),o(o.P+o.F*Lt,s,{set:Ct}),o(o.P+o.F*!T,s,Bt),r||S.toString==gt||(S.toString=gt),o(o.P+o.F*a(function(){new p(1).slice()}),s,{slice:Wt}),o(o.P+o.F*(a(function(){return[1,2].toLocaleString()!=new p([1,2]).toLocaleString()})||!a(function(){S.toLocaleString.call([1,2])})),s,{toLocaleString:Ut}),I[s]=T?M:j,r||T||h(S,bt,j)}}else t.exports=function(){}},ed0b:function(t,n,e){"use strict";var r=e("7726"),i=e("9e1e"),a=e("2d00"),o=e("0f88"),c=e("32e9"),u=e("dcbc"),s=e("79e5"),f=e("f605"),l=e("4588"),h=e("9def"),d=e("09fa"),p=e("9093").f,v=e("86cc").f,g=e("36bd"),y=e("7f20"),b="ArrayBuffer",m="DataView",w="prototype",x="Wrong length!",P="Wrong index!",S=r[b],E=r[m],O=r.Math,A=r.RangeError,_=r.Infinity,L=S,k=O.abs,M=O.pow,T=O.floor,j=O.log,R=O.LN2,I="buffer",F="byteLength",D="byteOffset",N=i?"_b":I,U=i?"_l":F,V=i?"_o":D;function W(t,n,e){var r,i,a,o=new Array(e),c=8*e-n-1,u=(1<<c)-1,s=u>>1,f=23===n?M(2,-24)-M(2,-77):0,l=0,h=t<0||0===t&&1/t<0?1:0;for(t=k(t),t!=t||t===_?(i=t!=t?1:0,r=u):(r=T(j(t)/R),t*(a=M(2,-r))<1&&(r--,a*=2),t+=r+s>=1?f/a:f*M(2,1-s),t*a>=2&&(r++,a/=2),r+s>=u?(i=0,r=u):r+s>=1?(i=(t*a-1)*M(2,n),r+=s):(i=t*M(2,s-1)*M(2,n),r=0));n>=8;o[l++]=255&i,i/=256,n-=8);for(r=r<<n|i,c+=n;c>0;o[l++]=255&r,r/=256,c-=8);return o[--l]|=128*h,o}function C(t,n,e){var r,i=8*e-n-1,a=(1<<i)-1,o=a>>1,c=i-7,u=e-1,s=t[u--],f=127&s;for(s>>=7;c>0;f=256*f+t[u],u--,c-=8);for(r=f&(1<<-c)-1,f>>=-c,c+=n;c>0;r=256*r+t[u],u--,c-=8);if(0===f)f=1-o;else{if(f===a)return r?NaN:s?-_:_;r+=M(2,n),f-=o}return(s?-1:1)*r*M(2,f-n)}function B(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]}function q(t){return[255&t]}function z(t){return[255&t,t>>8&255]}function G(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]}function H(t){return W(t,52,8)}function Y(t){return W(t,23,4)}function Q(t,n,e){v(t[w],n,{get:function(){return this[e]}})}function J(t,n,e,r){var i=+e,a=d(i);if(a+n>t[U])throw A(P);var o=t[N]._b,c=a+t[V],u=o.slice(c,c+n);return r?u:u.reverse()}function K(t,n,e,r,i,a){var o=+e,c=d(o);if(c+n>t[U])throw A(P);for(var u=t[N]._b,s=c+t[V],f=r(+i),l=0;l<n;l++)u[s+l]=f[a?l:n-l-1]}if(o.ABV){if(!s(function(){S(1)})||!s(function(){new S(-1)})||s(function(){return new S,new S(1.5),new S(NaN),S.name!=b})){S=function(t){return f(this,S),new L(d(t))};for(var X,Z=S[w]=L[w],$=p(L),tt=0;$.length>tt;)(X=$[tt++])in S||c(S,X,L[X]);a||(Z.constructor=S)}var nt=new E(new S(2)),et=E[w].setInt8;nt.setInt8(0,2147483648),nt.setInt8(1,2147483649),!nt.getInt8(0)&&nt.getInt8(1)||u(E[w],{setInt8:function(t,n){et.call(this,t,n<<24>>24)},setUint8:function(t,n){et.call(this,t,n<<24>>24)}},!0)}else S=function(t){f(this,S,b);var n=d(t);this._b=g.call(new Array(n),0),this[U]=n},E=function(t,n,e){f(this,E,m),f(t,S,m);var r=t[U],i=l(n);if(i<0||i>r)throw A("Wrong offset!");if(e=void 0===e?r-i:h(e),i+e>r)throw A(x);this[N]=t,this[V]=i,this[U]=e},i&&(Q(S,F,"_l"),Q(E,I,"_b"),Q(E,F,"_l"),Q(E,D,"_o")),u(E[w],{getInt8:function(t){return J(this,1,t)[0]<<24>>24},getUint8:function(t){return J(this,1,t)[0]},getInt16:function(t){var n=J(this,2,t,arguments[1]);return(n[1]<<8|n[0])<<16>>16},getUint16:function(t){var n=J(this,2,t,arguments[1]);return n[1]<<8|n[0]},getInt32:function(t){return B(J(this,4,t,arguments[1]))},getUint32:function(t){return B(J(this,4,t,arguments[1]))>>>0},getFloat32:function(t){return C(J(this,4,t,arguments[1]),23,4)},getFloat64:function(t){return C(J(this,8,t,arguments[1]),52,8)},setInt8:function(t,n){K(this,1,t,q,n)},setUint8:function(t,n){K(this,1,t,q,n)},setInt16:function(t,n){K(this,2,t,z,n,arguments[2])},setUint16:function(t,n){K(this,2,t,z,n,arguments[2])},setInt32:function(t,n){K(this,4,t,G,n,arguments[2])},setUint32:function(t,n){K(this,4,t,G,n,arguments[2])},setFloat32:function(t,n){K(this,4,t,Y,n,arguments[2])},setFloat64:function(t,n){K(this,8,t,H,n,arguments[2])}});y(S,b),y(E,m),c(E[w],o.VIEW,!0),n[b]=S,n[m]=E},f605:function(t,n){t.exports=function(t,n,e,r){if(!(t instanceof n)||void 0!==r&&r in t)throw TypeError(e+": incorrect invocation!");return t}},f751:function(t,n,e){var r=e("5ca1");r(r.S+r.F,"Object",{assign:e("7333")})},fab2:function(t,n,e){var r=e("7726").document;t.exports=r&&r.documentElement}});