@actual-app/web 23.4.2 → 23.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/asset-manifest.json +3 -3
- package/build/data/migrations/1682974838138_remove_payee_rules.sql +5 -0
- package/build/data-file-index.txt +1 -0
- package/build/index.html +1 -1
- package/build/kcab/kcab.worker.e2ee9d65fbc7d1214a04.js +32 -0
- package/build/kcab/kcab.worker.e2ee9d65fbc7d1214a04.js.map +1 -0
- package/build/kcab/{xfo.kcab.worker.f69af9ddb3faa7a57f53.js → xfo.kcab.worker.e2ee9d65fbc7d1214a04.js} +1 -1
- package/build/static/js/main.8c52ae96.js +3 -0
- package/build/static/js/{main.9c657c78.js.LICENSE.txt → main.8c52ae96.js.LICENSE.txt} +9 -10
- package/build/static/js/main.8c52ae96.js.map +1 -0
- package/package.json +3 -4
- package/build/kcab/kcab.worker.f69af9ddb3faa7a57f53.js +0 -31
- package/build/kcab/kcab.worker.f69af9ddb3faa7a57f53.js.map +0 -1
- package/build/static/js/main.9c657c78.js +0 -3
- package/build/static/js/main.9c657c78.js.map +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var backend=function(t){self.webpackChunkbackend=function(e,n){for(var i in n)t[i]=n[i];for(;e.length;)r[e.pop()]=1};var e={},r={main:1};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.e=function(t){var e=[];return e.push(Promise.resolve().then((function(){r[t]||importScripts(n.p+""+t+".kcab.worker.e2ee9d65fbc7d1214a04.js")}))),Promise.all(e)},n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/kcab/",n(n.s=253)}([function(t,e,r){"use strict";r.r(e),r.d(e,"toDateRepr",(function(){return f.g})),r.d(e,"fromDateRepr",(function(){return f.d})),r.d(e,"getDatabasePath",(function(){return y})),r.d(e,"openDatabase",(function(){return b})),r.d(e,"reopenDatabase",(function(){return _})),r.d(e,"closeDatabase",(function(){return v})),r.d(e,"setDatabase",(function(){return w})),r.d(e,"getDatabase",(function(){return E})),r.d(e,"loadClock",(function(){return S})),r.d(e,"runQuery",(function(){return O})),r.d(e,"execQuery",(function(){return T})),r.d(e,"cache",(function(){return M})),r.d(e,"transaction",(function(){return I})),r.d(e,"asyncTransaction",(function(){return R})),r.d(e,"all",(function(){return N})),r.d(e,"first",(function(){return k})),r.d(e,"firstSync",(function(){return D})),r.d(e,"run",(function(){return j})),r.d(e,"select",(function(){return C})),r.d(e,"update",(function(){return L})),r.d(e,"insertWithUUID",(function(){return x})),r.d(e,"insert",(function(){return B})),r.d(e,"delete_",(function(){return U})),r.d(e,"selectWithSchema",(function(){return F})),r.d(e,"selectFirstWithSchema",(function(){return P})),r.d(e,"insertWithSchema",(function(){return W})),r.d(e,"updateWithSchema",(function(){return z})),r.d(e,"getCategories",(function(){return H})),r.d(e,"getCategoriesGrouped",(function(){return q})),r.d(e,"insertCategoryGroup",(function(){return V})),r.d(e,"updateCategoryGroup",(function(){return G})),r.d(e,"moveCategoryGroup",(function(){return Y})),r.d(e,"deleteCategoryGroup",(function(){return $})),r.d(e,"insertCategory",(function(){return K})),r.d(e,"updateCategory",(function(){return Z})),r.d(e,"moveCategory",(function(){return J})),r.d(e,"deleteCategory",(function(){return X})),r.d(e,"getPayee",(function(){return Q})),r.d(e,"insertPayee",(function(){return tt})),r.d(e,"deletePayee",(function(){return et})),r.d(e,"deleteTransferPayee",(function(){return rt})),r.d(e,"updatePayee",(function(){return nt})),r.d(e,"mergePayees",(function(){return it})),r.d(e,"getPayees",(function(){return ot})),r.d(e,"getOrphanedPayees",(function(){return at})),r.d(e,"getPayeeByName",(function(){return st})),r.d(e,"getAccounts",(function(){return ut})),r.d(e,"insertAccount",(function(){return ct})),r.d(e,"updateAccount",(function(){return lt})),r.d(e,"deleteAccount",(function(){return ft})),r.d(e,"moveAccount",(function(){return dt})),r.d(e,"getTransaction",(function(){return ht})),r.d(e,"getTransactionsByDate",(function(){return gt})),r.d(e,"getTransactions",(function(){return pt})),r.d(e,"insertTransaction",(function(){return mt})),r.d(e,"updateTransaction",(function(){return yt})),r.d(e,"deleteTransaction",(function(){return bt}));var n=r(139),i=r.n(n),o=r(2),a=r(13),s=r(22),u=r(5),c=r(14),l=r(10),f=r(20),d=r(7);function h(t,e){const r=t[e-1],n=t[e];return r?n?(r.sort_order+n.sort_order)/2:r.sort_order+16384:n.sort_order/2}function g(t,e){const r=t.findIndex(t=>t.id===e),n=t[r],i=t[r-1];let o=[];if(e&&-1!==r){if(n.sort_order-(i?i.sort_order:0)<=2){let e=r,n=Math.floor(t[e].sort_order)+16384;for(;e<t.length&&!(n<=t[e].sort_order);)o.push({id:t[e].id,sort_order:n}),e++,n+=16384}return{updates:o,sort_order:h(t,r)}}{let e;return e=t.length>0?t[t.length-1].sort_order+16384:16384,{updates:o,sort_order:e}}}let p,m;function y(){return p}async function b(t){m&&await a.c(m),p=o.j(o.e(t),"db.sqlite"),w(await a.g(p))}async function _(){await a.c(m),w(await a.g(p))}async function v(){m&&(await a.c(m),w(null))}function w(t){m=t,A=new i.a({max:100})}function E(){return m}async function S(){let t=await k("SELECT * FROM messages_clock");if(t){let e=Object(l.b)(t.clock);Object(l.h)(e)}else{let t=new l.a(0,0,Object(l.d)()),e=Object(l.e)(t);Object(l.h)(e),await O("INSERT INTO messages_clock (id, clock) VALUES (?, ?)",[1,Object(l.g)(e)])}}function O(t,e,r){return a.i(m,t,e,r)}function T(t){a.d(m,t)}let A=new i.a({max:100});function M(t){let e=A.get(t);if(e)return e;let r=a.h(m,t);return A.set(t,r),r}function I(t){return a.j(m,t)}function R(t){return a.b(m,t)}async function N(t,e){return O(t,e,!0)}async function k(t,e){const r=await O(t,e,!0);return 0===r.length?null:r[0]}function D(t,e){const r=O(t,e,!0);return 0===r.length?null:r[0]}async function j(t,e){return O(t,e)}async function C(t,e){return(await O("SELECT * FROM "+t+" WHERE id = ?",[e],!0))[0]}async function L(t,e){let r=Object.keys(e).filter(t=>"id"!==t);if(null==e.id)throw new Error("update: id is required");await Object(d.j)(r.map(r=>({dataset:t,row:e.id,column:r,value:e[r],timestamp:l.a.send()})))}async function x(t,e){return e.id||(e={...e,id:s.a()}),await B(t,e),e.id}async function B(t,e){let r=Object.keys(e).filter(t=>"id"!==t);if(null==e.id)throw new Error("insert: id is required");await Object(d.j)(r.map(r=>({dataset:t,row:e.id,column:r,value:e[r],timestamp:l.a.send()})))}async function U(t,e){await Object(d.j)([{dataset:t,row:e,column:"tombstone",value:1,timestamp:l.a.send()}])}async function F(t,e,r){return(await O(e,r,!0)).map(e=>Object(c.d)(c.h,c.i,t,e)).filter(Boolean)}async function P(t,e,r){let n=await F(t,e,r);return n.length>0?n[0]:null}function W(t,e){return e.id||(e={...e,id:s.a()}),x(t,Object(c.b)(c.h,c.i,t,e))}function z(t,e){return L(t,Object(c.c)(c.h,c.i,t,e))}async function H(){return N("\n SELECT c.* FROM categories c\n LEFT JOIN category_groups cg ON c.cat_group = cg.id\n WHERE c.tombstone = 0\n ORDER BY cg.sort_order, cg.id, c.sort_order, c.id\n ")}async function q(){const t=await N("SELECT * FROM category_groups WHERE tombstone = 0 ORDER BY is_income, sort_order, id"),e=await N("\n SELECT * FROM categories WHERE tombstone = 0\n ORDER BY sort_order, id\n ");return t.map(t=>({...t,categories:e.filter(e=>e.cat_group===t.id)}))}async function V(t){const e=await k("\n SELECT sort_order FROM category_groups WHERE tombstone = 0 ORDER BY sort_order DESC, id DESC LIMIT 1\n "),r=(e?e.sort_order:0)+16384;return x("category_groups",t={...f.b.validate(t),sort_order:r})}function G(t){return L("category_groups",t=f.b.validate(t,{update:!0}))}async function Y(t,e){const r=await N("SELECT id, sort_order FROM category_groups WHERE tombstone = 0 ORDER BY sort_order, id"),{updates:n,sort_order:i}=g(r,e);for(let t of n)await L("category_groups",t);await L("category_groups",{id:t,sort_order:i})}async function $(t,e){const r=await N("SELECT * FROM categories WHERE cat_group = ?",[t.id]);await Promise.all(r.map(t=>X(t,e))),await U("category_groups",t.id)}async function K(t){let e,r,{atEnd:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{atEnd:void 0};return await Object(d.c)(async()=>{if(n){const t=await k("\n SELECT sort_order FROM categories WHERE tombstone = 0 ORDER BY sort_order DESC, id DESC LIMIT 1\n ");e=(t?t.sort_order:0)+16384}else{const r=await N("SELECT id, sort_order FROM categories WHERE cat_group = ? AND tombstone = 0 ORDER BY sort_order, id",[t.cat_group]),{updates:n,sort_order:i}=g(r,r.length>0?r[0].id:null);for(let t of n)await L("categories",t);e=i}t={...f.c.validate(t),sort_order:e};const i=await x("categories",t);await B("category_mapping",{id:i,transferId:i}),r=i}),r}function Z(t){return L("categories",t=f.c.validate(t,{update:!0}))}async function J(t,e,r){if(!e)throw new Error("moveCategory: groupId is required");const n=await N("SELECT id, sort_order FROM categories WHERE cat_group = ? AND tombstone = 0 ORDER BY sort_order, id",[e]),{updates:i,sort_order:o}=g(n,r);for(let t of i)await L("categories",t);await L("categories",{id:t,sort_order:o,cat_group:e})}async function X(t,e){if(e){const r=await N("SELECT * FROM category_mapping WHERE transferId = ?",[t.id]);for(let t of r)await L("category_mapping",{id:t.id,transferId:e});await L("category_mapping",{id:t.id,transferId:e})}return U("categories",t.id)}async function Q(t){return k("SELECT * FROM payees WHERE id = ?",[t])}async function tt(t){let e;return t=f.e.validate(t),await Object(d.c)(async()=>{e=await x("payees",t),await B("payee_mapping",{id:e,targetId:e})}),e}async function et(t){let{transfer_acct:e}=await k("SELECT * FROM payees WHERE id = ?",[t.id]);if(!e)return U("payees",t.id)}async function rt(t){return U("payees",t.id)}function nt(t){return L("payees",t=f.e.validate(t,{update:!0}))}async function it(t,e){let r=Object(u.i)(await N("SELECT * FROM payees"));null==r[t].transfer_acct&&(e=e.filter(t=>null==r[t].transfer_acct),await Object(d.c)(async()=>(await Promise.all(e.map(async e=>{let r=await N("SELECT id FROM payee_mapping WHERE targetId = ?",[e]);await Promise.all(r.map(e=>L("payee_mapping",{id:e.id,targetId:t})))})),Promise.all(e.map(e=>Promise.all([L("payee_mapping",{id:e,targetId:t}),U("payees",e)]))))))}function ot(){return N("\n SELECT p.*, COALESCE(a.name, p.name) AS name FROM payees p\n LEFT JOIN accounts a ON (p.transfer_acct = a.id AND a.tombstone = 0)\n WHERE p.tombstone = 0 AND (p.transfer_acct IS NULL OR a.id IS NOT NULL)\n ORDER BY p.transfer_acct IS NULL DESC, p.name COLLATE NOCASE\n ")}async function at(){return(await N("\n SELECT p.id FROM payees p\n LEFT JOIN payee_mapping pm ON pm.id = p.id\n LEFT JOIN v_transactions_internal_alive t ON t.payee = pm.targetId\n WHERE p.tombstone = 0 AND p.transfer_acct IS NULL AND t.id IS NULL\n ")).map(t=>t.id)}async function st(t){return k("SELECT * FROM payees WHERE UNICODE_LOWER(name) = ? AND tombstone = 0",[t.toLowerCase()])}function ut(){return N("SELECT a.*, b.name as bankName, b.id as bankId FROM accounts a\n LEFT JOIN banks b ON a.bank = b.id\n WHERE a.tombstone = 0\n ORDER BY sort_order, name")}async function ct(t){void 0===t.type&&(t={...t,type:"checking"});const e=await N("SELECT * FROM accounts WHERE offbudget = ? ORDER BY sort_order, name",[null!=t.offbudget?t.offbudget:0]);let{sort_order:r}=g(e);return x("accounts",t=f.a.validate({...t,sort_order:r}))}function lt(t){return L("accounts",t=f.a.validate(t,{update:!0}))}function ft(t){return U("accounts",t.id)}async function dt(t,e){let r,n=await k("SELECT * FROM accounts WHERE id = ?",[t]);r=n.closed?await N("SELECT id, sort_order FROM accounts WHERE closed = 1 ORDER BY sort_order, name"):await N("SELECT id, sort_order FROM accounts WHERE tombstone = 0 AND offbudget = ? ORDER BY sort_order, name",[n.offbudget]);const{updates:i,sort_order:o}=g(r,e);await Object(d.c)(()=>{for(let t of i)L("accounts",t);L("accounts",{id:t,sort_order:o})})}async function ht(t){return(await F("transactions","SELECT * FROM v_transactions WHERE id = ?",[t]))[0]}async function gt(t,e,r){throw new Error("`getTransactionsByDate` is deprecated")}async function pt(t){if(arguments.length>1)throw new Error("`getTransactions` was given a second argument, it now only takes a single argument `accountId`");return F("transactions","SELECT * FROM v_transactions WHERE account = ?",[t])}function mt(t){return W("transactions",t)}function yt(t){return z("transactions",t)}async function bt(t){return U("transactions",t.id)}},function(t,e,r){"use strict";(function(t){r.d(e,"l",(function(){return g})),r.d(e,"s",(function(){return p})),r.d(e,"k",(function(){return m})),r.d(e,"f",(function(){return y})),r.d(e,"e",(function(){return b})),r.d(e,"d",(function(){return _})),r.d(e,"m",(function(){return v})),r.d(e,"b",(function(){return w})),r.d(e,"r",(function(){return E})),r.d(e,"a",(function(){return S})),r.d(e,"q",(function(){return O})),r.d(e,"j",(function(){return T})),r.d(e,"i",(function(){return A})),r.d(e,"c",(function(){return M})),r.d(e,"n",(function(){return R})),r.d(e,"o",(function(){return N})),r.d(e,"h",(function(){return k})),r.d(e,"p",(function(){return D})),r.d(e,"g",(function(){return j}));var n=r(42),i=r(76),o=r(251),a=r(77),s=r(252),u=r(145),c=r(429),l=r(430),f=r(431),d=r(62);function h(t){if("string"==typeof t){let[e,r,n]=t.split("-");return null!=n?new Date(parseInt(e),parseInt(r)-1,parseInt(n),12):null!=r?new Date(parseInt(e),parseInt(r)-1,1,12):new Date(parseInt(e),0,1,12)}return t}const g=h;function p(t){return n.a(h(t),"yyyy")}function m(t){return n.a(h(t),"yyyy-MM")}function y(t){return n.a(h(t),"yyyy-MM-dd")}function b(){return t.IS_TESTING?t.currentMonth||"2017-01":n.a(new Date,"yyyy-MM")}function _(){return t.IS_TESTING?"2017-01-01":n.a(new Date,"yyyy-MM-dd")}function v(t){return n.a(o.a(h(t),1),"yyyy-MM")}function w(t,e){return n.a(i.a(h(t),e),"yyyy-MM")}function E(t,e){return n.a(o.a(h(t),e),"yyyy-MM")}function S(t,e){return n.a(a.a(h(t),e),"yyyy-MM-dd")}function O(t,e){return n.a(s.a(h(t),e),"yyyy-MM-dd")}function T(t,e){return u.a(h(t),h(e))}function A(t,e){return c.a(h(t),h(e))}function M(t){return{start:parseInt(n.a(l.a(h(t)),"yyyyMMdd")),end:parseInt(n.a(f.a(h(t)),"yyyyMMdd"))}}function I(t,e){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n=[];let i=m(t);for(;u.a(h(i),h(e));)n.push(i),i=w(i,1);return r&&n.push(i),n}function R(t,e){return I(t,e)}function N(t,e){return I(t,e,!0)}function k(t){return t.slice(0,7)}function D(t){return"budget"+t.replace("-","")}function j(t,e){return n.a(h(t),e)}Object(d.a)(t=>new RegExp(t.replace(/d+/g,"\\d{1,2}").replace(/M+/g,"\\d{1,2}").replace(/y+/g,"\\d{4}"))),Object(d.a)(t=>t.replace(/y+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"")),Object(d.a)(t=>{let e=t.replace(/y+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/d+/g,"\\d{1,2}").replace(/M+/g,"\\d{1,2}");return new RegExp("^"+e+"$")}),Object(d.a)(t=>t.replace(/d+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/\/\//,"/").replace(/\.\./,".").replace(/--/,"-")),Object(d.a)(t=>{let e=t.replace(/d+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/\/\//,"/").replace(/M+/g,"\\d{1,2}").replace(/y+/g,"\\d{2,4}");return new RegExp("^"+e+"$")}),Object(d.a)(t=>t.replace(/y+/g,"yy")),Object(d.a)(t=>{let e=t.replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/d+/g,"\\d{1,2}").replace(/M+/g,"\\d{1,2}").replace(/y+/g,"\\d{2}");return new RegExp("^"+e+"$")})}).call(this,r(33))},function(t,e,r){"use strict";r.d(e,"b",(function(){return p})),r.d(e,"l",(function(){return m})),r.d(e,"j",(function(){return f})),r.d(e,"f",(function(){return d.c})),r.d(e,"g",(function(){return d.d})),r.d(e,"e",(function(){return d.b})),r.d(e,"a",(function(){return d.a})),r.d(e,"i",(function(){return O})),r.d(e,"k",(function(){return A})),r.d(e,"d",(function(){return M})),r.d(e,"m",(function(){return I})),r.d(e,"c",(function(){return R})),r.d(e,"n",(function(){return N})),r.d(e,"q",(function(){return k})),r.d(e,"p",(function(){return D})),r.d(e,"o",(function(){return j})),r.d(e,"h",(function(){return C}));const n=63,i=44;const o=class{constructor(t,e){this.FS=t,this.backend=e,this.node_ops={getattr:e=>{let r=t.isFile(e.mode)?e.contents.getattr():null,n={dev:1};return n.ino=e.id,n.mode=r?r.mode:e.mode,n.nlink=1,n.uid=0,n.gid=0,n.rdev=e.rdev,n.size=r?r.size:t.isDir(e.mode)?4096:0,n.atime=new Date(0),n.mtime=new Date(0),n.ctime=new Date(0),n.blksize=r?r.blockSize:4096,n.blocks=Math.ceil(n.size/n.blksize),n},setattr:(t,e)=>{this.FS.isFile(t.mode)?t.contents.setattr(e):(null!=e.mode&&(t.mode=e.mode),null!=e.size&&(t.size=e.size))},lookup:(t,e)=>{throw new this.FS.ErrnoError(i)},mknod:(t,e,r,n)=>{if(e.endsWith(".lock"))throw new Error("Locking via lockfiles is not supported");return this.createNode(t,e,r,n)},rename:(t,e,r)=>{throw new Error("rename not implemented")},unlink:(t,e)=>{this.FS.lookupNode(t,e).contents.delete(e)},readdir:t=>{throw new Error("readdir not implemented")},symlink:(t,e,r)=>{throw new Error("symlink not implemented")},readlink:t=>{throw new Error("symlink not implemented")}},this.stream_ops={open:t=>{this.FS.isFile(t.node.mode)&&t.node.contents.open()},close:t=>{this.FS.isFile(t.node.mode)&&t.node.contents.close()},read:(t,e,r,n,i)=>t.node.contents.read(e,r,n,i),write:(t,e,r,n,i)=>t.node.contents.write(e,r,n,i),llseek:(e,r,n)=>{var i=r;if(1===n?i+=e.position:2===n&&t.isFile(e.node.mode)&&(i+=e.node.contents.getattr().size),i<0)throw new this.FS.ErrnoError(28);return i},allocate:(t,e,r)=>{t.node.contents.setattr({size:e+r})},mmap:(t,e,r,n,i,o)=>{throw new Error("mmap not implemented")},msync:(t,e,r,n,i)=>{throw new Error("msync not implemented")},fsync:(t,e,r,n,i)=>{t.node.contents.fsync()}}}mount(){return this.createNode(null,"/",16895,0)}lock(t,e){let{node:r}=this.FS.lookupPath(t);return!r||!r.contents||r.contents.lock(e)}unlock(t,e){let{node:r}=this.FS.lookupPath(t);return!r||!r.contents||r.contents.unlock(e)}createNode(t,e,r,i){if(!this.FS.isDir(r)&&!this.FS.isFile(r))throw new this.FS.ErrnoError(n);var o=this.FS.createNode(t,e,r,i);return this.FS.isDir(o.mode)?(o.node_ops={mknod:this.node_ops.mknod,lookup:this.node_ops.lookup,unlink:this.node_ops.unlink,setattr:this.node_ops.setattr},o.stream_ops={},o.contents={}):this.FS.isFile(o.mode)&&(o.node_ops=this.node_ops,o.stream_ops=this.stream_ops,o.contents=this.backend.createFile(e)),t&&(t.contents[e]=o,t.timestamp=o.timestamp),o}};var a=r(234),s=r(23),u=r(36),c=r(13);function l(t){if(0===t.length)return".";let e=47===t.charCodeAt(0),r=47===t.charCodeAt(t.length-1);return 0!==(t=function(t,e){let r,n="",i=0,o=-1,a=0;for(let s=0;s<=t.length;++s){if(s<t.length)r=t.charCodeAt(s);else{if(47===r)break;r=47}if(47===r){if(o===s-1||1===a);else if(o!==s-1&&2===a){if(n.length<2||2!==i||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){let t=n.lastIndexOf("/");if(t!==n.length-1){-1===t?(n="",i=0):(n=n.slice(0,t),i=n.length-1-n.lastIndexOf("/")),o=s,a=0;continue}}else if(2===n.length||1===n.length){n="",i=0,o=s,a=0;continue}e&&(n.length>0?n+="/..":n="..",i=2)}else n.length>0?n+="/"+t.slice(o+1,s):n=t.slice(o+1,s),i=s-o-1;o=s,a=0}else 46===r&&-1!==a?++a:a=-1}return n}(t,!e)).length||e||(t="."),t.length>0&&r&&(t+="/"),e?"/"+t:t}var f=function(){if(0===arguments.length)return".";let t;for(let e=0;e<arguments.length;++e){let r=e<0||arguments.length<=e?void 0:arguments[e];r.length>0&&(void 0===t?t=r:t+="/"+r)}return void 0===t?".":l(t)},d=r(89);let h=null,g=null;const p="/default-db.sqlite",m="/migrations";function y(t){try{return h.readlink(t),!0}catch(t){}try{return h.stat(t),!0}catch(t){}return!1}function b(t){let e=t.split("/").filter(t=>""!==t),r="";for(let t of e)r+="/"+t,y(r)||h.mkdir(r)}function _(t){return t.startsWith("/documents")&&(t.endsWith(".sqlite")?y(t)||h.symlink("/blocked/"+function(t){return t.replace(/^\//,"").replace(/\//g,"-")}(t),t):h.writeFile(t,"!$@) this should never read !$@)")),t}async function v(t,e){if(t.startsWith("/documents")&&!t.endsWith(".sqlite")){if(!y(t))throw new Error("File does not exist: "+t);let{store:r}=u.d(await u.c(),"files"),n=await u.b(r,t);if(null==n)throw new Error("File does not exist: "+t);return"utf8"===e.encoding&&ArrayBuffer.isView(n.contents)?String.fromCharCode.apply(null,new Uint16Array(n.contents.buffer)):n.contents}return h.readFile(w(t),e)}function w(t){try{let{node:e}=h.lookupPath(t,{follow:!1});return e.link?h.readlink(t):t}catch(e){return t}}async function E(t,e){if(e instanceof ArrayBuffer?e=new Uint8Array(e):ArrayBuffer.isView(e)&&(e=new Uint8Array(e.buffer)),_(t),t.startsWith("/documents")){let r=t.endsWith(".sqlite"),{store:n}=u.d(await u.c(),"files");r?(await u.e(n,{filepath:t,contents:""}),await Promise.resolve(),h.writeFile(w(t),e)):await u.e(n,{filepath:t,contents:e})}else h.writeFile(w(t),e)}async function S(){let t=(await(await fetch("/data-file-index.txt")).text()).split("\n").map(t=>t.trim()).filter(t=>""!==t);await I("/migrations"),await I("/demo-budget"),await Promise.all(t.map(async t=>{var e;E("/"+t,await(e="/data/"+t,fetch(e).then(t=>t.arrayBuffer())))}))}const O=async function(){let t=Object(c.a)();h=t.FS,h.mkdir("/uploads"),h.mkdir("/documents"),h.mkdir("/blocked");{let e=new a.a(()=>{s.c("fallback-write-error")});g=new o(h,e),t.register_for_idb(g),h.mount(g,{},"/blocked"),await S()}await async function(){let{store:t}=u.d(await u.c(),"files"),e=t.getAllKeys(),r=await new Promise((t,r)=>{e.onsuccess=e=>t(e.target.result),e.onerror=t=>r(t)});for(let t of r)b(T(t)),_(t)}()},T=function(t){return t.split("/").slice(0,-1).join("/")},A=async function(t){return h.readdir(t).filter(t=>"."!==t&&".."!==t)},M=async function(t){return y(t)},I=async function(t){h.mkdir(t)},R=async function(t,e){return E(e,await v(t))},N=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";return v(t,{encoding:e})},k=async function(t,e){return E(t,e)},D=async function(t){return async function(t){if(t.startsWith("/documents")){let e=t.endsWith(".sqlite"),{store:r}=u.d(await u.c(),"files");if(await u.a(r,t),e){let e=w(t);y(e)&&h.unlink(e)}}h.unlink(t)}(t)},j=async function(t){if(await M(t)){for(let e of await A(t)){let r=f(t,e),n=h.stat(r,!0);h.isDir(n.mode)?await j(r):await D(r)}await async function(t){h.rmdir(t)}(t)}},C=async function(t){throw new Error("getModifiedTime not supported on the web (only used for backups)")}},function(t,e,r){"use strict";r.d(e,"b",(function(){return m})),r.d(e,"e",(function(){return _})),r.d(e,"i",(function(){return v})),r.d(e,"g",(function(){return w})),r.d(e,"f",(function(){return E})),r.d(e,"c",(function(){return S})),r.d(e,"d",(function(){return O})),r.d(e,"h",(function(){return T})),r.d(e,"a",(function(){return A})),r.d(e,"j",(function(){return M}));var n=r(26),i=r(13),o=r(1),a=r(48),s=r(6),u=r(109),c=r(14);var l=function(){let t={addNode:n,removeNode:function(n){return i(n),e.delete(n),r.delete(n),t},adjacent:o,adjacentIncoming:a,addEdge:function(e,r){return n(e),n(r),o(e).add(r),a(r).add(e),t},removeEdge:s,removeIncomingEdges:i,topologicalSort:function(t){const e=new Set,r=[];return t.forEach(t=>{e.has(t)||function t(e,r,n){r.add(e);let i=o(e).values(),a=i.next();for(;!a.done;)r.has(a.value)||t(a.value,r,n),a=i.next();n.unshift(e)}(t,e,r)}),r},generateDOT:function(){let t=[];return e.forEach((function(e,r){0!==e.length&&t.push(`${r} -> {${e.join(",")}}`)})),`\n digraph G {\n ${t.join("\n").replace(/!/g,"_")}\n }\n `},getEdges:function(){return{edges:e,incomingEdges:r}}},e=new Map,r=new Map;function n(n){return e.set(n,o(n)),r.set(n,a(n)),t}function i(t){const e=a(t);r.set(t,new Set);let n=e.values(),i=n.next();for(;!i.done;)s(i.value,t),i=n.next()}function o(t){return e.get(t)||new Set}function a(t){return r.get(t)||new Set}function s(n,i){return e.has(n)&&o(n).delete(i),r.has(i)&&a(i).delete(n),t}return t},f=r(21);class d{constructor(t,e){this.graph=new l,this.nodes=new Map,this.transactionDepth=0,this.saveCache=t,this.setCacheStatus=e,this.dirtyCells=[],this.computeQueue=[],this.events=Object(u.a)(),this._meta={createdMonths:new Set}}meta(){return this._meta}setMeta(t){this._meta=t}_getNode(t){const{sheet:e}=Object(f.b)(t);return this.nodes.has(t)||this.nodes.set(t,{name:t,expr:null,value:null,sheet:e}),this.nodes.get(t)}getNode(t){return this._getNode(t)}hasCell(t){return this.nodes.has(t)}add(t,e,r){this.set(t,e)}getNodes(){return this.nodes}serialize(){return{graph:this.graph.getEdges(),nodes:[...this.nodes.entries()]}}transaction(t){this.startTransaction();try{t()}catch(t){console.log(t)}return this.endTransaction()}startTransaction(){this.transactionDepth++}endTransaction(){if(this.transactionDepth--,0===this.transactionDepth){const t=this.dirtyCells;this.dirtyCells=[],this.queueComputation(this.graph.topologicalSort(t))}return[]}queueComputation(t){this.computeQueue=this.computeQueue.concat(t),Promise.resolve().then(()=>{this.running||this.runComputations()})}runComputations(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;for(this.running=!0;t<this.computeQueue.length;){let e,r,n=this.computeQueue[t];try{if(e=this.getNode(n),e._run){let t=e._dependencies.map(t=>this.getNode(t).value);r=e._run(...t),r instanceof Promise&&console.warn(`dynamic cell ${n} returned a promise! this is discouraged because errors are not handled properly`)}else{if(!e.sql){t++;continue}r=Object(c.f)(e.query,e.sql.sqlPieces,e.sql.state)}}catch(t){return console.log("Error while evaluating "+n+":",t),this.running=!1,void(this.computeQueue=[])}if(r instanceof Promise)return void r.then(r=>{e.value=r,this.runComputations(t+1)},r=>{console.warn(`Failed running ${e.name}!`,r),this.runComputations(t+1)});e.value=r,t++}t===this.computeQueue.length&&(this.events.emit("change",{names:this.computeQueue}),"function"==typeof this.saveCache&&this.saveCache(this.computeQueue),this.markCacheSafe(),this.running=!1,this.computeQueue=[])}markCacheSafe(){this.cacheBarrier||this.setCacheStatus&&this.setCacheStatus({clean:!0})}markCacheDirty(){this.setCacheStatus&&this.setCacheStatus({clean:!1})}startCacheBarrier(){this.cacheBarrier=!0,this.markCacheDirty()}endCacheBarrier(){this.cacheBarrier=!1,this.running||this.computeQueue.length>0||this.markCacheSafe()}addEventListener(t,e){return this.events.on(t,e),()=>this.events.off(t,e)}onFinish(t){if(0!==this.transactionDepth)throw new Error("onFinish called while inside a spreadsheet transaction. This is not allowed as it will lead to race conditions");if(!this.running&&0===this.computeQueue.length)return t([]),()=>{};let e=this.addEventListener("change",(function(){return e(),t(...arguments)}));return e}unload(){this.events.all.clear()}getValue(t){return this.getNode(t).value}getExpr(t){return this.getNode(t).expr}getCellValue(t,e){return this.getNode(Object(f.a)(t,e)).value}getCellExpr(t,e){return this.getNode(Object(f.a)(t,e)).expr}getCellValueLoose(t,e){let r=Object(f.a)(t,e);return this.nodes.has(r)?this.getNode(r).value:null}bootup(t){this.onFinish(()=>{t()})}load(t,e){const r=this._getNode(t);r.expr=e,r.value=e}create(t,e){return this.transaction(()=>{const r=this._getNode(t);r.expr=e,r.value=e,this._markDirty(t)})}set(t,e){this.create(t,e)}recompute(t){this.transaction(()=>{this.dirtyCells.push(t)})}recomputeAll(){this.transaction(()=>{this.dirtyCells=[...this.nodes.keys()]})}createQuery(t,e,r){let n=Object(f.a)(t,e),i=this._getNode(n);if(i.query!==r){i.query=r;let{sqlPieces:t,state:e}=Object(c.a)(i.query,c.h,c.i);i.sql={sqlPieces:t,state:e},this.transaction(()=>{this._markDirty(n)})}}createStatic(t,e,r){let n=Object(f.a)(t,e);this.nodes.has(n)||this.create(n,r)}createDynamic(t,e,r){let{dependencies:n=[],run:i,initialValue:o,refresh:a=!1}=r,s=Object(f.a)(t,e),u=this._getNode(s);u.dynamic||(u.dynamic=!0,u._run=i,n=n.map(e=>{let r;return r=Object(f.b)(e).sheet?e:Object(f.a)(t,e),r}),u._dependencies=n,this.graph.removeIncomingEdges(s),n.forEach(t=>{this.graph.addEdge(t,s)}),(null==u.value||a)&&this.transaction(()=>{u.value=o,this._markDirty(s)}))}clearSheet(t){for(let[e,r]of this.nodes.entries())r.sheet===t&&this.nodes.delete(e)}voidCell(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=this.getNode(Object(f.a)(t,e));n._run=null,n.dynamic=!1,n.value=r}deleteCell(t,e){this.voidCell(t,e),this.nodes.delete(Object(f.a)(t,e))}addDependencies(t,e,r){let n=Object(f.a)(t,e);r=r.map(e=>Object(f.b)(e).sheet?e:Object(f.a)(t,e));let i=this.getNode(n),o=r.filter(t=>-1===(i._dependencies||[]).indexOf(t));o.length>0&&(i._dependencies=(i._dependencies||[]).concat(o),o.forEach(t=>{this.graph.addEdge(t,n)}),this.recompute(n))}removeDependencies(t,e,r){let n=Object(f.a)(t,e);r=r.map(e=>Object(f.b)(e).sheet?e:Object(f.a)(t,e));let i=this.getNode(n);i._dependencies=(i._dependencies||[]).filter(t=>-1===r.indexOf(t)),r.forEach(t=>{this.graph.removeEdge(t,n)}),this.recompute(n)}_markDirty(t){this.dirtyCells.push(t)}triggerDatabaseChanges(t,e){let r=new Set([...t.keys(),...e.keys()]);this.startTransaction(),this.nodes.forEach(t=>{t.sql&&t.sql.state.dependencies.some(t=>r.has(t))&&this._markDirty(t.name)}),this.endTransaction()}}let h,g,p;function m(){return h}async function y(t,e){await i.j(t,()=>{e.forEach(e=>{const r=h._getNode(e);null==r.sql&&i.i(t,"INSERT OR REPLACE INTO kvcache (key, value) VALUES (?, ?)",[e,JSON.stringify(r.value)])})})}function b(t,e,r){let{clean:n}=r;if(n){let r=1e7*Math.random();i.i(e,"INSERT OR REPLACE INTO kvcache_key (id, key) VALUES (1, ?)",[r]),t&&i.i(t,"INSERT OR REPLACE INTO kvcache_key (id, key) VALUES (1, ?)",[r])}else i.i(e,"DELETE FROM kvcache_key")}async function _(t,e){let r,o,s=t.getDatabase();if(a.a){let e=t.getDatabasePath().replace(/db\.sqlite$/,"cache.sqlite");p=r=i.g(e),i.d(r,"\n CREATE TABLE IF NOT EXISTS kvcache (key TEXT PRIMARY KEY, value TEXT);\n CREATE TABLE IF NOT EXISTS kvcache_key (id INTEGER PRIMARY KEY, key REAL)\n ")}else r=s;if(o=new d(y.bind(null,r),b.bind(null,s,r)),Object(n.a)({message:"loading spreaadsheet",category:"server"}),h=o,g=e,e&&o.addEventListener("change",e),function(t,e){let r=i.i(e,"SELECT key FROM kvcache_key WHERE id = 1",[],!0),n=0===r.length?null:r[0].key;if(null==n)return!0;if(t){let e=i.i(t,"SELECT key FROM kvcache_key WHERE id = 1",[],!0);if(0===e.length||e[0].key!==n)return!0}return r=i.i(e,"SELECT * FROM kvcache LIMIT 1",[],!0),0===r.length}(s,r))console.log("Loading fresh spreadsheet"),await E(t);else{let t=await i.i(r,"SELECT * FROM kvcache",[],!0);console.log(`Loaded spreadsheet from cache (${t.length} items)`);for(let e of t){let t=JSON.parse(e.value);o.load(e.key,t)}}return Object(n.a)({message:"loaded spreaadsheet",category:"server"}),o}function v(){h&&(h.unload(),h=null),p&&(i.c(p),p=null)}async function w(t){if(h)return v(),_(t,g)}async function E(t){let e=h,{budgetType:r}=s.b()||{},n="report"===r?"reflect_budgets":"zero_budgets",i=await t.all(`\n SELECT * FROM ${n} b\n LEFT JOIN categories c ON c.id = b.category\n WHERE c.tombstone = 0\n `);e.startTransaction();for(let t of i)if(t.month&&t.category){let r="budget"+t.month;e.set(`${r}!budget-${t.category}`,t.amount),e.set(`${r}!carryover-${t.category}`,1===t.carryover)}if("report"!==r){let r=await t.all("SELECT * FROM zero_budget_months");for(let t of r){let r=Object(o.p)(t.id);e.set(r+"!buffered",t.buffered)}}e.endTransaction()}function S(t,e){return h._getNode(Object(f.a)(t,e))}function O(t,e){return h.getValue(Object(f.a)(t,e))}function T(){h&&h.startTransaction()}function A(){h&&h.endTransaction()}function M(){return new Promise(t=>{h?h.onFinish(t):t(void 0)})}},function(t,e,r){"use strict";r.d(e,"c",(function(){return c})),r.d(e,"b",(function(){return l})),r.d(e,"d",(function(){return h})),r.d(e,"e",(function(){return g})),r.d(e,"f",(function(){return p})),r.d(e,"a",(function(){return m}));var n=r(26),i=r(92);let o=new Set,a=null,s=new WeakMap,u=[];function c(t){return s.set(t,!0),t}function l(t){return s.has(t)}async function f(){for(await d(200);o.size>0;)await Promise.all([...o.values()]),await d(100)}function d(t){return new Promise(e=>setTimeout(e,t))}async function h(t,e){let{undoTag:r,name:n}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(u.push(n),u.length>5&&(u=u.slice(-5)),s.has(t))return g(()=>t(e),{undoTag:r});"close-budget"===n&&await f();let i=t(e);return o.add(i),i.then(()=>{o.delete(i)}),i}const g=Object(i.b)((function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a=e,t().finally(()=>{a=null})}));function p(t,e){if(null==a)return Object(n.a)("Recent methods: "+u.join(", ")),Object(n.b)(new Error("withMutatorContext: mutator not running")),e();let r=a;return a={...a,...t},e().finally(()=>{a=r})}function m(){return null==a?(Object(n.a)({category:"server",message:"Recent methods: "+u.join(", ")}),{}):a}},function(t,e,r){"use strict";function n(t){return t[t.length-1]}function i(t,e){const r=t.id?{id:t.id}:{},n=Object.keys(e);let i=!1;for(let o=0;o<n.length;o++){let a=n[o];t[a]!==e[a]&&(r[a]=e[a],i=!0)}return i?r:null}function o(t,e,r){let n=!1;for(let i=0;i<r.length;i++){let o=r[i];if(t[o]!==e[o]){n=!0;break}}return n}function a(t,e){return e=[...e],t.added&&t.added.forEach(t=>{e.push(t)}),t.updated&&t.updated.forEach(t=>{let{id:r,...n}=t;const i=e.findIndex(t=>t.id===r);e[i]={...e[i],...n}}),t.deleted&&t.deleted.forEach(t=>{const r=e.findIndex(e=>t.id===e.id);-1!==r&&e.splice(r,1)}),e}function s(t,e){let r=new Map;for(let n=0;n<t.length;n++){let i=t[n],o=i[e],a=r.get(o)||[];a.push(i),r.set(o,a)}return r}function u(t,e,r){let n=new Map;for(let i=0;i<t.length;i++){let o=t[i],a=o[e],s=n.get(a)||[];n.set(a,s.concat([r?r(o):t[i]]))}return n}function c(t){let e=new Map;for(let r=0;r<t.length;r++){let n=t[r];e.set(n.id,n)}return e}function l(t,e){let r=c(t),n=c(e),o=[],a=[],s=t.filter(t=>!n.has(t.id)).map(t=>({id:t.id}));return e.forEach(t=>{let e=r.get(t.id);if(e){const r=i(e,t);r&&a.push(r)}else o.push(t)}),{added:o,updated:a,deleted:s}}function f(t){let e={};for(let r=0;r<t.length;r++){let n=t[r];e[n.id]=n}return e}function d(t,e,r){for(let n=0;n<e.length;n++){let i=e[n];n===e.length-1?t.set(i,r):(t.has(i)||t.set(i,new Map),t=t.get(i))}}function h(t,e){let r=t;for(let t=0;t<e.length;t++)if(r=r.get(e[t]),null==r)return r;return r}function g(t,e){let r=new Set(t),n=e.values(),i=n.next();for(;!i.done;)r.add(i.value),i=n.next();return r}r.d(e,"l",(function(){return n})),r.d(e,"f",(function(){return i})),r.d(e,"j",(function(){return o})),r.d(e,"b",(function(){return a})),r.d(e,"n",(function(){return s})),r.d(e,"h",(function(){return u})),r.d(e,"d",(function(){return l})),r.d(e,"i",(function(){return f})),r.d(e,"p",(function(){return d})),r.d(e,"g",(function(){return h})),r.d(e,"e",(function(){return g})),r.d(e,"o",(function(){return m})),r.d(e,"c",(function(){return y})),r.d(e,"q",(function(){return b})),r.d(e,"a",(function(){return _})),r.d(e,"k",(function(){return v})),r.d(e,"m",(function(){return w}));let p={value:null,formatter:null,regex:null};!function(t){let e,r,n,{format:i,hideFraction:o}=t;switch(i){case"space-comma":e="en-ZA",r=/[^-0-9,]/g,n=",";break;case"dot-comma":e="de-DE",r=/[^-0-9,]/g,n=",";break;case"comma-dot":default:e="en-US",r=/[^-0-9.]/g,n="."}p={value:i,separator:n,formatter:new Intl.NumberFormat(e,{minimumFractionDigits:o?0:2,maximumFractionDigits:o?0:2}),regex:r}}({format:"comma-dot",hideFraction:!1});function m(t){if(!Number.isInteger(t))throw new Error("safeNumber: number is not an integer: "+JSON.stringify(t));if(t>2**51-1||t<-(2**51-1))throw new Error("safeNumber: can’t safely perform arithmetic with number: "+t);return t}function y(t){let e=parseFloat(t.replace(p.regex,"").replace(p.separator,"."));return isNaN(e)?null:e}function b(t){let e=parseInt(t.replace(/[^-0-9.,]/g,""));return isNaN(e)?null:e}function _(t){return Math.round(100*t)}function v(t){return parseFloat((m(t)/100).toFixed(2))}function w(t){function e(t){return isNaN(t)?null:t}function r(t){return t.replace(/[^0-9-]/g,"")}t.startsWith("(")&&t.endsWith(")")&&(t=t.replace("(","-").replace(")",""));let n=t.match(/[.,][^.,]*$/);if(!n||0===n.index)return e(parseFloat(r(t)));let i=r(t.slice(0,n.index)),o=r(t.slice(n.index+1));return e(parseFloat(i+"."+o))}},function(t,e,r){"use strict";r.d(e,"c",(function(){return s})),r.d(e,"d",(function(){return u})),r.d(e,"e",(function(){return c})),r.d(e,"b",(function(){return l})),r.d(e,"a",(function(){return f}));var n=r(2),i=r(10),o=r(7);let a=null;async function s(t){const e=n.j(n.e(t),"metadata.json");try{a=JSON.parse(await n.n(e))}catch(e){a={id:t,budgetName:t}}return a.id=t,a}async function u(t){let{avoidSync:e=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Object.assign(a,t),!e){let e=Object.keys(t).map(e=>"budgetType"===e||"budgetName"===e?{dataset:"prefs",row:e,column:"value",value:t[e],timestamp:i.a.send()}:null).filter(t=>t);e.length>0&&await Object(o.j)(e)}if(!a.dummyTestPrefs){let t=n.j(n.e(a.id),"metadata.json");await n.q(t,JSON.stringify(a))}}function c(){a=null}function l(){return a}function f(t,e){return{id:t,budgetName:e,"notifications.schedules":!0,"notifications.repair-splits":!0}}},function(t,e,r){"use strict";r.d(e,"g",(function(){return A})),r.d(e,"i",(function(){return I})),r.d(e,"h",(function(){return E})),r.d(e,"k",(function(){return N})),r.d(e,"a",(function(){return B})),r.d(e,"b",(function(){return U})),r.d(e,"c",(function(){return H})),r.d(e,"j",(function(){return q})),r.d(e,"l",(function(){return G})),r.d(e,"d",(function(){return Y})),r.d(e,"f",(function(){return Z})),r.d(e,"e",(function(){return J}));var n=r(26),i=r(9),o=r(23),a=r(56),s=r(92),u=r(5),c=r(52),l=r(10),f=r(0),d=r(11),h=r(31),g=r(4),p=r(27),m=r(6),y=r(15),b=r(3),_=r(18),v=r(140);function w(){let t=f.runQuery("SELECT timestamp FROM messages_crdt",[],!0),e={};for(let r=0;r<t.length;r++)e=l.f.insert(e,l.a.parse(t[r].timestamp));return{numMessages:t.length,trie:e}}async function E(){let t=w(),e=Object(l.c)();e.merkle=t.trie,f.runQuery(f.cache("INSERT OR REPLACE INTO messages_clock (id, clock) VALUES (1, ?)"),[Object(l.g)(e)])}var S=r(35),O=r(45);async function T(){return(await S.f(12)).toString()}async function A(t){let e=new O.Message;e.setDataset(await T()),e.setRow(await T()),e.setColumn(await T()),e.setValue(await T());let r=e.serializeBinary();return await S.c(r,t)}var M=r(38);async function I(t){if(!t){let{valid:t,error:e}=await M.a();if(e)return{error:e};if(!t)return{error:{reason:"file-has-new-key"}}}let{error:e}=await M.h(t);if(e)return{error:e};if(await Object(g.e)(async()=>{await f.execQuery("\n DELETE FROM messages_crdt;\n DELETE FROM messages_clock;\n DELETE FROM transactions WHERE tombstone = 1;\n DELETE FROM accounts WHERE tombstone = 1;\n DELETE FROM payees WHERE tombstone = 1;\n DELETE FROM categories WHERE tombstone = 1;\n DELETE FROM category_groups WHERE tombstone = 1;\n DELETE FROM schedules WHERE tombstone = 1;\n DELETE FROM rules WHERE tombstone = 1;\n ANALYZE;\n VACUUM;\n "),await f.loadClock()}),await m.d({groupId:null,lastSyncedTimestamp:null,lastUploaded:null}),t){let{key:e}=t,{cloudFileId:r}=m.b(),n=JSON.parse(await i.a("encrypt-keys")||"{}");n[r]=e.serialize(),await i.e("encrypt-keys",JSON.stringify(n)),await m.d({encryptKeyId:e.getId()})}try{await M.i()}catch(t){return t.reason?{error:t}:(Object(n.b)(t),{error:{reason:"upload-failure"}})}finally{o.c("prefs-updated")}return{}}let R="enabled";function N(t){let e=R;switch(t){case"enabled":R="enabled";break;case"offline":R="offline";break;case"disabled":R="disabled";break;case"import":R="import";break;default:throw new Error("setSyncingMode: invalid mode: "+t)}return e}function k(t){switch(t){case"enabled":return"enabled"===R||"offline"===R;case"disabled":return"disabled"===R||"import"===R;case"offline":return"offline"===R;case"import":return"import"===R;default:throw new Error("checkSyncingMode: invalid mode: "+t)}}function D(t,e){let{dataset:r,row:n,column:i,value:o}=t;if("prefs"===r);else{let t;try{t=e?{sql:f.cache(`UPDATE ${r} SET ${i} = ? WHERE id = ?`),params:[o,n]}:{sql:f.cache(`INSERT INTO ${r} (id, ${i}) VALUES (?, ?)`),params:[n,o]},f.runQuery(t.sql,t.params)}catch(e){throw new d.g("invalid-schema",{error:{message:e.message,stack:e.stack},query:t})}}}async function j(t,e){let r=[];for(let n=0;n<e.length;n+=100){let i,o=e.slice(n,n+100),a=t+".id";"transactions"===t?(i="\n SELECT t.*, c.transferId AS category\n FROM transactions t\n LEFT JOIN category_mapping c ON c.id = t.category\n ",a="t.id"):i="SELECT * FROM "+t,i+=" WHERE ",i+=o.map(t=>a+" = ?").join(" OR ");try{let t=await f.runQuery(i,o,!0);r=r.concat(t)}catch(t){throw new d.g("invalid-schema",{error:{message:t.message,stack:t.stack},sql:i,params:o})}}return r}function C(t){if(null===t)return"0:";if("number"==typeof t)return"N:"+t;if("string"==typeof t)return"S:"+t;throw new Error("Unserializable value type: "+JSON.stringify(t))}function L(t){switch(t[0]){case"0":return null;case"N":return parseFloat(t.slice(2));case"S":return t.slice(2)}throw new Error("Invalid type key for value: "+t)}let x=[];function B(t){return x.push(t),()=>{x=x.filter(e=>e!==t)}}const U=Object(s.b)(async t=>{if(k("import"))return void function(t){f.transaction(()=>{for(let e=0;e<t.length;e++){let r=t[e],{dataset:n}=r;if(!r.old){try{D(r)}catch(t){D(r,!0)}if("prefs"===n)throw new Error("Cannot set prefs while importing")}}})}(t);k("enabled")&&(t=await async function(t){let e=[];for(let r=0;r<t.length;r++){let n=t[r],{dataset:i,row:o,column:a,timestamp:s}=n,u=s.toString(),c=f.runQuery(f.cache("SELECT timestamp FROM messages_crdt WHERE dataset = ? AND row = ? AND column = ? AND timestamp >= ?"),[i,o,a,u],!0);0===c.length?e.push(n):c[0].timestamp!==u&&e.push({...n,old:!0})}return e}(t)),t=[...t].sort((t,e)=>{let r=t.timestamp?t.timestamp.toString():"",n=e.timestamp?e.timestamp.toString():"";return r<n?-1:r>n?1:0});let e={};async function r(){let t=new Map;for(let r of Object.keys(e)){const n=await j(r,e[r]);for(let e=0;e<n.length;e++){let i=n[e];Object(u.p)(t,[r,i.id],i)}}return t}t.forEach(t=>{"prefs"!==t.dataset&&(null==e[t.dataset]&&(e[t.dataset]=[]),e[t.dataset].push(t.row))});let n,i,a={},s=await r();_.a(t,s),k("enabled")&&(n=Object(l.c)(),i=n.merkle),b.b()&&b.b().startCacheBarrier(),f.transaction(()=>{let e=new Set;for(let r=0;r<t.length;r++){let n=t[r],{dataset:o,row:c,column:d,timestamp:h,value:g}=n;n.old||(D(n,Object(u.g)(s,[o,c])||e.has(o+c)),"prefs"===o?a[c]=g:e.add(o+c)),k("enabled")&&(f.runQuery(f.cache("INSERT INTO messages_crdt (timestamp, dataset, row, column, value)\n VALUES (?, ?, ?, ?, ?)"),[h.toString(),o,c,d,C(g)]),i=l.f.insert(i,n.timestamp))}k("enabled")&&(i=l.f.prune(i),f.runQuery(f.cache("INSERT OR REPLACE INTO messages_clock (id, clock) VALUES (1, ?)"),[Object(l.g)({...n,merkle:i})]))}),k("enabled")&&(n.merkle=i),Object.keys(a).length>0&&(m.d(a,{avoidSync:!0}),a.budgetType&&Object(c.c)(a.budgetType),o.c("prefs-updated"));let d=await r();b.b()&&(b.h(),Object(c.d)(s,d),b.b().triggerDatabaseChanges(s,d),b.a(),b.b().endCacheBarrier()),x.forEach(t=>t(s,d));let g=K(t.filter(t=>!t.old));return h.a.events.emit("sync",{type:"applied",tables:g,data:d,prevData:s}),t});function F(t){return t.forEach(t=>{l.a.recv(t.timestamp)}),Object(g.e)(()=>U(t))}async function P(t){try{await U(t)}catch(t){throw t instanceof d.g&&("invalid-schema"===t.reason?h.a.events.emit("sync",{type:"error",subtype:"apply-failure",meta:t.meta}):h.a.events.emit("sync",{type:"error",meta:t.meta})),t}await(Y(),void(k("enabled")&&!k("offline")&&($=setTimeout(J,1e3))))}let W=!1,z=[];async function H(t){if(W)return void await t();W=!0;let e=[];try{await t()}finally{W=!1,e=z,z=[]}e.length>0&&await P(e)}async function q(t){if(!W)return P(t);z=z.concat(t)}function V(t){return f.runQuery("SELECT timestamp, dataset, row, column, value FROM messages_crdt WHERE timestamp > ?",[t],!0)}async function G(t,e){let r=await V(e);return await F(t.map(t=>({...t,value:L(t.value),timestamp:l.a.parse(t.timestamp)}))),r}function Y(){$&&(clearTimeout($),$=null)}let $=null;function K(t){return t.reduce((t,e)=>{let r="schedules_next_date"===e.dataset?"schedules":e.dataset;return t.includes(r)||t.push(r),t},[])}async function Z(){(await J()).error||await b.j()}const J=Object(s.a)((async function(){let t;h.a.events.emit("sync",{type:"start"});try{t=await async function t(e,r,n){let{cloudFileId:o,groupId:s,lastSyncedTimestamp:u}=m.b()||{};if(Y(),k("disabled")||k("offline"))return[];let c=Object(l.c)().timestamp.toString(),h=e||u||new l.a(Date.now()-3e5,0,"0").toString(),g=V(h),b=await i.a("user-token");a.a.info("Syncing since",h,g.length,"(attempt: "+r+")");let _=await v.b(s,o,h,g),E=await Object(p.c)(Object(y.a)().SYNC_SERVER+"/sync",_,{"X-ACTUAL-TOKEN":b});if(!m.b()||m.b().groupId!==s)return[];let S=await v.a(E);a.a.info("Got messages from server",S.messages.length);let O=Object(l.c)().timestamp.toString()!==c,T=[];S.messages.length>0&&(T=await F(S.messages.map(t=>({...t,value:L(t.value),timestamp:l.a.parse(t.timestamp)}))));let A=l.f.diff(S.merkle,Object(l.c)().merkle);if(null!==A){if(r>=10&&A===n||r>=100){a.a.info("SENT -------"),a.a.info(JSON.stringify(g)),a.a.info("RECEIVED -------"),a.a.info(JSON.stringify(S.messages));let t=w();if(console.log(r,"messages:",g.length,g.length>0?g[0]:null,"res.messages:",S.messages.length,S.messages.length>0?S.messages[0]:null,"clientId",Object(l.c)().timestamp.node(),"groupId",s,"diffTime:",A,A===n,"local clock:",Object(l.c)().timestamp.toString(),Object(l.c)().merkle.hash,"rebuilt hash:",t.numMessages,t.trie.hash,"server hash:",S.merkle.hash,"localTimeChanged:",O),t.trie.hash===S.merkle.hash){let t=await f.all("SELECT * FROM messages_clock");1!==t.length&&console.log("Bad number of clocks:",t.length);let e=Object(l.b)(t[0]).merkle.hash;console.log("Merkle hash in db:",e)}throw new d.g("out-of-sync")}T=T.concat(await t(new l.a(A,0,"0").toString(),O?0:r+1,A))}else await m.d({lastSyncedTimestamp:Object(l.c)().timestamp.toString()});return T}(null,0,null)}catch(t){return console.log(t),t instanceof d.g?"out-of-sync"===t.reason?(Object(n.b)(t),h.a.events.emit("sync",{type:"error",subtype:"out-of-sync"})):"invalid-schema"===t.reason?h.a.events.emit("sync",{type:"error",subtype:"invalid-schema"}):"decrypt-failure"===t.reason||"encrypt-failure"===t.reason?h.a.events.emit("sync",{type:"error",subtype:t.reason,meta:t.meta}):"beta-version"===t.reason?h.a.events.emit("sync",{type:"error",subtype:t.reason}):h.a.events.emit("sync",{type:"error"}):t instanceof d.e?(console.log(t),"unauthorized"===t.reason?(h.a.events.emit("sync",{type:"unauthorized"}),i.e("readOnly","true")):"network-failure"===t.reason?h.a.events.emit("sync",{type:"error",subtype:"network"}):h.a.events.emit("sync",{type:"error",subtype:t.reason})):(Object(n.b)(t),h.a.events.emit("sync",{type:"error"})),{error:{message:t.message,reason:t.reason,meta:t.meta}}}let e=K(t);return h.a.events.emit("sync",{type:"success",tables:e,syncDisabled:k("disabled")}),{messages:t}}))},function(t,e,r){"use strict";function n(t,e){if(e.length<t)throw new TypeError(t+" argument"+(t>1?"s":"")+" required, but only "+e.length+" present")}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";r.d(e,"b",(function(){return i})),r.d(e,"a",(function(){return a})),r.d(e,"e",(function(){return s})),r.d(e,"c",(function(){return u})),r.d(e,"d",(function(){return c}));var n=r(36);const i=function(){};function o(t){t.commit&&t.commit()}const a=async function(t){let e=(await Object(n.c)()).transaction(["asyncStorage"],"readonly"),r=e.objectStore("asyncStorage");return new Promise((n,i)=>{let a=r.get(t);a.onerror=t=>i(t),a.onsuccess=t=>n(t.target.result),o(e)})},s=async function(t,e){let r=(await Object(n.c)()).transaction(["asyncStorage"],"readwrite"),i=r.objectStore("asyncStorage");new Promise((n,a)=>{let s=i.put(e,t);s.onerror=t=>a(t),s.onsuccess=t=>n(void 0),o(r)})},u=async function(t){let e=(await Object(n.c)()).transaction(["asyncStorage"],"readonly"),r=e.objectStore("asyncStorage"),i=Promise.all(t.map(t=>new Promise((e,n)=>{let i=r.get(t);i.onerror=t=>n(t),i.onsuccess=r=>e([t,r.target.result])})));return o(e),i},c=async function(t){let e=(await Object(n.c)()).transaction(["asyncStorage"],"readwrite"),r=e.objectStore("asyncStorage"),i=Promise.all(t.map(t=>new Promise((e,n)=>{let i=r.delete(t);i.onerror=t=>n(t),i.onsuccess=t=>e(void 0)})));return o(e),i}},function(t,e,r){"use strict";r.d(e,"f",(function(){return n})),r.d(e,"c",(function(){return m})),r.d(e,"h",(function(){return p})),r.d(e,"e",(function(){return y})),r.d(e,"d",(function(){return v})),r.d(e,"g",(function(){return b})),r.d(e,"b",(function(){return _})),r.d(e,"a",(function(){return S}));var n={};function i(t){return Object.keys(t).filter(t=>"hash"!==t)}function o(t){let e=t+"0".repeat(16-t.length);return 1e3*parseInt(e,3)*60}function a(t,e){let r=e.hash(),n=Number(Math.floor(e.millis()/1e3/60)).toString(3);return function t(e,r,n){if(0===r.length)return e;const i=r[0],o=e[i]||{};return Object.assign({},e,{[i]:Object.assign({},o,t(o,r.slice(1),n),{hash:o.hash^n})})}(t=Object.assign({},t,{hash:t.hash^r}),n,r)}function s(t){let e={};for(let r of t)a(e,r);return e}function u(t,e){if(t.hash===e.hash)return null;let r=t,n=e,a="";for(;;){let t=[...new Set([...i(r),...i(n)]).values()];t.sort();let e=null;for(let i=0;i<t.length;i++){let o=t[i];if(!r[o]||!n[o])break;let a=r[o],s=n[o];if(a.hash!==s.hash){e=o;break}}if(!e)return o(a);a+=e,r=r[e]||{},n=n[e]||{}}}function c(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;if(!t.hash)return t;let r=i(t);r.sort();let n={hash:t.hash};return r=r.slice(-e).map(r=>n[r]=c(t[r],e)),n}function l(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=" ".repeat(r)+(""!==e?`k: ${e} `:"")+`hash: ${t.hash||"(empty)"}\n`;return n+i(t).map(e=>l(t[e],e,r+2)).join("")}r.r(n),r.d(n,"getKeys",(function(){return i})),r.d(n,"keyToTimestamp",(function(){return o})),r.d(n,"insert",(function(){return a})),r.d(n,"build",(function(){return s})),r.d(n,"diff",(function(){return u})),r.d(n,"prune",(function(){return c})),r.d(n,"debug",(function(){return l}));var f=r(236),d=r.n(f),h=r(22);let g=null;function p(t){g=t}function m(){return g}function y(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{timestamp:O.from(t),merkle:e}}function b(t){return JSON.stringify({timestamp:t.timestamp.toString(),merkle:t.merkle})}function _(t){let e;try{e=JSON.parse(t)}catch(t){e={timestamp:"1970-01-01T00:00:00.000Z-0000-"+v(),merkle:{}}}return{timestamp:O.from(S.parse(e.timestamp)),merkle:e.merkle}}function v(){return h.a().replace(/-/g,"").slice(-16)}let w={maxDrift:3e5};const E=parseInt("0xFFFF");class S{constructor(t,e,r){this._state={millis:t,counter:e,node:r}}valueOf(){return this.toString()}toString(){return[new Date(this.millis()).toISOString(),("0000"+this.counter().toString(16).toUpperCase()).slice(-4),("0000000000000000"+this.node()).slice(-16)].join("-")}millis(){return this._state.millis}counter(){return this._state.counter}node(){return this._state.node}hash(){return d.a.v3(this.toString())}}class O extends S{setMillis(t){this._state.millis=t}setCounter(t){this._state.counter=t}setNode(t){this._state.node=t}}O.from=t=>new O(t.millis(),t.counter(),t.node()),S.init=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.maxDrift&&(w.maxDrift=t.maxDrift),p(y(new S(0,0,t.node?("0000000000000000"+t.node).toString().slice(-16):"")))},S.send=function(){if(!g)return null;let t=Date.now(),e=g.timestamp.millis(),r=g.timestamp.counter(),n=Math.max(e,t),i=e===n?r+1:0;if(n-t>w.maxDrift)throw new S.ClockDriftError(n,t,w.maxDrift);if(i>E)throw new S.OverflowError;return g.timestamp.setMillis(n),g.timestamp.setCounter(i),new S(g.timestamp.millis(),g.timestamp.counter(),g.timestamp.node())},S.recv=function(t){if(!g)return null;let e=Date.now(),r=t.millis(),n=t.counter();if(r-e>w.maxDrift)throw new S.ClockDriftError;let i=g.timestamp.millis(),o=g.timestamp.counter(),a=Math.max(Math.max(i,e),r),s=a===i&&a===r?Math.max(o,n)+1:a===i?o+1:a===r?n+1:0;if(a-e>w.maxDrift)throw new S.ClockDriftError;if(s>E)throw new S.OverflowError;return g.timestamp.setMillis(a),g.timestamp.setCounter(s),new S(g.timestamp.millis(),g.timestamp.counter(),g.timestamp.node())},S.parse=function(t){if("string"==typeof t){let e=t.split("-");if(e&&5===e.length){let t=Date.parse(e.slice(0,3).join("-")).valueOf(),r=parseInt(e[3],16),n=e[4];if(!isNaN(t)&&t>=0&&!isNaN(r)&&r<=E&&"string"==typeof n&&n.length<=16)return new S(t,r,n)}}return null};let T=S.parse("1970-01-01T00:00:00.000Z-0000-0000000000000000");S.zero=function(){return T};let A=S.parse("9999-12-31T23:59:59.999Z-FFFF-FFFFFFFFFFFFFFFF");S.max=function(){return A},S.since=t=>t+"-0000-0000000000000000",S.DuplicateNodeError=class extends Error{constructor(t){super("duplicate node identifier "+t),this.name="DuplicateNodeError"}},S.ClockDriftError=class extends Error{constructor(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];super(["maximum clock drift exceeded"].concat(e).join(" ")),this.name="ClockDriftError"}},S.OverflowError=class extends Error{constructor(){super("timestamp counter overflow"),this.name="OverflowError"}}},function(t,e,r){"use strict";r.d(e,"e",(function(){return n})),r.d(e,"d",(function(){return i})),r.d(e,"g",(function(){return o})),r.d(e,"h",(function(){return a})),r.d(e,"f",(function(){return s})),r.d(e,"a",(function(){return u})),r.d(e,"b",(function(){return c})),r.d(e,"c",(function(){return l}));class n extends Error{constructor(t,e){super("PostError: "+t),this.type="PostError",this.reason=t,this.meta=e}}class i extends Error{constructor(t,e){super(`HTTPError: unsuccessful status code (${t}): ${e}`),this.statusCode=t,this.responseBody=e}}class o extends Error{constructor(t,e){super("SyncError: "+t),this.reason=t,this.meta=e}}class a extends Error{}class s extends Error{constructor(t,e){super("RuleError: "+e),this.type=t}}function u(t,e){return{type:"APIError",message:t,meta:e}}function c(t,e){return{type:"FileDownloadError",reason:t,meta:e}}function l(t,e){return{type:"FileUploadError",reason:t,meta:e}}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},function(t,e,r){"use strict";r.d(e,"f",(function(){return a})),r.d(e,"a",(function(){return s})),r.d(e,"h",(function(){return c})),r.d(e,"i",(function(){return l})),r.d(e,"d",(function(){return f})),r.d(e,"j",(function(){return h})),r.d(e,"b",(function(){return g})),r.d(e,"g",(function(){return p})),r.d(e,"c",(function(){return m})),r.d(e,"e",(function(){return y}));var n=r(235),i=r.n(n);let o=null;async function a(){return new Promise((t,e)=>{i()({locateFile:t=>"/"+t}).then(e=>{o=e,t(void 0)},t=>{e(t)})})}function s(){if(null==o)throw new Error("_getModule: sql.js must be initialized first");return o}function u(t,e){e.forEach(e=>{if("string"!=typeof e&&"number"!=typeof e&&null!==e)throw new Error("Invalid field type "+e+" for sql "+t)})}function c(t,e){return t.prepare(e)}function l(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];r&&u(e,r);let i="string"==typeof e?t.prepare(e):e;if(n)try{i.bind(r);let t=[];for(;i.step();)t.push(i.getAsObject());return"string"==typeof e?i.free():i.reset(),t}catch(t){throw console.log(e),t}else try{return i.run(r),{changes:t.getRowsModified()}}catch(t){throw t}}function f(t,e){t.exec(e)}let d=0;function h(t,e){let r,n,i;d>0?(r="SAVEPOINT __actual_sp",n="RELEASE __actual_sp",i="ROLLBACK TO __actual_sp"):(r="BEGIN",n="COMMIT",i="ROLLBACK"),f(t,r),d++;try{const r=e();return f(t,n),r}catch(e){throw f(t,i),"ROLLBACK"!==i&&f(t,n),e}finally{d--}}async function g(t,e){0===d&&t.exec("BEGIN TRANSACTION"),d++;try{await e()}finally{d--,0===d&&t.exec("COMMIT")}}async function p(t){let e=null;if(t)if("string"!=typeof t)e=new o.Database(t);else{let r=t;if(":memory:"!==r){if("undefined"==typeof SharedArrayBuffer){let t=o.FS.open(o.FS.readlink(r),"a+");await t.node.contents.readIfFallback(),o.FS.close(t)}e=new o.Database(r.includes("/blocked")?r:o.FS.readlink(r),{filename:!0}),e.exec("\n PRAGMA journal_mode=MEMORY;\n PRAGMA cache_size=-10000;\n ")}}return null===e&&(e=new o.Database),e.create_function("UNICODE_LOWER",t=>null==t?void 0:t.toLowerCase()),e.create_function("UNICODE_UPPER",t=>null==t?void 0:t.toUpperCase()),e}function m(t){t.close()}function y(t){return t.export()}},function(t,e,r){"use strict";r.d(e,"b",(function(){return c})),r.d(e,"c",(function(){return l})),r.d(e,"d",(function(){return f})),r.d(e,"a",(function(){return Y})),r.d(e,"e",(function(){return Z})),r.d(e,"h",(function(){return X})),r.d(e,"i",(function(){return Q})),r.d(e,"g",(function(){return ut})),r.d(e,"f",(function(){return st}));var n=r(1),i=r(20);function o(t,e){return e.required||"id"===t}function a(t,e){if(void 0===t)throw new Error("Query value cannot be undefined");if(null===t)return"boolean"===e?0:null;switch(e){case"date":if(t instanceof Date)return Object(i.g)(Object(n.f)(t));if(null==t.match(/^\d{4}-\d{2}-\d{2}$/)||t.date<"2000-01-01")throw new Error("Invalid date: "+t);return Object(i.g)(t);case"date-month":return Object(i.g)(t.slice(0,7));case"date-year":return Object(i.g)(t.slice(0,4));case"boolean":return t?1:0;case"id":if("string"!=typeof t&&null!==t)throw new Error("Invalid id, must be string: "+t);return t;case"integer":if("number"==typeof t&&Number.isInteger(t))return t;throw new Error("Can’t convert to integer: "+JSON.stringify(t));case"json":return JSON.stringify(t)}return t}function s(t,e){if(null===t)return"boolean"!==e&&null;switch(e){case"date":return Object(i.d)(t);case"date-month":return Object(i.d)(t).slice(0,7);case"date-year":return Object(i.d)(t).slice(0,4);case"boolean":return 1===t;case"json":case"json/fallback":try{return JSON.parse(t)}catch(r){return"json/fallback"===e?t:null}}return t}function u(t,e,r,n){let{skipNull:i=!1}=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},s=t[r];if(null==s)throw new Error(`Table “${r}” does not exist`);let u=e.views||{},c=t=>u[r]&&u[r].fields&&u[r].fields[t]||t;return Object.fromEntries(Object.keys(n).map(t=>{if("_"===t[0])return null;let e=s[t];if(null==e)throw new Error(`Field “${t}” does not exist on table ${r}: ${JSON.stringify(n)}`);if(o(t,e)&&null==n[t])throw new Error(`“${t}” is required for table “${r}”: ${JSON.stringify(n)}`);return i&&null==n[t]?null:[c(t),a(n[t],e.type)]}).filter(Boolean))}function c(t,e,r,n){let i={...n},a=t[r];if(null==a)throw new Error(`Error inserting: table “${r}” does not exist`);return Object.keys(a).forEach(t=>{let e=a[t];if(null==i[t])if(void 0!==e.default)i[t]="function"==typeof e.default?e.default():e.default;else if(o(t,e))throw new Error(`“${t}” is required for table “${r}”: ${JSON.stringify(i)}`)}),u(t,e,r,i,{skipNull:!0})}function l(t,e,r,n){let i={...n};if(null==t[r])throw new Error(`Error updating: table “${r}” does not exist`);return u(t,e,r,i)}function f(t,e,r,n){let i=t[r];if(null==i)throw new Error(`Table “${r}” does not exist`);let o=Object.keys(i),a={};for(let t=0;t<o.length;t++){let e=o[t],r=i[e];a[e]=s(n[e],r.type)}return a}let d=0;function h(){d=0}function g(t){return d++,t+d}class p extends Error{}function m(t){return parseInt(t.replace(/-/g,""))}function y(t,e,r,n){return null!=t[e].tombstone?`${n} AND ${r}.tombstone = 0`:n}function b(t){let e=t.split(".");return{path:e.slice(0,-1).join("."),field:e[e.length-1]}}function _(t){return-1===t.indexOf(".")&&"group"!==t?t:`"${t}"`}function v(t,e){let{literal:r=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return{value:t,type:e,literal:r}}function w(t,e){let{schema:r,paths:n}=t,i=e.split(".");if(i.length<2)throw new p("Invalid path: "+e);let o,a=i[0],s=i.slice(1).reduce((t,e)=>{let n=r[t];if(null==n)throw new p(`Path error: ${t} table does not exist`);if(!n[e]||null==n[e].ref)throw new p(`Field not joinable on table ${t}: “${e}”`);return n[e].ref},a),u=i.slice(0,-1);if(1===u.length)o=u[0];else{let t=u.join("."),e=n.get(t);if(!e)throw new p("Path does not exist: "+t);o=e.tableId}return{tableName:s,tableId:g(s),joinField:i[i.length-1],joinTable:o}}function E(t,e){let r=e.split(".");return r=r.reduce((t,e)=>{let r=t.context+"."+e;return{context:r,path:[...t.path,r]}},{context:t.implicitTableName,path:[]}).path,r.forEach(e=>{t.paths.get(e)||t.paths.set(e,w(t,e))}),t.paths.get(r[r.length-1])}function S(t,e){if("string"!=typeof e)throw new p("Invalid field name, must be a string");let r,{path:n,field:i}=b(e);r=""===n?{tableName:t.implicitTableName,tableId:t.implicitTableId}:E(t,n);let o=function(t,e,r){if(null==t[e])throw new p(`Table “${e}” does not exist in the schema`);let n=t[e][r];if(null==n)throw new p(`Field “${r}” does not exist in table “${e}”`);return n}(t.schema,r.tableName,i);if(t.validateRefs&&o.ref&&"id"===o.type&&"id"!==i){let n=t.implicitTableName+"."+e,o=t.paths.get(n);o||(o=w(t,n),o.noMapping=!0,t.paths.set(n,o)),i="id",r=o}return v(r.tableId+"."+i,o.type)}function O(t){let e=t.match(/^(\d{4}-\d{2}-\d{2})$/);return e?v(m(e[1]),"date",{literal:!0}):null}function T(t){let e=t.match(/^(\d{4}-\d{2})$/);return e?v(m(e[1]),"date",{literal:!0}):null}function A(t,e){throw new p(`Bad ${e} format: ${t}`)}function M(t,e,r){if(e.type===r)return e;if("param"===e.type)return function(t,e){let r=t.paramType;if(r){let n={date:["string"],"date-month":["date"],"date-year":["date","date-month"],id:["string"],float:["integer"]};if(!(r===e||n[e]&&n[e].includes(r)))throw new Error(`Parameter “${t.paramName}” can’t convert to ${e} (already inferred as ${r})`)}else t.paramType=e}(e,r),v(e.value,r);if("null"===e.type){if(!e.literal)throw new p("A non-literal null doesn’t make sense");return"boolean"===r?v(0,"boolean",{literal:!0}):e}if("date"===r){if("string"===e.type){if(e.literal)return O(e.value)||A(e.value,"date");throw new p("Casting string fields to dates is not supported")}throw new p(`Can’t cast ${e.type} to date`)}if("date-month"===r){let t;if("date"===e.type)t=e;else{if("string"!==e.type&&"any"!==e.type)throw new p(`Can’t cast ${e.type} to date-month`);t=T(e.value)||O(e.value)||A(e.value,"date-month")}return t.literal?v(m(t.value.toString().slice(0,6)),"date-month",{literal:!0}):v(`CAST(SUBSTR(${t.value}, 1, 6) AS integer)`,"date-month")}if("date-year"===r){let t;if("date"===e.type||"date-month"===e.type)t=e;else{if("string"!==e.type)throw new p(`Can’t cast ${e.type} to date-year`);t=function(t){let e=t.match(/^(\d{4})$/);return e?v(m(e[1]),"date",{literal:!0}):null}(e.value)||T(e.value)||O(e.value)||A(e.value,"date-year")}return t.literal?v(m(t.value.toString().slice(0,4)),"date-year",{literal:!0}):v(`CAST(SUBSTR(${t.value}, 1, 4) AS integer)`,"date-year")}if("id"===r){if("string"===e.type)return v(e.value,"id",{literal:e.literal})}else if("float"===r&&"integer"===e.type)return v(e.value,"float",{literal:e.literal});if("any"===e.type)return v(e.value,r,{literal:e.literal});throw new p(`Can’t convert ${e.type} to ${r}`)}function I(t,e,r){let n=e;if(r&&(n=M(0,e,r)),n.literal){if("id"===n.type)return`'${n.value}'`;if("string"===n.type){return`'${n.value.replace(/'/g,"''")}'`}}return n.value}function R(t,e,r){return e.map((t,e)=>I(0,t,r?r[e]:null))}function N(t,e,r){if(null==r&&(r=e),null!=e&&t.length<e)throw new p("Too few arguments");if(null!=r&&t.length>r)throw new p("Too many arguments")}function k(t,e){return function(r){if(null==r||null==r.compileStack)throw new p("This function cannot track error data. It needs to accept the compiler state as the first argument.");for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];r.compileStack.push({type:t,args:i});let a=e(r,...i);return r.compileStack.pop(),a}}function D(t){if("string"==typeof t)return t;if(void 0===t)return"undefined";let e=JSON.stringify(t);if(e.length>70){return JSON.stringify(t,null,2).split("\n").join("\n ")}return e}function j(t,e){if(0===e.length)return t;let r=e.slice(1).reverse().map(t=>{switch(t.type){case"expr":case"function":return D(t.args[0]);case"op":{let[e,r]=t.args;return D({[e]:r})}case"value":return D(t.value);default:return""}}).map(t=>"\n "+t).join("");const n=e[0].type,i=e[0].args[0];r+=`\n ${n}(${D(1===i.length?i[0]:i)})`;{const e=new p;return e.message=t.message+"\n\nExpression stack:"+r,e.stack=null,e}}function C(t){if(void 0===t)throw new p("`undefined` is not a valid query value");if(null===t)return v("NULL","null",{literal:!0});if(t instanceof Date)return v(function(t){let e=t=>(t<10?"0":"")+t;return t.getFullYear()+e(t.getMonth()+1)+e(t.getDate())}(t),"date",{literal:!0});if("string"==typeof t)return v(t=t.replace(/\\\$/g,"$"),"string",{literal:!0});if("boolean"==typeof t)return v(t?1:0,"boolean",{literal:!0});if("number"==typeof t)return v(t,Number.isInteger(t)?"integer":"float",{literal:!0});if(Array.isArray(t))return v(t,"array",{literal:!0});throw new p("Unsupported type of expression: "+JSON.stringify(t))}const L=k("expr",(t,e)=>{if("string"==typeof e){if("$"===e[0]){let r="$"===e?t.implicitField:e.slice(1);if(null==r||""===r)throw new p("Invalid field reference: "+e);return S(t,r)}if(":"===e[0]){let r={value:"?",type:"param",paramName:e.slice(1)};return t.namedParameters.push(r),r}}if(null!==e){if(Array.isArray(e))return C(e);if("object"==typeof e&&Object.keys(e).find(t=>"$"===t[0]))return x(t,e)}return C(e)}),x=k("function",(t,e)=>{let[r]=Object.keys(e),n=e[r];if(Array.isArray(n)||(n=[n]),"$"!==r[0])throw new p(`Unknown property “${r}.” Did you mean to call a function? Try prefixing it with $`);let i=n;switch("$condition"!==r&&(i=n.map(e=>L(t,e))),r){case"$sum":{N(i,1);let[t]=R(0,i,["float"]);return v(`SUM(${t})`,i[0].type)}case"$sumOver":{let[e]=R(0,i,["float"]);return v(`(SUM(${e}) OVER (${t.orders?"ORDER BY "+q(t,t.orders):""} ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING))`,i[0].type)}case"$count":{N(i,1);let[t]=R(0,i);return v(`COUNT(${t})`,"integer")}case"$substr":{N(i,2,3);let[t,e,r]=R(0,i,["string","integer","integer"]);return v(`SUBSTR(${t}, ${e}, ${r})`,"string")}case"$lower":{N(i,1);let[t]=R(0,i,["string"]);return v(`UNICODE_LOWER(${t})`,"string")}case"$neg":return N(i,1),R(0,i,["float"]),v(`(-${I(0,i[0])})`,i[0].type);case"$abs":return N(i,1),R(0,i,["float"]),v(`ABS(${I(0,i[0])})`,i[0].type);case"$idiv":return N(i,2),R(0,i,["integer","integer"]),v(`(${I(0,i[0])} / ${I(0,i[1])})`,i[0].type);case"$month":return N(i,1),M(0,i[0],"date-month");case"$year":return N(i,1),M(0,i[0],"date-year");case"$condition":return N(i,1),v(U(t,i[0]).join(" AND "),"boolean");case"$nocase":N(i,1);let[e]=R(0,i,["string"]);return v(e+" COLLATE NOCASE",i[0].type);case"$literal":if(N(i,1),!i[0].literal)throw new p("Literal not passed to $literal");return i[0];default:throw new p("Unknown function: "+r)}}),B=k("op",(t,e,r)=>{let n,{$transform:i,...o}=r,[a]=Object.keys(o),s=L(t,r[a]);switch(n=i?x({...t,implicitField:e},"string"==typeof i?{[i]:"$"}:i):L(t,"$"+e),a){case"$gte":{let[t,e]=R(0,[n,s],[null,n.type]);return`${t} >= ${e}`}case"$lte":{let[t,e]=R(0,[n,s],[null,n.type]);return`${t} <= ${e}`}case"$gt":{let[t,e]=R(0,[n,s],[null,n.type]);return`${t} > ${e}`}case"$lt":{let[t,e]=R(0,[n,s],[null,n.type]);return`${t} < ${e}`}case"$eq":{if("null"===M(0,s,n.type).type)return I(0,n)+" IS NULL";let[e,r]=R(0,[n,s],[null,n.type]);if("param"===s.type){let i=t.namedParameters.map(t=>t===s||t===n?[t,{...t}]:t);return t.namedParameters=[].concat.apply([],i),`CASE\n WHEN ${e} IS NULL THEN ${r} IS NULL\n ELSE ${e} = ${r}\n END`}return`${e} = ${r}`}case"$oneof":{let[t,e]=R(0,[n,s],[null,"array"]);return t+" IN ("+[...new Set(e)].map(t=>`'${t}'`).join(",")+")"}case"$like":{let[t,e]=R(0,[n,s],["string","string"]);return`${t} LIKE ${e}`}default:throw new p("Unknown operator: "+a)}});function U(t,e){return Array.isArray(e)||(e=Object.entries(e).map(t=>({[t[0]]:t[1]}))),e.filter(Boolean).reduce((e,r)=>{let n=Object.entries(r).map(e=>{let[r,n]=e;return"$and"===r?n?F(t,n):null:"$or"===r?n?function(t,e){if(!e)return"0";let r=U(t,e);if(0===r.length)return"0";return"("+r.join("\n OR ")+")"}(t,n):null:"string"==typeof n||"number"==typeof n||"boolean"==typeof n||n instanceof Date||null==n?B(t,r,{$eq:n}):Array.isArray(n)?n.map(e=>B(t,r,e)).join(" AND "):B(t,r,n)}).filter(Boolean);return[...e,...n]},[])}function F(t,e){if(!e)return"1";let r=U(t,e);return 0===r.length?"1":"("+r.join("\n AND ")+")"}const P=k("filter",(t,e)=>F(t,e));function W(t,e,r){let n=[];return t.paths.forEach((i,o)=>{let{tableName:a,tableId:s,joinField:u,joinTable:c,noMapping:l}=t.paths.get(o),f=`${s}.id = ${e(c)}.${_(u)}`,d=r(a);d.length>0&&(f+=" AND "+F({...t,implicitTableName:a,implicitTableId:s},d)),n.push(`LEFT JOIN ${l?a:e(a,!0)} ${s} ON ${y(t.schema,a,s,f)}`),-1===t.dependencies.indexOf(a)&&t.dependencies.push(a)}),n.join("\n")}const z=k("select",(t,e,r,n)=>(r||e.includes("id")||e.includes("*")||(e=e.concat(["id"])),e.map(e=>{if("string"==typeof e){if(-1!==e.indexOf("*")){return function(t,e){let r,n;if("*"===e)n={tableName:t.implicitTableName,tableId:t.implicitTableId};else if(e.match(/\.\*$/)){let i=b(e);r=i.path,n=E(t,i.path)}let i=t.schema[n.tableName];if(null==i)throw new Error(`Table “${n.tableName}” does not exist`);return Object.keys(i).map(t=>r?`${r}.${t}`:t)}(t,e).map(e=>{let r=L(t,"$"+e);return t.outputTypes.set(e,r.type),r.value+" AS "+_(e)}).join(", ")}let r=L(t,"$"+e);return t.outputTypes.set(e,r.type),r.value+" AS "+_(e)}let[r,i]=Object.entries(e)[0];if("$"===r[0])throw t.compileStack.push({type:"value",value:e}),new p(`Invalid field “${r}”, are you trying to select a function? You need to name the expression`);if("string"==typeof i){let e=L(t,"$"+i);return t.outputTypes.set(r,e.type),`${e.value} AS ${_(r)}`}let o=x({...t,orders:n},i);return t.outputTypes.set(r,o.type),o.value+" AS "+_(r)}).join(", "))),H=k("groupBy",(t,e)=>e.map(e=>"string"==typeof e?L(t,"$"+e).value:x(t,e).value).join(", ")),q=k("orderBy",(t,e)=>e.map(e=>{let r,n=null;if("string"==typeof e)r=L(t,"$"+e).value;else{let i=Object.entries(e),o=i[0];if(1===i.length&&"$"!==o[0][0])n=o[1],r=L(t,"$"+o[0]).value;else{let{$dir:i,...o}=e;n=i,r=x(t,o).value}}if(null!=n){if("desc"!==n&&"asc"!==n)throw new p("Invalid order direction: "+n);return`${r} ${n}`}return r}).join(", "));let V=["$sum","$count"];function G(t){return t.groupExpressions.length>0||!!t.selectExpressions.find(t=>{if("string"!=typeof t){let[e,r]=Object.entries(t)[0];return function t(e){if("object"!=typeof e||Array.isArray(e))return!1;let[r,n]=Object.entries(e)[0];return Array.isArray(n)||(n=[n]),-1!==V.indexOf(r)||!!n.find(e=>t(e))}(r)}return!1})}function Y(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{withDead:n,validateRefs:i=!0,tableOptions:o,rawMode:a}=t,{tableViews:s={},tableFilters:u=(t=>[]),customizeQuery:c=(t=>t)}=r,l=t=>{let e=u(t);for(let t of e){if(Array.isArray(t))throw new p("Invalid internal table filter: only object filters are supported");if(-1!==Object.keys(t)[0].indexOf("."))throw new p("Invalid internal table filter: field names cannot contain paths")}return e},f=(t,e)=>("function"==typeof s?s(t,{withDead:n,isJoin:e,tableOptions:o}):s[t])||t,d=t.table,{filterExpressions:g,selectExpressions:m,groupExpressions:y,orderExpressions:b,limit:_,offset:v}=c(t),w="",E="",S="",O="",T="",A={schema:e,implicitTableName:d,implicitTableId:f(d),paths:new Map,dependencies:[d],compileStack:[],outputTypes:new Map,validateRefs:i,namedParameters:[]};h();try{if(w=z(A,m,G(t),b),g.length>0){E="WHERE "+P(A,g)}else E="WHERE 1";if(!a){let t=l(d);t.length>0&&(E+=" AND "+F(A,t))}if(y.length>0){O="GROUP BY "+H(A,y)}if(b.length>0){T="ORDER BY "+q(A,b)}A.paths.size>0&&(S=W(A,f,l))}catch(t){if(t instanceof p)throw j(t,A.compileStack);throw t}let M={select:w,from:f(d),joins:S,where:E,groupBy:O,orderBy:T,limit:_,offset:v};return{sqlPieces:M,state:A}}function $(t,e,r){let n=r,i=t.withDead?n.where:y(e.schema,e.implicitTableName,e.implicitTableId,n.where);return`\n SELECT ${n.select} FROM ${n.from}\n ${n.joins}\n ${i}\n ${n.groupBy}\n ${n.orderBy}\n ${null!=n.limit?"LIMIT "+n.limit:""}\n ${null!=n.offset?"OFFSET "+n.offset:""}\n `}function K(t){return Object.keys(t).map(e=>{let r=t[e],n=r!==e;return r.match(/[ .]/)||(r="_."+r),n?`${r} AS ${_(e)}`:""+r}).join(", ")}function Z(t,e){let r=e.views,n=[];return Object.keys(r).forEach(e=>{let{fields:i={},...o}=r[e],a=Object.fromEntries(Object.keys(t[e]).map(t=>[t,t])),s={...a,...i};Object.keys(o).forEach(t=>{let e,r=t=>K({...a,...t}),i=t=>K({...s,...t});e="function"==typeof o[t]?o[t](i,r):o[t],e=e.trim().replace(/;$/,""),n.push(`\n DROP VIEW IF EXISTS ${t};\n CREATE VIEW ${t} AS ${e};\n `)})}),n.join("\n")}function J(t,e){return{type:t,...e}}const X={transactions:{id:J("id"),is_parent:J("boolean"),is_child:J("boolean"),parent_id:J("id"),account:J("id",{ref:"accounts",required:!0}),category:J("id",{ref:"categories"}),amount:J("integer",{default:0,required:!0}),payee:J("id",{ref:"payees"}),notes:J("string"),date:J("date",{required:!0}),imported_id:J("string"),error:J("json"),imported_payee:J("string"),starting_balance_flag:J("boolean"),transfer_id:J("id"),sort_order:J("float",{default:()=>Date.now()}),cleared:J("boolean",{default:!0}),tombstone:J("boolean"),schedule:J("id",{ref:"schedules"})},payees:{id:J("id"),name:J("string",{required:!0}),transfer_acct:J("id",{ref:"accounts"}),tombstone:J("boolean")},accounts:{id:J("id"),name:J("string",{required:!0}),type:J("string"),offbudget:J("boolean"),closed:J("boolean"),sort_order:J("float"),tombstone:J("boolean")},categories:{id:J("id"),name:J("string"),is_income:J("boolean"),group:J("id",{ref:"category_groups"}),sort_order:J("float"),tombstone:J("boolean")},category_groups:{id:J("id"),name:J("string"),is_income:J("boolean"),sort_order:J("float"),tombstone:J("boolean")},schedules:{id:J("id"),name:J("string"),rule:J("id",{ref:"rules",required:!0}),next_date:J("date"),completed:J("boolean"),posts_transaction:J("boolean"),tombstone:J("boolean"),_payee:J("id",{ref:"payees"}),_account:J("id",{ref:"accounts"}),_amount:J("json/fallback"),_amountOp:J("string"),_date:J("json/fallback"),_conditions:J("json"),_actions:J("json")},rules:{id:J("id"),stage:J("string"),conditions_op:J("string"),conditions:J("json"),actions:J("json"),tombstone:J("boolean")},notes:{id:J("id"),note:J("string")}},Q={tableViews(t,e){let{isJoin:r,withDead:n,tableOptions:i={splits:void 0}}=e;switch(t){case"transactions":{if(r)return"v_transactions_internal_alive";let t=i.splits||"inline";return n||"inline"!==t&&"none"!==t?"v_transactions_internal":"v_transactions_internal_alive"}case"schedules":return"v_schedules";case"categories":return"v_categories";case"payees":return"v_payees"}return t},customizeQuery(t){let{table:e}=t;return{...t,orderExpressions:function(t){if(t.length>0)return t.concat(["id"]);switch(e){case"transactions":return[{date:"desc"},"starting_balance_flag",{sort_order:"desc"},"id"];case"payees":return[{$condition:{transfer_acct:null},$dir:"desc"},{$nocase:"$name"}];case"accounts":return["sort_order","name"];case"schedules":return[{$condition:{completed:!0}},"next_date"]}return[]}(t.orderExpressions)}},views:{payees:{v_payees:t=>`\n SELECT ${t({name:"COALESCE(__accounts.name, _.name)"})} FROM payees _\n LEFT JOIN accounts __accounts ON (_.transfer_acct = __accounts.id AND __accounts.tombstone = 0)\n -- We never want to show transfer payees that are pointing to deleted accounts.\n -- Either this is not a transfer payee, if the account exists\n WHERE _.transfer_acct IS NULL OR __accounts.id IS NOT NULL\n `},categories:{fields:{group:"cat_group"},v_categories:t=>`SELECT ${t({group:"cat_group"})} FROM categories _`},schedules:{v_schedules:t=>`\n SELECT ${t({next_date:"\n CASE\n WHEN _nd.local_next_date_ts = _nd.base_next_date_ts THEN _nd.local_next_date\n ELSE _nd.base_next_date\n END\n ",_payee:"pm.targetId",_account:"json_extract(_rules.conditions, _paths.account || '.value')",_amount:"json_extract(_rules.conditions, _paths.amount || '.value')",_amountOp:"json_extract(_rules.conditions, _paths.amount || '.op')",_date:"json_extract(_rules.conditions, _paths.date || '.value')",_conditions:"_rules.conditions",_actions:"_rules.actions"})} FROM schedules _\n LEFT JOIN schedules_next_date _nd ON _nd.schedule_id = _.id\n LEFT JOIN schedules_json_paths _paths ON _paths.schedule_id = _.id\n LEFT JOIN rules _rules ON _rules.id = _.rule\n LEFT JOIN payee_mapping pm ON pm.id = json_extract(_rules.conditions, _paths.payee || '.value')\n `},transactions:{fields:{is_parent:"isParent",is_child:"isChild",account:"acct",imported_id:"financial_id",imported_payee:"imported_description",transfer_id:"transferred_id",payee:"description"},v_transactions_internal:t=>`\n SELECT ${t({payee:"pm.targetId",category:"CASE WHEN _.isParent = 1 THEN NULL ELSE cm.transferId END",amount:"IFNULL(_.amount, 0)",parent_id:"CASE WHEN _.isChild = 0 THEN NULL ELSE _.parent_id END"})} FROM transactions _\n LEFT JOIN category_mapping cm ON cm.id = _.category\n LEFT JOIN payee_mapping pm ON pm.id = _.description\n WHERE\n _.date IS NOT NULL AND\n _.acct IS NOT NULL AND\n (_.isChild = 0 OR _.parent_id IS NOT NULL)\n `,v_transactions_internal_alive:"\n SELECT _.* FROM v_transactions_internal _\n LEFT JOIN transactions t2 ON (_.is_child = 1 AND t2.id = _.parent_id)\n WHERE IFNULL(_.tombstone, 0) = 0 AND (_.is_child = 0 OR t2.tombstone = 0)\n ",v_transactions:(t,e)=>`\n SELECT ${e({payee:"p.id",category:"c.id",account:"a.id"})} FROM v_transactions_internal_alive _\n LEFT JOIN payees p ON (p.id = _.payee AND p.tombstone = 0)\n LEFT JOIN categories c ON (c.id = _.category AND c.tombstone = 0)\n LEFT JOIN accounts a ON (a.id = _.account AND a.tombstone = 0)\n ORDER BY _.date desc, _.starting_balance_flag, _.sort_order desc, _.id;\n `}}};var tt=r(30),et=r(0);async function rt(t,e,r,n,i){let o=$(t,e,r),a=await et.all(o,n);return function(t,e){for(let r=0;r<t.length;r++){let n=t[r];Object.keys(n).forEach(t=>{n[t]=s(n[t],e.get(t))})}}(a,i),a}async function nt(t,e,r){let n,{params:i={},executors:o={}}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=r.namedParameters.map(t=>{let e=t.paramName;if(void 0===i[e])throw new Error(`Parameter ${e} not provided to query`);return a(i[e],t.paramType)});if(n=o[r.implicitTableName]?await o[r.implicitTableName](r,t,e,s,r.outputTypes):await rt(t,r,e,s,r.outputTypes),t.calculation)if(n.length>0){let t=n[0];n=t[Object.keys(t)[0]]||0}else n=null;return n}var it=r(93);function ot(t){for(let e of Object.keys(t))if("$or"===e||"$and"===e){if(t[e]&&ot(t[e]))return!0}else if(0!==e.indexOf("account")&&"date"!==e)return!0;return!1}const at={transactions:function(t,e,r,n,i){let o=(e.tableOptions||{}).splits||"inline";if(-1===["all","inline","none","grouped"].indexOf(o))throw new Error(`Invalid “splits” option for transactions: “${o}”`);return"all"===o||"inline"===o||"none"===o?async function(t,e,r,n,i,o){let a={...r};"all"!==i&&(a.where="none"===i?`${a.where} AND ${a.from}.parent_id IS NULL`:`${a.where} AND ${a.from}.is_parent = 0`);return rt(e,t,a,n,o)}(t,e,r,n,o,i):"grouped"===o?async function(t,e,r,n,i,o){let a,{withDead:u}=e,c=u?"":`AND ${r.from}.tombstone = 0`;if(G(e)){let i={...r};return i.where=`${i.where} AND ${i.from}.is_parent = 0`,u||(i.from="v_transactions_internal_alive v_transactions_internal"),rt(e,t,i,n,o)}let l=null;if(function(t){return null==t.filterExpressions.find(ot)}(e)){let t=`\n SELECT ${r.from}.id as group_id\n FROM ${r.from}\n ${r.joins}\n ${r.where} AND is_child = 0 ${c}\n ${r.orderBy}\n ${null!=r.limit?"LIMIT "+r.limit:""}\n ${null!=r.offset?"OFFSET "+r.offset:""}\n `;a=await et.all(t,n)}else{let t=`\n SELECT group_id, matched FROM (\n SELECT\n group_id,\n GROUP_CONCAT(id) as matched\n FROM (\n SELECT ${r.from}.id, IFNULL(${r.from}.parent_id, ${r.from}.id) as group_id\n FROM ${r.from}\n LEFT JOIN transactions _t2 ON ${r.from}.is_child = 1 AND _t2.id = ${r.from}.parent_id\n ${r.joins}\n ${r.where} AND ${r.from}.tombstone = 0 AND IFNULL(_t2.tombstone, 0) = 0\n )\n GROUP BY group_id\n )\n LEFT JOIN ${r.from} ON ${r.from}.id = group_id\n ${r.joins}\n ${r.orderBy}\n ${null!=r.limit?"LIMIT "+r.limit:""}\n ${null!=r.offset?"OFFSET "+r.offset:""}\n `;a=await et.all(t,n),l=new Set([].concat.apply([],a.map(t=>t.matched.split(","))))}let f=Object(it.b)(a.map(t=>t.group_id),`IFNULL(${r.from}.parent_id, ${r.from}.id)`),d=`\n SELECT ${r.select}, parent_id AS _parent_id FROM ${r.from}\n ${r.joins}\n WHERE ${f} ${c}\n ${r.orderBy}\n `,h=await et.all(d),{parents:g,children:p}=h.reduce((t,e)=>{let r=e._parent_id;if(delete e._parent_id,null==r)t.parents.push(e);else{let n=t.children.get(r)||[];n.push(e),t.children.set(r,n)}return t},{parents:[],children:new Map});return function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t;return t.reduce((t,n)=>{let i=e.get(n.id)||[];return t.push({...r(n),subtransactions:i.map(r)}),t},[])}(g,p,t=>(Object.keys(t).forEach(e=>{t[e]=s(t[e],o.get(e))}),l&&!l.has(t.id)&&(t._unmatched=!0),t))}(t,e,r,n,0,i):void 0}};function st(t,e,r,n){return nt(t,e,r,{params:n,executors:at})}function ut(t,e){return t instanceof tt.a&&(t=t.serialize()),async function(t,e,r,n){let{sqlPieces:i,state:o}=Y(r,t,e);return{data:await nt(r,i,o,n),dependencies:o.dependencies}}(X,Q,t,{params:e,executors:at})}},function(t,e,r){"use strict";r.d(e,"b",(function(){return a})),r.d(e,"a",(function(){return s}));var n=r(2);let i=null;function o(t){let e=new URL(t);for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return e.pathname=n.j(...i),e.toString()}function a(t){i=null==t?null:s(t)}function s(t){return t?{BASE_SERVER:t,SYNC_SERVER:o(t,"/sync"),SIGNUP_SERVER:o(t,"/account"),PLAID_SERVER:o(t,"/plaid"),NORDIGEN_SERVER:o(t,"/nordigen")}:i}},function(t,e,r){"use strict";(function(t){
|
|
2
|
+
/*!
|
|
3
|
+
* The buffer module from node.js, for the browser.
|
|
4
|
+
*
|
|
5
|
+
* @author Feross Aboukhadijeh <http://feross.org>
|
|
6
|
+
* @license MIT
|
|
7
|
+
*/
|
|
8
|
+
var n=r(254),i=r(255),o=r(147);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return f(this,t)}return c(this,t,e,r)}function c(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=d(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|g(e,r),i=(t=s(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(u.isBuffer(e)){var r=0|h(e.length);return 0===(t=s(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?s(t,0):d(t,e);if("Buffer"===e.type&&o(e.data))return d(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function f(t,e){if(l(e),t=s(t,e<0?0:0|h(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function d(t,e){var r=e.length<0?0:0|h(e.length);t=s(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function h(t){if(t>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return P(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(t).length;default:if(n)return P(t).length;e=(""+e).toLowerCase(),n=!0}}function p(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,r);case"utf8":case"utf-8":return A(this,e,r);case"ascii":return M(this,e,r);case"latin1":case"binary":return I(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,i){var o,a=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var l=-1;for(o=r;o<s;o++)if(c(t,o)===c(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*a}else-1!==l&&(o-=o-l),l=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){for(var f=!0,d=0;d<u;d++)if(c(t,o+d)!==c(e,d)){f=!1;break}if(f)return o}return-1}function _(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[r+a]=s}return a}function v(t,e,r,n){return z(P(e,t.length-r),t,r,n)}function w(t,e,r,n){return z(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function E(t,e,r,n){return w(t,e,r,n)}function S(t,e,r,n){return z(W(e),t,r,n)}function O(t,e,r,n){return z(function(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function T(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,a,s,u,c=t[i],l=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=r)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=f}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=a(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,r){return c(null,t,e,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,r){return function(t,e,r,n){return l(e),e<=0?s(t,e):void 0!==r?"string"==typeof n?s(t,e).fill(r,n):s(t,e).fill(r):s(t,e)}(null,t,e,r)},u.allocUnsafe=function(t){return f(null,t)},u.allocUnsafeSlow=function(t){return f(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var a=t[r];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},u.byteLength=g,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)m(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?A(this,0,t):p.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,r,n,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),s=Math.min(o,a),c=this.slice(n,i),l=t.slice(e,r),f=0;f<s;++f)if(c[f]!==l[f]){o=c[f],a=l[f];break}return o<a?-1:a<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return _(this,t,e,r);case"utf8":case"utf-8":return v(this,t,e,r);case"ascii":return w(this,t,e,r);case"latin1":case"binary":return E(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function M(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function I(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function R(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=F(t[o]);return i}function N(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function k(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function j(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function C(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function L(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function x(t,e,r,n,o){return o||L(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function B(t,e,r,n,o){return o||L(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=u.prototype;else{var i=e-t;r=new u(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},u.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||k(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||k(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUInt8=function(t,e){return e||k(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||k(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||k(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||k(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||k(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||k(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||k(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||k(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||k(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||k(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||k(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||k(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||k(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||k(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||k(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||k(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||D(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||D(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):C(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):C(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);D(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<r&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);D(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):C(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):C(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return x(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return x(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return B(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return B(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var a=u.isBuffer(t)?t:P(new u(t,n).toString()),s=a.length;for(o=0;o<r-e;++o)this[o+e]=a[o%s]}return this};var U=/[^+\/0-9A-Za-z-_]/g;function F(t){return t<16?"0"+t.toString(16):t.toString(16)}function P(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function W(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(U,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(33))},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(8);function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t){Object(n.a)(1,arguments);var e=Object.prototype.toString.call(t);return t instanceof Date||"object"===i(t)&&"[object Date]"===e?new Date(t.getTime()):"number"==typeof t||"[object Number]"===e?new Date(t):("string"!=typeof t&&"[object String]"!==e||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn((new Error).stack)),new Date(NaN))}},function(t,e,r){"use strict";r.d(e,"a",(function(){return l})),r.d(e,"b",(function(){return f})),r.d(e,"f",(function(){return d})),r.d(e,"e",(function(){return h})),r.d(e,"d",(function(){return p})),r.d(e,"c",(function(){return m}));var n=r(23),i=r(5),o=r(10),a=r(4),s=r(7);let u=[{type:"marker"}],c=0;function l(t,e){let r=Object(a.a)();if(r.undoListening&&t.length>0){!function(){u=u.slice(0,c+1);let t=u.filter(t=>"marker"===t.type);if(t.length>20){let e=t.slice(-20),r=u.indexOf(e[0]);u=u.slice(r),c=u.length-1}}();let{undoTag:n}=r;u.push({type:"messages",messages:t,oldData:e,undoTag:n}),c++}}function f(){u=[{type:"marker"}],c=0}function d(t,e){let r=Object(a.a)();if(r.undoDisabled||r.undoListening)return t();u=u.slice(0,c+1);let n={type:"marker",meta:e};return"marker"===u[u.length-1].type?u[u.length-1]=n:(u.push(n),c++),Object(a.f)({undoListening:!0,undoTag:r.undoTag},t)}function h(t){return function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return d(()=>t(...r))}}async function g(t,e,r){await Object(a.f)({undoListening:!1},()=>Object(s.j)(t.map(t=>({...t,timestamp:o.a.send()}))));const i=t.reduce((t,e)=>(t.includes(e.dataset)||t.push(e.dataset),t),[]);n.c("undo-event",{messages:t,tables:i,meta:e,undoTag:r})}async function p(){let t=c;for(c=Math.max(c-1,0);c>0&&"marker"!==u[c].type;)c--;let e=u[c].meta,r=Math.max(c,0),n=u.slice(r,t+1).filter(t=>"messages"===t.type);if(n.length>0){let t=n.reduce((t,e)=>t.concat(e.messages.map(t=>function(t,e){let r=Object(i.g)(e,[t.dataset,t.row]);if(r){let e=t.column;return"spreadsheet_cells"===t.dataset&&(e="cachedValue"),{...t,value:r[e]}}if("spreadsheet_cells"===t.dataset)return"expr"===t.column?{...t,value:null}:t;if("category_mapping"!==t.dataset&&"payee_mapping"!==t.dataset)return"zero_budget_months"===t.dataset||"zero_budgets"===t.dataset||"reflect_budgets"===t.dataset?["buffered","amount","carryover"].includes(t.column)?{...t,value:0}:null:"notes"===t.dataset?{...t,value:null}:{...t,column:"tombstone",value:1};return null}(t,e.oldData)).filter(t=>t)),[]).reverse();await g(t,e,n[0].undoTag)}}async function m(){let t="marker"===u[c].type?u[c].meta:null,e=c;for(c=Math.min(c+1,u.length-1);c<u.length-1&&"marker"!==u[c].type;)c++;let r=c,n=u.slice(e+1,r+1).filter(t=>"messages"===t.type);if(n.length>0){let e=n.reduce((t,e)=>t.concat(e.messages).concat(function(t,e){let r=new Set;return t.forEach(t=>{Object(i.g)(e,[t.dataset,t.row])||["zero_budget_months","zero_budgets","reflect_budgets","notes","category_mapping","payee_mapping"].includes(t.dataset)||r.add(t.dataset+"."+t.row)}),[...r].map(t=>{let[e,r]=t.split(".");return{dataset:e,row:r,column:"tombstone",value:0,timestamp:o.a.send()}})}(e.messages,e.oldData)),[]);await g(e,t,n[n.length-1].undoTag)}}},function(t,e,r){
|
|
9
|
+
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
10
|
+
var n=r(16),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function a(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},a.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},function(t,e,r){"use strict";function n(t,e,r,n){r.forEach(r=>{if(n){if(e.hasOwnProperty(r)&&null==e[r])throw new Error(`${t} is missing field ${r}`)}else if(!e.hasOwnProperty(r)||null==e[r])throw new Error(`${t} is missing field ${r}`)})}function i(t){if("string"!=typeof t)throw new Error("toDateRepr not passed a string: "+t);return parseInt(t.replace(/-/g,""))}function o(t){if("number"!=typeof t)throw new Error("fromDateRepr not passed a number: "+t);const e=t.toString();return e.slice(0,4)+"-"+e.slice(4,6)+"-"+e.slice(6)}r.d(e,"f",(function(){return n})),r.d(e,"g",(function(){return i})),r.d(e,"d",(function(){return o})),r.d(e,"a",(function(){return a})),r.d(e,"c",(function(){return s})),r.d(e,"b",(function(){return u})),r.d(e,"e",(function(){return c})),r.d(e,"h",(function(){return l}));const a={validateAccountType(t){const{type:e}=t;if("checking"!==e&&"savings"!==e&&"investment"!==e&&"credit"!==e&&"mortgage"!==e&&"debt"!==e&&"other"!==e)throw new Error("Invalid account type: "+e)},validate(t){let{update:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e&&null==t.type||a.validateAccountType(t),n("account",t,e?["name","type","offbudget","closed"]:["name","type"],e),t}},s={validate(t){let{update:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("category",t,e?["name","is_income","cat_group"]:["name","cat_group"],e);let{sort_order:r,...i}=t;return i}},u={validate(t){let{update:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("categoryGroup",t,e?["name","is_income"]:["name"],e);let{sort_order:r,...i}=t;return i}},c={validate(t){let{update:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n("payee",t,["name"],e),t}},l={validate(t){let{update:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n("transaction",t,["date","acct"],e),"date"in t&&(null==t.date.match(/^\d{4}-\d{2}-\d{2}$/)||t.date<"2000-01-01"))throw new Error("Invalid transaction date: "+t.date);return t},toJS(t){if(!("location"in t))throw new Error("A full transaction is required to be passed to `toJS`. Instead got: "+JSON.stringify(t));let e={...t};return e.error=t.error?JSON.parse(t.error):null,e.isParent=1===t.isParent,e.isChild=1===t.isChild,e.starting_balance_flag=1===t.starting_balance_flag,e.cleared=1===t.cleared,e.pending=1===t.pending,e.date=e.date&&o(e.date),e},fromJS(t){let e={...t};return"error"in e&&(e.error=t.error?JSON.stringify(t.error):null),"isParent"in e&&(e.isParent=t.isParent?1:0),"isChild"in e&&(e.isChild=t.isChild?1:0),"cleared"in e&&(e.cleared=t.cleared?1:0),"pending"in e&&(e.pending=t.pending?1:0),"starting_balance_flag"in e&&(e.starting_balance_flag=t.starting_balance_flag?1:0),"date"in e&&(e.date=i(t.date)),e}}},function(t,e,r){"use strict";function n(t){let e=t.indexOf("!");return-1!==e?{sheet:t.slice(0,e),name:t.slice(e+1)}:{sheet:null,name:t}}function i(t,e){return t+"!"+e}r.d(e,"b",(function(){return n})),r.d(e,"a",(function(){return i}))},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(60),i=r.n(n);const o=function(){return i.a.v4()}},function(t,e,r){"use strict";r.d(e,"b",(function(){return a})),r.d(e,"c",(function(){return s})),r.d(e,"a",(function(){return u}));var n=r(4),i=r(26);function o(){let t="undefined"!=typeof window?window:"undefined"!=typeof self?self:null;if(!t)throw new Error("Cannot get global object");return t}o().__globalServerChannel=null;const a=function(t,e){const r=t;o().__globalServerChannel=r,r.addEventListener("message",t=>{let o=t.data,a="string"==typeof o?JSON.parse(o):o;if(a.type&&("init"===a.type||a.type.startsWith("__")))return;let{id:u,name:c,args:l,undoTag:f,catchErrors:d}=a;e[c]?Object(n.d)(e[c],l,{undoTag:f,name:c}).then(t=>{d&&(t={data:t,error:null}),r.postMessage({type:"reply",id:u,result:t,mutated:Object(n.b)(e[c]),undoTag:f})},t=>{let e=function(t){return t.type&&"APIError"===t.type?t:{type:"InternalError",message:t.message}}(t);c.startsWith("api/")?r.postMessage({type:"reply",id:u,error:e}):d?r.postMessage({type:"reply",id:u,result:{error:e,data:null}}):r.postMessage({type:"error",id:u}),"InternalError"===e.type&&Object(i.b)(t),d||s("server-error")}):(console.warn("Unknown method: "+c),r.postMessage({type:"reply",id:u,result:null,error:{type:"APIError",message:"Unknown method: "+c}}))},!1),r.postMessage({type:"connect"})},s=function(t,e){const{__globalServerChannel:r}=o();r&&r.postMessage({type:"push",name:t,args:e})},u=function(){return 1}},function(t,e,r){"use strict";r.d(e,"d",(function(){return c})),r.d(e,"c",(function(){return h})),r.d(e,"h",(function(){return g})),r.d(e,"i",(function(){return p})),r.d(e,"a",(function(){return y})),r.d(e,"k",(function(){return b})),r.d(e,"g",(function(){return _})),r.d(e,"e",(function(){return v})),r.d(e,"f",(function(){return w})),r.d(e,"b",(function(){return E})),r.d(e,"l",(function(){return S})),r.d(e,"m",(function(){return O})),r.d(e,"j",(function(){return T}));var n=r(1),i=r(5),o=r(0),a=r(6),s=r(3),u=r(7);async function c(t,e){const r=await s.c(t,e);return Object(i.o)("number"==typeof r.value?r.value:0)}function l(){let{budgetType:t}=a.b()||{};return"report"===t?"reflect_budgets":"zero_budgets"}function f(){let{budgetType:t}=a.b();return"report"===t}function d(t){return parseInt(t.replace("-",""))}function h(t){let{category:e,month:r}=t,n=l(),i=o.firstSync(`SELECT * FROM ${n} WHERE month = ? AND category = ?`,[d(r),e]);return i&&i.amount||0}function g(t){let{category:e,month:r,amount:n}=t;n=Object(i.o)("number"==typeof n?n:0);const a=l();let s=o.firstSync(`SELECT id FROM ${a} WHERE month = ? AND category = ?`,[d(r),e]);return s?o.update(a,{id:s.id,amount:n}):o.insert(a,{id:`${d(r)}-${e}`,month:d(r),category:e,amount:n})}function p(t,e){let r=o.firstSync("SELECT id FROM zero_budget_months WHERE id = ?",[t]);return r?o.update("zero_budget_months",{id:r.id,buffered:e}):o.insert("zero_budget_months",{id:t,buffered:e})}function m(t,e,r,n){let i=o.firstSync(`SELECT id FROM ${t} WHERE month = ? AND category = ?`,[r,e]);return i?o.update(t,{id:i.id,carryover:n?1:0}):o.insert(t,{id:`${r}-${e}`,month:r,category:e,carryover:n?1:0})}async function y(t){let{month:e}=t,r=d(n.m(e)),i=l(),a=await function(t,e){return o.all(`\n SELECT b.*, c.is_income FROM v_categories c\n LEFT JOIN ${t} b ON b.category = c.id\n WHERE c.tombstone = 0 AND b.month = ?\n `,[e])}(i,r);await Object(u.c)(()=>{a.forEach(t=>{(1!==t.is_income||f())&&g({category:t.category,month:e,amount:t.amount})})})}async function b(t){let{month:e}=t,r=await o.all("SELECT * FROM v_categories WHERE tombstone = 0");await Object(u.c)(()=>{r.forEach(t=>{(1!==t.is_income||f())&&g({category:t.id,month:e,amount:0})})})}async function _(t){let{month:e}=t,r=await o.all("SELECT * FROM v_categories WHERE tombstone = 0"),i=n.m(e),a=n.m(i),s=n.m(a);await Object(u.c)(async()=>{for(let t of r){if(1===t.is_income&&!f())continue;let r=await c(n.p(i),"sum-amount-"+t.id),o=await c(n.p(a),"sum-amount-"+t.id),u=await c(n.p(s),"sum-amount-"+t.id);const l=Math.round((r+o+u)/3);g({category:t.id,month:e,amount:-l})}})}async function v(t){let{month:e,amount:r}=t,i=await o.first("SELECT buffered FROM zero_budget_months WHERE id = ?",[e]),a=n.p(e),s=await c(a,"to-budget");if(s>0){let t=function(t,e,r){return e+(r=Math.min(Math.max(r,-e),Math.max(t,0)))}(s,i&&i.buffered||0,r);return await p(e,t),!0}return!1}async function w(t){let{month:e}=t;await p(e,0)}async function E(t){let{month:e,to:r,from:i}=t,o=n.p(e),a=await c(o,"budget-"+r),s=await c(o,"leftover-"+r),u=await c(o,"to-be-budgeted"===i?"to-budget":"leftover-"+i);if(s>=0||u<=0)return;let l=Math.min(-s,u);if("to-be-budgeted"!==i){const t=await c(o,"budget-"+i);await g({category:i,month:e,amount:t-l})}await g({category:r,month:e,amount:a+l})}async function S(t){let{month:e,amount:r,category:i}=t,o=n.p(e),a=await c(o,"to-budget");r=Math.max(Math.min(r,a),0);let s=await c(o,"budget-"+i);await g({category:i,month:e,amount:s+r})}async function O(t){let{month:e,amount:r,from:i,to:o}=t;const a=n.p(e),s=await c(a,"budget-"+i);if(await g({category:i,month:e,amount:s-r}),"to-be-budgeted"!==o){const t=await c(a,"budget-"+o);await g({category:o,month:e,amount:t+r})}}async function T(t){let{startMonth:e,category:r,flag:i}=t,o=l(),a=function(t){let{createdMonths:e}=s.b().meta(),r=null;for(let t of e)(null==r||t>r)&&(r=t);return n.o(t,r)}(e);await Object(u.c)(()=>{for(let t of a)m(o,r,d(t),i)})}},function(t,e){var r,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(t){n=a}}();var u,c=[],l=!1,f=-1;function d(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&h())}function h(){if(!l){var t=s(d);l=!0;for(var e=c.length;e;){for(u=c,c=[];++f<e;)u&&u[f].run();f=-1,e=c.length}u=null,l=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function g(t,e){this.fun=t,this.array=e}function p(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new g(t,e)),1!==c.length||l||s(h)},g.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=p,i.addListener=p,i.once=p,i.off=p,i.removeListener=p,i.removeAllListeners=p,i.emit=p,i.prependListener=p,i.prependOnceListener=p,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,r){"use strict";r.d(e,"b",(function(){return n})),r.d(e,"a",(function(){return i}));const n=function(t){console.log("[Exception]",t)},i=function(t){}},function(t,e,r){"use strict";(function(t){r.d(e,"b",(function(){return s})),r.d(e,"c",(function(){return u})),r.d(e,"a",(function(){return c}));var n=r(66),i=r(11),o=r(48);function a(t,e){if(200!==t.status){if(500===t.status)throw new i.e(500===t.status?"internal":e);if(-1!==t.headers.get("Content-Type").toLowerCase().indexOf("application/json")){let t=JSON.parse(e);throw new i.e(t.reason)}throw new i.e(e)}}async function s(t,e){let r,o,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{o=await Object(n.a)(t,{method:"POST",body:JSON.stringify(e),headers:{...s,"Content-Type":"application/json"}}),r=await o.text()}catch(t){throw new i.e("network-failure")}a(o,r);try{o=JSON.parse(r)}catch(t){throw new i.e("parse-json",{meta:r})}if("ok"!==o.status)throw console.log("API call failed: "+t+"\nData: "+JSON.stringify(e,null,2)+"\nResponse: "+JSON.stringify(o,null,2)),new i.e(o.description||o.reason||"unknown");return o.data}async function u(e,r,s){let u,c;try{u=await Object(n.a)(e,{method:"POST",body:o.c?r:t.from(r),headers:{"Content-Length":r.length,"Content-Type":"application/actual-sync",...s}})}catch(t){throw new i.e("network-failure")}return c=u.arrayBuffer?t.from(await u.arrayBuffer()):await u.buffer(),a(u,c.toString()),c}function c(t,e){return Object(n.a)(t,e).then(t=>t.text())}}).call(this,r(16).Buffer)},function(t,e,r){"use strict";function n(t){if(null===t||!0===t||!1===t)return NaN;var e=Number(t);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";r.d(e,"i",(function(){return E})),r.d(e,"h",(function(){return O})),r.d(e,"d",(function(){return T})),r.d(e,"f",(function(){return A})),r.d(e,"m",(function(){return M})),r.d(e,"c",(function(){return I})),r.d(e,"j",(function(){return N})),r.d(e,"b",(function(){return k})),r.d(e,"a",(function(){return D})),r.d(e,"e",(function(){return j})),r.d(e,"l",(function(){return L})),r.d(e,"k",(function(){return B}));var n=r(1),i=r(44),o=r(5),a=r(14),s=r(0),u=r(95),c=r(11),l=r(20),f=r(7),d=r(34);let h,g,p,m;r.d(e,"g",(function(){return d.e}));let y=a.i.views.transactions.fields,b=(_=a.i.views.transactions.fields,Object.fromEntries(Object.entries(_).map(t=>[t[1],t[0]])));var _;function v(t){return{...t,field:b[t.field]||t.field}}function w(t){return{...t,field:y[t.field]||t.field}}const E={validate(t){let{update:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Object(l.f)("rules",t,["conditions","actions"],e),(!e||"stage"in t)&&"pre"!==t.stage&&"post"!==t.stage&&null!==t.stage)throw new Error("Invalid rule stage: "+t.stage);if((!e||"conditionsOp"in t)&&!["and","or"].includes(t.conditionsOp))throw new Error("Invalid rule conditionsOp: "+t.conditionsOp);return t},toJS(t){function e(t){let e;try{e="string"==typeof t?JSON.parse(t):t}catch(t){throw new c.f("internal","Cannot parse rule json")}if(!Array.isArray(e))throw new c.f("internal","Rule json must be an array");return e}let{conditions:r,conditions_op:n,actions:i,...o}=t;return{...o,conditionsOp:n,conditions:r?e(r).map(t=>v(t)):[],actions:i?e(i).map(t=>v(t)):[]}},fromJS(t){let{conditions:e,conditionsOp:r,actions:n,...i}=t;if(r&&(i.conditions_op=r),Array.isArray(e)){let t=e.map(t=>w(t));i.conditions=JSON.stringify(t)}if(Array.isArray(n)){let t=n.map(t=>w(t));i.actions=JSON.stringify(t)}return i}};function S(t){let e;try{e=new d.c({...E.toJS(t),fieldTypes:i.a})}catch(t){if(console.warn("Invalid rule",t),t instanceof c.f)return null;throw t}return Object(d.f)(e,Object(u.a)()),e}async function O(){h=new Map,p=new d.d({field:"imported_payee",method:"firstchar"}),m=new d.d({field:"payee"});let t=await s.all("\n SELECT * FROM rules\n WHERE conditions IS NOT NULL AND actions IS NOT NULL AND tombstone = 0\n ");for(let e=0;e<t.length;e++){let r=t[e];"cleanup"!==r.stage&&"modify"!==r.stage||(r.stage="pre");let n=S(r);n&&(h.set(n.id,n),p.index(n),m.index(n))}g&&g(),g=Object(f.a)(R)}function T(){return[...h.values()]}async function A(t){return t=E.validate(t),s.insertWithUUID("rules",E.fromJS(t))}async function M(t){return t=E.validate(t,{update:!0}),s.update("rules",E.fromJS(t))}async function I(t){return!await s.first("SELECT id FROM schedules WHERE rule = ?",[t.id])&&s.delete_("rules",t.id)}function R(t,e){e.forEach((t,e)=>{"rules"===e&&t.forEach(t=>{let e=h.get(t.id);if(1===t.tombstone){let e=h.get(t.id);e&&(h.delete(e.getId()),p.remove(e),m.remove(e))}else{let r=S(t);r&&(e&&(p.remove(e),m.remove(e)),h.set(t.id,r),p.index(r),m.index(r))}})}),[...e.keys()].find(t=>-1!==t.indexOf("mapping"))&&T().forEach(t=>{Object(d.f)(t,Object(u.a)())})}function N(t){let e={...t},r=Object(d.g)(Object(o.e)(p.getApplicableRules(t),m.getApplicableRules(t)));for(let t=0;t<r.length;t++)e=r[t].apply(e);return e}function k(t){let{recurDateBounds:e=100}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=[],o=(t=t.map(t=>{if(t instanceof d.b)return t;try{return new d.b(t.op,t.field,t.value,t.options,i.a)}catch(t){return r.push(t.type||"internal"),console.log("conditionsToAQL: invalid condition: "+t.message),null}}).filter(Boolean)).map(t=>{let{type:r,field:o,op:a,value:s,options:u}=t,c=t=>"number"===r?t.value:t,l=(t,e,n)=>{if("number"===r){if(u){if(u.outflow)return{$and:[{amount:{$lt:0}},{[t]:{$transform:"$neg",[e]:n}}]};if(u.inflow)return{$and:[{amount:{$gt:0}},{[t]:{[e]:n}}]}}return{amount:{[e]:n}}}return"string"===r?{[t]:{$transform:"$lower",[e]:n}}:"date"===r?{[t]:{[e]:n.date}}:{[t]:{[e]:n}}};switch(a){case"isapprox":case"is":if("date"===r){if("recur"===s.type){return{$or:s.schedule.occurrences({take:e}).toArray().map(t=>Object(n.f)(t.date)).map(t=>"isapprox"===a?{$and:[{date:{$gte:Object(n.q)(t,2)}},{date:{$lte:Object(n.a)(t,2)}}]}:{date:t})}}if("isapprox"===a){let t=Object(n.l)(s.date),e=Object(n.a)(t,2);return{$and:[{date:{$gte:Object(n.q)(t,2)}},{date:{$lte:e}}]}}switch(s.type){case"date":return{date:s.date};case"month":return{$and:[{date:{$gte:s.date+"-00"}},{date:{$lte:s.date+"-99"}}]};case"year":return{$and:[{date:{$gte:s.date+"-00-00"}},{date:{$lte:s.date+"-99-99"}}]}}}else if("number"===r){let t=s.value;if("isapprox"===a){let e=Object(i.b)(t);return{$and:[l(o,"$gte",t-e),l(o,"$lte",t+e)]}}return l(o,"$eq",t)}return l(o,"$eq",s);case"isbetween":let[t,u]=Object(i.c)(s.num1,s.num2);return{[o]:[{$gte:t},{$lte:u}]};case"contains":return l("id"===r?o+".name":o,"$like","%"+s+"%");case"oneOf":let f=s;return 0===f.length?{id:null}:{$or:f.map(t=>l(o,"$eq",t))};case"gt":return l(o,"$gt",c(s));case"gte":return l(o,"$gte",c(s));case"lt":return l(o,"$lt",c(s));case"lte":return l(o,"$lte",c(s));case"true":return l(o,"$eq",!0);case"false":return l(o,"$eq",!1);default:throw new Error("Unhandled operator: "+a)}});return{filters:o,errors:r}}function D(t,e,r){let n=e.map(t=>{if(t instanceof d.a)return t;try{return new d.a(t.op,t.field,t.value,t.options,i.a)}catch(t){return console.log("Action error",t),null}}).filter(Boolean);if(n.length!==e.length)return null;let o=t.map(t=>{let e={id:t};for(let t of n)t.exec(e);return e});return r["transactions-batch-update"]({updated:o})}function j(t){let e=new Set;return Object(d.e)(T(),"payee",(r,n)=>{n===t&&e.add(r)}),Object(d.g)([...e])}function C(t,e,r,n){let{condValue:i,actionValue:o}=n;return function*(){let n=T();for(let a=0;a<n.length;a++){let s=n[a];s.stage!==t||1!==s.actions.length||"set"!==s.actions[0].op||s.actions[0].field!==r||void 0!==o&&s.actions[0].value!==o||1!==s.conditions.length||"is"!==s.conditions[0].op||s.conditions[0].field!==e||void 0!==i&&s.conditions[0].value!==i||(yield s.serialize())}return null}()}async function L(t,e){let r=function(t,e,r,n){let{condValue:i,actionValue:o}=n;return function*(){let n=T();for(let a=0;a<n.length;a++){let s=n[a];s.stage!==t||1!==s.actions.length||"set"!==s.actions[0].op||s.actions[0].field!==r||null!=o&&s.actions[0].value!==o||1!==s.conditions.length||"oneOf"!==s.conditions[0].op||s.conditions[0].field!==e||null!=i&&-1===s.conditions[0].value.indexOf(i)||(yield s.serialize())}return null}()}("pre","imported_payee","payee",{actionValue:e}).next().value;if(r){let e=r.conditions[0],n=[...Object(o.e)(new Set(e.value),new Set(t.filter(t=>""!==t)))],i={...r,conditions:[{...e,value:n}]};return await M(i),r.id}return A(new d.c({stage:"pre",conditionsOp:"and",conditions:[{op:"oneOf",field:"imported_payee",value:t}],actions:[{op:"set",field:"payee",value:e}],fieldTypes:i.a}).serialize())}function x(t){let e=new Map;t.forEach(t=>{t.category&&e.set(t.category,(e.get(t.category)||0)+1)});let r=t.reduce((t,r)=>{let n=e.get(r.category);return!t||n>t.score?{score:n,category:r.category}:t},null);return r.score>=3?r.category:null}async function B(t){if(0===t.length)return;let e=new Set(t.map(t=>t.payee)),r=new Set(t.map(t=>t.id)),a=null;for(let e=0;e<t.length;e++)(null===a||t[e].date<a)&&(a=t[e].date);a=Object(n.q)(a,180);let u=await s.all("SELECT t.* FROM v_transactions t\n LEFT JOIN accounts a ON a.id = t.account\n WHERE date >= ? AND date <= ? AND is_parent = 0 AND a.closed = 0\n ORDER BY date DESC",[Object(l.g)(a),Object(l.g)(Object(n.a)(Object(n.d)(),180))]),c=Object(o.n)(u,"payee"),h=new Map;for(let t of e)if(t){let e=(c.get(t)||[]).slice(0,5);if(e.find(t=>r.has(t.id))){let r=x(e);r&&h.set(t,r)}}await Object(f.c)(async()=>{for(let[t,e]of h.entries()){let r=[...C(null,"payee","category",{condValue:t})];if(r.length>0)for(let t of r){let r=t.actions[0];r.value!==e&&await M({...t,actions:[{...r,value:e}]})}else{let r=new d.c({stage:null,conditionsOp:"and",conditions:[{op:"is",field:"payee",value:t}],actions:[{op:"set",field:"category",value:e}],fieldTypes:i.a});await A(r.serialize())}}})}},function(t,e,r){"use strict";r.d(e,"a",(function(){return n})),r.d(e,"b",(function(){return i}));class n{constructor(t){this.state={filterExpressions:t.filterExpressions||[],selectExpressions:t.selectExpressions||[],groupExpressions:t.groupExpressions||[],orderExpressions:t.orderExpressions||[],calculation:!1,rawMode:!1,withDead:!1,validateRefs:!0,limit:null,offset:null,...t}}filter(t){return new n({...this.state,filterExpressions:[...this.state.filterExpressions,t]})}unfilter(t){let e=new Set(t);return new n({...this.state,filterExpressions:this.state.filterExpressions.filter(t=>!e.has(Object.keys(t)[0]))})}select(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];Array.isArray(t)||(t=[t]);let e=new n({...this.state,selectExpressions:t});return e.state.calculation=!1,e}calculate(t){let e=this.select({result:t});return e.state.calculation=!0,e}groupBy(t){return Array.isArray(t)||(t=[t]),new n({...this.state,groupExpressions:[...this.state.groupExpressions,...t]})}orderBy(t){return Array.isArray(t)||(t=[t]),new n({...this.state,orderExpressions:[...this.state.orderExpressions,...t]})}limit(t){return new n({...this.state,limit:t})}offset(t){return new n({...this.state,offset:t})}raw(){return new n({...this.state,rawMode:!0})}withDead(){return new n({...this.state,withDead:!0})}withoutValidatedRefs(){return new n({...this.state,validateRefs:!1})}options(t){return new n({...this.state,tableOptions:t})}serialize(){return this.state}}function i(t){return new n({table:t})}},function(t,e,r){"use strict";var n=r(23),i=r(51);const o=Object(i.a)();o.events.on("sync",t=>{n.c("sync-event",t)}),e.a=o},function(t,e,r){"use strict";r.d(e,"j",(function(){return o})),r.d(e,"b",(function(){return a})),r.d(e,"k",(function(){return s})),r.d(e,"l",(function(){return u})),r.d(e,"a",(function(){return c})),r.d(e,"g",(function(){return l})),r.d(e,"c",(function(){return f})),r.d(e,"e",(function(){return d})),r.d(e,"h",(function(){return h})),r.d(e,"d",(function(){return g})),r.d(e,"i",(function(){return p})),r.d(e,"f",(function(){return m}));var n=r(108);function i(t,e){return n.b(t,e)}async function o(t,e){await i("api/start-import",{budgetName:t});try{await e()}catch(t){throw await i("api/abort-import"),t}await i("api/finish-import")}async function a(t){await i("api/batch-budget-start");try{await t()}finally{await i("api/batch-budget-end")}}function s(t,e,r){return i("api/budget-set-amount",{month:t,categoryId:e,amount:r})}function u(t,e,r){return i("api/budget-set-carryover",{month:t,categoryId:e,flag:r})}function c(t,e){return i("api/transactions-add",{accountId:t,transactions:e})}function l(){return i("api/accounts-get")}function f(t,e){return i("api/account-create",{account:t,initialBalance:e})}function d(t){return i("api/category-group-create",{group:t})}function h(){return i("api/categories-get",{grouped:!1})}function g(t){return i("api/category-create",{category:t})}function p(){return i("api/payees-get")}function m(t){return i("api/payee-create",{payee:t})}},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";r.d(e,"b",(function(){return p})),r.d(e,"a",(function(){return y})),r.d(e,"c",(function(){return b})),r.d(e,"d",(function(){return _})),r.d(e,"g",(function(){return E})),r.d(e,"f",(function(){return S})),r.d(e,"e",(function(){return O}));var n=r(97),i=r(146),o=r(252),a=r(77),s=r(1),u=r(44),c=r(40),l=r(5),f=r(11),d=r(75);function h(t,e,r){if(!t)throw new f.f(e,r)}let g={date:{ops:["is","isapprox","gt","gte","lt","lte"],nullable:!1,parse(t,e,r){let o="string"==typeof e?"string"!=typeof(a=e)?null:10===a.length?n.a(i.a(a))?{type:"date",date:a}:null:7===a.length?n.a(i.a(a+"-01"))?{type:"month",date:a}:null:4===a.length&&n.a(i.a(a+"-01-01"))?{type:"year",date:a}:null:null!=e.frequency?function(t){try{let e=Object(c.e)(t);return{type:"recur",schedule:new d.a({rrules:e})}}catch(t){throw new f.f("parse-recur-date",t.message)}}(e):null;var a;return h(o,"date-format",`Invalid date format (field: ${r})`),"isapprox"===t?h("date"===o.type||"recur"===o.type,"date-format",`Invalid date value for “isapprox” (field: ${r})`):"gt"!==t&&"gte"!==t&&"lt"!==t&&"lte"!==t||h("date"===o.type,"date-format",`Invalid date value for “${t}” (field: ${r})`),o}},id:{ops:["is","contains","oneOf"],nullable:!0,parse:(t,e,r)=>"oneOf"===t?(h(Array.isArray(e),"no-empty-array",`oneOf must have an array value (field: ${r})`),e):e},string:{ops:["is","contains","oneOf"],nullable:!1,parse:(t,e,r)=>"oneOf"===t?(h(Array.isArray(e),"no-empty-array",`oneOf must have an array value (field: ${r}): ${JSON.stringify(e)}`),e.filter(Boolean).map(t=>t.toLowerCase())):("contains"===t&&h("string"==typeof e&&e.length>0,"no-empty-string",`contains must have non-empty string (field: ${r})`),e.toLowerCase())},number:{ops:["is","isapprox","isbetween","gt","gte","lt","lte"],nullable:!1,parse(t,e,r){let n="number"==typeof e?{type:"literal",value:e}:function(t){let{num1:e,num2:r}=t;return"number"!=typeof e||"number"!=typeof r?null:{type:"between",num1:e,num2:r}}(e);return h(null!=n,"not-number",`Value must be a number or between amount: ${JSON.stringify(e)} (field: ${r})`),"isbetween"===t?h("between"===n.type,"number-format",`Invalid between value for “${t}” (field: ${r})`):h("literal"===n.type,"number-format",`Invalid number value for “${t}” (field: ${r})`),n}},boolean:{ops:["is"],nullable:!1,parse:(t,e,r)=>(h("boolean"==typeof e,"not-boolean",`Value must be a boolean: ${e} (field: ${r})`),e)}};class p{constructor(t,e,r,n,i){let o=i.get(e);h(o,"internal","Invalid condition field: "+e);let a=g[o];h(a,"internal",`Invalid condition type: ${o} (field: ${e})`),h(a.ops.includes(t),"internal",`Invalid condition operator: ${t} (type: ${o}, field: ${e})`),!0!==a.nullable&&h(null!=r,"no-null","Field cannot be empty: "+e),"string"===o&&!0!==a.nullable&&h(""!==r,"no-null","Field cannot be empty: "+e),this.rawValue=r,this.unparsedValue=r,this.op=t,this.field=e,this.value=a.parse?a.parse(t,r,e):r,this.options=n,this.type=o}eval(t){let e=t[this.field];if(void 0===e)return!1;"string"==typeof e&&(e=e.toLowerCase());let r=this.type;if("number"===r&&this.options)if(this.options.outflow){if(e>0)return!1;e=-e}else if(this.options.inflow&&e<0)return!1;let n=t=>"number"===r?t.value:t;switch(this.op){case"isapprox":case"is":if("date"===r){if(null==e)return!1;if("recur"===this.value.type){let{schedule:t}=this.value;if("isapprox"===this.op){let r=Object(s.l)(e);return t.occursBetween(o.a(r,2),a.a(r,2))}return t.occursOn({date:Object(s.l)(e)})}{let{date:t}=this.value;if("isapprox"===this.op){let r=Object(s.l)(t),n=Object(s.a)(r,2);return e>=Object(s.q)(r,2)&&e<=n}switch(this.value.type){case"date":return e===t;case"month":return Object(s.k)(e)===t;case"year":return Object(s.s)(e)===t}}}else if("number"===r){let t=this.value.value;if("isapprox"===this.op){let r=Object(u.b)(t);return e>=t-r&&e<=t+r}return e===t}return e===this.value;case"isbetween":{let[t,r]=Object(u.c)(this.value.num1,this.value.num2);return e>=t&&e<=r}case"contains":return null!==e&&-1!==e.indexOf(this.value);case"oneOf":return null!==e&&-1!==this.value.indexOf(e);case"gt":return null!==e&&("date"===r?Object(s.i)(e,this.value.date):e>n(this.value));case"gte":return null!==e&&("date"===r?e===this.value.date||Object(s.i)(e,this.value.date):e>=n(this.value));case"lt":return null!==e&&("date"===r?Object(s.j)(e,this.value.date):e<n(this.value));case"lte":return null!==e&&("date"===r?e===this.value.date||Object(s.j)(e,this.value.date):e<=n(this.value))}return!1}getValue(){return this.value}serialize(){return{op:this.op,field:this.field,value:this.unparsedValue,type:this.type,...this.options?{options:this.options}:null}}}let m=["set","link-schedule"];class y{constructor(t,e,r,n,i){if(h(m.includes(t),"internal","Invalid action operation: "+t),"set"===t){let t=i.get(e);h(t,"internal","Invalid field for action: "+e),this.field=e,this.type=t}else"link-schedule"===t&&(this.field=null,this.type="id");this.op=t,this.rawValue=r,this.value=r,this.options=n}exec(t){switch(this.op){case"set":t[this.field]=this.value;break;case"link-schedule":t.schedule=this.value}}serialize(){return{op:this.op,field:this.field,value:this.value,type:this.type,...this.options?{options:this.options}:null}}}class b{constructor(t){let{id:e,stage:r,conditionsOp:n,conditions:i,actions:o,fieldTypes:a}=t;this.id=e,this.stage=r,this.conditionsOp=n,this.conditions=i.map(t=>new p(t.op,t.field,t.value,t.options,a)),this.actions=o.map(t=>new y(t.op,t.field,t.value,t.options,a))}evalConditions(t){if(0===this.conditions.length)return!1;const e="or"===this.conditionsOp?"some":"every";return this.conditions[e](e=>e.eval(t))}execActions(t){let e={};return this.actions.forEach(t=>t.exec(e)),e}exec(t){return this.evalConditions(t)?this.execActions(t):null}apply(t){let e=this.exec(t);return Object.assign({},t,e)}getId(){return this.id}serialize(){return{id:this.id,stage:this.stage,conditionsOp:this.conditionsOp,conditions:this.conditions.map(t=>t.serialize()),actions:this.actions.map(t=>t.serialize())}}}class _{constructor(t){let{field:e,method:r}=t;this.field=e,this.method=r,this.rules=new Map}getIndex(t){return this.rules.has(t)||this.rules.set(t,new Set),this.rules.get(t)}getIndexForValue(t){return this.getIndex(this.getKey(t)||"*")}getKey(t){return"string"==typeof t&&""!==t?"firstchar"===this.method?t[0].toLowerCase():t.toLowerCase():null}getIndexes(t){let e=t.conditions.find(t=>t.field===this.field),r=[];return!e||"oneOf"!==e.op&&"is"!==e.op?r.push(this.getIndex("*")):"oneOf"===e.op?e.value.forEach(t=>r.push(this.getIndexForValue(t))):r.push(this.getIndexForValue(e.value)),r}index(t){this.getIndexes(t).forEach(e=>{e.add(t)})}remove(t){this.getIndexes(t).forEach(e=>{e.delete(t)})}getApplicableRules(t){let e;if(this.field in t){let r=this.getKey(t[this.field]);r&&(e=this.rules.get(r))}return Object(l.e)(e||new Set,this.rules.get("*")||new Set)}}const v={is:10,oneOf:9,isapprox:5,isbetween:5,gt:1,gte:1,lt:1,lte:1,contains:0};function w(t){let e=new Map;return t.forEach(t=>{e.set(t,function(t){let e=t.conditions.reduce((t,e)=>null==v[e.op]?(console.log("Found invalid operation while ranking: "+e.op),0):t+v[e.op],0);return t.conditions.every(t=>"is"===t.op||"isapprox"===t.op||"oneOf"===t.op)?2*e:e}(t))}),[...t].sort((t,r)=>{let n=e.get(t),i=e.get(r);if(n<i)return-1;if(n>i)return 1;{let e=t.getId(),n=r.getId();return e<n?-1:e>n?1:0}})}function E(t){let e=[],r=[],n=[];for(let i of t)switch(i.stage){case"pre":e.push(i);break;case"post":n.push(i);break;default:r.push(i)}return e=w(e),r=w(r),n=w(n),e.concat(r).concat(n)}function S(t,e){for(let r=0;r<t.conditions.length;r++){let n=t.conditions[r];if("id"===n.type)switch(n.op){case"is":n.value=e.get(n.rawValue)||n.rawValue,n.unparsedValue=n.value;break;case"oneOf":n.value=n.rawValue.map(t=>e.get(t)||t),n.unparsedValue=[...n.value]}}for(let r=0;r<t.actions.length;r++){let n=t.actions[r];"id"===n.type&&"set"===n.op&&(n.value=e.get(n.rawValue)||n.rawValue)}}function O(t,e,r){let n;t:for(n=0;n<t.length;n++){let i=t[n];for(let t=0;t<i.conditions.length;t++){let n=i.conditions[t];if("id"===n.type&&n.field===e)switch(n.op){case"is":if(r(i,n.value))continue t;break;case"oneOf":for(let t=0;t<n.value.length;t++)if(r(i,n.value[t]))continue t}}for(let t=0;t<i.actions.length;t++){let n=i.actions[t];if("id"===n.type&&n.field===e&&"set"===n.op&&r(i,n.value))break}}}},function(t,e,r){"use strict";r.d(e,"d",(function(){return u})),r.d(e,"c",(function(){return c})),r.d(e,"b",(function(){return l})),r.d(e,"f",(function(){return f})),r.d(e,"e",(function(){return d})),r.d(e,"h",(function(){return h})),r.d(e,"g",(function(){return g})),r.d(e,"a",(function(){return p}));var n=r(22),i=r(79);let o={};class a{constructor(t){let{id:e}=t;this.id=e||n.a()}async createFromPassword(t){let{password:e,salt:r}=t;this.value=await i.a({secret:e,salt:r})}async createFromBase64(t){this.value=await i.d(t)}getId(){return this.id}getValue(){return this.value}serialize(){return{id:this.id,base64:this.value.base64}}}function s(t){if(null==t||null==o[t])throw new Error("missing-key");return o[t]}function u(t){return t in o}function c(t,e){return i.c(s(e),t)}function l(t,e){return i.b(s(e.keyId),t,e)}function f(t){return i.e(t)}async function d(t){let e;t instanceof a?e=t:(e=new a({id:t.id}),await e.createFromBase64(t.base64)),o[e.getId()]=e}function h(t){delete o[t.getId()]}function g(){o={}}async function p(t){let{id:e,password:r,salt:n}=t,i=new a({id:e});return await i.createFromPassword({password:r,salt:n}),i}},function(t,e,r){"use strict";r.d(e,"d",(function(){return o})),r.d(e,"b",(function(){return a})),r.d(e,"e",(function(){return s})),r.d(e,"a",(function(){return u})),r.d(e,"c",(function(){return c}));let n=i();function i(){return new Promise((t,e)=>{let r=indexedDB.open("actual",9);r.onupgradeneeded=function(t){let e=t.target.result;e.objectStoreNames.contains("filesystem")&&e.deleteObjectStore("filesystem",{keyPath:"filepath"}),e.objectStoreNames.contains("messages")&&e.deleteObjectStore("messages",{keyPath:"filepath"}),e.objectStoreNames.contains("asyncStorage")||e.createObjectStore("asyncStorage"),e.objectStoreNames.contains("files")||e.createObjectStore("files",{keyPath:"filepath"})},r.onblocked=t=>console.log("blocked",t),r.onerror=t=>{console.log("openRequest error"),e(new Error("indexeddb-failure: Could not open IndexedDB"))},r.onsuccess=function(e){let r=e.target.result;r.onversionchange=()=>{r.close()},r.onerror=function(t){if(console.log("Database error: "+(t.target&&t.target.error)),t.target&&t.target.error){if("QuotaExceededError"===t.target.error.name)throw new Error("indexeddb-quota-error")}},t(r)}})}const o=function(t,e){let r=t.transaction([e],"readwrite");return{trans:r,store:r.objectStore(e)}},a=async function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t;return new Promise((n,i)=>{let o=t.get(e);o.onsuccess=t=>{n(r(o.result))},o.onerror=t=>i(t)})},s=async function(t,e){return new Promise((r,n)=>{let i=t.put(e);i.onsuccess=t=>r(void 0),i.onerror=t=>n(t)})},u=async function(t,e){return new Promise((r,n)=>{let i=t.delete(e);i.onsuccess=t=>r(void 0),i.onerror=t=>n(t)})},c=function(){return n}},function(t,e,r){"use strict";r.d(e,"b",(function(){return R})),r.d(e,"c",(function(){return N})),r.d(e,"d",(function(){return U})),r.d(e,"a",(function(){return F})),r.d(e,"f",(function(){return P})),r.d(e,"e",(function(){return W}));var n=r(42),i=r(146),o=r(9),a=r(22),s=r(1),u=r(61),c=r(5),l=r(0),f=r(4),d=r(27),h=r(15),g=r(7),p=r(94);var m=new Set(["for","and","nor","but","or","yet","so","a","an","the","aboard","about","above","across","after","against","along","amid","among","anti","around","as","at","before","behind","below","beneath","beside","besides","between","beyond","but","by","concerning","considering","despite","down","during","except","excepting","excluding","following","for","from","in","inside","into","like","minus","near","of","off","on","onto","opposite","over","past","per","plus","regarding","round","save","since","than","through","to","toward","towards","under","underneath","unlike","until","up","upon","versus","via","with","within","without"]);var y=["CLI","API","HTTP","HTTPS","JSX","DNS","URL","CI","CDN","GitHub","CSS","JS","JavaScript","TypeScript","HTML","WordPress","JavaScript","Next.js","Node.js"];let b="[0-9A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶ-ͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԣԱ-Ֆՙա-ևא-תװ-ײء-يٮ-ٯٱ-ۓەۥ-ۦۮ-ۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴ-ߵߺऄ-हऽॐक़-ॡॱ-ॲॻ-ॿঅ-ঌএ-ঐও-নপ-রলশ-হঽৎড়-ঢ়য়-ৡৰ-ৱਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલ-ળવ-હઽૐૠ-ૡଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହଽଡ଼-ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘ-ౙౠ-ౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠ-ೡഅ-ഌഎ-ഐഒ-നപ-ഹഽൠ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะา-ำเ-ๆກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ະາ-ຳຽເ-ໄໆໜ-ໝༀཀ-ཇཉ-ཬྈ-ྋက-ဪဿၐ-ၕၚ-ၝၡၥ-ၦၮ-ၰၵ-ႁႎႠ-Ⴥა-ჺჼᄀ-ᅙᅟ-ᆢᆨ-ᇹሀ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙶᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦩᧁ-ᧇᨀ-ᨖᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮ-ᮯᰀ-ᰣᱍ-ᱏᱚ-ᱽᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₔℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-Ɐⱱ-ⱽⲀ-ⳤⴀ-ⴥⴰ-ⵥⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆷㇰ-ㇿ㐀䶵一鿃ꀀ-ꒌꔀ-ꘌꘐ-ꘟꘪ-ꘫꙀ-ꙟꙢ-ꙮꙿ-ꚗꜗ-ꜟꜢ-ꞈꞋ-ꞌꟻ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꤊ-ꤥꤰ-ꥆꨀ-ꨨꩀ-ꩂꩄ-ꩋ가힣豈-鶴侮-頻並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]",_=new RegExp(`(?:(?:(\\s?(?:^|[.\\(\\)!?;:"-])\\s*)(${b}))|(${b}))(${b}*[’']*${b}*)`,"g"),v=t=>t.map(t=>[new RegExp(`\\b${t}\\b`,"gi"),t]);function w(t){const e=t[0];return/\s/.test(e)?t.substr(1):/[()]/.test(e)?null:t}function E(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{special:void 0};t=t.toLowerCase().replace(_,(function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;const o=w(t);if(!o)return t;if(!r){const t=n+i;if(m.has(t))return o}return e+(n||r).toUpperCase()+i}));const r=e.special||[],n=[...y,...r],i=v(n);return i.forEach(e=>{let[r,n]=e;t=t.replace(r,n)}),t}var S=r(29),O=r(53);function T(t,e){return{type:"BankSyncError",category:t,code:e}}function A(t,e){let{subtransactions:r,...n}=Object(u.c)({...t,is_parent:!0,subtransactions:e.map((e,r)=>Object(u.b)(t,{...e,sort_order:0-r}))});return[n,...r]}function M(t){switch(t.type){case"credit":case"loan":return-t.balances.current;default:return t.balances.current}}async function I(t,e){await l.runQuery("UPDATE accounts SET balance_current = ? WHERE id = ?",[Object(c.a)(e),t])}async function R(t,e,r){let n=await Object(d.b)(Object(h.a)().PLAID_SERVER+"/accounts",{userId:t,key:e,item_id:r}),{accounts:i}=n;return i.forEach(t=>{t.balances.current=M(t)}),i}async function N(t,e,r){const n=await o.a("user-token");if(n){let i=await Object(d.b)(Object(h.a)().NORDIGEN_SERVER+"/accounts",{userId:t,key:e,item_id:r},{"X-ACTUAL-TOKEN":n}),{accounts:o}=i;return o.forEach(t=>{t.balances.current=M(t)}),o}}function k(t){return{imported_id:t.transaction_id,payee_name:t.name,imported_payee:t.name,amount:-Object(c.a)(t.amount),date:t.date}}async function D(t,e,r,n,i,o){let a=[],u=null,c=0,l=0;for(;;){const f=s.d(),g=await Object(d.b)(Object(h.a)().PLAID_SERVER+"/transactions",{userId:t,key:e,item_id:""+n,account_id:r,start_date:i,end_date:f,count:100,offset:c});if(g.error_code)throw T(g.error_type,g.error_code);if(0===g.transactions.length)break;if(l+=g.transactions.length,a=a.concat(g.transactions.filter(t=>!t.pending)),u=M(g.accounts[0]),l===g.total_transactions||null!=o&&a.length>=o)break;c+=100}return a=null!=o?a.slice(0,o):a,{transactions:a.map(k),accountBalance:u}}async function j(t,e,r,n,i){let a=await o.a("user-token");if(a){const o=(new Date).toISOString().split("T")[0],s=await Object(d.b)(Object(h.a)().NORDIGEN_SERVER+"/transactions",{userId:t,key:e,requisitionId:n,accountId:r,startDate:i,endDate:o},{"X-ACTUAL-TOKEN":a});if(s.error_code)throw T(s.error_type,s.error_code);const{transactions:{all:u},balances:c,startingBalance:l}=s;return{transactions:u,accountBalance:c,startingBalance:l}}}async function C(t,e,r){if(null==t.payee&&e){let t=r.get(e.toLowerCase());if(t=t||await l.getPayeeByName(e),null!=t)return t.id;{let t={id:a.a(),name:e};return r.set(e.toLowerCase(),t),t.id}}return t.payee}async function L(t,e){let{rawPayeeName:r=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=new Map,i=[];for(let o of t){if(null==o.date)throw new Error("`date` is required when adding a transaction");let{payee_name:t,subtransactions:a,...s}=o;if(o=s,t){let e=t.trim();t=""===e?null:r?e:E(e)}o.imported_payee=o.imported_payee||t,o.imported_payee&&(o.imported_payee=o.imported_payee.trim()),o.account=e,o.payee=await C(o,t,n),i.push({payee_name:t,subtransactions:a?a.map(t=>({...t,account:e})):null,trans:o})}return{normalized:i,payeesToCreate:n}}async function x(t,e){let r=new Set(e.map(t=>t.payee));await Object(g.c)(async()=>{for(let e of t.values())r.has(e.id)&&await l.insertPayee(e)})}async function B(t,e){const r=new Set,n=[],i=[];let{normalized:o,payeesToCreate:u}=await async function(t,e){let r=new Map,n=[];for(let i of t){if(i.date||(i.date=i.valueDate||i.bookingDate),i.amount||(i.amount=i.transactionAmount.amount),null==i.date)throw new Error("`date` is required when adding a transaction");let t;if(i.amount>0||Object.is(Number(i.amount),0)){const e=[];e.push(E(i.debtorName||i.remittanceInformationUnstructured||(i.remittanceInformationUnstructuredArray||[]).join(", "))),i.debtorAccount&&i.debtorAccount.iban&&e.push("("+i.debtorAccount.iban.slice(0,4)+" XXX "+i.debtorAccount.iban.slice(-4)+")"),t=e.join(" ")}else{const e=[];e.push(E(i.creditorName||i.remittanceInformationUnstructured||(i.remittanceInformationUnstructuredArray||[]).join(", "))),i.creditorAccount&&i.creditorAccount.iban&&e.push("("+i.creditorAccount.iban.slice(0,4)+" XXX "+i.creditorAccount.iban.slice(-4)+")"),t=e.join(" ")}i.imported_payee=i.imported_payee||t,i.imported_payee&&(i.imported_payee=i.imported_payee.trim()),i.account=e,i.payee=await C(i,t,r),i.cleared=Boolean(i.booked),n.push({payee_name:t,trans:{amount:Object(c.a)(i.amount),payee:i.payee,account:i.account,date:i.date,notes:i.remittanceInformationUnstructured||(i.remittanceInformationUnstructuredArray||[]).join(", "),imported_id:i.transactionId,imported_payee:i.imported_payee,cleared:i.cleared}})}return{normalized:n,payeesToCreate:r}}(e,t),f=[];for(let{payee_name:e,trans:n,subtransactions:i}of o){n=Object(S.j)(n);let o=null,a=null;n.imported_id&&(o=await l.first("SELECT * FROM v_transactions WHERE imported_id = ? AND account = ?",[n.imported_id,t]),o&&r.add(o.id)),o||(a=await l.all("SELECT id, date, imported_id, payee, category, notes FROM v_transactions\n WHERE date >= ? AND date <= ? AND amount = ? AND account = ? AND is_child = 0",[l.toDateRepr(s.q(n.date,4)),l.toDateRepr(s.a(n.date,1)),n.amount||0,t])),f.push({payee_name:e,trans:n,subtransactions:i,match:o,fuzzyDataset:a})}let d=f.map(t=>{if(!t.match&&t.fuzzyDataset){let e=t.fuzzyDataset.find(e=>!r.has(e.id)&&t.trans.payee===e.payee);if(e)return r.add(e.id),{...t,match:e}}return t}).map(t=>{if(!t.match&&t.fuzzyDataset){let e=t.fuzzyDataset.find(t=>!r.has(t.id));if(e)return r.add(e.id),{...t,match:e}}return t});for(let{trans:t,subtransactions:e,match:r}of d)if(r){let e={...r,cleared:1===r.cleared,date:l.fromDateRepr(r.date)};const i={date:t.date,imported_id:t.imported_id||null,payee:e.payee||t.payee||null,category:e.category||t.category||null,imported_payee:t.imported_payee||null,notes:e.notes||t.notes||null,cleared:null==t.cleared||t.cleared};Object(c.j)(e,i,Object.keys(i))&&n.push({id:e.id,...i})}else{let r={...t,id:a.a(),category:t.category||null,cleared:null==t.cleared||t.cleared};e&&e.length>0?i.push(...A(r,e)):i.push(r)}return await x(u,[...i,...n]),await Object(O.a)({added:i,updated:n}),{added:i.map(t=>t.id),updated:n.map(t=>t.id)}}async function U(t,e){const r=new Set,n=[],i=[];let{normalized:o,payeesToCreate:u}=await L(e,t),f=[];for(let{payee_name:e,trans:n,subtransactions:i}of o){n=Object(S.j)(n);let o=null,a=null;n.imported_id&&(o=await l.first("SELECT * FROM v_transactions WHERE imported_id = ? AND account = ?",[n.imported_id,t]),o&&r.add(o.id)),o||(a=await l.all("SELECT id, date, imported_id, payee, category, notes FROM v_transactions\n WHERE date >= ? AND date <= ? AND amount = ? AND account = ? AND is_child = 0",[l.toDateRepr(s.q(n.date,4)),l.toDateRepr(s.a(n.date,1)),n.amount||0,t])),f.push({payee_name:e,trans:n,subtransactions:i,match:o,fuzzyDataset:a})}let d=f.map(t=>{if(!t.match&&t.fuzzyDataset){let e=t.fuzzyDataset.find(e=>!r.has(e.id)&&t.trans.payee===e.payee);if(e)return r.add(e.id),{...t,match:e}}return t}).map(t=>{if(!t.match&&t.fuzzyDataset){let e=t.fuzzyDataset.find(t=>!r.has(t.id));if(e)return r.add(e.id),{...t,match:e}}return t});for(let{trans:t,subtransactions:e,match:r}of d)if(r){let e={...r,cleared:1===r.cleared,date:l.fromDateRepr(r.date)};const i={date:t.date,imported_id:t.imported_id||null,payee:e.payee||t.payee||null,category:e.category||t.category||null,imported_payee:t.imported_payee||null,notes:e.notes||t.notes||null,cleared:null==t.cleared||t.cleared};Object(c.j)(e,i,Object.keys(i))&&n.push({id:e.id,...i})}else{let r={...t,id:a.a(),category:t.category||null,cleared:null==t.cleared||t.cleared};e&&e.length>0?i.push(...A(r,e)):i.push(r)}return await x(u,[...i,...n]),await Object(O.a)({added:i,updated:n}),{added:i.map(t=>t.id),updated:n.map(t=>t.id)}}async function F(t,e){let{runTransfers:r=!0}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=[];let i,{normalized:o,payeesToCreate:s}=await L(e,t,{rawPayeeName:!0});for(let{trans:e,subtransactions:r}of o){e=Object(S.j)(e);let i={id:a.a(),...e,account:t,cleared:null==e.cleared||e.cleared};r&&r.length>0?n.push(...A(i,r)):n.push(i)}if(await x(s,n),r){let t=await Object(O.a)({added:n});i=t.added.map(t=>t.id)}else await Object(g.c)(async()=>{i=await Promise.all(n.map(async t=>l.insertTransaction(t)))});return i}async function P(t,e,r,o,a){const u=await l.first("SELECT * FROM v_transactions WHERE account = ? ORDER BY date DESC LIMIT 1",[r]),c=await l.select("accounts",r);if(u){const n=await l.first("SELECT date FROM v_transactions WHERE account = ? ORDER BY date ASC LIMIT 1",[r]),i=l.fromDateRepr(n.date);let c=s.q(l.fromDateRepr(u.date),31);c<i&&(c=i);let{transactions:d,accountBalance:h}=await j(t,e,o,a,c);return 0===d.length?{added:[],updated:[]}:(d=d.map(t=>({...t,account:r})),Object(f.e)(async()=>{const t=await B(r,d);return await I(r,h),t}))}{const u=s.q(s.d(),30),{transactions:d,startingBalance:h}=await j(t,e,o,a,n.a(i.a(u),"yyyy-MM-dd")),g=d[d.length-1],m=d.length>0?g.valueDate||g.bookingDate:s.d(),y=await Object(p.a)();return Object(f.e)(async()=>{let t=await l.insertTransaction({account:r,amount:h,category:0===c.offbudget?y.category:null,payee:y.id,date:m,cleared:!0,starting_balance_flag:!0}),e=await B(r,d);return{...e,added:[t,...e.added]}})}}async function W(t,e,r,o,a){const u=await l.first("SELECT * FROM v_transactions WHERE account = ? ORDER BY date DESC LIMIT 1",[r]);if(u){const n=await l.first("SELECT date FROM v_transactions WHERE account = ? ORDER BY date ASC LIMIT 1",[r]),i=l.fromDateRepr(n.date);let c=s.q(l.fromDateRepr(u.date),31);c<i&&(c=i);let{transactions:d,accountBalance:h}=await D(t,e,o,a,c);return 0===d.length?{added:[],updated:[]}:(d=d.map(t=>({...t,account:r})),Object(f.e)(async()=>{const t=await U(r,d);return await I(r,h),t}))}{const u=await l.select("accounts",r),c=s.q(s.d(),0===u.offbudget?1:30),{transactions:d}=await D(t,e,o,a,n.a(i.a(c),"yyyy-MM-dd"));let h=u.balance_current;const g=d.reduce((t,e)=>t-e.amount,h),m=d.length>0?d[d.length-1].date:s.d();let y=await Object(p.a)();return Object(f.e)(async()=>{let t=await l.insertTransaction({account:r,amount:g,category:0===u.offbudget?y.category:null,payee:y.id,date:m,cleared:!0,starting_balance_flag:!0}),e=await U(r,d);return{...e,added:[t,...e.added]}})}}},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return _})),r.d(e,"h",(function(){return v})),r.d(e,"c",(function(){return w})),r.d(e,"d",(function(){return E})),r.d(e,"i",(function(){return S})),r.d(e,"f",(function(){return O})),r.d(e,"g",(function(){return T})),r.d(e,"e",(function(){return A})),r.d(e,"b",(function(){return M}));var n=r(90),i=r.n(n),o=r(9),a=r(66),s=r(2),u=r(13),c=r(22),l=r(1),f=r(35),d=r(11),h=r(4),g=r(27),p=r(6),m=r(15);async function y(t){return 200!==t.status?t.text().then(e=>{throw new d.d(t.status,e)}):t}async function b(){let t=await Object(a.a)(...arguments);return t=await y(t),t.json()}async function _(){let t,e=await o.a("user-token"),{cloudFileId:r,encryptKeyId:n}=p.b();try{t=await Object(g.b)(Object(m.a)().SYNC_SERVER+"/user-get-key",{token:e,fileId:r})}catch(t){return console.log(t),{error:{reason:"network"}}}return{valid:t.id==n&&(null==n||f.d(n))}}async function v(t){let e=await o.a("user-token"),{cloudFileId:r}=p.b();try{await Object(g.b)(Object(m.a)().SYNC_SERVER+"/reset-user-file",{token:e,fileId:r})}catch(t){return t instanceof d.e?{error:{reason:"unauthorized"===t.reason?"unauthorized":"network"}}:{error:{reason:"internal"}}}if(t)try{await Object(g.b)(Object(m.a)().SYNC_SERVER+"/user-create-key",{token:e,fileId:r,keyId:t.key.getId(),keySalt:t.salt,testContent:t.testContent})}catch(t){return t instanceof d.e?{error:{reason:"network"}}:{error:{reason:"internal"}}}return{}}async function w(){let{id:e,budgetName:r}=p.b();if(!r)return null;let n=s.e(e),o=new i.a;return await Object(h.e)(async()=>{let e=await s.n(s.j(n,"db.sqlite"),"binary"),r=await u.g(e);u.d(r,"\n DELETE FROM kvcache;\n DELETE FROM kvcache_key;\n ");let i=u.e(r);u.c(r);let a=JSON.parse(await s.n(s.j(n,"metadata.json")));a.resetClock=!0;let c=t.from(JSON.stringify(a),"utf8");o.addFile("db.sqlite",i),o.addFile("metadata.json",c)}),t.from(o.toBuffer())}async function E(t,e){let r,n;try{r=new i.a(e),n=r.getEntries()}catch(t){throw Object(d.b)("not-zip-file")}let o=n.find(t=>t.entryName.includes("db.sqlite")),a=n.find(t=>t.entryName.includes("metadata.json"));if(!o||!a)throw Object(d.b)("invalid-zip-file");let u,c=r.readFile(o),f=r.readFile(a);try{u=JSON.parse(f.toString("utf8"))}catch(t){throw Object(d.b)("invalid-meta-file")}u={...u,cloudFileId:t.fileId,groupId:t.groupId,lastUploaded:l.d(),encryptKeyId:t.encryptMeta?t.encryptMeta.keyId:null};let h=s.e(u.id);if(await s.d(h)){let t=s.j(h,"db.sqlite"),e=s.j(h,"metadata.json");await s.d(t)&&await s.p(t),await s.d(e)&&await s.p(e)}else await s.m(h);return await s.q(s.j(h,"db.sqlite"),c),await s.q(s.j(h,"metadata.json"),JSON.stringify(u)),{id:u.id}}async function S(){let t=await o.a("user-token");if(!t)throw Object(d.c)("unauthorized");let e=await w();if(null==e)return;let r,{id:n,groupId:i,budgetName:a,cloudFileId:s,encryptKeyId:u}=p.b(),h=e,g=null;if(u){let t;try{t=await f.c(e,u)}catch(t){throw Object(d.c)("encrypt-failure",{isMissingKey:"missing-key"===t.message})}h=t.value,g=t.meta}s||(s=c.a());try{r=await b(Object(m.a)().SYNC_SERVER+"/upload-user-file",{method:"POST",headers:{"Content-Length":h.length,"Content-Type":"application/encrypted-file","X-ACTUAL-TOKEN":t,"X-ACTUAL-FILE-ID":s,"X-ACTUAL-NAME":encodeURIComponent(a),"X-ACTUAL-FORMAT":2,...g?{"X-ACTUAL-ENCRYPT-META":JSON.stringify(g)}:null,...i?{"X-ACTUAL-GROUP-ID":i}:null},body:h})}catch(t){if(console.log("Upload failure",t),t instanceof d.e)throw Object(d.c)("unauthorized"===t.reason?"unauthorized":t.reason||"network");throw Object(d.c)("internal")}if("ok"!==r.status)throw Object(d.c)("internal");p.b()&&p.b().id===n&&await p.d({lastUploaded:l.d(),cloudFileId:s,groupId:r.groupId})}async function O(){let{cloudFileId:t,groupId:e,lastUploaded:r}=p.b(),n=r&&l.a(r,7),i=l.d();r&&i<n||t&&e&&S().catch(t=>{})}async function T(t){const[[,e]]=await o.c(["user-token"]);await Object(g.b)(Object(m.a)().SYNC_SERVER+"/delete-user-file",{token:e,fileId:t})}async function A(){let t,e=await o.a("user-token");if(!e)return null;try{t=await b(Object(m.a)().SYNC_SERVER+"/list-user-files",{headers:{"X-ACTUAL-TOKEN":e}})}catch(t){return console.log("Error",t),null}return"error"===t.status?null:t.data.map(t=>({...t,hasKey:f.d(t.encryptKeyId)}))}async function M(e){let r,n,i=await o.a("user-token");try{r=await Object(a.a)(Object(m.a)().SYNC_SERVER+"/download-user-file",{headers:{"X-ACTUAL-TOKEN":i,"X-ACTUAL-FILE-ID":e}}).then(y).then(e=>e.arrayBuffer?e.arrayBuffer().then(e=>t.from(e)):e.buffer())}catch(t){throw console.log("Download failure",t),Object(d.b)("download-failure")}try{n=await b(Object(m.a)().SYNC_SERVER+"/get-user-file-info",{headers:{"X-ACTUAL-TOKEN":i,"X-ACTUAL-FILE-ID":e}})}catch(t){throw Object(d.b)("internal",{fileId:e})}if("ok"!==n.status)throw Object(d.b)("internal",{fileId:e});let s=n.data;if(s.encryptMeta)try{r=await f.b(r,s.encryptMeta)}catch(t){throw Object(d.b)("decrypt-failure",{isMissingKey:"missing-key"===t.message})}return E(s,r)}}).call(this,r(16).Buffer)},function(t,e,r){(function(t){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(331).Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function c(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,a=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=u(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,l=r;l<s;l+=n)u=c(t,l,l+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var f=1;for(u=c(t,l,t.length,e),l=0;l<a;l++)f*=e;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c<n;c++){for(var l=u>>>26,f=67108863&u,d=Math.min(c,e.length-1),h=Math.max(0,c-t.length+1);h<=d;h++){var g=c-h|0;l+=(a=(i=0|t.words[g])*(o=0|e.words[h])+f)/67108864|0,f=67108863&a}r.words[c]=0|f,u=0|l}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);r=0!==(o=s>>>24-i&16777215)||a!==this.length-1?l[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=f[t],h=d[t];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(h).toString(t);r=(g=g.idivn(h)).isZero()?p+r:l[c-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),l=this.clone();if(u){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a<n.length;a++)o=(e=(0|r.words[a])-(0|n.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var g=function(t,e,r){var n,i,o,a=t.words,s=e.words,u=r.words,c=0,l=0|a[0],f=8191&l,d=l>>>13,h=0|a[1],g=8191&h,p=h>>>13,m=0|a[2],y=8191&m,b=m>>>13,_=0|a[3],v=8191&_,w=_>>>13,E=0|a[4],S=8191&E,O=E>>>13,T=0|a[5],A=8191&T,M=T>>>13,I=0|a[6],R=8191&I,N=I>>>13,k=0|a[7],D=8191&k,j=k>>>13,C=0|a[8],L=8191&C,x=C>>>13,B=0|a[9],U=8191&B,F=B>>>13,P=0|s[0],W=8191&P,z=P>>>13,H=0|s[1],q=8191&H,V=H>>>13,G=0|s[2],Y=8191&G,$=G>>>13,K=0|s[3],Z=8191&K,J=K>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ft=8191<,dt=lt>>>13,ht=0|s[9],gt=8191&ht,pt=ht>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(c+(n=Math.imul(f,W))|0)+((8191&(i=(i=Math.imul(f,z))+Math.imul(d,W)|0))<<13)|0;c=((o=Math.imul(d,z))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(g,W),i=(i=Math.imul(g,z))+Math.imul(p,W)|0,o=Math.imul(p,z);var yt=(c+(n=n+Math.imul(f,q)|0)|0)+((8191&(i=(i=i+Math.imul(f,V)|0)+Math.imul(d,q)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,W),i=(i=Math.imul(y,z))+Math.imul(b,W)|0,o=Math.imul(b,z),n=n+Math.imul(g,q)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(p,q)|0,o=o+Math.imul(p,V)|0;var bt=(c+(n=n+Math.imul(f,Y)|0)|0)+((8191&(i=(i=i+Math.imul(f,$)|0)+Math.imul(d,Y)|0))<<13)|0;c=((o=o+Math.imul(d,$)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(v,W),i=(i=Math.imul(v,z))+Math.imul(w,W)|0,o=Math.imul(w,z),n=n+Math.imul(y,q)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,V)|0,n=n+Math.imul(g,Y)|0,i=(i=i+Math.imul(g,$)|0)+Math.imul(p,Y)|0,o=o+Math.imul(p,$)|0;var _t=(c+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,J)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(S,W),i=(i=Math.imul(S,z))+Math.imul(O,W)|0,o=Math.imul(O,z),n=n+Math.imul(v,q)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(w,q)|0,o=o+Math.imul(w,V)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,$)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,$)|0,n=n+Math.imul(g,Z)|0,i=(i=i+Math.imul(g,J)|0)+Math.imul(p,Z)|0,o=o+Math.imul(p,J)|0;var vt=(c+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(A,W),i=(i=Math.imul(A,z))+Math.imul(M,W)|0,o=Math.imul(M,z),n=n+Math.imul(S,q)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(O,q)|0,o=o+Math.imul(O,V)|0,n=n+Math.imul(v,Y)|0,i=(i=i+Math.imul(v,$)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,$)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,J)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var wt=(c+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(d,rt)|0))<<13)|0;c=((o=o+Math.imul(d,nt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(R,W),i=(i=Math.imul(R,z))+Math.imul(N,W)|0,o=Math.imul(N,z),n=n+Math.imul(A,q)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(M,q)|0,o=o+Math.imul(M,V)|0,n=n+Math.imul(S,Y)|0,i=(i=i+Math.imul(S,$)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,$)|0,n=n+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,J)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,J)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,nt)|0;var Et=(c+(n=n+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(D,W),i=(i=Math.imul(D,z))+Math.imul(j,W)|0,o=Math.imul(j,z),n=n+Math.imul(R,q)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(N,q)|0,o=o+Math.imul(N,V)|0,n=n+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,$)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,$)|0,n=n+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,J)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,J)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0,n=n+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(c+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(L,W),i=(i=Math.imul(L,z))+Math.imul(x,W)|0,o=Math.imul(x,z),n=n+Math.imul(D,q)|0,i=(i=i+Math.imul(D,V)|0)+Math.imul(j,q)|0,o=o+Math.imul(j,V)|0,n=n+Math.imul(R,Y)|0,i=(i=i+Math.imul(R,$)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,$)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,J)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,n=n+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ct)|0;var Ot=(c+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,dt)|0)+Math.imul(d,ft)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(U,W),i=(i=Math.imul(U,z))+Math.imul(F,W)|0,o=Math.imul(F,z),n=n+Math.imul(L,q)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(x,q)|0,o=o+Math.imul(x,V)|0,n=n+Math.imul(D,Y)|0,i=(i=i+Math.imul(D,$)|0)+Math.imul(j,Y)|0,o=o+Math.imul(j,$)|0,n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,J)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,n=n+Math.imul(g,ft)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,dt)|0;var Tt=(c+(n=n+Math.imul(f,gt)|0)|0)+((8191&(i=(i=i+Math.imul(f,pt)|0)+Math.imul(d,gt)|0))<<13)|0;c=((o=o+Math.imul(d,pt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(U,q),i=(i=Math.imul(U,V))+Math.imul(F,q)|0,o=Math.imul(F,V),n=n+Math.imul(L,Y)|0,i=(i=i+Math.imul(L,$)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,$)|0,n=n+Math.imul(D,Z)|0,i=(i=i+Math.imul(D,J)|0)+Math.imul(j,Z)|0,o=o+Math.imul(j,J)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,at)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,at)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,ct)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ct)|0,n=n+Math.imul(y,ft)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,dt)|0;var At=(c+(n=n+Math.imul(g,gt)|0)|0)+((8191&(i=(i=i+Math.imul(g,pt)|0)+Math.imul(p,gt)|0))<<13)|0;c=((o=o+Math.imul(p,pt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(U,Y),i=(i=Math.imul(U,$))+Math.imul(F,Y)|0,o=Math.imul(F,$),n=n+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,J)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,J)|0,n=n+Math.imul(D,Q)|0,i=(i=i+Math.imul(D,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ct)|0,n=n+Math.imul(v,ft)|0,i=(i=i+Math.imul(v,dt)|0)+Math.imul(w,ft)|0,o=o+Math.imul(w,dt)|0;var Mt=(c+(n=n+Math.imul(y,gt)|0)|0)+((8191&(i=(i=i+Math.imul(y,pt)|0)+Math.imul(b,gt)|0))<<13)|0;c=((o=o+Math.imul(b,pt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(U,Z),i=(i=Math.imul(U,J))+Math.imul(F,Z)|0,o=Math.imul(F,J),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(D,rt)|0,i=(i=i+Math.imul(D,nt)|0)+Math.imul(j,rt)|0,o=o+Math.imul(j,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,n=n+Math.imul(S,ft)|0,i=(i=i+Math.imul(S,dt)|0)+Math.imul(O,ft)|0,o=o+Math.imul(O,dt)|0;var It=(c+(n=n+Math.imul(v,gt)|0)|0)+((8191&(i=(i=i+Math.imul(v,pt)|0)+Math.imul(w,gt)|0))<<13)|0;c=((o=o+Math.imul(w,pt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(U,Q),i=(i=Math.imul(U,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(D,ot)|0,i=(i=i+Math.imul(D,at)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,at)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,dt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,dt)|0;var Rt=(c+(n=n+Math.imul(S,gt)|0)|0)+((8191&(i=(i=i+Math.imul(S,pt)|0)+Math.imul(O,gt)|0))<<13)|0;c=((o=o+Math.imul(O,pt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(U,rt),i=(i=Math.imul(U,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,n=n+Math.imul(D,ut)|0,i=(i=i+Math.imul(D,ct)|0)+Math.imul(j,ut)|0,o=o+Math.imul(j,ct)|0,n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,dt)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,dt)|0;var Nt=(c+(n=n+Math.imul(A,gt)|0)|0)+((8191&(i=(i=i+Math.imul(A,pt)|0)+Math.imul(M,gt)|0))<<13)|0;c=((o=o+Math.imul(M,pt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(U,ot),i=(i=Math.imul(U,at))+Math.imul(F,ot)|0,o=Math.imul(F,at),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,n=n+Math.imul(D,ft)|0,i=(i=i+Math.imul(D,dt)|0)+Math.imul(j,ft)|0,o=o+Math.imul(j,dt)|0;var kt=(c+(n=n+Math.imul(R,gt)|0)|0)+((8191&(i=(i=i+Math.imul(R,pt)|0)+Math.imul(N,gt)|0))<<13)|0;c=((o=o+Math.imul(N,pt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(U,ut),i=(i=Math.imul(U,ct))+Math.imul(F,ut)|0,o=Math.imul(F,ct),n=n+Math.imul(L,ft)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(x,ft)|0,o=o+Math.imul(x,dt)|0;var Dt=(c+(n=n+Math.imul(D,gt)|0)|0)+((8191&(i=(i=i+Math.imul(D,pt)|0)+Math.imul(j,gt)|0))<<13)|0;c=((o=o+Math.imul(j,pt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,n=Math.imul(U,ft),i=(i=Math.imul(U,dt))+Math.imul(F,ft)|0,o=Math.imul(F,dt);var jt=(c+(n=n+Math.imul(L,gt)|0)|0)+((8191&(i=(i=i+Math.imul(L,pt)|0)+Math.imul(x,gt)|0))<<13)|0;c=((o=o+Math.imul(x,pt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863;var Ct=(c+(n=Math.imul(U,gt))|0)+((8191&(i=(i=Math.imul(U,pt))+Math.imul(F,gt)|0))<<13)|0;return c=((o=Math.imul(F,pt))+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=yt,u[2]=bt,u[3]=_t,u[4]=vt,u[5]=wt,u[6]=Et,u[7]=St,u[8]=Ot,u[9]=Tt,u[10]=At,u[11]=Mt,u[12]=It,u[13]=Rt,u[14]=Nt,u[15]=kt,u[16]=Dt,u[17]=jt,u[18]=Ct,0!==c&&(u[19]=c,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(g=h),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?h(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var a=i;i=0;for(var s=67108863&n,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,f=(0|t.words[l])*(0|e.words[c]),d=67108863&f;s=67108863&(d=d+s|0),i+=(a=(a=a+(f/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a<o;a++)n[a]=e[t[a]],i[a]=r[t[a]]},m.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var f=u,d=c,h=0;h<a;h++){var g=r[l+h],p=n[l+h],m=r[l+h+a],y=n[l+h+a],b=f*m-d*y;y=f*y+d*m,m=b,r[l+h]=g+m,n[l+h]=p+y,r[l+h+a]=g-m,n[l+h+a]=p-y,h!==s&&(b=u*f-c*d,d=u*d+c*f,f=b)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},m.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},m.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,r,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)r[a]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),a=new Array(n),s=new Array(n),u=new Array(n),c=new Array(n),l=new Array(n),f=new Array(n),d=r.words;d.length=n,this.convert13b(t.words,t.length,a,n),this.convert13b(e.words,e.length,c,n),this.transform(a,o,s,u,n,i),this.transform(c,o,l,f,n,i);for(var h=0;h<n;h++){var g=s[h]*l[h]-u[h]*f[h];u[h]=s[h]*f[h]+u[h]*l[h],s[h]=g}return this.conjugate(s,u,n),this.transform(s,u,d,o,n,i),this.conjugate(d,o,n),this.normalize13b(d,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),p(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=(t.words[n]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<r;this.words[e]=u|a,a=s>>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var f=0|this.words[c];this.words[c]=l<<26-o|f>>>o,l=f&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r)&&!!(this.words[r]&i)},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,u=n.length-i.length;if("mod"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=n.clone()._ishlnsubmul(i,1,u);0===l.negative&&(n=l,s&&(s.words[u]=1));for(var f=u-1;f>=0;f--){var d=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(i,d,f);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=d)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),f=e.clone();!e.isZero();){for(var d=0,h=1;0==(e.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(f)),i.iushrn(1),a.iushrn(1);for(var g=0,p=1;0==(r.words[0]&p)&&g<26;++g,p<<=1);if(g>0)for(r.iushrn(g);g-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(f)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),a.isub(u)):(r.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var f=0,d=1;0==(r.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function _(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function O(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},i(_,b),_.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n<r;n++)e.words[n]=t.words[n];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,n=10;n<t.length;n++){var o=0|t.words[n];t.words[n-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},_.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(v,b),i(w,b),i(E,b),E.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new _;else if("p224"===t)e=new v;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return y[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,i),d=this.pow(t,i.addn(1).iushrn(1)),h=this.pow(t,i),g=a;0!==h.cmp(s);){for(var p=h,m=0;0!==p.cmp(s);m++)p=p.redSqr();n(m<g);var y=this.pow(f,new o(1).iushln(g-m-1));d=d.redMul(y),f=y.redSqr(),h=h.redMul(f),g=m}return d},S.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},S.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var c=e.words[n],l=u-1;l>=0;l--){var f=c>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==a?(a<<=1,a|=f,(4===++s||0===n&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new O(t)},i(O,S),O.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},O.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},O.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},O.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},O.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(84)(t))},function(t,e,r){"use strict";r.d(e,"d",(function(){return o})),r.d(e,"b",(function(){return a})),r.d(e,"e",(function(){return s})),r.d(e,"a",(function(){return u})),r.d(e,"c",(function(){return c}));var n=r(1),i=r(30);function o(t,e,r){let i=n.d();return e?"completed":r?"paid":t===i?"due":t>i&&t<=n.a(i,7)?"upcoming":t<i?"missed":"scheduled"}function a(t){let e=t.map(t=>{let e=t._conditions.find(t=>"date"===t.field);return{$and:{schedule:t.id,date:{$gte:e&&"is"===e.op?t.next_date:n.q(t.next_date,2)}}}});return Object(i.b)("transactions").filter({$or:e}).orderBy({date:"desc"}).groupBy("schedule").select(["schedule","date"])}function s(t){let e={start:n.l(t.start),frequency:t.frequency.toUpperCase(),byHourOfDay:[12]};t.interval&&(e.interval=t.interval);switch(t.frequency){case"daily":case"weekly":return[e];case"monthly":if(t.patterns&&t.patterns.length>0){let r=t.patterns.filter(t=>"day"===t.type),n=t.patterns.filter(t=>"day"!==t.type);return[r.length>0&&{...e,byDayOfMonth:r.map(t=>t.value)},n.length>0&&{...e,byDayOfWeek:n.map(t=>{return[(e=t.type,e.slice(0,2).toUpperCase()),t.value];var e})}].filter(Boolean)}return[e];case"yearly":return[e];default:throw new Error("Invalid recurring date config")}}function u(t){return{payee:t.find(t=>"is"===t.op&&"payee"===t.field)||t.find(t=>"is"===t.op&&"description"===t.field)||null,account:t.find(t=>"is"===t.op&&"account"===t.field)||t.find(t=>"is"===t.op&&"acct"===t.field)||null,amount:t.find(t=>("is"===t.op||"isapprox"===t.op||"isbetween"===t.op)&&"amount"===t.field)||null,date:t.find(t=>("is"===t.op||"isapprox"===t.op)&&"date"===t.field)||null}}function c(t){return t&&"number"!=typeof t?Math.round((t.num1+t.num2)/2):t}},function(t,e,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var i=r(110),o=r(149),a=r(262),s=r(282),u=s.fsSyncMethods,c=s.fsAsyncMethods,l=r(82),f=l.constants.F_OK,d=l.constants.R_OK,h=l.constants.W_OK,g=l.constants.X_OK;function p(t){for(var e={F_OK:f,R_OK:d,W_OK:h,X_OK:g,constants:l.constants,Stats:i.default,Dirent:o.default},r=0,n=u;r<n.length;r++){"function"==typeof t[m=n[r]]&&(e[m]=t[m].bind(t))}for(var s=0,p=c;s<p.length;s++){var m;"function"==typeof t[m=p[s]]&&(e[m]=t[m].bind(t))}return e.StatWatcher=t.StatWatcher,e.FSWatcher=t.FSWatcher,e.WriteStream=t.WriteStream,e.ReadStream=t.ReadStream,e.promises=t.promises,e._toUnixTimestamp=a.toUnixTimestamp,e}e.Volume=a.Volume,e.vol=new a.Volume,e.createFsFromVolume=p,e.fs=p(e.vol),t.exports=n(n({},t.exports),e.fs),t.exports.semantic=!0},function(t,e,r){"use strict";r.d(e,"a",(function(){return tt}));var n=r(97),i=r(28),o=r(17),a=r(8);function s(t,e){Object(a.a)(2,arguments);var r=Object(o.a)(t).getTime(),n=Object(i.a)(e);return new Date(r+n)}function u(t,e){Object(a.a)(2,arguments);var r=Object(i.a)(e);return s(t,-r)}function c(t){Object(a.a)(1,arguments);var e=1,r=Object(o.a)(t),n=r.getUTCDay(),i=(n<e?7:0)+n-e;return r.setUTCDate(r.getUTCDate()-i),r.setUTCHours(0,0,0,0),r}function l(t){Object(a.a)(1,arguments);var e=Object(o.a)(t),r=e.getUTCFullYear(),n=new Date(0);n.setUTCFullYear(r+1,0,4),n.setUTCHours(0,0,0,0);var i=c(n),s=new Date(0);s.setUTCFullYear(r,0,4),s.setUTCHours(0,0,0,0);var u=c(s);return e.getTime()>=i.getTime()?r+1:e.getTime()>=u.getTime()?r:r-1}function f(t){Object(a.a)(1,arguments);var e=l(t),r=new Date(0);r.setUTCFullYear(e,0,4),r.setUTCHours(0,0,0,0);var n=c(r);return n}var d={};function h(){return d}function g(t,e){var r,n,s,u,c,l,f,d;Object(a.a)(1,arguments);var g=h(),p=Object(i.a)(null!==(r=null!==(n=null!==(s=null!==(u=null==e?void 0:e.weekStartsOn)&&void 0!==u?u:null==e||null===(c=e.locale)||void 0===c||null===(l=c.options)||void 0===l?void 0:l.weekStartsOn)&&void 0!==s?s:g.weekStartsOn)&&void 0!==n?n:null===(f=g.locale)||void 0===f||null===(d=f.options)||void 0===d?void 0:d.weekStartsOn)&&void 0!==r?r:0);if(!(p>=0&&p<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var m=Object(o.a)(t),y=m.getUTCDay(),b=(y<p?7:0)+y-p;return m.setUTCDate(m.getUTCDate()-b),m.setUTCHours(0,0,0,0),m}function p(t,e){var r,n,s,u,c,l,f,d;Object(a.a)(1,arguments);var p=Object(o.a)(t),m=p.getUTCFullYear(),y=h(),b=Object(i.a)(null!==(r=null!==(n=null!==(s=null!==(u=null==e?void 0:e.firstWeekContainsDate)&&void 0!==u?u:null==e||null===(c=e.locale)||void 0===c||null===(l=c.options)||void 0===l?void 0:l.firstWeekContainsDate)&&void 0!==s?s:y.firstWeekContainsDate)&&void 0!==n?n:null===(f=y.locale)||void 0===f||null===(d=f.options)||void 0===d?void 0:d.firstWeekContainsDate)&&void 0!==r?r:1);if(!(b>=1&&b<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var _=new Date(0);_.setUTCFullYear(m+1,0,b),_.setUTCHours(0,0,0,0);var v=g(_,e),w=new Date(0);w.setUTCFullYear(m,0,b),w.setUTCHours(0,0,0,0);var E=g(w,e);return p.getTime()>=v.getTime()?m+1:p.getTime()>=E.getTime()?m:m-1}function m(t,e){var r,n,o,s,u,c,l,f;Object(a.a)(1,arguments);var d=h(),m=Object(i.a)(null!==(r=null!==(n=null!==(o=null!==(s=null==e?void 0:e.firstWeekContainsDate)&&void 0!==s?s:null==e||null===(u=e.locale)||void 0===u||null===(c=u.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==o?o:d.firstWeekContainsDate)&&void 0!==n?n:null===(l=d.locale)||void 0===l||null===(f=l.options)||void 0===f?void 0:f.firstWeekContainsDate)&&void 0!==r?r:1),y=p(t,e),b=new Date(0);b.setUTCFullYear(y,0,m),b.setUTCHours(0,0,0,0);var _=g(b,e);return _}function y(t,e){for(var r=t<0?"-":"",n=Math.abs(t).toString();n.length<e;)n="0"+n;return r+n}var b={y:function(t,e){var r=t.getUTCFullYear(),n=r>0?r:1-r;return y("yy"===e?n%100:n,e.length)},M:function(t,e){var r=t.getUTCMonth();return"M"===e?String(r+1):y(r+1,2)},d:function(t,e){return y(t.getUTCDate(),e.length)},a:function(t,e){var r=t.getUTCHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return"am"===r?"a.m.":"p.m."}},h:function(t,e){return y(t.getUTCHours()%12||12,e.length)},H:function(t,e){return y(t.getUTCHours(),e.length)},m:function(t,e){return y(t.getUTCMinutes(),e.length)},s:function(t,e){return y(t.getUTCSeconds(),e.length)},S:function(t,e){var r=e.length,n=t.getUTCMilliseconds();return y(Math.floor(n*Math.pow(10,r-3)),e.length)}},_="midnight",v="noon",w="morning",E="afternoon",S="evening",O="night";function T(t,e){var r=t>0?"-":"+",n=Math.abs(t),i=Math.floor(n/60),o=n%60;if(0===o)return r+String(i);var a=e||"";return r+String(i)+a+y(o,2)}function A(t,e){return t%60==0?(t>0?"-":"+")+y(Math.abs(t)/60,2):M(t,e)}function M(t,e){var r=e||"",n=t>0?"-":"+",i=Math.abs(t);return n+y(Math.floor(i/60),2)+r+y(i%60,2)}var I={G:function(t,e,r){var n=t.getUTCFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(t,e,r){if("yo"===e){var n=t.getUTCFullYear(),i=n>0?n:1-n;return r.ordinalNumber(i,{unit:"year"})}return b.y(t,e)},Y:function(t,e,r,n){var i=p(t,n),o=i>0?i:1-i;return"YY"===e?y(o%100,2):"Yo"===e?r.ordinalNumber(o,{unit:"year"}):y(o,e.length)},R:function(t,e){return y(l(t),e.length)},u:function(t,e){return y(t.getUTCFullYear(),e.length)},Q:function(t,e,r){var n=Math.ceil((t.getUTCMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return y(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(t,e,r){var n=Math.ceil((t.getUTCMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return y(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(t,e,r){var n=t.getUTCMonth();switch(e){case"M":case"MM":return b.M(t,e);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(t,e,r){var n=t.getUTCMonth();switch(e){case"L":return String(n+1);case"LL":return y(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(t,e,r,n){var i=function(t,e){Object(a.a)(1,arguments);var r=Object(o.a)(t),n=g(r,e).getTime()-m(r,e).getTime();return Math.round(n/6048e5)+1}(t,n);return"wo"===e?r.ordinalNumber(i,{unit:"week"}):y(i,e.length)},I:function(t,e,r){var n=function(t){Object(a.a)(1,arguments);var e=Object(o.a)(t),r=c(e).getTime()-f(e).getTime();return Math.round(r/6048e5)+1}(t);return"Io"===e?r.ordinalNumber(n,{unit:"week"}):y(n,e.length)},d:function(t,e,r){return"do"===e?r.ordinalNumber(t.getUTCDate(),{unit:"date"}):b.d(t,e)},D:function(t,e,r){var n=function(t){Object(a.a)(1,arguments);var e=Object(o.a)(t),r=e.getTime();e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0);var n=e.getTime(),i=r-n;return Math.floor(i/864e5)+1}(t);return"Do"===e?r.ordinalNumber(n,{unit:"dayOfYear"}):y(n,e.length)},E:function(t,e,r){var n=t.getUTCDay();switch(e){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(t,e,r,n){var i=t.getUTCDay(),o=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return y(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(i,{width:"short",context:"formatting"});case"eeee":default:return r.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,r,n){var i=t.getUTCDay(),o=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return y(o,e.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(i,{width:"narrow",context:"standalone"});case"cccccc":return r.day(i,{width:"short",context:"standalone"});case"cccc":default:return r.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,r){var n=t.getUTCDay(),i=0===n?7:n;switch(e){case"i":return String(i);case"ii":return y(i,e.length);case"io":return r.ordinalNumber(i,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(t,e,r){var n=t.getUTCHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(t,e,r){var n,i=t.getUTCHours();switch(n=12===i?v:0===i?_:i/12>=1?"pm":"am",e){case"b":case"bb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(t,e,r){var n,i=t.getUTCHours();switch(n=i>=17?S:i>=12?E:i>=4?w:O,e){case"B":case"BB":case"BBB":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(t,e,r){if("ho"===e){var n=t.getUTCHours()%12;return 0===n&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return b.h(t,e)},H:function(t,e,r){return"Ho"===e?r.ordinalNumber(t.getUTCHours(),{unit:"hour"}):b.H(t,e)},K:function(t,e,r){var n=t.getUTCHours()%12;return"Ko"===e?r.ordinalNumber(n,{unit:"hour"}):y(n,e.length)},k:function(t,e,r){var n=t.getUTCHours();return 0===n&&(n=24),"ko"===e?r.ordinalNumber(n,{unit:"hour"}):y(n,e.length)},m:function(t,e,r){return"mo"===e?r.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):b.m(t,e)},s:function(t,e,r){return"so"===e?r.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):b.s(t,e)},S:function(t,e){return b.S(t,e)},X:function(t,e,r,n){var i=(n._originalDate||t).getTimezoneOffset();if(0===i)return"Z";switch(e){case"X":return A(i);case"XXXX":case"XX":return M(i);case"XXXXX":case"XXX":default:return M(i,":")}},x:function(t,e,r,n){var i=(n._originalDate||t).getTimezoneOffset();switch(e){case"x":return A(i);case"xxxx":case"xx":return M(i);case"xxxxx":case"xxx":default:return M(i,":")}},O:function(t,e,r,n){var i=(n._originalDate||t).getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+T(i,":");case"OOOO":default:return"GMT"+M(i,":")}},z:function(t,e,r,n){var i=(n._originalDate||t).getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+T(i,":");case"zzzz":default:return"GMT"+M(i,":")}},t:function(t,e,r,n){var i=n._originalDate||t;return y(Math.floor(i.getTime()/1e3),e.length)},T:function(t,e,r,n){return y((n._originalDate||t).getTime(),e.length)}},R=function(t,e){switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},N=function(t,e){switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},k={p:N,P:function(t,e){var r,n=t.match(/(P+)(p+)?/)||[],i=n[1],o=n[2];if(!o)return R(t,e);switch(i){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;case"PPPP":default:r=e.dateTime({width:"full"})}return r.replace("{{date}}",R(i,e)).replace("{{time}}",N(o,e))}},D=r(91),j=["D","DD"],C=["YY","YYYY"];function L(t){return-1!==j.indexOf(t)}function x(t){return-1!==C.indexOf(t)}function B(t,e,r){if("YYYY"===t)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(e,"`) for formatting years to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("YY"===t)throw new RangeError("Use `yy` instead of `YY` (in `".concat(e,"`) for formatting years to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("D"===t)throw new RangeError("Use `d` instead of `D` (in `".concat(e,"`) for formatting days of the month to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("DD"===t)throw new RangeError("Use `dd` instead of `DD` (in `".concat(e,"`) for formatting days of the month to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var U={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},F=function(t,e,r){var n,i=U[t];return n="string"==typeof i?i:1===e?i.one:i.other.replace("{{count}}",e.toString()),null!=r&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function P(t){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.width?String(e.width):t.defaultWidth,n=t.formats[r]||t.formats[t.defaultWidth];return n}}var W={date:P({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:P({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:P({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},z={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function H(t){return function(e,r){var n;if("formatting"===(null!=r&&r.context?String(r.context):"standalone")&&t.formattingValues){var i=t.defaultFormattingWidth||t.defaultWidth,o=null!=r&&r.width?String(r.width):i;n=t.formattingValues[o]||t.formattingValues[i]}else{var a=t.defaultWidth,s=null!=r&&r.width?String(r.width):t.defaultWidth;n=t.values[s]||t.values[a]}return n[t.argumentCallback?t.argumentCallback(e):e]}}function q(t){return function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.width,i=n&&t.matchPatterns[n]||t.matchPatterns[t.defaultMatchWidth],o=e.match(i);if(!o)return null;var a,s=o[0],u=n&&t.parsePatterns[n]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(u)?G(u,(function(t){return t.test(s)})):V(u,(function(t){return t.test(s)}));a=t.valueCallback?t.valueCallback(c):c,a=r.valueCallback?r.valueCallback(a):a;var l=e.slice(s.length);return{value:a,rest:l}}}function V(t,e){for(var r in t)if(t.hasOwnProperty(r)&&e(t[r]))return r}function G(t,e){for(var r=0;r<t.length;r++)if(e(t[r]))return r}var Y,$={code:"en-US",formatDistance:F,formatLong:W,formatRelative:function(t,e,r,n){return z[t]},localize:{ordinalNumber:function(t,e){var r=Number(t),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},era:H({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:H({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:H({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:H({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:H({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(Y={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(t){return parseInt(t,10)}},function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.match(Y.matchPattern);if(!r)return null;var n=r[0],i=t.match(Y.parsePattern);if(!i)return null;var o=Y.valueCallback?Y.valueCallback(i[0]):i[0];o=e.valueCallback?e.valueCallback(o):o;var a=t.slice(n.length);return{value:o,rest:a}}),era:q({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:q({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:q({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:q({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:q({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}},K=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Z=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,J=/^'([^]*?)'?$/,X=/''/g,Q=/[a-zA-Z]/;function tt(t,e,r){var s,c,l,f,d,g,p,m,y,b,_,v,w,E,S,O,T,A;Object(a.a)(2,arguments);var M=String(e),R=h(),N=null!==(s=null!==(c=null==r?void 0:r.locale)&&void 0!==c?c:R.locale)&&void 0!==s?s:$,j=Object(i.a)(null!==(l=null!==(f=null!==(d=null!==(g=null==r?void 0:r.firstWeekContainsDate)&&void 0!==g?g:null==r||null===(p=r.locale)||void 0===p||null===(m=p.options)||void 0===m?void 0:m.firstWeekContainsDate)&&void 0!==d?d:R.firstWeekContainsDate)&&void 0!==f?f:null===(y=R.locale)||void 0===y||null===(b=y.options)||void 0===b?void 0:b.firstWeekContainsDate)&&void 0!==l?l:1);if(!(j>=1&&j<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var C=Object(i.a)(null!==(_=null!==(v=null!==(w=null!==(E=null==r?void 0:r.weekStartsOn)&&void 0!==E?E:null==r||null===(S=r.locale)||void 0===S||null===(O=S.options)||void 0===O?void 0:O.weekStartsOn)&&void 0!==w?w:R.weekStartsOn)&&void 0!==v?v:null===(T=R.locale)||void 0===T||null===(A=T.options)||void 0===A?void 0:A.weekStartsOn)&&void 0!==_?_:0);if(!(C>=0&&C<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!N.localize)throw new RangeError("locale must contain localize property");if(!N.formatLong)throw new RangeError("locale must contain formatLong property");var U=Object(o.a)(t);if(!Object(n.a)(U))throw new RangeError("Invalid time value");var F=Object(D.a)(U),P=u(U,F),W={firstWeekContainsDate:j,weekStartsOn:C,locale:N,_originalDate:U},z=M.match(Z).map((function(t){var e=t[0];return"p"===e||"P"===e?(0,k[e])(t,N.formatLong):t})).join("").match(K).map((function(n){if("''"===n)return"'";var i=n[0];if("'"===i)return et(n);var o=I[i];if(o)return null!=r&&r.useAdditionalWeekYearTokens||!x(n)||B(n,e,String(t)),null!=r&&r.useAdditionalDayOfYearTokens||!L(n)||B(n,e,String(t)),o(P,n,N.localize,W);if(i.match(Q))throw new RangeError("Format string contains an unescaped latin alphabet character `"+i+"`");return n})).join("");return z}function et(t){var e=t.match(J);return e?e[1].replace(X,"'"):t}},function(t,e,r){(function(t){function r(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function n(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n<t.length;n++)e(t[n],n,t)&&r.push(t[n]);return r}e.resolve=function(){for(var e="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var a=o>=0?arguments[o]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(e=a+"/"+e,i="/"===a.charAt(0))}return(i?"/":"")+(e=r(n(e.split("/"),(function(t){return!!t})),!i).join("/"))||"."},e.normalize=function(t){var o=e.isAbsolute(t),a="/"===i(t,-1);return(t=r(n(t.split("/"),(function(t){return!!t})),!o).join("/"))||o||(t="."),t&&a&&(t+="/"),(o?"/":"")+t},e.isAbsolute=function(t){return"/"===t.charAt(0)},e.join=function(){var t=Array.prototype.slice.call(arguments,0);return e.normalize(n(t,(function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))},e.relative=function(t,r){function n(t){for(var e=0;e<t.length&&""===t[e];e++);for(var r=t.length-1;r>=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=e.resolve(t).substr(1),r=e.resolve(r).substr(1);for(var i=n(t.split("/")),o=n(r.split("/")),a=Math.min(i.length,o.length),s=a,u=0;u<a;u++)if(i[u]!==o[u]){s=u;break}var c=[];for(u=s;u<i.length;u++)c.push("..");return(c=c.concat(o.slice(s))).join("/")},e.sep="/",e.delimiter=":",e.dirname=function(t){if("string"!=typeof t&&(t+=""),0===t.length)return".";for(var e=t.charCodeAt(0),r=47===e,n=-1,i=!0,o=t.length-1;o>=1;--o)if(47===(e=t.charCodeAt(o))){if(!i){n=o;break}}else i=!1;return-1===n?r?"/":".":r&&1===n?"/":t.slice(0,n)},e.basename=function(t,e){var r=function(t){"string"!=typeof t&&(t+="");var e,r=0,n=-1,i=!0;for(e=t.length-1;e>=0;--e)if(47===t.charCodeAt(e)){if(!i){r=e+1;break}}else-1===n&&(i=!1,n=e+1);return-1===n?"":t.slice(r,n)}(t);return e&&r.substr(-1*e.length)===e&&(r=r.substr(0,r.length-e.length)),r},e.extname=function(t){"string"!=typeof t&&(t+="");for(var e=-1,r=0,n=-1,i=!0,o=0,a=t.length-1;a>=0;--a){var s=t.charCodeAt(a);if(47!==s)-1===n&&(i=!1,n=a+1),46===s?-1===e?e=a:1!==o&&(o=1):-1!==e&&(o=-1);else if(!i){r=a+1;break}}return-1===e||-1===n||0===o||1===o&&e===n-1&&e===r+1?"":t.slice(e,n)};var i="b"==="ab".substr(-1)?function(t,e,r){return t.substr(e,r)}:function(t,e,r){return e<0&&(e=t.length+e),t.substr(e,r)}}).call(this,r(25))},function(t,e,r){"use strict";r.d(e,"a",(function(){return n})),r.d(e,"c",(function(){return i})),r.d(e,"b",(function(){return o}));r(5);const n=new Map(Object.entries({imported_payee:"string",payee:"id",date:"date",notes:"string",amount:"number",amountInflow:"number",amountOutfow:"number",category:"id",account:"id",cleared:"boolean"}));function i(t,e){return t<e?[t,e]:[e,t]}function o(t){return Math.round(.075*Math.abs(t))}},function(t,e,r){var n=r(386),i=n,o=globalThis;i.exportSymbol("proto.EncryptedData",null,o),i.exportSymbol("proto.Message",null,o),i.exportSymbol("proto.MessageEnvelope",null,o),i.exportSymbol("proto.SyncRequest",null,o),i.exportSymbol("proto.SyncResponse",null,o),proto.EncryptedData=function(t){n.Message.initialize(this,t,0,-1,null,null)},i.inherits(proto.EncryptedData,n.Message),i.DEBUG&&!COMPILED&&(proto.EncryptedData.displayName="proto.EncryptedData"),proto.Message=function(t){n.Message.initialize(this,t,0,-1,null,null)},i.inherits(proto.Message,n.Message),i.DEBUG&&!COMPILED&&(proto.Message.displayName="proto.Message"),proto.MessageEnvelope=function(t){n.Message.initialize(this,t,0,-1,null,null)},i.inherits(proto.MessageEnvelope,n.Message),i.DEBUG&&!COMPILED&&(proto.MessageEnvelope.displayName="proto.MessageEnvelope"),proto.SyncRequest=function(t){n.Message.initialize(this,t,0,-1,proto.SyncRequest.repeatedFields_,null)},i.inherits(proto.SyncRequest,n.Message),i.DEBUG&&!COMPILED&&(proto.SyncRequest.displayName="proto.SyncRequest"),proto.SyncResponse=function(t){n.Message.initialize(this,t,0,-1,proto.SyncResponse.repeatedFields_,null)},i.inherits(proto.SyncResponse,n.Message),i.DEBUG&&!COMPILED&&(proto.SyncResponse.displayName="proto.SyncResponse"),n.Message.GENERATE_TO_OBJECT&&(proto.EncryptedData.prototype.toObject=function(t){return proto.EncryptedData.toObject(t,this)},proto.EncryptedData.toObject=function(t,e){var r={iv:e.getIv_asB64(),authtag:e.getAuthtag_asB64(),data:e.getData_asB64()};return t&&(r.$jspbMessageInstance=e),r}),proto.EncryptedData.deserializeBinary=function(t){var e=new n.BinaryReader(t),r=new proto.EncryptedData;return proto.EncryptedData.deserializeBinaryFromReader(r,e)},proto.EncryptedData.deserializeBinaryFromReader=function(t,e){for(;e.nextField()&&!e.isEndGroup();){switch(e.getFieldNumber()){case 1:var r=e.readBytes();t.setIv(r);break;case 2:r=e.readBytes();t.setAuthtag(r);break;case 3:r=e.readBytes();t.setData(r);break;default:e.skipField()}}return t},proto.EncryptedData.prototype.serializeBinary=function(){var t=new n.BinaryWriter;return proto.EncryptedData.serializeBinaryToWriter(this,t),t.getResultBuffer()},proto.EncryptedData.serializeBinaryToWriter=function(t,e){var r=void 0;(r=t.getIv_asU8()).length>0&&e.writeBytes(1,r),(r=t.getAuthtag_asU8()).length>0&&e.writeBytes(2,r),(r=t.getData_asU8()).length>0&&e.writeBytes(3,r)},proto.EncryptedData.prototype.getIv=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.EncryptedData.prototype.getIv_asB64=function(){return n.Message.bytesAsB64(this.getIv())},proto.EncryptedData.prototype.getIv_asU8=function(){return n.Message.bytesAsU8(this.getIv())},proto.EncryptedData.prototype.setIv=function(t){return n.Message.setProto3BytesField(this,1,t)},proto.EncryptedData.prototype.getAuthtag=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.EncryptedData.prototype.getAuthtag_asB64=function(){return n.Message.bytesAsB64(this.getAuthtag())},proto.EncryptedData.prototype.getAuthtag_asU8=function(){return n.Message.bytesAsU8(this.getAuthtag())},proto.EncryptedData.prototype.setAuthtag=function(t){return n.Message.setProto3BytesField(this,2,t)},proto.EncryptedData.prototype.getData=function(){return n.Message.getFieldWithDefault(this,3,"")},proto.EncryptedData.prototype.getData_asB64=function(){return n.Message.bytesAsB64(this.getData())},proto.EncryptedData.prototype.getData_asU8=function(){return n.Message.bytesAsU8(this.getData())},proto.EncryptedData.prototype.setData=function(t){return n.Message.setProto3BytesField(this,3,t)},n.Message.GENERATE_TO_OBJECT&&(proto.Message.prototype.toObject=function(t){return proto.Message.toObject(t,this)},proto.Message.toObject=function(t,e){var r={dataset:n.Message.getFieldWithDefault(e,1,""),row:n.Message.getFieldWithDefault(e,2,""),column:n.Message.getFieldWithDefault(e,3,""),value:n.Message.getFieldWithDefault(e,4,"")};return t&&(r.$jspbMessageInstance=e),r}),proto.Message.deserializeBinary=function(t){var e=new n.BinaryReader(t),r=new proto.Message;return proto.Message.deserializeBinaryFromReader(r,e)},proto.Message.deserializeBinaryFromReader=function(t,e){for(;e.nextField()&&!e.isEndGroup();){switch(e.getFieldNumber()){case 1:var r=e.readString();t.setDataset(r);break;case 2:r=e.readString();t.setRow(r);break;case 3:r=e.readString();t.setColumn(r);break;case 4:r=e.readString();t.setValue(r);break;default:e.skipField()}}return t},proto.Message.prototype.serializeBinary=function(){var t=new n.BinaryWriter;return proto.Message.serializeBinaryToWriter(this,t),t.getResultBuffer()},proto.Message.serializeBinaryToWriter=function(t,e){var r=void 0;(r=t.getDataset()).length>0&&e.writeString(1,r),(r=t.getRow()).length>0&&e.writeString(2,r),(r=t.getColumn()).length>0&&e.writeString(3,r),(r=t.getValue()).length>0&&e.writeString(4,r)},proto.Message.prototype.getDataset=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.Message.prototype.setDataset=function(t){return n.Message.setProto3StringField(this,1,t)},proto.Message.prototype.getRow=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.Message.prototype.setRow=function(t){return n.Message.setProto3StringField(this,2,t)},proto.Message.prototype.getColumn=function(){return n.Message.getFieldWithDefault(this,3,"")},proto.Message.prototype.setColumn=function(t){return n.Message.setProto3StringField(this,3,t)},proto.Message.prototype.getValue=function(){return n.Message.getFieldWithDefault(this,4,"")},proto.Message.prototype.setValue=function(t){return n.Message.setProto3StringField(this,4,t)},n.Message.GENERATE_TO_OBJECT&&(proto.MessageEnvelope.prototype.toObject=function(t){return proto.MessageEnvelope.toObject(t,this)},proto.MessageEnvelope.toObject=function(t,e){var r={timestamp:n.Message.getFieldWithDefault(e,1,""),isencrypted:n.Message.getBooleanFieldWithDefault(e,2,!1),content:e.getContent_asB64()};return t&&(r.$jspbMessageInstance=e),r}),proto.MessageEnvelope.deserializeBinary=function(t){var e=new n.BinaryReader(t),r=new proto.MessageEnvelope;return proto.MessageEnvelope.deserializeBinaryFromReader(r,e)},proto.MessageEnvelope.deserializeBinaryFromReader=function(t,e){for(;e.nextField()&&!e.isEndGroup();){switch(e.getFieldNumber()){case 1:var r=e.readString();t.setTimestamp(r);break;case 2:r=e.readBool();t.setIsencrypted(r);break;case 3:r=e.readBytes();t.setContent(r);break;default:e.skipField()}}return t},proto.MessageEnvelope.prototype.serializeBinary=function(){var t=new n.BinaryWriter;return proto.MessageEnvelope.serializeBinaryToWriter(this,t),t.getResultBuffer()},proto.MessageEnvelope.serializeBinaryToWriter=function(t,e){var r=void 0;(r=t.getTimestamp()).length>0&&e.writeString(1,r),(r=t.getIsencrypted())&&e.writeBool(2,r),(r=t.getContent_asU8()).length>0&&e.writeBytes(3,r)},proto.MessageEnvelope.prototype.getTimestamp=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.MessageEnvelope.prototype.setTimestamp=function(t){return n.Message.setProto3StringField(this,1,t)},proto.MessageEnvelope.prototype.getIsencrypted=function(){return n.Message.getBooleanFieldWithDefault(this,2,!1)},proto.MessageEnvelope.prototype.setIsencrypted=function(t){return n.Message.setProto3BooleanField(this,2,t)},proto.MessageEnvelope.prototype.getContent=function(){return n.Message.getFieldWithDefault(this,3,"")},proto.MessageEnvelope.prototype.getContent_asB64=function(){return n.Message.bytesAsB64(this.getContent())},proto.MessageEnvelope.prototype.getContent_asU8=function(){return n.Message.bytesAsU8(this.getContent())},proto.MessageEnvelope.prototype.setContent=function(t){return n.Message.setProto3BytesField(this,3,t)},proto.SyncRequest.repeatedFields_=[1],n.Message.GENERATE_TO_OBJECT&&(proto.SyncRequest.prototype.toObject=function(t){return proto.SyncRequest.toObject(t,this)},proto.SyncRequest.toObject=function(t,e){var r={messagesList:n.Message.toObjectList(e.getMessagesList(),proto.MessageEnvelope.toObject,t),fileid:n.Message.getFieldWithDefault(e,2,""),groupid:n.Message.getFieldWithDefault(e,3,""),keyid:n.Message.getFieldWithDefault(e,5,""),since:n.Message.getFieldWithDefault(e,6,"")};return t&&(r.$jspbMessageInstance=e),r}),proto.SyncRequest.deserializeBinary=function(t){var e=new n.BinaryReader(t),r=new proto.SyncRequest;return proto.SyncRequest.deserializeBinaryFromReader(r,e)},proto.SyncRequest.deserializeBinaryFromReader=function(t,e){for(;e.nextField()&&!e.isEndGroup();){switch(e.getFieldNumber()){case 1:var r=new proto.MessageEnvelope;e.readMessage(r,proto.MessageEnvelope.deserializeBinaryFromReader),t.addMessages(r);break;case 2:r=e.readString();t.setFileid(r);break;case 3:r=e.readString();t.setGroupid(r);break;case 5:r=e.readString();t.setKeyid(r);break;case 6:r=e.readString();t.setSince(r);break;default:e.skipField()}}return t},proto.SyncRequest.prototype.serializeBinary=function(){var t=new n.BinaryWriter;return proto.SyncRequest.serializeBinaryToWriter(this,t),t.getResultBuffer()},proto.SyncRequest.serializeBinaryToWriter=function(t,e){var r=void 0;(r=t.getMessagesList()).length>0&&e.writeRepeatedMessage(1,r,proto.MessageEnvelope.serializeBinaryToWriter),(r=t.getFileid()).length>0&&e.writeString(2,r),(r=t.getGroupid()).length>0&&e.writeString(3,r),(r=t.getKeyid()).length>0&&e.writeString(5,r),(r=t.getSince()).length>0&&e.writeString(6,r)},proto.SyncRequest.prototype.getMessagesList=function(){return n.Message.getRepeatedWrapperField(this,proto.MessageEnvelope,1)},proto.SyncRequest.prototype.setMessagesList=function(t){return n.Message.setRepeatedWrapperField(this,1,t)},proto.SyncRequest.prototype.addMessages=function(t,e){return n.Message.addToRepeatedWrapperField(this,1,t,proto.MessageEnvelope,e)},proto.SyncRequest.prototype.clearMessagesList=function(){return this.setMessagesList([])},proto.SyncRequest.prototype.getFileid=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.SyncRequest.prototype.setFileid=function(t){return n.Message.setProto3StringField(this,2,t)},proto.SyncRequest.prototype.getGroupid=function(){return n.Message.getFieldWithDefault(this,3,"")},proto.SyncRequest.prototype.setGroupid=function(t){return n.Message.setProto3StringField(this,3,t)},proto.SyncRequest.prototype.getKeyid=function(){return n.Message.getFieldWithDefault(this,5,"")},proto.SyncRequest.prototype.setKeyid=function(t){return n.Message.setProto3StringField(this,5,t)},proto.SyncRequest.prototype.getSince=function(){return n.Message.getFieldWithDefault(this,6,"")},proto.SyncRequest.prototype.setSince=function(t){return n.Message.setProto3StringField(this,6,t)},proto.SyncResponse.repeatedFields_=[1],n.Message.GENERATE_TO_OBJECT&&(proto.SyncResponse.prototype.toObject=function(t){return proto.SyncResponse.toObject(t,this)},proto.SyncResponse.toObject=function(t,e){var r={messagesList:n.Message.toObjectList(e.getMessagesList(),proto.MessageEnvelope.toObject,t),merkle:n.Message.getFieldWithDefault(e,2,"")};return t&&(r.$jspbMessageInstance=e),r}),proto.SyncResponse.deserializeBinary=function(t){var e=new n.BinaryReader(t),r=new proto.SyncResponse;return proto.SyncResponse.deserializeBinaryFromReader(r,e)},proto.SyncResponse.deserializeBinaryFromReader=function(t,e){for(;e.nextField()&&!e.isEndGroup();){switch(e.getFieldNumber()){case 1:var r=new proto.MessageEnvelope;e.readMessage(r,proto.MessageEnvelope.deserializeBinaryFromReader),t.addMessages(r);break;case 2:r=e.readString();t.setMerkle(r);break;default:e.skipField()}}return t},proto.SyncResponse.prototype.serializeBinary=function(){var t=new n.BinaryWriter;return proto.SyncResponse.serializeBinaryToWriter(this,t),t.getResultBuffer()},proto.SyncResponse.serializeBinaryToWriter=function(t,e){var r=void 0;(r=t.getMessagesList()).length>0&&e.writeRepeatedMessage(1,r,proto.MessageEnvelope.serializeBinaryToWriter),(r=t.getMerkle()).length>0&&e.writeString(2,r)},proto.SyncResponse.prototype.getMessagesList=function(){return n.Message.getRepeatedWrapperField(this,proto.MessageEnvelope,1)},proto.SyncResponse.prototype.setMessagesList=function(t){return n.Message.setRepeatedWrapperField(this,1,t)},proto.SyncResponse.prototype.addMessages=function(t,e){return n.Message.addToRepeatedWrapperField(this,1,t,proto.MessageEnvelope,e)},proto.SyncResponse.prototype.clearMessagesList=function(){return this.setMessagesList([])},proto.SyncResponse.prototype.getMerkle=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.SyncResponse.prototype.setMerkle=function(t){return n.Message.setProto3StringField(this,2,t)},i.object.extend(e,proto)},function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=r,r.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},function(t,e,r){"use strict";var n=e,i=r(39),o=r(46),a=r(197);n.assert=o,n.toArray=a.toArray,n.zero2=a.zero2,n.toHex=a.toHex,n.encode=a.encode,n.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<<e+1,o=t.clone(),a=0;a<n.length;a++){var s,u=o.andln(i-1);o.isOdd()?(s=u>(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,n[a]=s,o.iushrn(1)}return n},n.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var a,s,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=0==(1&u)?0:3!==(n=t.andln(7)+i&7)&&5!==n||2!==c?u:-u,r[0].push(a),s=0==(1&c)?0:3!==(n=e.andln(7)+o&7)&&5!==n||2!==u?c:-c,r[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new i(t,"hex","le")}},function(t,e,r){"use strict";r.d(e,"b",(function(){return n})),r.d(e,"c",(function(){return i})),r.d(e,"a",(function(){return o}));const n=!1,i=!0,o=!1},function(t,e,r){"use strict";var n=r(46),i=r(12);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function a(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function s(t){return 1===t.length?"0"+t:t}function u(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=i,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(var n=0,i=0;i<t.length;i++){var a=t.charCodeAt(i);a<128?r[n++]=a:a<2048?(r[n++]=a>>6|192,r[n++]=63&a|128):o(t,i)?(a=65536+((1023&a)<<10)+(1023&t.charCodeAt(++i)),r[n++]=a>>18|240,r[n++]=a>>12&63|128,r[n++]=a>>6&63|128,r[n++]=63&a|128):(r[n++]=a>>12|224,r[n++]=a>>6&63|128,r[n++]=63&a|128)}else for(i=0;i<t.length;i++)r[i]=0|t[i];return r},e.toHex=function(t){for(var e="",r=0;r<t.length;r++)e+=s(t[r].toString(16));return e},e.htonl=a,e.toHex32=function(t,e){for(var r="",n=0;n<t.length;n++){var i=t[n];"little"===e&&(i=a(i)),r+=u(i.toString(16))}return r},e.zero2=s,e.zero8=u,e.join32=function(t,e,r,i){var o=r-e;n(o%4==0);for(var a=new Array(o/4),s=0,u=e;s<a.length;s++,u+=4){var c;c="big"===i?t[u]<<24|t[u+1]<<16|t[u+2]<<8|t[u+3]:t[u+3]<<24|t[u+2]<<16|t[u+1]<<8|t[u],a[s]=c>>>0}return a},e.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n<t.length;n++,i+=4){var o=t[n];"big"===e?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<<e|t>>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,r){return t+e+r>>>0},e.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},e.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},e.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,a=(o<n?1:0)+r+i;t[e]=a>>>0,t[e+1]=o},e.sum64_hi=function(t,e,r,n){return(e+n>>>0<e?1:0)+t+r>>>0},e.sum64_lo=function(t,e,r,n){return e+n>>>0},e.sum64_4_hi=function(t,e,r,n,i,o,a,s){var u=0,c=e;return u+=(c=c+n>>>0)<e?1:0,u+=(c=c+o>>>0)<o?1:0,t+r+i+a+(u+=(c=c+s>>>0)<s?1:0)>>>0},e.sum64_4_lo=function(t,e,r,n,i,o,a,s){return e+n+o+s>>>0},e.sum64_5_hi=function(t,e,r,n,i,o,a,s,u,c){var l=0,f=e;return l+=(f=f+n>>>0)<e?1:0,l+=(f=f+o>>>0)<o?1:0,l+=(f=f+s>>>0)<s?1:0,t+r+i+a+u+(l+=(f=f+c>>>0)<c?1:0)>>>0},e.sum64_5_lo=function(t,e,r,n,i,o,a,s,u,c){return e+n+o+s+c>>>0},e.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},e.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},e.shr64_hi=function(t,e,r){return t>>>r},e.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},function(t,e,r){"use strict";var n=r(59),i=r(107),o=i(n("String.prototype.indexOf"));t.exports=function(t,e){var r=n(t,!!e);return"function"==typeof r&&o(t,".prototype.")>-1?i(r):r}},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(109),i=r(26);class o{constructor(){this.handlers={},this.services=[],this.events=Object(n.a)(),this.unlistenServices=[]}method(t,e){if(null!=this.handlers[t])throw new Error("Conflicting method name, names must be globally unique: "+t);this.handlers[t]=e}service(t){this.services.push(t)}combine(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];for(let t of e){Object.keys(t.handlers).forEach(e=>{this.method(e,t.handlers[e])}),t.services.forEach(t=>{this.service(t)});for(let[e,r]of t.events.all.entries())for(let t of r)this.events.on(e,t)}}startServices(){this.unlistenServices.length>0&&Object(i.b)(new Error("App: startServices called while services are already running")),this.unlistenServices=this.services.map(t=>t())}stopServices(){this.unlistenServices.forEach(t=>{t&&t()}),this.unlistenServices=[]}}function a(){return new o}},function(t,e,r){"use strict";r.d(e,"d",(function(){return v})),r.d(e,"b",(function(){return w})),r.d(e,"a",(function(){return S})),r.d(e,"c",(function(){return O}));var n=r(1),i=r(5),o=r(0),a=r(3),s=r(21),u=r(24);function c(t){if("number"==typeof t)return t;if("string"==typeof t){const e=parseFloat(t);return isNaN(e)?0:e}return 0}function l(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Object(i.o)(e.reduce((t,e)=>t+c(e),0))}function f(t){let e=[];for(let r=0;r<t.length;r+=2)e.push([t[r],t[r+1]]);return e}function d(t){let e=n.m(t[0]);return n.p(e)}function h(t,e){if(e.length>0){let r=d(e);a.b().createStatic(r,"carryover-"+t.id,!1),a.b().createStatic(r,"leftover-"+t.id,0),a.b().createStatic(r,"leftover-pos-"+t.id,0)}}function g(t,e,r){let n=d(r);t.blankSheet!==n&&(a.b().clearSheet(t.blankSheet),function(t,e,r){a.b().createStatic(e,"is-blank",!0),a.b().createStatic(e,"to-budget",0),a.b().createStatic(e,"buffered",0),t.forEach(t=>h(t,r))}(e,n,r),t.blankSheet=n)}function p(){return a.b().meta().budgetType||"rollover"}function m(t,e,r,n,u){a.b().createDynamic(e,"sum-amount-"+t.id,{initialValue:0,run:()=>{let e=o.runQuery(`SELECT SUM(amount) as amount FROM v_transactions_internal_alive t\n LEFT JOIN accounts a ON a.id = t.account\n WHERE t.date >= ${n} AND t.date <= ${u}\n AND category = '${t.id}' AND a.offbudget = 0`,[],!0)[0];return(e?e.amount:0)||0}}),"rollover"===p()?function(t,e,r){t.is_income||(a.b().createStatic(e,"budget-"+t.id,0),null==a.b().getCellValue(e,"budget-"+t.id)&&a.b().set(Object(s.a)(e,"budget-"+t.id),0),a.b().createStatic(e,"carryover-"+t.id,!1),a.b().createDynamic(e,"leftover-"+t.id,{initialValue:0,dependencies:["budget-"+t.id,"sum-amount-"+t.id,`${r}!carryover-${t.id}`,`${r}!leftover-${t.id}`,`${r}!leftover-pos-${t.id}`],run:(t,e,r,n,o)=>Object(i.o)(c(t)+c(e)+c(r?n:o))}),a.b().createDynamic(e,"leftover-pos-"+t.id,{initialValue:0,dependencies:["leftover-"+t.id],run:t=>t<0?0:t}))}(t,e,r):async function(t,e,r){a.b().createStatic(e,"budget-"+t.id,0),null==a.b().getCellValue(e,"budget-"+t.id)&&a.b().set(Object(s.a)(e,"budget-"+t.id),0),a.b().createDynamic(e,"leftover-"+t.id,{initialValue:0,dependencies:["budget-"+t.id,"sum-amount-"+t.id,`${r}!carryover-${t.id}`,`${r}!leftover-${t.id}`],run:(e,r,n,o)=>t.is_income?Object(i.o)(c(e)-c(r)+(n?c(o):0)):Object(i.o)(c(e)+c(r)+(n?c(o):0))}),a.b().createDynamic(e,"spent-with-carryover-"+t.id,{initialValue:0,dependencies:["budget-"+t.id,"sum-amount-"+t.id,"carryover-"+t.id],refresh:!0,run:(t,e,r)=>r?Math.max(0,Object(i.o)(c(t)+c(e))):e}),a.b().createStatic(e,"carryover-"+t.id,!1)}(t,e,r)}function y(t,e){a.b().createDynamic(e,"group-sum-amount-"+t.id,{initialValue:0,dependencies:t.categories.map(t=>"sum-amount-"+t.id),run:l}),t.is_income&&"rollover"===p()||(a.b().createDynamic(e,"group-budget-"+t.id,{initialValue:0,dependencies:t.categories.map(t=>"budget-"+t.id),run:l}),a.b().createDynamic(e,"group-leftover-"+t.id,{initialValue:0,dependencies:t.categories.map(t=>"leftover-"+t.id),run:l}))}function b(t,e){if((e.has("date")||e.has("acct")||e.has("amount")||e.has("category")||e.has("tombstone")||e.has("isParent"))&&t.date&&t.category){let e=n.k(o.fromDateRepr(t.date)),r=n.p(e);a.b().recompute(Object(s.a)(r,"sum-amount-"+t.category))}}function _(t,e,r){let i=p();if(1===r.tombstone&&e&&0===e.tombstone){let e=r.id;t.forEach(t=>{!function(t,e){a.b().removeDependencies(t,"total-budgeted",["group-budget-"+e]),a.b().removeDependencies(t,"total-spent",["group-sum-amount-"+e]),a.b().removeDependencies(t,"total-leftover",["group-leftover-"+e])}(n.p(t),e)})}else if(0===r.tombstone&&(!e||1===e.tombstone)){let e=r;e.is_income&&"rollover"===i||t.forEach(t=>{let r=n.p(t),i=o.runQuery("SELECT * FROM categories WHERE tombstone = 0 AND cat_group = ?",[e.id],!0);y({...e,categories:i},r),function(t,e){a.b().addDependencies(t,"total-budgeted",["group-budget-"+e]),a.b().addDependencies(t,"total-spent",["group-sum-amount-"+e]),a.b().addDependencies(t,"total-leftover",["group-leftover-"+e])}(r,e.id)})}}function v(t,e){let{createdMonths:r=new Set}=a.b().meta();a.h();try{e.forEach((e,u)=>{let c=t.get(u);e.forEach(t=>{let e=c&&c.get(t.id);if("zero_budget_months"===u)!function(t){let e=n.p(t.id);a.b().set(e+"!buffered",t.buffered)}(t);else if("zero_budgets"===u||"reflect_budgets"===u)!function(t){if(t.category){let e=n.p(t.month.toString());a.b().set(`${e}!budget-${t.category}`,t.amount||0),a.b().set(`${e}!carryover-${t.category}`,1===t.carryover)}}(t);else if("transactions"===u){let r=new Set(Object.keys(Object(i.f)(e||{},t)||{}));e&&b(e,r),b(t,r)}else"category_mapping"===u?function(t,e,r){t.forEach(t=>{let i=n.p(t);e&&a.b().recompute(Object(s.a)(i,"sum-amount-"+e.transferId)),a.b().recompute(Object(s.a)(i,"sum-amount-"+r.transferId))})}(r,e,t):"categories"===u?function(t,e,r){function i(t,e,r){a.b().addDependencies(t,"group-sum-amount-"+e,["sum-amount-"+r]),a.b().addDependencies(t,"group-budget-"+e,["budget-"+r]),a.b().addDependencies(t,"group-leftover-"+e,["leftover-"+r])}function o(t,e,r){a.b().removeDependencies(t,"group-sum-amount-"+e,["sum-amount-"+r]),a.b().removeDependencies(t,"group-budget-"+e,["budget-"+r]),a.b().removeDependencies(t,"group-leftover-"+e,["leftover-"+r])}let s=p();if(e&&0===e.tombstone&&1===r.tombstone){let e=r.id,i=r.cat_group;t.forEach(t=>{o(n.p(t),i,e)})}else if(0!==r.tombstone||e&&1!==e.tombstone){if(e&&e.cat_group!==r.cat_group){let a=r.id;t.forEach(t=>{let s=n.p(t);o(s,e.cat_group,a),i(s,r.cat_group,a)})}}else"rollover"===s&&h(r,t),t.forEach(t=>{let e=n.m(t),o=n.p(e),s=n.p(t),{start:u,end:c}=n.c(t);m(r,s,o,u,c);let l=r.id,f=r.cat_group;"rollover"===p()&&a.b().addDependencies(s,"last-month-overspent",[`${o}!leftover-${l}`,`${o}!carryover-${l}`]),i(s,f,l)})}(r,e,t):"category_groups"===u?_(r,e,t):"accounts"===u&&function(t,e,r){if(!e||e.offbudget!==r.offbudget){let e=o.runQuery("\n SELECT DISTINCT(category) as category FROM transactions\n WHERE acct = ?\n ",[r.id],!0);t.forEach(t=>{let r=n.p(t);e.forEach(t=>{a.b().recompute(Object(s.a)(r,"sum-amount-"+t.category))})})}}(r,e,t)})})}finally{a.a()}}async function w(t,e){let{createdMonths:r}=a.b().meta();[...r].forEach(r=>{let n=t.map(t=>u.c({month:r,category:t})).reduce((t,e)=>t+e,0),i=u.c({month:r,category:e});u.h({month:r,category:e,amount:n+i})})}async function E(t){const e=await o.getCategories(),r=await o.getCategoriesGrouped();a.h();let s=a.b().meta();s.createdMonths=s.createdMonths||new Set;let u=p();"rollover"===u&&g(s,e,t),t.forEach(t=>{if(!s.createdMonths.has(t)){let o=n.m(t),{start:d,end:h}=n.c(t),g=n.p(t),p=n.p(o);e.forEach(t=>{m(t,g,p,d,h)}),r.forEach(t=>{y(t,g)}),"rollover"===u?function(t,e,r,n){let o=t.filter(t=>t.is_income)[0],s=e.filter(t=>!t.is_income);var u;a.b().createStatic(n,"buffered",0),a.b().createDynamic(n,"from-last-month",{initialValue:0,dependencies:[r+"!to-budget",r+"!buffered"],run:(t,e)=>Object(i.o)(c(t)+c(e))}),a.b().createDynamic(n,"total-income",{initialValue:0,dependencies:["group-sum-amount-"+o.id],run:t=>t}),a.b().createDynamic(n,"available-funds",{initialValue:0,dependencies:["total-income","from-last-month"],run:(t,e)=>Object(i.o)(c(t)+c(e))}),a.b().createDynamic(n,"last-month-overspent",{initialValue:0,dependencies:(u=s.map(t=>[`${r}!leftover-${t.id}`,`${r}!carryover-${t.id}`]),Array.prototype.concat.apply([],u)),run:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e=f(e),Object(i.o)(e.reduce((t,e)=>{let[r,n]=e;return n?t:t+Math.min(0,c(r))},0))}}),a.b().createDynamic(n,"total-budgeted",{initialValue:0,dependencies:t.filter(t=>!t.is_income).map(t=>"group-budget-"+t.id),run:function(){return-l(...arguments)}}),a.b().createDynamic(n,"buffered",{initialValue:0}),a.b().createDynamic(n,"to-budget",{initialValue:0,dependencies:["available-funds","last-month-overspent","total-budgeted","buffered"],run:(t,e,r,n)=>Object(i.o)(c(t)+c(e)+c(r)-c(n))}),a.b().createDynamic(n,"total-spent",{initialValue:0,dependencies:t.filter(t=>!t.is_income).map(t=>"group-sum-amount-"+t.id),run:l}),a.b().createDynamic(n,"total-leftover",{initialValue:0,dependencies:t.filter(t=>!t.is_income).map(t=>"group-leftover-"+t.id),run:l})}(r,e,p,g):function(t,e,r){let n=t.filter(t=>t.is_income)[0],o=e.filter(t=>!t.is_income);a.b().createDynamic(r,"total-budgeted",{initialValue:0,dependencies:t.filter(t=>!t.is_income).map(t=>"group-budget-"+t.id),run:l}),a.b().createDynamic(r,"total-spent",{initialValue:0,refresh:!0,dependencies:o.map(t=>`${r}!spent-with-carryover-${t.id}`),run:l}),a.b().createDynamic(r,"total-income",{initialValue:0,dependencies:["group-sum-amount-"+n.id],run:t=>t}),a.b().createDynamic(r,"total-leftover",{initialValue:0,dependencies:["total-budgeted","total-spent"],run:l}),a.b().createDynamic(r,"total-budget-income",{initialValue:0,dependencies:["group-budget-"+n.id],run:t=>t}),a.b().createDynamic(r,"total-saved",{initialValue:0,dependencies:["total-budget-income","total-budgeted"],run:(t,e)=>t-e}),a.b().createDynamic(r,"real-saved",{initialValue:0,dependencies:["total-income","total-spent"],run:(t,e)=>Object(i.o)(t- -e)})}(r,e,g),s.createdMonths.add(t)}}),a.b().setMeta(s),a.a(),await a.j()}async function S(){let t=await o.first("SELECT * FROM transactions WHERE isChild=0 AND date IS NOT NULL ORDER BY date ASC LIMIT 1"),e=t&&o.fromDateRepr(t.date),r=n.e(),{start:i,end:s,range:u}=function(t,e){return(t=n.h(t))>(e=n.h(e))&&(t=e),{start:t=n.r(t,3),end:e=n.b(e,12),range:n.o(t,e)}}(e||r,r),c=a.b().meta().createdMonths||new Set;return u.filter(t=>!c.has(t)).length>0&&await E(u),{start:i,end:s}}async function O(t){let e=a.b().meta();if(t===e.budgetType)return;e.budgetType=t,e.createdMonths=new Set;let r=a.b().getNodes();o.transaction(()=>{for(let t of r.keys()){let[e,r]=t.split("!");e.match(/^budget\d+/)&&a.b().deleteCell(e,r)}}),a.b().startCacheBarrier(),a.f(o);let n=await S();return a.b().endCacheBarrier(),n}},function(t,e,r){"use strict";r.d(e,"a",(function(){return g}));var n=r(23),i=r(0),o=r(93),a=r(7),s=r(29);async function u(t){if(t.payee){let{transfer_acct:e}=await i.first("SELECT id, transfer_acct FROM v_payees WHERE id = ?",[t.payee]);return e}return null}async function c(t,e){const{offbudget:r}=await i.first("SELECT offbudget FROM accounts WHERE id = ?",[t.account]),{offbudget:n}=await i.first("SELECT offbudget FROM accounts WHERE id = ?",[e]);return r===n&&(await i.updateTransaction({id:t.id,category:null}),!0)}async function l(t,e){let{id:r}=await i.first("SELECT id FROM payees WHERE transfer_acct = ?",[t.account]);if(t.parent_id){let e=await i.first("\n SELECT p.id, p.transfer_acct FROM v_transactions t\n LEFT JOIN payees p ON p.id = t.payee\n WHERE t.id = ?\n ",[t.parent_id]);if(e.transfer_acct)return e.id!==t.payee?(await i.updateTransaction({id:t.id,payee:null}),{id:t.id,payee:null}):null}const n=await i.insertTransaction({account:e,amount:-t.amount,payee:r,date:t.date,transfer_id:t.id,notes:t.notes||null,cleared:!1});await i.updateTransaction({id:t.id,transfer_id:n});const o=await c(t,e);return{id:t.id,transfer_id:n,...o?{category:null}:{}}}async function f(t){let e=await i.getTransaction(t.transfer_id);return e&&(e.is_child?await i.updateTransaction({id:t.transfer_id,transfer_id:null,payee:null}):await i.deleteTransaction({id:t.transfer_id})),await i.updateTransaction({id:t.id,transfer_id:null}),{id:t.id,transfer_id:null}}async function d(t,e){let r=await async function(t){return i.first("SELECT * FROM payees WHERE transfer_acct = ?",[t])}(t.account);await i.updateTransaction({id:t.transfer_id,account:e,payee:r.id,date:t.date,notes:t.notes,amount:-t.amount});if(await c(t,e))return{id:t.id,category:null}}async function h(t){return Object(o.a)((t,e)=>i.selectWithSchema("transactions",t,e),t,t=>`id = '${t}'`,t=>"SELECT * FROM v_transactions_internal WHERE "+t)}async function g(t){let{added:e,deleted:r,updated:c,learnCategories:g=!1,detectOrphanPayees:p=!0}=t,m=[],y=c?c.map(t=>t.id):[],b=r?await async function(t){let e=Object(o.b)(t,"parent_id"),r=await i.all("SELECT id FROM v_transactions_internal WHERE "+e),n=new Set(t);for(let t of r)n.add(t.id);return[...n]}(r.map(t=>t.id)):[],_=new Set,v=await i.all("SELECT * FROM accounts WHERE tombstone = 0");if(c){let t=c.filter(t=>t.payee).map(t=>t.id),e=await h(t);for(let t=0;t<e.length;t++)_.add(e[t].payee)}await Object(a.c)(async()=>{e&&(m=await Promise.all(e.map(async t=>i.insertTransaction(t)))),r&&await Promise.all(b.map(async t=>{await i.deleteTransaction({id:t})})),c&&await Promise.all(c.map(async t=>{if(t.account){1===v.find(e=>e.id===t.account).offbudget&&(t.category=null)}await i.updateTransaction(t)}))});let w,E=await h(m),S=await h(y),O=await h(b),T=E;if(await Object(a.c)(async()=>{await Promise.all(E.map(t=>async function(t){let e=await u(t);if(e)return l(t,e)}(t))),w=(await Promise.all(S.map(t=>async function(t){const e=await u(t);return e&&!t.transfer_id?l(t,e):!e&&t.transfer_id?f(t):e&&t.transfer_id?d(t,e):void 0}(t)))).filter(Boolean),await Promise.all(O.map(t=>async function(t){t.transfer_id&&await f(t)}(t)))}),g){let t=new Set([...e?e.filter(t=>t.category).map(t=>t.id):[],...c?c.filter(t=>t.category).map(t=>t.id):[]]);await s.k(E.concat(S).filter(e=>t.has(e.id)))}if(p&&c){let t=c.map(t=>t.payee).filter(Boolean);if(t.length>0){let e=new Set(await i.getOrphanedPayees()),r=[..._].filter(t=>e.has(t));r.length>0&&n.c("orphaned-payees",{orphanedIds:r,updatedPayeeIds:t})}}return{added:T,updated:w}}},function(t,e,r){"use strict";var n,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(t,e){return new Promise((function(r,n){function i(r){t.removeListener(e,o),n(r)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),r([].slice.call(arguments))}y(t,e,o,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&y(t,"error",e,r)}(t,i,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function c(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function l(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function f(t,e,r,n){var i,o,a,s;if(c(r),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),a=o[e]),void 0===a)a=o[e]=r,++t._eventsCount;else if("function"==typeof a?a=o[e]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=l(t))>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return t}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=d.bind(n);return i.listener=r,n.wrapFn=i,i}function g(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(i):m(i,i.length)}function p(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function m(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function y(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function i(o){n.once&&t.removeEventListener(e,i),r(o)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(t){if("number"!=typeof t||t<0||a(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");u=t}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||a(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},s.prototype.getMaxListeners=function(){return l(this)},s.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var n="error"===t,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var a;if(e.length>0&&(a=e[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[t];if(void 0===u)return!1;if("function"==typeof u)o(u,this,e);else{var c=u.length,l=m(u,c);for(r=0;r<c;++r)o(l[r],this,e)}return!0},s.prototype.addListener=function(t,e){return f(this,t,e,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(t,e){return f(this,t,e,!0)},s.prototype.once=function(t,e){return c(e),this.on(t,h(this,t,e)),this},s.prototype.prependOnceListener=function(t,e){return c(e),this.prependListener(t,h(this,t,e)),this},s.prototype.removeListener=function(t,e){var r,n,i,o,a;if(c(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===e||r[o].listener===e){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,i),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,a||e)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},s.prototype.listeners=function(t){return g(this,t,!0)},s.prototype.rawListeners=function(t){return g(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},s.prototype.listenerCount=p,s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(t,e,r){"use strict";var n=r(19).Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=c,e=4;break;case"utf8":this.fillLast=s,e=4;break;case"base64":this.text=l,this.end=f,e=3;break;default:return this.write=d,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function l(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function d(t){return t.toString(this.encoding)}function h(t){return t&&t.length?this.write(t):""}e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},o.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},o.prototype.text=function(t,e){var r=function(t,e,r){var n=e.length-1;if(n<r)return 0;var i=a(e[n]);if(i>=0)return i>0&&(t.lastNeed=i-1),i;if(--n<r||-2===i)return 0;if((i=a(e[n]))>=0)return i>0&&(t.lastNeed=i-2),i;if(--n<r||-2===i)return 0;if((i=a(e[n]))>=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,r){"use strict";const n={info:function(){console.log(...arguments)},warn:function(){console.warn(...arguments)}};e.a=n},function(t,e,r){var n=r(19).Buffer,i=r(68).Transform,o=r(55).StringDecoder;function a(t){i.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(12)(a,i),a.prototype.update=function(t,e,r){"string"==typeof t&&(t=n.from(t,e));var i=this._update(t);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(t,e,r){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){n=t}finally{r(n)}},a.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},a.prototype._finalOrDigest=function(t){var e=this.__final()||n.alloc(0);return t&&(e=this._toString(e,t,!0)),e},a.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n},t.exports=a},function(t,e,r){"use strict";var n=r(106);t.exports=function(){return n()&&!!Symbol.toStringTag}},function(t,e,r){"use strict";var n=SyntaxError,i=Function,o=TypeError,a=function(t){try{return i('"use strict"; return ('+t+").constructor;")()}catch(t){}},s=Object.getOwnPropertyDescriptor;if(s)try{s({},"")}catch(t){s=null}var u=function(){throw new o},c=s?function(){try{return u}catch(t){try{return s(arguments,"callee").get}catch(t){return u}}}():u,l=r(137)(),f=Object.getPrototypeOf||function(t){return t.__proto__},d={},h="undefined"==typeof Uint8Array?void 0:f(Uint8Array),g={"%AggregateError%":"undefined"==typeof AggregateError?void 0:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"%ArrayIteratorPrototype%":l?f([][Symbol.iterator]()):void 0,"%AsyncFromSyncIteratorPrototype%":void 0,"%AsyncFunction%":d,"%AsyncGenerator%":d,"%AsyncGeneratorFunction%":d,"%AsyncIteratorPrototype%":d,"%Atomics%":"undefined"==typeof Atomics?void 0:Atomics,"%BigInt%":"undefined"==typeof BigInt?void 0:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?void 0:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?void 0:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?void 0:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?void 0:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?void 0:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?void 0:FinalizationRegistry,"%Function%":i,"%GeneratorFunction%":d,"%Int8Array%":"undefined"==typeof Int8Array?void 0:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?void 0:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?void 0:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":l?f(f([][Symbol.iterator]())):void 0,"%JSON%":"object"==typeof JSON?JSON:void 0,"%Map%":"undefined"==typeof Map?void 0:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&l?f((new Map)[Symbol.iterator]()):void 0,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?void 0:Promise,"%Proxy%":"undefined"==typeof Proxy?void 0:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?void 0:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?void 0:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&l?f((new Set)[Symbol.iterator]()):void 0,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":l?f(""[Symbol.iterator]()):void 0,"%Symbol%":l?Symbol:void 0,"%SyntaxError%":n,"%ThrowTypeError%":c,"%TypedArray%":h,"%TypeError%":o,"%Uint8Array%":"undefined"==typeof Uint8Array?void 0:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?void 0:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?void 0:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?void 0:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?void 0:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?void 0:WeakSet};try{null.error}catch(t){var p=f(f(t));g["%Error.prototype%"]=p}var m={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},y=r(138),b=r(398),_=y.call(Function.call,Array.prototype.concat),v=y.call(Function.apply,Array.prototype.splice),w=y.call(Function.call,String.prototype.replace),E=y.call(Function.call,String.prototype.slice),S=y.call(Function.call,RegExp.prototype.exec),O=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,T=/\\(\\)?/g,A=function(t){var e=E(t,0,1),r=E(t,-1);if("%"===e&&"%"!==r)throw new n("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new n("invalid intrinsic syntax, expected opening `%`");var i=[];return w(t,O,(function(t,e,r,n){i[i.length]=r?w(n,T,"$1"):e||t})),i},M=function(t,e){var r,i=t;if(b(m,i)&&(i="%"+(r=m[i])[0]+"%"),b(g,i)){var s=g[i];if(s===d&&(s=function t(e){var r;if("%AsyncFunction%"===e)r=a("async function () {}");else if("%GeneratorFunction%"===e)r=a("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=a("async function* () {}");else if("%AsyncGenerator%"===e){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===e){var i=t("%AsyncGenerator%");i&&(r=f(i.prototype))}return g[e]=r,r}(i)),void 0===s&&!e)throw new o("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:s}}throw new n("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new o('"allowMissing" argument must be a boolean');if(null===S(/^%?[^%]*%?$/,t))throw new n("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=A(t),i=r.length>0?r[0]:"",a=M("%"+i+"%",e),u=a.name,c=a.value,l=!1,f=a.alias;f&&(i=f[0],v(r,_([0,1],f)));for(var d=1,h=!0;d<r.length;d+=1){var p=r[d],m=E(p,0,1),y=E(p,-1);if(('"'===m||"'"===m||"`"===m||'"'===y||"'"===y||"`"===y)&&m!==y)throw new n("property names with quotes must have matching quotes");if("constructor"!==p&&h||(l=!0),b(g,u="%"+(i+="."+p)+"%"))c=g[u];else if(null!=c){if(!(p in c)){if(!e)throw new o("base intrinsic for "+t+" exists, but the property is not available.");return}if(s&&d+1>=r.length){var w=s(c,p);c=(h=!!w)&&"get"in w&&!("originalValue"in w.get)?w.get:c[p]}else h=b(c,p),c=c[p];h&&!l&&(g[u]=c)}}return c}},function(t,e,r){var n=r(382),i=r(383),o=i;o.v1=n,o.v4=i,t.exports=o},function(t,e,r){"use strict";r.d(e,"b",(function(){return s})),r.d(e,"c",(function(){return u})),r.d(e,"d",(function(){return c})),r.d(e,"e",(function(){return h})),r.d(e,"a",(function(){return g}));var n=r(22),i=r(5);function o(t){return"number"==typeof t?t:0}function a(t,e){return{type:"SplitTransactionError",version:1,difference:o(e.amount)-t}}function s(t,e){let r="temp"===t.id?"temp":"";return{amount:0,...e,payee:e.payee||t.payee,id:e.id?e.id:r+n.a(),account:t.account,date:t.date,cleared:null!=t.cleared?t.cleared:null,starting_balance_flag:null!=t.starting_balance_flag?t.starting_balance_flag:null,is_child:!0,parent_id:t.id,error:null}}function u(t){const e=t.subtransactions.reduce((t,e)=>t+o(e.amount),0);return{...t,error:e===o(t.amount)?null:a(e,t)}}function c(t){return t.reduce((t,e)=>{let{subtransactions:r,...n}=e;r=r||[],t.push(n);for(let e=0;e<r.length;e++)t.push(r[e]);return t},[])}function l(t){return{...t[0],subtransactions:t.slice(1)}}function f(t){return null==t?null:c([t])}function d(t,e,r){let n=t.findIndex(t=>t.id===e),o=t[n],a=[...t];if(-1===n)throw new Error("Tried to edit unknown transaction id: "+e);if(o.is_parent||o.is_child){let e=function(t,e){for(;e>=0;){if(t[e].is_parent)return e;e--}return null}(t,n);if(null==e)return console.log("Cannot find parent index"),{diff:{deleted:[],updated:[]}};let o,s=function(t,e){let r=[t[e]],n=e+1;for(;n<t.length&&t[n].is_child;)r.push(t[n]),n++;return r}(t,e),u=r(l(s)),c=f(u);return null==c?(o={deleted:[{id:s[0].id}],updated:[]},u={id:s[0].id,_deleted:!0},a.splice(e,s.length)):(o=Object(i.d)(s,c),a.splice(e,s.length,...c)),{data:a,newTransaction:u,diff:o}}{let t=r(o),e=f(t)||[];return t&&(t.subtransactions=t.subtransactions||[]),a.splice(n,1,...e),{data:a,newTransaction:t||{id:o.id,_deleted:!0},diff:Object(i.d)([o],e)}}}function h(t,e){return d(t,e.id,t=>{if(t.is_parent){let r=t.id===e.id?e:t,n=t.subtransactions.map(n=>{let i=n;return t.id===e.id?i={...n,payee:n.payee===t.payee?e.payee:n.payee}:n.id===e.id&&(i=e),s(r,i)});return u({...r,subtransactions:n})}return e})}function g(t,e){return d(t,e,t=>{if(t.is_parent){if(t.id===e)return null;if(1===t.subtransactions.length)return{...t,subtransactions:null,is_parent:!1,error:null};{let r=t.subtransactions.filter(t=>t.id!==e);return u({...t,subtransactions:r})}}return null})}},function(t,e,r){"use strict";var n=function(t,e){return t===e};e.a=function(t,e){var r;void 0===e&&(e=n);var i,o=[],a=!1,s=function(t,r){return e(t,o[r],r)};return function(){for(var e=arguments.length,n=new Array(e),u=0;u<e;u++)n[u]=arguments[u];return a&&r===this&&n.length===o.length&&n.every(s)||(i=t.apply(this,n),a=!0,r=this,o=n),i}}},,function(t,e,r){"use strict";var n=r(100),i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=f;var o=Object.create(r(83));o.inherits=r(12);var a=r(154),s=r(115);o.inherits(f,a);for(var u=i(s.prototype),c=0;c<u.length;c++){var l=u[c];f.prototype[l]||(f.prototype[l]=s.prototype[l])}function f(t){if(!(this instanceof f))return new f(t);a.call(this,t),s.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",d)}function d(){this.allowHalfOpen||this._writableState.ended||n.nextTick(h,this)}function h(t){t.end()}Object.defineProperty(f.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(f.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),f.prototype._destroy=function(t,e){this.push(null),this.end(),n.nextTick(e,t)}},function(t,e,r){"use strict";var n=r(136),i="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,a=Array.prototype.concat,s=Object.defineProperty,u=r(400)(),c=s&&u,l=function(t,e,r,n){var i;(!(e in t)||"function"==typeof(i=n)&&"[object Function]"===o.call(i)&&n())&&(c?s(t,e,{configurable:!0,enumerable:!1,value:r,writable:!0}):t[e]=r)},f=function(t,e){var r=arguments.length>2?arguments[2]:{},o=n(e);i&&(o=a.call(o,Object.getOwnPropertySymbols(e)));for(var s=0;s<o.length;s+=1)l(t,o[s],e[o[s]],r[o[s]])};f.supportsDescriptors=!!c,t.exports=f},function(t,e,r){"use strict";r.d(e,"a",(function(){return n}));const n=self.fetch},function(t,e,r){"use strict";r.d(e,"d",(function(){return d})),r.d(e,"c",(function(){return h})),r.d(e,"a",(function(){return g})),r.d(e,"b",(function(){return p}));var n=r(9),i=r(22),o=r(96),a=r(5),s=r(0),u=r(4),c=r(27),l=r(15),f=r(37);async function d(t,e){let[[,r],[,o]]=await n.c(["user-id","user-key"]);if(null==t||!t.institution_id||!t.name)throw new Error("Invalid institution object");let a=i.a();return await Object(c.b)(Object(l.a)().PLAID_SERVER+"/handoff_public_token",{userId:r,key:o,item_id:a,public_token:e}),await Object(u.e)(()=>s.insertWithUUID("banks",{id:a,bank_id:t.institution_id,name:t.name})),a}async function h(t,e){let r=await s.first("SELECT id, bank_id, name FROM banks WHERE bank_id = ?",[e]);if(r)return r;const n={id:i.a(),bank_id:e,name:t.name};return await s.insertWithUUID("banks",n),n}async function g(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],[[,i],[,c]]=await n.c(["user-id","user-key"]),l=await f.b(i,c,t);return l=l.filter(t=>e.includes(t.account_id)),Promise.all(l.map(async e=>{let n=await Object(u.e)(async()=>{let n=await s.insertAccount({account_id:e.account_id,name:e.name,official_name:e.official_name,type:Object(o.a)(e.type),balance_current:Object(a.a)(e.balances.current),mask:e.mask,bank:t,offbudget:r.includes(e.account_id)?1:0});return await s.insertPayee({name:"",transfer_acct:n}),n});return await f.e(i,c,n,e.account_id,t),n}))}async function p(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],[[,i],[,c]]=await n.c(["user-id","user-key"]),l=await f.c(i,c,t);return l=l.filter(t=>e.includes(t.account_id)),Promise.all(l.map(async e=>{let n=await Object(u.e)(async()=>{let n=await s.insertAccount({account_id:e.account_id,name:e.name,official_name:e.official_name,type:Object(o.a)(e.type),balance_current:Object(a.a)(e.balances.current),mask:e.mask,bank:t,offbudget:r.includes(e.account_id)?1:0});return await s.insertPayee({name:"",transfer_acct:n}),n});return await f.f(i,c,n,e.account_id,t),n}))}},function(t,e,r){t.exports=i;var n=r(54).EventEmitter;function i(){n.call(this)}r(12)(i,n),i.Readable=r(113),i.Writable=r(270),i.Duplex=r(271),i.Transform=r(272),i.PassThrough=r(273),i.Stream=i,i.prototype.pipe=function(t,e){var r=this;function i(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),t.on("drain",o),t._isStdio||e&&!1===e.end||(r.on("end",s),r.on("close",u));var a=!1;function s(){a||(a=!0,t.end())}function u(){a||(a=!0,"function"==typeof t.destroy&&t.destroy())}function c(t){if(l(),0===n.listenerCount(this,"error"))throw t}function l(){r.removeListener("data",i),t.removeListener("drain",o),r.removeListener("end",s),r.removeListener("close",u),r.removeListener("error",c),t.removeListener("error",c),r.removeListener("end",l),r.removeListener("close",l),t.removeListener("close",l)}return r.on("error",c),t.on("error",c),r.on("end",l),r.on("close",l),t.on("close",l),t.emit("pipe",r),t}},function(t,e,r){"use strict";(function(e,n){var i=r(19).Buffer,o=e.crypto||e.msCrypto;o&&o.getRandomValues?t.exports=function(t,e){if(t>4294967295)throw new RangeError("requested too many random bytes");var r=i.allocUnsafe(t);if(t>0)if(t>65536)for(var a=0;a<t;a+=65536)o.getRandomValues(r.slice(a,a+65536));else o.getRandomValues(r);if("function"==typeof e)return n.nextTick((function(){e(null,r)}));return r}:t.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,r(33),r(25))},function(t,e,r){"use strict";var n={};function i(t,e,r){r||(r=Error);var i=function(t){var r,n;function i(r,n,i){return t.call(this,function(t,r,n){return"string"==typeof e?e:e(t,r,n)}(r,n,i))||this}return n=t,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);i.prototype.name=r.name,i.prototype.code=t,n[t]=i}function o(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}i("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(t,e,r){var n,i,a,s;if("string"==typeof e&&(i="not ",e.substr(!a||a<0?0:+a,i.length)===i)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))s="The ".concat(t," ").concat(n," ").concat(o(e,"type"));else{var u=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(u," ").concat(n," ").concat(o(e,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},function(t,e,r){"use strict";(function(e){var n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=c;var i=r(166),o=r(170);r(12)(c,i);for(var a=n(o.prototype),s=0;s<a.length;s++){var u=a[s];c.prototype[u]||(c.prototype[u]=o.prototype[u])}function c(t){if(!(this instanceof c))return new c(t);i.call(this,t),o.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",l)))}function l(){this._writableState.ended||e.nextTick(f,this)}function f(t){t.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}).call(this,r(25))},function(t,e,r){var n=r(19).Buffer;function i(t,e){this._block=n.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}i.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=n.from(t,e));for(var r=this._block,i=this._blockSize,o=t.length,a=this._len,s=0;s<o;){for(var u=a%i,c=Math.min(o-s,i-u),l=0;l<c;l++)r[u+l]=t[s+l];s+=c,(a+=c)%i==0&&this._update(r)}return this._len+=o,this},i.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=i},function(t,e,r){"use strict";var n={};function i(t,e,r){r||(r=Error);var i=function(t){var r,n;function i(r,n,i){return t.call(this,function(t,r,n){return"string"==typeof e?e:e(t,r,n)}(r,n,i))||this}return n=t,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);i.prototype.name=r.name,i.prototype.code=t,n[t]=i}function o(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}i("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(t,e,r){var n,i,a,s;if("string"==typeof e&&(i="not ",e.substr(!a||a<0?0:+a,i.length)===i)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))s="The ".concat(t," ").concat(n," ").concat(o(e,"type"));else{var u=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(u," ").concat(n," ").concat(o(e,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},function(t,e,r){"use strict";(function(e){var n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=c;var i=r(191),o=r(195);r(12)(c,i);for(var a=n(o.prototype),s=0;s<a.length;s++){var u=a[s];c.prototype[u]||(c.prototype[u]=o.prototype[u])}function c(t){if(!(this instanceof c))return new c(t);i.call(this,t),o.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",l)))}function l(){this._writableState.ended||e.nextTick(f,this)}function f(t){t.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}).call(this,r(25))},function(t,e,r){"use strict";r.d(e,"a",(function(){return Ct}));class n extends Error{}let i;class o{constructor(t,e){if(this.duration=e&&e.duration||0,this.generators=e&&e.generators&&e.generators.slice()||[],!Number.isInteger(this.duration)||this.duration<0)throw new n("duration must be a non-negative integer")}static set adapter(t){if(i)throw new Error(`"${i.name}" has already been configured.`);i=t}static get adapter(){if(!i)throw new Error("No date adapter has been configured. See rSchedule docs.");return i}static isDate(t){throw a("isDate()")}static fromDate(t,e){throw a("fromDate()")}static fromJSON(t){throw a("fromJSON()")}static fromDateTime(t){throw a("fromDateTime()")}toISOString(){return this.set("timezone","UTC").toDateTime().toISOString()}toDateTime(){return c.fromJSON(Object.assign(Object.assign({},this.toJSON()),{generators:this.generators}))}}function a(t){return new Error(`You must implement the "${t}" method for this DateAdapter class`)}var s;o.hasTimezoneSupport=!1,function(t){t.WEEKDAYS=["SU","MO","TU","WE","TH","FR","SA"],t.MILLISECONDS_IN_SECOND=1e3,t.MILLISECONDS_IN_MINUTE=60*t.MILLISECONDS_IN_SECOND,t.MILLISECONDS_IN_HOUR=60*t.MILLISECONDS_IN_MINUTE,t.MILLISECONDS_IN_DAY=24*t.MILLISECONDS_IN_HOUR,t.MILLISECONDS_IN_WEEK=7*t.MILLISECONDS_IN_DAY}(s||(s={}));class u extends Error{}class c{constructor(t,e,r,n){if(this.date=new Date(t),this.timezone=e||null,this.duration=r||0,this.generators=n&&n.slice()||[],!Number.isInteger(this.duration)||this.duration<0)throw new u("duration must be a non-negative integer");this.assertIsValid()}static fromJSON(t){const e=new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond));return new c(e,t.timezone,t.duration,t.generators)}static fromDateAdapter(t){return c.fromJSON(Object.assign(Object.assign({},t.toJSON()),{generators:t.generators}))}get end(){if(this.duration)return this._end||(this._end=this.add(this.duration,"millisecond")),this._end}isEqual(t){return!!t&&(l(this,t),this.valueOf()===t.valueOf())}isBefore(t){return l(this,t),this.valueOf()<t.valueOf()}isBeforeOrEqual(t){return l(this,t),this.valueOf()<=t.valueOf()}isAfter(t){return l(this,t),this.valueOf()>t.valueOf()}isAfterOrEqual(t){return l(this,t),this.valueOf()>=t.valueOf()}isOccurring(t){if(!this.duration)throw new Error("DateTime#isOccurring() is only applicable to DateTimes with durations");return l(this,t),t.isAfterOrEqual(this)&&t.isBeforeOrEqual(this.add(this.duration,"millisecond"))}add(t,e){switch(e){case"generator":{const e=this.generators.slice();return e.unshift(t),new c(this.date,this.timezone,this.duration,e)}case"year":return this.forkDateTime(w(this.date,t));case"month":return this.forkDateTime(E(this.date,t));case"week":return this.forkDateTime(S(this.date,t));case"day":return this.forkDateTime(O(this.date,t));case"hour":return this.forkDateTime(T(this.date,t));case"minute":return this.forkDateTime(A(this.date,t));case"second":return this.forkDateTime(M(this.date,t));case"millisecond":return this.forkDateTime(I(this.date,t));default:throw new Error("Invalid unit provided to `DateTime#add`")}}subtract(t,e){switch(e){case"year":return this.forkDateTime(function(t,e){return w(t,-e)}(this.date,t));case"month":return this.forkDateTime(function(t,e){return E(t,-e)}(this.date,t));case"week":return this.forkDateTime(function(t,e){return S(t,-e)}(this.date,t));case"day":return this.forkDateTime(R(this.date,t));case"hour":return this.forkDateTime(function(t,e){return T(t,-e)}(this.date,t));case"minute":return this.forkDateTime(function(t,e){return A(t,-e)}(this.date,t));case"second":return this.forkDateTime(function(t,e){return M(t,-e)}(this.date,t));case"millisecond":return this.forkDateTime(function(t,e){return I(t,-e)}(this.date,t));default:throw new Error("Invalid unit provided to `DateTime#subtract`")}}get(t){switch(t){case"year":return this.date.getUTCFullYear();case"month":return this.date.getUTCMonth()+1;case"yearday":return function(t){const e=new Date(Date.UTC(t.getUTCFullYear(),0,1)),r=t.valueOf()-e.valueOf();return 1+Math.floor(r/s.MILLISECONDS_IN_DAY)}(this.date);case"weekday":return s.WEEKDAYS[this.date.getUTCDay()];case"day":return this.date.getUTCDate();case"hour":return this.date.getUTCHours();case"minute":return this.date.getUTCMinutes();case"second":return this.date.getUTCSeconds();case"millisecond":return this.date.getUTCMilliseconds();default:throw new Error("Invalid unit provided to `DateTime#set`")}}set(t,e){if("duration"===t)return new c(this.date,this.timezone,e,this.generators);if("generators"===t)return new c(this.date,this.timezone,this.duration,e);let r=new Date(this.date);switch(t){case"year":r.setUTCFullYear(e);break;case"month":{const t=m(e,r.getUTCFullYear());r.getUTCDate()>t?(r.setUTCDate(1),r.setUTCMonth(e),r=R(r,1)):r.setUTCMonth(e-1);break}case"day":r.setUTCDate(e);break;case"hour":r.setUTCHours(e);break;case"minute":r.setUTCMinutes(e);break;case"second":r.setUTCSeconds(e);break;case"millisecond":r.setUTCMilliseconds(e);break;default:throw new Error("Invalid unit provided to `DateTime#set`")}return this.forkDateTime(r)}granularity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.forkDateTime(this.date);switch(t){case"year":r=r.set("month",1);case"month":r=r.set("day",1);break;case"week":r=function(t,e){const r=h(e).indexOf(t.get("weekday"));return t.subtract(r,"day")}(r,e.weekStart)}switch(t){case"year":case"month":case"week":case"day":r=r.set("hour",0);case"hour":r=r.set("minute",0);case"minute":r=r.set("second",0);case"second":r=r.set("millisecond",0);case"millisecond":return r;default:throw new Error("Invalid granularity provided to `DateTime#granularity`: "+t)}}endGranularity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.forkDateTime(this.date);switch(t){case"year":r=r.set("month",12);case"month":r=r.set("day",m(r.get("month"),r.get("year")));break;case"week":r=function(t,e){const r=h(e).indexOf(t.get("weekday"));return t.add(6-r,"day")}(r,e.weekStart)}switch(t){case"year":case"month":case"week":case"day":r=r.set("hour",23);case"hour":r=r.set("minute",59);case"minute":r=r.set("second",59);case"second":r=r.set("millisecond",999);case"millisecond":return r;default:throw new Error("Invalid granularity provided to `DateTime#granularity`: "+t)}}toISOString(){return this.date.toISOString()}toDateTime(){return this}toJSON(){const t={timezone:this.timezone,year:this.get("year"),month:this.get("month"),day:this.get("day"),hour:this.get("hour"),minute:this.get("minute"),second:this.get("second"),millisecond:this.get("millisecond")};return this.duration&&(t.duration=this.duration),t}valueOf(){return this.date.valueOf()}assertIsValid(){if(isNaN(this.valueOf()))throw new u("DateTime has invalid date.");return!0}forkDateTime(t){return new c(t,this.timezone,this.duration,this.generators)}}function l(t,e){if(t.timezone!==e.timezone)throw new u("Attempted to compare a datetime to another date in a different timezone: "+JSON.stringify(t)+" and "+JSON.stringify(e));return!0}function f(t,e){if(t.isAfter(e))return 1;if(t.isBefore(e))return-1;if(t.duration&&e.duration){if(t.duration>e.duration)return 1;if(t.duration<e.duration)return-1}return 0}function d(t){return Array.from(new Map(t.map(t=>[t.toISOString(),t])).values())}function h(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"SU";const e=s.WEEKDAYS.slice();let r=e.indexOf(t);for(;0!==r;)g(e),r--;return e}function g(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"first";return 0===t.length||("first"===e?t.push(t.shift()):t.unshift(t.pop())),t}function p(t,e){if(t===e)return 0;const r=s.WEEKDAYS.indexOf(t)-s.WEEKDAYS.indexOf(e);return r>0?7-r:Math.abs(r)}function m(t,e){return{1:31,2:y(e),3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31}[t]}function y(t){return b(t)?29:28}function b(t){return t%400==0||t%4==0&&t%100!=0}function _(t){if(null===t||!0===t||!1===t)return NaN;const e=Number(t);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}function v(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");const r=t.valueOf(),n=_(e);return new Date(r+n)}function w(t,e){return E(t,12*_(e))}function E(t,e){const r=_(e),n=(t=new Date(t)).getUTCMonth()+r,i=new Date(0);i.setUTCFullYear(t.getUTCFullYear(),n,1),i.setUTCHours(0,0,0,0);const o=m(i.getUTCMonth()+1,i.getUTCFullYear());return t.setUTCMonth(n,Math.min(o,t.getUTCDate())),t}function S(t,e){return O(t,7*_(e))}function O(t,e){return I(t,_(e)*s.MILLISECONDS_IN_DAY)}function T(t,e){return v(t,_(e)*s.MILLISECONDS_IN_HOUR)}function A(t,e){return v(t,_(e)*s.MILLISECONDS_IN_MINUTE)}function M(t,e){return v(t,_(e)*s.MILLISECONDS_IN_SECOND)}function I(t,e){const r=_(e),n=t.getTime();return new Date(n+r)}function R(t,e){return O(t,-e)}class N extends Error{}class k extends Error{}function D(t,e){return t>e?1:e>t?-1:0}function j(t){return JSON.parse(JSON.stringify(t))}function C(t,e){return t instanceof c?t.timezone!==e?o.adapter.fromDateTime(t).set("timezone",e).toDateTime():t:t instanceof o?t.set("timezone",e).toDateTime():o.adapter.fromDate(t).set("timezone",e).toDateTime()}function L(t,e){return t.timezone!==e?o.adapter.fromDateTime(t).set("timezone",e).toDateTime():t}class x extends Error{}function B(t,e){const r=function(t){let e,r;if(t.start instanceof c)e=t.start;else if(t.start instanceof o)e=t.start.toDateTime();else{if(!o.adapter.isDate(t.start))throw new x('"start" must be either a `DateAdapter` instance or an instance of the date a DateAdapter is wrapping (e.g. `StandardDateAdapter` wraps a `Date`)');e=o.adapter.fromDate(t.start).toDateTime()}if(t.end)if(t.end instanceof c)r=t.end;else if(t.end instanceof o)r=t.end.toDateTime();else{if(!o.adapter.isDate(t.end))throw new x('"end" must be either be `undefined`, a `DateAdapter` instance, or an instance of the date a DateAdapter is wrapping (e.g. `StandardDateAdapter` wraps a `Date`)');r=o.adapter.fromDate(t.end).toDateTime()}if(void 0!==t.duration){if(!Number.isInteger(t.duration))throw new x('"duration" expects a whole number');if(t.duration<=0)throw new x('"duration" must be greater than 0')}if(void 0!==t.count){if(!Number.isInteger(t.count))throw new x('"count" must be a whole number');if(t.count<0)throw new x('"count" must be greater than 0')}if(void 0!==t.end&&void 0!==t.count)throw new x('"end" and "count" cannot both be present');return{start:e,end:r,count:t.count,duration:t.duration}}(e),n=j(e);return t.forEach(t=>{t.normalizeOptions(n,r)}),Object.keys(r).forEach(t=>{void 0===r[t]&&delete r[t]}),r}function U(t){const e=j(t);return e.start=t.start,t.end&&(e.end=t.end),e}class F extends Error{}class P{constructor(t){this.date=t}}class W{constructor(t){this.date=t}}class z{constructor(t,e,r){this.options=e,this.args=r,this.rules=[],this.iterator=void 0===this.options.count?this.iterate():this.args.reverse?this.iterateWithReverseCount():this.iterateWithCount(),this.options=Object.assign(Object.assign({},j(e)),{start:e.start,end:e.end}),this.reverse=void 0===this.options.count&&r.reverse||!1;const{start:n,end:i}=this.normalizeDateTimeArgs(r);if(void 0!==e.count?this.start=e.start:n&&e.start?this.start=n.isAfterOrEqual(e.start)?n:e.start:this.start=n||e.start,i&&e.end?this.end=i.isBeforeOrEqual(e.end)?i:e.end:this.end=i||e.end,this.args.reverse&&void 0===e.count&&!this.end)throw new Error("When iterating in reverse, the rule must have an `end` or `count` property or you must provide an `end` argument.");this.isInfinite=!this.end&&void 0===this.options.count,this.hasDuration=!!this.options.duration,this.rules=Array.isArray(t)?t:t(this)}[Symbol.iterator](){return this.iterator}next(t){return this.iterator.next(t)}*iterateWithReverseCount(){let t;const e=Array.from(this.iterateWithCount()).reverse().slice();let r=e.shift();for(;r;)if(t&&t.skipToDate&&r.isAfter(t.skipToDate))r=e.shift();else{if(t=yield r,t&&t.skipToDate&&t.skipToDate.isAfterOrEqual(r))throw new Error("A provided `skipToDate` option must be greater than the last yielded date (or smaller, in the case of reverse iteration)");r=e.shift()}}*iterateWithCount(){if(0===this.options.count)return;const t=this.iterate(),e=this.args.start||this.start;let r,n=t.next().value,i=1;for(;n&&i<=this.options.count;)if(i++,n.isBefore(e))n=t.next().value;else if(r&&r.skipToDate&&n.isBefore(r.skipToDate))n=t.next().value;else{if(r=yield n,r&&r.skipToDate&&r.skipToDate.isBeforeOrEqual(n))throw new Error("A provided `skipToDate` option must be greater than the last yielded date (or smaller, in the case of reverse iteration)");n=t.next().value}}*iterate(){let t=this.start;this.reverse&&(t=this.end);let e=this.nextDate(t);for(;e;){const t=yield this.normalizeRunOutput(e);if(t&&t.skipToDate){if(this.reverse?t.skipToDate.isAfterOrEqual(e):t.skipToDate.isBeforeOrEqual(e))throw new Error("A provided `skipToDate` option must be greater than the last yielded date (or smaller, in the case of reverse iteration)");e=this.nextDate(t.skipToDate)}else e=this.nextDate(this.reverse?e.subtract(1,"millisecond"):e.add(1,"millisecond"))}}nextDate(t){let e=this.runRules(t.set("generators",[]));if(this.isDatePastEnd(e.date))return null;let r=0;for(;e instanceof W&&r<50;){if(e=this.runRules(e.date),this.isDatePastEnd(e.date))return null;r++}if(e instanceof W)throw new F(`Failed to find a matching occurrence in ${r} iterations. Last iterated date: "${e.date.toISOString()}"`);if(this.reverse?t.isBefore(e.date):t.isAfter(e.date))throw new F("An error occurred in a recurrence rule. If this happened using the rSchedule provided recurrence rules, you should open an issue in the rSchedule repo. The maintainer is going to want to know how to recreate the error.");return e.date}runRules(t){let e=new P(t);for(const t of this.rules){if(e instanceof W)return e;e=t.run(e.date)}return e}isDatePastEnd(t){return this.reverse?t.isBefore(this.start):this.end&&t.isAfter(this.end)}normalizeRunOutput(t){return this.hasDuration?t.set("duration",this.options.duration):t}normalizeDateTimeArgs(t){return{start:t.start&&L(t.start,this.options.start.timezone),end:t.end&&L(t.end,this.options.start.timezone)}}}class H{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.timezone=void 0!==t.timezone?t.timezone:null,this.maxDuration=t.maxDuration||0}get firstDate(){if(void 0!==this._firstDate)return this._firstDate;const t=this._run().next().value;return this._firstDate=t?this.dateAdapter.fromDateTime(t):null,this._firstDate}get lastDate(){if(void 0!==this._lastDate)return this._lastDate;if(this.isInfinite)return this._lastDate=null,null;const t=this._run({reverse:!0}).next().value;return this._lastDate=t?this.dateAdapter.fromDateTime(t):null,this._lastDate}pipe(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.reduce((t,e)=>e({base:t,timezone:this.timezone}),this)}occurrences(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new q(this,this.normalizeOccurrencesArgs(t))}collections(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new G(this,this.normalizeCollectionsArgs(t))}occursBetween(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=this.normalizeDateInput(t),i=this.normalizeDateInput(e);if(this.hasDuration&&!r.excludeEnds){const t=this.getMaxDuration("occursBetween",r),e=this._run({start:n.subtract(t,"millisecond"),end:i,reverse:!0});for(const t of e)if(!t.end.isBefore(n))return!0;return!1}for(const t of this._run({start:n,end:i})){if(r.excludeEnds){if(t.isEqual(n))continue;if(t.isEqual(i))break}return!0}return!1}occursOn(t){const e=this.normalizeOccursOnArgs(t);if(e.weekday){if(this.isInfinite&&!e.before)throw new N("When calling `occursOn()` with a `weekday` argument and an occurrence object that has infinite occurrences, you must include a `before` argument as well.");const t=e.after&&(e.excludeEnds?e.after.add(1,"day"):e.after),r=e.before&&(e.excludeEnds?e.before.subtract(1,"day"):e.before),n=this._run({start:t,end:r});let i=n.next().value;if(!i)return!1;for(;i;){if(i.get("weekday")===e.weekday)return!0;i=n.next({skipToDate:i.add(p(i.get("weekday"),e.weekday),"day").granularity("day")}).value}return!1}if(!e.date)throw new N('"occursOn()" must be called with either a "date" or "weekday" argument');if(this.hasDuration){const t=this.getMaxDuration("occursOn",e),r=this._run({start:e.date.subtract(t,"millisecond"),end:e.date});for(const t of r)if(!t.end.isBefore(e.date))return!t.isAfter(e.date);return!1}for(const t of this._run({start:e.date,end:e.date}))return!!t;return!1}occursAfter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=this.normalizeDateInput(t);if(this.hasDuration&&!e.excludeStart){const t=this.getMaxDuration("occursAfter",e),n=this._run({start:r.subtract(t,"millisecond")});for(const t of n)if(!t.end.isBefore(r))return!0;return!1}for(const t of this._run({start:r}))if(!e.excludeStart||!t.isEqual(r))return!0;return!1}occursBefore(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=this.normalizeDateInput(t);if(this.hasDuration&&e.excludeStart){for(const t of this._run({end:r,reverse:!0}))if(!t.end.isAfterOrEqual(r))return!0;return!1}for(const t of this._run({end:r,reverse:!0}))if(!e.excludeStart||!t.isEqual(r))return!0;return!1}get dateAdapter(){return o.adapter}normalizeOccurrencesArgs(t){return Object.assign(Object.assign({},t),{start:this.normalizeDateInput(t.start),end:this.normalizeDateInput(t.end)})}normalizeCollectionsArgs(t){if(void 0!==t.reverse)throw new N("`collections()` does not support the `reverse` option at this time.");return Object.assign(Object.assign({},t),{start:this.normalizeDateInput(t.start),end:this.normalizeDateInput(t.end)})}normalizeOccursOnArgs(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign(Object.assign({},t),{date:this.normalizeDateInput(t.date),after:this.normalizeDateInput(t.after),before:this.normalizeDateInput(t.before),excludeDates:t.excludeDates&&t.excludeDates.map(t=>this.normalizeDateInput(t))})}normalizeRunArgs(t){return Object.assign(Object.assign({},t),{start:this.normalizeDateInput(t.start),end:this.normalizeDateInput(t.end)})}normalizeDateInput(t){return t?C(t,this.timezone):void 0}normalizeDateInputToAdapter(t){if(t)return function(t){return t instanceof c?o.adapter.fromDateTime(t):t instanceof o?t:o.adapter.fromDate(t)}(t)}normalizeRunOutput(t){return L(t,this.timezone)}getMaxDuration(t,e){const r=e.maxDuration||this.maxDuration;if(!Number.isInteger(r))throw new N(`When an occurrence generator has a duration, a 'maxDuration' argument must be supplied to ${t}().`);return r}}class q{constructor(t,e){this.iterable=t,this.args=e,this[Symbol.iterator]=()=>this.occurrenceIterator(),this.iterator=t._run(e),this.isInfinite=t.isInfinite}next(t){return this.occurrenceIterator(t).next()}toArray(){if(this.args.end||this.args.take||!this.isInfinite)return Array.from(this.occurrenceIterator());throw new k("OccurrenceIterator#toArray() can only be called if the iterator is not infinite, or you provide and `end` argument, or you provide a `take` argument.")}*occurrenceIterator(t){let e=this.normalizeRunArgs(t),r=this.iterator.next(e).value;for(;r;){const t=yield this.normalizeDateOutput(r);e=this.normalizeRunArgs(t),r=this.iterator.next(e).value}}normalizeRunArgs(t){return{skipToDate:this.normalizeDateInput(t&&t.skipToDate)}}normalizeDateInput(t){return t?C(t,this.iterable.timezone):void 0}normalizeDateOutput(t){if(t)return t?o.adapter.fromDateTime(t):void 0}}class V{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;this.dates=t,this.granularity=e,this.periodStart=r,this.periodEnd=n}}class G{constructor(t,e){if(this.iterable=t,this.args=e,this.granularity="year",this[Symbol.iterator]=()=>this.iterator,e.granularity&&(this.granularity=e.granularity,"week"===this.granularity&&!e.weekStart))throw new Error('"week" granularity requires `weekStart` arg');if(e.weekStart&&(this.weekStart=e.weekStart),e.reverse)throw new Error("`OccurrenceGenerator#collections()` does not support iterating in reverse. Though `OccurrenceGenerator#occurrences()` does support iterating in reverse.");this.args=Object.assign(Object.assign({},e),{start:e.start||t._run().next().value,end:e.end&&this.getPeriod(e.end).end}),this.startDate=this.args.start&&this.normalizeDateOutput(this.getPeriod(this.args.start).start)||null,this.iterator=this.collectionIterator()}next(){return this.iterator.next()}toArray(){if(this.args.end||this.args.take||!this.iterable.isInfinite){const t=[];for(const e of this.collectionIterator())t.push(e);return t}throw new k("CollectionIterator#toArray() can only be called if the iterator is not infinite, or you provide and `end` argument, or you provide a `take` argument.")}normalizeDateOutput(t){if(t)return o.adapter.fromDateTime(t)}*collectionIterator(){if(!this.startDate)return;let t=this.occurrenceIterator(),e=t.next().value;if(!e)return;let r=this.getPeriod(this.args.start),n=[],i=0;for(;e&&(void 0===this.args.take||this.args.take>i);){for(;e&&e.isBeforeOrEqual(r.end);)n.push(e),e=t.next().value;if(yield new V(n.map(t=>this.normalizeDateOutput(t)),this.granularity,this.normalizeDateOutput(r.start),this.normalizeDateOutput(r.end)),!e)return;n=[],r=this.args.skipEmptyPeriods?this.getPeriod(e):this.getPeriod(this.incrementPeriod(r.period)),"month"===this.granularity&&this.weekStart&&(t=this.iterable._run({start:r.start,end:this.args.end}),e=t.next().value),i++}}getPeriod(t){let e,r,n;return"month"===this.granularity&&this.weekStart?(e=t.granularity("month").granularity("week",{weekStart:this.weekStart}),r=t.endGranularity("month").endGranularity("week",{weekStart:this.weekStart}),n=t.granularity("month")):(e=t.granularity(this.granularity,{weekStart:this.weekStart}),r=t.endGranularity(this.granularity,{weekStart:this.weekStart}),n=e),{start:e,end:r,period:n}}incrementPeriod(t){return t.add(1,this.granularity)}occurrenceIterator(){let t=this.args.start||this.iterable._run().next().value;return t?(t=this.getPeriod(t).start,this.iterable._run({start:t,end:this.args.end})):this.iterable._run(this.args)}}class Y extends H{constructor(t,e){super(e),this.streams=t,this.config=e,this.timezone=e.timezone,this.streams=t.map(t=>t instanceof Y?t:t.set("timezone",this.timezone)),this.isInfinite=this.calculateIsInfinite(),this.hasDuration=this.calculateHasDuration()}normalizeDateInput(t){if(t)return C(t,this.timezone)}normalizeRunOutput(t){return L(t,this.timezone)}}class ${constructor(t,e){this.runArgs=e,this.stream=t._run(this.runArgs),this.next()}next(t){const{done:e,value:r}=this.stream.next(t);return this.done="boolean"!=typeof e||e,this.value=r,{done:e,value:r}}}function K(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(r.skipToDate&&0!==t.length){if(e.reverse?t.every(t=>t.value.isBeforeOrEqual(r.skipToDate)):t.every(t=>t.value.isAfterOrEqual(r.skipToDate)))throw new Error("A provided `skipToDate` option must be greater than the last yielded date (or smaller, in the case of reverse iteration)");for(const n of t)n.done||(e.reverse?n.value.isBeforeOrEqual(r.skipToDate):n.value.isAfterOrEqual(r.skipToDate))||n.next(r)}}function Z(t,e){return t.done&&e.done?0:t.done?1:e.done?-1:t.value.isAfter(e.value)?1:-1}function J(t,e){return t.done&&e.done?0:t.done?-1:e.done?1:t.value.isAfter(e.value)?-1:1}function X(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return K(t,e,r),t.sort(e.reverse?J:Z).filter(t=>!t.done).shift()}function Q(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return t=>new tt(e,t)}class tt extends Y{set(t,e){return new tt(this.streams.map(t=>t.set("timezone",e)),Object.assign(Object.assign({},this.config),{base:this.config.base&&this.config.base.set("timezone",e),timezone:e}))}_run(){var t=this;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function*(){const r=t.streams.map(t=>new $(t,e));if(t.config.base&&r.push(new $(t.config.base,e)),0===r.length)return;let n=X(r,e);for(;n&&!n.done;){const i=yield t.normalizeRunOutput(n.value);i&&i.skipToDate||n.next(),n=X(r,e,i)}}()}calculateIsInfinite(){return this.config.base&&this.config.base.isInfinite||this.streams.some(t=>t.isInfinite)}calculateHasDuration(){const t=this.streams.every(t=>t.hasDuration);return this.config.base?this.config.base.hasDuration&&t:t}}class et extends H{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(t),this.adapters=[],this.isInfinite=!1,this.maxDuration=0,this.datetimes=[],this.data=t.data,t.dates&&(this.adapters=t.dates.map(e=>{let r=this.normalizeDateInputToAdapter(e);return t.duration&&!r.duration&&(r=r.set("duration",t.duration)),r.set("timezone",this.timezone)}),this.datetimes=this.adapters.map(t=>t.toDateTime())),this.hasDuration=this.datetimes.every(t=>!!t.duration),this.hasDuration&&(this.maxDuration=this.adapters.reduce((t,e)=>e.duration>t?e.duration:t,0))}get length(){return this.adapters.length}get firstDate(){return this.adapters[0]||null}get lastDate(){return this.adapters[this.length-1]||null}occurrences(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new q(this,this.normalizeOccurrencesArgs(t))}collections(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new G(this,this.normalizeCollectionsArgs(t))}add(t){return new et({dates:[...this.adapters,t],timezone:this.timezone,data:this.data})}remove(t){const e=this.adapters.slice(),r=this.normalizeDateInputToAdapter(t),n=e.findIndex(t=>t.valueOf()===r.valueOf());return n>=0&&e.splice(n,1),new et({dates:e,timezone:this.timezone,data:this.data})}set(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this.timezone,i=this.adapters.slice();if("timezone"===t){if(e===this.timezone)return this;r.keepLocalTime&&(i=this.adapters.map(t=>{const r=t.toJSON();return r.timezone=e,this.dateAdapter.fromJSON(r)})),n=e}else if("dates"===t)i=e;else{if("duration"!==t)throw new N(`Unexpected prop argument "${t}". Accepted values are "timezone" or "dates"`);i=i.map(t=>t.set("duration",e||0))}return new et({dates:i,data:this.data,timezone:n})}filter(t){return new et({dates:this.adapters.filter(t),data:this.data,timezone:this.timezone})}_run(){var t=this;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function*(){let r=t.datetimes.sort(f);e.start&&(r=r.filter(t=>t.isAfterOrEqual(e.start))),e.end&&(r=r.filter(t=>t.isBeforeOrEqual(e.end))),e.reverse&&(r=r.slice().reverse()),e.take&&(r=r.slice(0,e.take));const n=r.slice();let i,o=n.shift();for(;o;)if(i&&i.skipToDate&&(e.reverse?i.skipToDate.isBefore(o):i.skipToDate.isAfter(o)))o=n.shift();else{if(o=o.add(t,"generator"),i=yield t.normalizeRunOutput(o),i&&i.skipToDate&&(e.reverse?i.skipToDate.isAfterOrEqual(o):i.skipToDate.isBeforeOrEqual(o)))throw new Error("A provided `skipToDate` option must be greater than the last yielded date (or smaller, in the case of reverse iteration)");o=n.shift()}}()}}class rt extends Error{}let nt;class it{constructor(t,e){if(this.duration=e&&e.duration||0,this.generators=e&&e.generators&&e.generators.slice()||[],!Number.isInteger(this.duration)||this.duration<0)throw new rt("duration must be a non-negative integer")}static set adapter(t){if(nt)throw new Error(`"${nt.name}" has already been configured.`);nt=t}static get adapter(){if(!nt)throw new Error("No date adapter has been configured. See rSchedule docs.");return nt}static isDate(t){throw ot("isDate()")}static fromDate(t,e){throw ot("fromDate()")}static fromJSON(t){throw ot("fromJSON()")}static fromDateTime(t){throw ot("fromDateTime()")}toISOString(){return this.set("timezone","UTC").toDateTime().toISOString()}toDateTime(){return ut.fromJSON(Object.assign(Object.assign({},this.toJSON()),{generators:this.generators}))}}function ot(t){return new Error(`You must implement the "${t}" method for this DateAdapter class`)}var at;it.hasTimezoneSupport=!1,function(t){t.WEEKDAYS=["SU","MO","TU","WE","TH","FR","SA"],t.MILLISECONDS_IN_SECOND=1e3,t.MILLISECONDS_IN_MINUTE=60*t.MILLISECONDS_IN_SECOND,t.MILLISECONDS_IN_HOUR=60*t.MILLISECONDS_IN_MINUTE,t.MILLISECONDS_IN_DAY=24*t.MILLISECONDS_IN_HOUR,t.MILLISECONDS_IN_WEEK=7*t.MILLISECONDS_IN_DAY}(at||(at={}));class st extends Error{}class ut{constructor(t,e,r,n){if(this.date=new Date(t),this.timezone=e||null,this.duration=r||0,this.generators=n&&n.slice()||[],!Number.isInteger(this.duration)||this.duration<0)throw new st("duration must be a non-negative integer");this.assertIsValid()}static fromJSON(t){const e=new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond));return new ut(e,t.timezone,t.duration,t.generators)}static fromDateAdapter(t){return ut.fromJSON(Object.assign(Object.assign({},t.toJSON()),{generators:t.generators}))}get end(){if(this.duration)return this._end||(this._end=this.add(this.duration,"millisecond")),this._end}isEqual(t){return!!t&&(ct(this,t),this.valueOf()===t.valueOf())}isBefore(t){return ct(this,t),this.valueOf()<t.valueOf()}isBeforeOrEqual(t){return ct(this,t),this.valueOf()<=t.valueOf()}isAfter(t){return ct(this,t),this.valueOf()>t.valueOf()}isAfterOrEqual(t){return ct(this,t),this.valueOf()>=t.valueOf()}isOccurring(t){if(!this.duration)throw new Error("DateTime#isOccurring() is only applicable to DateTimes with durations");return ct(this,t),t.isAfterOrEqual(this)&&t.isBeforeOrEqual(this.add(this.duration,"millisecond"))}add(t,e){switch(e){case"generator":{const e=this.generators.slice();return e.unshift(t),new ut(this.date,this.timezone,this.duration,e)}case"year":return this.forkDateTime(mt(this.date,t));case"month":return this.forkDateTime(yt(this.date,t));case"week":return this.forkDateTime(bt(this.date,t));case"day":return this.forkDateTime(_t(this.date,t));case"hour":return this.forkDateTime(vt(this.date,t));case"minute":return this.forkDateTime(wt(this.date,t));case"second":return this.forkDateTime(Et(this.date,t));case"millisecond":return this.forkDateTime(St(this.date,t));default:throw new Error("Invalid unit provided to `DateTime#add`")}}subtract(t,e){switch(e){case"year":return this.forkDateTime(function(t,e){return mt(t,-e)}(this.date,t));case"month":return this.forkDateTime(function(t,e){return yt(t,-e)}(this.date,t));case"week":return this.forkDateTime(function(t,e){return bt(t,-e)}(this.date,t));case"day":return this.forkDateTime(Ot(this.date,t));case"hour":return this.forkDateTime(function(t,e){return vt(t,-e)}(this.date,t));case"minute":return this.forkDateTime(function(t,e){return wt(t,-e)}(this.date,t));case"second":return this.forkDateTime(function(t,e){return Et(t,-e)}(this.date,t));case"millisecond":return this.forkDateTime(function(t,e){return St(t,-e)}(this.date,t));default:throw new Error("Invalid unit provided to `DateTime#subtract`")}}get(t){switch(t){case"year":return this.date.getUTCFullYear();case"month":return this.date.getUTCMonth()+1;case"yearday":return function(t){const e=new Date(Date.UTC(t.getUTCFullYear(),0,1)),r=t.valueOf()-e.valueOf();return 1+Math.floor(r/at.MILLISECONDS_IN_DAY)}(this.date);case"weekday":return at.WEEKDAYS[this.date.getUTCDay()];case"day":return this.date.getUTCDate();case"hour":return this.date.getUTCHours();case"minute":return this.date.getUTCMinutes();case"second":return this.date.getUTCSeconds();case"millisecond":return this.date.getUTCMilliseconds();default:throw new Error("Invalid unit provided to `DateTime#set`")}}set(t,e){if("duration"===t)return new ut(this.date,this.timezone,e,this.generators);if("generators"===t)return new ut(this.date,this.timezone,this.duration,e);let r=new Date(this.date);switch(t){case"year":r.setUTCFullYear(e);break;case"month":{const t=dt(e,r.getUTCFullYear());r.getUTCDate()>t?(r.setUTCDate(1),r.setUTCMonth(e),r=Ot(r,1)):r.setUTCMonth(e-1);break}case"day":r.setUTCDate(e);break;case"hour":r.setUTCHours(e);break;case"minute":r.setUTCMinutes(e);break;case"second":r.setUTCSeconds(e);break;case"millisecond":r.setUTCMilliseconds(e);break;default:throw new Error("Invalid unit provided to `DateTime#set`")}return this.forkDateTime(r)}granularity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.forkDateTime(this.date);switch(t){case"year":r=r.set("month",1);case"month":r=r.set("day",1);break;case"week":r=function(t,e){const r=lt(e).indexOf(t.get("weekday"));return t.subtract(r,"day")}(r,e.weekStart)}switch(t){case"year":case"month":case"week":case"day":r=r.set("hour",0);case"hour":r=r.set("minute",0);case"minute":r=r.set("second",0);case"second":r=r.set("millisecond",0);case"millisecond":return r;default:throw new Error("Invalid granularity provided to `DateTime#granularity`: "+t)}}endGranularity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.forkDateTime(this.date);switch(t){case"year":r=r.set("month",12);case"month":r=r.set("day",dt(r.get("month"),r.get("year")));break;case"week":r=function(t,e){const r=lt(e).indexOf(t.get("weekday"));return t.add(6-r,"day")}(r,e.weekStart)}switch(t){case"year":case"month":case"week":case"day":r=r.set("hour",23);case"hour":r=r.set("minute",59);case"minute":r=r.set("second",59);case"second":r=r.set("millisecond",999);case"millisecond":return r;default:throw new Error("Invalid granularity provided to `DateTime#granularity`: "+t)}}toISOString(){return this.date.toISOString()}toDateTime(){return this}toJSON(){const t={timezone:this.timezone,year:this.get("year"),month:this.get("month"),day:this.get("day"),hour:this.get("hour"),minute:this.get("minute"),second:this.get("second"),millisecond:this.get("millisecond")};return this.duration&&(t.duration=this.duration),t}valueOf(){return this.date.valueOf()}assertIsValid(){if(isNaN(this.valueOf()))throw new st("DateTime has invalid date.");return!0}forkDateTime(t){return new ut(t,this.timezone,this.duration,this.generators)}}function ct(t,e){if(t.timezone!==e.timezone)throw new st("Attempted to compare a datetime to another date in a different timezone: "+JSON.stringify(t)+" and "+JSON.stringify(e));return!0}function lt(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"SU";const e=at.WEEKDAYS.slice();let r=e.indexOf(t);for(;0!==r;)ft(e),r--;return e}function ft(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"first";return 0===t.length||("first"===e?t.push(t.shift()):t.unshift(t.pop())),t}function dt(t,e){return{1:31,2:ht(e),3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31}[t]}function ht(t){return function(t){return t%400==0||t%4==0&&t%100!=0}(t)?29:28}function gt(t){if(null===t||!0===t||!1===t)return NaN;const e=Number(t);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}function pt(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");const r=t.valueOf(),n=gt(e);return new Date(r+n)}function mt(t,e){return yt(t,12*gt(e))}function yt(t,e){const r=gt(e),n=(t=new Date(t)).getUTCMonth()+r,i=new Date(0);i.setUTCFullYear(t.getUTCFullYear(),n,1),i.setUTCHours(0,0,0,0);const o=dt(i.getUTCMonth()+1,i.getUTCFullYear());return t.setUTCMonth(n,Math.min(o,t.getUTCDate())),t}function bt(t,e){return _t(t,7*gt(e))}function _t(t,e){return St(t,gt(e)*at.MILLISECONDS_IN_DAY)}function vt(t,e){return pt(t,gt(e)*at.MILLISECONDS_IN_HOUR)}function wt(t,e){return pt(t,gt(e)*at.MILLISECONDS_IN_MINUTE)}function Et(t,e){return pt(t,gt(e)*at.MILLISECONDS_IN_SECOND)}function St(t,e){const r=gt(e),n=t.getTime();return new Date(n+r)}function Ot(t,e){return _t(t,-e)}function Tt(t,e){return t.timezone!==e?it.adapter.fromDateTime(t).set("timezone",e).toDateTime():t}class At extends H{constructor(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super(r),this.recurrenceRules=t,this.options=U(e),this.normOptions=B(this.recurrenceRules,this.options),this.timezone=void 0!==r.timezone?r.timezone:this.normOptions.start.timezone,this.data=r.data,this.hasDuration=!!e.duration,this.hasDuration&&(this.duration=e.duration),this.isInfinite=void 0===this.normOptions.end&&void 0===this.normOptions.count}occurrences(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new q(this,this.normalizeOccurrencesArgs(t))}collections(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new G(this,this.normalizeCollectionsArgs(t))}_run(){var t=this;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function*(){const r=t.normalizeRunArgs(e),n=new z((i=t.recurrenceRules,t=>i.reduce((e,r)=>{const n=r.get(t);return n&&e.push(n),e},[])),t.normOptions,r);var i;let o=n.next().value,a=0;for(;o&&(void 0===r.take||a<r.take);){a++,o=o.add(t,"generator");const e=yield t.normalizeRunOutput(o);o=(null==e?void 0:e.skipToDate)?n.next(Object.assign(Object.assign({},e),{skipToDate:Tt(e.skipToDate,n.start.timezone)})).value:n.next(e).value}}()}}class Mt extends At{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(Mt.recurrenceRules,t,e)}set(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=U(this.options),i=this.timezone;if("timezone"===t){if(e===this.timezone&&!r.keepLocalTime)return this;if(r.keepLocalTime){const t=this.normalizeDateInput(n.start).toJSON();t.timezone=e;const r=this.dateAdapter.fromJSON(t);n.start=n.start instanceof this.dateAdapter?r:n.start instanceof c?r.toDateTime():r.date}i=e}else"options"===t?n=e:n[t]=e;return new Mt(n,{data:this.data,maxDuration:this.maxDuration,timezone:i})}}Mt.recurrenceRules=[];class It extends H{constructor(t){super(t),this.data=t.data}occurrences(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new q(this,this.normalizeOccurrencesArgs(t))}collections(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new G(this,this.normalizeCollectionsArgs(t))}_run(){var t=this;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function*(){const r=e.take;delete e.take;const n=t.occurrenceStream._run(e);let i=n.next().value,o=0;for(;i&&(void 0===r||r>o);){i=i.add(t,"generator");const e=yield t.normalizeRunOutput(i);i=n.next(e).value,o++}}()}}function Rt(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return t=>new Nt(e,t)}class Nt extends Y{set(t,e){return new Nt(this.streams.map(t=>t.set("timezone",e)),Object.assign(Object.assign({},this.config),{base:this.config.base&&this.config.base.set("timezone",e),timezone:e}))}_run(){var t=this;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function*(){if(!t.config.base)return;const r=new $(t.config.base,e),n=new $(new tt(t.streams,{timezone:t.config.timezone}),e);for(kt(r,n,e);!r.done;){const i=yield t.normalizeRunOutput(r.value);i&&i.skipToDate||r.next(),kt(r,n,e,i)}}()}calculateIsInfinite(){return!(!this.config.base||!this.config.base.isInfinite)}calculateHasDuration(){return!(!this.config.base||!this.config.base.hasDuration)}}function kt(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};for(K([t,e],r,n),Dt(t,e,r);!t.done&&!e.done&&t.value.isEqual(e.value);)t.next(),Dt(t,e,r)}function Dt(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(r.reverse)for(;!e.done&&!t.done&&e.value.isAfter(t.value);)e.next();else for(;!e.done&&!t.done&&e.value.isBefore(t.value);)e.next()}class jt extends Y{set(t,e){return new jt([],Object.assign(Object.assign({},this.config),{base:this.config.base&&this.config.base.set("timezone",e),timezone:e}))}_run(){var t=this;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function*(){if(!t.config.base)return;const r=new $(t.config.base,e);for(;!r.done;){const e=yield t.normalizeRunOutput(r.value),n=r.value;for(r.next(e);(!e||!e.skipToDate)&&!r.done&&r.value.isEqual(n);)r.next()}}()}calculateIsInfinite(){return!(!this.config.base||!this.config.base.isInfinite)}calculateHasDuration(){return!(!this.config.base||!this.config.base.hasDuration)}}class Ct extends It{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(t),this.rrules=[],this.exrules=[];for(const e of["rrules","exrules"]){const r=t[e];r&&(this[e]=r.map(t=>t instanceof Mt?t.set("timezone",this.timezone):new Mt(t,{timezone:this.timezone})))}for(const e of["rdates","exdates"]){const r=t[e];this[e]=r?r instanceof et?r.set("timezone",this.timezone):new et({dates:r,timezone:this.timezone}):new et({timezone:this.timezone})}this.hasDuration=this.rrules.every(t=>t.hasDuration)&&this.exrules.every(t=>t.hasDuration)&&this.rdates.hasDuration&&this.exdates.hasDuration,this.isInfinite=this.rrules.some(t=>t.isInfinite),this.occurrenceStream=[Q(...this.rrules),Rt(...this.exrules),Q(this.rdates),Rt(this.exdates),t=>new jt([],t)].reduce((t,e)=>e({base:t,timezone:this.timezone}),void 0)}add(t,e){const r=this.rrules.slice(),n=this.exrules.slice();let i=this.rdates,o=this.exdates;switch(t){case"rrule":r.push(e);break;case"exrule":n.push(e);break;case"rdate":i=this.rdates.add(e);break;case"exdate":o=this.exdates.add(e)}return new Ct({timezone:this.timezone,data:this.data,rrules:r,exrules:n,rdates:i,exdates:o})}remove(t,e){let r=this.rrules,n=this.exrules,i=this.rdates,o=this.exdates;switch(t){case"rrule":r=r.filter(t=>t!==e);break;case"exrule":n=n.filter(t=>t!==e);break;case"rdate":i=this.rdates.remove(e);break;case"exdate":o=this.exdates.remove(e)}return new Ct({timezone:this.timezone,data:this.data,rrules:r,exrules:n,rdates:i,exdates:o})}set(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this.timezone,i=this.rrules,o=this.exrules,a=this.rdates,s=this.exdates;switch(t){case"timezone":if(e===this.timezone&&!r.keepLocalTime)return this;r.keepLocalTime&&(i=i.map(t=>t.set("timezone",e,r)),o=o.map(t=>t.set("timezone",e,r)),a=a.set("timezone",e,r),s=s.set("timezone",e,r)),n=e;break;case"rrules":i=e;break;case"exrules":o=e;break;case"rdates":a=e;break;case"exdates":s=e}return new Ct({timezone:n,data:this.data,rrules:i,exrules:o,rdates:a,exdates:s})}}Error;Error;class Lt{constructor(t){this.processor=t,this.start=t.start,this.end=t.end,this.options=t.options}}class xt extends Lt{constructor(t,e){super(t),this.initDate=e,this.intervalUnit=function(t){switch(t){case"YEARLY":return"year";case"MONTHLY":return"month";case"WEEKLY":return"week";case"DAILY":return"day";case"HOURLY":return"hour";case"MINUTELY":return"minute";case"SECONDLY":return"second";case"MILLISECONDLY":return"millisecond";default:throw new Error("unknown freq passed to freqToGranularity()")}}(this.options.frequency),this.firstIntervalStartDate=this.normalizedStartDate(this.options.start),this.intervalStartDate=this.firstIntervalStartDate,this.intervalEndDate=this.normalizedEndDate(this.firstIntervalStartDate),this.skipToInterval(this.initDate)}run(t){return this.validateDate(new P(t))}validateDate(t){const{date:e}=t;return t instanceof P&&this.dateIsWithinInterval(e)?t:(this.skipToInterval(e),new W(this.dateIsWithinInterval(e)?e:this.setToCurrentInterval()))}setToCurrentInterval(){return this.intervalStartDate}normalizedStartDate(t){return"WEEKLY"===this.options.frequency?t.granularity("week",{weekStart:this.options.weekStart}):t.granularity(this.intervalUnit)}normalizedEndDate(t){switch(this.options.frequency){case"YEARLY":return t.add(1,"year");case"MONTHLY":return t.add(1,"month");case"WEEKLY":return t.add(1,"week");case"DAILY":return t.add(1,"day");case"HOURLY":return t.add(1,"hour");case"MINUTELY":return t.add(1,"minute");case"SECONDLY":return t.add(1,"second");case"MILLISECONDLY":return t.add(1,"millisecond");default:throw new Error("Unknown frequency "+this.options.frequency)}}skipToInterval(t){const e=this.intervalDifference(t);this.intervalStartDate=this.firstIntervalStartDate.add(e,this.intervalUnit),this.intervalEndDate=this.normalizedEndDate(this.intervalStartDate)}dateIsWithinInterval(t){return this.intervalStartDate.isBeforeOrEqual(t)&&this.intervalEndDate.isAfter(t)}intervalDifference(t){return Bt({first:this.firstIntervalStartDate,second:t,unit:this.intervalUnit,interval:this.options.interval,weekStart:this.options.weekStart,direction:"after"})}}function Bt(t){let{first:e,second:r,unit:n,interval:i,weekStart:o,direction:a}=t,u=(()=>{let t,i;switch(n){case"year":return i=12*(r.get("year")-e.get("year")),i=i+r.get("month")-e.get("month"),Math.floor(i/12);case"month":return i=12*(r.get("year")-e.get("year")),i=i+r.get("month")-e.get("month"),i;case"week":e=e.granularity("week",{weekStart:o}),t=s.MILLISECONDS_IN_WEEK;break;case"day":t=s.MILLISECONDS_IN_DAY;break;case"hour":t=s.MILLISECONDS_IN_HOUR;break;case"minute":t=s.MILLISECONDS_IN_MINUTE;break;case"second":t=s.MILLISECONDS_IN_SECOND;break;case"millisecond":t=1;break;default:throw new Error("Unexpected `unit` value")}const a=r.valueOf()-e.valueOf();return Math.floor(a/t)})();return u=("after"===a?Math.ceil:Math.floor)(u/i)*i,u}class Ut extends xt{setToCurrentInterval(){return this.intervalEndDate.subtract(1,"millisecond")}intervalDifference(t){return Bt({first:this.firstIntervalStartDate,second:t,unit:this.intervalUnit,interval:this.options.interval,weekStart:this.options.weekStart,direction:"before"})}}const Ft=["MILLISECONDLY","SECONDLY","MINUTELY","HOURLY","DAILY","WEEKLY","MONTHLY","YEARLY"],Pt={name:"FrequencyRule",get:t=>void 0!==t.options.byMillisecondOfSecond||"MILLISECONDLY"!==t.options.frequency?null:t.reverse?new Ut(t,t.end):new xt(t,t.start),normalizeOptions:(t,e)=>{if(!Ft.includes(t.frequency))throw new x('"frequency" must be one of '+JSON.stringify(Ft));if(void 0!==t.interval){if(!Number.isInteger(t.interval))throw new x('"interval" expects a whole number');if(t.interval<1)throw new x('"interval" cannot be less than 1')}if(void 0!==t.weekStart&&!s.WEEKDAYS.includes(t.weekStart))throw new x('"weekStart" must be one of '+JSON.stringify(s.WEEKDAYS));e.frequency=t.frequency,e.interval=t.interval||1,e.weekStart=t.weekStart||"MO"},deps:()=>[Pt]};function Wt(t){return Array.isArray(t)&&t.length>0}const zt=new WeakMap;class Ht extends Lt{constructor(t){super(t),zt.has(this.processor)||zt.set(this.processor,new xt(t,t.start)),this.frequency=zt.get(this.processor)}validateDate(t){return this.frequency.validateDate(t)}}class qt extends Lt{constructor(t){super(t),zt.has(this.processor)||zt.set(this.processor,new Ut(t,t.end)),this.frequency=zt.get(this.processor)}validateDate(t){return this.frequency.validateDate(t)}}class Vt extends qt{run(t){const e=t.get(this.granularity);for(const r of this.option)if(!(e<r))return e===r?this.validateDate(new P(t)):this.validateDate(new W(t.endGranularity(this.baseGranularity).set(this.granularity,r)));return this.validateDate(new W(t.endGranularity(this.baseGranularity).subtract(1,this.baseGranularity).set(this.granularity,this.option[0])))}}class Gt extends Vt{constructor(){super(...arguments),this.baseGranularity="second",this.granularity="millisecond",this.option=this.options.byMillisecondOfSecond.slice().reverse()}}class Yt extends Ht{run(t){const e=t.get(this.granularity);for(const r of this.option)if(!(e>r))return e===r?this.validateDate(new P(t)):this.validateDate(new W(t.granularity(this.baseGranularity).set(this.granularity,r)));return this.validateDate(new W(t.granularity(this.baseGranularity).add(1,this.baseGranularity).set(this.granularity,this.option[0])))}}class $t extends Yt{constructor(){super(...arguments),this.baseGranularity="second",this.granularity="millisecond",this.option=this.options.byMillisecondOfSecond}}const Kt={name:"ByMillisecondOfSecond",get:t=>void 0===t.options.byMillisecondOfSecond?null:t.reverse?new Gt(t):new $t(t),normalizeOptions:(t,e)=>{if(void 0!==t.byMillisecondOfSecond){if(!Wt(t.byMillisecondOfSecond))throw new x('"byMillisecondOfSecond" expects a non-empty array');if(t.byMillisecondOfSecond.some(t=>t<0||t>999))throw new x('"byMillisecondOfSecond" values must be >= 0 && <= 999');e.byMillisecondOfSecond=t.byMillisecondOfSecond,e.byMillisecondOfSecond.sort(D)}else"MILLISECONDLY"!==t.frequency&&(e.byMillisecondOfSecond=[e.start.get("millisecond")])},deps:()=>[Pt,Kt]};class Zt extends Vt{constructor(){super(...arguments),this.baseGranularity="minute",this.granularity="second",this.option=this.options.bySecondOfMinute.slice().reverse()}}class Jt extends Yt{constructor(){super(...arguments),this.baseGranularity="minute",this.granularity="second",this.option=this.options.bySecondOfMinute}}const Xt={name:"BySecondOfMinute",get:t=>void 0===t.options.bySecondOfMinute?null:t.reverse?new Zt(t):new Jt(t),normalizeOptions:(t,e)=>{if(void 0!==t.bySecondOfMinute){if(!Wt(t.bySecondOfMinute))throw new x('"bySecondOfMinute" expects a non-empty array');if(t.bySecondOfMinute.some(t=>t<0||t>60))throw new x('"bySecondOfMinute" values must be >= 0 && <= 60');e.bySecondOfMinute=t.bySecondOfMinute,e.bySecondOfMinute.sort(D)}else["SECONDLY","MILLISECONDLY"].includes(t.frequency)||(e.bySecondOfMinute=[e.start.get("second")])},deps:()=>[Pt,Xt,Kt]};class Qt extends Vt{constructor(){super(...arguments),this.baseGranularity="hour",this.granularity="minute",this.option=this.options.byMinuteOfHour.slice().reverse()}}class te extends Yt{constructor(){super(...arguments),this.baseGranularity="hour",this.granularity="minute",this.option=this.options.byMinuteOfHour}}const ee={name:"ByMinuteOfHour",get:t=>void 0===t.options.byMinuteOfHour?null:t.reverse?new Qt(t):new te(t),normalizeOptions:(t,e)=>{if(void 0!==t.byMinuteOfHour){if(!Wt(t.byMinuteOfHour))throw new x('"byMinuteOfHour" expects a non-empty array');if(t.byMinuteOfHour.some(t=>t<0||t>59))throw new x('"byMinuteOfHour" values must be >= 0 && <= 59');e.byMinuteOfHour=t.byMinuteOfHour,e.byMinuteOfHour.sort(D)}else["MINUTELY","SECONDLY","MILLISECONDLY"].includes(t.frequency)||(e.byMinuteOfHour=[e.start.get("minute")])},deps:()=>[Pt,ee,Xt,Kt]};class re extends Vt{constructor(){super(...arguments),this.baseGranularity="day",this.granularity="hour",this.option=this.options.byHourOfDay.slice().reverse()}}class ne extends Yt{constructor(){super(...arguments),this.baseGranularity="day",this.granularity="hour",this.option=this.options.byHourOfDay}}const ie={name:"ByHourOfDay",get:t=>void 0===t.options.byHourOfDay?null:t.reverse?new re(t):new ne(t),normalizeOptions:(t,e)=>{if(void 0!==t.byHourOfDay){if(!Wt(t.byHourOfDay))throw new x('"byHourOfDay" expects a non-empty array');if(t.byHourOfDay.some(t=>t<0||t>23))throw new x('"byHourOfDay" values must be >= 0 && <= 23');e.byHourOfDay=t.byHourOfDay,e.byHourOfDay.sort(D)}else["YEARLY","MONTHLY","WEEKLY","DAILY"].includes(t.frequency)&&(e.byHourOfDay=[e.start.get("hour")])},deps:()=>[Pt,ie,ee,Xt,Kt]};function oe(t,e){return t.add(p(t.get("weekday"),e),"day")}function ae(t,e,r){let n=t.set("day",1);return r<0&&(n=n.add(1,"month")),n=oe(n,e),r<0?n.add(r,"week"):n.add(r-1,"week")}class se extends Ht{run(t){const e=ue(t,this.options.byDayOfMonth,this.options.byDayOfWeek),r=t.get("day");for(const n of e)if(!(r>n))return r===n?this.validateDate(new P(t)):this.validateDate(new W(t.granularity("month").set("day",n)));let n,i=t,o=0;for(;!n&&o<30;)i=i.granularity("month").add(1,"month"),n=ue(i,this.options.byDayOfMonth,this.options.byDayOfWeek)[0],o++;if(o>=13)throw new F("byDayOfMonth Infinite while loop");return this.validateDate(new W(i.set("day",n)))}}function ue(t,e,r){const n=t.endGranularity("month").get("day");let i=e.filter(t=>n>=Math.abs(t)).map(t=>t>0?t:n+t+1);if(r){const e=t.granularity("month"),n=[];r.forEach(r=>{if("string"==typeof r)return void n.push(...i.filter(t=>e.set("day",t).get("weekday")===r));const o=ae(t,...r).get("day");i.includes(o)&&n.push(o)}),i=Array.from(new Set(n))}return i.sort((t,e)=>t>e?1:t<e?-1:0)}class ce extends qt{run(t){const e=ue(t,this.options.byDayOfMonth,this.options.byDayOfWeek).reverse(),r=t.get("day");for(const n of e)if(!(r<n))return r===n?this.validateDate(new P(t)):this.validateDate(new W(t.endGranularity("month").set("day",n)));let n,i=t,o=0;for(;!n&&o<30;)i=i.endGranularity("month").subtract(1,"month"),n=ue(i,this.options.byDayOfMonth,this.options.byDayOfWeek).pop(),o++;if(o>=13)throw new F("byDayOfMonth Infinite while loop");return this.validateDate(new W(i.set("day",n)))}}const le={name:"ByDayOfMonth",get:t=>void 0===t.options.byDayOfMonth?null:t.reverse?new ce(t):new se(t),normalizeOptions:(t,e)=>{if(void 0!==t.byDayOfMonth){if("WEEKLY"===t.frequency)throw new x('when "frequency" is "WEEKLY", "byDayOfMonth" cannot be present');if(!Wt(t.byDayOfMonth))throw new x('"byDayOfMonth" expects a non-empty array');if(t.byDayOfMonth.some(t=>0===t||t<-31||t>31))throw new x('"byDayOfMonth" values must be `num !== 0 && num <= 31 && num >= -31`');e.byDayOfMonth=t.byDayOfMonth.slice()}else Wt(t.byDayOfWeek)||Wt(t.byDayOfYear)||!["YEARLY","MONTHLY"].includes(t.frequency)||(e.byDayOfMonth=[e.start.get("day")])},deps:()=>[Pt,le,ie,ee,Xt,Kt]};function fe(t,e,r){let n=t.set("month",1).set("day",1);return r<0&&(n=n.add(1,"year")),n=oe(n,e),r<0?n.add(r,"week"):n.add(r-1,"week")}function de(t,e){const r=p(t.get("weekday"),e);return t.subtract(0===r?0:7-r,"day")}class he extends qt{run(t){return"YEARLY"===this.options.frequency?void 0===this.options.byMonthOfYear?this.expandYearly(t):this.expandMonthly(t):"MONTHLY"===this.options.frequency?this.expandMonthly(t):this.expand(t)}expandYearly(t){let e=ge(t,this.options.byDayOfWeek)[0],r=0,n=t;for(;!e&&r<28;)r++,n=n.granularity("year").subtract(1,"millisecond"),e=ge(n,this.options.byDayOfWeek)[0];if(!e)throw new F("The byDayOfWeek rule appears to contain an impossible combination");return this.result(t,e)}expandMonthly(t){let e=pe(t,this.options.byDayOfWeek)[0],r=0,n=t;for(;!e&&r<50;)r++,n=n.granularity("month").subtract(1,"millisecond"),e=pe(n,this.options.byDayOfWeek)[0];if(!e)throw new F("The byDayOfWeek rule appears to contain an impossible combination");return this.result(t,e)}expand(t){const e=this.options.byDayOfWeek.map(e=>de(t,e)).sort(f).pop();return this.result(t,e)}result(t,e){return e.isEqual(t)?this.validateDate(new P(t)):this.validateDate(new W(e.endGranularity("day")))}}function ge(t,e){return d([...e.filter(t=>Array.isArray(t)).map(e=>fe(t,...e)),...e.filter(t=>"string"==typeof t).map(e=>de(t,e)).filter(e=>e.get("year")===t.get("year"))]).filter(e=>e.isBeforeOrEqual(t)).sort(f).reverse()}function pe(t,e){return d([...e.filter(t=>Array.isArray(t)).map(e=>ae(t,...e)),...e.filter(t=>"string"==typeof t).map(e=>de(t,e)).filter(e=>e.get("year")===t.get("year")&&e.get("month")===t.get("month"))]).filter(e=>e.isBeforeOrEqual(t)).sort(f).reverse()}class me extends Ht{run(t){return"YEARLY"===this.options.frequency?void 0===this.options.byMonthOfYear?this.expandYearly(t):this.expandMonthly(t):"MONTHLY"===this.options.frequency?this.expandMonthly(t):this.expand(t)}expandYearly(t){let e=ye(t,this.options.byDayOfWeek)[0],r=0,n=t;for(;!e&&r<28;)r++,n=n.granularity("year").add(1,"year"),e=ye(n,this.options.byDayOfWeek)[0];if(!e)throw new F("The byDayOfWeek rule appears to contain an impossible combination");return this.result(t,e)}expandMonthly(t){let e=be(t,this.options.byDayOfWeek)[0],r=0,n=t;for(;!e&&r<50;)r++,n=n.granularity("month").add(1,"month"),e=be(n,this.options.byDayOfWeek)[0];if(!e)throw new F("The byDayOfWeek rule appears to contain an impossible combination");return this.result(t,e)}expand(t){const e=this.options.byDayOfWeek.map(e=>oe(t,e)).sort(f)[0];return this.result(t,e)}result(t,e){return e.isEqual(t)?this.validateDate(new P(t)):this.validateDate(new W(e.granularity("day")))}}function ye(t,e){return d([...e.filter(t=>Array.isArray(t)).map(e=>fe(t,...e)),...e.filter(t=>"string"==typeof t).map(e=>oe(t,e)).filter(e=>e.get("year")===t.get("year"))]).filter(e=>e.isAfterOrEqual(t)).sort(f)}function be(t,e){return d([...e.filter(t=>Array.isArray(t)).map(e=>ae(t,...e)),...e.filter(t=>"string"==typeof t).map(e=>oe(t,e)).filter(e=>e.get("year")===t.get("year")&&e.get("month")===t.get("month"))]).filter(e=>e.isAfterOrEqual(t)).sort(f)}const _e={name:"ByDayOfWeek",get:t=>void 0===t.options.byDayOfWeek?null:t.reverse?new he(t):new me(t),normalizeOptions:(t,e)=>{if(void 0!==t.byDayOfWeek){if(!Wt(t.byDayOfWeek))throw new x('"byDayOfWeek" expects a non-empty array');const r=t.byDayOfWeek.find(t=>Array.isArray(t)?!s.WEEKDAYS.includes(t[0]):!s.WEEKDAYS.includes(t));if(r)throw new x(`"byDayOfWeek" expects weedays in the form ${JSON.stringify(s.WEEKDAYS)} but "${r}" was provided`);if(!["YEARLY","MONTHLY"].includes(t.frequency)&&t.byDayOfWeek.some(t=>Array.isArray(t)))throw new x('"byDayOfWeek" can only include a numeric value (i.e. `[string, number]`) when the "frequency" is either "MONTHLY" or "YEARLY"');if("MONTHLY"===t.frequency&&t.byDayOfWeek.some(t=>Array.isArray(t)&&(t[1]<-31||0===t[1]||t[1]>31)))throw new x('when "frequency" is "MONTHLY", each "byDayOfWeek" can optionally only have a numeric value >= -31 and <= 31 and !== 0');if("YEARLY"===t.frequency&&t.byDayOfWeek.some(t=>Array.isArray(t)&&(t[1]<-366||0===t[1]||t[1]>366)))throw new x('when "frequency" is "YEARLY", each "byDayOfWeek" can optionally only have a numeric value >= -366 and <= 366 and !== 0');e.byDayOfWeek=t.byDayOfWeek}else Wt(t.byDayOfMonth)||"WEEKLY"!==t.frequency||(e.byDayOfWeek=[e.start.get("weekday")])},deps:()=>[Pt,_e,ie,ee,Xt,Kt]};class ve extends qt{constructor(){super(...arguments),this.option=this.processor.options.byMonthOfYear.slice().reverse()}run(t){const e=t.get("month");for(const r of this.option)if(!(e<r))return e===r?this.validateDate(new P(t)):this.validateDate(new W(t.endGranularity("year").set("month",r)));return this.validateDate(new W(t.endGranularity("year").subtract(1,"year").set("month",this.option[0])))}}class we extends Ht{run(t){const e=t.get("month");for(const r of this.options.byMonthOfYear)if(!(e>r))return e===r?this.validateDate(new P(t)):this.validateDate(new W(t.granularity("year").set("month",r)));return this.validateDate(new W(t.granularity("year").add(1,"year").set("month",this.options.byMonthOfYear[0])))}}const Ee={name:"ByMonthOfYear",get:t=>void 0===t.options.byMonthOfYear?null:t.reverse?new ve(t):new we(t),normalizeOptions:(t,e)=>{if(void 0!==t.byMonthOfYear){if(!Wt(t.byMonthOfYear))throw new x('"byMonthOfYear" expects a non-empty array');if(t.byMonthOfYear.some(t=>t<1||t>12))throw new x('"byMonthOfYear" values must be `num >= 1 && num >= 12`');e.byMonthOfYear=t.byMonthOfYear.slice(),e.byMonthOfYear.sort(D)}else Wt(t.byDayOfMonth)||Wt(t.byDayOfWeek)||Wt(t.byDayOfYear)||"YEARLY"!==t.frequency||(e.byMonthOfYear=[e.start.get("month")])},deps:()=>[Pt,Ee,le,ie,ee,Xt,Kt]},Se=[Pt,Ee,le,_e,ie,ee,Xt,Kt];class Oe extends o{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(super(void 0,e),!["UTC",null,void 0].includes(e.timezone))throw new n(`StandardDateAdapter only supports "UTC" and local time zones but "${e.timezone}" was provided.`);this._date=new Date(t),this.timezone=void 0!==e.timezone?e.timezone:null,this.assertIsValid()}static isDate(t){return"[object Date]"===Object.prototype.toString.call(t)}static fromDate(t,e){return new Oe(t,e)}static fromJSON(t){const e=[t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond];switch(t.timezone){case"UTC":return new Oe(new Date(Date.UTC(...e)),{timezone:"UTC",duration:t.duration});case null:return new Oe(new Date(...e),{timezone:null,duration:t.duration});default:throw new n(`The \`StandardDateAdapter\` only supports datetimes in UTC or LOCAL (null) time. You provided a JSON object with timezone "${t.timezone}".`)}}static fromDateTime(t){const e=Oe.fromJSON(t.toJSON());return e.generators.push(...t.generators),e}get date(){return new Date(this._date)}get end(){if(this.duration)return this._end||(this._end=Oe.fromDateTime(this.toDateTime().add(this.duration,"millisecond")).date),this._end}set(t,e){if("timezone"===t)return this.timezone===e?this:new Oe(this._date,{timezone:e,duration:this.duration,generators:this.generators});if("duration"===t)return this.duration===e?this:new Oe(this._date,{timezone:this.timezone,duration:e,generators:this.generators});throw new N(`Unknown prop "${t}" for StandardDateAdapter#set()`)}valueOf(){return this._date.valueOf()}toJSON(){let t;return t="UTC"===this.timezone?{timezone:this.timezone,year:this._date.getUTCFullYear(),month:this._date.getUTCMonth()+1,day:this._date.getUTCDate(),hour:this._date.getUTCHours(),minute:this._date.getUTCMinutes(),second:this._date.getUTCSeconds(),millisecond:this._date.getUTCMilliseconds()}:{timezone:this.timezone,year:this._date.getFullYear(),month:this._date.getMonth()+1,day:this._date.getDate(),hour:this._date.getHours(),minute:this._date.getMinutes(),second:this._date.getSeconds(),millisecond:this._date.getMilliseconds()},this.duration&&(t.duration=this.duration),t}assertIsValid(){if(!Oe.isDate(this._date)||isNaN(this._date.valueOf()))throw new n("StandardDateAdapter has invalid date.");if(![null,"UTC"].includes(this.timezone))throw new n(`StandardDateAdapter only supports local (null) and UTC timezones but "${this.timezone}" was specified.`);if(this.duration&&this.duration<=0)throw new n("If provided, duration must be greater than 0.");return!0}}Oe.hasTimezoneSupport=!1,o.adapter=Oe,Mt.recurrenceRules=Se;class Te extends Error{}class Ae extends Error{}function Me(t,e,r){r.data&&(!0===r.data?e.data=t.data:e.data=r.data(t),void 0===e.data&&delete e.data)}function Ie(t,e){H.JSON_FN_MAP.set(t,e)}H.JSON_FN_MAP=new Map,H.prototype.toJSON=function(t){throw new Ae(`To support smaller bundles, ${this.constructor.name}#toJSON() must be manually added. See "@rschedule/json-tools" in the rSchedule docs.`)},H.fromJSON=function(t,e){if("object"!=typeof t||null===t)throw new Te(`Invalid json "${t}"`);const r=H.JSON_FN_MAP.get(t.type);if(!r)throw new Te(`Unknown rSchedule object type "${t.type}". Have you added a json serializer for "${t.type}"? See "@rschedule/json-tools" in the rSchedule docs.`);return r(t,e)},et.prototype.toJSON=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e={type:"Dates",dates:this.adapters.map(t=>t.toJSON())};return t.nested||(e.timezone=this.timezone),Me(this,e,t),e},et.fromJSON=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("Dates"!==t.type)throw new Te("Invalid Dates JSON");return new et({dates:t.dates.map(t=>o.adapter.fromJSON(t)),data:"function"==typeof e.data?e.data(t):t.data,timezone:e.timezone||t.timezone})},Ie("Dates",et.fromJSON),Mt.prototype.toJSON=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e={type:"Rule",config:Object.assign(Object.assign({},j(this.options)),{start:this.normalizeDateInput(this.options.start).toJSON()})};return this.options.end&&(e.config.end=this.normalizeDateInput(this.options.end).toJSON()),t.nested||(e.timezone=this.timezone),Me(this,e,t),e},Mt.fromJSON=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=Object.assign(Object.assign({},t.config),{start:o.adapter.fromJSON(t.config.start),end:t.config.end&&o.adapter.fromJSON(t.config.end)});return new Mt(r,{data:"function"==typeof e.data?e.data(t):t.data,timezone:e.timezone||t.timezone})},Ie("Rule",Mt.fromJSON),Ct.prototype.toJSON=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e={type:"Schedule",rrules:this.rrules.map(e=>e.toJSON(Object.assign(Object.assign({},t),{nested:!0}))),exrules:this.exrules.map(e=>e.toJSON(Object.assign(Object.assign({},t),{nested:!0}))),rdates:this.rdates.toJSON(Object.assign(Object.assign({},t),{nested:!0})),exdates:this.exdates.toJSON(Object.assign(Object.assign({},t),{nested:!0}))};return t.nested||(e.timezone=this.timezone),Me(this,e,t),e},Ct.fromJSON=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("Schedule"!==t.type)throw new Te("Invalid Schedule JSON");return new Ct({rrules:t.rrules.map(r=>Mt.fromJSON(r,Object.assign({timezone:t.timezone},e))),exrules:t.exrules.map(r=>Mt.fromJSON(r,Object.assign({timezone:t.timezone},e))),rdates:et.fromJSON(t.rdates,Object.assign({timezone:t.timezone},e)),exdates:et.fromJSON(t.exdates,Object.assign({timezone:t.timezone},e)),data:"function"==typeof e.data?e.data(t):t.data,timezone:e.timezone||t.timezone})},Ie("Schedule",Ct.fromJSON)},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(28),i=r(17),o=r(8);function a(t,e){Object(o.a)(2,arguments);var r=Object(i.a)(t),a=Object(n.a)(e);if(isNaN(a))return new Date(NaN);if(!a)return r;var s=r.getDate(),u=new Date(r.getTime());u.setMonth(r.getMonth()+a+1,0);var c=u.getDate();return s>=c?u:(r.setFullYear(u.getFullYear(),u.getMonth(),s),r)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(28),i=r(17),o=r(8);function a(t,e){Object(o.a)(2,arguments);var r=Object(i.a)(t),a=Object(n.a)(e);return isNaN(a)?new Date(NaN):a?(r.setDate(r.getDate()+a),r):r}},function(t,e,r){"use strict";r.d(e,"b",(function(){return Q})),r.d(e,"c",(function(){return tt}));var n=r(17),i=r(8);function o(t){Object(i.a)(1,arguments);var e=Object(n.a)(t);return e.setHours(0,0,0,0),e}var a=r(77),s=r(143),u=r.n(s),c=r(26),l=r(23),f=r(22),d=r(1),h=r(30),g=r(40),p=r(34),m=r(37),y=r(29),b=r(51),_=r(14),v=r(0),w=r(20),E=r(4),S=r(6),O=r(7),T=r(18),A=r(75),M=r(252),I=r(91);function R(t,e){Object(i.a)(2,arguments);var r=o(t),n=o(e),a=r.getTime()-Object(I.a)(r),s=n.getTime()-Object(I.a)(n);return Math.round((a-s)/864e5)}function N(t,e){var r=t.getFullYear()-e.getFullYear()||t.getMonth()-e.getMonth()||t.getDate()-e.getDate()||t.getHours()-e.getHours()||t.getMinutes()-e.getMinutes()||t.getSeconds()-e.getSeconds()||t.getMilliseconds()-e.getMilliseconds();return r<0?-1:r>0?1:r}var k=r(28),D=r(240);function j(t,e){Object(i.a)(2,arguments);var r=Object(k.a)(e);return Object(D.a)(t,-r)}var C=r(251);var L=r(42),x=r(76);function B(t,e){Object(i.a)(2,arguments);var r=Object(k.a)(e);return Object(x.a)(t,12*r)}function U(t,e){Object(i.a)(2,arguments);var r=Object(k.a)(e);return B(t,-r)}var F=r(44),P=r(5);function W(t){return new A.a({rrules:Object(g.e)(t)}).occurrences({take:3}).toArray().map(t=>t.date)}async function z(t,e){let{data:r}=await Object(_.g)(Object(h.b)("transactions").filter({account:e,schedule:null,"payee.transfer_acct":null,$and:[{date:{$gte:M.a(t,2)}},{date:{$lte:a.a(t,2)}}]}).select("*").options({splits:"none"}));return r}function H(t,e){return 1/(Math.abs(function(t,e){Object(i.a)(2,arguments);var r=Object(n.a)(t),o=Object(n.a)(e),a=N(r,o),s=Math.abs(R(r,o));r.setDate(r.getDate()-a*s);var u=Number(N(r,o)===-a),c=a*(s-u);return 0===c?0:c}(Object(d.l)(t),Object(d.l)(e)))+1)}function q(t,e){let r=(t=[...t].reverse())[0],n=t.slice(1),i=[];for(let o of r.transactions){let a=Object(F.b)(o.amount),s=o.payee,u=n.map(t=>{let e=t.transactions.find(t=>t.amount>=o.amount-a&&t.amount<=o.amount+a);return e=e&&e.payee===s?e:null,e?{trans:e,rank:H(t.date,e.date)}:null});if(-1!==u.indexOf(null))continue;let c=u.reduce((t,e)=>t+e.rank,H(r.date,o.date)),l=u.reduce((t,e)=>t&&e.trans.amount===o.amount,!0);i.push({rank:c,amount:o.amount,account:o.account,payee:o.payee,date:e,exactDate:c===t.length,exactAmount:l})}return i}async function V(t,e,r,n,i){let o=[];for(let s=0;s<e;s++){let e,u=a.a(t,s);if("function"==typeof r){if(e=r(u),!1===e)continue}else e={...r,start:u};e.start=Object(d.f)(e.start);let c=[],l=W(e);for(let t of l)c.push({date:Object(d.f)(t),transactions:await z(t,n)});o=o.concat(q(c,e,i))}return o}async function G(t,e){return V(j(Object(d.l)(t),4),14,{frequency:"weekly"},e)}async function Y(t,e){return V(j(Object(d.l)(t),7),14,{frequency:"weekly",interval:2},e)}async function $(t,e){return V(C.a(Object(d.l)(t),4),62,t=>!(function(t){Object(i.a)(1,arguments);var e=Object(n.a)(t),r=e.getDate();return r}(t)>28)&&{start:t,frequency:"monthly"},e)}async function K(t,e){let r=await V(C.a(Object(d.l)(t),3),1,{frequency:"monthly",patterns:[{type:"day",value:-1}]},e,.75),n=await V(C.a(Object(d.l)(t),4),1,{frequency:"monthly",patterns:[{type:"day",value:-1}]},e,.75);return r.concat(n)}async function Z(t,e){return V(j(Object(d.l)(t),8),14,t=>{let e=L.a(new Date,"iiii").slice(0,2).toUpperCase();return{start:t,frequency:"monthly",patterns:[{type:e,value:1},{type:e,value:3}]}},e)}async function J(t,e){return V(C.a(Object(d.l)(t),8),14,t=>{let e=L.a(new Date,"iiii").slice(0,2).toUpperCase();return{start:t,frequency:"monthly",patterns:[{type:e,value:2},{type:e,value:4}]}},e)}async function X(t){let e=t._conditions,r=e.find(t=>"date"===t.field).value;for(;;){let t=r;switch(r={...t},r.frequency){case"weekly":r.start=Object(d.f)(j(Object(d.l)(r.start),r.interval||1));break;case"monthly":r.start=Object(d.f)(C.a(Object(d.l)(r.start),r.interval||1));break;case"yearly":r.start=Object(d.f)(U(Object(d.l)(r.start),r.interval||1));break;default:throw new Error("findStartDate: invalid frequency")}let n=e.map(t=>"date"===t.field?{...t,value:r}:t),{filters:i,errors:o}=Object(y.b)(n,{recurDateBounds:1});if(o.length>0){r=null;break}let{data:a}=await Object(_.g)(Object(h.b)("transactions").filter({$and:i}).select("*"));if(0===a.length){r=t;break}}return r?{...t,date:r,_conditions:e.map(t=>"date"===t.field?{...t,value:r}:t)}:t}function Q(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;e=o(e);let r=new p.b(t.op,"date",t.value,null,new Map(Object.entries({date:"date"}))),n=r.getValue();if("date"===n.type)return n.date;if("recur"===n.type){let t=n.schedule.occurrences({start:e,take:1}).toArray();if(t.length>0){let e=t[0].date;return Object(d.f)(e)}}return null}async function tt(t){if(null==t)throw new Error("Schedule not attached to a rule");let{data:e}=await Object(_.g)(Object(h.b)("schedules").filter({id:t}).calculate("rule"));return Object(y.d)().find(t=>t.id===e)}async function et(t){let{id:e,start:r,conditions:n,reset:i}=t;if(null==n){let t=await tt(e);if(null==t)throw new Error("No rule found for schedule");n=t.serialize().conditions}let{date:o}=Object(g.a)(n),{data:a}=await Object(_.g)(Object(h.b)("schedules").filter({id:e}).calculate("next_date"));if(o){let t=Q(o,r?r(a):new Date);if(t!==a){let r=await v.first("SELECT id, base_next_date_ts FROM schedules_next_date WHERE schedule_id = ?",[e]);await v.update("schedules_next_date",i?{id:r.id,base_next_date:Object(w.g)(t),base_next_date_ts:Date.now()}:{id:r.id,local_next_date:Object(w.g)(t),local_next_date_ts:r.base_next_date_ts})}}}async function rt(t,e){let r=await v.first("SELECT id from schedules WHERE name = ?",[t]);return null!=r&&(!e||r.id!==e)}async function nt(t){let e,{schedule:r,conditions:n,resetNextDate:i}=t;if(r.rule)throw new Error("You cannot change the rule of a schedule");if(r.name){if(await rt(r.name,r.id))throw new Error("There is already a schedule with this name")}else r.name=null;if(n){let{date:t}=Object(g.a)(n);if(t&&null==t.value)throw new Error("Date is required");e=await tt(r.id),null==e&&(e=await async function(t){let{data:e}=await Object(_.g)(Object(h.b)("schedules").filter({id:t}).calculate("rule"));e&&await v.delete_("rules",e);let r=await Object(y.f)({stage:null,conditionsOp:"and",conditions:[{op:"isapprox",field:"date",value:Object(d.d)()},{op:"isapprox",field:"amount",value:0}],actions:[{op:"link-schedule",value:t}]});return await v.updateWithSchema("schedules",{id:t,rule:r}),Object(y.d)().find(t=>t.id===r)}(r.id))}await Object(O.c)(async()=>{if(n){let t=e.serialize().conditions,o=function(t,e){let r=Object(g.a)(t),n=Object(g.a)(e),i=function(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}(Object.values(r),Object.values(n)),o=t.map(t=>{let e=i.find(e=>t===e[0]);return e&&e[1]?e[1]:t}),a=i.filter(t=>null==t[0]&&null!=t[1]).map(t=>t[1]);return o.concat(a)}(t,n);await Object(y.m)({id:e.id,conditions:o});let a=t=>{let{type:e,...r}=t;return r};!i&&u()(t.find(t=>"account"===t.field),t.find(t=>"account"===t.field))&&u()(a(t.find(t=>"date"===t.field)||{}),a(o.find(t=>"date"===t.field)||{}))||await et({id:r.id,conditions:o,reset:!0})}else i&&await et({id:r.id,reset:!0});await v.updateWithSchema("schedules",r)})}function it(t){let{actions:e,conditions:r}=t instanceof p.c?t.serialize():y.i.toJS(t);if(e&&e.find(t=>"link-schedule"===t.op)){let t=e.find(t=>"link-schedule"===t.op).value;if(t){let e=Object(g.a)(r),n=r.findIndex(t=>t===e.payee),i=r.findIndex(t=>t===e.account),o=r.findIndex(t=>t===e.amount),a=r.findIndex(t=>t===e.date);v.runQuery("INSERT OR REPLACE INTO schedules_json_paths (schedule_id, payee, account, amount, date) VALUES (?, ?, ?, ?, ?)",[t,-1===n?null:`$[${n}]`,-1===i?null:`$[${i}]`,-1===o?null:`$[${o}]`,-1===a?null:`$[${a}]`])}}}function ot(t,e){e.forEach((t,e)=>{"rules"===e&&t.forEach(t=>{it(t)})})}async function at(t){let{id:e}=t,{data:r}=await Object(_.g)(Object(h.b)("schedules").filter({id:e}).select("*")),n=r[0];if(null==n||null==n._account)return;let i={payee:n._payee,account:n._account,amount:Object(g.c)(n._amount),date:n.next_date,schedule:n.id,cleared:!1};i.account&&await Object(m.a)(i.account,[i])}async function st(t){let{data:e}=await Object(_.g)(Object(h.b)("schedules").filter({completed:!1,"_account.closed":!1}).select("*")),{data:r}=await Object(_.g)(Object(g.b)(e)),n=new Set(r.filter(Boolean).map(t=>t.schedule)),i=[],o=!1;for(let r of e){let e=Object(g.d)(r.next_date,r.completed,n.has(r.id));if("paid"===e){if(r._date)if(r._date.frequency)try{await et({id:r.id})}catch(t){}else r._date<Object(d.d)()&&await nt({schedule:{id:r.id,completed:!0}})}else("due"===e||"missed"===e)&&r.posts_transaction&&r._account&&(t?(await at({id:r.id}),o=!0):i.push(r._payee))}i.length>0?l.c("schedules-offline",{payees:i}):o&&l.c("sync-event",{type:"success",tables:["transactions"],syncDisabled:"false"})}let ut=Object(b.a)();ut.method("schedule/create",Object(E.c)(Object(T.e)((async function(){let{schedule:t=null,conditions:e=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t&&t.id||f.a(),{date:n}=Object(g.a)(e);if(null==n)throw new Error("A date condition is required to create a schedule");if(null==n.value)throw new Error("Date is required");let i,o=Q(n),a=o?Object(w.g)(o):null;if(t)if(t.name){if(await rt(t.name,r))throw new Error("Cannot create schedules with the same name")}else t.name=null;i=await Object(y.f)({stage:null,conditionsOp:"and",conditions:e,actions:[{op:"link-schedule",value:r}]});let s=Date.now();return await v.insertWithUUID("schedules_next_date",{schedule_id:r,local_next_date:a,local_next_date_ts:s,base_next_date:a,base_next_date_ts:s}),await v.insertWithSchema("schedules",{...t,id:r,rule:i}),r})))),ut.method("schedule/update",Object(E.c)(Object(T.e)(nt))),ut.method("schedule/delete",Object(E.c)(Object(T.e)((async function(t){let{id:e}=t,{data:r}=await Object(_.g)(Object(h.b)("schedules").filter({id:e}).calculate("rule"));await Object(O.c)(async()=>{await v.delete_("rules",r),await v.delete_("schedules",e)})})))),ut.method("schedule/skip-next-date",Object(E.c)(Object(T.e)((async function(t){let{id:e}=t;return et({id:e,start:t=>a.a(Object(d.l)(t),1)})})))),ut.method("schedule/post-transaction",Object(E.c)(Object(T.e)(at))),ut.method("schedule/force-run-service",Object(E.c)(()=>st(!0))),ut.method("schedule/get-possible-transactions",(function(t){let{schedule:e}=t})),ut.method("schedule/discover",(function(){return async function(){let{data:t}=await Object(_.g)(Object(h.b)("accounts").filter({closed:!1}).select("*")),e=[];for(let r of t){let t=await v.first("SELECT * FROM v_transactions WHERE account = ? AND parent_id IS NULL ORDER BY date DESC LIMIT 1",[r.id]);if(t){let n=Object(w.d)(t.date);e=e.concat(await G(n,r.id),await Y(n,r.id),await $(n,r.id),await K(n,r.id),await Z(n,r.id),await J(n,r.id))}}let r=[...Object(P.h)(e,"payee").entries()].map(t=>{let[e,r]=t;r.sort((t,e)=>e.rank-t.rank);let n=r[0];return{id:f.a(),account:n.account,payee:n.payee,date:n.date,amount:n.amount,_conditions:[{op:"is",field:"account",value:n.account},{op:"is",field:"payee",value:n.payee},{op:n.exactDate?"is":"isapprox",field:"date",value:n.date},{op:n.exactAmount?"is":"isapprox",field:"amount",value:n.amount}]}}),n=[];for(let t of r)n.push(await X(t));return n}()})),ut.method("schedule/get-upcoming-dates",(async function(t){let{config:e,count:r}=t,n=Object(g.e)(e);try{return new A.a({rrules:n}).occurrences({start:o(new Date),take:r}).toArray().map(t=>Object(d.f)(t.date))}catch(t){throw Object(c.a)(e),t}})),ut.service((function(){return v.transaction(()=>{Object(y.d)().forEach(t=>{it(t)})}),Object(O.a)(ot)})),ut.events.on("sync",t=>{let{type:e,subtype:r}=t;if(("success"===e||"error"===e||"unauthorized"===e)&&S.b()){let{lastScheduleRun:t}=S.b();t!==Object(d.d)()&&(Object(E.e)(()=>st("success"===e)),S.d({lastScheduleRun:Object(d.d)()}))}});e.a=ut},function(t,e,r){"use strict";(function(t){r.d(e,"e",(function(){return i})),r.d(e,"c",(function(){return o})),r.d(e,"b",(function(){return a})),r.d(e,"a",(function(){return s})),r.d(e,"d",(function(){return u}));function n(t){switch(t){case"aes-256-gcm":return"AES-GCM";default:throw new Error("unsupported crypto algorithm: "+t)}}function i(e){return t.from(crypto.getRandomValues(new Uint8Array(e)))}async function o(e,r){let i=crypto.getRandomValues(new Uint8Array(12)),o=await crypto.subtle.encrypt({name:n("aes-256-gcm"),iv:i,tagLength:128},e.getValue().raw,r);o=t.from(o);let a=o.slice(-16);return o=o.slice(0,-16),{value:o,meta:{keyId:e.getId(),algorithm:"aes-256-gcm",iv:t.from(i).toString("base64"),authTag:a.toString("base64")}}}async function a(e,r,i){let{algorithm:o,iv:a,authTag:s}=i,u=await crypto.subtle.decrypt({name:n(o),iv:t.from(a,"base64"),tagLength:128},e.getValue().raw,t.concat([r,t.from(s,"base64")]));return t.from(u)}async function s(e){let{secret:r,salt:n}=e,i=t.from(r),o=t.from(n),a=await crypto.subtle.importKey("raw",i,{name:"PBKDF2"},!1,["deriveBits","deriveKey"]),s=await crypto.subtle.deriveKey({name:"PBKDF2",hash:"SHA-512",salt:o,iterations:1e4},a,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),u=await crypto.subtle.exportKey("raw",s);return{raw:s,base64:t.from(u).toString("base64")}}async function u(e){return{raw:await crypto.subtle.importKey("raw",t.from(e,"base64"),{name:"AES-GCM"},!1,["encrypt","decrypt"]),base64:e}}}).call(this,r(16).Buffer)},function(t,e,r){"use strict";r.d(e,"a",(function(){return h})),r.d(e,"c",(function(){return g})),r.d(e,"b",(function(){return p})),r.d(e,"d",(function(){return m})),r.d(e,"e",(function(){return y}));var n=r(42),i=r(23),o=r(2),a=r(13),s=r(22),u=r(1),c=r(38),l=r(6);let f=null;async function d(t){const e=o.e(t),r=o.j(e,"backups");let n=[];await o.d(r)&&(n=await o.k(r),n=n.filter(t=>t.match(/\.sqlite$/)));const i=await Promise.all(n.map(async t=>{const e=await o.h(o.j(r,t));return{id:t,date:new Date(e)}}));return i.sort((t,e)=>t.date<e.date?1:t.date>e.date?-1:0),i}async function h(t){let e=await d(t),r=await async function(t){const e=o.e(t);return await o.d(o.j(e,"db.latest.sqlite"))?{id:"db.latest.sqlite",date:null,isLatest:!0}:null}(t);return r&&e.unshift(r),e.map(t=>({...t,date:t.date?n.a(t.date,"yyyy-MM-dd h:mm"):null}))}async function g(t){const e=o.e(t);await o.d(o.j(e,"db.latest.sqlite"))&&await o.p(o.j(o.e(t),"db.latest.sqlite"));let r=s.a()+".sqlite",c=o.j(e,"backups",r);await o.d(o.j(e,"backups"))||await o.m(o.j(e,"backups")),await o.c(o.j(e,"db.sqlite"),c);const l=a.g(c);await a.i(l,"DELETE FROM messages_crdt"),await a.i(l,"DELETE FROM messages_clock"),a.c(l);const f=await async function(t){const e=t.reduce((t,e)=>{const r=n.a(e.date,"yyyy-MM-dd");return t[r]=t[r]||[],t[r].push(e),t},{}),r=[];for(let t of Object.keys(e)){const n=e[t],i=t===u.d();for(let t of n.slice(i?3:1))r.push(t.id)}const i=t.filter(t=>!r.includes(t.id));return r.concat(i.slice(10).map(t=>t.id))}(await d(t));for(let t of f)await o.p(o.j(e,"backups",t));i.c("backups-updated",await h(t))}async function p(t,e){const r=o.e(t);if(await o.d(o.j(r,"db.latest.sqlite"))||(await o.c(o.j(r,"db.sqlite"),o.j(r,"db.latest.sqlite")),await o.c(o.j(r,"metadata.json"),o.j(r,"metadata.latest.json")),y(),m(t),await l.c(t)),"db.latest.sqlite"===e){console.log("Reverting backup"),await o.c(o.j(r,"db.latest.sqlite"),o.j(r,"db.sqlite")),await o.c(o.j(r,"metadata.latest.json"),o.j(r,"metadata.json")),await o.p(o.j(r,"db.latest.sqlite")),await o.p(o.j(r,"metadata.latest.json"));try{await c.i()}catch(t){}l.e()}else{console.log("Loading backup",e),await l.c(t),await l.d({groupId:null,lastSyncedTimestamp:null,lastUploaded:null});try{await c.i()}catch(t){}l.e(),await o.c(o.j(r,"backups",e),o.j(r,"db.sqlite"))}}function m(t){f&&clearInterval(f),f=setInterval(async()=>{console.log("Making backup"),await g(t)},9e5)}function y(){clearInterval(f),f=null}},function(t,e,r){t.exports=r(257),t.exports.Constants=r(158),t.exports.Errors=r(283),t.exports.FileAttr=r(284)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.constants={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:64,O_EXCL:128,O_NOCTTY:256,O_TRUNC:512,O_APPEND:1024,O_DIRECTORY:65536,O_NOATIME:262144,O_NOFOLLOW:131072,O_SYNC:1052672,O_DIRECT:16384,O_NONBLOCK:2048,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_FS_SYMLINK_DIR:1,UV_FS_SYMLINK_JUNCTION:2,UV_FS_COPYFILE_EXCL:1,UV_FS_COPYFILE_FICLONE:2,UV_FS_COPYFILE_FICLONE_FORCE:4,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4}},function(t,e,r){function n(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===n(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===n(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===n(t)},e.isError=function(t){return"[object Error]"===n(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(16).Buffer.isBuffer},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";var n=r(12),i=r(117),o=r(119),a=r(120),s=r(57);function u(t){s.call(this,"digest"),this._hash=t}n(u,s),u.prototype._update=function(t){this._hash.update(t)},u.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return"md5"===(t=t.toLowerCase())?new i:"rmd160"===t||"ripemd160"===t?new o:new u(a(t))}},function(t,e,r){(function(e){t.exports=function(t,r){for(var n=Math.min(t.length,r.length),i=new e(n),o=0;o<n;++o)i[o]=t[o]^r[o];return i}}).call(this,r(16).Buffer)},function(t,e,r){"use strict";var n=r(49),i=r(46);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}e.BlockHash=o,o.prototype.update=function(t,e){if(t=n.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=n.join32(t,0,t.length-r,this.endian);for(var i=0;i<t.length;i+=this._delta32)this._update(t,i,i+this._delta32)}return this},o.prototype.digest=function(t){return this.update(this._pad()),i(null===this.pending),this._digest(t)},o.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=t>>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o<this.padLength;o++)n[i++]=0;return n}},function(t,e,r){"use strict";const n=r(12),i=r(132).Reporter,o=r(130).Buffer;function a(t,e){i.call(this,e),o.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function s(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return s.isEncoderBuffer(t)||(t=new s(t,e)),this.length+=t.length,t}),this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=o.byteLength(t);else{if(!o.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}n(a,i),e.DecoderBuffer=a,a.isDecoderBuffer=function(t){if(t instanceof a)return!0;return"object"==typeof t&&o.isBuffer(t.base)&&"DecoderBuffer"===t.constructor.name&&"number"==typeof t.offset&&"number"==typeof t.length&&"function"==typeof t.save&&"function"==typeof t.restore&&"function"==typeof t.isEmpty&&"function"==typeof t.readUInt8&&"function"==typeof t.skip&&"function"==typeof t.raw},a.prototype.save=function(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},a.prototype.restore=function(t){const e=new a(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),e},a.prototype.isEmpty=function(){return this.offset===this.length},a.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},a.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");const r=new a(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},a.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},e.EncoderBuffer=s,s.isEncoderBuffer=function(t){if(t instanceof s)return!0;return"object"==typeof t&&"EncoderBuffer"===t.constructor.name&&"number"==typeof t.length&&"function"==typeof t.join},s.prototype.join=function(t,e){return t||(t=o.alloc(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(t,e),e+=r.length})):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):o.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t}},function(t,e,r){"use strict";(function(t,n){r.d(e,"c",(function(){return s})),r.d(e,"a",(function(){return u})),r.d(e,"d",(function(){return c})),r.d(e,"b",(function(){return l}));r(41);var i=r(43);let o,a=i.join(t,"..","..","..","..");n.match("bundle")&&(a=i.join(t,".."));const s=()=>"/",u=t=>o=t,c=()=>{if(!o)throw new Error("Document directory is not set");return o},l=t=>{if(!t)throw new Error("getDocumentDir: id is falsy: "+t);if(t.match(/[^A-Za-z0-9\-_]/))throw new Error(`Invalid budget id “${t}”. Check the id of your budget in the Advanced section of the settings page.`);return i.join(c(),t)};i.join(a,"default-db.sqlite"),i.join(a,"migrations"),i.join(a,"demo-budget"),i.join}).call(this,"/","/index.js")},function(t,e,r){(function(e){const n=r(81),i=r(43),o=r(159),a=r(381),s=(t,e)=>"boolean"==typeof t?t:e,u=(t,e)=>"string"==typeof t?t:e,c={noSort:!1,readEntries:!1,method:n.Constants.NONE,fs:null};t.exports=function(t,r){let l=null;const f=Object.assign(Object.create(null),c);t&&"object"==typeof t&&(t instanceof Uint8Array||(Object.assign(f,t),t=f.input?f.input:void 0,f.input&&delete f.input),e.isBuffer(t)&&(l=t,f.method=n.Constants.BUFFER,t=void 0)),Object.assign(f,r);const d=new n(f);if(t&&"string"==typeof t){if(!d.fs.existsSync(t))throw new Error(n.Errors.INVALID_FILENAME);f.method=n.Constants.FILE,f.filename=t,l=d.fs.readFileSync(t)}const h=new a(l,f),{canonical:g,sanitize:p}=n;function m(t){var e;if(t&&h&&("string"==typeof t&&(e=h.getEntry(t)),"object"==typeof t&&void 0!==t.entryName&&void 0!==t.header&&(e=h.getEntry(t.entryName)),e))return e;return null}function y(t){const{join:e,normalize:r,sep:n}=i.posix;return e(".",r(n+t.split("\\").join(n)+n))}return{readFile:function(t,e){var r=m(t);return r&&r.getData(e)||null},readFileAsync:function(t,e){var r=m(t);r?r.getDataAsync(e):e(null,"getEntry failed for:"+t)},readAsText:function(t,e){var r=m(t);if(r){var n=r.getData();if(n&&n.length)return n.toString(e||"utf8")}return""},readAsTextAsync:function(t,e,r){var n=m(t);n?n.getDataAsync((function(t,n){n?e(t,n):t&&t.length?e(t.toString(r||"utf8")):e("")})):e("")},deleteFile:function(t){var e=m(t);e&&h.deleteEntry(e.entryName)},addZipComment:function(t){h.comment=t},getZipComment:function(){return h.comment||""},addZipEntryComment:function(t,e){var r=m(t);r&&(r.comment=e)},getZipEntryComment:function(t){var e=m(t);return e&&e.comment||""},updateFile:function(t,e){var r=m(t);r&&r.setData(e)},addLocalFile:function(t,e,r,i){if(!d.fs.existsSync(t))throw new Error(n.Errors.FILE_NOT_FOUND.replace("%s",t));{e=e?y(e):"";var o=t.split("\\").join("/").split("/").pop();e+=r||o;const n=d.fs.statSync(t);this.addFile(e,d.fs.readFileSync(t),i,n)}},addLocalFolder:function(t,r,o){var a;if(o instanceof RegExp?(a=o,o=function(t){return a.test(t)}):"function"!=typeof o&&(o=function(){return!0}),r=r?y(r):"",t=i.normalize(t),!d.fs.existsSync(t))throw new Error(n.Errors.FILE_NOT_FOUND.replace("%s",t));{const n=d.findFiles(t),a=this;n.length&&n.forEach((function(n){var s=i.relative(t,n).split("\\").join("/");if(o(s)){var u=d.fs.statSync(n);u.isFile()?a.addFile(r+s,d.fs.readFileSync(n),"",u):a.addFile(r+s+"/",e.alloc(0),"",u)}}))}},addLocalFolderAsync:function(t,r,o,a){var s;a instanceof RegExp?(s=a,a=function(t){return s.test(t)}):"function"!=typeof a&&(a=function(){return!0}),o=o?y(o):"",t=i.normalize(t);var u=this;d.fs.open(t,"r",(function(s){if(s&&"ENOENT"===s.code)r(void 0,n.Errors.FILE_NOT_FOUND.replace("%s",t));else if(s)r(void 0,s);else{var c=d.findFiles(t),l=-1,f=function(){if((l+=1)<c.length){var n=c[l],s=i.relative(t,n).split("\\").join("/");s=s.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),a(s)?d.fs.stat(n,(function(t,i){t&&r(void 0,t),i.isFile()?d.fs.readFile(n,(function(t,e){t?r(void 0,t):(u.addFile(o+s,e,"",i),f())})):(u.addFile(o+s+"/",e.alloc(0),"",i),f())})):f()}else r(!0,void 0)};f()}}))},addLocalFolderPromise:function(t,e){return new Promise((r,n)=>{const{filter:i,zipPath:o}=Object.assign({},e);this.addLocalFolderAsync(t,(t,e)=>{e&&n(e),t&&r(this)},o,i)})},addFile:function(t,e,r,i){let a=m(t);const s=null!=a;s||(a=new o,a.entryName=t),a.comment=r||"";const u="object"==typeof i&&i instanceof d.fs.Stats;u&&(a.header.time=i.mtime);var c=a.isDirectory?16:0;if(!n.isWin){let t=a.isDirectory?16384:32768;t|=u?4095&i.mode:"number"==typeof i?4095&i:a.isDirectory?493:420,c=(c|t<<16)>>>0}a.attr=c,a.setData(e),s||h.setEntry(a)},getEntries:function(){return h?h.entries:[]},getEntry:function(t){return m(t)},getEntryCount:function(){return h.getEntryCount()},forEach:function(t){return h.forEach(t)},extractEntryTo:function(t,e,r,o,a,c){o=s(o,!1),a=s(a,!1),r=s(r,!0),c=u(c,u(a,void 0));var l=m(t);if(!l)throw new Error(n.Errors.NO_ENTRY);var f=g(l.entryName),y=p(e,c&&!l.isDirectory?c:r?f:i.basename(f));if(l.isDirectory)return h.getEntryChildren(l).forEach((function(t){if(t.isDirectory)return;var s=t.getData();if(!s)throw new Error(n.Errors.CANT_EXTRACT_FILE);var u=g(t.entryName),c=p(e,r?u:i.basename(u));const l=a?t.header.fileAttr:void 0;d.writeFileTo(c,s,o,l)})),!0;var b=l.getData();if(!b)throw new Error(n.Errors.CANT_EXTRACT_FILE);if(d.fs.existsSync(y)&&!o)throw new Error(n.Errors.CANT_OVERRIDE);const _=a?t.header.fileAttr:void 0;return d.writeFileTo(y,b,o,_),!0},test:function(t){if(!h)return!1;for(var e in h.entries)try{if(e.isDirectory)continue;if(!h.entries[e].getData(t))return!1}catch(t){return!1}return!0},extractAllTo:function(t,e,r,i){if(e=s(e,!1),i=u(r,i),r=s(r,!1),!h)throw new Error(n.Errors.NO_ZIP);h.entries.forEach((function(o){var a=p(t,g(o.entryName.toString()));if(o.isDirectory)return void d.makeDir(a);var s=o.getData(i);if(!s)throw new Error(n.Errors.CANT_EXTRACT_FILE);const u=r?o.header.fileAttr:void 0;d.writeFileTo(a,s,e,u);try{d.fs.utimesSync(a,o.header.time,o.header.time)}catch(t){throw new Error(n.Errors.CANT_EXTRACT_FILE)}}))},extractAllToAsync:function(t,e,r,o){if(o||(o=function(){}),e=s(e,!1),"function"!=typeof r||o||(o=r),r=s(r,!1),!h)return void o(new Error(n.Errors.NO_ZIP));t=i.resolve(t);const a=e=>p(t,i.normalize(g(e.entryName.toString()))),u=(t,e)=>new Error(t+': "'+e+'"'),c=[],l=new Set;h.entries.forEach(t=>{t.isDirectory?c.push(t):l.add(t)});for(const t of c){const e=a(t),n=r?t.header.fileAttr:void 0;try{d.makeDir(e),n&&d.fs.chmodSync(e,n),d.fs.utimesSync(e,t.header.time,t.header.time)}catch(t){o(u("Unable to create folder",e))}}const f=()=>{0===l.size&&o()};for(const a of l.values()){const s=i.normalize(g(a.entryName.toString())),c=p(t,s);a.getDataAsync((function(t,i){if(i)o(new Error(i));else if(t){const n=r?a.header.fileAttr:void 0;d.writeFileToAsync(c,t,e,n,(function(t){t?d.fs.utimes(c,a.header.time,a.header.time,(function(t){t?o(u("Unable to set times",c)):(l.delete(a),f())})):o(u("Unable to write file",c))}))}else o(new Error(n.Errors.CANT_EXTRACT_FILE))}))}f()},writeZip:function(t,e){if(1===arguments.length&&"function"==typeof t&&(e=t,t=""),!t&&f.filename&&(t=f.filename),t){var r=h.compressToBuffer();if(r){var n=d.writeFileTo(t,r,!0);"function"==typeof e&&e(n?null:new Error("failed"),"")}}},writeZipPromise:function(t,e){const{overwrite:r,perm:n}=Object.assign({overwrite:!0},e);return new Promise((e,i)=>{!t&&f.filename&&(t=f.filename),t||i("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(o=>{d.writeFileToAsync(t,o,r,n,t=>t?e(t):i("ADM-ZIP: Wasn't able to write zip file"))},i)})},toBufferPromise:function(){return new Promise((t,e)=>{h.toAsyncBuffer(t,e)})},toBuffer:function(t,e,r,n){return this.valueOf=2,"function"==typeof t?(h.toAsyncBuffer(t,e,r,n),null):h.compressToBuffer()}}}}).call(this,r(16).Buffer)},function(t,e,r){"use strict";function n(t){var e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),t.getTime()-e.getTime()}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";function n(t){let e={running:null,queue:[]};function r(){if(e.queue.length>0){const t=e.queue.shift();n(t.args,t.resolve,t.reject)}else e.running=null}function n(n,i,o){e.running=t(...n),e.running.then(t=>{r(),i(t)},t=>{r(),o(t)})}return function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return e.running?new Promise((t,n)=>{e.queue.push({resolve:t,reject:n,args:r})}):new Promise((t,e)=>n(r,t,e))}}function i(t){let e=null;return function(){return e||(e=t(...arguments).finally(()=>{e=null}),e)}}r.d(e,"b",(function(){return n})),r.d(e,"a",(function(){return i}))},function(t,e,r){"use strict";async function n(t,e,r,n){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],o=500,a=[],s=new Set;for(let u=0;u<e.length;u+=o){let c=e.slice(u,u+o).filter(t=>!s.has(t));if(c.length>0){let e=n("("+c.map(t=>r(t)).join(" OR ")+")"),o=await t(e,i,!0);s=new Set([...s,...c]),a=a.concat(o)}}return a}function i(t,e){return e+" IN ("+[...new Set(t)].map(t=>`'${t}'`).join(",")+")"}r.d(e,"a",(function(){return n})),r.d(e,"b",(function(){return i}))},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(0);async function i(){let t=await n.first("\n SELECT * FROM categories\n WHERE is_income = 1 AND\n LOWER(name) = 'starting balances' AND\n tombstone = 0\n ");return null===t&&(t=await n.first("SELECT * FROM categories WHERE is_income = 1 AND tombstone = 0")),{id:await async function(t){let e=await n.first("SELECT id FROM payees WHERE UNICODE_LOWER(name) = ? AND tombstone = 0",[t.toLowerCase()]);return e?e.id:n.insertPayee({name:t})}("Starting Balance"),category:t?t.id:null}}},function(t,e,r){"use strict";r.d(e,"b",(function(){return s})),r.d(e,"a",(function(){return c}));var n=r(7),i=r(0);let o,a;async function s(){let t=(await i.all("SELECT * FROM category_mapping")).map(t=>[t.id,t.transferId]),e=(await i.all("SELECT * FROM payee_mapping")).map(t=>[t.id,t.targetId]);o=new Map(t.concat(e)),a&&a(),a=Object(n.a)(u)}function u(t,e){e.forEach((t,e)=>{if(-1!==e.indexOf("mapping")){let r="category_mapping"===e?"transferId":"targetId";t.forEach(t=>{o.set(t.id,t[r])})}})}function c(){return o}},function(t,e,r){"use strict";function n(t,e){switch(t){case"brokerage":case"investment":return"investment";case"credit":return"credit";case"loan":return"debt";case"other":return"other";case"depository":default:switch(e){case"money market":case"savings":return"savings";case"cd":return"cd";default:return"checking"}}}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n=r(8);function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t){return Object(n.a)(1,arguments),t instanceof Date||"object"===i(t)&&"[object Date]"===Object.prototype.toString.call(t)}var a=r(17);function s(t){if(Object(n.a)(1,arguments),!o(t)&&"number"!=typeof t)return!1;var e=Object(a.a)(t);return!isNaN(Number(e))}},function(t,e,r){(function(t){var n=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},n=0;n<e.length;n++)r[e[n]]=Object.getOwnPropertyDescriptor(t,e[n]);return r},i=/%[sdj%]/g;e.format=function(t){if(!y(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(s(arguments[r]));return e.join(" ")}r=1;for(var n=arguments,o=n.length,a=String(t).replace(i,(function(t){if("%%"===t)return"%";if(r>=o)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}})),u=n[r];r<o;u=n[++r])p(u)||!v(u)?a+=" "+u:a+=" "+s(u);return a},e.deprecate=function(r,n){if(void 0!==t&&!0===t.noDeprecation)return r;if(void 0===t)return function(){return e.deprecate(r,n).apply(this,arguments)};var i=!1;return function(){if(!i){if(t.throwDeprecation)throw new Error(n);t.traceDeprecation?console.trace(n):console.error(n),i=!0}return r.apply(this,arguments)}};var o,a={};function s(t,r){var n={seen:[],stylize:c};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),g(r)?n.showHidden=r:r&&e._extend(n,r),b(n.showHidden)&&(n.showHidden=!1),b(n.depth)&&(n.depth=2),b(n.colors)&&(n.colors=!1),b(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),l(n,t,n.depth)}function u(t,e){var r=s.styles[e];return r?"["+s.colors[r][0]+"m"+t+"["+s.colors[r][1]+"m":t}function c(t,e){return t}function l(t,r,n){if(t.customInspect&&r&&S(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,t);return y(i)||(i=l(t,i,n)),i}var o=function(t,e){if(b(e))return t.stylize("undefined","undefined");if(y(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(m(e))return t.stylize(""+e,"number");if(g(e))return t.stylize(""+e,"boolean");if(p(e))return t.stylize("null","null")}(t,r);if(o)return o;var a=Object.keys(r),s=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(r)),E(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return f(r);if(0===a.length){if(S(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(_(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(w(r))return t.stylize(Date.prototype.toString.call(r),"date");if(E(r))return f(r)}var c,v="",O=!1,T=["{","}"];(h(r)&&(O=!0,T=["[","]"]),S(r))&&(v=" [Function"+(r.name?": "+r.name:"")+"]");return _(r)&&(v=" "+RegExp.prototype.toString.call(r)),w(r)&&(v=" "+Date.prototype.toUTCString.call(r)),E(r)&&(v=" "+f(r)),0!==a.length||O&&0!=r.length?n<0?_(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),c=O?function(t,e,r,n,i){for(var o=[],a=0,s=e.length;a<s;++a)I(e,String(a))?o.push(d(t,e,r,n,String(a),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(d(t,e,r,n,i,!0))})),o}(t,r,n,s,a):a.map((function(e){return d(t,r,n,s,e,O)})),t.seen.pop(),function(t,e,r){if(t.reduce((function(t,e){return e.indexOf("\n")>=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(c,v,T)):T[0]+v+T[1]}function f(t){return"["+Error.prototype.toString.call(t)+"]"}function d(t,e,r,n,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(s=t.stylize("[Setter]","special")),I(n,i)||(a="["+i+"]"),s||(t.seen.indexOf(u.value)<0?(s=p(r)?l(t,u.value,null):l(t,u.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),b(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function h(t){return Array.isArray(t)}function g(t){return"boolean"==typeof t}function p(t){return null===t}function m(t){return"number"==typeof t}function y(t){return"string"==typeof t}function b(t){return void 0===t}function _(t){return v(t)&&"[object RegExp]"===O(t)}function v(t){return"object"==typeof t&&null!==t}function w(t){return v(t)&&"[object Date]"===O(t)}function E(t){return v(t)&&("[object Error]"===O(t)||t instanceof Error)}function S(t){return"function"==typeof t}function O(t){return Object.prototype.toString.call(t)}function T(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(r){if(b(o)&&(o=t.env.NODE_DEBUG||""),r=r.toUpperCase(),!a[r])if(new RegExp("\\b"+r+"\\b","i").test(o)){var n=t.pid;a[r]=function(){var t=e.format.apply(e,arguments);console.error("%s %d: %s",r,n,t)}}else a[r]=function(){};return a[r]},e.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=h,e.isBoolean=g,e.isNull=p,e.isNullOrUndefined=function(t){return null==t},e.isNumber=m,e.isString=y,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=b,e.isRegExp=_,e.isObject=v,e.isDate=w,e.isError=E,e.isFunction=S,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(260);var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function M(){var t=new Date,e=[T(t.getHours()),T(t.getMinutes()),T(t.getSeconds())].join(":");return[t.getDate(),A[t.getMonth()],e].join(" ")}function I(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",M(),e.format.apply(e,arguments))},e.inherits=r(261),e._extend=function(t,e){if(!e||!v(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t};var R="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function N(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}e.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(R&&t[R]){var e;if("function"!=typeof(e=t[R]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,R,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,n=new Promise((function(t,n){e=t,r=n})),i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);i.push((function(t,n){t?r(t):e(n)}));try{t.apply(this,i)}catch(t){r(t)}return n}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),R&&Object.defineProperty(e,R,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,n(t))},e.promisify.custom=R,e.callbackify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function r(){for(var r=[],n=0;n<arguments.length;n++)r.push(arguments[n]);var i=r.pop();if("function"!=typeof i)throw new TypeError("The last argument must be of type Function");var o=this,a=function(){return i.apply(o,arguments)};e.apply(this,r).then((function(e){t.nextTick(a,null,e)}),(function(e){t.nextTick(N,e,a)}))}return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),Object.defineProperties(r,n(e)),r}}).call(this,r(25))},function(t,e,r){(function(t){var n=void 0!==t&&t||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(i.call(setTimeout,n,arguments),clearTimeout)},e.setInterval=function(){return new o(i.call(setInterval,n,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(n,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r(264),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(33))},function(t,e,r){"use strict";(function(e){void 0===e||!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:function(t,r,n,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var o,a,s=arguments.length;switch(s){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick((function(){t.call(null,r)}));case 3:return e.nextTick((function(){t.call(null,r,n)}));case 4:return e.nextTick((function(){t.call(null,r,n,i)}));default:for(o=new Array(s-1),a=0;a<o.length;)o[a++]=arguments[a];return e.nextTick((function(){t.apply(null,o)}))}}}:t.exports=e}).call(this,r(25))},function(t,e,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)i(r,n)&&(t[n]=r[n])}}return t},e.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var o={arraySet:function(t,e,r,n,i){if(e.subarray&&t.subarray)t.set(e.subarray(r,r+n),i);else for(var o=0;o<n;o++)t[i+o]=e[r+o]},flattenChunks:function(t){var e,r,n,i,o,a;for(n=0,e=0,r=t.length;e<r;e++)n+=t[e].length;for(a=new Uint8Array(n),i=0,e=0,r=t.length;e<r;e++)o=t[e],a.set(o,i),i+=o.length;return a}},a={arraySet:function(t,e,r,n,i){for(var o=0;o<n;o++)t[i+o]=e[r+o]},flattenChunks:function(t){return[].concat.apply([],t)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,o)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,a))},e.setTyped(n)},function(t,e,r){var n=r(19).Buffer;function i(t){n.isBuffer(t)||(t=n.from(t));for(var e=t.length/4|0,r=new Array(e),i=0;i<e;i++)r[i]=t.readUInt32BE(4*i);return r}function o(t){for(;0<t.length;t++)t[0]=0}function a(t,e,r,n,i){for(var o,a,s,u,c=r[0],l=r[1],f=r[2],d=r[3],h=t[0]^e[0],g=t[1]^e[1],p=t[2]^e[2],m=t[3]^e[3],y=4,b=1;b<i;b++)o=c[h>>>24]^l[g>>>16&255]^f[p>>>8&255]^d[255&m]^e[y++],a=c[g>>>24]^l[p>>>16&255]^f[m>>>8&255]^d[255&h]^e[y++],s=c[p>>>24]^l[m>>>16&255]^f[h>>>8&255]^d[255&g]^e[y++],u=c[m>>>24]^l[h>>>16&255]^f[g>>>8&255]^d[255&p]^e[y++],h=o,g=a,p=s,m=u;return o=(n[h>>>24]<<24|n[g>>>16&255]<<16|n[p>>>8&255]<<8|n[255&m])^e[y++],a=(n[g>>>24]<<24|n[p>>>16&255]<<16|n[m>>>8&255]<<8|n[255&h])^e[y++],s=(n[p>>>24]<<24|n[m>>>16&255]<<16|n[h>>>8&255]<<8|n[255&g])^e[y++],u=(n[m>>>24]<<24|n[h>>>16&255]<<16|n[g>>>8&255]<<8|n[255&p])^e[y++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var s=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var c=s^s<<1^s<<2^s<<3^s<<4;c=c>>>8^255&c^99,r[a]=c,n[c]=a;var l=t[a],f=t[l],d=t[f],h=257*t[c]^16843008*c;i[0][a]=h<<24|h>>>8,i[1][a]=h<<16|h>>>16,i[2][a]=h<<8|h>>>24,i[3][a]=h,h=16843009*d^65537*f^257*l^16843008*a,o[0][c]=h<<24|h>>>8,o[1][c]=h<<16|h>>>16,o[2][c]=h<<8|h>>>24,o[3][c]=h,0===a?a=s=1:(a=l^t[t[t[d^l]]],s^=t[t[s]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function c(t){this._key=i(t),this._reset()}c.blockSize=16,c.keySize=32,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,n=4*(r+1),i=[],o=0;o<e;o++)i[o]=t[o];for(o=e;o<n;o++){var a=i[o-1];o%e==0?(a=a<<8|a>>>24,a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a],a^=s[o/e|0]<<24):e>6&&o%e==4&&(a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a]),i[o]=i[o-e]^a}for(var c=[],l=0;l<n;l++){var f=n-l,d=i[f-(l%4?0:4)];c[l]=l<4||f<=4?d:u.INV_SUB_MIX[0][u.SBOX[d>>>24]]^u.INV_SUB_MIX[1][u.SBOX[d>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[d>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&d]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=c},c.prototype.encryptBlockRaw=function(t){return a(t=i(t),this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},c.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=n.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},c.prototype.decryptBlock=function(t){var e=(t=i(t))[1];t[1]=t[3],t[3]=e;var r=a(t,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=n.allocUnsafe(16);return o.writeUInt32BE(r[0],0),o.writeUInt32BE(r[3],4),o.writeUInt32BE(r[2],8),o.writeUInt32BE(r[1],12),o},c.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},t.exports.AES=c},function(t,e,r){var n=r(19).Buffer,i=r(117);t.exports=function(t,e,r,o){if(n.isBuffer(t)||(t=n.from(t,"binary")),e&&(n.isBuffer(e)||(e=n.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var a=r/8,s=n.alloc(a),u=n.alloc(o||0),c=n.alloc(0);a>0||o>0;){var l=new i;l.update(c),l.update(t),e&&l.update(e),c=l.digest();var f=0;if(a>0){var d=s.length-a;f=Math.min(a,c.length),c.copy(s,d,0,f),a-=f}if(f<c.length&&o>0){var h=u.length-o,g=Math.min(o,c.length-f);c.copy(u,h,f,f+g),o-=g}}return c.fill(0),{key:s,iv:u}}},function(t,e,r){"use strict";var n=r(39),i=r(47),o=i.getNAF,a=i.getJSF,s=i.assert;function u(t,e){this.type=t,this.p=new n(e.p,16),this.red=e.prime?n.red(e.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=e.n&&new n(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function c(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(t,e){s(t.precomputed);var r=t._getDoubles(),n=o(e,1,this._bitLength),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;var a,u,c=[];for(a=0;a<n.length;a+=r.step){u=0;for(var l=a+r.step-1;l>=a;l--)u=(u<<1)+n[l];c.push(u)}for(var f=this.jpoint(null,null,null),d=this.jpoint(null,null,null),h=i;h>0;h--){for(a=0;a<c.length;a++)(u=c[a])===h?d=d.mixedAdd(r.points[a]):u===-h&&(d=d.mixedAdd(r.points[a].neg()));f=f.add(d)}return f.toP()},u.prototype._wnafMul=function(t,e){var r=4,n=t._getNAFPoints(r);r=n.wnd;for(var i=n.points,a=o(e,r,this._bitLength),u=this.jpoint(null,null,null),c=a.length-1;c>=0;c--){for(var l=0;c>=0&&0===a[c];c--)l++;if(c>=0&&l++,u=u.dblp(l),c<0)break;var f=a[c];s(0!==f),u="affine"===t.type?f>0?u.mixedAdd(i[f-1>>1]):u.mixedAdd(i[-f-1>>1].neg()):f>0?u.add(i[f-1>>1]):u.add(i[-f-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,n,i){var s,u,c,l=this._wnafT1,f=this._wnafT2,d=this._wnafT3,h=0;for(s=0;s<n;s++){var g=(c=e[s])._getNAFPoints(t);l[s]=g.wnd,f[s]=g.points}for(s=n-1;s>=1;s-=2){var p=s-1,m=s;if(1===l[p]&&1===l[m]){var y=[e[p],null,null,e[m]];0===e[p].y.cmp(e[m].y)?(y[1]=e[p].add(e[m]),y[2]=e[p].toJ().mixedAdd(e[m].neg())):0===e[p].y.cmp(e[m].y.redNeg())?(y[1]=e[p].toJ().mixedAdd(e[m]),y[2]=e[p].add(e[m].neg())):(y[1]=e[p].toJ().mixedAdd(e[m]),y[2]=e[p].toJ().mixedAdd(e[m].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],_=a(r[p],r[m]);for(h=Math.max(_[0].length,h),d[p]=new Array(h),d[m]=new Array(h),u=0;u<h;u++){var v=0|_[0][u],w=0|_[1][u];d[p][u]=b[3*(v+1)+(w+1)],d[m][u]=0,f[p]=y}}else d[p]=o(r[p],l[p],this._bitLength),d[m]=o(r[m],l[m],this._bitLength),h=Math.max(d[p].length,h),h=Math.max(d[m].length,h)}var E=this.jpoint(null,null,null),S=this._wnafT4;for(s=h;s>=0;s--){for(var O=0;s>=0;){var T=!0;for(u=0;u<n;u++)S[u]=0|d[u][s],0!==S[u]&&(T=!1);if(!T)break;O++,s--}if(s>=0&&O++,E=E.dblp(O),s<0)break;for(u=0;u<n;u++){var A=S[u];0!==A&&(A>0?c=f[u][A-1>>1]:A<0&&(c=f[u][-A-1>>1].neg()),E="affine"===c.type?E.mixedAdd(c):E.add(c))}}for(s=0;s<n;s++)f[s]=null;return i?E:E.toP()},u.BasePoint=c,c.prototype.eq=function(){throw new Error("Not implemented")},c.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(t,e){t=i.toArray(t,e);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*r)return 6===t[0]?s(t[t.length-1]%2==0):7===t[0]&&s(t[t.length-1]%2==1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},c.prototype.encodeCompressed=function(t){return this.encode(t,!0)},c.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},c.prototype.encode=function(t,e){return i.encode(this._encode(e),t)},c.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},c.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},c.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)n=n.dbl();r.push(n)}return{step:t,points:r}},c.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)e[i]=e[i-1].add(n);return{wnd:t,points:e}},c.prototype._getBeta=function(){return null},c.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e}},function(t,e,r){var n=r(366),i=r(373),o=r(374),a=r(122),s=r(177),u=r(19).Buffer;function c(t){var e;"object"!=typeof t||u.isBuffer(t)||(e=t.passphrase,t=t.key),"string"==typeof t&&(t=u.from(t));var r,c,l=o(t,e),f=l.tag,d=l.data;switch(f){case"CERTIFICATE":c=n.certificate.decode(d,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(c||(c=n.PublicKey.decode(d,"der")),r=c.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return n.RSAPublicKey.decode(c.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return c.subjectPrivateKey=c.subjectPublicKey,{type:"ec",data:c};case"1.2.840.10040.4.1":return c.algorithm.params.pub_key=n.DSAparam.decode(c.subjectPublicKey.data,"der"),{type:"dsa",data:c.algorithm.params};default:throw new Error("unknown key id "+r)}case"ENCRYPTED PRIVATE KEY":d=function(t,e){var r=t.algorithm.decrypt.kde.kdeparams.salt,n=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),o=i[t.algorithm.decrypt.cipher.algo.join(".")],c=t.algorithm.decrypt.cipher.iv,l=t.subjectPrivateKey,f=parseInt(o.split("-")[1],10)/8,d=s.pbkdf2Sync(e,r,n,f,"sha1"),h=a.createDecipheriv(o,d,c),g=[];return g.push(h.update(l)),g.push(h.final()),u.concat(g)}(d=n.EncryptedPrivateKey.decode(d,"der"),e);case"PRIVATE KEY":switch(r=(c=n.PrivateKey.decode(d,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return n.RSAPrivateKey.decode(c.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:c.algorithm.curve,privateKey:n.ECPrivateKey.decode(c.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return c.algorithm.params.priv_key=n.DSAparam.decode(c.subjectPrivateKey,"der"),{type:"dsa",params:c.algorithm.params};default:throw new Error("unknown key id "+r)}case"RSA PUBLIC KEY":return n.RSAPublicKey.decode(d,"der");case"RSA PRIVATE KEY":return n.RSAPrivateKey.decode(d,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:n.DSAPrivateKey.decode(d,"der")};case"EC PRIVATE KEY":return{curve:(d=n.ECPrivateKey.decode(d,"der")).parameters.value,privateKey:d.privateKey};default:throw new Error("unknown key type "+f)}}t.exports=c,c.signature=n.signature},function(t,e,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var n=Object.getOwnPropertySymbols(t);if(1!==n.length||n[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(t,e);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},function(t,e,r){"use strict";var n=r(138),i=r(59),o=i("%Function.prototype.apply%"),a=i("%Function.prototype.call%"),s=i("%Reflect.apply%",!0)||n.call(a,o),u=i("%Object.getOwnPropertyDescriptor%",!0),c=i("%Object.defineProperty%",!0),l=i("%Math.max%");if(c)try{c({},"a",{value:1})}catch(t){c=null}t.exports=function(t){var e=s(n,a,arguments);if(u&&c){var r=u(e,"length");r.configurable&&c(e,"length",{value:1+l(0,t.length-(arguments.length-1))})}return e};var f=function(){return s(n,o,arguments)};c?c(t.exports,"apply",{value:f}):t.exports.apply=f},function(t,e,r){"use strict";let n;function i(t){n=t}r.d(e,"b",(function(){return n})),r.d(e,"a",(function(){return i}))},function(t,e,r){"use strict";e.a=function(t){return{all:t=t||new Map,on:function(e,r){var n=t.get(e);n?n.push(r):t.set(e,[r])},off:function(e,r){var n=t.get(e);n&&(r?n.splice(n.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var n=t.get(e);n&&n.slice().map((function(t){t(r)})),(n=t.get("*"))&&n.slice().map((function(t){t(e,r)}))}}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(82),i=r(258),o=n.constants.S_IFMT,a=n.constants.S_IFDIR,s=n.constants.S_IFREG,u=n.constants.S_IFBLK,c=n.constants.S_IFCHR,l=n.constants.S_IFLNK,f=n.constants.S_IFIFO,d=n.constants.S_IFSOCK,h=function(){function t(){}return t.build=function(e,r){void 0===r&&(r=!1);var n=new t,o=e.uid,a=e.gid,s=e.atime,u=e.mtime,c=e.ctime,l=r?i.default:function(t){return t};n.uid=l(o),n.gid=l(a),n.rdev=l(0),n.blksize=l(4096),n.ino=l(e.ino),n.size=l(e.getSize()),n.blocks=l(1),n.atime=s,n.mtime=u,n.ctime=c,n.birthtime=c,n.atimeMs=l(s.getTime()),n.mtimeMs=l(u.getTime());var f=l(c.getTime());return n.ctimeMs=f,n.birthtimeMs=f,n.dev=l(0),n.mode=l(e.mode),n.nlink=l(e.nlink),n},t.prototype._checkModeProperty=function(t){return(Number(this.mode)&o)===t},t.prototype.isDirectory=function(){return this._checkModeProperty(a)},t.prototype.isFile=function(){return this._checkModeProperty(s)},t.prototype.isBlockDevice=function(){return this._checkModeProperty(u)},t.prototype.isCharacterDevice=function(){return this._checkModeProperty(c)},t.prototype.isSymbolicLink=function(){return this._checkModeProperty(l)},t.prototype.isFIFO=function(){return this._checkModeProperty(f)},t.prototype.isSocket=function(){return this._checkModeProperty(d)},t}();e.Stats=h,e.default=h},function(t,e,r){"use strict";var n=this&&this.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),i=0;for(e=0;e<r;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)n[i]=o[a];return n};Object.defineProperty(e,"__esModule",{value:!0});var i=r(16);function o(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return new(i.Buffer.bind.apply(i.Buffer,n([void 0,t],e)))}e.Buffer=i.Buffer;var a=i.Buffer.allocUnsafe||o;e.bufferAllocUnsafe=a;var s=i.Buffer.from||o;e.bufferFrom=s},function(t,e,r){"use strict";(function(e){var n=r(259);
|
|
11
|
+
/*!
|
|
12
|
+
* The buffer module from node.js, for the browser.
|
|
13
|
+
*
|
|
14
|
+
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
15
|
+
* @license MIT
|
|
16
|
+
*/function i(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0}function o(t){return e.Buffer&&"function"==typeof e.Buffer.isBuffer?e.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}var a=r(98),s=Object.prototype.hasOwnProperty,u=Array.prototype.slice,c="foo"===function(){}.name;function l(t){return Object.prototype.toString.call(t)}function f(t){return!o(t)&&("function"==typeof e.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}var d=t.exports=b,h=/\s*function\s+([^\(\s]*)\s*/;function g(t){if(a.isFunction(t)){if(c)return t.name;var e=t.toString().match(h);return e&&e[1]}}function p(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function m(t){if(c||!a.isFunction(t))return a.inspect(t);var e=g(t);return"[Function"+(e?": "+e:"")+"]"}function y(t,e,r,n,i){throw new d.AssertionError({message:r,actual:t,expected:e,operator:n,stackStartFunction:i})}function b(t,e){t||y(t,!0,e,"==",d.ok)}function _(t,e,r,n){if(t===e)return!0;if(o(t)&&o(e))return 0===i(t,e);if(a.isDate(t)&&a.isDate(e))return t.getTime()===e.getTime();if(a.isRegExp(t)&&a.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"==typeof t||null!==e&&"object"==typeof e){if(f(t)&&f(e)&&l(t)===l(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===i(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(o(t)!==o(e))return!1;var s=(n=n||{actual:[],expected:[]}).actual.indexOf(t);return-1!==s&&s===n.expected.indexOf(e)||(n.actual.push(t),n.expected.push(e),function(t,e,r,n){if(null==t||null==e)return!1;if(a.isPrimitive(t)||a.isPrimitive(e))return t===e;if(r&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var i=v(t),o=v(e);if(i&&!o||!i&&o)return!1;if(i)return t=u.call(t),e=u.call(e),_(t,e,r);var s,c,l=S(t),f=S(e);if(l.length!==f.length)return!1;for(l.sort(),f.sort(),c=l.length-1;c>=0;c--)if(l[c]!==f[c])return!1;for(c=l.length-1;c>=0;c--)if(s=l[c],!_(t[s],e[s],r,n))return!1;return!0}(t,e,r,n))}return r?t===e:t==e}function v(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function w(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function E(t,e,r,n){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&y(i,r,"Missing expected exception"+n);var o="string"==typeof n,s=!t&&i&&!r;if((!t&&a.isError(i)&&o&&w(i,r)||s)&&y(i,r,"Got unwanted exception"+n),t&&i&&r&&!w(i,r)||!t&&i)throw i}d.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return p(m(t.actual),128)+" "+t.operator+" "+p(m(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||y;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=g(e),o=n.indexOf("\n"+i);if(o>=0){var a=n.indexOf("\n",o+1);n=n.substring(a+1)}this.stack=n}}},a.inherits(d.AssertionError,Error),d.fail=y,d.ok=b,d.equal=function(t,e,r){t!=e&&y(t,e,r,"==",d.equal)},d.notEqual=function(t,e,r){t==e&&y(t,e,r,"!=",d.notEqual)},d.deepEqual=function(t,e,r){_(t,e,!1)||y(t,e,r,"deepEqual",d.deepEqual)},d.deepStrictEqual=function(t,e,r){_(t,e,!0)||y(t,e,r,"deepStrictEqual",d.deepStrictEqual)},d.notDeepEqual=function(t,e,r){_(t,e,!1)&&y(t,e,r,"notDeepEqual",d.notDeepEqual)},d.notDeepStrictEqual=function t(e,r,n){_(e,r,!0)&&y(e,r,n,"notDeepStrictEqual",t)},d.strictEqual=function(t,e,r){t!==e&&y(t,e,r,"===",d.strictEqual)},d.notStrictEqual=function(t,e,r){t===e&&y(t,e,r,"!==",d.notStrictEqual)},d.throws=function(t,e,r){E(!0,t,e,r)},d.doesNotThrow=function(t,e,r){E(!1,t,e,r)},d.ifError=function(t){if(t)throw t},d.strict=n((function t(e,r){e||y(e,!0,r,"==",t)}),d,{equal:d.strictEqual,deepEqual:d.deepStrictEqual,notEqual:d.notStrictEqual,notDeepEqual:d.notDeepStrictEqual}),d.strict.strict=d.strict;var S=Object.keys||function(t){var e=[];for(var r in t)s.call(t,r)&&e.push(r);return e}}).call(this,r(33))},function(t,e,r){(e=t.exports=r(154)).Stream=e,e.Readable=e,e.Writable=r(115),e.Duplex=r(64),e.Transform=r(157),e.PassThrough=r(269)},function(t,e,r){var n=r(16),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function a(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=a),o(i,a),a.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},a.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},function(t,e,r){"use strict";(function(e,n,i){var o=r(100);function a(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=b;var s,u=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?n:o.nextTick;b.WritableState=y;var c=Object.create(r(83));c.inherits=r(12);var l={deprecate:r(116)},f=r(155),d=r(114).Buffer,h=i.Uint8Array||function(){};var g,p=r(156);function m(){}function y(t,e){s=s||r(64),t=t||{};var n=e instanceof s;this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,c=t.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(c||0===c)?c:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===t.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(o.nextTick(i,n),o.nextTick(O,t,e),t._writableState.errorEmitted=!0,t.emit("error",n)):(i(n),t._writableState.errorEmitted=!0,t.emit("error",n),O(t,e))}(t,r,n,e,i);else{var a=E(r);a||r.corked||r.bufferProcessing||!r.bufferedRequest||w(t,r),n?u(v,t,r,a,i):v(t,r,a,i)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function b(t){if(s=s||r(64),!(g.call(b,this)||this instanceof s))return new b(t);this._writableState=new y(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),f.call(this)}function _(t,e,r,n,i,o,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function v(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),O(t,e)}function w(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),o=e.corkedRequestsFree;o.entry=r;for(var s=0,u=!0;r;)i[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;i.allBuffers=u,_(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new a(e),e.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,l=r.encoding,f=r.callback;if(_(t,e,!1,e.objectMode?1:c.length,c,l,f),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function E(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function S(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),O(t,e)}))}function O(t,e){var r=E(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(S,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}c.inherits(b,f),y.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(y.prototype,"buffer",{get:l.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(g=Function.prototype[Symbol.hasInstance],Object.defineProperty(b,Symbol.hasInstance,{value:function(t){return!!g.call(this,t)||this===b&&(t&&t._writableState instanceof y)}})):g=function(t){return t instanceof this},b.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},b.prototype.write=function(t,e,r){var n,i=this._writableState,a=!1,s=!i.objectMode&&(n=t,d.isBuffer(n)||n instanceof h);return s&&!d.isBuffer(t)&&(t=function(t){return d.from(t)}(t)),"function"==typeof e&&(r=e,e=null),s?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof r&&(r=m),i.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),o.nextTick(e,r)}(this,r):(s||function(t,e,r,n){var i=!0,a=!1;return null===r?a=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(t.emit("error",a),o.nextTick(n,a),i=!1),i}(this,i,t,r))&&(i.pendingcb++,a=function(t,e,r,n,i,o){if(!r){var a=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=d.from(e,r));return e}(e,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=e.objectMode?1:n.length;e.length+=s;var u=e.length<e.highWaterMark;u||(e.needDrain=!0);if(e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else _(t,e,!1,s,n,i,o);return u}(this,i,s,t,e,r)),a},b.prototype.cork=function(){this._writableState.corked++},b.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||w(this,t))},b.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(b.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),b.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},b.prototype._writev=null,b.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(t,e,r){e.ending=!0,O(t,e),r&&(e.finished?o.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r)},Object.defineProperty(b.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),b.prototype.destroy=p.destroy,b.prototype._undestroy=p.undestroy,b.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,r(25),r(99).setImmediate,r(33))},function(t,e,r){(function(e){function r(t){try{if(!e.localStorage)return!1}catch(t){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}}).call(this,r(33))},function(t,e,r){"use strict";var n=r(12),i=r(165),o=r(19).Buffer,a=new Array(16);function s(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(t,e){return t<<e|t>>>32-e}function c(t,e,r,n,i,o,a){return u(t+(e&r|~e&n)+i+o|0,a)+e|0}function l(t,e,r,n,i,o,a){return u(t+(e&n|r&~n)+i+o|0,a)+e|0}function f(t,e,r,n,i,o,a){return u(t+(e^r^n)+i+o|0,a)+e|0}function d(t,e,r,n,i,o,a){return u(t+(r^(e|~n))+i+o|0,a)+e|0}n(s,i),s.prototype._update=function(){for(var t=a,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,o=this._d;r=c(r,n,i,o,t[0],3614090360,7),o=c(o,r,n,i,t[1],3905402710,12),i=c(i,o,r,n,t[2],606105819,17),n=c(n,i,o,r,t[3],3250441966,22),r=c(r,n,i,o,t[4],4118548399,7),o=c(o,r,n,i,t[5],1200080426,12),i=c(i,o,r,n,t[6],2821735955,17),n=c(n,i,o,r,t[7],4249261313,22),r=c(r,n,i,o,t[8],1770035416,7),o=c(o,r,n,i,t[9],2336552879,12),i=c(i,o,r,n,t[10],4294925233,17),n=c(n,i,o,r,t[11],2304563134,22),r=c(r,n,i,o,t[12],1804603682,7),o=c(o,r,n,i,t[13],4254626195,12),i=c(i,o,r,n,t[14],2792965006,17),r=l(r,n=c(n,i,o,r,t[15],1236535329,22),i,o,t[1],4129170786,5),o=l(o,r,n,i,t[6],3225465664,9),i=l(i,o,r,n,t[11],643717713,14),n=l(n,i,o,r,t[0],3921069994,20),r=l(r,n,i,o,t[5],3593408605,5),o=l(o,r,n,i,t[10],38016083,9),i=l(i,o,r,n,t[15],3634488961,14),n=l(n,i,o,r,t[4],3889429448,20),r=l(r,n,i,o,t[9],568446438,5),o=l(o,r,n,i,t[14],3275163606,9),i=l(i,o,r,n,t[3],4107603335,14),n=l(n,i,o,r,t[8],1163531501,20),r=l(r,n,i,o,t[13],2850285829,5),o=l(o,r,n,i,t[2],4243563512,9),i=l(i,o,r,n,t[7],1735328473,14),r=f(r,n=l(n,i,o,r,t[12],2368359562,20),i,o,t[5],4294588738,4),o=f(o,r,n,i,t[8],2272392833,11),i=f(i,o,r,n,t[11],1839030562,16),n=f(n,i,o,r,t[14],4259657740,23),r=f(r,n,i,o,t[1],2763975236,4),o=f(o,r,n,i,t[4],1272893353,11),i=f(i,o,r,n,t[7],4139469664,16),n=f(n,i,o,r,t[10],3200236656,23),r=f(r,n,i,o,t[13],681279174,4),o=f(o,r,n,i,t[0],3936430074,11),i=f(i,o,r,n,t[3],3572445317,16),n=f(n,i,o,r,t[6],76029189,23),r=f(r,n,i,o,t[9],3654602809,4),o=f(o,r,n,i,t[12],3873151461,11),i=f(i,o,r,n,t[15],530742520,16),r=d(r,n=f(n,i,o,r,t[2],3299628645,23),i,o,t[0],4096336452,6),o=d(o,r,n,i,t[7],1126891415,10),i=d(i,o,r,n,t[14],2878612391,15),n=d(n,i,o,r,t[5],4237533241,21),r=d(r,n,i,o,t[12],1700485571,6),o=d(o,r,n,i,t[3],2399980690,10),i=d(i,o,r,n,t[10],4293915773,15),n=d(n,i,o,r,t[1],2240044497,21),r=d(r,n,i,o,t[8],1873313359,6),o=d(o,r,n,i,t[15],4264355552,10),i=d(i,o,r,n,t[6],2734768916,15),n=d(n,i,o,r,t[13],1309151649,21),r=d(r,n,i,o,t[4],4149444226,6),o=d(o,r,n,i,t[11],3174756917,10),i=d(i,o,r,n,t[2],718787259,15),n=d(n,i,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},s.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=s},function(t,e,r){"use strict";var n=r(70).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,r,o){if("function"==typeof r)return t(e,null,r);r||(r={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}(o||i);var a=r.readable||!1!==r.readable&&e.readable,s=r.writable||!1!==r.writable&&e.writable,u=function(){e.writable||l()},c=e._writableState&&e._writableState.finished,l=function(){s=!1,c=!0,a||o.call(e)},f=e._readableState&&e._readableState.endEmitted,d=function(){a=!1,f=!0,s||o.call(e)},h=function(t){o.call(e,t)},g=function(){var t;return a&&!f?(e._readableState&&e._readableState.ended||(t=new n),o.call(e,t)):s&&!c?(e._writableState&&e._writableState.ended||(t=new n),o.call(e,t)):void 0},p=function(){e.req.on("finish",l)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(e)?s&&!e._writableState&&(e.on("end",u),e.on("close",u)):(e.on("complete",l),e.on("abort",g),e.req?p():e.on("request",p)),e.on("end",d),e.on("finish",l),!1!==r.error&&e.on("error",h),e.on("close",g),function(){e.removeListener("complete",l),e.removeListener("abort",g),e.removeListener("request",p),e.req&&e.req.removeListener("finish",l),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",l),e.removeListener("end",d),e.removeListener("error",h),e.removeListener("close",g)}}},function(t,e,r){"use strict";var n=r(16).Buffer,i=r(12),o=r(165),a=new Array(16),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],u=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],c=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],l=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],f=[0,1518500249,1859775393,2400959708,2840853838],d=[1352829926,1548603684,1836072691,2053994217,0];function h(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function g(t,e){return t<<e|t>>>32-e}function p(t,e,r,n,i,o,a,s){return g(t+(e^r^n)+o+a|0,s)+i|0}function m(t,e,r,n,i,o,a,s){return g(t+(e&r|~e&n)+o+a|0,s)+i|0}function y(t,e,r,n,i,o,a,s){return g(t+((e|~r)^n)+o+a|0,s)+i|0}function b(t,e,r,n,i,o,a,s){return g(t+(e&n|r&~n)+o+a|0,s)+i|0}function _(t,e,r,n,i,o,a,s){return g(t+(e^(r|~n))+o+a|0,s)+i|0}i(h,o),h.prototype._update=function(){for(var t=a,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,h=0|this._e,v=0|this._a,w=0|this._b,E=0|this._c,S=0|this._d,O=0|this._e,T=0;T<80;T+=1){var A,M;T<16?(A=p(r,n,i,o,h,t[s[T]],f[0],c[T]),M=_(v,w,E,S,O,t[u[T]],d[0],l[T])):T<32?(A=m(r,n,i,o,h,t[s[T]],f[1],c[T]),M=b(v,w,E,S,O,t[u[T]],d[1],l[T])):T<48?(A=y(r,n,i,o,h,t[s[T]],f[2],c[T]),M=y(v,w,E,S,O,t[u[T]],d[2],l[T])):T<64?(A=b(r,n,i,o,h,t[s[T]],f[3],c[T]),M=m(v,w,E,S,O,t[u[T]],d[3],l[T])):(A=_(r,n,i,o,h,t[s[T]],f[4],c[T]),M=p(v,w,E,S,O,t[u[T]],d[4],l[T])),r=h,h=o,o=g(i,10),i=n,n=A,v=O,O=S,S=g(E,10),E=w,w=M}var I=this._b+i+S|0;this._b=this._c+o+O|0,this._c=this._d+h+v|0,this._d=this._e+r+w|0,this._e=this._a+n+E|0,this._a=I},h.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=n.alloc?n.alloc(20):new n(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=h},function(t,e,r){(e=t.exports=function(t){t=t.toLowerCase();var r=e[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r}).sha=r(308),e.sha1=r(309),e.sha224=r(310),e.sha256=r(172),e.sha384=r(311),e.sha512=r(173)},function(t,e,r){"use strict";var n=r(46);function i(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0}t.exports=i,i.prototype._init=function(){},i.prototype.update=function(t){return 0===t.length?[]:"decrypt"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},i.prototype._buffer=function(t,e){for(var r=Math.min(this.buffer.length-this.bufferOff,t.length-e),n=0;n<r;n++)this.buffer[this.bufferOff+n]=t[e+n];return this.bufferOff+=r,r},i.prototype._flushBuffer=function(t,e){return this._update(this.buffer,0,t,e),this.bufferOff=0,this.blockSize},i.prototype._updateEncrypt=function(t){var e=0,r=0,n=(this.bufferOff+t.length)/this.blockSize|0,i=new Array(n*this.blockSize);0!==this.bufferOff&&(e+=this._buffer(t,e),this.bufferOff===this.buffer.length&&(r+=this._flushBuffer(i,r)));for(var o=t.length-(t.length-e)%this.blockSize;e<o;e+=this.blockSize)this._update(t,e,i,r),r+=this.blockSize;for(;e<t.length;e++,this.bufferOff++)this.buffer[this.bufferOff]=t[e];return i},i.prototype._updateDecrypt=function(t){for(var e=0,r=0,n=Math.ceil((this.bufferOff+t.length)/this.blockSize)-1,i=new Array(n*this.blockSize);n>0;n--)e+=this._buffer(t,e),r+=this._flushBuffer(i,r);return e+=this._buffer(t,e),i},i.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},i.prototype._pad=function(t,e){if(0===e)return!1;for(;e<t.length;)t[e++]=0;return!0},i.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var t=new Array(this.blockSize);return this._update(this.buffer,0,t,0),t},i.prototype._unpad=function(t){return t},i.prototype._finalDecrypt=function(){n.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var t=new Array(this.blockSize);return this._flushBuffer(t,0),this._unpad(t)}},function(t,e,r){var n=r(320),i=r(328),o=r(186);e.createCipher=e.Cipher=n.createCipher,e.createCipheriv=e.Cipheriv=n.createCipheriv,e.createDecipher=e.Decipher=i.createDecipher,e.createDecipheriv=e.Decipheriv=i.createDecipheriv,e.listCiphers=e.getCiphers=function(){return Object.keys(o)}},function(t,e,r){var n={ECB:r(321),CBC:r(322),CFB:r(323),CFB8:r(324),CFB1:r(325),OFB:r(326),CTR:r(184),GCM:r(184)},i=r(186);for(var o in i)i[o].module=n[i[o].mode];t.exports=i},function(t,e,r){var n;function i(t){this.rand=t}if(t.exports=function(t){return n||(n=new i(null)),n.generate(t)},t.exports.Rand=i,i.prototype.generate=function(t){return this._rand(t)},i.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r<e.length;r++)e[r]=this.rand.getByte();return e},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"==typeof window&&(i.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var o=r(332);if("function"!=typeof o.randomBytes)throw new Error("Not supported");i.prototype._rand=function(t){return o.randomBytes(t)}}catch(t){}},function(t,e,r){"use strict";var n=r(73).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,r,o){if("function"==typeof r)return t(e,null,r);r||(r={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}(o||i);var a=r.readable||!1!==r.readable&&e.readable,s=r.writable||!1!==r.writable&&e.writable,u=function(){e.writable||l()},c=e._writableState&&e._writableState.finished,l=function(){s=!1,c=!0,a||o.call(e)},f=e._readableState&&e._readableState.endEmitted,d=function(){a=!1,f=!0,s||o.call(e)},h=function(t){o.call(e,t)},g=function(){var t;return a&&!f?(e._readableState&&e._readableState.ended||(t=new n),o.call(e,t)):s&&!c?(e._writableState&&e._writableState.ended||(t=new n),o.call(e,t)):void 0},p=function(){e.req.on("finish",l)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(e)?s&&!e._writableState&&(e.on("end",u),e.on("close",u)):(e.on("complete",l),e.on("abort",g),e.req?p():e.on("request",p)),e.on("end",d),e.on("finish",l),!1!==r.error&&e.on("error",h),e.on("close",g),function(){e.removeListener("complete",l),e.removeListener("abort",g),e.removeListener("request",p),e.req&&e.req.removeListener("finish",l),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",l),e.removeListener("end",d),e.removeListener("error",h),e.removeListener("close",g)}}},function(t,e,r){(function(e){var n=r(345),i=r(69);function o(t){var e,r=t.modulus.byteLength();do{e=new n(i(r))}while(e.cmp(t.modulus)>=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function a(t,r){var i=function(t){var e=o(t);return{blinder:e.toRed(n.mont(t.modulus)).redPow(new n(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(r),a=r.modulus.byteLength(),s=new n(t).mul(i.blinder).umod(r.modulus),u=s.toRed(n.mont(r.prime1)),c=s.toRed(n.mont(r.prime2)),l=r.coefficient,f=r.prime1,d=r.prime2,h=u.redPow(r.exponent1).fromRed(),g=c.redPow(r.exponent2).fromRed(),p=h.isub(g).imul(l).umod(f).imul(d);return g.iadd(p).imul(i.unblinder).umod(r.modulus).toArrayLike(e,"be",a)}a.getr=o,t.exports=a}).call(this,r(16).Buffer)},function(t,e,r){"use strict";var n=e;n.version=r(347).version,n.utils=r(47),n.rand=r(124),n.curve=r(198),n.curves=r(128),n.ec=r(358),n.eddsa=r(362)},function(t,e,r){"use strict";var n,i=e,o=r(129),a=r(198),s=r(47).assert;function u(t){"short"===t.type?this.curve=new a.short(t):"edwards"===t.type?this.curve=new a.edwards(t):this.curve=new a.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new u(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=u,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=r(357)}catch(t){n=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},function(t,e,r){var n=e;n.utils=r(49),n.common=r(87),n.sha=r(351),n.ripemd=r(355),n.hmac=r(356),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},function(t,e,r){"use strict";(function(e){var n,i=r(16),o=i.Buffer,a={};for(n in i)i.hasOwnProperty(n)&&"SlowBuffer"!==n&&"Buffer"!==n&&(a[n]=i[n]);var s=a.Buffer={};for(n in o)o.hasOwnProperty(n)&&"allocUnsafe"!==n&&"allocUnsafeSlow"!==n&&(s[n]=o[n]);if(a.Buffer.prototype=o.prototype,s.from&&s.from!==Uint8Array.from||(s.from=function(t,e,r){if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof t);if(t&&void 0===t.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);return o(t,e,r)}),s.alloc||(s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError('The "size" argument must be of type number. Received type '+typeof t);if(t<0||t>=2*(1<<30))throw new RangeError('The value "'+t+'" is invalid for option "size"');var n=o(t);return e&&0!==e.length?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n}),!a.kStringMaxLength)try{a.kStringMaxLength=e.binding("buffer").kStringMaxLength}catch(t){}a.constants||(a.constants={MAX_LENGTH:a.kMaxLength},a.kStringMaxLength&&(a.constants.MAX_STRING_LENGTH=a.kStringMaxLength)),t.exports=a}).call(this,r(25))},function(t,e,r){"use strict";const n=r(132).Reporter,i=r(88).EncoderBuffer,o=r(88).DecoderBuffer,a=r(46),s=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s);function c(t,e,r){const n={};this._baseState=n,n.name=r,n.enc=t,n.parent=e||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}t.exports=c;const l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];c.prototype.clone=function(){const t=this._baseState,e={};l.forEach((function(r){e[r]=t[r]}));const r=new this.constructor(e.parent);return r._baseState=e,r},c.prototype._wrap=function(){const t=this._baseState;u.forEach((function(e){this[e]=function(){const r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}}),this)},c.prototype._init=function(t){const e=this._baseState;a(null===e.parent),t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this),a.equal(e.children.length,1,"Root node can have only one child")},c.prototype._useArgs=function(t){const e=this._baseState,r=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==r.length&&(a(null===e.children),e.children=r,r.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(a(null===e.args),e.args=t,e.reverseArgs=t.map((function(t){if("object"!=typeof t||t.constructor!==Object)return t;const e={};return Object.keys(t).forEach((function(r){r==(0|r)&&(r|=0);const n=t[r];e[n]=r})),e})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(t){c.prototype[t]=function(){const e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),s.forEach((function(t){c.prototype[t]=function(){const e=this._baseState,r=Array.prototype.slice.call(arguments);return a(null===e.tag),e.tag=t,this._useArgs(r),this}})),c.prototype.use=function(t){a(t);const e=this._baseState;return a(null===e.use),e.use=t,this},c.prototype.optional=function(){return this._baseState.optional=!0,this},c.prototype.def=function(t){const e=this._baseState;return a(null===e.default),e.default=t,e.optional=!0,this},c.prototype.explicit=function(t){const e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.explicit=t,this},c.prototype.implicit=function(t){const e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.implicit=t,this},c.prototype.obj=function(){const t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},c.prototype.key=function(t){const e=this._baseState;return a(null===e.key),e.key=t,this},c.prototype.any=function(){return this._baseState.any=!0,this},c.prototype.choice=function(t){const e=this._baseState;return a(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},c.prototype.contains=function(t){const e=this._baseState;return a(null===e.use),e.contains=t,this},c.prototype._decode=function(t,e){const r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,e));let n,i=r.default,a=!0,s=null;if(null!==r.key&&(s=t.enterKey(r.key)),r.optional){let n=null;if(null!==r.explicit?n=r.explicit:null!==r.implicit?n=r.implicit:null!==r.tag&&(n=r.tag),null!==n||r.any){if(a=this._peekTag(t,n,r.any),t.isError(a))return a}else{const n=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),a=!0}catch(t){a=!1}t.restore(n)}}if(r.obj&&a&&(n=t.enterObject()),a){if(null!==r.explicit){const e=this._decodeTag(t,r.explicit);if(t.isError(e))return e;t=e}const n=t.offset;if(null===r.use&&null===r.choice){let e;r.any&&(e=t.save());const n=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(n))return n;r.any?i=t.raw(e):t=n}if(e&&e.track&&null!==r.tag&&e.track(t.path(),n,t.length,"tagged"),e&&e.track&&null!==r.tag&&e.track(t.path(),t.offset,t.length,"content"),r.any||(i=null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e)),t.isError(i))return i;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(t,e)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){const n=new o(i);i=this._getUse(r.contains,t._reporterState.obj)._decode(n,e)}}return r.obj&&a&&(i=t.leaveObject(n)),null===r.key||null===i&&!0!==a?null!==s&&t.exitKey(s):t.leaveKey(s,r.key,i),i},c.prototype._decodeGeneric=function(t,e,r){const n=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,n.args[0],r):/str$/.test(t)?this._decodeStr(e,t,r):"objid"===t&&n.args?this._decodeObjid(e,n.args[0],n.args[1],r):"objid"===t?this._decodeObjid(e,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(e,t,r):"null_"===t?this._decodeNull(e,r):"bool"===t?this._decodeBool(e,r):"objDesc"===t?this._decodeStr(e,t,r):"int"===t||"enum"===t?this._decodeInt(e,n.args&&n.args[0],r):null!==n.use?this._getUse(n.use,e._reporterState.obj)._decode(e,r):e.error("unknown tag: "+t)},c.prototype._getUse=function(t,e){const r=this._baseState;return r.useDecoder=this._use(t,e),a(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},c.prototype._decodeChoice=function(t,e){const r=this._baseState;let n=null,i=!1;return Object.keys(r.choice).some((function(o){const a=t.save(),s=r.choice[o];try{const r=s._decode(t,e);if(t.isError(r))return!1;n={type:o,value:r},i=!0}catch(e){return t.restore(a),!1}return!0}),this),i?n:t.error("Choice not matched")},c.prototype._createEncoderBuffer=function(t){return new i(t,this.reporter)},c.prototype._encode=function(t,e,r){const n=this._baseState;if(null!==n.default&&n.default===t)return;const i=this._encodeValue(t,e,r);return void 0===i||this._skipDefault(i,e,r)?void 0:i},c.prototype._encodeValue=function(t,e,r){const i=this._baseState;if(null===i.parent)return i.children[0]._encode(t,e||new n);let o=null;if(this.reporter=e,i.optional&&void 0===t){if(null===i.default)return;t=i.default}let a=null,s=!1;if(i.any)o=this._createEncoderBuffer(t);else if(i.choice)o=this._encodeChoice(t,e);else if(i.contains)a=this._getUse(i.contains,r)._encode(t,e),s=!0;else if(i.children)a=i.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,e,t);if(null===r._baseState.key)return e.error("Child should have a key");const n=e.enterKey(r._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");const i=r._encode(t[r._baseState.key],e,t);return e.leaveKey(n),i}),this).filter((function(t){return t})),a=this._createEncoderBuffer(a);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return e.error("Too many args for : "+i.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");const r=this.clone();r._baseState.implicit=null,a=this._createEncoderBuffer(t.map((function(r){const n=this._baseState;return this._getUse(n.args[0],t)._encode(r,e)}),r))}else null!==i.use?o=this._getUse(i.use,r)._encode(t,e):(a=this._encodePrimitive(i.tag,t),s=!0);if(!i.any&&null===i.choice){const t=null!==i.implicit?i.implicit:i.tag,r=null===i.implicit?"universal":"context";null===t?null===i.use&&e.error("Tag could be omitted only for .use()"):null===i.use&&(o=this._encodeComposite(t,s,r,a))}return null!==i.explicit&&(o=this._encodeComposite(i.explicit,!1,"context",o)),o},c.prototype._encodeChoice=function(t,e){const r=this._baseState,n=r.choice[t.type];return n||a(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(t.value,e)},c.prototype._encodePrimitive=function(t,e){const r=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&r.args)return this._encodeObjid(e,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},c.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},c.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},function(t,e,r){"use strict";const n=r(12);function i(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function o(t,e){this.path=t,this.rethrow(e)}e.Reporter=i,i.prototype.isError=function(t){return t instanceof o},i.prototype.save=function(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},i.prototype.restore=function(t){const e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},i.prototype.enterKey=function(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function(t){const e=this._reporterState;e.path=e.path.slice(0,t-1)},i.prototype.leaveKey=function(t,e,r){const n=this._reporterState;this.exitKey(t),null!==n.obj&&(n.obj[e]=r)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){const t=this._reporterState,e=t.obj;return t.obj={},e},i.prototype.leaveObject=function(t){const e=this._reporterState,r=e.obj;return e.obj=t,r},i.prototype.error=function(t){let e;const r=this._reporterState,n=t instanceof o;if(e=n?t:new o(r.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!r.options.partial)throw e;return n||r.errors.push(e),e},i.prototype.wrapResult=function(t){const e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},n(o,Error),o.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},function(t,e,r){"use strict";function n(t){const e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);const n=t[r];e[n]=r})),e}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=n(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=n(e.tag)},function(t,e,r){var n=r(135).isArray;t.exports={copyOptions:function(t){var e,r={};for(e in t)t.hasOwnProperty(e)&&(r[e]=t[e]);return r},ensureFlagExists:function(t,e){t in e&&"boolean"==typeof e[t]||(e[t]=!1)},ensureSpacesExists:function(t){(!("spaces"in t)||"number"!=typeof t.spaces&&"string"!=typeof t.spaces)&&(t.spaces=0)},ensureAlwaysArrayExists:function(t){"alwaysArray"in t&&("boolean"==typeof t.alwaysArray||n(t.alwaysArray))||(t.alwaysArray=!1)},ensureKeyExists:function(t,e){t+"Key"in e&&"string"==typeof e[t+"Key"]||(e[t+"Key"]=e.compact?"_"+t:t)},checkFnExists:function(t,e){return t+"Fn"in e}}},function(t,e){t.exports={isArray:function(t){return Array.isArray?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)}}},function(t,e,r){"use strict";var n=Array.prototype.slice,i=r(216),o=Object.keys,a=o?function(t){return o(t)}:r(396),s=Object.keys;a.shim=function(){Object.keys?function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2)||(Object.keys=function(t){return i(t)?s(n.call(t)):s(t)}):Object.keys=a;return Object.keys||a},t.exports=a},function(t,e,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=r(106);t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},function(t,e,r){"use strict";var n=r(397);t.exports=Function.prototype.bind||n},function(t,e,r){"use strict";const n=r(384),i=Symbol("max"),o=Symbol("length"),a=Symbol("lengthCalculator"),s=Symbol("allowStale"),u=Symbol("maxAge"),c=Symbol("dispose"),l=Symbol("noDisposeOnSet"),f=Symbol("lruList"),d=Symbol("cache"),h=Symbol("updateAgeOnGet"),g=()=>1;const p=(t,e,r)=>{const n=t[d].get(e);if(n){const e=n.value;if(m(t,e)){if(b(t,n),!t[s])return}else r&&(t[h]&&(n.value.now=Date.now()),t[f].unshiftNode(n));return e.value}},m=(t,e)=>{if(!e||!e.maxAge&&!t[u])return!1;const r=Date.now()-e.now;return e.maxAge?r>e.maxAge:t[u]&&r>t[u]},y=t=>{if(t[o]>t[i])for(let e=t[f].tail;t[o]>t[i]&&null!==e;){const r=e.prev;b(t,e),e=r}},b=(t,e)=>{if(e){const r=e.value;t[c]&&t[c](r.key,r.value),t[o]-=r.length,t[d].delete(r.key),t[f].removeNode(e)}};class _{constructor(t,e,r,n,i){this.key=t,this.value=e,this.length=r,this.now=n,this.maxAge=i||0}}const v=(t,e,r,n)=>{let i=r.value;m(t,i)&&(b(t,r),t[s]||(i=void 0)),i&&e.call(n,i.value,i.key,t)};t.exports=class{constructor(t){if("number"==typeof t&&(t={max:t}),t||(t={}),t.max&&("number"!=typeof t.max||t.max<0))throw new TypeError("max must be a non-negative number");this[i]=t.max||1/0;const e=t.length||g;if(this[a]="function"!=typeof e?g:e,this[s]=t.stale||!1,t.maxAge&&"number"!=typeof t.maxAge)throw new TypeError("maxAge must be a number");this[u]=t.maxAge||0,this[c]=t.dispose,this[l]=t.noDisposeOnSet||!1,this[h]=t.updateAgeOnGet||!1,this.reset()}set max(t){if("number"!=typeof t||t<0)throw new TypeError("max must be a non-negative number");this[i]=t||1/0,y(this)}get max(){return this[i]}set allowStale(t){this[s]=!!t}get allowStale(){return this[s]}set maxAge(t){if("number"!=typeof t)throw new TypeError("maxAge must be a non-negative number");this[u]=t,y(this)}get maxAge(){return this[u]}set lengthCalculator(t){"function"!=typeof t&&(t=g),t!==this[a]&&(this[a]=t,this[o]=0,this[f].forEach(t=>{t.length=this[a](t.value,t.key),this[o]+=t.length})),y(this)}get lengthCalculator(){return this[a]}get length(){return this[o]}get itemCount(){return this[f].length}rforEach(t,e){e=e||this;for(let r=this[f].tail;null!==r;){const n=r.prev;v(this,t,r,e),r=n}}forEach(t,e){e=e||this;for(let r=this[f].head;null!==r;){const n=r.next;v(this,t,r,e),r=n}}keys(){return this[f].toArray().map(t=>t.key)}values(){return this[f].toArray().map(t=>t.value)}reset(){this[c]&&this[f]&&this[f].length&&this[f].forEach(t=>this[c](t.key,t.value)),this[d]=new Map,this[f]=new n,this[o]=0}dump(){return this[f].map(t=>!m(this,t)&&{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}).toArray().filter(t=>t)}dumpLru(){return this[f]}set(t,e,r){if((r=r||this[u])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const n=r?Date.now():0,s=this[a](e,t);if(this[d].has(t)){if(s>this[i])return b(this,this[d].get(t)),!1;const a=this[d].get(t).value;return this[c]&&(this[l]||this[c](t,a.value)),a.now=n,a.maxAge=r,a.value=e,this[o]+=s-a.length,a.length=s,this.get(t),y(this),!0}const h=new _(t,e,s,n,r);return h.length>this[i]?(this[c]&&this[c](t,e),!1):(this[o]+=h.length,this[f].unshift(h),this[d].set(t,this[f].head),y(this),!0)}has(t){if(!this[d].has(t))return!1;const e=this[d].get(t).value;return!m(this,e)}get(t){return p(this,t,!0)}peek(t){return p(this,t,!1)}pop(){const t=this[f].tail;return t?(b(this,t),t.value):null}del(t){b(this,this[d].get(t))}load(t){this.reset();const e=Date.now();for(let r=t.length-1;r>=0;r--){const n=t[r],i=n.e||0;if(0===i)this.set(n.k,n.v);else{const t=i-e;t>0&&this.set(n.k,n.v,t)}}}prune(){this[d].forEach((t,e)=>p(this,e,!1))}}},function(t,e,r){"use strict";(function(t){r.d(e,"b",(function(){return u})),r.d(e,"a",(function(){return c}));var n=r(35),i=r(11),o=r(6),a=r(45);function s(e){return t.isBuffer(e)?e:t.from(e)}async function u(e,r,s,u){let{encryptKeyId:c}=o.b(),l=new a.SyncRequest;for(let e=0;e<u.length;e++){let r=u[e],o=new a.MessageEnvelope;o.setTimestamp(r.timestamp);let s=new a.Message;s.setDataset(r.dataset),s.setRow(r.row),s.setColumn(r.column),s.setValue(r.value);let f=s.serializeBinary();if(c){let e,r=new a.EncryptedData;try{e=await n.c(f,c)}catch(t){throw new i.g("encrypt-failure",{isMissingKey:"missing-key"===t.message})}r.setData(e.value),r.setIv(t.from(e.meta.iv,"base64")),r.setAuthtag(t.from(e.meta.authTag,"base64")),o.setContent(r.serializeBinary()),o.setIsencrypted(!0)}else o.setContent(f);l.addMessages(o)}return l.setGroupid(e),l.setFileid(r),l.setKeyid(c),l.setSince(s),l.serializeBinary()}async function c(t){let{encryptKeyId:e}=o.b(),r=a.SyncResponse.deserializeBinary(t),u=JSON.parse(r.getMerkle()),c=r.getMessagesList(),l=[];for(let t=0;t<c.length;t++){let r,o=c[t],u=o.getTimestamp();if(o.getIsencrypted()){let t,u=a.EncryptedData.deserializeBinary(o.getContent());try{t=await n.b(s(u.getData()),{keyId:e,algorithm:"aes-256-gcm",iv:s(u.getIv()),authTag:s(u.getAuthtag())})}catch(t){throw console.log(t),new i.g("decrypt-failure",{isMissingKey:"missing-key"===t.message})}r=a.Message.deserializeBinary(t)}else r=a.Message.deserializeBinary(o.getContent());l.push({timestamp:u,dataset:r.getDataset(),row:r.getRow(),column:r.getColumn(),value:r.getValue()})}return{messages:l,merkle:u}}}).call(this,r(16).Buffer)},function(t,e,r){"use strict";r.d(e,"b",(function(){return s})),r.d(e,"a",(function(){return u}));var n=r(142),i=r.n(n),o=r(5),a=r(14);async function s(t,e,r,n){const a=e.reduce((t,e)=>{let{id:r,name:n}=e;return t[r]=n,t},{}),s=r.reduce((t,e)=>{let{name:r,categories:n}=e;return n.forEach(e=>t[e.id]=`${r}: ${e.name}`),t},{}),u=n.reduce((t,e)=>{let{id:r,name:n}=e;return t[r]=n,t},{}),c=t.map(t=>{let{account:e,date:r,payee:n,notes:i,category:c,amount:l}=t;return{Account:a[e],Date:r,Payee:u[n],Notes:i,Category:s[c],Amount:null==l?0:Object(o.k)(l)}});return i()(c,{header:!0})}async function u(t){let{data:e}=await Object(a.g)(t.select([{Id:"id"},{Account:"account.name"},{Date:"date"},{Payee:"payee.name"},{ParentId:"parent_id"},{IsParent:"is_parent"},{Notes:"notes"},{Category:"category.name"},{Amount:"amount"}]).options({splits:"all"})),r=new Map;for(let t of e)t.IsParent&&r.set(t.Id,t.Payee);let n=e.filter(t=>!t.IsParent).map(t=>({Account:t.Account,Date:t.Date,Payee:t.ParentId?r.get(t.ParentId):t.Payee,Notes:t.Notes,Category:t.Category,Amount:null==t.Amount?0:Object(o.k)(t.Amount)}));return i()(n,{header:!0})}},function(t,e,r){(function(e){const n=r(387),{StringDecoder:i}=r(55);t.exports=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=[];if(e.isBuffer(t)){t=(new i).write(t)}function a(t){t&&o.push(t.toString())}let s=new n.Stringifier(r);s.on("data",a);for(let e of t)s.write(e);return s.end(),s.off("data",a),o.join("")}}).call(this,r(16).Buffer)},function(t,e,r){"use strict";var n=r(136),i=r(217),o=r(399),a=r(402),s=r(403),u=r(406),c=r(407),l=r(408),f=r(59),d=r(50),h=r(414),g=r(417),p=r(419),m=r(422),y=r(425),b=d("Date.prototype.getTime"),_=Object.getPrototypeOf,v=d("Object.prototype.toString"),w=f("%Set%",!0),E=d("Map.prototype.has",!0),S=d("Map.prototype.get",!0),O=d("Map.prototype.size",!0),T=d("Set.prototype.add",!0),A=d("Set.prototype.delete",!0),M=d("Set.prototype.has",!0),I=d("Set.prototype.size",!0);function R(t,e,r,n){for(var i,o=g(t);(i=o.next())&&!i.done;)if(C(e,i.value,r,n))return A(t,i.value),!0;return!1}function N(t){return void 0===t?null:"object"!=typeof t?"symbol"!=typeof t&&("string"!=typeof t&&"number"!=typeof t||+t==+t):void 0}function k(t,e,r,n,i,o){var a=N(r);if(null!=a)return a;var s=S(e,a),u=y({},i,{strict:!1});return!(void 0===s&&!E(e,a)||!C(n,s,u,o))&&(!E(t,a)&&C(n,s,u,o))}function D(t,e,r){var n=N(r);return null!=n?n:M(e,n)&&!M(t,n)}function j(t,e,r,n,i,o){for(var a,s,u=g(t);(a=u.next())&&!a.done;)if(C(r,s=a.value,i,o)&&C(n,S(e,s),i,o))return A(t,s),!0;return!1}function C(t,e,r,f){var d=r||{};if(d.strict?o(t,e):t===e)return!0;if(l(t)!==l(e))return!1;if(!t||!e||"object"!=typeof t&&"object"!=typeof e)return d.strict?o(t,e):t==e;var p,A=f.has(t),N=f.has(e);if(A&&N){if(f.get(t)===f.get(e))return!0}else p={};return A||f.set(t,p),N||f.set(e,p),function(t,e,r,o){var l,f;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(v(t)!==v(e))return!1;if(i(t)!==i(e))return!1;var d=u(t),p=u(e);if(d!==p)return!1;var A=t instanceof Error,N=e instanceof Error;if(A!==N)return!1;if((A||N)&&(t.name!==e.name||t.message!==e.message))return!1;var x=a(t),B=a(e);if(x!==B)return!1;if((x||B)&&(t.source!==e.source||s(t)!==s(e)))return!1;var U=c(t),F=c(e);if(U!==F)return!1;if((U||F)&&b(t)!==b(e))return!1;if(r.strict&&_&&_(t)!==_(e))return!1;if(m(t)!==m(e))return!1;var P=L(t),W=L(e);if(P!==W)return!1;if(P||W){if(t.length!==e.length)return!1;for(l=0;l<t.length;l++)if(t[l]!==e[l])return!1;return!0}if(typeof t!=typeof e)return!1;var z=n(t),H=n(e);if(z.length!==H.length)return!1;for(z.sort(),H.sort(),l=z.length-1;l>=0;l--)if(z[l]!=H[l])return!1;for(l=z.length-1;l>=0;l--)if(f=z[l],!C(t[f],e[f],r,o))return!1;var q=h(t),V=h(e);if(q!==V)return!1;if("Set"===q||"Set"===V)return function(t,e,r,n){if(I(t)!==I(e))return!1;var i,o,a,s=g(t),u=g(e);for(;(i=s.next())&&!i.done;)if(i.value&&"object"==typeof i.value)a||(a=new w),T(a,i.value);else if(!M(e,i.value)){if(r.strict)return!1;if(!D(t,e,i.value))return!1;a||(a=new w),T(a,i.value)}if(a){for(;(o=u.next())&&!o.done;)if(o.value&&"object"==typeof o.value){if(!R(a,o.value,r.strict,n))return!1}else if(!r.strict&&!M(t,o.value)&&!R(a,o.value,r.strict,n))return!1;return 0===I(a)}return!0}(t,e,r,o);if("Map"===q)return function(t,e,r,n){if(O(t)!==O(e))return!1;var i,o,a,s,u,c,l=g(t),f=g(e);for(;(i=l.next())&&!i.done;)if(s=i.value[0],u=i.value[1],s&&"object"==typeof s)a||(a=new w),T(a,s);else if(void 0===(c=S(e,s))&&!E(e,s)||!C(u,c,r,n)){if(r.strict)return!1;if(!k(t,e,s,u,r,n))return!1;a||(a=new w),T(a,s)}if(a){for(;(o=f.next())&&!o.done;)if(s=o.value[0],c=o.value[1],s&&"object"==typeof s){if(!j(a,t,s,c,r,n))return!1}else if(!(r.strict||t.has(s)&&C(S(t,s),c,r,n)||j(a,t,s,c,y({},r,{strict:!1}),n)))return!1;return 0===I(a)}return!0}(t,e,r,o);return!0}(t,e,d,f)}function L(t){return!(!t||"object"!=typeof t||"number"!=typeof t.length)&&("function"==typeof t.copy&&"function"==typeof t.slice&&(!(t.length>0&&"number"!=typeof t[0])&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))))}t.exports=function(t,e,r){return C(t,e,r,p())}},function(t,e,r){"use strict";r.d(e,"b",(function(){return o})),r.d(e,"a",(function(){return a}));var n=r(2),i=r(22);async function o(t){let e=1,r="My Finances";for(;t.find(t=>t.name===r);)r="My Finances "+e,e++;return r}async function a(t){let e=t.replace(/( |[^A-Za-z0-9])/g,"-")+"-"+i.a().slice(0,7),r=0,o=n.e(e);for(;await n.d(o);)r++,o=n.e(e+r.toString());return r>0&&(e+=r.toString()),e}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(17),i=r(8);function o(t,e){Object(i.a)(2,arguments);var r=Object(n.a)(t),o=Object(n.a)(e);return r.getTime()<o.getTime()}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));Math.pow(10,8);var n=r(8),i=r(28);function o(t,e){var r;Object(n.a)(1,arguments);var o=Object(i.a)(null!==(r=null==e?void 0:e.additionalDigits)&&void 0!==r?r:2);if(2!==o&&1!==o&&0!==o)throw new RangeError("additionalDigits must be 0, 1 or 2");if("string"!=typeof t&&"[object String]"!==Object.prototype.toString.call(t))return new Date(NaN);var a,s=l(t);if(s.date){var u=f(s.date,o);a=d(u.restDateString,u.year)}if(!a||isNaN(a.getTime()))return new Date(NaN);var c,h=a.getTime(),p=0;if(s.time&&(p=g(s.time),isNaN(p)))return new Date(NaN);if(!s.timezone){var y=new Date(h+p),b=new Date(0);return b.setFullYear(y.getUTCFullYear(),y.getUTCMonth(),y.getUTCDate()),b.setHours(y.getUTCHours(),y.getUTCMinutes(),y.getUTCSeconds(),y.getUTCMilliseconds()),b}return c=m(s.timezone),isNaN(c)?new Date(NaN):new Date(h+p+c)}var a={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},s=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,u=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,c=/^([+-])(\d{2})(?::?(\d{2}))?$/;function l(t){var e,r={},n=t.split(a.dateTimeDelimiter);if(n.length>2)return r;if(/:/.test(n[0])?e=n[0]:(r.date=n[0],e=n[1],a.timeZoneDelimiter.test(r.date)&&(r.date=t.split(a.timeZoneDelimiter)[0],e=t.substr(r.date.length,t.length))),e){var i=a.timezone.exec(e);i?(r.time=e.replace(i[1],""),r.timezone=i[1]):r.time=e}return r}function f(t,e){var r=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),n=t.match(r);if(!n)return{year:NaN,restDateString:""};var i=n[1]?parseInt(n[1]):null,o=n[2]?parseInt(n[2]):null;return{year:null===o?i:100*o,restDateString:t.slice((n[1]||n[2]).length)}}function d(t,e){if(null===e)return new Date(NaN);var r=t.match(s);if(!r)return new Date(NaN);var n=!!r[4],i=h(r[1]),o=h(r[2])-1,a=h(r[3]),u=h(r[4]),c=h(r[5])-1;if(n)return function(t,e,r){return e>=1&&e<=53&&r>=0&&r<=6}(0,u,c)?function(t,e,r){var n=new Date(0);n.setUTCFullYear(t,0,4);var i=n.getUTCDay()||7,o=7*(e-1)+r+1-i;return n.setUTCDate(n.getUTCDate()+o),n}(e,u,c):new Date(NaN);var l=new Date(0);return function(t,e,r){return e>=0&&e<=11&&r>=1&&r<=(y[e]||(b(t)?29:28))}(e,o,a)&&function(t,e){return e>=1&&e<=(b(t)?366:365)}(e,i)?(l.setUTCFullYear(e,o,Math.max(i,a)),l):new Date(NaN)}function h(t){return t?parseInt(t):1}function g(t){var e=t.match(u);if(!e)return NaN;var r=p(e[1]),n=p(e[2]),i=p(e[3]);return function(t,e,r){if(24===t)return 0===e&&0===r;return r>=0&&r<60&&e>=0&&e<60&&t>=0&&t<25}(r,n,i)?36e5*r+6e4*n+1e3*i:NaN}function p(t){return t&&parseFloat(t.replace(",","."))||0}function m(t){if("Z"===t)return 0;var e=t.match(c);if(!e)return 0;var r="+"===e[1]?-1:1,n=parseInt(e[2]),i=e[3]&&parseInt(e[3])||0;return function(t,e){return e>=0&&e<=59}(0,i)?r*(36e5*n+6e4*i):NaN}var y=[31,null,31,30,31,30,31,31,30,31,30,31];function b(t){return t%400==0||t%4==0&&t%100!=0}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){(function(t){e.require=function(){if("object"==typeof t&&t.versions&&t.versions.electron)try{const t=r(!function(){var t=new Error("Cannot find module 'original-fs'");throw t.code="MODULE_NOT_FOUND",t}());if(Object.keys(t).length>0)return t}catch(t){}return r(41)}}).call(this,r(25))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(82),i=r(150),o=n.constants.S_IFMT,a=n.constants.S_IFDIR,s=n.constants.S_IFREG,u=n.constants.S_IFBLK,c=n.constants.S_IFCHR,l=n.constants.S_IFLNK,f=n.constants.S_IFIFO,d=n.constants.S_IFSOCK,h=function(){function t(){this.name="",this.mode=0}return t.build=function(e,r){var n=new t,o=e.getNode().mode;return n.name=i.strToEncoding(e.getName(),r),n.mode=o,n},t.prototype._checkModeProperty=function(t){return(this.mode&o)===t},t.prototype.isDirectory=function(){return this._checkModeProperty(a)},t.prototype.isFile=function(){return this._checkModeProperty(s)},t.prototype.isBlockDevice=function(){return this._checkModeProperty(u)},t.prototype.isCharacterDevice=function(){return this._checkModeProperty(c)},t.prototype.isSymbolicLink=function(){return this._checkModeProperty(l)},t.prototype.isFIFO=function(){return this._checkModeProperty(f)},t.prototype.isSocket=function(){return this._checkModeProperty(d)},t}();e.Dirent=h,e.default=h},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(111),i=r(151);e.ENCODING_UTF8="utf8",e.assertEncoding=function(t){if(t&&!n.Buffer.isEncoding(t))throw new i.TypeError("ERR_INVALID_OPT_VALUE_ENCODING",t)},e.strToEncoding=function(t,r){return r&&r!==e.ENCODING_UTF8?"buffer"===r?new n.Buffer(t):new n.Buffer(t).toString(r):t}},function(t,e,r){"use strict";(function(t){var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var o=r(112),a=r(98),s="undefined"==typeof Symbol?"_kCode":Symbol("code"),u={};function c(t){return function(t){function e(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=t.call(this,f(e,r))||this;return i.code=e,i[s]=e,i.name=t.prototype.name+" ["+i[s]+"]",i}return i(e,t),e}(t)}var l=function(t){function r(r){var n=this;if("object"!=typeof r||null===r)throw new e.TypeError("ERR_INVALID_ARG_TYPE","options","object");return(n=r.message?t.call(this,r.message)||this:t.call(this,a.inspect(r.actual).slice(0,128)+" "+r.operator+" "+a.inspect(r.expected).slice(0,128))||this).generatedMessage=!r.message,n.name="AssertionError [ERR_ASSERTION]",n.code="ERR_ASSERTION",n.actual=r.actual,n.expected=r.expected,n.operator=r.operator,e.Error.captureStackTrace(n,r.stackStartFunction),n}return i(r,t),r}(t.Error);function f(t,e){o.strictEqual(typeof t,"string");var r,n=u[t];if(o(n,"An invalid error message key was used: "+t+"."),"function"==typeof n)r=n;else{if(r=a.format,void 0===e||0===e.length)return n;e.unshift(n)}return String(r.apply(null,e))}function d(t,e){u[t]="function"==typeof e?e:String(e)}function h(t,e){if(o(t,"expected is required"),o("string"==typeof e,"thing is required"),Array.isArray(t)){var r=t.length;return o(r>0,"At least one expected value needs to be specified"),t=t.map((function(t){return String(t)})),r>2?"one of "+e+" "+t.slice(0,r-1).join(", ")+", or "+t[r-1]:2===r?"one of "+e+" "+t[0]+" or "+t[1]:"of "+e+" "+t[0]}return"of "+e+" "+String(t)}e.AssertionError=l,e.message=f,e.E=d,e.Error=c(t.Error),e.TypeError=c(t.TypeError),e.RangeError=c(t.RangeError),d("ERR_ARG_NOT_ITERABLE","%s must be iterable"),d("ERR_ASSERTION","%s"),d("ERR_BUFFER_OUT_OF_BOUNDS",(function(t,e){return e?"Attempt to write outside buffer bounds":'"'+t+'" is outside of buffer bounds'})),d("ERR_CHILD_CLOSED_BEFORE_REPLY","Child closed before reply received"),d("ERR_CONSOLE_WRITABLE_STREAM","Console expects a writable stream instance for %s"),d("ERR_CPU_USAGE","Unable to obtain cpu usage %s"),d("ERR_DNS_SET_SERVERS_FAILED",(function(t,e){return'c-ares failed to set servers: "'+t+'" ['+e+"]"})),d("ERR_FALSY_VALUE_REJECTION","Promise was rejected with falsy value"),d("ERR_ENCODING_NOT_SUPPORTED",(function(t){return'The "'+t+'" encoding is not supported'})),d("ERR_ENCODING_INVALID_ENCODED_DATA",(function(t){return"The encoded data was not valid for encoding "+t})),d("ERR_HTTP_HEADERS_SENT","Cannot render headers after they are sent to the client"),d("ERR_HTTP_INVALID_STATUS_CODE","Invalid status code: %s"),d("ERR_HTTP_TRAILER_INVALID","Trailers are invalid with this transfer encoding"),d("ERR_INDEX_OUT_OF_RANGE","Index out of range"),d("ERR_INVALID_ARG_TYPE",(function(t,e,r){var n,i;o(t,"name is required"),e.includes("not ")?(n="must not be",e=e.split("not ")[1]):n="must be";if(Array.isArray(t)){var a=t.map((function(t){return'"'+t+'"'})).join(", ");i="The "+a+" arguments "+n+" "+h(e,"type")}else if(t.includes(" argument"))i="The "+t+" "+n+" "+h(e,"type");else{var s=t.includes(".")?"property":"argument";i='The "'+t+'" '+s+" "+n+" "+h(e,"type")}arguments.length>=3&&(i+=". Received type "+(null!==r?typeof r:"null"));return i})),d("ERR_INVALID_ARRAY_LENGTH",(function(t,e,r){return o.strictEqual(typeof r,"number"),'The array "'+t+'" (length '+r+") must be of length "+e+"."})),d("ERR_INVALID_BUFFER_SIZE","Buffer size must be a multiple of %s"),d("ERR_INVALID_CALLBACK","Callback must be a function"),d("ERR_INVALID_CHAR","Invalid character in %s"),d("ERR_INVALID_CURSOR_POS","Cannot set cursor row without setting its column"),d("ERR_INVALID_FD",'"fd" must be a positive integer: %s'),d("ERR_INVALID_FILE_URL_HOST",'File URL host must be "localhost" or empty on %s'),d("ERR_INVALID_FILE_URL_PATH","File URL path %s"),d("ERR_INVALID_HANDLE_TYPE","This handle type cannot be sent"),d("ERR_INVALID_IP_ADDRESS","Invalid IP address: %s"),d("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+String(e)+'" is invalid for option "'+t+'"'})),d("ERR_INVALID_OPT_VALUE_ENCODING",(function(t){return'The value "'+String(t)+'" is invalid for option "encoding"'})),d("ERR_INVALID_REPL_EVAL_CONFIG",'Cannot specify both "breakEvalOnSigint" and "eval" for REPL'),d("ERR_INVALID_SYNC_FORK_INPUT","Asynchronous forks do not support Buffer, Uint8Array or string input: %s"),d("ERR_INVALID_THIS",'Value of "this" must be of type %s'),d("ERR_INVALID_TUPLE","%s must be an iterable %s tuple"),d("ERR_INVALID_URL","Invalid URL: %s"),d("ERR_INVALID_URL_SCHEME",(function(t){return"The URL must be "+h(t,"scheme")})),d("ERR_IPC_CHANNEL_CLOSED","Channel closed"),d("ERR_IPC_DISCONNECTED","IPC channel is already disconnected"),d("ERR_IPC_ONE_PIPE","Child process can have only one IPC pipe"),d("ERR_IPC_SYNC_FORK","IPC cannot be used with synchronous forks"),d("ERR_MISSING_ARGS",(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];o(t.length>0,"At least one arg needs to be specified");var r="The ",n=t.length;switch(t=t.map((function(t){return'"'+t+'"'})),n){case 1:r+=t[0]+" argument";break;case 2:r+=t[0]+" and "+t[1]+" arguments";break;default:r+=t.slice(0,n-1).join(", "),r+=", and "+t[n-1]+" arguments"}return r+" must be specified"})),d("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),d("ERR_NAPI_CONS_FUNCTION","Constructor must be a function"),d("ERR_NAPI_CONS_PROTOTYPE_OBJECT","Constructor.prototype must be an object"),d("ERR_NO_CRYPTO","Node.js is not compiled with OpenSSL crypto support"),d("ERR_NO_LONGER_SUPPORTED","%s is no longer supported"),d("ERR_PARSE_HISTORY_DATA","Could not parse history data in %s"),d("ERR_SOCKET_ALREADY_BOUND","Socket is already bound"),d("ERR_SOCKET_BAD_PORT","Port should be > 0 and < 65536"),d("ERR_SOCKET_BAD_TYPE","Bad socket type specified. Valid types are: udp4, udp6"),d("ERR_SOCKET_CANNOT_SEND","Unable to send data"),d("ERR_SOCKET_CLOSED","Socket is closed"),d("ERR_SOCKET_DGRAM_NOT_RUNNING","Not running"),d("ERR_STDERR_CLOSE","process.stderr cannot be closed"),d("ERR_STDOUT_CLOSE","process.stdout cannot be closed"),d("ERR_STREAM_WRAP","Stream has StringDecoder set or is in objectMode"),d("ERR_TLS_CERT_ALTNAME_INVALID","Hostname/IP does not match certificate's altnames: %s"),d("ERR_TLS_DH_PARAM_SIZE",(function(t){return"DH parameter size "+t+" is less than 2048"})),d("ERR_TLS_HANDSHAKE_TIMEOUT","TLS handshake timeout"),d("ERR_TLS_RENEGOTIATION_FAILED","Failed to renegotiate"),d("ERR_TLS_REQUIRED_SERVER_NAME",'"servername" is required parameter for Server.addContext'),d("ERR_TLS_SESSION_ATTACK","TSL session renegotiation attack detected"),d("ERR_TRANSFORM_ALREADY_TRANSFORMING","Calling transform done when still transforming"),d("ERR_TRANSFORM_WITH_LENGTH_0","Calling transform done when writableState.length != 0"),d("ERR_UNKNOWN_ENCODING","Unknown encoding: %s"),d("ERR_UNKNOWN_SIGNAL","Unknown signal: %s"),d("ERR_UNKNOWN_STDIN_TYPE","Unknown stdin file type"),d("ERR_UNKNOWN_STREAM_TYPE","Unknown stream file type"),d("ERR_V8BREAKITERATOR","Full ICU data not installed. See https://github.com/nodejs/node/wiki/Intl")}).call(this,r(33))},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});function n(){var e=function(){if(void 0!==t)return t;try{return r(25)}catch(t){return}}()||{};return e.getuid||(e.getuid=function(){return 0}),e.getgid||(e.getgid=function(){return 0}),e.cwd||(e.cwd=function(){return"/"}),e.nextTick||(e.nextTick=r(153).default),e.emitWarning||(e.emitWarning=function(t,e){console.warn(e+(e?": ":"")+t)}),e.env||(e.env={}),e}e.createProcess=n,e.default=n()}).call(this,r(25))},function(t,e,r){"use strict";(function(t,r){var n;Object.defineProperty(e,"__esModule",{value:!0}),n="function"==typeof t?t.bind(r):setTimeout.bind(r),e.default=n}).call(this,r(99).setImmediate,r(33))},function(t,e,r){"use strict";(function(e,n){var i=r(100);t.exports=_;var o,a=r(147);_.ReadableState=b;r(54).EventEmitter;var s=function(t,e){return t.listeners(e).length},u=r(155),c=r(114).Buffer,l=e.Uint8Array||function(){};var f=Object.create(r(83));f.inherits=r(12);var d=r(266),h=void 0;h=d&&d.debuglog?d.debuglog("stream"):function(){};var g,p=r(267),m=r(156);f.inherits(_,u);var y=["error","close","destroy","pause","resume"];function b(t,e){t=t||{};var n=e instanceof(o=o||r(64));this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,a=t.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(a||0===a)?a:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(g||(g=r(55).StringDecoder),this.decoder=new g(t.encoding),this.encoding=t.encoding)}function _(t){if(o=o||r(64),!(this instanceof _))return new _(t);this._readableState=new b(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),u.call(this)}function v(t,e,r,n,i){var o,a=t._readableState;null===e?(a.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,S(t)}(t,a)):(i||(o=function(t,e){var r;n=e,c.isBuffer(n)||n instanceof l||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var n;return r}(a,e)),o?t.emit("error",o):a.objectMode||e&&e.length>0?("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===c.prototype||(e=function(t){return c.from(t)}(e)),n?a.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):w(t,a,e,!0):a.ended?t.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?w(t,a,e,!1):T(t,a)):w(t,a,e,!1))):n||(a.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(a)}function w(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(t.emit("data",r),t.read(0)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&S(t)),T(t,e)}Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(t,e){this.push(null),e(t)},_.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=c.from(t,e),e=""),r=!0),v(this,t,e,!1,r)},_.prototype.unshift=function(t){return v(this,t,null,!0,!1)},_.prototype.isPaused=function(){return!1===this._readableState.flowing},_.prototype.setEncoding=function(t){return g||(g=r(55).StringDecoder),this._readableState.decoder=new g(t),this._readableState.encoding=t,this};function E(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=8388608?t=8388608:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function S(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(h("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(O,t):O(t))}function O(t){h("emit readable"),t.emit("readable"),R(t)}function T(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(A,t,e))}function A(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(h("maybeReadMore read 0"),t.read(0),r!==e.length);)r=e.length;e.readingMore=!1}function M(t){h("readable nexttick read 0"),t.read(0)}function I(t,e){e.reading||(h("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),R(t),e.flowing&&!e.reading&&t.read(0)}function R(t){var e=t._readableState;for(h("flow",e.flowing);e.flowing&&null!==t.read(););}function N(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;t<e.head.data.length?(n=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):n=t===e.head.data.length?e.shift():r?function(t,e){var r=e.head,n=1,i=r.data;t-=i.length;for(;r=r.next;){var o=r.data,a=t>o.length?o.length:t;if(a===o.length?i+=o:i+=o.slice(0,t),0===(t-=a)){a===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(a));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=c.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;for(;n=n.next;){var o=n.data,a=t>o.length?o.length:t;if(o.copy(r,r.length-t,0,a),0===(t-=a)){a===o.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(a));break}++i}return e.length-=i,r}(t,e);return n}(t,e.buffer,e.decoder),r);var r}function k(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(D,e,t))}function D(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function j(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}_.prototype.read=function(t){h("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return h("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?k(this):S(this),null;if(0===(t=E(t,e))&&e.ended)return 0===e.length&&k(this),null;var n,i=e.needReadable;return h("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&h("length less than watermark",i=!0),e.ended||e.reading?h("reading or ended",i=!1):i&&(h("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=E(r,e))),null===(n=t>0?N(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&k(this)),null!==n&&this.emit("data",n),n},_.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},_.prototype.pipe=function(t,e){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,h("pipe count=%d opts=%j",o.pipesCount,e);var u=(!e||!1!==e.end)&&t!==n.stdout&&t!==n.stderr?l:_;function c(e,n){h("onunpipe"),e===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,h("cleanup"),t.removeListener("close",y),t.removeListener("finish",b),t.removeListener("drain",f),t.removeListener("error",m),t.removeListener("unpipe",c),r.removeListener("end",l),r.removeListener("end",_),r.removeListener("data",p),d=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function l(){h("onend"),t.end()}o.endEmitted?i.nextTick(u):r.once("end",u),t.on("unpipe",c);var f=function(t){return function(){var e=t._readableState;h("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,R(t))}}(r);t.on("drain",f);var d=!1;var g=!1;function p(e){h("ondata"),g=!1,!1!==t.write(e)||g||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==j(o.pipes,t))&&!d&&(h("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,g=!0),r.pause())}function m(e){h("onerror",e),_(),t.removeListener("error",m),0===s(t,"error")&&t.emit("error",e)}function y(){t.removeListener("finish",b),_()}function b(){h("onfinish"),t.removeListener("close",y),_()}function _(){h("unpipe"),r.unpipe(t)}return r.on("data",p),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?a(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",m),t.once("close",y),t.once("finish",b),t.emit("pipe",r),o.flowing||(h("pipe resume"),r.resume()),t},_.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,r);return this}var a=j(e.pipes,t);return-1===a||(e.pipes.splice(a,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},_.prototype.on=function(t,e){var r=u.prototype.on.call(this,t,e);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var n=this._readableState;n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.emittedReadable=!1,n.reading?n.length&&S(this):i.nextTick(M,this))}return r},_.prototype.addListener=_.prototype.on,_.prototype.resume=function(){var t=this._readableState;return t.flowing||(h("resume"),t.flowing=!0,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(I,t,e))}(this,t)),this},_.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this},_.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",(function(){if(h("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(h("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<y.length;o++)t.on(y[o],this.emit.bind(this,y[o]));return this._read=function(e){h("wrapped _read",e),n&&(n=!1,t.resume())},this},Object.defineProperty(_.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),_._fromList=N}).call(this,r(33),r(25))},function(t,e,r){t.exports=r(54).EventEmitter},function(t,e,r){"use strict";var n=r(100);function i(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var r=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||n.nextTick(i,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?(n.nextTick(i,r,t),r._writableState&&(r._writableState.errorEmitted=!0)):e&&e(t)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,e,r){"use strict";t.exports=a;var n=r(64),i=Object.create(r(83));function o(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function a(t){if(!(this instanceof a))return new a(t);n.call(this,t),this._transformState={afterTransform:o.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",s)}function s(){var t=this;"function"==typeof this._flush?this._flush((function(e,r){u(t,e,r)})):u(this,null,null)}function u(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}i.inherits=r(12),i.inherits(a,n),a.prototype.push=function(t,e){return this._transformState.needTransform=!1,n.prototype.push.call(this,t,e)},a.prototype._transform=function(t,e,r){throw new Error("_transform() is not implemented")},a.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},a.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},a.prototype._destroy=function(t,e){var r=this;n.prototype._destroy.call(this,t,(function(t){e(t),r.emit("close")}))}},function(t,e){t.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}},function(t,e,r){(function(e){var n=r(81),i=r(160),o=n.Constants,a=r(287);t.exports=function(t){var r=new i.EntryHeader,s=e.alloc(0),u=e.alloc(0),c=!1,l=null,f=e.alloc(0);function d(){return t&&e.isBuffer(t)?(r.loadDataHeaderFromBinary(t),t.slice(r.realDataOffset,r.realDataOffset+r.compressedSize)):e.alloc(0)}function h(t){return 8==(8&r.flags)||n.crc32(t)===r.dataHeader.crc}function g(t,i,o){if(void 0===i&&"string"==typeof t&&(o=t,t=void 0),c)return t&&i&&i(e.alloc(0),n.Errors.DIRECTORY_CONTENT_ERROR),e.alloc(0);var u=d();if(0===u.length)return t&&i&&i(u),u;if(r.encripted){if("string"!=typeof o&&!e.isBuffer(o))throw new Error("ADM-ZIP: Incompatible password parameter");u=a.ZipCrypto.decrypt(u,r,o)}var l=e.alloc(r.size);switch(r.method){case n.Constants.STORED:if(u.copy(l),h(l))return t&&i&&i(l),l;throw t&&i&&i(l,n.Errors.BAD_CRC),new Error(n.Errors.BAD_CRC);case n.Constants.DEFLATED:var f=new a.Inflater(u);if(!t){if(f.inflate(l).copy(l,0),!h(l))throw new Error(n.Errors.BAD_CRC+" "+s.toString());return l}f.inflateAsync((function(t){t.copy(t,0),i&&(h(t)?i(t):i(t,n.Errors.BAD_CRC))}));break;default:throw t&&i&&i(e.alloc(0),n.Errors.UNKNOWN_METHOD),new Error(n.Errors.UNKNOWN_METHOD)}}function p(i,o){if((!l||!l.length)&&e.isBuffer(t))return i&&o&&o(d()),d();if(l.length&&!c){var s;switch(r.method){case n.Constants.STORED:return r.compressedSize=r.size,s=e.alloc(l.length),l.copy(s),i&&o&&o(s),s;default:case n.Constants.DEFLATED:var u=new a.Deflater(l);if(!i){var f=u.deflate();return r.compressedSize=f.length,f}u.deflateAsync((function(t){s=e.alloc(t.length),r.compressedSize=t.length,t.copy(s),o&&o(s)})),u=null}}else{if(!i||!o)return e.alloc(0);o(e.alloc(0))}}function m(t,e){return(t.readUInt32LE(e+4)<<4)+t.readUInt32LE(e)}function y(t){var e,n,i,a;t.length>=o.EF_ZIP64_SCOMP&&(e=m(t,o.EF_ZIP64_SUNCOMP),r.size===o.EF_ZIP64_OR_32&&(r.size=e)),t.length>=o.EF_ZIP64_RHO&&(n=m(t,o.EF_ZIP64_SCOMP),r.compressedSize===o.EF_ZIP64_OR_32&&(r.compressedSize=n)),t.length>=o.EF_ZIP64_DSN&&(i=m(t,o.EF_ZIP64_RHO),r.offset===o.EF_ZIP64_OR_32&&(r.offset=i)),t.length>=o.EF_ZIP64_DSN+4&&(a=t.readUInt32LE(o.EF_ZIP64_DSN),r.diskNumStart===o.EF_ZIP64_OR_16&&(r.diskNumStart=a))}return{get entryName(){return s.toString()},get rawEntryName(){return s},set entryName(t){var e=(s=n.toBuffer(t))[s.length-1];c=47===e||92===e,r.fileNameLength=s.length},get extra(){return f},set extra(t){f=t,r.extraLength=t.length,function(t){for(var e,r,n,i=0;i<t.length;)e=t.readUInt16LE(i),i+=2,r=t.readUInt16LE(i),i+=2,n=t.slice(i,i+r),i+=r,o.ID_ZIP64===e&&y(n)}(t)},get comment(){return u.toString()},set comment(t){u=n.toBuffer(t),r.commentLength=u.length},get name(){var t=s.toString();return c?t.substr(t.length-1).split("/").pop():t.split("/").pop()},get isDirectory(){return c},getCompressedData:function(){return p(!1,null)},getCompressedDataAsync:function(t){p(!0,t)},setData:function(t){l=n.toBuffer(t),!c&&l.length?(r.size=l.length,r.method=n.Constants.DEFLATED,r.crc=n.crc32(t),r.changed=!0):r.method=n.Constants.STORED},getData:function(t){return r.changed?l:g(!1,null,t)},getDataAsync:function(t,e){r.changed?t(l):g(!0,t,e)},set attr(t){r.attr=t},get attr(){return r.attr},set header(t){r.loadFromBinary(t)},get header(){return r},packHeader:function(){var t=r.entryHeaderToBinary(),e=n.Constants.CENHDR;return s.copy(t,e),e+=s.length,r.extraLength&&(f.copy(t,e),e+=r.extraLength),r.commentLength&&u.copy(t,e),t},toJSON:function(){const e=function(t){return"<"+(t&&t.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:r.toJSON(),compressedData:e(t),data:e(l)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}).call(this,r(16).Buffer)},function(t,e,r){e.EntryHeader=r(285),e.MainHeader=r(286)},function(t,e,r){"use strict";(function(t){var n=r(16).Buffer,i=r(68).Transform,o=r(289),a=r(98),s=r(112).ok,u=r(16).kMaxLength,c="Cannot create final Buffer. It would be larger than 0x"+u.toString(16)+" bytes";o.Z_MIN_WINDOWBITS=8,o.Z_MAX_WINDOWBITS=15,o.Z_DEFAULT_WINDOWBITS=15,o.Z_MIN_CHUNK=64,o.Z_MAX_CHUNK=1/0,o.Z_DEFAULT_CHUNK=16384,o.Z_MIN_MEMLEVEL=1,o.Z_MAX_MEMLEVEL=9,o.Z_DEFAULT_MEMLEVEL=8,o.Z_MIN_LEVEL=-1,o.Z_MAX_LEVEL=9,o.Z_DEFAULT_LEVEL=o.Z_DEFAULT_COMPRESSION;for(var l=Object.keys(o),f=0;f<l.length;f++){var d=l[f];d.match(/^Z/)&&Object.defineProperty(e,d,{enumerable:!0,value:o[d],writable:!1})}for(var h={Z_OK:o.Z_OK,Z_STREAM_END:o.Z_STREAM_END,Z_NEED_DICT:o.Z_NEED_DICT,Z_ERRNO:o.Z_ERRNO,Z_STREAM_ERROR:o.Z_STREAM_ERROR,Z_DATA_ERROR:o.Z_DATA_ERROR,Z_MEM_ERROR:o.Z_MEM_ERROR,Z_BUF_ERROR:o.Z_BUF_ERROR,Z_VERSION_ERROR:o.Z_VERSION_ERROR},g=Object.keys(h),p=0;p<g.length;p++){var m=g[p];h[h[m]]=m}function y(t,e,r){var i=[],o=0;function a(){for(var e;null!==(e=t.read());)i.push(e),o+=e.length;t.once("readable",a)}function s(){var e,a=null;o>=u?a=new RangeError(c):e=n.concat(i,o),i=[],t.close(),r(a,e)}t.on("error",(function(e){t.removeListener("end",s),t.removeListener("readable",a),r(e)})),t.on("end",s),t.end(e),a()}function b(t,e){if("string"==typeof e&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Not a string or buffer");var r=t._finishFlushFlag;return t._processChunk(e,r)}function _(t){if(!(this instanceof _))return new _(t);M.call(this,t,o.DEFLATE)}function v(t){if(!(this instanceof v))return new v(t);M.call(this,t,o.INFLATE)}function w(t){if(!(this instanceof w))return new w(t);M.call(this,t,o.GZIP)}function E(t){if(!(this instanceof E))return new E(t);M.call(this,t,o.GUNZIP)}function S(t){if(!(this instanceof S))return new S(t);M.call(this,t,o.DEFLATERAW)}function O(t){if(!(this instanceof O))return new O(t);M.call(this,t,o.INFLATERAW)}function T(t){if(!(this instanceof T))return new T(t);M.call(this,t,o.UNZIP)}function A(t){return t===o.Z_NO_FLUSH||t===o.Z_PARTIAL_FLUSH||t===o.Z_SYNC_FLUSH||t===o.Z_FULL_FLUSH||t===o.Z_FINISH||t===o.Z_BLOCK}function M(t,r){var a=this;if(this._opts=t=t||{},this._chunkSize=t.chunkSize||e.Z_DEFAULT_CHUNK,i.call(this,t),t.flush&&!A(t.flush))throw new Error("Invalid flush flag: "+t.flush);if(t.finishFlush&&!A(t.finishFlush))throw new Error("Invalid flush flag: "+t.finishFlush);if(this._flushFlag=t.flush||o.Z_NO_FLUSH,this._finishFlushFlag=void 0!==t.finishFlush?t.finishFlush:o.Z_FINISH,t.chunkSize&&(t.chunkSize<e.Z_MIN_CHUNK||t.chunkSize>e.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+t.chunkSize);if(t.windowBits&&(t.windowBits<e.Z_MIN_WINDOWBITS||t.windowBits>e.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+t.windowBits);if(t.level&&(t.level<e.Z_MIN_LEVEL||t.level>e.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+t.level);if(t.memLevel&&(t.memLevel<e.Z_MIN_MEMLEVEL||t.memLevel>e.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+t.memLevel);if(t.strategy&&t.strategy!=e.Z_FILTERED&&t.strategy!=e.Z_HUFFMAN_ONLY&&t.strategy!=e.Z_RLE&&t.strategy!=e.Z_FIXED&&t.strategy!=e.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+t.strategy);if(t.dictionary&&!n.isBuffer(t.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new o.Zlib(r);var s=this;this._hadError=!1,this._handle.onerror=function(t,r){I(s),s._hadError=!0;var n=new Error(t);n.errno=r,n.code=e.codes[r],s.emit("error",n)};var u=e.Z_DEFAULT_COMPRESSION;"number"==typeof t.level&&(u=t.level);var c=e.Z_DEFAULT_STRATEGY;"number"==typeof t.strategy&&(c=t.strategy),this._handle.init(t.windowBits||e.Z_DEFAULT_WINDOWBITS,u,t.memLevel||e.Z_DEFAULT_MEMLEVEL,c,t.dictionary),this._buffer=n.allocUnsafe(this._chunkSize),this._offset=0,this._level=u,this._strategy=c,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!a._handle},configurable:!0,enumerable:!0})}function I(e,r){r&&t.nextTick(r),e._handle&&(e._handle.close(),e._handle=null)}function R(t){t.emit("close")}Object.defineProperty(e,"codes",{enumerable:!0,value:Object.freeze(h),writable:!1}),e.Deflate=_,e.Inflate=v,e.Gzip=w,e.Gunzip=E,e.DeflateRaw=S,e.InflateRaw=O,e.Unzip=T,e.createDeflate=function(t){return new _(t)},e.createInflate=function(t){return new v(t)},e.createDeflateRaw=function(t){return new S(t)},e.createInflateRaw=function(t){return new O(t)},e.createGzip=function(t){return new w(t)},e.createGunzip=function(t){return new E(t)},e.createUnzip=function(t){return new T(t)},e.deflate=function(t,e,r){return"function"==typeof e&&(r=e,e={}),y(new _(e),t,r)},e.deflateSync=function(t,e){return b(new _(e),t)},e.gzip=function(t,e,r){return"function"==typeof e&&(r=e,e={}),y(new w(e),t,r)},e.gzipSync=function(t,e){return b(new w(e),t)},e.deflateRaw=function(t,e,r){return"function"==typeof e&&(r=e,e={}),y(new S(e),t,r)},e.deflateRawSync=function(t,e){return b(new S(e),t)},e.unzip=function(t,e,r){return"function"==typeof e&&(r=e,e={}),y(new T(e),t,r)},e.unzipSync=function(t,e){return b(new T(e),t)},e.inflate=function(t,e,r){return"function"==typeof e&&(r=e,e={}),y(new v(e),t,r)},e.inflateSync=function(t,e){return b(new v(e),t)},e.gunzip=function(t,e,r){return"function"==typeof e&&(r=e,e={}),y(new E(e),t,r)},e.gunzipSync=function(t,e){return b(new E(e),t)},e.inflateRaw=function(t,e,r){return"function"==typeof e&&(r=e,e={}),y(new O(e),t,r)},e.inflateRawSync=function(t,e){return b(new O(e),t)},a.inherits(M,i),M.prototype.params=function(r,n,i){if(r<e.Z_MIN_LEVEL||r>e.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+r);if(n!=e.Z_FILTERED&&n!=e.Z_HUFFMAN_ONLY&&n!=e.Z_RLE&&n!=e.Z_FIXED&&n!=e.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+n);if(this._level!==r||this._strategy!==n){var a=this;this.flush(o.Z_SYNC_FLUSH,(function(){s(a._handle,"zlib binding closed"),a._handle.params(r,n),a._hadError||(a._level=r,a._strategy=n,i&&i())}))}else t.nextTick(i)},M.prototype.reset=function(){return s(this._handle,"zlib binding closed"),this._handle.reset()},M.prototype._flush=function(t){this._transform(n.alloc(0),"",t)},M.prototype.flush=function(e,r){var i=this,a=this._writableState;("function"==typeof e||void 0===e&&!r)&&(r=e,e=o.Z_FULL_FLUSH),a.ended?r&&t.nextTick(r):a.ending?r&&this.once("end",r):a.needDrain?r&&this.once("drain",(function(){return i.flush(e,r)})):(this._flushFlag=e,this.write(n.alloc(0),"",r))},M.prototype.close=function(e){I(this,e),t.nextTick(R,this)},M.prototype._transform=function(t,e,r){var i,a=this._writableState,s=(a.ending||a.ended)&&(!t||a.length===t.length);return null===t||n.isBuffer(t)?this._handle?(s?i=this._finishFlushFlag:(i=this._flushFlag,t.length>=a.length&&(this._flushFlag=this._opts.flush||o.Z_NO_FLUSH)),void this._processChunk(t,i,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},M.prototype._processChunk=function(t,e,r){var i=t&&t.length,o=this._chunkSize-this._offset,a=0,l=this,f="function"==typeof r;if(!f){var d,h=[],g=0;this.on("error",(function(t){d=t})),s(this._handle,"zlib binding closed");do{var p=this._handle.writeSync(e,t,a,i,this._buffer,this._offset,o)}while(!this._hadError&&b(p[0],p[1]));if(this._hadError)throw d;if(g>=u)throw I(this),new RangeError(c);var m=n.concat(h,g);return I(this),m}s(this._handle,"zlib binding closed");var y=this._handle.write(e,t,a,i,this._buffer,this._offset,o);function b(u,c){if(this&&(this.buffer=null,this.callback=null),!l._hadError){var d=o-c;if(s(d>=0,"have should not go down"),d>0){var p=l._buffer.slice(l._offset,l._offset+d);l._offset+=d,f?l.push(p):(h.push(p),g+=p.length)}if((0===c||l._offset>=l._chunkSize)&&(o=l._chunkSize,l._offset=0,l._buffer=n.allocUnsafe(l._chunkSize)),0===c){if(a+=i-u,i=u,!f)return!0;var m=l._handle.write(e,t,a,i,l._buffer,l._offset,l._chunkSize);return m.callback=b,void(m.buffer=t)}if(!f)return!1;r()}}y.buffer=t,y.callback=b},a.inherits(_,M),a.inherits(v,M),a.inherits(w,M),a.inherits(E,M),a.inherits(S,M),a.inherits(O,M),a.inherits(T,M)}).call(this,r(25))},function(t,e,r){"use strict";t.exports=function(t,e,r,n){for(var i=65535&t|0,o=t>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(i=i+e[n++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0}},function(t,e,r){"use strict";var n=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();t.exports=function(t,e,r,i){var o=n,a=i+r;t^=-1;for(var s=i;s<a;s++)t=t>>>8^o[255&(t^e[s])];return-1^t}},function(t,e,r){"use strict";e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=r(69),e.createHash=e.Hash=r(85),e.createHmac=e.Hmac=r(174);var n=r(313),i=Object.keys(n),o=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(i);e.getHashes=function(){return o};var a=r(177);e.pbkdf2=a.pbkdf2,e.pbkdf2Sync=a.pbkdf2Sync;var s=r(315);e.Cipher=s.Cipher,e.createCipher=s.createCipher,e.Cipheriv=s.Cipheriv,e.createCipheriv=s.createCipheriv,e.Decipher=s.Decipher,e.createDecipher=s.createDecipher,e.Decipheriv=s.Decipheriv,e.createDecipheriv=s.createDecipheriv,e.getCiphers=s.getCiphers,e.listCiphers=s.listCiphers;var u=r(330);e.DiffieHellmanGroup=u.DiffieHellmanGroup,e.createDiffieHellmanGroup=u.createDiffieHellmanGroup,e.getDiffieHellman=u.getDiffieHellman,e.createDiffieHellman=u.createDiffieHellman,e.DiffieHellman=u.DiffieHellman;var c=r(335);e.createSign=c.createSign,e.Sign=c.Sign,e.createVerify=c.createVerify,e.Verify=c.Verify,e.createECDH=r(376);var l=r(377);e.publicEncrypt=l.publicEncrypt,e.privateEncrypt=l.privateEncrypt,e.publicDecrypt=l.publicDecrypt,e.privateDecrypt=l.privateDecrypt;var f=r(380);e.randomFill=f.randomFill,e.randomFillSync=f.randomFillSync,e.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},function(t,e,r){"use strict";var n=r(19).Buffer,i=r(300).Transform;function o(t){i.call(this),this._block=n.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(12)(o,i),o.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(t){n=t}r(n)},o.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},o.prototype.update=function(t,e){if(function(t,e){if(!n.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}(t,"Data"),this._finalized)throw new Error("Digest already called");n.isBuffer(t)||(t=n.from(t,e));for(var r=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)r[o++]=t[i++];this._update(),this._blockOffset=0}for(;i<t.length;)r[this._blockOffset++]=t[i++];for(var a=0,s=8*t.length;s>0;++a)this._length[a]+=s,(s=this._length[a]/4294967296|0)>0&&(this._length[a]-=4294967296*s);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},o.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=o},function(t,e,r){"use strict";(function(e,n){var i;t.exports=T,T.ReadableState=O;r(54).EventEmitter;var o=function(t,e){return t.listeners(e).length},a=r(167),s=r(16).Buffer,u=e.Uint8Array||function(){};var c,l=r(301);c=l&&l.debuglog?l.debuglog("stream"):function(){};var f,d,h,g=r(302),p=r(168),m=r(169).getHighWaterMark,y=r(70).codes,b=y.ERR_INVALID_ARG_TYPE,_=y.ERR_STREAM_PUSH_AFTER_EOF,v=y.ERR_METHOD_NOT_IMPLEMENTED,w=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(12)(T,a);var E=p.errorOrDestroy,S=["error","close","destroy","pause","resume"];function O(t,e,n){i=i||r(71),t=t||{},"boolean"!=typeof n&&(n=e instanceof i),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=m(this,t,"readableHighWaterMark",n),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(f||(f=r(55).StringDecoder),this.decoder=new f(t.encoding),this.encoding=t.encoding)}function T(t){if(i=i||r(71),!(this instanceof T))return new T(t);var e=this instanceof i;this._readableState=new O(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function A(t,e,r,n,i){c("readableAddChunk",e);var o,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(c("onEofChunk"),e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?R(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,N(t)))}(t,a);else if(i||(o=function(t,e){var r;n=e,s.isBuffer(n)||n instanceof u||"string"==typeof e||void 0===e||t.objectMode||(r=new b("chunk",["string","Buffer","Uint8Array"],e));var n;return r}(a,e)),o)E(t,o);else if(a.objectMode||e&&e.length>0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),n)a.endEmitted?E(t,new w):M(t,a,e,!0);else if(a.ended)E(t,new _);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?M(t,a,e,!1):k(t,a)):M(t,a,e,!1)}else n||(a.reading=!1,k(t,a));return!a.ended&&(a.length<a.highWaterMark||0===a.length)}function M(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&R(t)),k(t,e)}Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),T.prototype.destroy=p.destroy,T.prototype._undestroy=p.undestroy,T.prototype._destroy=function(t,e){e(t)},T.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=s.from(t,e),e=""),r=!0),A(this,t,e,!1,r)},T.prototype.unshift=function(t){return A(this,t,null,!0,!1)},T.prototype.isPaused=function(){return!1===this._readableState.flowing},T.prototype.setEncoding=function(t){f||(f=r(55).StringDecoder);var e=new f(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=e.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};function I(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function R(t){var e=t._readableState;c("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(c("emitReadable",e.flowing),e.emittedReadable=!0,n.nextTick(N,t))}function N(t){var e=t._readableState;c("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,x(t)}function k(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(D,t,e))}function D(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(c("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function j(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function C(t){c("readable nexttick read 0"),t.read(0)}function L(t,e){c("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),x(t),e.flowing&&!e.reading&&t.read(0)}function x(t){var e=t._readableState;for(c("flow",e.flowing);e.flowing&&null!==t.read(););}function B(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function U(t){var e=t._readableState;c("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,n.nextTick(F,e,t))}function F(t,e){if(c("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function P(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}T.prototype.read=function(t){c("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return c("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?U(this):R(this),null;if(0===(t=I(t,e))&&e.ended)return 0===e.length&&U(this),null;var n,i=e.needReadable;return c("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&c("length less than watermark",i=!0),e.ended||e.reading?c("reading or ended",i=!1):i&&(c("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=I(r,e))),null===(n=t>0?B(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&U(this)),null!==n&&this.emit("data",n),n},T.prototype._read=function(t){E(this,new v("_read()"))},T.prototype.pipe=function(t,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,c("pipe count=%d opts=%j",i.pipesCount,e);var a=(!e||!1!==e.end)&&t!==n.stdout&&t!==n.stderr?u:m;function s(e,n){c("onunpipe"),e===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,c("cleanup"),t.removeListener("close",g),t.removeListener("finish",p),t.removeListener("drain",l),t.removeListener("error",h),t.removeListener("unpipe",s),r.removeListener("end",u),r.removeListener("end",m),r.removeListener("data",d),f=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}function u(){c("onend"),t.end()}i.endEmitted?n.nextTick(a):r.once("end",a),t.on("unpipe",s);var l=function(t){return function(){var e=t._readableState;c("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,x(t))}}(r);t.on("drain",l);var f=!1;function d(e){c("ondata");var n=t.write(e);c("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==P(i.pipes,t))&&!f&&(c("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function h(e){c("onerror",e),m(),t.removeListener("error",h),0===o(t,"error")&&E(t,e)}function g(){t.removeListener("finish",p),m()}function p(){c("onfinish"),t.removeListener("close",g),m()}function m(){c("unpipe"),r.unpipe(t)}return r.on("data",d),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",h),t.once("close",g),t.once("finish",p),t.emit("pipe",r),i.flowing||(c("pipe resume"),r.resume()),t},T.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=P(e.pipes,t);return-1===a||(e.pipes.splice(a,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},T.prototype.on=function(t,e){var r=a.prototype.on.call(this,t,e),i=this._readableState;return"data"===t?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,c("on readable",i.length,i.reading),i.length?R(this):i.reading||n.nextTick(C,this))),r},T.prototype.addListener=T.prototype.on,T.prototype.removeListener=function(t,e){var r=a.prototype.removeListener.call(this,t,e);return"readable"===t&&n.nextTick(j,this),r},T.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||n.nextTick(j,this),e},T.prototype.resume=function(){var t=this._readableState;return t.flowing||(c("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,n.nextTick(L,t,e))}(this,t)),t.paused=!1,this},T.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},T.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",(function(){if(c("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(c("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<S.length;o++)t.on(S[o],this.emit.bind(this,S[o]));return this._read=function(e){c("wrapped _read",e),n&&(n=!1,t.resume())},this},"function"==typeof Symbol&&(T.prototype[Symbol.asyncIterator]=function(){return void 0===d&&(d=r(304)),d(this)}),Object.defineProperty(T.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(T.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(T.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),T._fromList=B,Object.defineProperty(T.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(T.from=function(t,e){return void 0===h&&(h=r(305)),h(T,t,e)})}).call(this,r(33),r(25))},function(t,e,r){t.exports=r(54).EventEmitter},function(t,e,r){"use strict";(function(e){function r(t,e){i(t,e),n(t)}function n(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function i(t,e){t.emit("error",e)}t.exports={destroy:function(t,o){var a=this,s=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return s||u?(o?o(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(i,this,t)):e.nextTick(i,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!o&&t?a._writableState?a._writableState.errorEmitted?e.nextTick(n,a):(a._writableState.errorEmitted=!0,e.nextTick(r,a,t)):e.nextTick(r,a,t):o?(e.nextTick(n,a),o(t)):e.nextTick(n,a)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}}}).call(this,r(25))},function(t,e,r){"use strict";var n=r(70).codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,r,i){var o=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},function(t,e,r){"use strict";(function(e,n){function i(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}var o;t.exports=T,T.WritableState=O;var a={deprecate:r(116)},s=r(167),u=r(16).Buffer,c=e.Uint8Array||function(){};var l,f=r(168),d=r(169).getHighWaterMark,h=r(70).codes,g=h.ERR_INVALID_ARG_TYPE,p=h.ERR_METHOD_NOT_IMPLEMENTED,m=h.ERR_MULTIPLE_CALLBACK,y=h.ERR_STREAM_CANNOT_PIPE,b=h.ERR_STREAM_DESTROYED,_=h.ERR_STREAM_NULL_VALUES,v=h.ERR_STREAM_WRITE_AFTER_END,w=h.ERR_UNKNOWN_ENCODING,E=f.errorOrDestroy;function S(){}function O(t,e,a){o=o||r(71),t=t||{},"boolean"!=typeof a&&(a=e instanceof o),this.objectMode=!!t.objectMode,a&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=d(this,t,"writableHighWaterMark",a),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===t.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,o=r.writecb;if("function"!=typeof o)throw new m;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,o){--e.pendingcb,r?(n.nextTick(o,i),n.nextTick(k,t,e),t._writableState.errorEmitted=!0,E(t,i)):(o(i),t._writableState.errorEmitted=!0,E(t,i),k(t,e))}(t,r,i,e,o);else{var a=R(r)||t.destroyed;a||r.corked||r.bufferProcessing||!r.bufferedRequest||I(t,r),i?n.nextTick(M,t,r,a,o):M(t,r,a,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function T(t){var e=this instanceof(o=o||r(71));if(!e&&!l.call(T,this))return new T(t);this._writableState=new O(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),s.call(this)}function A(t,e,r,n,i,o,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new b("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function M(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),k(t,e)}function I(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,o=new Array(n),a=e.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)o[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;o.allBuffers=u,A(t,e,!0,e.length,o,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new i(e),e.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,l=r.encoding,f=r.callback;if(A(t,e,!1,e.objectMode?1:c.length,c,l,f),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function R(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function N(t,e){t._final((function(r){e.pendingcb--,r&&E(t,r),e.prefinished=!0,t.emit("prefinish"),k(t,e)}))}function k(t,e){var r=R(e);if(r&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,n.nextTick(N,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}r(12)(T,s),O.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(O.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(l=Function.prototype[Symbol.hasInstance],Object.defineProperty(T,Symbol.hasInstance,{value:function(t){return!!l.call(this,t)||this===T&&(t&&t._writableState instanceof O)}})):l=function(t){return t instanceof this},T.prototype.pipe=function(){E(this,new y)},T.prototype.write=function(t,e,r){var i,o=this._writableState,a=!1,s=!o.objectMode&&(i=t,u.isBuffer(i)||i instanceof c);return s&&!u.isBuffer(t)&&(t=function(t){return u.from(t)}(t)),"function"==typeof e&&(r=e,e=null),s?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof r&&(r=S),o.ending?function(t,e){var r=new v;E(t,r),n.nextTick(e,r)}(this,r):(s||function(t,e,r,i){var o;return null===r?o=new _:"string"==typeof r||e.objectMode||(o=new g("chunk",["string","Buffer"],r)),!o||(E(t,o),n.nextTick(i,o),!1)}(this,o,t,r))&&(o.pendingcb++,a=function(t,e,r,n,i,o){if(!r){var a=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=u.from(e,r));return e}(e,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=e.objectMode?1:n.length;e.length+=s;var c=e.length<e.highWaterMark;c||(e.needDrain=!0);if(e.writing||e.corked){var l=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},l?l.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else A(t,e,!1,s,n,i,o);return c}(this,o,s,t,e,r)),a},T.prototype.cork=function(){this._writableState.corked++},T.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||I(this,t))},T.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new w(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(T.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),T.prototype._write=function(t,e,r){r(new p("_write()"))},T.prototype._writev=null,T.prototype.end=function(t,e,r){var i=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,r){e.ending=!0,k(t,e),r&&(e.finished?n.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),T.prototype.destroy=f.destroy,T.prototype._undestroy=f.undestroy,T.prototype._destroy=function(t,e){e(t)}}).call(this,r(33),r(25))},function(t,e,r){"use strict";t.exports=l;var n=r(70).codes,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,a=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=n.ERR_TRANSFORM_WITH_LENGTH_0,u=r(71);function c(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function l(t){if(!(this instanceof l))return new l(t);u.call(this,t),this._transformState={afterTransform:c.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",f)}function f(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?d(this,null,null):this._flush((function(e,r){d(t,e,r)}))}function d(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new s;if(t._transformState.transforming)throw new a;return t.push(null)}r(12)(l,u),l.prototype.push=function(t,e){return this._transformState.needTransform=!1,u.prototype.push.call(this,t,e)},l.prototype._transform=function(t,e,r){r(new i("_transform()"))},l.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},l.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},l.prototype._destroy=function(t,e){u.prototype._destroy.call(this,t,(function(t){e(t)}))}},function(t,e,r){var n=r(12),i=r(72),o=r(19).Buffer,a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function u(){this.init(),this._w=s,i.call(this,64,56)}function c(t,e,r){return r^t&(e^r)}function l(t,e,r){return t&e|r&(t|e)}function f(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function d(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function h(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}n(u,i),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,g=0|this._f,p=0|this._g,m=0|this._h,y=0;y<16;++y)r[y]=t.readInt32BE(4*y);for(;y<64;++y)r[y]=0|(((e=r[y-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[y-7]+h(r[y-15])+r[y-16];for(var b=0;b<64;++b){var _=m+d(u)+c(u,g,p)+a[b]+r[b]|0,v=f(n)+l(n,i,o)|0;m=p,p=g,g=u,u=s+_|0,s=o,o=i,i=n,n=_+v|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0,this._f=g+this._f|0,this._g=p+this._g|0,this._h=m+this._h|0},u.prototype._hash=function(){var t=o.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=u},function(t,e,r){var n=r(12),i=r(72),o=r(19).Buffer,a=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function u(){this.init(),this._w=s,i.call(this,128,112)}function c(t,e,r){return r^t&(e^r)}function l(t,e,r){return t&e|r&(t|e)}function f(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function d(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function h(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function g(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function p(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function y(t,e){return t>>>0<e>>>0?1:0}n(u,i),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(t){for(var e=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,s=0|this._eh,u=0|this._fh,b=0|this._gh,_=0|this._hh,v=0|this._al,w=0|this._bl,E=0|this._cl,S=0|this._dl,O=0|this._el,T=0|this._fl,A=0|this._gl,M=0|this._hl,I=0;I<32;I+=2)e[I]=t.readInt32BE(4*I),e[I+1]=t.readInt32BE(4*I+4);for(;I<160;I+=2){var R=e[I-30],N=e[I-30+1],k=h(R,N),D=g(N,R),j=p(R=e[I-4],N=e[I-4+1]),C=m(N,R),L=e[I-14],x=e[I-14+1],B=e[I-32],U=e[I-32+1],F=D+x|0,P=k+L+y(F,D)|0;P=(P=P+j+y(F=F+C|0,C)|0)+B+y(F=F+U|0,U)|0,e[I]=P,e[I+1]=F}for(var W=0;W<160;W+=2){P=e[W],F=e[W+1];var z=l(r,n,i),H=l(v,w,E),q=f(r,v),V=f(v,r),G=d(s,O),Y=d(O,s),$=a[W],K=a[W+1],Z=c(s,u,b),J=c(O,T,A),X=M+Y|0,Q=_+G+y(X,M)|0;Q=(Q=(Q=Q+Z+y(X=X+J|0,J)|0)+$+y(X=X+K|0,K)|0)+P+y(X=X+F|0,F)|0;var tt=V+H|0,et=q+z+y(tt,V)|0;_=b,M=A,b=u,A=T,u=s,T=O,s=o+Q+y(O=S+X|0,S)|0,o=i,S=E,i=n,E=w,n=r,w=v,r=Q+et+y(v=X+tt|0,X)|0}this._al=this._al+v|0,this._bl=this._bl+w|0,this._cl=this._cl+E|0,this._dl=this._dl+S|0,this._el=this._el+O|0,this._fl=this._fl+T|0,this._gl=this._gl+A|0,this._hl=this._hl+M|0,this._ah=this._ah+r+y(this._al,v)|0,this._bh=this._bh+n+y(this._bl,w)|0,this._ch=this._ch+i+y(this._cl,E)|0,this._dh=this._dh+o+y(this._dl,S)|0,this._eh=this._eh+s+y(this._el,O)|0,this._fh=this._fh+u+y(this._fl,T)|0,this._gh=this._gh+b+y(this._gl,A)|0,this._hh=this._hh+_+y(this._hl,M)|0},u.prototype._hash=function(){var t=o.allocUnsafe(64);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=u},function(t,e,r){"use strict";var n=r(12),i=r(312),o=r(57),a=r(19).Buffer,s=r(175),u=r(119),c=r(120),l=a.alloc(128);function f(t,e){o.call(this,"digest"),"string"==typeof e&&(e=a.from(e));var r="sha512"===t||"sha384"===t?128:64;(this._alg=t,this._key=e,e.length>r)?e=("rmd160"===t?new u:c(t)).update(e).digest():e.length<r&&(e=a.concat([e,l],r));for(var n=this._ipad=a.allocUnsafe(r),i=this._opad=a.allocUnsafe(r),s=0;s<r;s++)n[s]=54^e[s],i[s]=92^e[s];this._hash="rmd160"===t?new u:c(t),this._hash.update(n)}n(f,o),f.prototype._update=function(t){this._hash.update(t)},f.prototype._final=function(){var t=this._hash.digest();return("rmd160"===this._alg?new u:c(this._alg)).update(this._opad).update(t).digest()},t.exports=function(t,e){return"rmd160"===(t=t.toLowerCase())||"ripemd160"===t?new f("rmd160",e):"md5"===t?new i(s,e):new f(t,e)}},function(t,e,r){var n=r(117);t.exports=function(t){return(new n).update(t).digest()}},function(t){t.exports=JSON.parse('{"sha224WithRSAEncryption":{"sign":"rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"RSA-SHA224":{"sign":"ecdsa/rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"sha256WithRSAEncryption":{"sign":"rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"RSA-SHA256":{"sign":"ecdsa/rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"sha384WithRSAEncryption":{"sign":"rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"RSA-SHA384":{"sign":"ecdsa/rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"sha512WithRSAEncryption":{"sign":"rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA512":{"sign":"ecdsa/rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA1":{"sign":"rsa","hash":"sha1","id":"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{"sign":"ecdsa","hash":"sha1","id":""},"sha256":{"sign":"ecdsa","hash":"sha256","id":""},"sha224":{"sign":"ecdsa","hash":"sha224","id":""},"sha384":{"sign":"ecdsa","hash":"sha384","id":""},"sha512":{"sign":"ecdsa","hash":"sha512","id":""},"DSA-SHA":{"sign":"dsa","hash":"sha1","id":""},"DSA-SHA1":{"sign":"dsa","hash":"sha1","id":""},"DSA":{"sign":"dsa","hash":"sha1","id":""},"DSA-WITH-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-WITH-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-WITH-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-WITH-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-RIPEMD160":{"sign":"dsa","hash":"rmd160","id":""},"ripemd160WithRSA":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"RSA-RIPEMD160":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"md5WithRSAEncryption":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"},"RSA-MD5":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"}}')},function(t,e,r){e.pbkdf2=r(314),e.pbkdf2Sync=r(180)},function(t,e){var r=Math.pow(2,30)-1;t.exports=function(t,e){if("number"!=typeof t)throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if("number"!=typeof e)throw new TypeError("Key length not a number");if(e<0||e>r||e!=e)throw new TypeError("Bad key length")}},function(t,e,r){(function(e,r){var n;if(e.process&&e.process.browser)n="utf-8";else if(e.process&&e.process.version){n=parseInt(r.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else n="utf-8";t.exports=n}).call(this,r(33),r(25))},function(t,e,r){var n=r(175),i=r(119),o=r(120),a=r(19).Buffer,s=r(178),u=r(179),c=r(181),l=a.alloc(128),f={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function d(t,e,r){var s=function(t){function e(e){return o(t).update(e).digest()}return"rmd160"===t||"ripemd160"===t?function(t){return(new i).update(t).digest()}:"md5"===t?n:e}(t),u="sha512"===t||"sha384"===t?128:64;e.length>u?e=s(e):e.length<u&&(e=a.concat([e,l],u));for(var c=a.allocUnsafe(u+f[t]),d=a.allocUnsafe(u+f[t]),h=0;h<u;h++)c[h]=54^e[h],d[h]=92^e[h];var g=a.allocUnsafe(u+r+4);c.copy(g,0,0,u),this.ipad1=g,this.ipad2=c,this.opad=d,this.alg=t,this.blocksize=u,this.hash=s,this.size=f[t]}d.prototype.run=function(t,e){return t.copy(e,this.blocksize),this.hash(e).copy(this.opad,this.blocksize),this.hash(this.opad)},t.exports=function(t,e,r,n,i){s(r,n);var o=new d(i=i||"sha1",t=c(t,u,"Password"),(e=c(e,u,"Salt")).length),l=a.allocUnsafe(n),h=a.allocUnsafe(e.length+4);e.copy(h,0,0,e.length);for(var g=0,p=f[i],m=Math.ceil(n/p),y=1;y<=m;y++){h.writeUInt32BE(y,e.length);for(var b=o.run(h,o.ipad1),_=b,v=1;v<r;v++){_=o.run(_,o.ipad2);for(var w=0;w<p;w++)b[w]^=_[w]}b.copy(l,g),g+=p}return l}},function(t,e,r){var n=r(19).Buffer;t.exports=function(t,e,r){if(n.isBuffer(t))return t;if("string"==typeof t)return n.from(t,e);if(ArrayBuffer.isView(t))return n.from(t.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")}},function(t,e,r){"use strict";e.readUInt32BE=function(t,e){return(t[0+e]<<24|t[1+e]<<16|t[2+e]<<8|t[3+e])>>>0},e.writeUInt32BE=function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},e.ip=function(t,e,r,n){for(var i=0,o=0,a=6;a>=0;a-=2){for(var s=0;s<=24;s+=8)i<<=1,i|=e>>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=t>>>s+a&1}for(a=6;a>=0;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1}r[n+0]=i>>>0,r[n+1]=o>>>0},e.rip=function(t,e,r,n){for(var i=0,o=0,a=0;a<4;a++)for(var s=24;s>=0;s-=8)i<<=1,i|=e>>>s+a&1,i<<=1,i|=t>>>s+a&1;for(a=4;a<8;a++)for(s=24;s>=0;s-=8)o<<=1,o|=e>>>s+a&1,o<<=1,o|=t>>>s+a&1;r[n+0]=i>>>0,r[n+1]=o>>>0},e.pc1=function(t,e,r,n){for(var i=0,o=0,a=7;a>=5;a--){for(var s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1}for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;r[n+0]=i>>>0,r[n+1]=o>>>0},e.r28shl=function(t,e){return t<<e&268435455|t>>>28-e};var n=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];e.pc2=function(t,e,r,i){for(var o=0,a=0,s=n.length>>>1,u=0;u<s;u++)o<<=1,o|=t>>>n[u]&1;for(u=s;u<n.length;u++)a<<=1,a|=e>>>n[u]&1;r[i+0]=o>>>0,r[i+1]=a>>>0},e.expand=function(t,e,r){var n=0,i=0;n=(1&t)<<5|t>>>27;for(var o=23;o>=15;o-=4)n<<=6,n|=t>>>o&63;for(o=11;o>=3;o-=4)i|=t>>>o&63,i<<=6;i|=(31&t)<<1|t>>>31,e[r+0]=n>>>0,e[r+1]=i>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];e.substitute=function(t,e){for(var r=0,n=0;n<4;n++){r<<=4,r|=i[64*n+(t>>>18-6*n&63)]}for(n=0;n<4;n++){r<<=4,r|=i[256+64*n+(e>>>18-6*n&63)]}return r>>>0};var o=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];e.permute=function(t){for(var e=0,r=0;r<o.length;r++)e<<=1,e|=t>>>o[r]&1;return e>>>0},e.padSplit=function(t,e,r){for(var n=t.toString(2);n.length<e;)n="0"+n;for(var i=[],o=0;o<e;o+=r)i.push(n.slice(o,o+r));return i.join(" ")}},function(t,e,r){"use strict";var n=r(46),i=r(12),o=r(182),a=r(121);function s(){this.tmp=new Array(2),this.keys=null}function u(t){a.call(this,t);var e=new s;this._desState=e,this.deriveKeys(e,t.key)}i(u,a),t.exports=u,u.create=function(t){return new u(t)};var c=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];u.prototype.deriveKeys=function(t,e){t.keys=new Array(32),n.equal(e.length,this.blockSize,"Invalid key length");var r=o.readUInt32BE(e,0),i=o.readUInt32BE(e,4);o.pc1(r,i,t.tmp,0),r=t.tmp[0],i=t.tmp[1];for(var a=0;a<t.keys.length;a+=2){var s=c[a>>>1];r=o.r28shl(r,s),i=o.r28shl(i,s),o.pc2(r,i,t.keys,a)}},u.prototype._update=function(t,e,r,n){var i=this._desState,a=o.readUInt32BE(t,e),s=o.readUInt32BE(t,e+4);o.ip(a,s,i.tmp,0),a=i.tmp[0],s=i.tmp[1],"encrypt"===this.type?this._encrypt(i,a,s,i.tmp,0):this._decrypt(i,a,s,i.tmp,0),a=i.tmp[0],s=i.tmp[1],o.writeUInt32BE(r,a,n),o.writeUInt32BE(r,s,n+4)},u.prototype._pad=function(t,e){for(var r=t.length-e,n=e;n<t.length;n++)t[n]=r;return!0},u.prototype._unpad=function(t){for(var e=t[t.length-1],r=t.length-e;r<t.length;r++)n.equal(t[r],e);return t.slice(0,t.length-e)},u.prototype._encrypt=function(t,e,r,n,i){for(var a=e,s=r,u=0;u<t.keys.length;u+=2){var c=t.keys[u],l=t.keys[u+1];o.expand(s,t.tmp,0),c^=t.tmp[0],l^=t.tmp[1];var f=o.substitute(c,l),d=s;s=(a^o.permute(f))>>>0,a=d}o.rip(s,a,n,i)},u.prototype._decrypt=function(t,e,r,n,i){for(var a=r,s=e,u=t.keys.length-2;u>=0;u-=2){var c=t.keys[u],l=t.keys[u+1];o.expand(a,t.tmp,0),c^=t.tmp[0],l^=t.tmp[1];var f=o.substitute(c,l),d=a;a=(s^o.permute(f))>>>0,s=d}o.rip(a,s,n,i)}},function(t,e,r){var n=r(86),i=r(19).Buffer,o=r(185);function a(t){var e=t._cipher.encryptBlockRaw(t._prev);return o(t._prev),e}e.encrypt=function(t,e){var r=Math.ceil(e.length/16),o=t._cache.length;t._cache=i.concat([t._cache,i.allocUnsafe(16*r)]);for(var s=0;s<r;s++){var u=a(t),c=o+16*s;t._cache.writeUInt32BE(u[0],c+0),t._cache.writeUInt32BE(u[1],c+4),t._cache.writeUInt32BE(u[2],c+8),t._cache.writeUInt32BE(u[3],c+12)}var l=t._cache.slice(0,e.length);return t._cache=t._cache.slice(e.length),n(e,l)}},function(t,e){t.exports=function(t){for(var e,r=t.length;r--;){if(255!==(e=t.readUInt8(r))){e++,t.writeUInt8(e,r);break}t.writeUInt8(0,r)}}},function(t){t.exports=JSON.parse('{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}')},function(t,e,r){var n=r(102),i=r(19).Buffer,o=r(57),a=r(12),s=r(327),u=r(86),c=r(185);function l(t,e,r,a){o.call(this);var u=i.alloc(4,0);this._cipher=new n.AES(e);var l=this._cipher.encryptBlock(u);this._ghash=new s(l),r=function(t,e,r){if(12===e.length)return t._finID=i.concat([e,i.from([0,0,0,1])]),i.concat([e,i.from([0,0,0,2])]);var n=new s(r),o=e.length,a=o%16;n.update(e),a&&(a=16-a,n.update(i.alloc(a,0))),n.update(i.alloc(8,0));var u=8*o,l=i.alloc(8);l.writeUIntBE(u,0,8),n.update(l),t._finID=n.state;var f=i.from(t._finID);return c(f),f}(this,r,l),this._prev=i.from(r),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=a,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}a(l,o),l.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=i.alloc(e,0),this._ghash.update(e))}this._called=!0;var r=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(r),this._len+=t.length,r},l.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=u(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var r=0;t.length!==e.length&&r++;for(var n=Math.min(t.length,e.length),i=0;i<n;++i)r+=t[i]^e[i];return r}(t,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=t,this._cipher.scrub()},l.prototype.getAuthTag=function(){if(this._decrypt||!i.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},l.prototype.setAuthTag=function(t){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=t},l.prototype.setAAD=function(t){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(t),this._alen+=t.length},t.exports=l},function(t,e,r){var n=r(102),i=r(19).Buffer,o=r(57);function a(t,e,r,a){o.call(this),this._cipher=new n.AES(e),this._prev=i.from(r),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=a,this._mode=t}r(12)(a,o),a.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)},a.prototype._final=function(){this._cipher.scrub()},t.exports=a},function(t,e,r){var n=r(69);t.exports=b,b.simpleSieve=m,b.fermatTest=y;var i=r(39),o=new i(24),a=new(r(190)),s=new i(1),u=new i(2),c=new i(5),l=(new i(16),new i(8),new i(10)),f=new i(3),d=(new i(7),new i(11)),h=new i(4),g=(new i(12),null);function p(){if(null!==g)return g;var t=[];t[0]=2;for(var e=1,r=3;r<1048576;r+=2){for(var n=Math.ceil(Math.sqrt(r)),i=0;i<e&&t[i]<=n&&r%t[i]!=0;i++);e!==i&&t[i]<=n||(t[e++]=r)}return g=t,t}function m(t){for(var e=p(),r=0;r<e.length;r++)if(0===t.modn(e[r]))return 0===t.cmpn(e[r]);return!0}function y(t){var e=i.mont(t);return 0===u.toRed(e).redPow(t.subn(1)).fromRed().cmpn(1)}function b(t,e){if(t<16)return new i(2===e||5===e?[140,123]:[140,39]);var r,g;for(e=new i(e);;){for(r=new i(n(Math.ceil(t/8)));r.bitLength()>t;)r.ishrn(1);if(r.isEven()&&r.iadd(s),r.testn(1)||r.iadd(u),e.cmp(u)){if(!e.cmp(c))for(;r.mod(l).cmp(f);)r.iadd(h)}else for(;r.mod(o).cmp(d);)r.iadd(h);if(m(g=r.shrn(1))&&m(r)&&y(g)&&y(r)&&a.test(g)&&a.test(r))return r}}},function(t,e,r){var n=r(39),i=r(124);function o(t){this.rand=t||new i.Rand}t.exports=o,o.create=function(t){return new o(t)},o.prototype._randbelow=function(t){var e=t.bitLength(),r=Math.ceil(e/8);do{var i=new n(this.rand.generate(r))}while(i.cmp(t)>=0);return i},o.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},o.prototype.test=function(t,e,r){var i=t.bitLength(),o=n.mont(t),a=new n(1).toRed(o);e||(e=Math.max(1,i/48|0));for(var s=t.subn(1),u=0;!s.testn(u);u++);for(var c=t.shrn(u),l=s.toRed(o);e>0;e--){var f=this._randrange(new n(2),s);r&&r(f);var d=f.toRed(o).redPow(c);if(0!==d.cmp(a)&&0!==d.cmp(l)){for(var h=1;h<u;h++){if(0===(d=d.redSqr()).cmp(a))return!1;if(0===d.cmp(l))break}if(h===u)return!1}}return!0},o.prototype.getDivisor=function(t,e){var r=t.bitLength(),i=n.mont(t),o=new n(1).toRed(i);e||(e=Math.max(1,r/48|0));for(var a=t.subn(1),s=0;!a.testn(s);s++);for(var u=t.shrn(s),c=a.toRed(i);e>0;e--){var l=this._randrange(new n(2),a),f=t.gcd(l);if(0!==f.cmpn(1))return f;var d=l.toRed(i).redPow(u);if(0!==d.cmp(o)&&0!==d.cmp(c)){for(var h=1;h<s;h++){if(0===(d=d.redSqr()).cmp(o))return d.fromRed().subn(1).gcd(t);if(0===d.cmp(c))break}if(h===s)return(d=d.redSqr()).fromRed().subn(1).gcd(t)}}return!1}},function(t,e,r){"use strict";(function(e,n){var i;t.exports=T,T.ReadableState=O;r(54).EventEmitter;var o=function(t,e){return t.listeners(e).length},a=r(192),s=r(16).Buffer,u=e.Uint8Array||function(){};var c,l=r(337);c=l&&l.debuglog?l.debuglog("stream"):function(){};var f,d,h,g=r(338),p=r(193),m=r(194).getHighWaterMark,y=r(73).codes,b=y.ERR_INVALID_ARG_TYPE,_=y.ERR_STREAM_PUSH_AFTER_EOF,v=y.ERR_METHOD_NOT_IMPLEMENTED,w=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(12)(T,a);var E=p.errorOrDestroy,S=["error","close","destroy","pause","resume"];function O(t,e,n){i=i||r(74),t=t||{},"boolean"!=typeof n&&(n=e instanceof i),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=m(this,t,"readableHighWaterMark",n),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(f||(f=r(55).StringDecoder),this.decoder=new f(t.encoding),this.encoding=t.encoding)}function T(t){if(i=i||r(74),!(this instanceof T))return new T(t);var e=this instanceof i;this._readableState=new O(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function A(t,e,r,n,i){c("readableAddChunk",e);var o,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(c("onEofChunk"),e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?R(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,N(t)))}(t,a);else if(i||(o=function(t,e){var r;n=e,s.isBuffer(n)||n instanceof u||"string"==typeof e||void 0===e||t.objectMode||(r=new b("chunk",["string","Buffer","Uint8Array"],e));var n;return r}(a,e)),o)E(t,o);else if(a.objectMode||e&&e.length>0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),n)a.endEmitted?E(t,new w):M(t,a,e,!0);else if(a.ended)E(t,new _);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?M(t,a,e,!1):k(t,a)):M(t,a,e,!1)}else n||(a.reading=!1,k(t,a));return!a.ended&&(a.length<a.highWaterMark||0===a.length)}function M(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&R(t)),k(t,e)}Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),T.prototype.destroy=p.destroy,T.prototype._undestroy=p.undestroy,T.prototype._destroy=function(t,e){e(t)},T.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=s.from(t,e),e=""),r=!0),A(this,t,e,!1,r)},T.prototype.unshift=function(t){return A(this,t,null,!0,!1)},T.prototype.isPaused=function(){return!1===this._readableState.flowing},T.prototype.setEncoding=function(t){f||(f=r(55).StringDecoder);var e=new f(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=e.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};function I(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function R(t){var e=t._readableState;c("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(c("emitReadable",e.flowing),e.emittedReadable=!0,n.nextTick(N,t))}function N(t){var e=t._readableState;c("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,x(t)}function k(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(D,t,e))}function D(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(c("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function j(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function C(t){c("readable nexttick read 0"),t.read(0)}function L(t,e){c("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),x(t),e.flowing&&!e.reading&&t.read(0)}function x(t){var e=t._readableState;for(c("flow",e.flowing);e.flowing&&null!==t.read(););}function B(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function U(t){var e=t._readableState;c("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,n.nextTick(F,e,t))}function F(t,e){if(c("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function P(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}T.prototype.read=function(t){c("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return c("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?U(this):R(this),null;if(0===(t=I(t,e))&&e.ended)return 0===e.length&&U(this),null;var n,i=e.needReadable;return c("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&c("length less than watermark",i=!0),e.ended||e.reading?c("reading or ended",i=!1):i&&(c("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=I(r,e))),null===(n=t>0?B(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&U(this)),null!==n&&this.emit("data",n),n},T.prototype._read=function(t){E(this,new v("_read()"))},T.prototype.pipe=function(t,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,c("pipe count=%d opts=%j",i.pipesCount,e);var a=(!e||!1!==e.end)&&t!==n.stdout&&t!==n.stderr?u:m;function s(e,n){c("onunpipe"),e===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,c("cleanup"),t.removeListener("close",g),t.removeListener("finish",p),t.removeListener("drain",l),t.removeListener("error",h),t.removeListener("unpipe",s),r.removeListener("end",u),r.removeListener("end",m),r.removeListener("data",d),f=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}function u(){c("onend"),t.end()}i.endEmitted?n.nextTick(a):r.once("end",a),t.on("unpipe",s);var l=function(t){return function(){var e=t._readableState;c("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,x(t))}}(r);t.on("drain",l);var f=!1;function d(e){c("ondata");var n=t.write(e);c("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==P(i.pipes,t))&&!f&&(c("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function h(e){c("onerror",e),m(),t.removeListener("error",h),0===o(t,"error")&&E(t,e)}function g(){t.removeListener("finish",p),m()}function p(){c("onfinish"),t.removeListener("close",g),m()}function m(){c("unpipe"),r.unpipe(t)}return r.on("data",d),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",h),t.once("close",g),t.once("finish",p),t.emit("pipe",r),i.flowing||(c("pipe resume"),r.resume()),t},T.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=P(e.pipes,t);return-1===a||(e.pipes.splice(a,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},T.prototype.on=function(t,e){var r=a.prototype.on.call(this,t,e),i=this._readableState;return"data"===t?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,c("on readable",i.length,i.reading),i.length?R(this):i.reading||n.nextTick(C,this))),r},T.prototype.addListener=T.prototype.on,T.prototype.removeListener=function(t,e){var r=a.prototype.removeListener.call(this,t,e);return"readable"===t&&n.nextTick(j,this),r},T.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||n.nextTick(j,this),e},T.prototype.resume=function(){var t=this._readableState;return t.flowing||(c("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,n.nextTick(L,t,e))}(this,t)),t.paused=!1,this},T.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},T.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",(function(){if(c("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(c("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<S.length;o++)t.on(S[o],this.emit.bind(this,S[o]));return this._read=function(e){c("wrapped _read",e),n&&(n=!1,t.resume())},this},"function"==typeof Symbol&&(T.prototype[Symbol.asyncIterator]=function(){return void 0===d&&(d=r(340)),d(this)}),Object.defineProperty(T.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(T.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(T.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),T._fromList=B,Object.defineProperty(T.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(T.from=function(t,e){return void 0===h&&(h=r(341)),h(T,t,e)})}).call(this,r(33),r(25))},function(t,e,r){t.exports=r(54).EventEmitter},function(t,e,r){"use strict";(function(e){function r(t,e){i(t,e),n(t)}function n(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function i(t,e){t.emit("error",e)}t.exports={destroy:function(t,o){var a=this,s=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return s||u?(o?o(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(i,this,t)):e.nextTick(i,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!o&&t?a._writableState?a._writableState.errorEmitted?e.nextTick(n,a):(a._writableState.errorEmitted=!0,e.nextTick(r,a,t)):e.nextTick(r,a,t):o?(e.nextTick(n,a),o(t)):e.nextTick(n,a)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}}}).call(this,r(25))},function(t,e,r){"use strict";var n=r(73).codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,r,i){var o=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},function(t,e,r){"use strict";(function(e,n){function i(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}var o;t.exports=T,T.WritableState=O;var a={deprecate:r(116)},s=r(192),u=r(16).Buffer,c=e.Uint8Array||function(){};var l,f=r(193),d=r(194).getHighWaterMark,h=r(73).codes,g=h.ERR_INVALID_ARG_TYPE,p=h.ERR_METHOD_NOT_IMPLEMENTED,m=h.ERR_MULTIPLE_CALLBACK,y=h.ERR_STREAM_CANNOT_PIPE,b=h.ERR_STREAM_DESTROYED,_=h.ERR_STREAM_NULL_VALUES,v=h.ERR_STREAM_WRITE_AFTER_END,w=h.ERR_UNKNOWN_ENCODING,E=f.errorOrDestroy;function S(){}function O(t,e,a){o=o||r(74),t=t||{},"boolean"!=typeof a&&(a=e instanceof o),this.objectMode=!!t.objectMode,a&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=d(this,t,"writableHighWaterMark",a),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===t.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,o=r.writecb;if("function"!=typeof o)throw new m;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,o){--e.pendingcb,r?(n.nextTick(o,i),n.nextTick(k,t,e),t._writableState.errorEmitted=!0,E(t,i)):(o(i),t._writableState.errorEmitted=!0,E(t,i),k(t,e))}(t,r,i,e,o);else{var a=R(r)||t.destroyed;a||r.corked||r.bufferProcessing||!r.bufferedRequest||I(t,r),i?n.nextTick(M,t,r,a,o):M(t,r,a,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function T(t){var e=this instanceof(o=o||r(74));if(!e&&!l.call(T,this))return new T(t);this._writableState=new O(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),s.call(this)}function A(t,e,r,n,i,o,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new b("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function M(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),k(t,e)}function I(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,o=new Array(n),a=e.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)o[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;o.allBuffers=u,A(t,e,!0,e.length,o,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new i(e),e.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,l=r.encoding,f=r.callback;if(A(t,e,!1,e.objectMode?1:c.length,c,l,f),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function R(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function N(t,e){t._final((function(r){e.pendingcb--,r&&E(t,r),e.prefinished=!0,t.emit("prefinish"),k(t,e)}))}function k(t,e){var r=R(e);if(r&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,n.nextTick(N,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}r(12)(T,s),O.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(O.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(l=Function.prototype[Symbol.hasInstance],Object.defineProperty(T,Symbol.hasInstance,{value:function(t){return!!l.call(this,t)||this===T&&(t&&t._writableState instanceof O)}})):l=function(t){return t instanceof this},T.prototype.pipe=function(){E(this,new y)},T.prototype.write=function(t,e,r){var i,o=this._writableState,a=!1,s=!o.objectMode&&(i=t,u.isBuffer(i)||i instanceof c);return s&&!u.isBuffer(t)&&(t=function(t){return u.from(t)}(t)),"function"==typeof e&&(r=e,e=null),s?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof r&&(r=S),o.ending?function(t,e){var r=new v;E(t,r),n.nextTick(e,r)}(this,r):(s||function(t,e,r,i){var o;return null===r?o=new _:"string"==typeof r||e.objectMode||(o=new g("chunk",["string","Buffer"],r)),!o||(E(t,o),n.nextTick(i,o),!1)}(this,o,t,r))&&(o.pendingcb++,a=function(t,e,r,n,i,o){if(!r){var a=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=u.from(e,r));return e}(e,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=e.objectMode?1:n.length;e.length+=s;var c=e.length<e.highWaterMark;c||(e.needDrain=!0);if(e.writing||e.corked){var l=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},l?l.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else A(t,e,!1,s,n,i,o);return c}(this,o,s,t,e,r)),a},T.prototype.cork=function(){this._writableState.corked++},T.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||I(this,t))},T.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new w(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(T.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),T.prototype._write=function(t,e,r){r(new p("_write()"))},T.prototype._writev=null,T.prototype.end=function(t,e,r){var i=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,r){e.ending=!0,k(t,e),r&&(e.finished?n.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),T.prototype.destroy=f.destroy,T.prototype._undestroy=f.undestroy,T.prototype._destroy=function(t,e){e(t)}}).call(this,r(33),r(25))},function(t,e,r){"use strict";t.exports=l;var n=r(73).codes,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,a=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=n.ERR_TRANSFORM_WITH_LENGTH_0,u=r(74);function c(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function l(t){if(!(this instanceof l))return new l(t);u.call(this,t),this._transformState={afterTransform:c.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",f)}function f(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?d(this,null,null):this._flush((function(e,r){d(t,e,r)}))}function d(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new s;if(t._transformState.transforming)throw new a;return t.push(null)}r(12)(l,u),l.prototype.push=function(t,e){return this._transformState.needTransform=!1,u.prototype.push.call(this,t,e)},l.prototype._transform=function(t,e,r){r(new i("_transform()"))},l.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},l.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},l.prototype._destroy=function(t,e){u.prototype._destroy.call(this,t,(function(t){e(t)}))}},function(t,e,r){"use strict";var n=e;function i(t){return 1===t.length?"0"+t:t}function o(t){for(var e="",r=0;r<t.length;r++)e+=i(t[r].toString(16));return e}n.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var n=0;n<t.length;n++)r[n]=0|t[n];return r}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(n=0;n<t.length;n++){var i=t.charCodeAt(n),o=i>>8,a=255&i;o?r.push(o,a):r.push(a)}return r},n.zero2=i,n.toHex=o,n.encode=function(t,e){return"hex"===e?o(t):t}},function(t,e,r){"use strict";var n=e;n.base=r(104),n.short=r(348),n.mont=r(349),n.edwards=r(350)},function(t,e,r){"use strict";var n=r(49).rotr32;function i(t,e,r){return t&e^~t&r}function o(t,e,r){return t&e^t&r^e&r}function a(t,e,r){return t^e^r}e.ft_1=function(t,e,r,n){return 0===t?i(e,r,n):1===t||3===t?a(e,r,n):2===t?o(e,r,n):void 0},e.ch32=i,e.maj32=o,e.p32=a,e.s0_256=function(t){return n(t,2)^n(t,13)^n(t,22)},e.s1_256=function(t){return n(t,6)^n(t,11)^n(t,25)},e.g0_256=function(t){return n(t,7)^n(t,18)^t>>>3},e.g1_256=function(t){return n(t,17)^n(t,19)^t>>>10}},function(t,e,r){"use strict";var n=r(49),i=r(87),o=r(199),a=r(46),s=n.sum32,u=n.sum32_4,c=n.sum32_5,l=o.ch32,f=o.maj32,d=o.s0_256,h=o.s1_256,g=o.g0_256,p=o.g1_256,m=i.BlockHash,y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function b(){if(!(this instanceof b))return new b;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=y,this.W=new Array(64)}n.inherits(b,m),t.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=u(p(r[n-2]),r[n-7],g(r[n-15]),r[n-16]);var i=this.h[0],o=this.h[1],m=this.h[2],y=this.h[3],b=this.h[4],_=this.h[5],v=this.h[6],w=this.h[7];for(a(this.k.length===r.length),n=0;n<r.length;n++){var E=c(w,h(b),l(b,_,v),this.k[n],r[n]),S=s(d(i),f(i,o,m));w=v,v=_,_=b,b=s(y,E),y=m,m=o,o=i,i=s(E,S)}this.h[0]=s(this.h[0],i),this.h[1]=s(this.h[1],o),this.h[2]=s(this.h[2],m),this.h[3]=s(this.h[3],y),this.h[4]=s(this.h[4],b),this.h[5]=s(this.h[5],_),this.h[6]=s(this.h[6],v),this.h[7]=s(this.h[7],w)},b.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},function(t,e,r){"use strict";var n=r(49),i=r(87),o=r(46),a=n.rotr64_hi,s=n.rotr64_lo,u=n.shr64_hi,c=n.shr64_lo,l=n.sum64,f=n.sum64_hi,d=n.sum64_lo,h=n.sum64_4_hi,g=n.sum64_4_lo,p=n.sum64_5_hi,m=n.sum64_5_lo,y=i.BlockHash,b=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function _(){if(!(this instanceof _))return new _;y.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=b,this.W=new Array(160)}function v(t,e,r,n,i){var o=t&r^~t&i;return o<0&&(o+=4294967296),o}function w(t,e,r,n,i,o){var a=e&n^~e&o;return a<0&&(a+=4294967296),a}function E(t,e,r,n,i){var o=t&r^t&i^r&i;return o<0&&(o+=4294967296),o}function S(t,e,r,n,i,o){var a=e&n^e&o^n&o;return a<0&&(a+=4294967296),a}function O(t,e){var r=a(t,e,28)^a(e,t,2)^a(e,t,7);return r<0&&(r+=4294967296),r}function T(t,e){var r=s(t,e,28)^s(e,t,2)^s(e,t,7);return r<0&&(r+=4294967296),r}function A(t,e){var r=a(t,e,14)^a(t,e,18)^a(e,t,9);return r<0&&(r+=4294967296),r}function M(t,e){var r=s(t,e,14)^s(t,e,18)^s(e,t,9);return r<0&&(r+=4294967296),r}function I(t,e){var r=a(t,e,1)^a(t,e,8)^u(t,e,7);return r<0&&(r+=4294967296),r}function R(t,e){var r=s(t,e,1)^s(t,e,8)^c(t,e,7);return r<0&&(r+=4294967296),r}function N(t,e){var r=a(t,e,19)^a(e,t,29)^u(t,e,6);return r<0&&(r+=4294967296),r}function k(t,e){var r=s(t,e,19)^s(e,t,29)^c(t,e,6);return r<0&&(r+=4294967296),r}n.inherits(_,y),t.exports=_,_.blockSize=1024,_.outSize=512,_.hmacStrength=192,_.padLength=128,_.prototype._prepareBlock=function(t,e){for(var r=this.W,n=0;n<32;n++)r[n]=t[e+n];for(;n<r.length;n+=2){var i=N(r[n-4],r[n-3]),o=k(r[n-4],r[n-3]),a=r[n-14],s=r[n-13],u=I(r[n-30],r[n-29]),c=R(r[n-30],r[n-29]),l=r[n-32],f=r[n-31];r[n]=h(i,o,a,s,u,c,l,f),r[n+1]=g(i,o,a,s,u,c,l,f)}},_.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,n=this.h[0],i=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4],c=this.h[5],h=this.h[6],g=this.h[7],y=this.h[8],b=this.h[9],_=this.h[10],I=this.h[11],R=this.h[12],N=this.h[13],k=this.h[14],D=this.h[15];o(this.k.length===r.length);for(var j=0;j<r.length;j+=2){var C=k,L=D,x=A(y,b),B=M(y,b),U=v(y,b,_,I,R),F=w(y,b,_,I,R,N),P=this.k[j],W=this.k[j+1],z=r[j],H=r[j+1],q=p(C,L,x,B,U,F,P,W,z,H),V=m(C,L,x,B,U,F,P,W,z,H);C=O(n,i),L=T(n,i),x=E(n,i,a,s,u),B=S(n,i,a,s,u,c);var G=f(C,L,x,B),Y=d(C,L,x,B);k=R,D=N,R=_,N=I,_=y,I=b,y=f(h,g,q,V),b=d(g,g,q,V),h=u,g=c,u=a,c=s,a=n,s=i,n=f(q,V,G,Y),i=d(q,V,G,Y)}l(this.h,0,n,i),l(this.h,2,a,s),l(this.h,4,u,c),l(this.h,6,h,g),l(this.h,8,y,b),l(this.h,10,_,I),l(this.h,12,R,N),l(this.h,14,k,D)},_.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},function(t,e,r){(function(t){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(365).Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function c(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u<s;u++){var c=t.charCodeAt(u)-48;o*=i,a=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a<i,"Invalid character"),o+=a}return o}function l(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,a=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=u(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,l=r;l<s;l+=n)u=c(t,l,l+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var f=1;for(u=c(t,l,t.length,e),l=0;l<a;l++)f*=e;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype._move=function(t){l(t,this)},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch(t){o.prototype.inspect=f}else o.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],g=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);r=0!==(o=s>>>24-i&16777215)||a!==this.length-1?d[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=h[t],l=g[t];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var p=f.modrn(l).toString(t);r=(f=f.idivn(l)).isZero()?p+r:d[c-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(a,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c<n;c++){for(var l=u>>>26,f=67108863&u,d=Math.min(c,e.length-1),h=Math.max(0,c-t.length+1);h<=d;h++){var g=c-h|0;l+=(a=(i=0|t.words[g])*(o=0|e.words[h])+f)/67108864|0,f=67108863&a}r.words[c]=0|f,u=0|l}return 0!==u?r.words[c]=0|u:r.length--,r._strip()}o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|n;t[r++]=255&a,r<t.length&&(t[r++]=a>>8&255),r<t.length&&(t[r++]=a>>16&255),6===o?(r<t.length&&(t[r++]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},o.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|n;t[r--]=255&a,r>=0&&(t[r--]=a>>8&255),r>=0&&(t[r--]=a>>16&255),6===o?(r>=0&&(t[r--]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a<n.length;a++)o=(e=(0|r.words[a])-(0|n.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,o,a=t.words,s=e.words,u=r.words,c=0,l=0|a[0],f=8191&l,d=l>>>13,h=0|a[1],g=8191&h,p=h>>>13,m=0|a[2],y=8191&m,b=m>>>13,_=0|a[3],v=8191&_,w=_>>>13,E=0|a[4],S=8191&E,O=E>>>13,T=0|a[5],A=8191&T,M=T>>>13,I=0|a[6],R=8191&I,N=I>>>13,k=0|a[7],D=8191&k,j=k>>>13,C=0|a[8],L=8191&C,x=C>>>13,B=0|a[9],U=8191&B,F=B>>>13,P=0|s[0],W=8191&P,z=P>>>13,H=0|s[1],q=8191&H,V=H>>>13,G=0|s[2],Y=8191&G,$=G>>>13,K=0|s[3],Z=8191&K,J=K>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ft=8191<,dt=lt>>>13,ht=0|s[9],gt=8191&ht,pt=ht>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(c+(n=Math.imul(f,W))|0)+((8191&(i=(i=Math.imul(f,z))+Math.imul(d,W)|0))<<13)|0;c=((o=Math.imul(d,z))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(g,W),i=(i=Math.imul(g,z))+Math.imul(p,W)|0,o=Math.imul(p,z);var yt=(c+(n=n+Math.imul(f,q)|0)|0)+((8191&(i=(i=i+Math.imul(f,V)|0)+Math.imul(d,q)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,W),i=(i=Math.imul(y,z))+Math.imul(b,W)|0,o=Math.imul(b,z),n=n+Math.imul(g,q)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(p,q)|0,o=o+Math.imul(p,V)|0;var bt=(c+(n=n+Math.imul(f,Y)|0)|0)+((8191&(i=(i=i+Math.imul(f,$)|0)+Math.imul(d,Y)|0))<<13)|0;c=((o=o+Math.imul(d,$)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(v,W),i=(i=Math.imul(v,z))+Math.imul(w,W)|0,o=Math.imul(w,z),n=n+Math.imul(y,q)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,V)|0,n=n+Math.imul(g,Y)|0,i=(i=i+Math.imul(g,$)|0)+Math.imul(p,Y)|0,o=o+Math.imul(p,$)|0;var _t=(c+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,J)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(S,W),i=(i=Math.imul(S,z))+Math.imul(O,W)|0,o=Math.imul(O,z),n=n+Math.imul(v,q)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(w,q)|0,o=o+Math.imul(w,V)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,$)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,$)|0,n=n+Math.imul(g,Z)|0,i=(i=i+Math.imul(g,J)|0)+Math.imul(p,Z)|0,o=o+Math.imul(p,J)|0;var vt=(c+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(A,W),i=(i=Math.imul(A,z))+Math.imul(M,W)|0,o=Math.imul(M,z),n=n+Math.imul(S,q)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(O,q)|0,o=o+Math.imul(O,V)|0,n=n+Math.imul(v,Y)|0,i=(i=i+Math.imul(v,$)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,$)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,J)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var wt=(c+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(d,rt)|0))<<13)|0;c=((o=o+Math.imul(d,nt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(R,W),i=(i=Math.imul(R,z))+Math.imul(N,W)|0,o=Math.imul(N,z),n=n+Math.imul(A,q)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(M,q)|0,o=o+Math.imul(M,V)|0,n=n+Math.imul(S,Y)|0,i=(i=i+Math.imul(S,$)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,$)|0,n=n+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,J)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,J)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,nt)|0;var Et=(c+(n=n+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(D,W),i=(i=Math.imul(D,z))+Math.imul(j,W)|0,o=Math.imul(j,z),n=n+Math.imul(R,q)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(N,q)|0,o=o+Math.imul(N,V)|0,n=n+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,$)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,$)|0,n=n+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,J)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,J)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0,n=n+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(c+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(L,W),i=(i=Math.imul(L,z))+Math.imul(x,W)|0,o=Math.imul(x,z),n=n+Math.imul(D,q)|0,i=(i=i+Math.imul(D,V)|0)+Math.imul(j,q)|0,o=o+Math.imul(j,V)|0,n=n+Math.imul(R,Y)|0,i=(i=i+Math.imul(R,$)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,$)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,J)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,n=n+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ct)|0;var Ot=(c+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,dt)|0)+Math.imul(d,ft)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(U,W),i=(i=Math.imul(U,z))+Math.imul(F,W)|0,o=Math.imul(F,z),n=n+Math.imul(L,q)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(x,q)|0,o=o+Math.imul(x,V)|0,n=n+Math.imul(D,Y)|0,i=(i=i+Math.imul(D,$)|0)+Math.imul(j,Y)|0,o=o+Math.imul(j,$)|0,n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,J)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,n=n+Math.imul(g,ft)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,dt)|0;var Tt=(c+(n=n+Math.imul(f,gt)|0)|0)+((8191&(i=(i=i+Math.imul(f,pt)|0)+Math.imul(d,gt)|0))<<13)|0;c=((o=o+Math.imul(d,pt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(U,q),i=(i=Math.imul(U,V))+Math.imul(F,q)|0,o=Math.imul(F,V),n=n+Math.imul(L,Y)|0,i=(i=i+Math.imul(L,$)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,$)|0,n=n+Math.imul(D,Z)|0,i=(i=i+Math.imul(D,J)|0)+Math.imul(j,Z)|0,o=o+Math.imul(j,J)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,at)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,at)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,ct)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ct)|0,n=n+Math.imul(y,ft)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,dt)|0;var At=(c+(n=n+Math.imul(g,gt)|0)|0)+((8191&(i=(i=i+Math.imul(g,pt)|0)+Math.imul(p,gt)|0))<<13)|0;c=((o=o+Math.imul(p,pt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(U,Y),i=(i=Math.imul(U,$))+Math.imul(F,Y)|0,o=Math.imul(F,$),n=n+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,J)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,J)|0,n=n+Math.imul(D,Q)|0,i=(i=i+Math.imul(D,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ct)|0,n=n+Math.imul(v,ft)|0,i=(i=i+Math.imul(v,dt)|0)+Math.imul(w,ft)|0,o=o+Math.imul(w,dt)|0;var Mt=(c+(n=n+Math.imul(y,gt)|0)|0)+((8191&(i=(i=i+Math.imul(y,pt)|0)+Math.imul(b,gt)|0))<<13)|0;c=((o=o+Math.imul(b,pt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(U,Z),i=(i=Math.imul(U,J))+Math.imul(F,Z)|0,o=Math.imul(F,J),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(D,rt)|0,i=(i=i+Math.imul(D,nt)|0)+Math.imul(j,rt)|0,o=o+Math.imul(j,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,n=n+Math.imul(S,ft)|0,i=(i=i+Math.imul(S,dt)|0)+Math.imul(O,ft)|0,o=o+Math.imul(O,dt)|0;var It=(c+(n=n+Math.imul(v,gt)|0)|0)+((8191&(i=(i=i+Math.imul(v,pt)|0)+Math.imul(w,gt)|0))<<13)|0;c=((o=o+Math.imul(w,pt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(U,Q),i=(i=Math.imul(U,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(D,ot)|0,i=(i=i+Math.imul(D,at)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,at)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,dt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,dt)|0;var Rt=(c+(n=n+Math.imul(S,gt)|0)|0)+((8191&(i=(i=i+Math.imul(S,pt)|0)+Math.imul(O,gt)|0))<<13)|0;c=((o=o+Math.imul(O,pt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(U,rt),i=(i=Math.imul(U,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,n=n+Math.imul(D,ut)|0,i=(i=i+Math.imul(D,ct)|0)+Math.imul(j,ut)|0,o=o+Math.imul(j,ct)|0,n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,dt)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,dt)|0;var Nt=(c+(n=n+Math.imul(A,gt)|0)|0)+((8191&(i=(i=i+Math.imul(A,pt)|0)+Math.imul(M,gt)|0))<<13)|0;c=((o=o+Math.imul(M,pt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(U,ot),i=(i=Math.imul(U,at))+Math.imul(F,ot)|0,o=Math.imul(F,at),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,n=n+Math.imul(D,ft)|0,i=(i=i+Math.imul(D,dt)|0)+Math.imul(j,ft)|0,o=o+Math.imul(j,dt)|0;var kt=(c+(n=n+Math.imul(R,gt)|0)|0)+((8191&(i=(i=i+Math.imul(R,pt)|0)+Math.imul(N,gt)|0))<<13)|0;c=((o=o+Math.imul(N,pt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(U,ut),i=(i=Math.imul(U,ct))+Math.imul(F,ut)|0,o=Math.imul(F,ct),n=n+Math.imul(L,ft)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(x,ft)|0,o=o+Math.imul(x,dt)|0;var Dt=(c+(n=n+Math.imul(D,gt)|0)|0)+((8191&(i=(i=i+Math.imul(D,pt)|0)+Math.imul(j,gt)|0))<<13)|0;c=((o=o+Math.imul(j,pt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,n=Math.imul(U,ft),i=(i=Math.imul(U,dt))+Math.imul(F,ft)|0,o=Math.imul(F,dt);var jt=(c+(n=n+Math.imul(L,gt)|0)|0)+((8191&(i=(i=i+Math.imul(L,pt)|0)+Math.imul(x,gt)|0))<<13)|0;c=((o=o+Math.imul(x,pt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863;var Ct=(c+(n=Math.imul(U,gt))|0)+((8191&(i=(i=Math.imul(U,pt))+Math.imul(F,gt)|0))<<13)|0;return c=((o=Math.imul(F,pt))+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=yt,u[2]=bt,u[3]=_t,u[4]=vt,u[5]=wt,u[6]=Et,u[7]=St,u[8]=Ot,u[9]=Tt,u[10]=At,u[11]=Mt,u[12]=It,u[13]=Rt,u[14]=Nt,u[15]=kt,u[16]=Dt,u[17]=jt,u[18]=Ct,0!==c&&(u[19]=c,r.length++),r};function y(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var a=i;i=0;for(var s=67108863&n,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,f=(0|t.words[l])*(0|e.words[c]),d=67108863&f;s=67108863&(d=d+s|0),i+=(a=(a=a+(f/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function b(t,e,r){return y(t,e,r)}function _(t,e){this.x=t,this.y=e}Math.imul||(m=p),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?y(this,t,e):b(this,t,e)},_.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},_.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},_.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a<o;a++)n[a]=e[t[a]],i[a]=r[t[a]]},_.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var f=u,d=c,h=0;h<a;h++){var g=r[l+h],p=n[l+h],m=r[l+h+a],y=n[l+h+a],b=f*m-d*y;y=f*y+d*m,m=b,r[l+h]=g+m,n[l+h]=p+y,r[l+h+a]=g-m,n[l+h+a]=p-y,h!==s&&(b=u*f-c*d,d=u*d+c*f,f=b)}},_.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},_.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},_.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},_.prototype.convert13b=function(t,e,r,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)r[a]=0;n(0===o),n(0==(-8192&o))},_.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},_.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),a=new Array(n),s=new Array(n),u=new Array(n),c=new Array(n),l=new Array(n),f=new Array(n),d=r.words;d.length=n,this.convert13b(t.words,t.length,a,n),this.convert13b(e.words,e.length,c,n),this.transform(a,o,s,u,n,i),this.transform(c,o,l,f,n,i);for(var h=0;h<n;h++){var g=s[h]*l[h]-u[h]*f[h];u[h]=s[h]*f[h]+u[h]*l[h],s[h]=g}return this.conjugate(s,u,n),this.transform(s,u,d,o,n,i),this.conjugate(d,o,n),this.normalize13b(d,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r._strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),b(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<r;this.words[e]=u|a,a=s>>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var f=0|this.words[c];this.words[c]=l<<26-o|f>>>o,l=f&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r)&&!!(this.words[r]&i)},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,u=n.length-i.length;if("mod"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=n.clone()._ishlnsubmul(i,1,u);0===l.negative&&(n=l,s&&(s.words[u]=1));for(var f=u-1;f>=0;f--){var d=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(i,d,f);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=d)}return s&&s._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),f=e.clone();!e.isZero();){for(var d=0,h=1;0==(e.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(f)),i.iushrn(1),a.iushrn(1);for(var g=0,p=1;0==(r.words[0]&p)&&g<26;++g,p<<=1);if(g>0)for(r.iushrn(g);g-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(f)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),a.isub(u)):(r.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var f=0,d=1;0==(r.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new A(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function E(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function O(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function T(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(E,w),E.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n<r;n++)e.words[n]=t.words[n];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,n=10;n<t.length;n++){var o=0|t.words[n];t.words[n-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},E.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(S,w),i(O,w),i(T,w),T.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new E;else if("p224"===t)e=new S;else if("p192"===t)e=new O;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new T}return v[t]=e,e},A.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(l(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,i),d=this.pow(t,i.addn(1).iushrn(1)),h=this.pow(t,i),g=a;0!==h.cmp(s);){for(var p=h,m=0;0!==p.cmp(s);m++)p=p.redSqr();n(m<g);var y=this.pow(f,new o(1).iushln(g-m-1));d=d.redMul(y),f=y.redSqr(),h=h.redMul(f),g=m}return d},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var c=e.words[n],l=u-1;l>=0;l--){var f=c>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==a?(a<<=1,a|=f,(4===++s||0===n&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}u=26}return i},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new M(t)},i(M,A),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(84)(t))},function(t,e,r){"use strict";const n=e;n.bignum=r(39),n.define=r(367).define,n.base=r(370),n.constants=r(371),n.decoders=r(206),n.encoders=r(204)},function(t,e,r){"use strict";const n=e;n.der=r(205),n.pem=r(368)},function(t,e,r){"use strict";const n=r(12),i=r(130).Buffer,o=r(131),a=r(133);function s(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new u,this.tree._init(t.body)}function u(t){o.call(this,"der",t)}function c(t){return t<10?"0"+t:t}t.exports=s,s.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},n(u,o),u.prototype._encodeComposite=function(t,e,r,n){const o=function(t,e,r,n){let i;"seqof"===t?t="seq":"setof"===t&&(t="set");if(a.tagByName.hasOwnProperty(t))i=a.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return n.error("Unknown tag: "+t);i=t}if(i>=31)return n.error("Multi-octet tag encoding unsupported");e||(i|=32);return i|=a.tagClassByName[r||"universal"]<<6,i}(t,e,r,this.reporter);if(n.length<128){const t=i.alloc(2);return t[0]=o,t[1]=n.length,this._createEncoderBuffer([t,n])}let s=1;for(let t=n.length;t>=256;t>>=8)s++;const u=i.alloc(2+s);u[0]=o,u[1]=128|s;for(let t=1+s,e=n.length;e>0;t--,e>>=8)u[t]=255&e;return this._createEncoderBuffer([u,n])},u.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){const e=i.alloc(2*t.length);for(let r=0;r<t.length;r++)e.writeUInt16BE(t.charCodeAt(r),2*r);return this._createEncoderBuffer(e)}return"numstr"===e?this._isNumstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===e?this._isPrintstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(e)||"objDesc"===e?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: "+e+" unsupported")},u.prototype._encodeObjid=function(t,e,r){if("string"==typeof t){if(!e)return this.reporter.error("string objid given, but no values map found");if(!e.hasOwnProperty(t))return this.reporter.error("objid not found in values map");t=e[t].split(/[\s.]+/g);for(let e=0;e<t.length;e++)t[e]|=0}else if(Array.isArray(t)){t=t.slice();for(let e=0;e<t.length;e++)t[e]|=0}if(!Array.isArray(t))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(t));if(!r){if(t[1]>=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}let n=0;for(let e=0;e<t.length;e++){let r=t[e];for(n++;r>=128;r>>=7)n++}const o=i.alloc(n);let a=o.length-1;for(let e=t.length-1;e>=0;e--){let r=t[e];for(o[a--]=127&r;(r>>=7)>0;)o[a--]=128|127&r}return this._createEncoderBuffer(o)},u.prototype._encodeTime=function(t,e){let r;const n=new Date(t);return"gentime"===e?r=[c(n.getUTCFullYear()),c(n.getUTCMonth()+1),c(n.getUTCDate()),c(n.getUTCHours()),c(n.getUTCMinutes()),c(n.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[c(n.getUTCFullYear()%100),c(n.getUTCMonth()+1),c(n.getUTCDate()),c(n.getUTCHours()),c(n.getUTCMinutes()),c(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},u.prototype._encodeNull=function(){return this._createEncoderBuffer("")},u.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!i.isBuffer(t)){const e=t.toArray();!t.sign&&128&e[0]&&e.unshift(0),t=i.from(e)}if(i.isBuffer(t)){let e=t.length;0===t.length&&e++;const r=i.alloc(e);return t.copy(r),0===t.length&&(r[0]=0),this._createEncoderBuffer(r)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);let r=1;for(let e=t;e>=256;e>>=8)r++;const n=new Array(r);for(let e=n.length-1;e>=0;e--)n[e]=255&t,t>>=8;return 128&n[0]&&n.unshift(0),this._createEncoderBuffer(i.from(n))},u.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},u.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},u.prototype._skipDefault=function(t,e,r){const n=this._baseState;let i;if(null===n.default)return!1;const o=t.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,e,r).join()),o.length!==n.defaultBuffer.length)return!1;for(i=0;i<o.length;i++)if(o[i]!==n.defaultBuffer[i])return!1;return!0}},function(t,e,r){"use strict";const n=e;n.der=r(207),n.pem=r(369)},function(t,e,r){"use strict";const n=r(12),i=r(39),o=r(88).DecoderBuffer,a=r(131),s=r(133);function u(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new c,this.tree._init(t.body)}function c(t){a.call(this,"der",t)}function l(t,e){let r=t.readUInt8(e);if(t.isError(r))return r;const n=s.tagClass[r>>6],i=0==(32&r);if(31==(31&r)){let n=r;for(r=0;128==(128&n);){if(n=t.readUInt8(e),t.isError(n))return n;r<<=7,r|=127&n}}else r&=31;return{cls:n,primitive:i,tag:r,tagStr:s.tag[r]}}function f(t,e,r){let n=t.readUInt8(r);if(t.isError(n))return n;if(!e&&128===n)return null;if(0==(128&n))return n;const i=127&n;if(i>4)return t.error("length octect is too long");n=0;for(let e=0;e<i;e++){n<<=8;const e=t.readUInt8(r);if(t.isError(e))return e;n|=e}return n}t.exports=u,u.prototype.decode=function(t,e){return o.isDecoderBuffer(t)||(t=new o(t,e)),this.tree._decode(t,e)},n(c,a),c.prototype._peekTag=function(t,e,r){if(t.isEmpty())return!1;const n=t.save(),i=l(t,'Failed to peek tag: "'+e+'"');return t.isError(i)?i:(t.restore(n),i.tag===e||i.tagStr===e||i.tagStr+"of"===e||r)},c.prototype._decodeTag=function(t,e,r){const n=l(t,'Failed to decode tag of "'+e+'"');if(t.isError(n))return n;let i=f(t,n.primitive,'Failed to get length of "'+e+'"');if(t.isError(i))return i;if(!r&&n.tag!==e&&n.tagStr!==e&&n.tagStr+"of"!==e)return t.error('Failed to match tag: "'+e+'"');if(n.primitive||null!==i)return t.skip(i,'Failed to match body of: "'+e+'"');const o=t.save(),a=this._skipUntilEnd(t,'Failed to skip indefinite length body: "'+this.tag+'"');return t.isError(a)?a:(i=t.offset-o.offset,t.restore(o),t.skip(i,'Failed to match body of: "'+e+'"'))},c.prototype._skipUntilEnd=function(t,e){for(;;){const r=l(t,e);if(t.isError(r))return r;const n=f(t,r.primitive,e);if(t.isError(n))return n;let i;if(i=r.primitive||null!==n?t.skip(n):this._skipUntilEnd(t,e),t.isError(i))return i;if("end"===r.tagStr)break}},c.prototype._decodeList=function(t,e,r,n){const i=[];for(;!t.isEmpty();){const e=this._peekTag(t,"end");if(t.isError(e))return e;const o=r.decode(t,"der",n);if(t.isError(o)&&e)break;i.push(o)}return i},c.prototype._decodeStr=function(t,e){if("bitstr"===e){const e=t.readUInt8();return t.isError(e)?e:{unused:e,data:t.raw()}}if("bmpstr"===e){const e=t.raw();if(e.length%2==1)return t.error("Decoding of string type: bmpstr length mismatch");let r="";for(let t=0;t<e.length/2;t++)r+=String.fromCharCode(e.readUInt16BE(2*t));return r}if("numstr"===e){const e=t.raw().toString("ascii");return this._isNumstr(e)?e:t.error("Decoding of string type: numstr unsupported characters")}if("octstr"===e)return t.raw();if("objDesc"===e)return t.raw();if("printstr"===e){const e=t.raw().toString("ascii");return this._isPrintstr(e)?e:t.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(e)?t.raw().toString():t.error("Decoding of string type: "+e+" unsupported")},c.prototype._decodeObjid=function(t,e,r){let n;const i=[];let o=0,a=0;for(;!t.isEmpty();)a=t.readUInt8(),o<<=7,o|=127&a,0==(128&a)&&(i.push(o),o=0);128&a&&i.push(o);const s=i[0]/40|0,u=i[0]%40;if(n=r?i:[s,u].concat(i.slice(1)),e){let t=e[n.join(" ")];void 0===t&&(t=e[n.join(".")]),void 0!==t&&(n=t)}return n},c.prototype._decodeTime=function(t,e){const r=t.raw().toString();let n,i,o,a,s,u;if("gentime"===e)n=0|r.slice(0,4),i=0|r.slice(4,6),o=0|r.slice(6,8),a=0|r.slice(8,10),s=0|r.slice(10,12),u=0|r.slice(12,14);else{if("utctime"!==e)return t.error("Decoding "+e+" time is not supported yet");n=0|r.slice(0,2),i=0|r.slice(2,4),o=0|r.slice(4,6),a=0|r.slice(6,8),s=0|r.slice(8,10),u=0|r.slice(10,12),n=n<70?2e3+n:1900+n}return Date.UTC(n,i-1,o,a,s,u,0)},c.prototype._decodeNull=function(){return null},c.prototype._decodeBool=function(t){const e=t.readUInt8();return t.isError(e)?e:0!==e},c.prototype._decodeInt=function(t,e){const r=t.raw();let n=new i(r);return e&&(n=e[n.toString(10)]||n),n},c.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getDecoder("der").tree}},function(t){t.exports=JSON.parse('{"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}')},function(t,e,r){var n=r(85),i=r(19).Buffer;function o(t){var e=i.allocUnsafe(4);return e.writeUInt32BE(t,0),e}t.exports=function(t,e){for(var r,a=i.alloc(0),s=0;a.length<e;)r=o(s++),a=i.concat([a,n("sha1").update(t).update(r).digest()]);return a.slice(0,e)}},function(t,e){t.exports=function(t,e){for(var r=t.length,n=-1;++n<r;)t[n]^=e[n];return t}},function(t,e,r){var n=r(39),i=r(19).Buffer;t.exports=function(t,e){return i.from(t.toRed(n.mont(e.modulus)).redPow(new n(e.publicExponent)).fromRed().toArray())}},function(t,e){var r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(r){var n=new Uint8Array(16);t.exports=function(){return r(n),n}}else{var i=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}}},function(t,e){for(var r=[],n=0;n<256;++n)r[n]=(n+256).toString(16).substr(1);t.exports=function(t,e){var n=e||0,i=r;return[i[t[n++]],i[t[n++]],i[t[n++]],i[t[n++]],"-",i[t[n++]],i[t[n++]],"-",i[t[n++]],i[t[n++]],"-",i[t[n++]],i[t[n++]],"-",i[t[n++]],i[t[n++]],i[t[n++]],i[t[n++]],i[t[n++]],i[t[n++]]].join("")}},function(t,e,r){var n,i,o=r(391),a=r(134),s=r(135).isArray;function u(t){var e=Number(t);if(!isNaN(e))return e;var r=t.toLowerCase();return"true"===r||"false"!==r&&t}function c(t,e){var r;if(n.compact){if(!i[n[t+"Key"]]&&(s(n.alwaysArray)?-1!==n.alwaysArray.indexOf(n[t+"Key"]):n.alwaysArray)&&(i[n[t+"Key"]]=[]),i[n[t+"Key"]]&&!s(i[n[t+"Key"]])&&(i[n[t+"Key"]]=[i[n[t+"Key"]]]),t+"Fn"in n&&"string"==typeof e&&(e=n[t+"Fn"](e,i)),"instruction"===t&&("instructionFn"in n||"instructionNameFn"in n))for(r in e)if(e.hasOwnProperty(r))if("instructionFn"in n)e[r]=n.instructionFn(e[r],r,i);else{var o=e[r];delete e[r],e[n.instructionNameFn(r,o,i)]=o}s(i[n[t+"Key"]])?i[n[t+"Key"]].push(e):i[n[t+"Key"]]=e}else{i[n.elementsKey]||(i[n.elementsKey]=[]);var a={};if(a[n.typeKey]=t,"instruction"===t){for(r in e)if(e.hasOwnProperty(r))break;a[n.nameKey]="instructionNameFn"in n?n.instructionNameFn(r,e,i):r,n.instructionHasAttributes?(a[n.attributesKey]=e[r][n.attributesKey],"instructionFn"in n&&(a[n.attributesKey]=n.instructionFn(a[n.attributesKey],r,i))):("instructionFn"in n&&(e[r]=n.instructionFn(e[r],r,i)),a[n.instructionKey]=e[r])}else t+"Fn"in n&&(e=n[t+"Fn"](e,i)),a[n[t+"Key"]]=e;n.addParent&&(a[n.parentKey]=i),i[n.elementsKey].push(a)}}function l(t){var e;if("attributesFn"in n&&t&&(t=n.attributesFn(t,i)),(n.trim||"attributeValueFn"in n||"attributeNameFn"in n||n.nativeTypeAttributes)&&t)for(e in t)if(t.hasOwnProperty(e)&&(n.trim&&(t[e]=t[e].trim()),n.nativeTypeAttributes&&(t[e]=u(t[e])),"attributeValueFn"in n&&(t[e]=n.attributeValueFn(t[e],e,i)),"attributeNameFn"in n)){var r=t[e];delete t[e],t[n.attributeNameFn(e,t[e],i)]=r}return t}function f(t){var e={};if(t.body&&("xml"===t.name.toLowerCase()||n.instructionHasAttributes)){for(var r,o=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g;null!==(r=o.exec(t.body));)e[r[1]]=r[2]||r[3]||r[4];e=l(e)}if("xml"===t.name.toLowerCase()){if(n.ignoreDeclaration)return;i[n.declarationKey]={},Object.keys(e).length&&(i[n.declarationKey][n.attributesKey]=e),n.addParent&&(i[n.declarationKey][n.parentKey]=i)}else{if(n.ignoreInstruction)return;n.trim&&(t.body=t.body.trim());var a={};n.instructionHasAttributes&&Object.keys(e).length?(a[t.name]={},a[t.name][n.attributesKey]=e):a[t.name]=t.body,c("instruction",a)}}function d(t,e){var r;if("object"==typeof t&&(e=t.attributes,t=t.name),e=l(e),"elementNameFn"in n&&(t=n.elementNameFn(t,i)),n.compact){var o;if(r={},!n.ignoreAttributes&&e&&Object.keys(e).length)for(o in r[n.attributesKey]={},e)e.hasOwnProperty(o)&&(r[n.attributesKey][o]=e[o]);!(t in i)&&(s(n.alwaysArray)?-1!==n.alwaysArray.indexOf(t):n.alwaysArray)&&(i[t]=[]),i[t]&&!s(i[t])&&(i[t]=[i[t]]),s(i[t])?i[t].push(r):i[t]=r}else i[n.elementsKey]||(i[n.elementsKey]=[]),(r={})[n.typeKey]="element",r[n.nameKey]=t,!n.ignoreAttributes&&e&&Object.keys(e).length&&(r[n.attributesKey]=e),n.alwaysChildren&&(r[n.elementsKey]=[]),i[n.elementsKey].push(r);r[n.parentKey]=i,i=r}function h(t){n.ignoreText||(t.trim()||n.captureSpacesBetweenElements)&&(n.trim&&(t=t.trim()),n.nativeType&&(t=u(t)),n.sanitize&&(t=t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")),c("text",t))}function g(t){n.ignoreComment||(n.trim&&(t=t.trim()),c("comment",t))}function p(t){var e=i[n.parentKey];n.addParent||delete i[n.parentKey],i=e}function m(t){n.ignoreCdata||(n.trim&&(t=t.trim()),c("cdata",t))}function y(t){n.ignoreDoctype||(t=t.replace(/^ /,""),n.trim&&(t=t.trim()),c("doctype",t))}function b(t){t.note=t}t.exports=function(t,e){var r=o.parser(!0,{}),s={};if(i=s,n=function(t){return n=a.copyOptions(t),a.ensureFlagExists("ignoreDeclaration",n),a.ensureFlagExists("ignoreInstruction",n),a.ensureFlagExists("ignoreAttributes",n),a.ensureFlagExists("ignoreText",n),a.ensureFlagExists("ignoreComment",n),a.ensureFlagExists("ignoreCdata",n),a.ensureFlagExists("ignoreDoctype",n),a.ensureFlagExists("compact",n),a.ensureFlagExists("alwaysChildren",n),a.ensureFlagExists("addParent",n),a.ensureFlagExists("trim",n),a.ensureFlagExists("nativeType",n),a.ensureFlagExists("nativeTypeAttributes",n),a.ensureFlagExists("sanitize",n),a.ensureFlagExists("instructionHasAttributes",n),a.ensureFlagExists("captureSpacesBetweenElements",n),a.ensureAlwaysArrayExists(n),a.ensureKeyExists("declaration",n),a.ensureKeyExists("instruction",n),a.ensureKeyExists("attributes",n),a.ensureKeyExists("text",n),a.ensureKeyExists("comment",n),a.ensureKeyExists("cdata",n),a.ensureKeyExists("doctype",n),a.ensureKeyExists("type",n),a.ensureKeyExists("name",n),a.ensureKeyExists("elements",n),a.ensureKeyExists("parent",n),a.checkFnExists("doctype",n),a.checkFnExists("instruction",n),a.checkFnExists("cdata",n),a.checkFnExists("comment",n),a.checkFnExists("text",n),a.checkFnExists("instructionName",n),a.checkFnExists("elementName",n),a.checkFnExists("attributeName",n),a.checkFnExists("attributeValue",n),a.checkFnExists("attributes",n),n}(e),r.opt={strictEntities:!0},r.onopentag=d,r.ontext=h,r.oncomment=g,r.onclosetag=p,r.onerror=b,r.oncdata=m,r.ondoctype=y,r.onprocessinginstruction=f,r.write(t).close(),s[n.elementsKey]){var u=s[n.elementsKey];delete s[n.elementsKey],s[n.elementsKey]=u,delete s.text}return s}},function(t,e,r){var n,i,o=r(134),a=r(135).isArray;function s(t,e,r){return(!r&&t.spaces?"\n":"")+Array(e+1).join(t.spaces)}function u(t,e,r){if(e.ignoreAttributes)return"";"attributesFn"in e&&(t=e.attributesFn(t,i,n));var o,a,u,c,l=[];for(o in t)t.hasOwnProperty(o)&&null!==t[o]&&void 0!==t[o]&&(c=e.noQuotesForNativeAttributes&&"string"!=typeof t[o]?"":'"',a=(a=""+t[o]).replace(/"/g,"""),u="attributeNameFn"in e?e.attributeNameFn(o,a,i,n):o,l.push(e.spaces&&e.indentAttributes?s(e,r+1,!1):" "),l.push(u+"="+c+("attributeValueFn"in e?e.attributeValueFn(a,o,i,n):a)+c));return t&&Object.keys(t).length&&e.spaces&&e.indentAttributes&&l.push(s(e,r,!1)),l.join("")}function c(t,e,r){return n=t,i="xml",e.ignoreDeclaration?"":"<?xml"+u(t[e.attributesKey],e,r)+"?>"}function l(t,e,r){if(e.ignoreInstruction)return"";var o;for(o in t)if(t.hasOwnProperty(o))break;var a="instructionNameFn"in e?e.instructionNameFn(o,t[o],i,n):o;if("object"==typeof t[o])return n=t,i=a,"<?"+a+u(t[o][e.attributesKey],e,r)+"?>";var s=t[o]?t[o]:"";return"instructionFn"in e&&(s=e.instructionFn(s,o,i,n)),"<?"+a+(s?" "+s:"")+"?>"}function f(t,e){return e.ignoreComment?"":"\x3c!--"+("commentFn"in e?e.commentFn(t,i,n):t)+"--\x3e"}function d(t,e){return e.ignoreCdata?"":"<![CDATA["+("cdataFn"in e?e.cdataFn(t,i,n):t.replace("]]>","]]]]><![CDATA[>"))+"]]>"}function h(t,e){return e.ignoreDoctype?"":"<!DOCTYPE "+("doctypeFn"in e?e.doctypeFn(t,i,n):t)+">"}function g(t,e){return e.ignoreText?"":(t=(t=(t=""+t).replace(/&/g,"&")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),"textFn"in e?e.textFn(t,i,n):t)}function p(t,e,r,o){return t.reduce((function(t,a){var c=s(e,r,o&&!t);switch(a.type){case"element":return t+c+function(t,e,r){n=t,i=t.name;var o=[],a="elementNameFn"in e?e.elementNameFn(t.name,t):t.name;o.push("<"+a),t[e.attributesKey]&&o.push(u(t[e.attributesKey],e,r));var s=t[e.elementsKey]&&t[e.elementsKey].length||t[e.attributesKey]&&"preserve"===t[e.attributesKey]["xml:space"];return s||(s="fullTagEmptyElementFn"in e?e.fullTagEmptyElementFn(t.name,t):e.fullTagEmptyElement),s?(o.push(">"),t[e.elementsKey]&&t[e.elementsKey].length&&(o.push(p(t[e.elementsKey],e,r+1)),n=t,i=t.name),o.push(e.spaces&&function(t,e){var r;if(t.elements&&t.elements.length)for(r=0;r<t.elements.length;++r)switch(t.elements[r][e.typeKey]){case"text":if(e.indentText)return!0;break;case"cdata":if(e.indentCdata)return!0;break;case"instruction":if(e.indentInstruction)return!0;break;case"doctype":case"comment":case"element":default:return!0}return!1}(t,e)?"\n"+Array(r+1).join(e.spaces):""),o.push("</"+a+">")):o.push("/>"),o.join("")}(a,e,r);case"comment":return t+c+f(a[e.commentKey],e);case"doctype":return t+c+h(a[e.doctypeKey],e);case"cdata":return t+(e.indentCdata?c:"")+d(a[e.cdataKey],e);case"text":return t+(e.indentText?c:"")+g(a[e.textKey],e);case"instruction":var m={};return m[a[e.nameKey]]=a[e.attributesKey]?a:a[e.instructionKey],t+(e.indentInstruction?c:"")+l(m,e,r)}}),"")}function m(t,e,r){var n;for(n in t)if(t.hasOwnProperty(n))switch(n){case e.parentKey:case e.attributesKey:break;case e.textKey:if(e.indentText||r)return!0;break;case e.cdataKey:if(e.indentCdata||r)return!0;break;case e.instructionKey:if(e.indentInstruction||r)return!0;break;case e.doctypeKey:case e.commentKey:default:return!0}return!1}function y(t,e,r,o,a){n=t,i=e;var c="elementNameFn"in r?r.elementNameFn(e,t):e;if(null==t||""===t)return"fullTagEmptyElementFn"in r&&r.fullTagEmptyElementFn(e,t)||r.fullTagEmptyElement?"<"+c+"></"+c+">":"<"+c+"/>";var l=[];if(e){if(l.push("<"+c),"object"!=typeof t)return l.push(">"+g(t,r)+"</"+c+">"),l.join("");t[r.attributesKey]&&l.push(u(t[r.attributesKey],r,o));var f=m(t,r,!0)||t[r.attributesKey]&&"preserve"===t[r.attributesKey]["xml:space"];if(f||(f="fullTagEmptyElementFn"in r?r.fullTagEmptyElementFn(e,t):r.fullTagEmptyElement),!f)return l.push("/>"),l.join("");l.push(">")}return l.push(b(t,r,o+1,!1)),n=t,i=e,e&&l.push((a?s(r,o,!1):"")+"</"+c+">"),l.join("")}function b(t,e,r,n){var i,o,u,p=[];for(o in t)if(t.hasOwnProperty(o))for(u=a(t[o])?t[o]:[t[o]],i=0;i<u.length;++i){switch(o){case e.declarationKey:p.push(c(u[i],e,r));break;case e.instructionKey:p.push((e.indentInstruction?s(e,r,n):"")+l(u[i],e,r));break;case e.attributesKey:case e.parentKey:break;case e.textKey:p.push((e.indentText?s(e,r,n):"")+g(u[i],e));break;case e.cdataKey:p.push((e.indentCdata?s(e,r,n):"")+d(u[i],e));break;case e.doctypeKey:p.push(s(e,r,n)+h(u[i],e));break;case e.commentKey:p.push(s(e,r,n)+f(u[i],e));break;default:p.push(s(e,r,n)+y(u[i],o,e,r,m(u[i],e)))}n=n&&!p.length}return p.join("")}t.exports=function(t,e){e=function(t){var e=o.copyOptions(t);return o.ensureFlagExists("ignoreDeclaration",e),o.ensureFlagExists("ignoreInstruction",e),o.ensureFlagExists("ignoreAttributes",e),o.ensureFlagExists("ignoreText",e),o.ensureFlagExists("ignoreComment",e),o.ensureFlagExists("ignoreCdata",e),o.ensureFlagExists("ignoreDoctype",e),o.ensureFlagExists("compact",e),o.ensureFlagExists("indentText",e),o.ensureFlagExists("indentCdata",e),o.ensureFlagExists("indentAttributes",e),o.ensureFlagExists("indentInstruction",e),o.ensureFlagExists("fullTagEmptyElement",e),o.ensureFlagExists("noQuotesForNativeAttributes",e),o.ensureSpacesExists(e),"number"==typeof e.spaces&&(e.spaces=Array(e.spaces+1).join(" ")),o.ensureKeyExists("declaration",e),o.ensureKeyExists("instruction",e),o.ensureKeyExists("attributes",e),o.ensureKeyExists("text",e),o.ensureKeyExists("comment",e),o.ensureKeyExists("cdata",e),o.ensureKeyExists("doctype",e),o.ensureKeyExists("type",e),o.ensureKeyExists("name",e),o.ensureKeyExists("elements",e),o.checkFnExists("doctype",e),o.checkFnExists("instruction",e),o.checkFnExists("cdata",e),o.checkFnExists("comment",e),o.checkFnExists("text",e),o.checkFnExists("instructionName",e),o.checkFnExists("elementName",e),o.checkFnExists("attributeName",e),o.checkFnExists("attributeValue",e),o.checkFnExists("attributes",e),o.checkFnExists("fullTagEmptyElement",e),e}(e);var r=[];return n=t,i="_root_",e.compact?r.push(b(t,e,0,!0)):(t[e.declarationKey]&&r.push(c(t[e.declarationKey],e,0)),t[e.elementsKey]&&t[e.elementsKey].length&&r.push(p(t[e.elementsKey],e,0,!r.length))),r.join("")}},function(t,e,r){"use strict";var n=Object.prototype.toString;t.exports=function(t){var e=n.call(t),r="[object Arguments]"===e;return r||(r="[object Array]"!==e&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===n.call(t.callee)),r}},function(t,e,r){"use strict";var n=r(58)(),i=r(50)("Object.prototype.toString"),o=function(t){return!(n&&t&&"object"==typeof t&&Symbol.toStringTag in t)&&"[object Arguments]"===i(t)},a=function(t){return!!o(t)||null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==i(t)&&"[object Function]"===i(t.callee)},s=function(){return o(arguments)}();o.isLegacyArguments=a,t.exports=s?o:a},function(t,e,r){"use strict";var n=function(t){return t!=t};t.exports=function(t,e){return 0===t&&0===e?1/t==1/e:t===e||!(!n(t)||!n(e))}},function(t,e,r){"use strict";var n=r(218);t.exports=function(){return"function"==typeof Object.is?Object.is:n}},function(t,e,r){"use strict";var n=r(404).functionsHaveConfigurableNames(),i=Object,o=TypeError;t.exports=function(){if(null!=this&&this!==i(this))throw new o("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.sticky&&(t+="y"),t},n&&Object.defineProperty&&Object.defineProperty(t.exports,"name",{value:"get flags"})},function(t,e,r){"use strict";var n=r(220),i=r(65).supportsDescriptors,o=Object.getOwnPropertyDescriptor;t.exports=function(){if(i&&"gim"===/a/gim.flags){var t=o(RegExp.prototype,"flags");if(t&&"function"==typeof t.get&&"boolean"==typeof RegExp.prototype.dotAll&&"boolean"==typeof RegExp.prototype.hasIndices){var e="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(r,"sticky",{get:function(){e+="y"}}),"dy"===e)return t.get}}return n}},function(t,e,r){"use strict";var n=String.prototype.valueOf,i=Object.prototype.toString,o=r(58)();t.exports=function(t){return"string"==typeof t||"object"==typeof t&&(o?function(t){try{return n.call(t),!0}catch(t){return!1}}(t):"[object String]"===i.call(t))}},function(t,e,r){"use strict";var n,i="function"==typeof Map&&Map.prototype?Map:null,o="function"==typeof Set&&Set.prototype?Set:null;i||(n=function(t){return!1});var a=i?Map.prototype.has:null,s=o?Set.prototype.has:null;n||a||(n=function(t){return!1}),t.exports=n||function(t){if(!t||"object"!=typeof t)return!1;try{if(a.call(t),s)try{s.call(t)}catch(t){return!0}return t instanceof i}catch(t){}return!1}},function(t,e,r){"use strict";var n,i="function"==typeof Map&&Map.prototype?Map:null,o="function"==typeof Set&&Set.prototype?Set:null;o||(n=function(t){return!1});var a=i?Map.prototype.has:null,s=o?Set.prototype.has:null;n||s||(n=function(t){return!1}),t.exports=n||function(t){if(!t||"object"!=typeof t)return!1;try{if(s.call(t),a)try{a.call(t)}catch(t){return!0}return t instanceof o}catch(t){}return!1}},function(t,e,r){"use strict";var n=r(423),i=Object.prototype.toString,o=Object.prototype.hasOwnProperty,a=function(t,e,r){for(var n=0,i=t.length;n<i;n++)o.call(t,n)&&(null==r?e(t[n],n,t):e.call(r,t[n],n,t))},s=function(t,e,r){for(var n=0,i=t.length;n<i;n++)null==r?e(t.charAt(n),n,t):e.call(r,t.charAt(n),n,t)},u=function(t,e,r){for(var n in t)o.call(t,n)&&(null==r?e(t[n],n,t):e.call(r,t[n],n,t))};t.exports=function(t,e,r){if(!n(e))throw new TypeError("iterator must be a function");var o;arguments.length>=3&&(o=r),"[object Array]"===i.call(t)?a(t,e,o):"string"==typeof t?s(t,e,o):u(t,e,o)}},function(t,e,r){"use strict";(function(e){var r=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],n="undefined"==typeof globalThis?e:globalThis;t.exports=function(){for(var t=[],e=0;e<r.length;e++)"function"==typeof n[r[e]]&&(t[t.length]=r[e]);return t}}).call(this,r(33))},function(t,e,r){"use strict";var n=r(59)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(t){n=null}t.exports=n},function(t,e,r){"use strict";var n=r(136),i=r(106)(),o=r(50),a=Object,s=o("Array.prototype.push"),u=o("Object.prototype.propertyIsEnumerable"),c=i?Object.getOwnPropertySymbols:null;t.exports=function(t,e){if(null==t)throw new TypeError("target must be an object");var r=a(t);if(1===arguments.length)return r;for(var o=1;o<arguments.length;++o){var l=a(arguments[o]),f=n(l),d=i&&(Object.getOwnPropertySymbols||c);if(d)for(var h=d(l),g=0;g<h.length;++g){var p=h[g];u(l,p)&&s(f,p)}for(var m=0;m<f.length;++m){var y=f[m];if(u(l,y)){var b=l[y];r[y]=b}}}return r}},function(t,e,r){"use strict";var n=r(228);t.exports=function(){return Object.assign?function(){if(!Object.assign)return!1;for(var t="abcdefghijklmnopqrst",e=t.split(""),r={},n=0;n<e.length;++n)r[e[n]]=e[n];var i=Object.assign({},r),o="";for(var a in i)o+=a;return t!==o}()||function(){if(!Object.assign||!Object.preventExtensions)return!1;var t=Object.preventExtensions({1:2});try{Object.assign(t,"xy")}catch(e){return"y"===t[1]}return!1}()?n:Object.assign:n}},function(t,e){var r={utf8:{stringToBytes:function(t){return r.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(r.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var e=[],r=0;r<t.length;r++)e.push(255&t.charCodeAt(r));return e},bytesToString:function(t){for(var e=[],r=0;r<t.length;r++)e.push(String.fromCharCode(t[r]));return e.join("")}}};t.exports=r},function(t,e,r){"use strict";t.exports=t=>{const e=/^\\\\\?\\/.test(t),r=/[^\u0000-\u0080]+/.test(t);return e||r?t:t.replace(/\\/g,"/")}},function(t,e,r){"use strict";r.d(e,"a",(function(){return f}));var n=r(32),i=r(60),o=r.n(i);function a(t){return Math.round(t/10)}function s(t){let e=t.split("-");return e[0]+"-"+e[1]}function u(t){switch(t){case"cash":case"checking":return"checking";case"creditCard":case"lineOfCredit":return"credit";case"savings":return"savings";case"investmentAccount":return"investment";case"mortgage":return"mortgage";default:return"other"}}function c(t,e){return t.reduce((function(t,r){var n=r[e];return t.hasOwnProperty(n)||(t[n]=[]),t[n].push(r),t}),{})}async function l(t){const e=new Map;console.log("Importing Accounts..."),await function(t,e){return Promise.all(t.accounts.map(async t=>{if(!t.deleted){let r=await n.c({type:u(t.type),name:t.name,offbudget:!t.on_budget,closed:t.closed});e.set(t.id,r)}}))}(t,e),console.log("Importing Categories..."),await async function(t,e){const r=(await n.h()).find(t=>"Income"===t.name).id,i=["To be Budgeted","Inflow: Ready to Assign"];function o(e){return e.category_group_id===t.category_groups.find(t=>"Internal Master Category"===t.name).id?i.includes(e.name)?"income":"internal":e.category_group_id===t.category_groups.find(t=>"Credit Card Payments"===t.name).id?"creditCard":void 0}for(let i of t.category_groups)if(!i.deleted){if("Internal Master Category"!==i.name&&"Credit Card Payments"!==i.name){var a=await n.e({name:i.name,is_income:!1});e.set(i.id,a)}let s=t.categories.filter(t=>t.category_group_id===i.id);for(let t of s.reverse())if(!t.deleted){let i={};switch(i.name=t.name,o(t)){case"income":{let n=r;e.set(t.id,n);break}case"creditCard":case"internal":break;default:{i.group_id=a;let r=await n.d(i);e.set(t.id,r);break}}}}}(t,e),console.log("Importing Payees..."),await function(t,e){return Promise.all(t.payees.map(async t=>{if(!t.deleted){let r=await n.f({name:t.name});e.set(t.id,r)}}))}(t,e),console.log("Importing Transactions..."),await async function(t,e){const r=await n.i(),i=await n.h(),s=i.find(t=>"Income"===t.name).id,u=i.find(t=>"Starting Balances"===t.name).id,l=t.payees.find(t=>"Starting Balance"===t.name).id;let f=c(t.transactions,"account_id"),d=c(t.subtransactions,"transaction_id");for(let r of t.transactions)e.set(r.id,o.a.v4());await Promise.all(Object.keys(f).map(async i=>{let o=f[i].map(n=>{if(n.deleted)return null;let i=d[n.id];i&&(i=i.map(t=>({amount:a(t.amount),category:e.get(t.category_id)||null,notes:t.memo})));let o={id:e.get(n.id),account:e.get(n.account_id),date:n.date,amount:a(n.amount),category:e.get(n.category_id)||null,cleared:["cleared","reconciled"].includes(n.cleared),notes:n.memo||null,imported_id:n.import_id||null,transfer_id:e.get(n.transfer_transaction_id)||null,subtransactions:i};var c;n.transfer_account_id?o.payee=r.find(t=>t.transfer_acct===e.get(n.transfer_account_id)).id:(o.payee=e.get(n.payee_id),o.imported_payee=null===(c=t.payees.find(t=>!t.deleted&&t.id===n.payee_id))||void 0===c?void 0:c.name);return n.payee_id===l&&e.get(n.category_id)===s&&(o.category=u,o.payee=null),o}).filter(t=>t);await n.a(e.get(i),o)}))}(t,e),console.log("Importing Budgets..."),await async function(t,e){let r=(i=t.months,o="month",[...i].sort((t,e)=>t[o]<e[o]?-1:t[o]>e[o]?1:0));var i,o;const a=t.category_groups.find(t=>"Internal Master Category"===t.name).id,u=t.category_groups.find(t=>"Credit Card Payments"===t.name).id;await n.b(async()=>{for(let t of r){let r=s(t.month);await Promise.all(t.categories.map(async t=>{let i=e.get(t.id),o=t.budgeted/10;i&&t.category_group_id!==a&&t.category_group_id!==u&&await n.k(r,i,o)}))}})}(t,e),console.log("Setting up...")}async function f(t){return t.data&&(t=t.data),n.j(t.budget.name,()=>l(t.budget))}},function(t,e,r){"use strict";r.d(e,"a",(function(){return T}));var n=r(37),i=r(14),o=r(24),a=r(52),s=r(0),u=r(4),c=r(6),l=r(3),f=r(7),d=r(1),h=r(30);function g(t){return t[Math.floor(Math.random()*t.length)%t.length]}function p(t,e){return Math.round(function(t,e){return t+(e-t)*Math.random()}(t,e))}function m(t,e){let r=t[0];for(let n=0;n<t.length;n++)t[n][e]<r[e]&&(r=t[n]);return r}function y(t){return t.find(t=>"Starting Balances"===t.name).id}function b(t,e){let r=t.find(t=>"Deposit"===t.name),n=t.filter(t=>"Deposit"!==t.name&&"Starting Balance"!==t.name),i=e.find(t=>0===t.is_income),o=e.find(t=>1===t.is_income),a=i.categories.filter(t=>-1!==["Food","Restaurants","Entertainment","Clothing","General","Gift","Medical"].indexOf(t.name));return{incomePayee:r,expensePayees:n.filter(t=>!t.bill),incomeGroup:o,expenseCategories:a,billCategories:e.find(t=>"Bills"===t.name).categories,billPayees:n.filter(t=>t.bill)}}async function _(t,e,r,i){let{incomePayee:o,expensePayees:a,incomeGroup:s,expenseCategories:u,billCategories:c,billPayees:l}=b(r,i),f=p(100,200),h=[];for(let t=0;t<f;t++){let r,n,i;r=Math.random()<.09?o:g(a),n="Deposit"===r.name?s.categories.find(t=>"Income"===t.name):g(u),i="Deposit"===r.name?p(5e4,7e4):p(0,Math.random()<.05?-8e3:-700);let c={amount:i,payee:r.id,account:e.id,date:d.q(d.d(),Math.floor(t/3)),category:n.id};if(h.push(c),Math.random()<.2){let t=Math.round(c.amount/3),e=()=>r===o?s.categories.find(t=>"Income"===t.name).id:g(u).id;c.subtransactions=[{amount:t,category:e()},{amount:t,category:e()},{amount:c.amount-2*t,category:e()}]}}let m=d.k(h[h.length-1].date),_=d.o(m,d.e()),v=d.d();for(let t of _){let r=d.a(t,"12");d.j(r,v)&&h.push({amount:-1e4,payee:l.find(t=>t.name.toLowerCase().includes("power")).id,account:e.id,date:r,category:c.find(t=>"Power"===t.name).id}),r=d.a(t,"18"),d.j(r,v)&&h.push({amount:-9e3,payee:l.find(t=>t.name.toLowerCase().includes("water")).id,account:e.id,date:r,category:c.find(t=>"Water"===t.name).id}),r=d.a(t,"2"),d.j(r,v)&&h.push({amount:-12e4,payee:l.find(t=>t.name.toLowerCase().includes("housy")).id,account:e.id,date:r,category:c.find(t=>"Mortgage"===t.name).id}),r=d.a(t,"20"),d.j(r,v)&&h.push({amount:-6e3,payee:l.find(t=>t.name.toLowerCase().includes("internet")).id,account:e.id,date:r,category:c.find(t=>"Internet"===t.name).id}),r=d.a(t,"23"),d.j(r,v)&&h.push({amount:-7500,payee:l.find(t=>t.name.toLowerCase().includes("t-mobile")).id,account:e.id,date:r,category:c.find(t=>"Cell"===t.name).id})}let w=null;return h.forEach(t=>{(null==w||t.date<w)&&(w=t.date)}),h.unshift({amount:1e5,payee:r.find(t=>"Starting Balance"===t.name).id,account:e.id,date:w,category:y(s.categories),starting_balance_flag:!0}),Object(n.a)(e.id,h)}async function v(t,e,r,n){let{incomePayee:i,expensePayees:o,incomeGroup:a,expenseCategories:s}=b(r,n),u=p(20,40),c=[];for(let t=0;t<u;t++){let r,n;r=Math.random()<.04?i:g(o),n="Deposit"===r.name?a.categories.find(t=>"Income"===t.name):g(s);let u="Deposit"===r.name?p(5e4,7e4):p(0,-1e4);c.push({amount:u,payee:r.id,account:e.id,date:d.q(d.d(),2*t),category:n.id})}c.unshift({amount:p(9e4,12e4),payee:r.find(t=>"Starting Balance"===t.name).id,account:e.id,date:c[c.length-1].date,category:y(a.categories),starting_balance_flag:!0}),await t["transactions-batch-update"]({added:c,fastMode:!0})}async function w(t,e,r,n){let{incomePayee:i,incomeGroup:o}=b(r,n),a=p(10,30),s=[];for(let t=0;t<a;t++){let t=i,r=o.categories.find(t=>"Income"===t.name),n=p(1e4,2e4);s.push({amount:n,payee:t.id,account:e.id,date:d.q(d.d(),p(10,360)),category:r.id})}s.unshift({amount:p(1e4,2e4),payee:r.find(t=>"Starting Balance"===t.name).id,account:e.id,date:m(s,"date").date,category:y(o.categories),starting_balance_flag:!0}),await t["transactions-batch-update"]({added:s,fastMode:!0})}async function E(t,e,r,n){let{incomePayee:i,expensePayees:o,incomeGroup:a,expenseCategories:s}=b(r,n),u=p(15,40),c=[];for(let t=0;t<u;t++){let r;r=Math.random()<.3?i:g(o);let n=r===i?a.categories.find(t=>"Income"===t.name):g(s),u=r===i?p(1e4,8e4):p(-1e4,-2e3);c.push({amount:u,payee:r.id,account:e.id,date:d.q(d.d(),5*t),category:n.id})}c.unshift({amount:3e4,payee:r.find(t=>"Starting Balance"===t.name).id,account:e.id,date:c[c.length-1].date,category:y(a.categories),starting_balance_flag:!0}),await t["transactions-batch-update"]({added:c,fastMode:!0})}async function S(t,e,r,n){let{incomePayee:i,incomeGroup:o}=b(r,n),a=p(7,10),s=p(1e5,2e5),u=o.categories.find(t=>"Income"===t.name),c=[{amount:100*p(-3e3,-3500)*100,payee:r.find(t=>"Starting Balance"===t.name).id,account:e.id,date:d.r(d.d(),a)+"-02",category:y(o.categories),starting_balance_flag:!0}];for(let t=0;t<a;t++){let r=i;c.push({amount:s,payee:r.id,account:e.id,date:d.r(d.d(),t)+"-02",category:u.id,starting_balance_flag:!0})}await t["transactions-batch-update"]({added:c,fastMode:!0})}async function O(t,e,r,n){let{incomePayee:i,incomeGroup:o}=b(r,n),a=p(3,6),s=o.categories.find(t=>"Income"===t.name),u=[{amount:100*p(3250,3700)*100,payee:r.find(t=>"Starting Balance"===t.name).id,account:e.id,date:d.r(d.d(),a)+"-02",category:y(o.categories),starting_balance_flag:!0}];for(let t=0;t<a;t++){let r=i,n=100*p(4,9)*100;u.push({amount:n,payee:r.id,account:e.id,date:d.r(d.d(),t)+"-02",category:s.id})}await t["transactions-batch-update"]({added:u,fastMode:!0})}async function T(t){Object(f.k)("import"),await s.execQuery("PRAGMA journal_mode = OFF"),await s.runQuery("DELETE FROM categories;"),await s.runQuery("DELETE FROM category_groups");let e=[{name:"Bank of America",type:"checking"},{name:"Ally Savings",type:"savings"},{name:"Capital One Checking",type:"checking"},{name:"HSBC",type:"checking"},{name:"Vanguard 401k",type:"investment",offBudget:1},{name:"Mortgage",type:"mortgage",offBudget:1},{name:"House Asset",type:"other",offBudget:1},{name:"Roth IRA",type:"investment",offBudget:1}];await Object(u.e)(()=>Object(f.c)(async()=>{for(let r of e)r.id=await t["account-create"](r)}));let r=[{name:"Starting Balance"},{name:"Kroger"},{name:"Publix"},{name:"Home Depot"},{name:"Movies"},{name:"Online store"},{name:"Deposit"},{name:"Dominion Power",bill:!0},{name:"Extra Watery",bill:!0},{name:"Housy House",bill:!0},{name:"Fast Internet",bill:!0},{name:"T-mobile",bill:!0}];await Object(u.e)(()=>Object(f.c)(async()=>{for(let e of r)e.id=await t["payee-create"]({name:e.name})}));let g=[{name:"Usual Expenses",categories:[{name:"Savings"},{name:"Medical"},{name:"Gift"},{name:"General"},{name:"Clothing"},{name:"Entertainment"},{name:"Restaurants"},{name:"Food"}]},{name:"Bills",categories:[{name:"Power"},{name:"Water"},{name:"Mortgage"},{name:"Internet"},{name:"Cell"}]},{name:"Income",is_income:!0,categories:[{name:"Income",is_income:!0},{name:"Misc",is_income:!0},{name:"Starting Balances",is_income:!0}]}];await Object(u.e)(async()=>{for(let e of g){e.id=await t["category-group-create"]({name:e.name,isIncome:e.is_income?1:0});for(let r of e.categories)r.id=await t["category-create"]({...r,isIncome:r.is_income?1:0,groupId:e.id})}});let m=(await Object(u.d)(t["get-categories"])).grouped;Object(f.k)("import"),await Object(u.e)(()=>Object(f.c)(async()=>{for(let n of e)switch(n.type){case"checking":"Bank of America"===n.name?await _(0,n,r,m):await v(t,n,r,m);break;case"investment":await w(t,n,r,m);break;case"savings":await E(t,n,r,m);break;case"mortgage":await S(t,n,r,m);break;case"other":"House Asset"===n.name?await O(t,n,r,m):await v(t,n,r,m)}})),Object(f.k)("import");let y=e.find(t=>t.name="Bank of America"),{data:b}=await Object(i.g)(Object(h.b)("transactions").filter({account:y.id}).calculate({$sum:"$amount"}).serialize());if(b<0){let{data:e}=await Object(i.g)(Object(h.b)("transactions").filter({account:y.id,amount:{$gt:0}}).limit(1).select(["id","amount"]).serialize()),r=e[0];await Object(u.d)(t["transaction-update"],{...r,amount:r.amount+-b+p(1e4,2e4)})}Object(f.k)("disabled"),await c.d({isCached:!1}),await l.g(s),await a.a(),await l.j(),await async function(t,e,r){let i=t.find(t=>t.name="Bank of America"),a=(await s.first("SELECT * FROM v_transactions t LEFT JOIN accounts a ON t.account = a.id\n WHERE a.offbudget = 0 AND t.is_child = 0 ORDER BY date ASC LIMIT 1")).date,c=(await s.first("SELECT * FROM v_transactions t LEFT JOIN accounts a ON t.account = a.id\n WHERE a.id = ? AND a.offbudget = 0 AND t.is_child = 0 ORDER BY date ASC LIMIT 1",[i.id])).date,h=d.k(s.fromDateRepr(a)),g=d.e(),p=d.o(h,g);function m(t){for(let e of r){let r=e.categories.find(e=>e.name===t);if(r)return r}}function y(t,e,r){return o.h({month:t,category:e.id,amount:r})}function b(t,e){let r=l.d(d.p(t),"sum-amount-"+e.id);r<0&&y(t,e,-r)}await Object(u.e)(()=>Object(f.c)(async()=>{for(let t of p)t>=d.k(s.fromDateRepr(c))?(y(t,m("Food"),4e4),y(t,m("Restaurants"),3e4),y(t,m("Entertainment"),1e4),y(t,m("Clothing"),3e3),y(t,m("General"),5e4),y(t,m("Gift"),7500),y(t,m("Medical"),1e4),y(t,m("Cell"),7500),y(t,m("Internet"),6e3),y(t,m("Mortgage"),12e4),y(t,m("Water"),9e3),y(t,m("Power"),1e4)):(b(t,m("Food")),b(t,m("Restaurants")),b(t,m("Entertainment")),b(t,m("Clothing")),b(t,m("General")),b(t,m("Gift")),b(t,m("Medical")),b(t,m("Cell")),b(t,m("Internet")),b(t,m("Mortgage")),b(t,m("Water")),b(t,m("Power")))})),await l.j(),await Object(u.e)(()=>Object(f.c)(async()=>{let t=0;for(let e of p)if(e>=d.k(s.fromDateRepr(c))&&e<=d.e()){let r=d.p(e),n=l.d(r,"to-budget")-t;n-403e3>0?(y(e,m("Savings"),n-403e3),o.i(e,403e3),t+=n-403e3):n>0&&o.i(e,n)}})),await l.j();let _=d.p(d.e()),v=l.d(_,"to-budget");v<0&&await Object(n.a)(i.id,[{amount:-v,category:m("Income").id,date:d.e()+"-01"}]),await l.j()}(e,0,m)}},function(t,e,r){"use strict";(function(t){let r=1,n=2;function i(t){return(t[16]<<8)+t[17]}function o(t,e,r){return function(t,e,r){let n=[];for(let i=t;i<=e;i+=r)n.push(i);return n}(e-e%t,r-1-(r-1)%t,t)}function a(t,e,r,n){let i=o(e,r,n),a=0;return i.map(i=>{let o=0,s=e;r>i&&r<i+e&&(o=r-i),n>i&&n<i+e&&(s=n-i);let u=s-o,c=new ArrayBuffer(e);if(r>i+e||n<=i)return null;let l=t.byteOffset+a,f=t.buffer.byteLength-l;if(f<=0)return null;let d=Math.min(u,f);return new Uint8Array(c).set(new Uint8Array(t.buffer,l,d),o),a+=d,{pos:i,data:c,offset:o,length:d}}).filter(Boolean)}class s{constructor(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.filename=t,this.buffer=new Map,this.ops=e,this.meta=r,this._metaDirty=!1,this.writeLock=!1,this.openHandles=0}bufferChunks(t){for(let e=0;e<t.length;e++){let r=t[e];this.buffer.set(r.pos,r)}}open(){if(this.openHandles++,1===this.openHandles){this.ops.open();let t=this.ops.readMeta();null==this.meta&&(null==t&&(t={size:0}),this.meta=t)}return this.meta}close(){this.fsync(),this.openHandles=Math.max(this.openHandles-1,0),0===this.openHandles&&this.ops.close()}delete(){this.ops.delete()}load(t){let e=t.reduce((t,e)=>{let r=this.buffer.get(e);return r?t.chunks.push(r):t.missing.push(e),t},{chunks:[],missing:[]}),r=[];return e.missing.length>0&&(r=this.ops.readBlocks(e.missing,this.meta.blockSize)),e.chunks.concat(r)}read(t,e,r,n){let i=t.buffer;if(r<=0)return 0;if(n<0)return 0;if(n>=this.meta.size){let t=new Uint8Array(i,e);for(let e=0;e<r;e++)t[e]=0;return r}n=Math.max(n,0);let a=Math.min(r,this.meta.size-n),s=n,u=n+a,c=o(this.meta.blockSize,s,u),l=function(t,e,r){let n=new ArrayBuffer(r-e),i=new Uint8Array(n);for(let n=0;n<t.length;n++){let o=t[n];if("ArrayBuffer"!==o.data.constructor.name)throw new Error("Chunk data is not an ArrayBuffer");let a=0,s=o.data.byteLength;if(e>o.pos&&(a=e-o.pos),r<o.pos+o.data.byteLength&&(s=r-o.pos),a>o.data.byteLength||s<0)continue;let u=s-a;i.set(new Uint8Array(o.data,a,u),o.pos-e+a)}return n}(this.load(c),s,u);if(i.byteLength-e<l.byteLength)throw new Error("Buffer given to `read` is too small");let f=new Uint8Array(i);f.set(new Uint8Array(l),e);for(let t=a;t<r;t++)f[e+t]=0;return r}write(t,e,r,n){if(null==this.meta.blockSize){let r=i(new Uint8Array(t.buffer,t.byteOffset+e));if(![512,1024,2048,4096,8192,16384,32768,65536].includes(r))throw new Error("File has invalid page size. (the first block of a new file must be written first)");this.setattr({blockSize:r})}let o=t.buffer;if(r<=0)return 0;if(n<0)return 0;if(0===o.byteLength)return 0;r=Math.min(r,o.byteLength-e);let s=a(new Uint8Array(o,e,r),this.meta.blockSize,n,n+r),{partialWrites:u,fullWrites:c}=s.reduce((t,e)=>(e.length!==this.meta.blockSize?t.partialWrites.push(e):t.fullWrites.push({pos:e.pos,data:e.data}),t),{fullWrites:[],partialWrites:[]}),l=[];u.length>0&&(l=this.load(u.map(t=>t.pos)));let f=c.concat(l.map(t=>{let e=u.find(e=>e.pos===t.pos);return new Uint8Array(t.data).set(new Uint8Array(e.data,e.offset,e.length),e.offset,e.length),t}));return this.bufferChunks(f),n+r>this.meta.size&&this.setattr({size:n+r}),r}async readIfFallback(){if(this.ops.readIfFallback){let t=await this.ops.readIfFallback();this.meta=t||{size:0}}}lock(t){return this._recordingLock||(this._recordingLock=!0),!!this.ops.lock(t)&&(t>=n&&(this.writeLock=!0),!0)}unlock(t){return 0===t&&(this._recordingLock=!1),this.writeLock&&(this.fsync(),this.writeLock=!1),this.ops.unlock(t)}fsync(){if(this.buffer.size>0){let t=this.buffer.get(0);if(t){let e=i(new Uint8Array(t.data));if(e!==this.meta.blockSize){let t=this.buffer;this.buffer=new Map;let r=[...t.values()],n=r.length*this.meta.blockSize,i=new ArrayBuffer(n),o=new Uint8Array(i);for(let t of r)o.set(new Uint8Array(t.data),t.pos);this.bufferChunks(a(o,e,0,n)),this.setattr({blockSize:e})}}this.ops.writeBlocks([...this.buffer.values()],this.meta.blockSize)}this._metaDirty&&(this.ops.writeMeta({size:this.meta.size}),this._metaDirty=!1),this.buffer=new Map}setattr(t){null==this.meta&&(this.meta={}),void 0!==t.mode&&(this.meta.mode=t.mode),void 0!==t.blockSize&&(this.meta.blockSize=t.blockSize),void 0!==t.size&&(this.meta.size=t.size,this._metaDirty=!0)}getattr(){return this.meta}}class u{constructor(t){let{initialOffset:e=4,useAtomics:r=!0,stream:n=!0,debug:i,name:o}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.buffer=t,this.atomicView=new Int32Array(t),this.offset=e,this.useAtomics=r,this.stream=n,this.debug=i,this.name=o}log(){if(this.debug){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];console.log(`[reader: ${this.name}]`,...e)}}waitWrite(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.useAtomics){for(this.log("waiting for "+t);0===Atomics.load(this.atomicView,0);){if(null!=e&&"timed-out"===Atomics.wait(this.atomicView,0,0,e))throw new Error("timeout");Atomics.wait(this.atomicView,0,0,500)}this.log("resumed for "+t)}else if(1!==this.atomicView[0])throw new Error("`waitWrite` expected array to be readable")}flip(){if(this.log("flip"),this.useAtomics){if(1!==Atomics.compareExchange(this.atomicView,0,1,0))throw new Error("Read data out of sync! This is disastrous");Atomics.notify(this.atomicView,0)}else this.atomicView[0]=0;this.offset=4}done(){this.waitWrite("done");let t=3735928559===new DataView(this.buffer,this.offset).getUint32(0);return t&&(this.log("done"),this.flip()),t}peek(t){this.peekOffset=this.offset;let e=t();return this.offset=this.peekOffset,this.peekOffset=null,e}string(t){this.waitWrite("string",t);let e=this._int32(),r=e/2,n=new DataView(this.buffer,this.offset,e),i=[];for(let t=0;t<r;t++)i.push(n.getUint16(2*t));let o=String.fromCharCode.apply(null,i);return this.log("string",o),this.offset+=e,null==this.peekOffset&&this.flip(),o}_int32(){let t=new DataView(this.buffer,this.offset).getInt32();return this.log("_int32",t),this.offset+=4,t}int32(){this.waitWrite("int32");let t=this._int32();return this.log("int32",t),null==this.peekOffset&&this.flip(),t}bytes(){this.waitWrite("bytes");let t=this._int32(),e=new ArrayBuffer(t);return new Uint8Array(e).set(new Uint8Array(this.buffer,this.offset,t)),this.log("bytes",e),this.offset+=t,null==this.peekOffset&&this.flip(),e}}class c{constructor(t){let{initialOffset:e=4,useAtomics:r=!0,stream:n=!0,debug:i,name:o}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.buffer=t,this.atomicView=new Int32Array(t),this.offset=e,this.useAtomics=r,this.stream=n,this.debug=i,this.name=o,this.useAtomics?Atomics.store(this.atomicView,0,0):this.atomicView[0]=0}log(){if(this.debug){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];console.log(`[writer: ${this.name}]`,...e)}}waitRead(t){if(this.useAtomics){if(this.log("waiting for "+t),0!==Atomics.compareExchange(this.atomicView,0,0,1))throw new Error("Wrote something into unwritable buffer! This is disastrous");for(Atomics.notify(this.atomicView,0);1===Atomics.load(this.atomicView,0);)Atomics.wait(this.atomicView,0,1,500);this.log("resumed for "+t)}else this.atomicView[0]=1;this.offset=4}finalize(){this.log("finalizing"),new DataView(this.buffer,this.offset).setUint32(0,3735928559),this.waitRead("finalize")}string(t){this.log("string",t);let e=2*t.length;this._int32(e);let r=new DataView(this.buffer,this.offset,e);for(let e=0;e<t.length;e++)r.setUint16(2*e,t.charCodeAt(e));this.offset+=e,this.waitRead("string")}_int32(t){new DataView(this.buffer,this.offset).setInt32(0,t),this.offset+=4}int32(t){this.log("int32",t),this._int32(t),this.waitRead("int32")}bytes(t){this.log("bytes",t);let e=t.byteLength;this._int32(e),new Uint8Array(this.buffer,this.offset).set(new Uint8Array(t)),this.offset+=e,this.waitRead("bytes")}}function l(t,e){return Math.round(t/e)}class f{constructor(t){this.filename=t}getStoreName(){return this.filename.replace(/\//g,"-")}invokeWorker(t,e){if(null==this.reader||null==this.writer)throw new Error(`Attempted ${t} on ${this.filename} but file not open`);let r=this.reader,n=this.writer;switch(t){case"readBlocks":{let{name:t,positions:i,blockSize:o}=e,a=[];for(let e of i){n.string("readBlock"),n.string(t),n.int32(l(e,o)),n.finalize();let i=r.bytes();r.done(),a.push({pos:e,data:0===i.byteLength?new ArrayBuffer(o):i})}return a}case"writeBlocks":{let{name:t,writes:i,blockSize:o}=e;n.string("writeBlocks"),n.string(t);for(let t of i)n.int32(l(t.pos,o)),n.bytes(t.data);n.finalize();let a=r.int32();return r.done(),a}case"readMeta":{n.string("readMeta"),n.string(e.name),n.finalize();let t=r.int32(),i=r.int32();return r.done(),-1===t?null:{size:t,blockSize:i}}case"writeMeta":{let{name:t,meta:i}=e;n.string("writeMeta"),n.string(t),n.int32(i.size),n.finalize();let o=r.int32();return r.done(),o}case"closeFile":{n.string("closeFile"),n.string(e.name),n.finalize();let t=r.int32();return r.done(),t}case"lockFile":{n.string("lockFile"),n.string(e.name),n.int32(e.lockType),n.finalize();let t=r.int32();return r.done(),0===t}case"unlockFile":{n.string("unlockFile"),n.string(e.name),n.int32(e.lockType),n.finalize();let t=r.int32();return r.done(),0===t}}}lock(t){return this.invokeWorker("lockFile",{name:this.getStoreName(),lockType:t})}unlock(t){return this.invokeWorker("unlockFile",{name:this.getStoreName(),lockType:t})}delete(){(this.reader||this.writer)&&this.close();let t=globalThis.indexedDB.deleteDatabase(this.getStoreName());t.onerror=()=>{console.warn(`Deleting ${this.filename} database failed`)},t.onsuccess=()=>{}}open(){let t=new SharedArrayBuffer(36864);this.writer=new c(t,{name:"args (backend)",debug:!1});let e=new SharedArrayBuffer(36864);var r,n;this.reader=new u(e,{name:"results",debug:!1}),r=this.reader,n=this.writer,self.postMessage({type:"__absurd:spawn-idb-worker",argBuffer:n.buffer,resultBuffer:r.buffer}),self.addEventListener("message",t=>{switch(t.data.type){case"__perf-deets:start-profile":n.string("profile-start"),n.finalize(),r.int32(),r.done();break;case"__perf-deets:stop-profile":n.string("profile-stop"),n.finalize(),r.int32(),r.done()}})}close(){this.invokeWorker("closeFile",{name:this.getStoreName()}),this.reader=null,this.writer=null,this.worker=null}readMeta(){return this.invokeWorker("readMeta",{name:this.getStoreName()})}writeMeta(t){return this.invokeWorker("writeMeta",{name:this.getStoreName(),meta:t})}readBlocks(t,e){return this.stats&&(this.stats.read+=t.length),this.invokeWorker("readBlocks",{name:this.getStoreName(),positions:t,blockSize:e})}writeBlocks(t,e){return this.stats&&(this.stats.writes+=t.length),this.invokeWorker("writeBlocks",{name:this.getStoreName(),writes:t,blockSize:e})}}function d(t,e){return Math.round(t/e)}class h{constructor(t){this._openDb=null,this.hasAlertedFailure=!1,this.onFallbackFailure=t}async getDb(){return this._openDb||(this._openDb=await async function(t){return new Promise((e,r)=>{let n=globalThis.indexedDB.open(t,2);n.onsuccess=t=>{let r=t.target.result;r.onversionchange=()=>{console.log("closing because version changed"),r.close()},r.onclose=()=>{},e(r)},n.onupgradeneeded=t=>{let e=t.target.result;e.objectStoreNames.contains("data")||e.createObjectStore("data")},n.onblocked=t=>console.log("blocked",t),n.onerror=n.onabort=t=>r(t.target.error)})}(this.dbName)),this._openDb}closeDb(){this._openDb&&(this._openDb.close(),this._openDb=null)}async readAll(){let t=await this.getDb(this.dbName),e=new Map,r=t.transaction(["data"],"readonly").objectStore("data");return new Promise((t,n)=>{let i=r.openCursor(IDBKeyRange.lowerBound(-1));i.onerror=n,i.onsuccess=r=>{let n=r.target.result;n?(e.set(n.key,n.value),n.continue()):t(e)}})}async write(t,e,r){let n=(await this.getDb(this.dbName)).transaction(["data"],"readwrite"),i=n.objectStore("data");await new Promise((o,a)=>{let s=i.get(0);s.onsuccess=u=>{if(r&&!function(t,e){if(null!=t&&null!=e){let r=new Uint8Array(t),n=new Uint8Array(e);for(let t=24;t<40;t++)if(r[t]!==n[t])return!1;return!0}return null==t&&null==e}(s.result,e))return this.onFallbackFailure&&!this.hasAlertedFailure&&(this.hasAlertedFailure=!0,this.onFallbackFailure()),void a(new Error("Fallback mode unable to write file changes"));for(let e of t)i.put(e.value,e.key);n.onsuccess=()=>o(),n.onerror=()=>a()},s.onerror=a})}}class g{constructor(t,e){this.filename=t,this.dbName=this.filename.replace(/\//g,"-"),this.cachedFirstBlock=null,this.writeQueue=null,this.blocks=new Map,this.lockType=0,this.transferBlockOwnership=!1,this.persistance=new h(e)}async readIfFallback(){return this.transferBlockOwnership=!0,this.blocks=await this.persistance.readAll(),this.readMeta()}lock(t){return this.cachedFirstBlock=this.blocks.get(0),this.lockType=t,!0}unlock(t){return this.lockType>r&&t===r&&this.flush(),this.lockType=t,!0}delete(){let t=globalThis.indexedDB.deleteDatabase(this.dbName);t.onerror=()=>{console.warn(`Deleting ${this.filename} database failed`)},t.onsuccess=()=>{}}open(){this.writeQueue=[],this.lockType=0}close(){this.flush(),this.transferBlockOwnership?this.transferBlockOwnership=!1:this.blocks=new Map,this.persistance.closeDb()}readMeta(){let t=this.blocks.get(-1);if(t){let e=this.blocks.get(0);return{size:t.size,blockSize:i(new Uint8Array(e))}}return null}writeMeta(t){this.blocks.set(-1,t),this.queueWrite(-1,t)}readBlocks(t,e){let r=[];for(let n of t)r.push({pos:n,data:this.blocks.get(d(n,e))});return r}writeBlocks(t,e){for(let r of t){let t=d(r.pos,e);this.blocks.set(t,r.data),this.queueWrite(t,r.data)}this.lockType<=r&&this.flush()}queueWrite(t,e){this.writeQueue.push({key:t,value:e})}flush(){this.writeQueue.length>0&&(this.persistance.write(this.writeQueue,this.cachedFirstBlock,this.lockType>r),this.writeQueue=[]),this.cachedFirstBlock=null}}e.a=class{constructor(t){this.onFallbackFailure=t}createFile(e){let r;r="undefined"!=typeof SharedArrayBuffer?new f(e):new g(e,this.onFallbackFailure);let n=new s(e,r);return t.env.PERF_BUILD&&(null==this._files&&(this._files=new Set),this._files.add(n)),n}startProfile(){for(let t of this._files)if(t.ops.writer){let e=t.ops.writer,r=t.ops.reader;e.string("profile-start"),e.finalize(),r.int32(),r.done()}}stopProfile(){for(let t of this._files)if(t.ops.writer){let e=t.ops.writer,r=t.ops.reader;e.string("profile-stop"),e.finalize(),r.int32(),r.done()}}}}).call(this,r(25))},function(t,e,r){(function(t,e,n,i){var o=void 0,a=function(a){return o||(o=new Promise((function(o,s){var u,c=(u=void 0!==a?a:{}).onAbort;u.onAbort=function(t){s(new Error(t)),c&&c(t)},u.postRun=u.postRun||[],u.postRun.push((function(){o(u)})),t=void 0,u||(u=void 0!==u?u:{}),u.onRuntimeInitialized=function(){function t(t,e){this.Qa=t,this.db=e,this.Pa=1,this.wb=[]}function e(t,e){if(this.db=e,e=$(t)+1,this.hb=qt(e),null===this.hb)throw Error("Unable to allocate memory for the SQL string");Y(t,F,this.hb,e),this.sb=this.hb,this.eb=this.Mb=null}function r(t){let{filename:e=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!1===e?(this.filename="dbfile_"+(4294967295*Math.random()>>>0),this.Xc=!0,null!=t&&Nt.zb("/",this.filename,t,!0,!0)):this.filename=t,this.handleError(o(this.filename,n)),this.db=N(n,"i32"),tt(this.db),this.nb={},this.Xa={}}var n=Xt(4),i=u.cwrap,o=i("sqlite3_open","number",["string","number"]),a=i("sqlite3_close_v2","number",["number"]),s=i("sqlite3_exec","number",["number","string","number","number","number"]),c=i("sqlite3_changes","number",["number"]),l=i("sqlite3_prepare_v2","number",["number","string","number","number","number"]),f=i("sqlite3_sql","string",["number"]),d=i("sqlite3_normalized_sql","string",["number"]),h=i("sqlite3_prepare_v2","number",["number","number","number","number","number"]),g=i("sqlite3_bind_text","number",["number","number","number","number","number"]),p=i("sqlite3_bind_blob","number",["number","number","number","number","number"]),m=i("sqlite3_bind_double","number",["number","number","number"]),y=i("sqlite3_bind_int","number",["number","number","number"]),b=i("sqlite3_bind_parameter_index","number",["number","string"]),_=i("sqlite3_step","number",["number"]),v=i("sqlite3_errmsg","string",["number"]),w=i("sqlite3_column_count","number",["number"]),E=i("sqlite3_data_count","number",["number"]),S=i("sqlite3_column_double","number",["number","number"]),O=i("sqlite3_column_text","string",["number","number"]),T=i("sqlite3_column_blob","number",["number","number"]),A=i("sqlite3_column_bytes","number",["number","number"]),k=i("sqlite3_column_type","number",["number","number"]),D=i("sqlite3_column_name","string",["number","number"]),j=i("sqlite3_reset","number",["number"]),C=i("sqlite3_clear_bindings","number",["number"]),L=i("sqlite3_finalize","number",["number"]),B=i("sqlite3_create_function_v2","number","number string number number number number number number number".split(" ")),P=i("sqlite3_value_type","number",["number"]),W=i("sqlite3_value_bytes","number",["number"]),z=i("sqlite3_value_text","string",["number"]),H=i("sqlite3_value_blob","number",["number"]),q=i("sqlite3_value_double","number",["number"]),V=i("sqlite3_result_double","",["number","number"]),K=i("sqlite3_result_null","",["number"]),Z=i("sqlite3_result_text","",["number","string","number","number"]),J=i("sqlite3_result_blob","",["number","number","number","number"]),X=i("sqlite3_result_int","",["number","number"]),Q=i("sqlite3_result_error","",["number","string","number"]),tt=i("RegisterExtensionFunctions","number",["number"]);t.prototype.bind=function(t){if(!this.Qa)throw"Statement closed";return this.reset(),Array.isArray(t)?this.vc(t):null==t||"object"!=typeof t||this.wc(t)},t.prototype.step=function(){if(!this.Qa)throw"Statement closed";this.Pa=1;var t=_(this.Qa);switch(t){case 100:return!0;case 101:return!1;default:throw this.db.handleError(t)}},t.prototype.Pc=function(t){return null==t&&(t=this.Pa,this.Pa+=1),S(this.Qa,t)},t.prototype.Qc=function(t){return null==t&&(t=this.Pa,this.Pa+=1),O(this.Qa,t)},t.prototype.getBlob=function(t){null==t&&(t=this.Pa,this.Pa+=1);var e=A(this.Qa,t);t=T(this.Qa,t);for(var r=new Uint8Array(e),n=0;n<e;n+=1)r[n]=U[t+n];return r},t.prototype.get=function(t){null!=t&&this.bind(t)&&this.step(),t=[];for(var e=E(this.Qa),r=0;r<e;r+=1)switch(k(this.Qa,r)){case 1:case 2:t.push(this.Pc(r));break;case 3:t.push(this.Qc(r));break;case 4:t.push(this.getBlob(r));break;default:t.push(null)}return t},t.prototype.getColumnNames=function(){for(var t=[],e=w(this.Qa),r=0;r<e;r+=1)t.push(D(this.Qa,r));return t},t.prototype.getAsObject=function(t){t=this.get(t);for(var e=this.getColumnNames(),r={},n=0;n<e.length;n+=1)r[e[n]]=t[n];return r},t.prototype.getSQL=function(){return f(this.Qa)},t.prototype.getNormalizedSQL=function(){return d(this.Qa)},t.prototype.run=function(t){return null!=t&&this.bind(t),this.step(),this.reset()},t.prototype.zc=function(t,e){null==e&&(e=this.Pa,this.Pa+=1);var r=x(t=Wt(t));this.wb.push(r),this.db.handleError(g(this.Qa,e,r,t.length-1,0))},t.prototype.uc=function(t,e){null==e&&(e=this.Pa,this.Pa+=1);var r=x(t);this.wb.push(r),this.db.handleError(p(this.Qa,e,r,t.length,0))},t.prototype.yc=function(t,e){null==e&&(e=this.Pa,this.Pa+=1),this.db.handleError((t===(0|t)?y:m)(this.Qa,e,t))},t.prototype.xc=function(t){null==t&&(t=this.Pa,this.Pa+=1),p(this.Qa,t,0,0,0)},t.prototype.Tb=function(t,e){switch(null==e&&(e=this.Pa,this.Pa+=1),typeof t){case"string":return void this.zc(t,e);case"number":case"boolean":return void this.yc(t+0,e);case"object":if(null===t)return void this.xc(e);if(null!=t.length)return void this.uc(t,e)}throw"Wrong API use : tried to bind a value of an unknown type ("+t+")."},t.prototype.wc=function(t){var e=this;return Object.keys(t).forEach((function(r){var n=b(e.Qa,r);0!==n&&e.Tb(t[r],n)})),!0},t.prototype.vc=function(t){for(var e=0;e<t.length;e+=1)this.Tb(t[e],e+1);return!0},t.prototype.reset=function(){return 0===C(this.Qa)&&0===j(this.Qa)},t.prototype.freemem=function(){for(var t;void 0!==(t=this.wb.pop());)Vt(t)},t.prototype.free=function(){var t=0===L(this.Qa);return delete this.db.nb[this.Qa],this.Qa=0,t},e.prototype.next=function(){if(null===this.hb)return{done:!0};if(null!==this.eb&&(this.eb.free(),this.eb=null),!this.db.db)throw this.Bb(),Error("Database closed");var e=Zt(),r=Xt(4);R(n),R(r);try{this.db.handleError(h(this.db.db,this.sb,-1,n,r)),this.sb=N(r,"i32");var i=N(n,"i32");return 0===i?(this.Bb(),{done:!0}):(this.eb=new t(i,this.db),this.db.nb[i]=this.eb,{value:this.eb,done:!1})}catch(t){throw this.Mb=G(this.sb),this.Bb(),t}finally{Jt(e)}},e.prototype.Bb=function(){Vt(this.hb),this.hb=null},e.prototype.getRemainingSQL=function(){return null!==this.Mb?this.Mb:G(this.sb)},"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator&&(e.prototype[Symbol.iterator]=function(){return this}),r.prototype.run=function(t,e){if(!this.db)throw"Database closed";if(e){t=this.prepare(t,e);try{t.step()}finally{t.free()}}else this.handleError(s(this.db,t,0,0,n));return this},r.prototype.exec=function(e,r){if(!this.db)throw"Database closed";var i=Zt(),o=null;try{var a=$(e)+1,s=Xt(a);Y(e,U,s,a);var u=s,c=Xt(4);for(e=[];0!==N(u,"i8");){R(n),R(c),this.handleError(h(this.db,u,-1,n,c));var l=N(n,"i32");if(u=N(c,"i32"),0!==l){for(a=null,o=new t(l,this),null!=r&&o.bind(r);o.step();)null===a&&(a={columns:o.getColumnNames(),values:[]},e.push(a)),a.values.push(o.get());o.free()}}return e}catch(t){throw o&&o.free(),t}finally{Jt(i)}},r.prototype.each=function(t,e,r,n){"function"==typeof e&&(n=r,r=e,e=void 0),t=this.prepare(t,e);try{for(;t.step();)r(t.getAsObject())}finally{t.free()}if("function"==typeof n)return n()},r.prototype.prepare=function(e,r){if(R(n),this.handleError(l(this.db,e,-1,n,0)),0===(e=N(n,"i32")))throw"Nothing to prepare";var i=new t(e,this);return null!=r&&i.bind(r),this.nb[e]=i},r.prototype.iterateStatements=function(t){return new e(t,this)},r.prototype.export=function(){Object.values(this.nb).forEach((function(t){t.free()})),Object.values(this.Xa).forEach(M),this.Xa={},this.handleError(a(this.db));var t=Nt.readFile(this.filename,{encoding:"binary"});return this.handleError(o(this.filename,n)),this.db=N(n,"i32"),t},r.prototype.close=function(){null!==this.db&&(Object.values(this.nb).forEach((function(t){t.free()})),Object.values(this.Xa).forEach(M),this.Xa={},this.handleError(a(this.db)),this.Xc&&Nt.unlink("/"+this.filename),this.db=null)},r.prototype.handleError=function(t){if(0===t)return null;throw t=v(this.db),Error(t)},r.prototype.getRowsModified=function(){return c(this.db)},r.prototype.create_function=function(t,e){Object.prototype.hasOwnProperty.call(this.Xa,t)&&(M(this.Xa[t]),delete this.Xa[t]);var r=I((function(t,r,n){for(var i,o=[],a=0;a<r;a+=1){var s=N(n+4*a,"i32"),u=P(s);if(1===u||2===u)s=q(s);else if(3===u)s=z(s);else if(4===u){s=W(u=s),u=H(u);for(var c=new Uint8Array(s),l=0;l<s;l+=1)c[l]=U[u+l];s=c}else s=null;o.push(s)}try{i=e.apply(null,o)}catch(e){return void Q(t,e,-1)}switch(typeof i){case"boolean":X(t,i?1:0);break;case"number":V(t,i);break;case"string":Z(t,i,-1,-1);break;case"object":null===i?K(t):null!=i.length?(r=x(i),J(t,r,i.length,-1),Vt(r)):Q(t,"Wrong API use : tried to return a value of an unknown type ("+i+").",-1);break;default:K(t)}}),"viii");return this.Xa[t]=r,this.handleError(B(this.db,t,e.length,1,0,r,0,0,0)),this},u.Database=r;var et=new Map;u.register_for_idb=t=>{let e=I((function(e,r){return e=et.get(e),t.lock(e,r)?0:5}),"iii"),r=I((function(e,r){return e=et.get(e),t.unlock(e,r),0}),"iii"),n=I((function(t,e){t=G(t),et.set(e,t)}),"vii");u._register_for_idb(e,r,n)},u.cleanup_file=t=>{let e=[...et.entries()].find(e=>e[1]===t);et.delete(e[0])},u.reset_filesystem=()=>{Nt.root=null,Nt.lc()}};var l,f={};for(l in u)u.hasOwnProperty(l)&&(f[l]=u[l]);var d,h,g,p,m,y="./this.program",b="object"==typeof window,_="function"==typeof importScripts,v="object"==typeof e&&"object"==typeof e.versions&&"string"==typeof e.versions.node,w="";v?(w=_?r(43).dirname(w)+"/":n+"/",d=function(t,e){return p||(p=r(41)),m||(m=r(43)),t=m.normalize(t),p.readFileSync(t,e?null:"utf8")},g=function(t){return(t=d(t,!0)).buffer||(t=new Uint8Array(t)),j(t.buffer),t},h=function(t,e,n){p||(p=r(41)),m||(m=r(43)),t=m.normalize(t),p.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1<e.argv.length&&(y=e.argv[1].replace(/\\/g,"/")),e.argv.slice(2),t.exports=u,u.inspect=function(){return"[Emscripten Module object]"}):(b||_)&&(_?w=self.location.href:"undefined"!=typeof document&&document.currentScript&&(w=document.currentScript.src),w=0!==w.indexOf("blob:")?w.substr(0,w.lastIndexOf("/")+1):"",d=function(t){var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},_&&(g=function(t){var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),h=function(t,e,r){var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?e(n.response):r()},n.onerror=r,n.send(null)});var E=u.print||console.log.bind(console),S=u.printErr||console.warn.bind(console);for(l in f)f.hasOwnProperty(l)&&(u[l]=f[l]);f=null,u.thisProgram&&(y=u.thisProgram);var O,T,A=[];function M(t){O.delete(J.get(t)),A.push(t)}function I(t,e){if(!O){O=new WeakMap;for(var r=0;r<J.length;r++){var n=J.get(r);n&&O.set(n,r)}}if(O.has(t))t=O.get(t);else{if(A.length)r=A.pop();else{try{J.grow(1)}catch(t){if(!(t instanceof RangeError))throw t;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."}r=J.length-1}try{J.set(r,t)}catch(s){if(!(s instanceof TypeError))throw s;if("function"==typeof WebAssembly.Function){var i={i:"i32",j:"i64",f:"f32",d:"f64"},o={parameters:[],results:"v"==e[0]?[]:[i[e[0]]]};for(n=1;n<e.length;++n)o.parameters.push(i[e[n]]);e=new WebAssembly.Function(o,t)}else{i=[1,0,1,96],o=e.slice(0,1),e=e.slice(1);var a={i:127,j:126,f:125,d:124};for(i.push(e.length),n=0;n<e.length;++n)i.push(a[e[n]]);"v"==o?i.push(0):i=i.concat([1,a[o]]),i[1]=i.length-2,e=new Uint8Array([0,97,115,109,1,0,0,0].concat(i,[2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0])),e=new WebAssembly.Module(e),e=new WebAssembly.Instance(e,{e:{f:t}}).exports.f}J.set(r,e)}O.set(t,r),t=r}return t}u.wasmBinary&&(T=u.wasmBinary);u.noExitRuntime;function R(t){var e="i32";switch("*"===e.charAt(e.length-1)&&(e="i32"),e){case"i1":case"i8":U[t>>0]=0;break;case"i16":P[t>>1]=0;break;case"i32":W[t>>2]=0;break;case"i64":it=[0,(nt=0,1<=+Math.abs(nt)?0<nt?(0|Math.min(+Math.floor(nt/4294967296),4294967295))>>>0:~~+Math.ceil((nt-+(~~nt>>>0))/4294967296)>>>0:0)],W[t>>2]=it[0],W[t+4>>2]=it[1];break;case"float":z[t>>2]=0;break;case"double":H[t>>3]=0;break;default:ft("invalid type for setValue: "+e)}}function N(t,e){switch("*"===(e=e||"i8").charAt(e.length-1)&&(e="i32"),e){case"i1":case"i8":return U[t>>0];case"i16":return P[t>>1];case"i32":case"i64":return W[t>>2];case"float":return z[t>>2];case"double":return H[t>>3];default:ft("invalid type for getValue: "+e)}return null}"object"!=typeof WebAssembly&&ft("no native wasm support detected");var k,D=!1;function j(t,e){t||ft("Assertion failed: "+e)}function C(t){var e=u["_"+t];return j(e,"Cannot call unknown function "+t+", make sure it is exported"),e}function L(t,e,r,n){var i,o={string:function(t){var e=0;if(null!=t&&0!==t){var r=1+(t.length<<2);e=Xt(r),Y(t,F,e,r)}return e},array:function(t){var e=Xt(t.length);return U.set(t,e),e}},a=C(t),s=[];if(t=0,n)for(var u=0;u<n.length;u++){var c=o[r[u]];c?(0===t&&(t=Zt()),s[u]=c(n[u])):s[u]=n[u]}return r=a.apply(null,s),i=r,r="string"===e?G(i):"boolean"===e?!!i:i,0!==t&&Jt(t),r}function x(t){var e=qt(t.length);return t.subarray||t.slice?F.set(t,e):F.set(new Uint8Array(t),e),e}var B,U,F,P,W,z,H,q="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function V(t,e,r){var n=e+r;for(r=e;t[r]&&!(r>=n);)++r;if(16<r-e&&t.subarray&&q)return q.decode(t.subarray(e,r));for(n="";e<r;){var i=t[e++];if(128&i){var o=63&t[e++];if(192==(224&i))n+=String.fromCharCode((31&i)<<6|o);else{var a=63&t[e++];65536>(i=224==(240&i)?(15&i)<<12|o<<6|a:(7&i)<<18|o<<12|a<<6|63&t[e++])?n+=String.fromCharCode(i):(i-=65536,n+=String.fromCharCode(55296|i>>10,56320|1023&i))}}else n+=String.fromCharCode(i)}return n}function G(t,e){return t?V(F,t,e):""}function Y(t,e,r,n){if(!(0<n))return 0;var i=r;n=r+n-1;for(var o=0;o<t.length;++o){var a=t.charCodeAt(o);if(55296<=a&&57343>=a)a=65536+((1023&a)<<10)|1023&t.charCodeAt(++o);if(127>=a){if(r>=n)break;e[r++]=a}else{if(2047>=a){if(r+1>=n)break;e[r++]=192|a>>6}else{if(65535>=a){if(r+2>=n)break;e[r++]=224|a>>12}else{if(r+3>=n)break;e[r++]=240|a>>18,e[r++]=128|a>>12&63}e[r++]=128|a>>6&63}e[r++]=128|63&a}}return e[r]=0,r-i}function $(t){for(var e=0,r=0;r<t.length;++r){var n=t.charCodeAt(r);55296<=n&&57343>=n&&(n=65536+((1023&n)<<10)|1023&t.charCodeAt(++r)),127>=n?++e:e=2047>=n?e+2:65535>=n?e+3:e+4}return e}function K(t){var e=$(t)+1,r=qt(e);return r&&Y(t,U,r,e),r}function Z(){var t=k.buffer;B=t,u.HEAP8=U=new Int8Array(t),u.HEAP16=P=new Int16Array(t),u.HEAP32=W=new Int32Array(t),u.HEAPU8=F=new Uint8Array(t),u.HEAPU16=new Uint16Array(t),u.HEAPU32=new Uint32Array(t),u.HEAPF32=z=new Float32Array(t),u.HEAPF64=H=new Float64Array(t)}var J,X=[],Q=[],tt=[];function et(){var t=u.preRun.shift();X.unshift(t)}var rt,nt,it,ot,at=0,st=null,ut=null;function ct(){at++,u.monitorRunDependencies&&u.monitorRunDependencies(at)}function lt(){if(at--,u.monitorRunDependencies&&u.monitorRunDependencies(at),0==at&&(null!==st&&(clearInterval(st),st=null),ut)){var t=ut;ut=null,t()}}function ft(t){throw u.onAbort&&u.onAbort(t),S(t),D=!0,new WebAssembly.RuntimeError("abort("+t+"). Build with -s ASSERTIONS=1 for more info.")}function dt(){return rt.startsWith("data:application/octet-stream;base64,")}if(u.preloadedImages={},u.preloadedAudios={},rt="sql-wasm.wasm",!dt()){var ht=rt;rt=u.locateFile?u.locateFile(ht,w):w+ht}function gt(){var t=rt;try{if(t==rt&&T)return new Uint8Array(T);if(g)return g(t);throw"both async and sync fetching of the wasm failed"}catch(t){ft(t)}}function pt(t){for(;0<t.length;){var e=t.shift();if("function"==typeof e)e(u);else{var r=e.pd;"number"==typeof r?void 0===e.yb?J.get(r)():J.get(r)(e.yb):r(void 0===e.yb?null:e.yb)}}}function mt(t,e){for(var r=0,n=t.length-1;0<=n;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r;r--)t.unshift("..");return t}function yt(t){var e="/"===t.charAt(0),r="/"===t.substr(-1);return(t=mt(t.split("/").filter((function(t){return!!t})),!e).join("/"))||e||(t="."),t&&r&&(t+="/"),(e?"/":"")+t}function bt(t){var e=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(t).slice(1);return t=e[0],e=e[1],t||e?(e&&(e=e.substr(0,e.length-1)),t+e):"."}function _t(t){if("/"===t)return"/";var e=(t=(t=yt(t)).replace(/\/$/,"")).lastIndexOf("/");return-1===e?t:t.substr(e+1)}function vt(t,e){return yt(t+"/"+e)}function wt(){for(var t="",e=!1,r=arguments.length-1;-1<=r&&!e;r--){if("string"!=typeof(e=0<=r?arguments[r]:Nt.cwd()))throw new TypeError("Arguments to path.resolve must be strings");if(!e)return"";t=e+"/"+t,e="/"===e.charAt(0)}return(e?"/":"")+(t=mt(t.split("/").filter((function(t){return!!t})),!e).join("/"))||"."}function Et(t,e){function r(t){for(var e=0;e<t.length&&""===t[e];e++);for(var r=t.length-1;0<=r&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=wt(t).substr(1),e=wt(e).substr(1),t=r(t.split("/")),e=r(e.split("/"));for(var n=Math.min(t.length,e.length),i=n,o=0;o<n;o++)if(t[o]!==e[o]){i=o;break}for(n=[],o=i;o<t.length;o++)n.push("..");return(n=n.concat(e.slice(i))).join("/")}var St=[];function Ot(t,e){St[t]={input:[],output:[],gb:e},Nt.Qb(t,Tt)}var Tt={open:function(t){var e=St[t.node.rdev];if(!e)throw new Nt.ErrnoError(43);t.tty=e,t.seekable=!1},close:function(t){t.tty.gb.flush(t.tty)},flush:function(t){t.tty.gb.flush(t.tty)},read:function(t,e,r,n){if(!t.tty||!t.tty.gb.cc)throw new Nt.ErrnoError(60);for(var i=0,o=0;o<n;o++){try{var a=t.tty.gb.cc(t.tty)}catch(t){throw new Nt.ErrnoError(29)}if(void 0===a&&0===i)throw new Nt.ErrnoError(6);if(null==a)break;i++,e[r+o]=a}return i&&(t.node.timestamp=Date.now()),i},write:function(t,e,r,n){if(!t.tty||!t.tty.gb.Nb)throw new Nt.ErrnoError(60);try{for(var i=0;i<n;i++)t.tty.gb.Nb(t.tty,e[r+i])}catch(t){throw new Nt.ErrnoError(29)}return n&&(t.node.timestamp=Date.now()),i}},At={cc:function(t){if(!t.input.length){var r=null;if(v){var n=i.alloc(256),o=0;try{o=p.readSync(e.stdin.fd,n,0,256,null)}catch(t){if(!t.toString().includes("EOF"))throw t;o=0}r=0<o?n.slice(0,o).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(r=window.prompt("Input: "))&&(r+="\n"):"function"==typeof readline&&(null!==(r=readline())&&(r+="\n"));if(!r)return null;t.input=Wt(r,!0)}return t.input.shift()},Nb:function(t,e){null===e||10===e?(E(V(t.output,0)),t.output=[]):0!=e&&t.output.push(e)},flush:function(t){t.output&&0<t.output.length&&(E(V(t.output,0)),t.output=[])}},Mt={Nb:function(t,e){null===e||10===e?(S(V(t.output,0)),t.output=[]):0!=e&&t.output.push(e)},flush:function(t){t.output&&0<t.output.length&&(S(V(t.output,0)),t.output=[])}};function It(t){t=65536*Math.ceil(t/65536);var e=Qt(65536,t);return e?(F.fill(0,e,e+t),e):0}var Rt={Va:null,mount:function(){return Rt.createNode(null,"/",16895,0)},createNode:function(t,e,r,n){if(Nt.Rc(r)||Nt.isFIFO(r))throw new Nt.ErrnoError(63);return Rt.Va||(Rt.Va={dir:{node:{getattr:Rt.node_ops.getattr,setattr:Rt.node_ops.setattr,lookup:Rt.node_ops.lookup,mknod:Rt.node_ops.mknod,rename:Rt.node_ops.rename,unlink:Rt.node_ops.unlink,rmdir:Rt.node_ops.rmdir,readdir:Rt.node_ops.readdir,symlink:Rt.node_ops.symlink},stream:{llseek:Rt.stream_ops.llseek}},file:{node:{getattr:Rt.node_ops.getattr,setattr:Rt.node_ops.setattr},stream:{llseek:Rt.stream_ops.llseek,read:Rt.stream_ops.read,write:Rt.stream_ops.write,allocate:Rt.stream_ops.allocate,mmap:Rt.stream_ops.mmap,msync:Rt.stream_ops.msync}},link:{node:{getattr:Rt.node_ops.getattr,setattr:Rt.node_ops.setattr,readlink:Rt.node_ops.readlink},stream:{}},Vb:{node:{getattr:Rt.node_ops.getattr,setattr:Rt.node_ops.setattr},stream:Nt.Cc}}),r=Nt.createNode(t,e,r,n),Nt.isDir(r.mode)?(r.node_ops=Rt.Va.dir.node,r.stream_ops=Rt.Va.dir.stream,r.Na={}):Nt.isFile(r.mode)?(r.node_ops=Rt.Va.file.node,r.stream_ops=Rt.Va.file.stream,r.Ra=0,r.Na=null):Nt.fb(r.mode)?(r.node_ops=Rt.Va.link.node,r.stream_ops=Rt.Va.link.stream):Nt.pb(r.mode)&&(r.node_ops=Rt.Va.Vb.node,r.stream_ops=Rt.Va.Vb.stream),r.timestamp=Date.now(),t&&(t.Na[e]=r,t.timestamp=r.timestamp),r},qd:function(t){return t.Na?t.Na.subarray?t.Na.subarray(0,t.Ra):new Uint8Array(t.Na):new Uint8Array(0)},Zb:function(t,e){var r=t.Na?t.Na.length:0;r>=e||(e=Math.max(e,r*(1048576>r?2:1.125)>>>0),0!=r&&(e=Math.max(e,256)),r=t.Na,t.Na=new Uint8Array(e),0<t.Ra&&t.Na.set(r.subarray(0,t.Ra),0))},gd:function(t,e){if(t.Ra!=e)if(0==e)t.Na=null,t.Ra=0;else{var r=t.Na;t.Na=new Uint8Array(e),r&&t.Na.set(r.subarray(0,Math.min(e,t.Ra))),t.Ra=e}},node_ops:{getattr:function(t){var e={};return e.dev=Nt.pb(t.mode)?t.id:1,e.ino=t.id,e.mode=t.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=t.rdev,Nt.isDir(t.mode)?e.size=4096:Nt.isFile(t.mode)?e.size=t.Ra:Nt.fb(t.mode)?e.size=t.link.length:e.size=0,e.atime=new Date(t.timestamp),e.mtime=new Date(t.timestamp),e.ctime=new Date(t.timestamp),e.Ac=4096,e.blocks=Math.ceil(e.size/e.Ac),e},setattr:function(t,e){void 0!==e.mode&&(t.mode=e.mode),void 0!==e.timestamp&&(t.timestamp=e.timestamp),void 0!==e.size&&Rt.gd(t,e.size)},lookup:function(){throw Nt.Db[44]},mknod:function(t,e,r,n){return Rt.createNode(t,e,r,n)},rename:function(t,e,r){if(Nt.isDir(t.mode)){try{var n=Nt.lookupNode(e,r)}catch(t){}if(n)for(var i in n.Na)throw new Nt.ErrnoError(55)}delete t.parent.Na[t.name],t.parent.timestamp=Date.now(),t.name=r,e.Na[r]=t,e.timestamp=t.parent.timestamp,t.parent=e},unlink:function(t,e){delete t.Na[e],t.timestamp=Date.now()},rmdir:function(t,e){var r,n=Nt.lookupNode(t,e);for(r in n.Na)throw new Nt.ErrnoError(55);delete t.Na[e],t.timestamp=Date.now()},readdir:function(t){var e,r=[".",".."];for(e in t.Na)t.Na.hasOwnProperty(e)&&r.push(e);return r},symlink:function(t,e,r){return(t=Rt.createNode(t,e,41471,0)).link=r,t},readlink:function(t){if(!Nt.fb(t.mode))throw new Nt.ErrnoError(28);return t.link}},stream_ops:{read:function(t,e,r,n,i){var o=t.node.Na;if(i>=t.node.Ra)return 0;if(8<(t=Math.min(t.node.Ra-i,n))&&o.subarray)e.set(o.subarray(i,i+t),r);else for(n=0;n<t;n++)e[r+n]=o[i+n];return t},write:function(t,e,r,n,i,o){if(e.buffer===U.buffer&&(o=!1),!n)return 0;if((t=t.node).timestamp=Date.now(),e.subarray&&(!t.Na||t.Na.subarray)){if(o)return t.Na=e.subarray(r,r+n),t.Ra=n;if(0===t.Ra&&0===i)return t.Na=e.slice(r,r+n),t.Ra=n;if(i+n<=t.Ra)return t.Na.set(e.subarray(r,r+n),i),n}if(Rt.Zb(t,i+n),t.Na.subarray&&e.subarray)t.Na.set(e.subarray(r,r+n),i);else for(o=0;o<n;o++)t.Na[i+o]=e[r+o];return t.Ra=Math.max(t.Ra,i+n),n},llseek:function(t,e,r){if(1===r?e+=t.position:2===r&&Nt.isFile(t.node.mode)&&(e+=t.node.Ra),0>e)throw new Nt.ErrnoError(28);return e},allocate:function(t,e,r){Rt.Zb(t.node,e+r),t.node.Ra=Math.max(t.node.Ra,e+r)},mmap:function(t,e,r,n,i,o){if(0!==e)throw new Nt.ErrnoError(28);if(!Nt.isFile(t.node.mode))throw new Nt.ErrnoError(43);if(t=t.node.Na,2&o||t.buffer!==B){if((0<n||n+r<t.length)&&(t=t.subarray?t.subarray(n,n+r):Array.prototype.slice.call(t,n,n+r)),n=!0,!(r=It(r)))throw new Nt.ErrnoError(48);U.set(t,r)}else n=!1,r=t.byteOffset;return{ed:r,vb:n}},msync:function(t,e,r,n,i){if(!Nt.isFile(t.node.mode))throw new Nt.ErrnoError(43);return 2&i||Rt.stream_ops.write(t,e,0,n,r,!1),0}}};var Nt={root:null,mb:[],Xb:{},streams:[],Zc:1,Ua:null,Wb:"/",Hb:!1,hc:!0,Sa:{},nc:{kc:{qc:1,rc:2}},ErrnoError:null,Db:{},Lc:null,tb:0,lookupPath:function(t,e){if(e=e||{},!(t=wt(Nt.cwd(),t)))return{path:"",node:null};var r,n={Cb:!0,Pb:0};for(r in n)void 0===e[r]&&(e[r]=n[r]);if(8<e.Pb)throw new Nt.ErrnoError(32);t=mt(t.split("/").filter((function(t){return!!t})),!1);var i=Nt.root;for(n="/",r=0;r<t.length;r++){var o=r===t.length-1;if(o&&e.parent)break;if(i=Nt.lookupNode(i,t[r]),n=vt(n,t[r]),Nt.ab(i)&&(!o||o&&e.Cb)&&(i=i.lb.root),!o||e.Ta)for(o=0;Nt.fb(i.mode);)if(i=Nt.readlink(n),n=wt(bt(n),i),i=Nt.lookupPath(n,{Pb:e.Pb}).node,40<o++)throw new Nt.ErrnoError(32)}return{path:n,node:i}},Ya:function(t){for(var e;;){if(Nt.isRoot(t))return t=t.mount.jc,e?"/"!==t[t.length-1]?t+"/"+e:t+e:t;e=e?t.name+"/"+e:t.name,t=t.parent}},Gb:function(t,e){for(var r=0,n=0;n<e.length;n++)r=(r<<5)-r+e.charCodeAt(n)|0;return(t+r>>>0)%Nt.Ua.length},ec:function(t){var e=Nt.Gb(t.parent.id,t.name);t.cb=Nt.Ua[e],Nt.Ua[e]=t},fc:function(t){var e=Nt.Gb(t.parent.id,t.name);if(Nt.Ua[e]===t)Nt.Ua[e]=t.cb;else for(e=Nt.Ua[e];e;){if(e.cb===t){e.cb=t.cb;break}e=e.cb}},lookupNode:function(t,e){var r=Nt.Vc(t);if(r)throw new Nt.ErrnoError(r,t);for(r=Nt.Ua[Nt.Gb(t.id,e)];r;r=r.cb){var n=r.name;if(r.parent.id===t.id&&n===e)return r}return Nt.lookup(t,e)},createNode:function(t,e,r,n){return t=new Nt.FSNode(t,e,r,n),Nt.ec(t),t},Ab:function(t){Nt.fc(t)},isRoot:function(t){return t===t.parent},ab:function(t){return!!t.lb},isFile:function(t){return 32768==(61440&t)},isDir:function(t){return 16384==(61440&t)},fb:function(t){return 40960==(61440&t)},pb:function(t){return 8192==(61440&t)},Rc:function(t){return 24576==(61440&t)},isFIFO:function(t){return 4096==(61440&t)},isSocket:function(t){return 49152==(49152&t)},Mc:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},Yc:function(t){var e=Nt.Mc[t];if(void 0===e)throw Error("Unknown file open mode: "+t);return e},$b:function(t){var e=["r","w","rw"][3&t];return 512&t&&(e+="w"),e},Za:function(t,e){return Nt.hc?0:!e.includes("r")||292&t.mode?e.includes("w")&&!(146&t.mode)||e.includes("x")&&!(73&t.mode)?2:0:2},Vc:function(t){var e=Nt.Za(t,"x");return e||(t.node_ops.lookup?0:2)},Lb:function(t,e){try{return Nt.lookupNode(t,e),20}catch(t){}return Nt.Za(t,"wx")},qb:function(t,e,r){try{var n=Nt.lookupNode(t,e)}catch(t){return t.Oa}if(t=Nt.Za(t,"wx"))return t;if(r){if(!Nt.isDir(n.mode))return 54;if(Nt.isRoot(n)||Nt.Ya(n)===Nt.cwd())return 10}else if(Nt.isDir(n.mode))return 31;return 0},Wc:function(t,e){return t?Nt.fb(t.mode)?32:Nt.isDir(t.mode)&&("r"!==Nt.$b(e)||512&e)?31:Nt.Za(t,Nt.$b(e)):44},oc:4096,$c:function(t,e){for(e=e||Nt.oc,t=t||0;t<=e;t++)if(!Nt.streams[t])return t;throw new Nt.ErrnoError(33)},$a:function(t){return Nt.streams[t]},Jc:function(t,e,r){Nt.ub||(Nt.ub=function(){},Nt.ub.prototype={object:{get:function(){return this.node},set:function(t){this.node=t}}});var n,i=new Nt.ub;for(n in t)i[n]=t[n];return t=i,e=Nt.$c(e,r),t.fd=e,Nt.streams[e]=t},Dc:function(t){Nt.streams[t]=null},Cc:{open:function(t){t.stream_ops=Nt.Oc(t.node.rdev).stream_ops,t.stream_ops.open&&t.stream_ops.open(t)},llseek:function(){throw new Nt.ErrnoError(70)}},Kb:function(t){return t>>8},sd:function(t){return 255&t},bb:function(t,e){return t<<8|e},Qb:function(t,e){Nt.Xb[t]={stream_ops:e}},Oc:function(t){return Nt.Xb[t]},bc:function(t){var e=[];for(t=[t];t.length;){var r=t.pop();e.push(r),t.push.apply(t,r.mb)}return e},mc:function(t,e){function r(t){return Nt.tb--,e(t)}function n(t){if(t){if(!n.Kc)return n.Kc=!0,r(t)}else++o>=i.length&&r(null)}"function"==typeof t&&(e=t,t=!1),Nt.tb++,1<Nt.tb&&S("warning: "+Nt.tb+" FS.syncfs operations in flight at once, probably just doing extra work");var i=Nt.bc(Nt.root.mount),o=0;i.forEach((function(e){if(!e.type.mc)return n(null);e.type.mc(e,t,n)}))},mount:function(t,e,r){var n="/"===r,i=!r;if(n&&Nt.root)throw new Nt.ErrnoError(10);if(!n&&!i){var o=Nt.lookupPath(r,{Cb:!1});if(r=o.path,o=o.node,Nt.ab(o))throw new Nt.ErrnoError(10);if(!Nt.isDir(o.mode))throw new Nt.ErrnoError(54)}return e={type:t,vd:e,jc:r,mb:[]},(t=t.mount(e)).mount=e,e.root=t,n?Nt.root=t:o&&(o.lb=e,o.mount&&o.mount.mb.push(e)),t},yd:function(t){if(t=Nt.lookupPath(t,{Cb:!1}),!Nt.ab(t.node))throw new Nt.ErrnoError(28);var e=(t=t.node).lb,r=Nt.bc(e);Object.keys(Nt.Ua).forEach((function(t){for(t=Nt.Ua[t];t;){var e=t.cb;r.includes(t.mount)&&Nt.Ab(t),t=e}})),t.lb=null,t.mount.mb.splice(t.mount.mb.indexOf(e),1)},lookup:function(t,e){return t.node_ops.lookup(t,e)},mknod:function(t,e,r){var n=Nt.lookupPath(t,{parent:!0}).node;if(!(t=_t(t))||"."===t||".."===t)throw new Nt.ErrnoError(28);var i=Nt.Lb(n,t);if(i)throw new Nt.ErrnoError(i);if(!n.node_ops.mknod)throw new Nt.ErrnoError(63);return n.node_ops.mknod(n,t,e,r)},create:function(t,e){return Nt.mknod(t,4095&(void 0!==e?e:438)|32768,0)},mkdir:function(t,e){return Nt.mknod(t,1023&(void 0!==e?e:511)|16384,0)},td:function(t,e){t=t.split("/");for(var r="",n=0;n<t.length;++n)if(t[n]){r+="/"+t[n];try{Nt.mkdir(r,e)}catch(t){if(20!=t.Oa)throw t}}},rb:function(t,e,r){return void 0===r&&(r=e,e=438),Nt.mknod(t,8192|e,r)},symlink:function(t,e){if(!wt(t))throw new Nt.ErrnoError(44);var r=Nt.lookupPath(e,{parent:!0}).node;if(!r)throw new Nt.ErrnoError(44);e=_t(e);var n=Nt.Lb(r,e);if(n)throw new Nt.ErrnoError(n);if(!r.node_ops.symlink)throw new Nt.ErrnoError(63);return r.node_ops.symlink(r,e,t)},rename:function(t,e){var r=bt(t),n=bt(e),i=_t(t),o=_t(e),a=Nt.lookupPath(t,{parent:!0}),s=a.node;if(a=(a=Nt.lookupPath(e,{parent:!0})).node,!s||!a)throw new Nt.ErrnoError(44);if(s.mount!==a.mount)throw new Nt.ErrnoError(75);var u=Nt.lookupNode(s,i);if("."!==(n=Et(t,n)).charAt(0))throw new Nt.ErrnoError(28);if("."!==(n=Et(e,r)).charAt(0))throw new Nt.ErrnoError(55);try{var c=Nt.lookupNode(a,o)}catch(t){}if(u!==c){if(r=Nt.isDir(u.mode),i=Nt.qb(s,i,r))throw new Nt.ErrnoError(i);if(i=c?Nt.qb(a,o,r):Nt.Lb(a,o))throw new Nt.ErrnoError(i);if(!s.node_ops.rename)throw new Nt.ErrnoError(63);if(Nt.ab(u)||c&&Nt.ab(c))throw new Nt.ErrnoError(10);if(a!==s&&(i=Nt.Za(s,"w")))throw new Nt.ErrnoError(i);try{Nt.Sa.willMovePath&&Nt.Sa.willMovePath(t,e)}catch(r){S("FS.trackingDelegate['willMovePath']('"+t+"', '"+e+"') threw an exception: "+r.message)}Nt.fc(u);try{s.node_ops.rename(u,a,o)}catch(t){throw t}finally{Nt.ec(u)}try{Nt.Sa.onMovePath&&Nt.Sa.onMovePath(t,e)}catch(r){S("FS.trackingDelegate['onMovePath']('"+t+"', '"+e+"') threw an exception: "+r.message)}}},rmdir:function(t){var e=Nt.lookupPath(t,{parent:!0}).node,r=_t(t),n=Nt.lookupNode(e,r),i=Nt.qb(e,r,!0);if(i)throw new Nt.ErrnoError(i);if(!e.node_ops.rmdir)throw new Nt.ErrnoError(63);if(Nt.ab(n))throw new Nt.ErrnoError(10);try{Nt.Sa.willDeletePath&&Nt.Sa.willDeletePath(t)}catch(e){S("FS.trackingDelegate['willDeletePath']('"+t+"') threw an exception: "+e.message)}e.node_ops.rmdir(e,r),Nt.Ab(n);try{Nt.Sa.onDeletePath&&Nt.Sa.onDeletePath(t)}catch(e){S("FS.trackingDelegate['onDeletePath']('"+t+"') threw an exception: "+e.message)}},readdir:function(t){if(!(t=Nt.lookupPath(t,{Ta:!0}).node).node_ops.readdir)throw new Nt.ErrnoError(54);return t.node_ops.readdir(t)},unlink:function(t){var e=Nt.lookupPath(t,{parent:!0}).node,r=_t(t),n=Nt.lookupNode(e,r),i=Nt.qb(e,r,!1);if(i)throw new Nt.ErrnoError(i);if(!e.node_ops.unlink)throw new Nt.ErrnoError(63);if(Nt.ab(n))throw new Nt.ErrnoError(10);try{Nt.Sa.willDeletePath&&Nt.Sa.willDeletePath(t)}catch(e){S("FS.trackingDelegate['willDeletePath']('"+t+"') threw an exception: "+e.message)}e.node_ops.unlink(e,r),Nt.Ab(n);try{Nt.Sa.onDeletePath&&Nt.Sa.onDeletePath(t)}catch(e){S("FS.trackingDelegate['onDeletePath']('"+t+"') threw an exception: "+e.message)}},readlink:function(t){if(!(t=Nt.lookupPath(t).node))throw new Nt.ErrnoError(44);if(!t.node_ops.readlink)throw new Nt.ErrnoError(28);return wt(Nt.Ya(t.parent),t.node_ops.readlink(t))},stat:function(t,e){if(!(t=Nt.lookupPath(t,{Ta:!e}).node))throw new Nt.ErrnoError(44);if(!t.node_ops.getattr)throw new Nt.ErrnoError(63);return t.node_ops.getattr(t)},lstat:function(t){return Nt.stat(t,!0)},chmod:function(t,e,r){if(!(t="string"==typeof t?Nt.lookupPath(t,{Ta:!r}).node:t).node_ops.setattr)throw new Nt.ErrnoError(63);t.node_ops.setattr(t,{mode:4095&e|-4096&t.mode,timestamp:Date.now()})},lchmod:function(t,e){Nt.chmod(t,e,!0)},fchmod:function(t,e){if(!(t=Nt.$a(t)))throw new Nt.ErrnoError(8);Nt.chmod(t.node,e)},chown:function(t,e,r,n){if(!(t="string"==typeof t?Nt.lookupPath(t,{Ta:!n}).node:t).node_ops.setattr)throw new Nt.ErrnoError(63);t.node_ops.setattr(t,{timestamp:Date.now()})},lchown:function(t,e,r){Nt.chown(t,e,r,!0)},fchown:function(t,e,r){if(!(t=Nt.$a(t)))throw new Nt.ErrnoError(8);Nt.chown(t.node,e,r)},truncate:function(t,e){if(0>e)throw new Nt.ErrnoError(28);if(!(t="string"==typeof t?Nt.lookupPath(t,{Ta:!0}).node:t).node_ops.setattr)throw new Nt.ErrnoError(63);if(Nt.isDir(t.mode))throw new Nt.ErrnoError(31);if(!Nt.isFile(t.mode))throw new Nt.ErrnoError(28);var r=Nt.Za(t,"w");if(r)throw new Nt.ErrnoError(r);t.node_ops.setattr(t,{size:e,timestamp:Date.now()})},Nc:function(t,e){if(!(t=Nt.$a(t)))throw new Nt.ErrnoError(8);if(0==(2097155&t.flags))throw new Nt.ErrnoError(28);Nt.truncate(t.node,e)},kd:function(t,e,r){(t=Nt.lookupPath(t,{Ta:!0}).node).node_ops.setattr(t,{timestamp:Math.max(e,r)})},open:function(t,e,r,n,i){if(""===t)throw new Nt.ErrnoError(44);if(r=64&(e="string"==typeof e?Nt.Yc(e):e)?4095&(void 0===r?438:r)|32768:0,"object"==typeof t)var o=t;else{t=yt(t);try{o=Nt.lookupPath(t,{Ta:!(131072&e)}).node}catch(t){}}var a=!1;if(64&e)if(o){if(128&e)throw new Nt.ErrnoError(20)}else o=Nt.mknod(t,r,0),a=!0;if(!o)throw new Nt.ErrnoError(44);if(Nt.pb(o.mode)&&(e&=-513),65536&e&&!Nt.isDir(o.mode))throw new Nt.ErrnoError(54);if(!a&&(r=Nt.Wc(o,e)))throw new Nt.ErrnoError(r);512&e&&Nt.truncate(o,0),e&=-131713,(n=Nt.Jc({node:o,path:Nt.Ya(o),flags:e,seekable:!0,position:0,stream_ops:o.stream_ops,jd:[],error:!1},n,i)).stream_ops.open&&n.stream_ops.open(n),!u.logReadFiles||1&e||(Nt.Ob||(Nt.Ob={}),t in Nt.Ob||(Nt.Ob[t]=1,S("FS.trackingDelegate error on read file: "+t)));try{Nt.Sa.onOpenFile&&(i=0,1!=(2097155&e)&&(i|=Nt.nc.kc.qc),0!=(2097155&e)&&(i|=Nt.nc.kc.rc),Nt.Sa.onOpenFile(t,i))}catch(e){S("FS.trackingDelegate['onOpenFile']('"+t+"', flags) threw an exception: "+e.message)}return n},close:function(t){if(Nt.kb(t))throw new Nt.ErrnoError(8);t.Fb&&(t.Fb=null);try{t.stream_ops.close&&t.stream_ops.close(t)}catch(t){throw t}finally{Nt.Dc(t.fd)}t.fd=null},kb:function(t){return null===t.fd},llseek:function(t,e,r){if(Nt.kb(t))throw new Nt.ErrnoError(8);if(!t.seekable||!t.stream_ops.llseek)throw new Nt.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new Nt.ErrnoError(28);return t.position=t.stream_ops.llseek(t,e,r),t.jd=[],t.position},read:function(t,e,r,n,i){if(0>n||0>i)throw new Nt.ErrnoError(28);if(Nt.kb(t))throw new Nt.ErrnoError(8);if(1==(2097155&t.flags))throw new Nt.ErrnoError(8);if(Nt.isDir(t.node.mode))throw new Nt.ErrnoError(31);if(!t.stream_ops.read)throw new Nt.ErrnoError(28);var o=void 0!==i;if(o){if(!t.seekable)throw new Nt.ErrnoError(70)}else i=t.position;return e=t.stream_ops.read(t,e,r,n,i),o||(t.position+=e),e},write:function(t,e,r,n,i,o){if(0>n||0>i)throw new Nt.ErrnoError(28);if(Nt.kb(t))throw new Nt.ErrnoError(8);if(0==(2097155&t.flags))throw new Nt.ErrnoError(8);if(Nt.isDir(t.node.mode))throw new Nt.ErrnoError(31);if(!t.stream_ops.write)throw new Nt.ErrnoError(28);t.seekable&&1024&t.flags&&Nt.llseek(t,0,2);var a=void 0!==i;if(a){if(!t.seekable)throw new Nt.ErrnoError(70)}else i=t.position;e=t.stream_ops.write(t,e,r,n,i,o),a||(t.position+=e);try{t.path&&Nt.Sa.onWriteToFile&&Nt.Sa.onWriteToFile(t.path)}catch(e){S("FS.trackingDelegate['onWriteToFile']('"+t.path+"') threw an exception: "+e.message)}return e},allocate:function(t,e,r){if(Nt.kb(t))throw new Nt.ErrnoError(8);if(0>e||0>=r)throw new Nt.ErrnoError(28);if(0==(2097155&t.flags))throw new Nt.ErrnoError(8);if(!Nt.isFile(t.node.mode)&&!Nt.isDir(t.node.mode))throw new Nt.ErrnoError(43);if(!t.stream_ops.allocate)throw new Nt.ErrnoError(138);t.stream_ops.allocate(t,e,r)},mmap:function(t,e,r,n,i,o){if(0!=(2&i)&&0==(2&o)&&2!=(2097155&t.flags))throw new Nt.ErrnoError(2);if(1==(2097155&t.flags))throw new Nt.ErrnoError(2);if(!t.stream_ops.mmap)throw new Nt.ErrnoError(43);return t.stream_ops.mmap(t,e,r,n,i,o)},msync:function(t,e,r,n,i){return t&&t.stream_ops.msync?t.stream_ops.msync(t,e,r,n,i):0},ud:function(){return 0},ic:function(t,e,r){if(!t.stream_ops.ic)throw new Nt.ErrnoError(59);return t.stream_ops.ic(t,e,r)},readFile:function(t,e){if((e=e||{}).flags=e.flags||0,e.encoding=e.encoding||"binary","utf8"!==e.encoding&&"binary"!==e.encoding)throw Error('Invalid encoding type "'+e.encoding+'"');var r,n=Nt.open(t,e.flags);t=Nt.stat(t).size;var i=new Uint8Array(t);return Nt.read(n,i,0,t,0),"utf8"===e.encoding?r=V(i,0):"binary"===e.encoding&&(r=i),Nt.close(n),r},writeFile:function(t,e,r){if((r=r||{}).flags=r.flags||577,t=Nt.open(t,r.flags,r.mode),"string"==typeof e){var n=new Uint8Array($(e)+1);e=Y(e,n,0,n.length),Nt.write(t,n,0,e,void 0,r.Bc)}else{if(!ArrayBuffer.isView(e))throw Error("Unsupported data type");Nt.write(t,e,0,e.byteLength,void 0,r.Bc)}Nt.close(t)},cwd:function(){return Nt.Wb},chdir:function(t){if(null===(t=Nt.lookupPath(t,{Ta:!0})).node)throw new Nt.ErrnoError(44);if(!Nt.isDir(t.node.mode))throw new Nt.ErrnoError(54);var e=Nt.Za(t.node,"x");if(e)throw new Nt.ErrnoError(e);Nt.Wb=t.path},Fc:function(){Nt.mkdir("/tmp"),Nt.mkdir("/home"),Nt.mkdir("/home/web_user")},Ec:function(){Nt.mkdir("/dev"),Nt.Qb(Nt.bb(1,3),{read:function(){return 0},write:function(t,e,r,n){return n}}),Nt.rb("/dev/null",Nt.bb(1,3)),Ot(Nt.bb(5,0),At),Ot(Nt.bb(6,0),Mt),Nt.rb("/dev/tty",Nt.bb(5,0)),Nt.rb("/dev/tty1",Nt.bb(6,0));var t=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return function(){return crypto.getRandomValues(t),t[0]}}if(v)try{var e=r(164);return function(){return e.randomBytes(1)[0]}}catch(t){}return function(){ft("randomDevice")}}();Nt.Wa("/dev","random",t),Nt.Wa("/dev","urandom",t),Nt.mkdir("/dev/shm"),Nt.mkdir("/dev/shm/tmp")},Hc:function(){Nt.mkdir("/proc");var t=Nt.mkdir("/proc/self");Nt.mkdir("/proc/self/fd"),Nt.mount({mount:function(){var e=Nt.createNode(t,"fd",16895,73);return e.node_ops={lookup:function(t,e){var r=Nt.$a(+e);if(!r)throw new Nt.ErrnoError(8);return(t={parent:null,mount:{jc:"fake"},node_ops:{readlink:function(){return r.path}}}).parent=t}},e}},{},"/proc/self/fd")},Ic:function(){u.stdin?Nt.Wa("/dev","stdin",u.stdin):Nt.symlink("/dev/tty","/dev/stdin"),u.stdout?Nt.Wa("/dev","stdout",null,u.stdout):Nt.symlink("/dev/tty","/dev/stdout"),u.stderr?Nt.Wa("/dev","stderr",null,u.stderr):Nt.symlink("/dev/tty1","/dev/stderr"),Nt.open("/dev/stdin",0),Nt.open("/dev/stdout",1),Nt.open("/dev/stderr",1)},Yb:function(){Nt.ErrnoError||(Nt.ErrnoError=function(t,e){this.node=e,this.hd=function(t){this.Oa=t},this.hd(t),this.message="FS error"},Nt.ErrnoError.prototype=Error(),Nt.ErrnoError.prototype.constructor=Nt.ErrnoError,[44].forEach((function(t){Nt.Db[t]=new Nt.ErrnoError(t),Nt.Db[t].stack="<generic error, no stack>"})))},lc:function(){Nt.Yb(),Nt.Ua=Array(4096),Nt.mount(Rt,{},"/"),Nt.Fc(),Nt.Ec(),Nt.Hc(),Nt.Lc={MEMFS:Rt}},jb:function(t,e,r){Nt.jb.Hb=!0,Nt.Yb(),u.stdin=t||u.stdin,u.stdout=e||u.stdout,u.stderr=r||u.stderr,Nt.Ic()},wd:function(){Nt.jb.Hb=!1;var t=u._fflush;for(t&&t(0),t=0;t<Nt.streams.length;t++){var e=Nt.streams[t];e&&Nt.close(e)}},Eb:function(t,e){var r=0;return t&&(r|=365),e&&(r|=146),r},od:function(t,e){return(t=Nt.xb(t,e)).exists?t.object:null},xb:function(t,e){try{var r=Nt.lookupPath(t,{Ta:!e});t=r.path}catch(t){}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,ad:!1,cd:null,bd:null};try{r=Nt.lookupPath(t,{parent:!0}),n.ad=!0,n.cd=r.path,n.bd=r.node,n.name=_t(t),r=Nt.lookupPath(t,{Ta:!e}),n.exists=!0,n.path=r.path,n.object=r.node,n.name=r.node.name,n.isRoot="/"===r.path}catch(t){n.error=t.Oa}return n},md:function(t,e){for(t="string"==typeof t?t:Nt.Ya(t),e=e.split("/").reverse();e.length;){var r=e.pop();if(r){var n=vt(t,r);try{Nt.mkdir(n)}catch(t){}t=n}}return n},Gc:function(t,e,r,n,i){return t=vt("string"==typeof t?t:Nt.Ya(t),e),Nt.create(t,Nt.Eb(n,i))},zb:function(t,e,r,n,i,o){if(t=e?vt("string"==typeof t?t:Nt.Ya(t),e):t,n=Nt.Eb(n,i),i=Nt.create(t,n),r){if("string"==typeof r){t=Array(r.length),e=0;for(var a=r.length;e<a;++e)t[e]=r.charCodeAt(e);r=t}Nt.chmod(i,146|n),t=Nt.open(i,577),Nt.write(t,r,0,r.length,0,o),Nt.close(t),Nt.chmod(i,n)}return i},Wa:function(t,e,r,n){t=vt("string"==typeof t?t:Nt.Ya(t),e),e=Nt.Eb(!!r,!!n),Nt.Wa.Kb||(Nt.Wa.Kb=64);var i=Nt.bb(Nt.Wa.Kb++,0);return Nt.Qb(i,{open:function(t){t.seekable=!1},close:function(){n&&n.buffer&&n.buffer.length&&n(10)},read:function(t,e,n,i){for(var o=0,a=0;a<i;a++){try{var s=r()}catch(t){throw new Nt.ErrnoError(29)}if(void 0===s&&0===o)throw new Nt.ErrnoError(6);if(null==s)break;o++,e[n+a]=s}return o&&(t.node.timestamp=Date.now()),o},write:function(t,e,r,i){for(var o=0;o<i;o++)try{n(e[r+o])}catch(t){throw new Nt.ErrnoError(29)}return i&&(t.node.timestamp=Date.now()),o}}),Nt.rb(t,e,i)},ac:function(t){if(t.Ib||t.Sc||t.link||t.Na)return!0;if("undefined"!=typeof XMLHttpRequest)throw Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(!d)throw Error("Cannot load without read() or XMLHttpRequest.");try{t.Na=Wt(d(t.url),!0),t.Ra=t.Na.length}catch(t){throw new Nt.ErrnoError(29)}},ld:function(t,e,r,n,i){function o(){this.Jb=!1,this.ob=[]}if(o.prototype.get=function(t){if(!(t>this.length-1||0>t)){var e=t%this.chunkSize;return this.dc(t/this.chunkSize|0)[e]}},o.prototype.pc=function(t){this.dc=t},o.prototype.Ub=function(){var t=new XMLHttpRequest;if(t.open("HEAD",r,!1),t.send(null),!(200<=t.status&&300>t.status||304===t.status))throw Error("Couldn't load "+r+". Status: "+t.status);var e,n=Number(t.getResponseHeader("Content-length")),i=(e=t.getResponseHeader("Accept-Ranges"))&&"bytes"===e;t=(e=t.getResponseHeader("Content-Encoding"))&&"gzip"===e;var o=1048576;i||(o=n);var a=this;a.pc((function(t){var e=t*o,i=(t+1)*o-1;if(i=Math.min(i,n-1),void 0===a.ob[t]){var s=a.ob;if(e>i)throw Error("invalid range ("+e+", "+i+") or no bytes requested!");if(i>n-1)throw Error("only "+n+" bytes available! programmer error!");var u=new XMLHttpRequest;if(u.open("GET",r,!1),n!==o&&u.setRequestHeader("Range","bytes="+e+"-"+i),"undefined"!=typeof Uint8Array&&(u.responseType="arraybuffer"),u.overrideMimeType&&u.overrideMimeType("text/plain; charset=x-user-defined"),u.send(null),!(200<=u.status&&300>u.status||304===u.status))throw Error("Couldn't load "+r+". Status: "+u.status);e=void 0!==u.response?new Uint8Array(u.response||[]):Wt(u.responseText||"",!0),s[t]=e}if(void 0===a.ob[t])throw Error("doXHR failed!");return a.ob[t]})),!t&&n||(o=n=1,o=n=this.dc(0).length,E("LazyFiles on gzip forces download of the whole file when length is accessed")),this.tc=n,this.sc=o,this.Jb=!0},"undefined"!=typeof XMLHttpRequest){if(!_)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a=new o;Object.defineProperties(a,{length:{get:function(){return this.Jb||this.Ub(),this.tc}},chunkSize:{get:function(){return this.Jb||this.Ub(),this.sc}}}),a={Ib:!1,Na:a}}else a={Ib:!1,url:r};var s=Nt.Gc(t,e,a,n,i);a.Na?s.Na=a.Na:a.url&&(s.Na=null,s.url=a.url),Object.defineProperties(s,{Ra:{get:function(){return this.Na.length}}});var u={};return Object.keys(s.stream_ops).forEach((function(t){var e=s.stream_ops[t];u[t]=function(){return Nt.ac(s),e.apply(null,arguments)}})),u.read=function(t,e,r,n,i){if(Nt.ac(s),i>=(t=t.node.Na).length)return 0;if(n=Math.min(t.length-i,n),t.slice)for(var o=0;o<n;o++)e[r+o]=t[i+o];else for(o=0;o<n;o++)e[r+o]=t.get(i+o);return n},s.stream_ops=u,s},nd:function(t,e,r,n,i,o,a,s,c,l){function f(r){function f(r){l&&l(),s||Nt.zb(t,e,r,n,i,c),o&&o(),lt()}var h=!1;u.preloadPlugins.forEach((function(t){!h&&t.canHandle(d)&&(t.handle(r,d,f,(function(){a&&a(),lt()})),h=!0)})),h||f(r)}(void 0).jb();var d=e?wt(vt(t,e)):t;ct(),"string"==typeof r?function(t,e,r){var n="al "+t;h(t,(function(r){j(r,'Loading data file "'+t+'" failed (no arrayBuffer).'),e(new Uint8Array(r)),n&<()}),(function(){if(!r)throw'Loading data file "'+t+'" failed.';r()})),n&&ct()}(r,(function(t){f(t)}),a):f(r)},indexedDB:function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},Rb:function(){return"EM_FS_"+window.location.pathname},Sb:20,ib:"FILE_DATA",xd:function(t,e,r){e=e||function(){},r=r||function(){};var n=Nt.indexedDB();try{var i=n.open(Nt.Rb(),Nt.Sb)}catch(t){return r(t)}i.onupgradeneeded=function(){E("creating db"),i.result.createObjectStore(Nt.ib)},i.onsuccess=function(){var n=i.result.transaction([Nt.ib],"readwrite"),o=n.objectStore(Nt.ib),a=0,s=0,u=t.length;t.forEach((function(t){(t=o.put(Nt.xb(t).object.Na,t)).onsuccess=function(){++a+s==u&&(0==s?e():r())},t.onerror=function(){s++,a+s==u&&(0==s?e():r())}})),n.onerror=r},i.onerror=r},rd:function(t,e,r){e=e||function(){},r=r||function(){};var n=Nt.indexedDB();try{var i=n.open(Nt.Rb(),Nt.Sb)}catch(t){return r(t)}i.onupgradeneeded=r,i.onsuccess=function(){var n=i.result;try{var o=n.transaction([Nt.ib],"readonly")}catch(t){return void r(t)}var a=o.objectStore(Nt.ib),s=0,u=0,c=t.length;t.forEach((function(t){var n=a.get(t);n.onsuccess=function(){Nt.xb(t).exists&&Nt.unlink(t),Nt.zb(bt(t),_t(t),n.result,!0,!0,!0),++s+u==c&&(0==u?e():r())},n.onerror=function(){u++,s+u==c&&(0==u?e():r())}})),o.onerror=r},i.onerror=r}},kt={};function Dt(t,e,r){try{var n=t(e)}catch(t){if(t&&t.node&&yt(e)!==yt(Nt.Ya(t.node)))return-54;throw t}return W[r>>2]=n.dev,W[r+4>>2]=0,W[r+8>>2]=n.ino,W[r+12>>2]=n.mode,W[r+16>>2]=n.nlink,W[r+20>>2]=n.uid,W[r+24>>2]=n.gid,W[r+28>>2]=n.rdev,W[r+32>>2]=0,it=[n.size>>>0,(nt=n.size,1<=+Math.abs(nt)?0<nt?(0|Math.min(+Math.floor(nt/4294967296),4294967295))>>>0:~~+Math.ceil((nt-+(~~nt>>>0))/4294967296)>>>0:0)],W[r+40>>2]=it[0],W[r+44>>2]=it[1],W[r+48>>2]=4096,W[r+52>>2]=n.blocks,W[r+56>>2]=n.atime.getTime()/1e3|0,W[r+60>>2]=0,W[r+64>>2]=n.mtime.getTime()/1e3|0,W[r+68>>2]=0,W[r+72>>2]=n.ctime.getTime()/1e3|0,W[r+76>>2]=0,it=[n.ino>>>0,(nt=n.ino,1<=+Math.abs(nt)?0<nt?(0|Math.min(+Math.floor(nt/4294967296),4294967295))>>>0:~~+Math.ceil((nt-+(~~nt>>>0))/4294967296)>>>0:0)],W[r+80>>2]=it[0],W[r+84>>2]=it[1],0}var jt,Ct=void 0;function Lt(){return W[(Ct+=4)-4>>2]}function xt(t){if(!(t=Nt.$a(t)))throw new Nt.ErrnoError(8);return t}jt=v?function(){var t=e.hrtime();return 1e3*t[0]+t[1]/1e6}:function(){return performance.now()};var Bt,Ut={};function Ft(){if(!Bt){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:y||"./this.program"};for(t in Ut)void 0===Ut[t]?delete e[t]:e[t]=Ut[t];var r=[];for(t in e)r.push(t+"="+e[t]);Bt=r}return Bt}function Pt(t,e,r,n){t||(t=this),this.parent=t,this.mount=t.mount,this.lb=null,this.id=Nt.Zc++,this.name=e,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=n}function Wt(t,e){var r=Array($(t)+1);return t=Y(t,r,0,r.length),e&&(r.length=t),r}Object.defineProperties(Pt.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(t){t?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(t){t?this.mode|=146:this.mode&=-147}},Sc:{get:function(){return Nt.isDir(this.mode)}},Ib:{get:function(){return Nt.pb(this.mode)}}}),Nt.FSNode=Pt,Nt.lc();var zt={a:function(t,e,r,n){ft("Assertion failed: "+G(t)+", at: "+[e?G(e):"unknown filename",r,n?G(n):"unknown function"])},u:function(t,e){!function(){function t(t){return(t=t.toTimeString().match(/\(([A-Za-z ]+)\)$/))?t[1]:"GMT"}if(!ot){ot=!0;var e=(new Date).getFullYear(),r=new Date(e,0,1),n=new Date(e,6,1);e=r.getTimezoneOffset();var i=n.getTimezoneOffset(),o=Math.max(e,i);W[Kt()>>2]=60*o,W[$t()>>2]=Number(e!=i),r=t(r),n=t(n),r=K(r),n=K(n),i<e?(W[Yt()>>2]=r,W[Yt()+4>>2]=n):(W[Yt()>>2]=n,W[Yt()+4>>2]=r)}}(),t=new Date(1e3*W[t>>2]),W[e>>2]=t.getSeconds(),W[e+4>>2]=t.getMinutes(),W[e+8>>2]=t.getHours(),W[e+12>>2]=t.getDate(),W[e+16>>2]=t.getMonth(),W[e+20>>2]=t.getFullYear()-1900,W[e+24>>2]=t.getDay();var r=new Date(t.getFullYear(),0,1);W[e+28>>2]=(t.getTime()-r.getTime())/864e5|0,W[e+36>>2]=-60*t.getTimezoneOffset();var n=new Date(t.getFullYear(),6,1).getTimezoneOffset();return t=0|(n!=(r=r.getTimezoneOffset())&&t.getTimezoneOffset()==Math.min(r,n)),W[e+32>>2]=t,t=W[Yt()+(t?4:0)>>2],W[e+40>>2]=t,e},m:function(t,e){try{var r;if(t=G(t),-8&e)var n=-28;else(r=Nt.lookupPath(t,{Ta:!0}).node)?(t="",4&e&&(t+="r"),2&e&&(t+="w"),1&e&&(t+="x"),n=t&&Nt.Za(r,t)?-2:0):n=-44;return n}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),-t.Oa}},A:function(t,e){try{return t=G(t),Nt.chmod(t,e),0}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),-t.Oa}},H:function(t,e,r){try{return t=G(t),Nt.chown(t,e,r),0}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),-t.Oa}},B:function(t,e){try{return Nt.fchmod(t,e),0}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),-t.Oa}},I:function(t,e,r){try{return Nt.fchown(t,e,r),0}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),-t.Oa}},b:function(t,e,r){Ct=r;try{var n=xt(t);switch(e){case 0:var i=Lt();return 0>i?-28:Nt.open(n.path,n.flags,0,i).fd;case 1:case 2:return 0;case 3:return n.flags;case 4:return i=Lt(),n.flags|=i,0;case 12:return i=Lt(),P[i+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-28;case 9:return W[Ht()>>2]=28,-1;default:return-28}}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),-t.Oa}},E:function(t,e){try{var r=xt(t);return Dt(Nt.stat,r.path,e)}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),-t.Oa}},n:function(t,e,r){try{return Nt.Nc(t,r),0}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),-t.Oa}},l:function(t,e){try{if(0===e)return-28;var r=Nt.cwd();return e<$(r)+1?-68:(Y(r,F,t,e),t)}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),-t.Oa}},G:function(){return 0},d:function(){return 42},z:function(t,e){try{return t=G(t),Dt(Nt.lstat,t,e)}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),-t.Oa}},C:function(t,e){try{return"/"===(t=yt(t=G(t)))[t.length-1]&&(t=t.substr(0,t.length-1)),Nt.mkdir(t,e,0),0}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),-t.Oa}},y:function(t,e,r,n,i,o){try{t:{o<<=12;var a=!1;if(0!=(16&n)&&0!=t%65536)var s=-28;else{if(0!=(32&n)){var u=It(e);if(!u){s=-48;break t}a=!0}else{var c=Nt.$a(i);if(!c){s=-8;break t}var l=Nt.mmap(c,t,e,o,r,n);u=l.ed,a=l.vb}kt[u]={Uc:u,Tc:e,vb:a,fd:i,dd:r,flags:n,offset:o},s=u}}return s}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),-t.Oa}},x:function(t,e){try{var r=kt[t];if(0!==e&&r){if(e===r.Tc){var n=Nt.$a(r.fd);if(n&&2&r.dd){var i=r.flags,o=r.offset,a=F.slice(t,t+e);Nt.msync(n,a,o,e,i)}kt[t]=null,r.vb&&Vt(r.Uc)}var s=0}else s=-28;return s}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),-t.Oa}},w:function(t,e,r){Ct=r;try{var n=G(t),i=r?Lt():0;return Nt.open(n,e,i).fd}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),-t.Oa}},J:function(t,e,r){try{if(t=G(t),0>=r)var n=-28;else{var i=Nt.readlink(t),o=Math.min(r,$(i)),a=U[e+o];Y(i,F,e,r+1),U[e+o]=a,n=o}return n}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),-t.Oa}},F:function(t){try{return t=G(t),Nt.rmdir(t),0}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),-t.Oa}},e:function(t,e){try{return t=G(t),Dt(Nt.stat,t,e)}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),-t.Oa}},i:function(t){try{return t=G(t),Nt.unlink(t),0}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),-t.Oa}},v:function(){return 2147483648},p:function(t,e,r){F.copyWithin(t,e,e+r)},c:function(t){var e=F.length;if(2147483648<(t>>>=0))return!1;for(var r=1;4>=r;r*=2){var n=e*(1+.2/r);n=Math.min(n,t+100663296),0<(n=Math.max(t,n))%65536&&(n+=65536-n%65536);t:{try{k.grow(Math.min(2147483648,n)-B.byteLength+65535>>>16),Z();var i=1;break t}catch(t){}i=void 0}if(i)return!0}return!1},t:function(t){for(var e=jt();jt()-e<t;);},r:function(t,e){try{var r=0;return Ft().forEach((function(n,i){var o=e+r;for(i=W[t+4*i>>2]=o,o=0;o<n.length;++o)U[i++>>0]=n.charCodeAt(o);U[i>>0]=0,r+=n.length+1})),0}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),t.Oa}},s:function(t,e){try{var r=Ft();W[t>>2]=r.length;var n=0;return r.forEach((function(t){n+=t.length+1})),W[e>>2]=n,0}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),t.Oa}},f:function(t){try{var e=xt(t);return Nt.close(e),0}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),t.Oa}},q:function(t,e){try{var r=xt(t),n=r.tty?2:Nt.isDir(r.mode)?3:Nt.fb(r.mode)?7:4;return U[e>>0]=n,0}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),t.Oa}},j:function(t,e,r,n){try{t:{for(var i=xt(t),o=t=0;o<r;o++){var a=W[e+(8*o+4)>>2],s=Nt.read(i,U,W[e+8*o>>2],a,void 0);if(0>s){var u=-1;break t}if(t+=s,s<a)break}u=t}return W[n>>2]=u,0}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),t.Oa}},o:function(t,e,r,n,i){try{var o=xt(t);return-9007199254740992>=(t=4294967296*r+(e>>>0))||9007199254740992<=t?-61:(Nt.llseek(o,t,n),it=[o.position>>>0,(nt=o.position,1<=+Math.abs(nt)?0<nt?(0|Math.min(+Math.floor(nt/4294967296),4294967295))>>>0:~~+Math.ceil((nt-+(~~nt>>>0))/4294967296)>>>0:0)],W[i>>2]=it[0],W[i+4>>2]=it[1],o.Fb&&0===t&&0===n&&(o.Fb=null),0)}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),t.Oa}},k:function(t){try{var e=xt(t);return e.stream_ops&&e.stream_ops.fsync?-e.stream_ops.fsync(e):0}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),t.Oa}},g:function(t,e,r,n){try{t:{for(var i=xt(t),o=t=0;o<r;o++){var a=Nt.write(i,U,W[e+8*o>>2],W[e+(8*o+4)>>2],void 0);if(0>a){var s=-1;break t}t+=a}s=t}return W[n>>2]=s,0}catch(t){return void 0!==Nt&&t instanceof Nt.ErrnoError||ft(t),t.Oa}},h:function(t){var e=Date.now();return W[t>>2]=e/1e3|0,W[t+4>>2]=e%1e3*1e3|0,0},K:function(t){var e=Date.now()/1e3|0;return t&&(W[t>>2]=e),e},D:function(t,e){if(e){var r=e+8;e=1e3*W[r>>2],e+=W[r+4>>2]/1e3}else e=Date.now();t=G(t);try{Nt.kd(t,e,e);var n=0}catch(t){if(!(t instanceof Nt.ErrnoError)){t:{if(!(n=Error()).stack){try{throw Error()}catch(t){n=t}if(!n.stack){n="(no stack trace available)";break t}}n=n.stack.toString()}throw u.extraStackTrace&&(n+="\n"+u.extraStackTrace()),t+" : "+(n=function(t){return t.replace(/\b_Z[\w\d_]+/g,(function(t){return t==t?t:t+" ["+t+"]"}))}(n))}n=t.Oa,W[Ht()>>2]=n,n=-1}return n}};!function(){function t(t){u.asm=t.exports,k=u.asm.L,Z(),J=u.asm.Da,Q.unshift(u.asm.M),lt()}function e(e){t(e.instance)}function r(t){return function(){if(!T&&(b||_)){if("function"==typeof fetch&&!rt.startsWith("file://"))return fetch(rt,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+rt+"'";return t.arrayBuffer()})).catch((function(){return gt()}));if(h)return new Promise((function(t,e){h(rt,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return gt()}))}().then((function(t){return WebAssembly.instantiate(t,n)})).then(t,(function(t){S("failed to asynchronously prepare wasm: "+t),ft(t)}))}var n={a:zt};if(ct(),u.instantiateWasm)try{return u.instantiateWasm(n,t)}catch(t){return S("Module.instantiateWasm callback failed with error: "+t),!1}T||"function"!=typeof WebAssembly.instantiateStreaming||dt()||rt.startsWith("file://")||"function"!=typeof fetch?r(e):fetch(rt,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,n).then(e,(function(t){return S("wasm streaming compile failed: "+t),S("falling back to ArrayBuffer instantiation"),r(e)}))}))}(),u.___wasm_call_ctors=function(){return(u.___wasm_call_ctors=u.asm.M).apply(null,arguments)},u._sqlite3_vfs_find=function(){return(u._sqlite3_vfs_find=u.asm.N).apply(null,arguments)},u._sqlite3_free=function(){return(u._sqlite3_free=u.asm.O).apply(null,arguments)};var Ht=u.___errno_location=function(){return(Ht=u.___errno_location=u.asm.P).apply(null,arguments)};u._sqlite3_finalize=function(){return(u._sqlite3_finalize=u.asm.Q).apply(null,arguments)},u._sqlite3_reset=function(){return(u._sqlite3_reset=u.asm.R).apply(null,arguments)},u._sqlite3_clear_bindings=function(){return(u._sqlite3_clear_bindings=u.asm.S).apply(null,arguments)},u._sqlite3_value_blob=function(){return(u._sqlite3_value_blob=u.asm.T).apply(null,arguments)},u._sqlite3_value_text=function(){return(u._sqlite3_value_text=u.asm.U).apply(null,arguments)},u._sqlite3_value_bytes=function(){return(u._sqlite3_value_bytes=u.asm.V).apply(null,arguments)},u._sqlite3_value_double=function(){return(u._sqlite3_value_double=u.asm.W).apply(null,arguments)},u._sqlite3_value_int=function(){return(u._sqlite3_value_int=u.asm.X).apply(null,arguments)},u._sqlite3_value_type=function(){return(u._sqlite3_value_type=u.asm.Y).apply(null,arguments)},u._sqlite3_result_blob=function(){return(u._sqlite3_result_blob=u.asm.Z).apply(null,arguments)},u._sqlite3_result_double=function(){return(u._sqlite3_result_double=u.asm._).apply(null,arguments)},u._sqlite3_result_error=function(){return(u._sqlite3_result_error=u.asm.$).apply(null,arguments)},u._sqlite3_result_int=function(){return(u._sqlite3_result_int=u.asm.aa).apply(null,arguments)},u._sqlite3_result_int64=function(){return(u._sqlite3_result_int64=u.asm.ba).apply(null,arguments)},u._sqlite3_result_null=function(){return(u._sqlite3_result_null=u.asm.ca).apply(null,arguments)},u._sqlite3_result_text=function(){return(u._sqlite3_result_text=u.asm.da).apply(null,arguments)},u._sqlite3_step=function(){return(u._sqlite3_step=u.asm.ea).apply(null,arguments)},u._sqlite3_column_count=function(){return(u._sqlite3_column_count=u.asm.fa).apply(null,arguments)},u._sqlite3_data_count=function(){return(u._sqlite3_data_count=u.asm.ga).apply(null,arguments)},u._sqlite3_column_blob=function(){return(u._sqlite3_column_blob=u.asm.ha).apply(null,arguments)},u._sqlite3_column_bytes=function(){return(u._sqlite3_column_bytes=u.asm.ia).apply(null,arguments)},u._sqlite3_column_double=function(){return(u._sqlite3_column_double=u.asm.ja).apply(null,arguments)},u._sqlite3_column_text=function(){return(u._sqlite3_column_text=u.asm.ka).apply(null,arguments)},u._sqlite3_column_type=function(){return(u._sqlite3_column_type=u.asm.la).apply(null,arguments)},u._sqlite3_column_name=function(){return(u._sqlite3_column_name=u.asm.ma).apply(null,arguments)},u._sqlite3_bind_blob=function(){return(u._sqlite3_bind_blob=u.asm.na).apply(null,arguments)},u._sqlite3_bind_double=function(){return(u._sqlite3_bind_double=u.asm.oa).apply(null,arguments)},u._sqlite3_bind_int=function(){return(u._sqlite3_bind_int=u.asm.pa).apply(null,arguments)},u._sqlite3_bind_text=function(){return(u._sqlite3_bind_text=u.asm.qa).apply(null,arguments)},u._sqlite3_bind_parameter_index=function(){return(u._sqlite3_bind_parameter_index=u.asm.ra).apply(null,arguments)},u._sqlite3_sql=function(){return(u._sqlite3_sql=u.asm.sa).apply(null,arguments)},u._sqlite3_normalized_sql=function(){return(u._sqlite3_normalized_sql=u.asm.ta).apply(null,arguments)},u._sqlite3_errmsg=function(){return(u._sqlite3_errmsg=u.asm.ua).apply(null,arguments)},u._sqlite3_exec=function(){return(u._sqlite3_exec=u.asm.va).apply(null,arguments)},u._sqlite3_prepare_v2=function(){return(u._sqlite3_prepare_v2=u.asm.wa).apply(null,arguments)},u._sqlite3_changes=function(){return(u._sqlite3_changes=u.asm.xa).apply(null,arguments)},u._sqlite3_close_v2=function(){return(u._sqlite3_close_v2=u.asm.ya).apply(null,arguments)},u._sqlite3_create_function_v2=function(){return(u._sqlite3_create_function_v2=u.asm.za).apply(null,arguments)},u._sqlite3_open=function(){return(u._sqlite3_open=u.asm.Aa).apply(null,arguments)};var qt=u._malloc=function(){return(qt=u._malloc=u.asm.Ba).apply(null,arguments)},Vt=u._free=function(){return(Vt=u._free=u.asm.Ca).apply(null,arguments)};u._RegisterExtensionFunctions=function(){return(u._RegisterExtensionFunctions=u.asm.Ea).apply(null,arguments)},u._register_for_idb=function(){return(u._register_for_idb=u.asm.Fa).apply(null,arguments)};var Gt,Yt=u.__get_tzname=function(){return(Yt=u.__get_tzname=u.asm.Ga).apply(null,arguments)},$t=u.__get_daylight=function(){return($t=u.__get_daylight=u.asm.Ha).apply(null,arguments)},Kt=u.__get_timezone=function(){return(Kt=u.__get_timezone=u.asm.Ia).apply(null,arguments)},Zt=u.stackSave=function(){return(Zt=u.stackSave=u.asm.Ja).apply(null,arguments)},Jt=u.stackRestore=function(){return(Jt=u.stackRestore=u.asm.Ka).apply(null,arguments)},Xt=u.stackAlloc=function(){return(Xt=u.stackAlloc=u.asm.La).apply(null,arguments)},Qt=u._memalign=function(){return(Qt=u._memalign=u.asm.Ma).apply(null,arguments)};function te(){function t(){if(!Gt&&(Gt=!0,u.calledRun=!0,!D)){if(u.noFSInit||Nt.jb.Hb||Nt.jb(),Nt.hc=!1,pt(Q),u.onRuntimeInitialized&&u.onRuntimeInitialized(),u.postRun)for("function"==typeof u.postRun&&(u.postRun=[u.postRun]);u.postRun.length;){var t=u.postRun.shift();tt.unshift(t)}pt(tt)}}if(!(0<at)){if(u.preRun)for("function"==typeof u.preRun&&(u.preRun=[u.preRun]);u.preRun.length;)et();pt(X),0<at||(u.setStatus?(u.setStatus("Running..."),setTimeout((function(){setTimeout((function(){u.setStatus("")}),1),t()}),1)):t())}}if(u.cwrap=function(t,e,r,n){var i=(r=r||[]).every((function(t){return"number"===t}));return"string"!==e&&i&&!n?C(t):function(){return L(t,e,r,arguments)}},u.UTF8ToString=G,u.FS=Nt,u.stackSave=Zt,u.stackRestore=Jt,u.stackAlloc=Xt,ut=function t(){Gt||te(),Gt||(ut=t)},u.run=te,u.preInit)for("function"==typeof u.preInit&&(u.preInit=[u.preInit]);0<u.preInit.length;)u.preInit.pop()();return te(),u})))};t.exports=a,t.exports.default=a}).call(this,r(84)(t),r(25),"/",r(16).Buffer)},function(t,e,r){!function(){function e(t,e){var r,n,i,o,a,s,u,c;for(r=3&t.length,n=t.length-r,i=e,a=3432918353,s=461845907,c=0;c<n;)u=255&t.charCodeAt(c)|(255&t.charCodeAt(++c))<<8|(255&t.charCodeAt(++c))<<16|(255&t.charCodeAt(++c))<<24,++c,i=27492+(65535&(o=5*(65535&(i=(i^=u=(65535&(u=(u=(65535&u)*a+(((u>>>16)*a&65535)<<16)&4294967295)<<15|u>>>17))*s+(((u>>>16)*s&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(u=0,r){case 3:u^=(255&t.charCodeAt(c+2))<<16;case 2:u^=(255&t.charCodeAt(c+1))<<8;case 1:i^=u=(65535&(u=(u=(65535&(u^=255&t.charCodeAt(c)))*a+(((u>>>16)*a&65535)<<16)&4294967295)<<15|u>>>17))*s+(((u>>>16)*s&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}var r=e;r.v2=function(t,e){for(var r,n=t.length,i=e^n,o=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++o;switch(n){case 3:i^=(255&t.charCodeAt(o+2))<<16;case 2:i^=(255&t.charCodeAt(o+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(o)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0},r.v3=e,t.exports=r}()},function(t,e,r){"use strict";(function(t){function n(){return"true"===String(t.env.REACT_APP_NETLIFY)||!1}r.d(e,"a",(function(){return n}))}).call(this,r(25))},function(t,e,r){t.exports=r(388)},function(t,e,r){(function(e){const n=r(394);t.exports=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"==typeof t&&(t=e.from(t));const i=r&&r.objname?{}:[],o=new n.Parser(r);o.push=function(t){null!==t&&(void 0===r.objname?i.push(t):i[t[0]]=t[1])};const a=o.__parse(t,!1);if(void 0!==a)throw a;const s=o.__parse(void 0,!0);if(void 0!==s)throw s;return i}}).call(this,r(16).Buffer)},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(28),i=r(77),o=r(8);function a(t,e){Object(o.a)(2,arguments);var r=Object(n.a)(e),a=7*r;return Object(i.a)(t,a)}},function(t,e,r){var n,i,o;i=[],void 0===(o="function"==typeof(n=function(){"use strict";function t(e,r,n,i){var o=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(o,t.prototype),o.expected=r,o.found=n,o.location=i,o.name="SyntaxError",o}function e(t,e,r){return r=r||" ",t.length>e?t:(e-=t.length,t+(r+=r.repeat(e)).slice(0,e))}return function(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}(t,Error),t.prototype.format=function(t){var r="Error: "+this.message;if(this.location){var n,i=null;for(n=0;n<t.length;n++)if(t[n].source===this.location.source){i=t[n].text.split(/\r\n|\n|\r/g);break}var o=this.location.start,a=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(o):o,s=this.location.source+":"+a.line+":"+a.column;if(i){var u=this.location.end,c=e("",a.line.toString().length," "),l=i[o.line-1],f=(o.line===u.line?u.column:l.length+1)-o.column||1;r+="\n --\x3e "+s+"\n"+c+" |\n"+a.line+" | "+l+"\n"+c+" | "+e("",o.column-1," ")+e("",f,"^")}else r+="\n at "+s}return r},t.buildMessage=function(t,e){var r={literal:function(t){return'"'+i(t.text)+'"'},class:function(t){var e=t.parts.map((function(t){return Array.isArray(t)?o(t[0])+"-"+o(t[1]):o(t)}));return"["+(t.inverted?"^":"")+e.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(t){return t.description}};function n(t){return t.charCodeAt(0).toString(16).toUpperCase()}function i(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(t){return"\\x0"+n(t)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(t){return"\\x"+n(t)}))}function o(t){return t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(t){return"\\x0"+n(t)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(t){return"\\x"+n(t)}))}function a(t){return r[t.type](t)}return"Expected "+function(t){var e,r,n=t.map(a);if(n.sort(),n.length>0){for(e=1,r=1;e<n.length;e++)n[e-1]!==n[e]&&(n[r]=n[e],r++);n.length=r}switch(n.length){case 1:return n[0];case 2:return n[0]+" or "+n[1];default:return n.slice(0,-1).join(", ")+", or "+n[n.length-1]}}(t)+" but "+function(t){return t?'"'+i(t)+'"':"end of input"}(e)+" found."},{SyntaxError:t,parse:function(e,r){var n,i={},o=(r=void 0!==r?r:{}).grammarSource,a={expr:nt},s=nt,u=/^[0-9]/,c=/^[^\r\n\t]/,l=X("repeat interval"),f=Z("month",!0),d=Z("months",!0),h=Z("year",!0),g=Z("years",!0),p=Z("spend",!0),m=Z("from",!0),y=Z("week",!0),b=Z("weeks",!0),_=Z("by",!0),v=Z("of",!0),w=Z("repeat",!0),E=Z("every",!0),S=Z("starting",!0),O=Z("up",!0),T=Z("to",!0),A=Z("schedule",!0),M=Z("-",!0),I=X("space"),R=Z(" ",!1),N=X("digit"),k=J([["0","9"]],!1,!1),D=X("number"),j=X("amount"),C=Z(".",!1),L=X("percentage"),x=Z("%",!1),B=X("year"),U=X("month"),F=Z("-",!1),P=X("day"),W=X("currency symbol"),z={type:"any"},H=X("Name"),q=J(["\r","\n","\t"],!0,!1),V=0,G=[{line:1,column:1}],Y=0,$=[],K=0;if("startRule"in r){if(!(r.startRule in a))throw new Error("Can't start parsing from rule \""+r.startRule+'".');s=a[r.startRule]}function Z(t,e){return{type:"literal",text:t,ignoreCase:e}}function J(t,e,r){return{type:"class",parts:t,inverted:e,ignoreCase:r}}function X(t){return{type:"other",description:t}}function Q(t){var r,n=G[t];if(n)return n;for(r=t-1;!G[r];)r--;for(n={line:(n=G[r]).line,column:n.column};r<t;)10===e.charCodeAt(r)?(n.line++,n.column=1):n.column++,r++;return G[t]=n,n}function tt(t,e,r){var n=Q(t),i=Q(e),a={source:o,start:{offset:t,line:n.line,column:n.column},end:{offset:e,line:i.line,column:i.column}};return r&&o&&"function"==typeof o.offset&&(a.start=o.offset(a.start),a.end=o.offset(a.end)),a}function et(t){V<Y||(V>Y&&(Y=V,$=[]),$.push(t))}function rt(e,r,n){return new t(t.buildMessage(e,r),e,r,n)}function nt(){var t,r,n,o,a,s,u,c,w,E,O,T;return t=V,(r=st())===i&&(r=null),ut(),(n=function(){var t,r,n,o;if(K++,t=V,r=V,n=[],(o=ct())!==i)for(;o!==i;)n.push(o),o=ct();else n=i;return(r=n!==i?e.substring(r,V):n)!==i?((n=ut())===i&&(n=null),37===e.charCodeAt(V)?(o="%",V++):(o=i,0===K&&et(x)),o!==i?t=+r:(V=t,t=i)):(V=t,t=i),K--,t===i&&(r=i,0===K&&et(L)),t}())!==i&&(o=ut())!==i&&(a=function(){var t;return"of"===e.substr(V,2).toLowerCase()?(t=e.substr(V,2),V+=2):(t=i,0===K&&et(v)),t}())!==i&&ut()!==i&&(s=ht())!==i?t={type:"percentage",percent:+n,category:s,priority:+r}:(V=t,t=i),t===i&&(t=V,(r=st())===i&&(r=null),ut(),(n=ft())!==i&&(o=ut())!==i&&(a=ot())!==i&&ut()!==i&&(s=function(){var t,r;return t=V,(r=function(){var t;return"week"===e.substr(V,4).toLowerCase()?(t=e.substr(V,4),V+=4):(t=i,0===K&&et(y)),t}())!==i&&(r=null),(t=r)===i&&(t=V,(r=lt())!==i&&ut()!==i&&function(){var t;return"weeks"===e.substr(V,5).toLowerCase()?(t=e.substr(V,5),V+=5):(t=i,0===K&&et(b)),t}()!==i?t=+r:(V=t,t=i)),t}())!==i&&(u=ut())!==i&&(c=function(){var t;return"starting"===e.substr(V,8).toLowerCase()?(t=e.substr(V,8),V+=8):(t=i,0===K&&et(S)),t}())!==i&&(w=ut())!==i&&(E=function(){var t,r,n,o,a;return t=V,r=V,(n=dt())!==i?(45===e.charCodeAt(V)?(o="-",V++):(o=i,0===K&&et(F)),o!==i&&(a=function(){var t,r,n,o;return K++,t=V,r=V,(n=ct())!==i&&(o=ct())!==i?r=n=[n,o]:(V=r,r=i),t=r!==i?e.substring(t,V):r,K--,t===i&&(r=i,0===K&&et(P)),t}())!==i?r=n=[n,o,a]:(V=r,r=i)):(V=r,r=i),t=r!==i?e.substring(t,V):r}())!==i?((O=it())===i&&(O=null),t=function(t,e,r,n,i){return{type:"week",amount:e,weeks:r,starting:n,limit:i,priority:+t}}(r,n,s,E,O)):(V=t,t=i),t===i&&(t=V,(r=st())===i&&(r=null),ut(),(n=ft())!==i&&(o=ut())!==i&&(a=function(){var t;return"by"===e.substr(V,2).toLowerCase()?(t=e.substr(V,2),V+=2):(t=i,0===K&&et(_)),t}())!==i&&ut()!==i&&(s=dt())!==i?((u=function(){var t,r,n,o;return t=V,ut()!==i?("spend"===e.substr(V,5).toLowerCase()?(r=e.substr(V,5),V+=5):(r=i,0===K&&et(p)),r!==i&&ut()!==i?("from"===e.substr(V,4).toLowerCase()?(n=e.substr(V,4),V+=4):(n=i,0===K&&et(m)),n!==i&&ut()!==i&&(o=dt())!==i?t=o:(V=t,t=i)):(V=t,t=i)):(V=t,t=i),t}())===i&&(u=null),c=V,(w=ut())!==i&&(E=ot())!==i&&(O=ut())!==i&&(T=function(){var t,r,n;return K++,t=V,"month"===e.substr(V,5).toLowerCase()?(r=e.substr(V,5),V+=5):(r=i,0===K&&et(f)),r!==i&&(r={annual:!1}),(t=r)===i&&(t=V,(r=ct())!==i&&ut()!==i?("months"===e.substr(V,6).toLowerCase()?(n=e.substr(V,6),V+=6):(n=i,0===K&&et(d)),n!==i?t={annual:!1,repeat:+r}:(V=t,t=i)):(V=t,t=i),t===i&&(t=V,"year"===e.substr(V,4).toLowerCase()?(r=e.substr(V,4),V+=4):(r=i,0===K&&et(h)),r!==i&&(r={annual:!0}),(t=r)===i&&(t=V,(r=ct())!==i&&ut()!==i?("years"===e.substr(V,5).toLowerCase()?(n=e.substr(V,5),V+=5):(n=i,0===K&&et(g)),n!==i?t={annual:!0,repeat:+r}:(V=t,t=i)):(V=t,t=i)))),K--,t===i&&(r=i,0===K&&et(l)),t}())!==i?c=w=[w,E,O,T]:(V=c,c=i),c===i&&(c=null),t=function(t,e,r,n,i){return{type:n?"spend":"by",amount:e,month:r,...i?i[3]:{},from:n,priority:+t}}(r,n,s,u,c)):(V=t,t=i),t===i&&(t=V,(r=st())===i&&(r=null),ut(),(n=ft())!==i?((o=it())===i&&(o=null),t=function(t,e,r){return{type:"simple",monthly:e,limit:r,priority:+t}}(r,n,o)):(V=t,t=i),t===i&&(t=V,(r=st())===i&&(r=null),ut(),(n=at())!==i&&(o=ut())!==i&&(a=ft())!==i?t=function(t,e){return{type:"simple",limit:e,priority:+t}}(r,a):(V=t,t=i),t===i&&(t=V,(r=st())===i&&(r=null),ut(),(n=function(){var t;return"schedule"===e.substr(V,8).toLowerCase()?(t=e.substr(V,8),V+=8):(t=i,0===K&&et(A)),t}())!==i&&(o=ut())!==i&&(a=ht())!==i?t=function(t,e){return{type:"schedule",name:e,priority:+t}}(r,a):(V=t,t=i)))))),t}function it(){var t,e;return t=V,ut()!==i?(at(),ut()!==i&&(e=ft())!==i?t=e:(V=t,t=i)):(V=t,t=i),t}function ot(){var t,r,n,o;return t=V,"repeat"===e.substr(V,6).toLowerCase()?(r=e.substr(V,6),V+=6):(r=i,0===K&&et(w)),r!==i&&(n=ut())!==i?("every"===e.substr(V,5).toLowerCase()?(o=e.substr(V,5),V+=5):(o=i,0===K&&et(E)),o!==i?t=r=[r,n,o]:(V=t,t=i)):(V=t,t=i),t}function at(){var t,r,n,o;return t=V,"up"===e.substr(V,2).toLowerCase()?(r=e.substr(V,2),V+=2):(r=i,0===K&&et(O)),r!==i&&(n=ut())!==i?("to"===e.substr(V,2).toLowerCase()?(o=e.substr(V,2),V+=2):(o=i,0===K&&et(T)),o!==i?t=r=[r,n,o]:(V=t,t=i)):(V=t,t=i),t}function st(){var t,r,n;return t=V,"-"===e.substr(V,1).toLowerCase()?(r=e.charAt(V),V++):(r=i,0===K&&et(M)),r!==i&&(n=lt())!==i&&ut()!==i?t=n:(V=t,t=i),t}function ut(){var t,r;if(K++,t=[],32===e.charCodeAt(V)?(r=" ",V++):(r=i,0===K&&et(R)),r!==i)for(;r!==i;)t.push(r),32===e.charCodeAt(V)?(r=" ",V++):(r=i,0===K&&et(R));else t=i;return K--,t===i&&(r=i,0===K&&et(I)),t}function ct(){var t;return K++,u.test(e.charAt(V))?(t=e.charAt(V),V++):(t=i,0===K&&et(k)),K--,t===i&&0===K&&et(N),t}function lt(){var t,r,n;if(K++,t=V,r=[],(n=ct())!==i)for(;n!==i;)r.push(n),n=ct();else r=i;return t=r!==i?e.substring(t,V):r,K--,t===i&&(r=i,0===K&&et(D)),t}function ft(){var t,r,n,o,a,s,u,c,l;if(K++,t=V,function(){var t,r,n;K++,t=V,e.length>V?(r=e.charAt(V),V++):(r=i,0===K&&et(z)),r!==i&&(n=(n=/\p{Sc}/u.test(r))?void 0:i)!==i?t=r=[r,n]:(V=t,t=i),K--,t===i&&(r=i,0===K&&et(W))}(),ut(),r=V,n=V,o=[],(a=ct())!==i)for(;a!==i;)o.push(a),a=ct();else o=i;return o!==i?(a=V,46===e.charCodeAt(V)?(s=".",V++):(s=i,0===K&&et(C)),s!==i?(u=V,(c=ct())!==i?((l=ct())===i&&(l=null),u=c=[c,l]):(V=u,u=i),u===i&&(u=null),a=s=[s,u]):(V=a,a=i),a===i&&(a=null),n=o=[o,a]):(V=n,n=i),(r=n!==i?e.substring(r,V):n)!==i?t=+r:(V=t,t=i),K--,t===i&&0===K&&et(j),t}function dt(){var t,r,n,o,a,s;return K++,t=V,r=V,(n=function(){var t,r,n,o,a,s;return K++,t=V,r=V,(n=ct())!==i&&(o=ct())!==i&&(a=ct())!==i&&(s=ct())!==i?r=n=[n,o,a,s]:(V=r,r=i),t=r!==i?e.substring(t,V):r,K--,t===i&&(r=i,0===K&&et(B)),t}())!==i?(45===e.charCodeAt(V)?(o="-",V++):(o=i,0===K&&et(F)),o!==i&&(a=ct())!==i&&(s=ct())!==i?r=n=[n,o,a,s]:(V=r,r=i)):(V=r,r=i),t=r!==i?e.substring(t,V):r,K--,t===i&&(r=i,0===K&&et(U)),t}function ht(){var t,r,n;if(K++,t=V,r=[],c.test(e.charAt(V))?(n=e.charAt(V),V++):(n=i,0===K&&et(q)),n!==i)for(;n!==i;)r.push(n),c.test(e.charAt(V))?(n=e.charAt(V),V++):(n=i,0===K&&et(q));else r=i;return t=r!==i?e.substring(t,V):r,K--,t===i&&(r=i,0===K&&et(H)),t}if((n=s())!==i&&V===e.length)return n;throw n!==i&&V<e.length&&et({type:"end"}),rt($,Y<e.length?e.charAt(Y):null,Y<e.length?tt(Y,Y+1):tt(Y,Y))}}})?n.apply(e,i):n)||(t.exports=o)},function(t,e,r){"use strict";var n=r(51),i=r(0);let o=Object(n.a)();o.method("notes-save",async t=>{let{id:e,note:r}=t;await i.update("notes",{id:e,note:r})}),e.a=o},function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n=r(10),i=r(7);function o(t,e){e.forEach((t,e)=>{if("transactions"===e){let e=[];t.forEach(t=>{if(1===t.isChild&&null==t.parent_id&&t.id.includes("/")){let r=t.id.split("/")[0];e.push({dataset:"transactions",row:t.id,column:"parent_id",value:r,timestamp:n.a.send()})}}),e.length>0&&Object(i.b)(e)}})}let a=null;function s(){a&&(a(),a=null),a=Object(i.a)(o)}},function(t,e,r){"use strict";var n=r(53),i=r(51),o=r(0),a=r(4);let s=Object(i.a)();s.method("tools/fix-split-transactions",async()=>{let t=await o.all("\n SELECT t.*, p.payee AS parentPayee FROM v_transactions_internal t\n LEFT JOIN v_transactions_internal p ON t.parent_id = p.id\n WHERE t.is_child = 1 AND t.payee IS NULL AND p.payee IS NOT NULL\n ");await Object(a.e)(async()=>{let e=t.map(t=>({id:t.id,payee:t.parentPayee}));await Object(n.a)({updated:e})});let e=await o.all("\n SELECT t.id, p.cleared FROM v_transactions_internal t\n LEFT JOIN v_transactions_internal p ON t.parent_id = p.id\n WHERE t.is_child = 1 AND t.cleared != p.cleared\n ");await Object(a.e)(async()=>{let t=e.map(t=>({id:t.id,cleared:1===t.cleared}));await Object(n.a)({updated:t})});let r=await o.all("\n SELECT t.* FROM v_transactions_internal t\n LEFT JOIN v_transactions_internal p ON t.parent_id = p.id\n WHERE t.is_child = 1 AND t.tombstone = 0 AND (p.tombstone = 1 OR p.id IS NULL)\n ");return await Object(a.e)(async()=>{let t=r.map(t=>({id:t.id,tombstone:1}));await Object(n.a)({updated:t})}),{numBlankPayees:t.length,numCleared:e.length,numDeleted:r.length}}),e.a=s},function(t,e,r){var n,i,o,a,s;n=r(427),i=r(230).utf8,o=r(428),a=r(230).bin,(s=function(t,e){t.constructor==String?t=e&&"binary"===e.encoding?a.stringToBytes(t):i.stringToBytes(t):o(t)?t=Array.prototype.slice.call(t,0):Array.isArray(t)||t.constructor===Uint8Array||(t=t.toString());for(var r=n.bytesToWords(t),u=8*t.length,c=1732584193,l=-271733879,f=-1732584194,d=271733878,h=0;h<r.length;h++)r[h]=16711935&(r[h]<<8|r[h]>>>24)|4278255360&(r[h]<<24|r[h]>>>8);r[u>>>5]|=128<<u%32,r[14+(u+64>>>9<<4)]=u;var g=s._ff,p=s._gg,m=s._hh,y=s._ii;for(h=0;h<r.length;h+=16){var b=c,_=l,v=f,w=d;c=g(c,l,f,d,r[h+0],7,-680876936),d=g(d,c,l,f,r[h+1],12,-389564586),f=g(f,d,c,l,r[h+2],17,606105819),l=g(l,f,d,c,r[h+3],22,-1044525330),c=g(c,l,f,d,r[h+4],7,-176418897),d=g(d,c,l,f,r[h+5],12,1200080426),f=g(f,d,c,l,r[h+6],17,-1473231341),l=g(l,f,d,c,r[h+7],22,-45705983),c=g(c,l,f,d,r[h+8],7,1770035416),d=g(d,c,l,f,r[h+9],12,-1958414417),f=g(f,d,c,l,r[h+10],17,-42063),l=g(l,f,d,c,r[h+11],22,-1990404162),c=g(c,l,f,d,r[h+12],7,1804603682),d=g(d,c,l,f,r[h+13],12,-40341101),f=g(f,d,c,l,r[h+14],17,-1502002290),c=p(c,l=g(l,f,d,c,r[h+15],22,1236535329),f,d,r[h+1],5,-165796510),d=p(d,c,l,f,r[h+6],9,-1069501632),f=p(f,d,c,l,r[h+11],14,643717713),l=p(l,f,d,c,r[h+0],20,-373897302),c=p(c,l,f,d,r[h+5],5,-701558691),d=p(d,c,l,f,r[h+10],9,38016083),f=p(f,d,c,l,r[h+15],14,-660478335),l=p(l,f,d,c,r[h+4],20,-405537848),c=p(c,l,f,d,r[h+9],5,568446438),d=p(d,c,l,f,r[h+14],9,-1019803690),f=p(f,d,c,l,r[h+3],14,-187363961),l=p(l,f,d,c,r[h+8],20,1163531501),c=p(c,l,f,d,r[h+13],5,-1444681467),d=p(d,c,l,f,r[h+2],9,-51403784),f=p(f,d,c,l,r[h+7],14,1735328473),c=m(c,l=p(l,f,d,c,r[h+12],20,-1926607734),f,d,r[h+5],4,-378558),d=m(d,c,l,f,r[h+8],11,-2022574463),f=m(f,d,c,l,r[h+11],16,1839030562),l=m(l,f,d,c,r[h+14],23,-35309556),c=m(c,l,f,d,r[h+1],4,-1530992060),d=m(d,c,l,f,r[h+4],11,1272893353),f=m(f,d,c,l,r[h+7],16,-155497632),l=m(l,f,d,c,r[h+10],23,-1094730640),c=m(c,l,f,d,r[h+13],4,681279174),d=m(d,c,l,f,r[h+0],11,-358537222),f=m(f,d,c,l,r[h+3],16,-722521979),l=m(l,f,d,c,r[h+6],23,76029189),c=m(c,l,f,d,r[h+9],4,-640364487),d=m(d,c,l,f,r[h+12],11,-421815835),f=m(f,d,c,l,r[h+15],16,530742520),c=y(c,l=m(l,f,d,c,r[h+2],23,-995338651),f,d,r[h+0],6,-198630844),d=y(d,c,l,f,r[h+7],10,1126891415),f=y(f,d,c,l,r[h+14],15,-1416354905),l=y(l,f,d,c,r[h+5],21,-57434055),c=y(c,l,f,d,r[h+12],6,1700485571),d=y(d,c,l,f,r[h+3],10,-1894986606),f=y(f,d,c,l,r[h+10],15,-1051523),l=y(l,f,d,c,r[h+1],21,-2054922799),c=y(c,l,f,d,r[h+8],6,1873313359),d=y(d,c,l,f,r[h+15],10,-30611744),f=y(f,d,c,l,r[h+6],15,-1560198380),l=y(l,f,d,c,r[h+13],21,1309151649),c=y(c,l,f,d,r[h+4],6,-145523070),d=y(d,c,l,f,r[h+11],10,-1120210379),f=y(f,d,c,l,r[h+2],15,718787259),l=y(l,f,d,c,r[h+9],21,-343485551),c=c+b>>>0,l=l+_>>>0,f=f+v>>>0,d=d+w>>>0}return n.endian([c,l,f,d])})._ff=function(t,e,r,n,i,o,a){var s=t+(e&r|~e&n)+(i>>>0)+a;return(s<<o|s>>>32-o)+e},s._gg=function(t,e,r,n,i,o,a){var s=t+(e&n|r&~n)+(i>>>0)+a;return(s<<o|s>>>32-o)+e},s._hh=function(t,e,r,n,i,o,a){var s=t+(e^r^n)+(i>>>0)+a;return(s<<o|s>>>32-o)+e},s._ii=function(t,e,r,n,i,o,a){var s=t+(r^(e|~n))+(i>>>0)+a;return(s<<o|s>>>32-o)+e},s._blocksize=16,s._digestsize=16,t.exports=function(t,e){if(null==t)throw new Error("Illegal argument "+t);var r=n.wordsToBytes(s(t,e));return e&&e.asBytes?r:e&&e.asString?a.bytesToString(r):n.bytesToHex(r)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return R}));var n=r(23);function i(t,e){return"out-of-sync-migrations"===t||"out-of-sync-data"===t?"This budget cannot be loaded with this version of the app.":"budget-not-found"===t?`Budget “${e}” not found. Check the id of your budget in the Advanced section of the settings page.`:`We had an unknown problem opening “${e}”.`}var o=r(1),a=r(30),s=r(61),u=r(5),c=r(37),l=r(20);l.h;const f={...l.a,toExternal:t=>({id:t.id,name:t.name,type:t.type,offbudget:!!t.offbudget,closed:!!t.closed}),fromExternal(t){let e={...t};return"offbudget"in t&&(e.offbudget=t.offbudget?1:0),"closed"in t&&(e.closed=t.closed?1:0),e}},d={...l.c,toExternal:t=>({id:t.id,name:t.name,is_income:!!t.is_income,group_id:t.cat_group}),fromExternal(t){let{group_id:e,...r}=t;return"is_income"in t&&(r.is_income=t.is_income?1:0),"group_id"in t&&(r.cat_group=t.group_id),r}},h={...l.b,toExternal:t=>({id:t.id,name:t.name,is_income:!!t.is_income,categories:t.categories.map(d.toExternal)}),fromExternal(t){let e={...t};return"is_income"in t&&(e.is_income=t.is_income?1:0),"categories"in t&&(e.categories=t.categories.map(d.fromExternal)),e}},g={...l.e,toExternal:t=>({id:t.id,name:t.name,category:t.category,transfer_acct:t.transfer_acct}),fromExternal:t=>t};var p=r(14),m=r(38),y=r(10),b=r(0),_=r(4),v=r(6),w=r(3),E=r(7);let S=!1;function O(t,e){return{type:"APIError",message:t,meta:e}}function T(t){return e=>Object(_.e)(async()=>{let r=Object(y.c)().timestamp.toString(),i=await t(e),o=await b.all("SELECT DISTINCT dataset FROM messages_crdt WHERE timestamp > ?",[r]);return n.a()>1&&n.c("sync-event",{type:"success",tables:o.map(t=>t.dataset)}),i},{undoDisabled:!0})}let A={};async function M(t){if(!t.match(/^\d{4}-\d{2}$/))throw O("Invalid month format, use YYYY-MM: "+t);if(!S){let{start:e,end:r}=await A["get-budget-bounds"]();if(!o.n(e,r).includes(t))throw O("No budget exists for month: "+t)}}let I=null;function R(t){return A=Object.assign({},t,A),A}A["api/batch-budget-start"]=async function(){if(I)throw O("Cannot start a batch process: batch already started");S?b.asyncTransaction(()=>new Promise((t,e)=>{I={resolve:t,reject:e}})):Object(E.c)(()=>new Promise((t,e)=>{I={resolve:t,reject:e}}))},A["api/batch-budget-end"]=async function(){if(!I)throw O("Cannot end a batch process: no batch started");I.resolve(),I=null},A["api/load-budget"]=async function(t){let{id:e}=t,{id:r}=v.b()||{};if(r!==e){n.c("start-load");let{error:t}=await A["load-budget"]({id:e});if(t)throw n.c("show-budgets"),new Error(i(t,e));n.c("finish-load")}},A["api/download-budget"]=async function(t){let{syncId:e,password:r}=t,{id:n}=v.b()||{};n&&await A["close-budget"]();let o=(await A["get-budgets"]()).find(t=>t.groupId===e);if(o){await A["load-budget"]({id:o.id});let t=await A["sync-budget"]({id:o.id});if(t.error)throw new Error(i(t.error,o.id))}else{let t=(await A["get-remote-files"]()).find(t=>t.groupId===e);if(!t)throw new Error(`Budget “${e}” not found. Check the sync id of your budget in the Advanced section of the settings page.`);if(t.encryptKeyId&&!r)throw new Error(`File ${t.name} is encrypted. Please provide a password.`);if(r){let e=await A["key-test"]({fileId:t.fileId,password:r});if(e.error)throw new Error(function(t){let{reason:e}=t;switch(e){case"network":return"Unable to connect to the server. We need to access the server to get some information about your keys.";case"old-key-style":return"This file is encrypted with an old unsupported key style. Recreate the key on a device where the file is available, or use an older version of Actual to download it.";case"decrypt-failure":return"Unable to decrypt file with this password. Please try again.";default:return"Something went wrong trying to create a key, sorry! Contact help@actualbudget.com for support."}}(e.error))}let n=await A["download-budget"]({fileId:t.fileId});if(n.error)throw new Error(function(t){let{reason:e,meta:r,fileName:n}=t;switch(e){case"network":case"download-failure":return"Downloading the file failed. Check your network connection.";case"not-zip-file":case"invalid-zip-file":case"invalid-meta-file":return"Downloaded file is invalid, sorry! Contact help@actualbudget.com for support.";case"decrypt-failure":return"Unable to decrypt file "+(n||"(unknown)")+". To change your key, first download this file with the proper password.";case"out-of-sync-migrations":return"This budget cannot be loaded with this version of the app. Make sure the app is up-to-date.";default:return"Something went wrong trying to download that file, sorry! Contact help@actualbudget.com for support. "+(r&&r.fileId?`(fileId: ${r.fileId})`:"")}}(n.error));await A["load-budget"]({id:n.id})}},A["api/start-import"]=async function(t){let{budgetName:e}=t;await A["close-budget"](),await A["create-budget"]({budgetName:e,avoidUpload:!0}),await b.runQuery("DELETE FROM categories WHERE is_income = 0"),await b.runQuery("DELETE FROM category_groups WHERE is_income = 0"),Object(E.k)("import"),n.c("start-import"),S=!0},A["api/finish-import"]=async function(){w.b().markCacheDirty();let{id:t}=v.b();await A["close-budget"](),await A["load-budget"]({id:t}),await A["get-budget-bounds"](),await w.j(),await m.i().catch(t=>{}),n.c("finish-import"),S=!1},A["api/abort-import"]=async function(){if(S){let{id:t}=v.b();await A["close-budget"](),await A["delete-budget"]({id:t}),n.c("show-budgets")}S=!1},A["api/query"]=async function(t){let{query:e}=t;return Object(p.g)(e)},A["api/budget-months"]=async function(){let{start:t,end:e}=await A["get-budget-bounds"]();return o.n(t,e)},A["api/budget-month"]=async function(t){let{month:e}=t;await M(e);let r=await b.getCategoriesGrouped(),n=o.p(e);function i(t){let e=w.b().getCellValue(n,t);return""===e?0:e}return{month:e,incomeAvailable:i("available-funds"),lastMonthOverspent:i("last-month-overspent"),forNextMonth:i("buffered"),totalBudgeted:i("total-budgeted"),toBudget:i("to-budget"),fromLastMonth:i("from-last-month"),totalIncome:i("total-income"),totalSpent:i("total-spent"),totalBalance:i("total-leftover"),categoryGroups:r.map(t=>t.is_income?{...h.toExternal(t),received:i("total-income"),categories:t.categories.map(t=>({...d.toExternal(t),received:i("sum-amount-"+t.id)}))}:{...h.toExternal(t),budgeted:i("group-budget-"+t.id),spent:i("group-sum-amount-"+t.id),balance:i("group-leftover-"+t.id),categories:t.categories.map(t=>({...d.toExternal(t),budgeted:i("budget-"+t.id),spent:i("sum-amount-"+t.id),balance:i("leftover-"+t.id),carryover:i("carryover-"+t.id)}))})}},A["api/budget-set-amount"]=T((async function(t){let{month:e,categoryId:r,amount:n}=t;return A["budget/budget-amount"]({month:e,category:r,amount:n})})),A["api/budget-set-carryover"]=T((async function(t){let{month:e,categoryId:r,flag:n}=t;return await M(e),await async function(t,e){if(null==e)throw O(t+": category id is required");let r=await b.first("SELECT is_income FROM categories WHERE id = ?",[e]);if(!r)throw O(`${t}: category “${e}” does not exist`);if(0!==r.is_income)throw O(`${t}: category “${e}” is not an expense category`)}("budget-set-carryover",r),A["budget/set-carryover"]({startMonth:e,category:r,flag:n})})),A["api/transactions-export"]=async function(t){let{transactions:e,categoryGroups:r,payees:n}=t;return A["transactions-export"]({transactions:e,categoryGroups:r,payees:n})},A["api/transactions-import"]=T((async function(t){let{accountId:e,transactions:r}=t;return A["transactions-import"]({accountId:e,transactions:r})})),A["api/transactions-add"]=T((async function(t){let{accountId:e,transactions:r}=t;return await Object(c.a)(e,r,{runTransfers:!1}),"ok"})),A["api/transactions-get"]=async function(t){let{accountId:e,startDate:r,endDate:n}=t,{data:i}=await Object(p.g)(Object(a.b)("transactions").filter({$and:[e&&{account:e},r&&{date:{$gte:r}},n&&{date:{$lte:n}}].filter(Boolean)}).select("*").options({splits:"grouped"}));return i},A["api/transactions-filter"]=async function(t){let{text:e,accountId:r}=t;throw new Error("`filterTransactions` is deprecated, use `runQuery` instead")},A["api/transaction-update"]=T((async function(t){let{id:e,fields:r}=t,{data:n}=await Object(p.g)(Object(a.b)("transactions").filter({id:e}).select("*").options({splits:"grouped"})),i=Object(s.d)(n);if(0===i.length)return[];let{diff:o}=Object(s.e)(i,r);return A["transactions-batch-update"](o)})),A["api/transaction-delete"]=T((async function(t){let{id:e}=t,{data:r}=await Object(p.g)(Object(a.b)("transactions").filter({id:e}).select("*").options({splits:"grouped"})),n=Object(s.d)(r);if(0===n.length)return[];let{diff:i}=Object(s.a)(n,e);return A["transactions-batch-update"](i)})),A["api/accounts-get"]=async function(){return(await b.getAccounts()).map(t=>f.toExternal(t))},A["api/account-create"]=T((async function(t){let{account:e,initialBalance:r=null}=t;return A["account-create"]({name:e.name,type:e.type,offBudget:e.offbudget,closed:e.closed,balance:null!=r?Object(u.k)(r):null})})),A["api/account-update"]=T((async function(t){let{id:e,fields:r}=t;return b.updateAccount({id:e,...f.fromExternal(r)})})),A["api/account-close"]=T((async function(t){let{id:e,transferAccountId:r,transferCategoryId:n}=t;return A["account-close"]({id:e,transferAccountId:r,categoryId:n})})),A["api/account-reopen"]=T((async function(t){let{id:e}=t;return A["account-reopen"]({id:e})})),A["api/account-delete"]=T((async function(t){let{id:e}=t;return A["account-close"]({id:e,forced:!0})})),A["api/categories-get"]=async function(){let{grouped:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=await A["get-categories"]();return t?e.grouped.map(h.toExternal):e.list.map(d.toExternal)},A["api/category-group-create"]=T((async function(t){let{group:e}=t;return A["category-group-create"]({name:e.name})})),A["api/category-group-update"]=T((async function(t){let{id:e,fields:r}=t;return A["category-group-update"]({id:e,...h.fromExternal(r)})})),A["api/category-group-delete"]=T((async function(t){let{id:e,transferCategoryId:r}=t;return A["category-group-delete"]({id:e,transferId:r})})),A["api/category-create"]=T((async function(t){let{category:e}=t;return A["category-create"]({name:e.name,groupId:e.group_id,isIncome:e.is_income})})),A["api/category-update"]=T((async function(t){let{id:e,fields:r}=t;return A["category-update"]({id:e,...d.fromExternal(r)})})),A["api/category-delete"]=T((async function(t){let{id:e,transferCategoryId:r}=t;return A["category-delete"]({id:e,transferId:r})})),A["api/payees-get"]=async function(){return(await A["payees-get"]()).map(g.toExternal)},A["api/payee-create"]=T((async function(t){let{payee:e}=t;return A["payee-create"]({name:e.name})})),A["api/payee-update"]=T((async function(t){let{id:e,fields:r}=t;return A["payees-batch-change"]({updated:[{id:e,...g.fromExternal(r)}]})})),A["api/payee-delete"]=T((async function(t){let{id:e}=t;return A["payees-batch-change"]({deleted:[{id:e}]})}))},function(t,e,r){"use strict";var n=r(51),i=r(4),o=r(18),a=r(24),s=r(17),u=r(8);function c(t,e){Object(u.a)(2,arguments);var r=Object(s.a)(t),n=Object(s.a)(e),i=r.getFullYear()-n.getFullYear(),o=r.getMonth()-n.getMonth();return 12*i+o}var l=r(76),f=r(42),d=r(240),h=r(77),g=r(1),p=r(40),m=r(5),y=r(0),b=r(78),_=r(241);function v(t){let e=t[0].priority,r=!1;for(let n=1;n<t.length;n++)t[n].priority!==e&&(e=Math.min(e,t[n].priority),r=!0);return{lowPriority:e,errorNotice:r}}async function w(t,e){let r=0,n=[],i=await async function(){let t={},e=await y.all(`SELECT * FROM notes WHERE lower(note) like '%${E}%'`);for(let r=0;r<e.length;r++){let n=e[r].note.split("\n"),i=[];for(let t=0;t<n.length;t++){let e=n[t].trim();if(!e.toLowerCase().startsWith(E))continue;let r=e.slice(E.length);try{let t=Object(_.parse)(r);i.push(t)}catch(t){i.push({type:"error",line:e,error:t})}}i.length&&(t[e[r].id]=i)}return t}(),o=0,s=[],u=await y.all("SELECT * FROM v_categories WHERE tombstone = 0");for(let e=0;e<u.length;e++){let r=u[e],n=await Object(a.d)(g.p(t),"budget-"+r.id);n&&s.push({cat:r,amount:n});let c=i[r.id];if(c){for(let t=0;t<c.length;t++)o=c[t].priority>o?c[t].priority:o;await Object(a.h)({category:r.id,month:t,amount:0})}}for(let s=0;s<=o;s++)for(let o=0;o<u.length;o++){let c=u[o],l=i[c.id];if(l){let i=!1,o=!1,u=0;if(l.filter(t=>"schedule"===t.type||"by"===t.type).length>0){let{lowPriority:t,errorNotice:e}=await v(l);u=t,i=u!==s,o=!0,!i&&e&&n.push(c.name+": Schedules and By templates should all have the same priority. Using priority "+u)}if(!i&&(o||(l=l.filter(t=>t.priority===s)),l.length>0)){n=n.concat(l.filter(t=>"error"===t.type).map(t=>{let{line:e,error:r}=t;return[c.name+": "+r.message,e," ".repeat(E.length+r.location.start.offset)+"^"].join("\n")}));let{amount:i,errors:o}=await S(c,l,t,s,e);null!=i&&(r++,await Object(a.h)({category:c.id,month:t,amount:i})),null!=o&&(n=n.concat(o.map(t=>`${c.name}: ${t}`)))}}}if(!e)for(let e=0;e<s.length;e++){await Object(a.h)({category:s[e].cat.id,month:t,amount:s[e].amount});let r=n.length;for(let t=0;t<r;t++)n[t].includes(s[e].cat.name)&&(n.splice(t,1),r--)}if(0===r)return n.length?{type:"error",sticky:!0,message:"There were errors interpreting some templates:",pre:n.join("\n\n")}:{type:"message",message:"All categories were up to date."};{let t=`Successfully applied templates to ${r} ${1===r?"category":"categories"}.`;return n.length?{sticky:!0,message:t+" There were errors interpreting some templates:",pre:n.join("\n\n")}:{type:"message",message:t}}}const E="#template";async function S(t,e,r,n,i){let o=new Date(r+"-01"),s=[],u=await y.all("SELECT name from schedules WHERE name NOT NULL AND tombstone = 0");u=u.map(t=>t.name),(e=e.filter(t=>{switch(t.type){case"by":case"spend":let e,r=new Date(t.month+"-01"),n=c(r,o),i=t.annual?12*(t.repeat||1):t.repeat;for("spend"===t.type&&(e=new Date(t.from+"-01"));n<0&&i;)r=Object(l.a)(r,i),e&&(e=Object(l.a)(e,i)),n=c(r,o);if(n<0)return s.push(t.month+" is in the past."),!1;t.month=Object(f.a)(r,"yyyy-MM"),e&&(t.from=Object(f.a)(e,"yyyy-MM"));break;case"schedule":if(!u.includes(t.name))return s.push(`Schedule ${t.name} does not exist`),null}return!0})).length>1&&(e=e.sort((t,e)=>"by"!==t.type||t.annual?t.type.localeCompare(e.type):c(new Date(t.month+"-01"),new Date(e.month+"-01"))));let _,v=g.p(r),w=await Object(a.d)(v,"budget-"+t.id),E=await Object(a.d)(v,"sum-amount-"+t.id),S=await Object(a.d)(v,"leftover-"+t.id),O=await Object(a.d)(v,"to-budget"),T=w,A=S-E-w,M=0,I=0,R=0;for(let r=0;r<e.length;r++){let i=e[r];switch(i.type){case"simple":{if(null!=i.limit){if(null!=_)return s.push("More than one “up to” limit found."),{errors:s};_=Object(m.a)(i.limit)}let t=0;if(null!=i.monthly){t=Object(m.a)(i.monthly)}else t=_;T+t<O||!n?T+=t:(O>0&&(T+=O),s.push("Insufficient funds."));break}case"by":{let t=e.length,a=new Date(e[r].month+"-01"),u=c(a,o),f="by"===i.type?i.repeat:12*(i.repeat||1);for(;u<0&&f;)a=Object(l.a)(a,f),u=c(e[r],o);if(u<0?R++:(M+=Object(m.a)(e[r].amount),I+=u+1),M-A>=0&&I>0&&r===t-1){let e=Math.round((M-A)/I*(t-R));T+e<O||!n?T+=e:(O>0&&(T+=O),s.push("Insufficient funds."))}break}case"week":{let t=Object(m.a)(i.amount),e=null!=i.weeks?Math.round(i.weeks):1;if(null!=i.limit){if(null!=_)return s.push("More than one “up to” limit found."),{errors:s};_=Object(m.a)(i.limit)}let r=new Date(i.starting),a=Object(l.a)(o,1);for(;r.getTime()<a.getTime();)r.getTime()>=o.getTime()&&(T+t<O||!n?T+=t:(O>0&&(T+=O),s.push("Insufficient funds.")),r=Object(d.a)(r,e));break}case"spend":{let e=new Date(i.from+"-01"),r=new Date(i.month+"-01"),u=A,d=!0;for(let r=e;c(o,r)>0;r=Object(l.a)(r,1)){let e=g.p(Object(f.a)(r,"yyyy-MM"));if(d){let r=await Object(a.d)(e,"sum-amount-"+t.id);u=await Object(a.d)(e,"leftover-"+t.id)-r,d=!1}else{u+=await Object(a.d)(e,"budget-"+t.id)}}let h=c(r,o),p=Object(m.a)(i.amount),y=0;if(h<0)return s.push(i.month+" is in the past."),{errors:s};y=0===h?p-u:Math.round((p-u)/(h+1)),y<O||!n?T=y:(O>0&&(T=O),s.push("Insufficient funds."));break}case"percentage":{let t=i.percent,e=0;if("all income"===i.category.toLowerCase())e=await Object(a.d)(v,"total-income");else{let t=(await y.getCategories()).find(t=>t.is_income&&t.name.toLowerCase()===i.category.toLowerCase());if(!t)return s.push(`Could not find category “${i.category}”`),{errors:s};e=await Object(a.d)(v,"sum-amount-"+t.id)}let r=Math.max(0,Math.round(e*(t/100)));r<O||!n?T=r:(O>0&&(T=O),s.push("Insufficient funds."));break}case"error":return{errors:s};default:case"schedule":{let{id:t}=await y.first("SELECT id FROM schedules WHERE name = ?",[i.name]),e=(await Object(b.c)(t)).serialize().conditions,{date:r,amount:a}=Object(p.a)(e),u=Object(r.value)===r.value&&"frequency"in r.value,f=Object(b.b)(r,o),d=c(new Date(f),o),g=-Object(p.c)(a.value),m=g-S+w;if(d<0)return s.push(`Non-repeating schedule ${i.name} was due on ${f}, which is in the past.`),{errors:s};if(d>0)m>=0&&d>-1&&(T+=Math.round(m/d));else{let t=0,e=Object(l.a)(o,1),i=new Date(f);if(u)for(;i.getTime()<e.getTime();)i.getTime()>=o.getTime()&&(t+=g),i=Object(h.a)(i,1),f=Object(b.b)(r,i),i=new Date(f);else t=g;let a=t-S+w;T+a<O||!n?T+=a:(O>0&&(T=O),s.push("Insufficient funds."))}break}}}if(null!=_&&T+A>_&&(T=_-A),(null==t.budgeted||0===t.budgeted)&&0!==T||i){if(t.budgeted===T)return null;{let r=t.name+": "+Object(m.k)(A);return r+=" + "+Object(m.k)(T)+" = "+Object(m.k)(A+T),r+=" "+e.map(t=>t.line).join("\n"),console.log(r),{amount:T,errors:s}}}return{errors:s}}let O=Object(n.a)();O.method("budget/budget-amount",Object(i.c)(Object(o.e)(a.h))),O.method("budget/copy-previous-month",Object(i.c)(Object(o.e)(a.a))),O.method("budget/set-zero",Object(i.c)(Object(o.e)(a.k))),O.method("budget/set-3month-avg",Object(i.c)(Object(o.e)(a.g))),O.method("budget/apply-goal-template",Object(i.c)(Object(o.e)((function(t){let{month:e}=t;return w(e,!1)})))),O.method("budget/overwrite-goal-template",Object(i.c)(Object(o.e)((function(t){let{month:e}=t;return w(e,!0)})))),O.method("budget/hold-for-next-month",Object(i.c)(Object(o.e)(a.e))),O.method("budget/reset-hold",Object(i.c)(Object(o.e)(a.f))),O.method("budget/cover-overspending",Object(i.c)(Object(o.e)(a.b))),O.method("budget/transfer-available",Object(i.c)(Object(o.e)(a.l))),O.method("budget/transfer-category",Object(i.c)(Object(o.e)(a.m))),O.method("budget/set-carryover",Object(i.c)(Object(o.e)(a.j)));e.a=O},function(t,e,r){"use strict";r.d(e,"a",(function(){return p}));var n=r(245),i=r.n(n),o=r(14),a=r(0);var s=r(2),u=r(13),c=r(22);let l=s.l,f={1632571489012:async function(t,e){function r(t){return null!=t.expr?t.expr:t.cachedValue}t.execQuery("\nCREATE TABLE zero_budget_months\n (id TEXT PRIMARY KEY,\n buffered INTEGER DEFAULT 0);\n\nCREATE TABLE zero_budgets\n (id TEXT PRIMARY KEY,\n month INTEGER,\n category TEXT,\n amount INTEGER DEFAULT 0,\n carryover INTEGER DEFAULT 0);\n\nCREATE TABLE reflect_budgets\n (id TEXT PRIMARY KEY,\n month INTEGER,\n category TEXT,\n amount INTEGER DEFAULT 0,\n carryover INTEGER DEFAULT 0);\n\nCREATE TABLE notes\n (id TEXT PRIMARY KEY,\n note TEXT);\n\nCREATE TABLE kvcache (key TEXT PRIMARY KEY, value TEXT);\nCREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);\n");let n=t.runQuery("SELECT * FROM spreadsheet_cells WHERE name LIKE 'budget%!budget-%'",[],!0);t.transaction(()=>{n.forEach(e=>{let n=e.name.match(/^(budget-report|budget)(\d+)!budget-(.+)$/);if(null==n)return void console.log("Warning: invalid budget month name",e.name);let i=n[1],o=n[2].slice(0,4)+"-"+n[2].slice(4),a=parseInt(n[2]),s=n[3],u=parseInt(r(e));isNaN(u)&&(u=0);let c=e.name.split("!")[0],l=t.runQuery("SELECT * FROM spreadsheet_cells WHERE name = ?",[`${c}!carryover-${s}`],!0),f="budget-report"===i?"reflect_budgets":"zero_budgets";t.runQuery(`INSERT INTO ${f} (id, month, category, amount, carryover) VALUES (?, ?, ?, ?, ?)`,[`${o}-${s}`,a,s,u,l.length>0&&"true"===r(l[0])?1:0])})});let i=t.runQuery("SELECT * FROM spreadsheet_cells WHERE name LIKE 'budget%!buffered'",[],!0);t.transaction(()=>{i.forEach(e=>{let n=e.name.match(/^budget(\d+)!buffered$/);if(n){let i=n[1].slice(0,4)+"-"+n[1].slice(4),o=parseInt(r(e));isNaN(o)&&(o=0),t.runQuery("INSERT INTO zero_budget_months (id, buffered) VALUES (?, ?)",[i,o])}})});let o=t.runQuery("SELECT * FROM spreadsheet_cells WHERE name LIKE 'notes!%'",[],!0);t.transaction(()=>{o.forEach(e=>{let n=(t=>{try{let e=JSON.parse(t);return e&&""!==e?e:null}catch(t){return null}})(r(e));if(n){let[,r]=e.name.split("!");t.runQuery("INSERT INTO notes (id, note) VALUES (?, ?)",[r,n])}})}),t.execQuery("\n DROP TABLE spreadsheet_cells;\n ANALYZE;\n VACUUM;\n ")}};function d(t){return parseInt(t.match(/^(\d)+/)[0])}async function h(t,e,r){const n=await s.n(s.j(r,e));e.match(/\.js$/)?await async function(t,e){const r={runQuery:(e,r,n)=>u.i(t,e,r,n),execQuery:e=>u.d(t,e),transaction:e=>u.j(t,e)};if(null==f[e])throw new Error("Could not find JS migration code to run for "+e);return(0,f[e])(r,()=>c.a())}(t,d(e)):await async function(t,e){try{await u.d(t,e)}catch(t){throw console.log("Error applying sql:",e),t}}(t,n),await u.i(t,"INSERT INTO __migrations__ (id) VALUES (?)",[d(e)])}async function g(t){let e=await async function(t){return(await u.i(t,"SELECT * FROM __migrations__ ORDER BY id ASC",[],!0)).map(t=>t.id)}(t),r=await async function(t){return(await s.k(t)).filter(t=>t.match(/(\.sql|\.js)$/)).sort((t,e)=>{const r=d(t),n=d(e);return r<n?-1:r>n?1:0})}(l);!function(t,e){for(let r=0;r<t.length;r++)if(r>=e.length||t[r]!==d(e[r]))throw new Error("out-of-sync-migrations")}(e,r);const n=function(t,e){return e.filter(e=>{const r=d(e);return-1===t.indexOf(r)})}(e,r);for(let e of n)await h(t,e,l);return n}async function p(){await async function(){await g(a.getDatabase())}(),await async function(){let t=await a.first("SELECT value FROM __meta__ WHERE key = ?",["view-hash"]),{value:e}=t||{},r=Object(o.e)(o.h,o.i),n=i()(r);e!==n&&(await a.execQuery(r),await a.runQuery("INSERT OR REPLACE INTO __meta__ (key, value) VALUES (?, ?)",["view-hash",n]))}()}},function(t,e,r){"use strict";r.d(e,"a",(function(){return _}));var n=r(32);function i(t){return Math.round(100*t)}var o=r(90),a=r.n(o),s=r(42),u=r(231),c=r.n(u),l=r(60),f=r.n(l);function d(t){switch(t){case"Cash":case"Checking":return"checking";case"CreditCard":return"credit";case"Savings":return"savings";case"InvestmentAccount":return"investment";case"Mortgage":return"mortgage";default:return"other"}}function h(t,e){return[...t].sort((t,r)=>t[e]<r[e]?-1:t[e]>r[e]?1:0)}function g(t){return s.a(function(t){if("string"==typeof t){let[e,r,n]=t.split("-");return null!=n?new Date(parseInt(e),parseInt(r)-1,parseInt(n)):null!=r?new Date(parseInt(e),parseInt(r)-1,1):new Date(parseInt(e),0,1)}return t}(t),"yyyy-MM")}function p(t,e){const r=[...e];return t.masterCategories.forEach(t=>{t.subCategories&&t.subCategories.forEach(t=>{r.find(e=>e.categoryId===t.entityId)||r.push({budgeted:0,categoryId:t.entityId})})}),r}async function m(t){const e=new Map;console.log("Importing Accounts..."),await async function(t,e){const r=h(t.accounts,"sortableIndex");return Promise.all(r.map(async t=>{if(!t.isTombstone){const r=await n.c({type:d(t.accountType),name:t.accountName,offbudget:!t.onBudget,closed:!!t.hidden});e.set(t.entityId,r)}}))}(t,e),console.log("Importing Categories..."),await async function(t,e){const r=h(t.masterCategories,"sortableIndex");await Promise.all(r.map(async t=>{if("OUTFLOW"===t.type&&!t.isTombstone&&t.subCategories&&t.subCategories.some(t=>!t.isTombstone)>0){const r=await n.e({name:t.name,is_income:!1});if(e.set(t.entityId,r),t.subCategories){const r=h(t.subCategories,"sortableIndex");r.reverse();for(let t of r)if(!t.isTombstone){const r=await n.d({name:t.name,group_id:e.get(t.masterCategoryId)});e.set(t.entityId,r)}}}}))}(t,e),console.log("Importing Payees..."),await async function(t,e){for(let r of t.payees)if(!r.isTombstone){let t=await n.f({name:r.name,category:e.get(r.autoFillCategoryId)||null,transfer_acct:e.get(r.targetAccountId)||null});e.set(r.entityId,t)}}(t,e),console.log("Importing Transactions..."),await async function(t,e){const r=(await n.h()).find(t=>"Income"===t.name).id,o=await n.g(),a=await n.i();function s(t){return null==t||"Category/__Split__"===t?null:"Category/__ImmediateIncome__"===t||"Category/__DeferredIncome__"===t?r:e.get(t)}function u(t){let e=o.find(e=>e.id===t);if(!e)throw new Error("Could not find account for transaction when importing");return e.offbudget}for(let r of t.transactions)if(e.set(r.entityId,f.a.v4()),r.subTransactions)for(let t of r.subTransactions)e.set(t.entityId,f.a.v4());let c=(l=t.transactions,d="accountId",l.reduce((function(t,e){var r=e[d];return t.hasOwnProperty(r)||(t[r]=[]),t[r].push(e),t}),{}));var l,d;await Promise.all(Object.keys(c).map(async r=>{let o=c[r].map(n=>{if(n.isTombstone)return null;function o(r){let n=e.get(r.transferTransactionId)||null,i=null,o=null;var s;n?i=a.find(t=>t.transfer_acct===e.get(r.targetAccountId)).id:(i=e.get(r.payeeId),o=null===(s=t.payees.find(t=>t.entityId===r.payeeId))||void 0===s?void 0:s.name);return{transfer_id:n,payee:i,imported_payee:o}}let c={id:e.get(n.entityId),amount:i(n.amount),category:u(e.get(r))?null:s(n.categoryId),date:n.date,notes:n.memo||null,cleared:"Cleared"===n.cleared,...o(n)};return c.subtransactions=n.subTransactions&&n.subTransactions.map((t,e)=>({amount:i(t.amount),category:s(t.categoryId),notes:t.memo||null,...o(t)})),c}).filter(t=>t);await n.a(e.get(r),o)}))}(t,e),console.log("Importing Budgets..."),await async function(t,e){let r=h(t.monthlyBudgets,"month");await n.b(async()=>{for(let o of r){let r=p(t,o.monthlySubCategoryBudgets.filter(t=>!t.isTombstone));await Promise.all(r.map(async t=>{let r=i(t.budgeted),a=e.get(t.categoryId),s=g(o.month);a&&(await n.k(s,a,r),"AffectsBuffer"===t.overspendingHandling?await n.l(s,a,!1):"Confined"===t.overspendingHandling&&await n.l(s,a,!0))}))}})}(t,e),console.log("Setting up...")}function y(t,e){let r=t.filter(t=>t.entryName===e);if(0===r.length)throw new Error("Could not find file: "+e);if(r.length>=2)throw new Error("File name matches multiple files: "+e);return r[0]}function b(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.slice(1).reduce((t,e)=>t+"/"+e.replace(/^\//,""),e[0].replace(/\/$/,""))}async function _(t,e){let r=function(t){let e=c()(t);if(!/\.zip/.test(e))return null;e=e.replace(/\.zip$/,"").replace(/.ynab4$/,"");let r=e.match(/([^/~]+)[^/]*$/);return r?r[1]:null}(t);if(!r)throw new Error("Not a YNAB4 file: "+t);let i=new a.a(e),o=i.getEntries(),s="",u=o[0].entryName.match(/([^/]*\.ynab4)/);u&&(s=u[1]+"/");let l=i.readFile(y(o,s+"Budget.ymeta")),f=b(s,JSON.parse(l.toString("utf8")).relativeDataFolderName),d=function(t,e){let r=e.map(e=>{const r=t.readFile(e).toString("utf8");let n;try{n=JSON.parse(r)}catch(t){return null}return n.hasFullKnowledge?{deviceGUID:n.deviceGUID,shortName:n.shortDeviceId,recentness:(i=n.knowledge,i.split(",").reduce((t,e)=>{const[r,n]=e.split("-");return t+parseInt(n)},0))}:null;var i}).filter(t=>t);return r=h(r,"recentness"),r[r.length-1].deviceGUID}(i,o.filter(t=>t.entryName.startsWith(b(f,"devices"))));const g=b(f,d,"Budget.yfull");let p,_;try{p=i.readFile(y(o,g)).toString("utf8")}catch(t){throw console.log(t),new Error("Error reading Budget.yfull file")}try{_=JSON.parse(p)}catch(t){throw new Error("Error parsing Budget.yull file")}return n.j(r,()=>m(_))}},function(t,e,r){"use strict";r.d(e,"a",(function(){return l}));var n=r(238),i=r.n(n),o=r(239),a=r.n(o),s=r(2),u=r(1),c=r(5);function l(t,e){let n=[],o=t.match(/\.[^.]*$/);if(o){switch(o[0].toLowerCase()){case".qif":return async function(t){let e,r=[],n=await s.n(t);try{e=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.split("\n"),n=r.shift(),i=/!Type:([^$]*)$/.exec(n.trim()),o={dateFormat:e.dateFormat,transactions:[]},a=o.transactions,s={};if(!i||!i.length)throw new Error("File does not appear to be a valid qif file: "+n);o.type=i[1];let u={};for(;n=r.shift();)if(n=n.trim(),"^"!==n)switch(n[0]){case"D":s.date=n.substring(1);break;case"T":s.amount=n.substring(1);break;case"N":s.number=n.substring(1);break;case"M":s.memo=n.substring(1);break;case"A":s.address=(s.address||[]).concat(n.substring(1));break;case"P":s.payee=n.substring(1).replace(/&/g,"&");break;case"L":let t=n.substring(1).split(":");s.category=t[0],void 0!==t[1]&&(s.subcategory=t[1]);break;case"C":s.clearedStatus=n.substring(1);break;case"S":let e=n.substring(1).split(":");u.category=e[0],void 0!==e[1]&&(u.subcategory=e[1]);break;case"E":u.description=n.substring(1);break;case"$":u.amount=parseFloat(n.substring(1)),s.division instanceof Array||(s.division=[]),s.division.push(u),u={};break;default:throw new Error("Unknown Detail Code: "+n[0])}else a.push(s),s={};return Object.keys(s).length&&a.push(s),o}(n)}catch(t){return r.push({message:"Failed parsing: doesn’t look like a valid QIF file.",internal:t.stack}),{errors:r,transactions:[]}}return{errors:r,transactions:e.transactions.map(t=>({amount:null!=t.amount?Object(c.m)(t.amount):null,date:t.date,payee_name:t.payee,imported_payee:t.payee,notes:t.memo||null}))}}(t);case".csv":return async function(t){let e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],i=await s.n(t);try{e=a()(i,{columns:!0,bom:!0,delimiter:r.delimiter||",",quote:'"',trim:!0,relax_column_count:!0,skip_empty_lines:!0})}catch(t){return n.push({message:"Failed parsing: "+t.message,internal:t.message}),{errors:n,transactions:[]}}return{errors:n,transactions:e}}(t,e);case".ofx":case".qfx":return async function(t){let e=(t,r)=>Object.prototype.toString.call(t)===Object.prototype.toString.call(r)?"[object Object]"===Object.prototype.toString.call(t)||"[object Array]"===Object.prototype.toString.call(t)?Object.keys(t).length===Object.keys(r).length&&Object.keys(t).every((function(n){return e(t[n],r[n])})):"number"==typeof t&&"number"==typeof r?Math.abs(t-r)<Number.EPSILON:t===r:null==t&&null==r;const{transactions:n,errors:o}=await async function(t){let{getOFXTransactions:e,initModule:n}=await r.e("xfo").then(r.bind(null,434));await n();let i,o=[],a=await s.n(t,"binary");try{i=e(a)}catch(t){return o.push({message:"Failed importing file",internal:t.stack}),{errors:o}}return{errors:o,transactions:i.map(t=>({amount:t.amount,imported_id:t.fi_id,date:t.date?Object(u.f)(1e3*t.date):null,payee_name:t.name,imported_payee:t.name,notes:t.memo||null}))}}(t),{transactions:a,errors:c}=await async function(t){var e,r;let n=[];const o=new TextDecoder("latin1").decode(await s.n(t,"binary"));let a;try{a=i.a.parse(o)}catch(t){return n.push({message:"Failed importing file",internal:t.stack}),{errors:n}}const u=[((null===(e=a.body.OFX.BANKMSGSRSV1)||void 0===e?void 0:e.STMTTRNRS.STMTRS)||(null===(r=a.body.OFX.CREDITCARDMSGSRSV1)||void 0===r?void 0:r.CCSTMTTRNRS.CCSTMTRS)).BANKTRANLIST.STMTTRN].flat();return{errors:n,transactions:u.map(t=>{var e,r,n;return{amount:parseFloat(t.TRNAMT._text),imported_id:t.FITID._text,date:t.DTPOSTED?f(t.DTPOSTED._text):null,payee_name:null===(e=t.NAME)||void 0===e?void 0:e._text,imported_payee:null===(r=t.NAME)||void 0===r?void 0:r._text,notes:null===(n=t.MEMO)||void 0===n?void 0:n._text}})}}(t);return o.length>0&&c.length>0?{ofxParser:!0,which:"both",errors:{length:o.length+c.length,oldErrors:o,newErrors:c}}:o.length>0?{ofxParser:!0,which:"old",errors:{length:o.length,oldErrors:o},transactions:a}:c.length>0?{ofxParser:!0,which:"new",errors:{length:c.length,newErrors:c},transactions:n}:e(n,a)?{ofxParser:!0,which:"none",errors:[],transactions:n}:{ofxParser:!0,which:"diff",errors:[],oldTrans:n,newTrans:a}}(t)}}return n.push({message:"Invalid file type",internal:""}),{errors:n,transactions:void 0}}function f(t){const e=/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/;let r=/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\.\d{3})?\[(.+):(.+)\]$/.exec(t);if(r){const[t,e,n,i,o,a,s,u,c,l]=r;return`${e}-${n}-${i}`}if(r=e.exec(t),r){const[t,e,n,i,o,a,s]=r;return`${e}-${n}-${i}`}return console.warn("Not able to parse date",t),null}},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(28),i=r(76),o=r(8);function a(t,e){Object(o.a)(2,arguments);var r=Object(n.a)(e);return Object(i.a)(t,-r)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(77),i=r(8),o=r(28);function a(t,e){Object(i.a)(2,arguments);var r=Object(o.a)(e);return Object(n.a)(t,-r)}},function(t,e,r){"use strict";r.r(e),function(t,n,i){r.d(e,"handlers",(function(){return ot})),r.d(e,"initApp",(function(){return lt})),r.d(e,"init",(function(){return ft})),r.d(e,"lib",(function(){return dt}));r(256);var o=r(108),a=r(249),s=r(232),u=r(233),c=r(26),l=r(9),f=r(23),d=r(2),h=r(56),g=r(13),p=r(22),m=r(96),y=r(237),b=r(1),_=r(30),v=r(44),w=r(5),E=r(141),S=r(67),O=r(250),T=r(94),A=r(34),M=r(37),I=r(29),R=r(53),N=r(246),k=r(14),D=r(80),j=r(247),C=r(52),L=r(38),x=r(10),B=r(0),U=r(95),F=r(35),P=r(11),W=r(31),z=r(4),H=r(242),q=r(48),V=r(27),G=r(6),Y=r(78),$=r(15),K=r(3),Z=r(21),J=r(7),X=r(243),Q=r(45),tt=r(244),et=r(18),rt=r(248),nt=r(144);function it(t){let{names:e}=t;const r=e.map(t=>{let e=K.b()._getNode(t);return{name:e.name,value:e.value}});f.c("cells-changed",r)}let ot={};function at(t){function e(t,e){let r=t.map(t=>{try{e(t)}catch(t){if(t instanceof P.f)return console.warn("Invalid rule",t),t.type;throw t}return null});return r.some(Boolean)?r:null}let r=e(t.conditions,t=>new A.b(t.op,t.field,t.value,t.options,v.a)),n=e(t.actions,t=>new A.a(t.op,t.field,t.value,t.options,v.a));return r||n?{conditionErrors:r,actionErrors:n}:null}ot.undo=Object(z.c)((async function(){return Object(et.d)()})),ot.redo=Object(z.c)((function(){return Object(et.c)()})),ot["transactions-batch-update"]=Object(z.c)((async function(t){let{added:e,deleted:r,updated:n,learnCategories:i}=t;return Object(et.f)(async()=>(await Object(R.a)({added:e,updated:n,deleted:r,learnCategories:i})).updated)})),ot["transaction-add"]=Object(z.c)((async function(t){return await ot["transactions-batch-update"]({added:[t]}),{}})),ot["transaction-update"]=Object(z.c)((async function(t){return await ot["transactions-batch-update"]({updated:[t]}),{}})),ot["transaction-delete"]=Object(z.c)((async function(t){return await ot["transactions-batch-update"]({deleted:[t]}),{}})),ot["transactions-parse-file"]=async function(t){let{filepath:e,options:r}=t;return Object(O.a)(e,r)},ot["transactions-export"]=async function(t){let{transactions:e,accounts:r,categoryGroups:n,payees:i}=t;return Object(E.b)(e,r,n,i)},ot["transactions-export-query"]=async function(t){let{query:e}=t;return Object(E.a)(new _.a(e))},ot["get-categories"]=async function(){return{grouped:await B.getCategoriesGrouped(),list:await B.getCategories()}},ot["get-earliest-transaction"]=async function(){let{data:t}=await Object(k.g)(Object(_.b)("transactions").options({splits:"none"}).orderBy({date:"asc"}).select("*").limit(1));return t[0]||null},ot["get-budget-bounds"]=async function(){return C.a()},ot["rollover-budget-month"]=async function(t){let{month:e}=t,r=await B.getCategoriesGrouped(),n=b.p(e);function i(t){let e=K.d(n,t);return{value:""===e?0:e,name:Object(Z.a)(n,t)}}let o=[i("available-funds"),i("last-month-overspent"),i("buffered"),i("total-budgeted"),i("to-budget"),i("from-last-month"),i("total-income"),i("total-spent"),i("total-leftover")];for(let t of r)if(t.is_income){o.push(i("total-income"));for(let e of t.categories)o.push(i("sum-amount-"+e.id))}else{o=o.concat([i("group-budget-"+t.id),i("group-sum-amount-"+t.id),i("group-leftover-"+t.id)]);for(let e of t.categories)o=o.concat([i("budget-"+e.id),i("sum-amount-"+e.id),i("leftover-"+e.id),i("carryover-"+e.id)])}return o},ot["report-budget-month"]=async function(t){let{month:e}=t,r=await B.getCategoriesGrouped(),n=b.p(e);function i(t){let e=K.d(n,t);return{value:""===e?0:e,name:Object(Z.a)(n,t)}}let o=[i("total-budgeted"),i("total-budget-income"),i("total-saved"),i("total-income"),i("total-spent"),i("real-saved"),i("total-leftover")];for(let t of r){o=o.concat([i("group-budget-"+t.id),i("group-sum-amount-"+t.id),i("group-leftover-"+t.id)]);for(let e of t.categories)o=o.concat([i("budget-"+e.id),i("sum-amount-"+e.id),i("leftover-"+e.id)]),t.is_income||o.push(i("carryover-"+e.id))}return o},ot["budget-set-type"]=async function(t){let{type:e}=t;if("rollover"!==e&&"report"!==e)throw new Error("Invalid budget type: "+e);if(e!==G.b().budgetType)return G.d({budgetType:e})},ot["category-create"]=Object(z.c)((async function(t){let{name:e,groupId:r,isIncome:n}=t;return Object(et.f)(async()=>{if(!r)throw Object(P.a)("Creating a category: groupId is required");return B.insertCategory({name:e,cat_group:r,is_income:n?1:0})})})),ot["category-update"]=Object(z.c)((async function(t){return Object(et.f)(async()=>{try{await B.updateCategory(t)}catch(t){if(t.message.toLowerCase().includes("unique constraint"))return{error:{type:"category-exists"}};throw t}return{}})})),ot["category-move"]=Object(z.c)((async function(t){let{id:e,groupId:r,targetId:n}=t;return Object(et.f)(async()=>(await Object(J.c)(async()=>{await B.moveCategory(e,r,n)}),"ok"))})),ot["category-delete"]=Object(z.c)((async function(t){let{id:e,transferId:r}=t;return Object(et.f)(async()=>{let t={};return await Object(J.c)(async()=>{let n=await B.first("SELECT is_income FROM categories WHERE id = ?",[e]);if(!n)return void(t={error:"no-categories"});let i=r&&await B.first("SELECT is_income FROM categories WHERE id = ?",[r]);!n||r&&!i?t={error:"no-categories"}:r&&n.is_income!==i.is_income?t={error:"category-type"}:(0===n.is_income&&r&&await C.b([e],r),await B.deleteCategory({id:e},r))}),t})})),ot["category-group-create"]=Object(z.c)((async function(t){let{name:e,isIncome:r}=t;return Object(et.f)(async()=>B.insertCategoryGroup({name:e,is_income:r?1:0}))})),ot["category-group-update"]=Object(z.c)((async function(t){return Object(et.f)(async()=>B.updateCategoryGroup(t))})),ot["category-group-move"]=Object(z.c)((async function(t){let{id:e,targetId:r}=t;return Object(et.f)(async()=>(await Object(J.c)(async()=>{await B.moveCategoryGroup(e,r)}),"ok"))})),ot["category-group-delete"]=Object(z.c)((async function(t){let{id:e,transferId:r}=t;return Object(et.f)(async()=>{const t=await B.all("SELECT id FROM categories WHERE cat_group = ? AND tombstone = 0",[e]);return Object(J.c)(async()=>{r&&await C.b(t.map(t=>t.id),r),await B.deleteCategoryGroup({id:e},r)})})})),ot["must-category-transfer"]=async function(t){let{id:e}=t;return 0!==(await B.runQuery("SELECT count(t.id) as count FROM transactions t\n LEFT JOIN category_mapping cm ON cm.id = t.category\n WHERE cm.transferId = ? AND t.tombstone = 0",[e],!0))[0].count||[...K.b().meta().createdMonths].some(t=>{const r=b.p(t);return 0!==K.b().getCellValue(r,"budget-"+e)})},ot["payee-create"]=Object(z.c)((async function(t){let{name:e}=t;return Object(et.f)(async()=>B.insertPayee({name:e}))})),ot["payees-get"]=async function(){return B.getPayees()},ot["payees-get-rule-counts"]=async function(){let t={};return I.g(I.d(),"payee",(e,r)=>{null==t[r]&&(t[r]=0),t[r]++}),t},ot["payees-merge"]=Object(z.c)((async function(t){let{targetId:e,mergeIds:r}=t;return Object(et.f)(async()=>B.mergePayees(e,r),{targetId:e,mergeIds:r})})),ot["payees-batch-change"]=Object(z.c)((async function(t){let{added:e,deleted:r,updated:n}=t;return Object(et.f)(async()=>Object(J.c)(async()=>{r&&await Promise.all(r.map(t=>B.deletePayee(t))),e&&await Promise.all(e.map(t=>B.insertPayee(t))),n&&await Promise.all(n.map(t=>B.updatePayee(t)))}))})),ot["payees-check-orphaned"]=async function(t){let{ids:e}=t,r=new Set(await B.getOrphanedPayees());return e.filter(t=>r.has(t))},ot["payees-get-rules"]=async function(t){let{id:e}=t;return I.e(e).map(t=>t.serialize())},ot["rule-validate"]=async function(t){return{error:at(t)}},ot["rule-add"]=Object(z.c)((async function(t){let e=at(t);return e?{error:e}:{id:await I.f(t)}})),ot["rule-update"]=Object(z.c)((async function(t){let e=at(t);return e?{error:e}:(await I.m(t),{})})),ot["rule-delete"]=Object(z.c)((async function(t){return I.c(t)})),ot["rule-delete-all"]=Object(z.c)((async function(t){let e=!1;return await Object(J.c)(async()=>{for(let r of t){!1===await I.c({id:r})&&(e=!0)}}),{someDeletionsFailed:e}})),ot["rule-apply-actions"]=Object(z.c)((async function(t){let{transactionIds:e,actions:r}=t;return I.a(e,r,ot)})),ot["rule-add-payee-rename"]=Object(z.c)((async function(t){let{fromNames:e,to:r}=t;return I.l(e,r)})),ot["rules-get"]=async function(){return Object(A.g)(I.d()).map(t=>t.serialize())},ot["rule-get"]=async function(t){let{id:e}=t,r=I.d().find(t=>t.id===e);return r?r.serialize():null},ot["rules-run"]=async function(t){let{transaction:e}=t;return I.j(e)},ot["make-filters-from-conditions"]=async function(t){let{conditions:e}=t;return I.b(e)},ot.getCell=async function(t){let{sheetName:e,name:r}=t,n=["name","value"],i=K.b()._getNode(Object(Z.a)(e,r));if(n){let t={};return n.forEach(e=>{t[e]="run"===e?i._run?i._run.toString():null:i[e]}),t}return i},ot.getCells=async function(t){let{names:e}=t;return e.map(t=>({value:K.b()._getNode(t).value}))},ot.getCellNamesInSheet=async function(t){let{sheetName:e}=t,r=[];for(let t of K.b().getNodes().keys()){let{sheet:n,name:i}=Object(Z.b)(t);n===e&&r.push(i)}return r},ot.debugCell=async function(t){let{sheetName:e,name:r}=t,n=K.b().getNode(Object(Z.a)(e,r));return{...n,_run:n._run&&n._run.toString()}},ot["create-query"]=async function(t){let{sheetName:e,name:r,query:n}=t;return K.b().createQuery(e,r,n),"ok"},ot.query=async function(t){if(null==t.table)throw new Error("query has no table, did you forgot to call `.serialize`?");return Object(k.g)(t)},ot["bank-delete"]=async function(t){let{id:e}=t;const r=await B.runQuery("SELECT * FROM accounts WHERE bank = ?",[e],!0);return await B.delete_("banks",e),await Promise.all(r.map(async t=>{await B.runQuery("DELETE FROM transactions WHERE acct = ?",[t.id]),await B.delete_("accounts",t.id)})),"ok"},ot["account-update"]=Object(z.c)((async function(t){let{id:e,name:r}=t;return Object(et.f)(async()=>(await B.update("accounts",{id:e,name:r}),{}))})),ot["accounts-get"]=async function(){return B.getAccounts()},ot["account-properties"]=async function(t){let{id:e}=t;const{balance:r}=await B.first("SELECT sum(amount) as balance FROM transactions WHERE acct = ? AND isParent = 0 AND tombstone = 0",[e]),{count:n}=await B.first("SELECT count(id) as count FROM transactions WHERE acct = ? AND tombstone = 0",[e]);return{balance:r||0,numTransactions:n}},ot["accounts-link"]=async function(t){let{institution:e,publicToken:r,accountId:n,upgradingId:i}=t,o=await S.d(e,r),[[,a],[,s]]=await l.c(["user-id","user-key"]),u=(await M.c(a,s,o)).find(t=>t.account_id===n);return await B.update("accounts",{id:i,account_id:u.account_id,official_name:u.official_name,type:Object(m.a)(u.type),balance_current:Object(w.a)(u.balances.current),balance_available:Object(w.a)(u.balances.available),balance_limit:Object(w.a)(u.balances.limit),mask:u.mask,bank:o}),await M.e(a,s,i,u.account_id,o),f.c("sync-event",{type:"success",tables:["transactions"]}),"ok"},ot["nordigen-accounts-link"]=async function(t){let e,{requisitionId:r,account:n,upgradingId:i}=t,o=await S.c(n.institution,r);if(i){e=(await B.first("SELECT * FROM accounts WHERE id = ?",[i])).id,await B.update("accounts",{id:e,account_id:n.account_id,bank:o.id})}else e=p.a(),await B.insertWithUUID("accounts",{id:e,account_id:n.account_id,mask:n.mask,name:n.name,official_name:n.official_name,type:n.type,bank:o.id}),await B.insertPayee({name:"",transfer_acct:e});return await M.f(void 0,void 0,e,n.account_id,o.bank_id),f.c("sync-event",{type:"success",tables:["transactions"]}),"ok"},ot["accounts-connect"]=async function(t){let{institution:e,publicToken:r,accountIds:n,offbudgetIds:i}=t,o=await S.d(e,r);return await S.a(o,n,i)},ot["nordigen-accounts-connect"]=async function(t){let{institution:e,publicToken:r,accountIds:n,offbudgetIds:i}=t,o=await S.d(e,r);return await S.b(o,n,i)},ot["account-create"]=Object(z.c)((async function(t){let{name:e,type:r,balance:n,offBudget:i,closed:o}=t;return Object(et.f)(async()=>{const t=await B.insertAccount({name:e,type:r,offbudget:i?1:0,closed:o?1:0});if(await B.insertPayee({name:"",transfer_acct:t}),null!=n&&0!==n){let e=await Object(T.a)();await B.insertTransaction({account:t,amount:Object(w.a)(n),category:i?null:e.category,payee:e.id,date:b.d(),cleared:!0,starting_balance_flag:!0})}return t})})),ot["account-close"]=Object(z.c)((async function(t){let{id:e,transferAccountId:r,categoryId:n,forced:i}=t;return await ot["account-unlink"]({id:e}),Object(et.f)(async()=>{let t=await B.first("SELECT * FROM accounts WHERE id = ? AND tombstone = 0",[e]);if(!t||1===t.closed)return;const{balance:o,numTransactions:a}=await ot["account-properties"]({id:e});if(0===a)await B.deleteAccount({id:e});else if(i){let t=await B.runQuery("SELECT id, transfer_id FROM v_transactions WHERE account = ?",[e],!0),{id:r}=await B.first("SELECT id FROM payees WHERE transfer_acct = ?",[e]);await Object(J.c)(()=>{t.forEach(t=>{t.transfer_id&&B.updateTransaction({id:t.transfer_id,payee:null,transfer_id:null}),B.deleteTransaction({id:t.id})}),B.deleteAccount({id:e}),B.deleteTransferPayee({id:r})})}else{if(0!==o&&null==r)throw Object(P.a)("balance is non-zero: transferAccountId is required");if(await B.update("accounts",{id:e,closed:1}),0!==o){let{id:t}=await B.first("SELECT id FROM payees WHERE transfer_acct = ?",[r]);await ot["transaction-add"]({id:p.a(),payee:t,amount:-o,account:e,date:b.d(),notes:"Closing account",category:n||null})}}})})),ot["account-reopen"]=Object(z.c)((async function(t){let{id:e}=t;return Object(et.f)(async()=>{await B.update("accounts",{id:e,closed:0})})})),ot["account-move"]=Object(z.c)((async function(t){let{id:e,targetId:r}=t;return Object(et.f)(async()=>{await B.moveAccount(e,r)})}));let st=!1;async function ut(t){let e;try{e=d.e(t)}catch(t){return Object(c.b)(new Error("`getBudgetDir` failed in `loadBudget`: "+t.message)),{error:"budget-not-found"}}if(Object(c.a)({message:"Loading budget "+e}),!await d.d(e))return Object(c.b)(new Error("budget directory does not exist")),{error:"budget-not-found"};try{await G.c(t),await B.openDatabase(t)}catch(e){return Object(c.a)({message:"Error loading budget "+t}),Object(c.b)(e),await ot["close-budget"](),{error:"opening-budget"}}if(!G.b().userId){let[[,t]]=await l.c(["user-token"]);G.d({userId:t})}try{await Object(rt.a)()}catch(e){let r;return console.warn("Error updating",e),e.message.includes("out-of-sync-migrations")?r={error:"out-of-sync-migrations"}:e.message.includes("out-of-sync-data")?r={error:"out-of-sync-data"}:(Object(c.b)(e),h.a.info("Error updating budget "+t,e),console.log("Error updating budget",e),r={error:"loading-budget"}),await ot["close-budget"](),r}await B.loadClock(),G.b().resetClock&&(Object(x.c)().timestamp.setNode(Object(x.d)()),await B.runQuery("INSERT OR REPLACE INTO messages_clock (id, clock) VALUES (1, ?)",[Object(x.g)(Object(x.c)())]),await G.d({resetClock:!1})),q.c||q.b||Object(D.d)(t);try{await K.e(B,it)}catch(t){return Object(c.b)(t),await ot["close-budget"](),{error:"opening-budget"}}return K.b().meta().budgetType=G.b().budgetType,await C.a(),await U.b(),await I.h(),await X.a(),await W.a.startServices(),Object(et.b)(),"_demo-budget"===t?Object(J.k)("disabled"):"_test-budget"===t?await l.e("lastBudget",t):(Object(J.k)("enabled"),await l.e("lastBudget",t),q.b||await L.f()),W.a.events.emit("load-budget",{id:t}),{}}function ct(){return q.b?"/documents":d.j("/documents","Actual")}async function lt(e,r){await g.f(),await Promise.all([l.b(),d.i()]),await async function(){async function t(t){await d.d(t)||await d.m(t)}let e=await l.a("document-dir");if(e)try{await t(e)}catch(t){e=null}e||(e=ct()),await t(e),d.a(e)}();let n=await l.a("encrypt-keys");if(n)try{let t=JSON.parse(n);await Promise.all(Object.keys(t).map(e=>F.e(t[e])))}catch(t){throw console.log("Error loading key",t),new Error("load-key-error")}const o=await l.a("server-url");if(o&&Object($.b)(o),f.b(r,W.a.handlers),!e&&!q.b&&!q.c){let e=await l.a("auto-update");t.send({type:"shouldAutoUpdate",flag:null==e||"true"===e})}e&&(i.$send=(t,e)=>Object(z.d)(W.a.handlers[t],e),i.$query=k.g,i.$q=_.b,i.$db=B,i.$setSyncingMode=J.k)}async function ft(e){let r,n;return e?(r=e.dataDir,n=e.serverURL):(r="/",n=t.env.ACTUAL_SERVER_URL),await g.f(),await Promise.all([l.b({persist:!1}),d.i()]),d.a(r||t.cwd()),n?(Object($.b)(n),e.password&&await Object(z.d)(ot["subscribe-sign-in"],{password:e.password})):(Object($.b)(null),W.a.events.on("load-budget",()=>{Object(J.k)("offline")})),dt}ot["poll-web-token"]=async function(t){let{token:e}=t,[[,r],[,n]]=await l.c(["user-id","user-key"]),i=Date.now();return st=!1,new Promise(t=>{!async function t(o){if(st)return;if(Date.now()-i>=6e5)return void o("timeout");let a=await Object(V.b)(Object($.a)().PLAID_SERVER+"/get-web-token-contents",{userId:r,key:n,token:e});a?a.error?o("unknown"):o(null,a):setTimeout(()=>t(o),3e3)}((e,r)=>{t(e?{error:e}:{data:r})})})},ot["poll-web-token-stop"]=async function(){return st=!0,"ok"},ot["accounts-sync"]=async function(t){let{id:e}=t,[[,r],[,n]]=await l.c(["user-id","user-key"]),i=await B.runQuery("SELECT a.*, b.id as bankId FROM accounts a\n LEFT JOIN banks b ON a.bank = b.id\n WHERE a.tombstone = 0 AND a.closed = 0",[],!0);e&&(i=i.filter(t=>t.id===e));let o=[],a=[],s=[],u=[];for(let t=0;t<i.length;t++){const e=i[t];if(e.bankId)try{const t=await M.e(r,n,e.id,e.account_id,e.bankId);let{added:i,updated:o}=t;a=a.concat(i),s=s.concat(o),(i.length>0||o.length>0)&&(u=u.concat(e.id))}catch(t){"BankSyncError"===t.type?o.push({type:"SyncError",accountId:e.id,message:"Failed syncing account “"+e.name+".”",category:t.category,code:t.code}):t instanceof P.e&&"internal"!==t.reason?o.push({accountId:e.id,message:`Account “${e.name}” is not linked properly. Please link it again`}):(o.push({accountId:e.id,message:"There was an internal error. Please get in touch https://actualbudget.github.io/docs/Contact for support.",internal:t.stack}),t.message="Failed syncing account: "+t.message,Object(c.b)(t))}}return u.length>0&&f.c("sync-event",{type:"success",tables:["transactions"]}),{errors:o,newTransactions:a,matchedTransactions:s,updatedAccounts:u}},ot["secret-set"]=async function(t){let{name:e,value:r}=t,n=await l.a("user-token");if(n)try{return await Object(V.b)(Object($.a)().BASE_SERVER+"/secret",{name:e,value:r},{"X-ACTUAL-TOKEN":n})}catch(t){return console.error(t),{error:"failed"}}return{error:"unauthorized"}},ot["secret-check"]=async function(t){let e=await l.a("user-token");if(e)try{return await Object(V.a)(Object($.a)().BASE_SERVER+"/secret/"+t,{"X-ACTUAL-TOKEN":e})}catch(t){return console.error(t),{error:"failed"}}return{error:"unauthorized"}},ot["nordigen-poll-web-token"]=async function(t){let{upgradingAccountId:e,requisitionId:r}=t,n=await l.a("user-token");if(n){let t=Date.now();return st=!1,new Promise(i=>{!async function i(o){if(st)return;if(Date.now()-t>=6e5)return void o("timeout");let a=await Object(V.b)(Object($.a)().NORDIGEN_SERVER+"/get-accounts",{upgradingAccountId:e,requisitionId:r},{"X-ACTUAL-TOKEN":n});a?a.error?o("unknown"):o(null,a):setTimeout(()=>i(o),3e3)}((t,e)=>{i(t?{error:t}:{data:e})})})}return null},ot["nordigen-status"]=async function(){const t=await l.a("user-token");return t?Object(V.b)(Object($.a)().NORDIGEN_SERVER+"/status",{},{"X-ACTUAL-TOKEN":t}):Promise.reject({error:"unauthorized"})},ot["nordigen-get-banks"]=async function(t){const e=await l.a("user-token");return e?Object(V.b)(Object($.a)().NORDIGEN_SERVER+"/get-banks",{country:t,showDemo:Object(y.a)()},{"X-ACTUAL-TOKEN":e}):Promise.reject({error:"unauthorized"})},ot["nordigen-poll-web-token-stop"]=async function(){return st=!0,"ok"},ot["nordigen-create-web-token"]=async function(t){let{upgradingAccountId:e,institutionId:r,accessValidForDays:n}=t,i=await l.a("user-token");if(i)try{return await Object(V.b)(Object($.a)().NORDIGEN_SERVER+"/create-web-token",{upgradingAccountId:e,institutionId:r,accessValidForDays:n},{"X-ACTUAL-TOKEN":i})}catch(t){return console.error(t),{error:"failed"}}return{error:"unauthorized"}},ot["nordigen-accounts-sync"]=async function(t){let{id:e}=t,[[,r],[,n]]=await l.c(["user-id","user-key"]),i=await B.runQuery("SELECT a.*, b.bank_id as bankId FROM accounts a\n LEFT JOIN banks b ON a.bank = b.id\n WHERE a.tombstone = 0 AND a.closed = 0",[],!0);e&&(i=i.filter(t=>t.id===e));let o=[],a=[],s=[],u=[];for(let t=0;t<i.length;t++){const e=i[t];if(e.bankId)try{const t=await M.f(r,n,e.id,e.account_id,e.bankId);let{added:i,updated:o}=t;a=a.concat(i),s=s.concat(o),(i.length>0||o.length>0)&&(u=u.concat(e.id))}catch(t){"BankSyncError"===t.type?o.push({type:"SyncError",accountId:e.id,message:"Failed syncing account “"+e.name+".”",category:t.category,code:t.code}):t instanceof P.e&&"internal"!==t.reason?o.push({accountId:e.id,message:`Account “${e.name}” is not linked properly. Please link it again`}):(o.push({accountId:e.id,message:"There was an internal error. Please get in touch https://actualbudget.github.io/docs/Contact for support.",internal:t.stack}),t.message="Failed syncing account: "+t.message,Object(c.b)(t))}}return u.length>0&&f.c("sync-event",{type:"success",tables:["transactions"]}),{errors:o,newTransactions:a,matchedTransactions:s,updatedAccounts:u}},ot["transactions-import"]=Object(z.c)((function(t){let{accountId:e,transactions:r}=t;return Object(et.f)(async()=>{if("string"!=typeof e)throw Object(P.a)("transactions-import: accountId must be an id");try{return await M.d(e,r)}catch(t){if(t instanceof P.h)return{errors:[{message:t.message}],added:[],updated:[]};throw t}})})),ot["account-unlink"]=Object(z.c)((async function(t){let{id:e}=t,{bank:r}=await B.first("SELECT bank FROM accounts WHERE id = ?",[e]);if(!r)return"ok";await B.updateAccount({id:e,account_id:null,bank:null,balance_current:null,balance_available:null,balance_limit:null});let{count:n}=await B.first("SELECT COUNT(*) as count FROM accounts WHERE bank = ?",[r]),i=await l.a("user-token");if(i&&0===n){let{bank_id:t}=await B.first("SELECT bank_id FROM banks WHERE id = ?",[r]);try{await Object(V.b)(Object($.a)().NORDIGEN_SERVER+"/remove-account",{requisitionId:t},{"X-ACTUAL-TOKEN":i})}catch(t){console.log({error:t})}}return"ok"})),ot["make-plaid-public-token"]=async function(t){let{bankId:e}=t,[[,r],[,n]]=await l.c(["user-id","user-key"]),i=await Object(V.b)(Object($.a)().PLAID_SERVER+"/make-public-token",{userId:r,key:n,item_id:""+e});return i.error_code?{error:"",code:i.error_code,type:i.error_type}:{linkToken:i.link_token}},ot["save-global-prefs"]=async function(e){return"maxMonths"in e&&await l.e("max-months",""+e.maxMonths),"autoUpdate"in e&&(await l.e("auto-update",""+e.autoUpdate),t.send({type:"shouldAutoUpdate",flag:e.autoUpdate})),"documentDir"in e&&await d.d(e.documentDir)&&await l.e("document-dir",e.documentDir),"floatingSidebar"in e&&await l.e("floating-sidebar",""+e.floatingSidebar),"ok"},ot["load-global-prefs"]=async function(){let[[,t],[,e],[,r],[,n],[,i],[,o]]=await l.c(["floating-sidebar","seen-tutorial","max-months","auto-update","document-dir","encrypt-key"]);return{floatingSidebar:"true"===t,seenTutorial:"true"===e,maxMonths:Object(w.q)(r||""),autoUpdate:null==n||"true"===n,documentDir:i||ct(),keyId:o&&JSON.parse(o).id}},ot["save-prefs"]=async function(t){let{cloudFileId:e}=G.b();if(t.budgetName&&e){let r=await l.a("user-token");await Object(V.b)(Object($.a)().SYNC_SERVER+"/update-user-filename",{token:r,fileId:e,name:t.budgetName})}return await G.d(t),"ok"},ot["load-prefs"]=async function(){return G.b()},ot["sync-reset"]=async function(){return await Object(J.i)()},ot["sync-repair"]=async function(){await Object(J.h)()},ot["key-make"]=async function(t){let{password:e}=t;if(!G.b())throw new Error("user-set-key must be called with file loaded");let r=F.f(32).toString("base64"),n=p.a(),i=await F.a({id:n,password:e,salt:r});await F.e(i);let o=await Object(J.g)(i.getId());return await Object(J.i)({key:i,salt:r,testContent:JSON.stringify({...o,value:o.value.toString("base64")})})},ot["key-test"]=async function(t){let e,{fileId:r,password:i}=t,o=await l.a("user-token");null==r&&(r=G.b().cloudFileId);try{e=await Object(V.b)(Object($.a)().SYNC_SERVER+"/user-get-key",{token:o,fileId:r})}catch(t){return console.log(t),{error:{reason:"network"}}}let{id:a,salt:s,test:u}=e;if(null==u)return{error:{reason:"old-key-style"}};u=JSON.parse(u);let c=await F.a({id:a,password:i,salt:s});F.e(c);try{await F.b(n.from(u.value,"base64"),u.meta)}catch(t){return console.log(t),F.h(c),{error:{reason:"decrypt-failure"}}}let f=JSON.parse(await l.a("encrypt-keys")||"{}");return f[r]=c.serialize(),await l.e("encrypt-keys",JSON.stringify(f)),G.b()&&await G.d({encryptKeyId:c.getId()}),{}},ot["subscribe-needs-bootstrap"]=async function(){let t,{url:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("https://not-configured/"===Object($.a)(e).BASE_SERVER)return{bootstrapped:!0,hasServer:!1};try{t=await Object(V.a)(Object($.a)(e).SIGNUP_SERVER+"/needs-bootstrap")}catch(t){return{error:"network-failure"}}try{t=JSON.parse(t)}catch(t){return{error:"parse-failure"}}return"error"===t.status?{error:t.reason}:{bootstrapped:t.data.bootstrapped,hasServer:!0}},ot["subscribe-bootstrap"]=async function(t){let e,{password:r}=t;try{e=await Object(V.b)(Object($.a)().SIGNUP_SERVER+"/bootstrap",{password:r})}catch(t){return{error:t.reason||"network-failure"}}return e.token?(await l.e("user-token",e.token),{}):{error:"internal"}},ot["subscribe-set-user"]=async function(t){let{token:e}=t;await l.e("user-token",e)},ot["subscribe-get-user"]=async function(){if(Object($.a)()&&"https://not-configured/"===Object($.a)().BASE_SERVER)return{offline:!1};let t=await l.a("user-token");if(t)try{const e=await Object(V.a)(Object($.a)().SIGNUP_SERVER+"/validate",{headers:{"X-ACTUAL-TOKEN":t}}),{status:r,reason:n}=JSON.parse(e);return"error"===r?"unauthorized"===n?null:{offline:!0}:{offline:!1}}catch(t){return console.log(t),{offline:!0}}return null},ot["subscribe-change-password"]=async function(t){let{password:e}=t,r=await l.a("user-token");try{await Object(V.b)(Object($.a)().SIGNUP_SERVER+"/change-password",{token:r,password:e})}catch(t){return{error:t.reason||"network-failure"}}return{}},ot["subscribe-sign-in"]=async function(t){let{password:e}=t,r=await Object(V.b)(Object($.a)().SIGNUP_SERVER+"/login",{password:e});return r.token?(await l.e("user-token",r.token),{}):{error:"invalid-password"}},ot["subscribe-sign-out"]=async function(){return F.g(),await l.d(["user-token","encrypt-keys","lastBudget","readOnly"]),"ok"},ot["get-server-version"]=async function(){if(!Object($.a)()||"https://not-configured/"===Object($.a)().BASE_SERVER)return{error:"no-server"};let t;try{const e=await Object(V.a)(Object($.a)().BASE_SERVER+"/info");t=JSON.parse(e).build.version}catch(t){return{error:"network-failure"}}return{version:t}},ot["get-server-url"]=async function(){return Object($.a)()&&Object($.a)().BASE_SERVER},ot["set-server-url"]=async function(t){let{url:e,validate:r=!0}=t;if(null!=e){if(r){let{error:t}=await Object(z.d)(ot["subscribe-needs-bootstrap"],{url:e});if(t)return{error:t}}}else e="https://not-configured/";return l.e("server-url",e),Object($.b)(e),{}},ot.sync=async function(){return Object(J.e)()},ot["get-budgets"]=async function(){const t=await d.k(d.g());return(await Promise.all(t.map(async t=>{const e=d.j(d.g(),t,"metadata.json");if(await d.d(e)){let r;try{r=JSON.parse(await d.n(e))}catch(t){return void console.log("Error parsing metadata:",t.stack)}if("_demo-budget"!==t)return{id:t,cloudFileId:r.cloudFileId,groupId:r.groupId,name:r.budgetName||"(no name)"}}return null}))).filter(t=>t)},ot["get-remote-files"]=async function(){return L.e()},ot["reset-budget-cache"]=Object(z.c)((async function(){await K.f(B),K.b().recomputeAll(),await K.j()})),ot["upload-budget"]=async function(){let{id:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t){if(G.b())throw new Error("upload-budget: id given but prefs already loaded");await G.c(t)}try{await L.i()}catch(t){return console.log(t),"FileUploadError"===t.type?{error:t}:(Object(c.b)(t),{error:{reason:"internal"}})}finally{t&&G.e()}return{}},ot["download-budget"]=async function(t){let e,{fileId:r}=t;try{e=await L.b(r)}catch(t){if("FileDownloadError"===t.type){if("file-exists"===t.reason&&t.meta.id){await G.c(t.meta.id);let e=G.b().budgetName;G.e(),t.meta={...t.meta,name:e}}return{error:t}}return Object(c.b)(t),{error:{reason:"internal"}}}let n=e.id;return await ot["load-budget"]({id:n}),e=await ot["sync-budget"]({id:n}),await ot["close-budget"](),e.error?e:{id:n}},ot["sync-budget"]=async function(t){let{id:e}=t;return Object(J.k)("enabled"),await Object(J.f)(),{}},ot["load-budget"]=async function(t){let{id:e}=t,r=G.b();if(r){if(r.id===e)return{};await ot["close-budget"]()}return await ut(e)},ot["create-demo-budget"]=async function(){return await l.e("readOnly",""),ot["create-budget"]({budgetName:"Demo Budget",testMode:!0,testBudgetId:"_demo-budget"})},ot["close-budget"]=async function(){Object(c.a)({message:"Closing budget"}),await K.j(),K.i(),Object(J.d)(),await W.a.stopServices(),await B.closeDatabase();try{await l.e("lastBudget","")}catch(t){}return G.e(),Object(D.e)(),"ok"},ot["delete-budget"]=async function(t){let{id:e,cloudFileId:r}=t;if(r&&await L.g(r).catch(t=>{}),e){let t=d.e(e);await d.o(t)}return"ok"},ot["create-budget"]=async function(){let t,{budgetName:e,avoidUpload:r,testMode:n,testBudgetId:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n)e=e||"Test Budget",t=i||"_test-budget",await d.d(d.e(t))&&await d.o(d.e(t));else{if(!e){let t=await ot["get-budgets"]();e=await Object(nt.b)(t)}t=await Object(nt.a)(e)}let o=d.e(t);await d.m(o),await d.c(d.b,d.j(o,"db.sqlite")),await d.q(d.j(o,"metadata.json"),JSON.stringify(G.a(t,e)));let{error:a}=await ut(t);if(a)return console.log("Error creating budget: "+a),{error:a};if(!r&&!n)try{await L.i()}catch(t){}return n&&await Object(u.a)(ot),{}},ot["set-tutorial-seen"]=async function(){return await l.e("seen-tutorial","true"),"ok"},ot["import-budget"]=async function(t){let{filepath:e,type:r}=t;try{if(!await d.d(e))throw new Error("File not found at the provided path: "+e);let t=n.from(await d.n(e,"binary"));switch(r){case"ynab4":try{await a.a(e,t)}catch(t){let e=t.message.toLowerCase();if(e.includes("not a ynab4")||e.includes("could not find file"))return{error:"not-ynab4"}}break;case"ynab5":let r;try{r=JSON.parse(t.toString())}catch(t){return{error:"parse-error"}}try{await s.a(r)}catch(t){return{error:"not-ynab5"}}break;case"actual":let n;await ot["close-budget"]();try{({id:n}=await L.d({cloudFileId:null,groupId:null},t))}catch(t){if("FileDownloadError"===t.type)return{error:t.reason};throw t}let i=await g.g(d.j(d.e(n),"db.sqlite"));g.d(i,"\n DELETE FROM kvcache;\n DELETE FROM kvcache_key;\n "),g.c(i),await ot["load-budget"]({id:n}),await ot["get-budget-bounds"](),await K.j(),await L.i().catch(t=>{})}}catch(t){return t.message="Error importing budget: "+t.message,Object(c.b)(t),{error:"internal-error"}}return{}},ot["export-budget"]=async function(){return await L.c()},ot["get-upgrade-notifications"]=async function(){let{id:t}=G.b();if("_test-budget"===t||"_demo-budget"===t)return[];let e=["schedules","repair-splits"],r=[];for(let t of e){let e="notifications."+t;null==G.b()[e]&&r.push(t)}return r},ot["seen-upgrade-notification"]=async function(t){let{type:e}=t,r="notifications."+e;G.d({[r]:!0})},ot["upload-file-web"]=async function(t){let{filename:e,contents:r}=t;return q.c?(await d.q("/uploads/"+e,r),"ok"):null},ot["backups-get"]=async function(t){let{id:e}=t;return Object(D.a)(e)},ot["backup-load"]=async function(t){let{id:e,backupId:r}=t;await Object(D.b)(e,r)},ot["backup-make"]=async function(t){let{id:e}=t;await Object(D.c)(e)},ot["get-last-opened-backup"]=async function(){const t=await l.a("lastBudget");if(t&&""!==t){const e=d.e(t);if(await d.d(e))return t}return null},ot["app-focused"]=async function(){G.b()&&G.b().id&&Object(J.e)()},ot=Object(N.a)(ot),o.a((t,e)=>Object(z.d)(W.a.handlers[t],e)),W.a.handlers=ot,W.a.combine(Y.a,j.a,H.a,tt.a);const dt={getDataDir:d.f,sendMessage:(t,e)=>f.c(t,e),send:async(t,e)=>await Object(z.d)(W.a.handlers[t],e),on:(t,e)=>W.a.events.on(t,e),syncAndReceiveMessages:J.l,q:_.b,db:B,merkle:x.f,timestamp:{getClock:x.c,setClock:x.h,makeClock:x.e,makeClientId:x.d,serializeClock:x.g,deserializeClock:x.b,Timestamp:x.a},SyncProtoBuf:Q}}.call(this,r(25),r(16).Buffer,r(33))},function(t,e,r){"use strict";e.byteLength=function(t){var e=c(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=c(t),a=n[0],s=n[1],u=new o(function(t,e,r){return 3*(e+r)/4-r}(0,a,s)),l=0,f=s>0?a-4:a;for(r=0;r<f;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],u[l++]=e>>16&255,u[l++]=e>>8&255,u[l++]=255&e;2===s&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,u[l++]=255&e);1===s&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=0,s=r-i;a<s;a+=16383)o.push(l(t,a,a+16383>s?s:a+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s<u;++s)n[s]=a[s],i[a.charCodeAt(s)]=s;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,r){for(var i,o,a=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),a.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){
|
|
17
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
18
|
+
e.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,c=u>>1,l=-7,f=r?i-1:0,d=r?-1:1,h=t[e+f];for(f+=d,o=h&(1<<-l)-1,h>>=-l,l+=s;l>0;o=256*o+t[e+f],f+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+t[e+f],f+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,n),o-=c}return(h?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,u,c=8*o-i-1,l=(1<<c)-1,f=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,g=n?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+f>=1?d/u:d*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(e*u-1)*Math.pow(2,i),a+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;t[r+h]=255&s,h+=g,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;t[r+h]=255&a,h+=g,a/=256,c-=8);t[r+h-g]|=128*p}},function(t,e){},function(t,e,r){(function(e,n){const i=r(148).require(),o=r(43),a=r(158),s="object"==typeof e&&"win32"===e.platform,u=t=>t&&"object"==typeof t,c=new Uint32Array(256).map((t,e)=>{for(let t=0;t<8;t++)0!=(1&e)?e=3988292384^e>>>1:e>>>=1;return e>>>0});function l(t){this.sep=o.sep,this.fs=i,u(t)&&u(t.fs)&&"function"==typeof t.fs.statSync&&(this.fs=t.fs)}t.exports=l,l.prototype.makeDir=function(t){const e=this;!function(t){let r=t.split(e.sep)[0];t.split(e.sep).forEach((function(t){if(t&&":"!==t.substr(-1,1)){var n;r+=e.sep+t;try{n=e.fs.statSync(r)}catch(t){e.fs.mkdirSync(r)}if(n&&n.isFile())throw Errors.FILE_IN_THE_WAY.replace("%s",r)}}))}(t)},l.prototype.writeFileTo=function(t,e,r,n){const i=this;if(i.fs.existsSync(t)){if(!r)return!1;if(i.fs.statSync(t).isDirectory())return!1}var a,s=o.dirname(t);i.fs.existsSync(s)||i.makeDir(s);try{a=i.fs.openSync(t,"w",438)}catch(e){i.fs.chmodSync(t,438),a=i.fs.openSync(t,"w",438)}if(a)try{i.fs.writeSync(a,e,0,e.length,0)}finally{i.fs.closeSync(a)}return i.fs.chmodSync(t,n||438),!0},l.prototype.writeFileToAsync=function(t,e,r,n,i){"function"==typeof n&&(i=n,n=void 0);const a=this;a.fs.exists(t,(function(s){if(s&&!r)return i(!1);a.fs.stat(t,(function(r,u){if(s&&u.isDirectory())return i(!1);var c=o.dirname(t);a.fs.exists(c,(function(r){r||a.makeDir(c),a.fs.open(t,"w",438,(function(r,o){r?a.fs.chmod(t,438,(function(){a.fs.open(t,"w",438,(function(r,o){a.fs.write(o,e,0,e.length,0,(function(){a.fs.close(o,(function(){a.fs.chmod(t,n||438,(function(){i(!0)}))}))}))}))})):o?a.fs.write(o,e,0,e.length,0,(function(){a.fs.close(o,(function(){a.fs.chmod(t,n||438,(function(){i(!0)}))}))})):a.fs.chmod(t,n||438,(function(){i(!0)}))}))}))}))}))},l.prototype.findFiles=function(t){const e=this;return function t(r,n,i){"boolean"==typeof n&&(i=n,n=void 0);let a=[];return e.fs.readdirSync(r).forEach((function(s){var u=o.join(r,s);e.fs.statSync(u).isDirectory()&&i&&(a=a.concat(t(u,n,i))),n&&!n.test(u)||a.push(o.normalize(u)+(e.fs.statSync(u).isDirectory()?e.sep:""))})),a}(t,void 0,!0)},l.prototype.getAttributes=function(){},l.prototype.setAttributes=function(){},l.crc32update=function(t,e){return c[255&(t^e)]^t>>>8},l.crc32=function(t){"string"==typeof t&&(t=n.from(t,"utf8")),c.length||genCRCTable();let e=t.length,r=-1;for(let n=0;n<e;)r=l.crc32update(r,t[n++]);return~r>>>0},l.methodToString=function(t){switch(t){case a.STORED:return"STORED ("+t+")";case a.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}},l.canonical=function(t){if(!t)return"";var e=o.posix.normalize("/"+t.split("\\").join("/"));return o.join(".",e)},l.sanitize=function(t,e){t=o.resolve(o.normalize(t));for(var r=e.split("/"),n=0,i=r.length;n<i;n++){var a=o.normalize(o.join(t,r.slice(n,i).join(o.sep)));if(0===a.indexOf(t))return a}return o.normalize(o.join(t,o.basename(e)))},l.toBuffer=function(t){return n.isBuffer(t)?t:t instanceof Uint8Array?n.from(t):"string"==typeof t?n.from(t,"utf8"):n.alloc(0)},l.readBigUInt64LE=function(t,e){var r=n.from(t.slice(e,e+8));return r.swap64(),parseInt("0x"+r.toString("hex"))},l.isWin=s,l.crcTable=c}).call(this,r(25),r(16).Buffer)},function(t,e){"function"==typeof BigInt?e.default=BigInt:e.default=function(){throw new Error("BigInt is not supported in this environment.")}},function(t,e,r){"use strict";
|
|
19
|
+
/*
|
|
20
|
+
object-assign
|
|
21
|
+
(c) Sindre Sorhus
|
|
22
|
+
@license MIT
|
|
23
|
+
*/var n=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function a(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(t){n[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,s,u=a(t),c=1;c<arguments.length;c++){for(var l in r=Object(arguments[c]))i.call(r,l)&&(u[l]=r[l]);if(n){s=n(r);for(var f=0;f<s.length;f++)o.call(r,s[f])&&(u[s[f]]=r[s[f]])}}return u}},function(t,e){t.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),i=0;for(e=0;e<r;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)n[i]=o[a];return n};Object.defineProperty(e,"__esModule",{value:!0});var a,s,u=r(43),c=r(263),l=r(110),f=r(149),d=r(111),h=r(153),g=r(152),p=r(265),m=r(68),y=r(82),b=r(54),_=r(150),v=r(151),w=r(98),E=r(274),S=u.resolve,O=y.constants.O_RDONLY,T=y.constants.O_WRONLY,A=y.constants.O_RDWR,M=y.constants.O_CREAT,I=y.constants.O_EXCL,R=y.constants.O_TRUNC,N=y.constants.O_APPEND,k=y.constants.O_SYNC,D=y.constants.O_DIRECTORY,j=y.constants.F_OK,C=y.constants.COPYFILE_EXCL,L=y.constants.COPYFILE_FICLONE_FORCE;if(u.posix){var x=u.posix;a=x.sep,s=x.relative}else a=u.sep,s=u.relative;var B,U="win32"===g.default.platform,F="path must be a string or Buffer",P="fd must be a file descriptor",W="mode must be an int",z="callback must be a function",H="uid must be an unsigned int",q="gid must be an unsigned int",V="ENOENT";function G(t,e,r,n,i){void 0===e&&(e=""),void 0===r&&(r=""),void 0===n&&(n=""),void 0===i&&(i=Error);var o=new i(function(t,e,r,n){void 0===e&&(e=""),void 0===r&&(r=""),void 0===n&&(n="");var i="";switch(r&&(i=" '"+r+"'"),n&&(i+=" -> '"+n+"'"),t){case V:return"ENOENT: no such file or directory, "+e+i;case"EBADF":return"EBADF: bad file descriptor, "+e+i;case"EINVAL":return"EINVAL: invalid argument, "+e+i;case"EPERM":return"EPERM: operation not permitted, "+e+i;case"EPROTO":return"EPROTO: protocol error, "+e+i;case"EEXIST":return"EEXIST: file already exists, "+e+i;case"ENOTDIR":return"ENOTDIR: not a directory, "+e+i;case"EISDIR":return"EISDIR: illegal operation on a directory, "+e+i;case"EACCES":return"EACCES: permission denied, "+e+i;case"ENOTEMPTY":return"ENOTEMPTY: directory not empty, "+e+i;case"EMFILE":return"EMFILE: too many open files, "+e+i;case"ENOSYS":return"ENOSYS: function not implemented, "+e+i;default:return t+": error occurred, "+e+i}}(t,e,r,n));return o.code=t,o}function Y(t){if("number"==typeof t)return t;if("string"==typeof t){var e=B[t];if(void 0!==e)return e}throw new v.TypeError("ERR_INVALID_OPT_VALUE","flags",t)}function $(t,e){var r;if(!e)return t;var n=typeof e;switch(n){case"string":r=Object.assign({},t,{encoding:e});break;case"object":r=Object.assign({},t,e);break;default:throw TypeError(function(t){return"Expected options to be either an object or a string, but got "+t+" instead"}(n))}return"buffer"!==r.encoding&&_.assertEncoding(r.encoding),r}function K(t){return function(e){return $(t,e)}}function Z(t){if("function"!=typeof t)throw TypeError(z);return t}function J(t){return function(e,r){return"function"==typeof e?[t(),e]:[t(e),Z(r)]}}!function(t){t[t.r=O]="r",t[t["r+"]=A]="r+",t[t.rs=O|k]="rs",t[t.sr=t.rs]="sr",t[t["rs+"]=A|k]="rs+",t[t["sr+"]=t["rs+"]]="sr+",t[t.w=T|M|R]="w",t[t.wx=T|M|R|I]="wx",t[t.xw=t.wx]="xw",t[t["w+"]=A|M|R]="w+",t[t["wx+"]=A|M|R|I]="wx+",t[t["xw+"]=t["wx+"]]="xw+",t[t.a=T|N|M]="a",t[t.ax=T|N|M|I]="ax",t[t.xa=t.ax]="xa",t[t["a+"]=A|N|M]="a+",t[t["ax+"]=A|N|M|I]="ax+",t[t["xa+"]=t["ax+"]]="xa+"}(B=e.FLAGS||(e.FLAGS={})),e.flagsToNumber=Y;var X={encoding:"utf8"},Q=K(X),tt=J(Q),et=K({flag:"r"}),rt={encoding:"utf8",mode:438,flag:B[B.w]},nt=K(rt),it={encoding:"utf8",mode:438,flag:B[B.a]},ot=K(it),at=J(ot),st=K(X),ut=J(st),ct={mode:511,recursive:!1},lt=function(t){return"number"==typeof t?Object.assign({},ct,{mode:t}):Object.assign({},ct,t)},ft={recursive:!1},dt=function(t){return Object.assign({},ft,t)},ht=K({encoding:"utf8",withFileTypes:!1}),gt=J(ht),pt={bigint:!1},mt=function(t){return void 0===t&&(t={}),Object.assign({},pt,t)},yt=function(t,e){return"function"==typeof t?[mt(),t]:[mt(t),Z(e)]};function bt(t){if("string"!=typeof t&&!d.Buffer.isBuffer(t)){try{if(!(t instanceof r(275).URL))throw new TypeError(F)}catch(t){throw new TypeError(F)}t=function(t){if(""!==t.hostname)throw new v.TypeError("ERR_INVALID_FILE_URL_HOST",g.default.platform);for(var e=t.pathname,r=0;r<e.length;r++)if("%"===e[r]){var n=32|e.codePointAt(r+2);if("2"===e[r+1]&&102===n)throw new v.TypeError("ERR_INVALID_FILE_URL_PATH","must not include encoded / characters")}return decodeURIComponent(e)}(t)}var e=String(t);return At(e),e}e.pathToFilename=bt;var _t=function(t,e){return void 0===e&&(e=g.default.cwd()),S(e,t)};if(U){var vt=_t,wt=r(281).unixify;_t=function(t,e){return wt(vt(t,e))}}function Et(t,e){var r=_t(t,e).substr(1);return r?r.split(a):[]}function St(t){return Et(bt(t))}function Ot(t,e){return void 0===e&&(e=_.ENCODING_UTF8),d.Buffer.isBuffer(t)?t:t instanceof Uint8Array?d.bufferFrom(t):d.bufferFrom(String(t),e)}function Tt(t,e){return e&&"buffer"!==e?t.toString(e):t}function At(t,e){if(-1!==(""+t).indexOf("\0")){var r=new Error("Path must be a string without null bytes");if(r.code=V,"function"!=typeof e)throw r;return g.default.nextTick(e,r),!1}return!0}function Mt(t,e){var r=function(t,e){return"number"==typeof t?t:"string"==typeof t?parseInt(t,8):e?Mt(e):void 0}(t,e);if("number"!=typeof r||isNaN(r))throw new TypeError(W);return r}function It(t){return t>>>0===t}function Rt(t){if(!It(t))throw TypeError(P)}function Nt(t){if("string"==typeof t&&+t==t)return+t;if(t instanceof Date)return t.getTime()/1e3;if(isFinite(t))return t<0?Date.now()/1e3:t;throw new Error("Cannot parse time: "+t)}function kt(t){if("number"!=typeof t)throw TypeError(H)}function Dt(t){if("number"!=typeof t)throw TypeError(q)}e.filenameToSteps=Et,e.pathToSteps=St,e.dataToStr=function(t,e){return void 0===e&&(e=_.ENCODING_UTF8),d.Buffer.isBuffer(t)?t.toString(e):t instanceof Uint8Array?d.bufferFrom(t).toString(e):String(t)},e.dataToBuffer=Ot,e.bufferToEncoding=Tt,e.toUnixTimestamp=Nt;var jt=function(){function t(t){void 0===t&&(t={}),this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.maxFiles=1e4,this.openFiles=0,this.promisesApi=E.default(this),this.statWatchers={},this.props=Object.assign({Node:c.Node,Link:c.Link,File:c.File},t);var e=this.createLink();e.setNode(this.createNode(!0));var r=this;this.StatWatcher=function(t){function e(){return t.call(this,r)||this}return i(e,t),e}(xt);var n=Bt;this.ReadStream=function(t){function e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.apply(this,o([r],e))||this}return i(e,t),e}(n);var a=Ft;this.WriteStream=function(t){function e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.apply(this,o([r],e))||this}return i(e,t),e}(a),this.FSWatcher=function(t){function e(){return t.call(this,r)||this}return i(e,t),e}(Pt),this.root=e}return t.fromJSON=function(e,r){var n=new t;return n.fromJSON(e,r),n},Object.defineProperty(t.prototype,"promises",{get:function(){if(null===this.promisesApi)throw new Error("Promise is not supported in this environment.");return this.promisesApi},enumerable:!0,configurable:!0}),t.prototype.createLink=function(t,e,r,n){if(void 0===r&&(r=!1),!t)return new this.props.Link(this,null,"");if(!e)throw new Error("createLink: name cannot be empty");return t.createChild(e,this.createNode(r,n))},t.prototype.deleteLink=function(t){var e=t.parent;return!!e&&(e.deleteChild(t),!0)},t.prototype.newInoNumber=function(){var t=this.releasedInos.pop();return t||(this.ino=(this.ino+1)%4294967295,this.ino)},t.prototype.newFdNumber=function(){var e=this.releasedFds.pop();return"number"==typeof e?e:t.fd--},t.prototype.createNode=function(t,e){void 0===t&&(t=!1);var r=new this.props.Node(this.newInoNumber(),e);return t&&r.setIsDirectory(),this.inodes[r.ino]=r,r},t.prototype.getNode=function(t){return this.inodes[t]},t.prototype.deleteNode=function(t){t.del(),delete this.inodes[t.ino],this.releasedInos.push(t.ino)},t.prototype.genRndStr=function(){var t=(Math.random()+1).toString(36).substr(2,6);return 6===t.length?t:this.genRndStr()},t.prototype.getLink=function(t){return this.root.walk(t)},t.prototype.getLinkOrThrow=function(t,e){var r=Et(t),n=this.getLink(r);if(!n)throw G(V,e,t);return n},t.prototype.getResolvedLink=function(t){for(var e="string"==typeof t?Et(t):t,r=this.root,n=0;n<e.length;){var i=e[n];if(!(r=r.getChild(i)))return null;var o=r.getNode();o.isSymlink()?(e=o.symlink.concat(e.slice(n+1)),r=this.root,n=0):n++}return r},t.prototype.getResolvedLinkOrThrow=function(t,e){var r=this.getResolvedLink(t);if(!r)throw G(V,e,t);return r},t.prototype.resolveSymlinks=function(t){return this.getResolvedLink(t.steps.slice(1))},t.prototype.getLinkAsDirOrThrow=function(t,e){var r=this.getLinkOrThrow(t,e);if(!r.getNode().isDirectory())throw G("ENOTDIR",e,t);return r},t.prototype.getLinkParent=function(t){return this.root.walk(t,t.length-1)},t.prototype.getLinkParentAsDirOrThrow=function(t,e){var r=t instanceof Array?t:Et(t),n=this.getLinkParent(r);if(!n)throw G(V,e,a+r.join(a));if(!n.getNode().isDirectory())throw G("ENOTDIR",e,a+r.join(a));return n},t.prototype.getFileByFd=function(t){return this.fds[String(t)]},t.prototype.getFileByFdOrThrow=function(t,e){if(!It(t))throw TypeError(P);var r=this.getFileByFd(t);if(!r)throw G("EBADF",e);return r},t.prototype.getNodeByIdOrCreate=function(t,e,r){if("number"==typeof t){var n=this.getFileByFd(t);if(!n)throw Error("File nto found");return n.node}var i=St(t),o=this.getLink(i);if(o)return o.getNode();if(e&M){var a=this.getLinkParent(i);if(a){var s=i[i.length-1];return(o=this.createLink(a,s,!1,r)).getNode()}}throw G(V,"getNodeByIdOrCreate",bt(t))},t.prototype.wrapAsync=function(t,e,r){var n=this;Z(r),h.default((function(){try{r(null,t.apply(n,e))}catch(t){r(t)}}))},t.prototype._toJSON=function(t,e,r){var n;void 0===t&&(t=this.root),void 0===e&&(e={});var i=!0,o=t.children;for(var a in t.getNode().isFile()&&((n={})[t.getName()]=t.parent.getChild(t.getName()),o=n,t=t.parent),o){i=!1;var u=t.getChild(a);if(!u)throw new Error("_toJSON: unexpected undefined");var c=u.getNode();if(c.isFile()){var l=u.getPath();r&&(l=s(r,l)),e[l]=c.getString()}else c.isDirectory()&&this._toJSON(u,e,r)}var f=t.getPath();return r&&(f=s(r,f)),f&&i&&(e[f]=null),e},t.prototype.toJSON=function(t,e,r){void 0===e&&(e={}),void 0===r&&(r=!1);var n=[];if(t){t instanceof Array||(t=[t]);for(var i=0,o=t;i<o.length;i++){var a=bt(o[i]);(c=this.getResolvedLink(a))&&n.push(c)}}else n.push(this.root);if(!n.length)return e;for(var s=0,u=n;s<u.length;s++){var c=u[s];this._toJSON(c,e,r?c.getPath():"")}return e},t.prototype.fromJSON=function(t,e){for(var r in void 0===e&&(e=g.default.cwd()),t){var n=t[r];if("string"==typeof n){var i=Et(r=_t(r,e));if(i.length>1){var o=a+i.slice(0,i.length-1).join(a);this.mkdirpBase(o,511)}this.writeFileSync(r,n)}else this.mkdirpBase(r,511)}},t.prototype.reset=function(){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.openFiles=0,this.root=this.createLink(),this.root.setNode(this.createNode(!0))},t.prototype.mountSync=function(t,e){this.fromJSON(e,t)},t.prototype.openLink=function(t,e,r){if(void 0===r&&(r=!0),this.openFiles>=this.maxFiles)throw G("EMFILE","open",t.getPath());var n=t;if(r&&(n=this.resolveSymlinks(t)),!n)throw G(V,"open",t.getPath());var i=n.getNode();if(i.isDirectory()){if((e&(O|A|T))!==O)throw G("EISDIR","open",t.getPath())}else if(e&D)throw G("ENOTDIR","open",t.getPath());if(!(e&T||i.canRead()))throw G("EACCES","open",t.getPath());var o=new this.props.File(t,i,e,this.newFdNumber());return this.fds[o.fd]=o,this.openFiles++,e&R&&o.truncate(),o},t.prototype.openFile=function(t,e,r,n){void 0===n&&(n=!0);var i=Et(t),o=n?this.getResolvedLink(i):this.getLink(i);if(!o&&e&M){var s=this.getResolvedLink(i.slice(0,i.length-1));if(!s)throw G(V,"open",a+i.join(a));e&M&&"number"==typeof r&&(o=this.createLink(s,i[i.length-1],!1,r))}if(o)return this.openLink(o,e,n);throw G(V,"open",t)},t.prototype.openBase=function(t,e,r,n){void 0===n&&(n=!0);var i=this.openFile(t,e,r,n);if(!i)throw G(V,"open",t);return i.fd},t.prototype.openSync=function(t,e,r){void 0===r&&(r=438);var n=Mt(r),i=bt(t),o=Y(e);return this.openBase(i,o,n)},t.prototype.open=function(t,e,r,n){var i=r,o=n;"function"==typeof r&&(i=438,o=r);var a=Mt(i=i||438),s=bt(t),u=Y(e);this.wrapAsync(this.openBase,[s,u,a],o)},t.prototype.closeFile=function(t){this.fds[t.fd]&&(this.openFiles--,delete this.fds[t.fd],this.releasedFds.push(t.fd))},t.prototype.closeSync=function(t){Rt(t);var e=this.getFileByFdOrThrow(t,"close");this.closeFile(e)},t.prototype.close=function(t,e){Rt(t),this.wrapAsync(this.closeSync,[t],e)},t.prototype.openFileOrGetById=function(t,e,r){if("number"==typeof t){var n=this.fds[t];if(!n)throw G(V);return n}return this.openFile(bt(t),e,r)},t.prototype.readBase=function(t,e,r,n,i){return this.getFileByFdOrThrow(t).read(e,Number(r),Number(n),i)},t.prototype.readSync=function(t,e,r,n,i){return Rt(t),this.readBase(t,e,r,n,i)},t.prototype.read=function(t,e,r,n,i,o){var a=this;if(Z(o),0===n)return g.default.nextTick((function(){o&&o(null,0,e)}));h.default((function(){try{var s=a.readBase(t,e,r,n,i);o(null,s,e)}catch(t){o(t)}}))},t.prototype.readFileBase=function(t,e,r){var n,i,o="number"==typeof t&&It(t);if(o)i=t;else{var a=Et(bt(t)),s=this.getResolvedLink(a);if(s)if(s.getNode().isDirectory())throw G("EISDIR","open",s.getPath());i=this.openSync(t,e)}try{n=Tt(this.getFileByFdOrThrow(i).getBuffer(),r)}finally{o||this.closeSync(i)}return n},t.prototype.readFileSync=function(t,e){var r=et(e),n=Y(r.flag);return this.readFileBase(t,n,r.encoding)},t.prototype.readFile=function(t,e,r){var n=J(et)(e,r),i=n[0],o=n[1],a=Y(i.flag);this.wrapAsync(this.readFileBase,[t,a,i.encoding],o)},t.prototype.writeBase=function(t,e,r,n,i){return this.getFileByFdOrThrow(t,"write").write(e,r,n,i)},t.prototype.writeSync=function(t,e,r,n,i){var o,a,s,u;Rt(t);var c="string"!=typeof e;c?(a=0|(r||0),s=n,u=i):(u=r,o=n);var l=Ot(e,o);return c?void 0===s&&(s=l.length):(a=0,s=l.length),this.writeBase(t,l,a,s,u)},t.prototype.write=function(t,e,r,n,i,o){var a,s,u,c,l,f=this;Rt(t);var d=typeof e,g=typeof r,p=typeof n,m=typeof i;"string"!==d?"function"===g?l=r:"function"===p?(a=0|r,l=n):"function"===m?(a=0|r,s=n,l=i):(a=0|r,s=n,u=i,l=o):"function"===g?l=r:"function"===p?(u=r,l=n):"function"===m&&(u=r,c=n,l=i);var y=Ot(e,c);"string"!==d?void 0===s&&(s=y.length):(a=0,s=y.length);var b=Z(l);h.default((function(){try{var r=f.writeBase(t,y,a,s,u);b(null,r,"string"!==d?y:e)}catch(t){b(t)}}))},t.prototype.writeFileBase=function(t,e,r,n){var i,o="number"==typeof t;i=o?t:this.openBase(bt(t),r,n);var a=0,s=e.length,u=r&N?void 0:0;try{for(;s>0;){var c=this.writeSync(i,e,a,s,u);a+=c,s-=c,void 0!==u&&(u+=c)}}finally{o||this.closeSync(i)}},t.prototype.writeFileSync=function(t,e,r){var n=nt(r),i=Y(n.flag),o=Mt(n.mode),a=Ot(e,n.encoding);this.writeFileBase(t,a,i,o)},t.prototype.writeFile=function(t,e,r,n){var i=r,o=n;"function"==typeof r&&(i=rt,o=r);var a=Z(o),s=nt(i),u=Y(s.flag),c=Mt(s.mode),l=Ot(e,s.encoding);this.wrapAsync(this.writeFileBase,[t,l,u,c],a)},t.prototype.linkBase=function(t,e){var r=Et(t),n=this.getLink(r);if(!n)throw G(V,"link",t,e);var i=Et(e),o=this.getLinkParent(i);if(!o)throw G(V,"link",t,e);var a=i[i.length-1];if(o.getChild(a))throw G("EEXIST","link",t,e);var s=n.getNode();s.nlink++,o.createChild(a,s)},t.prototype.copyFileBase=function(t,e,r){var n=this.readFileSync(t);if(r&C&&this.existsSync(e))throw G("EEXIST","copyFile",t,e);if(r&L)throw G("ENOSYS","copyFile",t,e);this.writeFileBase(e,n,B.w,438)},t.prototype.copyFileSync=function(t,e,r){var n=bt(t),i=bt(e);return this.copyFileBase(n,i,0|(r||0))},t.prototype.copyFile=function(t,e,r,n){var i,o,a=bt(t),s=bt(e);"function"==typeof r?(i=0,o=r):(i=r,o=n),Z(o),this.wrapAsync(this.copyFileBase,[a,s,i],o)},t.prototype.linkSync=function(t,e){var r=bt(t),n=bt(e);this.linkBase(r,n)},t.prototype.link=function(t,e,r){var n=bt(t),i=bt(e);this.wrapAsync(this.linkBase,[n,i],r)},t.prototype.unlinkBase=function(t){var e=Et(t),r=this.getLink(e);if(!r)throw G(V,"unlink",t);if(r.length)throw Error("Dir not empty...");this.deleteLink(r);var n=r.getNode();n.nlink--,n.nlink<=0&&this.deleteNode(n)},t.prototype.unlinkSync=function(t){var e=bt(t);this.unlinkBase(e)},t.prototype.unlink=function(t,e){var r=bt(t);this.wrapAsync(this.unlinkBase,[r],e)},t.prototype.symlinkBase=function(t,e){var r=Et(e),n=this.getLinkParent(r);if(!n)throw G(V,"symlink",t,e);var i=r[r.length-1];if(n.getChild(i))throw G("EEXIST","symlink",t,e);var o=n.createChild(i);return o.getNode().makeSymlink(Et(t)),o},t.prototype.symlinkSync=function(t,e,r){var n=bt(t),i=bt(e);this.symlinkBase(n,i)},t.prototype.symlink=function(t,e,r,n){var i=Z("function"==typeof r?r:n),o=bt(t),a=bt(e);this.wrapAsync(this.symlinkBase,[o,a],i)},t.prototype.realpathBase=function(t,e){var r=Et(t),n=this.getResolvedLink(r);if(!n)throw G(V,"realpath",t);return _.strToEncoding(n.getPath(),e)},t.prototype.realpathSync=function(t,e){return this.realpathBase(bt(t),st(e).encoding)},t.prototype.realpath=function(t,e,r){var n=ut(e,r),i=n[0],o=n[1],a=bt(t);this.wrapAsync(this.realpathBase,[a,i.encoding],o)},t.prototype.lstatBase=function(t,e){void 0===e&&(e=!1);var r=this.getLink(Et(t));if(!r)throw G(V,"lstat",t);return l.default.build(r.getNode(),e)},t.prototype.lstatSync=function(t,e){return this.lstatBase(bt(t),mt(e).bigint)},t.prototype.lstat=function(t,e,r){var n=yt(e,r),i=n[0],o=n[1];this.wrapAsync(this.lstatBase,[bt(t),i.bigint],o)},t.prototype.statBase=function(t,e){void 0===e&&(e=!1);var r=this.getResolvedLink(Et(t));if(!r)throw G(V,"stat",t);return l.default.build(r.getNode(),e)},t.prototype.statSync=function(t,e){return this.statBase(bt(t),mt(e).bigint)},t.prototype.stat=function(t,e,r){var n=yt(e,r),i=n[0],o=n[1];this.wrapAsync(this.statBase,[bt(t),i.bigint],o)},t.prototype.fstatBase=function(t,e){void 0===e&&(e=!1);var r=this.getFileByFd(t);if(!r)throw G("EBADF","fstat");return l.default.build(r.node,e)},t.prototype.fstatSync=function(t,e){return this.fstatBase(t,mt(e).bigint)},t.prototype.fstat=function(t,e,r){var n=yt(e,r),i=n[0],o=n[1];this.wrapAsync(this.fstatBase,[t,i.bigint],o)},t.prototype.renameBase=function(t,e){var r=this.getLink(Et(t));if(!r)throw G(V,"rename",t,e);var n=Et(e),i=this.getLinkParent(n);if(!i)throw G(V,"rename",t,e);var a=r.parent;a&&a.deleteChild(r);var s=n[n.length-1];r.steps=o(i.steps,[s]),i.setChild(r.getName(),r)},t.prototype.renameSync=function(t,e){var r=bt(t),n=bt(e);this.renameBase(r,n)},t.prototype.rename=function(t,e,r){var n=bt(t),i=bt(e);this.wrapAsync(this.renameBase,[n,i],r)},t.prototype.existsBase=function(t){return!!this.statBase(t)},t.prototype.existsSync=function(t){try{return this.existsBase(bt(t))}catch(t){return!1}},t.prototype.exists=function(t,e){var r=this,n=bt(t);if("function"!=typeof e)throw Error(z);h.default((function(){try{e(r.existsBase(n))}catch(t){e(!1)}}))},t.prototype.accessBase=function(t,e){this.getLinkOrThrow(t,"access")},t.prototype.accessSync=function(t,e){void 0===e&&(e=j);var r=bt(t);e|=0,this.accessBase(r,e)},t.prototype.access=function(t,e,r){var n,i=j;"function"!=typeof e?(i=0|e,n=Z(r)):n=e;var o=bt(t);this.wrapAsync(this.accessBase,[o,i],n)},t.prototype.appendFileSync=function(t,e,r){void 0===r&&(r=it);var n=ot(r);n.flag&&!It(t)||(n.flag="a"),this.writeFileSync(t,e,n)},t.prototype.appendFile=function(t,e,r,n){var i=at(r,n),o=i[0],a=i[1];o.flag&&!It(t)||(o.flag="a"),this.writeFile(t,e,o,a)},t.prototype.readdirBase=function(t,e){var r=Et(t),n=this.getResolvedLink(r);if(!n)throw G(V,"readdir",t);if(!n.getNode().isDirectory())throw G("ENOTDIR","scandir",t);if(e.withFileTypes){var i=[];for(var o in n.children){var a=n.getChild(o);a&&i.push(f.default.build(a,e.encoding))}return U||"buffer"===e.encoding||i.sort((function(t,e){return t.name<e.name?-1:t.name>e.name?1:0})),i}var s=[];for(var u in n.children)s.push(_.strToEncoding(u,e.encoding));return U||"buffer"===e.encoding||s.sort(),s},t.prototype.readdirSync=function(t,e){var r=ht(e),n=bt(t);return this.readdirBase(n,r)},t.prototype.readdir=function(t,e,r){var n=gt(e,r),i=n[0],o=n[1],a=bt(t);this.wrapAsync(this.readdirBase,[a,i],o)},t.prototype.readlinkBase=function(t,e){var r=this.getLinkOrThrow(t,"readlink").getNode();if(!r.isSymlink())throw G("EINVAL","readlink",t);var n=a+r.symlink.join(a);return _.strToEncoding(n,e)},t.prototype.readlinkSync=function(t,e){var r=Q(e),n=bt(t);return this.readlinkBase(n,r.encoding)},t.prototype.readlink=function(t,e,r){var n=tt(e,r),i=n[0],o=n[1],a=bt(t);this.wrapAsync(this.readlinkBase,[a,i.encoding],o)},t.prototype.fsyncBase=function(t){this.getFileByFdOrThrow(t,"fsync")},t.prototype.fsyncSync=function(t){this.fsyncBase(t)},t.prototype.fsync=function(t,e){this.wrapAsync(this.fsyncBase,[t],e)},t.prototype.fdatasyncBase=function(t){this.getFileByFdOrThrow(t,"fdatasync")},t.prototype.fdatasyncSync=function(t){this.fdatasyncBase(t)},t.prototype.fdatasync=function(t,e){this.wrapAsync(this.fdatasyncBase,[t],e)},t.prototype.ftruncateBase=function(t,e){this.getFileByFdOrThrow(t,"ftruncate").truncate(e)},t.prototype.ftruncateSync=function(t,e){this.ftruncateBase(t,e)},t.prototype.ftruncate=function(t,e,r){var n="number"==typeof e?e:0,i=Z("number"==typeof e?r:e);this.wrapAsync(this.ftruncateBase,[t,n],i)},t.prototype.truncateBase=function(t,e){var r=this.openSync(t,"r+");try{this.ftruncateSync(r,e)}finally{this.closeSync(r)}},t.prototype.truncateSync=function(t,e){if(It(t))return this.ftruncateSync(t,e);this.truncateBase(t,e)},t.prototype.truncate=function(t,e,r){var n="number"==typeof e?e:0,i=Z("number"==typeof e?r:e);if(It(t))return this.ftruncate(t,n,i);this.wrapAsync(this.truncateBase,[t,n],i)},t.prototype.futimesBase=function(t,e,r){var n=this.getFileByFdOrThrow(t,"futimes").node;n.atime=new Date(1e3*e),n.mtime=new Date(1e3*r)},t.prototype.futimesSync=function(t,e,r){this.futimesBase(t,Nt(e),Nt(r))},t.prototype.futimes=function(t,e,r,n){this.wrapAsync(this.futimesBase,[t,Nt(e),Nt(r)],n)},t.prototype.utimesBase=function(t,e,r){var n=this.openSync(t,"r+");try{this.futimesBase(n,e,r)}finally{this.closeSync(n)}},t.prototype.utimesSync=function(t,e,r){this.utimesBase(bt(t),Nt(e),Nt(r))},t.prototype.utimes=function(t,e,r,n){this.wrapAsync(this.utimesBase,[bt(t),Nt(e),Nt(r)],n)},t.prototype.mkdirBase=function(t,e){var r=Et(t);if(!r.length)throw G("EISDIR","mkdir",t);var n=this.getLinkParentAsDirOrThrow(t,"mkdir"),i=r[r.length-1];if(n.getChild(i))throw G("EEXIST","mkdir",t);n.createChild(i,this.createNode(!0,e))},t.prototype.mkdirpBase=function(t,e){for(var r=Et(t),n=this.root,i=0;i<r.length;i++){var o=r[i];if(!n.getNode().isDirectory())throw G("ENOTDIR","mkdir",n.getPath());var a=n.getChild(o);if(a){if(!a.getNode().isDirectory())throw G("ENOTDIR","mkdir",a.getPath());n=a}else n=n.createChild(o,this.createNode(!0,e))}},t.prototype.mkdirSync=function(t,e){var r=lt(e),n=Mt(r.mode,511),i=bt(t);r.recursive?this.mkdirpBase(i,n):this.mkdirBase(i,n)},t.prototype.mkdir=function(t,e,r){var n=lt(e),i=Z("function"==typeof e?e:r),o=Mt(n.mode,511),a=bt(t);n.recursive?this.wrapAsync(this.mkdirpBase,[a,o],i):this.wrapAsync(this.mkdirBase,[a,o],i)},t.prototype.mkdirpSync=function(t,e){this.mkdirSync(t,{mode:e,recursive:!0})},t.prototype.mkdirp=function(t,e,r){var n="function"==typeof e?void 0:e,i=Z("function"==typeof e?e:r);this.mkdir(t,{mode:n,recursive:!0},i)},t.prototype.mkdtempBase=function(t,e,r){void 0===r&&(r=5);var n=t+this.genRndStr();try{return this.mkdirBase(n,511),_.strToEncoding(n,e)}catch(n){if("EEXIST"===n.code){if(r>1)return this.mkdtempBase(t,e,r-1);throw Error("Could not create temp dir.")}throw n}},t.prototype.mkdtempSync=function(t,e){var r=Q(e).encoding;if(!t||"string"!=typeof t)throw new TypeError("filename prefix is required");return At(t),this.mkdtempBase(t,r)},t.prototype.mkdtemp=function(t,e,r){var n=tt(e,r),i=n[0].encoding,o=n[1];if(!t||"string"!=typeof t)throw new TypeError("filename prefix is required");At(t)&&this.wrapAsync(this.mkdtempBase,[t,i],o)},t.prototype.rmdirBase=function(t,e){var r=dt(e),n=this.getLinkAsDirOrThrow(t,"rmdir");if(n.length&&!r.recursive)throw G("ENOTEMPTY","rmdir",t);this.deleteLink(n)},t.prototype.rmdirSync=function(t,e){this.rmdirBase(bt(t),e)},t.prototype.rmdir=function(t,e,r){var n=dt(e),i=Z("function"==typeof e?e:r);this.wrapAsync(this.rmdirBase,[bt(t),n],i)},t.prototype.fchmodBase=function(t,e){this.getFileByFdOrThrow(t,"fchmod").chmod(e)},t.prototype.fchmodSync=function(t,e){this.fchmodBase(t,Mt(e))},t.prototype.fchmod=function(t,e,r){this.wrapAsync(this.fchmodBase,[t,Mt(e)],r)},t.prototype.chmodBase=function(t,e){var r=this.openSync(t,"r+");try{this.fchmodBase(r,e)}finally{this.closeSync(r)}},t.prototype.chmodSync=function(t,e){var r=Mt(e),n=bt(t);this.chmodBase(n,r)},t.prototype.chmod=function(t,e,r){var n=Mt(e),i=bt(t);this.wrapAsync(this.chmodBase,[i,n],r)},t.prototype.lchmodBase=function(t,e){var r=this.openBase(t,A,0,!1);try{this.fchmodBase(r,e)}finally{this.closeSync(r)}},t.prototype.lchmodSync=function(t,e){var r=Mt(e),n=bt(t);this.lchmodBase(n,r)},t.prototype.lchmod=function(t,e,r){var n=Mt(e),i=bt(t);this.wrapAsync(this.lchmodBase,[i,n],r)},t.prototype.fchownBase=function(t,e,r){this.getFileByFdOrThrow(t,"fchown").chown(e,r)},t.prototype.fchownSync=function(t,e,r){kt(e),Dt(r),this.fchownBase(t,e,r)},t.prototype.fchown=function(t,e,r,n){kt(e),Dt(r),this.wrapAsync(this.fchownBase,[t,e,r],n)},t.prototype.chownBase=function(t,e,r){this.getResolvedLinkOrThrow(t,"chown").getNode().chown(e,r)},t.prototype.chownSync=function(t,e,r){kt(e),Dt(r),this.chownBase(bt(t),e,r)},t.prototype.chown=function(t,e,r,n){kt(e),Dt(r),this.wrapAsync(this.chownBase,[bt(t),e,r],n)},t.prototype.lchownBase=function(t,e,r){this.getLinkOrThrow(t,"lchown").getNode().chown(e,r)},t.prototype.lchownSync=function(t,e,r){kt(e),Dt(r),this.lchownBase(bt(t),e,r)},t.prototype.lchown=function(t,e,r,n){kt(e),Dt(r),this.wrapAsync(this.lchownBase,[bt(t),e,r],n)},t.prototype.watchFile=function(t,e,r){var n=bt(t),i=e,o=r;if("function"==typeof i&&(o=e,i=null),"function"!=typeof o)throw Error('"watchFile()" requires a listener function');var a=5007,s=!0;i&&"object"==typeof i&&("number"==typeof i.interval&&(a=i.interval),"boolean"==typeof i.persistent&&(s=i.persistent));var u=this.statWatchers[n];return u||((u=new this.StatWatcher).start(n,s,a),this.statWatchers[n]=u),u.addListener("change",o),u},t.prototype.unwatchFile=function(t,e){var r=bt(t),n=this.statWatchers[r];n&&("function"==typeof e?n.removeListener("change",e):n.removeAllListeners("change"),0===n.listenerCount("change")&&(n.stop(),delete this.statWatchers[r]))},t.prototype.createReadStream=function(t,e){return new this.ReadStream(t,e)},t.prototype.createWriteStream=function(t,e){return new this.WriteStream(t,e)},t.prototype.watch=function(t,e,r){var n=bt(t),i=e;"function"==typeof e&&(r=e,i=null);var o=Q(i),a=o.persistent,s=o.recursive,u=o.encoding;void 0===a&&(a=!0),void 0===s&&(s=!1);var c=new this.FSWatcher;return c.start(n,a,s,u),r&&c.addListener("change",r),c},t.fd=2147483647,t}();function Ct(t){t.emit("stop")}e.Volume=jt;var Lt,xt=function(t){function e(e){var r=t.call(this)||this;return r.onInterval=function(){try{var t=r.vol.statSync(r.filename);r.hasChanged(t)&&(r.emit("change",t,r.prev),r.prev=t)}finally{r.loop()}},r.vol=e,r}return i(e,t),e.prototype.loop=function(){this.timeoutRef=this.setTimeout(this.onInterval,this.interval)},e.prototype.hasChanged=function(t){return t.mtimeMs>this.prev.mtimeMs||t.nlink!==this.prev.nlink},e.prototype.start=function(t,e,r){void 0===e&&(e=!0),void 0===r&&(r=5007),this.filename=bt(t),this.setTimeout=e?setTimeout:p.default,this.interval=r,this.prev=this.vol.statSync(this.filename),this.loop()},e.prototype.stop=function(){clearTimeout(this.timeoutRef),g.default.nextTick(Ct,this)},e}(b.EventEmitter);function Bt(t,e,r){if(!(this instanceof Bt))return new Bt(t,e,r);if(this._vol=t,void 0===(r=Object.assign({},$(r,{}))).highWaterMark&&(r.highWaterMark=65536),m.Readable.call(this,r),this.path=bt(e),this.fd=void 0===r.fd?null:r.fd,this.flags=void 0===r.flags?"r":r.flags,this.mode=void 0===r.mode?438:r.mode,this.start=r.start,this.end=r.end,this.autoClose=void 0===r.autoClose||r.autoClose,this.pos=void 0,this.bytesRead=0,void 0!==this.start){if("number"!=typeof this.start)throw new TypeError('"start" option must be a Number');if(void 0===this.end)this.end=1/0;else if("number"!=typeof this.end)throw new TypeError('"end" option must be a Number');if(this.start>this.end)throw new Error('"start" option must be <= "end" option');this.pos=this.start}"number"!=typeof this.fd&&this.open(),this.on("end",(function(){this.autoClose&&this.destroy&&this.destroy()}))}function Ut(t){this.close()}function Ft(t,e,r){if(!(this instanceof Ft))return new Ft(t,e,r);if(this._vol=t,r=Object.assign({},$(r,{})),m.Writable.call(this,r),this.path=bt(e),this.fd=void 0===r.fd?null:r.fd,this.flags=void 0===r.flags?"w":r.flags,this.mode=void 0===r.mode?438:r.mode,this.start=r.start,this.autoClose=void 0===r.autoClose||!!r.autoClose,this.pos=void 0,this.bytesWritten=0,void 0!==this.start){if("number"!=typeof this.start)throw new TypeError('"start" option must be a Number');if(this.start<0)throw new Error('"start" must be >= zero');this.pos=this.start}r.encoding&&this.setDefaultEncoding(r.encoding),"number"!=typeof this.fd&&this.open(),this.once("finish",(function(){this.autoClose&&this.close()}))}e.StatWatcher=xt,w.inherits(Bt,m.Readable),e.ReadStream=Bt,Bt.prototype.open=function(){var t=this;this._vol.open(this.path,this.flags,this.mode,(function(e,r){if(e)return t.autoClose&&t.destroy&&t.destroy(),void t.emit("error",e);t.fd=r,t.emit("open",r),t.read()}))},Bt.prototype._read=function(t){if("number"!=typeof this.fd)return this.once("open",(function(){this._read(t)}));if(!this.destroyed){var e;(!Lt||Lt.length-Lt.used<128)&&(e=this._readableState.highWaterMark,(Lt=d.bufferAllocUnsafe(e)).used=0);var r=Lt,n=Math.min(Lt.length-Lt.used,t),i=Lt.used;if(void 0!==this.pos&&(n=Math.min(this.end-this.pos+1,n)),n<=0)return this.push(null);var o=this;this._vol.read(this.fd,Lt,Lt.used,n,this.pos,(function(t,e){if(t)o.autoClose&&o.destroy&&o.destroy(),o.emit("error",t);else{var n=null;e>0&&(o.bytesRead+=e,n=r.slice(i,i+e)),o.push(n)}})),void 0!==this.pos&&(this.pos+=n),Lt.used+=n}},Bt.prototype._destroy=function(t,e){this.close((function(r){e(t||r)}))},Bt.prototype.close=function(t){var e=this;if(t&&this.once("close",t),this.closed||"number"!=typeof this.fd)return"number"!=typeof this.fd?void this.once("open",Ut):g.default.nextTick((function(){return e.emit("close")}));this.closed=!0,this._vol.close(this.fd,(function(t){t?e.emit("error",t):e.emit("close")})),this.fd=null},w.inherits(Ft,m.Writable),e.WriteStream=Ft,Ft.prototype.open=function(){this._vol.open(this.path,this.flags,this.mode,function(t,e){if(t)return this.autoClose&&this.destroy&&this.destroy(),void this.emit("error",t);this.fd=e,this.emit("open",e)}.bind(this))},Ft.prototype._write=function(t,e,r){if(!(t instanceof d.Buffer))return this.emit("error",new Error("Invalid data"));if("number"!=typeof this.fd)return this.once("open",(function(){this._write(t,e,r)}));var n=this;this._vol.write(this.fd,t,0,t.length,this.pos,(function(t,e){if(t)return n.autoClose&&n.destroy&&n.destroy(),r(t);n.bytesWritten+=e,r()})),void 0!==this.pos&&(this.pos+=t.length)},Ft.prototype._writev=function(t,e){if("number"!=typeof this.fd)return this.once("open",(function(){this._writev(t,e)}));for(var r=this,n=t.length,i=new Array(n),o=0,a=0;a<n;a++){var s=t[a].chunk;i[a]=s,o+=s.length}var u=d.Buffer.concat(i);this._vol.write(this.fd,u,0,u.length,this.pos,(function(t,n){if(t)return r.destroy&&r.destroy(),e(t);r.bytesWritten+=n,e()})),void 0!==this.pos&&(this.pos+=o)},Ft.prototype._destroy=Bt.prototype._destroy,Ft.prototype.close=Bt.prototype.close,Ft.prototype.destroySoon=Ft.prototype.end;var Pt=function(t){function e(e){var r=t.call(this)||this;return r._filename="",r._filenameEncoded="",r._recursive=!1,r._encoding=_.ENCODING_UTF8,r._onNodeChange=function(){r._emit("change")},r._onParentChild=function(t){t.getName()===r._getName()&&r._emit("rename")},r._emit=function(t){r.emit("change",t,r._filenameEncoded)},r._persist=function(){r._timer=setTimeout(r._persist,1e6)},r._vol=e,r}return i(e,t),e.prototype._getName=function(){return this._steps[this._steps.length-1]},e.prototype.start=function(t,e,r,n){void 0===e&&(e=!0),void 0===r&&(r=!1),void 0===n&&(n=_.ENCODING_UTF8),this._filename=bt(t),this._steps=Et(this._filename),this._filenameEncoded=_.strToEncoding(this._filename),this._recursive=r,this._encoding=n;try{this._link=this._vol.getLinkOrThrow(this._filename,"FSWatcher")}catch(t){var i=new Error("watch "+this._filename+" "+t.code);throw i.code=t.code,i.errno=t.code,i}this._link.getNode().on("change",this._onNodeChange),this._link.on("child:add",this._onNodeChange),this._link.on("child:delete",this._onNodeChange);var o=this._link.parent;o&&(o.setMaxListeners(o.getMaxListeners()+1),o.on("child:delete",this._onParentChild)),e&&this._persist()},e.prototype.close=function(){clearTimeout(this._timer),this._link.getNode().removeListener("change",this._onNodeChange);var t=this._link.parent;t&&t.removeListener("child:delete",this._onParentChild)},e}(b.EventEmitter);e.FSWatcher=Pt},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var o=r(152),a=r(111),s=r(82),u=r(54),c=r(110),l=s.constants.S_IFMT,f=s.constants.S_IFDIR,d=s.constants.S_IFREG,h=s.constants.S_IFLNK,g=s.constants.O_APPEND;e.SEP="/";var p=function(t){function e(e,r){void 0===r&&(r=438);var n=t.call(this)||this;return n.uid=o.default.getuid(),n.gid=o.default.getgid(),n.atime=new Date,n.mtime=new Date,n.ctime=new Date,n.perm=438,n.mode=d,n.nlink=1,n.perm=r,n.mode|=r,n.ino=e,n}return i(e,t),e.prototype.getString=function(t){return void 0===t&&(t="utf8"),this.getBuffer().toString(t)},e.prototype.setString=function(t){this.buf=a.bufferFrom(t,"utf8"),this.touch()},e.prototype.getBuffer=function(){return this.buf||this.setBuffer(a.bufferAllocUnsafe(0)),a.bufferFrom(this.buf)},e.prototype.setBuffer=function(t){this.buf=a.bufferFrom(t),this.touch()},e.prototype.getSize=function(){return this.buf?this.buf.length:0},e.prototype.setModeProperty=function(t){this.mode=this.mode&~l|t},e.prototype.setIsFile=function(){this.setModeProperty(d)},e.prototype.setIsDirectory=function(){this.setModeProperty(f)},e.prototype.setIsSymlink=function(){this.setModeProperty(h)},e.prototype.isFile=function(){return(this.mode&l)===d},e.prototype.isDirectory=function(){return(this.mode&l)===f},e.prototype.isSymlink=function(){return(this.mode&l)===h},e.prototype.makeSymlink=function(t){this.symlink=t,this.setIsSymlink()},e.prototype.write=function(t,e,r,n){if(void 0===e&&(e=0),void 0===r&&(r=t.length),void 0===n&&(n=0),this.buf||(this.buf=a.bufferAllocUnsafe(0)),n+r>this.buf.length){var i=a.bufferAllocUnsafe(n+r);this.buf.copy(i,0,0,this.buf.length),this.buf=i}return t.copy(this.buf,n,e,e+r),this.touch(),r},e.prototype.read=function(t,e,r,n){void 0===e&&(e=0),void 0===r&&(r=t.byteLength),void 0===n&&(n=0),this.buf||(this.buf=a.bufferAllocUnsafe(0));var i=r;return i>t.byteLength&&(i=t.byteLength),i+n>this.buf.length&&(i=this.buf.length-n),this.buf.copy(t,e,n,n+i),i},e.prototype.truncate=function(t){if(void 0===t&&(t=0),t)if(this.buf||(this.buf=a.bufferAllocUnsafe(0)),t<=this.buf.length)this.buf=this.buf.slice(0,t);else{var e=a.bufferAllocUnsafe(0);this.buf.copy(e),e.fill(0,t)}else this.buf=a.bufferAllocUnsafe(0);this.touch()},e.prototype.chmod=function(t){this.perm=t,this.mode=-512&this.mode|t,this.touch()},e.prototype.chown=function(t,e){this.uid=t,this.gid=e,this.touch()},e.prototype.touch=function(){this.mtime=new Date,this.emit("change",this)},e.prototype.canRead=function(t,e){return void 0===t&&(t=o.default.getuid()),void 0===e&&(e=o.default.getgid()),!!(4&this.perm)||(!!(e===this.gid&&32&this.perm)||!!(t===this.uid&&256&this.perm))},e.prototype.canWrite=function(t,e){return void 0===t&&(t=o.default.getuid()),void 0===e&&(e=o.default.getgid()),!!(2&this.perm)||(!!(e===this.gid&&16&this.perm)||!!(t===this.uid&&128&this.perm))},e.prototype.del=function(){this.emit("delete",this)},e.prototype.toJSON=function(){return{ino:this.ino,uid:this.uid,gid:this.gid,atime:this.atime.getTime(),mtime:this.mtime.getTime(),ctime:this.ctime.getTime(),perm:this.perm,mode:this.mode,nlink:this.nlink,symlink:this.symlink,data:this.getString()}},e}(u.EventEmitter);e.Node=p;var m=function(t){function r(e,r,n){var i=t.call(this)||this;return i.children={},i.steps=[],i.ino=0,i.length=0,i.vol=e,i.parent=r,i.steps=r?r.steps.concat([n]):[n],i}return i(r,t),r.prototype.setNode=function(t){this.node=t,this.ino=t.ino},r.prototype.getNode=function(){return this.node},r.prototype.createChild=function(t,e){void 0===e&&(e=this.vol.createNode());var n=new r(this.vol,this,t);return n.setNode(e),e.isDirectory(),this.setChild(t,n),n},r.prototype.setChild=function(t,e){return void 0===e&&(e=new r(this.vol,this,t)),this.children[t]=e,e.parent=this,this.length++,this.emit("child:add",e,this),e},r.prototype.deleteChild=function(t){delete this.children[t.getName()],this.length--,this.emit("child:delete",t,this)},r.prototype.getChild=function(t){if(Object.hasOwnProperty.call(this.children,t))return this.children[t]},r.prototype.getPath=function(){return this.steps.join(e.SEP)},r.prototype.getName=function(){return this.steps[this.steps.length-1]},r.prototype.walk=function(t,e,r){if(void 0===e&&(e=t.length),void 0===r&&(r=0),r>=t.length)return this;if(r>=e)return this;var n=t[r],i=this.getChild(n);return i?i.walk(t,e,r+1):null},r.prototype.toJSON=function(){return{steps:this.steps,ino:this.ino,children:Object.keys(this.children)}},r}(u.EventEmitter);e.Link=m;var y=function(){function t(t,e,r,n){this.position=0,this.link=t,this.node=e,this.flags=r,this.fd=n}return t.prototype.getString=function(t){return void 0===t&&(t="utf8"),this.node.getString()},t.prototype.setString=function(t){this.node.setString(t)},t.prototype.getBuffer=function(){return this.node.getBuffer()},t.prototype.setBuffer=function(t){this.node.setBuffer(t)},t.prototype.getSize=function(){return this.node.getSize()},t.prototype.truncate=function(t){this.node.truncate(t)},t.prototype.seekTo=function(t){this.position=t},t.prototype.stats=function(){return c.default.build(this.node)},t.prototype.write=function(t,e,r,n){void 0===e&&(e=0),void 0===r&&(r=t.length),"number"!=typeof n&&(n=this.position),this.flags&g&&(n=this.getSize());var i=this.node.write(t,e,r,n);return this.position=n+i,i},t.prototype.read=function(t,e,r,n){void 0===e&&(e=0),void 0===r&&(r=t.byteLength),"number"!=typeof n&&(n=this.position);var i=this.node.read(t,e,r,n);return this.position=n+i,i},t.prototype.chmod=function(t){this.node.chmod(t)},t.prototype.chown=function(t,e){this.node.chown(t,e)},t}();e.File=y},function(t,e,r){(function(t,e){!function(t,r){"use strict";if(!t.setImmediate){var n,i,o,a,s,u=1,c={},l=!1,f=t.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(t);d=d&&d.setTimeout?d:t,"[object process]"==={}.toString.call(t.process)?n=function(t){e.nextTick((function(){g(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=r,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){g(t.data)},n=function(t){o.port2.postMessage(t)}):f&&"onreadystatechange"in f.createElement("script")?(i=f.documentElement,n=function(t){var e=f.createElement("script");e.onreadystatechange=function(){g(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):n=function(t){setTimeout(g,0,t)}:(a="setImmediate$"+Math.random()+"$",s=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(a)&&g(+e.data.slice(a.length))},t.addEventListener?t.addEventListener("message",s,!1):t.attachEvent("onmessage",s),n=function(e){t.postMessage(a+e,"*")}),d.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),r=0;r<e.length;r++)e[r]=arguments[r+1];var i={callback:t,args:e};return c[u]=i,n(u),u++},d.clearImmediate=h}function h(t){delete c[t]}function g(t){if(l)setTimeout(g,0,t);else{var e=c[t];if(e){l=!0;try{!function(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(void 0,r)}}(e)}finally{h(t),l=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,r(33),r(25))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,r){var n=setTimeout.apply(null,arguments);return n&&"object"==typeof n&&"function"==typeof n.unref&&n.unref(),n}},function(t,e){},function(t,e,r){"use strict";var n=r(114).Buffer,i=r(268);t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var e,r,i,o=n.allocUnsafe(t>>>0),a=this.head,s=0;a;)e=a.data,r=o,i=s,e.copy(r,i),s+=a.data.length,a=a.next;return o},t}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,r){"use strict";t.exports=o;var n=r(157),i=Object.create(r(83));function o(t){if(!(this instanceof o))return new o(t);n.call(this,t)}i.inherits=r(12),i.inherits(o,n),o.prototype._transform=function(t,e,r){r(null,t)}},function(t,e,r){t.exports=r(115)},function(t,e,r){t.exports=r(64)},function(t,e,r){t.exports=r(113).Transform},function(t,e,r){t.exports=r(113).PassThrough},function(t,e,r){"use strict";var n=this&&this.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),i=0;for(e=0;e<r;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)n[i]=o[a];return n};function i(t,e,r){return void 0===r&&(r=function(t){return t}),function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return new Promise((function(o,a){t[e].bind(t).apply(void 0,n(i,[function(t,e){return t?a(t):o(r(e))}]))}))}}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){this.vol=t,this.fd=e}return t.prototype.appendFile=function(t,e){return i(this.vol,"appendFile")(this.fd,t,e)},t.prototype.chmod=function(t){return i(this.vol,"fchmod")(this.fd,t)},t.prototype.chown=function(t,e){return i(this.vol,"fchown")(this.fd,t,e)},t.prototype.close=function(){return i(this.vol,"close")(this.fd)},t.prototype.datasync=function(){return i(this.vol,"fdatasync")(this.fd)},t.prototype.read=function(t,e,r,n){return i(this.vol,"read",(function(e){return{bytesRead:e,buffer:t}}))(this.fd,t,e,r,n)},t.prototype.readFile=function(t){return i(this.vol,"readFile")(this.fd,t)},t.prototype.stat=function(t){return i(this.vol,"fstat")(this.fd,t)},t.prototype.sync=function(){return i(this.vol,"fsync")(this.fd)},t.prototype.truncate=function(t){return i(this.vol,"ftruncate")(this.fd,t)},t.prototype.utimes=function(t,e){return i(this.vol,"futimes")(this.fd,t,e)},t.prototype.write=function(t,e,r,n){return i(this.vol,"write",(function(e){return{bytesWritten:e,buffer:t}}))(this.fd,t,e,r,n)},t.prototype.writeFile=function(t,e){return i(this.vol,"writeFile")(this.fd,t,e)},t}();e.FileHandle=o,e.default=function(t){return"undefined"==typeof Promise?null:{FileHandle:o,access:function(e,r){return i(t,"access")(e,r)},appendFile:function(e,r,n){return i(t,"appendFile")(e instanceof o?e.fd:e,r,n)},chmod:function(e,r){return i(t,"chmod")(e,r)},chown:function(e,r,n){return i(t,"chown")(e,r,n)},copyFile:function(e,r,n){return i(t,"copyFile")(e,r,n)},lchmod:function(e,r){return i(t,"lchmod")(e,r)},lchown:function(e,r,n){return i(t,"lchown")(e,r,n)},link:function(e,r){return i(t,"link")(e,r)},lstat:function(e,r){return i(t,"lstat")(e,r)},mkdir:function(e,r){return i(t,"mkdir")(e,r)},mkdtemp:function(e,r){return i(t,"mkdtemp")(e,r)},open:function(e,r,n){return i(t,"open",(function(e){return new o(t,e)}))(e,r,n)},readdir:function(e,r){return i(t,"readdir")(e,r)},readFile:function(e,r){return i(t,"readFile")(e instanceof o?e.fd:e,r)},readlink:function(e,r){return i(t,"readlink")(e,r)},realpath:function(e,r){return i(t,"realpath")(e,r)},rename:function(e,r){return i(t,"rename")(e,r)},rmdir:function(e){return i(t,"rmdir")(e)},stat:function(e,r){return i(t,"stat")(e,r)},symlink:function(e,r,n){return i(t,"symlink")(e,r,n)},truncate:function(e,r){return i(t,"truncate")(e,r)},unlink:function(e){return i(t,"unlink")(e)},utimes:function(e,r,n){return i(t,"utimes")(e,r,n)},writeFile:function(e,r,n){return i(t,"writeFile")(e instanceof o?e.fd:e,r,n)}}}},function(t,e,r){"use strict";var n=r(276),i=r(277);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}e.parse=_,e.resolve=function(t,e){return _(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?_(t,!1,!0).resolveObject(e):e},e.format=function(t){i.isString(t)&&(t=_(t));return t instanceof o?t.format():o.prototype.format.call(t)},e.Url=o;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),f=["%","/","?",";","#"].concat(l),d=["/","?","#"],h=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,p={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},y={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},b=r(278);function _(t,e,r){if(t&&i.isObject(t)&&t instanceof o)return t;var n=new o;return n.parse(t,e,r),n}o.prototype.parse=function(t,e,r){if(!i.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t.indexOf("?"),s=-1!==o&&o<t.indexOf("#")?"?":"#",c=t.split(s);c[0]=c[0].replace(/\\/g,"/");var _=t=c.join(s);if(_=_.trim(),!r&&1===t.split("#").length){var v=u.exec(_);if(v)return this.path=_,this.href=_,this.pathname=v[1],v[2]?(this.search=v[2],this.query=e?b.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var w=a.exec(_);if(w){var E=(w=w[0]).toLowerCase();this.protocol=E,_=_.substr(w.length)}if(r||w||_.match(/^\/\/[^@\/]+@[^@\/]+/)){var S="//"===_.substr(0,2);!S||w&&m[w]||(_=_.substr(2),this.slashes=!0)}if(!m[w]&&(S||w&&!y[w])){for(var O,T,A=-1,M=0;M<d.length;M++){-1!==(I=_.indexOf(d[M]))&&(-1===A||I<A)&&(A=I)}-1!==(T=-1===A?_.lastIndexOf("@"):_.lastIndexOf("@",A))&&(O=_.slice(0,T),_=_.slice(T+1),this.auth=decodeURIComponent(O)),A=-1;for(M=0;M<f.length;M++){var I;-1!==(I=_.indexOf(f[M]))&&(-1===A||I<A)&&(A=I)}-1===A&&(A=_.length),this.host=_.slice(0,A),_=_.slice(A),this.parseHost(),this.hostname=this.hostname||"";var R="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!R)for(var N=this.hostname.split(/\./),k=(M=0,N.length);M<k;M++){var D=N[M];if(D&&!D.match(h)){for(var j="",C=0,L=D.length;C<L;C++)D.charCodeAt(C)>127?j+="x":j+=D[C];if(!j.match(h)){var x=N.slice(0,M),B=N.slice(M+1),U=D.match(g);U&&(x.push(U[1]),B.unshift(U[2])),B.length&&(_="/"+B.join(".")+_),this.hostname=x.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),R||(this.hostname=n.toASCII(this.hostname));var F=this.port?":"+this.port:"",P=this.hostname||"";this.host=P+F,this.href+=this.host,R&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==_[0]&&(_="/"+_))}if(!p[E])for(M=0,k=l.length;M<k;M++){var W=l[M];if(-1!==_.indexOf(W)){var z=encodeURIComponent(W);z===W&&(z=escape(W)),_=_.split(W).join(z)}}var H=_.indexOf("#");-1!==H&&(this.hash=_.substr(H),_=_.slice(0,H));var q=_.indexOf("?");if(-1!==q?(this.search=_.substr(q),this.query=_.substr(q+1),e&&(this.query=b.parse(this.query)),_=_.slice(0,q)):e&&(this.search="",this.query={}),_&&(this.pathname=_),y[E]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){F=this.pathname||"";var V=this.search||"";this.path=F+V}return this.href=this.format(),this},o.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",n=this.hash||"",o=!1,a="";this.host?o=t+this.host:this.hostname&&(o=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(a=b.stringify(this.query));var s=this.search||a&&"?"+a||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||y[e])&&!1!==o?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),n&&"#"!==n.charAt(0)&&(n="#"+n),s&&"?"!==s.charAt(0)&&(s="?"+s),e+o+(r=r.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(s=s.replace("#","%23"))+n},o.prototype.resolve=function(t){return this.resolveObject(_(t,!1,!0)).format()},o.prototype.resolveObject=function(t){if(i.isString(t)){var e=new o;e.parse(t,!1,!0),t=e}for(var r=new o,n=Object.keys(this),a=0;a<n.length;a++){var s=n[a];r[s]=this[s]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var u=Object.keys(t),c=0;c<u.length;c++){var l=u[c];"protocol"!==l&&(r[l]=t[l])}return y[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!y[t.protocol]){for(var f=Object.keys(t),d=0;d<f.length;d++){var h=f[d];r[h]=t[h]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||m[t.protocol])r.pathname=t.pathname;else{for(var g=(t.pathname||"").split("/");g.length&&!(t.host=g.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==g[0]&&g.unshift(""),g.length<2&&g.unshift(""),r.pathname=g.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var p=r.pathname||"",b=r.search||"";r.path=p+b}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var _=r.pathname&&"/"===r.pathname.charAt(0),v=t.host||t.pathname&&"/"===t.pathname.charAt(0),w=v||_||r.host&&t.pathname,E=w,S=r.pathname&&r.pathname.split("/")||[],O=(g=t.pathname&&t.pathname.split("/")||[],r.protocol&&!y[r.protocol]);if(O&&(r.hostname="",r.port=null,r.host&&(""===S[0]?S[0]=r.host:S.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===g[0]?g[0]=t.host:g.unshift(t.host)),t.host=null),w=w&&(""===g[0]||""===S[0])),v)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,S=g;else if(g.length)S||(S=[]),S.pop(),S=S.concat(g),r.search=t.search,r.query=t.query;else if(!i.isNullOrUndefined(t.search)){if(O)r.hostname=r.host=S.shift(),(R=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=R.shift(),r.host=r.hostname=R.shift());return r.search=t.search,r.query=t.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!S.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var T=S.slice(-1)[0],A=(r.host||t.host||S.length>1)&&("."===T||".."===T)||""===T,M=0,I=S.length;I>=0;I--)"."===(T=S[I])?S.splice(I,1):".."===T?(S.splice(I,1),M++):M&&(S.splice(I,1),M--);if(!w&&!E)for(;M--;M)S.unshift("..");!w||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),A&&"/"!==S.join("/").substr(-1)&&S.push("");var R,N=""===S[0]||S[0]&&"/"===S[0].charAt(0);O&&(r.hostname=r.host=N?"":S.length?S.shift():"",(R=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=R.shift(),r.host=r.hostname=R.shift()));return(w=w||r.host&&S.length)&&!N&&S.unshift(""),S.length?r.pathname=S.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var t=this.host,e=s.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,r){(function(t,n){var i;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(o){e&&e.nodeType,t&&t.nodeType;var a="object"==typeof n&&n;a.global!==a&&a.window!==a&&a.self;var s,u=2147483647,c=/^xn--/,l=/[^\x20-\x7E]/,f=/[\x2E\u3002\uFF0E\uFF61]/g,d={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},h=Math.floor,g=String.fromCharCode;function p(t){throw new RangeError(d[t])}function m(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function y(t,e){var r=t.split("@"),n="";return r.length>1&&(n=r[0]+"@",t=r[1]),n+m((t=t.replace(f,".")).split("."),e).join(".")}function b(t){for(var e,r,n=[],i=0,o=t.length;i<o;)(e=t.charCodeAt(i++))>=55296&&e<=56319&&i<o?56320==(64512&(r=t.charCodeAt(i++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),i--):n.push(e);return n}function _(t){return m(t,(function(t){var e="";return t>65535&&(e+=g((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=g(t)})).join("")}function v(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function w(t,e,r){var n=0;for(t=r?h(t/700):t>>1,t+=h(t/e);t>455;n+=36)t=h(t/35);return h(n+36*t/(t+38))}function E(t){var e,r,n,i,o,a,s,c,l,f,d,g=[],m=t.length,y=0,b=128,v=72;for((r=t.lastIndexOf("-"))<0&&(r=0),n=0;n<r;++n)t.charCodeAt(n)>=128&&p("not-basic"),g.push(t.charCodeAt(n));for(i=r>0?r+1:0;i<m;){for(o=y,a=1,s=36;i>=m&&p("invalid-input"),((c=(d=t.charCodeAt(i++))-48<10?d-22:d-65<26?d-65:d-97<26?d-97:36)>=36||c>h((u-y)/a))&&p("overflow"),y+=c*a,!(c<(l=s<=v?1:s>=v+26?26:s-v));s+=36)a>h(u/(f=36-l))&&p("overflow"),a*=f;v=w(y-o,e=g.length+1,0==o),h(y/e)>u-b&&p("overflow"),b+=h(y/e),y%=e,g.splice(y++,0,b)}return _(g)}function S(t){var e,r,n,i,o,a,s,c,l,f,d,m,y,_,E,S=[];for(m=(t=b(t)).length,e=128,r=0,o=72,a=0;a<m;++a)(d=t[a])<128&&S.push(g(d));for(n=i=S.length,i&&S.push("-");n<m;){for(s=u,a=0;a<m;++a)(d=t[a])>=e&&d<s&&(s=d);for(s-e>h((u-r)/(y=n+1))&&p("overflow"),r+=(s-e)*y,e=s,a=0;a<m;++a)if((d=t[a])<e&&++r>u&&p("overflow"),d==e){for(c=r,l=36;!(c<(f=l<=o?1:l>=o+26?26:l-o));l+=36)E=c-f,_=36-f,S.push(g(v(f+E%_,0))),c=h(E/_);S.push(g(v(c,0))),o=w(r,y,n==i),r=0,++n}++r,++e}return S.join("")}s={version:"1.4.1",ucs2:{decode:b,encode:_},decode:E,encode:S,toASCII:function(t){return y(t,(function(t){return l.test(t)?"xn--"+S(t):t}))},toUnicode:function(t){return y(t,(function(t){return c.test(t)?E(t.slice(4).toLowerCase()):t}))}},void 0===(i=function(){return s}.call(e,r,e,t))||(t.exports=i)}()}).call(this,r(84)(t),r(33))},function(t,e,r){"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e,r){"use strict";e.decode=e.parse=r(279),e.encode=e.stringify=r(280)},function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,r,o){e=e||"&",r=r||"=";var a={};if("string"!=typeof t||0===t.length)return a;var s=/\+/g;t=t.split(e);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=t.length;u>0&&c>u&&(c=u);for(var l=0;l<c;++l){var f,d,h,g,p=t[l].replace(s,"%20"),m=p.indexOf(r);m>=0?(f=p.substr(0,m),d=p.substr(m+1)):(f=p,d=""),h=decodeURIComponent(f),g=decodeURIComponent(d),n(a,h)?i(a[h])?a[h].push(g):a[h]=[a[h],g]:a[h]=g}return a};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,r){"use strict";var n=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,r,s){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?o(a(t),(function(a){var s=encodeURIComponent(n(a))+r;return i(t[a])?o(t[a],(function(t){return s+encodeURIComponent(n(t))})).join(e):s+encodeURIComponent(n(t[a]))})).join(e):s?encodeURIComponent(n(s))+r+encodeURIComponent(n(t)):""};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function o(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n<t.length;n++)r.push(e(t[n],n));return r}var a=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return e}},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.unixify=o,e.correctPath=function(t){return o(t.replace(/^\\\\\?\\.:\\/,"\\"))};var r="win32"===t.platform;function n(t,e){var n=t[e];return e>0&&("/"===n||r&&"\\"===n)}function i(t,e){if("string"!=typeof t)throw new TypeError("expected a string");return t=t.replace(/[\\\/]+/g,"/"),!1!==e&&(t=function(t){var e=t.length-1;if(e<2)return t;for(;n(t,e);)e--;return t.substr(0,e+1)}(t)),t}function o(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return r?(t=i(t,e)).replace(/^([a-zA-Z]+:|\.\/)/,""):t}}).call(this,r(25))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.fsProps=["constants","F_OK","R_OK","W_OK","X_OK","Stats"],e.fsSyncMethods=["renameSync","ftruncateSync","truncateSync","chownSync","fchownSync","lchownSync","chmodSync","fchmodSync","lchmodSync","statSync","lstatSync","fstatSync","linkSync","symlinkSync","readlinkSync","realpathSync","unlinkSync","rmdirSync","mkdirSync","mkdirpSync","readdirSync","closeSync","openSync","utimesSync","futimesSync","fsyncSync","writeSync","readSync","readFileSync","writeFileSync","appendFileSync","existsSync","accessSync","fdatasyncSync","mkdtempSync","copyFileSync","createReadStream","createWriteStream"],e.fsAsyncMethods=["rename","ftruncate","truncate","chown","fchown","lchown","chmod","fchmod","lchmod","stat","lstat","fstat","link","symlink","readlink","realpath","unlink","rmdir","mkdir","mkdirp","readdir","close","open","utimes","futimes","fsync","write","read","readFile","writeFile","appendFile","exists","access","fdatasync","mkdtemp","copyFile","watchFile","unwatchFile","watch"]},function(t,e){t.exports={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed",FILE_IN_THE_WAY:"There is a file in the way: %s",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:"File not found: %s",NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found"}},function(t,e,r){const n=r(148).require(),i=r(43);n.existsSync=n.existsSync||i.existsSync,t.exports=function(t){var e=t||"",r={directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0},o=null;return e&&n.existsSync(e)?(o=n.statSync(e),r.directory=o.isDirectory(),r.mtime=o.mtime,r.atime=o.atime,r.executable=0!=(73&o.mode),r.readonly=0==(128&o.mode),r.hidden="."===i.basename(e)[0]):console.warn("Invalid path: "+e),{get directory(){return r.directory},get readOnly(){return r.readonly},get hidden(){return r.hidden},get mtime(){return r.mtime},get atime(){return r.atime},get executable(){return r.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:e,isDirectory:r.directory,isReadOnly:r.readonly,isHidden:r.hidden,isExecutable:r.executable,mTime:r.mtime,aTime:r.atime}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}},function(t,e,r){(function(e){var n=r(81),i=n.Constants;t.exports=function(){var t=20,r=10,o=0,a=0,s=0,u=0,c=0,l=0,f=0,d=0,h=0,g=0,p=0,m=0,y=0;t|=n.isWin?2560:768,o|=i.FLG_EFS;var b={};function _(t){t=new Date(t),s=(t.getFullYear()-1980&127)<<25|t.getMonth()+1<<21|t.getDate()<<16|t.getHours()<<11|t.getMinutes()<<5|t.getSeconds()>>1}return _(+new Date),{get made(){return t},set made(e){t=e},get version(){return r},set version(t){r=t},get flags(){return o},set flags(t){o=t},get method(){return a},set method(t){switch(t){case i.STORED:this.version=10;case i.DEFLATED:default:this.version=20}a=t},get time(){return new Date(1980+(s>>25&127),(s>>21&15)-1,s>>16&31,s>>11&31,s>>5&63,(31&s)<<1)},set time(t){_(t)},get crc(){return u},set crc(t){u=Math.max(0,t)>>>0},get compressedSize(){return c},set compressedSize(t){c=Math.max(0,t)>>>0},get size(){return l},set size(t){l=Math.max(0,t)>>>0},get fileNameLength(){return f},set fileNameLength(t){f=t},get extraLength(){return d},set extraLength(t){d=t},get commentLength(){return h},set commentLength(t){h=t},get diskNumStart(){return g},set diskNumStart(t){g=Math.max(0,t)>>>0},get inAttr(){return p},set inAttr(t){p=Math.max(0,t)>>>0},get attr(){return m},set attr(t){m=Math.max(0,t)>>>0},get fileAttr(){return m?(m>>>0|0)>>16&4095:0},get offset(){return y},set offset(t){y=Math.max(0,t)>>>0},get encripted(){return 1==(1&o)},get entryHeaderSize(){return i.CENHDR+f+d+h},get realDataOffset(){return y+i.LOCHDR+b.fnameLen+b.extraLen},get dataHeader(){return b},loadDataHeaderFromBinary:function(t){var e=t.slice(y,y+i.LOCHDR);if(e.readUInt32LE(0)!==i.LOCSIG)throw new Error(n.Errors.INVALID_LOC);b={version:e.readUInt16LE(i.LOCVER),flags:e.readUInt16LE(i.LOCFLG),method:e.readUInt16LE(i.LOCHOW),time:e.readUInt32LE(i.LOCTIM),crc:e.readUInt32LE(i.LOCCRC),compressedSize:e.readUInt32LE(i.LOCSIZ),size:e.readUInt32LE(i.LOCLEN),fnameLen:e.readUInt16LE(i.LOCNAM),extraLen:e.readUInt16LE(i.LOCEXT)}},loadFromBinary:function(e){if(e.length!==i.CENHDR||e.readUInt32LE(0)!==i.CENSIG)throw new Error(n.Errors.INVALID_CEN);t=e.readUInt16LE(i.CENVEM),r=e.readUInt16LE(i.CENVER),o=e.readUInt16LE(i.CENFLG),a=e.readUInt16LE(i.CENHOW),s=e.readUInt32LE(i.CENTIM),u=e.readUInt32LE(i.CENCRC),c=e.readUInt32LE(i.CENSIZ),l=e.readUInt32LE(i.CENLEN),f=e.readUInt16LE(i.CENNAM),d=e.readUInt16LE(i.CENEXT),h=e.readUInt16LE(i.CENCOM),g=e.readUInt16LE(i.CENDSK),p=e.readUInt16LE(i.CENATT),m=e.readUInt32LE(i.CENATX),y=e.readUInt32LE(i.CENOFF)},dataHeaderToBinary:function(){var t=e.alloc(i.LOCHDR);return t.writeUInt32LE(i.LOCSIG,0),t.writeUInt16LE(r,i.LOCVER),t.writeUInt16LE(o,i.LOCFLG),t.writeUInt16LE(a,i.LOCHOW),t.writeUInt32LE(s,i.LOCTIM),t.writeUInt32LE(u,i.LOCCRC),t.writeUInt32LE(c,i.LOCSIZ),t.writeUInt32LE(l,i.LOCLEN),t.writeUInt16LE(f,i.LOCNAM),t.writeUInt16LE(d,i.LOCEXT),t},entryHeaderToBinary:function(){var n=e.alloc(i.CENHDR+f+d+h);return n.writeUInt32LE(i.CENSIG,0),n.writeUInt16LE(t,i.CENVEM),n.writeUInt16LE(r,i.CENVER),n.writeUInt16LE(o,i.CENFLG),n.writeUInt16LE(a,i.CENHOW),n.writeUInt32LE(s,i.CENTIM),n.writeUInt32LE(u,i.CENCRC),n.writeUInt32LE(c,i.CENSIZ),n.writeUInt32LE(l,i.CENLEN),n.writeUInt16LE(f,i.CENNAM),n.writeUInt16LE(d,i.CENEXT),n.writeUInt16LE(h,i.CENCOM),n.writeUInt16LE(g,i.CENDSK),n.writeUInt16LE(p,i.CENATT),n.writeUInt32LE(m,i.CENATX),n.writeUInt32LE(y,i.CENOFF),n.fill(0,i.CENHDR),n},toJSON:function(){const e=function(t){return t+" bytes"};return{made:t,version:r,flags:o,method:n.methodToString(a),time:this.time,crc:"0x"+u.toString(16).toUpperCase(),compressedSize:e(c),size:e(l),fileNameLength:e(f),extraLength:e(d),commentLength:e(h),diskNumStart:g,inAttr:p,attr:m,offset:y,entryHeaderSize:e(i.CENHDR+f+d+h)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}).call(this,r(16).Buffer)},function(t,e,r){(function(e){var n=r(81),i=n.Constants;t.exports=function(){var t=0,r=0,o=0,a=0,s=0;return{get diskEntries(){return t},set diskEntries(e){t=r=e},get totalEntries(){return r},set totalEntries(e){r=t=e},get size(){return o},set size(t){o=t},get offset(){return a},set offset(t){a=t},get commentLength(){return s},set commentLength(t){s=t},get mainHeaderSize(){return i.ENDHDR+s},loadFromBinary:function(e){if((e.length!==i.ENDHDR||e.readUInt32LE(0)!==i.ENDSIG)&&(e.length<i.ZIP64HDR||e.readUInt32LE(0)!==i.ZIP64SIG))throw new Error(n.Errors.INVALID_END);e.readUInt32LE(0)===i.ENDSIG?(t=e.readUInt16LE(i.ENDSUB),r=e.readUInt16LE(i.ENDTOT),o=e.readUInt32LE(i.ENDSIZ),a=e.readUInt32LE(i.ENDOFF),s=e.readUInt16LE(i.ENDCOM)):(t=n.readBigUInt64LE(e,i.ZIP64SUB),r=n.readBigUInt64LE(e,i.ZIP64TOT),o=n.readBigUInt64LE(e,i.ZIP64SIZ),a=n.readBigUInt64LE(e,i.ZIP64OFF),s=0)},toBinary:function(){var n=e.alloc(i.ENDHDR+s);return n.writeUInt32LE(i.ENDSIG,0),n.writeUInt32LE(0,4),n.writeUInt16LE(t,i.ENDSUB),n.writeUInt16LE(r,i.ENDTOT),n.writeUInt32LE(o,i.ENDSIZ),n.writeUInt32LE(a,i.ENDOFF),n.writeUInt16LE(s,i.ENDCOM),n.fill(" ",i.ENDHDR),n},toJSON:function(){return{diskEntries:t,totalEntries:r,size:o+" bytes",offset:function(t,e){let r=t.toString(16).toUpperCase();for(;r.length<e;)r="0"+r;return"0x"+r}(a,4),commentLength:s}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}).call(this,r(16).Buffer)},function(t,e,r){e.Deflater=r(288),e.Inflater=r(298),e.ZipCrypto=r(299)},function(t,e,r){(function(e){t.exports=function(t){var n=r(161),i={chunkSize:1024*(parseInt(t.length/1024)+1)};return{deflate:function(){return n.deflateRawSync(t,i)},deflateAsync:function(r){var o=n.createDeflateRaw(i),a=[],s=0;o.on("data",(function(t){a.push(t),s+=t.length})),o.on("end",(function(){var t=e.alloc(s),n=0;t.fill(0);for(var i=0;i<a.length;i++){var o=a[i];o.copy(t,n),n+=o.length}r&&r(t)})),o.end(t)}}}}).call(this,r(16).Buffer)},function(t,e,r){"use strict";(function(t,n){var i=r(112),o=r(290),a=r(291),s=r(294),u=r(297);for(var c in u)e[c]=u[c];e.NONE=0,e.DEFLATE=1,e.INFLATE=2,e.GZIP=3,e.GUNZIP=4,e.DEFLATERAW=5,e.INFLATERAW=6,e.UNZIP=7;function l(t){if("number"!=typeof t||t<e.DEFLATE||t>e.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=t,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}l.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,i(this.init_done,"close before init"),i(this.mode<=e.UNZIP),this.mode===e.DEFLATE||this.mode===e.GZIP||this.mode===e.DEFLATERAW?a.deflateEnd(this.strm):this.mode!==e.INFLATE&&this.mode!==e.GUNZIP&&this.mode!==e.INFLATERAW&&this.mode!==e.UNZIP||s.inflateEnd(this.strm),this.mode=e.NONE,this.dictionary=null)},l.prototype.write=function(t,e,r,n,i,o,a){return this._write(!0,t,e,r,n,i,o,a)},l.prototype.writeSync=function(t,e,r,n,i,o,a){return this._write(!1,t,e,r,n,i,o,a)},l.prototype._write=function(r,o,a,s,u,c,l,f){if(i.equal(arguments.length,8),i(this.init_done,"write before init"),i(this.mode!==e.NONE,"already finalized"),i.equal(!1,this.write_in_progress,"write already in progress"),i.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,i.equal(!1,void 0===o,"must provide flush value"),this.write_in_progress=!0,o!==e.Z_NO_FLUSH&&o!==e.Z_PARTIAL_FLUSH&&o!==e.Z_SYNC_FLUSH&&o!==e.Z_FULL_FLUSH&&o!==e.Z_FINISH&&o!==e.Z_BLOCK)throw new Error("Invalid flush value");if(null==a&&(a=t.alloc(0),u=0,s=0),this.strm.avail_in=u,this.strm.input=a,this.strm.next_in=s,this.strm.avail_out=f,this.strm.output=c,this.strm.next_out=l,this.flush=o,!r)return this._process(),this._checkError()?this._afterSync():void 0;var d=this;return n.nextTick((function(){d._process(),d._after()})),this},l.prototype._afterSync=function(){var t=this.strm.avail_out,e=this.strm.avail_in;return this.write_in_progress=!1,[e,t]},l.prototype._process=function(){var t=null;switch(this.mode){case e.DEFLATE:case e.GZIP:case e.DEFLATERAW:this.err=a.deflate(this.strm,this.flush);break;case e.UNZIP:switch(this.strm.avail_in>0&&(t=this.strm.next_in),this.gzip_id_bytes_read){case 0:if(null===t)break;if(31!==this.strm.input[t]){this.mode=e.INFLATE;break}if(this.gzip_id_bytes_read=1,t++,1===this.strm.avail_in)break;case 1:if(null===t)break;139===this.strm.input[t]?(this.gzip_id_bytes_read=2,this.mode=e.GUNZIP):this.mode=e.INFLATE;break;default:throw new Error("invalid number of gzip magic number bytes read")}case e.INFLATE:case e.GUNZIP:case e.INFLATERAW:for(this.err=s.inflate(this.strm,this.flush),this.err===e.Z_NEED_DICT&&this.dictionary&&(this.err=s.inflateSetDictionary(this.strm,this.dictionary),this.err===e.Z_OK?this.err=s.inflate(this.strm,this.flush):this.err===e.Z_DATA_ERROR&&(this.err=e.Z_NEED_DICT));this.strm.avail_in>0&&this.mode===e.GUNZIP&&this.err===e.Z_STREAM_END&&0!==this.strm.next_in[0];)this.reset(),this.err=s.inflate(this.strm,this.flush);break;default:throw new Error("Unknown mode "+this.mode)}},l.prototype._checkError=function(){switch(this.err){case e.Z_OK:case e.Z_BUF_ERROR:if(0!==this.strm.avail_out&&this.flush===e.Z_FINISH)return this._error("unexpected end of file"),!1;break;case e.Z_STREAM_END:break;case e.Z_NEED_DICT:return null==this.dictionary?this._error("Missing dictionary"):this._error("Bad dictionary"),!1;default:return this._error("Zlib error"),!1}return!0},l.prototype._after=function(){if(this._checkError()){var t=this.strm.avail_out,e=this.strm.avail_in;this.write_in_progress=!1,this.callback(e,t),this.pending_close&&this.close()}},l.prototype._error=function(t){this.strm.msg&&(t=this.strm.msg),this.onerror(t,this.err),this.write_in_progress=!1,this.pending_close&&this.close()},l.prototype.init=function(t,r,n,o,a){i(4===arguments.length||5===arguments.length,"init(windowBits, level, memLevel, strategy, [dictionary])"),i(t>=8&&t<=15,"invalid windowBits"),i(r>=-1&&r<=9,"invalid compression level"),i(n>=1&&n<=9,"invalid memlevel"),i(o===e.Z_FILTERED||o===e.Z_HUFFMAN_ONLY||o===e.Z_RLE||o===e.Z_FIXED||o===e.Z_DEFAULT_STRATEGY,"invalid strategy"),this._init(r,t,n,o,a),this._setDictionary()},l.prototype.params=function(){throw new Error("deflateParams Not supported")},l.prototype.reset=function(){this._reset(),this._setDictionary()},l.prototype._init=function(t,r,n,i,u){switch(this.level=t,this.windowBits=r,this.memLevel=n,this.strategy=i,this.flush=e.Z_NO_FLUSH,this.err=e.Z_OK,this.mode!==e.GZIP&&this.mode!==e.GUNZIP||(this.windowBits+=16),this.mode===e.UNZIP&&(this.windowBits+=32),this.mode!==e.DEFLATERAW&&this.mode!==e.INFLATERAW||(this.windowBits=-1*this.windowBits),this.strm=new o,this.mode){case e.DEFLATE:case e.GZIP:case e.DEFLATERAW:this.err=a.deflateInit2(this.strm,this.level,e.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case e.INFLATE:case e.GUNZIP:case e.INFLATERAW:case e.UNZIP:this.err=s.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}this.err!==e.Z_OK&&this._error("Init error"),this.dictionary=u,this.write_in_progress=!1,this.init_done=!0},l.prototype._setDictionary=function(){if(null!=this.dictionary){switch(this.err=e.Z_OK,this.mode){case e.DEFLATE:case e.DEFLATERAW:this.err=a.deflateSetDictionary(this.strm,this.dictionary)}this.err!==e.Z_OK&&this._error("Failed to set dictionary")}},l.prototype._reset=function(){switch(this.err=e.Z_OK,this.mode){case e.DEFLATE:case e.DEFLATERAW:case e.GZIP:this.err=a.deflateReset(this.strm);break;case e.INFLATE:case e.INFLATERAW:case e.GUNZIP:this.err=s.inflateReset(this.strm)}this.err!==e.Z_OK&&this._error("Failed to reset stream")},e.Zlib=l}).call(this,r(16).Buffer,r(25))},function(t,e,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},function(t,e,r){"use strict";var n,i=r(101),o=r(292),a=r(162),s=r(163),u=r(293);function c(t,e){return t.msg=u[e],e}function l(t){return(t<<1)-(t>4?9:0)}function f(t){for(var e=t.length;--e>=0;)t[e]=0}function d(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(i.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))}function h(t,e){o._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,d(t.strm)}function g(t,e){t.pending_buf[t.pending++]=e}function p(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function m(t,e){var r,n,i=t.max_chain_length,o=t.strstart,a=t.prev_length,s=t.nice_match,u=t.strstart>t.w_size-262?t.strstart-(t.w_size-262):0,c=t.window,l=t.w_mask,f=t.prev,d=t.strstart+258,h=c[o+a-1],g=c[o+a];t.prev_length>=t.good_match&&(i>>=2),s>t.lookahead&&(s=t.lookahead);do{if(c[(r=e)+a]===g&&c[r+a-1]===h&&c[r]===c[o]&&c[++r]===c[o+1]){o+=2,r++;do{}while(c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&o<d);if(n=258-(d-o),o=d-258,n>a){if(t.match_start=e,a=n,n>=s)break;h=c[o+a-1],g=c[o+a]}}}while((e=f[e&l])>u&&0!=--i);return a<=t.lookahead?a:t.lookahead}function y(t){var e,r,n,o,u,c,l,f,d,h,g=t.w_size;do{if(o=t.window_size-t.lookahead-t.strstart,t.strstart>=g+(g-262)){i.arraySet(t.window,t.window,g,g,0),t.match_start-=g,t.strstart-=g,t.block_start-=g,e=r=t.hash_size;do{n=t.head[--e],t.head[e]=n>=g?n-g:0}while(--r);e=r=g;do{n=t.prev[--e],t.prev[e]=n>=g?n-g:0}while(--r);o+=g}if(0===t.strm.avail_in)break;if(c=t.strm,l=t.window,f=t.strstart+t.lookahead,d=o,h=void 0,(h=c.avail_in)>d&&(h=d),r=0===h?0:(c.avail_in-=h,i.arraySet(l,c.input,c.next_in,h,f),1===c.state.wrap?c.adler=a(c.adler,l,h,f):2===c.state.wrap&&(c.adler=s(c.adler,l,h,f)),c.next_in+=h,c.total_in+=h,h),t.lookahead+=r,t.lookahead+t.insert>=3)for(u=t.strstart-t.insert,t.ins_h=t.window[u],t.ins_h=(t.ins_h<<t.hash_shift^t.window[u+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[u+3-1])&t.hash_mask,t.prev[u&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=u,u++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<262&&0!==t.strm.avail_in)}function b(t,e){for(var r,n;;){if(t.lookahead<262){if(y(t),t.lookahead<262&&0===e)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==r&&t.strstart-r<=t.w_size-262&&(t.match_length=m(t,r)),t.match_length>=3)if(n=o._tr_tally(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else n=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(h(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,4===e?(h(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(h(t,!1),0===t.strm.avail_out)?1:2}function _(t,e){for(var r,n,i;;){if(t.lookahead<262){if(y(t),t.lookahead<262&&0===e)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-262&&(t.match_length=m(t,r),t.match_length<=5&&(1===t.strategy||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-3,n=o._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(h(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if((n=o._tr_tally(t,0,t.window[t.strstart-1]))&&h(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=o._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,4===e?(h(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(h(t,!1),0===t.strm.avail_out)?1:2}function v(t,e,r,n,i){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=n,this.func=i}function w(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(1146),this.dyn_dtree=new i.Buf16(122),this.bl_tree=new i.Buf16(78),f(this.dyn_ltree),f(this.dyn_dtree),f(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(16),this.heap=new i.Buf16(573),f(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(573),f(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function E(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=2,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:113,t.adler=2===e.wrap?0:1,e.last_flush=0,o._tr_init(e),0):c(t,-2)}function S(t){var e,r=E(t);return 0===r&&((e=t.state).window_size=2*e.w_size,f(e.head),e.max_lazy_match=n[e.level].max_lazy,e.good_match=n[e.level].good_length,e.nice_match=n[e.level].nice_length,e.max_chain_length=n[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0),r}function O(t,e,r,n,o,a){if(!t)return-2;var s=1;if(-1===e&&(e=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),o<1||o>9||8!==r||n<8||n>15||e<0||e>9||a<0||a>4)return c(t,-2);8===n&&(n=9);var u=new w;return t.state=u,u.strm=t,u.wrap=s,u.gzhead=null,u.w_bits=n,u.w_size=1<<u.w_bits,u.w_mask=u.w_size-1,u.hash_bits=o+7,u.hash_size=1<<u.hash_bits,u.hash_mask=u.hash_size-1,u.hash_shift=~~((u.hash_bits+3-1)/3),u.window=new i.Buf8(2*u.w_size),u.head=new i.Buf16(u.hash_size),u.prev=new i.Buf16(u.w_size),u.lit_bufsize=1<<o+6,u.pending_buf_size=4*u.lit_bufsize,u.pending_buf=new i.Buf8(u.pending_buf_size),u.d_buf=1*u.lit_bufsize,u.l_buf=3*u.lit_bufsize,u.level=e,u.strategy=a,u.method=r,S(t)}n=[new v(0,0,0,0,(function(t,e){var r=65535;for(r>t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(y(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+r;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,h(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-262&&(h(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(h(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(h(t,!1),t.strm.avail_out),1)})),new v(4,4,8,4,b),new v(4,5,16,8,b),new v(4,6,32,32,b),new v(4,4,16,16,_),new v(8,16,32,32,_),new v(8,16,128,128,_),new v(8,32,128,256,_),new v(32,128,258,1024,_),new v(32,258,258,4096,_)],e.deflateInit=function(t,e){return O(t,e,8,15,8,0)},e.deflateInit2=O,e.deflateReset=S,e.deflateResetKeep=E,e.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?-2:(t.state.gzhead=e,0):-2},e.deflate=function(t,e){var r,i,a,u;if(!t||!t.state||e>5||e<0)return t?c(t,-2):-2;if(i=t.state,!t.output||!t.input&&0!==t.avail_in||666===i.status&&4!==e)return c(t,0===t.avail_out?-5:-2);if(i.strm=t,r=i.last_flush,i.last_flush=e,42===i.status)if(2===i.wrap)t.adler=0,g(i,31),g(i,139),g(i,8),i.gzhead?(g(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),g(i,255&i.gzhead.time),g(i,i.gzhead.time>>8&255),g(i,i.gzhead.time>>16&255),g(i,i.gzhead.time>>24&255),g(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),g(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(g(i,255&i.gzhead.extra.length),g(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=s(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(g(i,0),g(i,0),g(i,0),g(i,0),g(i,0),g(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),g(i,3),i.status=113);else{var m=8+(i.w_bits-8<<4)<<8;m|=(i.strategy>=2||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(m|=32),m+=31-m%31,i.status=113,p(i,m),0!==i.strstart&&(p(i,t.adler>>>16),p(i,65535&t.adler)),t.adler=1}if(69===i.status)if(i.gzhead.extra){for(a=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),d(t),a=i.pending,i.pending!==i.pending_buf_size));)g(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),d(t),a=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,g(i,u)}while(0!==u);i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),0===u&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),d(t),a=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,g(i,u)}while(0!==u);i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),0===u&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&d(t),i.pending+2<=i.pending_buf_size&&(g(i,255&t.adler),g(i,t.adler>>8&255),t.adler=0,i.status=113)):i.status=113),0!==i.pending){if(d(t),0===t.avail_out)return i.last_flush=-1,0}else if(0===t.avail_in&&l(e)<=l(r)&&4!==e)return c(t,-5);if(666===i.status&&0!==t.avail_in)return c(t,-5);if(0!==t.avail_in||0!==i.lookahead||0!==e&&666!==i.status){var b=2===i.strategy?function(t,e){for(var r;;){if(0===t.lookahead&&(y(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,r=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(h(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(h(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(h(t,!1),0===t.strm.avail_out)?1:2}(i,e):3===i.strategy?function(t,e){for(var r,n,i,a,s=t.window;;){if(t.lookahead<=258){if(y(t),t.lookahead<=258&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=s[i=t.strstart-1])===s[++i]&&n===s[++i]&&n===s[++i]){a=t.strstart+258;do{}while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&i<a);t.match_length=258-(a-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(r=o._tr_tally(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(h(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(h(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(h(t,!1),0===t.strm.avail_out)?1:2}(i,e):n[i.level].func(i,e);if(3!==b&&4!==b||(i.status=666),1===b||3===b)return 0===t.avail_out&&(i.last_flush=-1),0;if(2===b&&(1===e?o._tr_align(i):5!==e&&(o._tr_stored_block(i,0,0,!1),3===e&&(f(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),d(t),0===t.avail_out))return i.last_flush=-1,0}return 4!==e?0:i.wrap<=0?1:(2===i.wrap?(g(i,255&t.adler),g(i,t.adler>>8&255),g(i,t.adler>>16&255),g(i,t.adler>>24&255),g(i,255&t.total_in),g(i,t.total_in>>8&255),g(i,t.total_in>>16&255),g(i,t.total_in>>24&255)):(p(i,t.adler>>>16),p(i,65535&t.adler)),d(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?0:1)},e.deflateEnd=function(t){var e;return t&&t.state?42!==(e=t.state.status)&&69!==e&&73!==e&&91!==e&&103!==e&&113!==e&&666!==e?c(t,-2):(t.state=null,113===e?c(t,-3):0):-2},e.deflateSetDictionary=function(t,e){var r,n,o,s,u,c,l,d,h=e.length;if(!t||!t.state)return-2;if(2===(s=(r=t.state).wrap)||1===s&&42!==r.status||r.lookahead)return-2;for(1===s&&(t.adler=a(t.adler,e,h,0)),r.wrap=0,h>=r.w_size&&(0===s&&(f(r.head),r.strstart=0,r.block_start=0,r.insert=0),d=new i.Buf8(r.w_size),i.arraySet(d,e,h-r.w_size,r.w_size,0),e=d,h=r.w_size),u=t.avail_in,c=t.next_in,l=t.input,t.avail_in=h,t.next_in=0,t.input=e,y(r);r.lookahead>=3;){n=r.strstart,o=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+3-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++}while(--o);r.strstart=n,r.lookahead=2,y(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,t.next_in=c,t.input=l,t.avail_in=u,r.wrap=s,0},e.deflateInfo="pako deflate (from Nodeca project)"},function(t,e,r){"use strict";var n=r(101);function i(t){for(var e=t.length;--e>=0;)t[e]=0}var o=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],a=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],u=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],c=new Array(576);i(c);var l=new Array(60);i(l);var f=new Array(512);i(f);var d=new Array(256);i(d);var h=new Array(29);i(h);var g,p,m,y=new Array(30);function b(t,e,r,n,i){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=t&&t.length}function _(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function v(t){return t<256?f[t]:f[256+(t>>>7)]}function w(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function E(t,e,r){t.bi_valid>16-r?(t.bi_buf|=e<<t.bi_valid&65535,w(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=r-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)}function S(t,e,r){E(t,r[2*e],r[2*e+1])}function O(t,e){var r=0;do{r|=1&t,t>>>=1,r<<=1}while(--e>0);return r>>>1}function T(t,e,r){var n,i,o=new Array(16),a=0;for(n=1;n<=15;n++)o[n]=a=a+r[n-1]<<1;for(i=0;i<=e;i++){var s=t[2*i+1];0!==s&&(t[2*i]=O(o[s]++,s))}}function A(t){var e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function M(t){t.bi_valid>8?w(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function I(t,e,r,n){var i=2*e,o=2*r;return t[i]<t[o]||t[i]===t[o]&&n[e]<=n[r]}function R(t,e,r){for(var n=t.heap[r],i=r<<1;i<=t.heap_len&&(i<t.heap_len&&I(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!I(e,n,t.heap[i],t.depth));)t.heap[r]=t.heap[i],r=i,i<<=1;t.heap[r]=n}function N(t,e,r){var n,i,s,u,c=0;if(0!==t.last_lit)do{n=t.pending_buf[t.d_buf+2*c]<<8|t.pending_buf[t.d_buf+2*c+1],i=t.pending_buf[t.l_buf+c],c++,0===n?S(t,i,e):(S(t,(s=d[i])+256+1,e),0!==(u=o[s])&&E(t,i-=h[s],u),S(t,s=v(--n),r),0!==(u=a[s])&&E(t,n-=y[s],u))}while(c<t.last_lit);S(t,256,e)}function k(t,e){var r,n,i,o=e.dyn_tree,a=e.stat_desc.static_tree,s=e.stat_desc.has_stree,u=e.stat_desc.elems,c=-1;for(t.heap_len=0,t.heap_max=573,r=0;r<u;r++)0!==o[2*r]?(t.heap[++t.heap_len]=c=r,t.depth[r]=0):o[2*r+1]=0;for(;t.heap_len<2;)o[2*(i=t.heap[++t.heap_len]=c<2?++c:0)]=1,t.depth[i]=0,t.opt_len--,s&&(t.static_len-=a[2*i+1]);for(e.max_code=c,r=t.heap_len>>1;r>=1;r--)R(t,o,r);i=u;do{r=t.heap[1],t.heap[1]=t.heap[t.heap_len--],R(t,o,1),n=t.heap[1],t.heap[--t.heap_max]=r,t.heap[--t.heap_max]=n,o[2*i]=o[2*r]+o[2*n],t.depth[i]=(t.depth[r]>=t.depth[n]?t.depth[r]:t.depth[n])+1,o[2*r+1]=o[2*n+1]=i,t.heap[1]=i++,R(t,o,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var r,n,i,o,a,s,u=e.dyn_tree,c=e.max_code,l=e.stat_desc.static_tree,f=e.stat_desc.has_stree,d=e.stat_desc.extra_bits,h=e.stat_desc.extra_base,g=e.stat_desc.max_length,p=0;for(o=0;o<=15;o++)t.bl_count[o]=0;for(u[2*t.heap[t.heap_max]+1]=0,r=t.heap_max+1;r<573;r++)(o=u[2*u[2*(n=t.heap[r])+1]+1]+1)>g&&(o=g,p++),u[2*n+1]=o,n>c||(t.bl_count[o]++,a=0,n>=h&&(a=d[n-h]),s=u[2*n],t.opt_len+=s*(o+a),f&&(t.static_len+=s*(l[2*n+1]+a)));if(0!==p){do{for(o=g-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[g]--,p-=2}while(p>0);for(o=g;0!==o;o--)for(n=t.bl_count[o];0!==n;)(i=t.heap[--r])>c||(u[2*i+1]!==o&&(t.opt_len+=(o-u[2*i+1])*u[2*i],u[2*i+1]=o),n--)}}(t,e),T(o,c,t.bl_count)}function D(t,e,r){var n,i,o=-1,a=e[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),e[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=e[2*(n+1)+1],++s<u&&i===a||(s<c?t.bl_tree[2*i]+=s:0!==i?(i!==o&&t.bl_tree[2*i]++,t.bl_tree[32]++):s<=10?t.bl_tree[34]++:t.bl_tree[36]++,s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4))}function j(t,e,r){var n,i,o=-1,a=e[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),n=0;n<=r;n++)if(i=a,a=e[2*(n+1)+1],!(++s<u&&i===a)){if(s<c)do{S(t,i,t.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(S(t,i,t.bl_tree),s--),S(t,16,t.bl_tree),E(t,s-3,2)):s<=10?(S(t,17,t.bl_tree),E(t,s-3,3)):(S(t,18,t.bl_tree),E(t,s-11,7));s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4)}}i(y);var C=!1;function L(t,e,r,i){E(t,0+(i?1:0),3),function(t,e,r,i){M(t),i&&(w(t,r),w(t,~r)),n.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}(t,e,r,!0)}e._tr_init=function(t){C||(!function(){var t,e,r,n,i,u=new Array(16);for(r=0,n=0;n<28;n++)for(h[n]=r,t=0;t<1<<o[n];t++)d[r++]=n;for(d[r-1]=n,i=0,n=0;n<16;n++)for(y[n]=i,t=0;t<1<<a[n];t++)f[i++]=n;for(i>>=7;n<30;n++)for(y[n]=i<<7,t=0;t<1<<a[n]-7;t++)f[256+i++]=n;for(e=0;e<=15;e++)u[e]=0;for(t=0;t<=143;)c[2*t+1]=8,t++,u[8]++;for(;t<=255;)c[2*t+1]=9,t++,u[9]++;for(;t<=279;)c[2*t+1]=7,t++,u[7]++;for(;t<=287;)c[2*t+1]=8,t++,u[8]++;for(T(c,287,u),t=0;t<30;t++)l[2*t+1]=5,l[2*t]=O(t,5);g=new b(c,o,257,286,15),p=new b(l,a,0,30,15),m=new b(new Array(0),s,0,19,7)}(),C=!0),t.l_desc=new _(t.dyn_ltree,g),t.d_desc=new _(t.dyn_dtree,p),t.bl_desc=new _(t.bl_tree,m),t.bi_buf=0,t.bi_valid=0,A(t)},e._tr_stored_block=L,e._tr_flush_block=function(t,e,r,n){var i,o,a=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),k(t,t.l_desc),k(t,t.d_desc),a=function(t){var e;for(D(t,t.dyn_ltree,t.l_desc.max_code),D(t,t.dyn_dtree,t.d_desc.max_code),k(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*u[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),i=t.opt_len+3+7>>>3,(o=t.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==e?L(t,e,r,n):4===t.strategy||o===i?(E(t,2+(n?1:0),3),N(t,c,l)):(E(t,4+(n?1:0),3),function(t,e,r,n){var i;for(E(t,e-257,5),E(t,r-1,5),E(t,n-4,4),i=0;i<n;i++)E(t,t.bl_tree[2*u[i]+1],3);j(t,t.dyn_ltree,e-1),j(t,t.dyn_dtree,r-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),N(t,t.dyn_ltree,t.dyn_dtree)),A(t),n&&M(t)},e._tr_tally=function(t,e,r){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&r,t.last_lit++,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(d[r]+256+1)]++,t.dyn_dtree[2*v(e)]++),t.last_lit===t.lit_bufsize-1},e._tr_align=function(t){E(t,2,3),S(t,256,c),function(t){16===t.bi_valid?(w(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},function(t,e,r){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},function(t,e,r){"use strict";var n=r(101),i=r(162),o=r(163),a=r(295),s=r(296);function u(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function c(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function l(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new n.Buf32(852),e.distcode=e.distdyn=new n.Buf32(592),e.sane=1,e.back=-1,0):-2}function f(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,l(t)):-2}function d(t,e){var r,n;return t&&t.state?(n=t.state,e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?-2:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,f(t))):-2}function h(t,e){var r,n;return t?(n=new c,t.state=n,n.window=null,0!==(r=d(t,e))&&(t.state=null),r):-2}var g,p,m=!0;function y(t){if(m){var e;for(g=new n.Buf32(512),p=new n.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(s(1,t.lens,0,288,g,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;s(2,t.lens,0,32,p,0,t.work,{bits:5}),m=!1}t.lencode=g,t.lenbits=9,t.distcode=p,t.distbits=5}function b(t,e,r,i){var o,a=t.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new n.Buf8(a.wsize)),i>=a.wsize?(n.arraySet(a.window,e,r-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):((o=a.wsize-a.wnext)>i&&(o=i),n.arraySet(a.window,e,r-i,o,a.wnext),(i-=o)?(n.arraySet(a.window,e,r-i,i,0),a.wnext=i,a.whave=a.wsize):(a.wnext+=o,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=o))),0}e.inflateReset=f,e.inflateReset2=d,e.inflateResetKeep=l,e.inflateInit=function(t){return h(t,15)},e.inflateInit2=h,e.inflate=function(t,e){var r,c,l,f,d,h,g,p,m,_,v,w,E,S,O,T,A,M,I,R,N,k,D,j,C=0,L=new n.Buf8(4),x=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return-2;12===(r=t.state).mode&&(r.mode=13),d=t.next_out,l=t.output,g=t.avail_out,f=t.next_in,c=t.input,h=t.avail_in,p=r.hold,m=r.bits,_=h,v=g,k=0;t:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;m<16;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}if(2&r.wrap&&35615===p){r.check=0,L[0]=255&p,L[1]=p>>>8&255,r.check=o(r.check,L,2,0),p=0,m=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&p)<<8)+(p>>8))%31){t.msg="incorrect header check",r.mode=30;break}if(8!=(15&p)){t.msg="unknown compression method",r.mode=30;break}if(m-=4,N=8+(15&(p>>>=4)),0===r.wbits)r.wbits=N;else if(N>r.wbits){t.msg="invalid window size",r.mode=30;break}r.dmax=1<<N,t.adler=r.check=1,r.mode=512&p?10:12,p=0,m=0;break;case 2:for(;m<16;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}if(r.flags=p,8!=(255&r.flags)){t.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){t.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=p>>8&1),512&r.flags&&(L[0]=255&p,L[1]=p>>>8&255,r.check=o(r.check,L,2,0)),p=0,m=0,r.mode=3;case 3:for(;m<32;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}r.head&&(r.head.time=p),512&r.flags&&(L[0]=255&p,L[1]=p>>>8&255,L[2]=p>>>16&255,L[3]=p>>>24&255,r.check=o(r.check,L,4,0)),p=0,m=0,r.mode=4;case 4:for(;m<16;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}r.head&&(r.head.xflags=255&p,r.head.os=p>>8),512&r.flags&&(L[0]=255&p,L[1]=p>>>8&255,r.check=o(r.check,L,2,0)),p=0,m=0,r.mode=5;case 5:if(1024&r.flags){for(;m<16;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}r.length=p,r.head&&(r.head.extra_len=p),512&r.flags&&(L[0]=255&p,L[1]=p>>>8&255,r.check=o(r.check,L,2,0)),p=0,m=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((w=r.length)>h&&(w=h),w&&(r.head&&(N=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),n.arraySet(r.head.extra,c,f,w,N)),512&r.flags&&(r.check=o(r.check,c,w,f)),h-=w,f+=w,r.length-=w),r.length))break t;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===h)break t;w=0;do{N=c[f+w++],r.head&&N&&r.length<65536&&(r.head.name+=String.fromCharCode(N))}while(N&&w<h);if(512&r.flags&&(r.check=o(r.check,c,w,f)),h-=w,f+=w,N)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===h)break t;w=0;do{N=c[f+w++],r.head&&N&&r.length<65536&&(r.head.comment+=String.fromCharCode(N))}while(N&&w<h);if(512&r.flags&&(r.check=o(r.check,c,w,f)),h-=w,f+=w,N)break t}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;m<16;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}if(p!==(65535&r.check)){t.msg="header crc mismatch",r.mode=30;break}p=0,m=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=12;break;case 10:for(;m<32;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}t.adler=r.check=u(p),p=0,m=0,r.mode=11;case 11:if(0===r.havedict)return t.next_out=d,t.avail_out=g,t.next_in=f,t.avail_in=h,r.hold=p,r.bits=m,2;t.adler=r.check=1,r.mode=12;case 12:if(5===e||6===e)break t;case 13:if(r.last){p>>>=7&m,m-=7&m,r.mode=27;break}for(;m<3;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}switch(r.last=1&p,m-=1,3&(p>>>=1)){case 0:r.mode=14;break;case 1:if(y(r),r.mode=20,6===e){p>>>=2,m-=2;break t}break;case 2:r.mode=17;break;case 3:t.msg="invalid block type",r.mode=30}p>>>=2,m-=2;break;case 14:for(p>>>=7&m,m-=7&m;m<32;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}if((65535&p)!=(p>>>16^65535)){t.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&p,p=0,m=0,r.mode=15,6===e)break t;case 15:r.mode=16;case 16:if(w=r.length){if(w>h&&(w=h),w>g&&(w=g),0===w)break t;n.arraySet(l,c,f,w,d),h-=w,f+=w,g-=w,d+=w,r.length-=w;break}r.mode=12;break;case 17:for(;m<14;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}if(r.nlen=257+(31&p),p>>>=5,m-=5,r.ndist=1+(31&p),p>>>=5,m-=5,r.ncode=4+(15&p),p>>>=4,m-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;m<3;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}r.lens[x[r.have++]]=7&p,p>>>=3,m-=3}for(;r.have<19;)r.lens[x[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,D={bits:r.lenbits},k=s(0,r.lens,0,19,r.lencode,0,r.work,D),r.lenbits=D.bits,k){t.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;T=(C=r.lencode[p&(1<<r.lenbits)-1])>>>16&255,A=65535&C,!((O=C>>>24)<=m);){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}if(A<16)p>>>=O,m-=O,r.lens[r.have++]=A;else{if(16===A){for(j=O+2;m<j;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}if(p>>>=O,m-=O,0===r.have){t.msg="invalid bit length repeat",r.mode=30;break}N=r.lens[r.have-1],w=3+(3&p),p>>>=2,m-=2}else if(17===A){for(j=O+3;m<j;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}m-=O,N=0,w=3+(7&(p>>>=O)),p>>>=3,m-=3}else{for(j=O+7;m<j;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}m-=O,N=0,w=11+(127&(p>>>=O)),p>>>=7,m-=7}if(r.have+w>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=30;break}for(;w--;)r.lens[r.have++]=N}}if(30===r.mode)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,D={bits:r.lenbits},k=s(1,r.lens,0,r.nlen,r.lencode,0,r.work,D),r.lenbits=D.bits,k){t.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,D={bits:r.distbits},k=s(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,D),r.distbits=D.bits,k){t.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===e)break t;case 20:r.mode=21;case 21:if(h>=6&&g>=258){t.next_out=d,t.avail_out=g,t.next_in=f,t.avail_in=h,r.hold=p,r.bits=m,a(t,v),d=t.next_out,l=t.output,g=t.avail_out,f=t.next_in,c=t.input,h=t.avail_in,p=r.hold,m=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;T=(C=r.lencode[p&(1<<r.lenbits)-1])>>>16&255,A=65535&C,!((O=C>>>24)<=m);){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}if(T&&0==(240&T)){for(M=O,I=T,R=A;T=(C=r.lencode[R+((p&(1<<M+I)-1)>>M)])>>>16&255,A=65535&C,!(M+(O=C>>>24)<=m);){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}p>>>=M,m-=M,r.back+=M}if(p>>>=O,m-=O,r.back+=O,r.length=A,0===T){r.mode=26;break}if(32&T){r.back=-1,r.mode=12;break}if(64&T){t.msg="invalid literal/length code",r.mode=30;break}r.extra=15&T,r.mode=22;case 22:if(r.extra){for(j=r.extra;m<j;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}r.length+=p&(1<<r.extra)-1,p>>>=r.extra,m-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;T=(C=r.distcode[p&(1<<r.distbits)-1])>>>16&255,A=65535&C,!((O=C>>>24)<=m);){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}if(0==(240&T)){for(M=O,I=T,R=A;T=(C=r.distcode[R+((p&(1<<M+I)-1)>>M)])>>>16&255,A=65535&C,!(M+(O=C>>>24)<=m);){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}p>>>=M,m-=M,r.back+=M}if(p>>>=O,m-=O,r.back+=O,64&T){t.msg="invalid distance code",r.mode=30;break}r.offset=A,r.extra=15&T,r.mode=24;case 24:if(r.extra){for(j=r.extra;m<j;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}r.offset+=p&(1<<r.extra)-1,p>>>=r.extra,m-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===g)break t;if(w=v-g,r.offset>w){if((w=r.offset-w)>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=30;break}w>r.wnext?(w-=r.wnext,E=r.wsize-w):E=r.wnext-w,w>r.length&&(w=r.length),S=r.window}else S=l,E=d-r.offset,w=r.length;w>g&&(w=g),g-=w,r.length-=w;do{l[d++]=S[E++]}while(--w);0===r.length&&(r.mode=21);break;case 26:if(0===g)break t;l[d++]=r.length,g--,r.mode=21;break;case 27:if(r.wrap){for(;m<32;){if(0===h)break t;h--,p|=c[f++]<<m,m+=8}if(v-=g,t.total_out+=v,r.total+=v,v&&(t.adler=r.check=r.flags?o(r.check,l,v,d-v):i(r.check,l,v,d-v)),v=g,(r.flags?p:u(p))!==r.check){t.msg="incorrect data check",r.mode=30;break}p=0,m=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;m<32;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}if(p!==(4294967295&r.total)){t.msg="incorrect length check",r.mode=30;break}p=0,m=0}r.mode=29;case 29:k=1;break t;case 30:k=-3;break t;case 31:return-4;case 32:default:return-2}return t.next_out=d,t.avail_out=g,t.next_in=f,t.avail_in=h,r.hold=p,r.bits=m,(r.wsize||v!==t.avail_out&&r.mode<30&&(r.mode<27||4!==e))&&b(t,t.output,t.next_out,v-t.avail_out)?(r.mode=31,-4):(_-=t.avail_in,v-=t.avail_out,t.total_in+=_,t.total_out+=v,r.total+=v,r.wrap&&v&&(t.adler=r.check=r.flags?o(r.check,l,v,t.next_out-v):i(r.check,l,v,t.next_out-v)),t.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0===_&&0===v||4===e)&&0===k&&(k=-5),k)},e.inflateEnd=function(t){if(!t||!t.state)return-2;var e=t.state;return e.window&&(e.window=null),t.state=null,0},e.inflateGetHeader=function(t,e){var r;return t&&t.state?0==(2&(r=t.state).wrap)?-2:(r.head=e,e.done=!1,0):-2},e.inflateSetDictionary=function(t,e){var r,n=e.length;return t&&t.state?0!==(r=t.state).wrap&&11!==r.mode?-2:11===r.mode&&i(1,e,n,0)!==r.check?-3:b(t,e,n,n)?(r.mode=31,-4):(r.havedict=1,0):-2},e.inflateInfo="pako inflate (from Nodeca project)"},function(t,e,r){"use strict";t.exports=function(t,e){var r,n,i,o,a,s,u,c,l,f,d,h,g,p,m,y,b,_,v,w,E,S,O,T,A;r=t.state,n=t.next_in,T=t.input,i=n+(t.avail_in-5),o=t.next_out,A=t.output,a=o-(e-t.avail_out),s=o+(t.avail_out-257),u=r.dmax,c=r.wsize,l=r.whave,f=r.wnext,d=r.window,h=r.hold,g=r.bits,p=r.lencode,m=r.distcode,y=(1<<r.lenbits)-1,b=(1<<r.distbits)-1;t:do{g<15&&(h+=T[n++]<<g,g+=8,h+=T[n++]<<g,g+=8),_=p[h&y];e:for(;;){if(h>>>=v=_>>>24,g-=v,0===(v=_>>>16&255))A[o++]=65535&_;else{if(!(16&v)){if(0==(64&v)){_=p[(65535&_)+(h&(1<<v)-1)];continue e}if(32&v){r.mode=12;break t}t.msg="invalid literal/length code",r.mode=30;break t}w=65535&_,(v&=15)&&(g<v&&(h+=T[n++]<<g,g+=8),w+=h&(1<<v)-1,h>>>=v,g-=v),g<15&&(h+=T[n++]<<g,g+=8,h+=T[n++]<<g,g+=8),_=m[h&b];r:for(;;){if(h>>>=v=_>>>24,g-=v,!(16&(v=_>>>16&255))){if(0==(64&v)){_=m[(65535&_)+(h&(1<<v)-1)];continue r}t.msg="invalid distance code",r.mode=30;break t}if(E=65535&_,g<(v&=15)&&(h+=T[n++]<<g,(g+=8)<v&&(h+=T[n++]<<g,g+=8)),(E+=h&(1<<v)-1)>u){t.msg="invalid distance too far back",r.mode=30;break t}if(h>>>=v,g-=v,E>(v=o-a)){if((v=E-v)>l&&r.sane){t.msg="invalid distance too far back",r.mode=30;break t}if(S=0,O=d,0===f){if(S+=c-v,v<w){w-=v;do{A[o++]=d[S++]}while(--v);S=o-E,O=A}}else if(f<v){if(S+=c+f-v,(v-=f)<w){w-=v;do{A[o++]=d[S++]}while(--v);if(S=0,f<w){w-=v=f;do{A[o++]=d[S++]}while(--v);S=o-E,O=A}}}else if(S+=f-v,v<w){w-=v;do{A[o++]=d[S++]}while(--v);S=o-E,O=A}for(;w>2;)A[o++]=O[S++],A[o++]=O[S++],A[o++]=O[S++],w-=3;w&&(A[o++]=O[S++],w>1&&(A[o++]=O[S++]))}else{S=o-E;do{A[o++]=A[S++],A[o++]=A[S++],A[o++]=A[S++],w-=3}while(w>2);w&&(A[o++]=A[S++],w>1&&(A[o++]=A[S++]))}break}}break}}while(n<i&&o<s);n-=w=g>>3,h&=(1<<(g-=w<<3))-1,t.next_in=n,t.next_out=o,t.avail_in=n<i?i-n+5:5-(n-i),t.avail_out=o<s?s-o+257:257-(o-s),r.hold=h,r.bits=g}},function(t,e,r){"use strict";var n=r(101),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],a=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],s=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(t,e,r,u,c,l,f,d){var h,g,p,m,y,b,_,v,w,E=d.bits,S=0,O=0,T=0,A=0,M=0,I=0,R=0,N=0,k=0,D=0,j=null,C=0,L=new n.Buf16(16),x=new n.Buf16(16),B=null,U=0;for(S=0;S<=15;S++)L[S]=0;for(O=0;O<u;O++)L[e[r+O]]++;for(M=E,A=15;A>=1&&0===L[A];A--);if(M>A&&(M=A),0===A)return c[l++]=20971520,c[l++]=20971520,d.bits=1,0;for(T=1;T<A&&0===L[T];T++);for(M<T&&(M=T),N=1,S=1;S<=15;S++)if(N<<=1,(N-=L[S])<0)return-1;if(N>0&&(0===t||1!==A))return-1;for(x[1]=0,S=1;S<15;S++)x[S+1]=x[S]+L[S];for(O=0;O<u;O++)0!==e[r+O]&&(f[x[e[r+O]]++]=O);if(0===t?(j=B=f,b=19):1===t?(j=i,C-=257,B=o,U-=257,b=256):(j=a,B=s,b=-1),D=0,O=0,S=T,y=l,I=M,R=0,p=-1,m=(k=1<<M)-1,1===t&&k>852||2===t&&k>592)return 1;for(;;){_=S-R,f[O]<b?(v=0,w=f[O]):f[O]>b?(v=B[U+f[O]],w=j[C+f[O]]):(v=96,w=0),h=1<<S-R,T=g=1<<I;do{c[y+(D>>R)+(g-=h)]=_<<24|v<<16|w|0}while(0!==g);for(h=1<<S-1;D&h;)h>>=1;if(0!==h?(D&=h-1,D+=h):D=0,O++,0==--L[S]){if(S===A)break;S=e[r+f[O]]}if(S>M&&(D&m)!==p){for(0===R&&(R=M),y+=T,N=1<<(I=S-R);I+R<A&&!((N-=L[I+R])<=0);)I++,N<<=1;if(k+=1<<I,1===t&&k>852||2===t&&k>592)return 1;c[p=D&m]=M<<24|I<<16|y-l|0}}return 0!==D&&(c[y+D]=S-R<<24|64<<16|0),d.bits=M,0}},function(t,e,r){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(t,e,r){(function(e){t.exports=function(t){var n=r(161);return{inflate:function(){return n.inflateRawSync(t)},inflateAsync:function(r){var i=n.createInflateRaw(),o=[],a=0;i.on("data",(function(t){o.push(t),a+=t.length})),i.on("end",(function(){var t=e.alloc(a),n=0;t.fill(0);for(var i=0;i<o.length;i++){var s=o[i];s.copy(t,n),n+=s.length}r&&r(t)})),i.end(t)}}}}).call(this,r(16).Buffer)},function(t,e,r){"use strict";(function(e){const{randomFillSync:n}=r(164),i=new Uint32Array(256).map((t,e)=>{for(let t=0;t<8;t++)0!=(1&e)?e=e>>>1^3988292384:e>>>=1;return e>>>0}),o=(t,e)=>Math.imul(t,e)>>>0,a=(t,e)=>i[255&(t^e)]^t>>>8,s=()=>"function"==typeof n?n(e.alloc(12)):s.node();s.node=()=>{const t=e.alloc(12),r=t.length;for(let e=0;e<r;e++)t[e]=256*Math.random()&255;return t};const u={genSalt:s};function c(t){const r=e.isBuffer(t)?t:e.from(t);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let t=0;t<r.length;t++)this.updateKeys(r[t])}function l(t){const r=new c(t);return function(t,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;n||(n=e.alloc(t.length));for(let e of t){const t=r.next();n[i++]=e^t,r.updateKeys(e)}return n}}c.prototype.updateKeys=function(t){const e=this.keys;return e[0]=a(e[0],t),e[1]+=255&e[0],e[1]=o(e[1],134775813)+1,e[2]=a(e[2],e[1]>>>24),t},c.prototype.next=function(){const t=(2|this.keys[2])>>>0;return o(t,1^t)>>8&255},t.exports={decrypt:function(t,r,n){if(!t||!e.isBuffer(t)||t.length<12)return e.alloc(0);const i=function(t){const r=new c(t);return function(t){const n=e.alloc(t.length);let i=0;for(let e of t)n[i++]=r.updateKeys(e^r.next());return n}}(n);if(i(t.slice(0,12))[11]!==r.crc>>>24)throw"ADM-ZIP: Wrong Password";return i(t.slice(12))},encrypt:function(t,r,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];null==t&&(t=e.alloc(0)),e.isBuffer(t)||(t=e.from(t.toString()));const o=l(n),a=u.genSalt();a[11]=r.crc>>>24&255,i&&(a[10]=r.crc>>>16&255);const s=e.alloc(t.length+12);return o(a,s),o(t,s,12)},_salter:function(t){e.isBuffer(t)&&t.length>=12?u.genSalt=function(){return t.slice(0,12)}:u.genSalt="node"===t?s.node:s}}}).call(this,r(16).Buffer)},function(t,e,r){(e=t.exports=r(166)).Stream=e,e.Readable=e,e.Writable=r(170),e.Duplex=r(71),e.Transform=r(171),e.PassThrough=r(306),e.finished=r(118),e.pipeline=r(307)},function(t,e){},function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var a=r(16).Buffer,s=r(303).inspect,u=s&&s.custom||"inspect";t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var e,r,c;return e=t,(r=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return a.alloc(0);for(var e,r,n,i=a.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,r=i,n=s,a.prototype.copy.call(e,r,n),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,n=e.data;for(t-=n.length;e=e.next;){var i=e.data,o=t>i.length?i.length:t;if(o===i.length?n+=i:n+=i.slice(0,t),0==(t-=o)){o===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=a.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,e}},{key:u,value:function(t,e){return s(this,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},e,{depth:0,customInspect:!1}))}}])&&o(e.prototype,r),c&&o(e,c),t}()},function(t,e){},function(t,e,r){"use strict";(function(e){var n;function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=r(118),a=Symbol("lastResolve"),s=Symbol("lastReject"),u=Symbol("error"),c=Symbol("ended"),l=Symbol("lastPromise"),f=Symbol("handlePromise"),d=Symbol("stream");function h(t,e){return{value:t,done:e}}function g(t){var e=t[a];if(null!==e){var r=t[d].read();null!==r&&(t[l]=null,t[a]=null,t[s]=null,e(h(r,!1)))}}function p(t){e.nextTick(g,t)}var m=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((i(n={get stream(){return this[d]},next:function(){var t=this,r=this[u];if(null!==r)return Promise.reject(r);if(this[c])return Promise.resolve(h(void 0,!0));if(this[d].destroyed)return new Promise((function(r,n){e.nextTick((function(){t[u]?n(t[u]):r(h(void 0,!0))}))}));var n,i=this[l];if(i)n=new Promise(function(t,e){return function(r,n){t.then((function(){e[c]?r(h(void 0,!0)):e[f](r,n)}),n)}}(i,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(h(o,!1));n=new Promise(this[f])}return this[l]=n,n}},Symbol.asyncIterator,(function(){return this})),i(n,"return",(function(){var t=this;return new Promise((function(e,r){t[d].destroy(null,(function(t){t?r(t):e(h(void 0,!0))}))}))})),n),m);t.exports=function(t){var e,r=Object.create(y,(i(e={},d,{value:t,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,s,{value:null,writable:!0}),i(e,u,{value:null,writable:!0}),i(e,c,{value:t._readableState.endEmitted,writable:!0}),i(e,f,{value:function(t,e){var n=r[d].read();n?(r[l]=null,r[a]=null,r[s]=null,t(h(n,!1))):(r[a]=t,r[s]=e)},writable:!0}),e));return r[l]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=r[s];return null!==e&&(r[l]=null,r[a]=null,r[s]=null,e(t)),void(r[u]=t)}var n=r[a];null!==n&&(r[l]=null,r[a]=null,r[s]=null,n(h(void 0,!0))),r[c]=!0})),t.on("readable",p.bind(null,r)),r}}).call(this,r(25))},function(t,e){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},function(t,e,r){"use strict";t.exports=i;var n=r(171);function i(t){if(!(this instanceof i))return new i(t);n.call(this,t)}r(12)(i,n),i.prototype._transform=function(t,e,r){r(null,t)}},function(t,e,r){"use strict";var n;var i=r(70).codes,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function s(t){if(t)throw t}function u(t,e,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var s=!1;t.on("close",(function(){s=!0})),void 0===n&&(n=r(118)),n(t,{readable:e,writable:i},(function(t){if(t)return o(t);s=!0,o()}));var u=!1;return function(e){if(!s&&!u)return u=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new a("pipe"))}}function c(t){t()}function l(t,e){return t.pipe(e)}function f(t){return t.length?"function"!=typeof t[t.length-1]?s:t.pop():s}t.exports=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n,i=f(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new o("streams");var a=e.map((function(t,r){var o=r<e.length-1;return u(t,o,r>0,(function(t){n||(n=t),t&&a.forEach(c),o||(a.forEach(c),i(n))}))}));return e.reduce(l)}},function(t,e,r){var n=r(12),i=r(72),o=r(19).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,i.call(this,64,56)}function c(t){return t<<30|t>>>2}function l(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,f=0;f<16;++f)r[f]=t.readInt32BE(4*f);for(;f<80;++f)r[f]=r[f-3]^r[f-8]^r[f-14]^r[f-16];for(var d=0;d<80;++d){var h=~~(d/20),g=0|((e=n)<<5|e>>>27)+l(h,i,o,s)+u+r[d]+a[h];u=s,s=o,o=c(i),i=n,n=g}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},function(t,e,r){var n=r(12),i=r(72),o=r(19).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,i.call(this,64,56)}function c(t){return t<<5|t>>>27}function l(t){return t<<30|t>>>2}function f(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,d=0;d<16;++d)r[d]=t.readInt32BE(4*d);for(;d<80;++d)r[d]=(e=r[d-3]^r[d-8]^r[d-14]^r[d-16])<<1|e>>>31;for(var h=0;h<80;++h){var g=~~(h/20),p=c(n)+f(g,i,o,s)+u+r[h]+a[g]|0;u=s,s=o,o=l(i),i=n,n=p}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},function(t,e,r){var n=r(12),i=r(172),o=r(72),a=r(19).Buffer,s=new Array(64);function u(){this.init(),this._w=s,o.call(this,64,56)}n(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var t=a.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=u},function(t,e,r){var n=r(12),i=r(173),o=r(72),a=r(19).Buffer,s=new Array(160);function u(){this.init(),this._w=s,o.call(this,128,112)}n(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var t=a.allocUnsafe(48);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=u},function(t,e,r){"use strict";var n=r(12),i=r(19).Buffer,o=r(57),a=i.alloc(128);function s(t,e){o.call(this,"digest"),"string"==typeof e&&(e=i.from(e)),this._alg=t,this._key=e,e.length>64?e=t(e):e.length<64&&(e=i.concat([e,a],64));for(var r=this._ipad=i.allocUnsafe(64),n=this._opad=i.allocUnsafe(64),s=0;s<64;s++)r[s]=54^e[s],n[s]=92^e[s];this._hash=[r]}n(s,o),s.prototype._update=function(t){this._hash.push(t)},s.prototype._final=function(){var t=this._alg(i.concat(this._hash));return this._alg(i.concat([this._opad,t]))},t.exports=s},function(t,e,r){t.exports=r(176)},function(t,e,r){(function(e){var n,i,o=r(19).Buffer,a=r(178),s=r(179),u=r(180),c=r(181),l=e.crypto&&e.crypto.subtle,f={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},d=[];function h(){return i||(i=e.process&&e.process.nextTick?e.process.nextTick:e.queueMicrotask?e.queueMicrotask:e.setImmediate?e.setImmediate:e.setTimeout)}function g(t,e,r,n,i){return l.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then((function(t){return l.deriveBits({name:"PBKDF2",salt:e,iterations:r,hash:{name:i}},t,n<<3)})).then((function(t){return o.from(t)}))}t.exports=function(t,r,i,p,m,y){"function"==typeof m&&(y=m,m=void 0);var b=f[(m=m||"sha1").toLowerCase()];if(b&&"function"==typeof e.Promise){if(a(i,p),t=c(t,s,"Password"),r=c(r,s,"Salt"),"function"!=typeof y)throw new Error("No callback provided to pbkdf2");!function(t,e){t.then((function(t){h()((function(){e(null,t)}))}),(function(t){h()((function(){e(t)}))}))}(function(t){if(e.process&&!e.process.browser)return Promise.resolve(!1);if(!l||!l.importKey||!l.deriveBits)return Promise.resolve(!1);if(void 0!==d[t])return d[t];var r=g(n=n||o.alloc(8),n,10,128,t).then((function(){return!0})).catch((function(){return!1}));return d[t]=r,r}(b).then((function(e){return e?g(t,r,i,p,b):u(t,r,i,p,m)})),y)}else h()((function(){var e;try{e=u(t,r,i,p,m)}catch(t){return y(t)}y(null,e)}))}}).call(this,r(33))},function(t,e,r){var n=r(316),i=r(122),o=r(123),a=r(329),s=r(103);function u(t,e,r){if(t=t.toLowerCase(),o[t])return i.createCipheriv(t,e,r);if(a[t])return new n({key:e,iv:r,mode:t});throw new TypeError("invalid suite type")}function c(t,e,r){if(t=t.toLowerCase(),o[t])return i.createDecipheriv(t,e,r);if(a[t])return new n({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}e.createCipher=e.Cipher=function(t,e){var r,n;if(t=t.toLowerCase(),o[t])r=o[t].key,n=o[t].iv;else{if(!a[t])throw new TypeError("invalid suite type");r=8*a[t].key,n=a[t].iv}var i=s(e,!1,r,n);return u(t,i.key,i.iv)},e.createCipheriv=e.Cipheriv=u,e.createDecipher=e.Decipher=function(t,e){var r,n;if(t=t.toLowerCase(),o[t])r=o[t].key,n=o[t].iv;else{if(!a[t])throw new TypeError("invalid suite type");r=8*a[t].key,n=a[t].iv}var i=s(e,!1,r,n);return c(t,i.key,i.iv)},e.createDecipheriv=e.Decipheriv=c,e.listCiphers=e.getCiphers=function(){return Object.keys(a).concat(i.getCiphers())}},function(t,e,r){var n=r(57),i=r(317),o=r(12),a=r(19).Buffer,s={"des-ede3-cbc":i.CBC.instantiate(i.EDE),"des-ede3":i.EDE,"des-ede-cbc":i.CBC.instantiate(i.EDE),"des-ede":i.EDE,"des-cbc":i.CBC.instantiate(i.DES),"des-ecb":i.DES};function u(t){n.call(this);var e,r=t.mode.toLowerCase(),i=s[r];e=t.decrypt?"decrypt":"encrypt";var o=t.key;a.isBuffer(o)||(o=a.from(o)),"des-ede"!==r&&"des-ede-cbc"!==r||(o=a.concat([o,o.slice(0,8)]));var u=t.iv;a.isBuffer(u)||(u=a.from(u)),this._des=i.create({key:o,iv:u,type:e})}s.des=s["des-cbc"],s.des3=s["des-ede3-cbc"],t.exports=u,o(u,n),u.prototype._update=function(t){return a.from(this._des.update(t))},u.prototype._final=function(){return a.from(this._des.final())}},function(t,e,r){"use strict";e.utils=r(182),e.Cipher=r(121),e.DES=r(183),e.CBC=r(318),e.EDE=r(319)},function(t,e,r){"use strict";var n=r(46),i=r(12),o={};function a(t){n.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;e<this.iv.length;e++)this.iv[e]=t[e]}e.instantiate=function(t){function e(e){t.call(this,e),this._cbcInit()}i(e,t);for(var r=Object.keys(o),n=0;n<r.length;n++){var a=r[n];e.prototype[a]=o[a]}return e.create=function(t){return new e(t)},e},o._cbcInit=function(){var t=new a(this.options.iv);this._cbcState=t},o._update=function(t,e,r,n){var i=this._cbcState,o=this.constructor.super_.prototype,a=i.iv;if("encrypt"===this.type){for(var s=0;s<this.blockSize;s++)a[s]^=t[e+s];o._update.call(this,a,0,r,n);for(s=0;s<this.blockSize;s++)a[s]=r[n+s]}else{o._update.call(this,t,e,r,n);for(s=0;s<this.blockSize;s++)r[n+s]^=a[s];for(s=0;s<this.blockSize;s++)a[s]=t[e+s]}}},function(t,e,r){"use strict";var n=r(46),i=r(12),o=r(121),a=r(183);function s(t,e){n.equal(e.length,24,"Invalid key length");var r=e.slice(0,8),i=e.slice(8,16),o=e.slice(16,24);this.ciphers="encrypt"===t?[a.create({type:"encrypt",key:r}),a.create({type:"decrypt",key:i}),a.create({type:"encrypt",key:o})]:[a.create({type:"decrypt",key:o}),a.create({type:"encrypt",key:i}),a.create({type:"decrypt",key:r})]}function u(t){o.call(this,t);var e=new s(this.type,this.options.key);this._edeState=e}i(u,o),t.exports=u,u.create=function(t){return new u(t)},u.prototype._update=function(t,e,r,n){var i=this._edeState;i.ciphers[0]._update(t,e,r,n),i.ciphers[1]._update(r,n,r,n),i.ciphers[2]._update(r,n,r,n)},u.prototype._pad=a.prototype._pad,u.prototype._unpad=a.prototype._unpad},function(t,e,r){var n=r(123),i=r(187),o=r(19).Buffer,a=r(188),s=r(57),u=r(102),c=r(103);function l(t,e,r){s.call(this),this._cache=new d,this._cipher=new u.AES(e),this._prev=o.from(r),this._mode=t,this._autopadding=!0}r(12)(l,s),l.prototype._update=function(t){var e,r;this._cache.add(t);for(var n=[];e=this._cache.get();)r=this._mode.encrypt(this,e),n.push(r);return o.concat(n)};var f=o.alloc(16,16);function d(){this.cache=o.allocUnsafe(0)}function h(t,e,r){var s=n[t.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=o.from(e)),e.length!==s.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof r&&(r=o.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===s.type?new a(s.module,e,r):"auth"===s.type?new i(s.module,e,r):new l(s.module,e,r)}l.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(f))throw this._cipher.scrub(),new Error("data not multiple of block length")},l.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},d.prototype.add=function(t){this.cache=o.concat([this.cache,t])},d.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},d.prototype.flush=function(){for(var t=16-this.cache.length,e=o.allocUnsafe(t),r=-1;++r<t;)e.writeUInt8(t,r);return o.concat([this.cache,e])},e.createCipheriv=h,e.createCipher=function(t,e){var r=n[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=c(e,!1,r.key,r.iv);return h(t,i.key,i.iv)}},function(t,e){e.encrypt=function(t,e){return t._cipher.encryptBlock(e)},e.decrypt=function(t,e){return t._cipher.decryptBlock(e)}},function(t,e,r){var n=r(86);e.encrypt=function(t,e){var r=n(e,t._prev);return t._prev=t._cipher.encryptBlock(r),t._prev},e.decrypt=function(t,e){var r=t._prev;t._prev=e;var i=t._cipher.decryptBlock(e);return n(i,r)}},function(t,e,r){var n=r(19).Buffer,i=r(86);function o(t,e,r){var o=e.length,a=i(e,t._cache);return t._cache=t._cache.slice(o),t._prev=n.concat([t._prev,r?e:a]),a}e.encrypt=function(t,e,r){for(var i,a=n.allocUnsafe(0);e.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=n.allocUnsafe(0)),!(t._cache.length<=e.length)){a=n.concat([a,o(t,e,r)]);break}i=t._cache.length,a=n.concat([a,o(t,e.slice(0,i),r)]),e=e.slice(i)}return a}},function(t,e,r){var n=r(19).Buffer;function i(t,e,r){var i=t._cipher.encryptBlock(t._prev)[0]^e;return t._prev=n.concat([t._prev.slice(1),n.from([r?e:i])]),i}e.encrypt=function(t,e,r){for(var o=e.length,a=n.allocUnsafe(o),s=-1;++s<o;)a[s]=i(t,e[s],r);return a}},function(t,e,r){var n=r(19).Buffer;function i(t,e,r){for(var n,i,a=-1,s=0;++a<8;)n=e&1<<7-a?128:0,s+=(128&(i=t._cipher.encryptBlock(t._prev)[0]^n))>>a%8,t._prev=o(t._prev,r?n:i);return s}function o(t,e){var r=t.length,i=-1,o=n.allocUnsafe(t.length);for(t=n.concat([t,n.from([e])]);++i<r;)o[i]=t[i]<<1|t[i+1]>>7;return o}e.encrypt=function(t,e,r){for(var o=e.length,a=n.allocUnsafe(o),s=-1;++s<o;)a[s]=i(t,e[s],r);return a}},function(t,e,r){(function(t){var n=r(86);function i(t){return t._prev=t._cipher.encryptBlock(t._prev),t._prev}e.encrypt=function(e,r){for(;e._cache.length<r.length;)e._cache=t.concat([e._cache,i(e)]);var o=e._cache.slice(0,r.length);return e._cache=e._cache.slice(r.length),n(r,o)}}).call(this,r(16).Buffer)},function(t,e,r){var n=r(19).Buffer,i=n.alloc(16,0);function o(t){var e=n.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function a(t){this.h=t,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}a.prototype.ghash=function(t){for(var e=-1;++e<t.length;)this.state[e]^=t[e];this._multiply()},a.prototype._multiply=function(){for(var t,e,r,n=[(t=this.h).readUInt32BE(0),t.readUInt32BE(4),t.readUInt32BE(8),t.readUInt32BE(12)],i=[0,0,0,0],a=-1;++a<128;){for(0!=(this.state[~~(a/8)]&1<<7-a%8)&&(i[0]^=n[0],i[1]^=n[1],i[2]^=n[2],i[3]^=n[3]),r=0!=(1&n[3]),e=3;e>0;e--)n[e]=n[e]>>>1|(1&n[e-1])<<31;n[0]=n[0]>>>1,r&&(n[0]=n[0]^225<<24)}this.state=o(i)},a.prototype.update=function(t){var e;for(this.cache=n.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},a.prototype.final=function(t,e){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(o([0,t,0,e])),this.state},t.exports=a},function(t,e,r){var n=r(187),i=r(19).Buffer,o=r(123),a=r(188),s=r(57),u=r(102),c=r(103);function l(t,e,r){s.call(this),this._cache=new f,this._last=void 0,this._cipher=new u.AES(e),this._prev=i.from(r),this._mode=t,this._autopadding=!0}function f(){this.cache=i.allocUnsafe(0)}function d(t,e,r){var s=o[t.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=i.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof e&&(e=i.from(e)),e.length!==s.key/8)throw new TypeError("invalid key length "+e.length);return"stream"===s.type?new a(s.module,e,r,!0):"auth"===s.type?new n(s.module,e,r,!0):new l(s.module,e,r)}r(12)(l,s),l.prototype._update=function(t){var e,r;this._cache.add(t);for(var n=[];e=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,e),n.push(r);return i.concat(n)},l.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return function(t){var e=t[15];if(e<1||e>16)throw new Error("unable to decrypt data");var r=-1;for(;++r<e;)if(t[r+(16-e)]!==e)throw new Error("unable to decrypt data");if(16===e)return;return t.slice(0,16-e)}(this._mode.decrypt(this,t));if(t)throw new Error("data not multiple of block length")},l.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},f.prototype.add=function(t){this.cache=i.concat([this.cache,t])},f.prototype.get=function(t){var e;if(t){if(this.cache.length>16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},f.prototype.flush=function(){if(this.cache.length)return this.cache},e.createDecipher=function(t,e){var r=o[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=c(e,!1,r.key,r.iv);return d(t,n.key,n.iv)},e.createDecipheriv=d},function(t,e){e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}},function(t,e,r){(function(t){var n=r(189),i=r(333),o=r(334);var a={binary:!0,hex:!0,base64:!0};e.DiffieHellmanGroup=e.createDiffieHellmanGroup=e.getDiffieHellman=function(e){var r=new t(i[e].prime,"hex"),n=new t(i[e].gen,"hex");return new o(r,n)},e.createDiffieHellman=e.DiffieHellman=function e(r,i,s,u){return t.isBuffer(i)||void 0===a[i]?e(r,"binary",i,s):(i=i||"binary",u=u||"binary",s=s||new t([2]),t.isBuffer(s)||(s=new t(s,u)),"number"==typeof r?new o(n(r,s),s,!0):(t.isBuffer(r)||(r=new t(r,i)),new o(r,s,!0)))}}).call(this,r(16).Buffer)},function(t,e){},function(t,e){},function(t){t.exports=JSON.parse('{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}')},function(t,e,r){(function(e){var n=r(39),i=new(r(190)),o=new n(24),a=new n(11),s=new n(10),u=new n(3),c=new n(7),l=r(189),f=r(69);function d(t,r){return r=r||"utf8",e.isBuffer(t)||(t=new e(t,r)),this._pub=new n(t),this}function h(t,r){return r=r||"utf8",e.isBuffer(t)||(t=new e(t,r)),this._priv=new n(t),this}t.exports=p;var g={};function p(t,e,r){this.setGenerator(e),this.__prime=new n(t),this._prime=n.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=d,this.setPrivateKey=h):this._primeCode=8}function m(t,r){var n=new e(t.toArray());return r?n.toString(r):n}Object.defineProperty(p.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(t,e){var r=e.toString("hex"),n=[r,t.toString(16)].join("_");if(n in g)return g[n];var f,d=0;if(t.isEven()||!l.simpleSieve||!l.fermatTest(t)||!i.test(t))return d+=1,d+="02"===r||"05"===r?8:4,g[n]=d,d;switch(i.test(t.shrn(1))||(d+=2),r){case"02":t.mod(o).cmp(a)&&(d+=8);break;case"05":(f=t.mod(s)).cmp(u)&&f.cmp(c)&&(d+=8);break;default:d+=4}return g[n]=d,d}(this.__prime,this.__gen)),this._primeCode}}),p.prototype.generateKeys=function(){return this._priv||(this._priv=new n(f(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},p.prototype.computeSecret=function(t){var r=(t=(t=new n(t)).toRed(this._prime)).redPow(this._priv).fromRed(),i=new e(r.toArray()),o=this.getPrime();if(i.length<o.length){var a=new e(o.length-i.length);a.fill(0),i=e.concat([a,i])}return i},p.prototype.getPublicKey=function(t){return m(this._pub,t)},p.prototype.getPrivateKey=function(t){return m(this._priv,t)},p.prototype.getPrime=function(t){return m(this.__prime,t)},p.prototype.getGenerator=function(t){return m(this._gen,t)},p.prototype.setGenerator=function(t,r){return r=r||"utf8",e.isBuffer(t)||(t=new e(t,r)),this.__gen=t,this._gen=new n(t),this}}).call(this,r(16).Buffer)},function(t,e,r){var n=r(19).Buffer,i=r(85),o=r(336),a=r(12),s=r(344),u=r(375),c=r(176);function l(t){o.Writable.call(this);var e=c[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=i(e.hash),this._tag=e.id,this._signType=e.sign}function f(t){o.Writable.call(this);var e=c[t];if(!e)throw new Error("Unknown message digest");this._hash=i(e.hash),this._tag=e.id,this._signType=e.sign}function d(t){return new l(t)}function h(t){return new f(t)}Object.keys(c).forEach((function(t){c[t].id=n.from(c[t].id,"hex"),c[t.toLowerCase()]=c[t]})),a(l,o.Writable),l.prototype._write=function(t,e,r){this._hash.update(t),r()},l.prototype.update=function(t,e){return"string"==typeof t&&(t=n.from(t,e)),this._hash.update(t),this},l.prototype.sign=function(t,e){this.end();var r=this._hash.digest(),n=s(r,t,this._hashType,this._signType,this._tag);return e?n.toString(e):n},a(f,o.Writable),f.prototype._write=function(t,e,r){this._hash.update(t),r()},f.prototype.update=function(t,e){return"string"==typeof t&&(t=n.from(t,e)),this._hash.update(t),this},f.prototype.verify=function(t,e,r){"string"==typeof e&&(e=n.from(e,r)),this.end();var i=this._hash.digest();return u(e,i,t,this._signType,this._tag)},t.exports={Sign:d,Verify:h,createSign:d,createVerify:h}},function(t,e,r){(e=t.exports=r(191)).Stream=e,e.Readable=e,e.Writable=r(195),e.Duplex=r(74),e.Transform=r(196),e.PassThrough=r(342),e.finished=r(125),e.pipeline=r(343)},function(t,e){},function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var a=r(16).Buffer,s=r(339).inspect,u=s&&s.custom||"inspect";t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var e,r,c;return e=t,(r=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return a.alloc(0);for(var e,r,n,i=a.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,r=i,n=s,a.prototype.copy.call(e,r,n),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,n=e.data;for(t-=n.length;e=e.next;){var i=e.data,o=t>i.length?i.length:t;if(o===i.length?n+=i:n+=i.slice(0,t),0==(t-=o)){o===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=a.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,e}},{key:u,value:function(t,e){return s(this,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},e,{depth:0,customInspect:!1}))}}])&&o(e.prototype,r),c&&o(e,c),t}()},function(t,e){},function(t,e,r){"use strict";(function(e){var n;function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=r(125),a=Symbol("lastResolve"),s=Symbol("lastReject"),u=Symbol("error"),c=Symbol("ended"),l=Symbol("lastPromise"),f=Symbol("handlePromise"),d=Symbol("stream");function h(t,e){return{value:t,done:e}}function g(t){var e=t[a];if(null!==e){var r=t[d].read();null!==r&&(t[l]=null,t[a]=null,t[s]=null,e(h(r,!1)))}}function p(t){e.nextTick(g,t)}var m=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((i(n={get stream(){return this[d]},next:function(){var t=this,r=this[u];if(null!==r)return Promise.reject(r);if(this[c])return Promise.resolve(h(void 0,!0));if(this[d].destroyed)return new Promise((function(r,n){e.nextTick((function(){t[u]?n(t[u]):r(h(void 0,!0))}))}));var n,i=this[l];if(i)n=new Promise(function(t,e){return function(r,n){t.then((function(){e[c]?r(h(void 0,!0)):e[f](r,n)}),n)}}(i,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(h(o,!1));n=new Promise(this[f])}return this[l]=n,n}},Symbol.asyncIterator,(function(){return this})),i(n,"return",(function(){var t=this;return new Promise((function(e,r){t[d].destroy(null,(function(t){t?r(t):e(h(void 0,!0))}))}))})),n),m);t.exports=function(t){var e,r=Object.create(y,(i(e={},d,{value:t,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,s,{value:null,writable:!0}),i(e,u,{value:null,writable:!0}),i(e,c,{value:t._readableState.endEmitted,writable:!0}),i(e,f,{value:function(t,e){var n=r[d].read();n?(r[l]=null,r[a]=null,r[s]=null,t(h(n,!1))):(r[a]=t,r[s]=e)},writable:!0}),e));return r[l]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=r[s];return null!==e&&(r[l]=null,r[a]=null,r[s]=null,e(t)),void(r[u]=t)}var n=r[a];null!==n&&(r[l]=null,r[a]=null,r[s]=null,n(h(void 0,!0))),r[c]=!0})),t.on("readable",p.bind(null,r)),r}}).call(this,r(25))},function(t,e){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},function(t,e,r){"use strict";t.exports=i;var n=r(196);function i(t){if(!(this instanceof i))return new i(t);n.call(this,t)}r(12)(i,n),i.prototype._transform=function(t,e,r){r(null,t)}},function(t,e,r){"use strict";var n;var i=r(73).codes,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function s(t){if(t)throw t}function u(t,e,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var s=!1;t.on("close",(function(){s=!0})),void 0===n&&(n=r(125)),n(t,{readable:e,writable:i},(function(t){if(t)return o(t);s=!0,o()}));var u=!1;return function(e){if(!s&&!u)return u=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new a("pipe"))}}function c(t){t()}function l(t,e){return t.pipe(e)}function f(t){return t.length?"function"!=typeof t[t.length-1]?s:t.pop():s}t.exports=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n,i=f(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new o("streams");var a=e.map((function(t,r){var o=r<e.length-1;return u(t,o,r>0,(function(t){n||(n=t),t&&a.forEach(c),o||(a.forEach(c),i(n))}))}));return e.reduce(l)}},function(t,e,r){var n=r(19).Buffer,i=r(174),o=r(126),a=r(127).ec,s=r(202),u=r(105),c=r(208);function l(t,e,r,o){if((t=n.from(t.toArray())).length<e.byteLength()){var a=n.alloc(e.byteLength()-t.length);t=n.concat([a,t])}var s=r.length,u=function(t,e){t=(t=f(t,e)).mod(e);var r=n.from(t.toArray());if(r.length<e.byteLength()){var i=n.alloc(e.byteLength()-r.length);r=n.concat([i,r])}return r}(r,e),c=n.alloc(s);c.fill(1);var l=n.alloc(s);return l=i(o,l).update(c).update(n.from([0])).update(t).update(u).digest(),c=i(o,l).update(c).digest(),{k:l=i(o,l).update(c).update(n.from([1])).update(t).update(u).digest(),v:c=i(o,l).update(c).digest()}}function f(t,e){var r=new s(t),n=(t.length<<3)-e.bitLength();return n>0&&r.ishrn(n),r}function d(t,e,r){var o,a;do{for(o=n.alloc(0);8*o.length<t.bitLength();)e.v=i(r,e.k).update(e.v).digest(),o=n.concat([o,e.v]);a=f(o,t),e.k=i(r,e.k).update(e.v).update(n.from([0])).digest(),e.v=i(r,e.k).update(e.v).digest()}while(-1!==a.cmp(t));return a}function h(t,e,r,n){return t.toRed(s.mont(r)).redPow(e).fromRed().mod(n)}t.exports=function(t,e,r,i,g){var p=u(e);if(p.curve){if("ecdsa"!==i&&"ecdsa/rsa"!==i)throw new Error("wrong private key type");return function(t,e){var r=c[e.curve.join(".")];if(!r)throw new Error("unknown curve "+e.curve.join("."));var i=new a(r).keyFromPrivate(e.privateKey).sign(t);return n.from(i.toDER())}(t,p)}if("dsa"===p.type){if("dsa"!==i)throw new Error("wrong private key type");return function(t,e,r){var i,o=e.params.priv_key,a=e.params.p,u=e.params.q,c=e.params.g,g=new s(0),p=f(t,u).mod(u),m=!1,y=l(o,u,t,r);for(;!1===m;)i=d(u,y,r),g=h(c,i,a,u),0===(m=i.invm(u).imul(p.add(o.mul(g))).mod(u)).cmpn(0)&&(m=!1,g=new s(0));return function(t,e){t=t.toArray(),e=e.toArray(),128&t[0]&&(t=[0].concat(t));128&e[0]&&(e=[0].concat(e));var r=[48,t.length+e.length+4,2,t.length];return r=r.concat(t,[2,e.length],e),n.from(r)}(g,m)}(t,p,r)}if("rsa"!==i&&"ecdsa/rsa"!==i)throw new Error("wrong private key type");t=n.concat([g,t]);for(var m=p.modulus.byteLength(),y=[0,1];t.length+y.length+1<m;)y.push(255);y.push(0);for(var b=-1;++b<t.length;)y.push(t[b]);return o(y,p)},t.exports.getKey=l,t.exports.makeKey=d},function(t,e,r){(function(t){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(346).Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function c(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u<s;u++){var c=t.charCodeAt(u)-48;o*=i,a=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a<i,"Invalid character"),o+=a}return o}function l(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,a=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=u(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,l=r;l<s;l+=n)u=c(t,l,l+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var f=1;for(u=c(t,l,t.length,e),l=0;l<a;l++)f*=e;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype._move=function(t){l(t,this)},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch(t){o.prototype.inspect=f}else o.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],g=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);r=0!==(o=s>>>24-i&16777215)||a!==this.length-1?d[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=h[t],l=g[t];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var p=f.modrn(l).toString(t);r=(f=f.idivn(l)).isZero()?p+r:d[c-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(a,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c<n;c++){for(var l=u>>>26,f=67108863&u,d=Math.min(c,e.length-1),h=Math.max(0,c-t.length+1);h<=d;h++){var g=c-h|0;l+=(a=(i=0|t.words[g])*(o=0|e.words[h])+f)/67108864|0,f=67108863&a}r.words[c]=0|f,u=0|l}return 0!==u?r.words[c]=0|u:r.length--,r._strip()}o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|n;t[r++]=255&a,r<t.length&&(t[r++]=a>>8&255),r<t.length&&(t[r++]=a>>16&255),6===o?(r<t.length&&(t[r++]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},o.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|n;t[r--]=255&a,r>=0&&(t[r--]=a>>8&255),r>=0&&(t[r--]=a>>16&255),6===o?(r>=0&&(t[r--]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a<n.length;a++)o=(e=(0|r.words[a])-(0|n.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,o,a=t.words,s=e.words,u=r.words,c=0,l=0|a[0],f=8191&l,d=l>>>13,h=0|a[1],g=8191&h,p=h>>>13,m=0|a[2],y=8191&m,b=m>>>13,_=0|a[3],v=8191&_,w=_>>>13,E=0|a[4],S=8191&E,O=E>>>13,T=0|a[5],A=8191&T,M=T>>>13,I=0|a[6],R=8191&I,N=I>>>13,k=0|a[7],D=8191&k,j=k>>>13,C=0|a[8],L=8191&C,x=C>>>13,B=0|a[9],U=8191&B,F=B>>>13,P=0|s[0],W=8191&P,z=P>>>13,H=0|s[1],q=8191&H,V=H>>>13,G=0|s[2],Y=8191&G,$=G>>>13,K=0|s[3],Z=8191&K,J=K>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ft=8191<,dt=lt>>>13,ht=0|s[9],gt=8191&ht,pt=ht>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(c+(n=Math.imul(f,W))|0)+((8191&(i=(i=Math.imul(f,z))+Math.imul(d,W)|0))<<13)|0;c=((o=Math.imul(d,z))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(g,W),i=(i=Math.imul(g,z))+Math.imul(p,W)|0,o=Math.imul(p,z);var yt=(c+(n=n+Math.imul(f,q)|0)|0)+((8191&(i=(i=i+Math.imul(f,V)|0)+Math.imul(d,q)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,W),i=(i=Math.imul(y,z))+Math.imul(b,W)|0,o=Math.imul(b,z),n=n+Math.imul(g,q)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(p,q)|0,o=o+Math.imul(p,V)|0;var bt=(c+(n=n+Math.imul(f,Y)|0)|0)+((8191&(i=(i=i+Math.imul(f,$)|0)+Math.imul(d,Y)|0))<<13)|0;c=((o=o+Math.imul(d,$)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(v,W),i=(i=Math.imul(v,z))+Math.imul(w,W)|0,o=Math.imul(w,z),n=n+Math.imul(y,q)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,V)|0,n=n+Math.imul(g,Y)|0,i=(i=i+Math.imul(g,$)|0)+Math.imul(p,Y)|0,o=o+Math.imul(p,$)|0;var _t=(c+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,J)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(S,W),i=(i=Math.imul(S,z))+Math.imul(O,W)|0,o=Math.imul(O,z),n=n+Math.imul(v,q)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(w,q)|0,o=o+Math.imul(w,V)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,$)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,$)|0,n=n+Math.imul(g,Z)|0,i=(i=i+Math.imul(g,J)|0)+Math.imul(p,Z)|0,o=o+Math.imul(p,J)|0;var vt=(c+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(A,W),i=(i=Math.imul(A,z))+Math.imul(M,W)|0,o=Math.imul(M,z),n=n+Math.imul(S,q)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(O,q)|0,o=o+Math.imul(O,V)|0,n=n+Math.imul(v,Y)|0,i=(i=i+Math.imul(v,$)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,$)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,J)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var wt=(c+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(d,rt)|0))<<13)|0;c=((o=o+Math.imul(d,nt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(R,W),i=(i=Math.imul(R,z))+Math.imul(N,W)|0,o=Math.imul(N,z),n=n+Math.imul(A,q)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(M,q)|0,o=o+Math.imul(M,V)|0,n=n+Math.imul(S,Y)|0,i=(i=i+Math.imul(S,$)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,$)|0,n=n+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,J)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,J)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,nt)|0;var Et=(c+(n=n+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(D,W),i=(i=Math.imul(D,z))+Math.imul(j,W)|0,o=Math.imul(j,z),n=n+Math.imul(R,q)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(N,q)|0,o=o+Math.imul(N,V)|0,n=n+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,$)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,$)|0,n=n+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,J)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,J)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0,n=n+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(c+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(L,W),i=(i=Math.imul(L,z))+Math.imul(x,W)|0,o=Math.imul(x,z),n=n+Math.imul(D,q)|0,i=(i=i+Math.imul(D,V)|0)+Math.imul(j,q)|0,o=o+Math.imul(j,V)|0,n=n+Math.imul(R,Y)|0,i=(i=i+Math.imul(R,$)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,$)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,J)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,n=n+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ct)|0;var Ot=(c+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,dt)|0)+Math.imul(d,ft)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(U,W),i=(i=Math.imul(U,z))+Math.imul(F,W)|0,o=Math.imul(F,z),n=n+Math.imul(L,q)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(x,q)|0,o=o+Math.imul(x,V)|0,n=n+Math.imul(D,Y)|0,i=(i=i+Math.imul(D,$)|0)+Math.imul(j,Y)|0,o=o+Math.imul(j,$)|0,n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,J)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,n=n+Math.imul(g,ft)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,dt)|0;var Tt=(c+(n=n+Math.imul(f,gt)|0)|0)+((8191&(i=(i=i+Math.imul(f,pt)|0)+Math.imul(d,gt)|0))<<13)|0;c=((o=o+Math.imul(d,pt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(U,q),i=(i=Math.imul(U,V))+Math.imul(F,q)|0,o=Math.imul(F,V),n=n+Math.imul(L,Y)|0,i=(i=i+Math.imul(L,$)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,$)|0,n=n+Math.imul(D,Z)|0,i=(i=i+Math.imul(D,J)|0)+Math.imul(j,Z)|0,o=o+Math.imul(j,J)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,at)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,at)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,ct)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ct)|0,n=n+Math.imul(y,ft)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,dt)|0;var At=(c+(n=n+Math.imul(g,gt)|0)|0)+((8191&(i=(i=i+Math.imul(g,pt)|0)+Math.imul(p,gt)|0))<<13)|0;c=((o=o+Math.imul(p,pt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(U,Y),i=(i=Math.imul(U,$))+Math.imul(F,Y)|0,o=Math.imul(F,$),n=n+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,J)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,J)|0,n=n+Math.imul(D,Q)|0,i=(i=i+Math.imul(D,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ct)|0,n=n+Math.imul(v,ft)|0,i=(i=i+Math.imul(v,dt)|0)+Math.imul(w,ft)|0,o=o+Math.imul(w,dt)|0;var Mt=(c+(n=n+Math.imul(y,gt)|0)|0)+((8191&(i=(i=i+Math.imul(y,pt)|0)+Math.imul(b,gt)|0))<<13)|0;c=((o=o+Math.imul(b,pt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(U,Z),i=(i=Math.imul(U,J))+Math.imul(F,Z)|0,o=Math.imul(F,J),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(D,rt)|0,i=(i=i+Math.imul(D,nt)|0)+Math.imul(j,rt)|0,o=o+Math.imul(j,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,n=n+Math.imul(S,ft)|0,i=(i=i+Math.imul(S,dt)|0)+Math.imul(O,ft)|0,o=o+Math.imul(O,dt)|0;var It=(c+(n=n+Math.imul(v,gt)|0)|0)+((8191&(i=(i=i+Math.imul(v,pt)|0)+Math.imul(w,gt)|0))<<13)|0;c=((o=o+Math.imul(w,pt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(U,Q),i=(i=Math.imul(U,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(D,ot)|0,i=(i=i+Math.imul(D,at)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,at)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,dt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,dt)|0;var Rt=(c+(n=n+Math.imul(S,gt)|0)|0)+((8191&(i=(i=i+Math.imul(S,pt)|0)+Math.imul(O,gt)|0))<<13)|0;c=((o=o+Math.imul(O,pt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(U,rt),i=(i=Math.imul(U,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,n=n+Math.imul(D,ut)|0,i=(i=i+Math.imul(D,ct)|0)+Math.imul(j,ut)|0,o=o+Math.imul(j,ct)|0,n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,dt)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,dt)|0;var Nt=(c+(n=n+Math.imul(A,gt)|0)|0)+((8191&(i=(i=i+Math.imul(A,pt)|0)+Math.imul(M,gt)|0))<<13)|0;c=((o=o+Math.imul(M,pt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(U,ot),i=(i=Math.imul(U,at))+Math.imul(F,ot)|0,o=Math.imul(F,at),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,n=n+Math.imul(D,ft)|0,i=(i=i+Math.imul(D,dt)|0)+Math.imul(j,ft)|0,o=o+Math.imul(j,dt)|0;var kt=(c+(n=n+Math.imul(R,gt)|0)|0)+((8191&(i=(i=i+Math.imul(R,pt)|0)+Math.imul(N,gt)|0))<<13)|0;c=((o=o+Math.imul(N,pt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(U,ut),i=(i=Math.imul(U,ct))+Math.imul(F,ut)|0,o=Math.imul(F,ct),n=n+Math.imul(L,ft)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(x,ft)|0,o=o+Math.imul(x,dt)|0;var Dt=(c+(n=n+Math.imul(D,gt)|0)|0)+((8191&(i=(i=i+Math.imul(D,pt)|0)+Math.imul(j,gt)|0))<<13)|0;c=((o=o+Math.imul(j,pt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,n=Math.imul(U,ft),i=(i=Math.imul(U,dt))+Math.imul(F,ft)|0,o=Math.imul(F,dt);var jt=(c+(n=n+Math.imul(L,gt)|0)|0)+((8191&(i=(i=i+Math.imul(L,pt)|0)+Math.imul(x,gt)|0))<<13)|0;c=((o=o+Math.imul(x,pt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863;var Ct=(c+(n=Math.imul(U,gt))|0)+((8191&(i=(i=Math.imul(U,pt))+Math.imul(F,gt)|0))<<13)|0;return c=((o=Math.imul(F,pt))+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=yt,u[2]=bt,u[3]=_t,u[4]=vt,u[5]=wt,u[6]=Et,u[7]=St,u[8]=Ot,u[9]=Tt,u[10]=At,u[11]=Mt,u[12]=It,u[13]=Rt,u[14]=Nt,u[15]=kt,u[16]=Dt,u[17]=jt,u[18]=Ct,0!==c&&(u[19]=c,r.length++),r};function y(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var a=i;i=0;for(var s=67108863&n,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,f=(0|t.words[l])*(0|e.words[c]),d=67108863&f;s=67108863&(d=d+s|0),i+=(a=(a=a+(f/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function b(t,e,r){return y(t,e,r)}function _(t,e){this.x=t,this.y=e}Math.imul||(m=p),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?y(this,t,e):b(this,t,e)},_.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},_.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},_.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a<o;a++)n[a]=e[t[a]],i[a]=r[t[a]]},_.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var f=u,d=c,h=0;h<a;h++){var g=r[l+h],p=n[l+h],m=r[l+h+a],y=n[l+h+a],b=f*m-d*y;y=f*y+d*m,m=b,r[l+h]=g+m,n[l+h]=p+y,r[l+h+a]=g-m,n[l+h+a]=p-y,h!==s&&(b=u*f-c*d,d=u*d+c*f,f=b)}},_.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},_.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},_.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},_.prototype.convert13b=function(t,e,r,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)r[a]=0;n(0===o),n(0==(-8192&o))},_.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},_.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),a=new Array(n),s=new Array(n),u=new Array(n),c=new Array(n),l=new Array(n),f=new Array(n),d=r.words;d.length=n,this.convert13b(t.words,t.length,a,n),this.convert13b(e.words,e.length,c,n),this.transform(a,o,s,u,n,i),this.transform(c,o,l,f,n,i);for(var h=0;h<n;h++){var g=s[h]*l[h]-u[h]*f[h];u[h]=s[h]*f[h]+u[h]*l[h],s[h]=g}return this.conjugate(s,u,n),this.transform(s,u,d,o,n,i),this.conjugate(d,o,n),this.normalize13b(d,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r._strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),b(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<r;this.words[e]=u|a,a=s>>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var f=0|this.words[c];this.words[c]=l<<26-o|f>>>o,l=f&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r)&&!!(this.words[r]&i)},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,u=n.length-i.length;if("mod"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=n.clone()._ishlnsubmul(i,1,u);0===l.negative&&(n=l,s&&(s.words[u]=1));for(var f=u-1;f>=0;f--){var d=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(i,d,f);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=d)}return s&&s._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),f=e.clone();!e.isZero();){for(var d=0,h=1;0==(e.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(f)),i.iushrn(1),a.iushrn(1);for(var g=0,p=1;0==(r.words[0]&p)&&g<26;++g,p<<=1);if(g>0)for(r.iushrn(g);g-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(f)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),a.isub(u)):(r.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var f=0,d=1;0==(r.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new A(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function E(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function O(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function T(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(E,w),E.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n<r;n++)e.words[n]=t.words[n];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,n=10;n<t.length;n++){var o=0|t.words[n];t.words[n-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},E.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(S,w),i(O,w),i(T,w),T.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new E;else if("p224"===t)e=new S;else if("p192"===t)e=new O;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new T}return v[t]=e,e},A.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(l(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,i),d=this.pow(t,i.addn(1).iushrn(1)),h=this.pow(t,i),g=a;0!==h.cmp(s);){for(var p=h,m=0;0!==p.cmp(s);m++)p=p.redSqr();n(m<g);var y=this.pow(f,new o(1).iushln(g-m-1));d=d.redMul(y),f=y.redSqr(),h=h.redMul(f),g=m}return d},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var c=e.words[n],l=u-1;l>=0;l--){var f=c>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==a?(a<<=1,a|=f,(4===++s||0===n&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}u=26}return i},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new M(t)},i(M,A),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(84)(t))},function(t,e){},function(t){t.exports=JSON.parse('{"name":"elliptic","version":"6.5.4","description":"EC cryptography","main":"lib/elliptic.js","files":["lib"],"scripts":{"lint":"eslint lib test","lint:fix":"npm run lint -- --fix","unit":"istanbul test _mocha --reporter=spec test/index.js","test":"npm run lint && npm run unit","version":"grunt dist && git add dist/"},"repository":{"type":"git","url":"git@github.com:indutny/elliptic"},"keywords":["EC","Elliptic","curve","Cryptography"],"author":"Fedor Indutny <fedor@indutny.com>","license":"MIT","bugs":{"url":"https://github.com/indutny/elliptic/issues"},"homepage":"https://github.com/indutny/elliptic","devDependencies":{"brfs":"^2.0.2","coveralls":"^3.1.0","eslint":"^7.6.0","grunt":"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1","istanbul":"^0.4.5","mocha":"^8.0.1"},"dependencies":{"bn.js":"^4.11.9","brorand":"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1","inherits":"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}')},function(t,e,r){"use strict";var n=r(47),i=r(39),o=r(12),a=r(104),s=n.assert;function u(t){a.call(this,"short",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function c(t,e,r,n){a.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(e,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function l(t,e,r,n){a.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(e,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,a),t.exports=u,u.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new i(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=(e=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(t.lambda)r=new i(t.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?r=o[0]:(r=o[1],s(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new i(t.a,16),b:new i(t.b,16)}})):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:i.mont(t),r=new i(2).toRed(e).redInvm(),n=r.redNeg(),o=new i(3).toRed(e).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},u.prototype._getEndoBasis=function(t){for(var e,r,n,o,a,s,u,c,l,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=t,h=this.n.clone(),g=new i(1),p=new i(0),m=new i(0),y=new i(1),b=0;0!==d.cmpn(0);){var _=h.div(d);c=h.sub(_.mul(d)),l=m.sub(_.mul(g));var v=y.sub(_.mul(p));if(!n&&c.cmp(f)<0)e=u.neg(),r=g,n=c.neg(),o=l;else if(n&&2==++b)break;u=c,h=d,d=c,m=g,g=l,y=p,p=v}a=c.neg(),s=l;var w=n.sqr().add(o.sqr());return a.sqr().add(s.sqr()).cmp(w)>=0&&(a=e,s=r),n.negative&&(n=n.neg(),o=o.neg()),a.negative&&(a=a.neg(),s=s.neg()),[{a:n,b:o},{a:a,b:s}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),u=i.mul(r.b),c=o.mul(n.b);return{k1:t.sub(a).sub(s),k2:u.add(c).neg()}},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(e&&!o||!e&&o)&&(n=n.redNeg()),this.point(t,n)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var a=this._endoSplit(e[o]),s=t[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),n[2*o]=s,n[2*o+1]=u,i[2*o]=a.k1,i[2*o+1]=a.k2}for(var c=this._wnafMulAdd(1,n,i,2*o,r),l=0;l<2*o;l++)n[l]=null,i[l]=null;return c},o(c,a.BasePoint),u.prototype.point=function(t,e,r){return new c(this,t,e,r)},u.prototype.pointFromJSON=function(t,e){return c.fromJSON(this,t,e)},c.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,n=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(n)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(n)}}}return e}},c.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},c.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var n=t.point(e[0],e[1],r);if(!e[2])return n;function i(e){return t.point(e[0],e[1],r)}var o=e[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(i))}},n},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},c.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(t){return t=new i(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},c.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},c.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},c.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},c.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(l,a.BasePoint),u.prototype.jpoint=function(t,e,r){return new l(this,t,e,r)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(r.redMul(this.z)),s=n.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),f=n.redMul(c),d=u.redSqr().redIAdd(l).redISub(f).redISub(f),h=u.redMul(f.redISub(d)).redISub(o.redMul(l)),g=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,h,g)},l.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),l=r.redMul(u),f=s.redSqr().redIAdd(c).redISub(l).redISub(l),d=s.redMul(l.redISub(f)).redISub(i.redMul(c)),h=this.z.redMul(a);return this.curve.jpoint(f,d,h)},l.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),c=a.redAdd(a);for(e=0;e<t;e++){var l=o.redSqr(),f=c.redSqr(),d=f.redSqr(),h=l.redAdd(l).redIAdd(l).redIAdd(n.redMul(u)),g=o.redMul(f),p=h.redSqr().redISub(g.redAdd(g)),m=g.redISub(p),y=h.redMul(m);y=y.redIAdd(y).redISub(d);var b=c.redMul(s);e+1<t&&(u=u.redMul(d)),o=p,s=b,c=y}return this.curve.jpoint(o,c.redMul(i),s)},l.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},l.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(n).redISub(o);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n),u=s.redSqr().redISub(a).redISub(a),c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=u,e=s.redMul(a.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),f=this.y.redSqr(),d=f.redSqr(),h=this.x.redAdd(f).redSqr().redISub(l).redISub(d);h=h.redIAdd(h);var g=l.redAdd(l).redIAdd(l),p=g.redSqr(),m=d.redIAdd(d);m=(m=m.redIAdd(m)).redIAdd(m),t=p.redISub(h).redISub(h),e=g.redMul(h.redISub(t)).redISub(m),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},l.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(n).redISub(o);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=s.redSqr().redISub(a).redISub(a);t=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),e=s.redMul(a.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),f=this.y.redSqr(),d=this.x.redMul(f),h=this.x.redSub(l).redMul(this.x.redAdd(l));h=h.redAdd(h).redIAdd(h);var g=d.redIAdd(d),p=(g=g.redIAdd(g)).redAdd(g);t=h.redSqr().redISub(p),r=this.y.redAdd(this.z).redSqr().redISub(f).redISub(l);var m=f.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),e=h.redMul(g.redISub(t)).redISub(m)}return this.curve.jpoint(t,e,r)},l.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=e.redSqr(),a=r.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),u=e.redAdd(e),c=(u=u.redIAdd(u)).redMul(a),l=s.redSqr().redISub(c.redAdd(c)),f=c.redISub(l),d=a.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var h=s.redMul(f).redISub(d),g=r.redAdd(r).redMul(n);return this.curve.jpoint(l,h,g)},l.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),n=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),a=this.x.redAdd(e).redSqr().redISub(t).redISub(n),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),u=n.redIAdd(n);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=i.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(u),l=e.redMul(c);l=(l=l.redIAdd(l)).redIAdd(l);var f=this.x.redMul(s).redISub(l);f=(f=f.redIAdd(f)).redIAdd(f);var d=this.y.redMul(c.redMul(u.redISub(c)).redISub(a.redMul(s)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var h=this.z.redAdd(a).redSqr().redISub(r).redISub(s);return this.curve.jpoint(f,d,h)},l.prototype.mul=function(t,e){return t=new i(t,e),this.curve._wnafMul(this,t)},l.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var n=e.redMul(this.z),i=r.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(n)).cmpn(0)},l.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var n=t.clone(),i=this.curve.redN.redMul(e);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},l.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(t,e,r){"use strict";var n=r(39),i=r(12),o=r(104),a=r(47);function s(t){o.call(this,"mont",t),this.a=new n(t.a,16).toRed(this.red),this.b=new n(t.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(t,e,r){o.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(e,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(s,o),t.exports=s,s.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===n.redSqrt().redSqr().cmp(n)},i(u,o.BasePoint),s.prototype.decodePoint=function(t,e){return this.point(a.toArray(t,e),1)},s.prototype.point=function(t,e){return new u(this,t,e)},s.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(t,e){return new u(t,e[0],e[1]||t.one)},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),n=t.redMul(e),i=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(r),a=i.redMul(n),s=e.z.redMul(o.redAdd(a).redSqr()),u=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},u.prototype.mul=function(t){for(var e=t.clone(),r=this,n=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(t,e,r){"use strict";var n=r(47),i=r(39),o=r(12),a=r(104),s=n.assert;function u(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,a.call(this,"edwards",t),this.a=new i(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),s(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function c(t,e,r,n,o){a.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(e,16),this.y=new i(r,16),this.z=n?new i(n,16):this.curve.one,this.t=o&&new i(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}o(u,a),t.exports=u,u.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},u.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},u.prototype.jpoint=function(t,e,r,n){return this.point(t,e,r,n)},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),a=n.redMul(o.redInvm()),s=a.redSqrt();if(0!==s.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");var u=s.fromRed().isOdd();return(e&&!u||!e&&u)&&(s=s.redNeg()),this.point(t,s)},u.prototype.pointFromY=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),a=n.redMul(o.redInvm());if(0===a.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var s=a.redSqrt();if(0!==s.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");return s.fromRed().isOdd()!==e&&(s=s.redNeg()),this.point(s,t)},u.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),n=e.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===n.cmp(i)},o(c,a.BasePoint),u.prototype.pointFromJSON=function(t){return c.fromJSON(this,t)},u.prototype.point=function(t,e,r,n){return new c(this,t,e,r,n)},c.fromJSON=function(t,e){return new c(t,e[0],e[1],e[2])},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},c.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=n.redAdd(e),a=o.redSub(r),s=n.redSub(e),u=i.redMul(a),c=o.redMul(s),l=i.redMul(s),f=a.redMul(o);return this.curve.point(u,c,f,l)},c.prototype._projDbl=function(){var t,e,r,n,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var c=(n=this.curve._mulA(s)).redAdd(u);this.zOne?(t=a.redSub(s).redSub(u).redMul(c.redSub(this.curve.two)),e=c.redMul(n.redSub(u)),r=c.redSqr().redSub(c).redSub(c)):(i=this.z.redSqr(),o=c.redSub(i).redISub(i),t=a.redSub(s).redISub(u).redMul(o),e=c.redMul(n.redSub(u)),r=c.redMul(o))}else n=s.redAdd(u),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),t=this.curve._mulC(a.redISub(n)).redMul(o),e=this.curve._mulC(n).redMul(s.redISub(u)),r=n.redMul(o);return this.curve.point(t,e,r)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),n=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),a=i.redSub(n),s=i.redAdd(n),u=r.redAdd(e),c=o.redMul(a),l=s.redMul(u),f=o.redMul(u),d=a.redMul(s);return this.curve.point(c,l,d,f)},c.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),u=i.redSub(s),c=i.redAdd(s),l=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),f=n.redMul(u).redMul(l);return this.curve.twisted?(e=n.redMul(c).redMul(a.redSub(this.curve._mulA(o))),r=u.redMul(c)):(e=n.redMul(c).redMul(a.redSub(o)),r=this.curve._mulC(u).redMul(c)),this.curve.point(f,e,r)},c.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},c.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},c.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},c.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},c.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(n),0===this.x.cmp(e))return!0}},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add},function(t,e,r){"use strict";e.sha1=r(352),e.sha224=r(353),e.sha256=r(200),e.sha384=r(354),e.sha512=r(201)},function(t,e,r){"use strict";var n=r(49),i=r(87),o=r(199),a=n.rotl32,s=n.sum32,u=n.sum32_5,c=o.ft_1,l=i.BlockHash,f=[1518500249,1859775393,2400959708,3395469782];function d(){if(!(this instanceof d))return new d;l.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(d,l),t.exports=d,d.blockSize=512,d.outSize=160,d.hmacStrength=80,d.padLength=64,d.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=a(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var i=this.h[0],o=this.h[1],l=this.h[2],d=this.h[3],h=this.h[4];for(n=0;n<r.length;n++){var g=~~(n/20),p=u(a(i,5),c(g,o,l,d),h,r[n],f[g]);h=d,d=l,l=a(o,30),o=i,i=p}this.h[0]=s(this.h[0],i),this.h[1]=s(this.h[1],o),this.h[2]=s(this.h[2],l),this.h[3]=s(this.h[3],d),this.h[4]=s(this.h[4],h)},d.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},function(t,e,r){"use strict";var n=r(49),i=r(200);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(o,i),t.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},function(t,e,r){"use strict";var n=r(49),i=r(201);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(o,i),t.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},function(t,e,r){"use strict";var n=r(49),i=r(87),o=n.rotl32,a=n.sum32,s=n.sum32_3,u=n.sum32_4,c=i.BlockHash;function l(){if(!(this instanceof l))return new l;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function f(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}function d(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function h(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}n.inherits(l,c),e.ripemd160=l,l.blockSize=512,l.outSize=160,l.hmacStrength=192,l.padLength=64,l.prototype._update=function(t,e){for(var r=this.h[0],n=this.h[1],i=this.h[2],c=this.h[3],l=this.h[4],b=r,_=n,v=i,w=c,E=l,S=0;S<80;S++){var O=a(o(u(r,f(S,n,i,c),t[g[S]+e],d(S)),m[S]),l);r=l,l=c,c=o(i,10),i=n,n=O,O=a(o(u(b,f(79-S,_,v,w),t[p[S]+e],h(S)),y[S]),E),b=E,E=w,w=o(v,10),v=_,_=O}O=s(this.h[1],i,w),this.h[1]=s(this.h[2],c,E),this.h[2]=s(this.h[3],l,b),this.h[3]=s(this.h[4],r,_),this.h[4]=s(this.h[0],n,v),this.h[0]=O},l.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var g=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],p=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],y=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},function(t,e,r){"use strict";var n=r(49),i=r(46);function o(t,e,r){if(!(this instanceof o))return new o(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(e,r))}t.exports=o,o.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},o.prototype.update=function(t,e){return this.inner.update(t,e),this},o.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)}},function(t,e){t.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},function(t,e,r){"use strict";var n=r(39),i=r(359),o=r(47),a=r(128),s=r(124),u=o.assert,c=r(360),l=r(361);function f(t){if(!(this instanceof f))return new f(t);"string"==typeof t&&(u(Object.prototype.hasOwnProperty.call(a,t),"Unknown curve "+t),t=a[t]),t instanceof a.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}t.exports=f,f.prototype.keyPair=function(t){return new c(this,t)},f.prototype.keyFromPrivate=function(t,e){return c.fromPrivate(this,t,e)},f.prototype.keyFromPublic=function(t,e){return c.fromPublic(this,t,e)},f.prototype.genKeyPair=function(t){t||(t={});for(var e=new i({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||s(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var a=new n(e.generate(r));if(!(a.cmp(o)>0))return a.iaddn(1),this.keyFromPrivate(a)}},f.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},f.prototype.sign=function(t,e,r,o){"object"==typeof r&&(o=r,r=null),o||(o={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new n(t,16));for(var a=this.n.byteLength(),s=e.getPrivate().toArray("be",a),u=t.toArray("be",a),c=new i({hash:this.hash,entropy:s,nonce:u,pers:o.pers,persEnc:o.persEnc||"utf8"}),f=this.n.sub(new n(1)),d=0;;d++){var h=o.k?o.k(d):new n(c.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(f)>=0)){var g=this.g.mul(h);if(!g.isInfinity()){var p=g.getX(),m=p.umod(this.n);if(0!==m.cmpn(0)){var y=h.invm(this.n).mul(m.mul(e.getPrivate()).iadd(t));if(0!==(y=y.umod(this.n)).cmpn(0)){var b=(g.getY().isOdd()?1:0)|(0!==p.cmp(m)?2:0);return o.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),b^=1),new l({r:m,s:y,recoveryParam:b})}}}}}},f.prototype.verify=function(t,e,r,i){t=this._truncateToN(new n(t,16)),r=this.keyFromPublic(r,i);var o=(e=new l(e,"hex")).r,a=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var s,u=a.invm(this.n),c=u.mul(t).umod(this.n),f=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(c,r.getPublic(),f)).isInfinity()&&s.eqXToP(o):!(s=this.g.mulAdd(c,r.getPublic(),f)).isInfinity()&&0===s.getX().umod(this.n).cmp(o)},f.prototype.recoverPubKey=function(t,e,r,i){u((3&r)===r,"The recovery param is more than two bits"),e=new l(e,i);var o=this.n,a=new n(t),s=e.r,c=e.s,f=1&r,d=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");s=d?this.curve.pointFromX(s.add(this.curve.n),f):this.curve.pointFromX(s,f);var h=e.r.invm(o),g=o.sub(a).mul(h).umod(o),p=c.mul(h).umod(o);return this.g.mulAdd(g,s,p)},f.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new l(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},function(t,e,r){"use strict";var n=r(129),i=r(197),o=r(46);function a(t){if(!(this instanceof a))return new a(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=i.toArray(t.entropy,t.entropyEnc||"hex"),r=i.toArray(t.nonce,t.nonceEnc||"hex"),n=i.toArray(t.pers,t.persEnc||"hex");o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}t.exports=a,a.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},a.prototype._hmac=function(){return new n.hmac(this.hash,this.K)},a.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},a.prototype.reseed=function(t,e,r,n){"string"!=typeof e&&(n=r,r=e,e=null),t=i.toArray(t,e),r=i.toArray(r,n),o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},a.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length<t;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var a=o.slice(0,t);return this._update(r),this._reseed++,i.encode(a,e)}},function(t,e,r){"use strict";var n=r(39),i=r(47).assert;function o(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}t.exports=o,o.fromPublic=function(t,e,r){return e instanceof o?e:new o(t,{pub:e,pubEnc:r})},o.fromPrivate=function(t,e,r){return e instanceof o?e:new o(t,{priv:e,privEnc:r})},o.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},o.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(t,e){this.priv=new n(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},o.prototype.derive=function(t){return t.validate()||i(t.validate(),"public point not validated"),t.mul(this.priv).getX()},o.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},o.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},o.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},function(t,e,r){"use strict";var n=r(39),i=r(47),o=i.assert;function a(t,e){if(t instanceof a)return t;this._importDER(t,e)||(o(t.r&&t.s,"Signature without r or s"),this.r=new n(t.r,16),this.s=new n(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function s(){this.place=0}function u(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,a=e.place;o<n;o++,a++)i<<=8,i|=t[a],i>>>=0;return!(i<=127)&&(e.place=a,i)}function c(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function l(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}t.exports=a,a.prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new s;if(48!==t[r.place++])return!1;var o=u(t,r);if(!1===o)return!1;if(o+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var a=u(t,r);if(!1===a)return!1;var c=t.slice(r.place,a+r.place);if(r.place+=a,2!==t[r.place++])return!1;var l=u(t,r);if(!1===l)return!1;if(t.length!==l+r.place)return!1;var f=t.slice(r.place,l+r.place);if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}if(0===f[0]){if(!(128&f[1]))return!1;f=f.slice(1)}return this.r=new n(c),this.s=new n(f),this.recoveryParam=null,!0},a.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=c(e),r=c(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];l(n,e.length),(n=n.concat(e)).push(2),l(n,r.length);var o=n.concat(r),a=[48];return l(a,o.length),a=a.concat(o),i.encode(a,t)}},function(t,e,r){"use strict";var n=r(129),i=r(128),o=r(47),a=o.assert,s=o.parseBytes,u=r(363),c=r(364);function l(t){if(a("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof l))return new l(t);t=i[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=n.sha512}t.exports=l,l.prototype.sign=function(t,e){t=s(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),o=this.encodePoint(i),a=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),u=n.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:o})},l.prototype.verify=function(t,e,r){t=s(t),e=this.makeSignature(e);var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(o)},l.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return o.intFromLE(t.digest()).umod(this.curve.n)},l.prototype.keyFromPublic=function(t){return u.fromPublic(this,t)},l.prototype.keyFromSecret=function(t){return u.fromSecret(this,t)},l.prototype.makeSignature=function(t){return t instanceof c?t:new c(this,t)},l.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},l.prototype.decodePoint=function(t){var e=(t=o.parseBytes(t)).length-1,r=t.slice(0,e).concat(-129&t[e]),n=0!=(128&t[e]),i=o.intFromLE(r);return this.curve.pointFromY(i,n)},l.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},l.prototype.decodeInt=function(t){return o.intFromLE(t)},l.prototype.isPoint=function(t){return t instanceof this.pointClass}},function(t,e,r){"use strict";var n=r(47),i=n.assert,o=n.parseBytes,a=n.cachedProperty;function s(t,e){this.eddsa=t,this._secret=o(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=o(e.pub)}s.fromPublic=function(t,e){return e instanceof s?e:new s(t,{pub:e})},s.fromSecret=function(t,e){return e instanceof s?e:new s(t,{secret:e})},s.prototype.secret=function(){return this._secret},a(s,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),a(s,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),a(s,"privBytes",(function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,n=e.slice(0,t.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),a(s,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),a(s,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),a(s,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),s.prototype.sign=function(t){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},s.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},s.prototype.getSecret=function(t){return i(this._secret,"KeyPair is public only"),n.encode(this.secret(),t)},s.prototype.getPublic=function(t){return n.encode(this.pubBytes(),t)},t.exports=s},function(t,e,r){"use strict";var n=r(39),i=r(47),o=i.assert,a=i.cachedProperty,s=i.parseBytes;function u(t,e){this.eddsa=t,"object"!=typeof e&&(e=s(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),o(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof n&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}a(u,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),a(u,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),a(u,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),a(u,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},t.exports=u},function(t,e){},function(t,e,r){"use strict";var n=r(203);e.certificate=r(372);var i=n.define("RSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}));e.RSAPrivateKey=i;var o=n.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));e.RSAPublicKey=o;var a=n.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())}));e.PublicKey=a;var s=n.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())})),u=n.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(s),this.key("subjectPrivateKey").octstr())}));e.PrivateKey=u;var c=n.define("EncryptedPrivateKeyInfo",(function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())}));e.EncryptedPrivateKey=c;var l=n.define("DSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())}));e.DSAPrivateKey=l,e.DSAparam=n.define("DSAparam",(function(){this.int()}));var f=n.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(d),this.key("publicKey").optional().explicit(1).bitstr())}));e.ECPrivateKey=f;var d=n.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})}));e.signature=n.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}))},function(t,e,r){"use strict";const n=r(204),i=r(206),o=r(12);function a(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}e.define=function(t,e){return new a(t,e)},a.prototype._createNamed=function(t){const e=this.name;function r(t){this._initNamed(t,e)}return o(r,t),r.prototype._initNamed=function(e,r){t.call(this,e,r)},new r(this)},a.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(i[t])),this.decoders[t]},a.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},a.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(n[t])),this.encoders[t]},a.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}},function(t,e,r){"use strict";const n=r(12),i=r(205);function o(t){i.call(this,t),this.enc="pem"}n(o,i),t.exports=o,o.prototype.encode=function(t,e){const r=i.prototype.encode.call(this,t).toString("base64"),n=["-----BEGIN "+e.label+"-----"];for(let t=0;t<r.length;t+=64)n.push(r.slice(t,t+64));return n.push("-----END "+e.label+"-----"),n.join("\n")}},function(t,e,r){"use strict";const n=r(12),i=r(130).Buffer,o=r(207);function a(t){o.call(this,t),this.enc="pem"}n(a,o),t.exports=a,a.prototype.decode=function(t,e){const r=t.toString().split(/[\r\n]+/g),n=e.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/;let s=-1,u=-1;for(let t=0;t<r.length;t++){const e=r[t].match(a);if(null!==e&&e[2]===n){if(-1!==s){if("END"!==e[1])break;u=t;break}if("BEGIN"!==e[1])break;s=t}}if(-1===s||-1===u)throw new Error("PEM section not found for: "+n);const c=r.slice(s+1,u).join("");c.replace(/[^a-z0-9+/=]+/gi,"");const l=i.from(c,"base64");return o.prototype.decode.call(this,l,e)}},function(t,e,r){"use strict";const n=e;n.Reporter=r(132).Reporter,n.DecoderBuffer=r(88).DecoderBuffer,n.EncoderBuffer=r(88).EncoderBuffer,n.Node=r(131)},function(t,e,r){"use strict";const n=e;n._reverse=function(t){const e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);const n=t[r];e[n]=r})),e},n.der=r(133)},function(t,e,r){"use strict";var n=r(203),i=n.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),o=n.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),a=n.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),s=n.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(a),this.key("subjectPublicKey").bitstr())})),u=n.define("RelativeDistinguishedName",(function(){this.setof(o)})),c=n.define("RDNSequence",(function(){this.seqof(u)})),l=n.define("Name",(function(){this.choice({rdnSequence:this.use(c)})})),f=n.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(i),this.key("notAfter").use(i))})),d=n.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),h=n.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(a),this.key("issuer").use(l),this.key("validity").use(f),this.key("subject").use(l),this.key("subjectPublicKeyInfo").use(s),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(d).optional())})),g=n.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(h),this.key("signatureAlgorithm").use(a),this.key("signatureValue").bitstr())}));t.exports=g},function(t){t.exports=JSON.parse('{"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}')},function(t,e,r){var n=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,i=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,o=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,a=r(103),s=r(122),u=r(19).Buffer;t.exports=function(t,e){var r,c=t.toString(),l=c.match(n);if(l){var f="aes"+l[1],d=u.from(l[2],"hex"),h=u.from(l[3].replace(/[\r\n]/g,""),"base64"),g=a(e,d.slice(0,8),parseInt(l[1],10)).key,p=[],m=s.createDecipheriv(f,g,d);p.push(m.update(h)),p.push(m.final()),r=u.concat(p)}else{var y=c.match(o);r=u.from(y[2].replace(/[\r\n]/g,""),"base64")}return{tag:c.match(i)[1],data:r}}},function(t,e,r){var n=r(19).Buffer,i=r(202),o=r(127).ec,a=r(105),s=r(208);function u(t,e){if(t.cmpn(0)<=0)throw new Error("invalid sig");if(t.cmp(e)>=e)throw new Error("invalid sig")}t.exports=function(t,e,r,c,l){var f=a(r);if("ec"===f.type){if("ecdsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");return function(t,e,r){var n=s[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var i=new o(n),a=r.data.subjectPrivateKey.data;return i.verify(e,t,a)}(t,e,f)}if("dsa"===f.type){if("dsa"!==c)throw new Error("wrong public key type");return function(t,e,r){var n=r.data.p,o=r.data.q,s=r.data.g,c=r.data.pub_key,l=a.signature.decode(t,"der"),f=l.s,d=l.r;u(f,o),u(d,o);var h=i.mont(n),g=f.invm(o);return 0===s.toRed(h).redPow(new i(e).mul(g).mod(o)).fromRed().mul(c.toRed(h).redPow(d.mul(g).mod(o)).fromRed()).mod(n).mod(o).cmp(d)}(t,e,f)}if("rsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");e=n.concat([l,e]);for(var d=f.modulus.byteLength(),h=[1],g=0;e.length+h.length+2<d;)h.push(255),g++;h.push(0);for(var p=-1;++p<e.length;)h.push(e[p]);h=n.from(h);var m=i.mont(f.modulus);t=(t=new i(t).toRed(m)).redPow(new i(f.publicExponent)),t=n.from(t.fromRed().toArray());var y=g<8?1:0;for(d=Math.min(t.length,h.length),t.length!==h.length&&(y=1),p=-1;++p<d;)y|=t[p]^h[p];return 0===y}},function(t,e,r){(function(e){var n=r(127),i=r(39);t.exports=function(t){return new a(t)};var o={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function a(t){this.curveType=o[t],this.curveType||(this.curveType={name:t}),this.curve=new n.ec(this.curveType.name),this.keys=void 0}function s(t,r,n){Array.isArray(t)||(t=t.toArray());var i=new e(t);if(n&&i.length<n){var o=new e(n-i.length);o.fill(0),i=e.concat([o,i])}return r?i.toString(r):i}o.p224=o.secp224r1,o.p256=o.secp256r1=o.prime256v1,o.p192=o.secp192r1=o.prime192v1,o.p384=o.secp384r1,o.p521=o.secp521r1,a.prototype.generateKeys=function(t,e){return this.keys=this.curve.genKeyPair(),this.getPublicKey(t,e)},a.prototype.computeSecret=function(t,r,n){return r=r||"utf8",e.isBuffer(t)||(t=new e(t,r)),s(this.curve.keyFromPublic(t).getPublic().mul(this.keys.getPrivate()).getX(),n,this.curveType.byteLength)},a.prototype.getPublicKey=function(t,e){var r=this.keys.getPublic("compressed"===e,!0);return"hybrid"===e&&(r[r.length-1]%2?r[0]=7:r[0]=6),s(r,t)},a.prototype.getPrivateKey=function(t){return s(this.keys.getPrivate(),t)},a.prototype.setPublicKey=function(t,r){return r=r||"utf8",e.isBuffer(t)||(t=new e(t,r)),this.keys._importPublic(t),this},a.prototype.setPrivateKey=function(t,r){r=r||"utf8",e.isBuffer(t)||(t=new e(t,r));var n=new i(t);return n=n.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(n),this}}).call(this,r(16).Buffer)},function(t,e,r){e.publicEncrypt=r(378),e.privateDecrypt=r(379),e.privateEncrypt=function(t,r){return e.publicEncrypt(t,r,!0)},e.publicDecrypt=function(t,r){return e.privateDecrypt(t,r,!0)}},function(t,e,r){var n=r(105),i=r(69),o=r(85),a=r(209),s=r(210),u=r(39),c=r(211),l=r(126),f=r(19).Buffer;t.exports=function(t,e,r){var d;d=t.padding?t.padding:r?1:4;var h,g=n(t);if(4===d)h=function(t,e){var r=t.modulus.byteLength(),n=e.length,c=o("sha1").update(f.alloc(0)).digest(),l=c.length,d=2*l;if(n>r-d-2)throw new Error("message too long");var h=f.alloc(r-n-d-2),g=r-l-1,p=i(l),m=s(f.concat([c,h,f.alloc(1,1),e],g),a(p,g)),y=s(p,a(m,l));return new u(f.concat([f.alloc(1),y,m],r))}(g,e);else if(1===d)h=function(t,e,r){var n,o=e.length,a=t.modulus.byteLength();if(o>a-11)throw new Error("message too long");n=r?f.alloc(a-o-3,255):function(t){var e,r=f.allocUnsafe(t),n=0,o=i(2*t),a=0;for(;n<t;)a===o.length&&(o=i(2*t),a=0),(e=o[a++])&&(r[n++]=e);return r}(a-o-3);return new u(f.concat([f.from([0,r?1:2]),n,f.alloc(1),e],a))}(g,e,r);else{if(3!==d)throw new Error("unknown padding");if((h=new u(e)).cmp(g.modulus)>=0)throw new Error("data too long for modulus")}return r?l(h,g):c(h,g)}},function(t,e,r){var n=r(105),i=r(209),o=r(210),a=r(39),s=r(126),u=r(85),c=r(211),l=r(19).Buffer;t.exports=function(t,e,r){var f;f=t.padding?t.padding:r?1:4;var d,h=n(t),g=h.modulus.byteLength();if(e.length>g||new a(e).cmp(h.modulus)>=0)throw new Error("decryption error");d=r?c(new a(e),h):s(e,h);var p=l.alloc(g-d.length);if(d=l.concat([p,d],g),4===f)return function(t,e){var r=t.modulus.byteLength(),n=u("sha1").update(l.alloc(0)).digest(),a=n.length;if(0!==e[0])throw new Error("decryption error");var s=e.slice(1,a+1),c=e.slice(a+1),f=o(s,i(c,a)),d=o(c,i(f,r-a-1));if(function(t,e){t=l.from(t),e=l.from(e);var r=0,n=t.length;t.length!==e.length&&(r++,n=Math.min(t.length,e.length));var i=-1;for(;++i<n;)r+=t[i]^e[i];return r}(n,d.slice(0,a)))throw new Error("decryption error");var h=a;for(;0===d[h];)h++;if(1!==d[h++])throw new Error("decryption error");return d.slice(h)}(h,d);if(1===f)return function(t,e,r){var n=e.slice(0,2),i=2,o=0;for(;0!==e[i++];)if(i>=e.length){o++;break}var a=e.slice(2,i-1);("0002"!==n.toString("hex")&&!r||"0001"!==n.toString("hex")&&r)&&o++;a.length<8&&o++;if(o)throw new Error("decryption error");return e.slice(i)}(0,d,r);if(3===f)return d;throw new Error("unknown padding")}},function(t,e,r){"use strict";(function(t,n){function i(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var o=r(19),a=r(69),s=o.Buffer,u=o.kMaxLength,c=t.crypto||t.msCrypto,l=Math.pow(2,32)-1;function f(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>l||t<0)throw new TypeError("offset must be a uint32");if(t>u||t>e)throw new RangeError("offset out of range")}function d(t,e,r){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>l||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>u)throw new RangeError("buffer too small")}function h(t,e,r,i){if(n.browser){var o=t.buffer,s=new Uint8Array(o,e,r);return c.getRandomValues(s),i?void n.nextTick((function(){i(null,t)})):t}if(!i)return a(r).copy(t,e),t;a(r,(function(r,n){if(r)return i(r);n.copy(t,e),i(null,t)}))}c&&c.getRandomValues||!n.browser?(e.randomFill=function(e,r,n,i){if(!(s.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof r)i=r,r=0,n=e.length;else if("function"==typeof n)i=n,n=e.length-r;else if("function"!=typeof i)throw new TypeError('"cb" argument must be a function');return f(r,e.length),d(n,r,e.length),h(e,r,n,i)},e.randomFillSync=function(e,r,n){void 0===r&&(r=0);if(!(s.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');f(r,e.length),void 0===n&&(n=e.length-r);return d(n,r,e.length),h(e,r,n)}):(e.randomFill=i,e.randomFillSync=i)}).call(this,r(33),r(25))},function(t,e,r){(function(e){const n=r(159),i=r(160),o=r(81);t.exports=function(t,r){var a=[],s={},u=e.alloc(0),c=new i.MainHeader,l=!1;const f=Object.assign(Object.create(null),r),{noSort:d}=f;function h(){l=!0,s={},a=new Array(c.diskEntries);for(var e=c.offset,r=0;r<a.length;r++){var i=e,u=new n(t);u.header=t.slice(i,i+=o.Constants.CENHDR),u.entryName=t.slice(i,i+=u.header.fileNameLength),u.header.extraLength&&(u.extra=t.slice(i,i+=u.header.extraLength)),u.header.commentLength&&(u.comment=t.slice(i,i+u.header.commentLength)),e+=u.header.entryHeaderSize,a[r]=u,s[u.entryName]=u}}function g(){a.length>1&&!d&&a.sort((t,e)=>t.entryName.toLowerCase().localeCompare(e.entryName.toLowerCase()))}return t?function(e){var r=t.length-o.Constants.ENDHDR,n=Math.max(0,r-65535),i=n,a=t.length,s=-1,l=0;for(;r>=i;r--)if(80===t[r])if(t.readUInt32LE(r)!==o.Constants.ENDSIG)if(t.readUInt32LE(r)!==o.Constants.END64SIG){if(t.readUInt32LE(r)===o.Constants.ZIP64SIG){s=r,a=r+o.readBigUInt64LE(t,r+o.Constants.ZIP64SIZE)+o.Constants.ZIP64LEAD;break}}else i=n;else s=r,l=r,a=r+o.Constants.ENDHDR,i=r-o.Constants.END64HDR;if(!~s)throw new Error(o.Errors.INVALID_FORMAT);c.loadFromBinary(t.slice(s,a)),c.commentLength&&(u=t.slice(l+o.Constants.ENDHDR));e&&h()}(f.readEntries):l=!0,{get entries(){return l||h(),a},get comment(){return u.toString()},set comment(t){u=o.toBuffer(t),c.commentLength=u.length},getEntryCount:function(){return l?a.length:c.diskEntries},forEach:function(e){l?a.forEach(e):function(e){const r=c.diskEntries;let i=c.offset;for(let a=0;a<r;a++){let r=i;const a=new n(t);a.header=t.slice(r,r+=o.Constants.CENHDR),a.entryName=t.slice(r,r+=a.header.fileNameLength),i+=a.header.entryHeaderSize,e(a)}}(e)},getEntry:function(t){return l||h(),s[t]||null},setEntry:function(t){l||h(),a.push(t),s[t.entryName]=t,c.totalEntries=a.length},deleteEntry:function(t){l||h();var e=s[t];if(e&&e.isDirectory){var r=this;this.getEntryChildren(e).forEach((function(e){e.entryName!==t&&r.deleteEntry(e.entryName)}))}a.splice(a.indexOf(e),1),delete s[t],c.totalEntries=a.length},getEntryChildren:function(t){if(l||h(),t&&t.isDirectory){const e=[],r=t.entryName,n=r.length;return a.forEach((function(t){t.entryName.substr(0,n)===r&&e.push(t)})),e}return[]},compressToBuffer:function(){l||h(),g();const t=[],r=[];let n=0,i=0;c.size=0,c.offset=0;for(const o of a){const a=o.getCompressedData();o.header.offset=i;const s=o.header.dataHeaderToBinary(),u=o.rawEntryName.length,l=e.alloc(u+o.extra.length);o.rawEntryName.copy(l,0),l.copy(o.extra,u);const f=s.length+l.length+a.length;i+=f,t.push(s),t.push(l),t.push(a);const d=o.packHeader();r.push(d),c.size+=d.length,n+=f+d.length}n+=c.mainHeaderSize,c.offset=i,i=0;const s=e.alloc(n);for(const e of t)e.copy(s,i),i+=e.length;for(const t of r)t.copy(s,i),i+=t.length;const f=c.toBinary();return u&&u.copy(f,o.Constants.ENDHDR),f.copy(s,i),s},toAsyncBuffer:function(t,r,n,i){try{l||h(),g();const r=[],s=[];let f=0,d=0;c.size=0,c.offset=0;const p=function(a){if(a.length){const t=a.pop(),o=t.entryName+t.extra.toString();n&&n(o),t.getCompressedDataAsync((function(n){i&&i(o),t.header.offset=d;const u=t.header.dataHeaderToBinary(),l=e.alloc(o.length,o),h=u.length+l.length+n.length;d+=h,r.push(u),r.push(l),r.push(n);const g=t.packHeader();s.push(g),c.size+=g.length,f+=h+g.length,p(a)}))}else{f+=c.mainHeaderSize,c.offset=d,d=0;const n=e.alloc(f);r.forEach((function(t){t.copy(n,d),d+=t.length})),s.forEach((function(t){t.copy(n,d),d+=t.length}));const i=c.toBinary();u&&u.copy(i,o.Constants.ENDHDR),i.copy(n,d),t(n)}};p(a)}catch(t){r(t)}}}}}).call(this,r(16).Buffer)},function(t,e,r){var n,i,o=r(212),a=r(213),s=0,u=0;t.exports=function(t,e,r){var c=e&&r||0,l=e||[],f=(t=t||{}).node||n,d=void 0!==t.clockseq?t.clockseq:i;if(null==f||null==d){var h=o();null==f&&(f=n=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==d&&(d=i=16383&(h[6]<<8|h[7]))}var g=void 0!==t.msecs?t.msecs:(new Date).getTime(),p=void 0!==t.nsecs?t.nsecs:u+1,m=g-s+(p-u)/1e4;if(m<0&&void 0===t.clockseq&&(d=d+1&16383),(m<0||g>s)&&void 0===t.nsecs&&(p=0),p>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");s=g,u=p,i=d;var y=(1e4*(268435455&(g+=122192928e5))+p)%4294967296;l[c++]=y>>>24&255,l[c++]=y>>>16&255,l[c++]=y>>>8&255,l[c++]=255&y;var b=g/4294967296*1e4&268435455;l[c++]=b>>>8&255,l[c++]=255&b,l[c++]=b>>>24&15|16,l[c++]=b>>>16&255,l[c++]=d>>>8|128,l[c++]=255&d;for(var _=0;_<6;++_)l[c+_]=f[_];return e||a(l)}},function(t,e,r){var n=r(212),i=r(213);t.exports=function(t,e,r){var o=e&&r||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var a=(t=t||{}).random||(t.rng||n)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,e)for(var s=0;s<16;++s)e[o+s]=a[s];return e||i(a)}},function(t,e,r){"use strict";function n(t){var e=this;if(e instanceof n||(e=new n),e.tail=null,e.head=null,e.length=0,t&&"function"==typeof t.forEach)t.forEach((function(t){e.push(t)}));else if(arguments.length>0)for(var r=0,i=arguments.length;r<i;r++)e.push(arguments[r]);return e}function i(t,e,r){var n=e===t.head?new s(r,null,e,t):new s(r,e,e.next,t);return null===n.next&&(t.tail=n),null===n.prev&&(t.head=n),t.length++,n}function o(t,e){t.tail=new s(e,t.tail,null,t),t.head||(t.head=t.tail),t.length++}function a(t,e){t.head=new s(e,null,t.head,t),t.tail||(t.tail=t.head),t.length++}function s(t,e,r,n){if(!(this instanceof s))return new s(t,e,r,n);this.list=n,this.value=t,e?(e.next=this,this.prev=e):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}t.exports=n,n.Node=s,n.create=n,n.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var e=t.next,r=t.prev;return e&&(e.prev=r),r&&(r.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=r),t.list.length--,t.next=null,t.prev=null,t.list=null,e},n.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}},n.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}},n.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++)o(this,arguments[t]);return this.length},n.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++)a(this,arguments[t]);return this.length},n.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}},n.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}},n.prototype.forEach=function(t,e){e=e||this;for(var r=this.head,n=0;null!==r;n++)t.call(e,r.value,n,this),r=r.next},n.prototype.forEachReverse=function(t,e){e=e||this;for(var r=this.tail,n=this.length-1;null!==r;n--)t.call(e,r.value,n,this),r=r.prev},n.prototype.get=function(t){for(var e=0,r=this.head;null!==r&&e<t;e++)r=r.next;if(e===t&&null!==r)return r.value},n.prototype.getReverse=function(t){for(var e=0,r=this.tail;null!==r&&e<t;e++)r=r.prev;if(e===t&&null!==r)return r.value},n.prototype.map=function(t,e){e=e||this;for(var r=new n,i=this.head;null!==i;)r.push(t.call(e,i.value,this)),i=i.next;return r},n.prototype.mapReverse=function(t,e){e=e||this;for(var r=new n,i=this.tail;null!==i;)r.push(t.call(e,i.value,this)),i=i.prev;return r},n.prototype.reduce=function(t,e){var r,n=this.head;if(arguments.length>1)r=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");n=this.head.next,r=this.head.value}for(var i=0;null!==n;i++)r=t(r,n.value,i),n=n.next;return r},n.prototype.reduceReverse=function(t,e){var r,n=this.tail;if(arguments.length>1)r=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");n=this.tail.prev,r=this.tail.value}for(var i=this.length-1;null!==n;i--)r=t(r,n.value,i),n=n.prev;return r},n.prototype.toArray=function(){for(var t=new Array(this.length),e=0,r=this.head;null!==r;e++)t[e]=r.value,r=r.next;return t},n.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,r=this.tail;null!==r;e++)t[e]=r.value,r=r.prev;return t},n.prototype.slice=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var r=new n;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var i=0,o=this.head;null!==o&&i<t;i++)o=o.next;for(;null!==o&&i<e;i++,o=o.next)r.push(o.value);return r},n.prototype.sliceReverse=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var r=new n;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var i=this.length,o=this.tail;null!==o&&i>e;i--)o=o.prev;for(;null!==o&&i>t;i--,o=o.prev)r.push(o.value);return r},n.prototype.splice=function(t,e){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var r=0,n=this.head;null!==n&&r<t;r++)n=n.next;var o=[];for(r=0;n&&r<e;r++)o.push(n.value),n=this.removeNode(n);null===n&&(n=this.tail),n!==this.head&&n!==this.tail&&(n=n.prev);for(r=2;r<arguments.length;r++)n=i(this,n,arguments[r]);return o},n.prototype.reverse=function(){for(var t=this.head,e=this.tail,r=t;null!==r;r=r.prev){var n=r.prev;r.prev=r.next,r.next=n}return this.head=e,this.tail=t,this};try{r(385)(n)}catch(t){}},function(t,e,r){"use strict";t.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}},function(module,exports,__webpack_require__){(function(global,Buffer){var $jscomp=$jscomp||{};$jscomp.scope={},$jscomp.findInternal=function(t,e,r){t instanceof String&&(t=String(t));for(var n=t.length,i=0;i<n;i++){var o=t[i];if(e.call(r,o,i,t))return{i:i,v:o}}return{i:-1,v:void 0}},$jscomp.ASSUME_ES5=!1,$jscomp.ASSUME_NO_NATIVE_MAP=!1,$jscomp.ASSUME_NO_NATIVE_SET=!1,$jscomp.SIMPLE_FROUND_POLYFILL=!1,$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,r){t!=Array.prototype&&t!=Object.prototype&&(t[e]=r.value)},$jscomp.getGlobal=function(t){return"undefined"!=typeof window&&window===t?t:void 0!==global&&null!=global?global:t},$jscomp.global=$jscomp.getGlobal(this),$jscomp.polyfill=function(t,e,r,n){if(e){for(r=$jscomp.global,t=t.split("."),n=0;n<t.length-1;n++){var i=t[n];i in r||(r[i]={}),r=r[i]}(e=e(n=r[t=t[t.length-1]]))!=n&&null!=e&&$jscomp.defineProperty(r,t,{configurable:!0,writable:!0,value:e})}},$jscomp.polyfill("Array.prototype.findIndex",(function(t){return t||function(t,e){return $jscomp.findInternal(this,t,e).i}}),"es6","es3"),$jscomp.checkStringArgs=function(t,e,r){if(null==t)throw new TypeError("The 'this' value for String.prototype."+r+" must not be null or undefined");if(e instanceof RegExp)throw new TypeError("First argument to String.prototype."+r+" must not be a regular expression");return t+""},$jscomp.polyfill("String.prototype.endsWith",(function(t){return t||function(t,e){var r=$jscomp.checkStringArgs(this,t,"endsWith");t+="",void 0===e&&(e=r.length),e=Math.max(0,Math.min(0|e,r.length));for(var n=t.length;0<n&&0<e;)if(r[--e]!=t[--n])return!1;return 0>=n}}),"es6","es3"),$jscomp.polyfill("Array.prototype.find",(function(t){return t||function(t,e){return $jscomp.findInternal(this,t,e).v}}),"es6","es3"),$jscomp.polyfill("String.prototype.startsWith",(function(t){return t||function(t,e){var r=$jscomp.checkStringArgs(this,t,"startsWith");t+="";var n=r.length,i=t.length;e=Math.max(0,Math.min(0|e,r.length));for(var o=0;o<i&&e<n;)if(r[e++]!=t[o++])return!1;return o>=i}}),"es6","es3"),$jscomp.polyfill("String.prototype.repeat",(function(t){return t||function(t){var e=$jscomp.checkStringArgs(this,null,"repeat");if(0>t||1342177279<t)throw new RangeError("Invalid count value");t|=0;for(var r="";t;)1&t&&(r+=e),(t>>>=1)&&(e+=e);return r}}),"es6","es3");var COMPILED=!0,goog=goog||{};goog.global=this||self,goog.isDef=function(t){return void 0!==t},goog.isString=function(t){return"string"==typeof t},goog.isBoolean=function(t){return"boolean"==typeof t},goog.isNumber=function(t){return"number"==typeof t},goog.exportPath_=function(t,e,r){t=t.split("."),r=r||goog.global,t[0]in r||void 0===r.execScript||r.execScript("var "+t[0]);for(var n;t.length&&(n=t.shift());)!t.length&&goog.isDef(e)?r[n]=e:r=r[n]&&r[n]!==Object.prototype[n]?r[n]:r[n]={}},goog.define=function(t,e){if(!COMPILED){var r=goog.global.CLOSURE_UNCOMPILED_DEFINES,n=goog.global.CLOSURE_DEFINES;r&&void 0===r.nodeType&&Object.prototype.hasOwnProperty.call(r,t)?e=r[t]:n&&void 0===n.nodeType&&Object.prototype.hasOwnProperty.call(n,t)&&(e=n[t])}return e},goog.FEATURESET_YEAR=2012,goog.DEBUG=!0,goog.LOCALE="en",goog.TRUSTED_SITE=!0,goog.STRICT_MODE_COMPATIBLE=!1,goog.DISALLOW_TEST_ONLY_CODE=COMPILED&&!goog.DEBUG,goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING=!1,goog.provide=function(t){if(goog.isInModuleLoader_())throw Error("goog.provide cannot be used within a module.");if(!COMPILED&&goog.isProvided_(t))throw Error('Namespace "'+t+'" already declared.');goog.constructNamespace_(t)},goog.constructNamespace_=function(t,e){if(!COMPILED){delete goog.implicitNamespaces_[t];for(var r=t;(r=r.substring(0,r.lastIndexOf(".")))&&!goog.getObjectByName(r);)goog.implicitNamespaces_[r]=!0}goog.exportPath_(t,e)},goog.getScriptNonce=function(t){return t&&t!=goog.global?goog.getScriptNonce_(t.document):(null===goog.cspNonce_&&(goog.cspNonce_=goog.getScriptNonce_(goog.global.document)),goog.cspNonce_)},goog.NONCE_PATTERN_=/^[\w+/_-]+[=]{0,2}$/,goog.cspNonce_=null,goog.getScriptNonce_=function(t){return(t=t.querySelector&&t.querySelector("script[nonce]"))&&(t=t.nonce||t.getAttribute("nonce"))&&goog.NONCE_PATTERN_.test(t)?t:""},goog.VALID_MODULE_RE_=/^[a-zA-Z_$][a-zA-Z0-9._$]*$/,goog.module=function(t){if(!goog.isString(t)||!t||-1==t.search(goog.VALID_MODULE_RE_))throw Error("Invalid module identifier");if(!goog.isInGoogModuleLoader_())throw Error("Module "+t+" has been loaded incorrectly. Note, modules cannot be loaded as normal scripts. They require some kind of pre-processing step. You're likely trying to load a module via a script tag or as a part of a concatenated bundle without rewriting the module. For more info see: https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide.");if(goog.moduleLoaderState_.moduleName)throw Error("goog.module may only be called once per module.");if(goog.moduleLoaderState_.moduleName=t,!COMPILED){if(goog.isProvided_(t))throw Error('Namespace "'+t+'" already declared.');delete goog.implicitNamespaces_[t]}},goog.module.get=function(t){return goog.module.getInternal_(t)},goog.module.getInternal_=function(t){if(!COMPILED){if(t in goog.loadedModules_)return goog.loadedModules_[t].exports;if(!goog.implicitNamespaces_[t])return null!=(t=goog.getObjectByName(t))?t:null}return null},goog.ModuleType={ES6:"es6",GOOG:"goog"},goog.moduleLoaderState_=null,goog.isInModuleLoader_=function(){return goog.isInGoogModuleLoader_()||goog.isInEs6ModuleLoader_()},goog.isInGoogModuleLoader_=function(){return!!goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.GOOG},goog.isInEs6ModuleLoader_=function(){if(goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.ES6)return!0;var t=goog.global.$jscomp;return!!t&&("function"==typeof t.getCurrentModulePath&&!!t.getCurrentModulePath())},goog.module.declareLegacyNamespace=function(){if(!COMPILED&&!goog.isInGoogModuleLoader_())throw Error("goog.module.declareLegacyNamespace must be called from within a goog.module");if(!COMPILED&&!goog.moduleLoaderState_.moduleName)throw Error("goog.module must be called prior to goog.module.declareLegacyNamespace.");goog.moduleLoaderState_.declareLegacyNamespace=!0},goog.declareModuleId=function(t){if(!COMPILED){if(!goog.isInEs6ModuleLoader_())throw Error("goog.declareModuleId may only be called from within an ES6 module");if(goog.moduleLoaderState_&&goog.moduleLoaderState_.moduleName)throw Error("goog.declareModuleId may only be called once per module.");if(t in goog.loadedModules_)throw Error('Module with namespace "'+t+'" already exists.')}if(goog.moduleLoaderState_)goog.moduleLoaderState_.moduleName=t;else{var e=goog.global.$jscomp;if(!e||"function"!=typeof e.getCurrentModulePath)throw Error('Module with namespace "'+t+'" has been loaded incorrectly.');e=e.require(e.getCurrentModulePath()),goog.loadedModules_[t]={exports:e,type:goog.ModuleType.ES6,moduleId:t}}},goog.setTestOnly=function(t){if(goog.DISALLOW_TEST_ONLY_CODE)throw t=t||"",Error("Importing test-only code into non-debug environment"+(t?": "+t:"."))},goog.forwardDeclare=function(t){},COMPILED||(goog.isProvided_=function(t){return t in goog.loadedModules_||!goog.implicitNamespaces_[t]&&goog.isDefAndNotNull(goog.getObjectByName(t))},goog.implicitNamespaces_={"goog.module":!0}),goog.getObjectByName=function(t,e){t=t.split("."),e=e||goog.global;for(var r=0;r<t.length;r++)if(e=e[t[r]],!goog.isDefAndNotNull(e))return null;return e},goog.globalize=function(t,e){for(var r in e=e||goog.global,t)e[r]=t[r]},goog.addDependency=function(t,e,r,n){!COMPILED&&goog.DEPENDENCIES_ENABLED&&goog.debugLoader_.addDependency(t,e,r,n)},goog.ENABLE_DEBUG_LOADER=!0,goog.logToConsole_=function(t){goog.global.console&&goog.global.console.error(t)},goog.require=function(t){if(!COMPILED){if(goog.ENABLE_DEBUG_LOADER&&goog.debugLoader_.requested(t),goog.isProvided_(t)){if(goog.isInModuleLoader_())return goog.module.getInternal_(t)}else if(goog.ENABLE_DEBUG_LOADER){var e=goog.moduleLoaderState_;goog.moduleLoaderState_=null;try{goog.debugLoader_.load_(t)}finally{goog.moduleLoaderState_=e}}return null}},goog.requireType=function(t){return{}},goog.basePath="",goog.nullFunction=function(){},goog.abstractMethod=function(){throw Error("unimplemented abstract method")},goog.addSingletonGetter=function(t){t.instance_=void 0,t.getInstance=function(){return t.instance_?t.instance_:(goog.DEBUG&&(goog.instantiatedSingletons_[goog.instantiatedSingletons_.length]=t),t.instance_=new t)}},goog.instantiatedSingletons_=[],goog.LOAD_MODULE_USING_EVAL=!0,goog.SEAL_MODULE_EXPORTS=goog.DEBUG,goog.loadedModules_={},goog.DEPENDENCIES_ENABLED=!COMPILED&&goog.ENABLE_DEBUG_LOADER,goog.TRANSPILE="detect",goog.ASSUME_ES_MODULES_TRANSPILED=!1,goog.TRANSPILE_TO_LANGUAGE="",goog.TRANSPILER="transpile.js",goog.hasBadLetScoping=null,goog.useSafari10Workaround=function(){if(null==goog.hasBadLetScoping){try{var a=!eval('"use strict";let x = 1; function f() { return typeof x; };f() == "number";')}catch(t){a=!1}goog.hasBadLetScoping=a}return goog.hasBadLetScoping},goog.workaroundSafari10EvalBug=function(t){return"(function(){"+t+"\n;})();\n"},goog.loadModule=function(t){var e=goog.moduleLoaderState_;try{if(goog.moduleLoaderState_={moduleName:"",declareLegacyNamespace:!1,type:goog.ModuleType.GOOG},goog.isFunction(t))var r=t.call(void 0,{});else{if(!goog.isString(t))throw Error("Invalid module definition");goog.useSafari10Workaround()&&(t=goog.workaroundSafari10EvalBug(t)),r=goog.loadModuleFromSource_.call(void 0,t)}var n=goog.moduleLoaderState_.moduleName;if(!goog.isString(n)||!n)throw Error('Invalid module name "'+n+'"');goog.moduleLoaderState_.declareLegacyNamespace?goog.constructNamespace_(n,r):goog.SEAL_MODULE_EXPORTS&&Object.seal&&"object"==typeof r&&null!=r&&Object.seal(r),goog.loadedModules_[n]={exports:r,type:goog.ModuleType.GOOG,moduleId:goog.moduleLoaderState_.moduleName}}finally{goog.moduleLoaderState_=e}},goog.loadModuleFromSource_=function(a){return eval(a),{}},goog.normalizePath_=function(t){t=t.split("/");for(var e=0;e<t.length;)"."==t[e]?t.splice(e,1):e&&".."==t[e]&&t[e-1]&&".."!=t[e-1]?t.splice(--e,2):e++;return t.join("/")},goog.loadFileSync_=function(t){if(goog.global.CLOSURE_LOAD_FILE_SYNC)return goog.global.CLOSURE_LOAD_FILE_SYNC(t);try{var e=new goog.global.XMLHttpRequest;return e.open("get",t,!1),e.send(),0==e.status||200==e.status?e.responseText:null}catch(t){return null}},goog.transpile_=function(t,e,r){var n=goog.global.$jscomp;n||(goog.global.$jscomp=n={});var i=n.transpile;if(!i){var o=goog.basePath+goog.TRANSPILER,a=goog.loadFileSync_(o);if(a){if(function(){(0,eval)(a+"\n//# sourceURL="+o)}.call(goog.global),goog.global.$gwtExport&&goog.global.$gwtExport.$jscomp&&!goog.global.$gwtExport.$jscomp.transpile)throw Error('The transpiler did not properly export the "transpile" method. $gwtExport: '+JSON.stringify(goog.global.$gwtExport));goog.global.$jscomp.transpile=goog.global.$gwtExport.$jscomp.transpile,i=(n=goog.global.$jscomp).transpile}}return i||(i=n.transpile=function(t,e){return goog.logToConsole_(e+" requires transpilation but no transpiler was found."),t}),i(t,e,r)},goog.typeOf=function(t){var e=typeof t;if("object"==e){if(!t)return"null";if(t instanceof Array)return"array";if(t instanceof Object)return e;var r=Object.prototype.toString.call(t);if("[object Window]"==r)return"object";if("[object Array]"==r||"number"==typeof t.length&&void 0!==t.splice&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==r||void 0!==t.call&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&void 0===t.call)return"object";return e},goog.isNull=function(t){return null===t},goog.isDefAndNotNull=function(t){return null!=t},goog.isArray=function(t){return"array"==goog.typeOf(t)},goog.isArrayLike=function(t){var e=goog.typeOf(t);return"array"==e||"object"==e&&"number"==typeof t.length},goog.isDateLike=function(t){return goog.isObject(t)&&"function"==typeof t.getFullYear},goog.isFunction=function(t){return"function"==goog.typeOf(t)},goog.isObject=function(t){var e=typeof t;return"object"==e&&null!=t||"function"==e},goog.getUid=function(t){return t[goog.UID_PROPERTY_]||(t[goog.UID_PROPERTY_]=++goog.uidCounter_)},goog.hasUid=function(t){return!!t[goog.UID_PROPERTY_]},goog.removeUid=function(t){null!==t&&"removeAttribute"in t&&t.removeAttribute(goog.UID_PROPERTY_);try{delete t[goog.UID_PROPERTY_]}catch(t){}},goog.UID_PROPERTY_="closure_uid_"+(1e9*Math.random()>>>0),goog.uidCounter_=0,goog.getHashCode=goog.getUid,goog.removeHashCode=goog.removeUid,goog.cloneObject=function(t){var e=goog.typeOf(t);if("object"==e||"array"==e){if("function"==typeof t.clone)return t.clone();for(var r in e="array"==e?[]:{},t)e[r]=goog.cloneObject(t[r]);return e}return t},goog.bindNative_=function(t,e,r){return t.call.apply(t.bind,arguments)},goog.bindJs_=function(t,e,r){if(!t)throw Error();if(2<arguments.length){var n=Array.prototype.slice.call(arguments,2);return function(){var r=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(r,n),t.apply(e,r)}}return function(){return t.apply(e,arguments)}},goog.bind=function(t,e,r){return Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?goog.bind=goog.bindNative_:goog.bind=goog.bindJs_,goog.bind.apply(null,arguments)},goog.partial=function(t,e){var r=Array.prototype.slice.call(arguments,1);return function(){var e=r.slice();return e.push.apply(e,arguments),t.apply(this,e)}},goog.mixin=function(t,e){for(var r in e)t[r]=e[r]},goog.now=goog.TRUSTED_SITE&&Date.now||function(){return+new Date},goog.globalEval=function(t){if(goog.global.execScript)goog.global.execScript(t,"JavaScript");else{if(!goog.global.eval)throw Error("goog.globalEval not available");if(null==goog.evalWorksForGlobals_){try{goog.global.eval("var _evalTest_ = 1;")}catch(t){}if(void 0!==goog.global._evalTest_){try{delete goog.global._evalTest_}catch(t){}goog.evalWorksForGlobals_=!0}else goog.evalWorksForGlobals_=!1}if(goog.evalWorksForGlobals_)goog.global.eval(t);else{var e=goog.global.document,r=e.createElement("SCRIPT");r.type="text/javascript",r.defer=!1,r.appendChild(e.createTextNode(t)),e.head.appendChild(r),e.head.removeChild(r)}}},goog.evalWorksForGlobals_=null,goog.getCssName=function(t,e){if("."==String(t).charAt(0))throw Error('className passed in goog.getCssName must not start with ".". You passed: '+t);var r=function(t){return goog.cssNameMapping_[t]||t},n=function(t){t=t.split("-");for(var e=[],n=0;n<t.length;n++)e.push(r(t[n]));return e.join("-")};return n=goog.cssNameMapping_?"BY_WHOLE"==goog.cssNameMappingStyle_?r:n:function(t){return t},t=e?t+"-"+n(e):n(t),goog.global.CLOSURE_CSS_NAME_MAP_FN?goog.global.CLOSURE_CSS_NAME_MAP_FN(t):t},goog.setCssNameMapping=function(t,e){goog.cssNameMapping_=t,goog.cssNameMappingStyle_=e},!COMPILED&&goog.global.CLOSURE_CSS_NAME_MAPPING&&(goog.cssNameMapping_=goog.global.CLOSURE_CSS_NAME_MAPPING),goog.getMsg=function(t,e,r){return r&&r.html&&(t=t.replace(/</g,"<")),e&&(t=t.replace(/\{\$([^}]+)}/g,(function(t,r){return null!=e&&r in e?e[r]:t}))),t},goog.getMsgWithFallback=function(t,e){return t},goog.exportSymbol=function(t,e,r){goog.exportPath_(t,e,r)},goog.exportProperty=function(t,e,r){t[e]=r},goog.inherits=function(t,e){function r(){}r.prototype=e.prototype,t.superClass_=e.prototype,t.prototype=new r,t.prototype.constructor=t,t.base=function(t,r,n){for(var i=Array(arguments.length-2),o=2;o<arguments.length;o++)i[o-2]=arguments[o];return e.prototype[r].apply(t,i)}},goog.base=function(t,e,r){var n=arguments.callee.caller;if(goog.STRICT_MODE_COMPATIBLE||goog.DEBUG&&!n)throw Error("arguments.caller not defined. goog.base() cannot be used with strict mode code. See http://www.ecma-international.org/ecma-262/5.1/#sec-C");if(void 0!==n.superClass_){for(var i=Array(arguments.length-1),o=1;o<arguments.length;o++)i[o-1]=arguments[o];return n.superClass_.constructor.apply(t,i)}if("string"!=typeof e&&"symbol"!=typeof e)throw Error("method names provided to goog.base must be a string or a symbol");for(i=Array(arguments.length-2),o=2;o<arguments.length;o++)i[o-2]=arguments[o];o=!1;for(var a=t.constructor.prototype;a;a=Object.getPrototypeOf(a))if(a[e]===n)o=!0;else if(o)return a[e].apply(t,i);if(t[e]===n)return t.constructor.prototype[e].apply(t,i);throw Error("goog.base called from a method of one name to a method of a different name")},goog.scope=function(t){if(goog.isInModuleLoader_())throw Error("goog.scope is not supported within a module.");t.call(goog.global)},COMPILED||(goog.global.COMPILED=COMPILED),goog.defineClass=function(t,e){var r=e.constructor,n=e.statics;return r&&r!=Object.prototype.constructor||(r=function(){throw Error("cannot instantiate an interface (no constructor defined).")}),r=goog.defineClass.createSealingConstructor_(r,t),t&&goog.inherits(r,t),delete e.constructor,delete e.statics,goog.defineClass.applyProperties_(r.prototype,e),null!=n&&(n instanceof Function?n(r):goog.defineClass.applyProperties_(r,n)),r},goog.defineClass.SEAL_CLASS_INSTANCES=goog.DEBUG,goog.defineClass.createSealingConstructor_=function(t,e){if(!goog.defineClass.SEAL_CLASS_INSTANCES)return t;var r=!goog.defineClass.isUnsealable_(e),n=function(){var e=t.apply(this,arguments)||this;return e[goog.UID_PROPERTY_]=e[goog.UID_PROPERTY_],this.constructor===n&&r&&Object.seal instanceof Function&&Object.seal(e),e};return n},goog.defineClass.isUnsealable_=function(t){return t&&t.prototype&&t.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_]},goog.defineClass.OBJECT_PROTOTYPE_FIELDS_="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),goog.defineClass.applyProperties_=function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);for(var n=0;n<goog.defineClass.OBJECT_PROTOTYPE_FIELDS_.length;n++)r=goog.defineClass.OBJECT_PROTOTYPE_FIELDS_[n],Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},goog.tagUnsealableClass=function(t){!COMPILED&&goog.defineClass.SEAL_CLASS_INSTANCES&&(t.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_]=!0)},goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_="goog_defineClass_legacy_unsealable",!COMPILED&&goog.DEPENDENCIES_ENABLED&&(goog.inHtmlDocument_=function(){var t=goog.global.document;return null!=t&&"write"in t},goog.isDocumentLoading_=function(){var t=goog.global.document;return t.attachEvent?"complete"!=t.readyState:"loading"==t.readyState},goog.findBasePath_=function(){if(goog.isDef(goog.global.CLOSURE_BASE_PATH)&&goog.isString(goog.global.CLOSURE_BASE_PATH))goog.basePath=goog.global.CLOSURE_BASE_PATH;else if(goog.inHtmlDocument_()){var t=goog.global.document,e=t.currentScript;for(e=(t=e?[e]:t.getElementsByTagName("SCRIPT")).length-1;0<=e;--e){var r=t[e].src,n=r.lastIndexOf("?");if(n=-1==n?r.length:n,"base.js"==r.substr(n-7,7)){goog.basePath=r.substr(0,n-7);break}}}},goog.findBasePath_(),goog.Transpiler=function(){this.requiresTranspilation_=null,this.transpilationTarget_=goog.TRANSPILE_TO_LANGUAGE},goog.Transpiler.prototype.createRequiresTranspilation_=function(){function a(t,r){e?d[t]=!0:r()?(c=t,d[t]=!1):e=d[t]=!0}function b(a){try{return!!eval(a)}catch(t){return!1}}var c="es3",d={es3:!1},e=!1,f=goog.global.navigator&&goog.global.navigator.userAgent?goog.global.navigator.userAgent:"";return a("es5",(function(){return b("[1,].length==1")})),a("es6",(function(){return!f.match(/Edge\/(\d+)(\.\d)*/i)&&b('(()=>{"use strict";class X{constructor(){if(new.target!=String)throw 1;this.x=42}}let q=Reflect.construct(X,[],String);if(q.x!=42||!(q instanceof String))throw 1;for(const a of[2,3]){if(a==2)continue;function f(z={a}){let a=0;return z.a}{function f(){return 0;}}return f()==3}})()')})),a("es7",(function(){return b("2 ** 2 == 4")})),a("es8",(function(){return b("async () => 1, true")})),a("es9",(function(){return b("({...rest} = {}), true")})),a("es_next",(function(){return!1})),{target:c,map:d}},goog.Transpiler.prototype.needsTranspile=function(t,e){if("always"==goog.TRANSPILE)return!0;if("never"==goog.TRANSPILE)return!1;if(!this.requiresTranspilation_){var r=this.createRequiresTranspilation_();this.requiresTranspilation_=r.map,this.transpilationTarget_=this.transpilationTarget_||r.target}if(t in this.requiresTranspilation_)return!!this.requiresTranspilation_[t]||!(!goog.inHtmlDocument_()||"es6"!=e||"noModule"in goog.global.document.createElement("script"));throw Error("Unknown language mode: "+t)},goog.Transpiler.prototype.transpile=function(t,e){return goog.transpile_(t,e,this.transpilationTarget_)},goog.transpiler_=new goog.Transpiler,goog.protectScriptTag_=function(t){return t.replace(/<\/(SCRIPT)/gi,"\\x3c/$1")},goog.DebugLoader_=function(){this.dependencies_={},this.idToPath_={},this.written_={},this.loadingDeps_=[],this.depsToLoad_=[],this.paused_=!1,this.factory_=new goog.DependencyFactory(goog.transpiler_),this.deferredCallbacks_={},this.deferredQueue_=[]},goog.DebugLoader_.prototype.bootstrap=function(t,e){function r(){n&&(goog.global.setTimeout(n,0),n=null)}var n=e;if(t.length){e=[];for(var i=0;i<t.length;i++){var o=this.getPathFromDeps_(t[i]);if(!o)throw Error("Unregonized namespace: "+t[i]);e.push(this.dependencies_[o])}o=goog.require;var a=0;for(i=0;i<t.length;i++)o(t[i]),e[i].onLoad((function(){++a==t.length&&r()}))}else r()},goog.DebugLoader_.prototype.loadClosureDeps=function(){this.depsToLoad_.push(this.factory_.createDependency(goog.normalizePath_(goog.basePath+"deps.js"),"deps.js",[],[],{},!1)),this.loadDeps_()},goog.DebugLoader_.prototype.requested=function(t,e){(t=this.getPathFromDeps_(t))&&(e||this.areDepsLoaded_(this.dependencies_[t].requires))&&(e=this.deferredCallbacks_[t])&&(delete this.deferredCallbacks_[t],e())},goog.DebugLoader_.prototype.setDependencyFactory=function(t){this.factory_=t},goog.DebugLoader_.prototype.load_=function(t){if(!this.getPathFromDeps_(t))throw t="goog.require could not find: "+t,goog.logToConsole_(t),Error(t);var e=this,r=[],n=function(t){var i=e.getPathFromDeps_(t);if(!i)throw Error("Bad dependency path or symbol: "+t);if(!e.written_[i]){for(e.written_[i]=!0,t=e.dependencies_[i],i=0;i<t.requires.length;i++)goog.isProvided_(t.requires[i])||n(t.requires[i]);r.push(t)}};n(t),t=!!this.depsToLoad_.length,this.depsToLoad_=this.depsToLoad_.concat(r),this.paused_||t||this.loadDeps_()},goog.DebugLoader_.prototype.loadDeps_=function(){for(var t=this,e=this.paused_;this.depsToLoad_.length&&!e;)!function(){var r=!1,n=t.depsToLoad_.shift(),i=!1;t.loading_(n);var o={pause:function(){if(r)throw Error("Cannot call pause after the call to load.");e=!0},resume:function(){r?t.resume_():e=!1},loaded:function(){if(i)throw Error("Double call to loaded.");i=!0,t.loaded_(n)},pending:function(){for(var e=[],r=0;r<t.loadingDeps_.length;r++)e.push(t.loadingDeps_[r]);return e},setModuleState:function(t){goog.moduleLoaderState_={type:t,moduleName:"",declareLegacyNamespace:!1}},registerEs6ModuleExports:function(t,e,r){r&&(goog.loadedModules_[r]={exports:e,type:goog.ModuleType.ES6,moduleId:r||""})},registerGoogModuleExports:function(t,e){goog.loadedModules_[t]={exports:e,type:goog.ModuleType.GOOG,moduleId:t}},clearModuleState:function(){goog.moduleLoaderState_=null},defer:function(e){if(r)throw Error("Cannot register with defer after the call to load.");t.defer_(n,e)},areDepsLoaded:function(){return t.areDepsLoaded_(n.requires)}};try{n.load(o)}finally{r=!0}}();e&&this.pause_()},goog.DebugLoader_.prototype.pause_=function(){this.paused_=!0},goog.DebugLoader_.prototype.resume_=function(){this.paused_&&(this.paused_=!1,this.loadDeps_())},goog.DebugLoader_.prototype.loading_=function(t){this.loadingDeps_.push(t)},goog.DebugLoader_.prototype.loaded_=function(t){for(var e=0;e<this.loadingDeps_.length;e++)if(this.loadingDeps_[e]==t){this.loadingDeps_.splice(e,1);break}for(e=0;e<this.deferredQueue_.length;e++)if(this.deferredQueue_[e]==t.path){this.deferredQueue_.splice(e,1);break}if(this.loadingDeps_.length==this.deferredQueue_.length&&!this.depsToLoad_.length)for(;this.deferredQueue_.length;)this.requested(this.deferredQueue_.shift(),!0);t.loaded()},goog.DebugLoader_.prototype.areDepsLoaded_=function(t){for(var e=0;e<t.length;e++){var r=this.getPathFromDeps_(t[e]);if(!r||!(r in this.deferredCallbacks_)&&!goog.isProvided_(t[e]))return!1}return!0},goog.DebugLoader_.prototype.getPathFromDeps_=function(t){return t in this.idToPath_?this.idToPath_[t]:t in this.dependencies_?t:null},goog.DebugLoader_.prototype.defer_=function(t,e){this.deferredCallbacks_[t.path]=e,this.deferredQueue_.push(t.path)},goog.LoadController=function(){},goog.LoadController.prototype.pause=function(){},goog.LoadController.prototype.resume=function(){},goog.LoadController.prototype.loaded=function(){},goog.LoadController.prototype.pending=function(){},goog.LoadController.prototype.registerEs6ModuleExports=function(t,e,r){},goog.LoadController.prototype.setModuleState=function(t){},goog.LoadController.prototype.clearModuleState=function(){},goog.LoadController.prototype.defer=function(t){},goog.LoadController.prototype.areDepsLoaded=function(){},goog.Dependency=function(t,e,r,n,i){this.path=t,this.relativePath=e,this.provides=r,this.requires=n,this.loadFlags=i,this.loaded_=!1,this.loadCallbacks_=[]},goog.Dependency.prototype.getPathName=function(){var t=this.path,e=t.indexOf("://");return 0<=e&&(0<=(e=(t=t.substring(e+3)).indexOf("/"))&&(t=t.substring(e+1))),t},goog.Dependency.prototype.onLoad=function(t){this.loaded_?t():this.loadCallbacks_.push(t)},goog.Dependency.prototype.loaded=function(){this.loaded_=!0;var t=this.loadCallbacks_;this.loadCallbacks_=[];for(var e=0;e<t.length;e++)t[e]()},goog.Dependency.defer_=!1,goog.Dependency.callbackMap_={},goog.Dependency.registerCallback_=function(t){var e=Math.random().toString(32);return goog.Dependency.callbackMap_[e]=t,e},goog.Dependency.unregisterCallback_=function(t){delete goog.Dependency.callbackMap_[t]},goog.Dependency.callback_=function(t,e){if(!(t in goog.Dependency.callbackMap_))throw Error("Callback key "+t+" does not exist (was base.js loaded more than once?).");for(var r=goog.Dependency.callbackMap_[t],n=[],i=1;i<arguments.length;i++)n.push(arguments[i]);r.apply(void 0,n)},goog.Dependency.prototype.load=function(t){if(goog.global.CLOSURE_IMPORT_SCRIPT)goog.global.CLOSURE_IMPORT_SCRIPT(this.path)?t.loaded():t.pause();else if(goog.inHtmlDocument_()){var e=goog.global.document;if("complete"==e.readyState&&!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING){if(/\bdeps.js$/.test(this.path))return void t.loaded();throw Error('Cannot write "'+this.path+'" after document load')}if(!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING&&goog.isDocumentLoading_()){var r=goog.Dependency.registerCallback_((function(e){goog.DebugLoader_.IS_OLD_IE_&&"complete"!=e.readyState||(goog.Dependency.unregisterCallback_(r),t.loaded())})),n=!goog.DebugLoader_.IS_OLD_IE_&&goog.getScriptNonce()?' nonce="'+goog.getScriptNonce()+'"':"";n='<script src="'+this.path+'" '+(goog.DebugLoader_.IS_OLD_IE_?"onreadystatechange":"onload")+"=\"goog.Dependency.callback_('"+r+'\', this)" type="text/javascript" '+(goog.Dependency.defer_?"defer":"")+n+"><\/script>",e.write(goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createHTML(n):n)}else{var i=e.createElement("script");i.defer=goog.Dependency.defer_,i.async=!1,i.type="text/javascript",(n=goog.getScriptNonce())&&i.setAttribute("nonce",n),goog.DebugLoader_.IS_OLD_IE_?(t.pause(),i.onreadystatechange=function(){"loaded"!=i.readyState&&"complete"!=i.readyState||(t.loaded(),t.resume())}):i.onload=function(){i.onload=null,t.loaded()},i.src=goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createScriptURL(this.path):this.path,e.head.appendChild(i)}}else goog.logToConsole_("Cannot use default debug loader outside of HTML documents."),"deps.js"==this.relativePath?(goog.logToConsole_("Consider setting CLOSURE_IMPORT_SCRIPT before loading base.js, or setting CLOSURE_NO_DEPS to true."),t.loaded()):t.pause()},goog.Es6ModuleDependency=function(t,e,r,n,i){goog.Dependency.call(this,t,e,r,n,i)},goog.inherits(goog.Es6ModuleDependency,goog.Dependency),goog.Es6ModuleDependency.prototype.load=function(t){if(goog.global.CLOSURE_IMPORT_SCRIPT)goog.global.CLOSURE_IMPORT_SCRIPT(this.path)?t.loaded():t.pause();else if(goog.inHtmlDocument_()){var e=goog.global.document,r=this;if(goog.isDocumentLoading_()){var n=function(t,r){t=r?'<script type="module" crossorigin>'+r+"<\/script>":'<script type="module" crossorigin src="'+t+'"><\/script>',e.write(goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createHTML(t):t)};goog.Dependency.defer_=!0}else n=function(t,r){var n=e.createElement("script");n.defer=!0,n.async=!1,n.type="module",n.setAttribute("crossorigin",!0);var i=goog.getScriptNonce();i&&n.setAttribute("nonce",i),r?n.textContent=goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createScript(r):r:n.src=goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createScriptURL(t):t,e.head.appendChild(n)};var i=goog.Dependency.registerCallback_((function(){goog.Dependency.unregisterCallback_(i),t.setModuleState(goog.ModuleType.ES6)}));n(void 0,'goog.Dependency.callback_("'+i+'")'),n(this.path,void 0);var o=goog.Dependency.registerCallback_((function(e){goog.Dependency.unregisterCallback_(o),t.registerEs6ModuleExports(r.path,e,goog.moduleLoaderState_.moduleName)}));n(void 0,'import * as m from "'+this.path+'"; goog.Dependency.callback_("'+o+'", m)');var a=goog.Dependency.registerCallback_((function(){goog.Dependency.unregisterCallback_(a),t.clearModuleState(),t.loaded()}));n(void 0,'goog.Dependency.callback_("'+a+'")')}else goog.logToConsole_("Cannot use default debug loader outside of HTML documents."),t.pause()},goog.TransformedDependency=function(t,e,r,n,i){goog.Dependency.call(this,t,e,r,n,i),this.contents_=null,this.lazyFetch_=!goog.inHtmlDocument_()||!("noModule"in goog.global.document.createElement("script"))},goog.inherits(goog.TransformedDependency,goog.Dependency),goog.TransformedDependency.prototype.load=function(t){function e(){n.contents_=goog.loadFileSync_(n.path),n.contents_&&(n.contents_=n.transform(n.contents_),n.contents_&&(n.contents_+="\n//# sourceURL="+n.path))}function r(){if(n.lazyFetch_&&e(),n.contents_){i&&t.setModuleState(goog.ModuleType.ES6);try{var r=n.contents_;if(n.contents_=null,goog.globalEval(r),i)var o=goog.moduleLoaderState_.moduleName}finally{i&&t.clearModuleState()}i&&goog.global.$jscomp.require.ensure([n.getPathName()],(function(){t.registerEs6ModuleExports(n.path,goog.global.$jscomp.require(n.getPathName()),o)})),t.loaded()}}var n=this;if(goog.global.CLOSURE_IMPORT_SCRIPT)e(),this.contents_&&goog.global.CLOSURE_IMPORT_SCRIPT("",this.contents_)?(this.contents_=null,t.loaded()):t.pause();else{var i=this.loadFlags.module==goog.ModuleType.ES6;this.lazyFetch_||e();var o=1<t.pending().length,a=o&&goog.DebugLoader_.IS_OLD_IE_;if(o=goog.Dependency.defer_&&(o||goog.isDocumentLoading_()),a||o)t.defer((function(){r()}));else{var s=goog.global.document;if(a=goog.inHtmlDocument_()&&"ActiveXObject"in goog.global,i&&goog.inHtmlDocument_()&&goog.isDocumentLoading_()&&!a){goog.Dependency.defer_=!0,t.pause();var u=s.onreadystatechange;s.onreadystatechange=function(){"interactive"==s.readyState&&(s.onreadystatechange=u,r(),t.resume()),goog.isFunction(u)&&u.apply(void 0,arguments)}}else!goog.DebugLoader_.IS_OLD_IE_&&goog.inHtmlDocument_()&&goog.isDocumentLoading_()?function(){var t=goog.global.document,e=goog.Dependency.registerCallback_((function(){goog.Dependency.unregisterCallback_(e),r()})),n='<script type="text/javascript">'+goog.protectScriptTag_('goog.Dependency.callback_("'+e+'");')+"<\/script>";t.write(goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createHTML(n):n)}():r()}}},goog.TransformedDependency.prototype.transform=function(t){},goog.TranspiledDependency=function(t,e,r,n,i,o){goog.TransformedDependency.call(this,t,e,r,n,i),this.transpiler=o},goog.inherits(goog.TranspiledDependency,goog.TransformedDependency),goog.TranspiledDependency.prototype.transform=function(t){return this.transpiler.transpile(t,this.getPathName())},goog.PreTranspiledEs6ModuleDependency=function(t,e,r,n,i){goog.TransformedDependency.call(this,t,e,r,n,i)},goog.inherits(goog.PreTranspiledEs6ModuleDependency,goog.TransformedDependency),goog.PreTranspiledEs6ModuleDependency.prototype.transform=function(t){return t},goog.GoogModuleDependency=function(t,e,r,n,i,o,a){goog.TransformedDependency.call(this,t,e,r,n,i),this.needsTranspile_=o,this.transpiler_=a},goog.inherits(goog.GoogModuleDependency,goog.TransformedDependency),goog.GoogModuleDependency.prototype.transform=function(t){return this.needsTranspile_&&(t=this.transpiler_.transpile(t,this.getPathName())),goog.LOAD_MODULE_USING_EVAL&&goog.isDef(goog.global.JSON)?"goog.loadModule("+goog.global.JSON.stringify(t+"\n//# sourceURL="+this.path+"\n")+");":'goog.loadModule(function(exports) {"use strict";'+t+"\n;return exports});\n//# sourceURL="+this.path+"\n"},goog.DebugLoader_.IS_OLD_IE_=!(goog.global.atob||!goog.global.document||!goog.global.document.all),goog.DebugLoader_.prototype.addDependency=function(t,e,r,n){e=e||[],t=t.replace(/\\/g,"/");var i=goog.normalizePath_(goog.basePath+t);for(n&&"boolean"!=typeof n||(n=n?{module:goog.ModuleType.GOOG}:{}),r=this.factory_.createDependency(i,t,e,r,n,goog.transpiler_.needsTranspile(n.lang||"es3",n.module)),this.dependencies_[i]=r,r=0;r<e.length;r++)this.idToPath_[e[r]]=i;this.idToPath_[t]=i},goog.DependencyFactory=function(t){this.transpiler=t},goog.DependencyFactory.prototype.createDependency=function(t,e,r,n,i,o){return i.module==goog.ModuleType.GOOG?new goog.GoogModuleDependency(t,e,r,n,i,o,this.transpiler):o?new goog.TranspiledDependency(t,e,r,n,i,this.transpiler):i.module==goog.ModuleType.ES6?"never"==goog.TRANSPILE&&goog.ASSUME_ES_MODULES_TRANSPILED?new goog.PreTranspiledEs6ModuleDependency(t,e,r,n,i):new goog.Es6ModuleDependency(t,e,r,n,i):new goog.Dependency(t,e,r,n,i)},goog.debugLoader_=new goog.DebugLoader_,goog.loadClosureDeps=function(){goog.debugLoader_.loadClosureDeps()},goog.setDependencyFactory=function(t){goog.debugLoader_.setDependencyFactory(t)},goog.global.CLOSURE_NO_DEPS||goog.debugLoader_.loadClosureDeps(),goog.bootstrap=function(t,e){goog.debugLoader_.bootstrap(t,e)}),goog.TRUSTED_TYPES_POLICY_NAME="",goog.identity_=function(t){return t},goog.createTrustedTypesPolicy=function(t){var e=null;if("undefined"==typeof TrustedTypes||!TrustedTypes.createPolicy)return e;try{e=TrustedTypes.createPolicy(t,{createHTML:goog.identity_,createScript:goog.identity_,createScriptURL:goog.identity_,createURL:goog.identity_})}catch(t){goog.logToConsole_(t.message)}return e},goog.TRUSTED_TYPES_POLICY_=goog.TRUSTED_TYPES_POLICY_NAME?goog.createTrustedTypesPolicy(goog.TRUSTED_TYPES_POLICY_NAME+"#base"):null,goog.object={},goog.object.is=function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e},goog.object.forEach=function(t,e,r){for(var n in t)e.call(r,t[n],n,t)},goog.object.filter=function(t,e,r){var n,i={};for(n in t)e.call(r,t[n],n,t)&&(i[n]=t[n]);return i},goog.object.map=function(t,e,r){var n,i={};for(n in t)i[n]=e.call(r,t[n],n,t);return i},goog.object.some=function(t,e,r){for(var n in t)if(e.call(r,t[n],n,t))return!0;return!1},goog.object.every=function(t,e,r){for(var n in t)if(!e.call(r,t[n],n,t))return!1;return!0},goog.object.getCount=function(t){var e,r=0;for(e in t)r++;return r},goog.object.getAnyKey=function(t){for(var e in t)return e},goog.object.getAnyValue=function(t){for(var e in t)return t[e]},goog.object.contains=function(t,e){return goog.object.containsValue(t,e)},goog.object.getValues=function(t){var e,r=[],n=0;for(e in t)r[n++]=t[e];return r},goog.object.getKeys=function(t){var e,r=[],n=0;for(e in t)r[n++]=e;return r},goog.object.getValueByKeys=function(t,e){var r=goog.isArrayLike(e),n=r?e:arguments;for(r=r?0:1;r<n.length;r++){if(null==t)return;t=t[n[r]]}return t},goog.object.containsKey=function(t,e){return null!==t&&e in t},goog.object.containsValue=function(t,e){for(var r in t)if(t[r]==e)return!0;return!1},goog.object.findKey=function(t,e,r){for(var n in t)if(e.call(r,t[n],n,t))return n},goog.object.findValue=function(t,e,r){return(e=goog.object.findKey(t,e,r))&&t[e]},goog.object.isEmpty=function(t){for(var e in t)return!1;return!0},goog.object.clear=function(t){for(var e in t)delete t[e]},goog.object.remove=function(t,e){var r;return(r=e in t)&&delete t[e],r},goog.object.add=function(t,e,r){if(null!==t&&e in t)throw Error('The object already contains the key "'+e+'"');goog.object.set(t,e,r)},goog.object.get=function(t,e,r){return null!==t&&e in t?t[e]:r},goog.object.set=function(t,e,r){t[e]=r},goog.object.setIfUndefined=function(t,e,r){return e in t?t[e]:t[e]=r},goog.object.setWithReturnValueIfNotSet=function(t,e,r){return e in t?t[e]:(r=r(),t[e]=r)},goog.object.equals=function(t,e){for(var r in t)if(!(r in e)||t[r]!==e[r])return!1;for(var n in e)if(!(n in t))return!1;return!0},goog.object.clone=function(t){var e,r={};for(e in t)r[e]=t[e];return r},goog.object.unsafeClone=function(t){var e=goog.typeOf(t);if("object"==e||"array"==e){if(goog.isFunction(t.clone))return t.clone();for(var r in e="array"==e?[]:{},t)e[r]=goog.object.unsafeClone(t[r]);return e}return t},goog.object.transpose=function(t){var e,r={};for(e in t)r[t[e]]=e;return r},goog.object.PROTOTYPE_FIELDS_="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),goog.object.extend=function(t,e){for(var r,n,i=1;i<arguments.length;i++){for(r in n=arguments[i])t[r]=n[r];for(var o=0;o<goog.object.PROTOTYPE_FIELDS_.length;o++)r=goog.object.PROTOTYPE_FIELDS_[o],Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}},goog.object.create=function(t){var e=arguments.length;if(1==e&&goog.isArray(arguments[0]))return goog.object.create.apply(null,arguments[0]);if(e%2)throw Error("Uneven number of arguments");for(var r={},n=0;n<e;n+=2)r[arguments[n]]=arguments[n+1];return r},goog.object.createSet=function(t){var e=arguments.length;if(1==e&&goog.isArray(arguments[0]))return goog.object.createSet.apply(null,arguments[0]);for(var r={},n=0;n<e;n++)r[arguments[n]]=!0;return r},goog.object.createImmutableView=function(t){var e=t;return Object.isFrozen&&!Object.isFrozen(t)&&(e=Object.create(t),Object.freeze(e)),e},goog.object.isImmutableView=function(t){return!!Object.isFrozen&&Object.isFrozen(t)},goog.object.getAllPropertyNames=function(t,e,r){if(!t)return[];if(!Object.getOwnPropertyNames||!Object.getPrototypeOf)return goog.object.getKeys(t);for(var n={};t&&(t!==Object.prototype||e)&&(t!==Function.prototype||r);){for(var i=Object.getOwnPropertyNames(t),o=0;o<i.length;o++)n[i[o]]=!0;t=Object.getPrototypeOf(t)}return goog.object.getKeys(n)},goog.object.getSuperClass=function(t){return(t=Object.getPrototypeOf(t.prototype))&&t.constructor},goog.debug={},goog.debug.Error=function(t){if(Error.captureStackTrace)Error.captureStackTrace(this,goog.debug.Error);else{var e=Error().stack;e&&(this.stack=e)}t&&(this.message=String(t)),this.reportErrorToServer=!0},goog.inherits(goog.debug.Error,Error),goog.debug.Error.prototype.name="CustomError",goog.dom={},goog.dom.NodeType={ELEMENT:1,ATTRIBUTE:2,TEXT:3,CDATA_SECTION:4,ENTITY_REFERENCE:5,ENTITY:6,PROCESSING_INSTRUCTION:7,COMMENT:8,DOCUMENT:9,DOCUMENT_TYPE:10,DOCUMENT_FRAGMENT:11,NOTATION:12},goog.asserts={},goog.asserts.ENABLE_ASSERTS=goog.DEBUG,goog.asserts.AssertionError=function(t,e){goog.debug.Error.call(this,goog.asserts.subs_(t,e)),this.messagePattern=t},goog.inherits(goog.asserts.AssertionError,goog.debug.Error),goog.asserts.AssertionError.prototype.name="AssertionError",goog.asserts.DEFAULT_ERROR_HANDLER=function(t){throw t},goog.asserts.errorHandler_=goog.asserts.DEFAULT_ERROR_HANDLER,goog.asserts.subs_=function(t,e){for(var r="",n=(t=t.split("%s")).length-1,i=0;i<n;i++)r+=t[i]+(i<e.length?e[i]:"%s");return r+t[n]},goog.asserts.doAssertFailure_=function(t,e,r,n){var i="Assertion failed";if(r){i+=": "+r;var o=n}else t&&(i+=": "+t,o=e);t=new goog.asserts.AssertionError(""+i,o||[]),goog.asserts.errorHandler_(t)},goog.asserts.setErrorHandler=function(t){goog.asserts.ENABLE_ASSERTS&&(goog.asserts.errorHandler_=t)},goog.asserts.assert=function(t,e,r){return goog.asserts.ENABLE_ASSERTS&&!t&&goog.asserts.doAssertFailure_("",null,e,Array.prototype.slice.call(arguments,2)),t},goog.asserts.assertExists=function(t,e,r){return goog.asserts.ENABLE_ASSERTS&&null==t&&goog.asserts.doAssertFailure_("Expected to exist: %s.",[t],e,Array.prototype.slice.call(arguments,2)),t},goog.asserts.fail=function(t,e){goog.asserts.ENABLE_ASSERTS&&goog.asserts.errorHandler_(new goog.asserts.AssertionError("Failure"+(t?": "+t:""),Array.prototype.slice.call(arguments,1)))},goog.asserts.assertNumber=function(t,e,r){return goog.asserts.ENABLE_ASSERTS&&!goog.isNumber(t)&&goog.asserts.doAssertFailure_("Expected number but got %s: %s.",[goog.typeOf(t),t],e,Array.prototype.slice.call(arguments,2)),t},goog.asserts.assertString=function(t,e,r){return goog.asserts.ENABLE_ASSERTS&&!goog.isString(t)&&goog.asserts.doAssertFailure_("Expected string but got %s: %s.",[goog.typeOf(t),t],e,Array.prototype.slice.call(arguments,2)),t},goog.asserts.assertFunction=function(t,e,r){return goog.asserts.ENABLE_ASSERTS&&!goog.isFunction(t)&&goog.asserts.doAssertFailure_("Expected function but got %s: %s.",[goog.typeOf(t),t],e,Array.prototype.slice.call(arguments,2)),t},goog.asserts.assertObject=function(t,e,r){return goog.asserts.ENABLE_ASSERTS&&!goog.isObject(t)&&goog.asserts.doAssertFailure_("Expected object but got %s: %s.",[goog.typeOf(t),t],e,Array.prototype.slice.call(arguments,2)),t},goog.asserts.assertArray=function(t,e,r){return goog.asserts.ENABLE_ASSERTS&&!goog.isArray(t)&&goog.asserts.doAssertFailure_("Expected array but got %s: %s.",[goog.typeOf(t),t],e,Array.prototype.slice.call(arguments,2)),t},goog.asserts.assertBoolean=function(t,e,r){return goog.asserts.ENABLE_ASSERTS&&!goog.isBoolean(t)&&goog.asserts.doAssertFailure_("Expected boolean but got %s: %s.",[goog.typeOf(t),t],e,Array.prototype.slice.call(arguments,2)),t},goog.asserts.assertElement=function(t,e,r){return!goog.asserts.ENABLE_ASSERTS||goog.isObject(t)&&t.nodeType==goog.dom.NodeType.ELEMENT||goog.asserts.doAssertFailure_("Expected Element but got %s: %s.",[goog.typeOf(t),t],e,Array.prototype.slice.call(arguments,2)),t},goog.asserts.assertInstanceof=function(t,e,r,n){return!goog.asserts.ENABLE_ASSERTS||t instanceof e||goog.asserts.doAssertFailure_("Expected instanceof %s but got %s.",[goog.asserts.getType_(e),goog.asserts.getType_(t)],r,Array.prototype.slice.call(arguments,3)),t},goog.asserts.assertFinite=function(t,e,r){return!goog.asserts.ENABLE_ASSERTS||"number"==typeof t&&isFinite(t)||goog.asserts.doAssertFailure_("Expected %s to be a finite number but it is not.",[t],e,Array.prototype.slice.call(arguments,2)),t},goog.asserts.assertObjectPrototypeIsIntact=function(){for(var t in Object.prototype)goog.asserts.fail(t+" should not be enumerable in Object.prototype.")},goog.asserts.getType_=function(t){return t instanceof Function?t.displayName||t.name||"unknown type name":t instanceof Object?t.constructor.displayName||t.constructor.name||Object.prototype.toString.call(t):null===t?"null":typeof t};var jspb={BinaryConstants:{},ConstBinaryMessage:function(){},BinaryMessage:function(){}};jspb.BinaryConstants.FieldType={INVALID:-1,DOUBLE:1,FLOAT:2,INT64:3,UINT64:4,INT32:5,FIXED64:6,FIXED32:7,BOOL:8,STRING:9,GROUP:10,MESSAGE:11,BYTES:12,UINT32:13,ENUM:14,SFIXED32:15,SFIXED64:16,SINT32:17,SINT64:18,FHASH64:30,VHASH64:31},jspb.BinaryConstants.WireType={INVALID:-1,VARINT:0,FIXED64:1,DELIMITED:2,START_GROUP:3,END_GROUP:4,FIXED32:5},jspb.BinaryConstants.FieldTypeToWireType=function(t){var e=jspb.BinaryConstants.FieldType,r=jspb.BinaryConstants.WireType;switch(t){case e.INT32:case e.INT64:case e.UINT32:case e.UINT64:case e.SINT32:case e.SINT64:case e.BOOL:case e.ENUM:case e.VHASH64:return r.VARINT;case e.DOUBLE:case e.FIXED64:case e.SFIXED64:case e.FHASH64:return r.FIXED64;case e.STRING:case e.MESSAGE:case e.BYTES:return r.DELIMITED;case e.FLOAT:case e.FIXED32:case e.SFIXED32:return r.FIXED32;default:return r.INVALID}},jspb.BinaryConstants.INVALID_FIELD_NUMBER=-1,jspb.BinaryConstants.FLOAT32_EPS=1401298464324817e-60,jspb.BinaryConstants.FLOAT32_MIN=11754943508222875e-54,jspb.BinaryConstants.FLOAT32_MAX=34028234663852886e22,jspb.BinaryConstants.FLOAT64_EPS=5e-324,jspb.BinaryConstants.FLOAT64_MIN=22250738585072014e-324,jspb.BinaryConstants.FLOAT64_MAX=17976931348623157e292,jspb.BinaryConstants.TWO_TO_20=1048576,jspb.BinaryConstants.TWO_TO_23=8388608,jspb.BinaryConstants.TWO_TO_31=2147483648,jspb.BinaryConstants.TWO_TO_32=4294967296,jspb.BinaryConstants.TWO_TO_52=4503599627370496,jspb.BinaryConstants.TWO_TO_63=0x8000000000000000,jspb.BinaryConstants.TWO_TO_64=0x10000000000000000,jspb.BinaryConstants.ZERO_HASH="\0\0\0\0\0\0\0\0",goog.array={},goog.NATIVE_ARRAY_PROTOTYPES=goog.TRUSTED_SITE,goog.array.ASSUME_NATIVE_FUNCTIONS=2012<goog.FEATURESET_YEAR,goog.array.peek=function(t){return t[t.length-1]},goog.array.last=goog.array.peek,goog.array.indexOf=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.indexOf)?function(t,e,r){return goog.asserts.assert(null!=t.length),Array.prototype.indexOf.call(t,e,r)}:function(t,e,r){if(r=null==r?0:0>r?Math.max(0,t.length+r):r,goog.isString(t))return goog.isString(e)&&1==e.length?t.indexOf(e,r):-1;for(;r<t.length;r++)if(r in t&&t[r]===e)return r;return-1},goog.array.lastIndexOf=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.lastIndexOf)?function(t,e,r){return goog.asserts.assert(null!=t.length),Array.prototype.lastIndexOf.call(t,e,null==r?t.length-1:r)}:function(t,e,r){if(0>(r=null==r?t.length-1:r)&&(r=Math.max(0,t.length+r)),goog.isString(t))return goog.isString(e)&&1==e.length?t.lastIndexOf(e,r):-1;for(;0<=r;r--)if(r in t&&t[r]===e)return r;return-1},goog.array.forEach=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.forEach)?function(t,e,r){goog.asserts.assert(null!=t.length),Array.prototype.forEach.call(t,e,r)}:function(t,e,r){for(var n=t.length,i=goog.isString(t)?t.split(""):t,o=0;o<n;o++)o in i&&e.call(r,i[o],o,t)},goog.array.forEachRight=function(t,e,r){var n=t.length,i=goog.isString(t)?t.split(""):t;for(--n;0<=n;--n)n in i&&e.call(r,i[n],n,t)},goog.array.filter=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.filter)?function(t,e,r){return goog.asserts.assert(null!=t.length),Array.prototype.filter.call(t,e,r)}:function(t,e,r){for(var n=t.length,i=[],o=0,a=goog.isString(t)?t.split(""):t,s=0;s<n;s++)if(s in a){var u=a[s];e.call(r,u,s,t)&&(i[o++]=u)}return i},goog.array.map=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.map)?function(t,e,r){return goog.asserts.assert(null!=t.length),Array.prototype.map.call(t,e,r)}:function(t,e,r){for(var n=t.length,i=Array(n),o=goog.isString(t)?t.split(""):t,a=0;a<n;a++)a in o&&(i[a]=e.call(r,o[a],a,t));return i},goog.array.reduce=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.reduce)?function(t,e,r,n){return goog.asserts.assert(null!=t.length),n&&(e=goog.bind(e,n)),Array.prototype.reduce.call(t,e,r)}:function(t,e,r,n){var i=r;return goog.array.forEach(t,(function(r,o){i=e.call(n,i,r,o,t)})),i},goog.array.reduceRight=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.reduceRight)?function(t,e,r,n){return goog.asserts.assert(null!=t.length),goog.asserts.assert(null!=e),n&&(e=goog.bind(e,n)),Array.prototype.reduceRight.call(t,e,r)}:function(t,e,r,n){var i=r;return goog.array.forEachRight(t,(function(r,o){i=e.call(n,i,r,o,t)})),i},goog.array.some=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.some)?function(t,e,r){return goog.asserts.assert(null!=t.length),Array.prototype.some.call(t,e,r)}:function(t,e,r){for(var n=t.length,i=goog.isString(t)?t.split(""):t,o=0;o<n;o++)if(o in i&&e.call(r,i[o],o,t))return!0;return!1},goog.array.every=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.every)?function(t,e,r){return goog.asserts.assert(null!=t.length),Array.prototype.every.call(t,e,r)}:function(t,e,r){for(var n=t.length,i=goog.isString(t)?t.split(""):t,o=0;o<n;o++)if(o in i&&!e.call(r,i[o],o,t))return!1;return!0},goog.array.count=function(t,e,r){var n=0;return goog.array.forEach(t,(function(t,i,o){e.call(r,t,i,o)&&++n}),r),n},goog.array.find=function(t,e,r){return 0>(e=goog.array.findIndex(t,e,r))?null:goog.isString(t)?t.charAt(e):t[e]},goog.array.findIndex=function(t,e,r){for(var n=t.length,i=goog.isString(t)?t.split(""):t,o=0;o<n;o++)if(o in i&&e.call(r,i[o],o,t))return o;return-1},goog.array.findRight=function(t,e,r){return 0>(e=goog.array.findIndexRight(t,e,r))?null:goog.isString(t)?t.charAt(e):t[e]},goog.array.findIndexRight=function(t,e,r){var n=t.length,i=goog.isString(t)?t.split(""):t;for(--n;0<=n;n--)if(n in i&&e.call(r,i[n],n,t))return n;return-1},goog.array.contains=function(t,e){return 0<=goog.array.indexOf(t,e)},goog.array.isEmpty=function(t){return 0==t.length},goog.array.clear=function(t){if(!goog.isArray(t))for(var e=t.length-1;0<=e;e--)delete t[e];t.length=0},goog.array.insert=function(t,e){goog.array.contains(t,e)||t.push(e)},goog.array.insertAt=function(t,e,r){goog.array.splice(t,r,0,e)},goog.array.insertArrayAt=function(t,e,r){goog.partial(goog.array.splice,t,r,0).apply(null,e)},goog.array.insertBefore=function(t,e,r){var n;2==arguments.length||0>(n=goog.array.indexOf(t,r))?t.push(e):goog.array.insertAt(t,e,n)},goog.array.remove=function(t,e){var r;return(r=0<=(e=goog.array.indexOf(t,e)))&&goog.array.removeAt(t,e),r},goog.array.removeLast=function(t,e){return 0<=(e=goog.array.lastIndexOf(t,e))&&(goog.array.removeAt(t,e),!0)},goog.array.removeAt=function(t,e){return goog.asserts.assert(null!=t.length),1==Array.prototype.splice.call(t,e,1).length},goog.array.removeIf=function(t,e,r){return 0<=(e=goog.array.findIndex(t,e,r))&&(goog.array.removeAt(t,e),!0)},goog.array.removeAllIf=function(t,e,r){var n=0;return goog.array.forEachRight(t,(function(i,o){e.call(r,i,o,t)&&goog.array.removeAt(t,o)&&n++})),n},goog.array.concat=function(t){return Array.prototype.concat.apply([],arguments)},goog.array.join=function(t){return Array.prototype.concat.apply([],arguments)},goog.array.toArray=function(t){var e=t.length;if(0<e){for(var r=Array(e),n=0;n<e;n++)r[n]=t[n];return r}return[]},goog.array.clone=goog.array.toArray,goog.array.extend=function(t,e){for(var r=1;r<arguments.length;r++){var n=arguments[r];if(goog.isArrayLike(n)){var i=t.length||0,o=n.length||0;t.length=i+o;for(var a=0;a<o;a++)t[i+a]=n[a]}else t.push(n)}},goog.array.splice=function(t,e,r,n){return goog.asserts.assert(null!=t.length),Array.prototype.splice.apply(t,goog.array.slice(arguments,1))},goog.array.slice=function(t,e,r){return goog.asserts.assert(null!=t.length),2>=arguments.length?Array.prototype.slice.call(t,e):Array.prototype.slice.call(t,e,r)},goog.array.removeDuplicates=function(t,e,r){e=e||t;var n=function(t){return goog.isObject(t)?"o"+goog.getUid(t):(typeof t).charAt(0)+t};r=r||n,n={};for(var i=0,o=0;o<t.length;){var a=t[o++],s=r(a);Object.prototype.hasOwnProperty.call(n,s)||(n[s]=!0,e[i++]=a)}e.length=i},goog.array.binarySearch=function(t,e,r){return goog.array.binarySearch_(t,r||goog.array.defaultCompare,!1,e)},goog.array.binarySelect=function(t,e,r){return goog.array.binarySearch_(t,e,!0,void 0,r)},goog.array.binarySearch_=function(t,e,r,n,i){for(var o,a=0,s=t.length;a<s;){var u=a+s>>1,c=r?e.call(i,t[u],u,t):e(n,t[u]);0<c?a=u+1:(s=u,o=!c)}return o?a:~a},goog.array.sort=function(t,e){t.sort(e||goog.array.defaultCompare)},goog.array.stableSort=function(t,e){for(var r=Array(t.length),n=0;n<t.length;n++)r[n]={index:n,value:t[n]};var i=e||goog.array.defaultCompare;for(goog.array.sort(r,(function(t,e){return i(t.value,e.value)||t.index-e.index})),n=0;n<t.length;n++)t[n]=r[n].value},goog.array.sortByKey=function(t,e,r){var n=r||goog.array.defaultCompare;goog.array.sort(t,(function(t,r){return n(e(t),e(r))}))},goog.array.sortObjectsByKey=function(t,e,r){goog.array.sortByKey(t,(function(t){return t[e]}),r)},goog.array.isSorted=function(t,e,r){e=e||goog.array.defaultCompare;for(var n=1;n<t.length;n++){var i=e(t[n-1],t[n]);if(0<i||0==i&&r)return!1}return!0},goog.array.equals=function(t,e,r){if(!goog.isArrayLike(t)||!goog.isArrayLike(e)||t.length!=e.length)return!1;var n=t.length;r=r||goog.array.defaultCompareEquality;for(var i=0;i<n;i++)if(!r(t[i],e[i]))return!1;return!0},goog.array.compare3=function(t,e,r){r=r||goog.array.defaultCompare;for(var n=Math.min(t.length,e.length),i=0;i<n;i++){var o=r(t[i],e[i]);if(0!=o)return o}return goog.array.defaultCompare(t.length,e.length)},goog.array.defaultCompare=function(t,e){return t>e?1:t<e?-1:0},goog.array.inverseDefaultCompare=function(t,e){return-goog.array.defaultCompare(t,e)},goog.array.defaultCompareEquality=function(t,e){return t===e},goog.array.binaryInsert=function(t,e,r){return 0>(r=goog.array.binarySearch(t,e,r))&&(goog.array.insertAt(t,e,-(r+1)),!0)},goog.array.binaryRemove=function(t,e,r){return 0<=(e=goog.array.binarySearch(t,e,r))&&goog.array.removeAt(t,e)},goog.array.bucket=function(t,e,r){for(var n={},i=0;i<t.length;i++){var o=t[i],a=e.call(r,o,i,t);goog.isDef(a)&&(n[a]||(n[a]=[])).push(o)}return n},goog.array.toObject=function(t,e,r){var n={};return goog.array.forEach(t,(function(i,o){n[e.call(r,i,o,t)]=i})),n},goog.array.range=function(t,e,r){var n=[],i=0,o=t;if(void 0!==e&&(i=t,o=e),0>(r=r||1)*(o-i))return[];if(0<r)for(t=i;t<o;t+=r)n.push(t);else for(t=i;t>o;t+=r)n.push(t);return n},goog.array.repeat=function(t,e){for(var r=[],n=0;n<e;n++)r[n]=t;return r},goog.array.flatten=function(t){for(var e=[],r=0;r<arguments.length;r++){var n=arguments[r];if(goog.isArray(n))for(var i=0;i<n.length;i+=8192){var o=goog.array.slice(n,i,i+8192);o=goog.array.flatten.apply(null,o);for(var a=0;a<o.length;a++)e.push(o[a])}else e.push(n)}return e},goog.array.rotate=function(t,e){return goog.asserts.assert(null!=t.length),t.length&&(0<(e%=t.length)?Array.prototype.unshift.apply(t,t.splice(-e,e)):0>e&&Array.prototype.push.apply(t,t.splice(0,-e))),t},goog.array.moveItem=function(t,e,r){goog.asserts.assert(0<=e&&e<t.length),goog.asserts.assert(0<=r&&r<t.length),e=Array.prototype.splice.call(t,e,1),Array.prototype.splice.call(t,r,0,e[0])},goog.array.zip=function(t){if(!arguments.length)return[];for(var e=[],r=arguments[0].length,n=1;n<arguments.length;n++)arguments[n].length<r&&(r=arguments[n].length);for(n=0;n<r;n++){for(var i=[],o=0;o<arguments.length;o++)i.push(arguments[o][n]);e.push(i)}return e},goog.array.shuffle=function(t,e){e=e||Math.random;for(var r=t.length-1;0<r;r--){var n=Math.floor(e()*(r+1)),i=t[r];t[r]=t[n],t[n]=i}},goog.array.copyByIndex=function(t,e){var r=[];return goog.array.forEach(e,(function(e){r.push(t[e])})),r},goog.array.concatMap=function(t,e,r){return goog.array.concat.apply([],goog.array.map(t,e,r))},goog.crypt={},goog.crypt.stringToByteArray=function(t){for(var e=[],r=0,n=0;n<t.length;n++){var i=t.charCodeAt(n);255<i&&(e[r++]=255&i,i>>=8),e[r++]=i}return e},goog.crypt.byteArrayToString=function(t){if(8192>=t.length)return String.fromCharCode.apply(null,t);for(var e="",r=0;r<t.length;r+=8192){var n=goog.array.slice(t,r,r+8192);e+=String.fromCharCode.apply(null,n)}return e},goog.crypt.byteArrayToHex=function(t,e){return goog.array.map(t,(function(t){return 1<(t=t.toString(16)).length?t:"0"+t})).join(e||"")},goog.crypt.hexToByteArray=function(t){goog.asserts.assert(0==t.length%2,"Key string length must be multiple of 2");for(var e=[],r=0;r<t.length;r+=2)e.push(parseInt(t.substring(r,r+2),16));return e},goog.crypt.stringToUtf8ByteArray=function(t){for(var e=[],r=0,n=0;n<t.length;n++){var i=t.charCodeAt(n);128>i?e[r++]=i:(2048>i?e[r++]=i>>6|192:(55296==(64512&i)&&n+1<t.length&&56320==(64512&t.charCodeAt(n+1))?(i=65536+((1023&i)<<10)+(1023&t.charCodeAt(++n)),e[r++]=i>>18|240,e[r++]=i>>12&63|128):e[r++]=i>>12|224,e[r++]=i>>6&63|128),e[r++]=63&i|128)}return e},goog.crypt.utf8ByteArrayToString=function(t){for(var e=[],r=0,n=0;r<t.length;){var i=t[r++];if(128>i)e[n++]=String.fromCharCode(i);else if(191<i&&224>i){var o=t[r++];e[n++]=String.fromCharCode((31&i)<<6|63&o)}else if(239<i&&365>i){o=t[r++];var a=t[r++];i=((7&i)<<18|(63&o)<<12|(63&a)<<6|63&t[r++])-65536,e[n++]=String.fromCharCode(55296+(i>>10)),e[n++]=String.fromCharCode(56320+(1023&i))}else o=t[r++],a=t[r++],e[n++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&a)}return e.join("")},goog.crypt.xorByteArray=function(t,e){goog.asserts.assert(t.length==e.length,"XOR array lengths must match");for(var r=[],n=0;n<t.length;n++)r.push(t[n]^e[n]);return r},goog.dom.asserts={},goog.dom.asserts.assertIsLocation=function(t){if(goog.asserts.ENABLE_ASSERTS){var e=goog.dom.asserts.getWindow_(t);e&&(!t||!(t instanceof e.Location)&&t instanceof e.Element)&&goog.asserts.fail("Argument is not a Location (or a non-Element mock); got: %s",goog.dom.asserts.debugStringForType_(t))}return t},goog.dom.asserts.assertIsElementType_=function(t,e){if(goog.asserts.ENABLE_ASSERTS){var r=goog.dom.asserts.getWindow_(t);r&&void 0!==r[e]&&(t&&(t instanceof r[e]||!(t instanceof r.Location||t instanceof r.Element))||goog.asserts.fail("Argument is not a %s (or a non-Element, non-Location mock); got: %s",e,goog.dom.asserts.debugStringForType_(t)))}return t},goog.dom.asserts.assertIsHTMLAnchorElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLAnchorElement")},goog.dom.asserts.assertIsHTMLButtonElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLButtonElement")},goog.dom.asserts.assertIsHTMLLinkElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLLinkElement")},goog.dom.asserts.assertIsHTMLImageElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLImageElement")},goog.dom.asserts.assertIsHTMLAudioElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLAudioElement")},goog.dom.asserts.assertIsHTMLVideoElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLVideoElement")},goog.dom.asserts.assertIsHTMLInputElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLInputElement")},goog.dom.asserts.assertIsHTMLTextAreaElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLTextAreaElement")},goog.dom.asserts.assertIsHTMLCanvasElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLCanvasElement")},goog.dom.asserts.assertIsHTMLEmbedElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLEmbedElement")},goog.dom.asserts.assertIsHTMLFormElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLFormElement")},goog.dom.asserts.assertIsHTMLFrameElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLFrameElement")},goog.dom.asserts.assertIsHTMLIFrameElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLIFrameElement")},goog.dom.asserts.assertIsHTMLObjectElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLObjectElement")},goog.dom.asserts.assertIsHTMLScriptElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLScriptElement")},goog.dom.asserts.debugStringForType_=function(t){if(!goog.isObject(t))return void 0===t?"undefined":null===t?"null":typeof t;try{return t.constructor.displayName||t.constructor.name||Object.prototype.toString.call(t)}catch(t){return"<object could not be stringified>"}},goog.dom.asserts.getWindow_=function(t){try{var e=t&&t.ownerDocument,r=e&&(e.defaultView||e.parentWindow);if((r=r||goog.global).Element&&r.Location)return r}catch(t){}return null},goog.functions={},goog.functions.constant=function(t){return function(){return t}},goog.functions.FALSE=function(){return!1},goog.functions.TRUE=function(){return!0},goog.functions.NULL=function(){return null},goog.functions.identity=function(t,e){return t},goog.functions.error=function(t){return function(){throw Error(t)}},goog.functions.fail=function(t){return function(){throw t}},goog.functions.lock=function(t,e){return e=e||0,function(){return t.apply(this,Array.prototype.slice.call(arguments,0,e))}},goog.functions.nth=function(t){return function(){return arguments[t]}},goog.functions.partialRight=function(t,e){var r=Array.prototype.slice.call(arguments,1);return function(){var e=Array.prototype.slice.call(arguments);return e.push.apply(e,r),t.apply(this,e)}},goog.functions.withReturnValue=function(t,e){return goog.functions.sequence(t,goog.functions.constant(e))},goog.functions.equalTo=function(t,e){return function(r){return e?t==r:t===r}},goog.functions.compose=function(t,e){var r=arguments,n=r.length;return function(){var t;n&&(t=r[n-1].apply(this,arguments));for(var e=n-2;0<=e;e--)t=r[e].call(this,t);return t}},goog.functions.sequence=function(t){var e=arguments,r=e.length;return function(){for(var t,n=0;n<r;n++)t=e[n].apply(this,arguments);return t}},goog.functions.and=function(t){var e=arguments,r=e.length;return function(){for(var t=0;t<r;t++)if(!e[t].apply(this,arguments))return!1;return!0}},goog.functions.or=function(t){var e=arguments,r=e.length;return function(){for(var t=0;t<r;t++)if(e[t].apply(this,arguments))return!0;return!1}},goog.functions.not=function(t){return function(){return!t.apply(this,arguments)}},goog.functions.create=function(t,e){var r=function(){};return r.prototype=t.prototype,r=new r,t.apply(r,Array.prototype.slice.call(arguments,1)),r},goog.functions.CACHE_RETURN_VALUE=!0,goog.functions.cacheReturnValue=function(t){var e,r=!1;return function(){return goog.functions.CACHE_RETURN_VALUE?(r||(e=t(),r=!0),e):t()}},goog.functions.once=function(t){var e=t;return function(){if(e){var t=e;e=null,t()}}},goog.functions.debounce=function(t,e,r){var n=0;return function(i){goog.global.clearTimeout(n);var o=arguments;n=goog.global.setTimeout((function(){t.apply(r,o)}),e)}},goog.functions.throttle=function(t,e,r){var n=0,i=!1,o=[],a=function(){n=0,i&&(i=!1,s())},s=function(){n=goog.global.setTimeout(a,e),t.apply(r,o)};return function(t){o=arguments,n?i=!0:s()}},goog.functions.rateLimit=function(t,e,r){var n=0,i=function(){n=0};return function(o){n||(n=goog.global.setTimeout(i,e),t.apply(r,arguments))}},goog.dom.HtmlElement=function(){},goog.dom.TagName=function(t){this.tagName_=t},goog.dom.TagName.prototype.toString=function(){return this.tagName_},goog.dom.TagName.A=new goog.dom.TagName("A"),goog.dom.TagName.ABBR=new goog.dom.TagName("ABBR"),goog.dom.TagName.ACRONYM=new goog.dom.TagName("ACRONYM"),goog.dom.TagName.ADDRESS=new goog.dom.TagName("ADDRESS"),goog.dom.TagName.APPLET=new goog.dom.TagName("APPLET"),goog.dom.TagName.AREA=new goog.dom.TagName("AREA"),goog.dom.TagName.ARTICLE=new goog.dom.TagName("ARTICLE"),goog.dom.TagName.ASIDE=new goog.dom.TagName("ASIDE"),goog.dom.TagName.AUDIO=new goog.dom.TagName("AUDIO"),goog.dom.TagName.B=new goog.dom.TagName("B"),goog.dom.TagName.BASE=new goog.dom.TagName("BASE"),goog.dom.TagName.BASEFONT=new goog.dom.TagName("BASEFONT"),goog.dom.TagName.BDI=new goog.dom.TagName("BDI"),goog.dom.TagName.BDO=new goog.dom.TagName("BDO"),goog.dom.TagName.BIG=new goog.dom.TagName("BIG"),goog.dom.TagName.BLOCKQUOTE=new goog.dom.TagName("BLOCKQUOTE"),goog.dom.TagName.BODY=new goog.dom.TagName("BODY"),goog.dom.TagName.BR=new goog.dom.TagName("BR"),goog.dom.TagName.BUTTON=new goog.dom.TagName("BUTTON"),goog.dom.TagName.CANVAS=new goog.dom.TagName("CANVAS"),goog.dom.TagName.CAPTION=new goog.dom.TagName("CAPTION"),goog.dom.TagName.CENTER=new goog.dom.TagName("CENTER"),goog.dom.TagName.CITE=new goog.dom.TagName("CITE"),goog.dom.TagName.CODE=new goog.dom.TagName("CODE"),goog.dom.TagName.COL=new goog.dom.TagName("COL"),goog.dom.TagName.COLGROUP=new goog.dom.TagName("COLGROUP"),goog.dom.TagName.COMMAND=new goog.dom.TagName("COMMAND"),goog.dom.TagName.DATA=new goog.dom.TagName("DATA"),goog.dom.TagName.DATALIST=new goog.dom.TagName("DATALIST"),goog.dom.TagName.DD=new goog.dom.TagName("DD"),goog.dom.TagName.DEL=new goog.dom.TagName("DEL"),goog.dom.TagName.DETAILS=new goog.dom.TagName("DETAILS"),goog.dom.TagName.DFN=new goog.dom.TagName("DFN"),goog.dom.TagName.DIALOG=new goog.dom.TagName("DIALOG"),goog.dom.TagName.DIR=new goog.dom.TagName("DIR"),goog.dom.TagName.DIV=new goog.dom.TagName("DIV"),goog.dom.TagName.DL=new goog.dom.TagName("DL"),goog.dom.TagName.DT=new goog.dom.TagName("DT"),goog.dom.TagName.EM=new goog.dom.TagName("EM"),goog.dom.TagName.EMBED=new goog.dom.TagName("EMBED"),goog.dom.TagName.FIELDSET=new goog.dom.TagName("FIELDSET"),goog.dom.TagName.FIGCAPTION=new goog.dom.TagName("FIGCAPTION"),goog.dom.TagName.FIGURE=new goog.dom.TagName("FIGURE"),goog.dom.TagName.FONT=new goog.dom.TagName("FONT"),goog.dom.TagName.FOOTER=new goog.dom.TagName("FOOTER"),goog.dom.TagName.FORM=new goog.dom.TagName("FORM"),goog.dom.TagName.FRAME=new goog.dom.TagName("FRAME"),goog.dom.TagName.FRAMESET=new goog.dom.TagName("FRAMESET"),goog.dom.TagName.H1=new goog.dom.TagName("H1"),goog.dom.TagName.H2=new goog.dom.TagName("H2"),goog.dom.TagName.H3=new goog.dom.TagName("H3"),goog.dom.TagName.H4=new goog.dom.TagName("H4"),goog.dom.TagName.H5=new goog.dom.TagName("H5"),goog.dom.TagName.H6=new goog.dom.TagName("H6"),goog.dom.TagName.HEAD=new goog.dom.TagName("HEAD"),goog.dom.TagName.HEADER=new goog.dom.TagName("HEADER"),goog.dom.TagName.HGROUP=new goog.dom.TagName("HGROUP"),goog.dom.TagName.HR=new goog.dom.TagName("HR"),goog.dom.TagName.HTML=new goog.dom.TagName("HTML"),goog.dom.TagName.I=new goog.dom.TagName("I"),goog.dom.TagName.IFRAME=new goog.dom.TagName("IFRAME"),goog.dom.TagName.IMG=new goog.dom.TagName("IMG"),goog.dom.TagName.INPUT=new goog.dom.TagName("INPUT"),goog.dom.TagName.INS=new goog.dom.TagName("INS"),goog.dom.TagName.ISINDEX=new goog.dom.TagName("ISINDEX"),goog.dom.TagName.KBD=new goog.dom.TagName("KBD"),goog.dom.TagName.KEYGEN=new goog.dom.TagName("KEYGEN"),goog.dom.TagName.LABEL=new goog.dom.TagName("LABEL"),goog.dom.TagName.LEGEND=new goog.dom.TagName("LEGEND"),goog.dom.TagName.LI=new goog.dom.TagName("LI"),goog.dom.TagName.LINK=new goog.dom.TagName("LINK"),goog.dom.TagName.MAIN=new goog.dom.TagName("MAIN"),goog.dom.TagName.MAP=new goog.dom.TagName("MAP"),goog.dom.TagName.MARK=new goog.dom.TagName("MARK"),goog.dom.TagName.MATH=new goog.dom.TagName("MATH"),goog.dom.TagName.MENU=new goog.dom.TagName("MENU"),goog.dom.TagName.MENUITEM=new goog.dom.TagName("MENUITEM"),goog.dom.TagName.META=new goog.dom.TagName("META"),goog.dom.TagName.METER=new goog.dom.TagName("METER"),goog.dom.TagName.NAV=new goog.dom.TagName("NAV"),goog.dom.TagName.NOFRAMES=new goog.dom.TagName("NOFRAMES"),goog.dom.TagName.NOSCRIPT=new goog.dom.TagName("NOSCRIPT"),goog.dom.TagName.OBJECT=new goog.dom.TagName("OBJECT"),goog.dom.TagName.OL=new goog.dom.TagName("OL"),goog.dom.TagName.OPTGROUP=new goog.dom.TagName("OPTGROUP"),goog.dom.TagName.OPTION=new goog.dom.TagName("OPTION"),goog.dom.TagName.OUTPUT=new goog.dom.TagName("OUTPUT"),goog.dom.TagName.P=new goog.dom.TagName("P"),goog.dom.TagName.PARAM=new goog.dom.TagName("PARAM"),goog.dom.TagName.PICTURE=new goog.dom.TagName("PICTURE"),goog.dom.TagName.PRE=new goog.dom.TagName("PRE"),goog.dom.TagName.PROGRESS=new goog.dom.TagName("PROGRESS"),goog.dom.TagName.Q=new goog.dom.TagName("Q"),goog.dom.TagName.RP=new goog.dom.TagName("RP"),goog.dom.TagName.RT=new goog.dom.TagName("RT"),goog.dom.TagName.RTC=new goog.dom.TagName("RTC"),goog.dom.TagName.RUBY=new goog.dom.TagName("RUBY"),goog.dom.TagName.S=new goog.dom.TagName("S"),goog.dom.TagName.SAMP=new goog.dom.TagName("SAMP"),goog.dom.TagName.SCRIPT=new goog.dom.TagName("SCRIPT"),goog.dom.TagName.SECTION=new goog.dom.TagName("SECTION"),goog.dom.TagName.SELECT=new goog.dom.TagName("SELECT"),goog.dom.TagName.SMALL=new goog.dom.TagName("SMALL"),goog.dom.TagName.SOURCE=new goog.dom.TagName("SOURCE"),goog.dom.TagName.SPAN=new goog.dom.TagName("SPAN"),goog.dom.TagName.STRIKE=new goog.dom.TagName("STRIKE"),goog.dom.TagName.STRONG=new goog.dom.TagName("STRONG"),goog.dom.TagName.STYLE=new goog.dom.TagName("STYLE"),goog.dom.TagName.SUB=new goog.dom.TagName("SUB"),goog.dom.TagName.SUMMARY=new goog.dom.TagName("SUMMARY"),goog.dom.TagName.SUP=new goog.dom.TagName("SUP"),goog.dom.TagName.SVG=new goog.dom.TagName("SVG"),goog.dom.TagName.TABLE=new goog.dom.TagName("TABLE"),goog.dom.TagName.TBODY=new goog.dom.TagName("TBODY"),goog.dom.TagName.TD=new goog.dom.TagName("TD"),goog.dom.TagName.TEMPLATE=new goog.dom.TagName("TEMPLATE"),goog.dom.TagName.TEXTAREA=new goog.dom.TagName("TEXTAREA"),goog.dom.TagName.TFOOT=new goog.dom.TagName("TFOOT"),goog.dom.TagName.TH=new goog.dom.TagName("TH"),goog.dom.TagName.THEAD=new goog.dom.TagName("THEAD"),goog.dom.TagName.TIME=new goog.dom.TagName("TIME"),goog.dom.TagName.TITLE=new goog.dom.TagName("TITLE"),goog.dom.TagName.TR=new goog.dom.TagName("TR"),goog.dom.TagName.TRACK=new goog.dom.TagName("TRACK"),goog.dom.TagName.TT=new goog.dom.TagName("TT"),goog.dom.TagName.U=new goog.dom.TagName("U"),goog.dom.TagName.UL=new goog.dom.TagName("UL"),goog.dom.TagName.VAR=new goog.dom.TagName("VAR"),goog.dom.TagName.VIDEO=new goog.dom.TagName("VIDEO"),goog.dom.TagName.WBR=new goog.dom.TagName("WBR"),goog.dom.tags={},goog.dom.tags.VOID_TAGS_={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},goog.dom.tags.isVoidTag=function(t){return!0===goog.dom.tags.VOID_TAGS_[t]},goog.html={},goog.html.trustedtypes={},goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY=goog.TRUSTED_TYPES_POLICY_NAME?goog.createTrustedTypesPolicy(goog.TRUSTED_TYPES_POLICY_NAME+"#html"):null,goog.string={},goog.string.TypedString=function(){},goog.string.Const=function(t,e){this.stringConstValueWithSecurityContract__googStringSecurityPrivate_=t===goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_&&e||"",this.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_=goog.string.Const.TYPE_MARKER_},goog.string.Const.prototype.implementsGoogStringTypedString=!0,goog.string.Const.prototype.getTypedStringValue=function(){return this.stringConstValueWithSecurityContract__googStringSecurityPrivate_},goog.string.Const.prototype.toString=function(){return"Const{"+this.stringConstValueWithSecurityContract__googStringSecurityPrivate_+"}"},goog.string.Const.unwrap=function(t){return t instanceof goog.string.Const&&t.constructor===goog.string.Const&&t.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_===goog.string.Const.TYPE_MARKER_?t.stringConstValueWithSecurityContract__googStringSecurityPrivate_:(goog.asserts.fail("expected object of type Const, got '"+t+"'"),"type_error:Const")},goog.string.Const.from=function(t){return new goog.string.Const(goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_,t)},goog.string.Const.TYPE_MARKER_={},goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_={},goog.string.Const.EMPTY=goog.string.Const.from(""),goog.html.SafeScript=function(){this.privateDoNotAccessOrElseSafeScriptWrappedValue_="",this.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_},goog.html.SafeScript.prototype.implementsGoogStringTypedString=!0,goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={},goog.html.SafeScript.fromConstant=function(t){return 0===(t=goog.string.Const.unwrap(t)).length?goog.html.SafeScript.EMPTY:goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(t)},goog.html.SafeScript.fromConstantAndArgs=function(t,e){for(var r=[],n=1;n<arguments.length;n++)r.push(goog.html.SafeScript.stringify_(arguments[n]));return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse("("+goog.string.Const.unwrap(t)+")("+r.join(", ")+");")},goog.html.SafeScript.fromJson=function(t){return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(goog.html.SafeScript.stringify_(t))},goog.html.SafeScript.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeScriptWrappedValue_.toString()},goog.DEBUG&&(goog.html.SafeScript.prototype.toString=function(){return"SafeScript{"+this.privateDoNotAccessOrElseSafeScriptWrappedValue_+"}"}),goog.html.SafeScript.unwrap=function(t){return goog.html.SafeScript.unwrapTrustedScript(t).toString()},goog.html.SafeScript.unwrapTrustedScript=function(t){return t instanceof goog.html.SafeScript&&t.constructor===goog.html.SafeScript&&t.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?t.privateDoNotAccessOrElseSafeScriptWrappedValue_:(goog.asserts.fail("expected object of type SafeScript, got '"+t+"' of type "+goog.typeOf(t)),"type_error:SafeScript")},goog.html.SafeScript.stringify_=function(t){return JSON.stringify(t).replace(/</g,"\\x3c")},goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse=function(t){return(new goog.html.SafeScript).initSecurityPrivateDoNotAccessOrElse_(t)},goog.html.SafeScript.prototype.initSecurityPrivateDoNotAccessOrElse_=function(t){return this.privateDoNotAccessOrElseSafeScriptWrappedValue_=goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY?goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createScript(t):t,this},goog.html.SafeScript.EMPTY=goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(""),goog.fs={},goog.fs.url={},goog.fs.url.createObjectUrl=function(t){return goog.fs.url.getUrlObject_().createObjectURL(t)},goog.fs.url.revokeObjectUrl=function(t){goog.fs.url.getUrlObject_().revokeObjectURL(t)},goog.fs.url.getUrlObject_=function(){var t=goog.fs.url.findUrlObject_();if(null!=t)return t;throw Error("This browser doesn't seem to support blob URLs")},goog.fs.url.findUrlObject_=function(){return goog.isDef(goog.global.URL)&&goog.isDef(goog.global.URL.createObjectURL)?goog.global.URL:goog.isDef(goog.global.webkitURL)&&goog.isDef(goog.global.webkitURL.createObjectURL)?goog.global.webkitURL:goog.isDef(goog.global.createObjectURL)?goog.global:null},goog.fs.url.browserSupportsObjectUrls=function(){return null!=goog.fs.url.findUrlObject_()},goog.i18n={},goog.i18n.bidi={},goog.i18n.bidi.FORCE_RTL=!1,goog.i18n.bidi.IS_RTL=goog.i18n.bidi.FORCE_RTL||("ar"==goog.LOCALE.substring(0,2).toLowerCase()||"fa"==goog.LOCALE.substring(0,2).toLowerCase()||"he"==goog.LOCALE.substring(0,2).toLowerCase()||"iw"==goog.LOCALE.substring(0,2).toLowerCase()||"ps"==goog.LOCALE.substring(0,2).toLowerCase()||"sd"==goog.LOCALE.substring(0,2).toLowerCase()||"ug"==goog.LOCALE.substring(0,2).toLowerCase()||"ur"==goog.LOCALE.substring(0,2).toLowerCase()||"yi"==goog.LOCALE.substring(0,2).toLowerCase())&&(2==goog.LOCALE.length||"-"==goog.LOCALE.substring(2,3)||"_"==goog.LOCALE.substring(2,3))||3<=goog.LOCALE.length&&"ckb"==goog.LOCALE.substring(0,3).toLowerCase()&&(3==goog.LOCALE.length||"-"==goog.LOCALE.substring(3,4)||"_"==goog.LOCALE.substring(3,4))||7<=goog.LOCALE.length&&("-"==goog.LOCALE.substring(2,3)||"_"==goog.LOCALE.substring(2,3))&&("adlm"==goog.LOCALE.substring(3,7).toLowerCase()||"arab"==goog.LOCALE.substring(3,7).toLowerCase()||"hebr"==goog.LOCALE.substring(3,7).toLowerCase()||"nkoo"==goog.LOCALE.substring(3,7).toLowerCase()||"rohg"==goog.LOCALE.substring(3,7).toLowerCase()||"thaa"==goog.LOCALE.substring(3,7).toLowerCase())||8<=goog.LOCALE.length&&("-"==goog.LOCALE.substring(3,4)||"_"==goog.LOCALE.substring(3,4))&&("adlm"==goog.LOCALE.substring(4,8).toLowerCase()||"arab"==goog.LOCALE.substring(4,8).toLowerCase()||"hebr"==goog.LOCALE.substring(4,8).toLowerCase()||"nkoo"==goog.LOCALE.substring(4,8).toLowerCase()||"rohg"==goog.LOCALE.substring(4,8).toLowerCase()||"thaa"==goog.LOCALE.substring(4,8).toLowerCase()),goog.i18n.bidi.Format={LRE:"",RLE:"",PDF:"",LRM:"",RLM:""},goog.i18n.bidi.Dir={LTR:1,RTL:-1,NEUTRAL:0},goog.i18n.bidi.RIGHT="right",goog.i18n.bidi.LEFT="left",goog.i18n.bidi.I18N_RIGHT=goog.i18n.bidi.IS_RTL?goog.i18n.bidi.LEFT:goog.i18n.bidi.RIGHT,goog.i18n.bidi.I18N_LEFT=goog.i18n.bidi.IS_RTL?goog.i18n.bidi.RIGHT:goog.i18n.bidi.LEFT,goog.i18n.bidi.toDir=function(t,e){return"number"==typeof t?0<t?goog.i18n.bidi.Dir.LTR:0>t?goog.i18n.bidi.Dir.RTL:e?null:goog.i18n.bidi.Dir.NEUTRAL:null==t?null:t?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR},goog.i18n.bidi.ltrChars_="A-Za-zÀ-ÖØ-öø-ʸ̀-ऀ-Ⰰ-\ud801\ud804-\ud839\ud83c-\udbff豈-︀--",goog.i18n.bidi.rtlChars_="֑-ۯۺ-ࣿ\ud802-\ud803\ud83a-\ud83bיִ-﷿ﹰ-ﻼ",goog.i18n.bidi.htmlSkipReg_=/<[^>]*>|&[^;]+;/g,goog.i18n.bidi.stripHtmlIfNeeded_=function(t,e){return e?t.replace(goog.i18n.bidi.htmlSkipReg_,""):t},goog.i18n.bidi.rtlCharReg_=new RegExp("["+goog.i18n.bidi.rtlChars_+"]"),goog.i18n.bidi.ltrCharReg_=new RegExp("["+goog.i18n.bidi.ltrChars_+"]"),goog.i18n.bidi.hasAnyRtl=function(t,e){return goog.i18n.bidi.rtlCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(t,e))},goog.i18n.bidi.hasRtlChar=goog.i18n.bidi.hasAnyRtl,goog.i18n.bidi.hasAnyLtr=function(t,e){return goog.i18n.bidi.ltrCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(t,e))},goog.i18n.bidi.ltrRe_=new RegExp("^["+goog.i18n.bidi.ltrChars_+"]"),goog.i18n.bidi.rtlRe_=new RegExp("^["+goog.i18n.bidi.rtlChars_+"]"),goog.i18n.bidi.isRtlChar=function(t){return goog.i18n.bidi.rtlRe_.test(t)},goog.i18n.bidi.isLtrChar=function(t){return goog.i18n.bidi.ltrRe_.test(t)},goog.i18n.bidi.isNeutralChar=function(t){return!goog.i18n.bidi.isLtrChar(t)&&!goog.i18n.bidi.isRtlChar(t)},goog.i18n.bidi.ltrDirCheckRe_=new RegExp("^[^"+goog.i18n.bidi.rtlChars_+"]*["+goog.i18n.bidi.ltrChars_+"]"),goog.i18n.bidi.rtlDirCheckRe_=new RegExp("^[^"+goog.i18n.bidi.ltrChars_+"]*["+goog.i18n.bidi.rtlChars_+"]"),goog.i18n.bidi.startsWithRtl=function(t,e){return goog.i18n.bidi.rtlDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(t,e))},goog.i18n.bidi.isRtlText=goog.i18n.bidi.startsWithRtl,goog.i18n.bidi.startsWithLtr=function(t,e){return goog.i18n.bidi.ltrDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(t,e))},goog.i18n.bidi.isLtrText=goog.i18n.bidi.startsWithLtr,goog.i18n.bidi.isRequiredLtrRe_=/^http:\/\/.*/,goog.i18n.bidi.isNeutralText=function(t,e){return t=goog.i18n.bidi.stripHtmlIfNeeded_(t,e),goog.i18n.bidi.isRequiredLtrRe_.test(t)||!goog.i18n.bidi.hasAnyLtr(t)&&!goog.i18n.bidi.hasAnyRtl(t)},goog.i18n.bidi.ltrExitDirCheckRe_=new RegExp("["+goog.i18n.bidi.ltrChars_+"][^"+goog.i18n.bidi.rtlChars_+"]*$"),goog.i18n.bidi.rtlExitDirCheckRe_=new RegExp("["+goog.i18n.bidi.rtlChars_+"][^"+goog.i18n.bidi.ltrChars_+"]*$"),goog.i18n.bidi.endsWithLtr=function(t,e){return goog.i18n.bidi.ltrExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(t,e))},goog.i18n.bidi.isLtrExitText=goog.i18n.bidi.endsWithLtr,goog.i18n.bidi.endsWithRtl=function(t,e){return goog.i18n.bidi.rtlExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(t,e))},goog.i18n.bidi.isRtlExitText=goog.i18n.bidi.endsWithRtl,goog.i18n.bidi.rtlLocalesRe_=/^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Adlm|Arab|Hebr|Nkoo|Rohg|Thaa))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)/i,goog.i18n.bidi.isRtlLanguage=function(t){return goog.i18n.bidi.rtlLocalesRe_.test(t)},goog.i18n.bidi.bracketGuardTextRe_=/(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?>+)/g,goog.i18n.bidi.guardBracketInText=function(t,e){return e=(void 0===e?goog.i18n.bidi.hasAnyRtl(t):e)?goog.i18n.bidi.Format.RLM:goog.i18n.bidi.Format.LRM,t.replace(goog.i18n.bidi.bracketGuardTextRe_,e+"$&"+e)},goog.i18n.bidi.enforceRtlInHtml=function(t){return"<"==t.charAt(0)?t.replace(/<\w+/,"$& dir=rtl"):"\n<span dir=rtl>"+t+"</span>"},goog.i18n.bidi.enforceRtlInText=function(t){return goog.i18n.bidi.Format.RLE+t+goog.i18n.bidi.Format.PDF},goog.i18n.bidi.enforceLtrInHtml=function(t){return"<"==t.charAt(0)?t.replace(/<\w+/,"$& dir=ltr"):"\n<span dir=ltr>"+t+"</span>"},goog.i18n.bidi.enforceLtrInText=function(t){return goog.i18n.bidi.Format.LRE+t+goog.i18n.bidi.Format.PDF},goog.i18n.bidi.dimensionsRe_=/:\s*([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)/g,goog.i18n.bidi.leftRe_=/left/gi,goog.i18n.bidi.rightRe_=/right/gi,goog.i18n.bidi.tempRe_=/%%%%/g,goog.i18n.bidi.mirrorCSS=function(t){return t.replace(goog.i18n.bidi.dimensionsRe_,":$1 $4 $3 $2").replace(goog.i18n.bidi.leftRe_,"%%%%").replace(goog.i18n.bidi.rightRe_,goog.i18n.bidi.LEFT).replace(goog.i18n.bidi.tempRe_,goog.i18n.bidi.RIGHT)},goog.i18n.bidi.doubleQuoteSubstituteRe_=/([\u0591-\u05f2])"/g,goog.i18n.bidi.singleQuoteSubstituteRe_=/([\u0591-\u05f2])'/g,goog.i18n.bidi.normalizeHebrewQuote=function(t){return t.replace(goog.i18n.bidi.doubleQuoteSubstituteRe_,"$1״").replace(goog.i18n.bidi.singleQuoteSubstituteRe_,"$1׳")},goog.i18n.bidi.wordSeparatorRe_=/\s+/,goog.i18n.bidi.hasNumeralsRe_=/[\d\u06f0-\u06f9]/,goog.i18n.bidi.rtlDetectionThreshold_=.4,goog.i18n.bidi.estimateDirection=function(t,e){var r=0,n=0,i=!1;for(t=goog.i18n.bidi.stripHtmlIfNeeded_(t,e).split(goog.i18n.bidi.wordSeparatorRe_),e=0;e<t.length;e++){var o=t[e];goog.i18n.bidi.startsWithRtl(o)?(r++,n++):goog.i18n.bidi.isRequiredLtrRe_.test(o)?i=!0:goog.i18n.bidi.hasAnyLtr(o)?n++:goog.i18n.bidi.hasNumeralsRe_.test(o)&&(i=!0)}return 0==n?i?goog.i18n.bidi.Dir.LTR:goog.i18n.bidi.Dir.NEUTRAL:r/n>goog.i18n.bidi.rtlDetectionThreshold_?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR},goog.i18n.bidi.detectRtlDirectionality=function(t,e){return goog.i18n.bidi.estimateDirection(t,e)==goog.i18n.bidi.Dir.RTL},goog.i18n.bidi.setElementDirAndAlign=function(t,e){t&&(e=goog.i18n.bidi.toDir(e))&&(t.style.textAlign=e==goog.i18n.bidi.Dir.RTL?goog.i18n.bidi.RIGHT:goog.i18n.bidi.LEFT,t.dir=e==goog.i18n.bidi.Dir.RTL?"rtl":"ltr")},goog.i18n.bidi.setElementDirByTextDirectionality=function(t,e){switch(goog.i18n.bidi.estimateDirection(e)){case goog.i18n.bidi.Dir.LTR:t.dir="ltr";break;case goog.i18n.bidi.Dir.RTL:t.dir="rtl";break;default:t.removeAttribute("dir")}},goog.i18n.bidi.DirectionalString=function(){},goog.html.TrustedResourceUrl=function(){this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_="",this.trustedURL_=null,this.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_},goog.html.TrustedResourceUrl.prototype.implementsGoogStringTypedString=!0,goog.html.TrustedResourceUrl.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_.toString()},goog.html.TrustedResourceUrl.prototype.implementsGoogI18nBidiDirectionalString=!0,goog.html.TrustedResourceUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR},goog.html.TrustedResourceUrl.prototype.cloneWithParams=function(t,e){var r=goog.html.TrustedResourceUrl.unwrap(this),n=(r=goog.html.TrustedResourceUrl.URL_PARAM_PARSER_.exec(r))[3]||"";return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(r[1]+goog.html.TrustedResourceUrl.stringifyParams_("?",r[2]||"",t)+goog.html.TrustedResourceUrl.stringifyParams_("#",n,e))},goog.DEBUG&&(goog.html.TrustedResourceUrl.prototype.toString=function(){return"TrustedResourceUrl{"+this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_+"}"}),goog.html.TrustedResourceUrl.unwrap=function(t){return goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(t).toString()},goog.html.TrustedResourceUrl.unwrapTrustedScriptURL=function(t){return t instanceof goog.html.TrustedResourceUrl&&t.constructor===goog.html.TrustedResourceUrl&&t.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?t.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_:(goog.asserts.fail("expected object of type TrustedResourceUrl, got '"+t+"' of type "+goog.typeOf(t)),"type_error:TrustedResourceUrl")},goog.html.TrustedResourceUrl.unwrapTrustedURL=function(t){return t.trustedURL_?t.trustedURL_:goog.html.TrustedResourceUrl.unwrap(t)},goog.html.TrustedResourceUrl.format=function(t,e){var r=goog.string.Const.unwrap(t);if(!goog.html.TrustedResourceUrl.BASE_URL_.test(r))throw Error("Invalid TrustedResourceUrl format: "+r);return t=r.replace(goog.html.TrustedResourceUrl.FORMAT_MARKER_,(function(t,n){if(!Object.prototype.hasOwnProperty.call(e,n))throw Error('Found marker, "'+n+'", in format string, "'+r+'", but no valid label mapping found in args: '+JSON.stringify(e));return(t=e[n])instanceof goog.string.Const?goog.string.Const.unwrap(t):encodeURIComponent(String(t))})),goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(t)},goog.html.TrustedResourceUrl.FORMAT_MARKER_=/%{(\w+)}/g,goog.html.TrustedResourceUrl.BASE_URL_=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,goog.html.TrustedResourceUrl.URL_PARAM_PARSER_=/^([^?#]*)(\?[^#]*)?(#[\s\S]*)?/,goog.html.TrustedResourceUrl.formatWithParams=function(t,e,r,n){return goog.html.TrustedResourceUrl.format(t,e).cloneWithParams(r,n)},goog.html.TrustedResourceUrl.fromConstant=function(t){return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(t))},goog.html.TrustedResourceUrl.fromConstants=function(t){for(var e="",r=0;r<t.length;r++)e+=goog.string.Const.unwrap(t[r]);return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={},goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse=function(t){var e=new goog.html.TrustedResourceUrl;return e.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_=goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY?goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createScriptURL(t):t,goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY&&(e.trustedURL_=goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createURL(t)),e},goog.html.TrustedResourceUrl.stringifyParams_=function(t,e,r){if(null==r)return e;if(goog.isString(r))return r?t+encodeURIComponent(r):"";for(var n in r){var i=r[n];i=goog.isArray(i)?i:[i];for(var o=0;o<i.length;o++){var a=i[o];null!=a&&(e||(e=t),e+=(e.length>t.length?"&":"")+encodeURIComponent(n)+"="+encodeURIComponent(String(a)))}}return e},goog.string.internal={},goog.string.internal.startsWith=function(t,e){return 0==t.lastIndexOf(e,0)},goog.string.internal.endsWith=function(t,e){var r=t.length-e.length;return 0<=r&&t.indexOf(e,r)==r},goog.string.internal.caseInsensitiveStartsWith=function(t,e){return 0==goog.string.internal.caseInsensitiveCompare(e,t.substr(0,e.length))},goog.string.internal.caseInsensitiveEndsWith=function(t,e){return 0==goog.string.internal.caseInsensitiveCompare(e,t.substr(t.length-e.length,e.length))},goog.string.internal.caseInsensitiveEquals=function(t,e){return t.toLowerCase()==e.toLowerCase()},goog.string.internal.isEmptyOrWhitespace=function(t){return/^[\s\xa0]*$/.test(t)},goog.string.internal.trim=goog.TRUSTED_SITE&&String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]},goog.string.internal.caseInsensitiveCompare=function(t,e){return(t=String(t).toLowerCase())<(e=String(e).toLowerCase())?-1:t==e?0:1},goog.string.internal.newLineToBr=function(t,e){return t.replace(/(\r\n|\r|\n)/g,e?"<br />":"<br>")},goog.string.internal.htmlEscape=function(t,e){if(e)t=t.replace(goog.string.internal.AMP_RE_,"&").replace(goog.string.internal.LT_RE_,"<").replace(goog.string.internal.GT_RE_,">").replace(goog.string.internal.QUOT_RE_,""").replace(goog.string.internal.SINGLE_QUOTE_RE_,"'").replace(goog.string.internal.NULL_RE_,"�");else{if(!goog.string.internal.ALL_RE_.test(t))return t;-1!=t.indexOf("&")&&(t=t.replace(goog.string.internal.AMP_RE_,"&")),-1!=t.indexOf("<")&&(t=t.replace(goog.string.internal.LT_RE_,"<")),-1!=t.indexOf(">")&&(t=t.replace(goog.string.internal.GT_RE_,">")),-1!=t.indexOf('"')&&(t=t.replace(goog.string.internal.QUOT_RE_,""")),-1!=t.indexOf("'")&&(t=t.replace(goog.string.internal.SINGLE_QUOTE_RE_,"'")),-1!=t.indexOf("\0")&&(t=t.replace(goog.string.internal.NULL_RE_,"�"))}return t},goog.string.internal.AMP_RE_=/&/g,goog.string.internal.LT_RE_=/</g,goog.string.internal.GT_RE_=/>/g,goog.string.internal.QUOT_RE_=/"/g,goog.string.internal.SINGLE_QUOTE_RE_=/'/g,goog.string.internal.NULL_RE_=/\x00/g,goog.string.internal.ALL_RE_=/[\x00&<>"']/,goog.string.internal.whitespaceEscape=function(t,e){return goog.string.internal.newLineToBr(t.replace(/ /g,"  "),e)},goog.string.internal.contains=function(t,e){return-1!=t.indexOf(e)},goog.string.internal.caseInsensitiveContains=function(t,e){return goog.string.internal.contains(t.toLowerCase(),e.toLowerCase())},goog.string.internal.compareVersions=function(t,e){var r=0;t=goog.string.internal.trim(String(t)).split("."),e=goog.string.internal.trim(String(e)).split(".");for(var n=Math.max(t.length,e.length),i=0;0==r&&i<n;i++){var o=t[i]||"",a=e[i]||"";do{if(o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],a=/(\d*)(\D*)(.*)/.exec(a)||["","","",""],0==o[0].length&&0==a[0].length)break;r=0==o[1].length?0:parseInt(o[1],10);var s=0==a[1].length?0:parseInt(a[1],10);r=goog.string.internal.compareElements_(r,s)||goog.string.internal.compareElements_(0==o[2].length,0==a[2].length)||goog.string.internal.compareElements_(o[2],a[2]),o=o[3],a=a[3]}while(0==r)}return r},goog.string.internal.compareElements_=function(t,e){return t<e?-1:t>e?1:0},goog.html.SafeUrl=function(){this.privateDoNotAccessOrElseSafeUrlWrappedValue_="",this.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_},goog.html.SafeUrl.INNOCUOUS_STRING="about:invalid#zClosurez",goog.html.SafeUrl.prototype.implementsGoogStringTypedString=!0,goog.html.SafeUrl.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeUrlWrappedValue_.toString()},goog.html.SafeUrl.prototype.implementsGoogI18nBidiDirectionalString=!0,goog.html.SafeUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR},goog.DEBUG&&(goog.html.SafeUrl.prototype.toString=function(){return"SafeUrl{"+this.privateDoNotAccessOrElseSafeUrlWrappedValue_+"}"}),goog.html.SafeUrl.unwrap=function(t){return goog.html.SafeUrl.unwrapTrustedURL(t).toString()},goog.html.SafeUrl.unwrapTrustedURL=function(t){return t instanceof goog.html.SafeUrl&&t.constructor===goog.html.SafeUrl&&t.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?t.privateDoNotAccessOrElseSafeUrlWrappedValue_:(goog.asserts.fail("expected object of type SafeUrl, got '"+t+"' of type "+goog.typeOf(t)),"type_error:SafeUrl")},goog.html.SafeUrl.fromConstant=function(t){return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(t))},goog.html.SAFE_MIME_TYPE_PATTERN_=/^(?:audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-wav|wav|webm)|image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|text\/csv|video\/(?:mpeg|mp4|ogg|webm|quicktime))(?:;\w+=(?:\w+|"[\w;=]+"))*$/i,goog.html.SafeUrl.isSafeMimeType=function(t){return goog.html.SAFE_MIME_TYPE_PATTERN_.test(t)},goog.html.SafeUrl.fromBlob=function(t){return t=goog.html.SAFE_MIME_TYPE_PATTERN_.test(t.type)?goog.fs.url.createObjectUrl(t):goog.html.SafeUrl.INNOCUOUS_STRING,goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t)},goog.html.DATA_URL_PATTERN_=/^data:([^,]*);base64,[a-z0-9+\/]+=*$/i,goog.html.SafeUrl.fromDataUrl=function(t){var e=(t=t.replace(/(%0A|%0D)/g,"")).match(goog.html.DATA_URL_PATTERN_);return e=e&&goog.html.SAFE_MIME_TYPE_PATTERN_.test(e[1]),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e?t:goog.html.SafeUrl.INNOCUOUS_STRING)},goog.html.SafeUrl.fromTelUrl=function(t){return goog.string.internal.caseInsensitiveStartsWith(t,"tel:")||(t=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t)},goog.html.SIP_URL_PATTERN_=/^sip[s]?:[+a-z0-9_.!$%&'*\/=^`{|}~-]+@([a-z0-9-]+\.)+[a-z0-9]{2,63}$/i,goog.html.SafeUrl.fromSipUrl=function(t){return goog.html.SIP_URL_PATTERN_.test(decodeURIComponent(t))||(t=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t)},goog.html.SafeUrl.fromFacebookMessengerUrl=function(t){return goog.string.internal.caseInsensitiveStartsWith(t,"fb-messenger://share")||(t=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t)},goog.html.SafeUrl.fromWhatsAppUrl=function(t){return goog.string.internal.caseInsensitiveStartsWith(t,"whatsapp://send")||(t=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t)},goog.html.SafeUrl.fromSmsUrl=function(t){return goog.string.internal.caseInsensitiveStartsWith(t,"sms:")&&goog.html.SafeUrl.isSmsUrlBodyValid_(t)||(t=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t)},goog.html.SafeUrl.isSmsUrlBodyValid_=function(t){var e=t.indexOf("#");if(0<e&&(t=t.substring(0,e)),!(e=t.match(/[?&]body=/gi)))return!0;if(1<e.length)return!1;if(!(t=t.match(/[?&]body=([^&]*)/)[1]))return!0;try{decodeURIComponent(t)}catch(t){return!1}return/^(?:[a-z0-9\-_.~]|%[0-9a-f]{2})+$/i.test(t)},goog.html.SafeUrl.fromSshUrl=function(t){return goog.string.internal.caseInsensitiveStartsWith(t,"ssh://")||(t=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t)},goog.html.SafeUrl.sanitizeChromeExtensionUrl=function(t,e){return goog.html.SafeUrl.sanitizeExtensionUrl_(/^chrome-extension:\/\/([^\/]+)\//,t,e)},goog.html.SafeUrl.sanitizeFirefoxExtensionUrl=function(t,e){return goog.html.SafeUrl.sanitizeExtensionUrl_(/^moz-extension:\/\/([^\/]+)\//,t,e)},goog.html.SafeUrl.sanitizeEdgeExtensionUrl=function(t,e){return goog.html.SafeUrl.sanitizeExtensionUrl_(/^ms-browser-extension:\/\/([^\/]+)\//,t,e)},goog.html.SafeUrl.sanitizeExtensionUrl_=function(t,e,r){return(t=t.exec(e))?(t=t[1],-1==(r instanceof goog.string.Const?[goog.string.Const.unwrap(r)]:r.map((function(t){return goog.string.Const.unwrap(t)}))).indexOf(t)&&(e=goog.html.SafeUrl.INNOCUOUS_STRING)):e=goog.html.SafeUrl.INNOCUOUS_STRING,goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.fromTrustedResourceUrl=function(t){return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.html.TrustedResourceUrl.unwrap(t))},goog.html.SAFE_URL_PATTERN_=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i,goog.html.SafeUrl.SAFE_URL_PATTERN=goog.html.SAFE_URL_PATTERN_,goog.html.SafeUrl.sanitize=function(t){return t instanceof goog.html.SafeUrl?t:(t="object"==typeof t&&t.implementsGoogStringTypedString?t.getTypedStringValue():String(t),goog.html.SAFE_URL_PATTERN_.test(t)||(t=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t))},goog.html.SafeUrl.sanitizeAssertUnchanged=function(t,e){return t instanceof goog.html.SafeUrl?t:(t="object"==typeof t&&t.implementsGoogStringTypedString?t.getTypedStringValue():String(t),e&&/^data:/i.test(t)&&(e=goog.html.SafeUrl.fromDataUrl(t)).getTypedStringValue()==t?e:(goog.asserts.assert(goog.html.SAFE_URL_PATTERN_.test(t),"%s does not match the safe URL pattern",t)||(t=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t)))},goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={},goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse=function(t){var e=new goog.html.SafeUrl;return e.privateDoNotAccessOrElseSafeUrlWrappedValue_=goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY?goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createURL(t):t,e},goog.html.SafeUrl.ABOUT_BLANK=goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse("about:blank"),goog.html.SafeStyle=function(){this.privateDoNotAccessOrElseSafeStyleWrappedValue_="",this.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_},goog.html.SafeStyle.prototype.implementsGoogStringTypedString=!0,goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={},goog.html.SafeStyle.fromConstant=function(t){return 0===(t=goog.string.Const.unwrap(t)).length?goog.html.SafeStyle.EMPTY:(goog.asserts.assert(goog.string.internal.endsWith(t,";"),"Last character of style string is not ';': "+t),goog.asserts.assert(goog.string.internal.contains(t,":"),"Style string must contain at least one ':', to specify a \"name: value\" pair: "+t),goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(t))},goog.html.SafeStyle.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeStyleWrappedValue_},goog.DEBUG&&(goog.html.SafeStyle.prototype.toString=function(){return"SafeStyle{"+this.privateDoNotAccessOrElseSafeStyleWrappedValue_+"}"}),goog.html.SafeStyle.unwrap=function(t){return t instanceof goog.html.SafeStyle&&t.constructor===goog.html.SafeStyle&&t.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?t.privateDoNotAccessOrElseSafeStyleWrappedValue_:(goog.asserts.fail("expected object of type SafeStyle, got '"+t+"' of type "+goog.typeOf(t)),"type_error:SafeStyle")},goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse=function(t){return(new goog.html.SafeStyle).initSecurityPrivateDoNotAccessOrElse_(t)},goog.html.SafeStyle.prototype.initSecurityPrivateDoNotAccessOrElse_=function(t){return this.privateDoNotAccessOrElseSafeStyleWrappedValue_=t,this},goog.html.SafeStyle.EMPTY=goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(""),goog.html.SafeStyle.INNOCUOUS_STRING="zClosurez",goog.html.SafeStyle.create=function(t){var e,r="";for(e in t){if(!/^[-_a-zA-Z0-9]+$/.test(e))throw Error("Name allows only [-_a-zA-Z0-9], got: "+e);var n=t[e];null!=n&&(r+=e+":"+(n=goog.isArray(n)?goog.array.map(n,goog.html.SafeStyle.sanitizePropertyValue_).join(" "):goog.html.SafeStyle.sanitizePropertyValue_(n))+";")}return r?goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(r):goog.html.SafeStyle.EMPTY},goog.html.SafeStyle.sanitizePropertyValue_=function(t){if(t instanceof goog.html.SafeUrl)return'url("'+goog.html.SafeUrl.unwrap(t).replace(/</g,"%3c").replace(/[\\"]/g,"\\$&")+'")';if(t=t instanceof goog.string.Const?goog.string.Const.unwrap(t):goog.html.SafeStyle.sanitizePropertyValueString_(String(t)),/[{;}]/.test(t))throw new goog.asserts.AssertionError("Value does not allow [{;}], got: %s.",[t]);return t},goog.html.SafeStyle.sanitizePropertyValueString_=function(t){var e=t.replace(goog.html.SafeStyle.FUNCTIONS_RE_,"$1").replace(goog.html.SafeStyle.FUNCTIONS_RE_,"$1").replace(goog.html.SafeStyle.URL_RE_,"url");return goog.html.SafeStyle.VALUE_RE_.test(e)?goog.html.SafeStyle.COMMENT_RE_.test(t)?(goog.asserts.fail("String value disallows comments, got: "+t),goog.html.SafeStyle.INNOCUOUS_STRING):goog.html.SafeStyle.hasBalancedQuotes_(t)?goog.html.SafeStyle.hasBalancedSquareBrackets_(t)?goog.html.SafeStyle.sanitizeUrl_(t):(goog.asserts.fail("String value requires balanced square brackets and one identifier per pair of brackets, got: "+t),goog.html.SafeStyle.INNOCUOUS_STRING):(goog.asserts.fail("String value requires balanced quotes, got: "+t),goog.html.SafeStyle.INNOCUOUS_STRING):(goog.asserts.fail("String value allows only "+goog.html.SafeStyle.VALUE_ALLOWED_CHARS_+" and simple functions, got: "+t),goog.html.SafeStyle.INNOCUOUS_STRING)},goog.html.SafeStyle.hasBalancedQuotes_=function(t){for(var e=!0,r=!0,n=0;n<t.length;n++){var i=t.charAt(n);"'"==i&&r?e=!e:'"'==i&&e&&(r=!r)}return e&&r},goog.html.SafeStyle.hasBalancedSquareBrackets_=function(t){for(var e=!0,r=/^[-_a-zA-Z0-9]$/,n=0;n<t.length;n++){var i=t.charAt(n);if("]"==i){if(e)return!1;e=!0}else if("["==i){if(!e)return!1;e=!1}else if(!e&&!r.test(i))return!1}return e},goog.html.SafeStyle.VALUE_ALLOWED_CHARS_="[-,.\"'%_!# a-zA-Z0-9\\[\\]]",goog.html.SafeStyle.VALUE_RE_=new RegExp("^"+goog.html.SafeStyle.VALUE_ALLOWED_CHARS_+"+$"),goog.html.SafeStyle.URL_RE_=/\b(url\([ \t\n]*)('[ -&(-\[\]-~]*'|"[ !#-\[\]-~]*"|[!#-&*-\[\]-~]*)([ \t\n]*\))/g,goog.html.SafeStyle.FUNCTIONS_RE_=/\b(hsl|hsla|rgb|rgba|matrix|calc|minmax|fit-content|repeat|(rotate|scale|translate)(X|Y|Z|3d)?)\([-+*/0-9a-z.%\[\], ]+\)/g,goog.html.SafeStyle.COMMENT_RE_=/\/\*/,goog.html.SafeStyle.sanitizeUrl_=function(t){return t.replace(goog.html.SafeStyle.URL_RE_,(function(t,e,r,n){var i="";return r=r.replace(/^(['"])(.*)\1$/,(function(t,e,r){return i=e,r})),t=goog.html.SafeUrl.sanitize(r).getTypedStringValue(),e+i+t+i+n}))},goog.html.SafeStyle.concat=function(t){var e="",r=function(t){goog.isArray(t)?goog.array.forEach(t,r):e+=goog.html.SafeStyle.unwrap(t)};return goog.array.forEach(arguments,r),e?goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(e):goog.html.SafeStyle.EMPTY},goog.html.SafeStyleSheet=function(){this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_="",this.SAFE_STYLE_SHEET_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_},goog.html.SafeStyleSheet.prototype.implementsGoogStringTypedString=!0,goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={},goog.html.SafeStyleSheet.createRule=function(t,e){if(goog.string.internal.contains(t,"<"))throw Error("Selector does not allow '<', got: "+t);var r=t.replace(/('|")((?!\1)[^\r\n\f\\]|\\[\s\S])*\1/g,"");if(!/^[-_a-zA-Z0-9#.:* ,>+~[\]()=^$|]+$/.test(r))throw Error("Selector allows only [-_a-zA-Z0-9#.:* ,>+~[\\]()=^$|] and strings, got: "+t);if(!goog.html.SafeStyleSheet.hasBalancedBrackets_(r))throw Error("() and [] in selector must be balanced, got: "+t);return e instanceof goog.html.SafeStyle||(e=goog.html.SafeStyle.create(e)),t=t+"{"+goog.html.SafeStyle.unwrap(e).replace(/</g,"\\3C ")+"}",goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(t)},goog.html.SafeStyleSheet.hasBalancedBrackets_=function(t){for(var e={"(":")","[":"]"},r=[],n=0;n<t.length;n++){var i=t[n];if(e[i])r.push(e[i]);else if(goog.object.contains(e,i)&&r.pop()!=i)return!1}return 0==r.length},goog.html.SafeStyleSheet.concat=function(t){var e="",r=function(t){goog.isArray(t)?goog.array.forEach(t,r):e+=goog.html.SafeStyleSheet.unwrap(t)};return goog.array.forEach(arguments,r),goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeStyleSheet.fromConstant=function(t){return 0===(t=goog.string.Const.unwrap(t)).length?goog.html.SafeStyleSheet.EMPTY:(goog.asserts.assert(!goog.string.internal.contains(t,"<"),"Forbidden '<' character in style sheet string: "+t),goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(t))},goog.html.SafeStyleSheet.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_},goog.DEBUG&&(goog.html.SafeStyleSheet.prototype.toString=function(){return"SafeStyleSheet{"+this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_+"}"}),goog.html.SafeStyleSheet.unwrap=function(t){return t instanceof goog.html.SafeStyleSheet&&t.constructor===goog.html.SafeStyleSheet&&t.SAFE_STYLE_SHEET_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?t.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_:(goog.asserts.fail("expected object of type SafeStyleSheet, got '"+t+"' of type "+goog.typeOf(t)),"type_error:SafeStyleSheet")},goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse=function(t){return(new goog.html.SafeStyleSheet).initSecurityPrivateDoNotAccessOrElse_(t)},goog.html.SafeStyleSheet.prototype.initSecurityPrivateDoNotAccessOrElse_=function(t){return this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_=t,this},goog.html.SafeStyleSheet.EMPTY=goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(""),goog.labs={},goog.labs.userAgent={},goog.labs.userAgent.util={},goog.labs.userAgent.util.getNativeUserAgentString_=function(){var t=goog.labs.userAgent.util.getNavigator_();return t&&(t=t.userAgent)?t:""},goog.labs.userAgent.util.getNavigator_=function(){return goog.global.navigator},goog.labs.userAgent.util.userAgent_=goog.labs.userAgent.util.getNativeUserAgentString_(),goog.labs.userAgent.util.setUserAgent=function(t){goog.labs.userAgent.util.userAgent_=t||goog.labs.userAgent.util.getNativeUserAgentString_()},goog.labs.userAgent.util.getUserAgent=function(){return goog.labs.userAgent.util.userAgent_},goog.labs.userAgent.util.matchUserAgent=function(t){var e=goog.labs.userAgent.util.getUserAgent();return goog.string.internal.contains(e,t)},goog.labs.userAgent.util.matchUserAgentIgnoreCase=function(t){var e=goog.labs.userAgent.util.getUserAgent();return goog.string.internal.caseInsensitiveContains(e,t)},goog.labs.userAgent.util.extractVersionTuples=function(t){for(var e,r=/(\w[\w ]+)\/([^\s]+)\s*(?:\((.*?)\))?/g,n=[];e=r.exec(t);)n.push([e[1],e[2],e[3]||void 0]);return n},goog.labs.userAgent.browser={},goog.labs.userAgent.browser.matchOpera_=function(){return goog.labs.userAgent.util.matchUserAgent("Opera")},goog.labs.userAgent.browser.matchIE_=function(){return goog.labs.userAgent.util.matchUserAgent("Trident")||goog.labs.userAgent.util.matchUserAgent("MSIE")},goog.labs.userAgent.browser.matchEdgeHtml_=function(){return goog.labs.userAgent.util.matchUserAgent("Edge")},goog.labs.userAgent.browser.matchEdgeChromium_=function(){return goog.labs.userAgent.util.matchUserAgent("Edg/")},goog.labs.userAgent.browser.matchOperaChromium_=function(){return goog.labs.userAgent.util.matchUserAgent("OPR")},goog.labs.userAgent.browser.matchFirefox_=function(){return goog.labs.userAgent.util.matchUserAgent("Firefox")||goog.labs.userAgent.util.matchUserAgent("FxiOS")},goog.labs.userAgent.browser.matchSafari_=function(){return goog.labs.userAgent.util.matchUserAgent("Safari")&&!(goog.labs.userAgent.browser.matchChrome_()||goog.labs.userAgent.browser.matchCoast_()||goog.labs.userAgent.browser.matchOpera_()||goog.labs.userAgent.browser.matchEdgeHtml_()||goog.labs.userAgent.browser.matchEdgeChromium_()||goog.labs.userAgent.browser.matchOperaChromium_()||goog.labs.userAgent.browser.matchFirefox_()||goog.labs.userAgent.browser.isSilk()||goog.labs.userAgent.util.matchUserAgent("Android"))},goog.labs.userAgent.browser.matchCoast_=function(){return goog.labs.userAgent.util.matchUserAgent("Coast")},goog.labs.userAgent.browser.matchIosWebview_=function(){return(goog.labs.userAgent.util.matchUserAgent("iPad")||goog.labs.userAgent.util.matchUserAgent("iPhone"))&&!goog.labs.userAgent.browser.matchSafari_()&&!goog.labs.userAgent.browser.matchChrome_()&&!goog.labs.userAgent.browser.matchCoast_()&&!goog.labs.userAgent.browser.matchFirefox_()&&goog.labs.userAgent.util.matchUserAgent("AppleWebKit")},goog.labs.userAgent.browser.matchChrome_=function(){return(goog.labs.userAgent.util.matchUserAgent("Chrome")||goog.labs.userAgent.util.matchUserAgent("CriOS"))&&!goog.labs.userAgent.browser.matchEdgeHtml_()},goog.labs.userAgent.browser.matchAndroidBrowser_=function(){return goog.labs.userAgent.util.matchUserAgent("Android")&&!(goog.labs.userAgent.browser.isChrome()||goog.labs.userAgent.browser.isFirefox()||goog.labs.userAgent.browser.isOpera()||goog.labs.userAgent.browser.isSilk())},goog.labs.userAgent.browser.isOpera=goog.labs.userAgent.browser.matchOpera_,goog.labs.userAgent.browser.isIE=goog.labs.userAgent.browser.matchIE_,goog.labs.userAgent.browser.isEdge=goog.labs.userAgent.browser.matchEdgeHtml_,goog.labs.userAgent.browser.isEdgeChromium=goog.labs.userAgent.browser.matchEdgeChromium_,goog.labs.userAgent.browser.isOperaChromium=goog.labs.userAgent.browser.matchOperaChromium_,goog.labs.userAgent.browser.isFirefox=goog.labs.userAgent.browser.matchFirefox_,goog.labs.userAgent.browser.isSafari=goog.labs.userAgent.browser.matchSafari_,goog.labs.userAgent.browser.isCoast=goog.labs.userAgent.browser.matchCoast_,goog.labs.userAgent.browser.isIosWebview=goog.labs.userAgent.browser.matchIosWebview_,goog.labs.userAgent.browser.isChrome=goog.labs.userAgent.browser.matchChrome_,goog.labs.userAgent.browser.isAndroidBrowser=goog.labs.userAgent.browser.matchAndroidBrowser_,goog.labs.userAgent.browser.isSilk=function(){return goog.labs.userAgent.util.matchUserAgent("Silk")},goog.labs.userAgent.browser.getVersion=function(){function t(t){return t=goog.array.find(t,n),r[t]||""}var e=goog.labs.userAgent.util.getUserAgent();if(goog.labs.userAgent.browser.isIE())return goog.labs.userAgent.browser.getIEVersion_(e);e=goog.labs.userAgent.util.extractVersionTuples(e);var r={};goog.array.forEach(e,(function(t){r[t[0]]=t[1]}));var n=goog.partial(goog.object.containsKey,r);return goog.labs.userAgent.browser.isOpera()?t(["Version","Opera"]):goog.labs.userAgent.browser.isEdge()?t(["Edge"]):goog.labs.userAgent.browser.isEdgeChromium()?t(["Edg"]):goog.labs.userAgent.browser.isChrome()?t(["Chrome","CriOS"]):(e=e[2])&&e[1]||""},goog.labs.userAgent.browser.isVersionOrHigher=function(t){return 0<=goog.string.internal.compareVersions(goog.labs.userAgent.browser.getVersion(),t)},goog.labs.userAgent.browser.getIEVersion_=function(t){var e=/rv: *([\d\.]*)/.exec(t);if(e&&e[1])return e[1];e="";var r=/MSIE +([\d\.]+)/.exec(t);if(r&&r[1])if(t=/Trident\/(\d.\d)/.exec(t),"7.0"==r[1])if(t&&t[1])switch(t[1]){case"4.0":e="8.0";break;case"5.0":e="9.0";break;case"6.0":e="10.0";break;case"7.0":e="11.0"}else e="7.0";else e=r[1];return e},goog.html.SafeHtml=function(){this.privateDoNotAccessOrElseSafeHtmlWrappedValue_="",this.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_,this.dir_=null},goog.html.SafeHtml.prototype.implementsGoogI18nBidiDirectionalString=!0,goog.html.SafeHtml.prototype.getDirection=function(){return this.dir_},goog.html.SafeHtml.prototype.implementsGoogStringTypedString=!0,goog.html.SafeHtml.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeHtmlWrappedValue_.toString()},goog.DEBUG&&(goog.html.SafeHtml.prototype.toString=function(){return"SafeHtml{"+this.privateDoNotAccessOrElseSafeHtmlWrappedValue_+"}"}),goog.html.SafeHtml.unwrap=function(t){return goog.html.SafeHtml.unwrapTrustedHTML(t).toString()},goog.html.SafeHtml.unwrapTrustedHTML=function(t){return t instanceof goog.html.SafeHtml&&t.constructor===goog.html.SafeHtml&&t.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?t.privateDoNotAccessOrElseSafeHtmlWrappedValue_:(goog.asserts.fail("expected object of type SafeHtml, got '"+t+"' of type "+goog.typeOf(t)),"type_error:SafeHtml")},goog.html.SafeHtml.htmlEscape=function(t){if(t instanceof goog.html.SafeHtml)return t;var e="object"==typeof t,r=null;return e&&t.implementsGoogI18nBidiDirectionalString&&(r=t.getDirection()),t=e&&t.implementsGoogStringTypedString?t.getTypedStringValue():String(t),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.internal.htmlEscape(t),r)},goog.html.SafeHtml.htmlEscapePreservingNewlines=function(t){return t instanceof goog.html.SafeHtml?t:(t=goog.html.SafeHtml.htmlEscape(t),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.internal.newLineToBr(goog.html.SafeHtml.unwrap(t)),t.getDirection()))},goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces=function(t){return t instanceof goog.html.SafeHtml?t:(t=goog.html.SafeHtml.htmlEscape(t),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.internal.whitespaceEscape(goog.html.SafeHtml.unwrap(t)),t.getDirection()))},goog.html.SafeHtml.from=goog.html.SafeHtml.htmlEscape,goog.html.SafeHtml.VALID_NAMES_IN_TAG_=/^[a-zA-Z0-9-]+$/,goog.html.SafeHtml.URL_ATTRIBUTES_={action:!0,cite:!0,data:!0,formaction:!0,href:!0,manifest:!0,poster:!0,src:!0},goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_={APPLET:!0,BASE:!0,EMBED:!0,IFRAME:!0,LINK:!0,MATH:!0,META:!0,OBJECT:!0,SCRIPT:!0,STYLE:!0,SVG:!0,TEMPLATE:!0},goog.html.SafeHtml.create=function(t,e,r){return goog.html.SafeHtml.verifyTagName(String(t)),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(String(t),e,r)},goog.html.SafeHtml.verifyTagName=function(t){if(!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(t))throw Error("Invalid tag name <"+t+">.");if(t.toUpperCase()in goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_)throw Error("Tag name <"+t+"> is not allowed for SafeHtml.")},goog.html.SafeHtml.createIframe=function(t,e,r,n){t&&goog.html.TrustedResourceUrl.unwrap(t);var i={};return i.src=t||null,i.srcdoc=e&&goog.html.SafeHtml.unwrap(e),t=goog.html.SafeHtml.combineAttributes(i,{sandbox:""},r),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",t,n)},goog.html.SafeHtml.createSandboxIframe=function(t,e,r,n){if(!goog.html.SafeHtml.canUseSandboxIframe())throw Error("The browser does not support sandboxed iframes.");var i={};return i.src=t?goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(t)):null,i.srcdoc=e||null,i.sandbox="",t=goog.html.SafeHtml.combineAttributes(i,{},r),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",t,n)},goog.html.SafeHtml.canUseSandboxIframe=function(){return goog.global.HTMLIFrameElement&&"sandbox"in goog.global.HTMLIFrameElement.prototype},goog.html.SafeHtml.createScriptSrc=function(t,e){return goog.html.TrustedResourceUrl.unwrap(t),t=goog.html.SafeHtml.combineAttributes({src:t},{},e),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script",t)},goog.html.SafeHtml.createScript=function(t,e){for(var r in e){var n=r.toLowerCase();if("language"==n||"src"==n||"text"==n||"type"==n)throw Error('Cannot set "'+n+'" attribute')}for(r="",t=goog.array.concat(t),n=0;n<t.length;n++)r+=goog.html.SafeScript.unwrap(t[n]);return t=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(r,goog.i18n.bidi.Dir.NEUTRAL),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script",e,t)},goog.html.SafeHtml.createStyle=function(t,e){e=goog.html.SafeHtml.combineAttributes({type:"text/css"},{},e);var r="";t=goog.array.concat(t);for(var n=0;n<t.length;n++)r+=goog.html.SafeStyleSheet.unwrap(t[n]);return t=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(r,goog.i18n.bidi.Dir.NEUTRAL),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("style",e,t)},goog.html.SafeHtml.createMetaRefresh=function(t,e){return t=goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(t)),(goog.labs.userAgent.browser.isIE()||goog.labs.userAgent.browser.isEdge())&&goog.string.internal.contains(t,";")&&(t="'"+t.replace(/'/g,"%27")+"'"),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("meta",{"http-equiv":"refresh",content:(e||0)+"; url="+t})},goog.html.SafeHtml.getAttrNameAndValue_=function(t,e,r){if(r instanceof goog.string.Const)r=goog.string.Const.unwrap(r);else if("style"==e.toLowerCase())r=goog.html.SafeHtml.getStyleValue_(r);else{if(/^on/i.test(e))throw Error('Attribute "'+e+'" requires goog.string.Const value, "'+r+'" given.');if(e.toLowerCase()in goog.html.SafeHtml.URL_ATTRIBUTES_)if(r instanceof goog.html.TrustedResourceUrl)r=goog.html.TrustedResourceUrl.unwrap(r);else if(r instanceof goog.html.SafeUrl)r=goog.html.SafeUrl.unwrap(r);else{if(!goog.isString(r))throw Error('Attribute "'+e+'" on tag "'+t+'" requires goog.html.SafeUrl, goog.string.Const, or string, value "'+r+'" given.');r=goog.html.SafeUrl.sanitize(r).getTypedStringValue()}}return r.implementsGoogStringTypedString&&(r=r.getTypedStringValue()),goog.asserts.assert(goog.isString(r)||goog.isNumber(r),"String or number value expected, got "+typeof r+" with value: "+r),e+'="'+goog.string.internal.htmlEscape(String(r))+'"'},goog.html.SafeHtml.getStyleValue_=function(t){if(!goog.isObject(t))throw Error('The "style" attribute requires goog.html.SafeStyle or map of style properties, '+typeof t+" given: "+t);return t instanceof goog.html.SafeStyle||(t=goog.html.SafeStyle.create(t)),goog.html.SafeStyle.unwrap(t)},goog.html.SafeHtml.createWithDir=function(t,e,r,n){return(e=goog.html.SafeHtml.create(e,r,n)).dir_=t,e},goog.html.SafeHtml.join=function(t,e){var r=(t=goog.html.SafeHtml.htmlEscape(t)).getDirection(),n=[],i=function(t){goog.isArray(t)?goog.array.forEach(t,i):(t=goog.html.SafeHtml.htmlEscape(t),n.push(goog.html.SafeHtml.unwrap(t)),t=t.getDirection(),r==goog.i18n.bidi.Dir.NEUTRAL?r=t:t!=goog.i18n.bidi.Dir.NEUTRAL&&r!=t&&(r=null))};return goog.array.forEach(e,i),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(n.join(goog.html.SafeHtml.unwrap(t)),r)},goog.html.SafeHtml.concat=function(t){return goog.html.SafeHtml.join(goog.html.SafeHtml.EMPTY,Array.prototype.slice.call(arguments))},goog.html.SafeHtml.concatWithDir=function(t,e){var r=goog.html.SafeHtml.concat(goog.array.slice(arguments,1));return r.dir_=t,r},goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={},goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse=function(t,e){return(new goog.html.SafeHtml).initSecurityPrivateDoNotAccessOrElse_(t,e)},goog.html.SafeHtml.prototype.initSecurityPrivateDoNotAccessOrElse_=function(t,e){return this.privateDoNotAccessOrElseSafeHtmlWrappedValue_=goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY?goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createHTML(t):t,this.dir_=e,this},goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse=function(t,e,r){var n=null,i="<"+t+goog.html.SafeHtml.stringifyAttributes(t,e);return goog.isDefAndNotNull(r)?goog.isArray(r)||(r=[r]):r=[],goog.dom.tags.isVoidTag(t.toLowerCase())?(goog.asserts.assert(!r.length,"Void tag <"+t+"> does not allow content."),i+=">"):(n=goog.html.SafeHtml.concat(r),i+=">"+goog.html.SafeHtml.unwrap(n)+"</"+t+">",n=n.getDirection()),(t=e&&e.dir)&&(n=/^(ltr|rtl|auto)$/i.test(t)?goog.i18n.bidi.Dir.NEUTRAL:null),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(i,n)},goog.html.SafeHtml.stringifyAttributes=function(t,e){var r="";if(e)for(var n in e){if(!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(n))throw Error('Invalid attribute name "'+n+'".');var i=e[n];goog.isDefAndNotNull(i)&&(r+=" "+goog.html.SafeHtml.getAttrNameAndValue_(t,n,i))}return r},goog.html.SafeHtml.combineAttributes=function(t,e,r){var n,i={};for(n in t)goog.asserts.assert(n.toLowerCase()==n,"Must be lower case"),i[n]=t[n];for(n in e)goog.asserts.assert(n.toLowerCase()==n,"Must be lower case"),i[n]=e[n];for(n in r){var o=n.toLowerCase();if(o in t)throw Error('Cannot override "'+o+'" attribute, got "'+n+'" with value "'+r[n]+'"');o in e&&delete i[o],i[n]=r[n]}return i},goog.html.SafeHtml.DOCTYPE_HTML=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("<!DOCTYPE html>",goog.i18n.bidi.Dir.NEUTRAL),goog.html.SafeHtml.EMPTY=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("",goog.i18n.bidi.Dir.NEUTRAL),goog.html.SafeHtml.BR=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("<br>",goog.i18n.bidi.Dir.NEUTRAL),goog.html.uncheckedconversions={},goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract=function(t,e,r){return goog.asserts.assertString(goog.string.Const.unwrap(t),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(t)),"must provide non-empty justification"),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(e,r||null)},goog.html.uncheckedconversions.safeScriptFromStringKnownToSatisfyTypeContract=function(t,e){return goog.asserts.assertString(goog.string.Const.unwrap(t),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(t)),"must provide non-empty justification"),goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(e)},goog.html.uncheckedconversions.safeStyleFromStringKnownToSatisfyTypeContract=function(t,e){return goog.asserts.assertString(goog.string.Const.unwrap(t),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(t)),"must provide non-empty justification"),goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(e)},goog.html.uncheckedconversions.safeStyleSheetFromStringKnownToSatisfyTypeContract=function(t,e){return goog.asserts.assertString(goog.string.Const.unwrap(t),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(t)),"must provide non-empty justification"),goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(e)},goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract=function(t,e){return goog.asserts.assertString(goog.string.Const.unwrap(t),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(t)),"must provide non-empty justification"),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.uncheckedconversions.trustedResourceUrlFromStringKnownToSatisfyTypeContract=function(t,e){return goog.asserts.assertString(goog.string.Const.unwrap(t),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(t)),"must provide non-empty justification"),goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(e)},goog.dom.safe={},goog.dom.safe.InsertAdjacentHtmlPosition={AFTERBEGIN:"afterbegin",AFTEREND:"afterend",BEFOREBEGIN:"beforebegin",BEFOREEND:"beforeend"},goog.dom.safe.insertAdjacentHtml=function(t,e,r){t.insertAdjacentHTML(e,goog.html.SafeHtml.unwrapTrustedHTML(r))},goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_={MATH:!0,SCRIPT:!0,STYLE:!0,SVG:!0,TEMPLATE:!0},goog.dom.safe.isInnerHtmlCleanupRecursive_=goog.functions.cacheReturnValue((function(){if(goog.DEBUG&&"undefined"==typeof document)return!1;var t=document.createElement("div"),e=document.createElement("div");return e.appendChild(document.createElement("div")),t.appendChild(e),!(goog.DEBUG&&!t.firstChild)&&(e=t.firstChild.firstChild,t.innerHTML=goog.html.SafeHtml.unwrapTrustedHTML(goog.html.SafeHtml.EMPTY),!e.parentElement)})),goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse=function(t,e){if(goog.dom.safe.isInnerHtmlCleanupRecursive_())for(;t.lastChild;)t.removeChild(t.lastChild);t.innerHTML=goog.html.SafeHtml.unwrapTrustedHTML(e)},goog.dom.safe.setInnerHtml=function(t,e){if(goog.asserts.ENABLE_ASSERTS){var r=t.tagName.toUpperCase();if(goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_[r])throw Error("goog.dom.safe.setInnerHtml cannot be used to set content of "+t.tagName+".")}goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse(t,e)},goog.dom.safe.setOuterHtml=function(t,e){t.outerHTML=goog.html.SafeHtml.unwrapTrustedHTML(e)},goog.dom.safe.setFormElementAction=function(t,e){e=e instanceof goog.html.SafeUrl?e:goog.html.SafeUrl.sanitizeAssertUnchanged(e),goog.dom.asserts.assertIsHTMLFormElement(t).action=goog.html.SafeUrl.unwrapTrustedURL(e)},goog.dom.safe.setButtonFormAction=function(t,e){e=e instanceof goog.html.SafeUrl?e:goog.html.SafeUrl.sanitizeAssertUnchanged(e),goog.dom.asserts.assertIsHTMLButtonElement(t).formAction=goog.html.SafeUrl.unwrapTrustedURL(e)},goog.dom.safe.setInputFormAction=function(t,e){e=e instanceof goog.html.SafeUrl?e:goog.html.SafeUrl.sanitizeAssertUnchanged(e),goog.dom.asserts.assertIsHTMLInputElement(t).formAction=goog.html.SafeUrl.unwrapTrustedURL(e)},goog.dom.safe.setStyle=function(t,e){t.style.cssText=goog.html.SafeStyle.unwrap(e)},goog.dom.safe.documentWrite=function(t,e){t.write(goog.html.SafeHtml.unwrapTrustedHTML(e))},goog.dom.safe.setAnchorHref=function(t,e){goog.dom.asserts.assertIsHTMLAnchorElement(t),e=e instanceof goog.html.SafeUrl?e:goog.html.SafeUrl.sanitizeAssertUnchanged(e),t.href=goog.html.SafeUrl.unwrapTrustedURL(e)},goog.dom.safe.setImageSrc=function(t,e){if(goog.dom.asserts.assertIsHTMLImageElement(t),!(e instanceof goog.html.SafeUrl)){var r=/^data:image\//i.test(e);e=goog.html.SafeUrl.sanitizeAssertUnchanged(e,r)}t.src=goog.html.SafeUrl.unwrapTrustedURL(e)},goog.dom.safe.setAudioSrc=function(t,e){if(goog.dom.asserts.assertIsHTMLAudioElement(t),!(e instanceof goog.html.SafeUrl)){var r=/^data:audio\//i.test(e);e=goog.html.SafeUrl.sanitizeAssertUnchanged(e,r)}t.src=goog.html.SafeUrl.unwrapTrustedURL(e)},goog.dom.safe.setVideoSrc=function(t,e){if(goog.dom.asserts.assertIsHTMLVideoElement(t),!(e instanceof goog.html.SafeUrl)){var r=/^data:video\//i.test(e);e=goog.html.SafeUrl.sanitizeAssertUnchanged(e,r)}t.src=goog.html.SafeUrl.unwrapTrustedURL(e)},goog.dom.safe.setEmbedSrc=function(t,e){goog.dom.asserts.assertIsHTMLEmbedElement(t),t.src=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(e)},goog.dom.safe.setFrameSrc=function(t,e){goog.dom.asserts.assertIsHTMLFrameElement(t),t.src=goog.html.TrustedResourceUrl.unwrapTrustedURL(e)},goog.dom.safe.setIframeSrc=function(t,e){goog.dom.asserts.assertIsHTMLIFrameElement(t),t.src=goog.html.TrustedResourceUrl.unwrapTrustedURL(e)},goog.dom.safe.setIframeSrcdoc=function(t,e){goog.dom.asserts.assertIsHTMLIFrameElement(t),t.srcdoc=goog.html.SafeHtml.unwrapTrustedHTML(e)},goog.dom.safe.setLinkHrefAndRel=function(t,e,r){goog.dom.asserts.assertIsHTMLLinkElement(t),t.rel=r,goog.string.internal.caseInsensitiveContains(r,"stylesheet")?(goog.asserts.assert(e instanceof goog.html.TrustedResourceUrl,'URL must be TrustedResourceUrl because "rel" contains "stylesheet"'),t.href=goog.html.TrustedResourceUrl.unwrapTrustedURL(e)):t.href=e instanceof goog.html.TrustedResourceUrl?goog.html.TrustedResourceUrl.unwrapTrustedURL(e):e instanceof goog.html.SafeUrl?goog.html.SafeUrl.unwrapTrustedURL(e):goog.html.SafeUrl.unwrapTrustedURL(goog.html.SafeUrl.sanitizeAssertUnchanged(e))},goog.dom.safe.setObjectData=function(t,e){goog.dom.asserts.assertIsHTMLObjectElement(t),t.data=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(e)},goog.dom.safe.setScriptSrc=function(t,e){goog.dom.asserts.assertIsHTMLScriptElement(t),t.src=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(e),(e=goog.getScriptNonce())&&t.setAttribute("nonce",e)},goog.dom.safe.setScriptContent=function(t,e){goog.dom.asserts.assertIsHTMLScriptElement(t),t.text=goog.html.SafeScript.unwrapTrustedScript(e),(e=goog.getScriptNonce())&&t.setAttribute("nonce",e)},goog.dom.safe.setLocationHref=function(t,e){goog.dom.asserts.assertIsLocation(t),e=e instanceof goog.html.SafeUrl?e:goog.html.SafeUrl.sanitizeAssertUnchanged(e),t.href=goog.html.SafeUrl.unwrapTrustedURL(e)},goog.dom.safe.assignLocation=function(t,e){goog.dom.asserts.assertIsLocation(t),e=e instanceof goog.html.SafeUrl?e:goog.html.SafeUrl.sanitizeAssertUnchanged(e),t.assign(goog.html.SafeUrl.unwrapTrustedURL(e))},goog.dom.safe.replaceLocation=function(t,e){goog.dom.asserts.assertIsLocation(t),e=e instanceof goog.html.SafeUrl?e:goog.html.SafeUrl.sanitizeAssertUnchanged(e),t.replace(goog.html.SafeUrl.unwrapTrustedURL(e))},goog.dom.safe.openInWindow=function(t,e,r,n,i){return t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),(e||goog.global).open(goog.html.SafeUrl.unwrapTrustedURL(t),r?goog.string.Const.unwrap(r):"",n,i)},goog.dom.safe.parseFromStringHtml=function(t,e){return goog.dom.safe.parseFromString(t,e,"text/html")},goog.dom.safe.parseFromString=function(t,e,r){return t.parseFromString(goog.html.SafeHtml.unwrapTrustedHTML(e),r)},goog.dom.safe.createImageFromBlob=function(t){if(!/^image\/.*/g.test(t.type))throw Error("goog.dom.safe.createImageFromBlob only accepts MIME type image/.*.");var e=goog.global.URL.createObjectURL(t);return(t=new goog.global.Image).onload=function(){goog.global.URL.revokeObjectURL(e)},goog.dom.safe.setImageSrc(t,goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Image blob URL."),e)),t},goog.string.DETECT_DOUBLE_ESCAPING=!1,goog.string.FORCE_NON_DOM_HTML_UNESCAPING=!1,goog.string.Unicode={NBSP:" "},goog.string.startsWith=goog.string.internal.startsWith,goog.string.endsWith=goog.string.internal.endsWith,goog.string.caseInsensitiveStartsWith=goog.string.internal.caseInsensitiveStartsWith,goog.string.caseInsensitiveEndsWith=goog.string.internal.caseInsensitiveEndsWith,goog.string.caseInsensitiveEquals=goog.string.internal.caseInsensitiveEquals,goog.string.subs=function(t,e){for(var r=t.split("%s"),n="",i=Array.prototype.slice.call(arguments,1);i.length&&1<r.length;)n+=r.shift()+i.shift();return n+r.join("%s")},goog.string.collapseWhitespace=function(t){return t.replace(/[\s\xa0]+/g," ").replace(/^\s+|\s+$/g,"")},goog.string.isEmptyOrWhitespace=goog.string.internal.isEmptyOrWhitespace,goog.string.isEmptyString=function(t){return 0==t.length},goog.string.isEmpty=goog.string.isEmptyOrWhitespace,goog.string.isEmptyOrWhitespaceSafe=function(t){return goog.string.isEmptyOrWhitespace(goog.string.makeSafe(t))},goog.string.isEmptySafe=goog.string.isEmptyOrWhitespaceSafe,goog.string.isBreakingWhitespace=function(t){return!/[^\t\n\r ]/.test(t)},goog.string.isAlpha=function(t){return!/[^a-zA-Z]/.test(t)},goog.string.isNumeric=function(t){return!/[^0-9]/.test(t)},goog.string.isAlphaNumeric=function(t){return!/[^a-zA-Z0-9]/.test(t)},goog.string.isSpace=function(t){return" "==t},goog.string.isUnicodeChar=function(t){return 1==t.length&&" "<=t&&"~">=t||""<=t&&"�">=t},goog.string.stripNewlines=function(t){return t.replace(/(\r\n|\r|\n)+/g," ")},goog.string.canonicalizeNewlines=function(t){return t.replace(/(\r\n|\r|\n)/g,"\n")},goog.string.normalizeWhitespace=function(t){return t.replace(/\xa0|\s/g," ")},goog.string.normalizeSpaces=function(t){return t.replace(/\xa0|[ \t]+/g," ")},goog.string.collapseBreakingSpaces=function(t){return t.replace(/[\t\r\n ]+/g," ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g,"")},goog.string.trim=goog.string.internal.trim,goog.string.trimLeft=function(t){return t.replace(/^[\s\xa0]+/,"")},goog.string.trimRight=function(t){return t.replace(/[\s\xa0]+$/,"")},goog.string.caseInsensitiveCompare=goog.string.internal.caseInsensitiveCompare,goog.string.numberAwareCompare_=function(t,e,r){if(t==e)return 0;if(!t)return-1;if(!e)return 1;for(var n=t.toLowerCase().match(r),i=e.toLowerCase().match(r),o=Math.min(n.length,i.length),a=0;a<o;a++){r=n[a];var s=i[a];if(r!=s)return t=parseInt(r,10),!isNaN(t)&&(e=parseInt(s,10),!isNaN(e)&&t-e)?t-e:r<s?-1:1}return n.length!=i.length?n.length-i.length:t<e?-1:1},goog.string.intAwareCompare=function(t,e){return goog.string.numberAwareCompare_(t,e,/\d+|\D+/g)},goog.string.floatAwareCompare=function(t,e){return goog.string.numberAwareCompare_(t,e,/\d+|\.\d+|\D+/g)},goog.string.numerateCompare=goog.string.floatAwareCompare,goog.string.urlEncode=function(t){return encodeURIComponent(String(t))},goog.string.urlDecode=function(t){return decodeURIComponent(t.replace(/\+/g," "))},goog.string.newLineToBr=goog.string.internal.newLineToBr,goog.string.htmlEscape=function(t,e){return t=goog.string.internal.htmlEscape(t,e),goog.string.DETECT_DOUBLE_ESCAPING&&(t=t.replace(goog.string.E_RE_,"e")),t},goog.string.E_RE_=/e/g,goog.string.unescapeEntities=function(t){return goog.string.contains(t,"&")?!goog.string.FORCE_NON_DOM_HTML_UNESCAPING&&"document"in goog.global?goog.string.unescapeEntitiesUsingDom_(t):goog.string.unescapePureXmlEntities_(t):t},goog.string.unescapeEntitiesWithDocument=function(t,e){return goog.string.contains(t,"&")?goog.string.unescapeEntitiesUsingDom_(t,e):t},goog.string.unescapeEntitiesUsingDom_=function(t,e){var r={"&":"&","<":"<",">":">",""":'"'},n=e?e.createElement("div"):goog.global.document.createElement("div");return t.replace(goog.string.HTML_ENTITY_PATTERN_,(function(t,e){var i=r[t];return i||("#"==e.charAt(0)&&(e=Number("0"+e.substr(1)),isNaN(e)||(i=String.fromCharCode(e))),i||(goog.dom.safe.setInnerHtml(n,goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Single HTML entity."),t+" ")),i=n.firstChild.nodeValue.slice(0,-1)),r[t]=i)}))},goog.string.unescapePureXmlEntities_=function(t){return t.replace(/&([^;]+);/g,(function(t,e){switch(e){case"amp":return"&";case"lt":return"<";case"gt":return">";case"quot":return'"';default:return"#"!=e.charAt(0)||(e=Number("0"+e.substr(1)),isNaN(e))?t:String.fromCharCode(e)}}))},goog.string.HTML_ENTITY_PATTERN_=/&([^;\s<&]+);?/g,goog.string.whitespaceEscape=function(t,e){return goog.string.newLineToBr(t.replace(/ /g,"  "),e)},goog.string.preserveSpaces=function(t){return t.replace(/(^|[\n ]) /g,"$1"+goog.string.Unicode.NBSP)},goog.string.stripQuotes=function(t,e){for(var r=e.length,n=0;n<r;n++){var i=1==r?e:e.charAt(n);if(t.charAt(0)==i&&t.charAt(t.length-1)==i)return t.substring(1,t.length-1)}return t},goog.string.truncate=function(t,e,r){return r&&(t=goog.string.unescapeEntities(t)),t.length>e&&(t=t.substring(0,e-3)+"..."),r&&(t=goog.string.htmlEscape(t)),t},goog.string.truncateMiddle=function(t,e,r,n){if(r&&(t=goog.string.unescapeEntities(t)),n&&t.length>e){n>e&&(n=e);var i=t.length-n;t=t.substring(0,e-n)+"..."+t.substring(i)}else t.length>e&&(n=Math.floor(e/2),i=t.length-n,t=t.substring(0,n+e%2)+"..."+t.substring(i));return r&&(t=goog.string.htmlEscape(t)),t},goog.string.specialEscapeChars_={"\0":"\\0","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\x0B",'"':'\\"',"\\":"\\\\","<":"\\u003C"},goog.string.jsEscapeCache_={"'":"\\'"},goog.string.quote=function(t){t=String(t);for(var e=['"'],r=0;r<t.length;r++){var n=t.charAt(r),i=n.charCodeAt(0);e[r+1]=goog.string.specialEscapeChars_[n]||(31<i&&127>i?n:goog.string.escapeChar(n))}return e.push('"'),e.join("")},goog.string.escapeString=function(t){for(var e=[],r=0;r<t.length;r++)e[r]=goog.string.escapeChar(t.charAt(r));return e.join("")},goog.string.escapeChar=function(t){if(t in goog.string.jsEscapeCache_)return goog.string.jsEscapeCache_[t];if(t in goog.string.specialEscapeChars_)return goog.string.jsEscapeCache_[t]=goog.string.specialEscapeChars_[t];var e=t.charCodeAt(0);if(31<e&&127>e)var r=t;else 256>e?(r="\\x",(16>e||256<e)&&(r+="0")):(r="\\u",4096>e&&(r+="0")),r+=e.toString(16).toUpperCase();return goog.string.jsEscapeCache_[t]=r},goog.string.contains=goog.string.internal.contains,goog.string.caseInsensitiveContains=goog.string.internal.caseInsensitiveContains,goog.string.countOf=function(t,e){return t&&e?t.split(e).length-1:0},goog.string.removeAt=function(t,e,r){var n=t;return 0<=e&&e<t.length&&0<r&&(n=t.substr(0,e)+t.substr(e+r,t.length-e-r)),n},goog.string.remove=function(t,e){return t.replace(e,"")},goog.string.removeAll=function(t,e){return e=new RegExp(goog.string.regExpEscape(e),"g"),t.replace(e,"")},goog.string.replaceAll=function(t,e,r){return e=new RegExp(goog.string.regExpEscape(e),"g"),t.replace(e,r.replace(/\$/g,"$$$$"))},goog.string.regExpEscape=function(t){return String(t).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08")},goog.string.repeat=String.prototype.repeat?function(t,e){return t.repeat(e)}:function(t,e){return Array(e+1).join(t)},goog.string.padNumber=function(t,e,r){return-1==(r=(t=goog.isDef(r)?t.toFixed(r):String(t)).indexOf("."))&&(r=t.length),goog.string.repeat("0",Math.max(0,e-r))+t},goog.string.makeSafe=function(t){return null==t?"":String(t)},goog.string.buildString=function(t){return Array.prototype.join.call(arguments,"")},goog.string.getRandomString=function(){return Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^goog.now()).toString(36)},goog.string.compareVersions=goog.string.internal.compareVersions,goog.string.hashCode=function(t){for(var e=0,r=0;r<t.length;++r)e=31*e+t.charCodeAt(r)>>>0;return e},goog.string.uniqueStringCounter_=2147483648*Math.random()|0,goog.string.createUniqueString=function(){return"goog_"+goog.string.uniqueStringCounter_++},goog.string.toNumber=function(t){var e=Number(t);return 0==e&&goog.string.isEmptyOrWhitespace(t)?NaN:e},goog.string.isLowerCamelCase=function(t){return/^[a-z]+([A-Z][a-z]*)*$/.test(t)},goog.string.isUpperCamelCase=function(t){return/^([A-Z][a-z]*)+$/.test(t)},goog.string.toCamelCase=function(t){return String(t).replace(/\-([a-z])/g,(function(t,e){return e.toUpperCase()}))},goog.string.toSelectorCase=function(t){return String(t).replace(/([A-Z])/g,"-$1").toLowerCase()},goog.string.toTitleCase=function(t,e){return e=goog.isString(e)?goog.string.regExpEscape(e):"\\s",t.replace(new RegExp("(^"+(e?"|["+e+"]+":"")+")([a-z])","g"),(function(t,e,r){return e+r.toUpperCase()}))},goog.string.capitalize=function(t){return String(t.charAt(0)).toUpperCase()+String(t.substr(1)).toLowerCase()},goog.string.parseInt=function(t){return isFinite(t)&&(t=String(t)),goog.isString(t)?/^\s*-?0x/i.test(t)?parseInt(t,16):parseInt(t,10):NaN},goog.string.splitLimit=function(t,e,r){t=t.split(e);for(var n=[];0<r&&t.length;)n.push(t.shift()),r--;return t.length&&n.push(t.join(e)),n},goog.string.lastComponent=function(t,e){if(!e)return t;"string"==typeof e&&(e=[e]);for(var r=-1,n=0;n<e.length;n++)if(""!=e[n]){var i=t.lastIndexOf(e[n]);i>r&&(r=i)}return-1==r?t:t.slice(r+1)},goog.string.editDistance=function(t,e){var r=[],n=[];if(t==e)return 0;if(!t.length||!e.length)return Math.max(t.length,e.length);for(var i=0;i<e.length+1;i++)r[i]=i;for(i=0;i<t.length;i++){n[0]=i+1;for(var o=0;o<e.length;o++)n[o+1]=Math.min(n[o]+1,r[o+1]+1,r[o]+Number(t[i]!=e[o]));for(o=0;o<r.length;o++)r[o]=n[o]}return n[e.length]},goog.labs.userAgent.engine={},goog.labs.userAgent.engine.isPresto=function(){return goog.labs.userAgent.util.matchUserAgent("Presto")},goog.labs.userAgent.engine.isTrident=function(){return goog.labs.userAgent.util.matchUserAgent("Trident")||goog.labs.userAgent.util.matchUserAgent("MSIE")},goog.labs.userAgent.engine.isEdge=function(){return goog.labs.userAgent.util.matchUserAgent("Edge")},goog.labs.userAgent.engine.isWebKit=function(){return goog.labs.userAgent.util.matchUserAgentIgnoreCase("WebKit")&&!goog.labs.userAgent.engine.isEdge()},goog.labs.userAgent.engine.isGecko=function(){return goog.labs.userAgent.util.matchUserAgent("Gecko")&&!goog.labs.userAgent.engine.isWebKit()&&!goog.labs.userAgent.engine.isTrident()&&!goog.labs.userAgent.engine.isEdge()},goog.labs.userAgent.engine.getVersion=function(){var t=goog.labs.userAgent.util.getUserAgent();if(t){t=goog.labs.userAgent.util.extractVersionTuples(t);var e,r=goog.labs.userAgent.engine.getEngineTuple_(t);if(r)return"Gecko"==r[0]?goog.labs.userAgent.engine.getVersionForKey_(t,"Firefox"):r[1];if((t=t[0])&&(e=t[2])&&(e=/Trident\/([^\s;]+)/.exec(e)))return e[1]}return""},goog.labs.userAgent.engine.getEngineTuple_=function(t){if(!goog.labs.userAgent.engine.isEdge())return t[1];for(var e=0;e<t.length;e++){var r=t[e];if("Edge"==r[0])return r}},goog.labs.userAgent.engine.isVersionOrHigher=function(t){return 0<=goog.string.compareVersions(goog.labs.userAgent.engine.getVersion(),t)},goog.labs.userAgent.engine.getVersionForKey_=function(t,e){return(t=goog.array.find(t,(function(t){return e==t[0]})))&&t[1]||""},goog.labs.userAgent.platform={},goog.labs.userAgent.platform.isAndroid=function(){return goog.labs.userAgent.util.matchUserAgent("Android")},goog.labs.userAgent.platform.isIpod=function(){return goog.labs.userAgent.util.matchUserAgent("iPod")},goog.labs.userAgent.platform.isIphone=function(){return goog.labs.userAgent.util.matchUserAgent("iPhone")&&!goog.labs.userAgent.util.matchUserAgent("iPod")&&!goog.labs.userAgent.util.matchUserAgent("iPad")},goog.labs.userAgent.platform.isIpad=function(){return goog.labs.userAgent.util.matchUserAgent("iPad")},goog.labs.userAgent.platform.isIos=function(){return goog.labs.userAgent.platform.isIphone()||goog.labs.userAgent.platform.isIpad()||goog.labs.userAgent.platform.isIpod()},goog.labs.userAgent.platform.isMacintosh=function(){return goog.labs.userAgent.util.matchUserAgent("Macintosh")},goog.labs.userAgent.platform.isLinux=function(){return goog.labs.userAgent.util.matchUserAgent("Linux")},goog.labs.userAgent.platform.isWindows=function(){return goog.labs.userAgent.util.matchUserAgent("Windows")},goog.labs.userAgent.platform.isChromeOS=function(){return goog.labs.userAgent.util.matchUserAgent("CrOS")},goog.labs.userAgent.platform.isChromecast=function(){return goog.labs.userAgent.util.matchUserAgent("CrKey")},goog.labs.userAgent.platform.isKaiOS=function(){return goog.labs.userAgent.util.matchUserAgentIgnoreCase("KaiOS")},goog.labs.userAgent.platform.isGo2Phone=function(){return goog.labs.userAgent.util.matchUserAgentIgnoreCase("GAFP")},goog.labs.userAgent.platform.getVersion=function(){var t=goog.labs.userAgent.util.getUserAgent(),e="";return goog.labs.userAgent.platform.isWindows()?e=(t=(e=/Windows (?:NT|Phone) ([0-9.]+)/).exec(t))?t[1]:"0.0":goog.labs.userAgent.platform.isIos()?e=(t=(e=/(?:iPhone|iPod|iPad|CPU)\s+OS\s+(\S+)/).exec(t))&&t[1].replace(/_/g,"."):goog.labs.userAgent.platform.isMacintosh()?e=(t=(e=/Mac OS X ([0-9_.]+)/).exec(t))?t[1].replace(/_/g,"."):"10":goog.labs.userAgent.platform.isKaiOS()?e=(t=(e=/(?:KaiOS)\/(\S+)/i).exec(t))&&t[1]:goog.labs.userAgent.platform.isAndroid()?e=(t=(e=/Android\s+([^\);]+)(\)|;)/).exec(t))&&t[1]:goog.labs.userAgent.platform.isChromeOS()&&(e=(t=(e=/(?:CrOS\s+(?:i686|x86_64)\s+([0-9.]+))/).exec(t))&&t[1]),e||""},goog.labs.userAgent.platform.isVersionOrHigher=function(t){return 0<=goog.string.compareVersions(goog.labs.userAgent.platform.getVersion(),t)},goog.reflect={},goog.reflect.object=function(t,e){return e},goog.reflect.objectProperty=function(t,e){return t},goog.reflect.sinkValue=function(t){return goog.reflect.sinkValue[" "](t),t},goog.reflect.sinkValue[" "]=goog.nullFunction,goog.reflect.canAccessProperty=function(t,e){try{return goog.reflect.sinkValue(t[e]),!0}catch(t){}return!1},goog.reflect.cache=function(t,e,r,n){return n=n?n(e):e,Object.prototype.hasOwnProperty.call(t,n)?t[n]:t[n]=r(e)},goog.userAgent={},goog.userAgent.ASSUME_IE=!1,goog.userAgent.ASSUME_EDGE=!1,goog.userAgent.ASSUME_GECKO=!1,goog.userAgent.ASSUME_WEBKIT=!1,goog.userAgent.ASSUME_MOBILE_WEBKIT=!1,goog.userAgent.ASSUME_OPERA=!1,goog.userAgent.ASSUME_ANY_VERSION=!1,goog.userAgent.BROWSER_KNOWN_=goog.userAgent.ASSUME_IE||goog.userAgent.ASSUME_EDGE||goog.userAgent.ASSUME_GECKO||goog.userAgent.ASSUME_MOBILE_WEBKIT||goog.userAgent.ASSUME_WEBKIT||goog.userAgent.ASSUME_OPERA,goog.userAgent.getUserAgentString=function(){return goog.labs.userAgent.util.getUserAgent()},goog.userAgent.getNavigatorTyped=function(){return goog.global.navigator||null},goog.userAgent.getNavigator=function(){return goog.userAgent.getNavigatorTyped()},goog.userAgent.OPERA=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_OPERA:goog.labs.userAgent.browser.isOpera(),goog.userAgent.IE=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_IE:goog.labs.userAgent.browser.isIE(),goog.userAgent.EDGE=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_EDGE:goog.labs.userAgent.engine.isEdge(),goog.userAgent.EDGE_OR_IE=goog.userAgent.EDGE||goog.userAgent.IE,goog.userAgent.GECKO=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_GECKO:goog.labs.userAgent.engine.isGecko(),goog.userAgent.WEBKIT=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_WEBKIT||goog.userAgent.ASSUME_MOBILE_WEBKIT:goog.labs.userAgent.engine.isWebKit(),goog.userAgent.isMobile_=function(){return goog.userAgent.WEBKIT&&goog.labs.userAgent.util.matchUserAgent("Mobile")},goog.userAgent.MOBILE=goog.userAgent.ASSUME_MOBILE_WEBKIT||goog.userAgent.isMobile_(),goog.userAgent.SAFARI=goog.userAgent.WEBKIT,goog.userAgent.determinePlatform_=function(){var t=goog.userAgent.getNavigatorTyped();return t&&t.platform||""},goog.userAgent.PLATFORM=goog.userAgent.determinePlatform_(),goog.userAgent.ASSUME_MAC=!1,goog.userAgent.ASSUME_WINDOWS=!1,goog.userAgent.ASSUME_LINUX=!1,goog.userAgent.ASSUME_X11=!1,goog.userAgent.ASSUME_ANDROID=!1,goog.userAgent.ASSUME_IPHONE=!1,goog.userAgent.ASSUME_IPAD=!1,goog.userAgent.ASSUME_IPOD=!1,goog.userAgent.ASSUME_KAIOS=!1,goog.userAgent.ASSUME_GO2PHONE=!1,goog.userAgent.PLATFORM_KNOWN_=goog.userAgent.ASSUME_MAC||goog.userAgent.ASSUME_WINDOWS||goog.userAgent.ASSUME_LINUX||goog.userAgent.ASSUME_X11||goog.userAgent.ASSUME_ANDROID||goog.userAgent.ASSUME_IPHONE||goog.userAgent.ASSUME_IPAD||goog.userAgent.ASSUME_IPOD,goog.userAgent.MAC=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_MAC:goog.labs.userAgent.platform.isMacintosh(),goog.userAgent.WINDOWS=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_WINDOWS:goog.labs.userAgent.platform.isWindows(),goog.userAgent.isLegacyLinux_=function(){return goog.labs.userAgent.platform.isLinux()||goog.labs.userAgent.platform.isChromeOS()},goog.userAgent.LINUX=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_LINUX:goog.userAgent.isLegacyLinux_(),goog.userAgent.isX11_=function(){var t=goog.userAgent.getNavigatorTyped();return!!t&&goog.string.contains(t.appVersion||"","X11")},goog.userAgent.X11=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_X11:goog.userAgent.isX11_(),goog.userAgent.ANDROID=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_ANDROID:goog.labs.userAgent.platform.isAndroid(),goog.userAgent.IPHONE=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_IPHONE:goog.labs.userAgent.platform.isIphone(),goog.userAgent.IPAD=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_IPAD:goog.labs.userAgent.platform.isIpad(),goog.userAgent.IPOD=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_IPOD:goog.labs.userAgent.platform.isIpod(),goog.userAgent.IOS=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_IPHONE||goog.userAgent.ASSUME_IPAD||goog.userAgent.ASSUME_IPOD:goog.labs.userAgent.platform.isIos(),goog.userAgent.KAIOS=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_KAIOS:goog.labs.userAgent.platform.isKaiOS(),goog.userAgent.GO2PHONE=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_GO2PHONE:goog.labs.userAgent.platform.isGo2Phone(),goog.userAgent.determineVersion_=function(){var t="",e=goog.userAgent.getVersionRegexResult_();return e&&(t=e?e[1]:""),goog.userAgent.IE&&(null!=(e=goog.userAgent.getDocumentMode_())&&e>parseFloat(t))?String(e):t},goog.userAgent.getVersionRegexResult_=function(){var t=goog.userAgent.getUserAgentString();return goog.userAgent.GECKO?/rv:([^\);]+)(\)|;)/.exec(t):goog.userAgent.EDGE?/Edge\/([\d\.]+)/.exec(t):goog.userAgent.IE?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(t):goog.userAgent.WEBKIT?/WebKit\/(\S+)/.exec(t):goog.userAgent.OPERA?/(?:Version)[ \/]?(\S+)/.exec(t):void 0},goog.userAgent.getDocumentMode_=function(){var t=goog.global.document;return t?t.documentMode:void 0},goog.userAgent.VERSION=goog.userAgent.determineVersion_(),goog.userAgent.compare=function(t,e){return goog.string.compareVersions(t,e)},goog.userAgent.isVersionOrHigherCache_={},goog.userAgent.isVersionOrHigher=function(t){return goog.userAgent.ASSUME_ANY_VERSION||goog.reflect.cache(goog.userAgent.isVersionOrHigherCache_,t,(function(){return 0<=goog.string.compareVersions(goog.userAgent.VERSION,t)}))},goog.userAgent.isVersion=goog.userAgent.isVersionOrHigher,goog.userAgent.isDocumentModeOrHigher=function(t){return Number(goog.userAgent.DOCUMENT_MODE)>=t},goog.userAgent.isDocumentMode=goog.userAgent.isDocumentModeOrHigher,goog.userAgent.DOCUMENT_MODE=function(){if(goog.global.document&&goog.userAgent.IE)return goog.userAgent.getDocumentMode_()}(),goog.userAgent.product={},goog.userAgent.product.ASSUME_FIREFOX=!1,goog.userAgent.product.ASSUME_IPHONE=!1,goog.userAgent.product.ASSUME_IPAD=!1,goog.userAgent.product.ASSUME_ANDROID=!1,goog.userAgent.product.ASSUME_CHROME=!1,goog.userAgent.product.ASSUME_SAFARI=!1,goog.userAgent.product.PRODUCT_KNOWN_=goog.userAgent.ASSUME_IE||goog.userAgent.ASSUME_EDGE||goog.userAgent.ASSUME_OPERA||goog.userAgent.product.ASSUME_FIREFOX||goog.userAgent.product.ASSUME_IPHONE||goog.userAgent.product.ASSUME_IPAD||goog.userAgent.product.ASSUME_ANDROID||goog.userAgent.product.ASSUME_CHROME||goog.userAgent.product.ASSUME_SAFARI,goog.userAgent.product.OPERA=goog.userAgent.OPERA,goog.userAgent.product.IE=goog.userAgent.IE,goog.userAgent.product.EDGE=goog.userAgent.EDGE,goog.userAgent.product.FIREFOX=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_FIREFOX:goog.labs.userAgent.browser.isFirefox(),goog.userAgent.product.isIphoneOrIpod_=function(){return goog.labs.userAgent.platform.isIphone()||goog.labs.userAgent.platform.isIpod()},goog.userAgent.product.IPHONE=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_IPHONE:goog.userAgent.product.isIphoneOrIpod_(),goog.userAgent.product.IPAD=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_IPAD:goog.labs.userAgent.platform.isIpad(),goog.userAgent.product.ANDROID=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_ANDROID:goog.labs.userAgent.browser.isAndroidBrowser(),goog.userAgent.product.CHROME=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_CHROME:goog.labs.userAgent.browser.isChrome(),goog.userAgent.product.isSafariDesktop_=function(){return goog.labs.userAgent.browser.isSafari()&&!goog.labs.userAgent.platform.isIos()},goog.userAgent.product.SAFARI=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_SAFARI:goog.userAgent.product.isSafariDesktop_(),goog.crypt.base64={},goog.crypt.base64.DEFAULT_ALPHABET_COMMON_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",goog.crypt.base64.ENCODED_VALS=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_+"+/=",goog.crypt.base64.ENCODED_VALS_WEBSAFE=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_+"-_.",goog.crypt.base64.Alphabet={DEFAULT:0,NO_PADDING:1,WEBSAFE:2,WEBSAFE_DOT_PADDING:3,WEBSAFE_NO_PADDING:4},goog.crypt.base64.paddingChars_="=.",goog.crypt.base64.isPadding_=function(t){return goog.string.contains(goog.crypt.base64.paddingChars_,t)},goog.crypt.base64.byteToCharMaps_={};goog.crypt.base64.charToByteMap_=null,goog.crypt.base64.ASSUME_NATIVE_SUPPORT_=goog.userAgent.GECKO||goog.userAgent.WEBKIT&&!goog.userAgent.product.SAFARI||goog.userAgent.OPERA,goog.crypt.base64.HAS_NATIVE_ENCODE_=goog.crypt.base64.ASSUME_NATIVE_SUPPORT_||"function"==typeof goog.global.btoa,goog.crypt.base64.HAS_NATIVE_DECODE_=goog.crypt.base64.ASSUME_NATIVE_SUPPORT_||!goog.userAgent.product.SAFARI&&!goog.userAgent.IE&&"function"==typeof goog.global.atob,goog.crypt.base64.encodeByteArray=function(t,e){goog.asserts.assert(goog.isArrayLike(t),"encodeByteArray takes an array as a parameter"),void 0===e&&(e=goog.crypt.base64.Alphabet.DEFAULT),goog.crypt.base64.init_(),e=goog.crypt.base64.byteToCharMaps_[e];for(var r=[],n=0;n<t.length;n+=3){var i=t[n],o=n+1<t.length,a=o?t[n+1]:0,s=n+2<t.length,u=s?t[n+2]:0,c=i>>2;i=(3&i)<<4|a>>4,a=(15&a)<<2|u>>6,u&=63,s||(u=64,o||(a=64)),r.push(e[c],e[i],e[a]||"",e[u]||"")}return r.join("")},goog.crypt.base64.encodeString=function(t,e){return goog.crypt.base64.HAS_NATIVE_ENCODE_&&!e?goog.global.btoa(t):goog.crypt.base64.encodeByteArray(goog.crypt.stringToByteArray(t),e)},goog.crypt.base64.decodeString=function(t,e){if(goog.crypt.base64.HAS_NATIVE_DECODE_&&!e)return goog.global.atob(t);var r="";return goog.crypt.base64.decodeStringInternal_(t,(function(t){r+=String.fromCharCode(t)})),r},goog.crypt.base64.decodeStringToByteArray=function(t,e){var r=[];return goog.crypt.base64.decodeStringInternal_(t,(function(t){r.push(t)})),r},goog.crypt.base64.decodeStringToUint8Array=function(t){goog.asserts.assert(!goog.userAgent.IE||goog.userAgent.isVersionOrHigher("10"),"Browser does not support typed arrays");var e=t.length,r=3*e/4;r%3?r=Math.floor(r):goog.crypt.base64.isPadding_(t[e-1])&&(r=goog.crypt.base64.isPadding_(t[e-2])?r-2:r-1);var n=new Uint8Array(r),i=0;return goog.crypt.base64.decodeStringInternal_(t,(function(t){n[i++]=t})),n.subarray(0,i)},goog.crypt.base64.decodeStringInternal_=function(t,e){function r(e){for(;n<t.length;){var r=t.charAt(n++),i=goog.crypt.base64.charToByteMap_[r];if(null!=i)return i;if(!goog.string.isEmptyOrWhitespace(r))throw Error("Unknown base64 encoding at char: "+r)}return e}goog.crypt.base64.init_();for(var n=0;;){var i=r(-1),o=r(0),a=r(64),s=r(64);if(64===s&&-1===i)break;e(i<<2|o>>4),64!=a&&(e(o<<4&240|a>>2),64!=s&&e(a<<6&192|s))}},goog.crypt.base64.init_=function(){if(!goog.crypt.base64.charToByteMap_){goog.crypt.base64.charToByteMap_={};for(var t=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_.split(""),e=["+/=","+/","-_=","-_.","-_"],r=0;5>r;r++){var n=t.concat(e[r].split(""));goog.crypt.base64.byteToCharMaps_[r]=n;for(var i=0;i<n.length;i++){var o=n[i],a=goog.crypt.base64.charToByteMap_[o];void 0===a?goog.crypt.base64.charToByteMap_[o]=i:goog.asserts.assert(a===i)}}}},jspb.utils={},jspb.utils.split64Low=0,jspb.utils.split64High=0,jspb.utils.splitUint64=function(t){var e=t>>>0;t=Math.floor((t-e)/jspb.BinaryConstants.TWO_TO_32)>>>0,jspb.utils.split64Low=e,jspb.utils.split64High=t},jspb.utils.splitInt64=function(t){var e=0>t,r=(t=Math.abs(t))>>>0;t=Math.floor((t-r)/jspb.BinaryConstants.TWO_TO_32),t>>>=0,e&&(t=~t>>>0,4294967295<(r=1+(~r>>>0))&&(r=0,4294967295<++t&&(t=0))),jspb.utils.split64Low=r,jspb.utils.split64High=t},jspb.utils.splitZigzag64=function(t){var e=0>t;t=2*Math.abs(t),jspb.utils.splitUint64(t),t=jspb.utils.split64Low;var r=jspb.utils.split64High;e&&(0==t?0==r?r=t=4294967295:(r--,t=4294967295):t--),jspb.utils.split64Low=t,jspb.utils.split64High=r},jspb.utils.splitFloat32=function(t){var e=0>t?1:0;if(0===(t=e?-t:t))0<1/t?(jspb.utils.split64High=0,jspb.utils.split64Low=0):(jspb.utils.split64High=0,jspb.utils.split64Low=2147483648);else if(isNaN(t))jspb.utils.split64High=0,jspb.utils.split64Low=2147483647;else if(t>jspb.BinaryConstants.FLOAT32_MAX)jspb.utils.split64High=0,jspb.utils.split64Low=(e<<31|2139095040)>>>0;else if(t<jspb.BinaryConstants.FLOAT32_MIN)t=Math.round(t/Math.pow(2,-149)),jspb.utils.split64High=0,jspb.utils.split64Low=(e<<31|t)>>>0;else{var r=Math.floor(Math.log(t)/Math.LN2);t*=Math.pow(2,-r),16777216<=(t=Math.round(t*jspb.BinaryConstants.TWO_TO_23))&&++r,jspb.utils.split64High=0,jspb.utils.split64Low=(e<<31|r+127<<23|8388607&t)>>>0}},jspb.utils.splitFloat64=function(t){var e=0>t?1:0;if(0===(t=e?-t:t))jspb.utils.split64High=0<1/t?0:2147483648,jspb.utils.split64Low=0;else if(isNaN(t))jspb.utils.split64High=2147483647,jspb.utils.split64Low=4294967295;else if(t>jspb.BinaryConstants.FLOAT64_MAX)jspb.utils.split64High=(e<<31|2146435072)>>>0,jspb.utils.split64Low=0;else if(t<jspb.BinaryConstants.FLOAT64_MIN){var r=t/Math.pow(2,-1074);t=r/jspb.BinaryConstants.TWO_TO_32,jspb.utils.split64High=(e<<31|t)>>>0,jspb.utils.split64Low=r>>>0}else{var n=0;if(2<=(r=t))for(;2<=r&&1023>n;)n++,r/=2;else for(;1>r&&-1022<n;)r*=2,n--;t=(r=t*Math.pow(2,-n))*jspb.BinaryConstants.TWO_TO_20&1048575,r=r*jspb.BinaryConstants.TWO_TO_52>>>0,jspb.utils.split64High=(e<<31|n+1023<<20|t)>>>0,jspb.utils.split64Low=r}},jspb.utils.splitHash64=function(t){var e=t.charCodeAt(0),r=t.charCodeAt(1),n=t.charCodeAt(2),i=t.charCodeAt(3),o=t.charCodeAt(4),a=t.charCodeAt(5),s=t.charCodeAt(6);t=t.charCodeAt(7),jspb.utils.split64Low=e+(r<<8)+(n<<16)+(i<<24)>>>0,jspb.utils.split64High=o+(a<<8)+(s<<16)+(t<<24)>>>0},jspb.utils.joinUint64=function(t,e){return e*jspb.BinaryConstants.TWO_TO_32+(t>>>0)},jspb.utils.joinInt64=function(t,e){var r=2147483648&e;return r&&(e=~e>>>0,0==(t=1+~t>>>0)&&(e=e+1>>>0)),t=jspb.utils.joinUint64(t,e),r?-t:t},jspb.utils.toZigzag64=function(t,e,r){var n=e>>31;return r(t<<1^n,(e<<1|t>>>31)^n)},jspb.utils.joinZigzag64=function(t,e){return jspb.utils.fromZigzag64(t,e,jspb.utils.joinInt64)},jspb.utils.fromZigzag64=function(t,e,r){var n=-(1&t);return r((t>>>1|e<<31)^n,e>>>1^n)},jspb.utils.joinFloat32=function(t,e){e=2*(t>>31)+1;var r=t>>>23&255;return t&=8388607,255==r?t?NaN:1/0*e:0==r?e*Math.pow(2,-149)*t:e*Math.pow(2,r-150)*(t+Math.pow(2,23))},jspb.utils.joinFloat64=function(t,e){var r=2*(e>>31)+1,n=e>>>20&2047;return t=jspb.BinaryConstants.TWO_TO_32*(1048575&e)+t,2047==n?t?NaN:1/0*r:0==n?r*Math.pow(2,-1074)*t:r*Math.pow(2,n-1075)*(t+jspb.BinaryConstants.TWO_TO_52)},jspb.utils.joinHash64=function(t,e){return String.fromCharCode(t>>>0&255,t>>>8&255,t>>>16&255,t>>>24&255,e>>>0&255,e>>>8&255,e>>>16&255,e>>>24&255)},jspb.utils.DIGITS="0123456789abcdef".split(""),jspb.utils.ZERO_CHAR_CODE_=48,jspb.utils.A_CHAR_CODE_=97,jspb.utils.joinUnsignedDecimalString=function(t,e){function r(t,e){return t=t?String(t):"",e?"0000000".slice(t.length)+t:t}if(2097151>=e)return""+jspb.utils.joinUint64(t,e);var n=(t>>>24|e<<8)>>>0&16777215;return t=(16777215&t)+6777216*n+6710656*(e=e>>16&65535),n+=8147497*e,e*=2,1e7<=t&&(n+=Math.floor(t/1e7),t%=1e7),1e7<=n&&(e+=Math.floor(n/1e7),n%=1e7),r(e,0)+r(n,e)+r(t,1)},jspb.utils.joinSignedDecimalString=function(t,e){var r=2147483648&e;return r&&(e=~e+(0==(t=1+~t>>>0)?1:0)>>>0),t=jspb.utils.joinUnsignedDecimalString(t,e),r?"-"+t:t},jspb.utils.hash64ToDecimalString=function(t,e){jspb.utils.splitHash64(t),t=jspb.utils.split64Low;var r=jspb.utils.split64High;return e?jspb.utils.joinSignedDecimalString(t,r):jspb.utils.joinUnsignedDecimalString(t,r)},jspb.utils.hash64ArrayToDecimalStrings=function(t,e){for(var r=Array(t.length),n=0;n<t.length;n++)r[n]=jspb.utils.hash64ToDecimalString(t[n],e);return r},jspb.utils.decimalStringToHash64=function(t){function e(t,e){for(var r=0;8>r&&(1!==t||0<e);r++)e=t*n[r]+e,n[r]=255&e,e>>>=8}goog.asserts.assert(0<t.length);var r=!1;"-"===t[0]&&(r=!0,t=t.slice(1));for(var n=[0,0,0,0,0,0,0,0],i=0;i<t.length;i++)e(10,t.charCodeAt(i)-jspb.utils.ZERO_CHAR_CODE_);return r&&(function(){for(var t=0;8>t;t++)n[t]=255&~n[t]}(),e(1,1)),goog.crypt.byteArrayToString(n)},jspb.utils.splitDecimalString=function(t){jspb.utils.splitHash64(jspb.utils.decimalStringToHash64(t))},jspb.utils.toHexDigit_=function(t){return String.fromCharCode(10>t?jspb.utils.ZERO_CHAR_CODE_+t:jspb.utils.A_CHAR_CODE_-10+t)},jspb.utils.fromHexCharCode_=function(t){return t>=jspb.utils.A_CHAR_CODE_?t-jspb.utils.A_CHAR_CODE_+10:t-jspb.utils.ZERO_CHAR_CODE_},jspb.utils.hash64ToHexString=function(t){var e=Array(18);e[0]="0",e[1]="x";for(var r=0;8>r;r++){var n=t.charCodeAt(7-r);e[2*r+2]=jspb.utils.toHexDigit_(n>>4),e[2*r+3]=jspb.utils.toHexDigit_(15&n)}return e.join("")},jspb.utils.hexStringToHash64=function(t){t=t.toLowerCase(),goog.asserts.assert(18==t.length),goog.asserts.assert("0"==t[0]),goog.asserts.assert("x"==t[1]);for(var e="",r=0;8>r;r++){var n=jspb.utils.fromHexCharCode_(t.charCodeAt(2*r+2)),i=jspb.utils.fromHexCharCode_(t.charCodeAt(2*r+3));e=String.fromCharCode(16*n+i)+e}return e},jspb.utils.hash64ToNumber=function(t,e){jspb.utils.splitHash64(t),t=jspb.utils.split64Low;var r=jspb.utils.split64High;return e?jspb.utils.joinInt64(t,r):jspb.utils.joinUint64(t,r)},jspb.utils.numberToHash64=function(t){return jspb.utils.splitInt64(t),jspb.utils.joinHash64(jspb.utils.split64Low,jspb.utils.split64High)},jspb.utils.countVarints=function(t,e,r){for(var n=0,i=e;i<r;i++)n+=t[i]>>7;return r-e-n},jspb.utils.countVarintFields=function(t,e,r,n){var i=0;if(128>(n=8*n+jspb.BinaryConstants.WireType.VARINT))for(;e<r&&t[e++]==n;)for(i++;;){var o=t[e++];if(0==(128&o))break}else for(;e<r;){for(o=n;128<o;){if(t[e]!=(127&o|128))return i;e++,o>>=7}if(t[e++]!=o)break;for(i++;0!=(128&(o=t[e++])););}return i},jspb.utils.countFixedFields_=function(t,e,r,n,i){var o=0;if(128>n)for(;e<r&&t[e++]==n;)o++,e+=i;else for(;e<r;){for(var a=n;128<a;){if(t[e++]!=(127&a|128))return o;a>>=7}if(t[e++]!=a)break;o++,e+=i}return o},jspb.utils.countFixed32Fields=function(t,e,r,n){return jspb.utils.countFixedFields_(t,e,r,8*n+jspb.BinaryConstants.WireType.FIXED32,4)},jspb.utils.countFixed64Fields=function(t,e,r,n){return jspb.utils.countFixedFields_(t,e,r,8*n+jspb.BinaryConstants.WireType.FIXED64,8)},jspb.utils.countDelimitedFields=function(t,e,r,n){var i=0;for(n=8*n+jspb.BinaryConstants.WireType.DELIMITED;e<r;){for(var o=n;128<o;){if(t[e++]!=(127&o|128))return i;o>>=7}if(t[e++]!=o)break;i++;for(var a=0,s=1;a+=(127&(o=t[e++]))*s,s*=128,0!=(128&o););e+=a}return i},jspb.utils.debugBytesToTextFormat=function(t){var e='"';if(t){t=jspb.utils.byteSourceToUint8Array(t);for(var r=0;r<t.length;r++)e+="\\x",16>t[r]&&(e+="0"),e+=t[r].toString(16)}return e+'"'},jspb.utils.debugScalarToTextFormat=function(t){return"string"==typeof t?goog.string.quote(t):t.toString()},jspb.utils.stringToByteArray=function(t){for(var e=new Uint8Array(t.length),r=0;r<t.length;r++){var n=t.charCodeAt(r);if(255<n)throw Error("Conversion error: string contains codepoint outside of byte range");e[r]=n}return e},jspb.utils.byteSourceToUint8Array=function(t){return t.constructor===Uint8Array?t:t.constructor===ArrayBuffer||void 0!==Buffer&&t.constructor===Buffer||t.constructor===Array?new Uint8Array(t):t.constructor===String?goog.crypt.base64.decodeStringToUint8Array(t):(goog.asserts.fail("Type not convertible to Uint8Array."),new Uint8Array(0))},jspb.BinaryDecoder=function(t,e,r){this.bytes_=null,this.cursor_=this.end_=this.start_=0,this.error_=!1,t&&this.setBlock(t,e,r)},jspb.BinaryDecoder.instanceCache_=[],jspb.BinaryDecoder.alloc=function(t,e,r){if(jspb.BinaryDecoder.instanceCache_.length){var n=jspb.BinaryDecoder.instanceCache_.pop();return t&&n.setBlock(t,e,r),n}return new jspb.BinaryDecoder(t,e,r)},jspb.BinaryDecoder.prototype.free=function(){this.clear(),100>jspb.BinaryDecoder.instanceCache_.length&&jspb.BinaryDecoder.instanceCache_.push(this)},jspb.BinaryDecoder.prototype.clone=function(){return jspb.BinaryDecoder.alloc(this.bytes_,this.start_,this.end_-this.start_)},jspb.BinaryDecoder.prototype.clear=function(){this.bytes_=null,this.cursor_=this.end_=this.start_=0,this.error_=!1},jspb.BinaryDecoder.prototype.getBuffer=function(){return this.bytes_},jspb.BinaryDecoder.prototype.setBlock=function(t,e,r){this.bytes_=jspb.utils.byteSourceToUint8Array(t),this.start_=void 0!==e?e:0,this.end_=void 0!==r?this.start_+r:this.bytes_.length,this.cursor_=this.start_},jspb.BinaryDecoder.prototype.getEnd=function(){return this.end_},jspb.BinaryDecoder.prototype.setEnd=function(t){this.end_=t},jspb.BinaryDecoder.prototype.reset=function(){this.cursor_=this.start_},jspb.BinaryDecoder.prototype.getCursor=function(){return this.cursor_},jspb.BinaryDecoder.prototype.setCursor=function(t){this.cursor_=t},jspb.BinaryDecoder.prototype.advance=function(t){this.cursor_+=t,goog.asserts.assert(this.cursor_<=this.end_)},jspb.BinaryDecoder.prototype.atEnd=function(){return this.cursor_==this.end_},jspb.BinaryDecoder.prototype.pastEnd=function(){return this.cursor_>this.end_},jspb.BinaryDecoder.prototype.getError=function(){return this.error_||0>this.cursor_||this.cursor_>this.end_},jspb.BinaryDecoder.prototype.readSplitVarint64=function(t){for(var e=128,r=0,n=0,i=0;4>i&&128<=e;i++)r|=(127&(e=this.bytes_[this.cursor_++]))<<7*i;if(128<=e&&(r|=(127&(e=this.bytes_[this.cursor_++]))<<28,n|=(127&e)>>4),128<=e)for(i=0;5>i&&128<=e;i++)n|=(127&(e=this.bytes_[this.cursor_++]))<<7*i+3;if(128>e)return t(r>>>0,n>>>0);goog.asserts.fail("Failed to read varint, encoding is invalid."),this.error_=!0},jspb.BinaryDecoder.prototype.readSplitZigzagVarint64=function(t){return this.readSplitVarint64((function(e,r){return jspb.utils.fromZigzag64(e,r,t)}))},jspb.BinaryDecoder.prototype.readSplitFixed64=function(t){var e=this.bytes_,r=this.cursor_;this.cursor_+=8;for(var n=0,i=0,o=r+7;o>=r;o--)n=n<<8|e[o],i=i<<8|e[o+4];return t(n,i)},jspb.BinaryDecoder.prototype.skipVarint=function(){for(;128&this.bytes_[this.cursor_];)this.cursor_++;this.cursor_++},jspb.BinaryDecoder.prototype.unskipVarint=function(t){for(;128<t;)this.cursor_--,t>>>=7;this.cursor_--},jspb.BinaryDecoder.prototype.readUnsignedVarint32=function(){var t=this.bytes_,e=t[this.cursor_+0],r=127&e;return 128>e?(this.cursor_+=1,goog.asserts.assert(this.cursor_<=this.end_),r):(r|=(127&(e=t[this.cursor_+1]))<<7,128>e?(this.cursor_+=2,goog.asserts.assert(this.cursor_<=this.end_),r):(r|=(127&(e=t[this.cursor_+2]))<<14,128>e?(this.cursor_+=3,goog.asserts.assert(this.cursor_<=this.end_),r):(r|=(127&(e=t[this.cursor_+3]))<<21,128>e?(this.cursor_+=4,goog.asserts.assert(this.cursor_<=this.end_),r):(r|=(15&(e=t[this.cursor_+4]))<<28,128>e?(this.cursor_+=5,goog.asserts.assert(this.cursor_<=this.end_),r>>>0):(this.cursor_+=5,128<=t[this.cursor_++]&&128<=t[this.cursor_++]&&128<=t[this.cursor_++]&&128<=t[this.cursor_++]&&128<=t[this.cursor_++]&&goog.asserts.assert(!1),goog.asserts.assert(this.cursor_<=this.end_),r)))))},jspb.BinaryDecoder.prototype.readSignedVarint32=jspb.BinaryDecoder.prototype.readUnsignedVarint32,jspb.BinaryDecoder.prototype.readUnsignedVarint32String=function(){return this.readUnsignedVarint32().toString()},jspb.BinaryDecoder.prototype.readSignedVarint32String=function(){return this.readSignedVarint32().toString()},jspb.BinaryDecoder.prototype.readZigzagVarint32=function(){var t=this.readUnsignedVarint32();return t>>>1^-(1&t)},jspb.BinaryDecoder.prototype.readUnsignedVarint64=function(){return this.readSplitVarint64(jspb.utils.joinUint64)},jspb.BinaryDecoder.prototype.readUnsignedVarint64String=function(){return this.readSplitVarint64(jspb.utils.joinUnsignedDecimalString)},jspb.BinaryDecoder.prototype.readSignedVarint64=function(){return this.readSplitVarint64(jspb.utils.joinInt64)},jspb.BinaryDecoder.prototype.readSignedVarint64String=function(){return this.readSplitVarint64(jspb.utils.joinSignedDecimalString)},jspb.BinaryDecoder.prototype.readZigzagVarint64=function(){return this.readSplitVarint64(jspb.utils.joinZigzag64)},jspb.BinaryDecoder.prototype.readZigzagVarintHash64=function(){return this.readSplitZigzagVarint64(jspb.utils.joinHash64)},jspb.BinaryDecoder.prototype.readZigzagVarint64String=function(){return this.readSplitZigzagVarint64(jspb.utils.joinSignedDecimalString)},jspb.BinaryDecoder.prototype.readUint8=function(){var t=this.bytes_[this.cursor_+0];return this.cursor_+=1,goog.asserts.assert(this.cursor_<=this.end_),t},jspb.BinaryDecoder.prototype.readUint16=function(){var t=this.bytes_[this.cursor_+0],e=this.bytes_[this.cursor_+1];return this.cursor_+=2,goog.asserts.assert(this.cursor_<=this.end_),t<<0|e<<8},jspb.BinaryDecoder.prototype.readUint32=function(){var t=this.bytes_[this.cursor_+0],e=this.bytes_[this.cursor_+1],r=this.bytes_[this.cursor_+2],n=this.bytes_[this.cursor_+3];return this.cursor_+=4,goog.asserts.assert(this.cursor_<=this.end_),(t<<0|e<<8|r<<16|n<<24)>>>0},jspb.BinaryDecoder.prototype.readUint64=function(){var t=this.readUint32(),e=this.readUint32();return jspb.utils.joinUint64(t,e)},jspb.BinaryDecoder.prototype.readUint64String=function(){var t=this.readUint32(),e=this.readUint32();return jspb.utils.joinUnsignedDecimalString(t,e)},jspb.BinaryDecoder.prototype.readInt8=function(){var t=this.bytes_[this.cursor_+0];return this.cursor_+=1,goog.asserts.assert(this.cursor_<=this.end_),t<<24>>24},jspb.BinaryDecoder.prototype.readInt16=function(){var t=this.bytes_[this.cursor_+0],e=this.bytes_[this.cursor_+1];return this.cursor_+=2,goog.asserts.assert(this.cursor_<=this.end_),(t<<0|e<<8)<<16>>16},jspb.BinaryDecoder.prototype.readInt32=function(){var t=this.bytes_[this.cursor_+0],e=this.bytes_[this.cursor_+1],r=this.bytes_[this.cursor_+2],n=this.bytes_[this.cursor_+3];return this.cursor_+=4,goog.asserts.assert(this.cursor_<=this.end_),t<<0|e<<8|r<<16|n<<24},jspb.BinaryDecoder.prototype.readInt64=function(){var t=this.readUint32(),e=this.readUint32();return jspb.utils.joinInt64(t,e)},jspb.BinaryDecoder.prototype.readInt64String=function(){var t=this.readUint32(),e=this.readUint32();return jspb.utils.joinSignedDecimalString(t,e)},jspb.BinaryDecoder.prototype.readFloat=function(){var t=this.readUint32();return jspb.utils.joinFloat32(t,0)},jspb.BinaryDecoder.prototype.readDouble=function(){var t=this.readUint32(),e=this.readUint32();return jspb.utils.joinFloat64(t,e)},jspb.BinaryDecoder.prototype.readBool=function(){return!!this.bytes_[this.cursor_++]},jspb.BinaryDecoder.prototype.readEnum=function(){return this.readSignedVarint32()},jspb.BinaryDecoder.prototype.readString=function(t){var e=this.bytes_,r=this.cursor_;t=r+t;for(var n=[],i="";r<t;){var o=e[r++];if(128>o)n.push(o);else{if(192>o)continue;if(224>o){var a=e[r++];n.push((31&o)<<6|63&a)}else if(240>o){a=e[r++];var s=e[r++];n.push((15&o)<<12|(63&a)<<6|63&s)}else if(248>o){o=(7&o)<<18|(63&(a=e[r++]))<<12|(63&(s=e[r++]))<<6|63&e[r++],o-=65536,n.push(55296+(o>>10&1023),56320+(1023&o))}}8192<=n.length&&(i+=String.fromCharCode.apply(null,n),n.length=0)}return i+=goog.crypt.byteArrayToString(n),this.cursor_=r,i},jspb.BinaryDecoder.prototype.readStringWithLength=function(){var t=this.readUnsignedVarint32();return this.readString(t)},jspb.BinaryDecoder.prototype.readBytes=function(t){if(0>t||this.cursor_+t>this.bytes_.length)return this.error_=!0,goog.asserts.fail("Invalid byte length!"),new Uint8Array(0);var e=this.bytes_.subarray(this.cursor_,this.cursor_+t);return this.cursor_+=t,goog.asserts.assert(this.cursor_<=this.end_),e},jspb.BinaryDecoder.prototype.readVarintHash64=function(){return this.readSplitVarint64(jspb.utils.joinHash64)},jspb.BinaryDecoder.prototype.readFixedHash64=function(){var t=this.bytes_,e=this.cursor_,r=t[e+0],n=t[e+1],i=t[e+2],o=t[e+3],a=t[e+4],s=t[e+5],u=t[e+6];return t=t[e+7],this.cursor_+=8,String.fromCharCode(r,n,i,o,a,s,u,t)},jspb.BinaryReader=function(t,e,r){this.decoder_=jspb.BinaryDecoder.alloc(t,e,r),this.fieldCursor_=this.decoder_.getCursor(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID,this.error_=!1,this.readCallbacks_=null},jspb.BinaryReader.instanceCache_=[],jspb.BinaryReader.alloc=function(t,e,r){if(jspb.BinaryReader.instanceCache_.length){var n=jspb.BinaryReader.instanceCache_.pop();return t&&n.decoder_.setBlock(t,e,r),n}return new jspb.BinaryReader(t,e,r)},jspb.BinaryReader.prototype.alloc=jspb.BinaryReader.alloc,jspb.BinaryReader.prototype.free=function(){this.decoder_.clear(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID,this.error_=!1,this.readCallbacks_=null,100>jspb.BinaryReader.instanceCache_.length&&jspb.BinaryReader.instanceCache_.push(this)},jspb.BinaryReader.prototype.getFieldCursor=function(){return this.fieldCursor_},jspb.BinaryReader.prototype.getCursor=function(){return this.decoder_.getCursor()},jspb.BinaryReader.prototype.getBuffer=function(){return this.decoder_.getBuffer()},jspb.BinaryReader.prototype.getFieldNumber=function(){return this.nextField_},jspb.BinaryReader.prototype.getWireType=function(){return this.nextWireType_},jspb.BinaryReader.prototype.isDelimited=function(){return this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED},jspb.BinaryReader.prototype.isEndGroup=function(){return this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP},jspb.BinaryReader.prototype.getError=function(){return this.error_||this.decoder_.getError()},jspb.BinaryReader.prototype.setBlock=function(t,e,r){this.decoder_.setBlock(t,e,r),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID},jspb.BinaryReader.prototype.reset=function(){this.decoder_.reset(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID},jspb.BinaryReader.prototype.advance=function(t){this.decoder_.advance(t)},jspb.BinaryReader.prototype.nextField=function(){if(this.decoder_.atEnd())return!1;if(this.getError())return goog.asserts.fail("Decoder hit an error"),!1;this.fieldCursor_=this.decoder_.getCursor();var t=this.decoder_.readUnsignedVarint32(),e=t>>>3;return(t&=7)!=jspb.BinaryConstants.WireType.VARINT&&t!=jspb.BinaryConstants.WireType.FIXED32&&t!=jspb.BinaryConstants.WireType.FIXED64&&t!=jspb.BinaryConstants.WireType.DELIMITED&&t!=jspb.BinaryConstants.WireType.START_GROUP&&t!=jspb.BinaryConstants.WireType.END_GROUP?(goog.asserts.fail("Invalid wire type: %s (at position %s)",t,this.fieldCursor_),this.error_=!0,!1):(this.nextField_=e,this.nextWireType_=t,!0)},jspb.BinaryReader.prototype.unskipHeader=function(){this.decoder_.unskipVarint(this.nextField_<<3|this.nextWireType_)},jspb.BinaryReader.prototype.skipMatchingFields=function(){var t=this.nextField_;for(this.unskipHeader();this.nextField()&&this.getFieldNumber()==t;)this.skipField();this.decoder_.atEnd()||this.unskipHeader()},jspb.BinaryReader.prototype.skipVarintField=function(){this.nextWireType_!=jspb.BinaryConstants.WireType.VARINT?(goog.asserts.fail("Invalid wire type for skipVarintField"),this.skipField()):this.decoder_.skipVarint()},jspb.BinaryReader.prototype.skipDelimitedField=function(){if(this.nextWireType_!=jspb.BinaryConstants.WireType.DELIMITED)goog.asserts.fail("Invalid wire type for skipDelimitedField"),this.skipField();else{var t=this.decoder_.readUnsignedVarint32();this.decoder_.advance(t)}},jspb.BinaryReader.prototype.skipFixed32Field=function(){this.nextWireType_!=jspb.BinaryConstants.WireType.FIXED32?(goog.asserts.fail("Invalid wire type for skipFixed32Field"),this.skipField()):this.decoder_.advance(4)},jspb.BinaryReader.prototype.skipFixed64Field=function(){this.nextWireType_!=jspb.BinaryConstants.WireType.FIXED64?(goog.asserts.fail("Invalid wire type for skipFixed64Field"),this.skipField()):this.decoder_.advance(8)},jspb.BinaryReader.prototype.skipGroup=function(){for(var t=this.nextField_;;){if(!this.nextField()){goog.asserts.fail("Unmatched start-group tag: stream EOF"),this.error_=!0;break}if(this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP){this.nextField_!=t&&(goog.asserts.fail("Unmatched end-group tag"),this.error_=!0);break}this.skipField()}},jspb.BinaryReader.prototype.skipField=function(){switch(this.nextWireType_){case jspb.BinaryConstants.WireType.VARINT:this.skipVarintField();break;case jspb.BinaryConstants.WireType.FIXED64:this.skipFixed64Field();break;case jspb.BinaryConstants.WireType.DELIMITED:this.skipDelimitedField();break;case jspb.BinaryConstants.WireType.FIXED32:this.skipFixed32Field();break;case jspb.BinaryConstants.WireType.START_GROUP:this.skipGroup();break;default:goog.asserts.fail("Invalid wire encoding for field.")}},jspb.BinaryReader.prototype.registerReadCallback=function(t,e){null===this.readCallbacks_&&(this.readCallbacks_={}),goog.asserts.assert(!this.readCallbacks_[t]),this.readCallbacks_[t]=e},jspb.BinaryReader.prototype.runReadCallback=function(t){return goog.asserts.assert(null!==this.readCallbacks_),t=this.readCallbacks_[t],goog.asserts.assert(t),t(this)},jspb.BinaryReader.prototype.readAny=function(t){this.nextWireType_=jspb.BinaryConstants.FieldTypeToWireType(t);var e=jspb.BinaryConstants.FieldType;switch(t){case e.DOUBLE:return this.readDouble();case e.FLOAT:return this.readFloat();case e.INT64:return this.readInt64();case e.UINT64:return this.readUint64();case e.INT32:return this.readInt32();case e.FIXED64:return this.readFixed64();case e.FIXED32:return this.readFixed32();case e.BOOL:return this.readBool();case e.STRING:return this.readString();case e.GROUP:goog.asserts.fail("Group field type not supported in readAny()");case e.MESSAGE:goog.asserts.fail("Message field type not supported in readAny()");case e.BYTES:return this.readBytes();case e.UINT32:return this.readUint32();case e.ENUM:return this.readEnum();case e.SFIXED32:return this.readSfixed32();case e.SFIXED64:return this.readSfixed64();case e.SINT32:return this.readSint32();case e.SINT64:return this.readSint64();case e.FHASH64:return this.readFixedHash64();case e.VHASH64:return this.readVarintHash64();default:goog.asserts.fail("Invalid field type in readAny()")}return 0},jspb.BinaryReader.prototype.readMessage=function(t,e){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var r=this.decoder_.getEnd(),n=this.decoder_.readUnsignedVarint32();n=this.decoder_.getCursor()+n,this.decoder_.setEnd(n),e(t,this),this.decoder_.setCursor(n),this.decoder_.setEnd(r)},jspb.BinaryReader.prototype.readGroup=function(t,e,r){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.START_GROUP),goog.asserts.assert(this.nextField_==t),r(e,this),this.error_||this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP||(goog.asserts.fail("Group submessage did not end with an END_GROUP tag"),this.error_=!0)},jspb.BinaryReader.prototype.getFieldDecoder=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var t=this.decoder_.readUnsignedVarint32(),e=this.decoder_.getCursor(),r=e+t;return t=jspb.BinaryDecoder.alloc(this.decoder_.getBuffer(),e,t),this.decoder_.setCursor(r),t},jspb.BinaryReader.prototype.readInt32=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint32()},jspb.BinaryReader.prototype.readInt32String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint32String()},jspb.BinaryReader.prototype.readInt64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64()},jspb.BinaryReader.prototype.readInt64String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64String()},jspb.BinaryReader.prototype.readUint32=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint32()},jspb.BinaryReader.prototype.readUint32String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint32String()},jspb.BinaryReader.prototype.readUint64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint64()},jspb.BinaryReader.prototype.readUint64String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint64String()},jspb.BinaryReader.prototype.readSint32=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint32()},jspb.BinaryReader.prototype.readSint64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint64()},jspb.BinaryReader.prototype.readSint64String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint64String()},jspb.BinaryReader.prototype.readFixed32=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readUint32()},jspb.BinaryReader.prototype.readFixed64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readUint64()},jspb.BinaryReader.prototype.readFixed64String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readUint64String()},jspb.BinaryReader.prototype.readSfixed32=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readInt32()},jspb.BinaryReader.prototype.readSfixed32String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readInt32().toString()},jspb.BinaryReader.prototype.readSfixed64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readInt64()},jspb.BinaryReader.prototype.readSfixed64String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readInt64String()},jspb.BinaryReader.prototype.readFloat=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readFloat()},jspb.BinaryReader.prototype.readDouble=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readDouble()},jspb.BinaryReader.prototype.readBool=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),!!this.decoder_.readUnsignedVarint32()},jspb.BinaryReader.prototype.readEnum=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64()},jspb.BinaryReader.prototype.readString=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var t=this.decoder_.readUnsignedVarint32();return this.decoder_.readString(t)},jspb.BinaryReader.prototype.readBytes=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var t=this.decoder_.readUnsignedVarint32();return this.decoder_.readBytes(t)},jspb.BinaryReader.prototype.readVarintHash64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readVarintHash64()},jspb.BinaryReader.prototype.readSintHash64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarintHash64()},jspb.BinaryReader.prototype.readSplitVarint64=function(t){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSplitVarint64(t)},jspb.BinaryReader.prototype.readSplitZigzagVarint64=function(t){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSplitVarint64((function(e,r){return jspb.utils.fromZigzag64(e,r,t)}))},jspb.BinaryReader.prototype.readFixedHash64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readFixedHash64()},jspb.BinaryReader.prototype.readSplitFixed64=function(t){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readSplitFixed64(t)},jspb.BinaryReader.prototype.readPackedField_=function(t){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var e=this.decoder_.readUnsignedVarint32();e=this.decoder_.getCursor()+e;for(var r=[];this.decoder_.getCursor()<e;)r.push(t.call(this.decoder_));return r},jspb.BinaryReader.prototype.readPackedInt32=function(){return this.readPackedField_(this.decoder_.readSignedVarint32)},jspb.BinaryReader.prototype.readPackedInt32String=function(){return this.readPackedField_(this.decoder_.readSignedVarint32String)},jspb.BinaryReader.prototype.readPackedInt64=function(){return this.readPackedField_(this.decoder_.readSignedVarint64)},jspb.BinaryReader.prototype.readPackedInt64String=function(){return this.readPackedField_(this.decoder_.readSignedVarint64String)},jspb.BinaryReader.prototype.readPackedUint32=function(){return this.readPackedField_(this.decoder_.readUnsignedVarint32)},jspb.BinaryReader.prototype.readPackedUint32String=function(){return this.readPackedField_(this.decoder_.readUnsignedVarint32String)},jspb.BinaryReader.prototype.readPackedUint64=function(){return this.readPackedField_(this.decoder_.readUnsignedVarint64)},jspb.BinaryReader.prototype.readPackedUint64String=function(){return this.readPackedField_(this.decoder_.readUnsignedVarint64String)},jspb.BinaryReader.prototype.readPackedSint32=function(){return this.readPackedField_(this.decoder_.readZigzagVarint32)},jspb.BinaryReader.prototype.readPackedSint64=function(){return this.readPackedField_(this.decoder_.readZigzagVarint64)},jspb.BinaryReader.prototype.readPackedSint64String=function(){return this.readPackedField_(this.decoder_.readZigzagVarint64String)},jspb.BinaryReader.prototype.readPackedFixed32=function(){return this.readPackedField_(this.decoder_.readUint32)},jspb.BinaryReader.prototype.readPackedFixed64=function(){return this.readPackedField_(this.decoder_.readUint64)},jspb.BinaryReader.prototype.readPackedFixed64String=function(){return this.readPackedField_(this.decoder_.readUint64String)},jspb.BinaryReader.prototype.readPackedSfixed32=function(){return this.readPackedField_(this.decoder_.readInt32)},jspb.BinaryReader.prototype.readPackedSfixed64=function(){return this.readPackedField_(this.decoder_.readInt64)},jspb.BinaryReader.prototype.readPackedSfixed64String=function(){return this.readPackedField_(this.decoder_.readInt64String)},jspb.BinaryReader.prototype.readPackedFloat=function(){return this.readPackedField_(this.decoder_.readFloat)},jspb.BinaryReader.prototype.readPackedDouble=function(){return this.readPackedField_(this.decoder_.readDouble)},jspb.BinaryReader.prototype.readPackedBool=function(){return this.readPackedField_(this.decoder_.readBool)},jspb.BinaryReader.prototype.readPackedEnum=function(){return this.readPackedField_(this.decoder_.readEnum)},jspb.BinaryReader.prototype.readPackedVarintHash64=function(){return this.readPackedField_(this.decoder_.readVarintHash64)},jspb.BinaryReader.prototype.readPackedFixedHash64=function(){return this.readPackedField_(this.decoder_.readFixedHash64)},jspb.BinaryEncoder=function(){this.buffer_=[]},jspb.BinaryEncoder.prototype.length=function(){return this.buffer_.length},jspb.BinaryEncoder.prototype.end=function(){var t=this.buffer_;return this.buffer_=[],t},jspb.BinaryEncoder.prototype.writeSplitVarint64=function(t,e){for(goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(e==Math.floor(e)),goog.asserts.assert(0<=t&&t<jspb.BinaryConstants.TWO_TO_32),goog.asserts.assert(0<=e&&e<jspb.BinaryConstants.TWO_TO_32);0<e||127<t;)this.buffer_.push(127&t|128),t=(t>>>7|e<<25)>>>0,e>>>=7;this.buffer_.push(t)},jspb.BinaryEncoder.prototype.writeSplitFixed64=function(t,e){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(e==Math.floor(e)),goog.asserts.assert(0<=t&&t<jspb.BinaryConstants.TWO_TO_32),goog.asserts.assert(0<=e&&e<jspb.BinaryConstants.TWO_TO_32),this.writeUint32(t),this.writeUint32(e)},jspb.BinaryEncoder.prototype.writeUnsignedVarint32=function(t){for(goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(0<=t&&t<jspb.BinaryConstants.TWO_TO_32);127<t;)this.buffer_.push(127&t|128),t>>>=7;this.buffer_.push(t)},jspb.BinaryEncoder.prototype.writeSignedVarint32=function(t){if(goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(t>=-jspb.BinaryConstants.TWO_TO_31&&t<jspb.BinaryConstants.TWO_TO_31),0<=t)this.writeUnsignedVarint32(t);else{for(var e=0;9>e;e++)this.buffer_.push(127&t|128),t>>=7;this.buffer_.push(1)}},jspb.BinaryEncoder.prototype.writeUnsignedVarint64=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(0<=t&&t<jspb.BinaryConstants.TWO_TO_64),jspb.utils.splitInt64(t),this.writeSplitVarint64(jspb.utils.split64Low,jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeSignedVarint64=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(t>=-jspb.BinaryConstants.TWO_TO_63&&t<jspb.BinaryConstants.TWO_TO_63),jspb.utils.splitInt64(t),this.writeSplitVarint64(jspb.utils.split64Low,jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeZigzagVarint32=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(t>=-jspb.BinaryConstants.TWO_TO_31&&t<jspb.BinaryConstants.TWO_TO_31),this.writeUnsignedVarint32((t<<1^t>>31)>>>0)},jspb.BinaryEncoder.prototype.writeZigzagVarint64=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(t>=-jspb.BinaryConstants.TWO_TO_63&&t<jspb.BinaryConstants.TWO_TO_63),jspb.utils.splitZigzag64(t),this.writeSplitVarint64(jspb.utils.split64Low,jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeZigzagVarint64String=function(t){this.writeZigzagVarintHash64(jspb.utils.decimalStringToHash64(t))},jspb.BinaryEncoder.prototype.writeZigzagVarintHash64=function(t){var e=this;jspb.utils.splitHash64(t),jspb.utils.toZigzag64(jspb.utils.split64Low,jspb.utils.split64High,(function(t,r){e.writeSplitVarint64(t>>>0,r>>>0)}))},jspb.BinaryEncoder.prototype.writeUint8=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(0<=t&&256>t),this.buffer_.push(t>>>0&255)},jspb.BinaryEncoder.prototype.writeUint16=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(0<=t&&65536>t),this.buffer_.push(t>>>0&255),this.buffer_.push(t>>>8&255)},jspb.BinaryEncoder.prototype.writeUint32=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(0<=t&&t<jspb.BinaryConstants.TWO_TO_32),this.buffer_.push(t>>>0&255),this.buffer_.push(t>>>8&255),this.buffer_.push(t>>>16&255),this.buffer_.push(t>>>24&255)},jspb.BinaryEncoder.prototype.writeUint64=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(0<=t&&t<jspb.BinaryConstants.TWO_TO_64),jspb.utils.splitUint64(t),this.writeUint32(jspb.utils.split64Low),this.writeUint32(jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeInt8=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(-128<=t&&128>t),this.buffer_.push(t>>>0&255)},jspb.BinaryEncoder.prototype.writeInt16=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(-32768<=t&&32768>t),this.buffer_.push(t>>>0&255),this.buffer_.push(t>>>8&255)},jspb.BinaryEncoder.prototype.writeInt32=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(t>=-jspb.BinaryConstants.TWO_TO_31&&t<jspb.BinaryConstants.TWO_TO_31),this.buffer_.push(t>>>0&255),this.buffer_.push(t>>>8&255),this.buffer_.push(t>>>16&255),this.buffer_.push(t>>>24&255)},jspb.BinaryEncoder.prototype.writeInt64=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(t>=-jspb.BinaryConstants.TWO_TO_63&&t<jspb.BinaryConstants.TWO_TO_63),jspb.utils.splitInt64(t),this.writeSplitFixed64(jspb.utils.split64Low,jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeInt64String=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(+t>=-jspb.BinaryConstants.TWO_TO_63&&+t<jspb.BinaryConstants.TWO_TO_63),jspb.utils.splitHash64(jspb.utils.decimalStringToHash64(t)),this.writeSplitFixed64(jspb.utils.split64Low,jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeFloat=function(t){goog.asserts.assert(1/0===t||-1/0===t||isNaN(t)||t>=-jspb.BinaryConstants.FLOAT32_MAX&&t<=jspb.BinaryConstants.FLOAT32_MAX),jspb.utils.splitFloat32(t),this.writeUint32(jspb.utils.split64Low)},jspb.BinaryEncoder.prototype.writeDouble=function(t){goog.asserts.assert(1/0===t||-1/0===t||isNaN(t)||t>=-jspb.BinaryConstants.FLOAT64_MAX&&t<=jspb.BinaryConstants.FLOAT64_MAX),jspb.utils.splitFloat64(t),this.writeUint32(jspb.utils.split64Low),this.writeUint32(jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeBool=function(t){goog.asserts.assert("boolean"==typeof t||"number"==typeof t),this.buffer_.push(t?1:0)},jspb.BinaryEncoder.prototype.writeEnum=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(t>=-jspb.BinaryConstants.TWO_TO_31&&t<jspb.BinaryConstants.TWO_TO_31),this.writeSignedVarint32(t)},jspb.BinaryEncoder.prototype.writeBytes=function(t){this.buffer_.push.apply(this.buffer_,t)},jspb.BinaryEncoder.prototype.writeVarintHash64=function(t){jspb.utils.splitHash64(t),this.writeSplitVarint64(jspb.utils.split64Low,jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeFixedHash64=function(t){jspb.utils.splitHash64(t),this.writeUint32(jspb.utils.split64Low),this.writeUint32(jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeString=function(t){for(var e=this.buffer_.length,r=0;r<t.length;r++){var n=t.charCodeAt(r);if(128>n)this.buffer_.push(n);else if(2048>n)this.buffer_.push(n>>6|192),this.buffer_.push(63&n|128);else if(65536>n)if(55296<=n&&56319>=n&&r+1<t.length){var i=t.charCodeAt(r+1);56320<=i&&57343>=i&&(n=1024*(n-55296)+i-56320+65536,this.buffer_.push(n>>18|240),this.buffer_.push(n>>12&63|128),this.buffer_.push(n>>6&63|128),this.buffer_.push(63&n|128),r++)}else this.buffer_.push(n>>12|224),this.buffer_.push(n>>6&63|128),this.buffer_.push(63&n|128)}return this.buffer_.length-e},jspb.arith={},jspb.arith.UInt64=function(t,e){this.lo=t,this.hi=e},jspb.arith.UInt64.prototype.cmp=function(t){return this.hi<t.hi||this.hi==t.hi&&this.lo<t.lo?-1:this.hi==t.hi&&this.lo==t.lo?0:1},jspb.arith.UInt64.prototype.rightShift=function(){return new jspb.arith.UInt64((this.lo>>>1|(1&this.hi)<<31)>>>0,this.hi>>>1>>>0)},jspb.arith.UInt64.prototype.leftShift=function(){return new jspb.arith.UInt64(this.lo<<1>>>0,(this.hi<<1|this.lo>>>31)>>>0)},jspb.arith.UInt64.prototype.msb=function(){return!!(2147483648&this.hi)},jspb.arith.UInt64.prototype.lsb=function(){return!!(1&this.lo)},jspb.arith.UInt64.prototype.zero=function(){return 0==this.lo&&0==this.hi},jspb.arith.UInt64.prototype.add=function(t){return new jspb.arith.UInt64((this.lo+t.lo&4294967295)>>>0>>>0,((this.hi+t.hi&4294967295)>>>0)+(4294967296<=this.lo+t.lo?1:0)>>>0)},jspb.arith.UInt64.prototype.sub=function(t){return new jspb.arith.UInt64((this.lo-t.lo&4294967295)>>>0>>>0,((this.hi-t.hi&4294967295)>>>0)-(0>this.lo-t.lo?1:0)>>>0)},jspb.arith.UInt64.mul32x32=function(t,e){var r=65535&t,n=65535&e,i=e>>>16;for(e=r*n+65536*(r*i&65535)+65536*((t>>>=16)*n&65535),r=t*i+(r*i>>>16)+(t*n>>>16);4294967296<=e;)e-=4294967296,r+=1;return new jspb.arith.UInt64(e>>>0,r>>>0)},jspb.arith.UInt64.prototype.mul=function(t){var e=jspb.arith.UInt64.mul32x32(this.lo,t);return(t=jspb.arith.UInt64.mul32x32(this.hi,t)).hi=t.lo,t.lo=0,e.add(t)},jspb.arith.UInt64.prototype.div=function(t){if(0==t)return[];var e=new jspb.arith.UInt64(0,0),r=new jspb.arith.UInt64(this.lo,this.hi);t=new jspb.arith.UInt64(t,0);for(var n=new jspb.arith.UInt64(1,0);!t.msb();)t=t.leftShift(),n=n.leftShift();for(;!n.zero();)0>=t.cmp(r)&&(e=e.add(n),r=r.sub(t)),t=t.rightShift(),n=n.rightShift();return[e,r]},jspb.arith.UInt64.prototype.toString=function(){for(var t="",e=this;!e.zero();){var r=(e=e.div(10))[0];t=e[1].lo+t,e=r}return""==t&&(t="0"),t},jspb.arith.UInt64.fromString=function(t){for(var e=new jspb.arith.UInt64(0,0),r=new jspb.arith.UInt64(0,0),n=0;n<t.length;n++){if("0">t[n]||"9"<t[n])return null;var i=parseInt(t[n],10);r.lo=i,e=e.mul(10).add(r)}return e},jspb.arith.UInt64.prototype.clone=function(){return new jspb.arith.UInt64(this.lo,this.hi)},jspb.arith.Int64=function(t,e){this.lo=t,this.hi=e},jspb.arith.Int64.prototype.add=function(t){return new jspb.arith.Int64((this.lo+t.lo&4294967295)>>>0>>>0,((this.hi+t.hi&4294967295)>>>0)+(4294967296<=this.lo+t.lo?1:0)>>>0)},jspb.arith.Int64.prototype.sub=function(t){return new jspb.arith.Int64((this.lo-t.lo&4294967295)>>>0>>>0,((this.hi-t.hi&4294967295)>>>0)-(0>this.lo-t.lo?1:0)>>>0)},jspb.arith.Int64.prototype.clone=function(){return new jspb.arith.Int64(this.lo,this.hi)},jspb.arith.Int64.prototype.toString=function(){var t=0!=(2147483648&this.hi),e=new jspb.arith.UInt64(this.lo,this.hi);return t&&(e=new jspb.arith.UInt64(0,0).sub(e)),(t?"-":"")+e.toString()},jspb.arith.Int64.fromString=function(t){var e=0<t.length&&"-"==t[0];return e&&(t=t.substring(1)),null===(t=jspb.arith.UInt64.fromString(t))?null:(e&&(t=new jspb.arith.UInt64(0,0).sub(t)),new jspb.arith.Int64(t.lo,t.hi))},jspb.BinaryWriter=function(){this.blocks_=[],this.totalLength_=0,this.encoder_=new jspb.BinaryEncoder,this.bookmarks_=[]},jspb.BinaryWriter.prototype.appendUint8Array_=function(t){var e=this.encoder_.end();this.blocks_.push(e),this.blocks_.push(t),this.totalLength_+=e.length+t.length},jspb.BinaryWriter.prototype.beginDelimited_=function(t){return this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),t=this.encoder_.end(),this.blocks_.push(t),this.totalLength_+=t.length,t.push(this.totalLength_),t},jspb.BinaryWriter.prototype.endDelimited_=function(t){var e=t.pop();for(e=this.totalLength_+this.encoder_.length()-e,goog.asserts.assert(0<=e);127<e;)t.push(127&e|128),e>>>=7,this.totalLength_++;t.push(e),this.totalLength_++},jspb.BinaryWriter.prototype.writeSerializedMessage=function(t,e,r){this.appendUint8Array_(t.subarray(e,r))},jspb.BinaryWriter.prototype.maybeWriteSerializedMessage=function(t,e,r){null!=t&&null!=e&&null!=r&&this.writeSerializedMessage(t,e,r)},jspb.BinaryWriter.prototype.reset=function(){this.blocks_=[],this.encoder_.end(),this.totalLength_=0,this.bookmarks_=[]},jspb.BinaryWriter.prototype.getResultBuffer=function(){goog.asserts.assert(0==this.bookmarks_.length);for(var t=new Uint8Array(this.totalLength_+this.encoder_.length()),e=this.blocks_,r=e.length,n=0,i=0;i<r;i++){var o=e[i];t.set(o,n),n+=o.length}return e=this.encoder_.end(),t.set(e,n),n+=e.length,goog.asserts.assert(n==t.length),this.blocks_=[t],t},jspb.BinaryWriter.prototype.getResultBase64String=function(t){return goog.crypt.base64.encodeByteArray(this.getResultBuffer(),t)},jspb.BinaryWriter.prototype.beginSubMessage=function(t){this.bookmarks_.push(this.beginDelimited_(t))},jspb.BinaryWriter.prototype.endSubMessage=function(){goog.asserts.assert(0<=this.bookmarks_.length),this.endDelimited_(this.bookmarks_.pop())},jspb.BinaryWriter.prototype.writeFieldHeader_=function(t,e){goog.asserts.assert(1<=t&&t==Math.floor(t)),this.encoder_.writeUnsignedVarint32(8*t+e)},jspb.BinaryWriter.prototype.writeAny=function(t,e,r){var n=jspb.BinaryConstants.FieldType;switch(t){case n.DOUBLE:this.writeDouble(e,r);break;case n.FLOAT:this.writeFloat(e,r);break;case n.INT64:this.writeInt64(e,r);break;case n.UINT64:this.writeUint64(e,r);break;case n.INT32:this.writeInt32(e,r);break;case n.FIXED64:this.writeFixed64(e,r);break;case n.FIXED32:this.writeFixed32(e,r);break;case n.BOOL:this.writeBool(e,r);break;case n.STRING:this.writeString(e,r);break;case n.GROUP:goog.asserts.fail("Group field type not supported in writeAny()");break;case n.MESSAGE:goog.asserts.fail("Message field type not supported in writeAny()");break;case n.BYTES:this.writeBytes(e,r);break;case n.UINT32:this.writeUint32(e,r);break;case n.ENUM:this.writeEnum(e,r);break;case n.SFIXED32:this.writeSfixed32(e,r);break;case n.SFIXED64:this.writeSfixed64(e,r);break;case n.SINT32:this.writeSint32(e,r);break;case n.SINT64:this.writeSint64(e,r);break;case n.FHASH64:this.writeFixedHash64(e,r);break;case n.VHASH64:this.writeVarintHash64(e,r);break;default:goog.asserts.fail("Invalid field type in writeAny()")}},jspb.BinaryWriter.prototype.writeUnsignedVarint32_=function(t,e){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeUnsignedVarint32(e))},jspb.BinaryWriter.prototype.writeSignedVarint32_=function(t,e){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeSignedVarint32(e))},jspb.BinaryWriter.prototype.writeUnsignedVarint64_=function(t,e){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeUnsignedVarint64(e))},jspb.BinaryWriter.prototype.writeSignedVarint64_=function(t,e){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeSignedVarint64(e))},jspb.BinaryWriter.prototype.writeZigzagVarint32_=function(t,e){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeZigzagVarint32(e))},jspb.BinaryWriter.prototype.writeZigzagVarint64_=function(t,e){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeZigzagVarint64(e))},jspb.BinaryWriter.prototype.writeZigzagVarint64String_=function(t,e){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeZigzagVarint64String(e))},jspb.BinaryWriter.prototype.writeZigzagVarintHash64_=function(t,e){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeZigzagVarintHash64(e))},jspb.BinaryWriter.prototype.writeInt32=function(t,e){null!=e&&(goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&e<jspb.BinaryConstants.TWO_TO_31),this.writeSignedVarint32_(t,e))},jspb.BinaryWriter.prototype.writeInt32String=function(t,e){null!=e&&(e=parseInt(e,10),goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&e<jspb.BinaryConstants.TWO_TO_31),this.writeSignedVarint32_(t,e))},jspb.BinaryWriter.prototype.writeInt64=function(t,e){null!=e&&(goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_63&&e<jspb.BinaryConstants.TWO_TO_63),this.writeSignedVarint64_(t,e))},jspb.BinaryWriter.prototype.writeInt64String=function(t,e){null!=e&&(e=jspb.arith.Int64.fromString(e),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeSplitVarint64(e.lo,e.hi))},jspb.BinaryWriter.prototype.writeUint32=function(t,e){null!=e&&(goog.asserts.assert(0<=e&&e<jspb.BinaryConstants.TWO_TO_32),this.writeUnsignedVarint32_(t,e))},jspb.BinaryWriter.prototype.writeUint32String=function(t,e){null!=e&&(e=parseInt(e,10),goog.asserts.assert(0<=e&&e<jspb.BinaryConstants.TWO_TO_32),this.writeUnsignedVarint32_(t,e))},jspb.BinaryWriter.prototype.writeUint64=function(t,e){null!=e&&(goog.asserts.assert(0<=e&&e<jspb.BinaryConstants.TWO_TO_64),this.writeUnsignedVarint64_(t,e))},jspb.BinaryWriter.prototype.writeUint64String=function(t,e){null!=e&&(e=jspb.arith.UInt64.fromString(e),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeSplitVarint64(e.lo,e.hi))},jspb.BinaryWriter.prototype.writeSint32=function(t,e){null!=e&&(goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&e<jspb.BinaryConstants.TWO_TO_31),this.writeZigzagVarint32_(t,e))},jspb.BinaryWriter.prototype.writeSint64=function(t,e){null!=e&&(goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_63&&e<jspb.BinaryConstants.TWO_TO_63),this.writeZigzagVarint64_(t,e))},jspb.BinaryWriter.prototype.writeSintHash64=function(t,e){null!=e&&this.writeZigzagVarintHash64_(t,e)},jspb.BinaryWriter.prototype.writeSint64String=function(t,e){null!=e&&this.writeZigzagVarint64String_(t,e)},jspb.BinaryWriter.prototype.writeFixed32=function(t,e){null!=e&&(goog.asserts.assert(0<=e&&e<jspb.BinaryConstants.TWO_TO_32),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.FIXED32),this.encoder_.writeUint32(e))},jspb.BinaryWriter.prototype.writeFixed64=function(t,e){null!=e&&(goog.asserts.assert(0<=e&&e<jspb.BinaryConstants.TWO_TO_64),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.FIXED64),this.encoder_.writeUint64(e))},jspb.BinaryWriter.prototype.writeFixed64String=function(t,e){null!=e&&(e=jspb.arith.UInt64.fromString(e),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.FIXED64),this.encoder_.writeSplitFixed64(e.lo,e.hi))},jspb.BinaryWriter.prototype.writeSfixed32=function(t,e){null!=e&&(goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&e<jspb.BinaryConstants.TWO_TO_31),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.FIXED32),this.encoder_.writeInt32(e))},jspb.BinaryWriter.prototype.writeSfixed64=function(t,e){null!=e&&(goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_63&&e<jspb.BinaryConstants.TWO_TO_63),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.FIXED64),this.encoder_.writeInt64(e))},jspb.BinaryWriter.prototype.writeSfixed64String=function(t,e){null!=e&&(e=jspb.arith.Int64.fromString(e),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.FIXED64),this.encoder_.writeSplitFixed64(e.lo,e.hi))},jspb.BinaryWriter.prototype.writeFloat=function(t,e){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.FIXED32),this.encoder_.writeFloat(e))},jspb.BinaryWriter.prototype.writeDouble=function(t,e){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.FIXED64),this.encoder_.writeDouble(e))},jspb.BinaryWriter.prototype.writeBool=function(t,e){null!=e&&(goog.asserts.assert("boolean"==typeof e||"number"==typeof e),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeBool(e))},jspb.BinaryWriter.prototype.writeEnum=function(t,e){null!=e&&(goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&e<jspb.BinaryConstants.TWO_TO_31),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeSignedVarint32(e))},jspb.BinaryWriter.prototype.writeString=function(t,e){null!=e&&(t=this.beginDelimited_(t),this.encoder_.writeString(e),this.endDelimited_(t))},jspb.BinaryWriter.prototype.writeBytes=function(t,e){null!=e&&(e=jspb.utils.byteSourceToUint8Array(e),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(e.length),this.appendUint8Array_(e))},jspb.BinaryWriter.prototype.writeMessage=function(t,e,r){null!=e&&(t=this.beginDelimited_(t),r(e,this),this.endDelimited_(t))},jspb.BinaryWriter.prototype.writeMessageSet=function(t,e,r){null!=e&&(this.writeFieldHeader_(1,jspb.BinaryConstants.WireType.START_GROUP),this.writeFieldHeader_(2,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeSignedVarint32(t),t=this.beginDelimited_(3),r(e,this),this.endDelimited_(t),this.writeFieldHeader_(1,jspb.BinaryConstants.WireType.END_GROUP))},jspb.BinaryWriter.prototype.writeGroup=function(t,e,r){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.START_GROUP),r(e,this),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.END_GROUP))},jspb.BinaryWriter.prototype.writeFixedHash64=function(t,e){null!=e&&(goog.asserts.assert(8==e.length),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.FIXED64),this.encoder_.writeFixedHash64(e))},jspb.BinaryWriter.prototype.writeVarintHash64=function(t,e){null!=e&&(goog.asserts.assert(8==e.length),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeVarintHash64(e))},jspb.BinaryWriter.prototype.writeSplitFixed64=function(t,e,r){this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.FIXED64),this.encoder_.writeSplitFixed64(e,r)},jspb.BinaryWriter.prototype.writeSplitVarint64=function(t,e,r){this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeSplitVarint64(e,r)},jspb.BinaryWriter.prototype.writeSplitZigzagVarint64=function(t,e,r){this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT);var n=this.encoder_;jspb.utils.toZigzag64(e,r,(function(t,e){n.writeSplitVarint64(t>>>0,e>>>0)}))},jspb.BinaryWriter.prototype.writeRepeatedInt32=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeSignedVarint32_(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedInt32String=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeInt32String(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedInt64=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeSignedVarint64_(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedSplitFixed64=function(t,e,r,n){if(null!=e)for(var i=0;i<e.length;i++)this.writeSplitFixed64(t,r(e[i]),n(e[i]))},jspb.BinaryWriter.prototype.writeRepeatedSplitVarint64=function(t,e,r,n){if(null!=e)for(var i=0;i<e.length;i++)this.writeSplitVarint64(t,r(e[i]),n(e[i]))},jspb.BinaryWriter.prototype.writeRepeatedSplitZigzagVarint64=function(t,e,r,n){if(null!=e)for(var i=0;i<e.length;i++)this.writeSplitZigzagVarint64(t,r(e[i]),n(e[i]))},jspb.BinaryWriter.prototype.writeRepeatedInt64String=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeInt64String(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedUint32=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeUnsignedVarint32_(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedUint32String=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeUint32String(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedUint64=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeUnsignedVarint64_(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedUint64String=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeUint64String(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedSint32=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeZigzagVarint32_(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedSint64=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeZigzagVarint64_(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedSint64String=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeZigzagVarint64String_(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedSintHash64=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeZigzagVarintHash64_(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedFixed32=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeFixed32(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedFixed64=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeFixed64(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedFixed64String=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeFixed64String(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedSfixed32=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeSfixed32(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedSfixed64=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeSfixed64(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedSfixed64String=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeSfixed64String(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedFloat=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeFloat(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedDouble=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeDouble(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedBool=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeBool(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedEnum=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeEnum(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedString=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeString(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedBytes=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeBytes(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedMessage=function(t,e,r){if(null!=e)for(var n=0;n<e.length;n++){var i=this.beginDelimited_(t);r(e[n],this),this.endDelimited_(i)}},jspb.BinaryWriter.prototype.writeRepeatedGroup=function(t,e,r){if(null!=e)for(var n=0;n<e.length;n++)this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.START_GROUP),r(e[n],this),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.END_GROUP)},jspb.BinaryWriter.prototype.writeRepeatedFixedHash64=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeFixedHash64(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedVarintHash64=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeVarintHash64(t,e[r])},jspb.BinaryWriter.prototype.writePackedInt32=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeSignedVarint32(e[r]);this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedInt32String=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeSignedVarint32(parseInt(e[r],10));this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedInt64=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeSignedVarint64(e[r]);this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedSplitFixed64=function(t,e,r,n){if(null!=e){t=this.beginDelimited_(t);for(var i=0;i<e.length;i++)this.encoder_.writeSplitFixed64(r(e[i]),n(e[i]));this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedSplitVarint64=function(t,e,r,n){if(null!=e){t=this.beginDelimited_(t);for(var i=0;i<e.length;i++)this.encoder_.writeSplitVarint64(r(e[i]),n(e[i]));this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedSplitZigzagVarint64=function(t,e,r,n){if(null!=e){t=this.beginDelimited_(t);for(var i=this.encoder_,o=0;o<e.length;o++)jspb.utils.toZigzag64(r(e[o]),n(e[o]),(function(t,e){i.writeSplitVarint64(t>>>0,e>>>0)}));this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedInt64String=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++){var n=jspb.arith.Int64.fromString(e[r]);this.encoder_.writeSplitVarint64(n.lo,n.hi)}this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedUint32=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeUnsignedVarint32(e[r]);this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedUint32String=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeUnsignedVarint32(parseInt(e[r],10));this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedUint64=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeUnsignedVarint64(e[r]);this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedUint64String=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++){var n=jspb.arith.UInt64.fromString(e[r]);this.encoder_.writeSplitVarint64(n.lo,n.hi)}this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedSint32=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeZigzagVarint32(e[r]);this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedSint64=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeZigzagVarint64(e[r]);this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedSint64String=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeZigzagVarintHash64(jspb.utils.decimalStringToHash64(e[r]));this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedSintHash64=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeZigzagVarintHash64(e[r]);this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedFixed32=function(t,e){if(null!=e&&e.length)for(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(4*e.length),t=0;t<e.length;t++)this.encoder_.writeUint32(e[t])},jspb.BinaryWriter.prototype.writePackedFixed64=function(t,e){if(null!=e&&e.length)for(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(8*e.length),t=0;t<e.length;t++)this.encoder_.writeUint64(e[t])},jspb.BinaryWriter.prototype.writePackedFixed64String=function(t,e){if(null!=e&&e.length)for(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(8*e.length),t=0;t<e.length;t++){var r=jspb.arith.UInt64.fromString(e[t]);this.encoder_.writeSplitFixed64(r.lo,r.hi)}},jspb.BinaryWriter.prototype.writePackedSfixed32=function(t,e){if(null!=e&&e.length)for(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(4*e.length),t=0;t<e.length;t++)this.encoder_.writeInt32(e[t])},jspb.BinaryWriter.prototype.writePackedSfixed64=function(t,e){if(null!=e&&e.length)for(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(8*e.length),t=0;t<e.length;t++)this.encoder_.writeInt64(e[t])},jspb.BinaryWriter.prototype.writePackedSfixed64String=function(t,e){if(null!=e&&e.length)for(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(8*e.length),t=0;t<e.length;t++)this.encoder_.writeInt64String(e[t])},jspb.BinaryWriter.prototype.writePackedFloat=function(t,e){if(null!=e&&e.length)for(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(4*e.length),t=0;t<e.length;t++)this.encoder_.writeFloat(e[t])},jspb.BinaryWriter.prototype.writePackedDouble=function(t,e){if(null!=e&&e.length)for(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(8*e.length),t=0;t<e.length;t++)this.encoder_.writeDouble(e[t])},jspb.BinaryWriter.prototype.writePackedBool=function(t,e){if(null!=e&&e.length)for(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(e.length),t=0;t<e.length;t++)this.encoder_.writeBool(e[t])},jspb.BinaryWriter.prototype.writePackedEnum=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeEnum(e[r]);this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedFixedHash64=function(t,e){if(null!=e&&e.length)for(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(8*e.length),t=0;t<e.length;t++)this.encoder_.writeFixedHash64(e[t])},jspb.BinaryWriter.prototype.writePackedVarintHash64=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeVarintHash64(e[r]);this.endDelimited_(t)}},jspb.Map=function(t,e){this.arr_=t,this.valueCtor_=e,this.map_={},this.arrClean=!0,0<this.arr_.length&&this.loadFromArray_()},jspb.Map.prototype.loadFromArray_=function(){for(var t=0;t<this.arr_.length;t++){var e=this.arr_[t],r=e[0];this.map_[r.toString()]=new jspb.Map.Entry_(r,e[1])}this.arrClean=!0},jspb.Map.prototype.toArray=function(){if(this.arrClean){if(this.valueCtor_){var t,e=this.map_;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var r=e[t].valueWrapper;r&&r.toArray()}}}else{for(this.arr_.length=0,(e=this.stringKeys_()).sort(),t=0;t<e.length;t++){var n=this.map_[e[t]];(r=n.valueWrapper)&&r.toArray(),this.arr_.push([n.key,n.value])}this.arrClean=!0}return this.arr_},jspb.Map.prototype.toObject=function(t,e){for(var r=this.toArray(),n=[],i=0;i<r.length;i++){var o=this.map_[r[i][0].toString()];this.wrapEntry_(o);var a=o.valueWrapper;a?(goog.asserts.assert(e),n.push([o.key,e(t,a)])):n.push([o.key,o.value])}return n},jspb.Map.fromObject=function(t,e,r){e=new jspb.Map([],e);for(var n=0;n<t.length;n++){var i=t[n][0],o=r(t[n][1]);e.set(i,o)}return e},jspb.Map.ArrayIteratorIterable_=function(t){this.idx_=0,this.arr_=t},jspb.Map.ArrayIteratorIterable_.prototype.next=function(){return this.idx_<this.arr_.length?{done:!1,value:this.arr_[this.idx_++]}:{done:!0,value:void 0}},"undefined"!=typeof Symbol&&(jspb.Map.ArrayIteratorIterable_.prototype[Symbol.iterator]=function(){return this}),jspb.Map.prototype.getLength=function(){return this.stringKeys_().length},jspb.Map.prototype.clear=function(){this.map_={},this.arrClean=!1},jspb.Map.prototype.del=function(t){t=t.toString();var e=this.map_.hasOwnProperty(t);return delete this.map_[t],this.arrClean=!1,e},jspb.Map.prototype.getEntryList=function(){var t=[],e=this.stringKeys_();e.sort();for(var r=0;r<e.length;r++){var n=this.map_[e[r]];t.push([n.key,n.value])}return t},jspb.Map.prototype.entries=function(){var t=[],e=this.stringKeys_();e.sort();for(var r=0;r<e.length;r++){var n=this.map_[e[r]];t.push([n.key,this.wrapEntry_(n)])}return new jspb.Map.ArrayIteratorIterable_(t)},jspb.Map.prototype.keys=function(){var t=[],e=this.stringKeys_();e.sort();for(var r=0;r<e.length;r++)t.push(this.map_[e[r]].key);return new jspb.Map.ArrayIteratorIterable_(t)},jspb.Map.prototype.values=function(){var t=[],e=this.stringKeys_();e.sort();for(var r=0;r<e.length;r++)t.push(this.wrapEntry_(this.map_[e[r]]));return new jspb.Map.ArrayIteratorIterable_(t)},jspb.Map.prototype.forEach=function(t,e){var r=this.stringKeys_();r.sort();for(var n=0;n<r.length;n++){var i=this.map_[r[n]];t.call(e,this.wrapEntry_(i),i.key,this)}},jspb.Map.prototype.set=function(t,e){var r=new jspb.Map.Entry_(t);return this.valueCtor_?(r.valueWrapper=e,r.value=e.toArray()):r.value=e,this.map_[t.toString()]=r,this.arrClean=!1,this},jspb.Map.prototype.wrapEntry_=function(t){return this.valueCtor_?(t.valueWrapper||(t.valueWrapper=new this.valueCtor_(t.value)),t.valueWrapper):t.value},jspb.Map.prototype.get=function(t){if(t=this.map_[t.toString()])return this.wrapEntry_(t)},jspb.Map.prototype.has=function(t){return t.toString()in this.map_},jspb.Map.prototype.serializeBinary=function(t,e,r,n,i){var o=this.stringKeys_();o.sort();for(var a=0;a<o.length;a++){var s=this.map_[o[a]];e.beginSubMessage(t),r.call(e,1,s.key),this.valueCtor_?n.call(e,2,this.wrapEntry_(s),i):n.call(e,2,s.value),e.endSubMessage()}},jspb.Map.deserializeBinary=function(t,e,r,n,i,o,a){for(;e.nextField()&&!e.isEndGroup();){var s=e.getFieldNumber();1==s?o=r.call(e):2==s&&(t.valueCtor_?(goog.asserts.assert(i),a||(a=new t.valueCtor_),n.call(e,a,i)):a=n.call(e))}goog.asserts.assert(null!=o),goog.asserts.assert(null!=a),t.set(o,a)},jspb.Map.prototype.stringKeys_=function(){var t,e=this.map_,r=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.push(t);return r},jspb.Map.Entry_=function(t,e){this.key=t,this.value=e,this.valueWrapper=void 0},jspb.ExtensionFieldInfo=function(t,e,r,n,i){this.fieldIndex=t,this.fieldName=e,this.ctor=r,this.toObjectFn=n,this.isRepeated=i},jspb.ExtensionFieldBinaryInfo=function(t,e,r,n,i,o){this.fieldInfo=t,this.binaryReaderFn=e,this.binaryWriterFn=r,this.binaryMessageSerializeFn=n,this.binaryMessageDeserializeFn=i,this.isPacked=o},jspb.ExtensionFieldInfo.prototype.isMessageType=function(){return!!this.ctor},jspb.Message=function(){},jspb.Message.GENERATE_TO_OBJECT=!0,jspb.Message.GENERATE_FROM_OBJECT=!goog.DISALLOW_TEST_ONLY_CODE,jspb.Message.GENERATE_TO_STRING=!0,jspb.Message.ASSUME_LOCAL_ARRAYS=!1,jspb.Message.SERIALIZE_EMPTY_TRAILING_FIELDS=!0,jspb.Message.SUPPORTS_UINT8ARRAY_="function"==typeof Uint8Array,jspb.Message.prototype.getJsPbMessageId=function(){return this.messageId_},jspb.Message.getIndex_=function(t,e){return e+t.arrayIndexOffset_},jspb.Message.hiddenES6Property_=function(){},jspb.Message.getFieldNumber_=function(t,e){return e-t.arrayIndexOffset_},jspb.Message.initialize=function(t,e,r,n,i,o){if(t.wrappers_=null,e||(e=r?[r]:[]),t.messageId_=r?String(r):void 0,t.arrayIndexOffset_=0===r?-1:0,t.array=e,jspb.Message.initPivotAndExtensionObject_(t,n),t.convertedPrimitiveFields_={},jspb.Message.SERIALIZE_EMPTY_TRAILING_FIELDS||(t.repeatedFields=i),i)for(e=0;e<i.length;e++)(r=i[e])<t.pivot_?(r=jspb.Message.getIndex_(t,r),t.array[r]=t.array[r]||jspb.Message.EMPTY_LIST_SENTINEL_):(jspb.Message.maybeInitEmptyExtensionObject_(t),t.extensionObject_[r]=t.extensionObject_[r]||jspb.Message.EMPTY_LIST_SENTINEL_);if(o&&o.length)for(e=0;e<o.length;e++)jspb.Message.computeOneofCase(t,o[e])},jspb.Message.EMPTY_LIST_SENTINEL_=goog.DEBUG&&Object.freeze?Object.freeze([]):[],jspb.Message.isArray_=function(t){return jspb.Message.ASSUME_LOCAL_ARRAYS?t instanceof Array:Array.isArray(t)},jspb.Message.isExtensionObject_=function(t){return!(null===t||"object"!=typeof t||jspb.Message.isArray_(t)||jspb.Message.SUPPORTS_UINT8ARRAY_&&t instanceof Uint8Array)},jspb.Message.initPivotAndExtensionObject_=function(t,e){var r=t.array.length,n=-1;if(r&&(n=r-1,r=t.array[n],jspb.Message.isExtensionObject_(r)))return t.pivot_=jspb.Message.getFieldNumber_(t,n),void(t.extensionObject_=r);-1<e?(t.pivot_=Math.max(e,jspb.Message.getFieldNumber_(t,n+1)),t.extensionObject_=null):t.pivot_=Number.MAX_VALUE},jspb.Message.maybeInitEmptyExtensionObject_=function(t){var e=jspb.Message.getIndex_(t,t.pivot_);t.array[e]||(t.extensionObject_=t.array[e]={})},jspb.Message.toObjectList=function(t,e,r){for(var n=[],i=0;i<t.length;i++)n[i]=e.call(t[i],r,t[i]);return n},jspb.Message.toObjectExtension=function(t,e,r,n,i){for(var o in r){var a=r[o],s=n.call(t,a);if(null!=s){for(var u in a.fieldName)if(a.fieldName.hasOwnProperty(u))break;e[u]=a.toObjectFn?a.isRepeated?jspb.Message.toObjectList(s,a.toObjectFn,i):a.toObjectFn(i,s):s}}},jspb.Message.serializeBinaryExtensions=function(t,e,r,n){for(var i in r){var o=r[i],a=o.fieldInfo;if(!o.binaryWriterFn)throw Error("Message extension present that was generated without binary serialization support");var s=n.call(t,a);if(null!=s)if(a.isMessageType()){if(!o.binaryMessageSerializeFn)throw Error("Message extension present holding submessage without binary support enabled, and message is being serialized to binary format");o.binaryWriterFn.call(e,a.fieldIndex,s,o.binaryMessageSerializeFn)}else o.binaryWriterFn.call(e,a.fieldIndex,s)}},jspb.Message.readBinaryExtension=function(t,e,r,n,i){var o=r[e.getFieldNumber()];if(o){if(r=o.fieldInfo,!o.binaryReaderFn)throw Error("Deserializing extension whose generated code does not support binary format");if(r.isMessageType()){var a=new r.ctor;o.binaryReaderFn.call(e,a,o.binaryMessageDeserializeFn)}else a=o.binaryReaderFn.call(e);r.isRepeated&&!o.isPacked?(e=n.call(t,r))?e.push(a):i.call(t,r,[a]):i.call(t,r,a)}else e.skipField()},jspb.Message.getField=function(t,e){if(e<t.pivot_){e=jspb.Message.getIndex_(t,e);var r=t.array[e];return r===jspb.Message.EMPTY_LIST_SENTINEL_?t.array[e]=[]:r}if(t.extensionObject_)return(r=t.extensionObject_[e])===jspb.Message.EMPTY_LIST_SENTINEL_?t.extensionObject_[e]=[]:r},jspb.Message.getRepeatedField=function(t,e){return jspb.Message.getField(t,e)},jspb.Message.getOptionalFloatingPointField=function(t,e){return null==(t=jspb.Message.getField(t,e))?t:+t},jspb.Message.getBooleanField=function(t,e){return null==(t=jspb.Message.getField(t,e))?t:!!t},jspb.Message.getRepeatedFloatingPointField=function(t,e){var r=jspb.Message.getRepeatedField(t,e);if(t.convertedPrimitiveFields_||(t.convertedPrimitiveFields_={}),!t.convertedPrimitiveFields_[e]){for(var n=0;n<r.length;n++)r[n]=+r[n];t.convertedPrimitiveFields_[e]=!0}return r},jspb.Message.getRepeatedBooleanField=function(t,e){var r=jspb.Message.getRepeatedField(t,e);if(t.convertedPrimitiveFields_||(t.convertedPrimitiveFields_={}),!t.convertedPrimitiveFields_[e]){for(var n=0;n<r.length;n++)r[n]=!!r[n];t.convertedPrimitiveFields_[e]=!0}return r},jspb.Message.bytesAsB64=function(t){return null==t||"string"==typeof t?t:jspb.Message.SUPPORTS_UINT8ARRAY_&&t instanceof Uint8Array?goog.crypt.base64.encodeByteArray(t):(goog.asserts.fail("Cannot coerce to b64 string: "+goog.typeOf(t)),null)},jspb.Message.bytesAsU8=function(t){return null==t||t instanceof Uint8Array?t:"string"==typeof t?goog.crypt.base64.decodeStringToUint8Array(t):(goog.asserts.fail("Cannot coerce to Uint8Array: "+goog.typeOf(t)),null)},jspb.Message.bytesListAsB64=function(t){return jspb.Message.assertConsistentTypes_(t),t.length&&"string"!=typeof t[0]?goog.array.map(t,jspb.Message.bytesAsB64):t},jspb.Message.bytesListAsU8=function(t){return jspb.Message.assertConsistentTypes_(t),!t.length||t[0]instanceof Uint8Array?t:goog.array.map(t,jspb.Message.bytesAsU8)},jspb.Message.assertConsistentTypes_=function(t){if(goog.DEBUG&&t&&1<t.length){var e=goog.typeOf(t[0]);goog.array.forEach(t,(function(t){goog.typeOf(t)!=e&&goog.asserts.fail("Inconsistent type in JSPB repeated field array. Got "+goog.typeOf(t)+" expected "+e)}))}},jspb.Message.getFieldWithDefault=function(t,e,r){return null==(t=jspb.Message.getField(t,e))?r:t},jspb.Message.getBooleanFieldWithDefault=function(t,e,r){return null==(t=jspb.Message.getBooleanField(t,e))?r:t},jspb.Message.getFloatingPointFieldWithDefault=function(t,e,r){return null==(t=jspb.Message.getOptionalFloatingPointField(t,e))?r:t},jspb.Message.getFieldProto3=jspb.Message.getFieldWithDefault,jspb.Message.getMapField=function(t,e,r,n){if(t.wrappers_||(t.wrappers_={}),e in t.wrappers_)return t.wrappers_[e];var i=jspb.Message.getField(t,e);if(!i){if(r)return;i=[],jspb.Message.setField(t,e,i)}return t.wrappers_[e]=new jspb.Map(i,n)},jspb.Message.setField=function(t,e,r){return goog.asserts.assertInstanceof(t,jspb.Message),e<t.pivot_?t.array[jspb.Message.getIndex_(t,e)]=r:(jspb.Message.maybeInitEmptyExtensionObject_(t),t.extensionObject_[e]=r),t},jspb.Message.setProto3IntField=function(t,e,r){return jspb.Message.setFieldIgnoringDefault_(t,e,r,0)},jspb.Message.setProto3FloatField=function(t,e,r){return jspb.Message.setFieldIgnoringDefault_(t,e,r,0)},jspb.Message.setProto3BooleanField=function(t,e,r){return jspb.Message.setFieldIgnoringDefault_(t,e,r,!1)},jspb.Message.setProto3StringField=function(t,e,r){return jspb.Message.setFieldIgnoringDefault_(t,e,r,"")},jspb.Message.setProto3BytesField=function(t,e,r){return jspb.Message.setFieldIgnoringDefault_(t,e,r,"")},jspb.Message.setProto3EnumField=function(t,e,r){return jspb.Message.setFieldIgnoringDefault_(t,e,r,0)},jspb.Message.setProto3StringIntField=function(t,e,r){return jspb.Message.setFieldIgnoringDefault_(t,e,r,"0")},jspb.Message.setFieldIgnoringDefault_=function(t,e,r,n){return goog.asserts.assertInstanceof(t,jspb.Message),r!==n?jspb.Message.setField(t,e,r):e<t.pivot_?t.array[jspb.Message.getIndex_(t,e)]=null:(jspb.Message.maybeInitEmptyExtensionObject_(t),delete t.extensionObject_[e]),t},jspb.Message.addToRepeatedField=function(t,e,r,n){return goog.asserts.assertInstanceof(t,jspb.Message),e=jspb.Message.getRepeatedField(t,e),null!=n?e.splice(n,0,r):e.push(r),t},jspb.Message.setOneofField=function(t,e,r,n){return goog.asserts.assertInstanceof(t,jspb.Message),(r=jspb.Message.computeOneofCase(t,r))&&r!==e&&void 0!==n&&(t.wrappers_&&r in t.wrappers_&&(t.wrappers_[r]=void 0),jspb.Message.setField(t,r,void 0)),jspb.Message.setField(t,e,n)},jspb.Message.computeOneofCase=function(t,e){for(var r,n,i=0;i<e.length;i++){var o=e[i],a=jspb.Message.getField(t,o);null!=a&&(r=o,n=a,jspb.Message.setField(t,o,void 0))}return r?(jspb.Message.setField(t,r,n),r):0},jspb.Message.getWrapperField=function(t,e,r,n){if(t.wrappers_||(t.wrappers_={}),!t.wrappers_[r]){var i=jspb.Message.getField(t,r);(n||i)&&(t.wrappers_[r]=new e(i))}return t.wrappers_[r]},jspb.Message.getRepeatedWrapperField=function(t,e,r){return jspb.Message.wrapRepeatedField_(t,e,r),(e=t.wrappers_[r])==jspb.Message.EMPTY_LIST_SENTINEL_&&(e=t.wrappers_[r]=[]),e},jspb.Message.wrapRepeatedField_=function(t,e,r){if(t.wrappers_||(t.wrappers_={}),!t.wrappers_[r]){for(var n=jspb.Message.getRepeatedField(t,r),i=[],o=0;o<n.length;o++)i[o]=new e(n[o]);t.wrappers_[r]=i}},jspb.Message.setWrapperField=function(t,e,r){goog.asserts.assertInstanceof(t,jspb.Message),t.wrappers_||(t.wrappers_={});var n=r?r.toArray():r;return t.wrappers_[e]=r,jspb.Message.setField(t,e,n)},jspb.Message.setOneofWrapperField=function(t,e,r,n){goog.asserts.assertInstanceof(t,jspb.Message),t.wrappers_||(t.wrappers_={});var i=n?n.toArray():n;return t.wrappers_[e]=n,jspb.Message.setOneofField(t,e,r,i)},jspb.Message.setRepeatedWrapperField=function(t,e,r){goog.asserts.assertInstanceof(t,jspb.Message),t.wrappers_||(t.wrappers_={}),r=r||[];for(var n=[],i=0;i<r.length;i++)n[i]=r[i].toArray();return t.wrappers_[e]=r,jspb.Message.setField(t,e,n)},jspb.Message.addToRepeatedWrapperField=function(t,e,r,n,i){jspb.Message.wrapRepeatedField_(t,n,e);var o=t.wrappers_[e];return o||(o=t.wrappers_[e]=[]),r=r||new n,t=jspb.Message.getRepeatedField(t,e),null!=i?(o.splice(i,0,r),t.splice(i,0,r.toArray())):(o.push(r),t.push(r.toArray())),r},jspb.Message.toMap=function(t,e,r,n){for(var i={},o=0;o<t.length;o++)i[e.call(t[o])]=r?r.call(t[o],n,t[o]):t[o];return i},jspb.Message.prototype.syncMapFields_=function(){if(this.wrappers_)for(var t in this.wrappers_){var e=this.wrappers_[t];if(Array.isArray(e))for(var r=0;r<e.length;r++)e[r]&&e[r].toArray();else e&&e.toArray()}},jspb.Message.prototype.toArray=function(){return this.syncMapFields_(),this.array},jspb.Message.GENERATE_TO_STRING&&(jspb.Message.prototype.toString=function(){return this.syncMapFields_(),this.array.toString()}),jspb.Message.prototype.getExtension=function(t){if(this.extensionObject_){this.wrappers_||(this.wrappers_={});var e=t.fieldIndex;if(t.isRepeated){if(t.isMessageType())return this.wrappers_[e]||(this.wrappers_[e]=goog.array.map(this.extensionObject_[e]||[],(function(e){return new t.ctor(e)}))),this.wrappers_[e]}else if(t.isMessageType())return!this.wrappers_[e]&&this.extensionObject_[e]&&(this.wrappers_[e]=new t.ctor(this.extensionObject_[e])),this.wrappers_[e];return this.extensionObject_[e]}},jspb.Message.prototype.setExtension=function(t,e){this.wrappers_||(this.wrappers_={}),jspb.Message.maybeInitEmptyExtensionObject_(this);var r=t.fieldIndex;return t.isRepeated?(e=e||[],t.isMessageType()?(this.wrappers_[r]=e,this.extensionObject_[r]=goog.array.map(e,(function(t){return t.toArray()}))):this.extensionObject_[r]=e):t.isMessageType()?(this.wrappers_[r]=e,this.extensionObject_[r]=e?e.toArray():e):this.extensionObject_[r]=e,this},jspb.Message.difference=function(t,e){if(!(t instanceof e.constructor))throw Error("Messages have different types.");var r=t.toArray();e=e.toArray();var n=[],i=0,o=r.length>e.length?r.length:e.length;for(t.getJsPbMessageId()&&(n[0]=t.getJsPbMessageId(),i=1);i<o;i++)jspb.Message.compareFields(r[i],e[i])||(n[i]=e[i]);return new t.constructor(n)},jspb.Message.equals=function(t,e){return t==e||!(!t||!e)&&t instanceof e.constructor&&jspb.Message.compareFields(t.toArray(),e.toArray())},jspb.Message.compareExtensions=function(t,e){t=t||{},e=e||{};var r,n={};for(r in t)n[r]=0;for(r in e)n[r]=0;for(r in n)if(!jspb.Message.compareFields(t[r],e[r]))return!1;return!0},jspb.Message.compareFields=function(t,e){if(t==e)return!0;if(!goog.isObject(t)||!goog.isObject(e))return!!("number"==typeof t&&isNaN(t)||"number"==typeof e&&isNaN(e))&&String(t)==String(e);if(t.constructor!=e.constructor)return!1;if(jspb.Message.SUPPORTS_UINT8ARRAY_&&t.constructor===Uint8Array){if(t.length!=e.length)return!1;for(var r=0;r<t.length;r++)if(t[r]!=e[r])return!1;return!0}if(t.constructor===Array){var n=void 0,i=void 0,o=Math.max(t.length,e.length);for(r=0;r<o;r++){var a=t[r],s=e[r];if(a&&a.constructor==Object&&(goog.asserts.assert(void 0===n),goog.asserts.assert(r===t.length-1),n=a,a=void 0),s&&s.constructor==Object&&(goog.asserts.assert(void 0===i),goog.asserts.assert(r===e.length-1),i=s,s=void 0),!jspb.Message.compareFields(a,s))return!1}return!n&&!i||(n=n||{},i=i||{},jspb.Message.compareExtensions(n,i))}if(t.constructor===Object)return jspb.Message.compareExtensions(t,e);throw Error("Invalid type in JSPB array")},jspb.Message.prototype.cloneMessage=function(){return jspb.Message.cloneMessage(this)},jspb.Message.prototype.clone=function(){return jspb.Message.cloneMessage(this)},jspb.Message.clone=function(t){return jspb.Message.cloneMessage(t)},jspb.Message.cloneMessage=function(t){return new t.constructor(jspb.Message.clone_(t.toArray()))},jspb.Message.copyInto=function(t,e){goog.asserts.assertInstanceof(t,jspb.Message),goog.asserts.assertInstanceof(e,jspb.Message),goog.asserts.assert(t.constructor==e.constructor,"Copy source and target message should have the same type."),t=jspb.Message.clone(t);for(var r=e.toArray(),n=t.toArray(),i=r.length=0;i<n.length;i++)r[i]=n[i];e.wrappers_=t.wrappers_,e.extensionObject_=t.extensionObject_},jspb.Message.clone_=function(t){if(Array.isArray(t)){for(var e=Array(t.length),r=0;r<t.length;r++){var n=t[r];null!=n&&(e[r]="object"==typeof n?jspb.Message.clone_(goog.asserts.assert(n)):n)}return e}if(jspb.Message.SUPPORTS_UINT8ARRAY_&&t instanceof Uint8Array)return new Uint8Array(t);for(r in e={},t)null!=(n=t[r])&&(e[r]="object"==typeof n?jspb.Message.clone_(goog.asserts.assert(n)):n);return e},jspb.Message.registerMessageType=function(t,e){e.messageId=t},jspb.Message.messageSetExtensions={},jspb.Message.messageSetExtensionsBinary={},jspb.Export={},exports.Map=jspb.Map,exports.Message=jspb.Message,exports.BinaryReader=jspb.BinaryReader,exports.BinaryWriter=jspb.BinaryWriter,exports.ExtensionFieldInfo=jspb.ExtensionFieldInfo,exports.ExtensionFieldBinaryInfo=jspb.ExtensionFieldBinaryInfo,exports.exportSymbol=goog.exportSymbol,exports.inherits=goog.inherits,exports.object={extend:goog.object.extend},exports.typeOf=goog.typeOf}).call(this,__webpack_require__(33),__webpack_require__(16).Buffer)},function(t,e,r){(function(e,n){const{Transform:o}=r(68),a=e.from([239,187,191]);class s extends o{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super({writableObjectMode:!0,...t});const e={};let r;for(let r in t)e[f(r)]=t[r];if(r=this.normalize(e))throw r;switch(e.record_delimiter){case"auto":e.record_delimiter=null;break;case"unix":e.record_delimiter="\n";break;case"mac":e.record_delimiter="\r";break;case"windows":e.record_delimiter="\r\n";break;case"ascii":e.record_delimiter="";break;case"unicode":e.record_delimiter="\u2028"}this.options=e,this.state={stop:!1},this.info={records:0}}normalize(t){if(void 0===t.bom||null===t.bom||!1===t.bom)t.bom=!1;else if(!0!==t.bom)return new c("CSV_OPTION_BOOLEAN_INVALID_TYPE",["option `bom` is optional and must be a boolean value,","got "+JSON.stringify(t.bom)]);if(void 0===t.delimiter||null===t.delimiter)t.delimiter=",";else if(e.isBuffer(t.delimiter))t.delimiter=t.delimiter.toString();else if("string"!=typeof t.delimiter)return new c("CSV_OPTION_DELIMITER_INVALID_TYPE",["option `delimiter` must be a buffer or a string,","got "+JSON.stringify(t.delimiter)]);if(void 0===t.quote||null===t.quote)t.quote='"';else if(!0===t.quote)t.quote='"';else if(!1===t.quote)t.quote="";else if(e.isBuffer(t.quote))t.quote=t.quote.toString();else if("string"!=typeof t.quote)return new c("CSV_OPTION_QUOTE_INVALID_TYPE",["option `quote` must be a boolean, a buffer or a string,","got "+JSON.stringify(t.quote)]);if(void 0!==t.quoted&&null!==t.quoted||(t.quoted=!1),void 0!==t.quoted_empty&&null!==t.quoted_empty||(t.quoted_empty=void 0),void 0===t.quoted_match||null===t.quoted_match||!1===t.quoted_match?t.quoted_match=null:Array.isArray(t.quoted_match)||(t.quoted_match=[t.quoted_match]),t.quoted_match)for(let e of t.quoted_match){const t=e instanceof RegExp;if(!("string"==typeof e)&&!t)return Error("Invalid Option: quoted_match must be a string or a regex, got "+JSON.stringify(e))}if(void 0!==t.quoted_string&&null!==t.quoted_string||(t.quoted_string=!1),void 0!==t.eof&&null!==t.eof||(t.eof=!0),void 0===t.escape||null===t.escape)t.escape='"';else if(e.isBuffer(t.escape))t.escape=t.escape.toString();else if("string"!=typeof t.escape)return Error("Invalid Option: escape must be a buffer or a string, got "+JSON.stringify(t.escape));if(t.escape.length>1)return Error(`Invalid Option: escape must be one character, got ${t.escape.length} characters`);if(void 0!==t.header&&null!==t.header||(t.header=!1),t.columns=this.normalize_columns(t.columns),void 0!==t.quoted&&null!==t.quoted||(t.quoted=!1),void 0!==t.cast&&null!==t.cast||(t.cast={}),void 0!==t.cast.bigint&&null!==t.cast.bigint||(t.cast.bigint=t=>""+t),void 0!==t.cast.boolean&&null!==t.cast.boolean||(t.cast.boolean=t=>t?"1":""),void 0!==t.cast.date&&null!==t.cast.date||(t.cast.date=t=>""+t.getTime()),void 0!==t.cast.number&&null!==t.cast.number||(t.cast.number=t=>""+t),void 0!==t.cast.object&&null!==t.cast.object||(t.cast.object=t=>JSON.stringify(t)),void 0!==t.cast.string&&null!==t.cast.string||(t.cast.string=function(t){return t}),void 0===t.record_delimiter||null===t.record_delimiter)t.record_delimiter="\n";else if(e.isBuffer(t.record_delimiter))t.record_delimiter=t.record_delimiter.toString();else if("string"!=typeof t.record_delimiter)return Error("Invalid Option: record_delimiter must be a buffer or a string, got "+JSON.stringify(t.record_delimiter))}_transform(t,e,r){if(!0===this.state.stop)return;if(!Array.isArray(t)&&"object"!=typeof t)return this.state.stop=!0,r(Error("Invalid Record: expect an array or an object, got "+JSON.stringify(t)));if(0===this.info.records)if(Array.isArray(t)){if(!0===this.options.header&&!this.options.columns)return this.state.stop=!0,r(Error("Undiscoverable Columns: header option requires column option or object records"))}else void 0!==this.options.columns&&null!==this.options.columns||(this.options.columns=this.normalize_columns(Object.keys(t)));0===this.info.records&&(this.bom(),this.headers());try{this.emit("record",t,this.info.records)}catch(t){return this.state.stop=!0,this.emit("error",t)}let n;if(this.options.eof){if(n=this.stringify(t),void 0===n)return;n+=this.options.record_delimiter}else{if(n=this.stringify(t),void 0===n)return;(this.options.header||this.info.records)&&(n=this.options.record_delimiter+n)}this.info.records++,this.push(n),r()}_flush(t){0===this.info.records&&(this.bom(),this.headers()),t()}stringify(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("object"!=typeof t)return t;const{columns:r,header:n}=this.options,o=[];if(Array.isArray(t)){r&&t.splice(r.length);for(let r=0;r<t.length;r++){const n=t[r],[i,a]=this.__cast(n,{index:r,column:r,records:this.info.records,header:e});if(i)return void this.emit("error",i);o[r]=[a,n]}}else if(r)for(let n=0;n<r.length;n++){const i=v(t,r[n].key),[a,s]=this.__cast(i,{index:n,column:r[n].key,records:this.info.records,header:e});if(a)return void this.emit("error",a);o[n]=[s,i]}else for(let n of t){const a=t[n],[s,u]=this.__cast(a,{index:i,column:r[i].key,records:this.info.records,header:e});if(s)return void this.emit("error",s);o.push([u,a])}let a="";for(let t=0;t<o.length;t++){let e,r,[n,i]=o[t];if("string"==typeof n)e=this.options;else if(l(n)){if(e=n,n=e.value,delete e.value,"string"!=typeof n&&null!=n)return void this.emit("error",Error("Invalid Casting Value: returned value must return a string, null or undefined, got "+JSON.stringify(n)));if(e={...this.options,...e},r=this.normalize(e))return void this.emit("error",r)}else{if(null!=n)return void this.emit("error",Error("Invalid Casting Value: returned value must return a string, an object, null or undefined, got "+JSON.stringify(n)));e=this.options}const{delimiter:s,escape:u,quote:c,quoted:f,quoted_empty:d,quoted_string:h,quoted_match:g,record_delimiter:p}=e;if(n){if("string"!=typeof n)return this.emit("error",Error("Formatter must return a string, null or undefined, got "+JSON.stringify(n))),null;const t=s.length&&n.indexOf(s)>=0,e=""!==c&&n.indexOf(c)>=0,r=n.indexOf(u)>=0&&u!==c,o=n.indexOf(p)>=0,l=h&&"string"==typeof i;let d=g&&g.filter(t=>"string"==typeof t?-1!==n.indexOf(t):t.test(n));d=d&&d.length>0;const m=!0===e||t||o||f||l||d;if(!0===m&&!0===r){const t="\\"===u?new RegExp(u+u,"g"):new RegExp(u,"g");n=n.replace(t,u+u)}if(!0===e){const t=new RegExp(c,"g");n=n.replace(t,u+c)}!0===m&&(n=c+n+c),a+=n}else(!0===d||""===i&&!0===h&&!1!==d)&&(a+=c+c);t!==o.length-1&&(a+=s)}return a}bom(){!0===this.options.bom&&this.push(a)}headers(){if(!1===this.options.header)return;if(void 0===this.options.columns)return;let t=this.options.columns.map(t=>t.header);t=this.options.eof?this.stringify(t,!0)+this.options.record_delimiter:this.stringify(t),this.push(t)}__cast(t,e){const r=typeof t;try{return"string"===r?[void 0,this.options.cast.string(t,e)]:"bigint"===r?[void 0,this.options.cast.bigint(t,e)]:"number"===r?[void 0,this.options.cast.number(t,e)]:"boolean"===r?[void 0,this.options.cast.boolean(t,e)]:t instanceof Date?[void 0,this.options.cast.date(t,e)]:"object"===r&&null!==t?[void 0,this.options.cast.object(t,e)]:[void 0,t,t]}catch(t){return[t]}}normalize_columns(t){if(null!=t){if("object"!=typeof t)throw Error('Invalid option "columns": expect an array or an object');if(Array.isArray(t)){const e=[];for(let r of t)if("string"==typeof r)e.push({key:r,header:r});else{if("object"!=typeof r||void 0===r||Array.isArray(r))throw Error("Invalid column definition: expect a string or an object");if(!r.key)throw Error('Invalid column definition: property "key" is required');void 0===r.header&&(r.header=r.key),e.push(r)}t=e}else{const e=[];for(let r in t)e.push({key:r,header:t[r]});t=e}return t}}}const u=function(){let t,e,r;for(let n in arguments){const i=arguments[n],o=typeof i;if(void 0===t&&Array.isArray(i))t=i;else if(void 0===e&&l(i))e=i;else{if(void 0!==r||"function"!==o)throw new c("CSV_INVALID_ARGUMENT",["Invalid argument:",`got ${JSON.stringify(i)} at index ${n}`]);r=i}}const i=new s(e);if(r){const t=[];i.on("readable",(function(){let e;for(;null!==(e=this.read());)t.push(e)})),i.on("error",(function(t){r(t)})),i.on("end",(function(){r(void 0,t.join(""))}))}if(void 0!==t)if("function"==typeof n)n((function(){for(let e of t)i.write(e);i.end()}));else{for(let e of t)i.write(e);i.end()}return i};class c extends Error{constructor(t,r){Array.isArray(r)&&(r=r.join(" ")),super(r),void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,c),this.code=t;for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];for(const t of i)for(const r in t){const n=t[r];this[r]=e.isBuffer(n)?n.toString():null==n?n:JSON.parse(JSON.stringify(n))}}}u.Stringifier=s,u.CsvError=c,t.exports=u;const l=function(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)},f=function(t){return t.replace(/([A-Z])/g,(function(t,e){return"_"+e.toLowerCase()}))},d=".".charCodeAt(0),h=/\\(\\)?/g,g=RegExp("[^.[\\]]+|\\[(?:([^\"'][^[]*)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))","g"),p=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,m=/^\w*$/,y=function(t){const e=typeof t;return"symbol"===e||"object"===e&&t&&"[object Symbol]"===function(t){return Object.prototype.toString.call(t)}(t)},b=function(t,e){return Array.isArray(t)?t:function(t,e){if(Array.isArray(t))return!1;const r=typeof t;return!("number"!==r&&"symbol"!==r&&"boolean"!==r&&t&&!y(t))||(m.test(t)||!p.test(t)||null!=e&&t in Object(e))}(t,e)?[t]:function(t){const e=[];return t.charCodeAt(0)===d&&e.push(""),t.replace(g,(function(t,r,n,i){let o=t;n?o=i.replace(h,"$1"):r&&(o=r.trim()),e.push(o)})),e}(t)},_=function(t){if("string"==typeof t||y(t))return t;const e=""+t;return"0"==e&&1/t==-INFINITY?"-0":e},v=function(t,e){let r=0;const n=(e=b(e,t)).length;for(;null!=t&&r<n;)t=t[_(e[r++])];return r&&r===n?t:void 0}}).call(this,r(16).Buffer,r(99).setImmediate)},function(t,e,r){const n=r(389);t.exports={parse:function(t){const[e,r]=t.split("<OFX>",2);return{headers:n.parseHeaders(e),body:n.parseBody(r)}},serialize:function(t,e){return n.serializeHeaders(t)+n.serializeBody(e)}}},function(t,e,r){const n=r(390);function i(t){return n.xml2js(t,{compact:!0,spaces:4,ignoreComment:!0,elementNameFn(t){switch(t){case"INTUBID":return"INTU.BID";case"INTUUSERID":return"INTU.USERID";default:return t}}})}t.exports={parseHeaders:function(t){const e=t.split(/\r?\n/).map(t=>t.split(/:/,2)),r={};return e.forEach(t=>{t[0]&&Object.assign(r,{[t[0]]:t[1]})}),r},parseBody:function(t){try{return i("<OFX>"+t)}catch(e){return i(("<OFX>"+t).replace(/>\s+</g,"><").replace(/\s+</g,"<").replace(/>\s+/g,">").replace(/<([A-Z0-9_]*)+\.+([A-Z0-9_]*)>([^<]+)(<\/\1\.\2>)?/g,"<$1$2>$3").replace(/<(\w+?)>([^<]+)/g,"<$1>$2</<added>$1>").replace(/<\/<added>(\w+?)>(<\/\1>)?/g,"</$1>"))}},serializeHeaders:function(t){let e="";return Object.entries(t).forEach(t=>{e+=`${t[0]}:${t[1]}\n`}),e+="\n",e},serializeBody:function(t){return n.js2xml(t,{compact:!0,ignoreComment:!0,spaces:2})}}},function(t,e,r){var n=r(214),i=r(392),o=r(215),a=r(393);t.exports={xml2js:n,xml2json:i,js2xml:o,json2xml:a}},function(t,e,r){(function(t){!function(e){e.parser=function(t,e){return new o(t,e)},e.SAXParser=o,e.SAXStream=s,e.createStream=function(t,e){return new s(t,e)},e.MAX_BUFFER_LENGTH=65536;var n,i=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function o(t,r){if(!(this instanceof o))return new o(t,r);!function(t){for(var e=0,r=i.length;e<r;e++)t[i[e]]=""}(this),this.q=this.c="",this.bufferCheckPosition=e.MAX_BUFFER_LENGTH,this.opt=r||{},this.opt.lowercase=this.opt.lowercase||this.opt.lowercasetags,this.looseCase=this.opt.lowercase?"toLowerCase":"toUpperCase",this.tags=[],this.closed=this.closedRoot=this.sawRoot=!1,this.tag=this.error=null,this.strict=!!t,this.noscript=!(!t&&!this.opt.noscript),this.state=E.BEGIN,this.strictEntities=this.opt.strictEntities,this.ENTITIES=this.strictEntities?Object.create(e.XML_ENTITIES):Object.create(e.ENTITIES),this.attribList=[],this.opt.xmlns&&(this.ns=Object.create(c)),this.trackPosition=!1!==this.opt.position,this.trackPosition&&(this.position=this.line=this.column=0),O(this,"onready")}e.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(t){function e(){}return e.prototype=t,new e}),Object.keys||(Object.keys=function(t){var e=[];for(var r in t)t.hasOwnProperty(r)&&e.push(r);return e}),o.prototype={end:function(){R(this)},write:function(t){if(this.error)throw this.error;if(this.closed)return I(this,"Cannot write after close. Assign an onready handler.");if(null===t)return R(this);"object"==typeof t&&(t=t.toString());var r=0,n="";for(;n=U(t,r++),this.c=n,n;)switch(this.trackPosition&&(this.position++,"\n"===n?(this.line++,this.column=0):this.column++),this.state){case E.BEGIN:if(this.state=E.BEGIN_WHITESPACE,"\ufeff"===n)continue;B(this,n);continue;case E.BEGIN_WHITESPACE:B(this,n);continue;case E.TEXT:if(this.sawRoot&&!this.closedRoot){for(var o=r-1;n&&"<"!==n&&"&"!==n;)(n=U(t,r++))&&this.trackPosition&&(this.position++,"\n"===n?(this.line++,this.column=0):this.column++);this.textNode+=t.substring(o,r-1)}"<"!==n||this.sawRoot&&this.closedRoot&&!this.strict?(g(n)||this.sawRoot&&!this.closedRoot||N(this,"Text data outside of root node."),"&"===n?this.state=E.TEXT_ENTITY:this.textNode+=n):(this.state=E.OPEN_WAKA,this.startTagPosition=this.position);continue;case E.SCRIPT:"<"===n?this.state=E.SCRIPT_ENDING:this.script+=n;continue;case E.SCRIPT_ENDING:"/"===n?this.state=E.CLOSE_TAG:(this.script+="<"+n,this.state=E.SCRIPT);continue;case E.OPEN_WAKA:if("!"===n)this.state=E.SGML_DECL,this.sgmlDecl="";else if(g(n));else if(y(l,n))this.state=E.OPEN_TAG,this.tagName=n;else if("/"===n)this.state=E.CLOSE_TAG,this.tagName="";else if("?"===n)this.state=E.PROC_INST,this.procInstName=this.procInstBody="";else{if(N(this,"Unencoded <"),this.startTagPosition+1<this.position){var a=this.position-this.startTagPosition;n=new Array(a).join(" ")+n}this.textNode+="<"+n,this.state=E.TEXT}continue;case E.SGML_DECL:"[CDATA["===(this.sgmlDecl+n).toUpperCase()?(T(this,"onopencdata"),this.state=E.CDATA,this.sgmlDecl="",this.cdata=""):this.sgmlDecl+n==="--"?(this.state=E.COMMENT,this.comment="",this.sgmlDecl=""):"DOCTYPE"===(this.sgmlDecl+n).toUpperCase()?(this.state=E.DOCTYPE,(this.doctype||this.sawRoot)&&N(this,"Inappropriately located doctype declaration"),this.doctype="",this.sgmlDecl=""):">"===n?(T(this,"onsgmldeclaration",this.sgmlDecl),this.sgmlDecl="",this.state=E.TEXT):p(n)?(this.state=E.SGML_DECL_QUOTED,this.sgmlDecl+=n):this.sgmlDecl+=n;continue;case E.SGML_DECL_QUOTED:n===this.q&&(this.state=E.SGML_DECL,this.q=""),this.sgmlDecl+=n;continue;case E.DOCTYPE:">"===n?(this.state=E.TEXT,T(this,"ondoctype",this.doctype),this.doctype=!0):(this.doctype+=n,"["===n?this.state=E.DOCTYPE_DTD:p(n)&&(this.state=E.DOCTYPE_QUOTED,this.q=n));continue;case E.DOCTYPE_QUOTED:this.doctype+=n,n===this.q&&(this.q="",this.state=E.DOCTYPE);continue;case E.DOCTYPE_DTD:this.doctype+=n,"]"===n?this.state=E.DOCTYPE:p(n)&&(this.state=E.DOCTYPE_DTD_QUOTED,this.q=n);continue;case E.DOCTYPE_DTD_QUOTED:this.doctype+=n,n===this.q&&(this.state=E.DOCTYPE_DTD,this.q="");continue;case E.COMMENT:"-"===n?this.state=E.COMMENT_ENDING:this.comment+=n;continue;case E.COMMENT_ENDING:"-"===n?(this.state=E.COMMENT_ENDED,this.comment=M(this.opt,this.comment),this.comment&&T(this,"oncomment",this.comment),this.comment=""):(this.comment+="-"+n,this.state=E.COMMENT);continue;case E.COMMENT_ENDED:">"!==n?(N(this,"Malformed comment"),this.comment+="--"+n,this.state=E.COMMENT):this.state=E.TEXT;continue;case E.CDATA:"]"===n?this.state=E.CDATA_ENDING:this.cdata+=n;continue;case E.CDATA_ENDING:"]"===n?this.state=E.CDATA_ENDING_2:(this.cdata+="]"+n,this.state=E.CDATA);continue;case E.CDATA_ENDING_2:">"===n?(this.cdata&&T(this,"oncdata",this.cdata),T(this,"onclosecdata"),this.cdata="",this.state=E.TEXT):"]"===n?this.cdata+="]":(this.cdata+="]]"+n,this.state=E.CDATA);continue;case E.PROC_INST:"?"===n?this.state=E.PROC_INST_ENDING:g(n)?this.state=E.PROC_INST_BODY:this.procInstName+=n;continue;case E.PROC_INST_BODY:if(!this.procInstBody&&g(n))continue;"?"===n?this.state=E.PROC_INST_ENDING:this.procInstBody+=n;continue;case E.PROC_INST_ENDING:">"===n?(T(this,"onprocessinginstruction",{name:this.procInstName,body:this.procInstBody}),this.procInstName=this.procInstBody="",this.state=E.TEXT):(this.procInstBody+="?"+n,this.state=E.PROC_INST_BODY);continue;case E.OPEN_TAG:y(f,n)?this.tagName+=n:(k(this),">"===n?C(this):"/"===n?this.state=E.OPEN_TAG_SLASH:(g(n)||N(this,"Invalid character in tag name"),this.state=E.ATTRIB));continue;case E.OPEN_TAG_SLASH:">"===n?(C(this,!0),L(this)):(N(this,"Forward-slash in opening tag not followed by >"),this.state=E.ATTRIB);continue;case E.ATTRIB:if(g(n))continue;">"===n?C(this):"/"===n?this.state=E.OPEN_TAG_SLASH:y(l,n)?(this.attribName=n,this.attribValue="",this.state=E.ATTRIB_NAME):N(this,"Invalid attribute name");continue;case E.ATTRIB_NAME:"="===n?this.state=E.ATTRIB_VALUE:">"===n?(N(this,"Attribute without value"),this.attribValue=this.attribName,j(this),C(this)):g(n)?this.state=E.ATTRIB_NAME_SAW_WHITE:y(f,n)?this.attribName+=n:N(this,"Invalid attribute name");continue;case E.ATTRIB_NAME_SAW_WHITE:if("="===n)this.state=E.ATTRIB_VALUE;else{if(g(n))continue;N(this,"Attribute without value"),this.tag.attributes[this.attribName]="",this.attribValue="",T(this,"onattribute",{name:this.attribName,value:""}),this.attribName="",">"===n?C(this):y(l,n)?(this.attribName=n,this.state=E.ATTRIB_NAME):(N(this,"Invalid attribute name"),this.state=E.ATTRIB)}continue;case E.ATTRIB_VALUE:if(g(n))continue;p(n)?(this.q=n,this.state=E.ATTRIB_VALUE_QUOTED):(N(this,"Unquoted attribute value"),this.state=E.ATTRIB_VALUE_UNQUOTED,this.attribValue=n);continue;case E.ATTRIB_VALUE_QUOTED:if(n!==this.q){"&"===n?this.state=E.ATTRIB_VALUE_ENTITY_Q:this.attribValue+=n;continue}j(this),this.q="",this.state=E.ATTRIB_VALUE_CLOSED;continue;case E.ATTRIB_VALUE_CLOSED:g(n)?this.state=E.ATTRIB:">"===n?C(this):"/"===n?this.state=E.OPEN_TAG_SLASH:y(l,n)?(N(this,"No whitespace between attributes"),this.attribName=n,this.attribValue="",this.state=E.ATTRIB_NAME):N(this,"Invalid attribute name");continue;case E.ATTRIB_VALUE_UNQUOTED:if(!m(n)){"&"===n?this.state=E.ATTRIB_VALUE_ENTITY_U:this.attribValue+=n;continue}j(this),">"===n?C(this):this.state=E.ATTRIB;continue;case E.CLOSE_TAG:if(this.tagName)">"===n?L(this):y(f,n)?this.tagName+=n:this.script?(this.script+="</"+this.tagName,this.tagName="",this.state=E.SCRIPT):(g(n)||N(this,"Invalid tagname in closing tag"),this.state=E.CLOSE_TAG_SAW_WHITE);else{if(g(n))continue;b(l,n)?this.script?(this.script+="</"+n,this.state=E.SCRIPT):N(this,"Invalid tagname in closing tag."):this.tagName=n}continue;case E.CLOSE_TAG_SAW_WHITE:if(g(n))continue;">"===n?L(this):N(this,"Invalid characters in closing tag");continue;case E.TEXT_ENTITY:case E.ATTRIB_VALUE_ENTITY_Q:case E.ATTRIB_VALUE_ENTITY_U:var s,u;switch(this.state){case E.TEXT_ENTITY:s=E.TEXT,u="textNode";break;case E.ATTRIB_VALUE_ENTITY_Q:s=E.ATTRIB_VALUE_QUOTED,u="attribValue";break;case E.ATTRIB_VALUE_ENTITY_U:s=E.ATTRIB_VALUE_UNQUOTED,u="attribValue"}";"===n?(this[u]+=x(this),this.entity="",this.state=s):y(this.entity.length?h:d,n)?this.entity+=n:(N(this,"Invalid character in entity name"),this[u]+="&"+this.entity+n,this.entity="",this.state=s);continue;default:throw new Error(this,"Unknown state: "+this.state)}this.position>=this.bufferCheckPosition&&function(t){for(var r=Math.max(e.MAX_BUFFER_LENGTH,10),n=0,o=0,a=i.length;o<a;o++){var s=t[i[o]].length;if(s>r)switch(i[o]){case"textNode":A(t);break;case"cdata":T(t,"oncdata",t.cdata),t.cdata="";break;case"script":T(t,"onscript",t.script),t.script="";break;default:I(t,"Max buffer length exceeded: "+i[o])}n=Math.max(n,s)}var u=e.MAX_BUFFER_LENGTH-n;t.bufferCheckPosition=u+t.position}(this);return this}
|
|
24
|
+
/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var t;A(t=this),""!==t.cdata&&(T(t,"oncdata",t.cdata),t.cdata=""),""!==t.script&&(T(t,"onscript",t.script),t.script="")}};try{n=r(68).Stream}catch(t){n=function(){}}var a=e.EVENTS.filter((function(t){return"error"!==t&&"end"!==t}));function s(t,e){if(!(this instanceof s))return new s(t,e);n.apply(this),this._parser=new o(t,e),this.writable=!0,this.readable=!0;var r=this;this._parser.onend=function(){r.emit("end")},this._parser.onerror=function(t){r.emit("error",t),r._parser.error=null},this._decoder=null,a.forEach((function(t){Object.defineProperty(r,"on"+t,{get:function(){return r._parser["on"+t]},set:function(e){if(!e)return r.removeAllListeners(t),r._parser["on"+t]=e,e;r.on(t,e)},enumerable:!0,configurable:!1})}))}s.prototype=Object.create(n.prototype,{constructor:{value:s}}),s.prototype.write=function(e){if("function"==typeof t&&"function"==typeof t.isBuffer&&t.isBuffer(e)){if(!this._decoder){var n=r(55).StringDecoder;this._decoder=new n("utf8")}e=this._decoder.write(e)}return this._parser.write(e.toString()),this.emit("data",e),!0},s.prototype.end=function(t){return t&&t.length&&this.write(t),this._parser.end(),!0},s.prototype.on=function(t,e){var r=this;return r._parser["on"+t]||-1===a.indexOf(t)||(r._parser["on"+t]=function(){var e=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);e.splice(0,0,t),r.emit.apply(r,e)}),n.prototype.on.call(r,t,e)};var u="http://www.w3.org/XML/1998/namespace",c={xml:u,xmlns:"http://www.w3.org/2000/xmlns/"},l=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,f=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,d=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,h=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function g(t){return" "===t||"\n"===t||"\r"===t||"\t"===t}function p(t){return'"'===t||"'"===t}function m(t){return">"===t||g(t)}function y(t,e){return t.test(e)}function b(t,e){return!y(t,e)}var _,v,w,E=0;for(var S in e.STATE={BEGIN:E++,BEGIN_WHITESPACE:E++,TEXT:E++,TEXT_ENTITY:E++,OPEN_WAKA:E++,SGML_DECL:E++,SGML_DECL_QUOTED:E++,DOCTYPE:E++,DOCTYPE_QUOTED:E++,DOCTYPE_DTD:E++,DOCTYPE_DTD_QUOTED:E++,COMMENT_STARTING:E++,COMMENT:E++,COMMENT_ENDING:E++,COMMENT_ENDED:E++,CDATA:E++,CDATA_ENDING:E++,CDATA_ENDING_2:E++,PROC_INST:E++,PROC_INST_BODY:E++,PROC_INST_ENDING:E++,OPEN_TAG:E++,OPEN_TAG_SLASH:E++,ATTRIB:E++,ATTRIB_NAME:E++,ATTRIB_NAME_SAW_WHITE:E++,ATTRIB_VALUE:E++,ATTRIB_VALUE_QUOTED:E++,ATTRIB_VALUE_CLOSED:E++,ATTRIB_VALUE_UNQUOTED:E++,ATTRIB_VALUE_ENTITY_Q:E++,ATTRIB_VALUE_ENTITY_U:E++,CLOSE_TAG:E++,CLOSE_TAG_SAW_WHITE:E++,SCRIPT:E++,SCRIPT_ENDING:E++},e.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},e.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(e.ENTITIES).forEach((function(t){var r=e.ENTITIES[t],n="number"==typeof r?String.fromCharCode(r):r;e.ENTITIES[t]=n})),e.STATE)e.STATE[e.STATE[S]]=S;function O(t,e,r){t[e]&&t[e](r)}function T(t,e,r){t.textNode&&A(t),O(t,e,r)}function A(t){t.textNode=M(t.opt,t.textNode),t.textNode&&O(t,"ontext",t.textNode),t.textNode=""}function M(t,e){return t.trim&&(e=e.trim()),t.normalize&&(e=e.replace(/\s+/g," ")),e}function I(t,e){return A(t),t.trackPosition&&(e+="\nLine: "+t.line+"\nColumn: "+t.column+"\nChar: "+t.c),e=new Error(e),t.error=e,O(t,"onerror",e),t}function R(t){return t.sawRoot&&!t.closedRoot&&N(t,"Unclosed root tag"),t.state!==E.BEGIN&&t.state!==E.BEGIN_WHITESPACE&&t.state!==E.TEXT&&I(t,"Unexpected end"),A(t),t.c="",t.closed=!0,O(t,"onend"),o.call(t,t.strict,t.opt),t}function N(t,e){if("object"!=typeof t||!(t instanceof o))throw new Error("bad call to strictFail");t.strict&&I(t,e)}function k(t){t.strict||(t.tagName=t.tagName[t.looseCase]());var e=t.tags[t.tags.length-1]||t,r=t.tag={name:t.tagName,attributes:{}};t.opt.xmlns&&(r.ns=e.ns),t.attribList.length=0,T(t,"onopentagstart",r)}function D(t,e){var r=t.indexOf(":")<0?["",t]:t.split(":"),n=r[0],i=r[1];return e&&"xmlns"===t&&(n="xmlns",i=""),{prefix:n,local:i}}function j(t){if(t.strict||(t.attribName=t.attribName[t.looseCase]()),-1!==t.attribList.indexOf(t.attribName)||t.tag.attributes.hasOwnProperty(t.attribName))t.attribName=t.attribValue="";else{if(t.opt.xmlns){var e=D(t.attribName,!0),r=e.prefix,n=e.local;if("xmlns"===r)if("xml"===n&&t.attribValue!==u)N(t,"xml: prefix must be bound to "+u+"\nActual: "+t.attribValue);else if("xmlns"===n&&"http://www.w3.org/2000/xmlns/"!==t.attribValue)N(t,"xmlns: prefix must be bound to http://www.w3.org/2000/xmlns/\nActual: "+t.attribValue);else{var i=t.tag,o=t.tags[t.tags.length-1]||t;i.ns===o.ns&&(i.ns=Object.create(o.ns)),i.ns[n]=t.attribValue}t.attribList.push([t.attribName,t.attribValue])}else t.tag.attributes[t.attribName]=t.attribValue,T(t,"onattribute",{name:t.attribName,value:t.attribValue});t.attribName=t.attribValue=""}}function C(t,e){if(t.opt.xmlns){var r=t.tag,n=D(t.tagName);r.prefix=n.prefix,r.local=n.local,r.uri=r.ns[n.prefix]||"",r.prefix&&!r.uri&&(N(t,"Unbound namespace prefix: "+JSON.stringify(t.tagName)),r.uri=n.prefix);var i=t.tags[t.tags.length-1]||t;r.ns&&i.ns!==r.ns&&Object.keys(r.ns).forEach((function(e){T(t,"onopennamespace",{prefix:e,uri:r.ns[e]})}));for(var o=0,a=t.attribList.length;o<a;o++){var s=t.attribList[o],u=s[0],c=s[1],l=D(u,!0),f=l.prefix,d=l.local,h=""===f?"":r.ns[f]||"",g={name:u,value:c,prefix:f,local:d,uri:h};f&&"xmlns"!==f&&!h&&(N(t,"Unbound namespace prefix: "+JSON.stringify(f)),g.uri=f),t.tag.attributes[u]=g,T(t,"onattribute",g)}t.attribList.length=0}t.tag.isSelfClosing=!!e,t.sawRoot=!0,t.tags.push(t.tag),T(t,"onopentag",t.tag),e||(t.noscript||"script"!==t.tagName.toLowerCase()?t.state=E.TEXT:t.state=E.SCRIPT,t.tag=null,t.tagName=""),t.attribName=t.attribValue="",t.attribList.length=0}function L(t){if(!t.tagName)return N(t,"Weird empty close tag."),t.textNode+="</>",void(t.state=E.TEXT);if(t.script){if("script"!==t.tagName)return t.script+="</"+t.tagName+">",t.tagName="",void(t.state=E.SCRIPT);T(t,"onscript",t.script),t.script=""}var e=t.tags.length,r=t.tagName;t.strict||(r=r[t.looseCase]());for(var n=r;e--;){if(t.tags[e].name===n)break;N(t,"Unexpected close tag")}if(e<0)return N(t,"Unmatched closing tag: "+t.tagName),t.textNode+="</"+t.tagName+">",void(t.state=E.TEXT);t.tagName=r;for(var i=t.tags.length;i-- >e;){var o=t.tag=t.tags.pop();t.tagName=t.tag.name,T(t,"onclosetag",t.tagName);var a={};for(var s in o.ns)a[s]=o.ns[s];var u=t.tags[t.tags.length-1]||t;t.opt.xmlns&&o.ns!==u.ns&&Object.keys(o.ns).forEach((function(e){var r=o.ns[e];T(t,"onclosenamespace",{prefix:e,uri:r})}))}0===e&&(t.closedRoot=!0),t.tagName=t.attribValue=t.attribName="",t.attribList.length=0,t.state=E.TEXT}function x(t){var e,r=t.entity,n=r.toLowerCase(),i="";return t.ENTITIES[r]?t.ENTITIES[r]:t.ENTITIES[n]?t.ENTITIES[n]:("#"===(r=n).charAt(0)&&("x"===r.charAt(1)?(r=r.slice(2),i=(e=parseInt(r,16)).toString(16)):(r=r.slice(1),i=(e=parseInt(r,10)).toString(10))),r=r.replace(/^0+/,""),isNaN(e)||i.toLowerCase()!==r?(N(t,"Invalid character entity"),"&"+t.entity+";"):String.fromCodePoint(e))}function B(t,e){"<"===e?(t.state=E.OPEN_WAKA,t.startTagPosition=t.position):g(e)||(N(t,"Non-whitespace before first tag."),t.textNode=e,t.state=E.TEXT)}function U(t,e){var r="";return e<t.length&&(r=t.charAt(e)),r}E=e.STATE,String.fromCodePoint||(_=String.fromCharCode,v=Math.floor,w=function(){var t,e,r=16384,n=[],i=-1,o=arguments.length;if(!o)return"";for(var a="";++i<o;){var s=Number(arguments[i]);if(!isFinite(s)||s<0||s>1114111||v(s)!==s)throw RangeError("Invalid code point: "+s);s<=65535?n.push(s):(t=55296+((s-=65536)>>10),e=s%1024+56320,n.push(t,e)),(i+1===o||n.length>r)&&(a+=_.apply(null,n),n.length=0)}return a},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:w,configurable:!0,writable:!0}):String.fromCodePoint=w)}(e)}).call(this,r(16).Buffer)},function(t,e,r){var n=r(134),i=r(214);t.exports=function(t,e){var r,o,a;return r=function(t){var e=n.copyOptions(t);return n.ensureSpacesExists(e),e}(e),o=i(t,r),a="compact"in r&&r.compact?"_parent":"parent",("addParent"in r&&r.addParent?JSON.stringify(o,(function(t,e){return t===a?"_":e}),r.spaces):JSON.stringify(o,null,r.spaces)).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}},function(t,e,r){(function(e){var n=r(215);t.exports=function(t,r){t instanceof e&&(t=t.toString());var i=null;if("string"==typeof t)try{i=JSON.parse(t)}catch(t){throw new Error("The JSON structure is invalid")}else i=t;return n(i,r)}}).call(this,r(16).Buffer)},function(t,e,r){(function(e,n){const{Transform:i}=r(68),o=r(395),a={utf8:e.from([239,187,191]),utf16le:e.from([255,254])};class s extends i{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super({readableObjectMode:!0,...t,encoding:null}),this.__originalOptions=t,this.__normalizeOptions(t)}__normalizeOptions(t){const r={};for(let e in t)r[l(e)]=t[e];if(void 0===r.encoding||!0===r.encoding)r.encoding="utf8";else if(null===r.encoding||!1===r.encoding)r.encoding=null;else if("string"!=typeof r.encoding&&null!==r.encoding)throw new c("CSV_INVALID_OPTION_ENCODING",["Invalid option encoding:","encoding must be a string or null to return a buffer,","got "+JSON.stringify(r.encoding)],r);if(void 0===r.bom||null===r.bom||!1===r.bom)r.bom=!1;else if(!0!==r.bom)throw new c("CSV_INVALID_OPTION_BOM",["Invalid option bom:","bom must be true,","got "+JSON.stringify(r.bom)],r);let n=null;if(void 0===r.cast||null===r.cast||!1===r.cast||""===r.cast)r.cast=void 0;else if("function"==typeof r.cast)n=r.cast,r.cast=!0;else if(!0!==r.cast)throw new c("CSV_INVALID_OPTION_CAST",["Invalid option cast:","cast must be true or a function,","got "+JSON.stringify(r.cast)],r);if(void 0===r.cast_date||null===r.cast_date||!1===r.cast_date||""===r.cast_date)r.cast_date=!1;else{if(!0!==r.cast_date)throw new c("CSV_INVALID_OPTION_CAST_DATE",["Invalid option cast_date:","cast_date must be true or a function,","got "+JSON.stringify(r.cast_date)],r);r.cast_date=function(t){const e=Date.parse(t);return isNaN(e)?t:new Date(e)}}let i=null;if(!0===r.columns)i=void 0;else if("function"==typeof r.columns)i=r.columns,r.columns=!0;else if(Array.isArray(r.columns))r.columns=h(r.columns);else{if(void 0!==r.columns&&null!==r.columns&&!1!==r.columns)throw new c("CSV_INVALID_OPTION_COLUMNS",["Invalid option columns:","expect an array, a function or true,","got "+JSON.stringify(r.columns)],r);r.columns=!1}if(void 0===r.columns_duplicates_to_array||null===r.columns_duplicates_to_array||!1===r.columns_duplicates_to_array)r.columns_duplicates_to_array=!1;else{if(!0!==r.columns_duplicates_to_array)throw new c("CSV_INVALID_OPTION_COLUMNS_DUPLICATES_TO_ARRAY",["Invalid option columns_duplicates_to_array:","expect an boolean,","got "+JSON.stringify(r.columns_duplicates_to_array)],r);if(!1===r.columns)throw new c("CSV_INVALID_OPTION_COLUMNS_DUPLICATES_TO_ARRAY",["Invalid option columns_duplicates_to_array:","the `columns` mode must be activated."],r)}if(void 0===r.comment||null===r.comment||!1===r.comment||""===r.comment)r.comment=null;else if("string"==typeof r.comment&&(r.comment=e.from(r.comment,r.encoding)),!e.isBuffer(r.comment))throw new c("CSV_INVALID_OPTION_COMMENT",["Invalid option comment:","comment must be a buffer or a string,","got "+JSON.stringify(r.comment)],r);const a=JSON.stringify(r.delimiter);if(Array.isArray(r.delimiter)||(r.delimiter=[r.delimiter]),0===r.delimiter.length)throw new c("CSV_INVALID_OPTION_DELIMITER",["Invalid option delimiter:","delimiter must be a non empty string or buffer or array of string|buffer,","got "+a],r);if(r.delimiter=r.delimiter.map((function(t){if(null==t||!1===t)return e.from(",",r.encoding);if("string"==typeof t&&(t=e.from(t,r.encoding)),!e.isBuffer(t)||0===t.length)throw new c("CSV_INVALID_OPTION_DELIMITER",["Invalid option delimiter:","delimiter must be a non empty string or buffer or array of string|buffer,","got "+a],r);return t})),void 0===r.escape||!0===r.escape?r.escape=e.from('"',r.encoding):"string"==typeof r.escape?r.escape=e.from(r.escape,r.encoding):null!==r.escape&&!1!==r.escape||(r.escape=null),null!==r.escape&&!e.isBuffer(r.escape))throw new Error("Invalid Option: escape must be a buffer, a string or a boolean, got "+JSON.stringify(r.escape));if(void 0===r.from||null===r.from)r.from=1;else{if("string"==typeof r.from&&/\d+/.test(r.from)&&(r.from=parseInt(r.from)),!Number.isInteger(r.from))throw new Error("Invalid Option: from must be an integer, got "+JSON.stringify(r.from));if(r.from<0)throw new Error("Invalid Option: from must be a positive integer, got "+JSON.stringify(t.from))}if(void 0===r.from_line||null===r.from_line)r.from_line=1;else{if("string"==typeof r.from_line&&/\d+/.test(r.from_line)&&(r.from_line=parseInt(r.from_line)),!Number.isInteger(r.from_line))throw new Error("Invalid Option: from_line must be an integer, got "+JSON.stringify(t.from_line));if(r.from_line<=0)throw new Error("Invalid Option: from_line must be a positive integer greater than 0, got "+JSON.stringify(t.from_line))}if(void 0===r.ignore_last_delimiters||null===r.ignore_last_delimiters)r.ignore_last_delimiters=!1;else if("number"==typeof r.ignore_last_delimiters)r.ignore_last_delimiters=Math.floor(r.ignore_last_delimiters),0===r.ignore_last_delimiters&&(r.ignore_last_delimiters=!1);else if("boolean"!=typeof r.ignore_last_delimiters)throw new c("CSV_INVALID_OPTION_IGNORE_LAST_DELIMITERS",["Invalid option `ignore_last_delimiters`:","the value must be a boolean value or an integer,","got "+JSON.stringify(r.ignore_last_delimiters)],r);if(!0===r.ignore_last_delimiters&&!1===r.columns)throw new c("CSV_IGNORE_LAST_DELIMITERS_REQUIRES_COLUMNS",["The option `ignore_last_delimiters`","requires the activation of the `columns` option"],r);if(void 0===r.info||null===r.info||!1===r.info)r.info=!1;else if(!0!==r.info)throw new Error("Invalid Option: info must be true, got "+JSON.stringify(r.info));if(void 0===r.max_record_size||null===r.max_record_size||!1===r.max_record_size)r.max_record_size=0;else if(Number.isInteger(r.max_record_size)&&r.max_record_size>=0);else{if("string"!=typeof r.max_record_size||!/\d+/.test(r.max_record_size))throw new Error("Invalid Option: max_record_size must be a positive integer, got "+JSON.stringify(r.max_record_size));r.max_record_size=parseInt(r.max_record_size)}if(void 0===r.objname||null===r.objname||!1===r.objname)r.objname=void 0;else if(e.isBuffer(r.objname)){if(0===r.objname.length)throw new Error("Invalid Option: objname must be a non empty buffer");null===r.encoding||(r.objname=r.objname.toString(r.encoding))}else{if("string"!=typeof r.objname)throw new Error("Invalid Option: objname must be a string or a buffer, got "+r.objname);if(0===r.objname.length)throw new Error("Invalid Option: objname must be a non empty string")}if(void 0===r.on_record||null===r.on_record)r.on_record=void 0;else if("function"!=typeof r.on_record)throw new c("CSV_INVALID_OPTION_ON_RECORD",["Invalid option `on_record`:","expect a function,","got "+JSON.stringify(r.on_record)],r);if(null===r.quote||!1===r.quote||""===r.quote)r.quote=null;else if(void 0===r.quote||!0===r.quote?r.quote=e.from('"',r.encoding):"string"==typeof r.quote&&(r.quote=e.from(r.quote,r.encoding)),!e.isBuffer(r.quote))throw new Error("Invalid Option: quote must be a buffer or a string, got "+JSON.stringify(r.quote));if(void 0===r.raw||null===r.raw||!1===r.raw)r.raw=!1;else if(!0!==r.raw)throw new Error("Invalid Option: raw must be true, got "+JSON.stringify(r.raw));if(r.record_delimiter?Array.isArray(r.record_delimiter)||(r.record_delimiter=[r.record_delimiter]):r.record_delimiter=[],r.record_delimiter=r.record_delimiter.map((function(t){return"string"==typeof t&&(t=e.from(t,r.encoding)),t})),"boolean"==typeof r.relax);else{if(void 0!==r.relax&&null!==r.relax)throw new Error("Invalid Option: relax must be a boolean, got "+JSON.stringify(r.relax));r.relax=!1}if("boolean"==typeof r.relax_column_count);else{if(void 0!==r.relax_column_count&&null!==r.relax_column_count)throw new Error("Invalid Option: relax_column_count must be a boolean, got "+JSON.stringify(r.relax_column_count));r.relax_column_count=!1}if("boolean"==typeof r.relax_column_count_less);else{if(void 0!==r.relax_column_count_less&&null!==r.relax_column_count_less)throw new Error("Invalid Option: relax_column_count_less must be a boolean, got "+JSON.stringify(r.relax_column_count_less));r.relax_column_count_less=!1}if("boolean"==typeof r.relax_column_count_more);else{if(void 0!==r.relax_column_count_more&&null!==r.relax_column_count_more)throw new Error("Invalid Option: relax_column_count_more must be a boolean, got "+JSON.stringify(r.relax_column_count_more));r.relax_column_count_more=!1}if("boolean"==typeof r.skip_empty_lines);else{if(void 0!==r.skip_empty_lines&&null!==r.skip_empty_lines)throw new Error("Invalid Option: skip_empty_lines must be a boolean, got "+JSON.stringify(r.skip_empty_lines));r.skip_empty_lines=!1}if("boolean"==typeof r.skip_lines_with_empty_values);else{if(void 0!==r.skip_lines_with_empty_values&&null!==r.skip_lines_with_empty_values)throw new Error("Invalid Option: skip_lines_with_empty_values must be a boolean, got "+JSON.stringify(r.skip_lines_with_empty_values));r.skip_lines_with_empty_values=!1}if("boolean"==typeof r.skip_lines_with_error);else{if(void 0!==r.skip_lines_with_error&&null!==r.skip_lines_with_error)throw new Error("Invalid Option: skip_lines_with_error must be a boolean, got "+JSON.stringify(r.skip_lines_with_error));r.skip_lines_with_error=!1}if(void 0===r.rtrim||null===r.rtrim||!1===r.rtrim)r.rtrim=!1;else if(!0!==r.rtrim)throw new Error("Invalid Option: rtrim must be a boolean, got "+JSON.stringify(r.rtrim));if(void 0===r.ltrim||null===r.ltrim||!1===r.ltrim)r.ltrim=!1;else if(!0!==r.ltrim)throw new Error("Invalid Option: ltrim must be a boolean, got "+JSON.stringify(r.ltrim));if(void 0===r.trim||null===r.trim||!1===r.trim)r.trim=!1;else if(!0!==r.trim)throw new Error("Invalid Option: trim must be a boolean, got "+JSON.stringify(r.trim));if(!0===r.trim&&!1!==t.ltrim?r.ltrim=!0:!0!==r.ltrim&&(r.ltrim=!1),!0===r.trim&&!1!==t.rtrim?r.rtrim=!0:!0!==r.rtrim&&(r.rtrim=!1),void 0===r.to||null===r.to)r.to=-1;else{if("string"==typeof r.to&&/\d+/.test(r.to)&&(r.to=parseInt(r.to)),!Number.isInteger(r.to))throw new Error("Invalid Option: to must be an integer, got "+JSON.stringify(t.to));if(r.to<=0)throw new Error("Invalid Option: to must be a positive integer greater than 0, got "+JSON.stringify(t.to))}if(void 0===r.to_line||null===r.to_line)r.to_line=-1;else{if("string"==typeof r.to_line&&/\d+/.test(r.to_line)&&(r.to_line=parseInt(r.to_line)),!Number.isInteger(r.to_line))throw new Error("Invalid Option: to_line must be an integer, got "+JSON.stringify(t.to_line));if(r.to_line<=0)throw new Error("Invalid Option: to_line must be a positive integer greater than 0, got "+JSON.stringify(t.to_line))}this.info={bytes:0,comment_lines:0,empty_lines:0,invalid_field_length:0,lines:1,records:0},this.options=r,this.state={bomSkipped:!1,bufBytesStart:0,castField:n,commenting:!1,error:void 0,enabled:1===r.from_line,escaping:!1,escapeIsQuote:e.isBuffer(r.escape)&&e.isBuffer(r.quote)&&0===e.compare(r.escape,r.quote),expectedRecordLength:Array.isArray(r.columns)?r.columns.length:void 0,field:new o(20),firstLineToHeaders:i,needMoreDataSize:Math.max(null!==r.comment?r.comment.length:0,...r.delimiter.map(t=>t.length),null!==r.quote?r.quote.length:0),previousBuf:void 0,quoting:!1,stop:!1,rawBuffer:new o(100),record:[],recordHasError:!1,record_length:0,recordDelimiterMaxLength:0===r.record_delimiter.length?2:Math.max(...r.record_delimiter.map(t=>t.length)),trimChars:[e.from(" ",r.encoding)[0],e.from("\t",r.encoding)[0]],wasQuoting:!1,wasRowDelimiter:!1}}_transform(t,e,r){if(!0===this.state.stop)return;const n=this.__parse(t,!1);void 0!==n&&(this.state.stop=!0),r(n)}_flush(t){if(!0===this.state.stop)return;t(this.__parse(void 0,!0))}__parse(t,r){const{bom:n,comment:i,escape:o,from_line:s,ltrim:u,max_record_size:l,quote:f,raw:d,relax:h,rtrim:g,skip_empty_lines:p,to:m,to_line:y}=this.options;let{record_delimiter:b}=this.options;const{bomSkipped:_,previousBuf:v,rawBuffer:w,escapeIsQuote:E}=this.state;let S;if(void 0===v){if(void 0===t)return void this.push(null);S=t}else S=void 0!==v&&void 0===t?v:e.concat([v,t]);if(!1===_)if(!1===n)this.state.bomSkipped=!0;else if(S.length<3){if(!1===r)return void(this.state.previousBuf=S)}else{for(let t in a)if(0===a[t].compare(S,0,a[t].length)){let e=a[t].length;this.state.bufBytesStart+=e,S=S.slice(e),this.__normalizeOptions({...this.__originalOptions,encoding:t});break}this.state.bomSkipped=!0}const O=S.length;let T;for(T=0;T<O&&!this.__needMoreData(T,O,r);T++){if(!0===this.state.wasRowDelimiter&&(this.info.lines++,this.state.wasRowDelimiter=!1),-1!==y&&this.info.lines>y)return this.state.stop=!0,void this.push(null);if(!1===this.state.quoting&&0===b.length){this.__autoDiscoverRecordDelimiter(S,T)&&(b=this.options.record_delimiter)}const t=S[T];if(!0===d&&w.append(t),13!==t&&10!==t||!1!==this.state.wasRowDelimiter||(this.state.wasRowDelimiter=!0),!0===this.state.escaping)this.state.escaping=!1;else{if(null!==o&&!0===this.state.quoting&&this.__isEscape(S,T,t)&&T+o.length<O){if(!E){this.state.escaping=!0,T+=o.length-1;continue}if(this.__isQuote(S,T+o.length)){this.state.escaping=!0,T+=o.length-1;continue}}if(!1===this.state.commenting&&this.__isQuote(S,T))if(!0===this.state.quoting){const e=S[T+f.length],r=g&&this.__isCharTrimable(e),n=null!==i&&this.__compareBytes(i,S,T+f.length,e),a=this.__isDelimiter(S,T+f.length,e),s=0===b.length?this.__autoDiscoverRecordDelimiter(S,T+f.length):this.__isRecordDelimiter(e,S,T+f.length);if(null!==o&&this.__isEscape(S,T,t)&&this.__isQuote(S,T+o.length))T+=o.length-1;else{if(!e||a||s||n||r){this.state.quoting=!1,this.state.wasQuoting=!0,T+=f.length-1;continue}if(!1===h){const t=this.__error(new c("CSV_INVALID_CLOSING_QUOTE",["Invalid Closing Quote:",`got "${String.fromCharCode(e)}"`,"at line "+this.info.lines,"instead of delimiter, record delimiter, trimable character","(if activated) or comment"],this.options,this.__infoField()));if(void 0!==t)return t}else this.state.quoting=!1,this.state.wasQuoting=!0,this.state.field.prepend(f),T+=f.length-1}}else{if(0===this.state.field.length){this.state.quoting=!0,T+=f.length-1;continue}if(!1===h){const t=this.__error(new c("INVALID_OPENING_QUOTE",["Invalid Opening Quote:","a quote is found inside a field at line "+this.info.lines],this.options,this.__infoField(),{field:this.state.field}));if(void 0!==t)return t}}if(!1===this.state.quoting){let e=this.__isRecordDelimiter(t,S,T);if(0!==e){if(this.state.commenting&&!1===this.state.wasQuoting&&0===this.state.record.length&&0===this.state.field.length)this.info.comment_lines++;else{if(!1===this.state.enabled&&this.info.lines+(!0===this.state.wasRowDelimiter?1:0)>=s){this.state.enabled=!0,this.__resetField(),this.__resetRecord(),T+=e-1;continue}if(!0===p&&!1===this.state.wasQuoting&&0===this.state.record.length&&0===this.state.field.length){this.info.empty_lines++,T+=e-1;continue}this.info.bytes=this.state.bufBytesStart+T;const t=this.__onField();if(void 0!==t)return t;this.info.bytes=this.state.bufBytesStart+T+e;const r=this.__onRecord();if(void 0!==r)return r;if(-1!==m&&this.info.records>=m)return this.state.stop=!0,void this.push(null)}this.state.commenting=!1,T+=e-1;continue}if(this.state.commenting)continue;if(0!==(null===i?0:this.__compareBytes(i,S,T,t))){this.state.commenting=!0;continue}let r=this.__isDelimiter(S,T,t);if(0!==r){this.info.bytes=this.state.bufBytesStart+T;const t=this.__onField();if(void 0!==t)return t;T+=r-1;continue}}}if(!1===this.state.commenting&&0!==l&&this.state.record_length+this.state.field.length>l){const t=this.__error(new c("CSV_MAX_RECORD_SIZE",["Max Record Size:","record exceed the maximum number of tolerated bytes","of "+l,"at line "+this.info.lines],this.options,this.__infoField()));if(void 0!==t)return t}const e=!1===u||!0===this.state.quoting||0!==this.state.field.length||!this.__isCharTrimable(t),r=!1===g||!1===this.state.wasQuoting;if(!0===e&&!0===r)this.state.field.append(t);else if(!0===g&&!this.__isCharTrimable(t)){const t=this.__error(new c("CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE",["Invalid Closing Quote:","found non trimable byte after quote","at line "+this.info.lines],this.options,this.__infoField()));if(void 0!==t)return t}}if(!0===r)if(!0===this.state.quoting){const t=this.__error(new c("CSV_QUOTE_NOT_CLOSED",["Quote Not Closed:","the parsing is finished with an opening quote at line "+this.info.lines],this.options,this.__infoField()));if(void 0!==t)return t}else if(!0===this.state.wasQuoting||0!==this.state.record.length||0!==this.state.field.length){this.info.bytes=this.state.bufBytesStart+T;const t=this.__onField();if(void 0!==t)return t;const e=this.__onRecord();if(void 0!==e)return e}else!0===this.state.wasRowDelimiter?this.info.empty_lines++:!0===this.state.commenting&&this.info.comment_lines++;else this.state.bufBytesStart+=T,this.state.previousBuf=S.slice(T);!0===this.state.wasRowDelimiter&&(this.info.lines++,this.state.wasRowDelimiter=!1)}__onRecord(){const{columns:t,columns_duplicates_to_array:e,encoding:r,info:n,from:i,relax_column_count:o,relax_column_count_less:a,relax_column_count_more:s,raw:u,skip_lines_with_empty_values:l}=this.options,{enabled:f,record:h}=this.state;if(!1===f)return this.__resetRecord();const g=h.length;if(!0===t)return!0===l&&d(h)?void this.__resetRecord():this.__firstLineToColumns(h);if(!1===t&&0===this.info.records&&(this.state.expectedRecordLength=g),g!==this.state.expectedRecordLength){const e=!1===t?new c("CSV_INCONSISTENT_RECORD_LENGTH",["Invalid Record Length:",`expect ${this.state.expectedRecordLength},`,`got ${g} on line ${this.info.lines}`],this.options,this.__infoField(),{record:h}):new c("CSV_RECORD_DONT_MATCH_COLUMNS_LENGTH",["Invalid Record Length:",`columns length is ${t.length},`,`got ${g} on line ${this.info.lines}`],this.options,this.__infoField(),{record:h});if(!0===o||!0===a&&g<this.state.expectedRecordLength||!0===s&&g>this.state.expectedRecordLength)this.info.invalid_field_length++,this.state.error=e;else{const t=this.__error(e);if(t)return t}}if(!0===l&&d(h))this.__resetRecord();else{if(!0===this.state.recordHasError)return this.__resetRecord(),void(this.state.recordHasError=!1);if(this.info.records++,1===i||this.info.records>=i)if(!1!==t){const i={};for(let r=0,n=h.length;r<n;r++)void 0===t[r]||t[r].disabled||(!0===e&&void 0!==i[t[r].name]?Array.isArray(i[t[r].name])?i[t[r].name]=i[t[r].name].concat(h[r]):i[t[r].name]=[i[t[r].name],h[r]]:i[t[r].name]=h[r]);const{objname:o}=this.options;if(void 0===o)if(!0===u||!0===n){const t=this.__push(Object.assign({record:i},!0===u?{raw:this.state.rawBuffer.toString(r)}:{},!0===n?{info:this.__infoRecord()}:{}));if(t)return t}else{const t=this.__push(i);if(t)return t}else if(!0===u||!0===n){const t=this.__push(Object.assign({record:[i[o],i]},!0===u?{raw:this.state.rawBuffer.toString(r)}:{},!0===n?{info:this.__infoRecord()}:{}));if(t)return t}else{const t=this.__push([i[o],i]);if(t)return t}}else if(!0===u||!0===n){const t=this.__push(Object.assign({record:h},!0===u?{raw:this.state.rawBuffer.toString(r)}:{},!0===n?{info:this.__infoRecord()}:{}));if(t)return t}else{const t=this.__push(h);if(t)return t}this.__resetRecord()}}__firstLineToColumns(t){const{firstLineToHeaders:e}=this.state;try{const r=void 0===e?t:e.call(null,t);if(!Array.isArray(r))return this.__error(new c("CSV_INVALID_COLUMN_MAPPING",["Invalid Column Mapping:","expect an array from column function,","got "+JSON.stringify(r)],this.options,this.__infoField(),{headers:r}));const n=h(r);return this.state.expectedRecordLength=n.length,this.options.columns=n,void this.__resetRecord()}catch(t){return t}}__resetRecord(){!0===this.options.raw&&this.state.rawBuffer.reset(),this.state.error=void 0,this.state.record=[],this.state.record_length=0}__onField(){const{cast:t,encoding:e,rtrim:r,max_record_size:n}=this.options,{enabled:i,wasQuoting:o}=this.state;if(!1===i)return this.__resetField();let a=this.state.field.toString(e);if(!0===r&&!1===o&&(a=a.trimRight()),!0===t){const[t,e]=this.__cast(a);if(void 0!==t)return t;a=e}this.state.record.push(a),0!==n&&"string"==typeof a&&(this.state.record_length+=a.length),this.__resetField()}__resetField(){this.state.field.reset(),this.state.wasQuoting=!1}__push(t){const{on_record:e}=this.options;if(void 0!==e){const r=this.__infoRecord();try{t=e.call(null,t,r)}catch(t){return t}if(null==t)return}this.push(t)}__cast(t){const{columns:e,relax_column_count:r}=this.options;if(!0===Array.isArray(e)&&r&&this.options.columns.length<=this.state.record.length)return[void 0,void 0];if(null!==this.state.castField)try{const e=this.__infoField();return[void 0,this.state.castField.call(null,t,e)]}catch(t){return[t]}if(this.__isFloat(t))return[void 0,parseFloat(t)];if(!1!==this.options.cast_date){const e=this.__infoField();return[void 0,this.options.cast_date.call(null,t,e)]}return[void 0,t]}__isCharTrimable(t){return 32===t||9===t||13===t||10===t||12===t}__isFloat(t){return t-parseFloat(t)+1>=0}__compareBytes(t,e,r,n){if(t[0]!==n)return 0;const i=t.length;for(let n=1;n<i;n++)if(t[n]!==e[r+n])return 0;return i}__needMoreData(t,e,r){if(r)return!1;const{quote:n}=this.options,{quoting:i,needMoreDataSize:o,recordDelimiterMaxLength:a}=this.state;return e-t-1<Math.max(o,a,i?n.length+a:0)}__isDelimiter(t,e,r){const{delimiter:n,ignore_last_delimiters:i}=this.options;if(!0===i&&this.state.record.length===this.options.columns.length-1)return 0;if(!1!==i&&"number"==typeof i&&this.state.record.length===i-1)return 0;t:for(let i=0;i<n.length;i++){const o=n[i];if(o[0]===r){for(let r=1;r<o.length;r++)if(o[r]!==t[e+r])continue t;return o.length}}return 0}__isRecordDelimiter(t,e,r){const{record_delimiter:n}=this.options,i=n.length;t:for(let o=0;o<i;o++){const i=n[o],a=i.length;if(i[0]===t){for(let t=1;t<a;t++)if(i[t]!==e[r+t])continue t;return i.length}}return 0}__isEscape(t,e,r){const{escape:n}=this.options;if(null===n)return!1;const i=n.length;if(n[0]===r){for(let r=0;r<i;r++)if(n[r]!==t[e+r])return!1;return!0}return!1}__isQuote(t,e){const{quote:r}=this.options;if(null===r)return!1;const n=r.length;for(let i=0;i<n;i++)if(r[i]!==t[e+i])return!1;return!0}__autoDiscoverRecordDelimiter(t,r){const{encoding:n}=this.options,i=t[r];return 13===i?10===t[r+1]?(this.options.record_delimiter.push(e.from("\r\n",n)),this.state.recordDelimiterMaxLength=2,2):(this.options.record_delimiter.push(e.from("\r",n)),this.state.recordDelimiterMaxLength=1,1):10===i?(this.options.record_delimiter.push(e.from("\n",n)),this.state.recordDelimiterMaxLength=1,1):0}__error(t){const{skip_lines_with_error:e}=this.options,r="string"==typeof t?new Error(t):t;return e?(this.state.recordHasError=!0,void this.emit("skip",r)):r}__infoDataSet(){return{...this.info,columns:this.options.columns}}__infoRecord(){const{columns:t}=this.options;return{...this.__infoDataSet(),error:this.state.error,header:!0===t,index:this.state.record.length}}__infoField(){const{columns:t}=this.options,e=Array.isArray(t);return{...this.__infoRecord(),column:!0===e?t.length>this.state.record.length?t[this.state.record.length].name:null:this.state.record.length,quoting:this.state.wasQuoting}}}const u=function(){let t,r,i;for(let n in arguments){const o=arguments[n],a=typeof o;if(void 0!==t||"string"!=typeof o&&!e.isBuffer(o))if(void 0===r&&f(o))r=o;else{if(void 0!==i||"function"!==a)throw new c("CSV_INVALID_ARGUMENT",["Invalid argument:",`got ${JSON.stringify(o)} at index ${n}`],r||{});i=o}else t=o}const o=new s(r);if(i){const t=void 0===r||void 0===r.objname?[]:{};o.on("readable",(function(){let e;for(;null!==(e=this.read());)void 0===r||void 0===r.objname?t.push(e):t[e[0]]=e[1]})),o.on("error",(function(t){i(t,void 0,o.__infoDataSet())})),o.on("end",(function(){i(void 0,t,o.__infoDataSet())}))}return void 0!==t&&("function"==typeof n?n((function(){o.write(t),o.end()})):(o.write(t),o.end())),o};class c extends Error{constructor(t,r,n){Array.isArray(r)&&(r=r.join(" ")),super(r),void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,c),this.code=t;for(var i=arguments.length,o=new Array(i>3?i-3:0),a=3;a<i;a++)o[a-3]=arguments[a];for(const t of o)for(const r in t){const i=t[r];this[r]=e.isBuffer(i)?i.toString(n.encoding):null==i?i:JSON.parse(JSON.stringify(i))}}}u.Parser=s,u.CsvError=c,t.exports=u;const l=function(t){return t.replace(/([A-Z])/g,(function(t,e){return"_"+e.toLowerCase()}))},f=function(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)},d=function(t){return t.every(t=>null==t||t.toString&&""===t.toString().trim())},h=function(t){const e=[];for(let r=0,n=t.length;r<n;r++){const n=t[r];if(null==n||!1===n)e[r]={disabled:!0};else if("string"==typeof n)e[r]={name:n};else{if(!f(n))throw new c("CSV_INVALID_COLUMN_DEFINITION",["Invalid column definition:","expect a string or a literal object,",`got ${JSON.stringify(n)} at position ${r}`]);if("string"!=typeof n.name)throw new c("CSV_OPTION_COLUMNS_MISSING_NAME",["Option columns missing name:",'property "name" is required at position '+r,"when column is an object literal"]);e[r]=n}}return e}}).call(this,r(16).Buffer,r(99).setImmediate)},function(t,e,r){(function(e){t.exports=class{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;this.size=t,this.length=0,this.buf=e.alloc(t)}prepend(t){if(e.isBuffer(t)){const r=this.length+t.length;if(r>=this.size&&(this.resize(),r>=this.size))throw Error("INVALID_BUFFER_STATE");const n=this.buf;this.buf=e.alloc(this.size),t.copy(this.buf,0),n.copy(this.buf,t.length),this.length+=t.length}else{const e=this.length++;e===this.size&&this.resize();const r=this.clone();this.buf[0]=t,r.copy(this.buf,1,0,e)}}append(t){const e=this.length++;e===this.size&&this.resize(),this.buf[e]=t}clone(){return e.from(this.buf.slice(0,this.length))}resize(){const t=this.length;this.size=2*this.size;const r=e.alloc(this.size);this.buf.copy(r,0,0,t),this.buf=r}toString(t){return t?this.buf.slice(0,this.length).toString(t):Uint8Array.prototype.slice.call(this.buf.slice(0,this.length))}toJSON(){return this.toString("utf8")}reset(){this.length=0}}}).call(this,r(16).Buffer)},function(t,e,r){"use strict";var n;if(!Object.keys){var i=Object.prototype.hasOwnProperty,o=Object.prototype.toString,a=r(216),s=Object.prototype.propertyIsEnumerable,u=!s.call({toString:null},"toString"),c=s.call((function(){}),"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],f=function(t){var e=t.constructor;return e&&e.prototype===t},d={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},h=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!d["$"+t]&&i.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{f(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();n=function(t){var e=null!==t&&"object"==typeof t,r="[object Function]"===o.call(t),n=a(t),s=e&&"[object String]"===o.call(t),d=[];if(!e&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var g=c&&r;if(s&&t.length>0&&!i.call(t,0))for(var p=0;p<t.length;++p)d.push(String(p));if(n&&t.length>0)for(var m=0;m<t.length;++m)d.push(String(m));else for(var y in t)g&&"prototype"===y||!i.call(t,y)||d.push(String(y));if(u)for(var b=function(t){if("undefined"==typeof window||!h)return f(t);try{return f(t)}catch(t){return!1}}(t),_=0;_<l.length;++_)b&&"constructor"===l[_]||!i.call(t,l[_])||d.push(l[_]);return d}}t.exports=n},function(t,e,r){"use strict";var n="Function.prototype.bind called on incompatible ",i=Array.prototype.slice,o=Object.prototype.toString;t.exports=function(t){var e=this;if("function"!=typeof e||"[object Function]"!==o.call(e))throw new TypeError(n+e);for(var r,a=i.call(arguments,1),s=function(){if(this instanceof r){var n=e.apply(this,a.concat(i.call(arguments)));return Object(n)===n?n:this}return e.apply(t,a.concat(i.call(arguments)))},u=Math.max(0,e.length-a.length),c=[],l=0;l<u;l++)c.push("$"+l);if(r=Function("binder","return function ("+c.join(",")+"){ return binder.apply(this,arguments); }")(s),e.prototype){var f=function(){};f.prototype=e.prototype,r.prototype=new f,f.prototype=null}return r}},function(t,e,r){"use strict";var n=r(138);t.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},function(t,e,r){"use strict";var n=r(65),i=r(107),o=r(218),a=r(219),s=r(401),u=i(a(),Object);n(u,{getPolyfill:a,implementation:o,shim:s}),t.exports=u},function(t,e,r){"use strict";var n=r(59)("%Object.defineProperty%",!0),i=function(){if(n)try{return n({},"a",{value:1}),!0}catch(t){return!1}return!1};i.hasArrayLengthDefineBug=function(){if(!i())return null;try{return 1!==n([],"length",{value:1}).length}catch(t){return!0}},t.exports=i},function(t,e,r){"use strict";var n=r(219),i=r(65);t.exports=function(){var t=n();return i(Object,{is:t},{is:function(){return Object.is!==t}}),t}},function(t,e,r){"use strict";var n,i,o,a,s=r(50),u=r(58)();if(u){n=s("Object.prototype.hasOwnProperty"),i=s("RegExp.prototype.exec"),o={};var c=function(){throw o};a={toString:c,valueOf:c},"symbol"==typeof Symbol.toPrimitive&&(a[Symbol.toPrimitive]=c)}var l=s("Object.prototype.toString"),f=Object.getOwnPropertyDescriptor;t.exports=u?function(t){if(!t||"object"!=typeof t)return!1;var e=f(t,"lastIndex");if(!(e&&n(e,"value")))return!1;try{i(t,a)}catch(t){return t===o}}:function(t){return!(!t||"object"!=typeof t&&"function"!=typeof t)&&"[object RegExp]"===l(t)}},function(t,e,r){"use strict";var n=r(65),i=r(107),o=r(220),a=r(221),s=r(405),u=i(a());n(u,{getPolyfill:a,implementation:o,shim:s}),t.exports=u},function(t,e,r){"use strict";var n=function(){return"string"==typeof function(){}.name},i=Object.getOwnPropertyDescriptor;if(i)try{i([],"length")}catch(t){i=null}n.functionsHaveConfigurableNames=function(){if(!n()||!i)return!1;var t=i((function(){}),"name");return!!t&&!!t.configurable};var o=Function.prototype.bind;n.boundFunctionsHaveNames=function(){return n()&&"function"==typeof o&&""!==function(){}.bind().name},t.exports=n},function(t,e,r){"use strict";var n=r(65).supportsDescriptors,i=r(221),o=Object.getOwnPropertyDescriptor,a=Object.defineProperty,s=TypeError,u=Object.getPrototypeOf,c=/a/;t.exports=function(){if(!n||!u)throw new s("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=i(),e=u(c),r=o(e,"flags");return r&&r.get===t||a(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";var n=Date.prototype.getDay,i=Object.prototype.toString,o=r(58)();t.exports=function(t){return"object"==typeof t&&null!==t&&(o?function(t){try{return n.call(t),!0}catch(t){return!1}}(t):"[object Date]"===i.call(t))}},function(t,e,r){"use strict";var n=r(222),i=r(409),o=r(410),a=r(411),s=r(412);t.exports=function(t){return null==t||"object"!=typeof t&&"function"!=typeof t?null:n(t)?"String":i(t)?"Number":o(t)?"Boolean":a(t)?"Symbol":s(t)?"BigInt":void 0}},function(t,e,r){"use strict";var n=Number.prototype.toString,i=Object.prototype.toString,o=r(58)();t.exports=function(t){return"number"==typeof t||"object"==typeof t&&(o?function(t){try{return n.call(t),!0}catch(t){return!1}}(t):"[object Number]"===i.call(t))}},function(t,e,r){"use strict";var n=r(50),i=n("Boolean.prototype.toString"),o=n("Object.prototype.toString"),a=r(58)();t.exports=function(t){return"boolean"==typeof t||null!==t&&"object"==typeof t&&(a&&Symbol.toStringTag in t?function(t){try{return i(t),!0}catch(t){return!1}}(t):"[object Boolean]"===o(t))}},function(t,e,r){"use strict";var n=Object.prototype.toString;if(r(137)()){var i=Symbol.prototype.toString,o=/^Symbol\(.*\)$/;t.exports=function(t){if("symbol"==typeof t)return!0;if("[object Symbol]"!==n.call(t))return!1;try{return function(t){return"symbol"==typeof t.valueOf()&&o.test(i.call(t))}(t)}catch(t){return!1}}}else t.exports=function(t){return!1}},function(t,e,r){"use strict";if(r(413)()){var n=BigInt.prototype.valueOf;t.exports=function(t){return null!=t&&"boolean"!=typeof t&&"string"!=typeof t&&"number"!=typeof t&&"symbol"!=typeof t&&"function"!=typeof t&&("bigint"==typeof t||function(t){try{return n.call(t),!0}catch(t){}return!1}(t))}}else t.exports=function(t){return!1}},function(t,e,r){"use strict";var n="undefined"!=typeof BigInt&&BigInt;t.exports=function(){return"function"==typeof n&&"function"==typeof BigInt&&"bigint"==typeof n(42)&&"bigint"==typeof BigInt(42)}},function(t,e,r){"use strict";var n=r(223),i=r(224),o=r(415),a=r(416);t.exports=function(t){if(t&&"object"==typeof t){if(n(t))return"Map";if(i(t))return"Set";if(o(t))return"WeakMap";if(a(t))return"WeakSet"}return!1}},function(t,e,r){"use strict";var n,i="function"==typeof WeakMap&&WeakMap.prototype?WeakMap:null,o="function"==typeof WeakSet&&WeakSet.prototype?WeakSet:null;i||(n=function(t){return!1});var a=i?i.prototype.has:null,s=o?o.prototype.has:null;n||a||(n=function(t){return!1}),t.exports=n||function(t){if(!t||"object"!=typeof t)return!1;try{if(a.call(t,a),s)try{s.call(t,s)}catch(t){return!0}return t instanceof i}catch(t){}return!1}},function(t,e,r){"use strict";var n=r(59),i=r(50),o=n("%WeakSet%",!0),a=i("WeakSet.prototype.has",!0);if(a){var s=i("WeakMap.prototype.has",!0);t.exports=function(t){if(!t||"object"!=typeof t)return!1;try{if(a(t,a),s)try{s(t,s)}catch(t){return!0}return t instanceof o}catch(t){}return!1}}else t.exports=function(t){return!1}},function(t,e,r){"use strict";(function(e){var n=r(217);if(r(137)()||r(106)()){var i=Symbol.iterator;t.exports=function(t){return null!=t&&void 0!==t[i]?t[i]():n(t)?Array.prototype[i].call(t):void 0}}else{var o=r(418),a=r(222),s=r(59),u=s("%Map%",!0),c=s("%Set%",!0),l=r(50),f=l("Array.prototype.push"),d=l("String.prototype.charCodeAt"),h=l("String.prototype.slice"),g=function(t){var e=0;return{next:function(){var r,n=e>=t.length;return n||(r=t[e],e+=1),{done:n,value:r}}}},p=function(t,e){if(o(t)||n(t))return g(t);if(a(t)){var r=0;return{next:function(){var e=function(t,e){if(e+1>=t.length)return e+1;var r=d(t,e);if(r<55296||r>56319)return e+1;var n=d(t,e+1);return n<56320||n>57343?e+1:e+2}(t,r),n=h(t,r,e);return r=e,{done:e>t.length,value:n}}}}return e&&void 0!==t["_es6-shim iterator_"]?t["_es6-shim iterator_"]():void 0};if(u||c){var m=r(223),y=r(224),b=l("Map.prototype.forEach",!0),_=l("Set.prototype.forEach",!0);if(void 0===e||!e.versions||!e.versions.node)var v=l("Map.prototype.iterator",!0),w=l("Set.prototype.iterator",!0),E=function(t){var e=!1;return{next:function(){try{return{done:e,value:e?void 0:t.next()}}catch(t){return e=!0,{done:!0,value:void 0}}}}};var S=l("Map.prototype.@@iterator",!0)||l("Map.prototype._es6-shim iterator_",!0),O=l("Set.prototype.@@iterator",!0)||l("Set.prototype._es6-shim iterator_",!0);t.exports=function(t){return function(t){if(m(t)){if(v)return E(v(t));if(S)return S(t);if(b){var e=[];return b(t,(function(t,r){f(e,[r,t])})),g(e)}}if(y(t)){if(w)return E(w(t));if(O)return O(t);if(_){var r=[];return _(t,(function(t){f(r,t)})),g(r)}}}(t)||p(t)}}else t.exports=function(t){if(null!=t)return p(t,!0)}}}).call(this,r(25))},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";var n=r(59),i=r(50),o=r(420),a=n("%TypeError%"),s=n("%WeakMap%",!0),u=n("%Map%",!0),c=i("WeakMap.prototype.get",!0),l=i("WeakMap.prototype.set",!0),f=i("WeakMap.prototype.has",!0),d=i("Map.prototype.get",!0),h=i("Map.prototype.set",!0),g=i("Map.prototype.has",!0),p=function(t,e){for(var r,n=t;null!==(r=n.next);n=r)if(r.key===e)return n.next=r.next,r.next=t.next,t.next=r,r};t.exports=function(){var t,e,r,n={assert:function(t){if(!n.has(t))throw new a("Side channel does not contain "+o(t))},get:function(n){if(s&&n&&("object"==typeof n||"function"==typeof n)){if(t)return c(t,n)}else if(u){if(e)return d(e,n)}else if(r)return function(t,e){var r=p(t,e);return r&&r.value}(r,n)},has:function(n){if(s&&n&&("object"==typeof n||"function"==typeof n)){if(t)return f(t,n)}else if(u){if(e)return g(e,n)}else if(r)return function(t,e){return!!p(t,e)}(r,n);return!1},set:function(n,i){s&&n&&("object"==typeof n||"function"==typeof n)?(t||(t=new s),l(t,n,i)):u?(e||(e=new u),h(e,n,i)):(r||(r={key:{},next:null}),function(t,e,r){var n=p(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}}(r,n,i))}};return n}},function(t,e,r){var n="function"==typeof Map&&Map.prototype,i=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,o=n&&i&&"function"==typeof i.get?i.get:null,a=n&&Map.prototype.forEach,s="function"==typeof Set&&Set.prototype,u=Object.getOwnPropertyDescriptor&&s?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,c=s&&u&&"function"==typeof u.get?u.get:null,l=s&&Set.prototype.forEach,f="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,d="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,h="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,g=Boolean.prototype.valueOf,p=Object.prototype.toString,m=Function.prototype.toString,y=String.prototype.match,b=String.prototype.slice,_=String.prototype.replace,v=String.prototype.toUpperCase,w=String.prototype.toLowerCase,E=RegExp.prototype.test,S=Array.prototype.concat,O=Array.prototype.join,T=Array.prototype.slice,A=Math.floor,M="function"==typeof BigInt?BigInt.prototype.valueOf:null,I=Object.getOwnPropertySymbols,R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,N="function"==typeof Symbol&&"object"==typeof Symbol.iterator,k="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===N||"symbol")?Symbol.toStringTag:null,D=Object.prototype.propertyIsEnumerable,j=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function C(t,e){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||E.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var n=t<0?-A(-t):A(t);if(n!==t){var i=String(n),o=b.call(e,i.length+1);return _.call(i,r,"$&_")+"."+_.call(_.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return _.call(e,r,"$&_")}var L=r(421),x=L.custom,B=z(x)?x:null;function U(t,e,r){var n="double"===(r.quoteStyle||e)?'"':"'";return n+t+n}function F(t){return _.call(String(t),/"/g,""")}function P(t){return!("[object Array]"!==V(t)||k&&"object"==typeof t&&k in t)}function W(t){return!("[object RegExp]"!==V(t)||k&&"object"==typeof t&&k in t)}function z(t){if(N)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!R)return!1;try{return R.call(t),!0}catch(t){}return!1}t.exports=function t(e,r,n,i){var s=r||{};if(q(s,"quoteStyle")&&"single"!==s.quoteStyle&&"double"!==s.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(q(s,"maxStringLength")&&("number"==typeof s.maxStringLength?s.maxStringLength<0&&s.maxStringLength!==1/0:null!==s.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var u=!q(s,"customInspect")||s.customInspect;if("boolean"!=typeof u&&"symbol"!==u)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(q(s,"indent")&&null!==s.indent&&"\t"!==s.indent&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(q(s,"numericSeparator")&&"boolean"!=typeof s.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var p=s.numericSeparator;if(void 0===e)return"undefined";if(null===e)return"null";if("boolean"==typeof e)return e?"true":"false";if("string"==typeof e)return function t(e,r){if(e.length>r.maxStringLength){var n=e.length-r.maxStringLength,i="... "+n+" more character"+(n>1?"s":"");return t(b.call(e,0,r.maxStringLength),r)+i}return U(_.call(_.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Y),"single",r)}(e,s);if("number"==typeof e){if(0===e)return 1/0/e>0?"0":"-0";var v=String(e);return p?C(e,v):v}if("bigint"==typeof e){var E=String(e)+"n";return p?C(e,E):E}var A=void 0===s.depth?5:s.depth;if(void 0===n&&(n=0),n>=A&&A>0&&"object"==typeof e)return P(e)?"[Array]":"[Object]";var I=function(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=O.call(Array(t.indent+1)," ")}return{base:r,prev:O.call(Array(e+1),r)}}(s,n);if(void 0===i)i=[];else if(G(i,e)>=0)return"[Circular]";function x(e,r,o){if(r&&(i=T.call(i)).push(r),o){var a={depth:s.depth};return q(s,"quoteStyle")&&(a.quoteStyle=s.quoteStyle),t(e,a,n+1,i)}return t(e,s,n+1,i)}if("function"==typeof e&&!W(e)){var H=function(t){if(t.name)return t.name;var e=y.call(m.call(t),/^function\s*([\w$]+)/);if(e)return e[1];return null}(e),Q=X(e,x);return"[Function"+(H?": "+H:" (anonymous)")+"]"+(Q.length>0?" { "+O.call(Q,", ")+" }":"")}if(z(e)){var tt=N?_.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):R.call(e);return"object"!=typeof e||N?tt:$(tt)}if(function(t){if(!t||"object"!=typeof t)return!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement)return!0;return"string"==typeof t.nodeName&&"function"==typeof t.getAttribute}(e)){for(var et="<"+w.call(String(e.nodeName)),rt=e.attributes||[],nt=0;nt<rt.length;nt++)et+=" "+rt[nt].name+"="+U(F(rt[nt].value),"double",s);return et+=">",e.childNodes&&e.childNodes.length&&(et+="..."),et+="</"+w.call(String(e.nodeName))+">"}if(P(e)){if(0===e.length)return"[]";var it=X(e,x);return I&&!function(t){for(var e=0;e<t.length;e++)if(G(t[e],"\n")>=0)return!1;return!0}(it)?"["+J(it,I)+"]":"[ "+O.call(it,", ")+" ]"}if(function(t){return!("[object Error]"!==V(t)||k&&"object"==typeof t&&k in t)}(e)){var ot=X(e,x);return"cause"in Error.prototype||!("cause"in e)||D.call(e,"cause")?0===ot.length?"["+String(e)+"]":"{ ["+String(e)+"] "+O.call(ot,", ")+" }":"{ ["+String(e)+"] "+O.call(S.call("[cause]: "+x(e.cause),ot),", ")+" }"}if("object"==typeof e&&u){if(B&&"function"==typeof e[B]&&L)return L(e,{depth:A-n});if("symbol"!==u&&"function"==typeof e.inspect)return e.inspect()}if(function(t){if(!o||!t||"object"!=typeof t)return!1;try{o.call(t);try{c.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(e)){var at=[];return a&&a.call(e,(function(t,r){at.push(x(r,e,!0)+" => "+x(t,e))})),Z("Map",o.call(e),at,I)}if(function(t){if(!c||!t||"object"!=typeof t)return!1;try{c.call(t);try{o.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(e)){var st=[];return l&&l.call(e,(function(t){st.push(x(t,e))})),Z("Set",c.call(e),st,I)}if(function(t){if(!f||!t||"object"!=typeof t)return!1;try{f.call(t,f);try{d.call(t,d)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(e))return K("WeakMap");if(function(t){if(!d||!t||"object"!=typeof t)return!1;try{d.call(t,d);try{f.call(t,f)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(e))return K("WeakSet");if(function(t){if(!h||!t||"object"!=typeof t)return!1;try{return h.call(t),!0}catch(t){}return!1}(e))return K("WeakRef");if(function(t){return!("[object Number]"!==V(t)||k&&"object"==typeof t&&k in t)}(e))return $(x(Number(e)));if(function(t){if(!t||"object"!=typeof t||!M)return!1;try{return M.call(t),!0}catch(t){}return!1}(e))return $(x(M.call(e)));if(function(t){return!("[object Boolean]"!==V(t)||k&&"object"==typeof t&&k in t)}(e))return $(g.call(e));if(function(t){return!("[object String]"!==V(t)||k&&"object"==typeof t&&k in t)}(e))return $(x(String(e)));if(!function(t){return!("[object Date]"!==V(t)||k&&"object"==typeof t&&k in t)}(e)&&!W(e)){var ut=X(e,x),ct=j?j(e)===Object.prototype:e instanceof Object||e.constructor===Object,lt=e instanceof Object?"":"null prototype",ft=!ct&&k&&Object(e)===e&&k in e?b.call(V(e),8,-1):lt?"Object":"",dt=(ct||"function"!=typeof e.constructor?"":e.constructor.name?e.constructor.name+" ":"")+(ft||lt?"["+O.call(S.call([],ft||[],lt||[]),": ")+"] ":"");return 0===ut.length?dt+"{}":I?dt+"{"+J(ut,I)+"}":dt+"{ "+O.call(ut,", ")+" }"}return String(e)};var H=Object.prototype.hasOwnProperty||function(t){return t in this};function q(t,e){return H.call(t,e)}function V(t){return p.call(t)}function G(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}function Y(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+v.call(e.toString(16))}function $(t){return"Object("+t+")"}function K(t){return t+" { ? }"}function Z(t,e,r,n){return t+" ("+e+") {"+(n?J(r,n):O.call(r,", "))+"}"}function J(t,e){if(0===t.length)return"";var r="\n"+e.prev+e.base;return r+O.call(t,","+r)+"\n"+e.prev}function X(t,e){var r=P(t),n=[];if(r){n.length=t.length;for(var i=0;i<t.length;i++)n[i]=q(t,i)?e(t[i],t):""}var o,a="function"==typeof I?I(t):[];if(N){o={};for(var s=0;s<a.length;s++)o["$"+a[s]]=a[s]}for(var u in t)q(t,u)&&(r&&String(Number(u))===u&&u<t.length||N&&o["$"+u]instanceof Symbol||(E.call(/[^\w$]/,u)?n.push(e(u,t)+": "+e(t[u],t)):n.push(u+": "+e(t[u],t))));if("function"==typeof I)for(var c=0;c<a.length;c++)D.call(t,a[c])&&n.push("["+e(a[c])+"]: "+e(t[a[c]],t));return n}},function(t,e){},function(t,e,r){"use strict";(function(e){var n=r(225),i=r(226),o=r(50),a=r(227),s=o("Object.prototype.toString"),u=r(58)(),c="undefined"==typeof globalThis?e:globalThis,l=i(),f=o("String.prototype.slice"),d={},h=Object.getPrototypeOf;u&&a&&h&&n(l,(function(t){if("function"==typeof c[t]){var e=new c[t];if(Symbol.toStringTag in e){var r=h(e),n=a(r,Symbol.toStringTag);if(!n){var i=h(r);n=a(i,Symbol.toStringTag)}d[t]=n.get}}}));var g=r(424);t.exports=function(t){return!!g(t)&&(u&&Symbol.toStringTag in t?function(t){var e=!1;return n(d,(function(r,n){if(!e)try{var i=r.call(t);i===n&&(e=i)}catch(t){}})),e}(t):f(s(t),8,-1))}}).call(this,r(33))},function(t,e,r){"use strict";var n,i,o=Function.prototype.toString,a="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof a&&"function"==typeof Object.defineProperty)try{n=Object.defineProperty({},"length",{get:function(){throw i}}),i={},a((function(){throw 42}),null,n)}catch(t){t!==i&&(a=null)}else a=null;var s=/^\s*class\b/,u=function(t){try{var e=o.call(t);return s.test(e)}catch(t){return!1}},c=function(t){try{return!u(t)&&(o.call(t),!0)}catch(t){return!1}},l=Object.prototype.toString,f="function"==typeof Symbol&&!!Symbol.toStringTag,d=!(0 in[,]),h=function(){return!1};if("object"==typeof document){var g=document.all;l.call(g)===l.call(document.all)&&(h=function(t){if((d||!t)&&(void 0===t||"object"==typeof t))try{var e=l.call(t);return("[object HTMLAllCollection]"===e||"[object HTML document.all class]"===e||"[object HTMLCollection]"===e||"[object Object]"===e)&&null==t("")}catch(t){}return!1})}t.exports=a?function(t){if(h(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;try{a(t,null,n)}catch(t){if(t!==i)return!1}return!u(t)&&c(t)}:function(t){if(h(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(f)return c(t);if(u(t))return!1;var e=l.call(t);return!("[object Function]"!==e&&"[object GeneratorFunction]"!==e&&!/^\[object HTML/.test(e))&&c(t)}},function(t,e,r){"use strict";(function(e){var n=r(225),i=r(226),o=r(50),a=o("Object.prototype.toString"),s=r(58)(),u=r(227),c="undefined"==typeof globalThis?e:globalThis,l=i(),f=o("Array.prototype.indexOf",!0)||function(t,e){for(var r=0;r<t.length;r+=1)if(t[r]===e)return r;return-1},d=o("String.prototype.slice"),h={},g=Object.getPrototypeOf;s&&u&&g&&n(l,(function(t){var e=new c[t];if(Symbol.toStringTag in e){var r=g(e),n=u(r,Symbol.toStringTag);if(!n){var i=g(r);n=u(i,Symbol.toStringTag)}h[t]=n.get}}));t.exports=function(t){if(!t||"object"!=typeof t)return!1;if(!s||!(Symbol.toStringTag in t)){var e=d(a(t),8,-1);return f(l,e)>-1}return!!u&&function(t){var e=!1;return n(h,(function(r,n){if(!e)try{e=r.call(t)===n}catch(t){}})),e}(t)}}).call(this,r(33))},function(t,e,r){"use strict";var n=r(65),i=r(107),o=r(228),a=r(229),s=r(426),u=i.apply(a()),c=function(t,e){return u(Object,arguments)};n(c,{getPolyfill:a,implementation:o,shim:s}),t.exports=c},function(t,e,r){"use strict";var n=r(65),i=r(229);t.exports=function(){var t=i();return n(Object,{assign:t},{assign:function(){return Object.assign!==t}}),t}},function(t,e){var r,n;r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(t,e){return t<<e|t>>>32-e},rotr:function(t,e){return t<<32-e|t>>>e},endian:function(t){if(t.constructor==Number)return 16711935&n.rotl(t,8)|4278255360&n.rotl(t,24);for(var e=0;e<t.length;e++)t[e]=n.endian(t[e]);return t},randomBytes:function(t){for(var e=[];t>0;t--)e.push(Math.floor(256*Math.random()));return e},bytesToWords:function(t){for(var e=[],r=0,n=0;r<t.length;r++,n+=8)e[n>>>5]|=t[r]<<24-n%32;return e},wordsToBytes:function(t){for(var e=[],r=0;r<32*t.length;r+=8)e.push(t[r>>>5]>>>24-r%32&255);return e},bytesToHex:function(t){for(var e=[],r=0;r<t.length;r++)e.push((t[r]>>>4).toString(16)),e.push((15&t[r]).toString(16));return e.join("")},hexToBytes:function(t){for(var e=[],r=0;r<t.length;r+=2)e.push(parseInt(t.substr(r,2),16));return e},bytesToBase64:function(t){for(var e=[],n=0;n<t.length;n+=3)for(var i=t[n]<<16|t[n+1]<<8|t[n+2],o=0;o<4;o++)8*n+6*o<=8*t.length?e.push(r.charAt(i>>>6*(3-o)&63)):e.push("=");return e.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/gi,"");for(var e=[],n=0,i=0;n<t.length;i=++n%4)0!=i&&e.push((r.indexOf(t.charAt(n-1))&Math.pow(2,-2*i+8)-1)<<2*i|r.indexOf(t.charAt(n))>>>6-2*i);return e}},t.exports=n},function(t,e){function r(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}
|
|
25
|
+
/*!
|
|
26
|
+
* Determine if an object is a Buffer
|
|
27
|
+
*
|
|
28
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
29
|
+
* @license MIT
|
|
30
|
+
*/
|
|
31
|
+
t.exports=function(t){return null!=t&&(r(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&r(t.slice(0,0))}(t)||!!t._isBuffer)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(17),i=r(8);function o(t,e){Object(i.a)(2,arguments);var r=Object(n.a)(t),o=Object(n.a)(e);return r.getTime()>o.getTime()}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(17),i=r(8);function o(t){Object(i.a)(1,arguments);var e=Object(n.a)(t);return e.setDate(1),e.setHours(0,0,0,0),e}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(17),i=r(8);function o(t){Object(i.a)(1,arguments);var e=Object(n.a)(t),r=e.getMonth();return e.setFullYear(e.getFullYear(),r+1,0),e.setHours(23,59,59,999),e}}]);
|
|
32
|
+
//# sourceMappingURL=kcab.worker.e2ee9d65fbc7d1214a04.js.map
|