From 3161dd7ee95b6c7d70f8341298dd4fab84cda8b0 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 2 Sep 2022 14:47:08 -0700 Subject: es6 migration --- apidoc/vendor/bootstrap.min.js | 2 +- apidoc/vendor/handlebars.min.js | 4 +- apidoc/vendor/jquery.min.js | 2 +- apidoc/vendor/lodash.custom.min.js | 4 +- apidoc/vendor/prism.js | 4 +- apidoc/vendor/require.min.js | 10 +- apidoc/vendor/webfontloader.js | 2 +- app.js | 2 + db/db.js | 17 + db/index.js | 21 +- db/models/accounts.js | 3 +- db/models/codes.js | 3 +- db/models/deposits.js | 3 +- db/models/invoices.js | 3 +- db/models/keys.js | 3 +- db/models/orders.js | 3 +- db/models/payments.js | 3 +- db/models/referrals.js | 3 +- db/models/users.js | 3 +- db/models/waiting_list.js | 3 +- db/models/withdrawals.js | 3 +- db/normalized/accounts.js | 2 +- db/normalized/credits.js | 2 +- db/normalized/debits.js | 2 +- db/normalized/deposits.js | 2 +- db/normalized/exchanges.js | 2 +- db/normalized/invoices.js | 2 +- db/normalized/non_custodial_accounts.js | 2 +- db/normalized/transfers.js | 2 +- db/normalized/waiting_list.js | 2 +- db/normalized/withdrawals.js | 2 +- index.js | 192 ++++----- lib/binance.js | 2 +- lib/bitcoin.js | 3 + lib/buildliquidtx.js | 7 +- lib/buildtx.js | 3 +- lib/liquid.js | 4 + lib/ln.js | 25 ++ lib/logging.js | 24 +- lib/mail.js | 68 ++-- lib/notifications.js | 3 +- lib/passport.js | 63 ++- lib/rates.js | 18 +- lib/register.js | 4 +- lib/rpc.js | 18 + lib/send.js | 4 +- lib/sockets.js | 303 ++++++++------- lib/store.js | 14 + lib/sync.js | 74 ++-- lib/upload.js | 21 +- lib/utils.js | 14 +- lib/webhooks.js | 2 +- lib/whitelist.js | 2 +- package.json | 6 +- pnpm-lock.yaml | 663 +++++++++++++++++++++++++++----- routes/admin.js | 37 +- routes/assets.js | 17 +- routes/bitcoin/broadcast.js | 4 +- routes/bitcoin/conversionFee.js | 7 +- routes/bitcoin/fee.js | 27 +- routes/bitcoin/generate.js | 4 +- routes/bitcoin/index.js | 13 + routes/bitcoin/receive.js | 4 +- routes/bitcoin/send.js | 65 +++- routes/bitcoin/sweep.js | 15 +- routes/funding.js | 14 +- routes/info.js | 15 +- routes/invoices.js | 184 +++++---- routes/lightning/channel.js | 16 +- routes/lightning/channelRequest.js | 9 +- routes/lightning/conversionFee.js | 7 +- routes/lightning/index.js | 13 + routes/lightning/invoice.js | 5 +- routes/lightning/query.js | 8 +- routes/lightning/receive.js | 3 + routes/lightning/send.js | 11 +- routes/liquid/broadcast.js | 4 +- routes/liquid/conversionFee.js | 7 +- routes/liquid/fee.js | 20 +- routes/liquid/generate.js | 4 +- routes/liquid/index.js | 13 + routes/liquid/receive.js | 7 +- routes/liquid/send.js | 42 +- routes/liquid/taxi.js | 14 +- routes/lnurl.js | 525 ++++++++++++------------- routes/payments.js | 208 +++++----- routes/referrals.js | 21 +- routes/send.js | 11 +- routes/swaps.js | 36 +- routes/users.js | 90 ++--- scripts/apiParse.js | 9 +- scripts/createExceptions.js | 32 -- secret | 0 93 files changed, 1855 insertions(+), 1324 deletions(-) create mode 100644 app.js create mode 100644 db/db.js create mode 100644 lib/bitcoin.js create mode 100644 lib/liquid.js create mode 100644 lib/ln.js create mode 100644 lib/rpc.js create mode 100644 lib/store.js create mode 100644 routes/bitcoin/index.js create mode 100644 routes/lightning/index.js create mode 100644 routes/liquid/index.js delete mode 100644 scripts/createExceptions.js create mode 100644 secret diff --git a/apidoc/vendor/bootstrap.min.js b/apidoc/vendor/bootstrap.min.js index eb0a8b41..6290896a 100644 --- a/apidoc/vendor/bootstrap.min.js +++ b/apidoc/vendor/bootstrap.min.js @@ -3,4 +3,4 @@ * Copyright 2011-2019 Twitter, Inc. * Licensed under the MIT license */ -if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");!function(t){"use strict";var e=jQuery.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1||3this.$items.length-1||t<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){e.to(t)}):i==t?this.pause().cycle():this.slide(idocument.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&t?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!t?this.scrollbarWidth:""})},s.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},s.prototype.checkScrollbar=function(){var t=window.innerWidth;if(!t){var e=document.documentElement.getBoundingClientRect();t=e.right-Math.abs(e.left)}this.bodyIsOverflowing=document.body.clientWidth
',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0},sanitize:!0,sanitizeFn:null,whiteList:t},m.prototype.init=function(t,e,i){if(this.enabled=!0,this.type=t,this.$element=g(e),this.options=this.getOptions(i),this.$viewport=this.options.viewport&&g(document).find(g.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var o=this.options.trigger.split(" "),n=o.length;n--;){var s=o[n];if("click"==s)this.$element.on("click."+this.type,this.options.selector,g.proxy(this.toggle,this));else if("manual"!=s){var a="hover"==s?"mouseenter":"focusin",r="hover"==s?"mouseleave":"focusout";this.$element.on(a+"."+this.type,this.options.selector,g.proxy(this.enter,this)),this.$element.on(r+"."+this.type,this.options.selector,g.proxy(this.leave,this))}}this.options.selector?this._options=g.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},m.prototype.getDefaults=function(){return m.DEFAULTS},m.prototype.getOptions=function(t){var e=this.$element.data();for(var i in e)e.hasOwnProperty(i)&&-1!==g.inArray(i,o)&&delete e[i];return(t=g.extend({},this.getDefaults(),e,t)).delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t.sanitize&&(t.template=n(t.template,t.whiteList,t.sanitizeFn)),t},m.prototype.getDelegateOptions=function(){var i={},o=this.getDefaults();return this._options&&g.each(this._options,function(t,e){o[t]!=e&&(i[t]=e)}),i},m.prototype.enter=function(t){var e=t instanceof this.constructor?t:g(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e)),t instanceof g.Event&&(e.inState["focusin"==t.type?"focus":"hover"]=!0),e.tip().hasClass("in")||"in"==e.hoverState)e.hoverState="in";else{if(clearTimeout(e.timeout),e.hoverState="in",!e.options.delay||!e.options.delay.show)return e.show();e.timeout=setTimeout(function(){"in"==e.hoverState&&e.show()},e.options.delay.show)}},m.prototype.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},m.prototype.leave=function(t){var e=t instanceof this.constructor?t:g(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e)),t instanceof g.Event&&(e.inState["focusout"==t.type?"focus":"hover"]=!1),!e.isInStateTrue()){if(clearTimeout(e.timeout),e.hoverState="out",!e.options.delay||!e.options.delay.hide)return e.hide();e.timeout=setTimeout(function(){"out"==e.hoverState&&e.hide()},e.options.delay.hide)}},m.prototype.show=function(){var t=g.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(t);var e=g.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(t.isDefaultPrevented()||!e)return;var i=this,o=this.tip(),n=this.getUID(this.type);this.setContent(),o.attr("id",n),this.$element.attr("aria-describedby",n),this.options.animation&&o.addClass("fade");var s="function"==typeof this.options.placement?this.options.placement.call(this,o[0],this.$element[0]):this.options.placement,a=/\s?auto?\s?/i,r=a.test(s);r&&(s=s.replace(a,"")||"top"),o.detach().css({top:0,left:0,display:"block"}).addClass(s).data("bs."+this.type,this),this.options.container?o.appendTo(g(document).find(this.options.container)):o.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var l=this.getPosition(),h=o[0].offsetWidth,d=o[0].offsetHeight;if(r){var p=s,c=this.getPosition(this.$viewport);s="bottom"==s&&l.bottom+d>c.bottom?"top":"top"==s&&l.top-dc.width?"left":"left"==s&&l.left-ha.top+a.height&&(n.top=a.top+a.height-l)}else{var h=e.left-s,d=e.left+s+i;ha.right&&(n.left=a.left+a.width-d)}return n},m.prototype.getTitle=function(){var t=this.$element,e=this.options;return t.attr("data-original-title")||("function"==typeof e.title?e.title.call(t[0]):e.title)},m.prototype.getUID=function(t){for(;t+=~~(1e6*Math.random()),document.getElementById(t););return t},m.prototype.tip=function(){if(!this.$tip&&(this.$tip=g(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},m.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},m.prototype.enable=function(){this.enabled=!0},m.prototype.disable=function(){this.enabled=!1},m.prototype.toggleEnabled=function(){this.enabled=!this.enabled},m.prototype.toggle=function(t){var e=this;t&&((e=g(t.currentTarget).data("bs."+this.type))||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e))),t?(e.inState.click=!e.inState.click,e.isInStateTrue()?e.enter(e):e.leave(e)):e.tip().hasClass("in")?e.leave(e):e.enter(e)},m.prototype.destroy=function(){var t=this;clearTimeout(this.timeout),this.hide(function(){t.$element.off("."+t.type).removeData("bs."+t.type),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null,t.$element=null})},m.prototype.sanitizeHtml=function(t){return n(t,this.options.whiteList,this.options.sanitizeFn)};var e=g.fn.tooltip;g.fn.tooltip=function i(o){return this.each(function(){var t=g(this),e=t.data("bs.tooltip"),i="object"==typeof o&&o;!e&&/destroy|hide/.test(o)||(e||t.data("bs.tooltip",e=new m(this,i)),"string"==typeof o&&e[o]())})},g.fn.tooltip.Constructor=m,g.fn.tooltip.noConflict=function(){return g.fn.tooltip=e,this}}(jQuery),function(n){"use strict";var s=function(t,e){this.init("popover",t,e)};if(!n.fn.tooltip)throw new Error("Popover requires tooltip.js");s.VERSION="3.4.1",s.DEFAULTS=n.extend({},n.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:''}),((s.prototype=n.extend({},n.fn.tooltip.Constructor.prototype)).constructor=s).prototype.getDefaults=function(){return s.DEFAULTS},s.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),i=this.getContent();if(this.options.html){var o=typeof i;this.options.sanitize&&(e=this.sanitizeHtml(e),"string"===o&&(i=this.sanitizeHtml(i))),t.find(".popover-title").html(e),t.find(".popover-content").children().detach().end()["string"===o?"html":"append"](i)}else t.find(".popover-title").text(e),t.find(".popover-content").children().detach().end().text(i);t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},s.prototype.hasContent=function(){return this.getTitle()||this.getContent()},s.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},s.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var t=n.fn.popover;n.fn.popover=function e(o){return this.each(function(){var t=n(this),e=t.data("bs.popover"),i="object"==typeof o&&o;!e&&/destroy|hide/.test(o)||(e||t.data("bs.popover",e=new s(this,i)),"string"==typeof o&&e[o]())})},n.fn.popover.Constructor=s,n.fn.popover.noConflict=function(){return n.fn.popover=t,this}}(jQuery),function(s){"use strict";function n(t,e){this.$body=s(document.body),this.$scrollElement=s(t).is(document.body)?s(window):s(t),this.options=s.extend({},n.DEFAULTS,e),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",s.proxy(this.process,this)),this.refresh(),this.process()}function e(o){return this.each(function(){var t=s(this),e=t.data("bs.scrollspy"),i="object"==typeof o&&o;e||t.data("bs.scrollspy",e=new n(this,i)),"string"==typeof o&&e[o]()})}n.VERSION="3.4.1",n.DEFAULTS={offset:10},n.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},n.prototype.refresh=function(){var t=this,o="offset",n=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),s.isWindow(this.$scrollElement[0])||(o="position",n=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var t=s(this),e=t.data("target")||t.attr("href"),i=/^#./.test(e)&&s(e);return i&&i.length&&i.is(":visible")&&[[i[o]().top+n,e]]||null}).sort(function(t,e){return t[0]-e[0]}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},n.prototype.process=function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,i=this.getScrollHeight(),o=this.options.offset+i-this.$scrollElement.height(),n=this.offsets,s=this.targets,a=this.activeTarget;if(this.scrollHeight!=i&&this.refresh(),o<=e)return a!=(t=s[s.length-1])&&this.activate(t);if(a&&e=n[t]&&(n[t+1]===undefined||e .active"),n=i&&r.support.transition&&(o.length&&o.hasClass("fade")||!!e.find("> .fade").length);function s(){o.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),t.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),n?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu").length&&t.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),i&&i()}o.length&&n?o.one("bsTransitionEnd",s).emulateTransitionEnd(a.TRANSITION_DURATION):s(),o.removeClass("in")};var t=r.fn.tab;r.fn.tab=e,r.fn.tab.Constructor=a,r.fn.tab.noConflict=function(){return r.fn.tab=t,this};var i=function(t){t.preventDefault(),e.call(r(this),"show")};r(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',i).on("click.bs.tab.data-api",'[data-toggle="pill"]',i)}(jQuery),function(l){"use strict";var h=function(t,e){this.options=l.extend({},h.DEFAULTS,e);var i=this.options.target===h.DEFAULTS.target?l(this.options.target):l(document).find(this.options.target);this.$target=i.on("scroll.bs.affix.data-api",l.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",l.proxy(this.checkPositionWithEventLoop,this)),this.$element=l(t),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};function i(o){return this.each(function(){var t=l(this),e=t.data("bs.affix"),i="object"==typeof o&&o;e||t.data("bs.affix",e=new h(this,i)),"string"==typeof o&&e[o]()})}h.VERSION="3.4.1",h.RESET="affix affix-top affix-bottom",h.DEFAULTS={offset:0,target:window},h.prototype.getState=function(t,e,i,o){var n=this.$target.scrollTop(),s=this.$element.offset(),a=this.$target.height();if(null!=i&&"top"==this.affixed)return nthis.$items.length-1||t<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){e.to(t)}):i==t?this.pause().cycle():this.slide(idocument.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&t?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!t?this.scrollbarWidth:""})},s.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},s.prototype.checkScrollbar=function(){var t=window.innerWidth;if(!t){var e=document.documentElement.getBoundingClientRect();t=e.right-Math.abs(e.left)}this.bodyIsOverflowing=document.body.clientWidth
',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0},sanitize:!0,sanitizeFn:null,whiteList:t},m.prototype.init=function(t,e,i){if(this.enabled=!0,this.type=t,this.$element=g(e),this.options=this.getOptions(i),this.$viewport=this.options.viewport&&g(document).find(g.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var o=this.options.trigger.split(" "),n=o.length;n--;){var s=o[n];if("click"==s)this.$element.on("click."+this.type,this.options.selector,g.proxy(this.toggle,this));else if("manual"!=s){var a="hover"==s?"mouseenter":"focusin",r="hover"==s?"mouseleave":"focusout";this.$element.on(a+"."+this.type,this.options.selector,g.proxy(this.enter,this)),this.$element.on(r+"."+this.type,this.options.selector,g.proxy(this.leave,this))}}this.options.selector?this._options=g.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},m.prototype.getDefaults=function(){return m.DEFAULTS},m.prototype.getOptions=function(t){var e=this.$element.data();for(var i in e)e.hasOwnProperty(i)&&-1!==g.inArray(i,o)&&delete e[i];return(t=g.extend({},this.getDefaults(),e,t)).delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t.sanitize&&(t.template=n(t.template,t.whiteList,t.sanitizeFn)),t},m.prototype.getDelegateOptions=function(){var i={},o=this.getDefaults();return this._options&&g.each(this._options,function(t,e){o[t]!=e&&(i[t]=e)}),i},m.prototype.enter=function(t){var e=t instanceof this.constructor?t:g(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e)),t instanceof g.Event&&(e.inState["focusin"==t.type?"focus":"hover"]=!0),e.tip().hasClass("in")||"in"==e.hoverState)e.hoverState="in";else{if(clearTimeout(e.timeout),e.hoverState="in",!e.options.delay||!e.options.delay.show)return e.show();e.timeout=setTimeout(function(){"in"==e.hoverState&&e.show()},e.options.delay.show)}},m.prototype.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},m.prototype.leave=function(t){var e=t instanceof this.constructor?t:g(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e)),t instanceof g.Event&&(e.inState["focusout"==t.type?"focus":"hover"]=!1),!e.isInStateTrue()){if(clearTimeout(e.timeout),e.hoverState="out",!e.options.delay||!e.options.delay.hide)return e.hide();e.timeout=setTimeout(function(){"out"==e.hoverState&&e.hide()},e.options.delay.hide)}},m.prototype.show=function(){var t=g.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(t);var e=g.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(t.isDefaultPrevented()||!e)return;var i=this,o=this.tip(),n=this.getUID(this.type);this.setContent(),o.attr("id",n),this.$element.attr("aria-describedby",n),this.options.animation&&o.addClass("fade");var s="function"==typeof this.options.placement?this.options.placement.call(this,o[0],this.$element[0]):this.options.placement,a=/\s?auto?\s?/i,r=a.test(s);r&&(s=s.replace(a,"")||"top"),o.detach().css({top:0,left:0,display:"block"}).addClass(s).data("bs."+this.type,this),this.options.container?o.appendTo(g(document).find(this.options.container)):o.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var l=this.getPosition(),h=o[0].offsetWidth,d=o[0].offsetHeight;if(r){var p=s,c=this.getPosition(this.$viewport);s="bottom"==s&&l.bottom+d>c.bottom?"top":"top"==s&&l.top-dc.width?"left":"left"==s&&l.left-ha.top+a.height&&(n.top=a.top+a.height-l)}else{var h=e.left-s,d=e.left+s+i;ha.right&&(n.left=a.left+a.width-d)}return n},m.prototype.getTitle=function(){var t=this.$element,e=this.options;return t.attr("data-original-title")||("function"==typeof e.title?e.title.call(t[0]):e.title)},m.prototype.getUID=function(t){for(;t+=~~(1e6*Math.random()),document.getElementById(t););return t},m.prototype.tip=function(){if(!this.$tip&&(this.$tip=g(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},m.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},m.prototype.enable=function(){this.enabled=!0},m.prototype.disable=function(){this.enabled=!1},m.prototype.toggleEnabled=function(){this.enabled=!this.enabled},m.prototype.toggle=function(t){var e=this;t&&((e=g(t.currentTarget).data("bs."+this.type))||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e))),t?(e.inState.click=!e.inState.click,e.isInStateTrue()?e.enter(e):e.leave(e)):e.tip().hasClass("in")?e.leave(e):e.enter(e)},m.prototype.destroy=function(){var t=this;clearTimeout(this.timeout),this.hide(function(){t.$element.off("."+t.type).removeData("bs."+t.type),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null,t.$element=null})},m.prototype.sanitizeHtml=function(t){return n(t,this.options.whiteList,this.options.sanitizeFn)};var e=g.fn.tooltip;g.fn.tooltip=function i(o){return this.each(function(){var t=g(this),e=t.data("bs.tooltip"),i="object"==typeof o&&o;!e&&/destroy|hide/.test(o)||(e||t.data("bs.tooltip",e=new m(this,i)),"string"==typeof o&&e[o]())})},g.fn.tooltip.Constructor=m,g.fn.tooltip.noConflict=function(){return g.fn.tooltip=e,this}}(jQuery),function(n){"use strict";var s=function(t,e){this.init("popover",t,e)};if(!n.fn.tooltip)throw new Error("Popover requires tooltip.js");s.VERSION="3.4.1",s.DEFAULTS=n.extend({},n.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:''}),((s.prototype=n.extend({},n.fn.tooltip.Constructor.prototype)).constructor=s).prototype.getDefaults=function(){return s.DEFAULTS},s.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),i=this.getContent();if(this.options.html){var o=typeof i;this.options.sanitize&&(e=this.sanitizeHtml(e),"string"===o&&(i=this.sanitizeHtml(i))),t.find(".popover-title").html(e),t.find(".popover-content").children().detach().end()["string"===o?"html":"append"](i)}else t.find(".popover-title").text(e),t.find(".popover-content").children().detach().end().text(i);t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},s.prototype.hasContent=function(){return this.getTitle()||this.getContent()},s.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},s.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var t=n.fn.popover;n.fn.popover=function e(o){return this.each(function(){var t=n(this),e=t.data("bs.popover"),i="object"==typeof o&&o;!e&&/destroy|hide/.test(o)||(e||t.data("bs.popover",e=new s(this,i)),"string"==typeof o&&e[o]())})},n.fn.popover.Constructor=s,n.fn.popover.noConflict=function(){return n.fn.popover=t,this}}(jQuery),function(s){"use strict";function n(t,e){this.$body=s(document.body),this.$scrollElement=s(t).is(document.body)?s(window):s(t),this.options=s.extend({},n.DEFAULTS,e),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",s.proxy(this.process,this)),this.refresh(),this.process()}function e(o){return this.each(function(){var t=s(this),e=t.data("bs.scrollspy"),i="object"==typeof o&&o;e||t.data("bs.scrollspy",e=new n(this,i)),"string"==typeof o&&e[o]()})}n.VERSION="3.4.1",n.DEFAULTS={offset:10},n.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},n.prototype.refresh=function(){var t=this,o="offset",n=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),s.isWindow(this.$scrollElement[0])||(o="position",n=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var t=s(this),e=t.data("target")||t.attr("href"),i=/^#./.test(e)&&s(e);return i&&i.length&&i.is(":visible")&&[[i[o]().top+n,e]]||null}).sort(function(t,e){return t[0]-e[0]}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},n.prototype.process=function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,i=this.getScrollHeight(),o=this.options.offset+i-this.$scrollElement.height(),n=this.offsets,s=this.targets,a=this.activeTarget;if(this.scrollHeight!=i&&this.refresh(),o<=e)return a!=(t=s[s.length-1])&&this.activate(t);if(a&&e=n[t]&&(n[t+1]===undefined||e .active"),n=i&&r.support.transition&&(o.length&&o.hasClass("fade")||!!e.find("> .fade").length);function s(){o.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),t.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),n?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu").length&&t.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),i&&i()}o.length&&n?o.one("bsTransitionEnd",s).emulateTransitionEnd(a.TRANSITION_DURATION):s(),o.removeClass("in")};var t=r.fn.tab;r.fn.tab=e,r.fn.tab.Constructor=a,r.fn.tab.noConflict=function(){return r.fn.tab=t,this};var i=function(t){t.preventDefault(),e.call(r(this),"show")};r(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',i).on("click.bs.tab.data-api",'[data-toggle="pill"]',i)}(jQuery),function(l){"use strict";var h=function(t,e){this.options=l.extend({},h.DEFAULTS,e);var i=this.options.target===h.DEFAULTS.target?l(this.options.target):l(document).find(this.options.target);this.$target=i.on("scroll.bs.affix.data-api",l.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",l.proxy(this.checkPositionWithEventLoop,this)),this.$element=l(t),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};function i(o){return this.each(function(){var t=l(this),e=t.data("bs.affix"),i="object"==typeof o&&o;e||t.data("bs.affix",e=new h(this,i)),"string"==typeof o&&e[o]()})}h.VERSION="3.4.1",h.RESET="affix affix-top affix-bottom",h.DEFAULTS={offset:0,target:window},h.prototype.getState=function(t,e,i,o){var n=this.$target.scrollTop(),s=this.$element.offset(),a=this.$target.height();if(null!=i&&"top"==this.affixed)return n= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};b.REVISION_CHANGES=q;var r="[object Object]";d.prototype={constructor:d,logger:l["default"],log:l["default"].log,registerHelper:function(a,b){if(f.toString.call(a)===r){if(b)throw new h["default"]("Arg not supported with multiple helpers");f.extend(this.helpers,a)}else this.helpers[a]=b},unregisterHelper:function(a){delete this.helpers[a]},registerPartial:function(a,b){if(f.toString.call(a)===r)f.extend(this.partials,a);else{if("undefined"==typeof b)throw new h["default"]('Attempting to register a partial called "'+a+'" as undefined');this.partials[a]=b}},unregisterPartial:function(a){delete this.partials[a]},registerDecorator:function(a,b){if(f.toString.call(a)===r){if(b)throw new h["default"]("Arg not supported with multiple decorators");f.extend(this.decorators,a)}else this.decorators[a]=b},unregisterDecorator:function(a){delete this.decorators[a]},resetLoggedPropertyAccesses:function(){m.resetLoggedProperties()}};var s=l["default"].log;b.log=s,b.createFrame=f.createFrame,b.logger=l["default"]},function(a,b){"use strict";function c(a){return k[a]}function d(a){for(var b=1;b":">",'"':""","'":"'","`":"`","=":"="},l=/[&<>"'`=]/g,m=/[&<>"'`=]/,n=Object.prototype.toString;b.toString=n;var o=function(a){return"function"==typeof a};o(/x/)&&(b.isFunction=o=function(a){return"function"==typeof a&&"[object Function]"===n.call(a)}),b.isFunction=o;var p=Array.isArray||function(a){return!(!a||"object"!=typeof a)&&"[object Array]"===n.call(a)};b.isArray=p},function(a,b,c){"use strict";function d(a,b){var c=b&&b.loc,g=void 0,h=void 0,i=void 0,j=void 0;c&&(g=c.start.line,h=c.end.line,i=c.start.column,j=c.end.column,a+=" - "+g+":"+i);for(var k=Error.prototype.constructor.call(this,a),l=0;l0?(c.ids&&(c.ids=[c.name]),a.helpers.each(b,c)):e(this);if(c.data&&c.ids){var g=d.createFrame(c.data);g.contextPath=d.appendContextPath(c.data.contextPath,c.name),c={data:g}}return f(b,c)})},a.exports=b["default"]},function(a,b,c){(function(d){"use strict";var e=c(13)["default"],f=c(1)["default"];b.__esModule=!0;var g=c(5),h=c(6),i=f(h);b["default"]=function(a){a.registerHelper("each",function(a,b){function c(b,c,d){l&&(l.key=b,l.index=c,l.first=0===c,l.last=!!d,m&&(l.contextPath=m+b)),k+=f(a[b],{data:l,blockParams:g.blockParams([a[b],b],[m+b,null])})}if(!b)throw new i["default"]("Must pass iterator to #each");var f=b.fn,h=b.inverse,j=0,k="",l=void 0,m=void 0;if(b.data&&b.ids&&(m=g.appendContextPath(b.data.contextPath,b.ids[0])+"."),g.isFunction(a)&&(a=a.call(this)),b.data&&(l=g.createFrame(b.data)),a&&"object"==typeof a)if(g.isArray(a))for(var n=a.length;j=0?b:parseInt(a,10)}return a},log:function(a){if(a=e.lookupLevel(a),"undefined"!=typeof console&&e.lookupLevel(e.level)<=a){var b=e.methodMap[a];console[b]||(b="log");for(var c=arguments.length,d=Array(c>1?c-1:0),f=1;f=v.LAST_COMPATIBLE_COMPILER_REVISION&&b<=v.COMPILER_REVISION)){if(b2&&v.push("'"+this.terminals_[s]+"'");x=this.lexer.showPosition?"Parse error on line "+(i+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+v.join(", ")+", got '"+(this.terminals_[n]||n)+"'":"Parse error on line "+(i+1)+": Unexpected "+(1==n?"end of input":"'"+(this.terminals_[n]||n)+"'"),this.parseError(x,{text:this.lexer.match,token:this.terminals_[n]||n,line:this.lexer.yylineno,loc:l,expected:v})}}if(q[0]instanceof Array&&q.length>1)throw new Error("Parse Error: multiple actions possible at state: "+p+", token: "+n);switch(q[0]){case 1:d.push(n),e.push(this.lexer.yytext),f.push(this.lexer.yylloc),d.push(q[1]),n=null,o?(n=o,o=null):(j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,l=this.lexer.yylloc,k>0&&k--);break;case 2:if(t=this.productions_[q[1]][1],w.$=e[e.length-t],w._$={first_line:f[f.length-(t||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(t||1)].first_column,last_column:f[f.length-1].last_column},m&&(w._$.range=[f[f.length-(t||1)].range[0],f[f.length-1].range[1]]),r=this.performAction.call(w,h,j,i,this.yy,q[1],e,f),"undefined"!=typeof r)return r;t&&(d=d.slice(0,-1*t*2),e=e.slice(0,-1*t),f=f.slice(0,-1*t)),d.push(this.productions_[q[1]][0]),e.push(w.$),f.push(w._$),u=g[d[d.length-2]][d[d.length-1]],d.push(u);break;case 3:return!0}}return!0}},c=function(){var a={EOF:1,parseError:function(a,b){if(!this.yy.parser)throw new Error(a);this.yy.parser.parseError(a,b)},setInput:function(a){return this._input=a,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var b=a.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b-1),this.offset-=b;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-b]),this},more:function(){return this._more=!0,this},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=new Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d,e;this._more||(this.yytext="",this.match="");for(var f=this._currentRules(),g=0;gb[0].length)||(b=c,d=g,this.options.flex));g++);return b?(e=b[0].match(/(?:\r\n?|\n).*/g),e&&(this.yylineno+=e.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:e?e[e.length-1].length-e[e.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+b[0].length},this.yytext+=b[0],this.match+=b[0],this.matches=b,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(b[0].length),this.matched+=b[0],a=this.performAction.call(this,this.yy,this,f[d],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),a?a:void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return"undefined"!=typeof a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(a){this.begin(a)}};return a.options={},a.performAction=function(a,b,c,d){function e(a,c){return b.yytext=b.yytext.substring(a,b.yyleng-c+a)}switch(c){case 0:if("\\\\"===b.yytext.slice(-2)?(e(0,1),this.begin("mu")):"\\"===b.yytext.slice(-1)?(e(0,1),this.begin("emu")):this.begin("mu"),b.yytext)return 15;break;case 1:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),"raw"===this.conditionStack[this.conditionStack.length-1]?15:(e(5,9),"END_RAW_BLOCK");case 5:return 15;case 6:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:return this.popState(),44;case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:return 48;case 21:this.unput(b.yytext),this.popState(),this.begin("com");break;case 22:return this.popState(),14;case 23:return 48;case 24:return 73;case 25:return 72;case 26:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return b.yytext=e(1,2).replace(/\\"/g,'"'),80;case 32:return b.yytext=e(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:return 82;case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 41:return 72;case 42:return b.yytext=b.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},a.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^\/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],a.conditions={mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}},a}();return b.lexer=c,a.prototype=b,b.Parser=a,new a}();b["default"]=c,a.exports=b["default"]},function(a,b,c){"use strict";function d(){var a=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.options=a}function e(a,b,c){void 0===b&&(b=a.length);var d=a[b-1],e=a[b-2];return d?"ContentStatement"===d.type?(e||!c?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(d.original):void 0:c}function f(a,b,c){void 0===b&&(b=-1);var d=a[b+1],e=a[b+2];return d?"ContentStatement"===d.type?(e||!c?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(d.original):void 0:c}function g(a,b,c){var d=a[null==b?0:b+1];if(d&&"ContentStatement"===d.type&&(c||!d.rightStripped)){var e=d.value;d.value=d.value.replace(c?/^\s+/:/^[ \t]*\r?\n?/,""),d.rightStripped=d.value!==e}}function h(a,b,c){var d=a[null==b?a.length-1:b-1];if(d&&"ContentStatement"===d.type&&(c||!d.leftStripped)){var e=d.value;return d.value=d.value.replace(c?/\s+$/:/[ \t]+$/,""),d.leftStripped=d.value!==e,d.leftStripped}}var i=c(1)["default"];b.__esModule=!0;var j=c(49),k=i(j);d.prototype=new k["default"],d.prototype.Program=function(a){var b=!this.options.ignoreStandalone,c=!this.isRootSeen;this.isRootSeen=!0;for(var d=a.body,i=0,j=d.length;i0)throw new q["default"]("Invalid path: "+d,{loc:c});".."===i&&f++}}return{type:"PathExpression",data:a,depth:f,parts:e,original:d,loc:c}}function j(a,b,c,d,e,f){var g=d.charAt(3)||d.charAt(2),h="{"!==g&&"&"!==g,i=/\*/.test(d);return{type:i?"Decorator":"MustacheStatement",path:a,params:b,hash:c,escaped:h,strip:e,loc:this.locInfo(f)}}function k(a,b,c,e){d(a,c),e=this.locInfo(e);var f={type:"Program",body:b,strip:{},loc:e};return{type:"BlockStatement",path:a.path,params:a.params,hash:a.hash,program:f,openStrip:{},inverseStrip:{},closeStrip:{},loc:e}}function l(a,b,c,e,f,g){e&&e.path&&d(a,e);var h=/\*/.test(a.open);b.blockParams=a.blockParams;var i=void 0,j=void 0;if(c){if(h)throw new q["default"]("Unexpected inverse block on decorator",c);c.chain&&(c.program.body[0].closeStrip=e.strip),j=c.strip,i=c.program}return f&&(f=i,i=b,b=f),{type:h?"DecoratorBlock":"BlockStatement",path:a.path,params:a.params,hash:a.hash,program:b,inverse:i,openStrip:a.strip,inverseStrip:j,closeStrip:e&&e.strip,loc:this.locInfo(g)}}function m(a,b){if(!b&&a.length){var c=a[0].loc,d=a[a.length-1].loc;c&&d&&(b={source:c.source,start:{line:c.start.line,column:c.start.column},end:{line:d.end.line,column:d.end.column}})}return{type:"Program",body:a,strip:{},loc:b}}function n(a,b,c,e){return d(a,c),{type:"PartialBlockStatement",name:a.path,params:a.params,hash:a.hash,program:b,openStrip:a.strip,closeStrip:c&&c.strip,loc:this.locInfo(e)}}var o=c(1)["default"];b.__esModule=!0,b.SourceLocation=e,b.id=f,b.stripFlags=g,b.stripComment=h,b.preparePath=i,b.prepareMustache=j,b.prepareRawBlock=k,b.prepareBlock=l,b.prepareProgram=m,b.preparePartialBlock=n;var p=c(6),q=o(p)},function(a,b,c){"use strict";function d(){}function e(a,b,c){if(null==a||"string"!=typeof a&&"Program"!==a.type)throw new l["default"]("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+a);b=b||{},"data"in b||(b.data=!0),b.compat&&(b.useDepths=!0);var d=c.parse(a,b),e=(new c.Compiler).compile(d,b);return(new c.JavaScriptCompiler).compile(e,b)}function f(a,b,c){function d(){var d=c.parse(a,b),e=(new c.Compiler).compile(d,b),f=(new c.JavaScriptCompiler).compile(e,b,void 0,!0);return c.template(f)}function e(a,b){return f||(f=d()),f.call(this,a,b)}if(void 0===b&&(b={}),null==a||"string"!=typeof a&&"Program"!==a.type)throw new l["default"]("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+a);b=m.extend({},b),"data"in b||(b.data=!0),b.compat&&(b.useDepths=!0);var f=void 0;return e._setup=function(a){return f||(f=d()),f._setup(a)},e._child=function(a,b,c,e){return f||(f=d()),f._child(a,b,c,e)},e}function g(a,b){if(a===b)return!0;if(m.isArray(a)&&m.isArray(b)&&a.length===b.length){for(var c=0;c1)throw new l["default"]("Unsupported number of partial arguments: "+c.length,a);c.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):c.push({type:"PathExpression",parts:[],depth:0}));var d=a.name.original,e="SubExpression"===a.name.type;e&&this.accept(a.name),this.setupFullMustacheParams(a,b,void 0,!0);var f=a.indent||"";this.options.preventIndent&&f&&(this.opcode("appendContent",f),f=""),this.opcode("invokePartial",e,d,f),this.opcode("append")},PartialBlockStatement:function(a){this.PartialStatement(a)},MustacheStatement:function(a){this.SubExpression(a),a.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function(a){this.DecoratorBlock(a)},ContentStatement:function(a){a.value&&this.opcode("appendContent",a.value)},CommentStatement:function(){},SubExpression:function(a){h(a);var b=this.classifySexpr(a);"simple"===b?this.simpleSexpr(a):"helper"===b?this.helperSexpr(a):this.ambiguousSexpr(a)},ambiguousSexpr:function(a,b,c){var d=a.path,e=d.parts[0],f=null!=b||null!=c;this.opcode("getContext",d.depth),this.opcode("pushProgram",b),this.opcode("pushProgram",c),d.strict=!0,this.accept(d),this.opcode("invokeAmbiguous",e,f)},simpleSexpr:function(a){var b=a.path;b.strict=!0,this.accept(b),this.opcode("resolvePossibleLambda")},helperSexpr:function(a,b,c){var d=this.setupFullMustacheParams(a,b,c),e=a.path,f=e.parts[0];if(this.options.knownHelpers[f])this.opcode("invokeKnownHelper",d.length,f);else{if(this.options.knownHelpersOnly)throw new l["default"]("You specified knownHelpersOnly, but used the unknown helper "+f,a);e.strict=!0,e.falsy=!0,this.accept(e),this.opcode("invokeHelper",d.length,e.original,o["default"].helpers.simpleId(e))}},PathExpression:function(a){this.addDepth(a.depth),this.opcode("getContext",a.depth);var b=a.parts[0],c=o["default"].helpers.scopedId(a),d=!a.depth&&!c&&this.blockParamIndex(b);d?this.opcode("lookupBlockParam",d,a.parts):b?a.data?(this.options.data=!0,this.opcode("lookupData",a.depth,a.parts,a.strict)):this.opcode("lookupOnContext",a.parts,a.falsy,a.strict,c):this.opcode("pushContext")},StringLiteral:function(a){this.opcode("pushString",a.value)},NumberLiteral:function(a){this.opcode("pushLiteral",a.value)},BooleanLiteral:function(a){this.opcode("pushLiteral",a.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(a){var b=a.pairs,c=0,d=b.length;for(this.opcode("pushHash");c=0)return[b,e]}}}},function(a,b,c){"use strict";function d(a){this.value=a}function e(){}function f(a,b,c,d){var e=b.popStack(),f=0,g=c.length;for(a&&g--;f= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};b.REVISION_CHANGES=q;var r="[object Object]";d.prototype={constructor:d,logger:l["default"],log:l["default"].log,registerHelper:function(a,b){if(f.toString.call(a)===r){if(b)throw new h["default"]("Arg not supported with multiple helpers");f.extend(this.helpers,a)}else this.helpers[a]=b},unregisterHelper:function(a){delete this.helpers[a]},registerPartial:function(a,b){if(f.toString.call(a)===r)f.extend(this.partials,a);else{if("undefined"==typeof b)throw new h["default"]('Attempting to register a partial called "'+a+'" as undefined');this.partials[a]=b}},unregisterPartial:function(a){delete this.partials[a]},registerDecorator:function(a,b){if(f.toString.call(a)===r){if(b)throw new h["default"]("Arg not supported with multiple decorators");f.extend(this.decorators,a)}else this.decorators[a]=b},unregisterDecorator:function(a){delete this.decorators[a]},resetLoggedPropertyAccesses:function(){m.resetLoggedProperties()}};var s=l["default"].log;b.log=s,b.createFrame=f.createFrame,b.logger=l["default"]},function(a,b){"use strict";function c(a){return k[a]}function d(a){for(var b=1;b":">",'"':""","'":"'","`":"`","=":"="},l=/[&<>"'`=]/g,m=/[&<>"'`=]/,n=Object.prototype.toString;b.toString=n;var o=function(a){return"function"==typeof a};o(/x/)&&(b.isFunction=o=function(a){return"function"==typeof a&&"[object Function]"===n.call(a)}),b.isFunction=o;var p=Array.isArray||function(a){return!(!a||"object"!=typeof a)&&"[object Array]"===n.call(a)};b.isArray=p},function(a,b,c){"use strict";function d(a,b){var c=b&&b.loc,g=void 0,h=void 0,i=void 0,j=void 0;c&&(g=c.start.line,h=c.end.line,i=c.start.column,j=c.end.column,a+=" - "+g+":"+i);for(var k=Error.prototype.constructor.call(this,a),l=0;l0?(c.ids&&(c.ids=[c.name]),a.helpers.each(b,c)):e(this);if(c.data&&c.ids){var g=d.createFrame(c.data);g.contextPath=d.appendContextPath(c.data.contextPath,c.name),c={data:g}}return f(b,c)})},a.exports=b["default"]},function(a,b,c){(function(d){"use strict";var e=c(13)["default"],f=c(1)["default"];b.__esModule=!0;var g=c(5),h=c(6),i=f(h);b["default"]=function(a){a.registerHelper("each",function(a,b){function c(b,c,d){l&&(l.key=b,l.index=c,l.first=0===c,l.last=!!d,m&&(l.contextPath=m+b)),k+=f(a[b],{data:l,blockParams:g.blockParams([a[b],b],[m+b,null])})}if(!b)throw new i["default"]("Must pass iterator to #each");var f=b.fn,h=b.inverse,j=0,k="",l=void 0,m=void 0;if(b.data&&b.ids&&(m=g.appendContextPath(b.data.contextPath,b.ids[0])+"."),g.isFunction(a)&&(a=a.call(this)),b.data&&(l=g.createFrame(b.data)),a&&"object"==typeof a)if(g.isArray(a))for(var n=a.length;j=0?b:parseInt(a,10)}return a},log:function(a){if(a=e.lookupLevel(a),"undefined"!=typeof console&&e.lookupLevel(e.level)<=a){var b=e.methodMap[a];console[b]||(b="log");for(var c=arguments.length,d=Array(c>1?c-1:0),f=1;f=v.LAST_COMPATIBLE_COMPILER_REVISION&&b<=v.COMPILER_REVISION)){if(b2&&v.push("'"+this.terminals_[s]+"'");x=this.lexer.showPosition?"Parse error on line "+(i+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+v.join(", ")+", got '"+(this.terminals_[n]||n)+"'":"Parse error on line "+(i+1)+": Unexpected "+(1==n?"end of input":"'"+(this.terminals_[n]||n)+"'"),this.parseError(x,{text:this.lexer.match,token:this.terminals_[n]||n,line:this.lexer.yylineno,loc:l,expected:v})}}if(q[0]instanceof Array&&q.length>1)throw new Error("Parse Error: multiple actions possible at state: "+p+", token: "+n);switch(q[0]){case 1:d.push(n),e.push(this.lexer.yytext),f.push(this.lexer.yylloc),d.push(q[1]),n=null,o?(n=o,o=null):(j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,l=this.lexer.yylloc,k>0&&k--);break;case 2:if(t=this.productions_[q[1]][1],w.$=e[e.length-t],w._$={first_line:f[f.length-(t||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(t||1)].first_column,last_column:f[f.length-1].last_column},m&&(w._$.range=[f[f.length-(t||1)].range[0],f[f.length-1].range[1]]),r=this.performAction.call(w,h,j,i,this.yy,q[1],e,f),"undefined"!=typeof r)return r;t&&(d=d.slice(0,-1*t*2),e=e.slice(0,-1*t),f=f.slice(0,-1*t)),d.push(this.productions_[q[1]][0]),e.push(w.$),f.push(w._$),u=g[d[d.length-2]][d[d.length-1]],d.push(u);break;case 3:return!0}}return!0}},c=function(){var a={EOF:1,parseError:function(a,b){if(!this.yy.parser)throw new Error(a);this.yy.parser.parseError(a,b)},setInput:function(a){return this._input=a,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var b=a.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b-1),this.offset-=b;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-b]),this},more:function(){return this._more=!0,this},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=new Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d,e;this._more||(this.yytext="",this.match="");for(var f=this._currentRules(),g=0;gb[0].length)||(b=c,d=g,this.options.flex));g++);return b?(e=b[0].match(/(?:\r\n?|\n).*/g),e&&(this.yylineno+=e.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:e?e[e.length-1].length-e[e.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+b[0].length},this.yytext+=b[0],this.match+=b[0],this.matches=b,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(b[0].length),this.matched+=b[0],a=this.performAction.call(this,this.yy,this,f[d],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),a?a:void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return"undefined"!=typeof a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(a){this.begin(a)}};return a.options={},a.performAction=function(a,b,c,d){function e(a,c){return b.yytext=b.yytext.substring(a,b.yyleng-c+a)}switch(c){case 0:if("\\\\"===b.yytext.slice(-2)?(e(0,1),this.begin("mu")):"\\"===b.yytext.slice(-1)?(e(0,1),this.begin("emu")):this.begin("mu"),b.yytext)return 15;break;case 1:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),"raw"===this.conditionStack[this.conditionStack.length-1]?15:(e(5,9),"END_RAW_BLOCK");case 5:return 15;case 6:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:return this.popState(),44;case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:return 48;case 21:this.unput(b.yytext),this.popState(),this.begin("com");break;case 22:return this.popState(),14;case 23:return 48;case 24:return 73;case 25:return 72;case 26:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return b.yytext=e(1,2).replace(/\\"/g,'"'),80;case 32:return b.yytext=e(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:return 82;case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 41:return 72;case 42:return b.yytext=b.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},a.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^\/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],a.conditions={mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}},a}();return b.lexer=c,a.prototype=b,b.Parser=a,new a}();b["default"]=c,a.exports=b["default"]},function(a,b,c){"use strict";function d(){var a=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.options=a}function e(a,b,c){void 0===b&&(b=a.length);var d=a[b-1],e=a[b-2];return d?"ContentStatement"===d.type?(e||!c?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(d.original):void 0:c}function f(a,b,c){void 0===b&&(b=-1);var d=a[b+1],e=a[b+2];return d?"ContentStatement"===d.type?(e||!c?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(d.original):void 0:c}function g(a,b,c){var d=a[null==b?0:b+1];if(d&&"ContentStatement"===d.type&&(c||!d.rightStripped)){var e=d.value;d.value=d.value.replace(c?/^\s+/:/^[ \t]*\r?\n?/,""),d.rightStripped=d.value!==e}}function h(a,b,c){var d=a[null==b?a.length-1:b-1];if(d&&"ContentStatement"===d.type&&(c||!d.leftStripped)){var e=d.value;return d.value=d.value.replace(c?/\s+$/:/[ \t]+$/,""),d.leftStripped=d.value!==e,d.leftStripped}}var i=c(1)["default"];b.__esModule=!0;var j=c(49),k=i(j);d.prototype=new k["default"],d.prototype.Program=function(a){var b=!this.options.ignoreStandalone,c=!this.isRootSeen;this.isRootSeen=!0;for(var d=a.body,i=0,j=d.length;i0)throw new q["default"]("Invalid path: "+d,{loc:c});".."===i&&f++}}return{type:"PathExpression",data:a,depth:f,parts:e,original:d,loc:c}}function j(a,b,c,d,e,f){var g=d.charAt(3)||d.charAt(2),h="{"!==g&&"&"!==g,i=/\*/.test(d);return{type:i?"Decorator":"MustacheStatement",path:a,params:b,hash:c,escaped:h,strip:e,loc:this.locInfo(f)}}function k(a,b,c,e){d(a,c),e=this.locInfo(e);var f={type:"Program",body:b,strip:{},loc:e};return{type:"BlockStatement",path:a.path,params:a.params,hash:a.hash,program:f,openStrip:{},inverseStrip:{},closeStrip:{},loc:e}}function l(a,b,c,e,f,g){e&&e.path&&d(a,e);var h=/\*/.test(a.open);b.blockParams=a.blockParams;var i=void 0,j=void 0;if(c){if(h)throw new q["default"]("Unexpected inverse block on decorator",c);c.chain&&(c.program.body[0].closeStrip=e.strip),j=c.strip,i=c.program}return f&&(f=i,i=b,b=f),{type:h?"DecoratorBlock":"BlockStatement",path:a.path,params:a.params,hash:a.hash,program:b,inverse:i,openStrip:a.strip,inverseStrip:j,closeStrip:e&&e.strip,loc:this.locInfo(g)}}function m(a,b){if(!b&&a.length){var c=a[0].loc,d=a[a.length-1].loc;c&&d&&(b={source:c.source,start:{line:c.start.line,column:c.start.column},end:{line:d.end.line,column:d.end.column}})}return{type:"Program",body:a,strip:{},loc:b}}function n(a,b,c,e){return d(a,c),{type:"PartialBlockStatement",name:a.path,params:a.params,hash:a.hash,program:b,openStrip:a.strip,closeStrip:c&&c.strip,loc:this.locInfo(e)}}var o=c(1)["default"];b.__esModule=!0,b.SourceLocation=e,b.id=f,b.stripFlags=g,b.stripComment=h,b.preparePath=i,b.prepareMustache=j,b.prepareRawBlock=k,b.prepareBlock=l,b.prepareProgram=m,b.preparePartialBlock=n;var p=c(6),q=o(p)},function(a,b,c){"use strict";function d(){}function e(a,b,c){if(null==a||"string"!=typeof a&&"Program"!==a.type)throw new l["default"]("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+a);b=b||{},"data"in b||(b.data=!0),b.compat&&(b.useDepths=!0);var d=c.parse(a,b),e=(new c.Compiler).compile(d,b);return(new c.JavaScriptCompiler).compile(e,b)}function f(a,b,c){function d(){var d=c.parse(a,b),e=(new c.Compiler).compile(d,b),f=(new c.JavaScriptCompiler).compile(e,b,void 0,!0);return c.template(f)}function e(a,b){return f||(f=d()),f.call(this,a,b)}if(void 0===b&&(b={}),null==a||"string"!=typeof a&&"Program"!==a.type)throw new l["default"]("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+a);b=m.extend({},b),"data"in b||(b.data=!0),b.compat&&(b.useDepths=!0);var f=void 0;return e._setup=function(a){return f||(f=d()),f._setup(a)},e._child=function(a,b,c,e){return f||(f=d()),f._child(a,b,c,e)},e}function g(a,b){if(a===b)return!0;if(m.isArray(a)&&m.isArray(b)&&a.length===b.length){for(var c=0;c1)throw new l["default"]("Unsupported number of partial arguments: "+c.length,a);c.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):c.push({type:"PathExpression",parts:[],depth:0});var d=a.name.original,e="SubExpression"===a.name.type;e&&this.accept(a.name),this.setupFullMustacheParams(a,b,void 0,!0);var f=a.indent||"";this.options.preventIndent&&f&&(this.opcode("appendContent",f),f=""),this.opcode("invokePartial",e,d,f),this.opcode("append")},PartialBlockStatement:function(a){this.PartialStatement(a)},MustacheStatement:function(a){this.SubExpression(a),a.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function(a){this.DecoratorBlock(a)},ContentStatement:function(a){a.value&&this.opcode("appendContent",a.value)},CommentStatement:function(){},SubExpression:function(a){h(a);var b=this.classifySexpr(a);"simple"===b?this.simpleSexpr(a):"helper"===b?this.helperSexpr(a):this.ambiguousSexpr(a)},ambiguousSexpr:function(a,b,c){var d=a.path,e=d.parts[0],f=null!=b||null!=c;this.opcode("getContext",d.depth),this.opcode("pushProgram",b),this.opcode("pushProgram",c),d.strict=!0,this.accept(d),this.opcode("invokeAmbiguous",e,f)},simpleSexpr:function(a){var b=a.path;b.strict=!0,this.accept(b),this.opcode("resolvePossibleLambda")},helperSexpr:function(a,b,c){var d=this.setupFullMustacheParams(a,b,c),e=a.path,f=e.parts[0];if(this.options.knownHelpers[f])this.opcode("invokeKnownHelper",d.length,f);else{if(this.options.knownHelpersOnly)throw new l["default"]("You specified knownHelpersOnly, but used the unknown helper "+f,a);e.strict=!0,e.falsy=!0,this.accept(e),this.opcode("invokeHelper",d.length,e.original,o["default"].helpers.simpleId(e))}},PathExpression:function(a){this.addDepth(a.depth),this.opcode("getContext",a.depth);var b=a.parts[0],c=o["default"].helpers.scopedId(a),d=!a.depth&&!c&&this.blockParamIndex(b);d?this.opcode("lookupBlockParam",d,a.parts):b?a.data?(this.options.data=!0,this.opcode("lookupData",a.depth,a.parts,a.strict)):this.opcode("lookupOnContext",a.parts,a.falsy,a.strict,c):this.opcode("pushContext")},StringLiteral:function(a){this.opcode("pushString",a.value)},NumberLiteral:function(a){this.opcode("pushLiteral",a.value)},BooleanLiteral:function(a){this.opcode("pushLiteral",a.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(a){var b=a.pairs,c=0,d=b.length;for(this.opcode("pushHash");c=0)return[b,e]}}}},function(a,b,c){"use strict";function d(a){this.value=a}function e(){}function f(a,b,c,d){var e=b.popStack(),f=0,g=c.length;for(a&&g--;f0&&(c+=", "+d.join(", "));var e=0;g(this.aliases).forEach(function(a){var d=b.aliases[a];d.children&&d.referenceCount>1&&(c+=", alias"+ ++e+"="+a,d.children[0]="alias"+e)}),this.lookupPropertyFunctionIsUsed&&(c+=", "+this.lookupPropertyFunctionVarDeclaration());var f=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&f.push("blockParams"),this.useDepths&&f.push("depths");var h=this.mergeSource(c);return a?(f.push(h),Function.apply(this,f)):this.source.wrap(["function(",f.join(","),") {\n ",h,"}"])},mergeSource:function(a){var b=this.environment.isSimple,c=!this.forceBuffer,d=void 0,e=void 0,f=void 0,g=void 0;return this.source.each(function(a){a.appendToBuffer?(f?a.prepend(" + "):f=a,g=a):(f&&(e?f.prepend("buffer += "):d=!0,g.add(";"),f=g=void 0),e=!0,b||(c=!1))}),c?f?(f.prepend("return "),g.add(";")):e||this.source.push('return "";'):(a+=", buffer = "+(d?"":this.initializeBuffer()),f?(f.prepend("return buffer + "),g.add(";")):this.source.push("return buffer;")),a&&this.source.prepend("var "+a.substring(2)+(d?"":";\n")),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){return"\n lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n }\n ".trim()},blockValue:function(a){var b=this.aliasable("container.hooks.blockHelperMissing"),c=[this.contextName(0)];this.setupHelperArgs(a,0,c);var d=this.popStack();c.splice(1,0,d),this.push(this.source.functionCall(b,"call",c))},ambiguousBlockValue:function(){var a=this.aliasable("container.hooks.blockHelperMissing"),b=[this.contextName(0)];this.setupHelperArgs("",0,b,!0),this.flushInline();var c=this.topStack();b.splice(1,0,c),this.pushSource(["if (!",this.lastHelper,") { ",c," = ",this.source.functionCall(a,"call",b),"}"])},appendContent:function(a){this.pendingContent?a=this.pendingContent+a:this.pendingLocation=this.source.currentLocation,this.pendingContent=a},append:function(){if(this.isInline())this.replaceStack(function(a){return[" != null ? ",a,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var a=this.popStack();this.pushSource(["if (",a," != null) { ",this.appendToBuffer(a,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(a){this.lastContext=a},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(a,b,c,d){var e=0;d||!this.options.compat||this.lastContext?this.pushContext():this.push(this.depthedLookup(a[e++])),this.resolvePath("context",a,e,b,c)},lookupBlockParam:function(a,b){this.useBlockParams=!0,this.push(["blockParams[",a[0],"][",a[1],"]"]),this.resolvePath("context",b,1)},lookupData:function(a,b,c){a?this.pushStackLiteral("container.data(data, "+a+")"):this.pushStackLiteral("data"),this.resolvePath("data",b,0,!0,c)},resolvePath:function(a,b,c,d,e){var g=this;if(this.options.strict||this.options.assumeObjects)return void this.push(f(this.options.strict&&e,this,b,a));for(var h=b.length;cthis.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var a=this.inlineStack;this.inlineStack=[];for(var b=0,c=a.length;b+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function D(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||j,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,j=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function qe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function Le(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function He(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Oe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Ut,Xt=[],Vt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||S.expando+"_"+Ct.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(Et.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Ut=E.implementation.createHTMLDocument("").body).innerHTML="
",2===Ut.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):("number"==typeof f.top&&(f.top+="px"),"number"==typeof f.left&&(f.left+="px"),c.css(f))}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=$e(y.pixelPosition,function(e,t){if(t)return t=Be(e,n),Me.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")}),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function D(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||j,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,j=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function qe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function Le(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function He(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Oe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Ut,Xt=[],Vt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||S.expando+"_"+Ct.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(Et.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Ut=E.implementation.createHTMLDocument("").body).innerHTML="
",2===Ut.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):("number"==typeof f.top&&(f.top+="px"),"number"==typeof f.left&&(f.left+="px"),c.css(f))}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=$e(y.pixelPosition,function(e,t){if(t)return t=Be(e,n),Me.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0a))return false; -if((f=u.get(t))&&u.get(e))return f==e;var f=-1,s=true,l=2&r?new y:Ut;for(u.set(t,e),u.set(e,t);++ft)&&(t==e.length-1?e.pop():je.call(e,t,1),--this.size,true)},h.prototype.get=function(t){var e=this.__data__;return t=g(e,t),0>t?Ut:e[t][1]},h.prototype.has=function(t){return-1n?(++this.size,r.push([t,e])):r[n][1]=e,this},p.prototype.clear=function(){this.size=0,this.__data__={hash:new b,map:new(Se||h),string:new b}},p.prototype.delete=function(t){ return t=Z(this,t).delete(t),this.size-=t?1:0,t},p.prototype.get=function(t){return Z(this,t).get(t)},p.prototype.has=function(t){return Z(this,t).has(t)},p.prototype.set=function(t,e){var r=Z(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this},y.prototype.add=y.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},y.prototype.has=function(t){return this.__data__.has(t)},j.prototype.clear=function(){this.__data__=new h,this.size=0},j.prototype.delete=function(t){ var e=this.__data__;return t=e.delete(t),this.size=e.size,t},j.prototype.get=function(t){return this.__data__.get(t)},j.prototype.has=function(t){return this.__data__.has(t)},j.prototype.set=function(t,e){var r=this.__data__;if(r instanceof h){var n=r.__data__;if(!Se||199>n.length)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new p(n)}return r.set(t,e),this.size=r.size,this};var Pe=function(t,e){return function(r,n){if(null==r)return r;if(!yt(r))return t(r,n);for(var o=r.length,c=e?o:-1,u=Object(r);(e?c--:++co?Ut:c,o=1),e=Object(e);++n=l.reach);k+=y.value.length,y=y.next){var b=y.value;if(t.length>n.length)return;if(!(b instanceof W)){var x=1;if(h&&y!=t.tail.prev){m.lastIndex=k;var w=m.exec(n);if(!w)break;var A=w.index+(f&&w[1]?w[1].length:0),P=w.index+w[0].length,S=k;for(S+=y.value.length;S<=A;)y=y.next,S+=y.value.length;if(S-=y.value.length,k=S,y.value instanceof W)continue;for(var E=y;E!==t.tail&&(Sl.reach&&(l.reach=j);var C=y.prev;L&&(C=I(t,C,L),k+=L.length),z(t,C,x);var _=new W(o,g?M.tokenize(O,g):O,v,O);y=I(t,C,_),N&&I(t,y,N),1"+a.content+""},!u.document)return u.addEventListener&&(M.disableWorkerMessageHandler||u.addEventListener("message",function(e){var n=JSON.parse(e.data),t=n.language,r=n.code,a=n.immediateClose;u.postMessage(M.highlight(r,M.languages[t],t)),a&&u.close()},!1)),M;var e=M.util.currentScript();function t(){M.manual||M.highlightAll()}if(e&&(M.filename=e.src,e.hasAttribute("data-manual")&&(M.manual=!0)),!M.manual){var r=document.readyState;"loading"===r||"interactive"===r&&e&&e.defer?document.addEventListener("DOMContentLoaded",t):window.requestAnimationFrame?window.requestAnimationFrame(t):window.setTimeout(t,16)}return M}(_self);"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism); +var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(u){var c=/\blang(?:uage)?-([\w-]+)\b/i,n=0,M={manual:u.Prism&&u.Prism.manual,disableWorkerMessageHandler:u.Prism&&u.Prism.disableWorkerMessageHandler,util:{encode:function e(n){return n instanceof W?new W(n.type,e(n.content),n.alias):Array.isArray(n)?n.map(e):n.replace(/&/g,"&").replace(/=l.reach);k+=y.value.length,y=y.next){var b=y.value;if(t.length>n.length)return;if(!(b instanceof W)){var x=1;if(h&&y!=t.tail.prev){m.lastIndex=k;var w=m.exec(n);if(!w)break;var A=w.index+(f&&w[1]?w[1].length:0),P=w.index+w[0].length,S=k;for(S+=y.value.length;S<=A;)y=y.next,S+=y.value.length;if(S-=y.value.length,k=S,y.value instanceof W)continue;for(var E=y;E!==t.tail&&(Sl.reach&&(l.reach=j);var C=y.prev;L&&(C=I(t,C,L),k+=L.length),z(t,C,x);var _=new W(o,g?M.tokenize(O,g):O,v,O);y=I(t,C,_),N&&I(t,y,N),1"+a.content+""},!u.document)return u.addEventListener&&(M.disableWorkerMessageHandler||u.addEventListener("message",function(e){var n=JSON.parse(e.data),t=n.language,r=n.code,a=n.immediateClose;u.postMessage(M.highlight(r,M.languages[t],t)),a&&u.close()},!1)),M;var e=M.util.currentScript();function t(){M.manual||M.highlightAll()}if(e&&(M.filename=e.src,e.hasAttribute("data-manual")&&(M.manual=!0)),!M.manual){var r=document.readyState;"loading"===r||"interactive"===r&&e&&e.defer?document.addEventListener("DOMContentLoaded",t):window.requestAnimationFrame?window.requestAnimationFrame(t):window.setTimeout(t,16)}return M}(_self);"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism); Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}; Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])[_$A-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|})\s*)(?:catch|finally)\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|(?:get|set)(?=\s*[\[$\w\xA0-\uFFFF])|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],number:/\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,function:/#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0},"function-variable":{pattern:/#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)?\s*\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=>)/i,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|(?!\${)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\${|}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.js=Prism.languages.javascript; !function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)\w+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b\w+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+?)\s*(?:\r?\n|\r)[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:n},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s*(?:\r?\n|\r)[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\](?:\\\\)*)(["'])(?:\\[\s\S]|\$\([^)]+\)|`[^`]+`|(?!\2)[^\\])*\2/,lookbehind:!0,greedy:!0,inside:n}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:n.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|aptitude|apt-cache|apt-get|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:if|then|else|elif|fi|for|while|in|case|esac|function|select|do|done|until)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|break|cd|continue|eval|exec|exit|export|getopts|hash|pwd|readonly|return|shift|test|times|trap|umask|unset|alias|bind|builtin|caller|command|declare|echo|enable|help|let|local|logout|mapfile|printf|read|readarray|source|type|typeset|ulimit|unalias|set|shopt)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:true|false)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|==?|!=?|=~|<<[<-]?|[&\d]?>>|\d?[<>]&?|&[>&]?|\|[&|]?|<=?|>=?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}};for(var a=["comment","function-name","for-or-select","assign-left","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],r=n.variable[1].inside,s=0;s>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/,number:/(?:\b0x(?:[\da-f]+\.?[\da-f]*|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i}),Prism.languages.insertBefore("c","string",{macro:{pattern:/(^\s*)#\s*[a-z]+(?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],comment:Prism.languages.c.comment,directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}},constant:/\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/}),delete Prism.languages.c.boolean; !function(s){function a(e,s){return e.replace(/<<(\d+)>>/g,function(e,n){return"(?:"+s[+n]+")"})}function t(e,n,s){return RegExp(a(e,n),s||"")}function e(e,n){for(var s=0;s>/g,function(){return"(?:"+e+")"});return e.replace(/<>/g,"[^\\s\\S]")}var n="bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",r="class enum interface struct",i="add alias and ascending async await by descending from get global group into join let nameof not notnull on or orderby partial remove select set unmanaged value when where where",o="abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield";function l(e){return"\\b(?:"+e.trim().replace(/ /g,"|")+")\\b"}var d=l(r),p=RegExp(l(n+" "+r+" "+i+" "+o)),c=l(r+" "+i+" "+o),u=l(n+" "+r+" "+o),g=e("<(?:[^<>;=+\\-*/%&|^]|<>)*>",2),b=e("\\((?:[^()]|<>)*\\)",2),h="@?\\b[A-Za-z_]\\w*\\b",f=a("<<0>>(?:\\s*<<1>>)?",[h,g]),m=a("(?!<<0>>)<<1>>(?:\\s*\\.\\s*<<1>>)*",[c,f]),k="\\[\\s*(?:,\\s*)*\\]",y=a("<<0>>(?:\\s*(?:\\?\\s*)?<<1>>)*(?:\\s*\\?)?",[m,k]),w=a("(?:<<0>>|<<1>>)(?:\\s*(?:\\?\\s*)?<<2>>)*(?:\\s*\\?)?",[a("\\(<<0>>+(?:,<<0>>+)+\\)",[a("[^,()<>[\\];=+\\-*/%&|^]|<<0>>|<<1>>|<<2>>",[g,b,k])]),m,k]),v={keyword:p,punctuation:/[<>()?,.:[\]]/},x="'(?:[^\r\n'\\\\]|\\\\.|\\\\[Uux][\\da-fA-F]{1,8})'",$='"(?:\\\\.|[^\\\\"\r\n])*"';s.languages.csharp=s.languages.extend("clike",{string:[{pattern:t("(^|[^$\\\\])<<0>>",['@"(?:""|\\\\[^]|[^\\\\"])*"(?!")']),lookbehind:!0,greedy:!0},{pattern:t("(^|[^@$\\\\])<<0>>",[$]),lookbehind:!0,greedy:!0},{pattern:RegExp(x),greedy:!0,alias:"character"}],"class-name":[{pattern:t("(\\busing\\s+static\\s+)<<0>>(?=\\s*;)",[m]),lookbehind:!0,inside:v},{pattern:t("(\\busing\\s+<<0>>\\s*=\\s*)<<1>>(?=\\s*;)",[h,w]),lookbehind:!0,inside:v},{pattern:t("(\\busing\\s+)<<0>>(?=\\s*=)",[h]),lookbehind:!0},{pattern:t("(\\b<<0>>\\s+)<<1>>",[d,f]),lookbehind:!0,inside:v},{pattern:t("(\\bcatch\\s*\\(\\s*)<<0>>",[m]),lookbehind:!0,inside:v},{pattern:t("(\\bwhere\\s+)<<0>>",[h]),lookbehind:!0},{pattern:t("(\\b(?:is(?:\\s+not)?|as)\\s+)<<0>>",[y]),lookbehind:!0,inside:v},{pattern:t("\\b<<0>>(?=\\s+(?!<<1>>)<<2>>(?:\\s*[=,;:{)\\]]|\\s+(?:in|when)\\b))",[w,u,h]),inside:v}],keyword:p,number:/(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:ul|lu|[dflmu])?\b/i,operator:/>>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,punctuation:/\?\.?|::|[{}[\];(),.:]/}),s.languages.insertBefore("csharp","number",{range:{pattern:/\.\./,alias:"operator"}}),s.languages.insertBefore("csharp","punctuation",{"named-parameter":{pattern:t("([(,]\\s*)<<0>>(?=\\s*:)",[h]),lookbehind:!0,alias:"punctuation"}}),s.languages.insertBefore("csharp","class-name",{namespace:{pattern:t("(\\b(?:namespace|using)\\s+)<<0>>(?:\\s*\\.\\s*<<0>>)*(?=\\s*[;{])",[h]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:t("(\\b(?:default|typeof|sizeof)\\s*\\(\\s*)(?:[^()\\s]|\\s(?!\\s*\\))|<<0>>)*(?=\\s*\\))",[b]),lookbehind:!0,alias:"class-name",inside:v},"return-type":{pattern:t("<<0>>(?=\\s+(?:<<1>>\\s*(?:=>|[({]|\\.\\s*this\\s*\\[)|this\\s*\\[))",[w,m]),inside:v,alias:"class-name"},"constructor-invocation":{pattern:t("(\\bnew\\s+)<<0>>(?=\\s*[[({])",[w]),lookbehind:!0,inside:v,alias:"class-name"},"generic-method":{pattern:t("<<0>>\\s*<<1>>(?=\\s*\\()",[h,g]),inside:{function:t("^<<0>>",[h]),generic:{pattern:RegExp(g),alias:"class-name",inside:v}}},"type-list":{pattern:t("\\b((?:<<0>>\\s+<<1>>|where\\s+<<2>>)\\s*:\\s*)(?:<<3>>|<<4>>)(?:\\s*,\\s*(?:<<3>>|<<4>>))*(?=\\s*(?:where|[{;]|=>|$))",[d,f,h,w,p.source]),lookbehind:!0,inside:{keyword:p,"class-name":{pattern:RegExp(w),greedy:!0,inside:v},punctuation:/,/}},preprocessor:{pattern:/(^\s*)#.*/m,lookbehind:!0,alias:"property",inside:{directive:{pattern:/(\s*#)\b(?:define|elif|else|endif|endregion|error|if|line|pragma|region|undef|warning)\b/,lookbehind:!0,alias:"keyword"}}}});var _=$+"|"+x,B=a("/(?![*/])|//[^\r\n]*[\r\n]|/\\*(?:[^*]|\\*(?!/))*\\*/|<<0>>",[_]),E=e(a("[^\"'/()]|<<0>>|\\(<>*\\)",[B]),2),R="\\b(?:assembly|event|field|method|module|param|property|return|type)\\b",P=a("<<0>>(?:\\s*\\(<<1>>*\\))?",[m,E]);s.languages.insertBefore("csharp","class-name",{attribute:{pattern:t("((?:^|[^\\s\\w>)?])\\s*\\[\\s*)(?:<<0>>\\s*:\\s*)?<<1>>(?:\\s*,\\s*<<1>>)*(?=\\s*\\])",[R,P]),lookbehind:!0,greedy:!0,inside:{target:{pattern:t("^<<0>>(?=\\s*:)",[R]),alias:"keyword"},"attribute-arguments":{pattern:t("\\(<<0>>*\\)",[E]),inside:s.languages.csharp},"class-name":{pattern:RegExp(m),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var z=":[^}\r\n]+",S=e(a("[^\"'/()]|<<0>>|\\(<>*\\)",[B]),2),j=a("\\{(?!\\{)(?:(?![}:])<<0>>)*<<1>>?\\}",[S,z]),A=e(a("[^\"'/()]|/(?!\\*)|/\\*(?:[^*]|\\*(?!/))*\\*/|<<0>>|\\(<>*\\)",[_]),2),F=a("\\{(?!\\{)(?:(?![}:])<<0>>)*<<1>>?\\}",[A,z]);function U(e,n){return{interpolation:{pattern:t("((?:^|[^{])(?:\\{\\{)*)<<0>>",[e]),lookbehind:!0,inside:{"format-string":{pattern:t("(^\\{(?:(?![}:])<<0>>)*)<<1>>(?=\\}$)",[n,z]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:"language-csharp",inside:s.languages.csharp}}},string:/[\s\S]+/}}s.languages.insertBefore("csharp","string",{"interpolation-string":[{pattern:t('(^|[^\\\\])(?:\\$@|@\\$)"(?:""|\\\\[^]|\\{\\{|<<0>>|[^\\\\{"])*"',[j]),lookbehind:!0,greedy:!0,inside:U(j,S)},{pattern:t('(^|[^@\\\\])\\$"(?:\\\\.|\\{\\{|<<0>>|[^\\\\"{])*"',[F]),lookbehind:!0,greedy:!0,inside:U(F,A)}]})}(Prism),Prism.languages.dotnet=Prism.languages.cs=Prism.languages.csharp; -!function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char8_t|char16_t|char32_t|class|compl|concept|const|consteval|constexpr|constinit|const_cast|continue|co_await|co_return|co_yield|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/;e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp("(\\b(?:class|concept|enum|struct|typename)\\s+)(?!)\\w+".replace(//g,function(){return t.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+\.?[\da-f']*|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+\.?[\d']*|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]*/i,greedy:!0},operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:true|false)\b/}),e.languages.insertBefore("cpp","string",{"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)(?:[^;{}"'])+?(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","operator",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(Prism); +!function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char8_t|char16_t|char32_t|class|compl|concept|const|consteval|constexpr|constinit|const_cast|continue|co_await|co_return|co_yield|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/;e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp("(\\b(?:class|concept|enum|struct|typename)\\s+)(?!)\\w+".replace(//g,function(){return t.source}),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+\.?[\da-f']*|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+\.?[\d']*|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]*/i,greedy:!0},operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:true|false)\b/}),e.languages.insertBefore("cpp","string",{"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)(?:[^;{}"'])+?(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","operator",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(Prism); Prism.languages.clojure={comment:/;.*/,string:{pattern:/"(?:[^"\\]|\\.)*"/,greedy:!0},operator:/(?:::|[:|'])\b[a-z][\w*+!?-]*\b/i,keyword:{pattern:/([^\w+*'?-])(?:def|if|do|let|\.\.|quote|var|->>|->|fn|loop|recur|throw|try|monitor-enter|\.|new|set!|def\-|defn|defn\-|defmacro|defmulti|defmethod|defstruct|defonce|declare|definline|definterface|defprotocol|==|defrecord|>=|deftype|<=|defproject|ns|\*|\+|\-|\/|<|=|>|accessor|agent|agent-errors|aget|alength|all-ns|alter|and|append-child|apply|array-map|aset|aset-boolean|aset-byte|aset-char|aset-double|aset-float|aset-int|aset-long|aset-short|assert|assoc|await|await-for|bean|binding|bit-and|bit-not|bit-or|bit-shift-left|bit-shift-right|bit-xor|boolean|branch\?|butlast|byte|cast|char|children|class|clear-agent-errors|comment|commute|comp|comparator|complement|concat|conj|cons|constantly|cond|if-not|construct-proxy|contains\?|count|create-ns|create-struct|cycle|dec|deref|difference|disj|dissoc|distinct|doall|doc|dorun|doseq|dosync|dotimes|doto|double|down|drop|drop-while|edit|end\?|ensure|eval|every\?|false\?|ffirst|file-seq|filter|find|find-doc|find-ns|find-var|first|float|flush|for|fnseq|frest|gensym|get-proxy-class|get|hash-map|hash-set|identical\?|identity|if-let|import|in-ns|inc|index|insert-child|insert-left|insert-right|inspect-table|inspect-tree|instance\?|int|interleave|intersection|into|into-array|iterate|join|key|keys|keyword|keyword\?|last|lazy-cat|lazy-cons|left|lefts|line-seq|list\*|list|load|load-file|locking|long|loop|macroexpand|macroexpand-1|make-array|make-node|map|map-invert|map\?|mapcat|max|max-key|memfn|merge|merge-with|meta|min|min-key|name|namespace|neg\?|new|newline|next|nil\?|node|not|not-any\?|not-every\?|not=|ns-imports|ns-interns|ns-map|ns-name|ns-publics|ns-refers|ns-resolve|ns-unmap|nth|nthrest|or|parse|partial|path|peek|pop|pos\?|pr|pr-str|print|print-str|println|println-str|prn|prn-str|project|proxy|proxy-mappings|quot|rand|rand-int|range|re-find|re-groups|re-matcher|re-matches|re-pattern|re-seq|read|read-line|reduce|ref|ref-set|refer|rem|remove|remove-method|remove-ns|rename|rename-keys|repeat|replace|replicate|resolve|rest|resultset-seq|reverse|rfirst|right|rights|root|rrest|rseq|second|select|select-keys|send|send-off|seq|seq-zip|seq\?|set|short|slurp|some|sort|sort-by|sorted-map|sorted-map-by|sorted-set|special-symbol\?|split-at|split-with|str|string\?|struct|struct-map|subs|subvec|symbol|symbol\?|sync|take|take-nth|take-while|test|time|to-array|to-array-2d|tree-seq|true\?|union|up|update-proxy|val|vals|var-get|var-set|var\?|vector|vector-zip|vector\?|when|when-first|when-let|when-not|with-local-vars|with-meta|with-open|with-out-str|xml-seq|xml-zip|zero\?|zipmap|zipper)(?=[^\w+*'?-])/,lookbehind:!0},boolean:/\b(?:true|false|nil)\b/,number:/\b[\da-f]+\b/i,punctuation:/[{}\[\](),]/}; Prism.languages.elixir={comment:/#.*/m,regex:{pattern:/~[rR](?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|([\/|"'])(?:\\.|(?!\2)[^\\\r\n])+\2|\((?:\\.|[^\\)\r\n])+\)|\[(?:\\.|[^\\\]\r\n])+\]|\{(?:\\.|[^\\}\r\n])+\}|<(?:\\.|[^\\>\r\n])+>)[uismxfr]*/,greedy:!0},string:[{pattern:/~[cCsSwW](?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|([\/|"'])(?:\\.|(?!\2)[^\\\r\n])+\2|\((?:\\.|[^\\)\r\n])+\)|\[(?:\\.|[^\\\]\r\n])+\]|\{(?:\\.|#\{[^}]+\}|#(?!\{)|[^#\\}\r\n])+\}|<(?:\\.|[^\\>\r\n])+>)[csa]?/,greedy:!0,inside:{}},{pattern:/("""|''')[\s\S]*?\1/,greedy:!0,inside:{}},{pattern:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0,inside:{}}],atom:{pattern:/(^|[^:]):\w+/,lookbehind:!0,alias:"symbol"},"attr-name":/\w+\??:(?!:)/,capture:{pattern:/(^|[^&])&(?:[^&\s\d()][^\s()]*|(?=\())/,lookbehind:!0,alias:"function"},argument:{pattern:/(^|[^&])&\d+/,lookbehind:!0,alias:"variable"},attribute:{pattern:/@\w+/,alias:"variable"},number:/\b(?:0[box][a-f\d_]+|\d[\d_]*)(?:\.[\d_]+)?(?:e[+-]?[\d_]+)?\b/i,keyword:/\b(?:after|alias|and|case|catch|cond|def(?:callback|exception|impl|module|p|protocol|struct)?|do|else|end|fn|for|if|import|not|or|require|rescue|try|unless|use|when)\b/,boolean:/\b(?:true|false|nil)\b/,operator:[/\bin\b|&&?|\|[|>]?|\\\\|::|\.\.\.?|\+\+?|-[->]?|<[-=>]|>=|!==?|\B!|=(?:==?|[>~])?|[*\/^]/,{pattern:/([^<])<(?!<)/,lookbehind:!0},{pattern:/([^>])>(?!>)/,lookbehind:!0}],punctuation:/<<|>>|[.,%\[\]{}()]/},Prism.languages.elixir.string.forEach(function(e){e.inside={interpolation:{pattern:/#\{[^}]+\}/,inside:{delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"},rest:Prism.languages.elixir}}}}); Prism.languages.erlang={comment:/%.+/,string:{pattern:/"(?:\\.|[^\\"\r\n])*"/,greedy:!0},"quoted-function":{pattern:/'(?:\\.|[^\\'\r\n])+'(?=\()/,alias:"function"},"quoted-atom":{pattern:/'(?:\\.|[^\\'\r\n])+'/,alias:"atom"},boolean:/\b(?:true|false)\b/,keyword:/\b(?:fun|when|case|of|end|if|receive|after|try|catch)\b/,number:[/\$\\?./,/\d+#[a-z0-9]+/i,/(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i],function:/\b[a-z][\w@]*(?=\()/,variable:{pattern:/(^|[^@])(?:\b|\?)[A-Z_][\w@]*/,lookbehind:!0},operator:[/[=\/<>:]=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:bnot|div|rem|band|bor|bxor|bsl|bsr|not|and|or|xor|orelse|andalso)\b/,{pattern:/(^|[^<])<(?!<)/,lookbehind:!0},{pattern:/(^|[^>])>(?!>)/,lookbehind:!0}],atom:/\b[a-z][\w@]*/,punctuation:/[()[\]{}:;,.#|]|<<|>>/}; diff --git a/apidoc/vendor/require.min.js b/apidoc/vendor/require.min.js index 651902f2..de7c7d2f 100644 --- a/apidoc/vendor/require.min.js +++ b/apidoc/vendor/require.min.js @@ -14,14 +14,14 @@ a.error):(b[f]=!0,x(a.depMaps,function(f,d){var h=f.id,k=g(t,h);!k||a.depMatched "Load timeout for modules: "+f,null,f),a.contextName=h.contextName,B(a);g&&x(l,function(a){K(a,{},{})});c&&!b||!k||!F&&!ka||ca||(ca=setTimeout(function(){ca=0;I()},50));ba=!1}}function J(a){w(r,a[0])||u(q(a[0],null,!0)).init(a[1],a[2])}function P(a){a=a.currentTarget||a.srcElement;var b=h.onScriptLoad;a.detachEvent&&!da?a.detachEvent("onreadystatechange",b):a.removeEventListener("load",b,!1);b=h.onScriptError;a.detachEvent&&!da||a.removeEventListener("error",b,!1);return{node:a,id:a&&a.getAttribute("data-requiremodule")}} function Q(){var a;for(C();H.length;){a=H.shift();if(null===a[0])return B(G("mismatch","Mismatched anonymous define() module: "+a[a.length-1]));J(a)}h.defQueueMap={}}var ba,ea,h,S,ca,m={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},t={},aa={},fa={},H=[],r={},X={},ga={},R=1,U=1;S={require:function(a){return a.require?a.require:a.require=h.makeRequire(a.map)},exports:function(a){a.usingExports=!0;if(a.map.isDefine)return a.exports?r[a.map.id]=a.exports:a.exports=r[a.map.id]= {}},module:function(a){return a.module?a.module:a.module={id:a.map.id,uri:a.map.url,config:function(){return g(m.config,a.map.id)||{}},exports:a.exports||(a.exports={})}}};ea=function(a){this.events=g(fa,a.id)||{};this.map=a;this.shim=g(m.shim,a.id);this.depExports=[];this.depMaps=[];this.depMatched=[];this.pluginMaps={};this.depCount=0};ea.prototype={init:function(a,b,c,f){f=f||{};if(!this.inited){this.factory=b;if(c)this.on("error",c);else this.events.error&&(c=y(this,function(a){this.emit("error", -a)}));this.depMaps=a&&a.slice(0);this.errback=c;this.inited=!0;this.ignore=f.ignore;f.enabled||this.enabled?this.enable():this.check()}},defineDep:function(a,b){this.depMatched[a]||(this.depMatched[a]=!0,--this.depCount,this.depExports[a]=b)},fetch:function(){if(!this.fetched){this.fetched=!0;h.startTime=(new Date).getTime();var a=this.map;if(this.shim)h.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],y(this,function(){return a.prefix?this.callPlugin():this.load()}));else return a.prefix? +a)});this.depMaps=a&&a.slice(0);this.errback=c;this.inited=!0;this.ignore=f.ignore;f.enabled||this.enabled?this.enable():this.check()}},defineDep:function(a,b){this.depMatched[a]||(this.depMatched[a]=!0,--this.depCount,this.depExports[a]=b)},fetch:function(){if(!this.fetched){this.fetched=!0;h.startTime=(new Date).getTime();var a=this.map;if(this.shim)h.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],y(this,function(){return a.prefix?this.callPlugin():this.load()});else return a.prefix? this.callPlugin():this.load()}},load:function(){var a=this.map.url;X[a]||(X[a]=!0,h.load(this.map.id,a))},check:function(){if(this.enabled&&!this.enabling){var a,b,c=this.map.id;b=this.depExports;var f=this.exports,l=this.factory;if(!this.inited)w(h.defQueueMap,c)||this.fetch();else if(this.error)this.emit("error",this.error);else if(!this.defining){this.defining=!0;if(1>this.depCount&&!this.defined){if(L(l)){try{f=h.execCb(c,l,b,f)}catch(d){a=d}this.map.isDefine&&void 0===f&&((b=this.module)?f=b.exports: this.usingExports&&(f=this.exports));if(a){if(this.events.error&&this.map.isDefine||k.onError!==ia)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",B(this.error=a);if("undefined"!==typeof console&&console.error)console.error(a);else k.onError(a)}}else f=l;this.exports=f;if(this.map.isDefine&&!this.ignore&&(r[c]=f,k.onResourceLoad)){var e=[];x(this.depMaps,function(a){e.push(a.normalizedMap||a)});k.onResourceLoad(h, this.map,e)}D(c);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}},callPlugin:function(){var a=this.map,b=a.id,d=q(a.prefix);this.depMaps.push(d);v(d,"defined",y(this,function(f){var l,d,e=g(ga,this.map.id),N=this.map.name,p=this.map.parentMap?this.map.parentMap.name:null,r=h.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(N=f.normalize(N,function(a){return c(a, -p,!0)})||""),d=q(a.prefix+"!"+N,this.map.parentMap),v(d,"defined",y(this,function(a){this.map.normalizedMap=d;this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),f=g(t,d.id)){this.depMaps.push(d);if(this.events.error)f.on("error",y(this,function(a){this.emit("error",a)}));f.enable()}}else e?(this.map.url=h.nameToUrl(e),this.load()):(l=y(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),l.error=y(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b]; -E(t,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&D(a.map.id)});B(a)}),l.fromText=y(this,function(f,c){var d=a.name,e=q(d),N=T;c&&(f=c);N&&(T=!1);u(e);w(m.config,b)&&(m.config[d]=m.config[b]);try{k.exec(f)}catch(g){return B(G("fromtexteval","fromText eval for "+b+" failed: "+g,g,[b]))}N&&(T=!0);this.depMaps.push(e);h.completeLoad(d);r([d],l)}),f.load(a.name,r,l,m))}));h.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){aa[this.map.id]=this;this.enabling=this.enabled=!0;x(this.depMaps, -y(this,function(a,b){var c,f;if("string"===typeof a){a=q(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=g(S,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;v(a,"defined",y(this,function(a){this.undefed||(this.defineDep(b,a),this.check())}));this.errback?v(a,"error",y(this,this.errback)):this.events.error&&v(a,"error",y(this,function(a){this.emit("error",a)}))}c=a.id;f=t[c];w(S,c)||!f||f.enabled||h.enable(a,this)}));E(this.pluginMaps,y(this,function(a){var b= -g(t,a.id);b&&!b.enabled&&h.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){x(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};h={config:m,contextName:b,registry:t,defined:r,urlFetched:X,defQueue:H,defQueueMap:{},Module:ea,makeModuleMap:q,nextTick:k.nextTick,onError:B,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=m.shim,c={paths:!0, +p,!0)})||""),d=q(a.prefix+"!"+N,this.map.parentMap),v(d,"defined",y(this,function(a){this.map.normalizedMap=d;this.init([],function(){return a},null,{enabled:!0,ignore:!0})}),f=g(t,d.id)){this.depMaps.push(d);if(this.events.error)f.on("error",y(this,function(a){this.emit("error",a)});f.enable()}}else e?(this.map.url=h.nameToUrl(e),this.load()):(l=y(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),l.error=y(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b]; +E(t,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&D(a.map.id)});B(a)}),l.fromText=y(this,function(f,c){var d=a.name,e=q(d),N=T;c&&(f=c);N&&(T=!1);u(e);w(m.config,b)&&(m.config[d]=m.config[b]);try{k.exec(f)}catch(g){return B(G("fromtexteval","fromText eval for "+b+" failed: "+g,g,[b]))}N&&(T=!0);this.depMaps.push(e);h.completeLoad(d);r([d],l)}),f.load(a.name,r,l,m))});h.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){aa[this.map.id]=this;this.enabling=this.enabled=!0;x(this.depMaps, +y(this,function(a,b){var c,f;if("string"===typeof a){a=q(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=g(S,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;v(a,"defined",y(this,function(a){this.undefed||(this.defineDep(b,a),this.check())});this.errback?v(a,"error",y(this,this.errback)):this.events.error&&v(a,"error",y(this,function(a){this.emit("error",a)})}c=a.id;f=t[c];w(S,c)||!f||f.enabled||h.enable(a,this)});E(this.pluginMaps,y(this,function(a){var b= +g(t,a.id);b&&!b.enabled&&h.enable(a,this)});this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){x(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};h={config:m,contextName:b,registry:t,defined:r,urlFetched:X,defQueue:H,defQueueMap:{},Module:ea,makeModuleMap:q,nextTick:k.nextTick,onError:B,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=m.shim,c={paths:!0, bundles:!0,config:!0,map:!0};E(a,function(a,b){c[b]?(m[b]||(m[b]={}),Z(m[b],a,!0,!0)):m[b]=a});a.bundles&&E(a.bundles,function(a,b){x(a,function(a){a!==b&&(ga[a]=b)})});a.shim&&(E(a.shim,function(a,c){M(a)&&(a={deps:a});!a.exports&&!a.init||a.exportsFn||(a.exportsFn=h.makeShimExports(a));b[c]=a}),m.shim=b);a.packages&&x(a.packages,function(a){var b;a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(m.paths[b]=a.location);m.pkgs[b]=a.name+"/"+(a.main||"main").replace(na,"").replace(V,"")});E(t, function(a,b){a.inited||a.map.unnormalized||(a.map=q(b,null,!0))});(a.deps||a.callback)&&h.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ha,arguments));return b||a.exports&&ja(a.exports)}},makeRequire:function(a,n){function e(c,d,g){var m,p;n.enableBuildCallback&&d&&L(d)&&(d.__requireJsBuild=!0);if("string"===typeof c){if(L(d))return B(G("requireargs","Invalid require call"),g);if(a&&w(S,c))return S[c](t[a.id]);if(k.get)return k.get(h, c,a,e);m=q(c,a,!1,!0);m=m.id;return w(r,m)?r[m]:B(G("notloaded",'Module name "'+m+'" has not been loaded yet for context: '+b+(a?"":". Use require([])")))}Q();h.nextTick(function(){Q();p=u(q(null,a));p.skipMap=n.skipMap;p.init(c,d,g,{enabled:!0});I()});return e}n=n||{};Z(e,{isBrowser:F,toUrl:function(b){var d,e=b.lastIndexOf("."),n=b.split("/")[0];-1!==e&&("."!==n&&".."!==n||1 { console.debug("Error connecting to database: " + err.message); console.log(dbOptions.connection.database + "." + dbOptions.connection.user); }); -knex = require("knex")(dbOptions); - import './models/accounts.js'; import './models/codes.js'; import './models/deposits.js'; @@ -166,3 +153,5 @@ Payment.belongsTo(Payment, { }); db.Order = Order; + +export default db; diff --git a/db/models/accounts.js b/db/models/accounts.js index 3dd9ff71..c7e76277 100644 --- a/db/models/accounts.js +++ b/db/models/accounts.js @@ -1,4 +1,5 @@ -import { DataTypes } from 'sequelize'; +import db from "../db.js"; +import { DataTypes } from '@sequelize/core'; const attributes = { id: { diff --git a/db/models/codes.js b/db/models/codes.js index b00f5bfb..57edfb35 100644 --- a/db/models/codes.js +++ b/db/models/codes.js @@ -1,4 +1,5 @@ -import { DataTypes } from 'sequelize'; +import db from "../db.js"; +import { DataTypes } from '@sequelize/core'; const attributes = { code: { diff --git a/db/models/deposits.js b/db/models/deposits.js index c52d37dd..0d030bf2 100644 --- a/db/models/deposits.js +++ b/db/models/deposits.js @@ -1,4 +1,5 @@ -import { DataTypes } from 'sequelize'; +import db from "../db.js"; +import { DataTypes } from '@sequelize/core'; const attributes = { id: { diff --git a/db/models/invoices.js b/db/models/invoices.js index 54f3f8bd..c405b122 100644 --- a/db/models/invoices.js +++ b/db/models/invoices.js @@ -1,4 +1,5 @@ -import { DataTypes } from 'sequelize'; +import db from "../db.js"; +import { DataTypes } from '@sequelize/core'; const attributes = { id: { diff --git a/db/models/keys.js b/db/models/keys.js index 47ec7745..8807e00e 100644 --- a/db/models/keys.js +++ b/db/models/keys.js @@ -1,4 +1,5 @@ -import { DataTypes } from 'sequelize'; +import db from "../db.js"; +import { DataTypes } from '@sequelize/core'; const attributes = { id: { diff --git a/db/models/orders.js b/db/models/orders.js index 864b6b44..60fd539b 100644 --- a/db/models/orders.js +++ b/db/models/orders.js @@ -1,4 +1,5 @@ -import { DataTypes } from 'sequelize'; +import db from "../db.js"; +import { DataTypes } from '@sequelize/core'; const attributes = { id: { diff --git a/db/models/payments.js b/db/models/payments.js index fd6b3593..31ce4855 100644 --- a/db/models/payments.js +++ b/db/models/payments.js @@ -1,4 +1,5 @@ -import { DataTypes } from 'sequelize'; +import db from "../db.js"; +import { DataTypes } from '@sequelize/core'; const attributes = { id: { diff --git a/db/models/referrals.js b/db/models/referrals.js index 79c73e38..2d1e8d8c 100644 --- a/db/models/referrals.js +++ b/db/models/referrals.js @@ -1,4 +1,5 @@ -import { DataTypes } from 'sequelize'; +import db from "../db.js"; +import { DataTypes } from '@sequelize/core'; const attributes = { id: { diff --git a/db/models/users.js b/db/models/users.js index fa89f315..50b8941c 100644 --- a/db/models/users.js +++ b/db/models/users.js @@ -1,4 +1,5 @@ -import { DataTypes } from 'sequelize'; +import db from "../db.js"; +import { DataTypes } from '@sequelize/core'; const attributes = { id: { diff --git a/db/models/waiting_list.js b/db/models/waiting_list.js index 742306c0..76fb9e3f 100644 --- a/db/models/waiting_list.js +++ b/db/models/waiting_list.js @@ -1,4 +1,5 @@ -import { DataTypes } from 'sequelize'; +import db from "../db.js"; +import { DataTypes } from '@sequelize/core'; const attributes = { id: { diff --git a/db/models/withdrawals.js b/db/models/withdrawals.js index 12f6ee6d..53863cbf 100644 --- a/db/models/withdrawals.js +++ b/db/models/withdrawals.js @@ -1,4 +1,5 @@ -import { DataTypes } from 'sequelize'; +import db from "../db.js"; +import { DataTypes } from '@sequelize/core'; const attributes = { id: { diff --git a/db/normalized/accounts.js b/db/normalized/accounts.js index c6ab1100..8e5aad33 100644 --- a/db/normalized/accounts.js +++ b/db/normalized/accounts.js @@ -40,7 +40,7 @@ export const down = function(knex) { // -// const { DataTypes } = require('sequelize'); +// const { DataTypes } = require('@sequelize/core'); // const attributes = { // id: { diff --git a/db/normalized/credits.js b/db/normalized/credits.js index 92bf5359..5511b616 100644 --- a/db/normalized/credits.js +++ b/db/normalized/credits.js @@ -42,7 +42,7 @@ return knex.schema.dropTable('credits'); // context for path, memo, rate, preimage, address, received, fee, tip, confirmed, redeemcode ? -import { DataTypes } from 'sequelize'; +import { DataTypes } from '@sequelize/core'; const attributes = { id: { diff --git a/db/normalized/debits.js b/db/normalized/debits.js index 256853c8..6fcee974 100644 --- a/db/normalized/debits.js +++ b/db/normalized/debits.js @@ -42,7 +42,7 @@ return knex.schema.dropTable('debits'); // context for path, memo, rate, preimage, address, received, fee, tip, confirmed, redeemcode ? -import { DataTypes } from 'sequelize'; +import { DataTypes } from '@sequelize/core'; const attributes = { id: { diff --git a/db/normalized/deposits.js b/db/normalized/deposits.js index 2a3c83fb..17a7c500 100644 --- a/db/normalized/deposits.js +++ b/db/normalized/deposits.js @@ -23,7 +23,7 @@ export const down = function(knex) { // code -> confirmation_code -// const { DataTypes } = require('sequelize'); +// const { DataTypes } = require('@sequelize/core'); // const attributes = { // id: { diff --git a/db/normalized/exchanges.js b/db/normalized/exchanges.js index 2f34a394..2be91990 100644 --- a/db/normalized/exchanges.js +++ b/db/normalized/exchanges.js @@ -38,7 +38,7 @@ return knex.schema.dropTable('exchanges'); // context for path, memo, rate, preimage, address, received, fee, tip, confirmed, redeemcode ? -import { DataTypes } from 'sequelize'; +import { DataTypes } from '@sequelize/core'; const attributes = { id: { diff --git a/db/normalized/invoices.js b/db/normalized/invoices.js index 25f5b681..823ad11d 100644 --- a/db/normalized/invoices.js +++ b/db/normalized/invoices.js @@ -39,7 +39,7 @@ export const down = function(knex) { // checkout - fields ? // voucher - fields ? -// const { DataTypes } = require('sequelize'); +// const { DataTypes } = require('@sequelize/core'); // const attributes = { // id: { diff --git a/db/normalized/non_custodial_accounts.js b/db/normalized/non_custodial_accounts.js index 5c56b966..e8190ce6 100644 --- a/db/normalized/non_custodial_accounts.js +++ b/db/normalized/non_custodial_accounts.js @@ -20,7 +20,7 @@ export const down = function(knex) { return knex.schema.dropTable('non_custodial_accounts'); }; -// const { DataTypes } = require('sequelize'); +// const { DataTypes } = require('@sequelize/core'); // const attributes = { // id: { diff --git a/db/normalized/transfers.js b/db/normalized/transfers.js index aa81472f..64f5c392 100644 --- a/db/normalized/transfers.js +++ b/db/normalized/transfers.js @@ -49,7 +49,7 @@ return knex.schema.dropTable('transfers'); // context for path, memo, rate, preimage, address, received, fee, tip, confirmed, redeemcode ? -import { DataTypes } from 'sequelize'; +import { DataTypes } from '@sequelize/core'; const attributes = { id: { diff --git a/db/normalized/waiting_list.js b/db/normalized/waiting_list.js index f6908868..5a37dc52 100644 --- a/db/normalized/waiting_list.js +++ b/db/normalized/waiting_list.js @@ -14,7 +14,7 @@ export const down = function(knex) { return knex.schema.dropTable('waiting_list'); }; -// const { DataTypes } = require('sequelize'); +// const { DataTypes } = require('@sequelize/core'); // const attributes = { // id: { diff --git a/db/normalized/withdrawals.js b/db/normalized/withdrawals.js index d404e6e3..742f3dbf 100644 --- a/db/normalized/withdrawals.js +++ b/db/normalized/withdrawals.js @@ -24,7 +24,7 @@ export const down = function(knex) { // // bank info -> bank_account records -// const { DataTypes } = require('sequelize'); +// const { DataTypes } = require('@sequelize/core'); // const attributes = { // id: { diff --git a/index.js b/index.js index 599f8ec2..1536faf9 100644 --- a/index.js +++ b/index.js @@ -1,104 +1,79 @@ -import axios from 'axios'; -import bodyParser from 'body-parser'; -import compression from 'compression'; -import cookieParser from 'cookie-parser'; -import cors from 'cors'; -import express from 'express'; -import { Op } from 'sequelize'; -import persist from './lib/persist.js'; - -ah = require("express-async-handler"); - -config = require("./config"); -networks = []; -prod = process.env.NODE_ENV === "production"; -fail = msg => { - throw new Error(msg); -}; - -addresses = {}; -challenge = {}; -change = []; -exceptions = []; -issuances = {}; -logins = {}; -seen = []; -sessions = {}; -sockets = {}; -unaccounted = []; - -convert = persist("data/conversions.json"); - -SATS = 100000000; -toSats = n => Math.round(n * SATS); - -app = express(); -app.enable("trust proxy"); -app.use(bodyParser.urlencoded({ extended: true })); -app.use(bodyParser.json()); - -app.use((err, req, res, next) => { - const details = { - path: req.path, - body: req.body, - msg: err.message, - stack: err.stack - }; - - if (req.user) details.username = req.user.username; - - l.error("JSON Error: ", JSON.stringify(details)); - res.status(500); - res.set({ - "Cache-Control": "no-cache" - }); - res.send(err.message); - return res.end(); -}); -app.use(cookieParser()); -app.use(cors({ credentials: true, origin: "*" })); -app.use(compression()); - -server = require("http").Server(app); - -import './db/index.js'; -import './lib/logging.js'; -import './lib/utils.js'; -import './lib/sockets.js'; -import './lib/webhooks.js'; -import './lib/passport.js'; -import './lib/register.js'; -import './lib/upload.js'; -import './lib/send.js'; -import './lib/sync.js'; -import './routes/assets.js'; -import './routes/info.js'; -import './routes/users.js'; - if (config.bitcoin) networks.push("bitcoin"); - if (config.liquid) networks.push("liquid"); - if (config.lna) networks.push("lightning"); - - require("./lib/rates"); - require("./lib/notifications"); - - if (config.imap) require("./lib/mail"); - if (config.lnurl) require("./routes/lnurl"); - if (config.mailgun) require("./routes/funding"); - - require("./routes/invoices"); - require("./routes/payments"); - require("./routes/swaps"); +import app from "./app.js"; +import axios from "axios"; +import bodyParser from "body-parser"; +import compression from "compression"; +import cookieParser from "cookie-parser"; +import cors from "cors"; +import express from "express"; +import { Op } from "@sequelize/core"; +import persist from "./lib/persist.js"; +import config from "./config/index.js"; +import { networks } from "./lib/store.js"; + +// app = express(); +// app.enable("trust proxy"); +// app.use(bodyParser.urlencoded({ extended: true }); +// app.use(bodyParser.json()); +// +// app.use((err, req, res, next) => { +// const details = { +// path: req.path, +// body: req.body, +// msg: err.message, +// stack: err.stack +// }; +// +// if (req.user) details.username = req.user.username; +// +// l.error("JSON Error: ", JSON.stringify(details)); +// res.status(500); +// res.set({ +// "Cache-Control": "no-cache" +// }); +// res.send(err.message); +// return res.end(); +// }); +// app.use(cookieParser()); +// app.use(cors({ credentials: true, origin: "*" }); +// app.use(compression()); + +import "./lib/logging.js"; +import "./lib/utils.js"; +import "./lib/sockets.js"; +import "./lib/webhooks.js"; +import "./lib/passport.js"; +import "./lib/register.js"; +import "./lib/upload.js"; +import "./lib/send.js"; +import "./lib/sync.js"; +import "./routes/assets.js"; +import "./routes/info.js"; +import "./routes/users.js"; +if (config.bitcoin) networks.push("bitcoin"); +if (config.liquid) networks.push("liquid"); +if (config.lna) networks.push("lightning"); + +import "./lib/rates.js"; +import "./lib/notifications.js"; + +if (config.imap) import("./lib/mail.js"); +if (config.lnurl) import("./routes/lnurl.js"); +if (config.mailgun) import ("./routes/funding.js"); + +import "./routes/invoices.js"; +import "./routes/payments.js"; +// import "./routes/swaps.js"; // Scope based Route Handling -import referralsRouter from './routes/referrals.js'; +// import referralsRouter from './routes/referrals.js'; -app.use("/referrals", referralsRouter); +// app.use("/referrals", referralsRouter); -import adminRouter from './routes/admin.js'; -app.use("/admin", adminAuth, adminRouter); +// import adminRouter from './routes/admin.js'; +// app.use("/admin", adminAuth, adminRouter); -import './startup.js'; +import "./startup.js"; app.post("/email", async (req, res) => { try { @@ -132,28 +107,15 @@ app.post("/email", async (req, res) => { } }); -app.use((err, req, res, next) => { - const details = { - path: req.path, - body: req.body, - msg: err.message, - stack: err.stack - }; - - if (req.user) details.username = req.user.username; - - l.error("uncaught error: ", JSON.stringify(details)); - res.status(500); - res.set({ - "Cache-Control": "no-cache" - }); - res.send(err.message); +app.listen(process.env.PORT || 3119, "0.0.0.0", function(err, address) { + if (err) { + console.log(err); + app.log.error(err); + process.exit(1); + } + app.log.info(`CoinOS Server listening on ${address}`); }); -server.listen(config.port, () => - l.info(`CoinOS Server listening on port ${config.port}`) -); - process.on("SIGINT", process.exit); process.on("uncaughtException", function(exception) { diff --git a/lib/binance.js b/lib/binance.js index 4aa678a9..0f91ce8c 100644 --- a/lib/binance.js +++ b/lib/binance.js @@ -1,7 +1,7 @@ import WebSocket from 'ws'; export default () => { - binance = new WebSocket("wss://stream.binance.com:9443/ws/btcusdt@ticker"); + const binance = new WebSocket("wss://stream.binance.com:9443/ws/btcusdt@ticker"); binance.onmessage = async function (event) { try { diff --git a/lib/bitcoin.js b/lib/bitcoin.js new file mode 100644 index 00000000..275abc04 --- /dev/null +++ b/lib/bitcoin.js @@ -0,0 +1,3 @@ +import config from "../config/index.js"; +import rpc from "./rpc.js"; +export default rpc(config.bitcoin); diff --git a/lib/buildliquidtx.js b/lib/buildliquidtx.js index ff0557b4..014b026c 100644 --- a/lib/buildliquidtx.js +++ b/lib/buildliquidtx.js @@ -1,13 +1,14 @@ +import { prod } from "./utils.js"; import axios from 'axios'; -import liquid from 'liquidjs-lib'; +// import liquid from 'liquidjs-lib'; import coinselect from 'coinselect'; -import split from 'coinselect/split'; +import split from 'coinselect/split.js'; const api = prod ? "https://blockstream.info/liquid/api" : "http://localhost:3002"; const SATS = 100000000; const network = prod ? liquid.networks["liquid"] : liquid.networks["regtest"]; -import { Op } from 'sequelize'; +import { Op } from '@sequelize/core'; export default async ({ address, diff --git a/lib/buildtx.js b/lib/buildtx.js index 970a17e3..a696062c 100644 --- a/lib/buildtx.js +++ b/lib/buildtx.js @@ -1,7 +1,8 @@ +import { prod } from "./utils.js"; import axios from 'axios'; import bitcoin from 'bitcoinjs-lib'; import coinselect from 'coinselect'; -import split from 'coinselect/split'; +import split from 'coinselect/split.js'; const api = prod ? "https://blockstream.info/api" : "http://electrsb:3095"; const SATS = 100000000; const network = prod diff --git a/lib/liquid.js b/lib/liquid.js new file mode 100644 index 00000000..d93bb5a1 --- /dev/null +++ b/lib/liquid.js @@ -0,0 +1,4 @@ +import config from "../config/index.js"; +import rpc from "./rpc.js"; +export default rpc(config.liquid); + diff --git a/lib/ln.js b/lib/ln.js new file mode 100644 index 00000000..91a704e9 --- /dev/null +++ b/lib/ln.js @@ -0,0 +1,25 @@ +import config from "../config/index.js"; +let ln; + +if (config.lna.clightning) { + ln = (await import("clightning-client"))(config.lna.dir); +} else { + let lnd = await import("../lib/lnd"); + ln = [ + "addInvoice", + "channelBalance", + "connectPeer", + "decodePayReq", + "getInfo", + "listInvoices", + "listPayments", + "sendPaymentSync", + "walletBalance" + ].reduce( + (a, b) => + (a[b] = args => new Promise(r => lnd[b](args, (e, v) => r(v)))) && a, + {} + ); +} + +export default ln; diff --git a/lib/logging.js b/lib/logging.js index 2e40e1b7..95e48514 100644 --- a/lib/logging.js +++ b/lib/logging.js @@ -1,21 +1,5 @@ -import pino from 'pino'; -import expressPinoFactory from 'express-pino-logger'; +import pino from "pino"; -const expressPino = expressPinoFactory({ - logger: pino("./logs/requests.log"), - serializers: { - res: res => {}, - req: req => ({ - method: req.method, - url: req.url - }) - } -}); - -l = { - info: (...msgs) => pino().info(msgs.join(" ")), - warn: (...msgs) => pino().warn(msgs.join(" ")), - error: (...msgs) => pino().error(msgs.join(" ")) -}; - -app.use(expressPino); + export const l = (...msgs) => pino().info(msgs.join(" ")) + export const warn = (...msgs) => pino().warn(msgs.join(" ")) + export const err = (...msgs) => pino().error(msgs.join(" ")) diff --git a/lib/mail.js b/lib/mail.js index b8242f9c..9d2ff7fc 100644 --- a/lib/mail.js +++ b/lib/mail.js @@ -1,7 +1,9 @@ -import fs from 'fs'; -import Imap from 'imap'; -import { inspect } from 'util'; -import persist from './persist'; +import app from "../app.js"; +import config from "../config/index.js"; +import fs from "fs"; +import Imap from "imap"; +import { inspect } from "util"; +import persist from "./persist.js"; const emails = persist("data/emails.json"); let imap = new Imap(config.imap); @@ -9,37 +11,31 @@ function openInbox(cb) { imap.openBox("INBOX", true, cb); } -app.post( - "/contact-sil", - ah((req, res) => { - const mailgun = require("mailgun-js")(config.mailgun); - let data = { - subject: "Contact form", - text: JSON.stringify(req.body), - from: "server@coinos.io", - to: "testsil@coinos.io" - }; - - mailgun.messages().send(data); - res.send(req.body); - }) -); - -app.post( - "/contact", - ah((req, res) => { - const mailgun = require("mailgun-js")(config.mailgun); - let data = { - subject: "Contact form", - text: JSON.stringify(req.body), - from: "server@coinos.io", - to: "contact@coinos.io" - }; - - mailgun.messages().send(data); - res.send(req.body); - }) -); +app.post("/contact-sil", (req, res) => { + const mailgun = require("mailgun-js")(config.mailgun); + let data = { + subject: "Contact form", + text: JSON.stringify(req.body), + from: "server@coinos.io", + to: "testsil@coinos.io" + }; + + mailgun.messages().send(data); + res.send(req.body); +}); + +app.post("/contact", (req, res) => { + const mailgun = require("mailgun-js")(config.mailgun); + let data = { + subject: "Contact form", + text: JSON.stringify(req.body), + from: "server@coinos.io", + to: "contact@coinos.io" + }; + + mailgun.messages().send(data); + res.send(req.body); +}); imap.once("ready", function() { openInbox(function(err, box) { @@ -55,7 +51,7 @@ imap.once("ready", function() { msg.on("body", function(stream, info) { let buffer = ""; stream.on("data", function(chunk) { - //stream.pipe(fs.createWriteStream('msg-' + seqno + '-body.txt', {flags:'a+'})); + //stream.pipe(fs.createWriteStream('msg-' + seqno + '-body.txt', {flags:'a+'}); buffer += chunk.toString("utf8"); }); stream.once("end", async function() { diff --git a/lib/notifications.js b/lib/notifications.js index 1ec1ff69..c931f09c 100644 --- a/lib/notifications.js +++ b/lib/notifications.js @@ -1,3 +1,4 @@ +import config from "../config/index.js"; import webpush from 'web-push'; if (config.vapid) { @@ -8,7 +9,7 @@ if (config.vapid) { ); } -notify = (user, payload) => { +export const notify = (user, payload) => { let { subscriptions } = user; if (subscriptions) { diff --git a/lib/passport.js b/lib/passport.js index 8da82b8e..16deef6e 100644 --- a/lib/passport.js +++ b/lib/passport.js @@ -1,6 +1,19 @@ -import Passport from 'passport'; -import jwt from 'passport-jwt'; -import { Op } from 'sequelize'; +import app from "../app.js"; +import Passport from "passport"; +import jwt from "passport-jwt"; +import { Op } from "@sequelize/core"; +import fastifyPassport from "@fastify/passport"; +import fastifySecureSession from '@fastify/secure-session' +import config from "../config/index.js"; +import fs from "fs"; +import path from "path"; + +app.register(fastifySecureSession, { + key: fs.readFileSync(config.jwt) +}); + +app.register(fastifyPassport.initialize()); +app.register(fastifyPassport.secureSession()); function cookieExtractor(req) { if (req && req.cookies) { @@ -9,7 +22,8 @@ function cookieExtractor(req) { return null; } -passport = Passport.use( +fastifyPassport.use( + "jwt", new jwt.Strategy( { jwtFromRequest: jwt.ExtractJwt.fromExtractors([ @@ -40,21 +54,32 @@ passport = Passport.use( ) ); -auth = passport.authenticate("jwt", { session: false }); - -optionalAuth = function(req, res, next) { - passport.authenticate("jwt", { session: false }, function(err, user, info) { - req.user = user; - next(); - })(req, res, next); +export const optionalAuth = { + preValidation: fastifyPassport.authenticate( + "jwt", + { session: false }, + function(err, user, info) { + req.user = user; + next(); + } + ) }; -adminAuth = ah((req, res, next) => { - passport.authenticate("jwt", { session: false }, function(err, user, info) { - if (!(user && user.admin)) return res.status(401).send("Unauthorized") - req.user = user; - next(); - })(req, res, next); -}); +export const adminAuth = { + preValidation: fastifyPassport.authenticate( + "jwt", + { session: false }, + function(err, user, info) { + if (!(user && user.admin)) return res.status(401).send("Unauthorized"); + req.user = user; + next(); + } + ) +}; -app.use(passport.initialize()); +export const auth = { + preValidation: fastifyPassport.authenticate("jwt", { + authInfo: false, + session: false + }) +}; diff --git a/lib/rates.js b/lib/rates.js index 745c4212..48c87aa7 100644 --- a/lib/rates.js +++ b/lib/rates.js @@ -1,6 +1,7 @@ -import axios from 'axios'; -import fs from 'fs'; -import binanceFactory from './binance'; +import app from "../app.js"; +import axios from "axios"; +import fs from "fs"; +import binanceFactory from "./binance.js"; const binance = binanceFactory(); let fetchRates; @@ -9,7 +10,7 @@ let fetchRates; try { ({ date, fx } = JSON.parse(fs.readFileSync("fx"))); - } catch(e) { + } catch (e) { l.warn("Failed to read fx file"); } @@ -47,12 +48,9 @@ let fetchRates; setTimeout(fetchRates, 7200000); })(); -app.get( - "/rates", - ah(async (req, res, next) => { - res.send(app.get("rates")); - }) -); +app.get("/rates", async (req, res, next) => { + res.send(app.get("rates")); +}); setInterval(() => { broadcast("rate", app.get("last")); diff --git a/lib/register.js b/lib/register.js index 0f7032b3..3dc259f5 100644 --- a/lib/register.js +++ b/lib/register.js @@ -2,7 +2,7 @@ import { authenticator } from 'otplib'; import axios from 'axios'; import bcrypt from 'bcrypt'; -register = ah(async (user, ip, requireChallenge) => { +export const register = async (user, ip, requireChallenge) => { if (!(user && user.username)) throw new Error("Username required"); user.username = user.username.replace(/ /g, ""); @@ -60,4 +60,4 @@ register = ah(async (user, ip, requireChallenge) => { await user.save(); l.info("new user", user.username, ip); return user; -}); +} diff --git a/lib/rpc.js b/lib/rpc.js new file mode 100644 index 00000000..72d1ee73 --- /dev/null +++ b/lib/rpc.js @@ -0,0 +1,18 @@ +export default ({ host, port, wallet, user, password }) => + new Proxy( + {}, + { + get: (target, prop) => (...params) => + ((method, ...params) => + wretch() + .url(`http://${host}:${port}/wallet/${wallet}`) + .auth( + `Basic ${Buffer.from(`${user}:${password}`).toString("base64")}` + ) + .post({ + method, + params + }) + .json(({ result }) => result))(prop.toLowerCase(), ...params) + } + ); diff --git a/lib/send.js b/lib/send.js index e30f0c4b..e589ca6b 100644 --- a/lib/send.js +++ b/lib/send.js @@ -1,8 +1,8 @@ import bolt11 from 'bolt11'; -import { Op } from 'sequelize'; +import { Op } from '@sequelize/core'; import { computeConversionFee, conversionFeeReceiver } from '../routes/lightning/conversionFee.js'; -send = async (amount, memo, hash, user) => { +export const send = async (amount, memo, hash, user) => { l.info("attempting lightning payment", user.username, amount, hash); let payreq = bolt11.decode(hash); diff --git a/lib/sockets.js b/lib/sockets.js index 91d9636c..dcb8a840 100644 --- a/lib/sockets.js +++ b/lib/sockets.js @@ -1,11 +1,14 @@ -import jwt from 'jsonwebtoken'; -import { v4 as uuidv4 } from 'uuid'; -import WebSocket from 'ws'; -import { differenceInSeconds, subSeconds } from 'date-fns'; -const code = 1000; +import app from "../app.js"; +import jwt from "jsonwebtoken"; +import { v4 as uuidv4 } from "uuid"; +import WebSocket from "ws"; +import { differenceInSeconds, subSeconds } from "date-fns"; +import fastifyWs from "@fastify/websocket"; +import whitelist from "./whitelist.js"; +const code = 1000; -wss = new WebSocket.Server({ clientTracking: false, noServer: true }); +const wss = new WebSocket.Server({ clientTracking: false, noServer: true }); /* eslint-disable-next-line */ const pick = (O, ...K) => K.reduce((o, k) => ((o[k] = O[k]), o), {}); @@ -13,14 +16,13 @@ const all = {}; const subscriptions = []; const lastSeen = {}; -emit = (username, type, data) => { +export const emit = (username, type, data) => { if (data.username !== undefined) data = pick(data, ...whitelist); - if (type === "payment" && data.amount > 0) { for (let i = subscriptions.length - 1; i >= 0; i--) { let s = subscriptions[i]; - + if ( s.invoice.amount === data.amount || (data.address && s.invoice.address === data.address) || @@ -39,7 +41,7 @@ emit = (username, type, data) => { } }; -broadcast = (type, data) => { +export const broadcast = (type, data) => { const sent = []; for (const username in sockets) { for (const id in sockets[username]) { @@ -54,12 +56,155 @@ broadcast = (type, data) => { }); }; -server.on("upgrade", function(req, socket, head) { - wss.handleUpgrade(req, socket, head, function(ws) { - wss.emit("connection", ws, req); +app.register(fastifyWs); +app.register(async function(app) { + app.get("/ws", { websocket: true }, ({ socket: ws }, req) => { + const id = uuidv4(); + ws.id = id; + ws.beats = 0; + ws.send(JSON.stringify({ type: "connected", data: id })); + all[id] = ws; + + ws.on("message", async message => { + let type, data; + try { + ({ type, data } = JSON.parse(message)); + } catch (e) { + l.error("coudn't parse socket message"); + } + + switch (type) { + case "heartbeat": + ws.beats = 0; + if (ws.user) emit(ws.user.username, "id", ws.id); + break; + + case "login": + let token = data; + + // if (differenceInSeconds(new Date(), lastSeen[token]) < 5) return; + lastSeen[token] = new Date(); + + try { + if (!token || token === "null" || !jwt.decode(token)) + return ws.close(code, `bad token ${token}`); + const username = jwt.decode(token).username; + if (!username) throw new Error("Invalid JWT token"); + + if (!sockets[username]) sockets[username] = {}; + const existing = Object.keys(sockets[username]); + if (existing.length > 4) { + const p = existing.find(sid => sid !== id); + sockets[username][p].send(JSON.stringify({ type: "logout" })); + setTimeout(() => { + if (sockets[username][p]) + sockets[username][p].close(code, "too many sockets"); + }, 5000); + } + sockets[username][id] = ws; + names[id] = username; + + let user = await getUser(username); + if (user.locked) throw new Error("Account is locked"); + let payments = await user.getPayments({ + where: { + account_id: user.account_id + }, + order: [["id", "DESC"]], + limit: 12, + include: [ + { + model: db.Account, + as: "account" + }, + { + model: db.Payment, + as: "fee_payment" + } + ] + }); + + let accounts = await user.getAccounts(); + let keys = await user.getKeys(); + user = user.get({ plain: true }); + user.accounts = accounts; + user.keys = keys; + user.payments = payments; + + ws.user = user; + ws.send(JSON.stringify({ type: "login", data: user })); + ws.send( + JSON.stringify({ type: "version", data: config.clientVersion }) + ); + } catch (e) { + l.error("caught socket error", e.message); + if (e.message.includes("locked")) { + ws.send(JSON.stringify({ type: "locked" })); + ws.send(JSON.stringify({ type: "logout" })); + } + if (e.message.includes("not found")) + ws.send(JSON.stringify({ type: "logout" })); + setTimeout( + () => ws && ws.close(code, `closing due to error ${e.message}`), + 1000 + ); + } + break; + case "token": + if (!ws.user) return; + ws.token = data; + break; + case "lnurl": + sessions[data] = ws; + break; + case "updateMemo": + const payment = await db.Payment.findOne({ + where: { + user_id: ws.user.id, + id: data.id + }, + include: { + model: db.Account, + as: "account" + } + }); + if (payment) { + payment.memo = data.memo; + await payment.save(); + emit(ws.user.username, "payment", payment); + } + break; + case "subscribe": + subscriptions.push({ invoice: data, ws }); + break; + default: + l.warn("received socket message of unknown type", type, data); + } + }); + + ws.on("close", function(code, reason) { + // if (reason) console.log("closing socket", reason); + try { + const username = names[id]; + if (sockets[username] && sockets[username][id]) { + delete sockets[username][id]; + } + + if (all[id]) delete all[id]; + } catch (e) { + l.error("problem closing socket", e.message); + } + }); }); }); +app.listen({ port: 3000 }, err => { + if (err) { + fastify.log.error(err); + process.exit(1); + } +}); + const names = {}; setInterval(() => { @@ -71,135 +216,3 @@ setInterval(() => { } } }, 2000); - -wss.on("connection", function(ws, req) { - const id = uuidv4(); - ws.id = id; - ws.beats = 0; - ws.send(JSON.stringify({ type: "connected", data: id })); - all[id] = ws; - - ws.on("message", async message => { - let type, data; - try { - ({ type, data } = JSON.parse(message)); - } catch (e) { - l.error("coudn't parse socket message"); - } - - switch (type) { - case "heartbeat": - ws.beats = 0; - if (ws.user) emit(ws.user.username, "id", ws.id); - break; - - case "login": - let token = data; - - // if (differenceInSeconds(new Date(), lastSeen[token]) < 5) return; - lastSeen[token] = new Date(); - - try { - if (!token || token === "null" || !jwt.decode(token)) return ws.close(code, `bad token ${token}`); - const username = jwt.decode(token).username; - if (!username) throw new Error("Invalid JWT token"); - - if (!sockets[username]) sockets[username] = {}; - const existing = Object.keys(sockets[username]); - if (existing.length > 4) { - const p = existing.find(sid => sid !== id); - sockets[username][p].send(JSON.stringify({ type: "logout" })); - setTimeout(() => { - if (sockets[username][p]) sockets[username][p].close(code, "too many sockets"); - }, 5000); - } - sockets[username][id] = ws; - names[id] = username; - - let user = await getUser(username); - if (user.locked) throw new Error("Account is locked"); - let payments = await user.getPayments({ - where: { - account_id: user.account_id - }, - order: [["id", "DESC"]], - limit: 12, - include: [{ - model: db.Account, - as: "account" - }, - { - model: db.Payment, - as: "fee_payment" - }] - }); - - let accounts = await user.getAccounts(); - let keys = await user.getKeys(); - user = user.get({ plain: true }); - user.accounts = accounts; - user.keys = keys; - user.payments = payments; - - ws.user = user; - ws.send(JSON.stringify({ type: "login", data: user })); - ws.send( - JSON.stringify({ type: "version", data: config.clientVersion }) - ); - } catch (e) { - l.error("caught socket error", e.message); - if (e.message.includes("locked")) { - ws.send(JSON.stringify({ type: "locked" })); - ws.send(JSON.stringify({ type: "logout" })); - } - if (e.message.includes("not found")) - ws.send(JSON.stringify({ type: "logout" })); - setTimeout(() => ws && ws.close(code, `closing due to error ${e.message}`), 1000); - } - break; - case "token": - if (!ws.user) return; - ws.token = data; - break; - case "lnurl": - sessions[data] = ws; - break; - case "updateMemo": - const payment = await db.Payment.findOne({ - where: { - user_id: ws.user.id, - id: data.id - }, - include: { - model: db.Account, - as: "account" - } - }); - if (payment) { - payment.memo = data.memo; - await payment.save(); - emit(ws.user.username, "payment", payment); - } - break; - case "subscribe": - subscriptions.push({ invoice: data, ws }); - break; - default: - l.warn("received socket message of unknown type", type, data); - } - }); - - ws.on("close", function(code, reason) { - // if (reason) console.log("closing socket", reason); - try { - const username = names[id]; - if (sockets[username] && sockets[username][id]) { - delete sockets[username][id]; - } - - if (all[id]) delete all[id]; - } catch (e) { - l.error("problem closing socket", e.message); - } - }); -}); diff --git a/lib/store.js b/lib/store.js new file mode 100644 index 00000000..fae3e65a --- /dev/null +++ b/lib/store.js @@ -0,0 +1,14 @@ +import persist from "./persist.js"; + +export const addresses = {}; +export const challenge = {}; +export const change = []; +export const exceptions = []; +export const issuances = {}; +export const logins = {}; +export const seen = []; +export const sessions = {}; +export const sockets = {}; +export const unaccounted = []; +export const networks = []; +export const convert = persist("data/conversions.json"); diff --git a/lib/sync.js b/lib/sync.js index ab1e81f0..1a98c121 100644 --- a/lib/sync.js +++ b/lib/sync.js @@ -1,7 +1,9 @@ -import { differenceInDays } from 'date-fns'; -import fs from 'fs'; -import read from '../lib/read.js'; -import { Op } from 'sequelize'; +import db from "../db/index.js"; +import app from "../app.js"; +import { differenceInDays } from "date-fns"; +import fs from "fs"; +import read from "../lib/read.js"; +import { Op } from "@sequelize/core"; const init = async () => { try { @@ -134,7 +136,12 @@ const sync = async () => { } } } catch (e) { - l.error("problem syncing lightning payment", JSON.stringify(missed[i]), e.message, e.stack); + l.error( + "problem syncing lightning payment", + JSON.stringify(missed[i]), + e.message, + e.stack + ); } } @@ -311,34 +318,31 @@ const sync = async () => { setTimeout(sync, 5000); -app.get( - "/conversions", - ah(async (req, res) => { - const transactions = [ - ...(await bc.listTransactions("*", 500)), - ...(await lq.listTransactions("*", 500)) - ].filter(tx => ["receive"].includes(tx.category)); - - const { addr } = req.query; - const { invoices } = require("./invoices"); - const persist = require("./persist"); - let conversions = persist("data/conversions.json"); - const payments = ( - await db.Payment.findAll({ - attributes: ["hash"] +app.get("/conversions", async (req, res) => { + const transactions = [ + ...(await bc.listTransactions("*", 500)), + ...(await lq.listTransactions("*", 500)) + ].filter(tx => ["receive"].includes(tx.category)); + + const { addr } = req.query; + const { invoices } = require("./invoices"); + const persist = require("./persist"); + let conversions = persist("data/conversions.json"); + const payments = ( + await db.Payment.findAll({ + attributes: ["hash"] + }) + ).map(p => p.hash); + res.send( + Object.keys(conversions) + .filter(c => conversions[c].address === addr) + .filter(c => { + return ( + invoices.find( + i => i.payment_request === c && i.state === "SETTLED" + ) || transactions.find(tx => tx.txid === c) + ); }) - ).map(p => p.hash); - res.send( - Object.keys(conversions) - .filter(c => conversions[c].address === addr) - .filter(c => { - return ( - invoices.find( - i => i.payment_request === c && i.state === "SETTLED" - ) || transactions.find(tx => tx.txid === c) - ); - }) - .filter(c => !payments.includes(c)) - ); - }) -); + .filter(c => !payments.includes(c)) + ); +}); diff --git a/lib/upload.js b/lib/upload.js index 2cd99bc3..f48a3d94 100644 --- a/lib/upload.js +++ b/lib/upload.js @@ -1,4 +1,6 @@ -import multer from 'multer'; +import { auth } from "./passport.js"; +import app from "../app.js"; +import multer from "multer"; const storage = multer.diskStorage({ destination: (req, file, cb) => { @@ -11,10 +13,10 @@ const storage = multer.diskStorage({ } }); -upload = multer({ +export const upload = multer({ storage, onFileUploadStart: (file, req, res) => { - console.log("CHECKING SIZE") + console.log("CHECKING SIZE"); const maxSize = 32 * 1000 * 1000; if (req.files.file.length > maxSize) { return false; @@ -22,12 +24,7 @@ upload = multer({ } }); -app.post( - "/profile", - auth, - upload.single("squirt"), - ah(async (req, res) => { - let { filename } = req.file; - res.send({ filename }); - }) -); +app.post("/profile", auth, upload.single("squirt"), async (req, res) => { + let { filename } = req.file; + res.send({ filename }); +}); diff --git a/lib/utils.js b/lib/utils.js index 1de8ffeb..af50d7ec 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -1,7 +1,7 @@ -import sequelize from 'sequelize'; +import sequelize from '@sequelize/core'; const { Op } = sequelize; -getUser = async (username, transaction) => { +export const getUser = async (username, transaction) => { let params = { include: [ { @@ -25,7 +25,7 @@ getUser = async (username, transaction) => { return user; }; -getUserById = async (id, transaction) => { +export const getUserById = async (id, transaction) => { let params = { include: [ { @@ -46,3 +46,11 @@ getUserById = async (id, transaction) => { return user; }; + +export const prod = process.env.NODE_ENV === "production"; +export const fail = msg => { + throw new Error(msg); +}; + +export const SATS = 100000000; +export const toSats = n => Math.round(n * SATS); diff --git a/lib/webhooks.js b/lib/webhooks.js index 0dc1df52..ccebc024 100644 --- a/lib/webhooks.js +++ b/lib/webhooks.js @@ -2,7 +2,7 @@ import wretch from 'wretch'; import fetch from 'node-fetch'; wretch().polyfills({ fetch }); -callWebhook = (invoice, payment) => { +export const callWebhook = (invoice, payment) => { if (!invoice || !payment) return; let { address, text, webhook } = invoice; diff --git a/lib/whitelist.js b/lib/whitelist.js index 39d1fb0f..229f2682 100644 --- a/lib/whitelist.js +++ b/lib/whitelist.js @@ -1,4 +1,4 @@ -whitelist = [ +export default [ "id", "account", "account_id", diff --git a/package.json b/package.json index d0f33e12..a6c5497d 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,10 @@ "debug": "DEBUG=debug nodemon index.js" }, "dependencies": { - "@asoltys/bitcoin-core": "^3.0.7", + "@fastify/passport": "^2.2.0", + "@fastify/secure-session": "^5.2.0", + "@fastify/websocket": "^7.0.1", + "@sequelize/core": "7.0.0-alpha.10", "async-mutex": "^0.2.4", "axios": "^0.21.1", "bcrypt": "^5.0.0", @@ -30,6 +33,7 @@ "express-async-handler": "^1.1.4", "express-pino-logger": "^6.0.0", "express-session": "^1.16.2", + "fastify": "^4.5.3", "file-type": "^18.0.0", "http-proxy-middleware": "^0.20.0", "imap": "^0.8.19", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0bf0af24..d839b0ac 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,7 +1,10 @@ -lockfileVersion: 5.3 +lockfileVersion: 5.4 specifiers: - '@asoltys/bitcoin-core': ^3.0.7 + '@fastify/passport': ^2.2.0 + '@fastify/secure-session': ^5.2.0 + '@fastify/websocket': ^7.0.1 + '@sequelize/core': 7.0.0-alpha.10 async-mutex: ^0.2.4 axios: ^0.21.1 bcrypt: ^5.0.0 @@ -22,6 +25,7 @@ specifiers: express-async-handler: ^1.1.4 express-pino-logger: ^6.0.0 express-session: ^1.16.2 + fastify: ^4.5.3 file-type: ^18.0.0 http-proxy-middleware: ^0.20.0 imap: ^0.8.19 @@ -58,7 +62,10 @@ specifiers: zeromq: 6.0.0-beta.6 dependencies: - '@asoltys/bitcoin-core': 3.0.7 + '@fastify/passport': 2.2.0 + '@fastify/secure-session': 5.2.0 + '@fastify/websocket': 7.0.1 + '@sequelize/core': 7.0.0-alpha.10_z5l6k2ymvrhe2jtlk3taqnzt7e async-mutex: 0.2.6 axios: 0.21.4 bcrypt: 5.0.1 @@ -79,11 +86,12 @@ dependencies: express-async-handler: 1.1.4 express-pino-logger: 6.0.0 express-session: 1.17.2 + fastify: 4.5.3 file-type: 18.0.0 http-proxy-middleware: 0.20.0 imap: 0.8.19 jsonwebtoken: 8.5.1 - knex: 0.95.11_305ac8a2f3555d00db92ee05fbd9623c + knex: 0.95.11_gbnmrixtkvoqbw4s5yc7xwlchq lightning: 3.5.0 liquidjs-lib: github.com/asoltys/liquidjs-lib/4a0bb0c4b38d327ec247d49e89219798fb0b28e2 lnurl: 0.19.0 @@ -118,45 +126,71 @@ devDependencies: packages: - /@asoltys/bitcoin-core/3.0.7: - resolution: {integrity: sha512-znXEzdNACYyol44aqPmQkamY+fb3T75dpybn27YDVvPsgPDZrO+cRvdBP+fi7li2bgr0boGTApk/T9JK9TCqVQ==} - engines: {node: '>=4'} + /@cto.af/textdecoder/0.0.0: + resolution: {integrity: sha512-sJpx3F5xcVV/9jNYJQtvimo4Vfld/nD3ph+ZWtQzZ03Zo8rJC7QKQTRcIGS13Rcz80DwFNthCWMrd58vpY4ZAQ==} + engines: {node: '>=4.9.1'} + dev: false + + /@fastify/ajv-compiler/3.2.0: + resolution: {integrity: sha512-JrqgKmZoh1AJojDZk699DupQ9+tz5gSy7/w+5DrkXy5whM5IcqdV3SjG5qnOqgVJT1nPtUMDY0xYus2j6vwJiw==} dependencies: - '@asoltys/request': 2.88.2 - json-bigint: 1.0.0 - lodash: 4.17.21 - semver: 5.7.1 - standard-error: 1.1.0 + ajv: 8.11.0 + ajv-formats: 2.1.1 + fast-uri: 2.1.0 dev: false - /@asoltys/request/2.88.2: - resolution: {integrity: sha512-7OCJ0kpkHPzZtP4Ibp5Y+x2N+BFr27XBZYUElb5UD5OJeRghSUwgkpolPkowD+0WZqs0UFFKMkMH943tTUXt/w==} - engines: {node: '>= 6'} + /@fastify/cookie/7.4.0: + resolution: {integrity: sha512-82MUHsZJY/Wl+rG2E+bnYxSifOtNRChm2M+8xnZHnKtYmyNfLvy/37ElCtqD3KzUyTycR+GE7v7uiDD/tY4TkA==} dependencies: - aws-sign2: 0.7.0 - aws4: 1.11.0 - caseless: 0.12.0 - combined-stream: 1.0.8 - extend: 3.0.2 - forever-agent: 0.6.1 - form-data: 2.3.3 - http-signature: 1.2.0 - is-typedarray: 1.0.0 - isstream: 0.1.2 - json-stringify-safe: 5.0.1 - mime-types: 2.1.33 - oauth-sign: 0.9.0 - performance-now: 2.1.0 - qs: 6.5.2 - safe-buffer: 5.2.1 - tough-cookie: 2.5.0 - tunnel-agent: 0.6.0 - uuid: 3.4.0 + cookie: 0.5.0 + fastify-plugin: 4.2.1 dev: false - /@cto.af/textdecoder/0.0.0: - resolution: {integrity: sha512-sJpx3F5xcVV/9jNYJQtvimo4Vfld/nD3ph+ZWtQzZ03Zo8rJC7QKQTRcIGS13Rcz80DwFNthCWMrd58vpY4ZAQ==} - engines: {node: '>=4.9.1'} + /@fastify/deepmerge/1.1.0: + resolution: {integrity: sha512-E8Hfdvs1bG6u0N4vN5Nty6JONUfTdOciyD5rn8KnEsLKIenvOVcr210BQR9t34PRkNyjqnMLGk3e0BsaxRdL+g==} + dev: false + + /@fastify/error/3.0.0: + resolution: {integrity: sha512-dPRyT40GiHRzSCll3/Jn2nPe25+E1VXc9tDwRAIKwFCxd5Np5wzgz1tmooWG3sV0qKgrBibihVoCna2ru4SEFg==} + dev: false + + /@fastify/fast-json-stringify-compiler/4.1.0: + resolution: {integrity: sha512-cTKBV2J9+u6VaKDhX7HepSfPSzw+F+TSd+k0wzifj4rG+4E5PjSFJCk19P8R6tr/72cuzgGd+mbB3jFT6lvAgw==} + dependencies: + fast-json-stringify: 5.2.0 + dev: false + + /@fastify/flash/5.0.0: + resolution: {integrity: sha512-ny5qwwYOYIJ+C05KyyIc8cWAr5Ca+Xzocn0ReTsNSqoeQ1UDjN6mWH24VXfQvsI6x8bQSmQdLhiWncPruyZbag==} + engines: {node: '>=10.16.0'} + dependencies: + fastify-plugin: 3.0.1 + dev: false + + /@fastify/passport/2.2.0: + resolution: {integrity: sha512-JbrtmJUotEgPf9FPpCpbMcVDghLbjziAkj7EnufEaRpMOZE3wkeVg0CzgnD+nrIGoHo6D31RCJMIZMvvLxb+ew==} + dependencies: + '@fastify/flash': 5.0.0 + fastify-plugin: 4.2.1 + dev: false + + /@fastify/secure-session/5.2.0: + resolution: {integrity: sha512-oRWKdHwWUzp4rsJ3GnR8w8doE+7vllWMtohBVp77bENkhm4/OvofaO6PJLJuQvKF7XJAKiGip29dX1RsllKT7g==} + hasBin: true + dependencies: + '@fastify/cookie': 7.4.0 + fastify-plugin: 3.0.1 + sodium-native: 3.4.1 + dev: false + + /@fastify/websocket/7.0.1: + resolution: {integrity: sha512-LHOUKqRr1iV4w47sVQAT5IrVPsTiuEAqOS1QgtRymJYPeVfIC65LTxg22eoR7kyYW4W84oWJk0gtsBwUGhDEVg==} + dependencies: + fastify-plugin: 4.2.1 + ws: 8.8.1 + transitivePeerDependencies: + - bufferutil + - utf-8-validate dev: false /@grpc/grpc-js/1.3.6: @@ -264,7 +298,7 @@ packages: async: 3.2.2 chalk: 3.0.0 dayjs: 1.8.36 - debug: 4.3.2 + debug: 4.3.4 eventemitter2: 5.0.1 fast-json-patch: 3.1.0 fclone: 1.0.11 @@ -287,7 +321,7 @@ packages: '@opencensus/core': 0.0.9 '@opencensus/propagation-b3': 0.0.8 async: 2.6.3 - debug: 4.3.2 + debug: 4.3.4 eventemitter2: 6.4.5 require-in-the-middle: 5.1.0 semver: 6.3.0 @@ -303,8 +337,8 @@ packages: engines: {node: '>=4.0'} dependencies: async: 2.6.3 - axios: 0.21.4_debug@4.3.2 - debug: 4.3.2 + axios: 0.21.4_debug@4.3.4 + debug: 4.3.4 eventemitter2: 6.4.5 ws: 7.5.5 transitivePeerDependencies: @@ -316,7 +350,7 @@ packages: /@pm2/pm2-version-check/1.0.4: resolution: {integrity: sha512-SXsM27SGH3yTWKc2fKR4SYNxsmnvuBQ9dd6QHtEWmiZ/VqaOYPAIlS8+vMcn27YLtAEBGvNRSh3TPNvtjZgfqA==} dependencies: - debug: 4.3.2 + debug: 4.3.4 transitivePeerDependencies: - supports-color dev: false @@ -364,6 +398,61 @@ packages: resolution: {integrity: sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=} dev: false + /@sequelize/core/7.0.0-alpha.10_z5l6k2ymvrhe2jtlk3taqnzt7e: + resolution: {integrity: sha512-uikpWaCiIaijsgoa9cH+3jCQl8r+FaQPhoE8AOJYvPwxOx52E1JZnRPMXNnlpbFy3Xu0qekrc5LBJq7IR8UB0Q==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + ibm_db: '*' + mariadb: '*' + mysql2: '*' + odbc: '*' + pg: '*' + pg-hstore: '*' + snowflake-sdk: '*' + sqlite3: '*' + tedious: '*' + peerDependenciesMeta: + ibm_db: + optional: true + mariadb: + optional: true + mysql2: + optional: true + odbc: + optional: true + pg: + optional: true + pg-hstore: + optional: true + snowflake-sdk: + optional: true + sqlite3: + optional: true + tedious: + optional: true + dependencies: + '@types/debug': 4.1.7 + debug: 4.3.4 + dottie: 2.0.2 + inflection: 1.13.2 + lodash: 4.17.21 + mariadb: 2.5.4 + moment: 2.29.1 + moment-timezone: 0.5.37 + mysql2: 2.3.0 + pg-connection-string: 2.5.0 + retry-as-promised: 5.0.0 + semver: 7.3.5 + sequelize-pool: 7.1.0 + sqlite3: 5.0.2 + toposort-class: 1.0.1 + uuid: 8.3.2 + validator: 13.7.0 + wkx: 0.5.0 + transitivePeerDependencies: + - supports-color + dev: false + /@sindresorhus/is/0.14.0: resolution: {integrity: sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==} engines: {node: '>=6'} @@ -408,6 +497,12 @@ packages: '@types/node': 16.10.3 dev: false + /@types/debug/4.1.7: + resolution: {integrity: sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==} + dependencies: + '@types/ms': 0.7.31 + dev: false + /@types/express-serve-static-core/4.17.24: resolution: {integrity: sha512-3UJuW+Qxhzwjq3xhwXm2onQcFHn76frIYVbTu+kn24LFxI+dEhdfISDFovPB8VpEgW8oQCTpRuCe+0zJxB7NEA==} dependencies: @@ -450,6 +545,10 @@ packages: resolution: {integrity: sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==} dev: false + /@types/ms/0.7.31: + resolution: {integrity: sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==} + dev: false + /@types/node/10.12.18: resolution: {integrity: sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ==} dev: false @@ -526,6 +625,17 @@ packages: resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} dev: false + /abort-controller/3.0.0: + resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==} + engines: {node: '>=6.5'} + dependencies: + event-target-shim: 5.0.1 + dev: false + + /abstract-logging/2.0.1: + resolution: {integrity: sha512-2BjRTZxTPvheOvGbBslFSYOUkr+SjPtOnrLP33f+VIWLzezQpZcqVg7ja3L4dBXmzzgwT+a029jRx5PCi3JuiA==} + dev: false + /accepts/1.3.7: resolution: {integrity: sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==} engines: {node: '>= 0.6'} @@ -552,11 +662,20 @@ packages: resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} engines: {node: '>= 6.0.0'} dependencies: - debug: 4.3.2 + debug: 4.3.4 transitivePeerDependencies: - supports-color dev: false + /ajv-formats/2.1.1: + resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} + peerDependenciesMeta: + ajv: + optional: true + dependencies: + ajv: 8.11.0 + dev: false + /ajv/6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} dependencies: @@ -567,6 +686,15 @@ packages: dev: false optional: true + /ajv/8.11.0: + resolution: {integrity: sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==} + dependencies: + fast-deep-equal: 3.1.3 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + uri-js: 4.4.1 + dev: false + /amp-message/0.1.2: resolution: {integrity: sha1-p48cmJlQh602GSpBKY5NtJ49/EU=} dependencies: @@ -637,6 +765,10 @@ packages: resolution: {integrity: sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==} dev: false + /archy/1.0.0: + resolution: {integrity: sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw==} + dev: false + /are-we-there-yet/1.1.7: resolution: {integrity: sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g==} dependencies: @@ -678,11 +810,13 @@ packages: dependencies: safer-buffer: 2.1.2 dev: false + optional: true /assert-plus/1.0.0: resolution: {integrity: sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=} engines: {node: '>=0.8'} dev: false + optional: true /ast-types/0.13.4: resolution: {integrity: sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==} @@ -745,13 +879,25 @@ packages: engines: {node: '>=8.0.0'} dev: false + /avvio/8.2.0: + resolution: {integrity: sha512-bbCQdg7bpEv6kGH41RO/3B2/GMMmJSo2iBK+X8AWN9mujtfUipMDfIjsgHCfpnKqoGEQrrmCDKSa5OQ19+fDmg==} + dependencies: + archy: 1.0.0 + debug: 4.3.4 + fastq: 1.13.0 + transitivePeerDependencies: + - supports-color + dev: false + /aws-sign2/0.7.0: resolution: {integrity: sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=} dev: false + optional: true /aws4/1.11.0: resolution: {integrity: sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==} dev: false + optional: true /axios/0.21.4: resolution: {integrity: sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==} @@ -761,10 +907,10 @@ packages: - debug dev: false - /axios/0.21.4_debug@4.3.2: + /axios/0.21.4_debug@4.3.4: resolution: {integrity: sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==} dependencies: - follow-redirects: 1.14.4_debug@4.3.2 + follow-redirects: 1.14.4_debug@4.3.4 transitivePeerDependencies: - debug dev: false @@ -792,6 +938,7 @@ packages: dependencies: tweetnacl: 0.14.5 dev: false + optional: true /bcrypt/5.0.1: resolution: {integrity: sha512-9BTgmrhZM2t1bNuDtrtIMVSmmxZBrJ71n8Wg+YgdjHuIWYF7SjjmCPZFB+/5i/o/PIeRpwVJR3P+NrpIItUjqw==} @@ -983,6 +1130,8 @@ packages: qs: 6.7.0 raw-body: 2.4.0 type-is: 1.6.18 + transitivePeerDependencies: + - supports-color dev: false /bolt07/1.7.3: @@ -1126,6 +1275,7 @@ packages: /caseless/0.12.0: resolution: {integrity: sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=} dev: false + optional: true /cbor/7.0.6: resolution: {integrity: sha512-rgt2RFogHGDLFU5r0kSfyeBc+de55DwYHP73KxKsQxsR5b0CYuQPH6AnJaXByiohpLdjQqj/K0SFcOV+dXdhSA==} @@ -1328,6 +1478,8 @@ packages: on-headers: 1.0.2 safe-buffer: 5.1.2 vary: 1.1.2 + transitivePeerDependencies: + - supports-color dev: false /concat-map/0.0.1: @@ -1401,9 +1553,15 @@ packages: engines: {node: '>= 0.6'} dev: false + /cookie/0.5.0: + resolution: {integrity: sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==} + engines: {node: '>= 0.6'} + dev: false + /core-util-is/1.0.2: resolution: {integrity: sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=} dev: false + optional: true /core-util-is/1.0.3: resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} @@ -1457,6 +1615,7 @@ packages: dependencies: assert-plus: 1.0.0 dev: false + optional: true /data-uri-to-buffer/1.2.0: resolution: {integrity: sha512-vKQ9DTQPN1FLYiiEEOQ6IBGFqvjCa5rSK3cWMy/Nespm5d/x3dGFT9UBZnkLxCwua/IXBi2TYnwTEpsOvhC4UQ==} @@ -1482,20 +1641,59 @@ packages: /debug/2.6.9: resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true dependencies: ms: 2.0.0 dev: false + /debug/2.6.9_supports-color@5.5.0: + resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.0.0 + supports-color: 5.5.0 + dev: false + /debug/3.1.0: resolution: {integrity: sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true dependencies: ms: 2.0.0 dev: false /debug/3.2.7: resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.3 + dev: false + + /debug/3.2.7_supports-color@5.5.0: + resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true dependencies: ms: 2.1.3 + supports-color: 5.5.0 dev: false /debug/4.3.2: @@ -1510,6 +1708,18 @@ packages: ms: 2.1.2 dev: false + /debug/4.3.4: + resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.2 + dev: false + /decode-uri-component/0.2.0: resolution: {integrity: sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=} engines: {node: '>=0.10'} @@ -1630,6 +1840,7 @@ packages: jsbn: 0.1.1 safer-buffer: 2.1.2 dev: false + optional: true /ecdsa-sig-formatter/1.0.11: resolution: {integrity: sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==} @@ -1782,6 +1993,11 @@ packages: engines: {node: '>= 0.6'} dev: false + /event-target-shim/5.0.1: + resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==} + engines: {node: '>=6'} + dev: false + /eventemitter2/0.4.14: resolution: {integrity: sha1-j2G3XN4BKy6esoTUVFWDtWQ7Yas=} dev: false @@ -1827,6 +2043,8 @@ packages: parseurl: 1.3.3 safe-buffer: 5.2.1 uid-safe: 2.1.5 + transitivePeerDependencies: + - supports-color dev: false /express/4.17.1: @@ -1863,6 +2081,8 @@ packages: type-is: 1.6.18 utils-merge: 1.0.1 vary: 1.1.2 + transitivePeerDependencies: + - supports-color dev: false /extend/3.0.2: @@ -1873,11 +2093,11 @@ packages: resolution: {integrity: sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=} engines: {'0': node >=0.6.0} dev: false + optional: true /fast-deep-equal/3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} dev: false - optional: true /fast-json-patch/3.1.0: resolution: {integrity: sha512-IhpytlsVTRndz0hU5t0/MGzS/etxLlfrpG5V5M9mVbuj9TrJLWaMfsox9REM5rkuGX0T+5qjpe8XA1o0gZ42nA==} @@ -1888,6 +2108,17 @@ packages: dev: false optional: true + /fast-json-stringify/5.2.0: + resolution: {integrity: sha512-u5jtrcAK9RINW15iuDKnsuuhqmqre4AmDMp3crRTjUMdAuHMpQUt3IfoMm5wlJm59b74PcajqOl3SjgnC5FPmw==} + dependencies: + '@fastify/deepmerge': 1.1.0 + ajv: 8.11.0 + ajv-formats: 2.1.1 + fast-deep-equal: 3.1.3 + fast-uri: 2.1.0 + rfdc: 1.3.0 + dev: false + /fast-levenshtein/2.0.6: resolution: {integrity: sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=} dev: false @@ -1897,20 +2128,64 @@ packages: engines: {node: '>=6'} dev: false + /fast-redact/3.1.2: + resolution: {integrity: sha512-+0em+Iya9fKGfEQGcd62Yv6onjBmmhV1uh86XVfOU8VwAe6kaFdQCWI9s0/Nnugx5Vd9tdbZ7e6gE2tR9dzXdw==} + engines: {node: '>=6'} + dev: false + /fast-safe-stringify/2.1.1: resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==} dev: false + /fast-uri/2.1.0: + resolution: {integrity: sha512-qKRta6N7BWEFVlyonVY/V+BMLgFqktCUV0QjT259ekAIlbVrMaFnFLxJ4s/JPl4tou56S1BzPufI60bLe29fHA==} + dev: false + /fast-url-parser/1.1.3: resolution: {integrity: sha1-9K8+qfNNiicc9YrSs3WfQx8LMY0=} dependencies: punycode: 1.4.1 dev: false + /fastify-plugin/3.0.1: + resolution: {integrity: sha512-qKcDXmuZadJqdTm6vlCqioEbyewF60b/0LOFCcYN1B6BIZGlYJumWWOYs70SFYLDAH4YqdE1cxH/RKMG7rFxgA==} + dev: false + + /fastify-plugin/4.2.1: + resolution: {integrity: sha512-dlGKiwLzRBKkEf5J5ho0uAD/Jdv8GQVUbriB3tAX3ehRUXE4gTV3lRd5inEg9li1aLzb0EGj8y2K4/8g1TN06g==} + dev: false + /fastify-warning/0.2.0: resolution: {integrity: sha512-s1EQguBw/9qtc1p/WTY4eq9WMRIACkj+HTcOIK1in4MV5aFaQC9ZCIt0dJ7pr5bIf4lPpHvAtP2ywpTNgs7hqw==} dev: false + /fastify/4.5.3: + resolution: {integrity: sha512-Q8Zvkmg7GnioMCDX1jT2Q7iRqjywlnDZ1735D2Ipf7ashCM/3/bqPKv2Jo1ZF2iDExct2eP1C/tdhcj0GG/OuQ==} + dependencies: + '@fastify/ajv-compiler': 3.2.0 + '@fastify/error': 3.0.0 + '@fastify/fast-json-stringify-compiler': 4.1.0 + abstract-logging: 2.0.1 + avvio: 8.2.0 + find-my-way: 7.0.1 + light-my-request: 5.5.1 + pino: 8.4.2 + process-warning: 2.0.0 + proxy-addr: 2.0.7 + rfdc: 1.3.0 + secure-json-parse: 2.4.0 + semver: 7.3.7 + tiny-lru: 8.0.2 + transitivePeerDependencies: + - supports-color + dev: false + + /fastq/1.13.0: + resolution: {integrity: sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==} + dependencies: + reusify: 1.0.4 + dev: false + /fclone/1.0.11: resolution: {integrity: sha1-EOhdo4v+p/xZk0HClu4ddyZu5kA=} dev: false @@ -1956,6 +2231,16 @@ packages: parseurl: 1.3.3 statuses: 1.5.0 unpipe: 1.0.0 + transitivePeerDependencies: + - supports-color + dev: false + + /find-my-way/7.0.1: + resolution: {integrity: sha512-w05SaOPg54KqBof/RDA+75n1R48V7ZZNPL3nR17jJJs5dgZpR3ivfrMWOyx7BVFQgCLhYRG05hfgFCohYvSUXA==} + engines: {node: '>=14'} + dependencies: + fast-deep-equal: 3.1.3 + safe-regex2: 2.0.0 dev: false /flatstr/1.0.12: @@ -1972,7 +2257,7 @@ packages: optional: true dev: false - /follow-redirects/1.14.4_debug@4.3.2: + /follow-redirects/1.14.4_debug@4.3.4: resolution: {integrity: sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g==} engines: {node: '>=4.0'} peerDependencies: @@ -1981,7 +2266,7 @@ packages: debug: optional: true dependencies: - debug: 4.3.2 + debug: 4.3.4 dev: false /follow-redirects/1.15.1: @@ -1997,6 +2282,7 @@ packages: /forever-agent/0.6.1: resolution: {integrity: sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=} dev: false + optional: true /form-data/2.3.3: resolution: {integrity: sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==} @@ -2006,6 +2292,7 @@ packages: combined-stream: 1.0.8 mime-types: 2.1.33 dev: false + optional: true /form-data/2.5.1: resolution: {integrity: sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==} @@ -2130,6 +2417,8 @@ packages: file-uri-to-path: 1.0.0 ftp: 0.3.10 readable-stream: 2.3.7 + transitivePeerDependencies: + - supports-color dev: false /get-uri/3.0.2: @@ -2138,7 +2427,7 @@ packages: dependencies: '@tootallnate/once': 1.1.2 data-uri-to-buffer: 3.0.1 - debug: 4.3.2 + debug: 4.3.4 file-uri-to-path: 2.0.0 fs-extra: 8.1.0 ftp: 0.3.10 @@ -2155,9 +2444,17 @@ packages: dependencies: assert-plus: 1.0.0 dev: false + optional: true - /git-node-fs/1.0.0: + /git-node-fs/1.0.0_js-git@0.7.8: resolution: {integrity: sha1-SbIV4kLr5Dqkx1Ybu6SZUhdSCA8=} + peerDependencies: + js-git: ^0.7.8 + peerDependenciesMeta: + js-git: + optional: true + dependencies: + js-git: 0.7.8 dev: false /git-sha1/0.1.2: @@ -2310,6 +2607,8 @@ packages: dependencies: agent-base: 4.3.0 debug: 3.1.0 + transitivePeerDependencies: + - supports-color dev: false /http-proxy-agent/4.0.1: @@ -2318,7 +2617,7 @@ packages: dependencies: '@tootallnate/once': 1.1.2 agent-base: 6.0.2 - debug: 4.3.2 + debug: 4.3.4 transitivePeerDependencies: - supports-color dev: false @@ -2354,6 +2653,7 @@ packages: jsprim: 1.4.1 sshpk: 1.16.1 dev: false + optional: true /http_ece/1.1.0: resolution: {integrity: sha512-bptAfCDdPJxOs5zYSe7Y3lpr772s1G346R4Td5LgRUeCwIGpCGDUTJxRrhTNcAXbx37spge0kWEIH7QAYWNTlA==} @@ -2368,6 +2668,8 @@ packages: dependencies: agent-base: 4.3.0 debug: 3.2.7 + transitivePeerDependencies: + - supports-color dev: false /https-proxy-agent/5.0.0: @@ -2375,7 +2677,7 @@ packages: engines: {node: '>= 6'} dependencies: agent-base: 6.0.2 - debug: 4.3.2 + debug: 4.3.4 transitivePeerDependencies: - supports-color dev: false @@ -2431,8 +2733,13 @@ packages: engines: {'0': node >= 0.4.0} dev: false + /inflection/1.13.2: + resolution: {integrity: sha512-cmZlljCRTBFouT8UzMzrGcVEvkv6D/wBdcdKG7J1QH5cXjtU75Dm+P27v9EKu/Y43UYyCJd1WC4zLebRrC8NBw==} + engines: {'0': node >= 0.4.0} + dev: false + /inflection/1.3.8: - resolution: {integrity: sha1-y9Fg2p91sUw8xjV41POWeEvzAU4=} + resolution: {integrity: sha512-xRvG6XhAkbneGO5BXP0uKyGkzmZ2bBbrFkx4ZVNx2TmsECbiq/pJapbbx/NECh+E85IfZwW5+IeVNJfkQgavag==} engines: {'0': node >= 0.4.0} dev: false @@ -2596,6 +2903,7 @@ packages: /isstream/0.1.2: resolution: {integrity: sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=} dev: false + optional: true /jest-diff/27.5.1: resolution: {integrity: sha512-m0NvkX55LDt9T4mctTEgnZk3fmEg3NRYutvMPWM/0iPnkFj2wIeF45O1718cMSOFO1vINkqmxqD8vE37uTEbqw==} @@ -2639,12 +2947,7 @@ packages: /jsbn/0.1.1: resolution: {integrity: sha1-peZUwuWi3rXyAdls77yoDA7y9RM=} dev: false - - /json-bigint/1.0.0: - resolution: {integrity: sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==} - dependencies: - bignumber.js: 9.0.1 - dev: false + optional: true /json-buffer/3.0.0: resolution: {integrity: sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=} @@ -2655,13 +2958,19 @@ packages: dev: false optional: true + /json-schema-traverse/1.0.0: + resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} + dev: false + /json-schema/0.2.3: resolution: {integrity: sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=} dev: false + optional: true /json-stringify-safe/5.0.1: resolution: {integrity: sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=} dev: false + optional: true /jsonfile/4.0.0: resolution: {integrity: sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=} @@ -2694,6 +3003,7 @@ packages: json-schema: 0.2.3 verror: 1.10.0 dev: false + optional: true /jwa/1.4.1: resolution: {integrity: sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==} @@ -2731,7 +3041,7 @@ packages: json-buffer: 3.0.0 dev: false - /knex/0.95.11_305ac8a2f3555d00db92ee05fbd9623c: + /knex/0.95.11_gbnmrixtkvoqbw4s5yc7xwlchq: resolution: {integrity: sha512-grDetD91O8VoQVCFqeWTgkzdq5406W6rggF/lK1hHuwzmjDs/0m9KxyncGdZbklTi7aUgHvw3+Cfy4x7FvpdaQ==} engines: {node: '>=10'} hasBin: true @@ -2798,6 +3108,14 @@ packages: type-check: 0.3.2 dev: false + /light-my-request/5.5.1: + resolution: {integrity: sha512-Zd4oZjF7axSyc5rYQsbB0qsgY4LFFviZSbEywxf7Vi5UE3y3c7tYF/GeheQjBNYY+pQ55BF8UGGJTjneoxOS1w==} + dependencies: + cookie: 0.5.0 + process-warning: 2.0.0 + set-cookie-parser: 2.5.1 + dev: false + /lightning/3.5.0: resolution: {integrity: sha512-6Kj1JX8tG3JiV5LXYGuZkKckiRJ/OU8ukb/R5qsp7RWq/xw32LDccCKvOK8oRnOGw9K+G8jcZAOY21exr9OSFA==} engines: {node: '>=10.10.0'} @@ -2821,6 +3139,7 @@ packages: psbt: 1.1.10 transitivePeerDependencies: - bignumber.js + - supports-color dev: false /lnurl/0.19.0: @@ -3079,6 +3398,12 @@ packages: moment: 2.29.1 dev: false + /moment-timezone/0.5.37: + resolution: {integrity: sha512-uEDzDNFhfaywRl+vwXxffjjq1q0Vzr+fcQpQ1bU0kbzorfS7zVtZnCnGc8mhWmF39d4g4YriF6kwA75mJKE/Zg==} + dependencies: + moment: 2.29.1 + dev: false + /moment/2.29.1: resolution: {integrity: sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==} dev: false @@ -3089,7 +3414,7 @@ packages: dev: false /ms/2.0.0: - resolution: {integrity: sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=} + resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} dev: false /ms/2.1.1: @@ -3165,6 +3490,8 @@ packages: debug: 3.2.7 iconv-lite: 0.4.24 sax: 1.2.4 + transitivePeerDependencies: + - supports-color dev: false /needle/2.9.1: @@ -3175,6 +3502,8 @@ packages: debug: 3.2.7 iconv-lite: 0.4.24 sax: 1.2.4 + transitivePeerDependencies: + - supports-color dev: false /negotiator/0.6.2: @@ -3248,6 +3577,8 @@ packages: rimraf: 2.7.1 semver: 5.7.1 tar: 4.4.19 + transitivePeerDependencies: + - supports-color dev: false /nodemon/2.0.13: @@ -3257,14 +3588,14 @@ packages: requiresBuild: true dependencies: chokidar: 3.5.2 - debug: 3.2.7 + debug: 3.2.7_supports-color@5.5.0 ignore-by-default: 1.0.1 minimatch: 3.0.4 pstree.remy: 1.1.8 semver: 5.7.1 supports-color: 5.5.0 touch: 3.1.0 - undefsafe: 2.0.3 + undefsafe: 2.0.3_supports-color@5.5.0 update-notifier: 5.1.0 dev: false @@ -3359,12 +3690,17 @@ packages: /oauth-sign/0.9.0: resolution: {integrity: sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==} dev: false + optional: true /object-assign/4.1.1: resolution: {integrity: sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=} engines: {node: '>=0.10.0'} dev: false + /on-exit-leak-free/2.1.0: + resolution: {integrity: sha512-VuCaZZAjReZ3vUwgOB8LxAosIurDiAW0s13rI1YwmaP++jvcxP77AWoQvenZebpCA2m8WC1/EosPYPMjnRAp/w==} + dev: false + /on-finished/2.3.0: resolution: {integrity: sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=} engines: {node: '>= 0.8'} @@ -3429,7 +3765,7 @@ packages: resolution: {integrity: sha512-44DUg21G/liUZ48dJpUSjZnFfZro/0K5JTyFYLBcmh9+T6Ooi4/i4efwUiEy0+4oQusCBqWdhv16XohIj1GqnQ==} dependencies: agent-base: 4.3.0 - debug: 4.3.2 + debug: 4.3.4 get-uri: 2.0.4 http-proxy-agent: 2.1.0 https-proxy-agent: 3.0.1 @@ -3446,7 +3782,7 @@ packages: dependencies: '@tootallnate/once': 1.1.2 agent-base: 6.0.2 - debug: 4.3.2 + debug: 4.3.4 get-uri: 3.0.2 http-proxy-agent: 4.0.1 https-proxy-agent: 5.0.0 @@ -3564,6 +3900,7 @@ packages: /performance-now/2.1.0: resolution: {integrity: sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=} dev: false + optional: true /pg-connection-string/2.5.0: resolution: {integrity: sha512-r5o/V/ORTA6TmUnyWZR9nCj1klXCO2CEKNRlVuJptZe85QuhFayC7WeMic7ndayT5IRIR0S0xFxFi2ousartlQ==} @@ -3595,6 +3932,13 @@ packages: split2: 3.2.2 dev: false + /pino-abstract-transport/1.0.0: + resolution: {integrity: sha512-c7vo5OpW4wIS42hUVcT5REsL8ZljsUfBjqV/e2sFxmFEFZiq1XLUp5EYLtuDH6PEHq9W1egWqRbnLUP5FuZmOA==} + dependencies: + readable-stream: 4.1.0 + split2: 4.1.0 + dev: false + /pino-http/5.8.0: resolution: {integrity: sha512-YwXiyRb9y0WCD1P9PcxuJuh3Dc5qmXde/paJE86UGYRdiFOi828hR9iUGmk5gaw6NBT9gLtKANOHFimvh19U5w==} dependencies: @@ -3629,6 +3973,10 @@ packages: resolution: {integrity: sha512-cK0pekc1Kjy5w9V2/n+8MkZwusa6EyyxfeQCB799CQRhRt/CqYKiWs5adeu8Shve2ZNffvfC/7J64A2PJo1W/Q==} dev: false + /pino-std-serializers/6.0.0: + resolution: {integrity: sha512-mMMOwSKrmyl+Y12Ri2xhH1lbzQxwwpuru9VjyJpgFIH4asSj88F2csdMwN6+M5g1Ll4rmsYghHLQJw81tgZ7LQ==} + dev: false + /pino/6.13.3: resolution: {integrity: sha512-tJy6qVgkh9MwNgqX1/oYi3ehfl2Y9H0uHyEEMsBe74KinESIjdMrMQDWpcZPpPicg3VV35d/GLQZmo4QgU2Xkg==} hasBin: true @@ -3642,6 +3990,23 @@ packages: sonic-boom: 1.4.1 dev: false + /pino/8.4.2: + resolution: {integrity: sha512-PlXDeGhJZfAuVay+wtlS02s5j8uisQveZExYdAm9MwwxUQSz9R7Q78XtjM2tTa4sa5KJmygimZjZxXXuHgV6ew==} + hasBin: true + dependencies: + atomic-sleep: 1.0.0 + fast-redact: 3.1.2 + on-exit-leak-free: 2.1.0 + pino-abstract-transport: 1.0.0 + pino-std-serializers: 6.0.0 + process-warning: 2.0.0 + quick-format-unescaped: 4.0.4 + real-require: 0.2.0 + safe-stable-stringify: 2.3.1 + sonic-boom: 3.2.0 + thread-stream: 2.1.0 + dev: false + /please-upgrade-node/3.2.0: resolution: {integrity: sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==} dependencies: @@ -3652,7 +4017,7 @@ packages: resolution: {integrity: sha512-FbLvW60w+vEyvMjP/xom2UPhUN/2bVpdtLfKJeYM3gwzYhoTEEChCOICfFzxkxuoEleOlnpjie+n1nue91bDQw==} engines: {node: '>=5'} dependencies: - debug: 4.3.2 + debug: 4.3.4 transitivePeerDependencies: - supports-color dev: false @@ -3663,7 +4028,7 @@ packages: dependencies: amp: 0.3.1 amp-message: 0.1.2 - debug: 4.3.2 + debug: 4.3.4 escape-string-regexp: 4.0.0 transitivePeerDependencies: - supports-color @@ -3688,7 +4053,7 @@ packages: requiresBuild: true dependencies: async: 3.2.2 - debug: 4.3.2 + debug: 4.3.4 pidusage: 2.0.21 systeminformation: 5.9.7 tx2: 1.0.4 @@ -3776,6 +4141,10 @@ packages: resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} dev: false + /process-warning/2.0.0: + resolution: {integrity: sha512-+MmoAXoUX+VTHAlwns0h+kFUWFs/3FZy+ZuchkgjyOu3oioLAo2LB5aCfKPh2+P9O18i3m43tUEv3YqttSy0Ww==} + dev: false + /promisify-call/2.0.4: resolution: {integrity: sha1-1IwtRWUszM1SgB3ey9UzptS9X7o=} engines: {node: '>=4.0'} @@ -3822,7 +4191,7 @@ packages: engines: {node: '>=6'} dependencies: agent-base: 4.3.0 - debug: 4.3.2 + debug: 4.3.4 http-proxy-agent: 2.1.0 https-proxy-agent: 3.0.1 lru-cache: 5.1.1 @@ -3838,7 +4207,7 @@ packages: engines: {node: '>= 8'} dependencies: agent-base: 6.0.2 - debug: 4.3.2 + debug: 4.3.4 http-proxy-agent: 4.0.1 https-proxy-agent: 5.0.0 lru-cache: 5.1.1 @@ -3871,6 +4240,7 @@ packages: /psl/1.8.0: resolution: {integrity: sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==} dev: false + optional: true /pstree.remy/1.1.8: resolution: {integrity: sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==} @@ -3884,7 +4254,7 @@ packages: dev: false /punycode/1.4.1: - resolution: {integrity: sha1-wNWmOycYgArY4esPpSachN1BhF4=} + resolution: {integrity: sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==} dev: false /punycode/2.1.1: @@ -3909,6 +4279,7 @@ packages: resolution: {integrity: sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==} engines: {node: '>=0.6'} dev: false + optional: true /qs/6.7.0: resolution: {integrity: sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==} @@ -4016,6 +4387,13 @@ packages: util-deprecate: 1.0.2 dev: false + /readable-stream/4.1.0: + resolution: {integrity: sha512-sVisi3+P2lJ2t0BPbpK629j8wRW06yKGJUcaLAGXPAUhyUxVJm7VsCTit1PFgT4JHUDMrGNR+ZjSKpzGaRF3zw==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + abort-controller: 3.0.0 + dev: false + /readable-web-to-node-stream/3.0.2: resolution: {integrity: sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==} engines: {node: '>=8'} @@ -4030,6 +4408,11 @@ packages: picomatch: 2.3.0 dev: false + /real-require/0.2.0: + resolution: {integrity: sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==} + engines: {node: '>= 12.13.0'} + dev: false + /rechoir/0.7.0: resolution: {integrity: sha512-ADsDEH2bvbjltXEP+hTIAmeFekTFK0V2BTxMkok6qILyAJEXV0AFfoWcAq4yfll5VdIMd/RVXq0lR+wQi5ZU3Q==} engines: {node: '>= 0.10'} @@ -4084,10 +4467,15 @@ packages: engines: {node: '>=0.10.0'} dev: false + /require-from-string/2.0.2: + resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} + engines: {node: '>=0.10.0'} + dev: false + /require-in-the-middle/5.1.0: resolution: {integrity: sha512-M2rLKVupQfJ5lf9OvqFGIT+9iVLnTmjgbOmpil12hiSQNn5zJTKGPoIisETNjfK+09vP3rpm1zJajmErpr2sEQ==} dependencies: - debug: 4.3.2 + debug: 4.3.4 module-details-from-path: 1.0.3 resolve: 1.20.0 transitivePeerDependencies: @@ -4116,12 +4504,26 @@ packages: lowercase-keys: 1.0.1 dev: false + /ret/0.2.2: + resolution: {integrity: sha512-M0b3YWQs7R3Z917WRQy1HHA7Ba7D8hvZg6UE5mLykJxQVE2ju0IXbGlaHPPlkY+WN7wFP+wUMXmBFA0aV6vYGQ==} + engines: {node: '>=4'} + dev: false + /retry-as-promised/3.2.0: resolution: {integrity: sha512-CybGs60B7oYU/qSQ6kuaFmRd9sTZ6oXSc0toqePvV74Ac6/IFZSI1ReFQmtCN+uvW1Mtqdwpvt/LGOiCBAY2Mg==} dependencies: any-promise: 1.3.0 dev: false + /retry-as-promised/5.0.0: + resolution: {integrity: sha512-6S+5LvtTl2ggBumk04hBo/4Uf6fRJUwIgunGZ7CYEBCeufGFW1Pu6ucUf/UskHeWOIsUcLOGLFXPig5tR5V1nA==} + dev: false + + /reusify/1.0.4: + resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} + engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + dev: false + /rfdc/1.3.0: resolution: {integrity: sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==} dev: false @@ -4159,6 +4561,17 @@ packages: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} dev: false + /safe-regex2/2.0.0: + resolution: {integrity: sha512-PaUSFsUaNNuKwkBijoAPHAK6/eM6VirvyPWlZ7BAQy4D+hCvh4B6lIG+nPdhbFfIbP+gTGBcrdsOaUs0F+ZBOQ==} + dependencies: + ret: 0.2.2 + dev: false + + /safe-stable-stringify/2.3.1: + resolution: {integrity: sha512-kYBSfT+troD9cDA85VDnHZ1rpHC50O0g1e6WlGHVCz/g+JS+9WKLj+XwFYyR8UbrZN8ll9HUpDAAddY58MGisg==} + engines: {node: '>=10'} + dev: false + /safer-buffer/2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} dev: false @@ -4208,7 +4621,7 @@ packages: dev: false /semver/5.3.0: - resolution: {integrity: sha1-myzl094C0XxgEq0yaqa00M9U+U8=} + resolution: {integrity: sha512-mfmm3/H9+67MCVix1h+IXTpDwL6710LyHuk7+cWC9T1mE0qz4iHhh6r4hU2wrIT9iTsAAC2XQRvfblL028cpLw==} hasBin: true dev: false @@ -4236,6 +4649,14 @@ packages: lru-cache: 6.0.0 dev: false + /semver/7.3.7: + resolution: {integrity: sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==} + engines: {node: '>=10'} + hasBin: true + dependencies: + lru-cache: 6.0.0 + dev: false + /send/0.17.1: resolution: {integrity: sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==} engines: {node: '>= 0.8.0'} @@ -4253,6 +4674,8 @@ packages: on-finished: 2.3.0 range-parser: 1.2.1 statuses: 1.5.0 + transitivePeerDependencies: + - supports-color dev: false /seq-queue/0.0.5: @@ -4264,6 +4687,11 @@ packages: engines: {node: '>= 6.0.0'} dev: false + /sequelize-pool/7.1.0: + resolution: {integrity: sha512-G9c0qlIWQSK29pR/5U2JF5dDQeqqHRragoyahj/Nx4KOOQ3CPPfzxnfqFPCSB7x5UgjOgnZ61nSxz+fjDpRlJg==} + engines: {node: '>= 10.0.0'} + dev: false + /sequelize/5.22.4: resolution: {integrity: sha512-xFQQ38HPg7EyDRDA+NdzMSRWbo9m6Z/RxpjnkBl3ggyQG+jRrup48x0jaw4Ox42h56wFnXOBC2NZOkTJfZeWCw==} engines: {node: '>=6.0.0'} @@ -4295,12 +4723,18 @@ packages: escape-html: 1.0.3 parseurl: 1.3.3 send: 0.17.1 + transitivePeerDependencies: + - supports-color dev: false /set-blocking/2.0.0: resolution: {integrity: sha1-BF+XgtARrppoA93TgrJDkrPYkPc=} dev: false + /set-cookie-parser/2.5.1: + resolution: {integrity: sha512-1jeBGaKNGdEq4FgIrORu/N570dwoPYio8lSoYLWmX7sQ//0JY08Xh9o5pBcgmHQ/MbsYp/aZnOe1s1lIsbLprQ==} + dev: false + /setprototypeof/1.1.1: resolution: {integrity: sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==} dev: false @@ -4339,7 +4773,7 @@ packages: engines: {node: '>= 6'} dependencies: agent-base: 6.0.2 - debug: 4.3.2 + debug: 4.3.4 socks: 2.6.1 transitivePeerDependencies: - supports-color @@ -4350,7 +4784,7 @@ packages: engines: {node: '>= 10'} dependencies: agent-base: 6.0.2 - debug: 4.3.2 + debug: 4.3.4 socks: 2.6.1 transitivePeerDependencies: - supports-color @@ -4372,6 +4806,13 @@ packages: smart-buffer: 4.2.0 dev: false + /sodium-native/3.4.1: + resolution: {integrity: sha512-PaNN/roiFWzVVTL6OqjzYct38NSXewdl2wz8SRB51Br/MLIJPrbM3XexhVWkq7D3UWMysfrhKVf1v1phZq6MeQ==} + requiresBuild: true + dependencies: + node-gyp-build: 4.3.0 + dev: false + /sonic-boom/1.4.1: resolution: {integrity: sha512-LRHh/A8tpW7ru89lrlkU4AszXt1dbwSjVWguGrmlxE7tawVmDBlI1PILMkXAxJTwqhgsEeTHzj36D5CmHgQmNg==} dependencies: @@ -4385,6 +4826,12 @@ packages: atomic-sleep: 1.0.0 dev: false + /sonic-boom/3.2.0: + resolution: {integrity: sha512-SbbZ+Kqj/XIunvIAgUZRlqd6CGQYq71tRRbXR92Za8J/R3Yh4Av+TWENiSiEgnlwckYLyP0YZQWVfyNC0dzLaA==} + dependencies: + atomic-sleep: 1.0.0 + dev: false + /source-map-support/0.5.19: resolution: {integrity: sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==} dependencies: @@ -4408,6 +4855,11 @@ packages: readable-stream: 3.6.0 dev: false + /split2/4.1.0: + resolution: {integrity: sha512-VBiJxFkxiXRlUIeyMQi8s4hgvKCSjtknJv/LVYbrgALPwf5zSKmEwV9Lst25AkvMDnvxODugjdl6KZgwKM1WYQ==} + engines: {node: '>= 10.x'} + dev: false + /sprintf-js/1.0.3: resolution: {integrity: sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=} dev: false @@ -4427,6 +4879,8 @@ packages: node-pre-gyp: 0.11.0 optionalDependencies: node-gyp: 3.8.0 + transitivePeerDependencies: + - supports-color dev: false /sqlstring/2.3.1: @@ -4454,10 +4908,7 @@ packages: safer-buffer: 2.1.2 tweetnacl: 0.14.5 dev: false - - /standard-error/1.1.0: - resolution: {integrity: sha1-I+UWj6HAggGJ5YEnAaeQWFENDTQ=} - dev: false + optional: true /statuses/1.5.0: resolution: {integrity: sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=} @@ -4611,6 +5062,12 @@ packages: engines: {node: '>=0.2.6'} dev: false + /thread-stream/2.1.0: + resolution: {integrity: sha512-5+Pf2Ya31CsZyIPYYkhINzdTZ3guL+jHq7D8lkBybgGcSQIKDbid3NJku3SpCKeE/gACWAccDA/rH2B6doC5aA==} + dependencies: + real-require: 0.2.0 + dev: false + /thunkify/2.1.2: resolution: {integrity: sha1-+qDp0jDFGsyVyhOjYawFyn4EVT0=} dev: false @@ -4620,6 +5077,11 @@ packages: engines: {node: '>=8'} dev: false + /tiny-lru/8.0.2: + resolution: {integrity: sha512-ApGvZ6vVvTNdsmt676grvCkUCGwzG9IqXma5Z07xJgiC5L7akUMof5U8G2JTI9Rz/ovtVhJBlY6mNhEvtjzOIg==} + engines: {node: '>=6'} + dev: false + /tiny-secp256k1/1.1.6: resolution: {integrity: sha512-FmqJZGduTyvsr2cF3375fqGHUovSwDi/QytexX1Se4BPuPZpTE5Ftp5fg+EFSuEf3lhZqgCRjEG3ydUQ/aNiwA==} engines: {node: '>=6.0.0'} @@ -4665,7 +5127,7 @@ packages: dev: false /toposort-class/1.0.1: - resolution: {integrity: sha1-f/0feMi+KMO6Rc1OGj9e4ZO9mYg=} + resolution: {integrity: sha512-OsLcGGbYF3rMjPUf8oKktyvCiUxSbqMMS39m33MAjLTC1DVIH6x3WSt63/M77ihI09+Sdfk1AXvfhCEeUmC7mg==} dev: false /touch/3.1.0: @@ -4682,6 +5144,7 @@ packages: psl: 1.8.0 punycode: 2.1.1 dev: false + optional: true /tr46/0.0.3: resolution: {integrity: sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=} @@ -4705,6 +5168,7 @@ packages: dependencies: safe-buffer: 5.2.1 dev: false + optional: true /tv4/1.3.0: resolution: {integrity: sha1-0CDIRvrdUMhVq7JeuuzGj8EPeWM=} @@ -4714,6 +5178,7 @@ packages: /tweetnacl/0.14.5: resolution: {integrity: sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=} dev: false + optional: true /tx2/1.0.4: resolution: {integrity: sha512-rU+y30nUY3PyIi+znvv74HzxlpULKwMPAyRK+YiCjvGkk3rY3fic3D6Z+avLpun3V5A6HFwPQ9JrBTMNEV/dxg==} @@ -4768,10 +5233,12 @@ packages: engines: {node: '>=14.0.0'} dev: false - /undefsafe/2.0.3: + /undefsafe/2.0.3_supports-color@5.5.0: resolution: {integrity: sha512-nrXZwwXrD/T/JXeygJqdCO6NZZ1L66HrxM/Z7mIq2oPanoN0F1nLx3lwJMu6AwJY69hdixaFQOuoYsMjE5/C2A==} dependencies: - debug: 2.6.9 + debug: 2.6.9_supports-color@5.5.0 + transitivePeerDependencies: + - supports-color dev: false /underscore/1.13.1: @@ -4810,7 +5277,7 @@ packages: is-yarn-global: 0.3.0 latest-version: 5.1.0 pupa: 2.1.1 - semver: 7.3.5 + semver: 7.3.7 semver-diff: 3.1.1 xdg-basedir: 4.0.0 dev: false @@ -4820,7 +5287,6 @@ packages: dependencies: punycode: 2.1.1 dev: false - optional: true /url-parse-lax/3.0.0: resolution: {integrity: sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=} @@ -4864,6 +5330,11 @@ packages: engines: {node: '>= 0.10'} dev: false + /validator/13.7.0: + resolution: {integrity: sha512-nYXQLCBkpJ8X6ltALua9dRrZDHVYxjJ1wgskNt1lH9fzGjs3tgojGSCBjmEPwkWS1y29+DrizMTW19Pr9uB2nw==} + engines: {node: '>= 0.10'} + dev: false + /varuint-bitcoin/1.1.2: resolution: {integrity: sha512-4EVb+w4rx+YfVM32HQX42AbbT7/1f5zwAYhIujKXKk8NQK+JfRVl3pqT3hjNn/L+RstigmGGKVwHA/P0wgITZw==} dependencies: @@ -4883,13 +5354,14 @@ packages: core-util-is: 1.0.2 extsprintf: 1.3.0 dev: false + optional: true /vizion/2.2.1: resolution: {integrity: sha512-sfAcO2yeSU0CSPFI/DmZp3FsFE9T+8913nv1xWBOyzODv13fwkn6Vl7HqxGpkr9F608M+8SuFId3s+BlZqfXww==} engines: {node: '>=4.0'} dependencies: async: 2.6.3 - git-node-fs: 1.0.0 + git-node-fs: 1.0.0_js-git@0.7.8 ini: 1.3.8 js-git: 0.7.8 dev: false @@ -4964,6 +5436,12 @@ packages: '@types/node': 16.10.3 dev: false + /wkx/0.5.0: + resolution: {integrity: sha512-Xng/d4Ichh8uN4l0FToV/258EjMGU9MGcA0HV2d9B/ZpZB3lqQm7nkOdZdm5GhKtLLhAE7PiVQwN4eN+2YJJUg==} + dependencies: + '@types/node': 16.10.3 + dev: false + /word-wrap/1.2.3: resolution: {integrity: sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==} engines: {node: '>=0.10.0'} @@ -5021,6 +5499,19 @@ packages: optional: true dev: false + /ws/8.8.1: + resolution: {integrity: sha512-bGy2JzvzkPowEJV++hF07hAD6niYSr0JzBNo/J29WsB57A2r7Wlc1UFcTR9IzrPvuNVO4B8LGqF8qcpsVOhJCA==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + dev: false + /xdg-basedir/4.0.0: resolution: {integrity: sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==} engines: {node: '>=8'} @@ -5041,7 +5532,7 @@ packages: dev: false /yallist/2.1.2: - resolution: {integrity: sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=} + resolution: {integrity: sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==} dev: false /yallist/3.1.1: diff --git a/routes/admin.js b/routes/admin.js index 1be6612d..bf8a112a 100644 --- a/routes/admin.js +++ b/routes/admin.js @@ -1,8 +1,8 @@ import express from 'express'; var router = express.Router(); -import parseInput from '../scripts/apiParse.js'; -import Sequelize from 'sequelize'; +import * as parseInput from '../scripts/apiParse.js'; +import Sequelize from '@sequelize/core'; const Op = Sequelize.Op; import { v4 as uuidv4 } from 'uuid'; @@ -27,7 +27,7 @@ import { v4 as uuidv4 } from 'uuid'; router.get( "/users", // auth, - ah(async (req, res) => { + async (req, res) => { var {search, starts_with, contains} = req.query var users = knex .select('username', 'email', 'phone', 'verified', knex.raw('LEFT(createdAt,10) as created_at')) @@ -47,7 +47,6 @@ router.get( const found = await users return res.send({users: found}) }) -); /** * @api {get} /referrals Retrieve list of referral tokens @@ -69,7 +68,7 @@ router.get( router.get( "/referrals", auth, - ah(async (req, res) => { + async (req, res) => { var referrals = knex .select( 'token', @@ -103,7 +102,6 @@ router.get( var found = await referrals return res.send({referrals: found}) }) -); /** * @api {get} /waiting_list Retrieve waiting_list @@ -125,7 +123,7 @@ router.get( router.get( "/waiting_list", // auth, - ah(async (req, res) => { + async (req, res) => { var {search, starts_with, contains} = req.query var queue = knex @@ -149,7 +147,6 @@ router.get( return res.send({queue: found}) }) -); /** * @api {get} /accounts Retrieve list of accounts @@ -171,7 +168,7 @@ router.get( router.get( "/accounts", auth, - ah(async (req, res) => { + async (req, res) => { var {nonZero, search, starts_with, contains} = req.query var accounts = knex @@ -194,7 +191,6 @@ router.get( return res.send({accounts: found}) }) -); /** * @api {get} /transactions Retrieve summary of user transactions @@ -217,7 +213,7 @@ router.get( router.get( "/transactions", // auth, - ah(async (req, res) => { + async (req, res) => { var {type, since, search, starts_with, contains} = req.query var transactions = knex @@ -262,7 +258,6 @@ router.get( return res.send({transactions: found}) }) -); /** * @api {get} /orders Retrieve summary of orders @@ -285,7 +280,7 @@ router.get( router.get( "/orders", auth, - ah(async (req, res) => { + async (req, res) => { var {type, since, search, starts_with, contains} = req.query var orders = knex @@ -319,7 +314,6 @@ router.get( var found = await orders return res.send({orders: found}) }) -); /** * @api {get} /invoices Retrieve summary of invoices @@ -342,7 +336,7 @@ router.get( router.get( "/invoices", auth, - ah(async (req, res) => { + async (req, res) => { var {type, since, search, starts_with, contains} = req.query var invoices = knex @@ -367,7 +361,6 @@ router.get( var found = await invoices return res.send({invoices: found}) }) -); /** @@ -391,7 +384,7 @@ router.get( router.get( "/deposits", auth, - ah(async (req, res) => { + async (req, res) => { var {type, since, search, starts_with, contains} = req.query var deposits = knex @@ -414,7 +407,6 @@ router.get( var found = await deposits return res.send({deposits: found}) }) -); /** * @api {get} /withdrawals Retrieve summary of withdrawals @@ -437,7 +429,7 @@ router.get( router.get( "/withdrawals", auth, - ah(async (req, res) => { + async (req, res) => { var {type, since, search, starts_with, contains} = req.query var withdrawals = knex @@ -460,7 +452,6 @@ router.get( var found = await withdrawals return res.send({withdrawals: found}) }) -); /** * @api {get} /payments Retrieve summary of payments @@ -483,7 +474,7 @@ router.get( router.get( "/payments", auth, - ah(async (req, res) => { + async (req, res) => { var {type, since, search, starts_with, contains} = req.query var payments = knex @@ -508,7 +499,6 @@ router.get( var found = await payments return res.send({payments: found}) }) -); /** * @api {get} /user_kyc Retrieve user kyc details @@ -531,7 +521,7 @@ router.get( router.get( "/kyc_required", auth, - ah(async (req, res) => { + async (req, res) => { var {since, search, starts_with, contains} = req.query var threshold = '0.2' @@ -566,6 +556,5 @@ router.get( return res.send({found: found}) }) -); export default router; diff --git a/routes/assets.js b/routes/assets.js index 884d1c77..1da217ae 100644 --- a/routes/assets.js +++ b/routes/assets.js @@ -1,3 +1,5 @@ +import app from "../app.js"; +import { auth } from "../lib/passport.js"; import axios from 'axios'; import crypto from 'crypto'; import fs from 'fs'; @@ -25,7 +27,7 @@ let fetchAssets; app.get( "/assets", - ah(async (req, res) => { + async (req, res) => { if (app.get("assets")) { const assets = app.get("assets"); @@ -64,12 +66,11 @@ app.get( res.status(500).send("Problem fetching blockstream asset registry data"); } }) -); app.post( "/assets", auth, - ah(async (req, res) => { + async (req, res) => { try { const sha256 = crypto.createHash("sha256"); const { id: user_id } = req.user; @@ -293,12 +294,11 @@ app.post( res.status(500).send(e.message); } }) -); app.post( "/assets/register", auth, - ah(async (req, res) => { + async (req, res) => { const { asset } = req.body; const account = await db.Account.findOne({ where: { @@ -324,12 +324,11 @@ app.post( res.status(500).send(e.message); } }) -); app.post( "/loadFaucet", auth, - ah(async (req, res) => { + async (req, res) => { return res.status(500).send("Faucet feature temporarily disabled"); const { user } = req; @@ -435,12 +434,11 @@ app.post( return res.status(500).send(e.message); } }) -); app.get( "/faucet", auth, - ah(async (req, res) => { + async (req, res) => { let { asset } = req.query; let faucet = await db.Account.findOne({ where: { @@ -458,4 +456,3 @@ app.get( res.send(faucet); }) -); diff --git a/routes/bitcoin/broadcast.js b/routes/bitcoin/broadcast.js index 5ee7d6bb..157d60a4 100644 --- a/routes/bitcoin/broadcast.js +++ b/routes/bitcoin/broadcast.js @@ -1,4 +1,4 @@ -export default ah(async (req, res) => { +export default async (req, res) => { try { const { user } = req; let hash = await bc.sendRawTransaction(req.body.tx); @@ -47,4 +47,4 @@ export default ah(async (req, res) => { } catch (e) { res.status(500).send(e.message); } -}); +}; diff --git a/routes/bitcoin/conversionFee.js b/routes/bitcoin/conversionFee.js index fa7904b1..8a6bfce6 100644 --- a/routes/bitcoin/conversionFee.js +++ b/routes/bitcoin/conversionFee.js @@ -2,14 +2,11 @@ // This is in a separate file so that the same function can be used by ./send and ./receive const conversionFeeMultiplier = 0.01; -const conversionFeeReceiver = "coinosfees"; // account that receives the fees +export const conversionFeeReceiver = "coinosfees"; // account that receives the fees /** * Returns the fee you have to pay for withdrawing 'amount' bitcoin. */ -function computeConversionFee(amount) { +export function computeConversionFee(amount) { return Math.floor(amount * conversionFeeMultiplier); } - -module.exports.conversionFeeReceiver = conversionFeeReceiver; -module.exports.computeConversionFee = computeConversionFee; diff --git a/routes/bitcoin/fee.js b/routes/bitcoin/fee.js index 20dc8e9a..8efb59f8 100644 --- a/routes/bitcoin/fee.js +++ b/routes/bitcoin/fee.js @@ -1,6 +1,6 @@ -import buildTx from '../../lib/buildtx'; +import buildTx from "../../lib/buildtx.js"; -export default ah(async (req, res) => { +export default async (req, res) => { let { user } = req; let { address, amount, feeRate, replaceable } = req.body; let tx, fee; @@ -9,9 +9,9 @@ export default ah(async (req, res) => { try { let psbt = await buildTx({ address, amount, feeRate, replaceable, user }); return res.send(psbt); - } catch(e) { + } catch (e) { return res.status(500).send(e.message); - } + } } let invoice = await db.Invoice.findOne({ @@ -19,8 +19,8 @@ export default ah(async (req, res) => { include: { attributes: ["username"], model: db.User, - as: "user", - }, + as: "user" + } }); if (invoice) { @@ -34,13 +34,18 @@ export default ah(async (req, res) => { try { amount = parseInt(amount); - let partial = await bc.createRawTransaction([], { - [address]: (amount / SATS).toFixed(8), - }, 0, replaceable); + let partial = await bc.createRawTransaction( + [], + { + [address]: (amount / SATS).toFixed(8) + }, + 0, + replaceable + ); let params = { subtractFeeFromOutputs: amount === user.balance ? [0] : [], - replaceable, + replaceable }; if (feeRate) params.feeRate = (feeRate / SATS).toFixed(8); @@ -59,4 +64,4 @@ export default ah(async (req, res) => { l.error("bitcoin fee estimation error", e); return res.status(500).send(e.message); } -}); +}; diff --git a/routes/bitcoin/generate.js b/routes/bitcoin/generate.js index 92df1e12..1b6c1aa4 100644 --- a/routes/bitcoin/generate.js +++ b/routes/bitcoin/generate.js @@ -1,5 +1,5 @@ -export default ah(async (req, res) => { +export default async (req, res) => { let address = await bc.getNewAddress(); await bc.generateToAddress(1, address); res.end(); -}); +}; diff --git a/routes/bitcoin/index.js b/routes/bitcoin/index.js new file mode 100644 index 00000000..9d096e8f --- /dev/null +++ b/routes/bitcoin/index.js @@ -0,0 +1,13 @@ +import broadcast from "./broadcast.js"; +import generate from "./generate.js"; +import sweep from "./sweep.js"; +import fee from "./fee.js"; +import send from "./send.js"; + +export default { + broadcast, + generate, + sweep, + fee, + send +}; diff --git a/routes/bitcoin/receive.js b/routes/bitcoin/receive.js index ac9aa1e7..65e96883 100644 --- a/routes/bitcoin/receive.js +++ b/routes/bitcoin/receive.js @@ -1,6 +1,8 @@ +import { notify } from "../lib/notifications.js"; +import { callWebhook } from "../lib/webhooks.js"; import reverse from 'buffer-reverse'; import zmq from 'zeromq/v5-compat'; -import { Op } from 'sequelize'; +import { Op } from '@sequelize/core'; import { fromBase58 } from 'bip32'; import bitcoin from 'bitcoinjs-lib'; diff --git a/routes/bitcoin/send.js b/routes/bitcoin/send.js index 85117dbb..d8406075 100644 --- a/routes/bitcoin/send.js +++ b/routes/bitcoin/send.js @@ -1,7 +1,11 @@ +import config from "../../config/index.js"; const btc = config.liquid.btcasset; -import { computeConversionFee, conversionFeeReceiver } from './conversionFee.js'; +import { + computeConversionFee, + conversionFeeReceiver +} from "./conversionFee.js"; -export default ah(async (req, res) => { +export default async (req, res) => { let { user } = req; let { address, memo, tx } = req.body; let { hex } = tx; @@ -61,7 +65,10 @@ export default ah(async (req, res) => { // use user's credits to reduce fee, if available let conversionFeeDeduction = Math.min(account.btc_credits, conversionFee); if (conversionFeeDeduction) { - await account.decrement({ btc_credits: conversionFeeDeduction }, { transaction }); + await account.decrement( + { btc_credits: conversionFeeDeduction }, + { transaction } + ); await account.reload({ transaction }); conversionFee -= conversionFeeDeduction; } @@ -70,11 +77,19 @@ export default ah(async (req, res) => { l.error("amount exceeds balance", amount, fee, account.balance); throw new Error("low balance"); } else if (total + conversionFee > account.balance) { - l.error("total (after conversion fee) exceeds balance", amount, fee, account.balance); + l.error( + "total (after conversion fee) exceeds balance", + amount, + fee, + account.balance + ); throw new Error("low balance (after conversion fee)"); } - await account.decrement({ balance: (total + conversionFee) }, { transaction }); + await account.decrement( + { balance: total + conversionFee }, + { transaction } + ); await account.reload({ transaction }); let receiverAccount = await db.Account.findOne({ @@ -85,7 +100,7 @@ export default ah(async (req, res) => { { model: db.User, as: "user" - }, + } ], lock: transaction.LOCK.UPDATE, transaction @@ -94,20 +109,26 @@ export default ah(async (req, res) => { let fee_payment; let fee_payment_id = null; if (conversionFee) { - await receiverAccount.increment({ balance: conversionFee }, { transaction }); + await receiverAccount.increment( + { balance: conversionFee }, + { transaction } + ); await receiverAccount.reload({ transaction }); - fee_payment = await db.Payment.create({ - amount: conversionFee, - fee: 0, - memo: "Bitcoin conversion fee", - account_id: receiverAccount.id, - user_id: receiverAccount.user_id, - rate: app.get("rates")[receiverAccount.user.currency], - currency: receiverAccount.user.currency, - confirmed: true, - received: true, - network: "COINOS" - }, { transaction }); + fee_payment = await db.Payment.create( + { + amount: conversionFee, + fee: 0, + memo: "Bitcoin conversion fee", + account_id: receiverAccount.id, + user_id: receiverAccount.user_id, + rate: app.get("rates")[receiverAccount.user.currency], + currency: receiverAccount.user.currency, + confirmed: true, + received: true, + network: "COINOS" + }, + { transaction } + ); fee_payment_id = fee_payment.id; } @@ -146,9 +167,11 @@ export default ah(async (req, res) => { l.info("sent bitcoin", user.username, total); }); } catch (e) { - if (e.message.includes("Insufficient")) e.message = "The coinos server hot wallet has insufficient funds to complete the payment, try again later"; + if (e.message.includes("Insufficient")) + e.message = + "The coinos server hot wallet has insufficient funds to complete the payment, try again later"; l.error("error sending bitcoin", e.message); console.log(e); return res.status(500).send(e.message); } -}); +}; diff --git a/routes/bitcoin/sweep.js b/routes/bitcoin/sweep.js index f056bdeb..6c0ca580 100644 --- a/routes/bitcoin/sweep.js +++ b/routes/bitcoin/sweep.js @@ -1,14 +1,17 @@ -import axios from 'axios'; -import bitcoin from 'bitcoinjs-lib'; -import coinselect from 'coinselect'; -import split from 'coinselect/split'; +import config from "../../config/index.js"; +import { prod } from "../../lib/utils.js"; +import axios from "axios"; +import bitcoin from "bitcoinjs-lib"; +import coinselect from "coinselect"; +import split from "coinselect/split.js"; + const api = prod ? "https://blockstream.info/api" : config.bitcoin.electrs; const SATS = 100000000; const network = prod ? bitcoin.networks["bitcoin"] : bitcoin.networks["regtest"]; -export default ah(async (req, res) => { +export default async (req, res) => { let { address: from, amount, feeRate, target } = req.body; let utxos; if (!feeRate) feeRate = (await bc.estimateSmartFee(6)).feerate * SATS; @@ -81,4 +84,4 @@ export default ah(async (req, res) => { } catch (e) { l.error("problem getting address stats", from, e.message); } -}); +}; diff --git a/routes/funding.js b/routes/funding.js index 7edcd713..9d305010 100644 --- a/routes/funding.js +++ b/routes/funding.js @@ -1,3 +1,5 @@ +import app from "../app.js"; +import config from "../config/index.js"; import mailgunFactory from 'mailgun-js'; const mailgun = mailgunFactory(config.mailgun); @@ -5,7 +7,7 @@ app.post( "/id", auth, upload.single("id"), - ah(async (req, res) => { + async (req, res) => { const { user } = req; if (user.verified === "proof") user.verified = "pending"; else user.verified = "id"; @@ -24,13 +26,12 @@ app.post( res.end(); }) -); app.post( "/proof", auth, upload.single("proof"), - ah(async (req, res) => { + async (req, res) => { const { user } = req; if (user.verified === "id") user.verified = "pending"; else user.verified = "proof"; @@ -40,12 +41,11 @@ app.post( res.end(); }) -); app.post( "/funding", auth, - ah(async (req, res) => { + async (req, res) => { try { let { id, amount, code } = req.body; @@ -81,12 +81,11 @@ app.post( res.status(500).send("Funding request failed"); } }) -); app.post( "/withdrawal", auth, - ah(async (req, res) => { + async (req, res) => { try { const { account, amount, email, institution, transit, notes } = req.body; if (!parseFloat(amount) || parseFloat(amount) < 0) @@ -108,4 +107,3 @@ app.post( res.status(500).send("Withdrawal request failed"); } }) -); diff --git a/routes/info.js b/routes/info.js index 0be7f27d..537cdc44 100644 --- a/routes/info.js +++ b/routes/info.js @@ -1,4 +1,5 @@ -import sequelize from 'sequelize'; +import app from "../app.js"; +import sequelize from '@sequelize/core'; const { Op } = sequelize; /** @@ -10,7 +11,7 @@ const { Op } = sequelize; * @apiSuccess {String[]} networks Array of supported networks; possible values are "bitcoin", "liquid" and "lightning". * @apiSuccess {String} clientVersion the current git commit of the ui */ -app.get("/info", ah(async (req, res, next) => { +app.get("/info", async (req, res, next) => { const { clientVersion } = config; const info = { @@ -20,9 +21,9 @@ app.get("/info", ah(async (req, res, next) => { }; res.send(info); -})); +}); -app.get("/balances", ah(async (req, res, next) => { +app.get("/balances", async (req, res, next) => { const accounts = await db.Account.findAll({ attributes: [ "asset", @@ -44,8 +45,8 @@ app.get("/balances", ah(async (req, res, next) => { lnwallet = parseInt(funds.outputs.reduce((a, b) => a + b.value, 0)); } else { lninfo = await lnp.getInfo({}); - lnchannel = parseInt((await lnp.channelBalance({})).balance); - lnwallet = parseInt((await lnp.walletBalance({})).total_balance); + lnchannel = parseInt((await lnp.channelBalance({}).balance)); + lnwallet = parseInt((await lnp.walletBalance({}).total_balance)); } } @@ -80,4 +81,4 @@ app.get("/balances", ah(async (req, res, next) => { parseInt(lnwallet); res.send(info); -})); +}); diff --git a/routes/invoices.js b/routes/invoices.js index 9e3fedb7..a65ff7ba 100644 --- a/routes/invoices.js +++ b/routes/invoices.js @@ -1,113 +1,107 @@ -import { Op } from 'sequelize'; -import axios from 'axios'; +import app from "../app.js"; +import { optionalAuth } from "../lib/passport.js"; +import { Op } from "@sequelize/core"; +import axios from "axios"; -app.get( - "/invoice", - ah(async (req, res, next) => { - try { - const invoice = await db.Invoice.findOne({ - where: { - uuid: req.query.uuid - }, - include: { - model: db.User, - as: "user", - attributes: ["username", "currency"] - } - }); +app.get("/invoice", async (req, res, next) => { + try { + const invoice = await db.Invoice.findOne({ + where: { + uuid: req.query.uuid + }, + include: { + model: db.User, + as: "user", + attributes: ["username", "currency"] + } + }); - res.send(invoice); - } catch (e) { - l.error("couldn't find invoice", e); - } - }) -); + res.send(invoice); + } catch (e) { + l.error("couldn't find invoice", e); + } +}); -app.post( - "/invoice", - optionalAuth, - ah(async (req, res, next) => { - try { - let { liquidAddress, id, invoice, user, tx } = req.body; - let { blindkey } = invoice; +app.post("/invoice", optionalAuth, async (req, res, next) => { + try { + let { liquidAddress, id, invoice, user, tx } = req.body; + let { blindkey } = invoice; - if (invoice.amount < 0) throw new Error("amount out of range"); - if ( - invoice.tip > invoice.amount || - invoice.tip > 1000000 || - invoice.tip < 0 - ) - throw new Error("tip amount out of range"); + if (invoice.amount < 0) throw new Error("amount out of range"); + if ( + invoice.tip > invoice.amount || + invoice.tip > 1000000 || + invoice.tip < 0 + ) + throw new Error("tip amount out of range"); - if (liquidAddress) { - l.info("conversion request for", liquidAddress, invoice.text); - convert[invoice.text] = { address: liquidAddress, tx }; - } + if (liquidAddress) { + l.info("conversion request for", liquidAddress, invoice.text); + convert[invoice.text] = { address: liquidAddress, tx }; + } - if (!user) ({ user } = req); - else { - user = await db.User.findOne({ - where: { - username: user.username - } - }); - } - if (!user) throw new Error("user not provided"); - if (!invoice.currency) invoice.currency = user.currency; - if (!invoice.rate) invoice.rate = app.get("rates")[invoice.currency]; - if (invoice.tip > invoice.amount || invoice.tip > 1000000) - throw new Error("tip is too large"); - if (invoice.tip < 0 || invoice.amount < 0) - throw new Error("invalid amount"); - invoice.user_id = user.id; - invoice.account_id = user.account_id; + if (!user) ({ user } = req); + else { + user = await db.User.findOne({ + where: { + username: user.username + } + }); + } + if (!user) throw new Error("user not provided"); + if (!invoice.currency) invoice.currency = user.currency; + if (!invoice.rate) invoice.rate = app.get("rates")[invoice.currency]; + if (invoice.tip > invoice.amount || invoice.tip > 1000000) + throw new Error("tip is too large"); + if (invoice.tip < 0 || invoice.amount < 0) + throw new Error("invalid amount"); + invoice.user_id = user.id; + invoice.account_id = user.account_id; - l.info( - "creating invoice", - user.username, - invoice.network, - invoice.amount, - invoice.tip, - invoice.currency, - invoice.text && - `${invoice.text.substr(0, 8)}..${invoice.text.substr(-6)}` - ); + l.info( + "creating invoice", + user.username, + invoice.network, + invoice.amount, + invoice.tip, + invoice.currency, + invoice.text && `${invoice.text.substr(0, 8)}..${invoice.text.substr(-6)}` + ); - if (!invoice.tip) invoice.tip = 0; + if (!invoice.tip) invoice.tip = 0; - const exists = - invoice.text && - (await db.Invoice.findOne({ - where: { - [Op.or]: { - address: invoice.address || "", - unconfidential: invoice.unconfidential || "", - text: invoice.text - } + const exists = + invoice.text && + (await db.Invoice.findOne({ + where: { + [Op.or]: { + address: invoice.address || "", + unconfidential: invoice.unconfidential || "", + text: invoice.text } - })); - - invoice = exists - ? await exists.update(invoice) - : await db.Invoice.create(invoice); - addresses[invoice.address] = user.username; - if (invoice.unconfidential) { - addresses[invoice.unconfidential] = user.username; - if (blindkey) await lq.importBlindingKey(invoice.address, blindkey); - } + } + })); - res.send(invoice); - } catch (e) { - l.error(e.message, e.stack); - res.status(500).send(`Problem during invoice creation: ${e.message}`); + invoice = exists + ? await exists.update(invoice) + : await db.Invoice.create(invoice); + addresses[invoice.address] = user.username; + if (invoice.unconfidential) { + addresses[invoice.unconfidential] = user.username; + if (blindkey) await lq.importBlindingKey(invoice.address, blindkey); } - }) -); + + res.send(invoice); + } catch (e) { + l.error(e.message, e.stack); + res.status(500).send(`Problem during invoice creation: ${e.message}`); + } +}); app.post( "/:username/:network/invoice", optionalAuth, - ah(async (req, res, next) => { + async (req, res, next) => { let { network, username } = req.params; - }) + } ); diff --git a/routes/lightning/channel.js b/routes/lightning/channel.js index fe6d9520..168f55ab 100644 --- a/routes/lightning/channel.js +++ b/routes/lightning/channel.js @@ -1,6 +1,6 @@ -import axios from 'axios'; +import axios from "axios"; -export default ah(async (req, res) => { +export default async (req, res) => { const { params } = req.body; const [pubkey, host] = params.uri.split("@"); @@ -12,7 +12,7 @@ export default ah(async (req, res) => { perm: true }); } catch (e) { - if (!e.message.includes('already connected')) { + if (!e.message.includes("already connected")) { l.error("problem connecting to peer", e.message); return res.status(500).send(e.message); } @@ -22,18 +22,18 @@ export default ah(async (req, res) => { let remoteid; try { remoteid = (await lnp.getInfo({})).identity_pubkey; - } catch(e) { + } catch (e) { l.error("problem getting lightning node info", e.message); return res.status(500).send(e.message); - } + } let url = `${callback}?k1=${k1}&remoteid=${remoteid}&private=0`; try { let response = await axios.get(url); res.send(response.data); - } catch(e) { + } catch (e) { l.error("problem sending channel request", e.message); return res.status(500).send({ status: "ERROR", reason: e.message }); - } -}); + } +}; diff --git a/routes/lightning/channelRequest.js b/routes/lightning/channelRequest.js index 96b6d71f..3aecaa61 100644 --- a/routes/lightning/channelRequest.js +++ b/routes/lightning/channelRequest.js @@ -1,10 +1,13 @@ -export default ah(async (req, res) => { +import { lnurlServer } from "../lnurl.js"; + +export default async (req, res) => { let { localAmt, pushAmt } = req.body; pushAmt = 0; try { - if (localAmt < 20000) throw new Error("amount must be greater than 20000 SAT"); + if (localAmt < 20000) + throw new Error("amount must be greater than 20000 SAT"); if (localAmt > 1000000) throw new Error("amount must be <= 1000000"); const result = await lnurlServer.generateNewUrl("channelRequest", { @@ -17,4 +20,4 @@ export default ah(async (req, res) => { l.error("problem generating channel request", e.message); res.status(500).send(e.message); } -}); +}; diff --git a/routes/lightning/conversionFee.js b/routes/lightning/conversionFee.js index 161f18e6..62c0ec28 100644 --- a/routes/lightning/conversionFee.js +++ b/routes/lightning/conversionFee.js @@ -2,14 +2,11 @@ // This is in a separate file so that the same function can be used by ./send and ./receive const conversionFeeMultiplier = 0.01; -const conversionFeeReceiver = "coinosfees"; // account that receives the fees +export const conversionFeeReceiver = "coinosfees"; // account that receives the fees /** * Returns the fee you have to pay for withdrawing 'amount' lightning BTC. */ -function computeConversionFee(amount) { +export function computeConversionFee(amount) { return Math.floor(amount * conversionFeeMultiplier); } - -module.exports.conversionFeeReceiver = conversionFeeReceiver; -module.exports.computeConversionFee = computeConversionFee; diff --git a/routes/lightning/index.js b/routes/lightning/index.js new file mode 100644 index 00000000..5d82cb5b --- /dev/null +++ b/routes/lightning/index.js @@ -0,0 +1,13 @@ +import channel from "./channel.js"; +import channelRequest from "./channelRequest.js"; +import invoice from "./invoice.js"; +import query from "./query.js"; +import send from "./send.js"; + +export default { + channel, + channelRequest, + invoice, + query, + send +}; diff --git a/routes/lightning/invoice.js b/routes/lightning/invoice.js index 38bad042..7d8a10cc 100644 --- a/routes/lightning/invoice.js +++ b/routes/lightning/invoice.js @@ -1,5 +1,4 @@ - -export default ah(async (req, res) => { +export default async (req, res) => { let { amount, memo, tip } = req.body; if (!tip) tip = 0; let value = amount + tip; @@ -22,4 +21,4 @@ export default ah(async (req, res) => { l.error("problem creating invoice", e.message, e.stack); res.status(500).send(e.message); } -}); +}; diff --git a/routes/lightning/query.js b/routes/lightning/query.js index 0d034604..36c297f6 100644 --- a/routes/lightning/query.js +++ b/routes/lightning/query.js @@ -1,17 +1,17 @@ -export default ah(async (req, res) => { +export default async (req, res) => { const { payreq } = req.body; const invoice = await db.Invoice.findOne({ include: { - attributes: ['username'], + attributes: ["username"], model: db.User, as: "user" }, where: { - text: payreq, + text: payreq } }); if (invoice) emit(req.user.username, "to", invoice.user); res.end(); -}); +}; diff --git a/routes/lightning/receive.js b/routes/lightning/receive.js index 1c3dc8eb..405eed38 100644 --- a/routes/lightning/receive.js +++ b/routes/lightning/receive.js @@ -1,4 +1,7 @@ +import { notify } from "../../lib/notifications.js"; +import { callWebhook } from "../../lib/webhooks.js"; import { computeConversionFee } from './conversionFee.js'; +import { sendLiquid } from "../liquid/send.js"; const handlePayment = async (msg) => { l.info("incoming lightning payment", msg.value, msg.payment_request, msg.settled); diff --git a/routes/lightning/send.js b/routes/lightning/send.js index a2eedcc8..807b4bb8 100644 --- a/routes/lightning/send.js +++ b/routes/lightning/send.js @@ -1,11 +1,16 @@ -export default ah(async (req, res) => { +export default async (req, res) => { let { amount, route, memo, payreq } = req.body; let { user } = req; try { res.send(await send(amount, memo, payreq, user)); } catch (e) { - l.error("problem sending lightning payment", user.username, payreq, e.message); + l.error( + "problem sending lightning payment", + user.username, + payreq, + e.message + ); res.status(500).send(e.message); } -}); +}; diff --git a/routes/liquid/broadcast.js b/routes/liquid/broadcast.js index 168e9518..2562effc 100644 --- a/routes/liquid/broadcast.js +++ b/routes/liquid/broadcast.js @@ -1,4 +1,4 @@ -export default ah(async (req, res) => { +export default async (req, res) => { try { const { user } = req; let hash = await lq.sendRawTransaction(req.body.tx); @@ -49,4 +49,4 @@ export default ah(async (req, res) => { l.error("problem broadcasting liquid transaction", e); res.status(500).send(e.message); } -}); +}; diff --git a/routes/liquid/conversionFee.js b/routes/liquid/conversionFee.js index f6a9e5b9..36ba6f36 100644 --- a/routes/liquid/conversionFee.js +++ b/routes/liquid/conversionFee.js @@ -2,14 +2,11 @@ // This is in a separate file so that the same function can be used by ./send and ./receive const conversionFeeMultiplier = 0.01; -const conversionFeeReceiver = "coinosfees"; // account that receives the fees +export const conversionFeeReceiver = "coinosfees"; // account that receives the fees /** * Returns the fee you have to pay for withdrawing 'amount' L-BTC. */ -function computeConversionFee(amount) { +export function computeConversionFee(amount) { return Math.floor(amount * conversionFeeMultiplier); } - -module.exports.conversionFeeReceiver = conversionFeeReceiver; -module.exports.computeConversionFee = computeConversionFee; diff --git a/routes/liquid/fee.js b/routes/liquid/fee.js index 0488b31e..0a2c330a 100644 --- a/routes/liquid/fee.js +++ b/routes/liquid/fee.js @@ -1,4 +1,4 @@ -import buildTx from '../../lib/buildliquidtx'; +import buildTx from "../../lib/buildliquidtx.js"; liquidTx = async ({ address, asset, amount, feeRate, replaceable, user }) => { let tx, fee; @@ -49,12 +49,14 @@ liquidTx = async ({ address, asset, amount, feeRate, replaceable, user }) => { tx = await node.createRawTransaction( [], - [{ - [address]: (amount / SATS).toFixed(8), - asset - }], + [ + { + [address]: (amount / SATS).toFixed(8), + asset + } + ], 0, - replaceable, + replaceable ); l.info("funding tx for fee estimate", tx); @@ -71,12 +73,12 @@ liquidTx = async ({ address, asset, amount, feeRate, replaceable, user }) => { return { feeRate, tx }; }; -export default ah(async (req, res) => { +export default async (req, res) => { try { - let tx = await liquidTx({ ...req.body, user: req.user }) + let tx = await liquidTx({ ...req.body, user: req.user }); res.send(tx); } catch (e) { l.error("error estimating liquid fee", e.message, e.stack); return res.status(500).send(e.message); } -}); +}; diff --git a/routes/liquid/generate.js b/routes/liquid/generate.js index 50c63dcf..73ad9b59 100644 --- a/routes/liquid/generate.js +++ b/routes/liquid/generate.js @@ -1,5 +1,5 @@ -export default ah(async (req, res) => { +export default async (req, res) => { let address = await lq.getNewAddress(); await lq.generateToAddress(1, address); res.end(); -}); +}; diff --git a/routes/liquid/index.js b/routes/liquid/index.js new file mode 100644 index 00000000..2b6b72b9 --- /dev/null +++ b/routes/liquid/index.js @@ -0,0 +1,13 @@ +import broadcast from "./broadcast.js"; +import generate from "./generate.js"; +// import fee from "./fee.js"; +import send from "./send.js"; +// import taxi from "./taxi.js"; + +export default { + broadcast, + generate, + // fee, + send, + // taxi +}; diff --git a/routes/liquid/receive.js b/routes/liquid/receive.js index 151ffb40..8891292e 100644 --- a/routes/liquid/receive.js +++ b/routes/liquid/receive.js @@ -1,9 +1,12 @@ +import { sendLiquid } from "./send.js"; +import { notify } from "../lib/notifications.js"; +import { callWebhook } from "../lib/webhooks.js"; import reverse from 'buffer-reverse'; import zmq from 'zeromq/v5-compat'; -import { Op } from 'sequelize'; +import { Op } from '@sequelize/core'; import { fromBase58 } from 'bip32'; import bitcoin from 'bitcoinjs-lib'; -import { Block, networks, Transaction } from 'liquidjs-lib'; +// import { Block, networks, Transaction } from 'liquidjs-lib'; import wretch from 'wretch'; import fetch from 'node-fetch'; wretch().polyfills({ fetch }); diff --git a/routes/liquid/send.js b/routes/liquid/send.js index e5112468..9529a040 100644 --- a/routes/liquid/send.js +++ b/routes/liquid/send.js @@ -1,9 +1,13 @@ +import config from "../../config/index.js"; const btc = config.liquid.btcasset; const lcad = config.liquid.cadasset; -import { Transaction } from 'liquidjs-lib'; -import { computeConversionFee, conversionFeeReceiver } from './conversionFee.js'; +// import { Transaction } from 'liquidjs-lib'; +import { + computeConversionFee, + conversionFeeReceiver +} from "./conversionFee.js"; -sendLiquid = async ({ asset, amount, user, address, memo, tx, limit }) => { +export const sendLiquid = async ({ asset, amount, user, address, memo, tx, limit }) => { try { l.info("sending liquid", amount, address); if (!tx) { @@ -106,9 +110,15 @@ sendLiquid = async ({ asset, amount, user, address, memo, tx, limit }) => { }); // use user's credits to reduce fee, if available - let conversionFeeDeduction = Math.min(account.liquid_credits, conversionFee); + let conversionFeeDeduction = Math.min( + account.liquid_credits, + conversionFee + ); if (conversionFeeDeduction) { - await account.decrement({ liquid_credits: conversionFeeDeduction }, { transaction }); + await account.decrement( + { liquid_credits: conversionFeeDeduction }, + { transaction } + ); await account.reload({ transaction }); conversionFee -= conversionFeeDeduction; } @@ -140,7 +150,10 @@ sendLiquid = async ({ asset, amount, user, address, memo, tx, limit }) => { ); } - await account.decrement({ balance: (total + conversionFee)}, { transaction }); + await account.decrement( + { balance: total + conversionFee }, + { transaction } + ); await account.reload({ transaction }); let receiverAccount = await db.Account.findOne({ @@ -151,14 +164,17 @@ sendLiquid = async ({ asset, amount, user, address, memo, tx, limit }) => { { model: db.User, as: "user" - }, + } ], lock: transaction.LOCK.UPDATE, transaction }); if (conversionFee) { - await receiverAccount.increment({ balance: conversionFee }, { transaction }); + await receiverAccount.increment( + { balance: conversionFee }, + { transaction } + ); await receiverAccount.reload({ transaction }); fee_payment = { amount: conversionFee, @@ -173,7 +189,9 @@ sendLiquid = async ({ asset, amount, user, address, memo, tx, limit }) => { network: "COINOS" }; fee_payment.account = receiverAccount; - ({ id: fee_payment_id } = await db.Payment.create(fee_payment, { transaction })); + ({ id: fee_payment_id } = await db.Payment.create(fee_payment, { + transaction + })); } let payment = { @@ -188,7 +206,7 @@ sendLiquid = async ({ asset, amount, user, address, memo, tx, limit }) => { confirmed: true, received: false, network: "liquid", - fee_payment_id, + fee_payment_id }; payment.account = account; @@ -231,7 +249,7 @@ sendLiquid = async ({ asset, amount, user, address, memo, tx, limit }) => { } }; -export default ah(async (req, res) => { +export default async (req, res) => { let { user } = req; try { @@ -240,4 +258,4 @@ export default ah(async (req, res) => { l.error("problem sending liquid", user.username, e.message); return res.status(500).send(e); } -}); +}; diff --git a/routes/liquid/taxi.js b/routes/liquid/taxi.js index 5bc3c8b7..e5baeeb9 100644 --- a/routes/liquid/taxi.js +++ b/routes/liquid/taxi.js @@ -1,8 +1,8 @@ -import { address as Address, Psbt, payments, networks } from 'liquidjs-lib'; -import { ECPairFactory } from 'ecpair'; -import tinysecp from 'tiny-secp256k1'; -import wretch from 'wretch'; -import fetch from 'node-fetch'; +// import { address as Address, Psbt, payments, networks } from 'liquidjs-lib'; +import { ECPairFactory } from "ecpair"; +import tinysecp from "tiny-secp256k1"; +import wretch from "wretch"; +import fetch from "node-fetch"; wretch().polyfills({ fetch }); @@ -16,7 +16,7 @@ const network = prod ? networks.liquid : networks.regtest; const ECPair = ECPairFactory(tinysecp); const key = ECPair.fromPrivateKey(Buffer.from(config.taxi, "hex")); -export default ah(async (req, res) => { +export default async (req, res) => { let { user } = req; let { psbt } = req.body; @@ -82,4 +82,4 @@ export default ah(async (req, res) => { console.log(e); return res.status(500).send(e); } -}); +}; diff --git a/routes/lnurl.js b/routes/lnurl.js index 9ced0466..7687b248 100644 --- a/routes/lnurl.js +++ b/routes/lnurl.js @@ -1,162 +1,109 @@ -import axios from 'axios'; -import lnurl from 'lnurl'; -import jwt from 'jsonwebtoken'; -import qs from 'query-string'; -import persist from '../lib/persist'; -import bolt11 from 'bolt11'; - -logins = persist("data/logins.json"); -recipients = persist("data/recipients.json"); -lnurlPayments = persist("data/payments.json"); -withdrawals = persist("data/withdrawals.json"); - -lnurlServer = lnurl.createServer(config.lnurl); - -import { computeConversionFee, conversionFeeReceiver } from './lightning/conversionFee.js'; - -var optionalAuth = function(req, res, next) { - passport.authenticate("jwt", { session: false }, function(err, user, info) { - req.user = user; - next(); - })(req, res, next); -}; - -app.get( - "/url", - ah(async (req, res, next) => { - try { - const code = await db.Code.findOne({ - where: { - code: req.query.code - } - }); - - if (code) { - res.send(code.text); - } else { - throw new Error("code not found"); +import app from "../app.js"; +import config from "../config/index.js"; +import axios from "axios"; +import lnurl from "lnurl"; +import jwt from "jsonwebtoken"; +import qs from "query-string"; +import persist from "../lib/persist.js"; +import bolt11 from "bolt11"; +import { optionalAuth, auth } from "../lib/passport.js"; + +export const logins = persist("data/logins.json"); +export const recipients = persist("data/recipients.json"); +export const lnurlPayments = persist("data/payments.json"); +export const withdrawals = persist("data/withdrawals.json"); + +export const lnurlServer = lnurl.createServer(config.lnurl); + +import { + computeConversionFee, + conversionFeeReceiver +} from "./lightning/conversionFee.js"; + +app.get("/url", async (req, res, next) => { + try { + const code = await db.Code.findOne({ + where: { + code: req.query.code } - } catch (e) { - l.error("couldn't find url", e.message); - } - }) -); - -app.get( - "/withdraw", - auth, - ah(async (req, res, next) => { - const { min, max } = req.query; - try { - const result = await lnurlServer.generateNewUrl("withdrawRequest", { - minWithdrawable: min * 1000, - maxWithdrawable: max * 1000, - defaultDescription: "coinos voucher" - }); - - withdrawals[result.secret] = req.user; - - res.send(result); - } catch (e) { - l.error("problem generating withdrawl url", e.message); - res.status(500).send(e.message); - } - }) -); - -app.post( - "/code", - ah(async (req, res, next) => { - try { - const { encoded } = req.body.lnurl; - const code = await db.Code.findOrCreate({ - where: { - code: `lnurl:${encoded.substr(-32)}`, - text: encoded - } - }); - - res.send(code); - } catch (e) { - l.error(e.errors); - res.status(500).send(e.message); - } - }) -); - -app.post( - "/withdraw", - auth, - ah(async (req, res, next) => { - const { user } = req; - const { - amount: value, - params: { callback, k1 } - } = req.body; - const invoice = await lnp.addInvoice({ value }); - const { payment_request: pr } = invoice; - const url = `${callback}?k1=${k1}&pr=${pr}`; - - await db.Invoice.create({ - user_id: user.id, - text: pr, - rate: app.get("rates")[user.currency], - currency: user.currency, - amount: value, - tip: 0, - network: "bitcoin" }); - try { - result = (await axios.get(url)).data; - res.send(result); - } catch (e) { - l.error("failed to withdraw", e.message); - res.status(500).send(e.message); + if (code) { + res.send(code.text); + } else { + throw new Error("code not found"); } - }) -); + } catch (e) { + l.error("couldn't find url", e.message); + } +}); -app.get( - "/lnurlp/:username", - ah(async (req, res, next) => { - try { - const { username } = req.params; - let user = await db.User.findOne({ - where: { - username - } - }); +app.get("/withdraw", auth, async (req, res, next) => { + const { min, max } = req.query; + try { + const result = await lnurlServer.generateNewUrl("withdrawRequest", { + minWithdrawable: min * 1000, + maxWithdrawable: max * 1000, + defaultDescription: "coinos voucher" + }); - if (!user) throw new Error("user not found"); + withdrawals[result.secret] = req.user; - let { amount, minSendable, maxSendable } = req.query; - minSendable = minSendable || 1000; - maxSendable = maxSendable || 1000000000; - if (parseInt(amount)) minSendable = maxSendable = amount * 1000; + res.send(result); + } catch (e) { + l.error("problem generating withdrawl url", e.message); + res.status(500).send(e.message); + } +}); - let result = await lnurlServer.generateNewUrl("payRequest", { - minSendable, - maxSendable, - metadata: JSON.stringify([["text/plain", `paying ${user.username}`], ["text/identifier", `${user.username}@coinos.io`]]) - }); +app.post("/code", async (req, res, next) => { + try { + const { encoded } = req.body.lnurl; + const code = await db.Code.findOrCreate({ + where: { + code: `lnurl:${encoded.substr(-32)}`, + text: encoded + } + }); - recipients[result.secret] = user; - l.info("recipient", user.username, result.secret); + res.send(code); + } catch (e) { + l.error(e.errors); + res.status(500).send(e.message); + } +}); - result = await axios.get(result.url); +app.post("/withdraw", auth, async (req, res, next) => { + const { user } = req; + const { + amount: value, + params: { callback, k1 } + } = req.body; + const invoice = await lnp.addInvoice({ value }); + const { payment_request: pr } = invoice; + const url = `${callback}?k1=${k1}&pr=${pr}`; + + await db.Invoice.create({ + user_id: user.id, + text: pr, + rate: app.get("rates")[user.currency], + currency: user.currency, + amount: value, + tip: 0, + network: "bitcoin" + }); - res.send(result.data); - } catch (e) { - l.error("problem generating payment url", e.message); - res.status(500).send(e.message); - } - }) -); + try { + result = (await axios.get(url)).data; + res.send(result); + } catch (e) { + l.error("failed to withdraw", e.message); + res.status(500).send(e.message); + } +}); -app.get( - "/pay/:username", - ah(async (req, res, next) => { +app.get("/lnurlp/:username", async (req, res, next) => { + try { const { username } = req.params; let user = await db.User.findOne({ where: { @@ -164,133 +111,154 @@ app.get( } }); + if (!user) throw new Error("user not found"); + let { amount, minSendable, maxSendable } = req.query; minSendable = minSendable || 1000; maxSendable = maxSendable || 1000000000; if (parseInt(amount)) minSendable = maxSendable = amount * 1000; - try { - const result = await lnurlServer.generateNewUrl("payRequest", { - minSendable, - maxSendable, - metadata: JSON.stringify([["text/plain", `paying ${user.username}`]]) - }); + let result = await lnurlServer.generateNewUrl("payRequest", { + minSendable, + maxSendable, + metadata: JSON.stringify([ + ["text/plain", `paying ${user.username}`], + ["text/identifier", `${user.username}@coinos.io`] + ]) + }); - recipients[result.secret] = user; - l.info("recipient", user.username, result.secret); - res.send(result); - } catch (e) { - l.error("problem generating payment url", e.message); - res.status(500).send(e.message); + recipients[result.secret] = user; + l.info("recipient", user.username, result.secret); + + result = await axios.get(result.url); + + res.send(result.data); + } catch (e) { + l.error("problem generating payment url", e.message); + res.status(500).send(e.message); + } +}); + +app.get("/pay/:username", async (req, res, next) => { + const { username } = req.params; + let user = await db.User.findOne({ + where: { + username } - }) -); + }); -app.post( - "/pay", - auth, - ah(async (req, res, next) => { - const { user } = req; - const { - amount, - comment, - params: { callback, k1 } - } = req.body; + let { amount, minSendable, maxSendable } = req.query; + minSendable = minSendable || 1000; + maxSendable = maxSendable || 1000000000; + if (parseInt(amount)) minSendable = maxSendable = amount * 1000; - let url = `${callback}${callback.includes("?") ? "&" : "?"}amount=${amount * - 1000}${comment ? "&comment=" + comment : ""}`; + try { + const result = await lnurlServer.generateNewUrl("payRequest", { + minSendable, + maxSendable, + metadata: JSON.stringify([["text/plain", `paying ${user.username}`]]) + }); - try { - const parts = callback.split("/"); - const secret = parts[parts.length - 1]; - lnurlPayments[secret] = user.id; - - if (recipients[secret]) { - url = `${req.protocol}://${req.get("host")}/api/send`; - const { data } = await axios.post( - url, - { - amount, - memo: comment, - username: recipients[secret].username - }, - { - headers: { - Authorization: req.get("Authorization") - } + recipients[result.secret] = user; + l.info("recipient", user.username, result.secret); + res.send(result); + } catch (e) { + l.error("problem generating payment url", e.message); + res.status(500).send(e.message); + } +}); + +app.post("/pay", auth, async (req, res, next) => { + const { user } = req; + const { + amount, + comment, + params: { callback, k1 } + } = req.body; + + let url = `${callback}${callback.includes("?") ? "&" : "?"}amount=${amount * + 1000}${comment ? "&comment=" + comment : ""}`; + + try { + const parts = callback.split("/"); + const secret = parts[parts.length - 1]; + lnurlPayments[secret] = user.id; + + if (recipients[secret]) { + url = `${req.protocol}://${req.get("host")}/api/send`; + const { data } = await axios.post( + url, + { + amount, + memo: comment, + username: recipients[secret].username + }, + { + headers: { + Authorization: req.get("Authorization") } - ); + } + ); - res.send(data); - } else { - const { data } = await axios.get(url); - res.send(await send(amount, "", data.pr, user)); - } - } catch (e) { - l.error("failed to send payment", e.message); - res.status(500).send(e.message); + res.send(data); + } else { + const { data } = await axios.get(url); + res.send(await send(amount, "", data.pr, user)); } - }) -); - -app.get( - "/login", - optionalAuth, - ah(async (req, res, next) => { - try { - const result = await lnurlServer.generateNewUrl("login"); + } catch (e) { + l.error("failed to send payment", e.message); + res.status(500).send(e.message); + } +}); - if (req.user) { - logins[result.secret] = req.user.username; - } +app.get("/login", optionalAuth, async (req, res, next) => { + try { + const result = await lnurlServer.generateNewUrl("login"); - res.send(result); - } catch (e) { - l.error("problem generating login url", e.message); - res.status(500).send(e.message); + if (req.user) { + logins[result.secret] = req.user.username; } - }) -); -app.get( - "/encode", - ah(async (req, res, next) => { - let { domain, name } = req.query; - let url = `https://${domain}/.well-known/lnurlp/${name}`; - res.send(lnurl.encode(url)); - }) -); + res.send(result); + } catch (e) { + l.error("problem generating login url", e.message); + res.status(500).send(e.message); + } +}); -app.get( - "/decode", - ah(async (req, res, next) => { - const { text } = req.query; +app.get("/encode", async (req, res, next) => { + let { domain, name } = req.query; + let url = `https://${domain}/.well-known/lnurlp/${name}`; + res.send(lnurl.encode(url)); +}); - try { - const url = lnurl.decode(text); - let spl = url.split("?"); - if (spl.length > 1 && qs.parse(spl[1]).tag === "login") { - return res.send({ - tag: "login", - k1: qs.parse(spl[1]).k1, - callback: url, - domain: url - .split("://")[1] - .split("/")[0] - .split("@") - .slice(-1)[0] - .split(":")[0] - }); - } +app.get("/decode", async (req, res, next) => { + const { text } = req.query; - const { data: params } = await axios.get(url); - res.send(params); - } catch (e) { - l.error("problem decoding lnurl", e.message); - res.status(500).send(e.message); + try { + const url = lnurl.decode(text); + let spl = url.split("?"); + if (spl.length > 1 && qs.parse(spl[1]).tag === "login") { + return res.send({ + tag: "login", + k1: qs.parse(spl[1]).k1, + callback: url, + domain: url + .split("://")[1] + .split("/")[0] + .split("@") + .slice(-1)[0] + .split(":")[0] + }); } - }) -); + + const { data: params } = await axios.get(url); + res.send(params); + } catch (e) { + l.error("problem decoding lnurl", e.message); + res.status(500).send(e.message); + } +}); lnurlServer.on("payRequest:action:processed", async function(event) { const { secret, params, result } = event; @@ -414,15 +382,21 @@ lnurlServer.bindToHook( { model: db.User, as: "user" - }, + } ], lock: transaction.LOCK.UPDATE, transaction }); - let conversionFeeDeduction = Math.min(account.lightning_credits, conversionFee); + let conversionFeeDeduction = Math.min( + account.lightning_credits, + conversionFee + ); if (conversionFeeDeduction) { - await account.decrement({ lightning_credits: conversionFeeDeduction }, { transaction }); + await account.decrement( + { lightning_credits: conversionFeeDeduction }, + { transaction } + ); await account.reload({ transaction }); conversionFee -= conversionFeeDeduction; } @@ -435,20 +409,26 @@ lnurlServer.bindToHook( let fee_payment_id = null; if (conversionFee) { - await receiverAccount.increment({ balance: conversionFee }, { transaction }); + await receiverAccount.increment( + { balance: conversionFee }, + { transaction } + ); await receiverAccount.reload({ transaction }); - let fee_payment = await db.Payment.create({ - amount: conversionFee, - fee: 0, - memo: "Bitcoin conversion fee", - account_id: receiverAccount.id, - user_id: receiverAccount.user_id, - rate: app.get("rates")[receiverAccount.user.currency], - currency: receiverAccount.user.currency, - confirmed: true, - received: true, - network: "COINOS" - }, { transaction }); + let fee_payment = await db.Payment.create( + { + amount: conversionFee, + fee: 0, + memo: "Bitcoin conversion fee", + account_id: receiverAccount.id, + user_id: receiverAccount.user_id, + rate: app.get("rates")[receiverAccount.user.currency], + currency: receiverAccount.user.currency, + confirmed: true, + received: true, + network: "COINOS" + }, + { transaction } + ); fee_payment_id = fee_payment.id; } @@ -462,7 +442,7 @@ lnurlServer.bindToHook( currency: user.currency, confirmed: true, network: "lightning", - fee_payment_id, + fee_payment_id }, { transaction } ); @@ -494,7 +474,10 @@ lnurlServer.bindToHook( } }, 1000); - await account.decrement({ balance: (amount + conversionFee) }, { transaction }); + await account.decrement( + { balance: amount + conversionFee }, + { transaction } + ); await account.reload({ transaction }); let p = payment.get({ plain: true }); diff --git a/routes/payments.js b/routes/payments.js index a9ad7d82..6861d2a3 100644 --- a/routes/payments.js +++ b/routes/payments.js @@ -1,93 +1,70 @@ -import fs from 'fs'; -import BitcoinCore from '@asoltys/bitcoin-core'; -import { join } from 'path'; -import { Op } from 'sequelize'; - -app.post("/send", auth, require("./send")); -app.post( - "/sendToTokenHolders", - auth, - ah(async (req, res, next) => { - let { asset, amount } = req.body; - - let accounts = await db.Account.findAll({ - where: { - asset, - "$user.username$": { [Op.ne]: "gh" } - }, +import bc from "../lib/bitcoin.js"; +import app from "../app.js"; +import config from "../config/index.js"; +import { auth, adminAuth, optionalAuth } from "../lib/passport.js"; +import fs from "fs"; +import { join } from "path"; +import { Op } from "@sequelize/core"; +import send from "./send.js"; - include: [{ model: db.User, as: "user" }] - }); +import btcRoutes from "./bitcoin/index.js"; +import lnRoutes from "./lightning/index.js"; +import lqRoutes from "./liquid/index.js"; - let totalTokens = accounts.reduce((a, b) => a + b.balance, 0); - console.log("TOTAL TOKENS", totalTokens); +app.post("/send", auth, send); +app.post("/sendToTokenHolders", auth, async (req, res, next) => { + let { asset, amount } = req.body; - let totalSats = Math.floor(amount / totalTokens); + let accounts = await db.Account.findAll({ + where: { + asset, + "$user.username$": { [Op.ne]: "gh" } + }, - console.log("TOTAL SATS", totalSats) + include: [{ model: db.User, as: "user" }] + }); - if (totalSats < 1) throw new Error("amount is too low to distribute"); + let totalTokens = accounts.reduce((a, b) => a + b.balance, 0); + console.log("TOTAL TOKENS", totalTokens); - for (let i = 0; i < accounts.length; i++) { - let account = accounts[i]; - console.log(account.user.username, account.balance); - } - accounts.map(({ balance, user: { username } }) => ({ username, balance })); - - res.send({ success: "it worked" }); - }) -); - -app.get( - "/except", - adminAuth, - ah((req, res) => { - let s = fs.createWriteStream("exceptions", { flags: "a" }); - unaccounted.map(tx => s.write(tx.txid + "\n")); - l.info("updated exceptions"); - res.send("updated exceptions"); - }) -); + let totalSats = Math.floor(amount / totalTokens); -if (config.lna) { - if (config.lna.clightning) { - lna = require("clightning-client")(config.lna.dir); - } else { - const lnd = require("../lib/lnd"); - lna = lnd.default; - lnp = [ - "addInvoice", - "channelBalance", - "connectPeer", - "decodePayReq", - "getInfo", - "listInvoices", - "listPayments", - "sendPaymentSync", - "walletBalance" - ].reduce( - (a, b) => - (a[b] = args => new Promise(r => lna[b](args, (e, v) => r(v)))) && a, - {} - ); + console.log("TOTAL SATS", totalSats); + + if (totalSats < 1) throw new Error("amount is too low to distribute"); + + for (let i = 0; i < accounts.length; i++) { + let account = accounts[i]; + console.log(account.user.username, account.balance); } + accounts.map(({ balance, user: { username } }) => ({ username, balance })); + + res.send({ success: "it worked" }); +}); + +app.get("/except", adminAuth, (req, res) => { + let s = fs.createWriteStream("exceptions", { flags: "a" }); + unaccounted.map(tx => s.write(tx.txid + "\n")); + l.info("updated exceptions"); + res.send("updated exceptions"); +}); - app.post("/lightning/channel", require("./lightning/channel")); - app.post("/lightning/channelRequest", require("./lightning/channelRequest")); - app.post("/lightning/invoice", require("./lightning/invoice")); - app.post("/lightning/query", auth, require("./lightning/query")); - app.post("/lightning/send", auth, require("./lightning/send")); - require("./lightning/receive"); +if (config.lna) { + app.post("/lightning/channel", lnRoutes.channel); + app.post("/lightning/channelRequest", lnRoutes.channelRequest); + app.post("/lightning/invoice", lnRoutes.invoice); + app.post("/lightning/query", auth, lnRoutes.query); + app.post("/lightning/send", auth, lnRoutes.send); + import("./lightning/receive"); } if (config.bitcoin) { - bc = new BitcoinCore(config.bitcoin); - app.post("/bitcoin/broadcast", optionalAuth, require("./bitcoin/broadcast")); - app.get("/bitcoin/generate", auth, require("./bitcoin/generate")); - app.post("/bitcoin/sweep", auth, require("./bitcoin/sweep")); - app.post("/bitcoin/fee", auth, require("./bitcoin/fee")); - app.post("/bitcoin/send", auth, require("./bitcoin/send")); - require("./bitcoin/receive"); + app.post("/bitcoin/broadcast", optionalAuth, btcRoutes.broadcast); + app.get("/bitcoin/generate", auth, btcRoutes.generate); + app.post("/bitcoin/sweep", auth, btcRoutes.sweep); + app.post("/bitcoin/fee", auth, btcRoutes.fee); + app.post("/bitcoin/send", auth, btcRoutes.send); + import("./bitcoin/receive"); setTimeout(async () => { try { @@ -102,14 +79,12 @@ if (config.bitcoin) { } if (config.liquid) { - lq = new BitcoinCore(config.liquid); - rare = new BitcoinCore(config.rare); - app.post("/liquid/broadcast", optionalAuth, require("./liquid/broadcast")); - app.get("/liquid/generate", auth, require("./liquid/generate")); - app.post("/liquid/fee", auth, require("./liquid/fee")); - app.post("/liquid/send", auth, require("./liquid/send")); - app.post("/taxi", auth, require("./liquid/taxi")); - require("./liquid/receive"); + app.post("/liquid/broadcast", optionalAuth, lqRoutes.broadcast); + app.get("/liquid/generate", auth, lqRoutes.generate); + // app.post("/liquid/fee", auth, lqRoutes.fee); + app.post("/liquid/send", auth, lqRoutes.send); + // app.post("/taxi", auth, lqRoutes.taxi); + import("./liquid/receive"); setTimeout(async () => { try { @@ -123,46 +98,39 @@ if (config.liquid) { }, 50); } -app.get( - "/payments", - auth, - ah(async (req, res) => { - if (!req.user.account_id) return res.send([]); - let payments = await db.Payment.findAll({ +app.get("/payments", auth, async (req, res) => { + if (!req.user.account_id) return res.send([]); + let payments = await db.Payment.findAll({ + where: { + account_id: req.user.account_id + }, + order: [["id", "DESC"]], + include: { + model: db.Account, + as: "account" + } + }); + + res.send(payments); +}); + +app.get("/payment/:redeemcode", async (req, res) => { + try { + const { redeemcode } = req.params; + let payment = await db.Payment.findOne({ where: { - account_id: req.user.account_id + redeemcode }, - order: [["id", "DESC"]], include: { model: db.Account, as: "account" } }); - res.send(payments); - }) -); + if (!payment) fail("invalid code"); -app.get( - "/payment/:redeemcode", - ah(async (req, res) => { - try { - const { redeemcode } = req.params; - let payment = await db.Payment.findOne({ - where: { - redeemcode - }, - include: { - model: db.Account, - as: "account" - } - }); - - if (!payment) fail("invalid code"); - - res.send(payment); - } catch (e) { - res.status(500).send(e.message); - } - }) -); + res.send(payment); + } catch (e) { + res.status(500).send(e.message); + } +}); diff --git a/routes/referrals.js b/routes/referrals.js index 82bbb3d4..5711532f 100644 --- a/routes/referrals.js +++ b/routes/referrals.js @@ -42,7 +42,7 @@ router.get('/', function(req, res, next) { router.post( "/grant", auth, - ah(async (req, res) => { + async (req, res) => { const {sponsor_id, expiry} = req.body var token = uuidv4() @@ -56,7 +56,6 @@ router.post( return res.send({token: token, status: 'available', expiry: expiry}) }) -); /** * @api {get} /grant Grant Referral code (variation using get) @@ -83,7 +82,7 @@ router.post( router.get( "/grant", auth, - ah(async (req, res) => { + async (req, res) => { const {sponsor_id, expiry} = req.query var token = uuidv4() @@ -97,7 +96,6 @@ router.get( return res.send({token: token, status: 'available', expiry: expiry}) }) -); /** @@ -127,7 +125,7 @@ router.get( router.get( "/checkTokens/:sponsor_id", auth, - ah(async (req, res) => { + async (req, res) => { const {sponsor_id} = req.params const {status} = req.query @@ -148,7 +146,6 @@ router.get( return res.send({tokens: found}) }) -); /** @@ -175,7 +172,7 @@ router.get( router.get( "/verify/:user_id/:token", auth, - ah(async (req, res) => { + async (req, res) => { const { user_id, token } = req.params; const found = await knex @@ -203,7 +200,6 @@ router.get( res.status(500).send('Invalid referral token') } }) -); /** @@ -227,7 +223,7 @@ router.get( */ router.post( "/joinQueue", - ah(async (req, res) => { + async (req, res) => { const { email, phone, user_id } = req.body; await knex.table('waiting_list') @@ -239,11 +235,10 @@ router.post( res.send({success: true, message: 'Added ' + email + ' to waiting list ' + phone}) }) -); router.get( "/joinQueue", - ah(async (req, res) => { + async (req, res) => { const {email, phone, user_id} = req.query; await knex('waiting_list') @@ -255,7 +250,6 @@ router.get( res.send({success: true, message: 'Added ' + email + ' to waiting list ' + phone}) }) -); /** * @api {get} /isReferred/:user_id Check if user is referred @@ -274,7 +268,7 @@ router.get( */ router.get( "/isReferred/:user_id", - ah(async (req, res) => { + async (req, res) => { const { user_id } = req.params; var referred = await knex('referrals') @@ -288,6 +282,5 @@ router.get( res.send({referred: false}) } }) -); export default router; diff --git a/routes/send.js b/routes/send.js index c6de3acb..7cc403e1 100644 --- a/routes/send.js +++ b/routes/send.js @@ -1,7 +1,10 @@ -import axios from 'axios'; -import { v4 as uuidv4 } from 'uuid'; +import { callWebhook } from "../lib/webhooks.js"; +import axios from "axios"; +import { v4 as uuidv4 } from "uuid"; +import { notify } from "../lib/notifications.js"; +import { sendLiquid } from "./liquid/send.js"; -export default ah(async (req, res, next) => { +export default async (req, res, next) => { let { amount, address, @@ -212,4 +215,4 @@ export default ah(async (req, res, next) => { l.error("problem sending internal payment", user.username, e.message); return res.status(500).send(e.message); } -}); +}; diff --git a/routes/swaps.js b/routes/swaps.js index e51dc4f0..f8b37cd0 100644 --- a/routes/swaps.js +++ b/routes/swaps.js @@ -2,7 +2,7 @@ import axios from 'axios'; import crypto from 'crypto'; import fs from 'fs'; import getAccount from '../lib/account'; -import { Op, col } from 'sequelize'; +import { Op, col } from '@sequelize/core'; import { v4 as uuidv4 } from 'uuid'; const shallow = a => { @@ -71,8 +71,8 @@ const swap = async (user, { a1, a2, v1, v2 }) => { { transaction } ); - emit(user.username, "payment", payment.get({ plain: true })); - emit(user.username, "account", a1acc.get({ plain: true })); + emit(user.username, "payment", payment.get({ plain: true }); + emit(user.username, "account", a1acc.get({ plain: true }); const orders = await db.Order.findAll( { @@ -123,7 +123,7 @@ const swap = async (user, { a1, a2, v1, v2 }) => { await order.acc1.increment({ balance: v2 }, { transaction }); await order.acc1.reload({ transaction }); - emit(order.user.username, "account", order.acc1.get({ plain: true })); + emit(order.user.username, "account", order.acc1.get({ plain: true }); payment = await db.Payment.create( { @@ -140,8 +140,8 @@ const swap = async (user, { a1, a2, v1, v2 }) => { { transaction } ); - emit(user.username, "payment", payment.get({ plain: true })); - emit(user.username, "account", a1acc.get({ plain: true })); + emit(user.username, "payment", payment.get({ plain: true }); + emit(user.username, "account", a1acc.get({ plain: true }); if (order.fee) { const btc = await getAccount( @@ -168,10 +168,10 @@ const swap = async (user, { a1, a2, v1, v2 }) => { await btc.increment({ balance: order.fee }, { transaction }); await btc.reload({ transaction }); - emit(order.user.username, "account", btc.get({ plain: true })); + emit(order.user.username, "account", btc.get({ plain: true }); } - emit(order.user.username, "payment", payment.get({ plain: true })); + emit(order.user.username, "payment", payment.get({ plain: true }); order = order.get({ plain: true }); order.a1 = order.acc1.asset; @@ -207,8 +207,8 @@ const swap = async (user, { a1, a2, v1, v2 }) => { await a2acc.increment({ balance: order.v1 }, { transaction }); await a2acc.reload({ transaction }); - emit(user.username, "payment", payment.get({ plain: true })); - emit(user.username, "account", a2acc.get({ plain: true })); + emit(user.username, "payment", payment.get({ plain: true }); + emit(user.username, "account", a2acc.get({ plain: true }); payment = await db.Payment.create( { @@ -225,7 +225,7 @@ const swap = async (user, { a1, a2, v1, v2 }) => { { transaction } ); - emit(order.user.username, "payment", payment.get({ plain: true })); + emit(order.user.username, "payment", payment.get({ plain: true }); await order.acc2.increment({ balance: order.v2 }, { transaction }); await order.acc2.reload({ transaction }); @@ -298,8 +298,8 @@ const cancel = async (user, id) => { { transaction } ); - emit(user.username, "account", account.get({ plain: true })); - emit(user.username, "payment", payment.get({ plain: true })); + emit(user.username, "account", account.get({ plain: true }); + emit(user.username, "payment", payment.get({ plain: true }); if (order.fee) { const btc = await getAccount(config.liquid.btcasset, user, transaction); @@ -322,8 +322,8 @@ const cancel = async (user, id) => { await btc.increment({ balance: order.fee }, { transaction }); await btc.reload({ transaction }); - emit(user.username, "account", btc.get({ plain: true })); - emit(user.username, "payment", payment.get({ plain: true })); + emit(user.username, "account", btc.get({ plain: true }); + emit(user.username, "payment", payment.get({ plain: true }); } broadcast("removeOrder", id); @@ -334,7 +334,7 @@ const cancel = async (user, id) => { app.delete( "/order/:id", auth, - ah(async (req, res) => { + async (req, res) => { const { id } = req.params; const { user } = req; @@ -346,7 +346,7 @@ app.delete( app.post( "/orders", auth, - ah(async (req, res) => { + async (req, res) => { return res.status(500).send("Trading temporarily disabled"); const { user } = req; try { @@ -362,7 +362,7 @@ app.post( app.get( "/orders", optionalAuth, - ah(async (req, res) => { + async (req, res) => { try { let orders = await db.Order.findAll({ attributes: { diff --git a/routes/users.js b/routes/users.js index f92c9045..f0fa8c47 100644 --- a/routes/users.js +++ b/routes/users.js @@ -1,19 +1,21 @@ +import { getUser } from "../lib/utils.js"; import axios from 'axios'; import bcrypt from 'bcrypt'; import jwt from 'jsonwebtoken'; import { authenticator } from 'otplib'; import getAccount from '../lib/account.js'; -import Sequelize from 'sequelize'; +import Sequelize from '@sequelize/core'; import bitcoin from 'bitcoinjs-lib'; -import liquid from 'liquidjs-lib'; +// import liquid from 'liquidjs-lib'; import { fromBase58, fromPrivateKey } from 'bip32'; import { Mutex } from 'async-mutex'; import bip32 from 'bip32'; +import whitelist from "../lib/whitelist.js"; const pick = (O, ...K) => K.reduce((o, k) => ((o[k] = O[k]), o), {}); -import '../lib/whitelist.js'; -const twofa = ah((req, res, next) => { +/* +const twofa = (req, res, next) => { let { user, body: { token } @@ -25,12 +27,12 @@ const twofa = ah((req, res, next) => { ) { return res.status(401).send("2fa required"); } else next(); -}); +} app.get( "/me", auth, - ah(async (req, res) => { + async (req, res) => { let user = req.user.get({ plain: true }); let payments = await req.user.getPayments({ where: { @@ -53,11 +55,10 @@ app.get( user.payments = payments; res.send(user); }) -); app.get( "/users/:username", - ah(async (req, res) => { + async (req, res) => { const { username } = req.params; const user = await db.User.findOne({ @@ -71,11 +72,10 @@ app.get( if (user) res.send(user); else res.status(500).send("User not found"); }) -); app.post( "/register", - ah(async (req, res) => { + async (req, res) => { try { const ip = req.headers["x-forwarded-for"] || req.connection.remoteAddress; const user = await register(req.body.user, ip, false); @@ -84,13 +84,12 @@ app.post( res.status(500).send(e.message); } }) -); app.post( "/disable2fa", auth, twofa, - ah(async (req, res) => { + async (req, res) => { let { user } = req; user.twofa = false; await user.save(); @@ -99,23 +98,21 @@ app.post( l.info("disabled 2fa", user.username); res.send({}); }) -); app.get( "/otpsecret", auth, twofa, - ah(async (req, res) => { + async (req, res) => { let { user } = req; emit(user.username, "otpsecret", user.otpsecret); res.end(); }) -); app.post( "/2fa", auth, - ah(async (req, res) => { + async (req, res) => { let { user } = req; try { const isValid = authenticator.check(req.body.token, req.user.otpsecret); @@ -133,23 +130,21 @@ app.post( l.info("enabled 2fa", user.username); res.send({}); }) -); app.get( "/exists", - ah(async (req, res) => { + async (req, res) => { let exists = await db.User.findOne({ where: { username: req.query.username } }); res.send(!!exists); }) -); app.post( "/user", auth, - ah(async (req, res) => { + async (req, res) => { try { let { user } = req; let { @@ -211,12 +206,11 @@ app.post( l.error("error updating user", e.message); } }) -); app.post( "/keys", auth, - ah(async (req, res) => { + async (req, res) => { const { key: hex } = req.body; const key = await db.Key.create({ user_id: req.user.id, @@ -225,12 +219,11 @@ app.post( emit(req.user.username, "key", key); res.send(key); }) -); app.post( "/keys/delete", auth, - ah(async (req, res) => { + async (req, res) => { const { hex } = req.body; ( await db.Key.findOne({ @@ -241,12 +234,11 @@ app.post( }) ).destroy(); }) -); app.post( "/updateSeeds", auth, - ah(async (req, res) => { + async (req, res) => { let { user } = req; let { seeds } = req.body; let keys = Object.keys(seeds); @@ -270,23 +262,21 @@ app.post( res.end(); }) -); app.post( "/accounts/delete", auth, - ah(async (req, res) => { + async (req, res) => { const { id } = req.body; const account = await db.Account.findOne({ where: { id } }); if (account) await account.destroy(); res.end(); }) -); app.post( "/accounts", auth, - ah(async (req, res) => { + async (req, res) => { const { name, seed, @@ -324,9 +314,8 @@ app.post( res.send(account); }) -); -let login = ah(async (req, res) => { +let login = async (req, res) => { try { const { params, sig, key } = req.body; @@ -383,7 +372,6 @@ let login = ah(async (req, res) => { l.error("login error", e.message, req.connection.remoteAddress); res.status(401).end(); } -}); app.post("/login", login); app.post("/taboggan", login); @@ -392,7 +380,7 @@ app.post("/doggin", login); app.post( "/logout", optionalAuth, - ah(async (req, res) => { + async (req, res) => { let { subscription } = req.body; if (!subscription) return res.end(); @@ -414,11 +402,10 @@ app.post( res.end(); }) -); app.get( "/address", - ah(async (req, res) => { + async (req, res) => { let { network, type } = req.query; let address, confidentialAddress; @@ -532,12 +519,11 @@ app.get( res.send({ address, confidentialAddress }); }) -); app.post( "/account", auth, - ah(async (req, res) => { + async (req, res) => { const { user } = req; const { id, @@ -590,12 +576,11 @@ app.post( return res.status(500).send("There was a problem updating the account"); } }) -); app.post( "/shiftAccount", auth, - ah(async (req, res) => { + async (req, res) => { let { user } = req; let { id } = req.body; @@ -634,7 +619,6 @@ app.post( return res.status(500).send("There was a problem switching accounts"); } }) -); app.get("/vapidPublicKey", function(req, res) { res.send(config.vapid.publicKey); @@ -643,7 +627,7 @@ app.get("/vapidPublicKey", function(req, res) { app.post( "/subscribe", auth, - ah(async function(req, res) { + async function(req, res) { let { subscriptions } = req.user; let { subscription } = req.body; if (!subscriptions) subscriptions = []; @@ -658,13 +642,12 @@ app.post( await req.user.save(); res.sendStatus(201); }) -); let redeeming = {}; app.post( "/redeem", optionalAuth, - ah(async function(req, res) { + async function(req, res) { const { redeemcode } = req.body; try { await db.transaction(async transaction => { @@ -755,35 +738,32 @@ app.post( return res.status(500).send("There was a problem redeeming the voucher"); } }) -); app.post( "/checkRedeemCode", auth, - ah(async function(req, res) { + async function(req, res) { const { redeemcode } = req.body; const payment = await db.Payment.findOne({ where: { redeemcode } }); res.send(payment); }) -); app.post( "/password", auth, - ah(async function(req, res) { + async function(req, res) { const { user } = req; const { password } = req.body; if (!user.password) return res.send(true); res.send(await bcrypt.compare(password, user.password)); }) -); app.get( "/isInternal", auth, - ah(async function(req, res) { + async function(req, res) { let { user } = req; let { address } = req.query; if (!address) throw new Error("Address not provided"); @@ -812,23 +792,21 @@ app.get( res.send(false); }) -); app.get( "/invoices", auth, - ah(async function(req, res) { + async function(req, res) { let invoices = await db.Invoice.findAll({ where: { user_id: req.user.id } }); res.send(invoices); - }) -); + }); app.post( "/signMessage", auth, - ah(async function(req, res) { + async function(req, res) { let { address, message } = req.body; let invoices = await db.Invoice.findAll({ @@ -843,4 +821,4 @@ app.post( res.status(500).send("Address not found for user"); }) -); + */ diff --git a/scripts/apiParse.js b/scripts/apiParse.js index 7e54b654..f13f1943 100644 --- a/scripts/apiParse.js +++ b/scripts/apiParse.js @@ -1,4 +1,4 @@ -const addUserSearch = function (input, table) { +export const addUserSearch = function (input, table) { var {search, starts_with, contains} = input if (!table) { table = 'users' } @@ -19,7 +19,7 @@ const addUserSearch = function (input, table) { } } -const addTimeSearch = function (input, field) { +export const addTimeSearch = function (input, field) { if (!field) { field = 'updatedAt' } var {since} = input @@ -32,8 +32,3 @@ const addTimeSearch = function (input, field) { } } -module.exports = { - addUserSearch: addUserSearch, - addTimeSearch: addTimeSearch, -} - diff --git a/scripts/createExceptions.js b/scripts/createExceptions.js deleted file mode 100644 index 26baeb7e..00000000 --- a/scripts/createExceptions.js +++ /dev/null @@ -1,32 +0,0 @@ -BitcoinCore = require("@asoltys/bitcoin-core"); -fs = require("fs"); -config = require("./config"); -bc = new BitcoinCore(config.bitcoin); -l = require("pino")(); -require("./db"); - -console.log(db.Payment); - -(async () => { - payments = ( - await db.Payment.findAll({ - attributes: ["hash"], - }) - ).map((p) => p.hash); - const transactions = await bc.listTransactions("*", 1000); - var stream = fs.createWriteStream("exceptions", { - flags: "a", - emitClose: true, - }); - transactions.map((tx) => { - if (!payments.includes(tx.txid)) { - l.info("writing", tx.txid); - stream.write(tx.txid + "\n"); - } - }); - stream.end(); - stream.on("close", () => { - l.info("done"); - process.exit(); - }); -})(); diff --git a/secret b/secret new file mode 100644 index 00000000..e69de29b -- cgit v1.2.3