diff --git a/js/Pane.js b/js/Pane.js index 13a7f726..a4ae736a 100644 --- a/js/Pane.js +++ b/js/Pane.js @@ -66,6 +66,8 @@ class Pane extends React.Component { }; }; + updateCompareViewSelection = value => {}; + shouldComponentUpdate(nextProps) { if (this.props.contentID !== nextProps.contentID) { return true; @@ -81,6 +83,8 @@ class Pane extends React.Component { } render() { + let widgets = [].concat(this.props.widgets); + let windowClassNames = classNames({ window: true, focus: this.props.isFocused, @@ -91,6 +95,27 @@ class Pane extends React.Component { focus: this.props.isFocused, }); + // compare view selection + if ( + this.props.has_compare && + this.props.compare_content_info && + this.props.compare_view_mode != 'merge' + ) { + var select = this.props.compare_selection_i; + widgets.push( +
+ Selected Env + +
+ ); + } + return (
{this.props.title}
{this.props.children}
-
{this.props.widgets}
+
{widgets}
); } diff --git a/js/PlotPane.js b/js/PlotPane.js index d932ba49..d24b23eb 100644 --- a/js/PlotPane.js +++ b/js/PlotPane.js @@ -63,12 +63,39 @@ class PlotPane extends React.Component { } newPlot = () => { - Plotly.newPlot( - this.props.contentID, - this.props.content.data, - this.props.content.layout, - { showLink: true, linkText: 'Edit' } - ); + // determine data based on window (compare) settings + if ( + !this.props.has_compare || + (this.props.compare_view_mode && this.props.compare_view_mode == 'select') + ) + var content = this.props.content; + // merge mode (for scatter plots) + else { + var layout = this.props.compare_content[0].layout; + layout.showlegend = true; + + // first merge list of data-lists into flat data-list + var data = this.props.compare_content + .map(function(content) { + return content.data; + }) + .flat(); + + // use the modified compare_name as labels + data.forEach(function(val) { + val.name = val.compare_name; + }); + + var content = { + layout: layout, + data: data, + }; + } + + Plotly.newPlot(this.props.contentID, content.data, content.layout, { + showLink: true, + linkText: 'Edit', + }); }; handleDownload = () => { @@ -83,11 +110,14 @@ class PlotPane extends React.Component { }; render() { + let widgets = []; + return ( (this._paneRef = ref)} + widgets={widgets} >
{ let pane = this.state.panes[id]; + if (pane.has_compare && pane.compare_content) { + pane.content = pane.compare_content[pane.compare_selection_i]; + } try { let Comp = PANES[pane.type]; @@ -1610,6 +1617,9 @@ class App extends React.Component { sendPaneMessage: this.sendPaneMessage, sendEmbeddingPop: this.sendEmbeddingPop, }} + updateCompareViewSelection={this.updateCompareViewSelection.bind( + pane + )} />
diff --git a/py/visdom/server.py b/py/visdom/server.py index 73019a72..a5c79f27 100644 --- a/py/visdom/server.py +++ b/py/visdom/server.py @@ -1455,92 +1455,110 @@ def gather_envs(state, env_path=DEFAULT_ENV_PATH): def compare_envs(state, eids, socket, env_path=DEFAULT_ENV_PATH): logging.info('comparing envs') - eidNums = {e: str(i) for i, e in enumerate(eids)} - env = {} - envs = {} + + # queries from eids-list + # - envs: a list of all (eid -> env) pairs. (directly loads envs if not yet loaded) + # - res: a single env containing all windows with titles + # - title2Win: a dict of all (title -> win) pairs + # note: In case multiple windows share the same title, any window + # could be used. we use the first occurence as a compare view + envs, res, title2Win = [], {'jsons': {}, 'reload': {}}, {} for eid in eids: + if eid in state: - envs[eid] = state.get(eid) + env = state.get(eid) elif env_path is not None: p = os.path.join(env_path, eid.strip(), '.json') if os.path.exists(p): with open(p, 'r') as fn: env = tornado.escape.json_decode(fn.read()) state[eid] = env - envs[eid] = env - - res = copy.deepcopy(envs[list(envs.keys())[0]]) - name2Wid = {res['jsons'][wid].get('title', None): wid + '_compare' - for wid in res.get('jsons', {}) - if 'title' in res['jsons'][wid]} - for wid in list(res['jsons'].keys()): - res['jsons'][wid + '_compare'] = res['jsons'][wid] - res['jsons'][wid] = None - res['jsons'].pop(wid) - - for ix, eid in enumerate(envs.keys()): - env = envs[eid] + else: + continue + + envs.append(env) + for winId, win in env['jsons'].items(): + if "title" in win and win["title"] and win["title"] not in title2Win: + comparewinId = winId + "_compare" + title2Win[win["title"]] = comparewinId + res['jsons'][comparewinId] = copy.deepcopy(env['jsons'][winId]) + if isinstance(res['jsons'][comparewinId]['content'], dict): + res['jsons'][comparewinId]['content']["data"] = [] + else: + res['jsons'][comparewinId]['content'] = "" + res['jsons'][comparewinId]["compare_content"] = [] + res['jsons'][comparewinId]["compare_selection_i"] = 0 + res['jsons'][comparewinId]['has_compare'] = True + res['jsons'][comparewinId]['compare_view_mode'] = "select" + res['jsons'][comparewinId]['compare_content_info'] = [] + res['jsons'][comparewinId]['contentID'] = get_rand_id() + logging.error("compare") + + # TODO: next, merge + tableRows = [] + for eidNum, env in enumerate(envs): + + perEnvTitleCount = {} for wid in env.get('jsons', {}).keys(): win = env['jsons'][wid] - if win.get('type', None) != 'plot': - continue if 'content' not in win: continue - if 'title' not in win: - continue - title = win['title'] - if title not in name2Wid or title == '': + if 'title' not in win or not win["title"]: continue - destWid = name2Wid[title] - destWidJson = res['jsons'][destWid] - # Combine plots with the same window title. If plot data source was - # labeled "name" in the legend, rename to "envId_legend" where - # envId is enumeration of the selected environments (not the long - # environment id string). This makes plot lines more readable. - if ix == 0: - if 'name' not in destWidJson['content']['data'][0]: - continue # Skip windows with unnamed data - destWidJson['has_compare'] = False - destWidJson['content']['layout']['showlegend'] = True - destWidJson['contentID'] = get_rand_id() - for dataIdx, data in enumerate(destWidJson['content']['data']): - if 'name' not in data: - break # stop working with this plot, not right format - destWidJson['content']['data'][dataIdx]['name'] = \ - '{}_{}'.format(eidNums[eid], data['name']) + # set up the window to show compare data in + title = win["title"] + content_copy = copy.deepcopy(win['content']) + destwin = res['jsons'][title2Win[title]] + if title not in perEnvTitleCount: + perEnvTitleCount[title] = 0 else: - if 'name' not in destWidJson['content']['data'][0]: - continue # Skip windows with unnamed data - # has_compare will be set to True only if the window title is - # shared by at least 2 envs. - destWidJson['has_compare'] = True - for _dataIdx, data in enumerate(win['content']['data']): - data = copy.deepcopy(data) - if 'name' not in data: - destWidJson['has_compare'] = False - break # stop working with this plot, not right format - data['name'] = '{}_{}'.format(eidNums[eid], data['name']) - destWidJson['content']['data'].append(data) - - # Make sure that only plots that are shared by at least two envs are shown. - # Check has_compare flag - for destWid in list(res['jsons'].keys()): - if ('has_compare' not in res['jsons'][destWid]) or \ - (not res['jsons'][destWid]['has_compare']): - del res['jsons'][destWid] - - # create legend mapping environment names to environment numbers so one can - # look it up for the new legend - tableRows = [" {} {} ".format(v, eidNums[v]) - for v in eidNums] + perEnvTitleCount[title] += 1 + destwin['compare_content_info'].append({ + "envId": eidNum, + "plot_name": str(eidNum)+"_"+str(perEnvTitleCount[title]), + "content_i": len(destwin['compare_content']), + }) + destwin['compare_content'].append(content_copy) + + # If plot data source was labeled "name" in the legend, rename to + # "envId_legend" where envId is enumeration of the selected + # environments (not the long environment id string). This makes plot + # lines more readable. + if isinstance(content_copy, dict) and "data" in content_copy: + for _dataIdx, data in enumerate(content_copy["data"]): + if 'name' in data: + data['compare_name'] = '{}_{}'.format(eidNum, data['name']) + + # create legend mapping environment names to environment numbers so one can + # look it up for the new legend + tableRows.append(" {} {} ".format(eids[eidNum], eidNum)) + + # in case all plot types in a window are line plot, we can use merge-mode + for win in res['jsons'].values(): + all_scatter = True + if isinstance(win['content'], dict) and 'layout' in win['content']: + for content_list in win['compare_content']: + for data in content_list["data"]: + if data['type'] != 'scatter': + all_scatter = False + break + if not all_scatter: + break + if all_scatter: + win['content']['layout']['showlegend'] = True + win['compare_view_mode'] = 'merge' + else: + if isinstance(win['content'], dict) and 'layout' in win['content'] and 'margin' in win['content']['layout']: + win['content']['layout']['margin']['b'] += 20 tbl = """" - {}
""".format(' '.join(tableRows)) + {}
+ """.format(' '.join(tableRows)) res['jsons']['window_compare_legend'] = { "command": "window", @@ -1556,10 +1574,11 @@ def compare_envs(state, eids, socket, env_path=DEFAULT_ENV_PATH): "i": 1, "has_compare": True, } - if 'reload' in res: - socket.write_message( - json.dumps({'command': 'reload', 'data': res['reload']}) - ) + # TODO needed? + # if 'reload' in res: + # socket.write_message( + # json.dumps({'command': 'reload', 'data': res['reload']}) + # ) jsons = list(res.get('jsons', {}).values()) windows = sorted(jsons, key=lambda k: ('i' not in k, k.get('i', None))) diff --git a/py/visdom/static/css/style.css b/py/visdom/static/css/style.css index 4a46fbab..14091506 100644 --- a/py/visdom/static/css/style.css +++ b/py/visdom/static/css/style.css @@ -252,3 +252,12 @@ doesn't override our desire to make them non-interactable */ .content-properties { background-color: #ffffff; } + +.widget.compare_selection { + color: #333; + font-size: 11px; +} + +.widget.compare_selection > span, .widget.compare_selection > select { + margin: 0 5px; +} diff --git a/py/visdom/static/js/main.js b/py/visdom/static/js/main.js index d6095567..19b724f4 100644 --- a/py/visdom/static/js/main.js +++ b/py/visdom/static/js/main.js @@ -1,4 +1,4 @@ -/*! @generated */!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=113)}([function(e,t,n){e.exports=n(127)()},function(e,t,n){"use strict";e.exports=n(115)},function(e,t,n){"use strict";n.r(t);var r="http://www.w3.org/1999/xhtml",i={svg:"http://www.w3.org/2000/svg",xhtml:r,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},o=function(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),i.hasOwnProperty(t)?{space:i[t],local:e}:e};function a(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===r&&t.documentElement.namespaceURI===r?t.createElement(e):t.createElementNS(n,e)}}function s(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}var c=function(e){var t=o(e);return(t.local?s:a)(t)};function l(){}var u=function(e){return null==e?l:function(){return this.querySelector(e)}};function h(){return[]}var d=function(e){return null==e?h:function(){return this.querySelectorAll(e)}},p=function(e){return function(){return this.matches(e)}},f=function(e){return new Array(e.length)};function m(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}m.prototype={constructor:m,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};var g="$";function v(e,t,n,r,i,o){for(var a,s=0,c=t.length,l=o.length;st?1:e>=t?0:NaN}function w(e){return function(){this.removeAttribute(e)}}function _(e){return function(){this.removeAttributeNS(e.space,e.local)}}function x(e,t){return function(){this.setAttribute(e,t)}}function E(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function S(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function M(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}var T=function(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView};function A(e){return function(){this.style.removeProperty(e)}}function C(e,t,n){return function(){this.style.setProperty(e,t,n)}}function O(e,t,n){return function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function P(e,t){return e.style.getPropertyValue(t)||T(e).getComputedStyle(e,null).getPropertyValue(t)}function L(e){return function(){delete this[e]}}function R(e,t){return function(){this[e]=t}}function k(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function D(e){return e.trim().split(/^|\s+/)}function N(e){return e.classList||new I(e)}function I(e){this._node=e,this._names=D(e.getAttribute("class")||"")}function z(e,t){for(var n=N(e),r=-1,i=t.length;++r=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function U(){this.textContent=""}function G(e){return function(){this.textContent=e}}function W(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function V(){this.innerHTML=""}function q(e){return function(){this.innerHTML=e}}function Y(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function X(){this.nextSibling&&this.parentNode.appendChild(this)}function Z(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function K(){return null}function J(){var e=this.parentNode;e&&e.removeChild(this)}function Q(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function $(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}var ee={},te=null;"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(ee={mouseenter:"mouseover",mouseleave:"mouseout"}));function ne(e,t,n){return e=re(e,t,n),function(t){var n=t.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||e.call(this,t)}}function re(e,t,n){return function(r){var i=te;te=r;try{e.call(this,this.__data__,t,n)}finally{te=i}}}function ie(e){return e.trim().split(/^|\s+/).map((function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}}))}function oe(e){return function(){var t=this.__on;if(t){for(var n,r=0,i=-1,o=t.length;r=E&&(E=x+1);!(_=b[E])&&++E=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=b);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o1?this.each((null==t?A:"function"==typeof t?O:C)(e,t,null==n?"":n)):P(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?L:"function"==typeof t?k:R)(e,t)):this.node()[e]},classed:function(e,t){var n=D(e+"");if(arguments.length<2){for(var r=N(this.node()),i=-1,o=n.length;++i=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),i.hasOwnProperty(t)?{space:i[t],local:e}:e};function a(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===r&&t.documentElement.namespaceURI===r?t.createElement(e):t.createElementNS(n,e)}}function s(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}var c=function(e){var t=o(e);return(t.local?s:a)(t)};function l(){}var u=function(e){return null==e?l:function(){return this.querySelector(e)}};function h(){return[]}var d=function(e){return null==e?h:function(){return this.querySelectorAll(e)}},p=function(e){return function(){return this.matches(e)}},f=function(e){return new Array(e.length)};function m(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}m.prototype={constructor:m,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};var g="$";function v(e,t,n,r,i,o){for(var a,s=0,c=t.length,l=o.length;st?1:e>=t?0:NaN}function w(e){return function(){this.removeAttribute(e)}}function _(e){return function(){this.removeAttributeNS(e.space,e.local)}}function x(e,t){return function(){this.setAttribute(e,t)}}function E(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function S(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function M(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}var T=function(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView};function C(e){return function(){this.style.removeProperty(e)}}function A(e,t,n){return function(){this.style.setProperty(e,t,n)}}function O(e,t,n){return function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function P(e,t){return e.style.getPropertyValue(t)||T(e).getComputedStyle(e,null).getPropertyValue(t)}function L(e){return function(){delete this[e]}}function R(e,t){return function(){this[e]=t}}function k(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function D(e){return e.trim().split(/^|\s+/)}function N(e){return e.classList||new I(e)}function I(e){this._node=e,this._names=D(e.getAttribute("class")||"")}function z(e,t){for(var n=N(e),r=-1,i=t.length;++r=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function U(){this.textContent=""}function G(e){return function(){this.textContent=e}}function W(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function V(){this.innerHTML=""}function q(e){return function(){this.innerHTML=e}}function Y(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function X(){this.nextSibling&&this.parentNode.appendChild(this)}function Z(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function K(){return null}function J(){var e=this.parentNode;e&&e.removeChild(this)}function Q(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function $(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}var ee={},te=null;"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(ee={mouseenter:"mouseover",mouseleave:"mouseout"}));function ne(e,t,n){return e=re(e,t,n),function(t){var n=t.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||e.call(this,t)}}function re(e,t,n){return function(r){var i=te;te=r;try{e.call(this,this.__data__,t,n)}finally{te=i}}}function ie(e){return e.trim().split(/^|\s+/).map((function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}}))}function oe(e){return function(){var t=this.__on;if(t){for(var n,r=0,i=-1,o=t.length;r=E&&(E=x+1);!(_=b[E])&&++E=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=b);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o1?this.each((null==t?C:"function"==typeof t?O:A)(e,t,null==n?"":n)):P(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?L:"function"==typeof t?k:R)(e,t)):this.node()[e]},classed:function(e,t){var n=D(e+"");if(arguments.length<2){for(var r=N(this.node()),i=-1,o=n.length;++i * @license MIT */ -var r=n(185),i=n(186),o=n(85);function a(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function f(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return U(e).length;default:if(r)return H(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return P(this,t,n);case"utf8":case"utf-8":return T(this,t,n);case"ascii":return C(this,t,n);case"latin1":case"binary":return O(this,t,n);case"base64":return M(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,i);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,i){var o,a=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,n/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var u=-1;for(o=n;os&&(n=s-c),o=n;o>=0;o--){for(var h=!0,d=0;di&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function M(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function T(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:l>223?3:l>191?2:1;if(i+h<=n)switch(h){case 1:l<128&&(u=l);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&l)<<6|63&o)>127&&(u=c);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(c=(15&l)<<12|(63&o)<<6|63&a)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(c=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&c<1114112&&(u=c)}null===u?(u=65533,h=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=h}return function(e){var t=e.length;if(t<=A)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},c.prototype.compare=function(e,t,n,r,i){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),l=this.slice(r,i),u=e.slice(t,n),h=0;hi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return _(this,e,t,n);case"latin1":case"binary":return x(this,e,t,n);case"base64":return E(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function C(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function k(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function D(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function N(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function I(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function z(e,t,n,r,o){return o||I(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function B(e,t,n,r,o){return o||I(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUInt8=function(e,t){return t||R(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||R(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||R(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||R(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return t||R(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||R(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||R(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||R(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||R(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||R(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||R(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||k(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):N(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);k(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);k(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):N(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return z(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return z(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function U(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(F,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function G(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(9))},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t){var n=e.exports={version:"2.6.9"};"number"==typeof __e&&(__e=n)},function(e,t,n){e.exports=!n(32)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},function(e,t,n){var r=n(31),i=n(75),o=n(53),a=Object.defineProperty;t.f=n(14)?Object.defineProperty:function(e,t,n){if(r(e),t=o(t,!0),r(n),i)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){"use strict";var r=n(42),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=h;var o=n(34);o.inherits=n(15);var a=n(90),s=n(65);o.inherits(h,a);for(var c=i(s.prototype),l=0;l=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}}))}function s(e,t){for(var n,r=0,i=e.length;r0)for(var n,r,i=new Array(n),o=0;o=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=o(e);return t&&0!==t.length?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r}),!a.kStringMaxLength)try{a.kStringMaxLength=t.binding("buffer").kStringMaxLength}catch(e){}a.constants||(a.constants={MAX_LENGTH:a.kMaxLength},a.kStringMaxLength&&(a.constants.MAX_STRING_LENGTH=a.kStringMaxLength)),e.exports=a}).call(this,n(10))},function(e,t,n){"use strict";var r,i=function(){function e(e,t){for(var n=0;n=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}},function(e,t,n){"use strict";t.__esModule=!0;var r,i=n(83),o=(r=i)&&r.__esModule?r:{default:r};t.default=function(){function e(e,t){for(var n=0;n=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function f(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return U(e).length;default:if(r)return H(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return P(this,t,n);case"utf8":case"utf-8":return T(this,t,n);case"ascii":return A(this,t,n);case"latin1":case"binary":return O(this,t,n);case"base64":return M(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,i);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,i){var o,a=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,n/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var u=-1;for(o=n;os&&(n=s-c),o=n;o>=0;o--){for(var h=!0,d=0;di&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function M(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function T(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:l>223?3:l>191?2:1;if(i+h<=n)switch(h){case 1:l<128&&(u=l);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&l)<<6|63&o)>127&&(u=c);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(c=(15&l)<<12|(63&o)<<6|63&a)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(c=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&c<1114112&&(u=c)}null===u?(u=65533,h=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=h}return function(e){var t=e.length;if(t<=C)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},c.prototype.compare=function(e,t,n,r,i){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),l=this.slice(r,i),u=e.slice(t,n),h=0;hi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return _(this,e,t,n);case"latin1":case"binary":return x(this,e,t,n);case"base64":return E(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function A(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function k(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function D(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function N(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function I(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function z(e,t,n,r,o){return o||I(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function B(e,t,n,r,o){return o||I(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUInt8=function(e,t){return t||R(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||R(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||R(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||R(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return t||R(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||R(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||R(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||R(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||R(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||R(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||R(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||k(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):N(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);k(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);k(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):N(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return z(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return z(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function U(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(F,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function G(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(9))},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t){var n=e.exports={version:"2.6.9"};"number"==typeof __e&&(__e=n)},function(e,t,n){e.exports=!n(32)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},function(e,t,n){var r=n(31),i=n(75),o=n(53),a=Object.defineProperty;t.f=n(14)?Object.defineProperty:function(e,t,n){if(r(e),t=o(t,!0),r(n),i)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){"use strict";var r=n(42),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=h;var o=n(34);o.inherits=n(15);var a=n(90),s=n(65);o.inherits(h,a);for(var c=i(s.prototype),l=0;l=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}}))}function s(e,t){for(var n,r=0,i=e.length;r0)for(var n,r,i=new Array(n),o=0;o=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=o(e);return t&&0!==t.length?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r}),!a.kStringMaxLength)try{a.kStringMaxLength=t.binding("buffer").kStringMaxLength}catch(e){}a.constants||(a.constants={MAX_LENGTH:a.kMaxLength},a.kStringMaxLength&&(a.constants.MAX_STRING_LENGTH=a.kStringMaxLength)),e.exports=a}).call(this,n(10))},function(e,t,n){"use strict";var r,i=function(){function e(e,t){for(var n=0;n=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}},function(e,t,n){"use strict";t.__esModule=!0;var r,i=n(83),o=(r=i)&&r.__esModule?r:{default:r};t.default=function(){function e(e,t){for(var n=0;nt&&(t=n);return t}function u(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:Boolean(e.moved),static:Boolean(e.static),isDraggable:e.isDraggable,isResizable:e.isResizable}}function h(e,t){return e!==t&&(!(e.x+e.w<=t.x)&&(!(e.x>=t.x+t.w)&&(!(e.y+e.h<=t.y)&&!(e.y>=t.y+t.h))))}function d(e,t,n){for(var r=w(e),i=E(e,t),o=Array(e.length),a=0,s=i.length;at.y+t.h)break;h(t,a)&&f(e,a,n+t[i],r)}}t[r]=n}function m(e,t,n,r,i){var o="horizontal"===n;if("vertical"===n)for(t.y=Math.min(l(e),t.y);t.y>0&&!y(e,t);)t.y--;else if(o)for(t.y=Math.min(l(e),t.y);t.x>0&&!y(e,t);)t.x--;for(var a=void 0;a=y(e,t);)o?f(i,t,a.x+a.w,"x"):f(i,t,a.y+a.h,"y"),o&&t.x+t.w>r&&(t.x=r-t.w,t.y++);return t}function g(e,t){for(var n=w(e),r=0,i=e.length;rt.cols&&(o.x=t.cols-o.w),o.x<0&&(o.x=0,o.w=t.cols),o.static)for(;y(n,o);)o.y++;else n.push(o)}return e}function v(e,t){for(var n=0,r=e.length;n=r:"horizontal"===a&&"number"==typeof n&&c>=n)&&(u=u.reverse());var h=b(u,t);if(o&&h.length)return A("Collision prevented on "+t.i+", reverting."),t.x=c,t.y=l,t.moved=!1,e;for(var d=0,p=h.length;dt.y||e.y===t.y&&e.x>t.x?1:e.y===t.y&&e.x===t.x?0:-1}))}function M(e){return[].concat(e).sort((function(e,t){return e.x>t.x||e.x===t.x&&e.y>t.y?1:-1}))}function T(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Layout",n=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(var r=0,i=e.length;r",'"',"`"," ","\r","\n","\t"]),u=["'"].concat(l),h=["%","/","?",";","#"].concat(u),d=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,f=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=n(199);function b(e,t,n){if(e&&i.isObject(e)&&e instanceof o)return e;var r=new o;return r.parse(e,t,n),r}o.prototype.parse=function(e,t,n){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),s=-1!==o&&o127?k+="x":k+=R[D];if(!k.match(p)){var I=P.slice(0,A),z=P.slice(A+1),B=R.match(f);B&&(I.push(B[1]),z.unshift(B[2])),z.length&&(b="/"+z.join(".")+b),this.hostname=I.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),O||(this.hostname=r.toASCII(this.hostname));var F=this.port?":"+this.port:"",j=this.hostname||"";this.host=j+F,this.href+=this.host,O&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!m[x])for(A=0,L=u.length;A0)&&n.host.split("@"))&&(n.auth=O.shift(),n.host=n.hostname=O.shift());return n.search=e.search,n.query=e.query,i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!E.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var M=E.slice(-1)[0],T=(n.host||e.host||E.length>1)&&("."===M||".."===M)||""===M,A=0,C=E.length;C>=0;C--)"."===(M=E[C])?E.splice(C,1):".."===M?(E.splice(C,1),A++):A&&(E.splice(C,1),A--);if(!_&&!x)for(;A--;A)E.unshift("..");!_||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),T&&"/"!==E.join("/").substr(-1)&&E.push("");var O,P=""===E[0]||E[0]&&"/"===E[0].charAt(0);S&&(n.hostname=n.host=P?"":E.length?E.shift():"",(O=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=O.shift(),n.host=n.hostname=O.shift()));return(_=_||n.host&&E.length)&&!P&&E.unshift(""),E.length?n.pathname=E.join("/"):(n.pathname=null,n.path=null),i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var e=this.host,t=s.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)i(n,r)&&(e[r]=n[r])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var o={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var o=0;oE}w.mouse("drag")}function A(){Object(i.select)(i.event.view).on("mousemove.drag mouseup.drag",null),c(i.event.view,n),a(),w.mouse("end")}function C(){if(g.apply(this,arguments)){var e,t,n=i.event.changedTouches,r=v.apply(this,arguments),a=n.length;for(e=0;e0?r:n)(e)}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(23);e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t){e.exports={}},function(e,t,n){var r=n(31),i=n(146),o=n(58),a=n(56)("IE_PROTO"),s=function(){},c=function(){var e,t=n(76)("iframe"),r=o.length;for(t.style.display="none",n(150).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("