diff --git a/admin/bundle.min.js b/admin/bundle.min.js index a34ed06..16ac8a8 100644 --- a/admin/bundle.min.js +++ b/admin/bundle.min.js @@ -1,12 +1,13 @@ -!function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return i(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a= 4.0.0"],main:function(t,e,n,r,i){var o,a=null!=e?e:{},s=n.helperMissing,u="function",c=t.escapeExpression;return'
\n
\n

'+c((o=null!=(o=n.id||(null!=e?e.id:e))?o:s,typeof o===u?o.call(a,{name:"id",hash:{},data:i}):o))+'

\n
\n
\n

'+c((o=null!=(o=n.description||(null!=e?e.description:e))?o:s,typeof o===u?o.call(a,{name:"description",hash:{},data:i}):o))+'

\n
\n \n \n
\n
\n \n \n
\n
\n \n
\n\n"},useData:!0})),this.templates=this.templates||{},this.templates.config=Handlebars.template({1:function(t,e,n,r,i){var o,a,s=null!=e?e:{},u=n.helperMissing,c="function",l=t.escapeExpression;return"
\n

"+l((a=null!=(a=n.key||i&&i.key)?a:u,typeof a===c?a.call(s,{name:"key",hash:{},data:i}):a))+'

\n
\n \n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n'},2:function(t,e,n,r,i){return"checked"},compiler:[7,">= 4.0.0"],main:function(t,e,n,r,i){var o,a=null!=e?e:{},s=n.helperMissing,u=t.escapeExpression,c=t.lambda;return'

'+u((n.glyphicon||e&&e.glyphicon||s).call(a,"cog",{name:"glyphicon",hash:{},data:i}))+' Configuration

\n\n
\n
\n

'+u((n.glyphicon||e&&e.glyphicon||s).call(a,"globe",{name:"glyphicon",hash:{},data:i}))+' General

\n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n \n
\n
\n
\n\n
\n
\n

'+u((n.glyphicon||e&&e.glyphicon||s).call(a,"send",{name:"glyphicon",hash:{},data:i}))+' Outgoing Mail

\n
\n
\n
\n
\n \n \n
\n
\n \n '+u((n.mailerServicePicker||e&&e.mailerServicePicker||s).call(a,null!=(o=null!=e?e.mailer:e)?o.service:o,{name:"mailerServicePicker",hash:{},data:i}))+'\n
\n
\n \n \n
\n
\n \n \n
\n \n
\n
\n
\n\n
\n
\n

'+u((n.glyphicon||e&&e.glyphicon||s).call(a,"lock",{name:"glyphicon",hash:{},data:i}))+' OAuth

\n
\n
\n\n
\n'+(null!=(o=n.each.call(a,null!=(o=null!=e?e.oauth:e)?o.providers:o,{name:"each",hash:{},fn:t.program(1,i,0),inverse:t.noop,data:i}))?o:"")+'\n \n
\n
\n
\n\n'},useData:!0}),this.templates.emails=Handlebars.template({1:function(t,e,n,r,i){var o;return null!=(o=t.invokePartial(r.email,e,{name:"email",data:i,helpers:n,partials:r,decorators:t.decorators}))?o:""},compiler:[7,">= 4.0.0"],main:function(t,e,n,r,i){var o;return'

Email Templates

\n\n'+(null!=(o=n.each.call(null!=e?e:{},null!=e?e.models:e,{name:"each",hash:{},fn:t.program(1,i,0),inverse:t.noop,data:i}))?o:"")},usePartial:!0,useData:!0}),this.templates.header=Handlebars.template({1:function(t,e,n,r,i){return' \n'},3:function(t,e,n,r,i){var o=null!=e?e:{},a=n.helperMissing,s=t.escapeExpression;return'\n"},compiler:[7,">= 4.0.0"],main:function(t,e,n,r,i){var o,a=null!=e?e:{};return'\n\n'+(null!=(o=n["if"].call(a,null!=(o=null!=e?e.userCtx:e)?o.name:o,{name:"if",hash:{},fn:t.program(3,i,0),inverse:t.noop,data:i}))?o:"")+"\n"},useData:!0}),this.templates.index=Handlebars.template({compiler:[7,">= 4.0.0"],main:function(t,e,n,r,i){var o,a=t.escapeExpression,s=t.lambda;return'

Hi Admin!

\n\n
\n
\n

'+a((n.glyphicon||e&&e.glyphicon||n.helperMissing).call(null!=e?e:{},"info-sign",{name:"glyphicon",hash:{},data:i}))+' App Info

\n
\n
\n

Capot

\n

\n Version: '+a(s(null!=(o=null!=e?e.capot:e)?o.version:o,e))+"
\n

\n

CouchDB

\n

\n Version: "+a(s(null!=(o=null!=e?e.couchdb:e)?o.version:o,e))+"
\n UUID: "+a(s(null!=(o=null!=e?e.couchdb:e)?o.uuid:o,e))+"
\n Vendor: "+a(s(null!=(o=null!=(o=null!=e?e.couchdb:e)?o.vendor:o)?o.name:o,e))+" "+a(s(null!=(o=null!=(o=null!=e?e.couchdb:e)?o.vendor:o)?o.version:o,e))+"\n

\n
\n
\n\n"},useData:!0}),this.templates.signin=Handlebars.template({compiler:[7,">= 4.0.0"],main:function(t,e,n,r,i){return'
\n
\n \n \n
\n \n
\n'},useData:!0}),this.templates.users=Handlebars.template({1:function(t,e,n,r,i){var o;return" \n "+t.escapeExpression((o=null!=(o=n.name||(null!=e?e.name:e))?o:n.helperMissing,"function"==typeof o?o.call(null!=e?e:{},{name:"name",hash:{},data:i}):o))+"\n \n"},compiler:[7,">= 4.0.0"],main:function(t,e,n,r,i){var o,a=null!=e?e:{};return'

'+t.escapeExpression((n.glyphicon||e&&e.glyphicon||n.helperMissing).call(a,"user",{name:"glyphicon",hash:{},data:i}))+' Users

\n\n\n'+(null!=(o=n.each.call(a,null!=e?e.models:e,{name:"each",hash:{},fn:t.program(1,i,0),inverse:t.noop,data:i}))?o:"")+"
\n\n"},useData:!0})},{}],8:[function(t,e,n){"use strict";var r=t("../../client/ui/view");e.exports=r.extend({className:"container",templateName:"header",initialize:function(t){var e=this,n=t.app,i=n.account;r.prototype.initialize.call(e,t);var o=function(){e.model=i.session,e.render()};i.on("init",o),i.on("signin",o),i.on("signout",o),i.on("online",o),i.on("offline",o),n.on("route",function(t){e.$("#main-menu a").each(function(){var e=$(this),n=e.attr("href");"/"===n.charAt(0)&&(n=n.slice(1)),n===t?e.parents("li").addClass("active"):e.parents("li").removeClass("active")})})},events:{'click [data-action="signout"]':"signout"},signout:function(){var t=this.app;return t.account.signOut().then(function(){window.location.href="/"},function(){console.error("signout:fail",arguments)}),!1}})},{"../../client/ui/view":26}],9:[function(t,e,n){"use strict";var r=t("lodash"),i=t("../../client/ui/view"),o=window.Handlebars;o.registerHelper("mailerServicePicker",function(t){var e='",new o.SafeString(e)}),e.exports=i.extend({className:"container",templateName:"config",initialize:function(t){var e=this;i.prototype.initialize.call(e,t);var n=e.app,r=e.model=n.createModel("config");r.once("sync",function(){e.render()}),r.fetch()},events:{"submit #app-form":"save","submit #mailer-form":"save","submit #oauth-form":"save"},save:function(t){t.preventDefault();var e=this,n=e.model,i={name:e.$("#app-name").val(),url:e.$("#app-url").val()},o={from:e.$("#mailer-from").val(),service:e.$("#mailer-service").val(),user:e.$("#mailer-user").val(),pass:e.$("#mailer-pass").val()},a=n.get("oauth");return a.providers=Object.keys(a.providers).reduce(function(t,e){return t[e]={enabled:$("#"+e+"-enabled").is(":checked"),key:$("#"+e+"-key").val(),secret:$("#"+e+"-secret").val(),scopes:$("#"+e+"-scopes").val().split(",").map(function(t){return r.trim(t.toLowerCase())})},t},{}),n.save({app:i,mailer:o,oauth:a},{error:function(t){alert(t.reason||t.message)},success:function(){alert("Config updated!")}}),!1}})},{"../../client/ui/view":26,lodash:118}],10:[function(t,e,n){"use strict";var r=t("../../client/ui/view");e.exports=r.extend({className:"container",templateName:"emails",initialize:function(t){var e=this,n=t.app;r.prototype.initialize.call(e,t);var i=e.model=n.createCollection("emails"),o=Handlebars.partials.email;i.on("change",function(t){var n=o(t.toViewContext());e.$('[data-id="'+t.id+'"]').replaceWith(n)}),i.once("sync",function(){e.render()}),i.fetch()},events:{'click [data-action="save-email"]':"saveEmail"},saveEmail:function(t){var e=$(t.currentTarget),n=e.parents(".panel"),r=n.find("textarea"),i=n.data("id"),o=r.val(),a=this.model.get(i);a.save({text:o})}})},{"../../client/ui/view":26}],11:[function(t,e,n){"use strict";var r=t("../../client/ui/view"),i=t("../../package.json");e.exports=r.extend({className:"container",templateName:"index",initialize:function(t){var e=this,n=t.app;r.prototype.initialize.call(e,t),n.couch.get("/").then(function(t){e.model={capot:i,couchdb:t},e.render()})}})},{"../../client/ui/view":26,"../../package.json":135}],12:[function(t,e,n){"use strict";var r=t("../../client/ui/view"),i=t("../../client/couch");e.exports=r.extend({className:"container",templateName:"signin",initialize:function(t){r.prototype.initialize.call(this,t),this.render()},events:{"submit #signin-form":"submit"},submit:function(t){t.preventDefault();var e={name:"admin",password:$("#pass").val()};return i("/_couch").post("/_session",e).then(function(t){window.location.href="/_admin/"},function(t){alert(t.reason)}),!1}})},{"../../client/couch":15,"../../client/ui/view":26}],13:[function(t,e,n){"use strict";var r=t("../../client/ui/view");e.exports=r.extend({className:"container",templateName:"users",initialize:function(t){var e=this;r.prototype.initialize.call(e,t);var n=e.app,i=e.model=n.createCollection("users");i.once("sync",function(){e.render()}),i.fetch()}})},{"../../client/ui/view":26}],14:[function(t,e,n){"use strict";var r=t("events").EventEmitter,i=t("promise"),o={};o.couch=t("./couch")("/_couch"),o.userDocUrl=function(t){return"/_users/"+encodeURIComponent("org.couchdb.user:"+t)},o.getState=function(){return JSON.parse(window.localStorage.getItem("__capot_session"))},o.setState=function(t){window.localStorage.setItem("__capot_session",JSON.stringify(t))},e.exports=function(t){var e=new r,n=!1;e.id=function(){var t=((e.session||{}).userCtx||{}).roles||[];return t.reduce(function(t,e){var n=/^capot:write:user\/([a-z0-9]+)$/.exec(e);return n&&n[1]?n[1]:t},null)},e.signUp=function(n,r){return new i(function(i,o){var a=function(){t.request("POST","/_session",{email:n,password:r}).then(function(t){return t.roles.length?void e.init().then(i,o):setTimeout(a,1e3)},o)};return r.length<8?o(new Error("Password must be at least 8 chars long")):void t.request("POST","/_users",{email:n,password:r}).then(function(){setTimeout(a,300)},o)})},e.signIn=function(n,r){if(!n||"string"!=typeof n)throw new TypeError("Email must be a string");if(!r||"string"!=typeof r)throw new TypeError("Password must be a string");return t.request("POST","/_session",{email:n,password:r}).then(function(){return e.init()})},e.signOut=function(){return t.request("DELETE","/_session").then(function(){return e.init()})},e.changePassword=function(n,r){if(!n||"string"!=typeof n)throw new TypeError("Password must be a string");if(!r||"string"!=typeof r)throw new TypeError("New password must be a string");var a=e.session.userCtx.name,s=o.userDocUrl(a);return a?r.length<8?new i(function(t,e){e(new Error("Password must be at least 8 chars long"))}):t.request("POST","/_session",{email:a,password:n}).then(function(){return o.couch.get(s)}).then(function(t){return t.password=r,o.couch.put(s,t)}).then(function(){return e.signIn(a,r)}):new i(function(t,e){e(new Error("User is not signed in"))})},e.changeUsername=function(t,e){throw new Error("FIXME: Unimplented!")},e.resetPassword=function(e){return t.request("POST","/_users/"+e+"/_reset",{email:e,baseurl:window.location.origin})},e.destroy=function(){var n=e.session.userCtx.name,r="/_users/"+encodeURIComponent(n);return t.request("GET",r).then(function(e){return t.request("DELETE",r+"?rev="+e._rev)}).then(function(){return e.init()})},e.isSignedIn=function(){var t=(e.session||{}).userCtx||{};return"string"==typeof t.name&&t.name.length>0},e.isAdmin=function(){var t=(e.session||{}).userCtx||{};return t.roles&&t.roles.indexOf("_admin")>=0},e.isOnline=function(){return e.session&&e.session.isOnline},e.isOffline=function(){return!e.isOnline()},e.init=function(r){n?t.log("debug","refreshing account..."):t.log("debug","initializing account..."),r=r||function(){};var a=e.isOnline(),s=e.isSignedIn();return new i(function(i,u){var c=function(){o.setState(e.session),n?a&&e.isOffline()?e.emit("offline"):!a&&e.isOnline()?e.emit("online"):!s&&e.isSignedIn()?e.emit("signin"):s&&!e.isSignedIn()&&e.emit("signout"):(n=!0,e.emit("init"),window.setInterval(e.init.bind(e),3e4)),i(),r()};t.request("GET","/_session").then(function(t){e.session=t,e.session.isOnline=!0,c()},function(n){n&&t.log("error",n),e.session=o.getState()||{},e.session.isOnline=!1,c()})})},e.connectWith=function(e,n){n=n||{};var r="/_oauth/"+e;return n.redirectTo&&(r+="?redirectTo="+encodeURIComponent(n.redirectTo)),new i(function(e,n){t.request("GET",r).then(function(t){window.location.href=t.authenticateUrl},n)})},e.on("init",function(){t.request("GET","/_oauth/session").then(function(t){return"object"==typeof t.data?t.data.cookie?void e.init().then(function(){e.emit("oauth",t)}):e.emit("oauth",t):void 0},function(e){e&&t.log("error",e),401!==xhr.status&&t.log("error","Status: "+xhr.status+"\n"+xhr.responseText)})});var a=function(e){return function(){t.log("debug","account:"+e,Array.prototype.slice.call(arguments,0))}};return t.settings.debug===!0&&["init","signin","signout","offline","online"].forEach(function(t){e.on(t,a(t))}),e}},{"./couch":15,events:33,promise:126}],15:[function(t,e,n){"use strict";var r=t("pouchdb"),i=t("./request"),o={};o.createApi=function(t){var e=i(t);return{get:e.bind(null,"GET"),post:e.bind(null,"POST"),put:e.bind(null,"PUT"),del:e.bind(null,"DELETE")}},e.exports=function(t){"string"==typeof t&&(t={url:t}),/^https?:\/\//.test(t.url)||("/"===t.url.charAt(0)&&(t.url=t.url.slice(1)),t.url=window.location.origin+"/"+t.url);var e=o.createApi(t);return e.db=function(e){return new r(t.url+"/"+encodeURIComponent(e))},e.isAdminParty=function(t){e.get("/_users/_all_docs",function(e,n){e&&401===e.statusCode?t(null,!1):e?t(e):t(null,!0)})},e}},{"./request":18,pouchdb:124}],16:[function(t,e,n){"use strict";var r=t("extend"),i=t("async"),o=t("pouchdb"),a=t("./request"),s=t("./uid"),u=t("./log"),c=t("./account"),l=t("./store"),f={};f.noop=function(){},f.defaults={debug:!1},e.exports=function(t){var e=r({},f.defaults,t),n={settings:e,request:a({url:window.location.origin}),uid:s,log:u(e)},d=n.account=c(n),h=n.store=l(n);return n.log("debug","Dependencies: jQuery "+jQuery.fn.jquery+", PouchDB "+o.version),n.start=function(t){t=t||f.noop,n.log("debug","Starting capot client..."),i.applyEachSeries([i.apply(d.init),i.apply(h.init)],function(e){n.log("info",e||"Capot client successfully started"),t(e)})},n}},{"./account":14,"./log":17,"./request":18,"./store":19,"./uid":27,async:30,extend:105,pouchdb:124}],17:[function(t,e,n){"use strict";var r={};r.pad=function(t,e,n){var r=""+t;"number"!=typeof e&&(e=2),"undefined"==typeof n&&(n="0");var i=e-r.length;if(0>=i)return r;for(var o=0;i>o;++o)r=n+r;return r},r.formatDate=function(t){return[r.pad(t.getHours()),r.pad(t.getMinutes()),r.pad(t.getSeconds()),r.pad(t.getMilliseconds(),3)].join(":")},e.exports=function(t){return function(e){if("undefined"!=typeof console&&"function"==typeof console.log&&("string"==typeof e&&(e=[e]),t.debug||!(e.indexOf("debug")>=0))){var n=Array.prototype.slice.call(arguments,1);1===n.length&&(n=n[0]),"undefined"!=typeof window.console&&"function"==typeof window.console.log&&console.log(r.formatDate(new Date),e,n)}}}},{}],18:[function(t,e,n){"use strict";var r=t("promise");e.exports=function(t){return function(){var e=Array.prototype.slice.call(arguments,0),n=e.shift(),i=e.shift();return"/"!==i.charAt(0)&&(i="/"+i),new r(function(r,o){var a={type:n,url:t.url+i,dataType:"json",timeout:6e4,cache:!1,error:function(t){var e,n;0===t.status?e="Request timed out":t.responseJSON&&t.responseJSON.error?(e=t.responseJSON.error,n=t.responseJSON.reason):e=t.statusText;var r=new Error(e);r.statusCode=t.status,n&&(r.reason=n),o(r)},success:r};if(t.user&&t.pass&&(a.username=t.user,a.password=t.pass),["PUT","POST"].indexOf(n)>=0){var s=e.pop();s&&(a.data=JSON.stringify(s),a.contentType="application/json")}if(e.length){var u=e.shift(),c=Object.keys(u);a.url+=c.reduce(function(t,e){var n=JSON.stringify(u[e]);return t&&(t+="&"),t+encodeURIComponent(e)+"="+encodeURIComponent(n)},"?")}$.ajax(a)})}}},{promise:126}],19:[function(t,e,n){"use strict";var r=t("events").EventEmitter,i=t("promise"),o=t("pouchdb"),a=t("extend"),s=t("omit"),u=t("async"),c={};c.noop=function(){},c.assertDocType=function(t){if("string"!=typeof t)throw new Error("Model type must be a string")},c.parse=function(t){var e=t._id.split("/");return a({id:e.slice(1).join("/"),type:e[0]},s(t,["_id"]))},c.toJSON=function(t){return a({_id:t.type+"/"+t.id},s(t,["id"]))},e.exports=function(t){var e=t.account,n=new r,l=function(t,e){n.emit("sync",t,e),n.emit("sync:"+t,e)};n.sync=function(e){return e=e||c.noop,!n.remoteUrl||t.account.isOffline()?e():void n.remote.sync(n.local,{filter:function(t){return 0!==t._id.indexOf("_design")&&t.$replicate!==!1}}).on("error",l.bind(null,"error")).on("denied",function(t){console.error("sync denied",t)}).on("paused",l.bind(null,"paused")).on("active",l.bind(null,"active")).on("change",l.bind(null,"change")).on("complete",function(t){n.lastSync=t.push.end_time,t.pull.end_time>n.lastSync&&(n.lastSync=t.pull.end_time),l("complete",t),e()})},n.find=function(t,e,r){return c.assertDocType(t),r=r||{},new i(function(i,o){n.local.get(t+"/"+e).then(function(t){var e=c.parse(t);return r.attachments&&t._attachments?void n.getAttachments(t).then(function(t){e._attachments=t,i(e)}):i(e)},o)})},n.findAll=function(t,e){return c.assertDocType(t),e=e||{},new i(function(r,i){n.local.allDocs({include_docs:!0,startkey:t+"/",endkey:t+"0"}).then(function(t){var o=t.rows.map(function(t){return c.parse(t.doc)});return e.attachments?void u.each(o,function(t,e){n.getAttachments(t).then(function(n){t._attachments=n,e()},e)},function(t){return t?i(t):void r(o)}):r(o)},i)})},n.add=function(e,r){c.assertDocType(e);var o=r._attachments||{},l=Object.keys(o),f={},d=l.reduce(function(t,e){var n=o[e];return n instanceof File?f[k]=n:t[k]=n,t},{}),h=a({},s(r,["_attachments"]),{_id:e+"/"+t.uid(),createdAt:new Date,type:e});return Object.keys(d).length&&(h._attachments=d),new i(function(t,e){var r=n.local;r.put(h).then(function(n){h._rev=n.rev;var i=Object.keys(f);return i.length?void u.eachSeries(i,function(t,e){var n=h._id,i=h._rev,o=f[t],a=o.type;r.putAttachment(n,t,i,o,a,function(t,n){return t?e(t):(h._rev=n.rev,void e())})},function(n){return n?e(n):void t(c.parse(h))}):t(c.parse(h))},e)})},n.update=function(t,e,n){c.assertDocType(t)},n.remove=function(t,e){return n.find(t,e).then(function(t){return n.local.put({_deleted:!0},c.toJSON(t)._id,t._rev)})},n.removeAll=function(t){return n.findAll(t).then(function(t){var e=t.map(function(t){var e=c.toJSON(t);return e._deleted=!0,e});return n.local.bulkDocs(e)})},n.attach=function(t,e,n,r){},n.getAttachments=function(t){var e=c.toJSON(t)._id,r=t._attachments||{},o=Object.keys(r);return new i(function(t,i){return o.length?void u.each(o,function(t,i){n.local.getAttachment(e,t,function(e,n){return e?i(e):(r[t].data=n,void i())})},function(e){return e?i(e):void t(r)}):t([])})},n.init=function(r){t.log("debug","capot.store init start"),r=r||c.noop;var i=e.id()||"__capot_anon";n.local=new o(i,{auto_compaction:!0});var a=function(){var e=n.local.changes({since:"now",live:!0,include_docs:!0});e.on("change",function(t){var e=c.parse(t.doc),r=e.type;if(r){var i=function(t){n.emit(t,e,{local:!0}),n.emit(t+":"+r,e,{local:!0})};i(t.deleted||e._deleted?"remove":/^1-/.test(e._rev)?"add":"update"),i("change"),n.sync()}}),t.log("debug","capot.store init ok"),n.emit("init"),r()};e.isSignedIn()&&!e.isAdmin()?(n.remoteUrl=window.location.origin+"/_couch/"+encodeURIComponent("user/"+i),n.remote=new o(n.remoteUrl),n.sync(a)):a()},["signin","signout"].forEach(function(t){e.on(t,n.init.bind(n))});var f=function(e){return function(){t.log("debug","store:"+e,Array.prototype.slice.call(arguments,0))}};return t.settings.debug===!0&&["init","add","update","remove","change","sync"].forEach(function(t){n.on(t,f(t))}),n}},{async:30,events:33,extend:105,omit:119,pouchdb:124,promise:126}],20:[function(t,e,n){"use strict";var r=t("lodash"),i=t("backbone");e.exports=i.View.extend({el:"body",regions:{},events:{"click a":"overrideLink"},initialize:function(t){t=t||{},i.View.prototype.initialize.call(this,t),this.options=t,this.addRegion("main",{view:null,prepend:!0}),this.addRegion("notifications",{view:null}),$("html").removeClass("no-js")},addRegion:function(t,e){var n=r.extend({id:t},e||{});if(!n.$el){var i=e.tagName||"div";n.$el=$("<"+i+' id="'+n.id+'">'),e.className&&n.$el.addClass(e.className)}if(n.$el.attr("data-app-region",t),"main"===t)this.$el.prepend(n.$el);else{var o=n.prepend?"before":"after";this.regions.main.$el[o](n.$el)}this.regions[t]=n,n.view&&this.setRegionView(t,n.view)},setRegionView:function(t,e){var n=this.regions[t],r=n.$el[0];if(!n)throw new Error("Unknown region: "+t);if(!e)throw new Error("No view passed to AppView.setRegionView()");"string"==typeof e&&(e=this.model.createView(e)),e.$el&&!$.contains(r,e.$el)&&n.$el.html(e.$el),n.view=e,this.trigger("region:view",n)},overrideLink:function(t){var e=this.model,n=$(t.currentTarget).attr("href"),i=n.substr(1);if("#"!==n.charAt(0)){var o=r.find(r.keys(e.routes),function(t){return e._routeToRegExp(t).test(i)});"string"==typeof o&&(t.preventDefault(),e.navigate(i,{trigger:!0}))}}})},{backbone:31,lodash:118}],21:[function(t,e,n){"use strict";var r=t("backbone"),i=t("./model"),o=t("lodash"),a={};a.remoteSync=function(t,e,n,r){var i=t.app,a=i.account,s=e.db||"user/"+a.id(),u="/_couch/"+encodeURIComponent(s),c=n+(r.idStartsWith?"/"+r.idStartsWith:""),l={include_docs:!0,startkey:c+(r.descending?"0":"/"),endkey:c+(r.descending?"/":"0")};return o.each(["limit","start","descending"],function(t){r[t]&&(l[t]=r[t])}),i.request("GET",u+"/_all_docs",l).then(function(t){return o.map(t.rows,function(t){var e=t.doc,n=e._id.split("/");return e.id=n.slice(1).join("/"),delete e._id,e})})},a.localSync=function(t,e,n){return t.app.store.findAll(n)},e.exports=r.Collection.extend({model:i,initialize:function(t,e){this.app=e.app,r.Collection.prototype.initialize.call(this,t,e)},comparator:function(t){return-1*t.get("createdAt")},toViewContext:function(){return{models:this.map(function(t){return t.toViewContext?t.toViewContext():t})}}, -sync:function(t,e,n){var r=n.success||function(){},i=n.error||function(){},o=new e.model,s=o.get("type");"read"!==t&&i(null,null,new Error("Sync method not supported"));var u=o.remote||o.db?a.remoteSync:a.localSync;u(e,o,s,n).then(r,function(t){i(null,null,t)})}})},{"./model":24,backbone:31,lodash:118}],22:[function(t,e,n){"use strict";var r=t("moment"),i=window.Handlebars;i.registerHelper("log",function(t){var e=Array.prototype.slice.call(arguments,0,arguments.length-1);console.log.apply(console,e)}),i.registerHelper("formatDate",function(t,e){return 2===arguments.length&&(e="lll"),new i.SafeString(r(t).format(e))}),i.registerHelper("fromNow",function(t){return new i.SafeString(r(t).fromNow())}),i.registerHelper("glyphicon",function(t){var e=' ';return new i.SafeString(e)})},{moment:123}],23:[function(t,e,n){"use strict";var r=window.jQuery||window.$,i=window.Backbone=t("backbone");window.Handlebars=t("handlebars"),i.$=r;var o=t("./router");e.exports=function(t){return new o(t)}},{"./router":25,backbone:31,handlebars:52}],24:[function(t,e,n){"use strict";var r=t("lodash"),i=t("backbone"),o=t("moment"),a={};a.isISODateString=function(t){var e=/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/;return"string"==typeof t&&e.test(t)},a.remoteSync=function(t,e){return void console.log("oh my god!")},a.localSync=function(t,e){var n=e.get("type"),r=(e.app||e.collection.app).store;if("create"===t)return r.add(n,e.toJSON());if("read"===t)return r.find(n,e.id);if("update"!==t){if("delete"===t)return r.remove(n,e.id);throw new Error("Unsupported model sync method")}},e.exports=i.Model.extend({db:null,replicate:!0,remote:!1,initialize:function(t,e){i.Model.prototype.initialize.call(this,t,e),e&&e.app&&(this.app=e.app)},toViewContext:function(){return r.extend({},this.attributes)},parse:function(t){return r.reduce(t,function(t,e,n){return"$replicate"===n?t:(t[n]=a.isISODateString(e)?o(e).toDate():e,t)},{})},toJSON:function(){return r.extend({},this.attributes,{$replicate:this.replicate!==!1})},sync:function(t,e,n){var r=n.success||function(){},i=n.error||function(){},o=this.remote||this.db?a.remoteSync:a.localSync;o(t,e).then(r,function(t){i(null,null,t)})}})},{backbone:31,lodash:118,moment:123}],25:[function(t,e,n){"use strict";var r=t("lodash"),i=t("backbone"),o=t("./app-view"),a=t("./view"),s={};s.getProp=function(t,e){if(!e)return t;var n=e.split("/"),i=n.shift();return t&&t.hasOwnProperty(i)?r.isObject(t[i])?s.getProp(t[i],n.join("/")):t[i]:null};var u=["routePrefix","collections","models","views","templates"];e.exports=i.Router.extend({routePrefix:"",collections:{},models:{},views:{},templates:null,initialize:function(e){var n=this,a=e.capot||t("../")(r.omit(e,u)),s=a.start.bind(a);a.log("debug","Dependencies: Lodash: "+r.VERSION+", Backbone "+i.VERSION+", Handlebars: "+Handlebars.VERSION),i.Router.prototype.initialize.call(n,e),u.forEach(function(t){"undefined"!=typeof e[t]&&(n[t]=e[t])}),r.extend(n,a,{view:new o({model:n}),start:function(){s(function(t){if(t)throw t;i.history.start({pushState:!0})})}}),n.routes||(n.routes={}),n.view.on("region:view",function(t){$("html").attr("class",t.view.templateName)})},route:function(t,e,n){var r=this.routePrefix||"";return 2===arguments.length&&(n=e,e=t),this.routes[t]=n,i.Router.prototype.route.call(this,r+t,e,n)},navigate:function(t,e){var n=this.routePrefix||"";return i.Router.prototype.navigate.call(this,n+t,e)},addRegion:function(t,e){this.view.addRegion(t,e)},setMainView:function(t){var e=(this.view.regions.main||{}).view;e&&e.unsubscribeFromGlobalEvents&&e.unsubscribeFromGlobalEvents(),this.view.setRegionView("main",t),t.subscribeToGlobalEvents()},showView:function(t,e){var n;if(r.isFunction(t)&&t instanceof a)n=t;else if(r.isString(t)&&(n=s.getProp(this.views,t),!n))throw new Error('Unknown view: "'+t+'"');var i=new n(r.extend({app:this},e));return this.setMainView(i),i},showTemplate:function(t){var e=a.extend({templateName:t}),n=new e({app:this});this.setMainView(n),n.render()},requireCondition:function(t,e,n){var r=this;return function(){return t()?void n.apply(this,Array.prototype.slice.call(arguments,0)):r.navigate(e,{trigger:!0})}},requireSignIn:function(t,e){var n=this;return 1===arguments.length&&(e=t,t="signin"),n.requireCondition(function(){return n.account.isSignedIn()},t,e)},requireSignOut:function(t,e){var n=this;return 1===arguments.length&&(e=t,t="dashboard"),n.requireCondition(function(){return n.account.isSignedIn()!==!0},t,e)},requireAdmin:function(t,e){var n=this;return 1===arguments.length&&(e=t,t="signin"),n.requireCondition(function(){return n.account.isAdmin()},t,e)},createView:function(t,e){var n=this.views[t];return new n(r.extend({},e,{app:this}))},createCollection:function(t,e,n){var i=this.collections[t];return new i(e,r.extend({},n,{app:this}))},createModel:function(t,e,n){var i=this.models[t];return new i(e,r.extend({},n,{app:this}))}})},{"../":16,"./app-view":20,"./view":26,backbone:31,lodash:118}],26:[function(t,e,n){"use strict";var r=t("lodash"),i=t("backbone");t("./helpers");var o={};o.getProp=function(t,e){if(!e)return t;var n=e.split("/"),i=n.shift();return t&&t.hasOwnProperty(i)?r.isObject(t[i])?o.getProp(t[i],n.join("/")):t[i]:null},e.exports=i.View.extend({templateName:null,template:null,locals:{},initialize:function(t){i.View.prototype.initialize.call(this,t),this.app=t.app,this.render=r.debounce(this.render,100),this.locals=r.extend(this.locals,t.locals||{})},render:function(t){var e=this.templateName,n=this.app;if(e){var i=o.getProp(n.templates,e);return r.isFunction(i)?(t=t||this.model||{},r.isFunction(t.toViewContext)?t=t.toViewContext():t.attributes?t=t.attributes:r.isArray(t)&&(t={models:r.map(t,function(t){return t.toViewContext?t.toViewContext():t})}),this.$el.html($.trim(i(r.extend({},this.locals,t)))),this.trigger("render"),this):(n.log("error","Template "+e+" not loaded!"),this)}},back:function(t){t.preventDefault(),t.stopPropagation(),window.history.back()},subscribeToGlobalEvents:function(){var t=this;r.each(t._getGlobalEventsHandlers(t.cid),function(t){t.src.on(t.name,t.fn),console.log("View subscribing to global event "+t.name)})},unsubscribeFromGlobalEvents:function(){r.each(this._getGlobalEventsHandlers(this.cid),function(t){t.src.removeListener(t.name,t.fn),console.log("View unsubscribing from global event "+t.name)})},_getGlobalEventsHandlers:r.memoize(function(){var t=this;return r.reduce(t.globalEvents,function(e,n,i){var o=i.split(" "),a=o[0],s=t[n],u={name:o[1]};return r.isFunction(s)?(u.fn=s.bind(t),"account"===a?(u.src=t.app.account,e.push(u)):"store"===a?(u.src=t.app.store,e.push(u)):"task"===a&&(u.src=t.app.task,e.push(u)),e):void 0},[])})})},{"./helpers":22,backbone:31,lodash:118}],27:[function(t,e,n){"use strict";var r={chars:"0123456789abcdefghijklmnopqrstuvwxyz".split("")};e.exports=function(t){var e="",n=r.chars.length;void 0===t&&(t=7);for(var i=0;t>i;++i){var o=Math.random()*n,a=r.chars[Math.floor(o)];e+=String(a).charAt(0)}return e}},{}],28:[function(t,e,n){"use strict";function r(){if(u.length)throw u.shift()}function i(t){var e;e=s.length?s.pop():new o,e.task=t,a(e)}function o(){this.task=null}var a=t("./raw"),s=[],u=[],c=a.makeRequestCallFromTimer(r);e.exports=i,o.prototype.call=function(){try{this.task.call()}catch(t){i.onerror?i.onerror(t):(u.push(t),c())}finally{this.task=null,s[s.length]=this}}},{"./raw":29}],29:[function(t,e,n){(function(t){"use strict";function n(t){s.length||(a(),u=!0),s[s.length]=t}function r(){for(;cl){for(var e=0,n=s.length-c;n>e;e++)s[e]=s[e+c];s.length-=c,c=0}}s.length=0,c=0,u=!1}function i(t){var e=1,n=new f(t),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){e=-e,r.data=e}}function o(t){return function(){function e(){clearTimeout(n),clearInterval(r),t()}var n=setTimeout(e,0),r=setInterval(e,50)}}e.exports=n;var a,s=[],u=!1,c=0,l=1024,f=t.MutationObserver||t.WebKitMutationObserver;a="function"==typeof f?i(r):o(r),n.requestFlush=a,n.makeRequestCallFromTimer=o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],30:[function(t,e,n){(function(t,n){!function(){function r(){}function i(t){return t}function o(t){return!!t}function a(t){return!t}function s(t){return function(){if(null===t)throw new Error("Callback was already called.");t.apply(this,arguments),t=null}}function u(t){return function(){null!==t&&(t.apply(this,arguments),t=null)}}function c(t){return F(t)||"number"==typeof t.length&&t.length>=0&&t.length%1===0}function l(t,e){for(var n=-1,r=t.length;++nr?r:null}):(n=H(t),e=n.length,function(){return r++,e>r?n[r]:null})}function g(t,e){return e=null==e?t.length-1:+e,function(){for(var n=Math.max(arguments.length-e,0),r=Array(n),i=0;n>i;i++)r[i]=arguments[i+e];switch(e){case 0:return t.call(this,r);case 1:return t.call(this,arguments[0],r)}}}function _(t){return function(e,n,r){return t(e,r)}}function y(t){return function(e,n,i){i=u(i||r),e=e||[];var o=m(e);if(0>=t)return i(null);var a=!1,c=0,l=!1;!function f(){if(a&&0>=c)return i(null);for(;t>c&&!l;){var r=o();if(null===r)return a=!0,void(0>=c&&i(null));c+=1,n(e[r],r,s(function(t){c-=1,t?(i(t),l=!0):f()}))}}()}}function b(t){return function(e,n,r){return t(R.eachOf,e,n,r)}}function w(t){return function(e,n,r,i){return t(y(n),e,r,i)}}function x(t){return function(e,n,r){return t(R.eachOfSeries,e,n,r)}}function k(t,e,n,i){i=u(i||r),e=e||[];var o=c(e)?[]:{};t(e,function(t,e,r){n(t,function(t,n){o[e]=n,r(t)})},function(t){i(t,o)})}function S(t,e,n,r){var i=[];t(e,function(t,e,r){n(t,function(n){n&&i.push({index:e,value:t}),r()})},function(){r(f(i.sort(function(t,e){return t.index-e.index}),function(t){return t.value}))})}function E(t,e,n,r){S(t,e,function(t,e){n(t,function(t){e(!t)})},r)}function O(t,e,n){return function(r,i,o,a){function s(){a&&a(n(!1,void 0))}function u(t,r,i){return a?void o(t,function(r){a&&e(r)&&(a(n(!0,t)),a=o=!1),i()}):i()}arguments.length>3?t(r,i,u,s):(a=o,o=i,t(r,u,s))}}function A(t,e){return e}function j(t,e,n){n=n||r;var i=c(e)?[]:{};t(e,function(t,e,n){t(g(function(t,r){r.length<=1&&(r=r[0]),i[e]=r,n(t)}))},function(t){n(t,i)})}function T(t,e,n,r){var i=[];t(e,function(t,e,r){n(t,function(t,e){i=i.concat(e||[]),r(t)})},function(t){r(t,i)})}function D(t,e,n){function i(t,e,n,i){if(null!=i&&"function"!=typeof i)throw new Error("task callback must be a function");return t.started=!0,F(e)||(e=[e]),0===e.length&&t.idle()?R.setImmediate(function(){t.drain()}):(l(e,function(e){var o={data:e,callback:i||r};n?t.tasks.unshift(o):t.tasks.push(o),t.tasks.length===t.concurrency&&t.saturated()}),void R.setImmediate(t.process))}function o(t,e){return function(){a-=1;var n=!1,r=arguments;l(e,function(t){l(u,function(e,r){e!==t||n||(u.splice(r,1),n=!0)}),t.callback.apply(t,r)}),t.tasks.length+a===0&&t.drain(),t.process()}}if(null==e)e=1;else if(0===e)throw new Error("Concurrency must not be zero");var a=0,u=[],c={tasks:[],concurrency:e,payload:n,saturated:r,empty:r,drain:r,started:!1,paused:!1,push:function(t,e){i(c,t,!1,e)},kill:function(){c.drain=r,c.tasks=[]},unshift:function(t,e){i(c,t,!0,e)},process:function(){for(;!c.paused&&a=e;e++)R.setImmediate(c.process)}}};return c}function I(t){return g(function(e,n){e.apply(null,n.concat([g(function(e,n){"object"==typeof console&&(e?console.error&&console.error(e):console[t]&&l(n,function(e){console[t](e)}))})]))})}function M(t){return function(e,n,r){t(d(e),n,r)}}function C(t){return g(function(e,n){var r=g(function(n){var r=this,i=n.pop();return t(e,function(t,e,i){t.apply(r,n.concat([i]))},i)});return n.length?r.apply(this,n):r})}function q(t){return g(function(e){var n=e.pop();e.push(function(){var t=arguments;r?R.setImmediate(function(){n.apply(null,t)}):n.apply(null,t)});var r=!0;t.apply(this,e),r=!1})}var L,R={},N="object"==typeof self&&self.self===self&&self||"object"==typeof n&&n.global===n&&n||this;null!=N&&(L=N.async),R.noConflict=function(){return N.async=L,R};var P=Object.prototype.toString,F=Array.isArray||function(t){return"[object Array]"===P.call(t)},U=function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},H=Object.keys||function(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e},Y="function"==typeof setImmediate&&setImmediate,B=Y?function(t){Y(t)}:function(t){setTimeout(t,0)};"object"==typeof t&&"function"==typeof t.nextTick?R.nextTick=t.nextTick:R.nextTick=B,R.setImmediate=Y?B:R.nextTick,R.forEach=R.each=function(t,e,n){return R.eachOf(t,_(e),n)},R.forEachSeries=R.eachSeries=function(t,e,n){return R.eachOfSeries(t,_(e),n)},R.forEachLimit=R.eachLimit=function(t,e,n,r){return y(e)(t,_(n),r)},R.forEachOf=R.eachOf=function(t,e,n){function i(t){c--,t?n(t):null===o&&0>=c&&n(null)}n=u(n||r),t=t||[];for(var o,a=m(t),c=0;null!=(o=a());)c+=1,e(t[o],o,s(i));0===c&&n(null)},R.forEachOfSeries=R.eachOfSeries=function(t,e,n){function i(){var r=!0;return null===a?n(null):(e(t[a],a,s(function(t){if(t)n(t);else{if(a=o(),null===a)return n(null);r?R.setImmediate(i):i()}})),void(r=!1))}n=u(n||r),t=t||[];var o=m(t),a=o();i()},R.forEachOfLimit=R.eachOfLimit=function(t,e,n,r){y(e)(t,n,r)},R.map=b(k),R.mapSeries=x(k),R.mapLimit=w(k),R.inject=R.foldl=R.reduce=function(t,e,n,r){R.eachOfSeries(t,function(t,r,i){n(e,t,function(t,n){e=n,i(t)})},function(t){r(t,e)})},R.foldr=R.reduceRight=function(t,e,n,r){var o=f(t,i).reverse();R.reduce(o,e,n,r)},R.transform=function(t,e,n,r){3===arguments.length&&(r=n,n=e,e=F(t)?[]:{}),R.eachOf(t,function(t,r,i){n(e,t,r,i)},function(t){r(t,e)})},R.select=R.filter=b(S),R.selectLimit=R.filterLimit=w(S),R.selectSeries=R.filterSeries=x(S),R.reject=b(E),R.rejectLimit=w(E),R.rejectSeries=x(E),R.any=R.some=O(R.eachOf,o,i),R.someLimit=O(R.eachOfLimit,o,i),R.all=R.every=O(R.eachOf,a,a),R.everyLimit=O(R.eachOfLimit,a,a),R.detect=O(R.eachOf,i,A),R.detectSeries=O(R.eachOfSeries,i,A),R.detectLimit=O(R.eachOfLimit,i,A),R.sortBy=function(t,e,n){function r(t,e){var n=t.criteria,r=e.criteria;return r>n?-1:n>r?1:0}R.map(t,function(t,n){e(t,function(e,r){e?n(e):n(null,{value:t,criteria:r})})},function(t,e){return t?n(t):void n(null,f(e.sort(r),function(t){return t.value}))})},R.auto=function(t,e,n){function i(t){_.unshift(t)}function o(t){var e=v(_,t);e>=0&&_.splice(e,1)}function a(){c--,l(_.slice(0),function(t){t()})}"function"==typeof arguments[1]&&(n=e,e=null),n=u(n||r);var s=H(t),c=s.length;if(!c)return n(null);e||(e=c);var f={},d=0,m=!1,_=[];i(function(){c||n(null,f)}),l(s,function(r){function s(){return e>d&&h(y,function(t,e){return t&&f.hasOwnProperty(e)},!0)&&!f.hasOwnProperty(r)}function u(){s()&&(d++,o(u),l[l.length-1](_,f))}if(!m){for(var c,l=F(t[r])?t[r]:[t[r]],_=g(function(t,e){if(d--,e.length<=1&&(e=e[0]),t){var i={};p(f,function(t,e){i[e]=t}),i[r]=e,m=!0,n(t,i)}else f[r]=e,R.setImmediate(a)}),y=l.slice(0,l.length-1),b=y.length;b--;){if(!(c=t[y[b]]))throw new Error("Has nonexistent dependency in "+y.join(", "));if(F(c)&&v(c,r)>=0)throw new Error("Has cyclic dependencies")}s()?(d++,l[l.length-1](_,f)):i(u)}})},R.retry=function(t,e,n){function r(t,e){if("number"==typeof e)t.times=parseInt(e,10)||o;else{if("object"!=typeof e)throw new Error("Unsupported argument type for 'times': "+typeof e);t.times=parseInt(e.times,10)||o,t.interval=parseInt(e.interval,10)||a}}function i(t,e){function n(t,n){return function(r){t(function(t,e){r(!t||n,{err:t,result:e})},e)}}function r(t){return function(e){setTimeout(function(){e(null)},t)}}for(;u.times;){var i=!(u.times-=1);s.push(n(u.task,i)),!i&&u.interval>0&&s.push(r(u.interval))}R.series(s,function(e,n){n=n[n.length-1],(t||u.callback)(n.err,n.result)})}var o=5,a=0,s=[],u={times:o,interval:a},c=arguments.length;if(1>c||c>3)throw new Error("Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)");return 2>=c&&"function"==typeof t&&(n=e,e=t),"function"!=typeof t&&r(u,t),u.callback=n,u.task=e,u.callback?i():i},R.waterfall=function(t,e){function n(t){return g(function(r,i){if(r)e.apply(null,[r].concat(i));else{var o=t.next();o?i.push(n(o)):i.push(e),q(t).apply(null,i)}})}if(e=u(e||r),!F(t)){var i=new Error("First argument to waterfall must be an array of functions");return e(i)}return t.length?void n(R.iterator(t))():e()},R.parallel=function(t,e){j(R.eachOf,t,e)},R.parallelLimit=function(t,e,n){j(y(e),t,n)},R.series=function(t,e){j(R.eachOfSeries,t,e)},R.iterator=function(t){function e(n){function r(){return t.length&&t[n].apply(null,arguments),r.next()}return r.next=function(){return nr;){var o=r+(i-r+1>>>1);n(e,t[o])>=0?r=o:i=o-1}return r}function o(t,e,o,a){if(null!=a&&"function"!=typeof a)throw new Error("task callback must be a function");return t.started=!0,F(e)||(e=[e]),0===e.length?R.setImmediate(function(){t.drain()}):void l(e,function(e){var s={data:e,priority:o,callback:"function"==typeof a?a:r};t.tasks.splice(i(t.tasks,s,n)+1,0,s),t.tasks.length===t.concurrency&&t.saturated(),R.setImmediate(t.process)})}var a=R.queue(t,e);return a.push=function(t,e,n){o(a,t,e,n)},delete a.unshift,a},R.cargo=function(t,e){return D(t,1,e)},R.log=I("log"),R.dir=I("dir"),R.memoize=function(t,e){var n={},r={},o=Object.prototype.hasOwnProperty;e=e||i;var a=g(function(i){var a=i.pop(),s=e.apply(null,i);o.call(n,s)?R.setImmediate(function(){a.apply(null,n[s])}):o.call(r,s)?r[s].push(a):(r[s]=[a],t.apply(null,i.concat([g(function(t){n[s]=t;var e=r[s];delete r[s];for(var i=0,o=e.length;o>i;i++)e[i].apply(null,t)})])))});return a.memo=n,a.unmemoized=t,a},R.unmemoize=function(t){return function(){return(t.unmemoized||t).apply(null,arguments)}},R.times=M(R.map),R.timesSeries=M(R.mapSeries),R.timesLimit=function(t,e,n,r){return R.mapLimit(d(t),e,n,r)},R.seq=function(){var t=arguments;return g(function(e){var n=this,i=e[e.length-1];"function"==typeof i?e.pop():i=r,R.reduce(t,e,function(t,e,r){e.apply(n,t.concat([g(function(t,e){r(t,e)})]))},function(t,e){i.apply(n,[t].concat(e))})})},R.compose=function(){return R.seq.apply(null,Array.prototype.reverse.call(arguments))},R.applyEach=C(R.eachOf),R.applyEachSeries=C(R.eachOfSeries),R.forever=function(t,e){function n(t){return t?i(t):void o(n)}var i=s(e||r),o=q(t);n()},R.ensureAsync=q,R.constant=g(function(t){var e=[null].concat(t);return function(t){return t.apply(this,e)}}),R.wrapSync=R.asyncify=function(t){return g(function(e){var n,r=e.pop();try{n=t.apply(this,e)}catch(i){return r(i)}U(n)&&"function"==typeof n.then?n.then(function(t){r(null,t)})["catch"](function(t){r(t.message?t:new Error(t))}):r(null,n)})},"object"==typeof e&&e.exports?e.exports=R:"function"==typeof define&&define.amd?define([],function(){return R}):N.async=R}()}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:125}],31:[function(t,e,n){(function(e){!function(r){var i="object"==typeof self&&self.self===self&&self||"object"==typeof e&&e.global===e&&e;if("function"==typeof define&&define.amd)define(["underscore","jquery","exports"],function(t,e,n){i.Backbone=r(i,n,t,e)});else if("undefined"!=typeof n){var o,a=t("underscore");try{o=t("jquery")}catch(s){}r(i,n,a,o)}else i.Backbone=r(i,{},i._,i.jQuery||i.Zepto||i.ender||i.$)}(function(t,e,n,r){var i=t.Backbone,o=Array.prototype.slice;e.VERSION="1.2.3",e.$=r,e.noConflict=function(){return t.Backbone=i,this},e.emulateHTTP=!1,e.emulateJSON=!1;var a=function(t,e,r){switch(t){case 1:return function(){return n[e](this[r])};case 2:return function(t){return n[e](this[r],t)};case 3:return function(t,i){return n[e](this[r],u(t,this),i)};case 4:return function(t,i,o){return n[e](this[r],u(t,this),i,o)};default:return function(){var t=o.call(arguments);return t.unshift(this[r]),n[e].apply(n,t)}}},s=function(t,e,r){n.each(e,function(e,i){n[i]&&(t.prototype[i]=a(e,i,r))})},u=function(t,e){return n.isFunction(t)?t:n.isObject(t)&&!e._isModel(t)?c(t):n.isString(t)?function(e){return e.get(t)}:t},c=function(t){var e=n.matches(t);return function(t){return e(t.attributes)}},l=e.Events={},f=/\s+/,d=function(t,e,r,i,o){var a,s=0;if(r&&"object"==typeof r){void 0!==i&&"context"in o&&void 0===o.context&&(o.context=i);for(a=n.keys(r);sr;r++)n[r]=arguments[r+1];return d(g,this._events,t,void 0,n),this};var g=function(t,e,n,r){if(t){var i=t[e],o=t.all;i&&o&&(o=o.slice()),i&&_(i,r),o&&_(o,[e].concat(r))}return t},_=function(t,e){var n,r=-1,i=t.length,o=e[0],a=e[1],s=e[2];switch(e.length){case 0:for(;++rr;r++)t[r+n]=e[r];for(r=0;rthis.length&&(i=this.length),0>i&&(i+=this.length+1);var o,a,s=[],u=[],c=[],l=[],f={},d=e.add,h=e.merge,p=e.remove,v=!1,m=this.comparator&&null==i&&e.sort!==!1,g=n.isString(this.comparator)?this.comparator:null;for(a=0;at&&(t+=this.length),this.models[t]},where:function(t,e){return this[e?"find":"filter"](t)},findWhere:function(t){return this.where(t,!0)},sort:function(t){ -var e=this.comparator;if(!e)throw new Error("Cannot sort a set without a comparator");t||(t={});var r=e.length;return n.isFunction(e)&&(e=n.bind(e,this)),1===r||n.isString(e)?this.models=this.sortBy(e):this.models.sort(e),t.silent||this.trigger("sort",this,t),this},pluck:function(t){return this.map(t+"")},fetch:function(t){t=n.extend({parse:!0},t);var e=t.success,r=this;return t.success=function(n){var i=t.reset?"reset":"set";r[i](n,t),e&&e.call(t.context,r,n,t),r.trigger("sync",r,n,t)},H(this,t),this.sync("read",this,t)},create:function(t,e){e=e?n.clone(e):{};var r=e.wait;if(t=this._prepareModel(t,e),!t)return!1;r||this.add(t,e);var i=this,o=e.success;return e.success=function(t,e,n){r&&i.add(t,n),o&&o.call(n.context,t,e,n)},t.save(null,e),t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(t){return t[this.model.prototype.idAttribute||"id"]},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(t,e){if(this._isModel(t))return t.collection||(t.collection=this),t;e=e?n.clone(e):{},e.collection=this;var r=new this.model(t,e);return r.validationError?(this.trigger("invalid",this,r.validationError,e),!1):r},_removeModels:function(t,e){for(var n=[],r=0;r7),this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.history||!this.history.pushState),this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(N,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var e=this.root.slice(0,-1)||"/";return this.location.replace(e+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;var r=document.body,i=r.insertBefore(this.iframe,r.firstChild).contentWindow;i.document.open(),i.document.close(),i.location.hash="#"+this.fragment}var o=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};return this._usePushState?o("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?o("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.options.silent?void 0:this.loadUrl()},stop:function(){var t=window.removeEventListener||function(t,e){return detachEvent("on"+t,e)};this._usePushState?t("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&t("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),L.started=!1},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();return e===this.fragment&&this.iframe&&(e=this.getHash(this.iframe.contentWindow)),e===this.fragment?!1:(this.iframe&&this.navigate(e),void this.loadUrl())},loadUrl:function(t){return this.matchRoot()?(t=this.fragment=this.getFragment(t),n.some(this.handlers,function(e){return e.route.test(t)?(e.callback(t),!0):void 0})):!1},navigate:function(t,e){if(!L.started)return!1;e&&e!==!0||(e={trigger:!!e}),t=this.getFragment(t||"");var n=this.root;""!==t&&"?"!==t.charAt(0)||(n=n.slice(0,-1)||"/");var r=n+t;if(t=this.decodeFragment(t.replace(P,"")),this.fragment!==t){if(this.fragment=t,this._usePushState)this.history[e.replace?"replaceState":"pushState"]({},document.title,r);else{if(!this._wantsHashChange)return this.location.assign(r);if(this._updateHash(this.location,t,e.replace),this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var i=this.iframe.contentWindow;e.replace||(i.document.open(),i.document.close()),this._updateHash(i.location,t,e.replace)}}return e.trigger?this.loadUrl(t):void 0}},_updateHash:function(t,e,n){if(n){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else t.hash="#"+e}}),e.history=new L;var F=function(t,e){var r,i=this;return r=t&&n.has(t,"constructor")?t.constructor:function(){return i.apply(this,arguments)},n.extend(r,i,e),r.prototype=n.create(i.prototype,t),r.prototype.constructor=r,r.__super__=i.prototype,r};y.extend=w.extend=D.extend=O.extend=L.extend=F;var U=function(){throw new Error('A "url" property or function must be specified')},H=function(t,e){var n=e.error;e.error=function(r){n&&n.call(e.context,t,r,e),t.trigger("error",t,r,e)}};return e})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{jquery:32,underscore:134}],32:[function(t,e,n){},{}],33:[function(t,e,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function o(t){return"number"==typeof t}function a(t){return"object"==typeof t&&null!==t}function s(t){return void 0===t}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if(!o(t)||0>t||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,n,r,o,u,c;if(this._events||(this._events={}),"error"===t&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[t],s(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),n.apply(this,o)}else if(a(n))for(o=Array.prototype.slice.call(arguments,1),c=n.slice(),r=c.length,u=0;r>u;u++)c[u].apply(this,o);return!0},r.prototype.addListener=function(t,e){var n;if(!i(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e),this._events[t]?a(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,a(this._events[t])&&!this._events[t].warned&&(n=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[t].length>n&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},r.prototype.removeListener=function(t,e){var n,r,o,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,r=-1,n===e||i(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(a(n)){for(s=o;s-- >0;)if(n[s]===e||n[s].listener&&n[s].listener===e){r=s;break}if(0>r)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],i(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},{}],34:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function o(){var t=new s.HandlebarsEnvironment;return h.extend(t,s),t.SafeString=c["default"],t.Exception=f["default"],t.Utils=h,t.escapeExpression=h.escapeExpression,t.VM=v,t.template=function(e){return v.template(e,t)},t}n.__esModule=!0;var a=t("./handlebars/base"),s=i(a),u=t("./handlebars/safe-string"),c=r(u),l=t("./handlebars/exception"),f=r(l),d=t("./handlebars/utils"),h=i(d),p=t("./handlebars/runtime"),v=i(p),m=t("./handlebars/no-conflict"),g=r(m),_=o();_.create=o,g["default"](_),_["default"]=_,n["default"]=_,e.exports=n["default"]},{"./handlebars/base":35,"./handlebars/exception":38,"./handlebars/no-conflict":48,"./handlebars/runtime":49,"./handlebars/safe-string":50,"./handlebars/utils":51}],35:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e,n){this.helpers=t||{},this.partials=e||{},this.decorators=n||{},u.registerDefaultHelpers(this),c.registerDefaultDecorators(this)}n.__esModule=!0,n.HandlebarsEnvironment=i;var o=t("./utils"),a=t("./exception"),s=r(a),u=t("./helpers"),c=t("./decorators"),l=t("./logger"),f=r(l),d="4.0.5";n.VERSION=d;var h=7;n.COMPILER_REVISION=h;var p={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0"};n.REVISION_CHANGES=p;var v="[object Object]";i.prototype={constructor:i,logger:f["default"],log:f["default"].log,registerHelper:function(t,e){if(o.toString.call(t)===v){if(e)throw new s["default"]("Arg not supported with multiple helpers");o.extend(this.helpers,t)}else this.helpers[t]=e},unregisterHelper:function(t){delete this.helpers[t]},registerPartial:function(t,e){if(o.toString.call(t)===v)o.extend(this.partials,t);else{if("undefined"==typeof e)throw new s["default"]('Attempting to register a partial called "'+t+'" as undefined');this.partials[t]=e}},unregisterPartial:function(t){delete this.partials[t]},registerDecorator:function(t,e){if(o.toString.call(t)===v){if(e)throw new s["default"]("Arg not supported with multiple decorators");o.extend(this.decorators,t)}else this.decorators[t]=e},unregisterDecorator:function(t){delete this.decorators[t]}};var m=f["default"].log;n.log=m,n.createFrame=o.createFrame,n.logger=f["default"]},{"./decorators":36,"./exception":38,"./helpers":39,"./logger":47,"./utils":51}],36:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){a["default"](t)}n.__esModule=!0,n.registerDefaultDecorators=i;var o=t("./decorators/inline"),a=r(o)},{"./decorators/inline":37}],37:[function(t,e,n){"use strict";n.__esModule=!0;var r=t("../utils");n["default"]=function(t){t.registerDecorator("inline",function(t,e,n,i){var o=t;return e.partials||(e.partials={},o=function(i,o){var a=n.partials;n.partials=r.extend({},a,e.partials);var s=t(i,o);return n.partials=a,s}),e.partials[i.args[0]]=i.fn,o})},e.exports=n["default"]},{"../utils":51}],38:[function(t,e,n){"use strict";function r(t,e){var n=e&&e.loc,o=void 0,a=void 0;n&&(o=n.start.line,a=n.start.column,t+=" - "+o+":"+a);for(var s=Error.prototype.constructor.call(this,t),u=0;u0?(n.ids&&(n.ids=[n.name]),t.helpers.each(e,n)):i(this);if(n.data&&n.ids){var a=r.createFrame(n.data);a.contextPath=r.appendContextPath(n.data.contextPath,n.name),n={data:a}}return o(e,n)})},e.exports=n["default"]},{"../utils":51}],41:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}n.__esModule=!0;var i=t("../utils"),o=t("../exception"),a=r(o);n["default"]=function(t){t.registerHelper("each",function(t,e){function n(e,n,o){c&&(c.key=e,c.index=n,c.first=0===n,c.last=!!o,l&&(c.contextPath=l+e)),u+=r(t[e],{data:c,blockParams:i.blockParams([t[e],e],[l+e,null])})}if(!e)throw new a["default"]("Must pass iterator to #each");var r=e.fn,o=e.inverse,s=0,u="",c=void 0,l=void 0;if(e.data&&e.ids&&(l=i.appendContextPath(e.data.contextPath,e.ids[0])+"."),i.isFunction(t)&&(t=t.call(this)),e.data&&(c=i.createFrame(e.data)),t&&"object"==typeof t)if(i.isArray(t))for(var f=t.length;f>s;s++)s in t&&n(s,s,s===t.length-1);else{var d=void 0;for(var h in t)t.hasOwnProperty(h)&&(void 0!==d&&n(d,s-1),d=h,s++);void 0!==d&&n(d,s-1,!0)}return 0===s&&(u=o(this)),u})},e.exports=n["default"]},{"../exception":38,"../utils":51}],42:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}n.__esModule=!0;var i=t("../exception"),o=r(i);n["default"]=function(t){t.registerHelper("helperMissing",function(){if(1!==arguments.length)throw new o["default"]('Missing helper: "'+arguments[arguments.length-1].name+'"')})},e.exports=n["default"]},{"../exception":38}],43:[function(t,e,n){"use strict";n.__esModule=!0;var r=t("../utils");n["default"]=function(t){t.registerHelper("if",function(t,e){return r.isFunction(t)&&(t=t.call(this)),!e.hash.includeZero&&!t||r.isEmpty(t)?e.inverse(this):e.fn(this)}),t.registerHelper("unless",function(e,n){return t.helpers["if"].call(this,e,{fn:n.inverse,inverse:n.fn,hash:n.hash})})},e.exports=n["default"]},{"../utils":51}],44:[function(t,e,n){"use strict";n.__esModule=!0,n["default"]=function(t){t.registerHelper("log",function(){for(var e=[void 0],n=arguments[arguments.length-1],r=0;r=0?e:parseInt(t,10)}return t},log:function(t){if(t=i.lookupLevel(t),"undefined"!=typeof console&&i.lookupLevel(i.level)<=t){var e=i.methodMap[t];console[e]||(e="log");for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;n>o;o++)r[o-1]=arguments[o];console[e].apply(console,r)}}};n["default"]=i,e.exports=n["default"]},{"./utils":51}],48:[function(t,e,n){(function(t){"use strict";n.__esModule=!0,n["default"]=function(e){var n="undefined"!=typeof t?t:window,r=n.Handlebars;e.noConflict=function(){return n.Handlebars===e&&(n.Handlebars=r),e}},e.exports=n["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],49:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function o(t){var e=t&&t[0]||1,n=g.COMPILER_REVISION;if(e!==n){if(n>e){var r=g.REVISION_CHANGES[n],i=g.REVISION_CHANGES[e];throw new m["default"]("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+r+") or downgrade your runtime to an older version ("+i+").")}throw new m["default"]("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+t[1]+").")}}function a(t,e){function n(n,r,i){i.hash&&(r=p.extend({},r,i.hash),i.ids&&(i.ids[0]=!0)),n=e.VM.resolvePartial.call(this,n,r,i);var o=e.VM.invokePartial.call(this,n,r,i);if(null==o&&e.compile&&(i.partials[i.name]=e.compile(n,t.compilerOptions,e),o=i.partials[i.name](r,i)),null!=o){if(i.indent){for(var a=o.split("\n"),s=0,u=a.length;u>s&&(a[s]||s+1!==u);s++)a[s]=i.indent+a[s];o=a.join("\n")}return o}throw new m["default"]("The partial "+i.name+" could not be compiled when running in runtime-only mode")}function r(e){function n(e){return""+t.main(i,e,i.helpers,i.partials,a,u,s)}var o=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],a=o.data;r._setup(o),!o.partial&&t.useData&&(a=f(e,a));var s=void 0,u=t.useBlockParams?[]:void 0;return t.useDepths&&(s=o.depths?e!==o.depths[0]?[e].concat(o.depths):o.depths:[e]),(n=d(t.main,n,i,o.depths||[],a,u))(e,o)}if(!e)throw new m["default"]("No environment passed to template");if(!t||!t.main)throw new m["default"]("Unknown template object: "+typeof t);t.main.decorator=t.main_d,e.VM.checkRevision(t.compiler);var i={strict:function(t,e){if(!(e in t))throw new m["default"]('"'+e+'" not defined in '+t);return t[e]},lookup:function(t,e){for(var n=t.length,r=0;n>r;r++)if(t[r]&&null!=t[r][e])return t[r][e]},lambda:function(t,e){return"function"==typeof t?t.call(e):t},escapeExpression:p.escapeExpression,invokePartial:n,fn:function(e){var n=t[e];return n.decorator=t[e+"_d"],n},programs:[],program:function(t,e,n,r,i){var o=this.programs[t],a=this.fn(t);return e||i||r||n?o=s(this,t,a,e,n,r,i):o||(o=this.programs[t]=s(this,t,a)),o},data:function(t,e){for(;t&&e--;)t=t._parent;return t},merge:function(t,e){var n=t||e;return t&&e&&t!==e&&(n=p.extend({},e,t)),n},noop:e.VM.noop,compilerInfo:t.compiler};return r.isTop=!0,r._setup=function(n){n.partial?(i.helpers=n.helpers,i.partials=n.partials,i.decorators=n.decorators):(i.helpers=i.merge(n.helpers,e.helpers),t.usePartial&&(i.partials=i.merge(n.partials,e.partials)),(t.usePartial||t.useDecorators)&&(i.decorators=i.merge(n.decorators,e.decorators)))},r._child=function(e,n,r,o){if(t.useBlockParams&&!r)throw new m["default"]("must pass block params");if(t.useDepths&&!o)throw new m["default"]("must pass parent depths");return s(i,e,t[e],n,0,r,o)},r}function s(t,e,n,r,i,o,a){function s(e){var i=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],s=a;return a&&e!==a[0]&&(s=[e].concat(a)),n(t,e,t.helpers,t.partials,i.data||r,o&&[i.blockParams].concat(o),s)}return s=d(n,s,t,a,r,o),s.program=e,s.depth=a?a.length:0,s.blockParams=i||0,s}function u(t,e,n){return t?t.call||n.name||(n.name=t,t=n.partials[t]):t="@partial-block"===n.name?n.data["partial-block"]:n.partials[n.name],t}function c(t,e,n){n.partial=!0,n.ids&&(n.data.contextPath=n.ids[0]||n.data.contextPath);var r=void 0;if(n.fn&&n.fn!==l&&(n.data=g.createFrame(n.data),r=n.data["partial-block"]=n.fn,r.partials&&(n.partials=p.extend({},n.partials,r.partials))),void 0===t&&r&&(t=r),void 0===t)throw new m["default"]("The partial "+n.name+" could not be found");return t instanceof Function?t(e,n):void 0}function l(){return""}function f(t,e){return e&&"root"in e||(e=e?g.createFrame(e):{},e.root=t),e}function d(t,e,n,r,i,o){if(t.decorator){var a={};e=t.decorator(e,a,n,r&&r[0],i,o,r),p.extend(e,a)}return e}n.__esModule=!0,n.checkRevision=o,n.template=a,n.wrapProgram=s,n.resolvePartial=u,n.invokePartial=c,n.noop=l;var h=t("./utils"),p=i(h),v=t("./exception"),m=r(v),g=t("./base")},{"./base":35,"./exception":38,"./utils":51}],50:[function(t,e,n){"use strict";function r(t){this.string=t}n.__esModule=!0,r.prototype.toString=r.prototype.toHTML=function(){return""+this.string},n["default"]=r,e.exports=n["default"]},{}],51:[function(t,e,n){"use strict";function r(t){return f[t]}function i(t){for(var e=1;en;n++)if(t[n]===e)return n;return-1}function a(t){if("string"!=typeof t){if(t&&t.toHTML)return t.toHTML();if(null==t)return"";if(!t)return t+"";t=""+t}return h.test(t)?t.replace(d,r):t}function s(t){return t||0===t?!(!m(t)||0!==t.length):!0}function u(t){var e=i({},t);return e._parent=t,e}function c(t,e){return t.path=e,t}function l(t,e){return(t?t+".":"")+e}n.__esModule=!0,n.extend=i,n.indexOf=o,n.escapeExpression=a,n.isEmpty=s,n.createFrame=u,n.blockParams=c,n.appendContextPath=l;var f={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},d=/[&<>"'`=]/g,h=/[&<>"'`=]/,p=Object.prototype.toString;n.toString=p;var v=function(t){return"function"==typeof t};v(/x/)&&(n.isFunction=v=function(t){return"function"==typeof t&&"[object Function]"===p.call(t)}),n.isFunction=v;var m=Array.isArray||function(t){return t&&"object"==typeof t?"[object Array]"===p.call(t):!1};n.isArray=m},{}],52:[function(t,e,n){e.exports=t("./dist/cjs/handlebars.runtime")["default"]},{"./dist/cjs/handlebars.runtime":34}],53:[function(t,e,n){function r(){}var i=t("./_nativeCreate"),o=Object.prototype;r.prototype=i?i(null):o,e.exports=r},{"./_nativeCreate":103}],54:[function(t,e,n){var r=t("./_getNative"),i=t("./_root"),o=r(i,"Map");e.exports=o},{"./_getNative":85,"./_root":104}],55:[function(t,e,n){function r(t){var e=-1,n=t?t.length:0;for(this.clear();++e-1}var i=t("./_baseIndexOf");e.exports=r},{"./_baseIndexOf":72}],60:[function(t,e,n){function r(t,e,n){for(var r=-1,i=t.length;++rn)return!1;var r=t.length-1;return n==r?t.pop():a.call(t,n,1),!0}var i=t("./_assocIndexOf"),o=Array.prototype,a=o.splice;e.exports=r},{"./_assocIndexOf":68}],66:[function(t,e,n){function r(t,e){var n=i(t,e);return 0>n?void 0:t[n][1]}var i=t("./_assocIndexOf");e.exports=r},{"./_assocIndexOf":68}],67:[function(t,e,n){function r(t,e){return i(t,e)>-1}var i=t("./_assocIndexOf");e.exports=r},{"./_assocIndexOf":68}],68:[function(t,e,n){function r(t,e){for(var n=t.length;n--;)if(i(t[n][0],e))return n;return-1}var i=t("./eq");e.exports=r},{"./eq":106}],69:[function(t,e,n){function r(t,e,n){var r=i(t,e);0>r?t.push([e,n]):t[r][1]=n}var i=t("./_assocIndexOf");e.exports=r},{"./_assocIndexOf":68}],70:[function(t,e,n){function r(t,e,n,r){var f=-1,d=o,h=!0,p=t.length,v=[],m=e.length;if(!p)return v;n&&(e=s(e,u(n))),r?(d=a,h=!1):e.length>=l&&(d=c,h=!1,e=new i(e));t:for(;++f0&&s(f)&&(n||a(f)||o(f))?e>1?r(f,e-1,n,u):i(u,f):n||(u[u.length]=f)}return u}var i=t("./_arrayPush"),o=t("./isArguments"),a=t("./isArray"),s=t("./isArrayLikeObject");e.exports=r},{"./_arrayPush":62,"./isArguments":107,"./isArray":108,"./isArrayLikeObject":110}],72:[function(t,e,n){function r(t,e,n){if(e!==e)return i(t,n);for(var r=n-1,o=t.length;++r1?n[o-1]:void 0,s=o>2?n[2]:void 0;for(a="function"==typeof a?(o--,a):void 0,s&&i(n[0],n[1],s)&&(a=3>o?void 0:a,o=1),e=Object(e);++r-1&&t%1==0&&e>t}var i=9007199254740991,o=/^(?:0|[1-9]\d*)$/;e.exports=r},{}],94:[function(t,e,n){function r(t,e,n){if(!s(n))return!1;var r=typeof e;return("number"==r?o(n)&&a(e,n.length):"string"==r&&e in n)?i(n[e],t):!1}var i=t("./eq"),o=t("./isArrayLike"),a=t("./_isIndex"),s=t("./isObject");e.exports=r},{"./_isIndex":93,"./eq":106,"./isArrayLike":109,"./isObject":114}],95:[function(t,e,n){function r(t){var e=typeof t;return"number"==e||"boolean"==e||"string"==e&&"__proto__"!=t||null==t}e.exports=r},{}],96:[function(t,e,n){function r(t){var e=t&&t.constructor,n="function"==typeof e&&e.prototype||i;return t===n}var i=Object.prototype;e.exports=r},{}],97:[function(t,e,n){function r(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}e.exports=r},{}],98:[function(t,e,n){function r(){this.__data__={hash:new i,map:o?new o:[],string:new i}}var i=t("./_Hash"),o=t("./_Map");e.exports=r},{"./_Hash":53,"./_Map":54}],99:[function(t,e,n){function r(t){var e=this.__data__;return s(t)?a("string"==typeof t?e.string:e.hash,t):i?e.map["delete"](t):o(e.map,t)}var i=t("./_Map"),o=t("./_assocDelete"),a=t("./_hashDelete"),s=t("./_isKeyable");e.exports=r},{"./_Map":54,"./_assocDelete":65,"./_hashDelete":86,"./_isKeyable":95}],100:[function(t,e,n){function r(t){var e=this.__data__;return s(t)?a("string"==typeof t?e.string:e.hash,t):i?e.map.get(t):o(e.map,t)}var i=t("./_Map"),o=t("./_assocGet"),a=t("./_hashGet"),s=t("./_isKeyable");e.exports=r},{"./_Map":54,"./_assocGet":66,"./_hashGet":87,"./_isKeyable":95}],101:[function(t,e,n){function r(t){var e=this.__data__;return s(t)?a("string"==typeof t?e.string:e.hash,t):i?e.map.has(t):o(e.map,t)}var i=t("./_Map"),o=t("./_assocHas"),a=t("./_hashHas"),s=t("./_isKeyable");e.exports=r},{"./_Map":54,"./_assocHas":67,"./_hashHas":88,"./_isKeyable":95}],102:[function(t,e,n){function r(t,e){var n=this.__data__;return s(t)?a("string"==typeof t?n.string:n.hash,t,e):i?n.map.set(t,e):o(n.map,t,e),this}var i=t("./_Map"),o=t("./_assocSet"),a=t("./_hashSet"),s=t("./_isKeyable");e.exports=r},{"./_Map":54,"./_assocSet":69,"./_hashSet":89,"./_isKeyable":95}],103:[function(t,e,n){var r=t("./_getNative"),i=r(Object,"create");e.exports=i},{"./_getNative":85}],104:[function(t,e,n){(function(r){var i=t("./_checkGlobal"),o={"function":!0,object:!0},a=o[typeof n]&&n&&!n.nodeType?n:void 0,s=o[typeof e]&&e&&!e.nodeType?e:void 0,u=i(a&&s&&"object"==typeof r&&r),c=i(o[typeof self]&&self),l=i(o[typeof window]&&window),f=i(o[typeof this]&&this),d=u||l!==(f&&f.window)&&l||c||f||Function("return this")();e.exports=d}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_checkGlobal":80}],105:[function(t,e,n){var r=t("./_assignValue"),i=t("./_copyObject"),o=t("./_createAssigner"),a=t("./isArrayLike"),s=t("./_isPrototype"),u=t("./keysIn"),c=Object.prototype,l=c.propertyIsEnumerable,f=!l.call({valueOf:1},"valueOf"),d=o(function(t,e){if(f||s(e)||a(e))return void i(e,u(e),t);for(var n in e)r(t,n,e[n])});e.exports=d},{"./_assignValue":64,"./_copyObject":81,"./_createAssigner":83,"./_isPrototype":96,"./isArrayLike":109,"./keysIn":117}],106:[function(t,e,n){function r(t,e){return t===e||t!==t&&e!==e}e.exports=r},{}],107:[function(t,e,n){function r(t){return i(t)&&s.call(t,"callee")&&(!c.call(t,"callee")||u.call(t)==o)}var i=t("./isArrayLikeObject"),o="[object Arguments]",a=Object.prototype,s=a.hasOwnProperty,u=a.toString,c=a.propertyIsEnumerable;e.exports=r},{"./isArrayLikeObject":110}],108:[function(t,e,n){var r=Array.isArray;e.exports=r},{}],109:[function(t,e,n){function r(t){return null!=t&&a(i(t))&&!o(t)}var i=t("./_getLength"),o=t("./isFunction"),a=t("./isLength");e.exports=r},{"./_getLength":84,"./isFunction":111,"./isLength":112}],110:[function(t,e,n){function r(t){return o(t)&&i(t)}var i=t("./isArrayLike"),o=t("./isObjectLike");e.exports=r},{"./isArrayLike":109,"./isObjectLike":115}],111:[function(t,e,n){function r(t){var e=i(t)?u.call(t):"";return e==o||e==a}var i=t("./isObject"),o="[object Function]",a="[object GeneratorFunction]",s=Object.prototype,u=s.toString;e.exports=r},{"./isObject":114}],112:[function(t,e,n){function r(t){return"number"==typeof t&&t>-1&&t%1==0&&i>=t}var i=9007199254740991;e.exports=r},{}],113:[function(t,e,n){function r(t){return null==t?!1:i(t)?d.test(l.call(t)):a(t)&&(o(t)?d:u).test(t)}var i=t("./isFunction"),o=t("./_isHostObject"),a=t("./isObjectLike"),s=/[\\^$.*+?()[\]{}|]/g,u=/^\[object .+?Constructor\]$/,c=Object.prototype,l=Function.prototype.toString,f=c.hasOwnProperty,d=RegExp("^"+l.call(f).replace(s,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=r},{"./_isHostObject":92,"./isFunction":111,"./isObjectLike":115}],114:[function(t,e,n){function r(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}e.exports=r},{}],115:[function(t,e,n){function r(t){return!!t&&"object"==typeof t}e.exports=r},{}],116:[function(t,e,n){function r(t){return"string"==typeof t||!i(t)&&o(t)&&u.call(t)==a}var i=t("./isArray"),o=t("./isObjectLike"),a="[object String]",s=Object.prototype,u=s.toString;e.exports=r},{"./isArray":108,"./isObjectLike":115}],117:[function(t,e,n){function r(t){for(var e=-1,n=s(t),r=i(t),u=r.length,l=o(t),f=!!l,d=l||[],h=d.length;++e-1}function h(t,e,n){for(var r=-1,i=t.length;++r-1;);return n}function M(t,e){for(var n=t.length;n--&&x(e,t[n],0)>-1;);return n}function C(t){return t&&t.Object===Object?t:null}function q(t,e){if(t!==e){var n=null===t,r=t===X,i=t===t,o=null===e,a=e===X,s=e===e;if(t>e&&!o||!i||n&&!a&&s||r&&s)return 1;if(e>t&&!n||!s||o&&!r&&i||a&&i)return-1}return 0}function L(t,e,n){for(var r=-1,i=t.criteria,o=e.criteria,a=i.length,s=n.length;++r=s)return u;var c=n[r];return u*("desc"==c?-1:1)}}return t.index-e.index}function R(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&r++;return r}function N(t){return xn[t]}function P(t){return kn[t]}function F(t){return"\\"+On[t]}function U(t,e,n){for(var r=t.length,i=e+(n?0:-1);n?i--:++i-1&&t%1==0&&e>t}function B(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}function W(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function V(t,e){for(var n=-1,r=t.length,i=0,o=[];++ne,i=n?t.length:0,o=gi(0,i,this.__views__),a=o.start,s=o.end,u=s-a,c=r?s:a-1,l=this.__iteratees__,f=l.length,d=0,h=yc(u,this.__takeCount__);if(!n||Q>i||i==u&&h==u)return Ar(t,this.__actions__);var p=[];t:for(;u--&&h>d;){c+=e;for(var v=-1,m=t[c];++vn)return!1;var r=t.length-1;return n==r?t.pop():dc.call(t,n,1),!0}function en(t,e){var n=rn(t,e);return 0>n?X:t[n][1]}function nn(t,e){return rn(t,e)>-1}function rn(t,e){for(var n=t.length;n--;)if(xa(t[n][0],e))return n;return-1}function on(t,e,n){var r=rn(t,e);0>r?t.push([e,n]):t[r][1]=n}function an(t,e,n,r){return t===X||xa(t,$u[n])&&!zu.call(r,n)?e:t}function sn(t,e,n){(n===X||xa(t[e],n))&&("number"!=typeof e||n!==X||e in t)||(t[e]=n)}function un(t,e,n){var r=t[e];zu.call(t,e)&&xa(r,n)&&(n!==X||e in t)||(t[e]=n)}function cn(t,e,n,r){return Rc(t,function(t,i,o){e(r,t,n(t),o)}),r}function ln(t,e){return t&&Ur(e,As(e),t)}function fn(t,e){for(var n=-1,r=null==t,i=e.length,o=Array(i);++n=t?t:n),e!==X&&(t=t>=e?t:e)),t}function En(t,e,n,r,i,o,a){var s;if(r&&(s=o?r(t,i,o,a):r(t)),s!==X)return s;if(!Ua(t))return t;var c=Ol(t);if(c){if(s=yi(t),!e)return Fr(t,s)}else{var l=mi(t),f=l==qt||l==Lt;if(Al(t))return Dr(t,e);if(l==Pt||l==Tt||f&&!o){if(H(t))return o?t:{};if(s=bi(f?{}:t),!e)return s=ln(s,t),n?Yr(t,s):s}else{if(!wn[l])return o?t:{};s=wi(t,l,e)}}a||(a=new ze);var d=a.get(t);return d?d:(a.set(t,s),(c?u:Un)(t,function(i,o){un(s,o,En(i,e,n,r,o,t,a))}),n&&!c?Yr(t,s):s)}function On(t){var e=As(t),n=e.length;return function(r){if(null==r)return!n;for(var i=n;i--;){var o=e[i],a=t[o],s=r[o];if(s===X&&!(o in Object(r))||!a(s))return!1}return!0}}function Tn(t){return Ua(t)?cc(t):{}}function Dn(t,e,n){if("function"!=typeof t)throw new Wu(tt);return fc(function(){t.apply(X,n)},e)}function Mn(t,e,n,r){var i=-1,o=d,a=!0,s=t.length,u=[],c=e.length;if(!s)return u;n&&(e=p(e,T(n))),r?(o=h,a=!1):e.length>=Q&&(o=$e,a=!1,e=new Ve(e));t:for(;++in&&(n=-n>i?0:i+n),r=r===X||r>i?i:cs(r),0>r&&(r+=i),r=n>r?0:ls(r);r>n;)t[n++]=e;return t}function Ln(t,e){var n=[];return Rc(t,function(t,r,i){e(t,r,i)&&n.push(t)}),n}function Pn(t,e,n,r){r||(r=[]);for(var i=-1,o=t.length;++i0&&ja(a)&&(n||Ol(a)||Ea(a))?e>1?Pn(a,e-1,n,r):v(r,a):n||(r[r.length]=a)}return r}function Fn(t,e){return null==t?t:Pc(t,e,js)}function Un(t,e){return t&&Pc(t,e,As)}function Hn(t,e){return t&&Fc(t,e,As)}function Yn(t,e){return f(e,function(e){return Na(t[e])})}function Bn(t,e){e=Si(e,t)?[e+""]:kn(e);for(var n=0,r=e.length;null!=t&&r>n;)t=t[e[n++]];return n&&n==r?t:X}function Wn(t,e){return zu.call(t,e)||"object"==typeof t&&e in t&&null===ac(t)}function Vn(t,e){return e in Object(t)}function $n(t,e,n){return t>=yc(e,n)&&t<_c(e,n)}function Gn(t,e,n){for(var r=n?h:d,i=t[0].length,o=t.length,a=o,s=Array(o),u=1/0,c=[];a--;){var l=t[a];a&&e&&(l=p(l,T(e))),u=yc(l.length,u),s[a]=!n&&(e||i>=120&&l.length>=120)?new Ve(a&&l):X}l=t[0];var f=-1,v=s[0];t:for(;++f-1;)s!==t&&dc.call(s,u,1),dc.call(t,u,1);return t}function hr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(r==n||i!=o){var o=i;if(Y(i))dc.call(t,i,1);else if(Si(i,t))delete t[i];else{var a=kn(i),s=Ii(t,a);null!=s&&delete s[Zi(a)]}}}return t}function pr(t,e){return t+pc(wc()*(e-t+1))}function vr(t,e,n,r){for(var i=-1,o=_c(hc((e-t)/(n||1)),0),a=Array(o);o--;)a[r?o:++i]=t,t+=n;return a}function mr(t,e,n,r){e=Si(e,t)?[e+""]:kn(e);for(var i=-1,o=e.length,a=o-1,s=t;null!=s&&++ie&&(e=-e>i?0:i+e),n=n>i?i:n,0>n&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r=i){for(;i>r;){var o=r+i>>>1,a=t[o];(n?e>=a:e>a)&&null!==a?r=o+1:i=o}return i}return br(t,e,_u,n)}function br(t,e,n,r){e=n(e);for(var i=0,o=t?t.length:0,a=e!==e,s=null===e,u=e===X;o>i;){var c=pc((i+o)/2),l=n(t[c]),f=l!==X,d=l===l;if(a)var h=d||r;else h=s?d&&f&&(r||null!=l):u?d&&(r||f):null==l?!1:r?e>=l:e>l;h?i=c+1:o=c}return yc(o,At)}function wr(t){return xr(t)}function xr(t,e){for(var n=0,r=t.length,i=t[0],o=e?e(i):i,a=o,s=1,u=[i];++n=Q){var c=e?null:Hc(t);if(c)return $(c);a=!1,i=$e,u=new Ve}else u=e?[]:s;t:for(;++rr?e[r]:X);return a}function Dr(t,e){if(e)return t.slice();var n=new t.constructor(t.length);return t.copy(n),n}function Ir(t){var e=new t.constructor(t.byteLength);return new rc(e).set(new rc(t)),e}function Mr(t){return m(W(t),r,new t.constructor)}function Cr(t){var e=new t.constructor(t.source,we.exec(t));return e.lastIndex=t.lastIndex,e}function qr(t){return m($(t),i,new t.constructor)}function Lr(t){return qc?Object(qc.call(t)):{}}function Rr(t,e){var n=e?Ir(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Nr(t,e,n,r){for(var i=-1,o=t.length,a=n.length,s=-1,u=e.length,c=_c(o-a,0),l=Array(u+c),f=!r;++si)&&(l[n[i]]=t[i]);for(;c--;)l[s++]=t[i++];return l}function Pr(t,e,n,r){for(var i=-1,o=t.length,a=-1,s=n.length,u=-1,c=e.length,l=_c(o-s,0),f=Array(l+c),d=!r;++ii)&&(f[h+n[a]]=t[i++]);return f}function Fr(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n1?n[i-1]:X,a=i>2?n[2]:X;for(o="function"==typeof o?(i--,o):X,a&&ki(n[0],n[1],a)&&(o=3>i?X:o,i=1),e=Object(e);++ra&&s[0]!==c&&s[a-1]!==c?[]:V(s,c);if(a-=l.length,n>a)return oi(t,e,Qr,r.placeholder,X,s,l,X,X,n-a);var f=this&&this!==Rn&&this instanceof r?i:t;return o(f,this,s)}var i=Kr(t);return r}function Zr(t){return da(function(e){e=Pn(e,1);var n=e.length,r=n,i=C.prototype.thru;for(t&&e.reverse();r--;){var o=e[r];if("function"!=typeof o)throw new Wu(tt);if(i&&!a&&"wrapper"==fi(o))var a=new C([],!0)}for(r=a?r:n;++r=Q)return a.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++ig){var x=V(y,b);return oi(t,e,Qr,l.placeholder,n,y,x,s,u,c-g)}var k=d?n:this,S=h?k[t]:t;return g=y.length,s?y=Mi(y,s):v&&g>1&&y.reverse(),f&&g>u&&(y.length=u),this&&this!==Rn&&this instanceof l&&(S=m||Kr(S)),S.apply(k,y)}var f=e<,d=e&rt,h=e&it,p=e&(at|st),v=e&dt,m=h?X:Kr(t);return l}function ti(t,e){return function(n,r){return zn(n,t,e(r),{})}}function ei(t){return da(function(e){return e=p(Pn(e,1),di()),da(function(n){var r=this;return t(e,function(t){return o(t,r,n)})})})}function ni(t,e,n){e=cs(e);var r=G(t);if(!e||r>=e)return"";var i=e-r;n=n===X?" ":n+"";var o=nu(n,hc(i/G(n)));return pn.test(n)?z(o).slice(0,i).join(""):o.slice(0,i)}function ri(t,e,n,r){function i(){for(var e=-1,u=arguments.length,c=-1,l=r.length,f=Array(l+u),d=this&&this!==Rn&&this instanceof i?s:t;++ce?1:-1:fs(r)||0,vr(e,n,r,t)}}function oi(t,e,n,r,i,o,a,s,u,c){var l=e&at,f=s?Fr(s):X,d=l?a:X,h=l?X:a,p=l?o:X,v=l?X:o;e|=l?ut:ct,e&=~(l?ct:ut),e&ot||(e&=~(rt|it));var m=[t,e,i,p,d,v,h,f,u,c],g=n.apply(X,m);return Oi(t)&&Vc(g,m),g.placeholder=r,g}function ai(t){var e=Yu[t];return function(t,n){if(t=fs(t),n=cs(n)){var r=(ps(t)+"e").split("e"),i=e(r[0]+"e"+(+r[1]+n));return r=(ps(i)+"e").split("e"),+(r[0]+"e"+(+r[1]-n))}return e(t)}}function si(t,e,n,r,i,o,a,s){var u=e⁢if(!u&&"function"!=typeof t)throw new Wu(tt);var c=r?r.length:0;if(c||(e&=~(ut|ct),r=i=X),a=a===X?a:_c(cs(a),0),s=s===X?s:cs(s),c-=i?i.length:0,e&ct){var l=r,f=i;r=i=X}var d=u?X:Yc(t),h=[t,e,n,r,i,l,f,o,a,s];if(d&&Ti(h,d),t=h[0],e=h[1],n=h[2],r=h[3],i=h[4],s=h[9]=null==h[9]?u?0:t.length:_c(h[9]-c,0),!s&&e&(at|st)&&(e&=~(at|st)),e&&e!=rt)p=e==at||e==st?Xr(t,e,s):e!=ut&&e!=(rt|ut)||i.length?Qr.apply(X,h):ri(t,e,n,r);else var p=Gr(t,e,n);var v=d?Uc:Vc;return v(p,h)}function ui(t,e,n,r,i,o){var a=-1,s=i&pt,u=i&ht,c=t.length,l=e.length;if(c!=l&&!(s&&l>c))return!1;var f=o.get(t);if(f)return f==e;var d=!0;for(o.set(t,e);++ai,a=r==lt&&n==at||r==lt&&n==ft&&t[7].length<=e[8]||r==(lt|ft)&&e[7].length<=e[8]&&n==at;if(!o&&!a)return t;r&rt&&(t[2]=e[2],i|=n&rt?0:ot);var s=e[3];if(s){var u=t[3];t[3]=u?Nr(u,s,e[4]):Fr(s),t[4]=u?V(t[3],nt):Fr(e[4])}return s=e[5],s&&(u=t[5],t[5]=u?Pr(u,s,e[6]):Fr(s),t[6]=u?V(t[5],nt):Fr(e[6])),s=e[7],s&&(t[7]=Fr(s)),r<&&(t[8]=null==t[8]?e[8]:yc(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=i,t}function Di(t,e,n,r,i,o){return Ua(t)&&Ua(e)&&or(t,e,X,Di,o.set(e,t)),t}function Ii(t,e){return 1==e.length?t:Ss(t,gr(e,0,-1))}function Mi(t,e){for(var n=t.length,r=yc(e.length,n),i=Fr(t);r--;){var o=e[r];t[r]=Y(o,n)?i[o]:X}return t}function Ci(t){var e=[];return ps(t).replace(he,function(t,n,r,i){e.push(r?i.replace(ye,"$1"):n||t)}),e}function qi(t){if(t instanceof Ae)return t.clone();var e=new C(t.__wrapped__,t.__chain__);return e.__actions__=Fr(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}function Li(t,e){e=_c(cs(e),0);var n=t?t.length:0;if(!n||1>e)return[];for(var r=0,i=0,o=Array(hc(n/e));n>r;)o[i++]=gr(t,r,r+=e);return o}function Ri(t){for(var e=-1,n=t?t.length:0,r=0,i=[];++ee?0:e,r)):[]}function Pi(t,e,n){var r=t?t.length:0;return r?(e=n||e===X?1:cs(e),e=r-e,gr(t,0,0>e?0:e)):[]}function Fi(t,e){return t&&t.length?Or(t,di(e,3),!0,!0):[]}function Ui(t,e){return t&&t.length?Or(t,di(e,3),!0):[]}function Hi(t,e,n,r){var i=t?t.length:0;return i?(n&&"number"!=typeof n&&ki(t,e,n)&&(n=0,r=i),qn(t,e,n,r)):[]}function Yi(t,e){return t&&t.length?w(t,di(e,3)):-1}function Bi(t,e){return t&&t.length?w(t,di(e,3),!0):-1}function Wi(t){var e=t?t.length:0;return e?Pn(t,1):[]}function Vi(t){var e=t?t.length:0;return e?Pn(t,xt):[]}function $i(t,e){var n=t?t.length:0;return n?(e=e===X?1:cs(e),Pn(t,e)):[]}function Gi(t){for(var e=-1,n=t?t.length:0,r={};++en&&(n=_c(r+n,0)),x(t,e,n)):-1}function Ki(t){return Pi(t,1)}function Xi(t,e){return t?mc.call(t,e):""}function Zi(t){var e=t?t.length:0;return e?t[e-1]:X}function Qi(t,e,n){var r=t?t.length:0;if(!r)return-1;var i=r;if(n!==X&&(i=cs(n),i=(0>i?_c(r+i,0):yc(i,r-1))+1),e!==e)return U(t,i,!0);for(;i--;)if(t[i]===e)return i;return-1}function to(t,e){return t&&t.length&&e&&e.length?dr(t,e):t}function eo(t,e,n){return t&&t.length&&e&&e.length?dr(t,e,di(n)):t}function no(t,e,n){return t&&t.length&&e&&e.length?dr(t,e,X,n):t}function ro(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=di(e,3);++rr&&xa(t[r],e))return r}return-1}function co(t,e){return yr(t,e,!0)}function lo(t,e,n){return br(t,e,di(n),!0)}function fo(t,e){var n=t?t.length:0;if(n){var r=yr(t,e,!0)-1;if(xa(t[r],e))return r}return-1}function ho(t){return t&&t.length?wr(t):[]}function po(t,e){return t&&t.length?xr(t,di(e)):[]}function vo(t){return Ni(t,1)}function mo(t,e,n){return t&&t.length?(e=n||e===X?1:cs(e),gr(t,0,0>e?0:e)):[]}function go(t,e,n){var r=t?t.length:0;return r?(e=n||e===X?1:cs(e),e=r-e,gr(t,0>e?0:e,r)):[]}function _o(t,e){return t&&t.length?Or(t,di(e,3),!1,!0):[]}function yo(t,e){return t&&t.length?Or(t,di(e,3)):[]}function bo(t){return t&&t.length?kr(t):[]}function wo(t,e){return t&&t.length?kr(t,di(e)):[]}function xo(t,e){return t&&t.length?kr(t,X,e):[]}function ko(t){if(!t||!t.length)return[];var e=0;return t=f(t,function(t){return ja(t)?(e=_c(t.length,e),!0):void 0}),A(e,function(e){return p(t,lr(e))})}function So(t,e){if(!t||!t.length)return[];var n=ko(t);return null==e?n:p(n,function(t){return o(e,X,t)})}function Eo(t,e){return Tr(t||[],e||[],un)}function Oo(t,e){return Tr(t||[],e||[],mr)}function Ao(t){var n=e(t);return n.__chain__=!0,n}function jo(t,e){return e(t),t}function To(t,e){return e(t)}function Do(){return Ao(this)}function Io(){return new C(this.value(),this.__chain__)}function Mo(t){return this.map(t).flatten()}function Co(){this.__values__===X&&(this.__values__=us(this.value()));var t=this.__index__>=this.__values__.length,e=t?X:this.__values__[this.__index__++];return{done:t,value:e}}function qo(){return this}function Lo(t){for(var e,r=this;r instanceof n;){var i=qi(r);i.__index__=0,i.__values__=X,e?o.__wrapped__=i:e=i;var o=i;r=r.__wrapped__}return o.__wrapped__=t,e}function Ro(){var t=this.__wrapped__;if(t instanceof Ae){var e=t;return this.__actions__.length&&(e=new Ae(this)),e=e.reverse(),e.__actions__.push({func:To,args:[io],thisArg:X}),new C(e,this.__chain__)}return this.thru(io)}function No(){return Ar(this.__wrapped__,this.__actions__)}function Po(t,e,n){var r=Ol(t)?l:Cn;return n&&ki(t,e,n)&&(e=X),r(t,di(e,3))}function Fo(t,e){var n=Ol(t)?f:Ln;return n(t,di(e,3))}function Uo(t,e){if(e=di(e,3),Ol(t)){var n=w(t,e);return n>-1?t[n]:X}return b(t,e,Rc)}function Ho(t,e){if(e=di(e,3),Ol(t)){var n=w(t,e,!0);return n>-1?t[n]:X}return b(t,e,Nc)}function Yo(t,e){return Pn($o(t,e),1)}function Bo(t,e){return"function"==typeof e&&Ol(t)?u(t,e):Rc(t,xn(e))}function Wo(t,e){return"function"==typeof e&&Ol(t)?c(t,e):Nc(t,xn(e))}function Vo(t,e,n,r){t=Aa(t)?t:Ys(t),n=n&&!r?cs(n):0;var i=t.length;return 0>n&&(n=_c(i+n,0)),ts(t)?i>=n&&t.indexOf(e,n)>-1:!!i&&x(t,e,n)>-1}function $o(t,e){var n=Ol(t)?p:nr;return n(t,di(e,3))}function Go(t,e,n,r){return null==t?[]:(Ol(e)||(e=null==e?[]:[e]),n=r?X:n,Ol(n)||(n=null==n?[]:[n]),sr(t,e,n))}function zo(t,e,n){var r=Ol(t)?m:S,i=arguments.length<3;return r(t,di(e,4),n,i,Rc)}function Jo(t,e,n){var r=Ol(t)?g:S,i=arguments.length<3;return r(t,di(e,4),n,i,Nc)}function Ko(t,e){var n=Ol(t)?f:Ln;return e=di(e,3),n(t,function(t,n,r){return!e(t,n,r)})}function Xo(t){var e=Aa(t)?t:Ys(t),n=e.length;return n>0?e[pr(0,n-1)]:X}function Zo(t,e){var n=-1,r=us(t),i=r.length,o=i-1;for(e=Sn(cs(e),0,i);++n0&&(n=e.apply(this,arguments)),1>=t&&(e=X),n}}function oa(t,e,n){e=n?X:e;var r=si(t,at,X,X,X,X,X,e);return r.placeholder=oa.placeholder,r}function aa(t,e,n){e=n?X:e;var r=si(t,st,X,X,X,X,X,e);return r.placeholder=aa.placeholder,r}function sa(t,e,n){function r(){p&&ic(p),l&&ic(l),m=0,c=l=h=p=v=X}function i(e,n){n&&ic(n),l=p=v=X,e&&(m=gl(),f=t.apply(h,c),p||l||(c=h=X))}function o(){var t=e-(gl()-d);0>=t||t>e?i(v,l):p=fc(o,t)}function a(){return(p&&v||l&&y)&&(f=t.apply(h,c)),r(),f}function s(){i(y,p)}function u(){if(c=arguments,d=gl(),h=this,v=y&&(p||!g),_===!1)var n=g&&!p;else{m||l||g||(m=d);var r=_-(d-m),i=(0>=r||r>_)&&(g||l);i?(l&&(l=ic(l)),m=d,f=t.apply(h,c)):l||(l=fc(s,r))}return i&&p?p=ic(p):p||e===_||(p=fc(o,e)),n&&(i=!0,f=t.apply(h,c)),!i||p||l||(c=h=X),f}var c,l,f,d,h,p,v,m=0,g=!1,_=!1,y=!0;if("function"!=typeof t)throw new Wu(tt);return e=fs(e)||0,Ua(n)&&(g=!!n.leading,_="maxWait"in n&&_c(fs(n.maxWait)||0,e),y="trailing"in n?!!n.trailing:y),u.cancel=r,u.flush=a,u}function ua(t){return si(t,dt)}function ca(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new Wu(tt);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a),a};return n.cache=new ca.Cache,n}function la(t){if("function"!=typeof t)throw new Wu(tt);return function(){return!t.apply(this,arguments)}}function fa(t){return ia(2,t)}function da(t,e){if("function"!=typeof t)throw new Wu(tt);return e=_c(e===X?t.length-1:cs(e),0),function(){for(var n=arguments,r=-1,i=_c(n.length-e,0),a=Array(i);++re}function Sa(t,e){return t>=e}function Ea(t){return ja(t)&&zu.call(t,"callee")&&(!lc.call(t,"callee")||Xu.call(t)==Tt)}function Oa(t){return Ha(t)&&Xu.call(t)==Vt}function Aa(t){return null!=t&&Fa(Bc(t))&&!Na(t)}function ja(t){return Ha(t)&&Aa(t)}function Ta(t){return t===!0||t===!1||Ha(t)&&Xu.call(t)==It}function Da(t){return Ha(t)&&Xu.call(t)==Mt}function Ia(t){return!!t&&1===t.nodeType&&Ha(t)&&!Ka(t)}function Ma(t){if(Aa(t)&&(Ol(t)||ts(t)||Na(t.splice)||Ea(t)))return!t.length;for(var e in t)if(zu.call(t,e))return!1;return!0}function Ca(t,e){return Kn(t,e)}function qa(t,e,n){n="function"==typeof n?n:X;var r=n?n(t,e):X;return r===X?Kn(t,e,n):!!r}function La(t){return Ha(t)?Xu.call(t)==Ct||"string"==typeof t.message&&"string"==typeof t.name:!1}function Ra(t){return"number"==typeof t&&vc(t)}function Na(t){var e=Ua(t)?Xu.call(t):"";return e==qt||e==Lt}function Pa(t){return"number"==typeof t&&t==cs(t)}function Fa(t){return"number"==typeof t&&t>-1&&t%1==0&&kt>=t}function Ua(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Ha(t){return!!t&&"object"==typeof t}function Ya(t){return Ha(t)&&mi(t)==Rt}function Ba(t,e){return t===e||Zn(t,e,hi(e))}function Wa(t,e,n){return n="function"==typeof n?n:X,Zn(t,e,hi(e),n)}function Va(t){return Ja(t)&&t!=+t}function $a(t){return null==t?!1:Na(t)?Qu.test(Gu.call(t)):Ha(t)&&(H(t)?Qu:Ee).test(t)}function Ga(t){return null===t}function za(t){return null==t}function Ja(t){return"number"==typeof t||Ha(t)&&Xu.call(t)==Nt}function Ka(t){if(!Ha(t)||Xu.call(t)!=Pt||H(t))return!1;var e=ac(t);if(null===e)return!0;var n=e.constructor;return"function"==typeof n&&n instanceof n&&Gu.call(n)==Ku}function Xa(t){return Ua(t)&&Xu.call(t)==Ft}function Za(t){return Pa(t)&&t>=-kt&&kt>=t}function Qa(t){return Ha(t)&&mi(t)==Ut}function ts(t){return"string"==typeof t||!Ol(t)&&Ha(t)&&Xu.call(t)==Ht}function es(t){return"symbol"==typeof t||Ha(t)&&Xu.call(t)==Yt}function ns(t){return Ha(t)&&Fa(t.length)&&!!bn[Xu.call(t)]}function rs(t){return t===X}function is(t){return Ha(t)&&mi(t)==Bt}function os(t){return Ha(t)&&Xu.call(t)==Wt}function as(t,e){return e>t}function ss(t,e){return e>=t}function us(t){if(!t)return[];if(Aa(t))return ts(t)?z(t):Fr(t);if(uc&&t[uc])return B(t[uc]());var e=mi(t),n=e==Rt?W:e==Ut?$:Ys;return n(t)}function cs(t){if(!t)return 0===t?t:0;if(t=fs(t),t===xt||t===-xt){var e=0>t?-1:1;return e*St}var n=t%1;return t===t?n?t-n:t:0}function ls(t){return t?Sn(cs(t),0,Ot):0}function fs(t){if(Ua(t)){var e=Na(t.valueOf)?t.valueOf():t;t=Ua(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(me,"");var n=Se.test(t);return n||Oe.test(t)?jn(t.slice(2),n?2:8):ke.test(t)?Et:+t}function ds(t){return Ur(t,js(t))}function hs(t){return Sn(cs(t),-kt,kt)}function ps(t){if("string"==typeof t)return t;if(null==t)return"";if(es(t))return Lc?Lc.call(t):"";var e=t+"";return"0"==e&&1/t==-xt?"-0":e}function vs(t,e){var n=Tn(t);return e?ln(n,e):n}function ms(t,e){return b(t,di(e,3),Un,!0)}function gs(t,e){return b(t,di(e,3),Hn,!0)}function _s(t,e){return null==t?t:Pc(t,xn(e),js)}function ys(t,e){return null==t?t:Fc(t,xn(e),js)}function bs(t,e){return t&&Un(t,xn(e))}function ws(t,e){return t&&Hn(t,xn(e))}function xs(t){return null==t?[]:Yn(t,As(t))}function ks(t){return null==t?[]:Yn(t,js(t))}function Ss(t,e,n){var r=null==t?X:Bn(t,e);return r===X?n:r}function Es(t,e){return _i(t,e,Wn)}function Os(t,e){return _i(t,e,Vn)}function As(t){var e=Ai(t);if(!e&&!Aa(t))return tr(t);var n=xi(t),r=!!n,i=n||[],o=i.length;for(var a in t)!Wn(t,a)||r&&("length"==a||Y(a,o))||e&&"constructor"==a||i.push(a);return i}function js(t){for(var e=-1,n=Ai(t),r=er(t),i=r.length,o=xi(t),a=!!o,s=o||[],u=s.length;++ee){var r=t;t=e,e=r}if(n||t%1||e%1){var i=wc();return yc(t+i*(e-t+An("1e-"+((i+"").length-1))),e)}return pr(t,e)}function Gs(t){return $l(ps(t).toLowerCase())}function zs(t){return t=ps(t),t&&t.replace(je,N).replace(dn,"")}function Js(t,e,n){t=ps(t),e="string"==typeof e?e:e+"";var r=t.length;return n=n===X?r:Sn(cs(n),0,r),n-=e.length,n>=0&&t.indexOf(e,n)==n}function Ks(t){return t=ps(t),t&&se.test(t)?t.replace(oe,P):t}function Xs(t){return t=ps(t),t&&ve.test(t)?t.replace(pe,"\\$&"):t}function Zs(t,e,n){t=ps(t),e=cs(e);var r=G(t);if(!e||r>=e)return t;var i=(e-r)/2,o=pc(i),a=hc(i);return ni("",o,n)+t+ni("",a,n)}function Qs(t,e,n){return t=ps(t),t+ni(t,e,n)}function tu(t,e,n){return t=ps(t),ni(t,e,n)+t}function eu(t,e,n){return n||null==e?e=0:e&&(e=+e),t=ps(t).replace(me,""),bc(t,e||(xe.test(t)?16:10))}function nu(t,e){t=ps(t),e=cs(e);var n="";if(!t||1>e||e>kt)return n;do e%2&&(n+=t),e=pc(e/2),t+=t;while(e);return n}function ru(){var t=arguments,e=ps(t[0]);return t.length<3?e:e.replace(t[1],t[2])}function iu(t,e,n){return ps(t).split(e,n)}function ou(t,e,n){return t=ps(t),n=Sn(cs(n),0,t.length),t.lastIndexOf(e,n)==n}function au(t,n,r){var i=e.templateSettings;r&&ki(t,n,r)&&(n=X),t=ps(t),n=Dl({},n,i,an);var o,a,s=Dl({},n.imports,i.imports,an),u=As(s),c=D(s,u),l=0,f=n.interpolate||Te,d="__p += '",h=Bu((n.escape||Te).source+"|"+f.source+"|"+(f===le?be:Te).source+"|"+(n.evaluate||Te).source+"|$","g"),p="//# sourceURL="+("sourceURL"in n?n.sourceURL:"lodash.templateSources["+ ++yn+"]")+"\n";t.replace(h,function(e,n,r,i,s,u){return r||(r=i),d+=t.slice(l,u).replace(De,F),n&&(o=!0,d+="' +\n__e("+n+") +\n'"),s&&(a=!0,d+="';\n"+s+";\n__p += '"),r&&(d+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=u+e.length,e}),d+="';\n";var v=n.variable;v||(d="with (obj) {\n"+d+"\n}\n"),d=(a?d.replace(ee,""):d).replace(ne,"$1").replace(re,"$1;"),d="function("+(v||"obj")+") {\n"+(v?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var m=Kl(function(){return Function(u,p+"return "+d).apply(X,c)});if(m.source=d,La(m))throw m;return m}function su(t){return ps(t).toLowerCase()}function uu(t){return ps(t).toUpperCase()}function cu(t,e,n){if(t=ps(t),!t)return t;if(n||e===X)return t.replace(me,"");if(e+="",!e)return t;var r=z(t),i=z(e);return r.slice(I(r,i),M(r,i)+1).join("")}function lu(t,e,n){if(t=ps(t),!t)return t;if(n||e===X)return t.replace(_e,"");if(e+="",!e)return t;var r=z(t);return r.slice(0,M(r,z(e))+1).join("")}function fu(t,e,n){if(t=ps(t),!t)return t;if(n||e===X)return t.replace(ge,"");if(e+="",!e)return t;var r=z(t);return r.slice(I(r,z(e))).join("")}function du(t,e){var n=vt,r=mt;if(Ua(e)){var i="separator"in e?e.separator:i;n="length"in e?cs(e.length):n,r="omission"in e?ps(e.omission):r}t=ps(t);var o=t.length;if(pn.test(t)){var a=z(t);o=a.length}if(n>=o)return t;var s=n-G(r);if(1>s)return r;var u=a?a.slice(0,s).join(""):t.slice(0,s);if(i===X)return u+r;if(a&&(s+=u.length-s),Xa(i)){if(t.slice(s).search(i)){var c,l=u;for(i.global||(i=Bu(i.source,ps(we.exec(i))+"g")),i.lastIndex=0;c=i.exec(l);)var f=c.index;u=u.slice(0,f===X?s:f)}}else if(t.indexOf(i,s)!=s){var d=u.lastIndexOf(i);d>-1&&(u=u.slice(0,d))}return u+r}function hu(t){return t=ps(t),t&&ae.test(t)?t.replace(ie,J):t}function pu(t,e,n){return t=ps(t),e=n?X:e,e===X&&(e=gn.test(t)?mn:vn),t.match(e)||[]}function vu(t){var e=t?t.length:0,n=di();return t=e?p(t,function(t){if("function"!=typeof t[1])throw new Wu(tt);return[n(t[0]),t[1]]}):[],da(function(n){for(var r=-1;++rt||t>kt)return[];var n=Ot,r=yc(t,Ot);e=xn(e),t-=Ot;for(var i=A(r,e);++n0){if(++t>=gt)return n}else t=0;return Uc(n,r)}}(),$c=da(function(t,e){return Ol(t)||(t=null==t?[]:[Object(t)]),e=Pn(e,1),s(t,e)}),Gc=da(function(t,e){return ja(t)?Mn(t,Pn(e,1,!0)):[]}),zc=da(function(t,e){var n=Zi(e);return ja(n)&&(n=X),ja(t)?Mn(t,Pn(e,1,!0),di(n)):[]}),Jc=da(function(t,e){var n=Zi(e);return ja(n)&&(n=X),ja(t)?Mn(t,Pn(e,1,!0),X,n):[]}),Kc=da(function(t){var e=p(t,hn);return e.length&&e[0]===t[0]?Gn(e):[]}),Xc=da(function(t){var e=Zi(t),n=p(t,hn);return e===Zi(n)?e=X:n.pop(),n.length&&n[0]===t[0]?Gn(n,di(e)):[]}),Zc=da(function(t){var e=Zi(t),n=p(t,hn);return e===Zi(n)?e=X:n.pop(),n.length&&n[0]===t[0]?Gn(n,X,e):[]}),Qc=da(to),tl=da(function(t,e){e=p(Pn(e,1),String);var n=fn(t,e);return hr(t,e.sort(q)),n}),el=da(function(t){return kr(Pn(t,1,!0))}),nl=da(function(t){var e=Zi(t);return ja(e)&&(e=X),kr(Pn(t,1,!0),di(e))}),rl=da(function(t){var e=Zi(t);return ja(e)&&(e=X),kr(Pn(t,1,!0),X,e)}),il=da(function(t,e){return ja(t)?Mn(t,e):[]}),ol=da(function(t){return jr(f(t,ja))}),al=da(function(t){var e=Zi(t);return ja(e)&&(e=X),jr(f(t,ja),di(e))}),sl=da(function(t){var e=Zi(t);return ja(e)&&(e=X),jr(f(t,ja),X,e)}),ul=da(ko),cl=da(function(t){var e=t.length,n=e>1?t[e-1]:X;return n="function"==typeof n?(t.pop(),n):X,So(t,n)}),ll=da(function(t){t=Pn(t,1);var e=t.length,n=e?t[0]:0,r=this.__wrapped__,i=function(e){return fn(e,t)};return!(e>1||this.__actions__.length)&&r instanceof Ae&&Y(n)?(r=r.slice(n,+n+(e?1:0)),r.__actions__.push({func:To,args:[i],thisArg:X}),new C(r,this.__chain__).thru(function(t){return e&&!t.length&&t.push(X),t})):this.thru(i)}),fl=Br(function(t,e,n){zu.call(t,n)?++t[n]:t[n]=1}),dl=Br(function(t,e,n){zu.call(t,n)?t[n].push(e):t[n]=[e]}),hl=da(function(t,e,n){var r=-1,i="function"==typeof e,a=Si(e),s=Aa(t)?Array(t.length):[];return Rc(t,function(t){var u=i?e:a&&null!=t?t[e]:X;s[++r]=u?o(u,t,n):Jn(t,e,n)}),s}),pl=Br(function(t,e,n){t[n]=e}),vl=Br(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]}),ml=da(function(t,e){if(null==t)return[];var n=e.length;return n>1&&ki(t,e[0],e[1])?e=[]:n>2&&ki(e[0],e[1],e[2])&&(e.length=1),sr(t,Pn(e,1),[])}),gl=Uu.now,_l=da(function(t,e,n){var r=rt;if(n.length){var i=V(n,vi(_l));r|=ut}return si(t,r,e,n,i)}),yl=da(function(t,e,n){var r=rt|it;if(n.length){var i=V(n,vi(yl));r|=ut}return si(e,r,t,n,i)}),bl=da(function(t,e){return Dn(t,1,e)}),wl=da(function(t,e,n){return Dn(t,fs(e)||0,n)}),xl=da(function(t,e){e=p(Pn(e,1),di());var n=e.length;return da(function(r){for(var i=-1,a=yc(r.length,n);++i0||0>e)?new Ae(n):(0>t?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==X&&(e=cs(e),n=0>e?n.dropRight(-e):n.take(e-t)),n)},Ae.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Ae.prototype.toArray=function(){return this.take(Ot)},Un(Ae.prototype,function(t,n){var r=/^(?:filter|find|map|reject)|While$/.test(n),i=/^(?:head|last)$/.test(n),o=e[i?"take"+("last"==n?"Right":""):n],a=i||/^find/.test(n);o&&(e.prototype[n]=function(){var n=this.__wrapped__,s=i?[1]:arguments,u=n instanceof Ae,c=s[0],l=u||Ol(n),f=function(t){var n=o.apply(e,v([t],s));return i&&d?n[0]:n};l&&r&&"function"==typeof c&&1!=c.length&&(u=l=!1);var d=this.__chain__,h=!!this.__actions__.length,p=a&&!d,m=u&&!h;if(!a&&l){n=m?n:new Ae(this);var g=t.apply(n,s);return g.__actions__.push({func:To,args:[f],thisArg:X}),new C(g,d)}return p&&m?t.apply(this,s):(g=this.thru(f),p?i?g.value()[0]:g.value():g)})}),u(["pop","push","shift","sort","splice","unshift"],function(t){var n=Vu[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:pop|shift)$/.test(t);e.prototype[t]=function(){var t=arguments;return i&&!this.__chain__?n.apply(this.value(),t):this[r](function(e){return n.apply(e,t)})}}),Un(Ae.prototype,function(t,n){var r=e[n];if(r){var i=r.name+"",o=Tc[i]||(Tc[i]=[]);o.push({name:n,func:r})}}),Tc[Qr(X,it).name]=[{name:"wrapper",func:X}],Ae.prototype.clone=Ie,Ae.prototype.reverse=Me,Ae.prototype.value=Ce,e.prototype.at=ll,e.prototype.chain=Do,e.prototype.commit=Io,e.prototype.flatMap=Mo,e.prototype.next=Co,e.prototype.plant=Lo,e.prototype.reverse=Ro,e.prototype.toJSON=e.prototype.valueOf=e.prototype.value=No,uc&&(e.prototype[uc]=qo),e}var X,Z="4.6.1",Q=200,tt="Expected a function",et="__lodash_hash_undefined__",nt="__lodash_placeholder__",rt=1,it=2,ot=4,at=8,st=16,ut=32,ct=64,lt=128,ft=256,dt=512,ht=1,pt=2,vt=30,mt="...",gt=150,_t=16,yt=1,bt=2,wt=3,xt=1/0,kt=9007199254740991,St=1.7976931348623157e308,Et=NaN,Ot=4294967295,At=Ot-1,jt=Ot>>>1,Tt="[object Arguments]",Dt="[object Array]",It="[object Boolean]",Mt="[object Date]",Ct="[object Error]",qt="[object Function]",Lt="[object GeneratorFunction]",Rt="[object Map]",Nt="[object Number]",Pt="[object Object]",Ft="[object RegExp]",Ut="[object Set]",Ht="[object String]",Yt="[object Symbol]",Bt="[object WeakMap]",Wt="[object WeakSet]",Vt="[object ArrayBuffer]",$t="[object Float32Array]",Gt="[object Float64Array]",zt="[object Int8Array]",Jt="[object Int16Array]",Kt="[object Int32Array]",Xt="[object Uint8Array]",Zt="[object Uint8ClampedArray]",Qt="[object Uint16Array]",te="[object Uint32Array]",ee=/\b__p \+= '';/g,ne=/\b(__p \+=) '' \+/g,re=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ie=/&(?:amp|lt|gt|quot|#39|#96);/g,oe=/[&<>"'`]/g,ae=RegExp(ie.source),se=RegExp(oe.source),ue=/<%-([\s\S]+?)%>/g,ce=/<%([\s\S]+?)%>/g,le=/<%=([\s\S]+?)%>/g,fe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,de=/^\w*$/,he=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,pe=/[\\^$.*+?()[\]{}|]/g,ve=RegExp(pe.source),me=/^\s+|\s+$/g,ge=/^\s+/,_e=/\s+$/,ye=/\\(\\)?/g,be=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,we=/\w*$/,xe=/^0x/i,ke=/^[-+]0x[0-9a-f]+$/i,Se=/^0b[01]+$/i,Ee=/^\[object .+?Constructor\]$/,Oe=/^0o[0-7]+$/i,Ae=/^(?:0|[1-9]\d*)$/,je=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,Te=/($^)/,De=/['\n\r\u2028\u2029\\]/g,Ie="\\ud800-\\udfff",Me="\\u0300-\\u036f\\ufe20-\\ufe23",Ce="\\u20d0-\\u20f0",qe="\\u2700-\\u27bf",Le="a-z\\xdf-\\xf6\\xf8-\\xff",Re="\\xac\\xb1\\xd7\\xf7",Ne="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Pe="\\u2018\\u2019\\u201c\\u201d",Fe=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ue="A-Z\\xc0-\\xd6\\xd8-\\xde",He="\\ufe0e\\ufe0f",Ye=Re+Ne+Pe+Fe,Be="["+Ie+"]",We="["+Ye+"]",Ve="["+Me+Ce+"]",$e="\\d+",Ge="["+qe+"]",ze="["+Le+"]",Je="[^"+Ie+Ye+$e+qe+Le+Ue+"]",Ke="\\ud83c[\\udffb-\\udfff]",Xe="(?:"+Ve+"|"+Ke+")",Ze="[^"+Ie+"]",Qe="(?:\\ud83c[\\udde6-\\uddff]){2}",tn="[\\ud800-\\udbff][\\udc00-\\udfff]",en="["+Ue+"]",nn="\\u200d",rn="(?:"+ze+"|"+Je+")",on="(?:"+en+"|"+Je+")",an=Xe+"?",sn="["+He+"]?",un="(?:"+nn+"(?:"+[Ze,Qe,tn].join("|")+")"+sn+an+")*",cn=sn+an+un,ln="(?:"+[Ge,Qe,tn].join("|")+")"+cn,fn="(?:"+[Ze+Ve+"?",Ve,Qe,tn,Be].join("|")+")",dn=RegExp(Ve,"g"),hn=RegExp(Ke+"(?="+Ke+")|"+fn+cn,"g"),pn=RegExp("["+nn+Ie+Me+Ce+He+"]"),vn=/[a-zA-Z0-9]+/g,mn=RegExp([en+"?"+ze+"+(?="+[We,en,"$"].join("|")+")",on+"+(?="+[We,en+rn,"$"].join("|")+")",en+"?"+rn+"+",en+"+",$e,ln].join("|"),"g"),gn=/[a-z][A-Z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,_n=["Array","Buffer","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Reflect","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],yn=-1,bn={};bn[$t]=bn[Gt]=bn[zt]=bn[Jt]=bn[Kt]=bn[Xt]=bn[Zt]=bn[Qt]=bn[te]=!0,bn[Tt]=bn[Dt]=bn[Vt]=bn[It]=bn[Mt]=bn[Ct]=bn[qt]=bn[Rt]=bn[Nt]=bn[Pt]=bn[Ft]=bn[Ut]=bn[Ht]=bn[Bt]=!1;var wn={};wn[Tt]=wn[Dt]=wn[Vt]=wn[It]=wn[Mt]=wn[$t]=wn[Gt]=wn[zt]=wn[Jt]=wn[Kt]=wn[Rt]=wn[Nt]=wn[Pt]=wn[Ft]=wn[Ut]=wn[Ht]=wn[Yt]=wn[Xt]=wn[Zt]=wn[Qt]=wn[te]=!0,wn[Ct]=wn[qt]=wn[Bt]=!1;var xn={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"},kn={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Sn={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},En={"function":!0,object:!0},On={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},An=parseFloat,jn=parseInt,Tn=En[typeof n]&&n&&!n.nodeType?n:X,Dn=En[typeof e]&&e&&!e.nodeType?e:X,In=Dn&&Dn.exports===Tn?Tn:X,Mn=C(Tn&&Dn&&"object"==typeof t&&t),Cn=C(En[typeof self]&&self),qn=C(En[typeof window]&&window),Ln=C(En[typeof this]&&this),Rn=Mn||qn!==(Ln&&Ln.window)&&qn||Cn||Ln||Function("return this")(),Nn=K();(qn||Cn||{})._=Nn,"function"==typeof define&&"object"==typeof define.amd&&define.amd?define(function(){return Nn}):Tn&&Dn?(In&&((Dn.exports=Nn)._=Nn),Tn._=Nn):Rn._=Nn}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],119:[function(t,e,n){var r=t("./_arrayMap"),i=t("./_baseDifference"),o=t("./_baseFlatten"),a=t("./_basePick"),s=t("./keysIn"),u=t("./rest"),c=u(function(t,e){return null==t?{}:(e=r(o(e,1),String),a(t,i(s(t),e)))});e.exports=c},{"./_arrayMap":61,"./_baseDifference":70,"./_baseFlatten":71,"./_basePick":74,"./keysIn":117,"./rest":120}],120:[function(t,e,n){function r(t,e){if("function"!=typeof t)throw new TypeError(a);return e=s(void 0===e?t.length-1:o(e),0),function(){for(var n=arguments,r=-1,o=s(n.length-e,0),a=Array(o);++rt?-1:1;return e*a}var n=t%1;return t===t?n?t-n:t:0}var i=t("./toNumber"),o=1/0,a=1.7976931348623157e308;e.exports=r},{"./toNumber":122}],122:[function(t,e,n){function r(t){if(o(t)){var e=i(t.valueOf)?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(s,"");var n=c.test(t);return n||l.test(t)?f(t.slice(2),n?2:8):u.test(t)?a:+t}var i=t("./isFunction"),o=t("./isObject"),a=NaN,s=/^\s+|\s+$/g,u=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,l=/^0o[0-7]+$/i,f=parseInt;e.exports=r},{"./isFunction":111,"./isObject":114}],123:[function(t,e,n){!function(t,r){"object"==typeof n&&"undefined"!=typeof e?e.exports=r():"function"==typeof define&&define.amd?define(r):t.moment=r()}(this,function(){"use strict";function n(){return tr.apply(null,arguments)}function r(t){tr=t}function i(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function o(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function a(t,e){var n,r=[];for(n=0;n0)for(n in er)r=er[n],i=e[r],p(i)||(t[r]=i);return t}function m(t){v(this,t),this._d=new Date(null!=t._d?t._d.getTime():NaN),nr===!1&&(nr=!0,n.updateOffset(this),nr=!1)}function g(t){return t instanceof m||null!=t&&null!=t._isAMomentObject}function _(t){return 0>t?Math.ceil(t):Math.floor(t)}function y(t){var e=+t,n=0;return 0!==e&&isFinite(e)&&(n=_(e)),n}function b(t,e,n){var r,i=Math.min(t.length,e.length),o=Math.abs(t.length-e.length),a=0;for(r=0;i>r;r++)(n&&t[r]!==e[r]||!n&&y(t[r])!==y(e[r]))&&a++;return a+o}function w(t){n.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+t)}function x(t,e){var n=!0;return u(function(){return n&&(w(t+"\nArguments: "+Array.prototype.slice.call(arguments).join(", ")+"\n"+(new Error).stack),n=!1),e.apply(this,arguments)},e)}function k(t,e){rr[t]||(w(e),rr[t]=!0)}function S(t){return t instanceof Function||"[object Function]"===Object.prototype.toString.call(t)}function E(t){return"[object Object]"===Object.prototype.toString.call(t)}function O(t){var e,n;for(n in t)e=t[n],S(e)?this[n]=e:this["_"+n]=e;this._config=t,this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function A(t,e){var n,r=u({},t);for(n in e)s(e,n)&&(E(t[n])&&E(e[n])?(r[n]={},u(r[n],t[n]),u(r[n],e[n])):null!=e[n]?r[n]=e[n]:delete r[n]);return r}function j(t){null!=t&&this.set(t)}function T(t){return t?t.toLowerCase().replace("_","-"):t}function D(t){for(var e,n,r,i,o=0;o0;){if(r=I(i.slice(0,e).join("-")))return r;if(n&&n.length>=e&&b(i,n,!0)>=e-1)break;e--}o++}return null}function I(n){var r=null;if(!or[n]&&"undefined"!=typeof e&&e&&e.exports)try{r=ir._abbr,t("./locale/"+n),M(r)}catch(i){}return or[n]}function M(t,e){var n;return t&&(n=p(e)?L(t):C(t,e),n&&(ir=n)),ir._abbr}function C(t,e){return null!==e?(e.abbr=t,null!=or[t]?(k("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale"),e=A(or[t]._config,e)):null!=e.parentLocale&&(null!=or[e.parentLocale]?e=A(or[e.parentLocale]._config,e):k("parentLocaleUndefined","specified parentLocale is not defined yet")),or[t]=new j(e),M(t),or[t]):(delete or[t],null)}function q(t,e){if(null!=e){var n;null!=or[t]&&(e=A(or[t]._config,e)),n=new j(e),n.parentLocale=or[t],or[t]=n,M(t)}else null!=or[t]&&(null!=or[t].parentLocale?or[t]=or[t].parentLocale:null!=or[t]&&delete or[t]);return or[t]}function L(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return ir;if(!i(t)){if(e=I(t))return e;t=[t]}return D(t)}function R(){return Object.keys(or)}function N(t,e){var n=t.toLowerCase();ar[n]=ar[n+"s"]=ar[e]=t}function P(t){return"string"==typeof t?ar[t]||ar[t.toLowerCase()]:void 0}function F(t){var e,n,r={};for(n in t)s(t,n)&&(e=P(n),e&&(r[e]=t[n]));return r}function U(t,e){return function(r){return null!=r?(Y(this,t,r),n.updateOffset(this,e),this):H(this,t)}}function H(t,e){return t.isValid()?t._d["get"+(t._isUTC?"UTC":"")+e]():NaN}function Y(t,e,n){t.isValid()&&t._d["set"+(t._isUTC?"UTC":"")+e](n)}function B(t,e){var n;if("object"==typeof t)for(n in t)this.set(n,t[n]);else if(t=P(t),S(this[t]))return this[t](e);return this}function W(t,e,n){var r=""+Math.abs(t),i=e-r.length,o=t>=0;return(o?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}function V(t,e,n,r){var i=r;"string"==typeof r&&(i=function(){return this[r]()}),t&&(lr[t]=i),e&&(lr[e[0]]=function(){return W(i.apply(this,arguments),e[1],e[2])}),n&&(lr[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),t)})}function $(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function G(t){var e,n,r=t.match(sr);for(e=0,n=r.length;n>e;e++)lr[r[e]]?r[e]=lr[r[e]]:r[e]=$(r[e]);return function(i){var o="";for(e=0;n>e;e++)o+=r[e]instanceof Function?r[e].call(i,t):r[e];return o}}function z(t,e){return t.isValid()?(e=J(e,t.localeData()),cr[e]=cr[e]||G(e),cr[e](t)):t.localeData().invalidDate()}function J(t,e){function n(t){return e.longDateFormat(t)||t}var r=5;for(ur.lastIndex=0;r>=0&&ur.test(t);)t=t.replace(ur,n),ur.lastIndex=0,r-=1;return t}function K(t,e,n){jr[t]=S(e)?e:function(t,r){return t&&n?n:e}}function X(t,e){return s(jr,t)?jr[t](e._strict,e._locale):new RegExp(Z(t))}function Z(t){return Q(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,e,n,r,i){return e||n||r||i}))}function Q(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function tt(t,e){var n,r=e;for("string"==typeof t&&(t=[t]),"number"==typeof e&&(r=function(t,n){n[e]=y(t)}),n=0;nr;r++){if(i=c([2e3,r]),n&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[r]||(o="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[r]=new RegExp(o.replace(".",""),"i")),n&&"MMMM"===e&&this._longMonthsParse[r].test(t))return r;if(n&&"MMM"===e&&this._shortMonthsParse[r].test(t))return r;if(!n&&this._monthsParse[r].test(t))return r}}function st(t,e){var n;if(!t.isValid())return t;if("string"==typeof e)if(/^\d+$/.test(e))e=y(e);else if(e=t.localeData().monthsParse(e),"number"!=typeof e)return t;return n=Math.min(t.date(),rt(t.year(),e)),t._d["set"+(t._isUTC?"UTC":"")+"Month"](e,n),t}function ut(t){return null!=t?(st(this,t),n.updateOffset(this,!0),this):H(this,"Month")}function ct(){return rt(this.year(),this.month())}function lt(t){return this._monthsParseExact?(s(this,"_monthsRegex")||dt.call(this),t?this._monthsShortStrictRegex:this._monthsShortRegex):this._monthsShortStrictRegex&&t?this._monthsShortStrictRegex:this._monthsShortRegex}function ft(t){return this._monthsParseExact?(s(this,"_monthsRegex")||dt.call(this),t?this._monthsStrictRegex:this._monthsRegex):this._monthsStrictRegex&&t?this._monthsStrictRegex:this._monthsRegex}function dt(){function t(t,e){return e.length-t.length}var e,n,r=[],i=[],o=[];for(e=0;12>e;e++)n=c([2e3,e]),r.push(this.monthsShort(n,"")),i.push(this.months(n,"")),o.push(this.months(n,"")),o.push(this.monthsShort(n,""));for(r.sort(t),i.sort(t),o.sort(t),e=0;12>e;e++)r[e]=Q(r[e]),i[e]=Q(i[e]),o[e]=Q(o[e]);this._monthsRegex=new RegExp("^("+o.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")$","i"),this._monthsShortStrictRegex=new RegExp("^("+r.join("|")+")$","i")}function ht(t){var e,n=t._a;return n&&-2===f(t).overflow&&(e=n[Ir]<0||n[Ir]>11?Ir:n[Mr]<1||n[Mr]>rt(n[Dr],n[Ir])?Mr:n[Cr]<0||n[Cr]>24||24===n[Cr]&&(0!==n[qr]||0!==n[Lr]||0!==n[Rr])?Cr:n[qr]<0||n[qr]>59?qr:n[Lr]<0||n[Lr]>59?Lr:n[Rr]<0||n[Rr]>999?Rr:-1,f(t)._overflowDayOfYear&&(Dr>e||e>Mr)&&(e=Mr),f(t)._overflowWeeks&&-1===e&&(e=Nr),f(t)._overflowWeekday&&-1===e&&(e=Pr),f(t).overflow=e),t}function pt(t){var e,n,r,i,o,a,s=t._i,u=Wr.exec(s)||Vr.exec(s);if(u){for(f(t).iso=!0,e=0,n=Gr.length;n>e;e++)if(Gr[e][1].exec(u[1])){i=Gr[e][0],r=Gr[e][2]!==!1;break}if(null==i)return void(t._isValid=!1);if(u[3]){for(e=0,n=zr.length;n>e;e++)if(zr[e][1].exec(u[3])){o=(u[2]||" ")+zr[e][0];break}if(null==o)return void(t._isValid=!1)}if(!r&&null!=o)return void(t._isValid=!1);if(u[4]){if(!$r.exec(u[4]))return void(t._isValid=!1);a="Z"}t._f=i+(o||"")+(a||""),Tt(t)}else t._isValid=!1}function vt(t){var e=Jr.exec(t._i);return null!==e?void(t._d=new Date(+e[1])):(pt(t),void(t._isValid===!1&&(delete t._isValid,n.createFromInputFallback(t))))}function mt(t,e,n,r,i,o,a){var s=new Date(t,e,n,r,i,o,a);return 100>t&&t>=0&&isFinite(s.getFullYear())&&s.setFullYear(t),s}function gt(t){var e=new Date(Date.UTC.apply(null,arguments));return 100>t&&t>=0&&isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t),e}function _t(t){return yt(t)?366:365}function yt(t){return t%4===0&&t%100!==0||t%400===0}function bt(){return yt(this.year())}function wt(t,e,n){var r=7+e-n,i=(7+gt(t,0,r).getUTCDay()-e)%7;return-i+r-1}function xt(t,e,n,r,i){var o,a,s=(7+n-r)%7,u=wt(t,r,i),c=1+7*(e-1)+s+u;return 0>=c?(o=t-1,a=_t(o)+c):c>_t(t)?(o=t+1,a=c-_t(t)):(o=t,a=c),{year:o,dayOfYear:a}}function kt(t,e,n){var r,i,o=wt(t.year(),e,n),a=Math.floor((t.dayOfYear()-o-1)/7)+1;return 1>a?(i=t.year()-1,r=a+St(i,e,n)):a>St(t.year(),e,n)?(r=a-St(t.year(),e,n),i=t.year()+1):(i=t.year(),r=a),{week:r,year:i}}function St(t,e,n){var r=wt(t,e,n),i=wt(t+1,e,n);return(_t(t)-r+i)/7}function Et(t,e,n){return null!=t?t:null!=e?e:n}function Ot(t){var e=new Date(n.now());return t._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}function At(t){var e,n,r,i,o=[];if(!t._d){for(r=Ot(t),t._w&&null==t._a[Mr]&&null==t._a[Ir]&&jt(t),t._dayOfYear&&(i=Et(t._a[Dr],r[Dr]),t._dayOfYear>_t(i)&&(f(t)._overflowDayOfYear=!0),n=gt(i,0,t._dayOfYear),t._a[Ir]=n.getUTCMonth(),t._a[Mr]=n.getUTCDate()),e=0;3>e&&null==t._a[e];++e)t._a[e]=o[e]=r[e];for(;7>e;e++)t._a[e]=o[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[Cr]&&0===t._a[qr]&&0===t._a[Lr]&&0===t._a[Rr]&&(t._nextDay=!0,t._a[Cr]=0),t._d=(t._useUTC?gt:mt).apply(null,o),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[Cr]=24)}}function jt(t){var e,n,r,i,o,a,s,u;e=t._w,null!=e.GG||null!=e.W||null!=e.E?(o=1,a=4,n=Et(e.GG,t._a[Dr],kt(Nt(),1,4).year),r=Et(e.W,1),i=Et(e.E,1),(1>i||i>7)&&(u=!0)):(o=t._locale._week.dow,a=t._locale._week.doy,n=Et(e.gg,t._a[Dr],kt(Nt(),o,a).year),r=Et(e.w,1),null!=e.d?(i=e.d,(0>i||i>6)&&(u=!0)):null!=e.e?(i=e.e+o,(e.e<0||e.e>6)&&(u=!0)):i=o),1>r||r>St(n,o,a)?f(t)._overflowWeeks=!0:null!=u?f(t)._overflowWeekday=!0:(s=xt(n,r,i,o,a),t._a[Dr]=s.year,t._dayOfYear=s.dayOfYear)}function Tt(t){if(t._f===n.ISO_8601)return void pt(t);t._a=[],f(t).empty=!0;var e,r,i,o,a,s=""+t._i,u=s.length,c=0;for(i=J(t._f,t._locale).match(sr)||[],e=0;e0&&f(t).unusedInput.push(a),s=s.slice(s.indexOf(r)+r.length),c+=r.length),lr[o]?(r?f(t).empty=!1:f(t).unusedTokens.push(o),nt(o,r,t)):t._strict&&!r&&f(t).unusedTokens.push(o);f(t).charsLeftOver=u-c,s.length>0&&f(t).unusedInput.push(s),f(t).bigHour===!0&&t._a[Cr]<=12&&t._a[Cr]>0&&(f(t).bigHour=void 0),t._a[Cr]=Dt(t._locale,t._a[Cr],t._meridiem),At(t),ht(t)}function Dt(t,e,n){var r;return null==n?e:null!=t.meridiemHour?t.meridiemHour(e,n):null!=t.isPM?(r=t.isPM(n),r&&12>e&&(e+=12),r||12!==e||(e=0),e):e}function It(t){var e,n,r,i,o;if(0===t._f.length)return f(t).invalidFormat=!0,void(t._d=new Date(NaN));for(i=0;io)&&(r=o,n=e));u(t,n||e)}function Mt(t){if(!t._d){var e=F(t._i);t._a=a([e.year,e.month,e.day||e.date,e.hour,e.minute,e.second,e.millisecond],function(t){return t&&parseInt(t,10)}),At(t)}}function Ct(t){var e=new m(ht(qt(t)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}function qt(t){var e=t._i,n=t._f;return t._locale=t._locale||L(t._l),null===e||void 0===n&&""===e?h({nullInput:!0}):("string"==typeof e&&(t._i=e=t._locale.preparse(e)),g(e)?new m(ht(e)):(i(n)?It(t):n?Tt(t):o(e)?t._d=e:Lt(t),d(t)||(t._d=null),t))}function Lt(t){var e=t._i;void 0===e?t._d=new Date(n.now()):o(e)?t._d=new Date(+e):"string"==typeof e?vt(t):i(e)?(t._a=a(e.slice(0),function(t){return parseInt(t,10)}),At(t)):"object"==typeof e?Mt(t):"number"==typeof e?t._d=new Date(e):n.createFromInputFallback(t)}function Rt(t,e,n,r,i){var o={};return"boolean"==typeof n&&(r=n,n=void 0),o._isAMomentObject=!0,o._useUTC=o._isUTC=i,o._l=n,o._i=t,o._f=e,o._strict=r,Ct(o)}function Nt(t,e,n,r){return Rt(t,e,n,r,!1)}function Pt(t,e){var n,r;if(1===e.length&&i(e[0])&&(e=e[0]),!e.length)return Nt();for(n=e[0],r=1;rt&&(t=-t,n="-"),n+W(~~(t/60),2)+e+W(~~t%60,2)})}function Wt(t,e){var n=(e||"").match(t)||[],r=n[n.length-1]||[],i=(r+"").match(ti)||["-",0,0],o=+(60*i[1])+y(i[2]);return"+"===i[0]?o:-o}function Vt(t,e){var r,i;return e._isUTC?(r=e.clone(),i=(g(t)||o(t)?+t:+Nt(t))-+r,r._d.setTime(+r._d+i),n.updateOffset(r,!1),r):Nt(t).local()}function $t(t){return 15*-Math.round(t._d.getTimezoneOffset()/15)}function Gt(t,e){var r,i=this._offset||0;return this.isValid()?null!=t?("string"==typeof t?t=Wt(Er,t):Math.abs(t)<16&&(t=60*t),!this._isUTC&&e&&(r=$t(this)),this._offset=t,this._isUTC=!0,null!=r&&this.add(r,"m"),i!==t&&(!e||this._changeInProgress?le(this,ie(t-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,n.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?i:$t(this):null!=t?this:NaN}function zt(t,e){return null!=t?("string"!=typeof t&&(t=-t),this.utcOffset(t,e),this):-this.utcOffset()}function Jt(t){return this.utcOffset(0,t)}function Kt(t){return this._isUTC&&(this.utcOffset(0,t),this._isUTC=!1,t&&this.subtract($t(this),"m")),this}function Xt(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Wt(Sr,this._i)),this}function Zt(t){return this.isValid()?(t=t?Nt(t).utcOffset():0,(this.utcOffset()-t)%60===0):!1}function Qt(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function te(){if(!p(this._isDSTShifted))return this._isDSTShifted;var t={};if(v(t,this),t=qt(t),t._a){var e=t._isUTC?c(t._a):Nt(t._a);this._isDSTShifted=this.isValid()&&b(t._a,e.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function ee(){return this.isValid()?!this._isUTC:!1}function ne(){return this.isValid()?this._isUTC:!1}function re(){return this.isValid()?this._isUTC&&0===this._offset:!1}function ie(t,e){var n,r,i,o=t,a=null;return Yt(t)?o={ms:t._milliseconds,d:t._days,M:t._months}:"number"==typeof t?(o={},e?o[e]=t:o.milliseconds=t):(a=ei.exec(t))?(n="-"===a[1]?-1:1,o={y:0,d:y(a[Mr])*n,h:y(a[Cr])*n,m:y(a[qr])*n,s:y(a[Lr])*n,ms:y(a[Rr])*n}):(a=ni.exec(t))?(n="-"===a[1]?-1:1,o={y:oe(a[2],n),M:oe(a[3],n),w:oe(a[4],n),d:oe(a[5],n),h:oe(a[6],n),m:oe(a[7],n),s:oe(a[8],n)}):null==o?o={}:"object"==typeof o&&("from"in o||"to"in o)&&(i=se(Nt(o.from),Nt(o.to)),o={},o.ms=i.milliseconds,o.M=i.months),r=new Ht(o),Yt(t)&&s(t,"_locale")&&(r._locale=t._locale),r}function oe(t,e){var n=t&&parseFloat(t.replace(",","."));return(isNaN(n)?0:n)*e}function ae(t,e){var n={milliseconds:0,months:0};return n.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function se(t,e){var n;return t.isValid()&&e.isValid()?(e=Vt(e,t),t.isBefore(e)?n=ae(t,e):(n=ae(e,t),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function ue(t){return 0>t?-1*Math.round(-1*t):Math.round(t)}function ce(t,e){return function(n,r){var i,o;return null===r||isNaN(+r)||(k(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period)."),o=n,n=r,r=o),n="string"==typeof n?+n:n,i=ie(n,r),le(this,i,t),this}}function le(t,e,r,i){var o=e._milliseconds,a=ue(e._days),s=ue(e._months);t.isValid()&&(i=null==i?!0:i,o&&t._d.setTime(+t._d+o*r),a&&Y(t,"Date",H(t,"Date")+a*r),s&&st(t,H(t,"Month")+s*r),i&&n.updateOffset(t,a||s))}function fe(t,e){var n=t||Nt(),r=Vt(n,this).startOf("day"),i=this.diff(r,"days",!0),o=-6>i?"sameElse":-1>i?"lastWeek":0>i?"lastDay":1>i?"sameDay":2>i?"nextDay":7>i?"nextWeek":"sameElse",a=e&&(S(e[o])?e[o]():e[o]);return this.format(a||this.localeData().calendar(o,this,Nt(n)))}function de(){return new m(this)}function he(t,e){var n=g(t)?t:Nt(t);return this.isValid()&&n.isValid()?(e=P(p(e)?"millisecond":e),"millisecond"===e?+this>+n:+n<+this.clone().startOf(e)):!1}function pe(t,e){var n=g(t)?t:Nt(t);return this.isValid()&&n.isValid()?(e=P(p(e)?"millisecond":e),"millisecond"===e?+n>+this:+this.clone().endOf(e)<+n):!1}function ve(t,e,n){return this.isAfter(t,n)&&this.isBefore(e,n)}function me(t,e){var n,r=g(t)?t:Nt(t);return this.isValid()&&r.isValid()?(e=P(e||"millisecond"),"millisecond"===e?+this===+r:(n=+r,+this.clone().startOf(e)<=n&&n<=+this.clone().endOf(e))):!1}function ge(t,e){return this.isSame(t,e)||this.isAfter(t,e)}function _e(t,e){return this.isSame(t,e)||this.isBefore(t,e)}function ye(t,e,n){var r,i,o,a;return this.isValid()?(r=Vt(t,this),r.isValid()?(i=6e4*(r.utcOffset()-this.utcOffset()),e=P(e),"year"===e||"month"===e||"quarter"===e?(a=be(this,r),"quarter"===e?a/=3:"year"===e&&(a/=12)):(o=this-r,a="second"===e?o/1e3:"minute"===e?o/6e4:"hour"===e?o/36e5:"day"===e?(o-i)/864e5:"week"===e?(o-i)/6048e5:o),n?a:_(a)):NaN):NaN}function be(t,e){var n,r,i=12*(e.year()-t.year())+(e.month()-t.month()),o=t.clone().add(i,"months");return 0>e-o?(n=t.clone().add(i-1,"months"),r=(e-o)/(o-n)):(n=t.clone().add(i+1,"months"),r=(e-o)/(n-o)),-(i+r)}function we(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function xe(){var t=this.clone().utc();return 0o&&(e=o),ze.call(this,t,e,n,r,i))}function ze(t,e,n,r,i){var o=xt(t,e,n,r,i),a=gt(o.year,0,o.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}function Je(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)}function Ke(t){return kt(t,this._week.dow,this._week.doy).week}function Xe(){return this._week.dow}function Ze(){return this._week.doy}function Qe(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")}function tn(t){var e=kt(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")}function en(t,e){return"string"!=typeof t?t:isNaN(t)?(t=e.weekdaysParse(t),"number"==typeof t?t:null):parseInt(t,10)}function nn(t,e){return i(this._weekdays)?this._weekdays[t.day()]:this._weekdays[this._weekdays.isFormat.test(e)?"format":"standalone"][t.day()]}function rn(t){return this._weekdaysShort[t.day()]}function on(t){return this._weekdaysMin[t.day()]}function an(t,e,n){var r,i,o;for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;7>r;r++){if(i=Nt([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(i,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(i,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(i,"").replace(".",".?")+"$","i")),this._weekdaysParse[r]||(o="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[r]=new RegExp(o.replace(".",""),"i")),n&&"dddd"===e&&this._fullWeekdaysParse[r].test(t))return r;if(n&&"ddd"===e&&this._shortWeekdaysParse[r].test(t))return r;if(n&&"dd"===e&&this._minWeekdaysParse[r].test(t))return r;if(!n&&this._weekdaysParse[r].test(t))return r}}function sn(t){if(!this.isValid())return null!=t?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=en(t,this.localeData()),this.add(t-e,"d")):e}function un(t){if(!this.isValid())return null!=t?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")}function cn(t){return this.isValid()?null==t?this.day()||7:this.day(this.day()%7?t:t-7):null!=t?this:NaN}function ln(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")}function fn(){return this.hours()%12||12}function dn(t,e){V(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}function hn(t,e){return e._meridiemParse}function pn(t){return"p"===(t+"").toLowerCase().charAt(0)}function vn(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"}function mn(t,e){e[Rr]=y(1e3*("0."+t))}function gn(){return this._isUTC?"UTC":""}function _n(){return this._isUTC?"Coordinated Universal Time":""}function yn(t){return Nt(1e3*t)}function bn(){return Nt.apply(null,arguments).parseZone()}function wn(t,e,n){var r=this._calendar[t];return S(r)?r.call(e,n):r}function xn(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t])}function kn(){return this._invalidDate}function Sn(t){return this._ordinal.replace("%d",t)}function En(t){return t}function On(t,e,n,r){var i=this._relativeTime[n];return S(i)?i(t,e,n,r):i.replace(/%d/i,t)}function An(t,e){var n=this._relativeTime[t>0?"future":"past"];return S(n)?n(e):n.replace(/%s/i,e)}function jn(t,e,n,r){var i=L(),o=c().set(r,e);return i[n](o,t)}function Tn(t,e,n,r,i){if("number"==typeof t&&(e=t,t=void 0),t=t||"",null!=e)return jn(t,e,n,i);var o,a=[];for(o=0;r>o;o++)a[o]=jn(t,o,n,i);return a}function Dn(t,e){return Tn(t,e,"months",12,"month")}function In(t,e){return Tn(t,e,"monthsShort",12,"month")}function Mn(t,e){return Tn(t,e,"weekdays",7,"day")}function Cn(t,e){return Tn(t,e,"weekdaysShort",7,"day")}function qn(t,e){return Tn(t,e,"weekdaysMin",7,"day")}function Ln(){var t=this._data;return this._milliseconds=Oi(this._milliseconds),this._days=Oi(this._days),this._months=Oi(this._months),t.milliseconds=Oi(t.milliseconds),t.seconds=Oi(t.seconds),t.minutes=Oi(t.minutes),t.hours=Oi(t.hours),t.months=Oi(t.months),t.years=Oi(t.years),this}function Rn(t,e,n,r){var i=ie(e,n);return t._milliseconds+=r*i._milliseconds,t._days+=r*i._days,t._months+=r*i._months,t._bubble()}function Nn(t,e){return Rn(this,t,e,1)}function Pn(t,e){return Rn(this,t,e,-1)}function Fn(t){return 0>t?Math.floor(t):Math.ceil(t)}function Un(){var t,e,n,r,i,o=this._milliseconds,a=this._days,s=this._months,u=this._data;return o>=0&&a>=0&&s>=0||0>=o&&0>=a&&0>=s||(o+=864e5*Fn(Yn(s)+a),a=0,s=0),u.milliseconds=o%1e3,t=_(o/1e3),u.seconds=t%60,e=_(t/60),u.minutes=e%60,n=_(e/60),u.hours=n%24,a+=_(n/24),i=_(Hn(a)),s+=i,a-=Fn(Yn(i)),r=_(s/12),s%=12,u.days=a,u.months=s,u.years=r,this}function Hn(t){return 4800*t/146097}function Yn(t){return 146097*t/4800}function Bn(t){var e,n,r=this._milliseconds;if(t=P(t),"month"===t||"year"===t)return e=this._days+r/864e5,n=this._months+Hn(e),"month"===t?n:n/12;switch(e=this._days+Math.round(Yn(this._months)),t){case"week":return e/7+r/6048e5;case"day":return e+r/864e5;case"hour":return 24*e+r/36e5;case"minute":return 1440*e+r/6e4;case"second":return 86400*e+r/1e3;case"millisecond":return Math.floor(864e5*e)+r;default:throw new Error("Unknown unit "+t)}}function Wn(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*y(this._months/12)}function Vn(t){return function(){return this.as(t)}}function $n(t){return t=P(t),this[t+"s"]()}function Gn(t){return function(){return this._data[t]}}function zn(){return _(this.days()/7)}function Jn(t,e,n,r,i){return i.relativeTime(e||1,!!n,t,r)}function Kn(t,e,n){var r=ie(t).abs(),i=Yi(r.as("s")),o=Yi(r.as("m")),a=Yi(r.as("h")),s=Yi(r.as("d")),u=Yi(r.as("M")),c=Yi(r.as("y")),l=i=o&&["m"]||o=a&&["h"]||a=s&&["d"]||s=u&&["M"]||u=c&&["y"]||["yy",c];return l[2]=e,l[3]=+t>0,l[4]=n,Jn.apply(null,l)}function Xn(t,e){return void 0===Bi[t]?!1:void 0===e?Bi[t]:(Bi[t]=e,!0)}function Zn(t){var e=this.localeData(),n=Kn(this,!t,e);return t&&(n=e.pastFuture(+this,n)),e.postformat(n)}function Qn(){var t,e,n,r=Wi(this._milliseconds)/1e3,i=Wi(this._days),o=Wi(this._months);t=_(r/60),e=_(t/60),r%=60,t%=60,n=_(o/12),o%=12;var a=n,s=o,u=i,c=e,l=t,f=r,d=this.asSeconds();return d?(0>d?"-":"")+"P"+(a?a+"Y":"")+(s?s+"M":"")+(u?u+"D":"")+(c||l||f?"T":"")+(c?c+"H":"")+(l?l+"M":"")+(f?f+"S":""):"P0D"}var tr,er=n.momentProperties=[],nr=!1,rr={};n.suppressDeprecationWarnings=!1;var ir,or={},ar={},sr=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,ur=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,cr={},lr={},fr=/\d/,dr=/\d\d/,hr=/\d{3}/,pr=/\d{4}/,vr=/[+-]?\d{6}/,mr=/\d\d?/,gr=/\d\d\d\d?/,_r=/\d\d\d\d\d\d?/,yr=/\d{1,3}/,br=/\d{1,4}/,wr=/[+-]?\d{1,6}/,xr=/\d+/,kr=/[+-]?\d+/,Sr=/Z|[+-]\d\d:?\d\d/gi,Er=/Z|[+-]\d\d(?::?\d\d)?/gi,Or=/[+-]?\d+(\.\d{1,3})?/,Ar=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,jr={},Tr={},Dr=0,Ir=1,Mr=2,Cr=3,qr=4,Lr=5,Rr=6,Nr=7,Pr=8;V("M",["MM",2],"Mo",function(){return this.month()+1}),V("MMM",0,0,function(t){return this.localeData().monthsShort(this,t)}),V("MMMM",0,0,function(t){return this.localeData().months(this,t)}),N("month","M"),K("M",mr),K("MM",mr,dr),K("MMM",function(t,e){return e.monthsShortRegex(t)}),K("MMMM",function(t,e){return e.monthsRegex(t)}),tt(["M","MM"],function(t,e){e[Ir]=y(t)-1}),tt(["MMM","MMMM"],function(t,e,n,r){var i=n._locale.monthsParse(t,r,n._strict);null!=i?e[Ir]=i:f(n).invalidMonth=t});var Fr=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/,Ur="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Hr="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Yr=Ar,Br=Ar,Wr=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,Vr=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,$r=/Z|[+-]\d\d(?::?\d\d)?/,Gr=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],zr=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Jr=/^\/?Date\((\-?\d+)/i;n.createFromInputFallback=x("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(t){t._d=new Date(t._i+(t._useUTC?" UTC":""))}),V("Y",0,0,function(){var t=this.year();return 9999>=t?""+t:"+"+t}),V(0,["YY",2],0,function(){return this.year()%100}),V(0,["YYYY",4],0,"year"),V(0,["YYYYY",5],0,"year"),V(0,["YYYYYY",6,!0],0,"year"),N("year","y"),K("Y",kr),K("YY",mr,dr),K("YYYY",br,pr),K("YYYYY",wr,vr),K("YYYYYY",wr,vr),tt(["YYYYY","YYYYYY"],Dr),tt("YYYY",function(t,e){e[Dr]=2===t.length?n.parseTwoDigitYear(t):y(t)}),tt("YY",function(t,e){e[Dr]=n.parseTwoDigitYear(t)}),tt("Y",function(t,e){e[Dr]=parseInt(t,10)}),n.parseTwoDigitYear=function(t){return y(t)+(y(t)>68?1900:2e3)};var Kr=U("FullYear",!1);n.ISO_8601=function(){};var Xr=x("moment().min is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var t=Nt.apply(null,arguments);return this.isValid()&&t.isValid()?this>t?this:t:h()}),Zr=x("moment().max is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var t=Nt.apply(null,arguments);return this.isValid()&&t.isValid()?t>this?this:t:h()}),Qr=function(){return Date.now?Date.now():+new Date};Bt("Z",":"),Bt("ZZ",""),K("Z",Er),K("ZZ",Er),tt(["Z","ZZ"],function(t,e,n){n._useUTC=!0,n._tzm=Wt(Er,t)});var ti=/([\+\-]|\d\d)/gi;n.updateOffset=function(){};var ei=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/,ni=/^(-)?P(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)W)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?$/;ie.fn=Ht.prototype;var ri=ce(1,"add"),ii=ce(-1,"subtract");n.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";var oi=x("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return void 0===t?this.localeData():this.locale(t)});V(0,["gg",2],0,function(){return this.weekYear()%100}),V(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Ye("gggg","weekYear"),Ye("ggggg","weekYear"),Ye("GGGG","isoWeekYear"),Ye("GGGGG","isoWeekYear"),N("weekYear","gg"),N("isoWeekYear","GG"),K("G",kr),K("g",kr),K("GG",mr,dr),K("gg",mr,dr),K("GGGG",br,pr),K("gggg",br,pr),K("GGGGG",wr,vr),K("ggggg",wr,vr),et(["gggg","ggggg","GGGG","GGGGG"],function(t,e,n,r){e[r.substr(0,2)]=y(t)}),et(["gg","GG"],function(t,e,r,i){e[i]=n.parseTwoDigitYear(t)}),V("Q",0,"Qo","quarter"),N("quarter","Q"),K("Q",fr),tt("Q",function(t,e){e[Ir]=3*(y(t)-1)}),V("w",["ww",2],"wo","week"),V("W",["WW",2],"Wo","isoWeek"),N("week","w"),N("isoWeek","W"),K("w",mr),K("ww",mr,dr),K("W",mr),K("WW",mr,dr),et(["w","ww","W","WW"],function(t,e,n,r){e[r.substr(0,1)]=y(t)});var ai={dow:0,doy:6};V("D",["DD",2],"Do","date"),N("date","D"),K("D",mr),K("DD",mr,dr),K("Do",function(t,e){return t?e._ordinalParse:e._ordinalParseLenient}),tt(["D","DD"],Mr),tt("Do",function(t,e){e[Mr]=y(t.match(mr)[0],10)});var si=U("Date",!0);V("d",0,"do","day"),V("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)}),V("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)}),V("dddd",0,0,function(t){return this.localeData().weekdays(this,t)}),V("e",0,0,"weekday"),V("E",0,0,"isoWeekday"),N("day","d"),N("weekday","e"),N("isoWeekday","E"),K("d",mr),K("e",mr),K("E",mr),K("dd",Ar),K("ddd",Ar),K("dddd",Ar),et(["dd","ddd","dddd"],function(t,e,n,r){var i=n._locale.weekdaysParse(t,r,n._strict);null!=i?e.d=i:f(n).invalidWeekday=t}),et(["d","e","E"],function(t,e,n,r){e[r]=y(t)});var ui="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ci="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),li="Su_Mo_Tu_We_Th_Fr_Sa".split("_");V("DDD",["DDDD",3],"DDDo","dayOfYear"),N("dayOfYear","DDD"),K("DDD",yr),K("DDDD",hr),tt(["DDD","DDDD"],function(t,e,n){n._dayOfYear=y(t)}),V("H",["HH",2],0,"hour"),V("h",["hh",2],0,fn),V("hmm",0,0,function(){return""+fn.apply(this)+W(this.minutes(),2)}),V("hmmss",0,0,function(){return""+fn.apply(this)+W(this.minutes(),2)+W(this.seconds(),2)}),V("Hmm",0,0,function(){return""+this.hours()+W(this.minutes(),2)}),V("Hmmss",0,0,function(){return""+this.hours()+W(this.minutes(),2)+W(this.seconds(),2)}),dn("a",!0),dn("A",!1),N("hour","h"),K("a",hn),K("A",hn),K("H",mr),K("h",mr),K("HH",mr,dr),K("hh",mr,dr),K("hmm",gr),K("hmmss",_r),K("Hmm",gr),K("Hmmss",_r),tt(["H","HH"],Cr),tt(["a","A"],function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t}),tt(["h","hh"],function(t,e,n){e[Cr]=y(t),f(n).bigHour=!0}),tt("hmm",function(t,e,n){var r=t.length-2;e[Cr]=y(t.substr(0,r)),e[qr]=y(t.substr(r)),f(n).bigHour=!0}),tt("hmmss",function(t,e,n){var r=t.length-4,i=t.length-2;e[Cr]=y(t.substr(0,r)),e[qr]=y(t.substr(r,2)),e[Lr]=y(t.substr(i)),f(n).bigHour=!0}),tt("Hmm",function(t,e,n){var r=t.length-2;e[Cr]=y(t.substr(0,r)),e[qr]=y(t.substr(r))}),tt("Hmmss",function(t,e,n){var r=t.length-4,i=t.length-2;e[Cr]=y(t.substr(0,r)),e[qr]=y(t.substr(r,2)),e[Lr]=y(t.substr(i))});var fi=/[ap]\.?m?\.?/i,di=U("Hours",!0);V("m",["mm",2],0,"minute"),N("minute","m"),K("m",mr),K("mm",mr,dr),tt(["m","mm"],qr);var hi=U("Minutes",!1);V("s",["ss",2],0,"second"),N("second","s"),K("s",mr),K("ss",mr,dr),tt(["s","ss"],Lr);var pi=U("Seconds",!1);V("S",0,0,function(){return~~(this.millisecond()/100)}),V(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),V(0,["SSS",3],0,"millisecond"),V(0,["SSSS",4],0,function(){return 10*this.millisecond()}),V(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),V(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),V(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),V(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),V(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),N("millisecond","ms"),K("S",yr,fr),K("SS",yr,dr),K("SSS",yr,hr);var vi;for(vi="SSSS";vi.length<=9;vi+="S")K(vi,xr);for(vi="S";vi.length<=9;vi+="S")tt(vi,mn);var mi=U("Milliseconds",!1);V("z",0,0,"zoneAbbr"),V("zz",0,0,"zoneName");var gi=m.prototype;gi.add=ri,gi.calendar=fe,gi.clone=de,gi.diff=ye,gi.endOf=Ie,gi.format=ke,gi.from=Se,gi.fromNow=Ee,gi.to=Oe,gi.toNow=Ae,gi.get=B,gi.invalidAt=Ue,gi.isAfter=he,gi.isBefore=pe,gi.isBetween=ve,gi.isSame=me,gi.isSameOrAfter=ge,gi.isSameOrBefore=_e,gi.isValid=Pe,gi.lang=oi,gi.locale=je,gi.localeData=Te,gi.max=Zr,gi.min=Xr,gi.parsingFlags=Fe,gi.set=B,gi.startOf=De,gi.subtract=ii,gi.toArray=Le,gi.toObject=Re,gi.toDate=qe,gi.toISOString=xe,gi.toJSON=Ne,gi.toString=we,gi.unix=Ce,gi.valueOf=Me,gi.creationData=He,gi.year=Kr,gi.isLeapYear=bt,gi.weekYear=Be,gi.isoWeekYear=We,gi.quarter=gi.quarters=Je,gi.month=ut,gi.daysInMonth=ct,gi.week=gi.weeks=Qe,gi.isoWeek=gi.isoWeeks=tn,gi.weeksInYear=$e,gi.isoWeeksInYear=Ve,gi.date=si,gi.day=gi.days=sn,gi.weekday=un,gi.isoWeekday=cn,gi.dayOfYear=ln,gi.hour=gi.hours=di,gi.minute=gi.minutes=hi,gi.second=gi.seconds=pi,gi.millisecond=gi.milliseconds=mi,gi.utcOffset=Gt,gi.utc=Jt,gi.local=Kt,gi.parseZone=Xt,gi.hasAlignedHourOffset=Zt,gi.isDST=Qt,gi.isDSTShifted=te,gi.isLocal=ee,gi.isUtcOffset=ne,gi.isUtc=re,gi.isUTC=re,gi.zoneAbbr=gn,gi.zoneName=_n,gi.dates=x("dates accessor is deprecated. Use date instead.",si),gi.months=x("months accessor is deprecated. Use month instead",ut),gi.years=x("years accessor is deprecated. Use year instead",Kr),gi.zone=x("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",zt);var _i=gi,yi={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},bi={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},wi="Invalid date",xi="%d",ki=/\d{1,2}/,Si={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Ei=j.prototype;Ei._calendar=yi,Ei.calendar=wn,Ei._longDateFormat=bi,Ei.longDateFormat=xn,Ei._invalidDate=wi,Ei.invalidDate=kn,Ei._ordinal=xi,Ei.ordinal=Sn,Ei._ordinalParse=ki,Ei.preparse=En,Ei.postformat=En,Ei._relativeTime=Si,Ei.relativeTime=On,Ei.pastFuture=An,Ei.set=O,Ei.months=it,Ei._months=Ur,Ei.monthsShort=ot,Ei._monthsShort=Hr,Ei.monthsParse=at,Ei._monthsRegex=Br,Ei.monthsRegex=ft,Ei._monthsShortRegex=Yr,Ei.monthsShortRegex=lt,Ei.week=Ke,Ei._week=ai,Ei.firstDayOfYear=Ze,Ei.firstDayOfWeek=Xe,Ei.weekdays=nn,Ei._weekdays=ui,Ei.weekdaysMin=on,Ei._weekdaysMin=li,Ei.weekdaysShort=rn,Ei._weekdaysShort=ci,Ei.weekdaysParse=an,Ei.isPM=pn,Ei._meridiemParse=fi,Ei.meridiem=vn,M("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10,n=1===y(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th";return t+n}}),n.lang=x("moment.lang is deprecated. Use moment.locale instead.",M),n.langData=x("moment.langData is deprecated. Use moment.localeData instead.",L);var Oi=Math.abs,Ai=Vn("ms"),ji=Vn("s"),Ti=Vn("m"),Di=Vn("h"),Ii=Vn("d"),Mi=Vn("w"),Ci=Vn("M"),qi=Vn("y"),Li=Gn("milliseconds"),Ri=Gn("seconds"),Ni=Gn("minutes"),Pi=Gn("hours"),Fi=Gn("days"),Ui=Gn("months"),Hi=Gn("years"),Yi=Math.round,Bi={s:45,m:45,h:22,d:26,M:11},Wi=Math.abs,Vi=Ht.prototype;Vi.abs=Ln,Vi.add=Nn,Vi.subtract=Pn,Vi.as=Bn,Vi.asMilliseconds=Ai,Vi.asSeconds=ji,Vi.asMinutes=Ti,Vi.asHours=Di,Vi.asDays=Ii,Vi.asWeeks=Mi,Vi.asMonths=Ci,Vi.asYears=qi,Vi.valueOf=Wn,Vi._bubble=Un,Vi.get=$n,Vi.milliseconds=Li,Vi.seconds=Ri,Vi.minutes=Ni,Vi.hours=Pi,Vi.days=Fi,Vi.weeks=zn,Vi.months=Ui,Vi.years=Hi,Vi.humanize=Zn,Vi.toISOString=Qn,Vi.toString=Qn,Vi.toJSON=Qn,Vi.locale=je,Vi.localeData=Te,Vi.toIsoString=x("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Qn),Vi.lang=oi,V("X",0,0,"unix"),V("x",0,0,"valueOf"),K("x",kr),K("X",Or),tt("X",function(t,e,n){n._d=new Date(1e3*parseFloat(t,10))}),tt("x",function(t,e,n){n._d=new Date(y(t))}),n.version="2.12.0",r(Nt),n.fn=_i,n.min=Ft,n.max=Ut,n.now=Qr,n.utc=c,n.unix=yn,n.months=Dn,n.isDate=o,n.locale=M,n.invalid=h,n.duration=ie,n.isMoment=g,n.weekdays=Mn,n.parseZone=bn,n.localeData=L,n.isDuration=Yt,n.monthsShort=In,n.weekdaysMin=qn,n.defineLocale=C,n.updateLocale=q,n.locales=R,n.weekdaysShort=Cn,n.normalizeUnits=P,n.relativeTimeThreshold=Xn,n.prototype=_i;var $i=n;return $i})},{}],124:[function(t,e,n){(function(r){!function(t){if("object"==typeof n&&"undefined"!=typeof e)e.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i;i="undefined"!=typeof window?window:"undefined"!=typeof r?r:"undefined"!=typeof self?self:this,i.PouchDB=t()}}(function(){var e;return function n(e,r,i){function o(s,u){if(!r[s]){if(!e[s]){var c="function"==typeof t&&t;if(!u&&c)return c(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var f=r[s]={exports:{}};e[s][0].call(f.exports,function(t){var n=e[s][1][t];return o(n?n:t)},f,f.exports,n,e,r,i)}return r[s].exports}for(var a="function"==typeof t&&t,s=0;s=31}function i(){var t=arguments,e=this.useColors;if(t[0]=(e?"%c":"")+this.namespace+(e?" %c":" ")+t[0]+(e?"%c ":" ")+"+"+n.humanize(this.diff),!e)return t;var r="color: "+this.color;t=[t[0],r,"color: inherit"].concat(Array.prototype.slice.call(t,1));var i=0,o=0;return t[0].replace(/%[a-z%]/g,function(t){"%%"!==t&&(i++,"%c"===t&&(o=i))}),t.splice(o,0,r),t}function o(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(t){try{null==t?n.storage.removeItem("debug"):n.storage.debug=t}catch(e){}}function s(){var t;try{t=n.storage.debug}catch(e){}return t}function u(){try{return window.localStorage}catch(t){}}n=e.exports=t(3),n.log=o,n.formatArgs=i,n.save=a,n.load=s,n.useColors=r,n.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(t){return JSON.stringify(t)},n.enable(s())},{3:3}],3:[function(t,e,n){function r(){return n.colors[l++%n.colors.length]}function i(t){function e(){}function i(){var t=i,e=+new Date,o=e-(c||e);t.diff=o,t.prev=c,t.curr=e,c=e,null==t.useColors&&(t.useColors=n.useColors()),null==t.color&&t.useColors&&(t.color=r());var a=Array.prototype.slice.call(arguments);a[0]=n.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var s=0;a[0]=a[0].replace(/%([a-z%])/g,function(e,r){if("%%"===e)return e;s++;var i=n.formatters[r];if("function"==typeof i){var o=a[s];e=i.call(t,o),a.splice(s,1),s--}return e}),"function"==typeof n.formatArgs&&(a=n.formatArgs.apply(t,a));var u=i.log||n.log||console.log.bind(console);u.apply(t,a)}e.enabled=!1,i.enabled=!0;var o=n.enabled(t)?i:e;return o.namespace=t,o}function o(t){n.save(t);for(var e=(t||"").split(/[\s,]+/),r=e.length,i=0;r>i;i++)e[i]&&(t=e[i].replace(/\*/g,".*?"),"-"===t[0]?n.skips.push(new RegExp("^"+t.substr(1)+"$")):n.names.push(new RegExp("^"+t+"$")))}function a(){n.enable("")}function s(t){var e,r;for(e=0,r=n.skips.length;r>e;e++)if(n.skips[e].test(t))return!1;for(e=0,r=n.names.length;r>e;e++)if(n.names[e].test(t))return!0;return!1}function u(t){return t instanceof Error?t.stack||t.message:t}n=e.exports=i,n.coerce=u,n.disable=a,n.enable=o,n.enabled=s,n.humanize=t(9),n.names=[],n.skips=[],n.formatters={};var c,l=0},{9:9}],4:[function(t,e,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function o(t){return"number"==typeof t}function a(t){return"object"==typeof t&&null!==t}function s(t){return void 0===t}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if(!o(t)||0>t||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,n,r,o,u,c;if(this._events||(this._events={}),"error"===t&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[t],s(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),n.apply(this,o)}else if(a(n))for(o=Array.prototype.slice.call(arguments,1),c=n.slice(),r=c.length,u=0;r>u;u++)c[u].apply(this,o);return!0},r.prototype.addListener=function(t,e){var n;if(!i(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e),this._events[t]?a(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,a(this._events[t])&&!this._events[t].warned&&(n=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[t].length>n&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},r.prototype.removeListener=function(t,e){var n,r,o,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,r=-1,n===e||i(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(a(n)){for(s=o;s-- >0;)if(n[s]===e||n[s].listener&&n[s].listener===e){r=s;break}if(0>r)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],i(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},{}],5:[function(t,e,n){(function(t){"use strict";function n(){l=!0;for(var t,e,n=f.length;n;){for(e=f,f=[],t=-1;++t1e4)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*f;case"days":case"day":case"d":return n*l;case"hours":case"hour":case"hrs":case"hr":case"h":return n*c;case"minutes":case"minute":case"mins":case"min":case"m":return n*u;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}}function i(t){return t>=l?Math.round(t/l)+"d":t>=c?Math.round(t/c)+"h":t>=u?Math.round(t/u)+"m":t>=s?Math.round(t/s)+"s":t+"ms"; -}function o(t){return a(t,l,"day")||a(t,c,"hour")||a(t,u,"minute")||a(t,s,"second")||t+" ms"}function a(t,e,n){return e>t?void 0:1.5*e>t?Math.floor(t/e)+" "+n:Math.ceil(t/e)+" "+n+"s"}var s=1e3,u=60*s,c=60*u,l=24*c,f=365.25*l;e.exports=function(t,e){return e=e||{},"string"==typeof t?r(t):e["long"]?o(t):i(t)}},{}],10:[function(t,e,n){"use strict";function r(t){if(null!==t)switch(typeof t){case"boolean":return t?1:0;case"number":return l(t);case"string":return t.replace(/\u0002/g,"").replace(/\u0001/g,"").replace(/\u0000/g,"");case"object":var e=Array.isArray(t),r=e?t:Object.keys(t),i=-1,o=r.length,a="";if(e)for(;++ii;i++){var o=n.collate(t[i],e[i]);if(0!==o)return o}return t.length===e.length?0:t.length>e.length?1:-1}function s(t,e){return t===e?0:t>e?1:-1}function u(t,e){for(var r=Object.keys(t),i=Object.keys(e),o=Math.min(r.length,i.length),a=0;o>a;a++){var s=n.collate(r[a],i[a]);if(0!==s)return s;if(s=n.collate(t[r[a]],e[i[a]]),0!==s)return s}return r.length===i.length?0:r.length>i.length?1:-1}function c(t){var e=["boolean","number","string","object"],n=e.indexOf(typeof t);return~n?null===t?1:Array.isArray(t)?5:3>n?n+2:n+3:Array.isArray(t)?5:void 0}function l(t){if(0===t)return"1";var e=t.toExponential().split(/e\+?/),n=parseInt(e[1],10),r=0>t,i=r?"0":"2",o=(r?-n:n)-f,a=p.padLeft(o.toString(),"0",d);i+=h+a;var s=Math.abs(parseFloat(e[0]));r&&(s=10-s);var u=s.toFixed(20);return u=u.replace(/\.?0+$/,""),i+=h+u}var f=-324,d=3,h="",p=t(11);n.collate=function(t,e){if(t===e)return 0;t=n.normalizeKey(t),e=n.normalizeKey(e);var r=c(t),i=c(e);if(r-i!==0)return r-i;if(null===t)return 0;switch(typeof t){case"number":return t-e;case"boolean":return t===e?0:e>t?-1:1;case"string":return s(t,e)}return Array.isArray(t)?a(t,e):u(t,e)},n.normalizeKey=function(t){switch(typeof t){case"undefined":return null;case"number":return t===1/0||t===-(1/0)||isNaN(t)?null:t;case"object":var e=t;if(Array.isArray(t)){var r=t.length;t=new Array(r);for(var i=0;r>i;i++)t[i]=n.normalizeKey(e[i])}else{if(t instanceof Date)return t.toJSON();if(null!==t){t={};for(var o in e)if(e.hasOwnProperty(o)){var a=e[o];"undefined"!=typeof a&&(t[o]=n.normalizeKey(a))}}}}return t},n.toIndexableString=function(t){var e="\x00";return t=n.normalizeKey(t),c(t)+h+r(t)+e},n.parseIndexableString=function(t){for(var e=[],n=[],r=0;;){var a=t[r++];if("\x00"!==a)switch(a){case"1":e.push(null);break;case"2":e.push("1"===t[r]),r++;break;case"3":var s=i(t,r);e.push(s.num),r+=s.length;break;case"4":for(var u="";;){var c=t[r];if("\x00"===c)break;u+=c,r++}u=u.replace(/\u0001\u0001/g,"\x00").replace(/\u0001\u0002/g,"").replace(/\u0002\u0002/g,""),e.push(u);break;case"5":var l={element:[],index:e.length};e.push(l.element),n.push(l);break;case"6":var f={element:{},index:e.length};e.push(f.element),n.push(f);break;default:throw new Error("bad collationIndex or unexpectedly reached end of input: "+a)}else{if(1===e.length)return e.pop();o(e,n)}}}},{11:11}],11:[function(t,e,n){"use strict";function r(t,e,n){for(var r="",i=n-t.length;r.lengthn;n++){if(n===i)return 1;var o=t.charAt(n),a=e.charAt(n);if(o!==a)return a>o?-1:1}return i>r?-1:0},n.intToDecimalForm=function(t){var e=0>t,n="";do{var r=e?-Math.ceil(t%10):Math.floor(t%10);n=r+n,t=e?Math.ceil(t/10):Math.floor(t/10)}while(t);return e&&"0"!==n&&(n="-"+n),n}},{}],12:[function(t,e,n){"use strict";function r(){this.store={}}function i(t){if(this.store=new r,t&&Array.isArray(t))for(var e=0,n=t.length;n>e;e++)this.add(t[e])}n.Map=r,n.Set=i,r.prototype.mangle=function(t){if("string"!=typeof t)throw new TypeError("key must be a string but Got "+t);return"$"+t},r.prototype.unmangle=function(t){return t.substring(1)},r.prototype.get=function(t){var e=this.mangle(t);return e in this.store?this.store[e]:void 0},r.prototype.set=function(t,e){var n=this.mangle(t);return this.store[n]=e,!0},r.prototype.has=function(t){var e=this.mangle(t);return e in this.store},r.prototype["delete"]=function(t){var e=this.mangle(t);return e in this.store?(delete this.store[e],!0):!1},r.prototype.forEach=function(t){for(var e=Object.keys(this.store),n=0,r=e.length;r>n;n++){var i=e[n],o=this.store[i];i=this.unmangle(i),t(o,i)}},i.prototype.add=function(t){return this.store.set(t,!0)},i.prototype.has=function(t){return this.store.has(t)},i.prototype["delete"]=function(t){return this.store["delete"](t)}},{}],13:[function(t,e,n){function r(){l=!1,s.length?c=s.concat(c):f=-1,c.length&&i()}function i(){if(!l){var t=setTimeout(r);l=!0;for(var e=c.length;e;){for(s=c,c=[];++f1)for(var n=1;n>>32-i,n)}function n(t,n,r,i,o,a,s){return e(n&r|~n&i,t,n,o,a,s)}function r(t,n,r,i,o,a,s){return e(n&i|r&~i,t,n,o,a,s)}function i(t,n,r,i,o,a,s){return e(n^r^i,t,n,o,a,s)}function o(t,n,r,i,o,a,s){return e(r^(n|~i),t,n,o,a,s)}function a(t,e){var a=t[0],s=t[1],u=t[2],c=t[3];a=n(a,s,u,c,e[0],7,-680876936),c=n(c,a,s,u,e[1],12,-389564586),u=n(u,c,a,s,e[2],17,606105819),s=n(s,u,c,a,e[3],22,-1044525330),a=n(a,s,u,c,e[4],7,-176418897),c=n(c,a,s,u,e[5],12,1200080426),u=n(u,c,a,s,e[6],17,-1473231341),s=n(s,u,c,a,e[7],22,-45705983),a=n(a,s,u,c,e[8],7,1770035416),c=n(c,a,s,u,e[9],12,-1958414417),u=n(u,c,a,s,e[10],17,-42063),s=n(s,u,c,a,e[11],22,-1990404162),a=n(a,s,u,c,e[12],7,1804603682),c=n(c,a,s,u,e[13],12,-40341101),u=n(u,c,a,s,e[14],17,-1502002290),s=n(s,u,c,a,e[15],22,1236535329),a=r(a,s,u,c,e[1],5,-165796510),c=r(c,a,s,u,e[6],9,-1069501632),u=r(u,c,a,s,e[11],14,643717713),s=r(s,u,c,a,e[0],20,-373897302),a=r(a,s,u,c,e[5],5,-701558691),c=r(c,a,s,u,e[10],9,38016083),u=r(u,c,a,s,e[15],14,-660478335),s=r(s,u,c,a,e[4],20,-405537848),a=r(a,s,u,c,e[9],5,568446438),c=r(c,a,s,u,e[14],9,-1019803690),u=r(u,c,a,s,e[3],14,-187363961),s=r(s,u,c,a,e[8],20,1163531501),a=r(a,s,u,c,e[13],5,-1444681467),c=r(c,a,s,u,e[2],9,-51403784),u=r(u,c,a,s,e[7],14,1735328473),s=r(s,u,c,a,e[12],20,-1926607734),a=i(a,s,u,c,e[5],4,-378558),c=i(c,a,s,u,e[8],11,-2022574463),u=i(u,c,a,s,e[11],16,1839030562),s=i(s,u,c,a,e[14],23,-35309556),a=i(a,s,u,c,e[1],4,-1530992060),c=i(c,a,s,u,e[4],11,1272893353),u=i(u,c,a,s,e[7],16,-155497632),s=i(s,u,c,a,e[10],23,-1094730640),a=i(a,s,u,c,e[13],4,681279174),c=i(c,a,s,u,e[0],11,-358537222),u=i(u,c,a,s,e[3],16,-722521979),s=i(s,u,c,a,e[6],23,76029189),a=i(a,s,u,c,e[9],4,-640364487),c=i(c,a,s,u,e[12],11,-421815835),u=i(u,c,a,s,e[15],16,530742520),s=i(s,u,c,a,e[2],23,-995338651),a=o(a,s,u,c,e[0],6,-198630844),c=o(c,a,s,u,e[7],10,1126891415),u=o(u,c,a,s,e[14],15,-1416354905),s=o(s,u,c,a,e[5],21,-57434055),a=o(a,s,u,c,e[12],6,1700485571),c=o(c,a,s,u,e[3],10,-1894986606),u=o(u,c,a,s,e[10],15,-1051523),s=o(s,u,c,a,e[1],21,-2054922799),a=o(a,s,u,c,e[8],6,1873313359),c=o(c,a,s,u,e[15],10,-30611744),u=o(u,c,a,s,e[6],15,-1560198380),s=o(s,u,c,a,e[13],21,1309151649),a=o(a,s,u,c,e[4],6,-145523070),c=o(c,a,s,u,e[11],10,-1120210379),u=o(u,c,a,s,e[2],15,718787259),s=o(s,u,c,a,e[9],21,-343485551),t[0]=y(a,t[0]),t[1]=y(s,t[1]),t[2]=y(u,t[2]),t[3]=y(c,t[3])}function s(t){var e,n=[];for(e=0;64>e;e+=4)n[e>>2]=t.charCodeAt(e)+(t.charCodeAt(e+1)<<8)+(t.charCodeAt(e+2)<<16)+(t.charCodeAt(e+3)<<24);return n}function u(t){var e,n=[];for(e=0;64>e;e+=4)n[e>>2]=t[e]+(t[e+1]<<8)+(t[e+2]<<16)+(t[e+3]<<24);return n}function c(t){var e,n,r,i,o,u,c=t.length,l=[1732584193,-271733879,-1732584194,271733878];for(e=64;c>=e;e+=64)a(l,s(t.substring(e-64,e)));for(t=t.substring(e-64),n=t.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e=0;n>e;e+=1)r[e>>2]|=t.charCodeAt(e)<<(e%4<<3);if(r[e>>2]|=128<<(e%4<<3),e>55)for(a(l,r),e=0;16>e;e+=1)r[e]=0;return i=8*c,i=i.toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(i[2],16),u=parseInt(i[1],16)||0,r[14]=o,r[15]=u,a(l,r),l}function l(t){var e,n,r,i,o,s,c=t.length,l=[1732584193,-271733879,-1732584194,271733878];for(e=64;c>=e;e+=64)a(l,u(t.subarray(e-64,e)));for(t=c>e-64?t.subarray(e-64):new Uint8Array(0),n=t.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e=0;n>e;e+=1)r[e>>2]|=t[e]<<(e%4<<3);if(r[e>>2]|=128<<(e%4<<3),e>55)for(a(l,r),e=0;16>e;e+=1)r[e]=0;return i=8*c,i=i.toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(i[2],16),s=parseInt(i[1],16)||0,r[14]=o,r[15]=s,a(l,r),l}function f(t){var e,n="";for(e=0;4>e;e+=1)n+=b[t>>8*e+4&15]+b[t>>8*e&15];return n}function d(t){var e;for(e=0;en;n+=1)o[n]=t.charCodeAt(n);return e?o:i}function v(t){return String.fromCharCode.apply(null,new Uint8Array(t))}function m(t,e,n){var r=new Uint8Array(t.byteLength+e.byteLength);return r.set(new Uint8Array(t)),r.set(new Uint8Array(e),t.byteLength),n?r:r.buffer}function g(t){var e,n=[],r=t.length;for(e=0;r-1>e;e+=2)n.push(parseInt(t.substr(e,2),16));return String.fromCharCode.apply(String,n)}function _(){this.reset()}var y=function(t,e){return t+e&4294967295},b=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];return"5d41402abc4b2a76b9719d911017c592"!==d(c("hello"))&&(y=function(t,e){var n=(65535&t)+(65535&e),r=(t>>16)+(e>>16)+(n>>16);return r<<16|65535&n}),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||!function(){function e(t,e){return t=0|t||0,0>t?Math.max(t+e,0):Math.min(t,e)}ArrayBuffer.prototype.slice=function(n,r){var i,o,a,s,u=this.byteLength,c=e(n,u),l=u;return r!==t&&(l=e(r,u)),c>l?new ArrayBuffer(0):(i=l-c,o=new ArrayBuffer(i),a=new Uint8Array(o),s=new Uint8Array(this,c,i),a.set(s),o)}}(),_.prototype.append=function(t){return this.appendBinary(h(t)),this},_.prototype.appendBinary=function(t){this._buff+=t,this._length+=t.length;var e,n=this._buff.length;for(e=64;n>=e;e+=64)a(this._hash,s(this._buff.substring(e-64,e)));return this._buff=this._buff.substring(e-64),this},_.prototype.end=function(t){var e,n,r=this._buff,i=r.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(e=0;i>e;e+=1)o[e>>2]|=r.charCodeAt(e)<<(e%4<<3);return this._finish(o,i),n=d(this._hash),t&&(n=g(n)),this.reset(),n},_.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},_.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}},_.prototype.setState=function(t){return this._buff=t.buff,this._length=t.length,this._hash=t.hash,this},_.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},_.prototype._finish=function(t,e){var n,r,i,o=e;if(t[o>>2]|=128<<(o%4<<3),o>55)for(a(this._hash,t),o=0;16>o;o+=1)t[o]=0;n=8*this._length,n=n.toString(16).match(/(.*?)(.{0,8})$/),r=parseInt(n[2],16),i=parseInt(n[1],16)||0,t[14]=r,t[15]=i,a(this._hash,t)},_.hash=function(t,e){return _.hashBinary(h(t),e)},_.hashBinary=function(t,e){var n=c(t),r=d(n);return e?g(r):r},_.ArrayBuffer=function(){this.reset()},_.ArrayBuffer.prototype.append=function(t){var e,n=m(this._buff.buffer,t,!0),r=n.length;for(this._length+=t.byteLength,e=64;r>=e;e+=64)a(this._hash,u(n.subarray(e-64,e)));return this._buff=r>e-64?new Uint8Array(n.buffer.slice(e-64)):new Uint8Array(0),this},_.ArrayBuffer.prototype.end=function(t){var e,n,r=this._buff,i=r.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(e=0;i>e;e+=1)o[e>>2]|=r[e]<<(e%4<<3);return this._finish(o,i),n=d(this._hash),t&&(n=g(n)),this.reset(),n},_.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},_.ArrayBuffer.prototype.getState=function(){var t=_.prototype.getState.call(this);return t.buff=v(t.buff),t},_.ArrayBuffer.prototype.setState=function(t){return t.buff=p(t.buff,!0),_.prototype.setState.call(this,t)},_.ArrayBuffer.prototype.destroy=_.prototype.destroy,_.ArrayBuffer.prototype._finish=_.prototype._finish,_.ArrayBuffer.hash=function(t,e){var n=l(new Uint8Array(t)),r=d(n);return e?g(r):r},_})},{}],16:[function(t,e,n){"use strict";function r(t,e,n){var r=n[n.length-1];t===r.element&&(n.pop(),r=n[n.length-1]);var i=r.element,o=r.index;if(Array.isArray(i))i.push(t);else if(o===e.length-2){var a=e.pop();i[a]=t}else e.push(t)}n.stringify=function(t){var e=[];e.push({obj:t});for(var n,r,i,o,a,s,u,c,l,f,d,h="";n=e.pop();)if(r=n.obj,i=n.prefix||"",o=n.val||"",h+=i,o)h+=o;else if("object"!=typeof r)h+="undefined"==typeof r?null:JSON.stringify(r);else if(null===r)h+="null";else if(Array.isArray(r)){for(e.push({val:"]"}),a=r.length-1;a>=0;a--)s=0===a?"":",",e.push({obj:r[a],prefix:s});e.push({val:"["})}else{u=[];for(c in r)r.hasOwnProperty(c)&&u.push(c);for(e.push({val:"}"}),a=u.length-1;a>=0;a--)l=u[a],f=r[l],d=a>0?",":"",d+=JSON.stringify(l)+":",e.push({obj:f,prefix:d});e.push({val:"{"})}return h},n.parse=function(t){for(var e,n,i,o,a,s,u,c,l,f=[],d=[],h=0;;)if(e=t[h++],"}"!==e&&"]"!==e&&"undefined"!=typeof e)switch(e){case" ":case" ":case"\n":case":":case",":break;case"n":h+=3,r(null,f,d);break;case"t":h+=3,r(!0,f,d);break;case"f":h+=4,r(!1,f,d);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":for(n="",h--;;){if(i=t[h++],!/[\d\.\-e\+]/.test(i)){h--;break}n+=i}r(parseFloat(n),f,d);break;case'"':for(o="",a=void 0,s=0;;){if(u=t[h++],'"'===u&&("\\"!==a||s%2!==1))break;o+=u,a=u,"\\"===a?s++:s=0}r(JSON.parse('"'+o+'"'),f,d);break;case"[":c={element:[],index:f.length},f.push(c.element),d.push(c);break;case"{":l={element:{},index:f.length},f.push(l.element),d.push(l);break;default:throw new Error("unexpectedly reached end of input: "+e)}else{if(1===f.length)return f.pop();r(f.pop(),f,d)}}},{}],17:[function(t,e,n){(function(n,r){"use strict";function i(t){return t&&"object"==typeof t&&"default"in t?t["default"]:t}function o(t,e){for(var n={},r=0,i=e.length;i>r;r++){var o=e[r];o in t&&(n[o]=t[o])}return n}function a(t){return t instanceof ArrayBuffer||"undefined"!=typeof Blob&&t instanceof Blob}function s(t){if("function"==typeof t.slice)return t.slice(0);var e=new ArrayBuffer(t.byteLength),n=new Uint8Array(e),r=new Uint8Array(t);return n.set(r),e}function u(t){if(t instanceof ArrayBuffer)return s(t);var e=t.size,n=t.type;return"function"==typeof t.slice?t.slice(0,e,n):t.webkitSlice(0,e,n)}function c(t){var e,n,r;if(!t||"object"!=typeof t)return t;if(Array.isArray(t)){for(e=[],n=0,r=t.length;r>n;n++)e[n]=c(t[n]);return e}if(t instanceof Date)return t.toISOString();if(a(t))return u(t);e={};for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var i=c(t[n]);"undefined"!=typeof i&&(e[n]=i)}return e}function l(t){var e=!1;return rr(function(n){if(e)throw new Error("once called more than once");e=!0,t.apply(this,n)})}function f(t){return rr(function(e){e=c(e);var r,i=this,o="function"==typeof e[e.length-1]?e.pop():!1;o&&(r=function(t,e){n.nextTick(function(){o(t,e)})});var a=new lr(function(n,r){var o;try{var a=l(function(t,e){t?r(t):n(e)});e.push(a),o=t.apply(i,e),o&&"function"==typeof o.then&&n(o)}catch(s){r(s)}});return r&&a.then(function(t){r(null,t)},r),a})}function d(t,e){function n(t,e,n){if(fr.enabled){for(var r=[t._db_name,e],i=0;ic;c++)o.push({pos:u+1,ids:s[c]});else{var f=!!a[1].deleted,d=a[0];e&&!(r!==f?r:n!==u?u>n:d>e)||(e=d,n=u,r=f)}}return n+"-"+e}function m(t){return t.ids}function g(t,e){e||(e=v(t));for(var n,r=e.substring(e.indexOf("-")+1),i=t.rev_tree.map(m);n=i.pop();){if(n[0]===r)return!!n[1].deleted;i=i.concat(n[2])}}function _(t){return or("return "+t+";",{})}function y(t){return new Function("doc",["var emitted = false;","var emit = function (a, b) {"," emitted = true;","};","var view = "+t+";","view(doc);","if (emitted) {"," return true;","}"].join("\n"))}function b(t){if(!t)return null;var e=t.split("/");return 2===e.length?e:1===e.length?[t,t]:null}function w(t){var e=b(t);return e?e.join("/"):null}function x(t,e){for(var n,r=t.slice();n=r.pop();)for(var i=n.pos,o=n.ids,a=o[2],s=e(0===a.length,i,o[0],n.ctx,o[1]),u=0,c=a.length;c>u;u++)r.push({pos:i+1,ids:a[u],ctx:s})}function k(t,e){return t.pos-e.pos}function S(t){var e=[];x(t,function(t,n,r,i,o){t&&e.push({rev:n+"-"+r,pos:n,opts:o})}),e.sort(k).reverse();for(var n=0,r=e.length;r>n;n++)delete e[n].pos;return e}function E(t){for(var e=v(t),n=S(t.rev_tree),r=[],i=0,o=n.length;o>i;i++){var a=n[i];a.rev===e||a.opts.deleted||r.push(a.rev)}return r}function O(t){Error.call(this,t.reason),this.status=t.status,this.name=t.error,this.message=t.reason,this.error=!0}function A(t,e,n){function r(e){for(var r in t)"function"!=typeof t[r]&&(this[r]=t[r]);void 0!==n&&(this.name=n),void 0!==e&&(this.reason=e)}return r.prototype=O.prototype,new r(e)}function j(t){var e,n,r,i,o;return n=t.error===!0&&"string"==typeof t.name?t.name:t.error,o=t.reason,r=Nr("name",n,o),t.missing||"missing"===o||"deleted"===o||"not_found"===n?r=pr:"doc_validation"===n?(r=Sr,i=o):"bad_request"===n&&r.message!==o&&(r=Er),r||(r=Nr("status",t.status,o)||br),e=A(r,o,n),i&&(e.message=i),t.id&&(e.id=t.id),t.status&&(e.status=t.status),t.missing&&(e.missing=t.missing),e}function T(t,e,n){function r(){i.cancel()}ir.EventEmitter.call(this);var i=this;this.db=t,e=e?c(e):{};var o=e.complete=l(function(e,n){e?i.emit("error",e):i.emit("complete",n),i.removeAllListeners(),t.removeListener("destroyed",r)});n&&(i.on("complete",function(t){n(null,t)}),i.on("error",n)),t.once("destroyed",r),e.onChange=function(t){e.isCancelled||(i.emit("change",t),i.startSeq&&i.startSeq<=t.seq&&(i.startSeq=!1))};var a=new lr(function(t,n){e.complete=function(e,r){e?n(e):t(r)}});i.once("cancel",function(){t.removeListener("destroyed",r),e.complete(null,{status:"cancelled"})}),this.then=a.then.bind(a),this["catch"]=a["catch"].bind(a),this.then(function(t){o(null,t)},o),t.taskqueue.isReady?i.doChanges(e):t.taskqueue.addTask(function(){i.isCancelled?i.emit("cancel"):i.doChanges(e)})}function D(t,e,n){var r=[{rev:t._rev}];"all_docs"===n.style&&(r=S(e.rev_tree).map(function(t){return{rev:t.rev}}));var i={id:e.id,changes:r,doc:t};return g(e,t._rev)&&(i.deleted=!0),n.conflicts&&(i.doc._conflicts=E(e),i.doc._conflicts.length||delete i.doc._conflicts),i}function I(t,e,n){function r(){var t=[];f.forEach(function(e){e.docs.forEach(function(n){t.push({id:e.id,docs:[n]})})}),n(null,{results:t})}function i(){++l===c&&r()}function a(t,e,n){f[t]={id:e,docs:n},i()}var s=Array.isArray(e)?e:e.docs,u={};s.forEach(function(t){t.id in u?u[t.id].push(t):u[t.id]=[t]});var c=Object.keys(u).length,l=0,f=new Array(c);Object.keys(u).forEach(function(n,r){var i=u[n],s=o(i[0],["atts_since","attachments"]);s.open_revs=i.map(function(t){return t.rev}),s.open_revs=s.open_revs.filter(function(t){return t});var c=function(t){return t};0===s.open_revs.length&&(delete s.open_revs,c=function(t){return[{ok:t}]}),["revs","attachments","binary"].forEach(function(t){t in e&&(s[t]=e[t])}),t.get(n,s,function(t,e){a(r,n,t?[{error:t}]:c(e))})})}function M(t){return/^_local/.test(t)}function C(t){for(var e,n=[],r=t.slice();e=r.pop();){var i=e.pos,o=e.ids,a=o[0],s=o[1],u=o[2],c=0===u.length,l=e.history?e.history.slice():[];l.push({id:a,opts:s}),c&&n.push({pos:i+1-l.length,ids:l});for(var f=0,d=u.length;d>f;f++)r.push({pos:i+1,ids:u[f],history:l})}return n.reverse()}function q(t){return 0|Math.random()*t}function L(t,e){e=e||Pr.length;var n="",r=-1;if(t){for(;++ro;o++)i=[r[o],{status:"missing"},[i]];return[{pos:n,ids:i}]}function U(t,e){var n,r,i,o={status:"available"};if(t._deleted&&(o.deleted=!0),e)if(t._id||(t._id=L()),r=L(32,16).toLowerCase(),t._rev){if(i=P(t._rev),i.error)return i;t._rev_tree=[{pos:i.prefix,ids:[i.id,{status:"missing"},[[r,o,[]]]]}],n=i.prefix+1}else t._rev_tree=[{pos:1,ids:[r,o,[]]}],n=1;else if(t._revisions&&(t._rev_tree=F(t._revisions,o),n=t._revisions.start,r=t._revisions.ids[0]),!t._rev_tree){if(i=P(t._rev),i.error)return i;n=i.prefix,r=i.id,t._rev_tree=[{pos:n,ids:[r,o,[]]}]}N(t._id),t._rev=n+"-"+r;var a={metadata:{},data:{}};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){var u="_"===s[0];if(u&&!Fr[s]){var c=A(Sr,s);throw c.message=Sr.message+": "+s,c}u&&!Ur[s]?a.metadata[s.slice(1)]=t[s]:a.data[s]=t[s]}return a}function H(t,e){return e>t?-1:t>e?1:0}function Y(t,e){for(var n=0;n0?e.keys.slice(e.skip):e.keys;if(e.descending&&r.reverse(),!r.length)return t._allDocs({limit:0},n);var i={offset:e.skip};return lr.all(r.map(function(n){var r=Xn.extend({key:n,deleted:"ok"},e);return["limit","skip","keys"].forEach(function(t){delete r[t]}),new lr(function(e,o){t._allDocs(r,function(t,r){return t?o(t):(i.total_rows=r.total_rows,void e(r.rows[0]||{key:n,error:"not_found"}))})})})).then(function(t){return i.rows=t,i})}function z(t){var e=t._compactionQueue[0],r=e.opts,i=e.callback;t.get("_local/compaction")["catch"](function(){return!1}).then(function(e){e&&e.last_seq&&(r.last_seq=e.last_seq),t._compact(r,function(e,r){e?i(e):i(null,r),n.nextTick(function(){t._compactionQueue.shift(),t._compactionQueue.length&&z(t)})})})}function J(t){return"_"===t.charAt(0)?t+"is not a valid attachment name, attachment names cannot start with '_'":!1}function K(t,e,n,r){e.seq=e.seq||0;var i={doc_ids:["_design/"+n],limit:1,since:e.seq};t.changes(i).then(function(t){var n=t.results&&t.results.length&&t.results[0].seq;n&&n>e.seq&&(e.seq=n,delete e.promise),r()})["catch"](r)}function X(t,e,n){t._ddocCache=t._ddocCache||{},t._ddocCache[e]=t._ddocCache[e]||{};var r=t._ddocCache[e];K(t,r,e,function(i){return i?n(i):(r.promise||(r.promise=new lr(function(n,r){t._get("_design/"+e,{},function(t,e){if(t)return r(t);var i={};["views","filters"].forEach(function(t){i[t]=e.doc[t]}),n(i)})})),void r.promise.then(function(t){n(null,t)})["catch"](n))})}function Z(t,e,n,r,i){X(t,e,function(t,e){if(t)return i(t);var o=e[n]&&e[n][r];return o?void i(null,o):i(A(pr))})}function Q(){ir.EventEmitter.call(this)}function tt(){this.isReady=!1,this.failed=!1,this.queue=[]}function et(t){t&&r.debug&&console.error(t)}function nt(t,e){function n(){o.emit("destroyed",i)}function r(){t.removeListener("destroyed",n),t.emit("destroyed",t)}var i=e.originalName,o=t.constructor,a=o._destructionListeners;t.once("destroyed",n),a.has(i)||a.set(i,[]),a.get(i).push(r)}function rt(t,e,n){if(!(this instanceof rt))return new rt(t,e,n);var r=this;"function"!=typeof e&&"undefined"!=typeof e||(n=e,e={}),t&&"object"==typeof t&&(e=t,t=void 0),"undefined"==typeof n&&(n=et),t=t||e.name,e=c(e),delete e.name,this.__opts=e;var i=n;r.auto_compaction=e.auto_compaction,r.prefix=rt.prefix,Q.call(r),r.taskqueue=new tt;var o=new lr(function(i,o){n=function(t,e){return t?o(t):(delete e.then,void i(e))},e=c(e);var a,s,u=e.name||t;return function(){try{if("string"!=typeof u)throw s=new Error("Missing/invalid DB name"),s.code=400,s;if(a=rt.parseAdapter(u,e),e.originalName=u,e.name=a.name,e.prefix&&"http"!==a.adapter&&"https"!==a.adapter&&(e.name=e.prefix+e.name),e.adapter=e.adapter||a.adapter,r._adapter=e.adapter,Qn("pouchdb:adapter")("Picked adapter: "+e.adapter),r._db_name=u,!rt.adapters[e.adapter])throw s=new Error("Adapter is missing"),s.code=404,s;if(!rt.adapters[e.adapter].valid())throw s=new Error("Invalid Adapter"),s.code=404,s}catch(t){r.taskqueue.fail(t)}}(),s?o(s):(r.adapter=e.adapter,r.replicate={},r.replicate.from=function(t,e,n){return r.constructor.replicate(t,r,e,n)},r.replicate.to=function(t,e,n){return r.constructor.replicate(r,t,e,n)},r.sync=function(t,e,n){return r.constructor.sync(r,t,e,n)},r.replicate.sync=r.sync,void rt.adapters[e.adapter].call(r,e,function(t){return t?(r.taskqueue.fail(t),void n(t)):(nt(r,e),r.emit("created",r),rt.emit("created",e.originalName),r.taskqueue.ready(r),void n(null,r))}))});o.then(function(t){i(null,t)},i),r.then=o.then.bind(o),r["catch"]=o["catch"].bind(o)}function it(){return"undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage&&"undefined"!=typeof chrome.storage.local}function ot(){return Hr}function at(t){Object.keys(ir.EventEmitter.prototype).forEach(function(e){"function"==typeof ir.EventEmitter.prototype[e]&&(t[e]=Br[e].bind(Br))});var e=t._destructionListeners=new nr.Map;t.on("destroyed",function(t){e.has(t)&&(e.get(t).forEach(function(t){t()}),e["delete"](t))})}function st(t,e){t=t||[],e=e||{};try{return new Blob(t,e)}catch(n){if("TypeError"!==n.name)throw n;for(var r="undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder,i=new r,o=0;o0&&(r=setTimeout(function(){n.reject(new Error("Load timeout for resource: "+t.url))},t.timeout)),n.promise.then(function(e){return i={statusCode:e.status},t.timeout>0&&clearTimeout(r),i.statusCode>=200&&i.statusCode<300?t.binary?e.blob():e.text():e.json()}).then(function(t){i.statusCode>=200&&i.statusCode<300?e(null,i,t):e(t,i)})["catch"](function(t){e(t,i)}),{abort:n.reject}}function ft(t,e){var n,r,i=function(){n.abort()};n=t.xhr?new t.xhr:new XMLHttpRequest;try{n.open(t.method,t.url)}catch(o){e(o,{statusCode:413})}n.withCredentials="withCredentials"in t?t.withCredentials:!0,"GET"===t.method?delete t.headers["Content-Type"]:t.json&&(t.headers.Accept="application/json",t.headers["Content-Type"]=t.headers["Content-Type"]||"application/json",t.body&&t.processData&&"string"!=typeof t.body&&(t.body=JSON.stringify(t.body))),t.binary&&(n.responseType="arraybuffer"),"body"in t||(t.body=null);for(var a in t.headers)t.headers.hasOwnProperty(a)&&n.setRequestHeader(a,t.headers[a]);return t.timeout>0&&(r=setTimeout(i,t.timeout),n.onprogress=function(){clearTimeout(r),r=setTimeout(i,t.timeout)},"undefined"!=typeof n.upload&&(n.upload.onprogress=n.onprogress)),n.onreadystatechange=function(){if(4===n.readyState){var r={statusCode:n.status};if(n.status>=200&&n.status<300){var i;i=t.binary?st([n.response||""],{type:n.getResponseHeader("Content-Type")}):n.responseText,e(null,r,i)}else{var o={};try{o=JSON.parse(n.response)}catch(a){}e(o,r)}}},t.body&&t.body instanceof Blob?ut(t.body,function(t){n.send(t)}):n.send(t.body),{abort:i}}function dt(){try{return new XMLHttpRequest,!0}catch(t){return!1}}function ht(t,e){return Wr||t.xhr?ft(t,e):lt(t,e)}function pt(){return""}function vt(t,e){function n(e,n,r){if(!t.binary&&t.json&&"string"==typeof e)try{e=JSON.parse(e)}catch(i){return r(i)}Array.isArray(e)&&(e=e.map(function(t){return t.error||t.missing?j(t):t})),t.binary&&Vr(e,n),r(null,e,n)}function r(t,e){var n,r;if(t.code&&t.status){var i=new Error(t.message||t.code);return i.status=t.status,e(i)}try{n=JSON.parse(t.responseText),r=j(n)}catch(o){r=j(t)}e(r)}t=c(t);var i={method:"GET",headers:{},json:!0,processData:!0, -timeout:1e4,cache:!1};return t=Xn.extend(i,t),t.json&&(t.binary||(t.headers.Accept="application/json"),t.headers["Content-Type"]=t.headers["Content-Type"]||"application/json"),t.binary&&(t.encoding=null,t.json=!1),t.processData||(t.json=!1),ht(t,function(i,o,a){if(i)return i.status=o?o.statusCode:400,r(i,e);var s,u=o.headers&&o.headers["content-type"],c=a||pt();if(!t.binary&&(t.json||!t.processData)&&"object"!=typeof c&&(/json/.test(u)||/^[\s]*\{/.test(c)&&/\}[\s]*$/.test(c)))try{c=JSON.parse(c.toString())}catch(l){}o.statusCode>=200&&o.statusCode<300?n(c,o,e):(s=j(c),s.status=o.statusCode,e(s))})}function mt(t,e){var n=navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",r=-1!==n.indexOf("safari")&&-1===n.indexOf("chrome"),i=-1!==n.indexOf("msie"),o=-1!==n.indexOf("edge"),a=r&&"POST"===t.method||(i||o)&&"GET"===t.method,s="cache"in t?t.cache:!0;if(a||!s){var u=-1!==t.url.indexOf("?");t.url+=(u?"&":"?")+"_nonce="+Date.now()}return vt(t,e)}function gt(t){for(var e=Jr.exec(t),n={},r=14;r--;){var i=$r[r],o=e[r]||"",a=-1!==["user","password"].indexOf(i);n[i]=a?decodeURIComponent(o):o}return n[Gr]={},n[$r[12]].replace(zr,function(t,e,r){e&&(n[Gr][e]=r)}),n}function _t(t){for(var e=t.length,n=new ArrayBuffer(e),r=new Uint8Array(n),i=0;e>i;i++)r[i]=t.charCodeAt(i);return n}function yt(t,e){return st([_t(t)],{type:e})}function bt(t,e,n){try{return!t(e,n)}catch(r){var i="Filter function threw: "+r.toString();return A(Er,i)}}function wt(t){var e={},n=t.filter&&"function"==typeof t.filter;return e.query=t.query_params,function(r){r.doc||(r.doc={});var i=n&&bt(t.filter,r.doc,e);if("object"==typeof i)return i;if(i)return!1;if(t.include_docs){if(!t.attachments)for(var o in r.doc._attachments)r.doc._attachments.hasOwnProperty(o)&&(r.doc._attachments[o].stub=!0)}else delete r.doc;return!0}}function xt(t,e){"console"in r&&"info"in console&&console.info("The above "+t+" is totally normal. "+e)}function kt(t,e,n,r,i){return t.get(e)["catch"](function(n){if(404===n.status)return"http"===t.type()&&xt(404,"PouchDB is just checking if a remote checkpoint exists."),{session_id:r,_id:e,history:[],replicator:ni,version:ei};throw n}).then(function(o){return i.cancelled?void 0:(o.history=(o.history||[]).filter(function(t){return t.session_id!==r}),o.history.unshift({last_seq:n,session_id:r}),o.history=o.history.slice(0,ri),o.version=ei,o.replicator=ni,o.session_id=r,o.last_seq=n,t.put(o)["catch"](function(o){if(409===o.status)return kt(t,e,n,r,i);throw o}))})}function St(t,e,n,r){this.src=t,this.target=e,this.id=n,this.returnValue=r}function Et(t,e){if(t.session_id===e.session_id)return{last_seq:t.last_seq,history:t.history||[]};var n=t.history||[],r=e.history||[];return Ot(n,r)}function Ot(t,e){var n=t[0],r=t.slice(1),i=e[0],o=e.slice(1);if(!n||0===e.length)return{last_seq:ii,history:[]};var a=n.session_id;if(At(a,e))return{last_seq:n.last_seq,history:t};var s=i.session_id;return At(s,r)?{last_seq:i.last_seq,history:o}:Ot(r,o)}function At(t,e){var n=e[0],r=e.slice(1);return t&&0!==e.length?t===n.session_id?!0:At(t,r):!1}function jt(t){return"number"==typeof t.status&&4===Math.floor(t.status/100)}function Tt(t,e){t=parseInt(t,10)||0,e=parseInt(e,10),e!==e||t>=e?e=(t||1)<<1:e+=1;var n=Math.random(),r=e-t;return~~(r*n+t)}function Dt(t){var e=0;return t||(e=2e3),Tt(t,e)}function It(t,e,n,r){return t.retry===!1?(e.emit("error",n),void e.removeAllListeners()):("function"!=typeof t.back_off_function&&(t.back_off_function=Dt),e.emit("requestError",n),"active"!==e.state&&"pending"!==e.state||(e.emit("paused",n),e.state="stopped",e.once("active",function(){t.current_back_off=ai})),t.current_back_off=t.current_back_off||ai,t.current_back_off=t.back_off_function(t.current_back_off),void setTimeout(r,t.current_back_off))}function Mt(t){return Xr(t)}function Ct(t,e,n,r){(n>0||r0||r0}function o(r){return t.allDocs({keys:r,include_docs:!0}).then(function(t){if(n.cancelled)throw new Error("cancelled");t.rows.forEach(function(t){!t.deleted&&t.doc&&Nt(t.value.rev)&&!i(t.doc)&&(u.push(t.doc),delete e[t.id])})})}function a(){var t=Object.keys(e).filter(function(t){var n=e[t].missing;return 1===n.length&&Nt(n[0])});return t.length>0?o(t):void 0}function s(){return u}e=c(e);var u=[];return lr.resolve().then(a).then(r).then(s)}function Ut(t,e,n,r,i){function o(){return k?lr.resolve():Rt(t,e,n).then(function(n){x=n,k=new St(t,e,x,r)})}function a(){if(N=[],0!==w.docs.length){var t=w.docs;return e.bulkDocs({docs:t,new_edits:!1}).then(function(e){if(r.cancelled)throw p(),new Error("cancelled");var n=[],o={};e.forEach(function(t){t.error&&(i.doc_write_failures++,n.push(t),o[t.id]=t)}),R=R.concat(n),i.docs_written+=w.docs.length-n.length;var a=n.filter(function(t){return"unauthorized"!==t.name&&"forbidden"!==t.name});if(t.forEach(function(t){var e=o[t._id];e?r.emit("denied",c(e)):N.push(t)}),a.length>0){var s=new Error("bulkDocs error");throw s.other_errors=n,h("target.bulkDocs failed to write docs",s),new Error("bulkWrite partial failure")}},function(e){throw i.doc_write_failures+=t.length,e})}}function s(){i.last_seq=T=w.seq;var t=c(i);return N.length&&(t.docs=N,r.emit("change",t)),O=!0,k.writeCheckpoint(w.seq,P).then(function(){if(O=!1,r.cancelled)throw p(),new Error("cancelled");w=void 0,_()})["catch"](function(t){throw O=!1,h("writeCheckpoint completed with error",t),t})}function u(){var t={};return w.changes.forEach(function(e){"_user/"!==e.id&&(t[e.id]=e.changes.map(function(t){return t.rev}))}),e.revsDiff(t).then(function(t){if(r.cancelled)throw p(),new Error("cancelled");w.diffs=t})}function l(){return Ft(t,w.diffs,r).then(function(t){t.forEach(function(t){delete w.diffs[t._id],i.docs_read++,w.docs.push(t)})})}function f(){if(!r.cancelled&&!w){if(0===S.length)return void d(!0);w=S.shift(),u().then(l).then(a).then(s).then(f)["catch"](function(t){h("batch processing terminated with error",t)})}}function d(t){return 0===E.changes.length?void(0!==S.length||w||((D&&F.live||A)&&(r.state="pending",r.emit("paused")),A&&p())):void((t||A||E.changes.length>=I)&&(S.push(E),E={seq:0,changes:[],docs:[]},"pending"!==r.state&&"stopped"!==r.state||(r.state="active",r.emit("active")),f()))}function h(t,e){j||(e.message||(e.message=t),i.ok=!1,i.status="aborting",i.errors.push(e),R=R.concat(e),S=[],E={seq:0,changes:[],docs:[]},p())}function p(){if(!(j||r.cancelled&&(i.status="cancelled",O))){i.status=i.status||"complete",i.end_time=new Date,i.last_seq=T,j=!0;var o=R.filter(function(t){return"unauthorized"!==t.name&&"forbidden"!==t.name});if(o.length>0){var a=R.pop();R.length>0&&(a.other_errors=R),a.result=i,It(n,r,a,function(){Ut(t,e,n,r)})}else i.errors=R,r.emit("complete",i),r.removeAllListeners()}}function v(t){if(r.cancelled)return p();var e=wt(n)(t);e&&(E.seq=t.seq,E.changes.push(t),d(F.live))}function m(t){return C=!1,r.cancelled?p():(t.results.length>0?(F.since=t.last_seq,_()):D?(F.live=!0,_()):A=!0,void d(!0))}function g(t){return C=!1,r.cancelled?p():void h("changes rejected",t)}function _(){function e(){o.cancel()}function i(){r.removeListener("cancel",e)}if(!C&&!A&&S.lengthi;i++)e+=String.fromCharCode(n[i]);return e}function zt(t,e){if("undefined"==typeof FileReader)return e(Gt((new FileReaderSync).readAsArrayBuffer(t)));var n=new FileReader,r="function"==typeof n.readAsBinaryString;n.onloadend=function(t){var n=t.target.result||"";return r?e(n):void e(Gt(n))},r?n.readAsBinaryString(t):n.readAsArrayBuffer(t)}function Jt(t){return new lr(function(e){zt(t,function(t){e(Xr(t))})})}function Kt(t){for(var e=[],n=0,r=t.length;r>n;n++)e=e.concat(t[n]);return e}function Xt(t){var e=t.doc&&t.doc._attachments;e&&Object.keys(e).forEach(function(t){var n=e[t];n.data=$t(n.data,n.content_type)})}function Zt(t){return/^_design/.test(t)?"_design/"+encodeURIComponent(t.slice(8)):/^_local/.test(t)?"_local/"+encodeURIComponent(t.slice(7)):encodeURIComponent(t)}function Qt(t){return t._attachments&&Object.keys(t._attachments)?lr.all(Object.keys(t._attachments).map(function(e){var n=t._attachments[e];return n.data&&"string"!=typeof n.data?Jt(n.data).then(function(t){n.data=t}):void 0})):lr.resolve()}function te(t){var e=gt(t);(e.user||e.password)&&(e.auth={username:e.user,password:e.password});var n=e.path.replace(/(^\/|\/$)/g,"").split("/");return e.db=n.pop(),-1===e.db.indexOf("%")&&(e.db=encodeURIComponent(e.db)),e.path=n.join("/"),e}function ee(t,e){return ne(t,t.db+"/"+e)}function ne(t,e){var n=t.path?"/":"";return t.protocol+"://"+t.host+(t.port?":"+t.port:"")+"/"+t.path+n+e}function re(t){return"?"+Object.keys(t).map(function(e){return e+"="+encodeURIComponent(t[e])}).join("&")}function ie(t,e){function n(t,e,n){var r=t.ajax||{},i=Xn.extend(c(p),r,e);return mi(i.method+" "+i.url),Qr.ajax(i,n)}function r(t,e){return new lr(function(r,i){n(t,e,function(t,e){return t?i(t):void r(e)})})}function i(t,e){return d(t,rr(function(t){a().then(function(){return e.apply(this,t)})["catch"](function(e){var n=t.pop();n(e)})}))}function a(){if(t.skipSetup||t.skip_setup)return lr.resolve();if(_)return _;var e={method:"GET",url:h};return _=r({},e)["catch"](function(t){return t&&t.status&&404===t.status?(xt(404,"PouchDB is just detecting if the remote exists."),r({},{method:"PUT",url:h})):lr.reject(t)})["catch"](function(t){return t&&t.status&&412===t.status?!0:lr.reject(t)}),_["catch"](function(){_=null}),_}function s(t){return t.split("/").map(encodeURIComponent).join("/")}var u=this,l=te;t.getHost&&(l=t.getHost);var f=l(t.name,t),h=ee(f,"");t=c(t);var p=t.ajax||{};if(u.getUrl=function(){return h},u.getHeaders=function(){return p.headers||{}},t.auth||f.auth){var v=t.auth||f.auth,m=v.username+":"+v.password,g=Xr(unescape(encodeURIComponent(m)));p.headers=p.headers||{},p.headers.Authorization="Basic "+g}var _;setTimeout(function(){e(null,u)}),u.type=function(){return"http"},u.id=i("id",function(t){n({},{method:"GET",url:ne(f,"")},function(e,n){var r=n&&n.uuid?n.uuid+f.db:ee(f,"");t(null,r)})}),u.request=i("request",function(t,e){t.url=ee(f,t.url),n({},t,e)}),u.compact=i("compact",function(t,e){"function"==typeof t&&(e=t,t={}),t=c(t),n(t,{url:ee(f,"_compact"),method:"POST"},function(){function n(){u.info(function(r,i){i&&!i.compact_running?e(null,{ok:!0}):setTimeout(n,t.interval||200)})}n()})}),u.bulkGet=d("bulkGet",function(t,e){function r(e){var r={};t.revs&&(r.revs=!0),t.attachments&&(r.attachments=!0),n({},{url:ee(f,"_bulk_get"+re(r)),method:"POST",body:{docs:t.docs}},e)}function i(){function n(t){return function(n,r){u[t]=r.results,++s===i&&e(null,{results:Kt(u)})}}for(var r=hi,i=Math.ceil(t.docs.length/r),s=0,u=new Array(i),c=0;i>c;c++){var l=o(t,["revs","attachments"]);l.docs=t.docs.slice(c*r,Math.min(t.docs.length,(c+1)*r)),I(a,l,n(c))}}var a=this,s=ne(f,""),u=pi[s];"boolean"!=typeof u?r(function(t,n){if(t){var r=Math.floor(t.status/100);4===r||5===r?(pi[s]=!1,xt(t.status,"PouchDB is just detecting if the remote supports the _bulk_get API."),i()):e(t)}else pi[s]=!0,e(null,n)}):u?r(e):i()}),u._info=function(t){a().then(function(){n({},{method:"GET",url:ee(f,"")},function(e,n){return e?t(e):(n.host=ee(f,""),void t(null,n))})})["catch"](t)},u.get=i("get",function(t,e,n){function i(t){var n=t._attachments,i=n&&Object.keys(n);return n&&i.length?lr.all(i.map(function(i){var o=n[i],a=Zt(t._id)+"/"+s(i)+"?rev="+t._rev;return r(e,{method:"GET",url:ee(f,a),binary:!0}).then(function(t){return e.binary?t:Jt(t)}).then(function(t){delete o.stub,delete o.length,o.data=t})})):void 0}function o(t){return Array.isArray(t)?lr.all(t.map(function(t){return t.ok?i(t.ok):void 0})):i(t)}"function"==typeof e&&(n=e,e={}),e=c(e);var a={};e.revs&&(a.revs=!0),e.revs_info&&(a.revs_info=!0),e.open_revs&&("all"!==e.open_revs&&(e.open_revs=JSON.stringify(e.open_revs)),a.open_revs=e.open_revs),e.rev&&(a.rev=e.rev),e.conflicts&&(a.conflicts=e.conflicts),t=Zt(t);var u={method:"GET",url:ee(f,t+re(a))};r(e,u).then(function(t){return lr.resolve().then(function(){return e.attachments?o(t):void 0}).then(function(){n(null,t)})})["catch"](n)}),u.remove=i("remove",function(t,e,r,i){var o;"string"==typeof e?(o={_id:t,_rev:e},"function"==typeof r&&(i=r,r={})):(o=t,"function"==typeof e?(i=e,r={}):(i=r,r=e));var a=o._rev||r.rev;n(r,{method:"DELETE",url:ee(f,Zt(o._id))+"?rev="+a},i)}),u.getAttachment=i("getAttachment",function(t,e,r,i){"function"==typeof r&&(i=r,r={});var o=r.rev?"?rev="+r.rev:"",a=ee(f,Zt(t))+"/"+s(e)+o;n(r,{method:"GET",url:a,binary:!0},i)}),u.removeAttachment=i("removeAttachment",function(t,e,r,i){var o=ee(f,Zt(t)+"/"+s(e))+"?rev="+r;n({},{method:"DELETE",url:o},i)}),u.putAttachment=i("putAttachment",function(t,e,r,i,o,a){"function"==typeof o&&(a=o,o=i,i=r,r=null);var u=Zt(t)+"/"+s(e),c=ee(f,u);if(r&&(c+="?rev="+r),"string"==typeof i){var l;try{l=Kr(i)}catch(d){return a(A(wr,"Attachment is not a valid base64 string"))}i=l?yt(l,o):""}var h={headers:{"Content-Type":o},method:"PUT",url:c,processData:!1,body:i,timeout:p.timeout||6e4};n({},h,a)}),u._bulkDocs=function(t,e,r){t.new_edits=e.new_edits,a().then(function(){return lr.all(t.docs.map(Qt))}).then(function(){n(e,{method:"POST",url:ee(f,"_bulk_docs"),body:t},function(t,e){return t?r(t):(e.forEach(function(t){t.ok=!0}),void r(null,e))})})["catch"](r)},u.allDocs=i("allDocs",function(t,e){"function"==typeof t&&(e=t,t={}),t=c(t);var n,i={},o="GET";t.conflicts&&(i.conflicts=!0),t.descending&&(i.descending=!0),t.include_docs&&(i.include_docs=!0),t.attachments&&(i.attachments=!0),t.key&&(i.key=JSON.stringify(t.key)),t.start_key&&(t.startkey=t.start_key),t.startkey&&(i.startkey=JSON.stringify(t.startkey)),t.end_key&&(t.endkey=t.end_key),t.endkey&&(i.endkey=JSON.stringify(t.endkey)),"undefined"!=typeof t.inclusive_end&&(i.inclusive_end=!!t.inclusive_end),"undefined"!=typeof t.limit&&(i.limit=t.limit),"undefined"!=typeof t.skip&&(i.skip=t.skip);var a=re(i);if("undefined"!=typeof t.keys){var s="keys="+encodeURIComponent(JSON.stringify(t.keys));s.length+a.length+1<=vi?a+="&"+s:(o="POST",n={keys:t.keys})}r(t,{method:o,url:ee(f,"_all_docs"+a),body:n}).then(function(n){t.include_docs&&t.attachments&&t.binary&&n.rows.forEach(Xt),e(null,n)})["catch"](e)}),u._changes=function(t){var e="batch_size"in t?t.batch_size:di;t=c(t),t.timeout="timeout"in t?t.timeout:"timeout"in p?p.timeout:3e4;var r,i=t.timeout?{timeout:t.timeout-5e3}:{},o="undefined"!=typeof t.limit?t.limit:!1;r="return_docs"in t?t.return_docs:"returnDocs"in t?t.returnDocs:!0;var s=o;if(t.style&&(i.style=t.style),(t.include_docs||t.filter&&"function"==typeof t.filter)&&(i.include_docs=!0),t.attachments&&(i.attachments=!0),t.continuous&&(i.feed="longpoll"),t.conflicts&&(i.conflicts=!0),t.descending&&(i.descending=!0),"heartbeat"in t?t.heartbeat&&(i.heartbeat=t.heartbeat):i.heartbeat=1e4,t.filter&&"string"==typeof t.filter&&(i.filter=t.filter,"_view"===t.filter&&t.view&&"string"==typeof t.view&&(i.view=t.view)),t.query_params&&"object"==typeof t.query_params)for(var u in t.query_params)t.query_params.hasOwnProperty(u)&&(i[u]=t.query_params[u]);var l,d="GET";if(t.doc_ids){i.filter="_doc_ids";var h=JSON.stringify(t.doc_ids);h.lengthe?e:s;var c={method:d,url:ee(f,"_changes"+re(i)),timeout:t.timeout,body:l};m=r,t.aborted||a().then(function(){v=n(t,c,u)})["catch"](u)}},_={results:[]},y=function(n,i){if(!t.aborted){var a=0;if(i&&i.results){a=i.results.length,_.last_seq=i.last_seq;var u={};u.query=t.query_params,i.results=i.results.filter(function(e){s--;var n=wt(t)(e);return n&&(t.include_docs&&t.attachments&&t.binary&&Xt(e),r&&_.results.push(e),t.onChange(e)),n})}else if(n)return t.aborted=!0,void t.complete(n);i&&i.last_seq&&(m=i.last_seq);var c=o&&0>=s||i&&e>a||t.descending;(!t.continuous||o&&0>=s)&&c?t.complete(null,_):setTimeout(function(){g(m,y)},0)}};return g(t.since||0,y),{cancel:function(){t.aborted=!0,v&&v.abort()}}},u.revsDiff=i("revsDiff",function(t,e,r){"function"==typeof e&&(r=e,e={}),n(e,{method:"POST",url:ee(f,"_revs_diff"),body:t},r)}),u._close=function(t){t()},u._destroy=function(e,r){n(e,{url:ee(f,""),method:"DELETE"},function(e,n){return e&&e.status&&404!==e.status?r(e):(u.emit("destroyed"),u.constructor.emit("destroyed",t.name),void r(null,n))})}}function oe(){this.promise=new lr(function(t){t()})}function ae(t){return ur.hash(t)}function se(t){var e=t.db,n=t.viewName,r=t.map,i=t.reduce,o=t.temporary,a=r.toString()+(i&&i.toString())+"undefined";if(!o&&e._cachedViews){var s=e._cachedViews[a];if(s)return lr.resolve(s)}return e.info().then(function(t){function s(t){t.views=t.views||{};var e=n;-1===e.indexOf("/")&&(e=n+"/"+n);var r=t.views[e]=t.views[e]||{};if(!r[u])return r[u]=!0,t}var u=t.db_name+"-mrview-"+(o?"temp":ae(a));return h(e,"_local/mrviews",s).then(function(){return e.registerDependentDatabase(u).then(function(t){var n=t.db;n.auto_compaction=!0;var s={name:u,db:n,sourceDB:e,adapter:e.adapter,mapFun:r,reduceFun:i};return s.db.get("_local/lastSeq")["catch"](function(t){if(404!==t.status)throw t}).then(function(t){return s.seq=t?t.seq:0,o||(e._cachedViews=e._cachedViews||{},e._cachedViews[a]=s,s.db.once("destroyed",function(){delete e._cachedViews[a]})),s})})})})}function ue(t,e,n,r,i,o){return or("return ("+t.replace(/;\s*$/,"")+");",{emit:e,sum:n,log:r,isArray:i,toJSON:o})}function ce(t){return-1===t.indexOf("/")?[t,t]:t.split("/")}function le(t){return 1===t.length&&/^1-/.test(t[0].rev)}function fe(t,e){try{t.emit("error",e)}catch(n){console.error("The user's map/reduce function threw an uncaught error.\nYou can debug this error by doing:\nmyDatabase.on('error', function (err) { debugger; });\nPlease double-check your map/reduce function."),console.error(e)}}function de(t,e,n){try{return{output:e.apply(null,n)}}catch(r){return fe(t,r),{error:r}}}function he(t,e){var n=Si(t.key,e.key);return 0!==n?n:Si(t.value,e.value)}function pe(t,e,n){return n=n||0,"number"==typeof e?t.slice(n,e+n):n>0?t.slice(n):t}function ve(t){var e=t.value,n=e&&"object"==typeof e&&e._id||t.id;return n}function me(t){t.rows.forEach(function(t){var e=t.doc&&t.doc._attachments;e&&Object.keys(e).forEach(function(t){var n=e[t];e[t].data=$t(n.data,n.content_type)})})}function ge(t){return function(e){return t.include_docs&&t.attachments&&t.binary&&me(e),e}}function _e(t){var e="builtin "+t+" function requires map values to be numbers or number arrays";return new He(e)}function ye(t){for(var e=0,n=0,r=t.length;r>n;n++){var i=t[n];if("number"!=typeof i){if(!Array.isArray(i))throw _e("_sum");e="number"==typeof e?[e]:e;for(var o=0,a=i.length;a>o;o++){var s=i[o];if("number"!=typeof s)throw _e("_sum");"undefined"==typeof e[o]?e.push(s):e[o]+=s}}else"number"==typeof e?e+=i:e[0]+=i}return e}function be(t,e,n,r){var i=e[t];"undefined"!=typeof i&&(r&&(i=encodeURIComponent(JSON.stringify(i))),n.push(t+"="+i))}function we(t){if("undefined"!=typeof t){var e=Number(t);return isNaN(e)||e!==parseInt(t,10)?t:e}}function xe(t){return t.group_level=we(t.group_level),t.limit=we(t.limit),t.skip=we(t.skip),t}function ke(t){if(t){if("number"!=typeof t)return new Ue('Invalid value for integer: "'+t+'"');if(0>t)return new Ue('Invalid value for positive integer: "'+t+'"')}}function Se(t,e){var n=t.descending?"endkey":"startkey",r=t.descending?"startkey":"endkey";if("undefined"!=typeof t[n]&&"undefined"!=typeof t[r]&&Si(t[n],t[r])>0)throw new Ue("No rows can match your key range, reverse your start_key and end_key or set {descending : true}");if(e.reduce&&t.reduce!==!1){if(t.include_docs)throw new Ue("{include_docs:true} is invalid for reduce");if(t.keys&&t.keys.length>1&&!t.group&&!t.group_level)throw new Ue("Multi-key fetches for reduce views must use {group: true}")}["group_level","limit","skip"].forEach(function(e){var n=ke(t[e]);if(n)throw n})}function Ee(t,e,n){var r,i=[],o="GET";if(be("reduce",n,i),be("include_docs",n,i),be("attachments",n,i),be("limit",n,i),be("descending",n,i),be("group",n,i),be("group_level",n,i),be("skip",n,i),be("stale",n,i),be("conflicts",n,i),be("startkey",n,i,!0),be("start_key",n,i,!0),be("endkey",n,i,!0),be("end_key",n,i,!0),be("inclusive_end",n,i),be("key",n,i,!0),i=i.join("&"),i=""===i?"":"?"+i,"undefined"!=typeof n.keys){var a=2e3,s="keys="+encodeURIComponent(JSON.stringify(n.keys));s.length+i.length+1<=a?i+=("?"===i[0]?"&":"?")+s:(o="POST","string"==typeof e?r={keys:n.keys}:e.keys=n.keys)}if("string"==typeof e){var u=ce(e);return t.request({method:o,url:"_design/"+u[0]+"/_view/"+u[1]+i,body:r}).then(ge(n))}return r=r||{},Object.keys(e).forEach(function(t){Array.isArray(e[t])?r[t]=e[t]:r[t]=e[t].toString()}),t.request({method:"POST",url:"_temp_view"+i,body:r}).then(ge(n))}function Oe(t,e,n){return new lr(function(r,i){t._query(e,n,function(t,e){return t?i(t):void r(e)})})}function Ae(t){return new lr(function(e,n){t._viewCleanup(function(t,r){return t?n(t):void e(r)})})}function je(t){return function(e){if(404===e.status)return t;throw e}}function Te(t,e,n){function r(){return le(l)?lr.resolve(s):e.db.get(a)["catch"](je(s))}function i(t){return t.keys.length?e.db.allDocs({keys:t.keys,include_docs:!0}):lr.resolve({rows:[]})}function o(t,e){for(var n=[],r={},i=0,o=e.rows.length;o>i;i++){var a=e.rows[i],s=a.doc;if(s&&(n.push(s),r[s._id]=!0,s._deleted=!c[s._id],!s._deleted)){var u=c[s._id];"value"in u&&(s.value=u.value)}}var l=Object.keys(c);return l.forEach(function(t){if(!r[t]){var e={_id:t},i=c[t];"value"in i&&(e.value=i.value),n.push(e)}}),t.keys=Di(l.concat(t.keys)),n.push(t),n}var a="_local/doc_"+t,s={_id:a,keys:[]},u=n[t],c=u.indexableKeysToKeyValues,l=u.changes;return r().then(function(t){return i(t).then(function(e){return o(t,e)})})}function De(t,e,n){var r="_local/lastSeq";return t.db.get(r)["catch"](je({_id:r,seq:0})).then(function(r){var i=Object.keys(e);return lr.all(i.map(function(n){return Te(n,t,e)})).then(function(e){var i=Kt(e);return r.seq=n,i.push(r),t.db.bulkDocs({docs:i})})})}function Ie(t){var e="string"==typeof t?t:t.name,n=Ci[e];return n||(n=Ci[e]=new oe),n}function Me(t){return Ti(Ie(t),function(){return Ce(t)})()}function Ce(t){function e(t,e){var n={id:i._id,key:Oi(t)};"undefined"!=typeof e&&null!==e&&(n.value=Oi(e)),r.push(n)}function n(e,n){return function(){return De(t,e,n)}}var r,i,o;if("function"==typeof t.mapFun&&2===t.mapFun.length){var a=t.mapFun;o=function(t){return a(t,e)}}else o=ue(t.mapFun.toString(),e,ye,gi,Array.isArray,JSON.parse);var s=t.seq||0,u=new oe;return new lr(function(e,a){function c(){u.finish().then(function(){t.seq=s,e()})}function l(){function e(t){a(t)}t.sourceDB.changes({conflicts:!0,include_docs:!0,style:"all_docs",since:s,limit:Li}).on("complete",function(e){var a=e.results;if(!a.length)return c();for(var f={},d=0,h=a.length;h>d;d++){var p=a[d];if("_"!==p.doc._id[0]){r=[],i=p.doc,i._deleted||de(t.sourceDB,o,[i]),r.sort(he);for(var v,m={},g=0,_=r.length;_>g;g++){var y=r[g],b=[y.key,y.id];0===Si(y.key,v)&&b.push(g);var w=Ei(b);m[w]=y,v=y.key}f[p.doc._id]={indexableKeysToKeyValues:m,changes:p.changes}}s=p.seq}return u.add(n(f,s)),a.lengths;s++){var c=o[s],l=de(t.sourceDB,r,[c.keys,c.values,!1]);if(l.error&&l.error instanceof He)throw l.error;e.push({value:l.error?null:l.output,key:c.groupKey})}return{rows:pe(e,n.limit,n.skip)}}function Le(t,e){return Ti(Ie(t),function(){return Re(t,e)})()}function Re(t,e){function n(e){return e.include_docs=!0,t.db.allDocs(e).then(function(t){return i=t.total_rows,t.rows.map(function(t){if("value"in t.doc&&"object"==typeof t.doc.value&&null!==t.doc.value){var e=Object.keys(t.doc.value).sort(),n=["id","key","value"];if(!(n>e||e>n))return t.doc.value}var r=Ai(t.doc._id);return{key:r[0],id:r[1],value:"value"in t.doc?t.doc.value:null}})})}function r(n){var r;if(r=o?qe(t,n,e):{total_rows:i,offset:a,rows:n},e.include_docs){var s=Di(n.map(ve));return t.sourceDB.allDocs({keys:s,include_docs:!0,conflicts:e.conflicts,attachments:e.attachments,binary:e.binary}).then(function(t){var e={};return t.rows.forEach(function(t){t.doc&&(e["$"+t.id]=t.doc)}),n.forEach(function(t){var n=ve(t),r=e["$"+n];r&&(t.doc=r)}),r})}return r}var i,o=t.reduceFun&&e.reduce!==!1,a=e.skip||0;if("undefined"==typeof e.keys||e.keys.length||(e.limit=0,delete e.keys),"undefined"!=typeof e.keys){var s=e.keys,u=s.map(function(t){var e={startkey:Ei([t]),endkey:Ei([t,{}])};return n(e)});return lr.all(u).then(Kt).then(r)}var c={descending:e.descending};if(e.start_key&&(e.startkey=e.start_key),e.end_key&&(e.endkey=e.end_key),"undefined"!=typeof e.startkey&&(c.startkey=Ei(e.descending?[e.startkey,{}]:[e.startkey])),"undefined"!=typeof e.endkey){var l=e.inclusive_end!==!1;e.descending&&(l=!l),c.endkey=Ei(l?[e.endkey,{}]:[e.endkey])}if("undefined"!=typeof e.key){var f=Ei([e.key]),d=Ei([e.key,{}]);c.descending?(c.endkey=f,c.startkey=d):(c.startkey=f,c.endkey=d)}return o||("number"==typeof e.limit&&(c.limit=e.limit),c.skip=a),n(c).then(r)}function Ne(t){return t.request({method:"POST",url:"_view_cleanup"})}function Pe(t){return t.get("_local/mrviews").then(function(e){var n={};Object.keys(e.views).forEach(function(t){var e=ce(t),r="_design/"+e[0],i=e[1];n[r]=n[r]||{},n[r][i]=!0});var r={keys:Object.keys(n),include_docs:!0};return t.allDocs(r).then(function(r){var i={};r.rows.forEach(function(t){var r=t.key.substring(8);Object.keys(n[t.key]).forEach(function(n){var o=r+"/"+n;e.views[o]||(o=n);var a=Object.keys(e.views[o]),s=t.doc&&t.doc.views&&t.doc.views[n];a.forEach(function(t){i[t]=i[t]||s})})});var o=Object.keys(i).filter(function(t){return!i[t]}),a=o.map(function(e){return Ti(Ie(e),function(){return new t.constructor(e,t.__opts).destroy()})()});return lr.all(a).then(function(){return{ok:!0}})})},je({ok:!0}))}function Fe(t,e,r){if("http"===t.type())return Ee(t,e,r);if("function"==typeof t._query)return Oe(t,e,r); -if("string"!=typeof e){Se(r,e);var i={db:t,viewName:"temp_view/temp_view",map:e.map,reduce:e.reduce,temporary:!0};return qi.add(function(){return se(i).then(function(t){function e(){return t.db.destroy()}return Ii(Me(t).then(function(){return Le(t,r)}),e)})}),qi.finish()}var o=e,a=ce(o),s=a[0],u=a[1];return t.getView(s,u).then(function(e){Se(r,e);var i={db:t,viewName:o,map:e.map,reduce:e.reduce};return se(i).then(function(t){return"ok"===r.stale||"update_after"===r.stale?("update_after"===r.stale&&n.nextTick(function(){Me(t)}),Le(t,r)):Me(t).then(function(){return Le(t,r)})})})}function Ue(t){this.status=400,this.name="query_parse_error",this.message=t,this.error=!0;try{Error.captureStackTrace(this,Ue)}catch(e){}}function He(t){this.status=500,this.name="invalid_value",this.message=t,this.error=!0;try{Error.captureStackTrace(this,He)}catch(e){}}function Ye(t){return Xr(Gt(t))}function Be(t,e,n){function r(t){try{return Kr(t)}catch(e){var n=A(wr,"Attachment is not a valid base64 string");return{error:n}}}function i(t,n){if(t.stub)return n();if("string"==typeof t.data){var i=r(t.data);if(i.error)return n(i.error);t.length=i.length,"blob"===e?t.data=yt(i,t.content_type):"base64"===e?t.data=Xr(i):t.data=i,ci(i).then(function(e){t.digest="md5-"+e,n()})}else ut(t.data,function(r){"binary"===e?t.data=Gt(r):"base64"===e&&(t.data=Ye(r)),ci(r).then(function(e){t.digest="md5-"+e,t.length=r.byteLength,n()})})}function o(){s++,t.length===s&&(a?n(a):n())}if(!t.length)return n();var a,s=0;t.forEach(function(t){function e(t){a=t,r++,r===n.length&&o()}var n=t.data&&t.data._attachments?Object.keys(t.data._attachments):[],r=0;if(!n.length)return o();for(var s in t.data._attachments)t.data._attachments.hasOwnProperty(s)&&i(t.data._attachments[s],e)})}function We(t,e){return t.pos-e.pos}function Ve(t,e,n){for(var r,i=0,o=t.length;o>i;)r=i+o>>>1,n(t[r],e)<0?i=r+1:o=r;return i}function $e(t,e,n){var r=Ve(t,e,n);t.splice(r,0,e)}function Ge(t,e){for(var n,r,i=e,o=t.length;o>i;i++){var a=t[i],s=[a.id,a.opts,[]];r?(r[2].push(s),r=s):n=r=s}return n}function ze(t,e){return t[0]0;){var i=n.pop(),o=i.tree1,a=i.tree2;(o[1].status||a[1].status)&&(o[1].status="available"===o[1].status||"available"===a[1].status?"available":"missing");for(var s=0;ss;s++){var c=t[s];if(c.pos===e.pos&&c.ids[0]===e.ids[0])r=Je(c.ids,e.ids),i.push({pos:c.pos,ids:r.tree}),o=o||r.conflicts,a=!0;else if(n!==!0){var l=c.pos0;){var v=p.pop();if(0!==v.diff)for(var m=v.ids[2],g=0,_=m.length;_>g;g++)p.push({ids:m[g],diff:v.diff-1,parent:v.ids,parentIdx:g});else v.ids[0]===f.ids[0]&&h.push(v)}var y=h[0];y?(r=Je(y.ids,f.ids),y.parent[2][y.parentIdx]=r.tree,i.push({pos:l.pos,ids:l.ids}),o=o||r.conflicts,a=!0):i.push(c)}else i.push(c)}return a||i.push(e),i.sort(We),{tree:i,conflicts:o||"internal_node"}}function Xe(t,e){for(var n,r=C(t),i={},o=0,a=r.length;a>o;o++){for(var s=r[o],u=s.ids,c=Math.max(0,u.length-e),l={pos:s.pos+c,ids:Ge(u,c)},f=0;c>f;f++){var d=s.pos+f+"-"+u[f].id;i[d]=!0}n=n?Ke(n,l,!0).tree:[l]}return x(n,function(t,e,n){delete i[e+"-"+n]}),{tree:n,revs:Object.keys(i)}}function Ze(t,e,n){var r=Ke(t,e),i=Xe(r.tree,n);return{tree:i.tree,stemmedRevs:i.revs,conflicts:r.conflicts}}function Qe(t,e){for(var n,r=t.slice(),i=e.split("-"),o=parseInt(i[0],10),a=i[1];n=r.pop();){if(n.pos===o&&n.ids[0]===a)return!0;for(var s=n.ids[2],u=0,c=s.length;c>u;u++)r.push({pos:n.pos+1,ids:s[u]})}return!1}function tn(t,e,n,r,i,o,a,s){if(Qe(e.rev_tree,n.metadata.rev))return r[i]=n,o();var u=e.winningRev||v(e),c="deleted"in e?e.deleted:g(e,u),l="deleted"in n.metadata?n.metadata.deleted:g(n.metadata),f=/^1-/.test(n.metadata.rev);if(c&&!l&&s&&f){var d=n.data;d._rev=u,d._id=n.metadata.id,n=U(d,s)}var h=Ze(e.rev_tree,n.metadata.rev_tree[0],t),p=s&&(c&&l||!c&&"new_leaf"!==h.conflicts||c&&!l&&"new_branch"===h.conflicts);if(p){var m=A(vr);return r[i]=m,o()}var _=n.metadata.rev;n.metadata.rev_tree=h.tree,n.stemmedRevs=h.stemmedRevs||[],e.rev_map&&(n.metadata.rev_map=e.rev_map);var y,b=v(n.metadata),w=g(n.metadata,b),x=c===w?0:w>c?-1:1;y=_===b?w:g(n.metadata,_),a(n,b,w,y,!0,x,i,o)}function en(t){return"missing"===t.metadata.rev_tree[0].ids[1].status}function nn(t,e,n,r,i,o,a,s,u){function c(t,e,n){var r=v(t.metadata),i=g(t.metadata,r);if("was_delete"in s&&i)return o[e]=A(pr,"deleted"),n();var u=f&&en(t);if(u){var c=A(vr);return o[e]=c,n()}var l=i?0:1;a(t,r,i,i,!1,l,e,n)}function l(){++h===p&&u&&u()}t=t||1e3;var f=s.new_edits,d=new nr.Map,h=0,p=e.length;e.forEach(function(t,e){if(t._id&&M(t._id)){var r=t._deleted?"_removeLocal":"_putLocal";return void n[r](t,{ctx:i},function(t,n){o[e]=t||n,l()})}var a=t.metadata.id;d.has(a)?(p--,d.get(a).push([t,e])):d.set(a,[[t,e]])}),d.forEach(function(e,n){function i(){++ur;r++){var o=E[r];if(o._id&&M(o._id))t();else{var a=b.get(o.metadata.id);a.onsuccess=e}}}function l(){q||(o.notify(r._meta.name),r._meta.docCount+=O,a(null,I))}function f(t,e){var n=x.get(t);n.onsuccess=function(n){if(n.target.result)e();else{var r=A(qr,"unknown stub attachment with digest "+t);r.status=412,e(r)}}}function d(t){function e(){++i===n.length&&t(r)}var n=[];if(E.forEach(function(t){t.data&&t.data._attachments&&Object.keys(t.data._attachments).forEach(function(e){var r=t.data._attachments[e];r.stub&&n.push(r.digest)})}),!n.length)return t();var r,i=0;n.forEach(function(t){f(t,function(t){t&&!r&&(r=t),e()})})}function h(t,e,n,r,i,o,a,s){O+=o,t.metadata.winningRev=e,t.metadata.deleted=n;var u=t.data;u._id=t.metadata.id,u._rev=t.metadata.rev,r&&(u._deleted=!0);var c=u._attachments&&Object.keys(u._attachments).length;return c?m(t,e,n,i,a,s):void v(t,e,n,i,a,s)}function p(t){var e=rn(t.metadata);gn(e,t.metadata.id,y)}function v(t,e,n,i,o,a){function s(o){i&&r.auto_compaction?p(t):t.stemmedRevs.length&&gn(t.stemmedRevs,t.metadata.id,y),f.seq=o.target.result,delete f.rev;var a=fn(f,e,n),s=b.put(a);s.onsuccess=c}function u(t){t.preventDefault(),t.stopPropagation();var e=w.index("_doc_id_rev"),n=e.getKey(l._doc_id_rev);n.onsuccess=function(t){var e=w.put(l,t.target.result);e.onsuccess=s}}function c(){I[o]={ok:!0,id:f.id,rev:e},C.set(t.metadata.id,t.metadata),g(t,f.seq,a)}var l=t.data,f=t.metadata;l._doc_id_rev=f.id+"::"+f.rev,delete l._id,delete l._rev;var d=w.put(l);d.onsuccess=s,d.onerror=u}function m(t,e,n,r,i,o){function a(){c===l.length&&v(t,e,n,r,i,o)}function s(){c++,a()}var u=t.data,c=0,l=Object.keys(u._attachments);l.forEach(function(e){var n=t.data._attachments[e];if(n.stub)c++,a();else{var r=n.data;delete n.data;var i=n.digest;_(i,r,s)}})}function g(t,e,n){function r(){++o===a.length&&n()}function i(n){var i=t.data._attachments[n].digest,o=k.put({seq:e,digestSeq:i+"::"+e});o.onsuccess=r,o.onerror=function(t){t.preventDefault(),t.stopPropagation(),r()}}var o=0,a=Object.keys(t.data._attachments||{});if(!a.length)return n();for(var s=0;sj;j++){var D=E[j];D._id&&M(D._id)||(D=E[j]=U(D,n.new_edits),D.error&&!S&&(S=D))}if(S)return a(S);var I=new Array(E.length),C=new nr.Map,q=!1,L=r._meta.blobSupport?"blob":"base64";Be(E,L,function(t){return t?a(t):void s()})}function bn(t,e,n,r,i){try{if(t&&e)return i?IDBKeyRange.bound(e,t,!n,!1):IDBKeyRange.bound(t,e,!1,!n);if(t)return i?IDBKeyRange.upperBound(t):IDBKeyRange.lowerBound(t);if(e)return i?IDBKeyRange.lowerBound(e,!n):IDBKeyRange.upperBound(e,!n);if(r)return IDBKeyRange.only(r)}catch(o){return{error:o}}return null}function wn(t,e,n,r){return"DataError"===n.name&&0===n.code?r(null,{total_rows:t._meta.docCount,offset:e.skip,rows:[]}):void r(A(jr,n.name,n.message))}function xn(t,e,n,r){function i(t,r){function i(e,n,r){var i=e.id+"::"+r;k.get(i).onsuccess=function(r){n.doc=hn(r.target.result),t.conflicts&&(n.doc._conflicts=E(e)),vn(n.doc,t,y)}}function o(e,n,r){var o={id:r.id,key:r.id,value:{rev:n}},a=r.deleted;if("ok"===t.deleted)S.push(o),a?(o.value.deleted=!0,o.doc=null):t.include_docs&&i(r,o,n);else if(!a&&d--<=0&&(S.push(o),t.include_docs&&i(r,o,n),0===--h))return;e["continue"]()}function a(t){O=e._meta.docCount;var n=t.target.result;if(n){var r=dn(n.value),i=r.winningRev;o(n,i,r)}}function s(){r(null,{total_rows:O,offset:t.skip,rows:S})}function u(){t.attachments?mn(S,t.binary).then(s):s()}var c="startkey"in t?t.startkey:!1,l="endkey"in t?t.endkey:!1,f="key"in t?t.key:!1,d=t.skip||0,h="number"==typeof t.limit?t.limit:-1,p=t.inclusive_end!==!1,v="descending"in t&&t.descending?"prev":null,m=bn(c,l,p,f,v);if(m&&m.error)return wn(e,t,m.error,r);var g=[Hi,Yi];t.attachments&&g.push(Bi);var _=_n(n,g,"readonly");if(_.error)return r(_.error);var y=_.txn,b=y.objectStore(Hi),w=y.objectStore(Yi),x=v?b.openCursor(m,v):b.openCursor(m),k=w.index("_doc_id_rev"),S=[],O=0;y.oncomplete=u,x.onsuccess=a}function o(t,n){return 0===t.limit?n(null,{total_rows:e._meta.docCount,offset:t.skip,rows:[]}):void i(t,n)}o(t,r)}function kn(t){return new lr(function(e){var n=st([""]);t.objectStore(Gi).put(n,"key"),t.onabort=function(t){t.preventDefault(),t.stopPropagation(),e(!1)},t.oncomplete=function(){var t=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);e(n||!t||parseInt(t[1],10)>=43)}})["catch"](function(){return!1})}function Sn(t){it()?chrome.storage.onChanged.addListener(function(e){null!=e.db_name&&t.emit(e.dbName.newValue)}):ot()&&("undefined"!=typeof addEventListener?addEventListener("storage",function(e){t.emit(e.key)}):window.attachEvent("storage",function(e){t.emit(e.key)}))}function En(){ir.EventEmitter.call(this),this._listeners={},Sn(this)}function On(t,e){var n=this;zi.queue.push({action:function(e){An(n,t,e)},callback:e}),cn(n.constructor)}function An(t,e,r){function i(t){var e=t.createObjectStore(Hi,{keyPath:"id"});t.createObjectStore(Yi,{autoIncrement:!0}).createIndex("_doc_id_rev","_doc_id_rev",{unique:!0}),t.createObjectStore(Bi,{keyPath:"digest"}),t.createObjectStore(Vi,{keyPath:"id",autoIncrement:!1}),t.createObjectStore(Gi),e.createIndex("deletedOrLocal","deletedOrLocal",{unique:!1}),t.createObjectStore($i,{keyPath:"_id"});var n=t.createObjectStore(Wi,{autoIncrement:!0});n.createIndex("seq","seq"),n.createIndex("digestSeq","digestSeq",{unique:!0})}function o(t,e){var n=t.objectStore(Hi);n.createIndex("deletedOrLocal","deletedOrLocal",{unique:!1}),n.openCursor().onsuccess=function(t){var r=t.target.result;if(r){var i=r.value,o=g(i);i.deletedOrLocal=o?"1":"0",n.put(i),r["continue"]()}else e()}}function a(t){t.createObjectStore($i,{keyPath:"_id"}).createIndex("_doc_id_rev","_doc_id_rev",{unique:!0})}function s(t,e){var n=t.objectStore($i),r=t.objectStore(Hi),i=t.objectStore(Yi),o=r.openCursor();o.onsuccess=function(t){var o=t.target.result;if(o){var a=o.value,s=a.id,u=M(s),c=v(a);if(u){var l=s+"::"+c,f=s+"::",d=s+"::~",h=i.index("_doc_id_rev"),p=IDBKeyRange.bound(f,d,!1,!1),m=h.openCursor(p);m.onsuccess=function(t){if(m=t.target.result){var e=m.value;e._doc_id_rev===l&&n.put(e),i["delete"](m.primaryKey),m["continue"]()}else r["delete"](o.primaryKey),o["continue"]()}}else o["continue"]()}else e&&e()}}function u(t){var e=t.createObjectStore(Wi,{autoIncrement:!0});e.createIndex("seq","seq"),e.createIndex("digestSeq","digestSeq",{unique:!0})}function l(t,e){var n=t.objectStore(Yi),r=t.objectStore(Bi),i=t.objectStore(Wi),o=r.count();o.onsuccess=function(t){var r=t.target.result;return r?void(n.openCursor().onsuccess=function(t){var n=t.target.result;if(!n)return e();for(var r=n.value,o=n.primaryKey,a=Object.keys(r._attachments||{}),s={},u=0;ui&&(i=n),e["continue"]()}}function o(){var t=fn(s,s.winningRev,s.deleted),e=r.put(t);e.onsuccess=function(){a["continue"]()}}var a=t.target.result;if(a){var s=e(a.value);return s.winningRev=s.winningRev||v(s),s.seq?o():void i()}}}var h=e.name,p=null;t._meta=null,t.type=function(){return"idb"},t._id=f(function(e){e(null,t._meta.instanceId)}),t._bulkDocs=function(n,r,i){yn(e,n,r,t,p,Xi,i)},t._get=function(t,e,n){function r(){n(a,{doc:i,metadata:o,ctx:s})}var i,o,a,s=e.ctx;if(!s){var u=_n(p,[Hi,Yi,Bi],"readonly");if(u.error)return n(u.error);s=u.txn}s.objectStore(Hi).get(t).onsuccess=function(t){if(o=dn(t.target.result),!o)return a=A(pr,"missing"),r();if(g(o)&&!e.rev)return a=A(pr,"deleted"),r();var n=s.objectStore(Yi),u=e.rev||o.winningRev,c=o.id+"::"+u;n.index("_doc_id_rev").get(c).onsuccess=function(t){return i=t.target.result,i&&(i=hn(i)),i?void r():(a=A(pr,"missing"),r())}}},t._getAttachment=function(t,e,n){var r;if(e.ctx)r=e.ctx;else{var i=_n(p,[Hi,Yi,Bi],"readonly");if(i.error)return n(i.error);r=i.txn}var o=t.digest,a=t.content_type;r.objectStore(Bi).get(o).onsuccess=function(t){var r=t.target.result.body;pn(r,a,e.binary,function(t){n(null,t)})}},t._info=function(e){if(null===p||!Ki.has(h)){var n=new Error("db isn't open");return n.id="idbNull",e(n)}var r,i,o=_n(p,[Yi],"readonly");if(o.error)return e(o.error);var a=o.txn,s=a.objectStore(Yi).openCursor(null,"prev");s.onsuccess=function(e){var n=e.target.result;r=n?n.key:0,i=t._meta.docCount},a.oncomplete=function(){e(null,{doc_count:i,update_seq:r,idb_attachment_format:t._meta.blobSupport?"binary":"base64"})}},t._allDocs=function(e,n){xn(e,t,p,n)},t._changes=function(e){function n(t){function n(){return c.seq!==a?t["continue"]():(u=a,c.winningRev===o._rev?i(o):void r())}function r(){var t=o._id+"::"+c.winningRev,e=g.get(t);e.onsuccess=function(t){i(hn(t.target.result))}}function i(n){var r=e.processChange(n,c,e);r.seq=c.seq;var i=b(r);return"object"==typeof i?e.complete(i):(i&&(y++,f&&_.push(r),e.attachments&&e.include_docs?vn(n,e,d,function(){mn([r],e.binary).then(function(){e.onChange(r)})}):e.onChange(r)),void(y!==l&&t["continue"]()))}var o=hn(t.value),a=t.key;if(s&&!s.has(o._id))return t["continue"]();var c;return(c=w.get(o._id))?n():void(m.get(o._id).onsuccess=function(t){c=dn(t.target.result),w.set(o._id,c),n()})}function r(t){var e=t.target.result;e&&n(e)}function i(){var t=[Hi,Yi];e.attachments&&t.push(Bi);var n=_n(p,t,"readonly");if(n.error)return e.complete(n.error);d=n.txn,d.onabort=ln(e.complete),d.oncomplete=o,v=d.objectStore(Yi),m=d.objectStore(Hi),g=v.index("_doc_id_rev");var i;i=e.descending?v.openCursor(null,"prev"):v.openCursor(IDBKeyRange.lowerBound(e.since,!0)),i.onsuccess=r}function o(){function t(){e.complete(null,{results:_,last_seq:u})}!e.continuous&&e.attachments?mn(_).then(t):t()}if(e=c(e),e.continuous){var a=h+":"+L();return Xi.addListener(h,a,t,e),Xi.notify(h),{cancel:function(){Xi.removeListener(h,a)}}}var s=e.doc_ids&&new nr.Set(e.doc_ids);e.since=e.since||0;var u=e.since,l="limit"in e?e.limit:-1;0===l&&(l=1);var f;f="return_docs"in e?e.return_docs:"returnDocs"in e?e.returnDocs:!0;var d,v,m,g,_=[],y=0,b=wt(e),w=new nr.Map;i()},t._close=function(t){return null===p?t(A(yr)):(p.close(),Ki["delete"](h),p=null,void t())},t._getRevisionTree=function(t,e){var n=_n(p,[Hi],"readonly");if(n.error)return e(n.error);var r=n.txn,i=r.objectStore(Hi).get(t);i.onsuccess=function(t){var n=dn(t.target.result);n?e(null,n.rev_tree):e(A(pr))}},t._doCompaction=function(t,e,n){var r=[Hi,Yi,Bi,Wi],i=_n(p,r,"readwrite");if(i.error)return n(i.error);var o=i.txn,a=o.objectStore(Hi);a.get(t).onsuccess=function(n){var r=dn(n.target.result);x(r.rev_tree,function(t,n,r,i,o){var a=n+"-"+r;-1!==e.indexOf(a)&&(o.status="missing")}),gn(e,t,o);var i=r.winningRev,a=r.deleted;o.objectStore(Hi).put(fn(r,i,a))},o.onabort=ln(n),o.oncomplete=function(){n()}},t._getLocal=function(t,e){var n=_n(p,[$i],"readonly");if(n.error)return e(n.error);var r=n.txn,i=r.objectStore($i).get(t);i.onerror=ln(e),i.onsuccess=function(t){var n=t.target.result;n?(delete n._doc_id_rev,e(null,n)):e(A(pr))}},t._putLocal=function(t,e,n){"function"==typeof e&&(n=e,e={}),delete t._revisions;var r=t._rev,i=t._id;r?t._rev="0-"+(parseInt(r.split("-")[1],10)+1):t._rev="0-1";var o,a=e.ctx;if(!a){var s=_n(p,[$i],"readwrite");if(s.error)return n(s.error);a=s.txn,a.onerror=ln(n),a.oncomplete=function(){o&&n(null,o)}}var u,c=a.objectStore($i);r?(u=c.get(i),u.onsuccess=function(i){var a=i.target.result;if(a&&a._rev===r){var s=c.put(t);s.onsuccess=function(){o={ok:!0,id:t._id,rev:t._rev},e.ctx&&n(null,o)}}else n(A(vr))}):(u=c.add(t),u.onerror=function(t){n(A(vr)),t.preventDefault(),t.stopPropagation()},u.onsuccess=function(){o={ok:!0,id:t._id,rev:t._rev},e.ctx&&n(null,o)})},t._removeLocal=function(t,e,n){"function"==typeof e&&(n=e,e={});var r=e.ctx;if(!r){var i=_n(p,[$i],"readwrite");if(i.error)return n(i.error);r=i.txn,r.oncomplete=function(){o&&n(null,o)}}var o,a=t._id,s=r.objectStore($i),u=s.get(a);u.onerror=ln(n),u.onsuccess=function(r){var i=r.target.result;i&&i._rev===t._rev?(s["delete"](a),o={ok:!0,id:a,rev:"0-0"},e.ctx&&n(null,o)):n(A(pr))}},t._destroy=function(t,e){Xi.removeAllListeners(h);var n=Zi.get(h);n&&n.result&&(n.result.close(),Ki["delete"](h));var r=indexedDB.deleteDatabase(h);r.onsuccess=function(){Zi["delete"](h),ot()&&h in localStorage&&delete localStorage[h],e(null,{ok:!0})},r.onerror=ln(e)};var m=Ki.get(h);if(m)return p=m.idb,t._meta=m.global,void n.nextTick(function(){r(null,t)});var _;_=e.storage?jn(h,e.storage):indexedDB.open(h,Ui),Zi.set(h,_),_.onupgradeneeded=function(t){function e(){var t=c[f-1];f++,t&&t(r,e)}var n=t.target.result;if(t.oldVersion<1)return i(n);var r=t.currentTarget.transaction;t.oldVersion<3&&a(n),t.oldVersion<4&&u(n);var c=[o,s,l,d],f=t.oldVersion;e()},_.onsuccess=function(e){p=e.target.result,p.onversionchange=function(){p.close(),Ki["delete"](h)},p.onabort=function(t){console.error("Database has a global failure",t.target.error),p.close(),Ki["delete"](h)};var n=p.transaction([Vi,Gi,Hi],"readwrite"),i=n.objectStore(Vi).get(Vi),o=null,a=null,s=null;i.onsuccess=function(e){var i=function(){null!==o&&null!==a&&null!==s&&(t._meta={name:h,instanceId:s,blobSupport:o,docCount:a},Ki.set(h,{idb:p,global:t._meta}),r(null,t))},u=e.target.result||{id:Vi};h+"_id"in u?(s=u[h+"_id"],i()):(s=L(),u[h+"_id"]=s,n.objectStore(Vi).put(u).onsuccess=function(){i()}),Ji||(Ji=kn(n)),Ji.then(function(t){o=t,i()});var c=n.objectStore(Hi).index("deletedOrLocal");c.count(IDBKeyRange.only("0")).onsuccess=function(t){a=t.target.result,i()}}},_.onerror=function(){var t="Failed to open indexedDB, are you in private browsing mode?";console.error(t),r(A(jr,t))}}function jn(t,e){try{return indexedDB.open(t,{version:Ui,storage:e})}catch(n){return indexedDB.open(t,Ui)}}function Tn(t){return decodeURIComponent(window.escape(t))}function Dn(t){return 65>t?t-48:t-55}function In(t,e,n){for(var r="";n>e;)r+=String.fromCharCode(Dn(t.charCodeAt(e++))<<4|Dn(t.charCodeAt(e++)));return r}function Mn(t,e,n){for(var r="";n>e;)r+=String.fromCharCode(Dn(t.charCodeAt(e+2))<<12|Dn(t.charCodeAt(e+3))<<8|Dn(t.charCodeAt(e))<<4|Dn(t.charCodeAt(e+1))),e+=4;return r}function Cn(t,e){return"UTF-8"===e?Tn(In(t,0,t.length)):Mn(t,0,t.length)}function qn(t){return"'"+t+"'"}function Ln(){return"undefined"!=typeof sqlitePlugin?sqlitePlugin.openDatabase.bind(sqlitePlugin):"undefined"!=typeof openDatabase?function(t){return openDatabase(t.name,t.version,t.description,t.size)}:void 0}function Rn(){return"undefined"!=typeof openDatabase||"undefined"!=typeof SQLitePlugin}function Nn(t){return t.replace(/\u0002/g,"").replace(/\u0001/g,"").replace(/\u0000/g,"")}function Pn(t){return t.replace(/\u0001\u0001/g,"\x00").replace(/\u0001\u0002/g,"").replace(/\u0002\u0002/g,"")}function Fn(t){return delete t._id,delete t._rev,JSON.stringify(t)}function Un(t,e,n){return t=JSON.parse(t),t._id=e,t._rev=n,t}function Hn(t){for(var e="(";t--;)e+="?",t&&(e+=",");return e+")"}function Yn(t,e,n,r,i){return"SELECT "+t+" FROM "+("string"==typeof e?e:e.join(" JOIN "))+(n?" ON "+n:"")+(r?" WHERE "+("string"==typeof r?r:r.join(" AND ")):"")+(i?" ORDER BY "+i:"")}function Bn(t,e,n){function r(){++o===t.length&&i()}function i(){if(a.length){var t="SELECT DISTINCT digest AS digest FROM "+oo+" WHERE seq IN "+Hn(a.length);n.executeSql(t,a,function(t,e){for(var n=[],r=0;r0;){var t=k.pop();t(null,b)}}function h(t,e){if(0===e){var n="CREATE TABLE IF NOT EXISTS "+io+" (dbid, db_version INTEGER)",c="CREATE TABLE IF NOT EXISTS "+no+" (digest UNIQUE, escaped TINYINT(1), body BLOB)",l="CREATE TABLE IF NOT EXISTS "+oo+" (digest, seq INTEGER)",f="CREATE TABLE IF NOT EXISTS "+to+" (id unique, json, winningseq, max_seq INTEGER UNIQUE)",h="CREATE TABLE IF NOT EXISTS "+eo+" (seq INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, json, deleted TINYINT(1), doc_id, rev)",p="CREATE TABLE IF NOT EXISTS "+ro+" (id UNIQUE, rev, json)";t.executeSql(c),t.executeSql(p),t.executeSql(l,[],function(){t.executeSql(ho),t.executeSql(po)}),t.executeSql(f,[],function(){t.executeSql(fo),t.executeSql(h,[],function(){t.executeSql(co),t.executeSql(lo),t.executeSql(n,[],function(){var e="INSERT INTO "+io+" (db_version, dbid) VALUES (?,?)";b=L();var n=[Qi,b];t.executeSql(e,n,function(){d()})})})})}else{var v=function(){var n=Qi>e;n&&t.executeSql("UPDATE "+io+" SET db_version = "+Qi);var r="SELECT dbid FROM "+io;t.executeSql(r,[],function(t,e){b=e.rows.item(0).dbid,d()})},m=[r,i,o,a,s,u,v],g=e,_=function(t){m[g-1](t,_),g++};_(t)}}function p(){O.transaction(function(t){l(t,function(){v(t)})},Wn(e),n)}function v(t){var e="SELECT sql FROM sqlite_master WHERE tbl_name = "+io;t.executeSql(e,[],function(t,e){e.rows.length?/db_version/.test(e.rows.item(0).sql)?t.executeSql("SELECT db_version FROM "+io,[],function(t,e){var n=e.rows.item(0).db_version;h(t,n)}):t.executeSql("ALTER TABLE "+io+" ADD COLUMN db_version INTEGER",[],function(){h(t,1)}):h(t,0)})}function m(t,e){if(-1!==y._docCount)return e(y._docCount);var n=Yn("COUNT("+to+".id) AS 'num'",[to,eo],vo,eo+".deleted=0");t.executeSql(n,[],function(t,n){y._docCount=n.rows.item(0).num,e(y._docCount)})}var _,y=this,b=null,w=Vn(t),k=[];y._docCount=-1,y._name=t.name;var S=Gn({name:y._name,version:uo,description:y._name,size:w,location:t.location,createFromLocation:t.createFromLocation,androidDatabaseImplementation:t.androidDatabaseImplementation});if(S.error)return Wn(e)(S.error);var O=S.db;"function"!=typeof O.readTransaction&&(O.readTransaction=O.transaction),p(),y.type=function(){return"websql"},y._id=f(function(t){t(null,b)}),y._info=function(t){O.readTransaction(function(e){m(e,function(n){var r="SELECT MAX(seq) AS seq FROM "+eo;e.executeSql(r,[],function(e,r){var i=r.rows.item(0).seq||0;t(null,{doc_count:n,update_seq:i,sqlite_plugin:O._sqlitePlugin,websql_encoding:_})})})},Wn(t))},y._bulkDocs=function(e,n,r){zn(t,e,n,y,O,so,r)},y._get=function(t,e,n){function r(){n(a,{doc:i,metadata:o,ctx:s})}var i,o,a,s=e.ctx;if(!s)return O.readTransaction(function(r){y._get(t,Xn.extend({ctx:r},e),n)});var u,c;e.rev?(u=Yn(mo,[to,eo],to+".id="+eo+".doc_id",[eo+".doc_id=?",eo+".rev=?"]),c=[t,e.rev]):(u=Yn(mo,[to,eo],vo,to+".id=?"),c=[t]),s.executeSql(u,c,function(t,n){if(!n.rows.length)return a=A(pr,"missing"),r();var s=n.rows.item(0);return o=an(s.metadata),s.deleted&&!e.rev?(a=A(pr,"deleted"),r()):(i=Un(s.data,o.id,s.rev),void r())})},y._allDocs=function(t,e){var n,r=[],i="startkey"in t?t.startkey:!1,o="endkey"in t?t.endkey:!1,a="key"in t?t.key:!1,s="descending"in t?t.descending:!1,u="limit"in t?t.limit:-1,c="skip"in t?t.skip:0,l=t.inclusive_end!==!1,f=[],d=[];if(a!==!1)d.push(to+".id = ?"),f.push(a);else if(i!==!1||o!==!1){if(i!==!1&&(d.push(to+".id "+(s?"<=":">=")+" ?"),f.push(i)),o!==!1){var h=s?">":"<";l&&(h+="="),d.push(to+".id "+h+" ?"),f.push(o)}a!==!1&&(d.push(to+".id = ?"),f.push(a))}"ok"!==t.deleted&&d.push(eo+".deleted = 0"),O.readTransaction(function(e){m(e,function(i){if(n=i,0!==u){var o=Yn(mo,[to,eo],vo,d,to+".id "+(s?"DESC":"ASC"));o+=" LIMIT "+u+" OFFSET "+c,e.executeSql(o,f,function(e,n){for(var i=0,o=n.rows.length;o>i;i++){var a=n.rows.item(i),s=an(a.metadata),u=s.id,c=Un(a.data,u,a.rev),l=c._rev,f={id:u,key:u,value:{rev:l}};if(t.include_docs&&(f.doc=c,f.doc._rev=l,t.conflicts&&(f.doc._conflicts=E(s)),Jn(f.doc,t,y,e)),a.deleted){if("ok"!==t.deleted)continue;f.value.deleted=!0,f.doc=null}r.push(f)}})}})},Wn(e),function(){e(null,{total_rows:n,offset:t.skip,rows:r})})},y._changes=function(t){function e(){var e=to+".json AS metadata, "+to+".max_seq AS maxSeq, "+eo+".json AS winningDoc, "+eo+".rev AS winningRev ",n=to+" JOIN "+eo,u=to+".id="+eo+".doc_id AND "+to+".winningseq="+eo+".seq",c=["maxSeq > ?"],l=[t.since];t.doc_ids&&(c.push(to+".id IN "+Hn(t.doc_ids.length)),l=l.concat(t.doc_ids));var f="maxSeq "+(r?"DESC":"ASC"),d=Yn(e,n,u,c,f),h=wt(t);t.view||t.filter||(d+=" LIMIT "+i);var p=t.since||0;O.readTransaction(function(e){e.executeSql(d,l,function(e,n){function r(e){return function(){t.onChange(e)}}for(var u=0,c=n.rows.length;c>u;u++){var l=n.rows.item(u),f=an(l.metadata);p=l.maxSeq;var d=Un(l.winningDoc,f.id,l.winningRev),v=t.processChange(d,f,t);v.seq=l.maxSeq;var m=h(v);if("object"==typeof m)return t.complete(m);if(m&&(s++,o&&a.push(v),t.attachments&&t.include_docs?Jn(d,t,y,e,r(v)):r(v)()),s===i)break}})},Wn(t.complete),function(){t.continuous||t.complete(null,{results:a,last_seq:p})})}if(t=c(t),t.continuous){var n=y._name+":"+L();return so.addListener(y._name,n,y,t),so.notify(y._name),{cancel:function(){so.removeListener(y._name,n)}}}var r=t.descending;t.since=t.since&&!r?t.since:0;var i="limit"in t?t.limit:-1;0===i&&(i=1);var o;o="return_docs"in t?t.return_docs:"returnDocs"in t?t.returnDocs:!0;var a=[],s=0;e()},y._close=function(t){t()},y._getAttachment=function(t,e,n){var r,i=e.ctx,o=t.digest,a=t.content_type,s="SELECT escaped, CASE WHEN escaped = 1 THEN body ELSE HEX(body) END AS body FROM "+no+" WHERE digest=?";i.executeSql(s,[o],function(t,i){var o=i.rows.item(0),s=o.escaped?Pn(o.body):Cn(o.body,_);r=e.binary?yt(s,a):Xr(s),n(null,r)})},y._getRevisionTree=function(t,e){O.readTransaction(function(n){var r="SELECT json AS metadata FROM "+to+" WHERE id = ?";n.executeSql(r,[t],function(t,n){if(n.rows.length){var r=an(n.rows.item(0).metadata);e(null,r.rev_tree)}else e(A(pr))})})},y._doCompaction=function(t,e,n){return e.length?void O.transaction(function(n){var r="SELECT json AS metadata FROM "+to+" WHERE id = ?";n.executeSql(r,[t],function(n,r){var i=an(r.rows.item(0).metadata);x(i.rev_tree,function(t,n,r,i,o){var a=n+"-"+r;-1!==e.indexOf(a)&&(o.status="missing")});var o="UPDATE "+to+" SET json = ? WHERE id = ?";n.executeSql(o,[sn(i),t])}),Bn(e,t,n)},Wn(n),function(){n()}):n()},y._getLocal=function(t,e){O.readTransaction(function(n){var r="SELECT json, rev FROM "+ro+" WHERE id=?";n.executeSql(r,[t],function(n,r){if(r.rows.length){var i=r.rows.item(0),o=Un(i.json,t,i.rev);e(null,o)}else e(A(pr))})})},y._putLocal=function(t,e,n){function r(t){var r,c;o?(r="UPDATE "+ro+" SET rev=?, json=? WHERE id=? AND rev=?",c=[i,u,a,o]):(r="INSERT INTO "+ro+" (id, rev, json) VALUES (?,?,?)",c=[a,i,u]),t.executeSql(r,c,function(t,r){r.rowsAffected?(s={ok:!0,id:a,rev:i},e.ctx&&n(null,s)):n(A(vr))},function(){return n(A(vr)),!1})}"function"==typeof e&&(n=e,e={}),delete t._revisions;var i,o=t._rev,a=t._id;i=o?t._rev="0-"+(parseInt(o.split("-")[1],10)+1):t._rev="0-1";var s,u=Fn(t);e.ctx?r(e.ctx):O.transaction(r,Wn(n),function(){s&&n(null,s)})},y._removeLocal=function(t,e,n){function r(r){var o="DELETE FROM "+ro+" WHERE id=? AND rev=?",a=[t._id,t._rev];r.executeSql(o,a,function(r,o){return o.rowsAffected?(i={ok:!0,id:t._id,rev:"0-0"},void(e.ctx&&n(null,i))):n(A(pr))})}"function"==typeof e&&(n=e,e={});var i;e.ctx?r(e.ctx):O.transaction(r,Wn(n),function(){i&&n(null,i)})},y._destroy=function(t,e){so.removeAllListeners(y._name),O.transaction(function(t){var e=[to,eo,no,io,ro,oo];e.forEach(function(e){t.executeSql("DROP TABLE IF EXISTS "+e,[])})},Wn(e),function(){ot()&&(delete window.localStorage["_pouch__websqldb_"+y._name],delete window.localStorage[y._name]),e(null,{ok:!0})})}}var Xn=t(7),Zn=i(Xn),Qn=i(t(2)),tr=i(t(6)),er=i(t(8)),nr=t(12),rr=i(t(1)),ir=t(4),or=i(t(14)),ar=t(10),sr=i(ar),ur=i(t(15)),cr=i(t(16)),lr="function"==typeof Promise?Promise:er,fr=Qn("pouchdb:api");tr(O,Error),O.prototype.toString=function(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})};var dr=new O({status:401,error:"unauthorized",reason:"Name or password is incorrect."}),hr=new O({status:400,error:"bad_request",reason:"Missing JSON list of 'docs'"}),pr=new O({status:404,error:"not_found",reason:"missing"}),vr=new O({status:409,error:"conflict",reason:"Document update conflict"}),mr=new O({status:400,error:"invalid_id",reason:"_id field must contain a string"}),gr=new O({status:412,error:"missing_id",reason:"_id is required for puts"}),_r=new O({status:400,error:"bad_request",reason:"Only reserved document ids may start with underscore."}),yr=new O({status:412,error:"precondition_failed",reason:"Database not open"}),br=new O({status:500,error:"unknown_error",reason:"Database encountered an unknown error"}),wr=new O({status:500,error:"badarg",reason:"Some query argument is invalid"}),xr=new O({status:400,error:"invalid_request",reason:"Request was invalid"}),kr=new O({status:400,error:"query_parse_error",reason:"Some query parameter is invalid"}),Sr=new O({status:500,error:"doc_validation",reason:"Bad special document member"}),Er=new O({status:400,error:"bad_request",reason:"Something wrong with the request"}),Or=new O({status:400,error:"bad_request",reason:"Document must be a JSON object"}),Ar=new O({status:404,error:"not_found",reason:"Database not found"}),jr=new O({status:500,error:"indexed_db_went_bad",reason:"unknown"}),Tr=new O({status:500,error:"web_sql_went_bad",reason:"unknown"}),Dr=new O({status:500,error:"levelDB_went_went_bad",reason:"unknown"}),Ir=new O({status:403,error:"forbidden",reason:"Forbidden by design doc validate_doc_update function"}),Mr=new O({status:400,error:"bad_request",reason:"Invalid rev format"}),Cr=new O({status:412,error:"file_exists",reason:"The database could not be created, the file already exists."}),qr=new O({status:412,error:"missing_stub"}),Lr=new O({status:413,error:"invalid_url",reason:"Provided URL is invalid"}),Rr={UNAUTHORIZED:dr,MISSING_BULK_DOCS:hr,MISSING_DOC:pr,REV_CONFLICT:vr,INVALID_ID:mr,MISSING_ID:gr,RESERVED_ID:_r,NOT_OPEN:yr,UNKNOWN_ERROR:br,BAD_ARG:wr,INVALID_REQUEST:xr,QUERY_PARSE_ERROR:kr,DOC_VALIDATION:Sr,BAD_REQUEST:Er,NOT_AN_OBJECT:Or,DB_MISSING:Ar,WSQ_ERROR:Tr,LDB_ERROR:Dr,FORBIDDEN:Ir,INVALID_REV:Mr,FILE_EXISTS:Cr,MISSING_STUB:qr,IDB_ERROR:jr,INVALID_URL:Lr},Nr=function(t,e,n){var r=Object.keys(Rr).filter(function(n){var r=Rr[n];return"function"!=typeof r&&r[t]===e}),i=n&&r.filter(function(t){var e=Rr[t];return e.message===n})[0]||r[0];return i?Rr[i]:null};tr(T,ir.EventEmitter),T.prototype.cancel=function(){this.isCancelled=!0,this.db.taskqueue.isReady&&this.emit("cancel")},T.prototype.doChanges=function(t){var e=this,n=t.complete;if(t=c(t),"live"in t&&!("continuous"in t)&&(t.continuous=t.live),t.processChange=D,"latest"===t.since&&(t.since="now"),t.since||(t.since=0),"now"===t.since)return void this.db.info().then(function(r){return e.isCancelled?void n(null,{status:"cancelled"}):(t.since=r.update_seq,void e.doChanges(t))},n);if(t.continuous&&"now"!==t.since&&this.db.info().then(function(t){e.startSeq=t.update_seq},function(t){if("idbNull"!==t.id)throw t}),t.filter&&"string"==typeof t.filter&&("_view"===t.filter?t.view=w(t.view):t.filter=w(t.filter),"http"!==this.db.type()&&!t.doc_ids))return this.filterChanges(t);"descending"in t||(t.descending=!1),t.limit=0===t.limit?1:t.limit,t.complete=n;var r=this.db._changes(t);if(r&&"function"==typeof r.cancel){var i=e.cancel;e.cancel=rr(function(t){r.cancel(),i.apply(this,t)})}},T.prototype.filterChanges=function(t){var e=this,n=t.complete;if("_view"===t.filter){if(!t.view||"string"!=typeof t.view){var r=A(Er,"`view` filter parameter not found or invalid.");return n(r)}var i=b(t.view);this.db.getView(i[0],i[1],function(r,i){return e.isCancelled?n(null,{status:"cancelled"}):r?n(j(r)):i.map?(t.filter=y(i.map),void e.doChanges(t)):n(A(pr))})}else{var o=b(t.filter);if(!o)return e.doChanges(t);this.db.getFilter(o[0],o[1],function(r,i){return e.isCancelled?n(null,{status:"cancelled"}):r?n(j(r)):(t.filter=_(i),void e.doChanges(t))})}};var Pr="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),Fr=R(["_id","_rev","_attachments","_deleted","_revisions","_revs_info","_conflicts","_deleted_conflicts","_local_seq","_rev_tree","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats","_removed"]),Ur=R(["_attachments","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats"]);tr(Q,ir.EventEmitter),Q.prototype.post=d("post",function(t,e,n){return"function"==typeof e&&(n=e,e={}),"object"!=typeof t||Array.isArray(t)?n(A(Or)):void this.bulkDocs({docs:[t]},e,B(n))}),Q.prototype.put=d("put",rr(function(t){var e,n,r,i,o=t.shift(),a="_id"in o;if("object"!=typeof o||Array.isArray(o))return(i=t.pop())(A(Or));for(;;)if(e=t.shift(),n=typeof e,"string"!==n||a?"string"!==n||!a||"_rev"in o?"object"===n?r=e:"function"===n&&(i=e):o._rev=e:(o._id=e,a=!0),!t.length)break;return r=r||{},N(o._id),M(o._id)&&"function"==typeof this._putLocal?o._deleted?this._removeLocal(o,i):this._putLocal(o,i):void this.bulkDocs({docs:[o]},r,B(i))})),Q.prototype.putAttachment=d("putAttachment",function(t,e,n,r,i){function o(t){return t._attachments=t._attachments||{},t._attachments[e]={content_type:i,data:r},a.put(t)}var a=this;return"function"==typeof i&&(i=r,r=n,n=null),"undefined"==typeof i&&(i=r,r=n,n=null),a.get(t).then(function(t){if(t._rev!==n)throw A(vr);return o(t)},function(e){if(e.reason===pr.message)return o({_id:t});throw e})}),Q.prototype.removeAttachment=d("removeAttachment",function(t,e,n,r){var i=this;i.get(t,function(t,o){return t?void r(t):o._rev!==n?void r(A(vr)):o._attachments?(delete o._attachments[e],0===Object.keys(o._attachments).length&&delete o._attachments,void i.put(o,r)):r()})}),Q.prototype.remove=d("remove",function(t,e,n,r){var i;"string"==typeof e?(i={_id:t,_rev:e},"function"==typeof n&&(r=n,n={})):(i=t,"function"==typeof e?(r=e,n={}):(r=n,n=e)),n=n||{},n.was_delete=!0;var o={_id:i._id,_rev:i._rev||n.rev};return o._deleted=!0,M(o._id)&&"function"==typeof this._removeLocal?this._removeLocal(i,r):void this.bulkDocs({docs:[o]},n,B(r))}),Q.prototype.revsDiff=d("revsDiff",function(t,e,n){function r(t,e){s.has(t)||s.set(t,{missing:[]}),s.get(t).missing.push(e)}function i(e,n){var i=t[e].slice(0);x(n,function(t,n,o,a,s){var u=n+"-"+o,c=i.indexOf(u);-1!==c&&(i.splice(c,1),"available"!==s.status&&r(e,u))}),i.forEach(function(t){r(e,t)})}"function"==typeof e&&(n=e,e={});var o=Object.keys(t);if(!o.length)return n(null,{});var a=0,s=new nr.Map;o.map(function(e){this._getRevisionTree(e,function(r,u){if(r&&404===r.status&&"missing"===r.message)s.set(e,{missing:t[e]});else{if(r)return n(r);i(e,u)}if(++a===o.length){var c={};return s.forEach(function(t,e){c[e]=t}),n(null,c)}})},this)}),Q.prototype.bulkGet=d("bulkGet",function(t,e){I(this,t,e)}),Q.prototype.compactDocument=d("compactDocument",function(t,e,n){var r=this;this._getRevisionTree(t,function(i,o){if(i)return n(i);var a=$(o),s=[],u=[];Object.keys(a).forEach(function(t){a[t]>e&&s.push(t)}),x(o,function(t,e,n,r,i){var o=e+"-"+n;"available"===i.status&&-1!==s.indexOf(o)&&u.push(o)}),r._doCompaction(t,u,n)})}),Q.prototype.compact=d("compact",function(t,e){"function"==typeof t&&(e=t,t={});var n=this;t=t||{},n._compactionQueue=n._compactionQueue||[],n._compactionQueue.push({opts:t,callback:e}),1===n._compactionQueue.length&&z(n)}),Q.prototype._compact=function(t,e){function n(t){a.push(i.compactDocument(t.id,0))}function r(t){var n=t.last_seq;lr.all(a).then(function(){return h(i,"_local/compaction",function(t){return!t.last_seq||t.last_seqs)c(u,t,r,i),si(n);else{c(u,t,r,i);var l=u.end(!0),f=Mt(l);e(null,f),u.destroy()}}var r="string"==typeof t,i=r?t.length:t.byteLength,o=Math.min(ui,i),a=Math.ceil(i/o),s=0,u=r?new ur:new ur.ArrayBuffer,c=r?qt:Ct;n()});tr(Ht,ir.EventEmitter),Ht.prototype.cancel=function(){this.cancelled=!0,this.state="cancelled",this.emit("cancel")},Ht.prototype.ready=function(t,e){function n(){i.cancel()}function r(){t.removeListener("destroyed",n),e.removeListener("destroyed",n)}var i=this;i._readyCalled||(i._readyCalled=!0,t.once("destroyed",n),e.once("destroyed",n),i.once("complete",r))};var li={replicate:Bt,toPouch:Yt},fi=li.replicate;tr(Vt,ir.EventEmitter),Vt.prototype.cancel=function(){this.canceled||(this.canceled=!0,this.push.cancel(),this.pull.cancel())};var di=25,hi=50,pi={},vi=1800,mi=Qn("pouchdb:http");ie.valid=function(){return!0},oe.prototype.add=function(t){return this.promise=this.promise["catch"](function(){}).then(function(){return t()}),this.promise},oe.prototype.finish=function(){return this.promise};var gi,_i=function(t,e){return e&&t.then(function(t){n.nextTick(function(){e(null,t)})},function(t){n.nextTick(function(){e(t)})}),t},yi=function(t){return rr(function(e){var n=e.pop(),r=t.apply(this,e);return"function"==typeof n&&_i(r,n),r})},bi=function(t,e){return t.then(function(t){return e().then(function(){return t})},function(t){return e().then(function(){throw t})})},wi=function(t,e){return function(){var n=arguments,r=this;return t.add(function(){return e.apply(r,n)})}},xi=function(t){for(var e={},n=0,r=t.length;r>n;n++)e["$"+t[n]]=!0;var i=Object.keys(e),o=new Array(i.length);for(n=0,r=i.length;r>n;n++)o[n]=i[n].substring(1);return o},ki={uniq:xi,sequentialize:wi,fin:bi,callbackify:yi,promisedCallback:_i},Si=sr.collate,Ei=sr.toIndexableString,Oi=sr.normalizeKey,Ai=sr.parseIndexableString;gi="undefined"!=typeof console&&"function"==typeof console.log?Function.prototype.bind.call(console.log,console):function(){};var ji=ki.callbackify,Ti=ki.sequentialize,Di=ki.uniq,Ii=ki.fin,Mi=ki.promisedCallback,Ci={},qi=new oe,Li=50,Ri={_sum:function(t,e){return ye(e)},_count:function(t,e){return e.length},_stats:function(t,e){function n(t){for(var e=0,n=0,r=t.length;r>n;n++){var i=t[n];e+=i*i}return e}return{sum:ye(e),min:Math.min.apply(null,e),max:Math.max.apply(null,e),count:e.length,sumsqr:n(e)}}},Ni=ji(function(){var t=this;return t._ddocCache&&delete t._ddocCache,"http"===t.type()?Ne(t):"function"==typeof t._viewCleanup?Ae(t):Pe(t)}),Pi=function(t,e,n){"function"==typeof e&&(n=e,e={}),e=e?xe(e):{},"function"==typeof t&&(t={map:t});var r=this,i=lr.resolve().then(function(){return Fe(r,t,e)});return Mi(i,n),i};tr(Ue,Error),tr(He,Error);var Fi={query:Pi,viewCleanup:Ni},Ui=5,Hi="document-store",Yi="by-sequence",Bi="attach-store",Wi="attach-seq-store",Vi="meta-store",$i="local-store",Gi="detect-blob-support",zi={running:!1,queue:[]};tr(En,ir.EventEmitter),En.prototype.addListener=function(t,e,n,r){function i(){function t(){s=!1}if(a._listeners[e]){if(s)return void(s="waiting");s=!0;var u=o(r,["style","include_docs","attachments","conflicts","filter","doc_ids","view","since","query_params","binary"]);n.changes(u).on("change",function(t){t.seq>r.since&&!r.cancelled&&(r.since=t.seq,r.onChange(t))}).on("complete",function(){"waiting"===s&&setTimeout(function(){i()},0),s=!1}).on("error",t)}}if(!this._listeners[e]){var a=this,s=!1;this._listeners[e]=i,this.on(t,i)}},En.prototype.removeListener=function(t,e){e in this._listeners&&ir.EventEmitter.prototype.removeListener.call(this,t,this._listeners[e])},En.prototype.notifyLocalWindows=function(t){it()?chrome.storage.local.set({dbName:t}):ot()&&(localStorage[t]="a"===localStorage[t]?"b":"a")},En.prototype.notify=function(t){this.emit(t),this.notifyLocalWindows(t)};var Ji,Ki=new nr.Map,Xi=new En,Zi=new nr.Map;On.valid=function(){var t="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform);return!t&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange};var Qi=7,to=qn("document-store"),eo=qn("by-sequence"),no=qn("attach-store"),ro=qn("local-store"),io=qn("metadata-store"),oo=qn("attach-seq-store"),ao=new nr.Map,so=new En,uo=1,co="CREATE INDEX IF NOT EXISTS 'by-seq-deleted-idx' ON "+eo+" (seq, deleted)",lo="CREATE UNIQUE INDEX IF NOT EXISTS 'by-seq-doc-id-rev' ON "+eo+" (doc_id, rev)",fo="CREATE INDEX IF NOT EXISTS 'doc-winningseq-idx' ON "+to+" (winningseq)",ho="CREATE INDEX IF NOT EXISTS 'attach-seq-seq-idx' ON "+oo+" (seq)",po="CREATE UNIQUE INDEX IF NOT EXISTS 'attach-seq-digest-idx' ON "+oo+" (digest, seq)",vo=eo+".seq = "+to+".winningseq",mo=eo+".seq AS seq, "+eo+".deleted AS deleted, "+eo+".json AS data, "+eo+".rev AS rev, "+to+".json AS metadata";Kn.valid=Rn;var go={idb:On,websql:Kn};rt.ajax=mt,rt.utils=Qr,rt.Errors=Rr,rt.replicate=li.replicate,rt.sync=Wt,rt.version="5.3.0",rt.adapter("http",ie),rt.adapter("https",ie),rt.plugin(Fi),Object.keys(go).forEach(function(t){rt.adapter(t,go[t],!0)}),e.exports=rt}).call(this,t(13),"undefined"!=typeof r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{1:1,10:10,12:12,13:13,14:14,15:15,16:16,2:2,4:4,6:6,7:7,8:8}]},{},[17])(17)})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],125:[function(t,e,n){function r(){l=!1,s.length?c=s.concat(c):f=-1,c.length&&i()}function i(){if(!l){var t=setTimeout(r);l=!0;for(var e=c.length;e;){for(s=c,c=[];++f1)for(var n=1;nr;r++)n.push("a"+r);var i=["return function ("+n.join(",")+") {","var self = this;","return new Promise(function (rs, rj) {","var res = fn.call(",["self"].concat(n).concat([s]).join(","),");","if (res &&",'(typeof res === "object" || typeof res === "function") &&','typeof res.then === "function"',") {rs(res);}","});","};"].join("");return Function(["Promise","fn"],i)(o,t)}function i(t){for(var e=Math.max(t.length-1,3),n=[],r=0;e>r;r++)n.push("a"+r);var i=["return function ("+n.join(",")+") {","var self = this;","var args;","var argLength = arguments.length;","if (arguments.length > "+e+") {","args = new Array(arguments.length + 1);","for (var i = 0; i < arguments.length; i++) {","args[i] = arguments[i];","}","}","return new Promise(function (rs, rj) {","var cb = "+s+";","var res;","switch (argLength) {",n.concat(["extra"]).map(function(t,e){return"case "+e+":res = fn.call("+["self"].concat(n.slice(0,e)).concat("cb").join(",")+");break;"}).join(""),"default:","args[argLength] = cb;","res = fn.apply(self, args);","}","if (res &&",'(typeof res === "object" || typeof res === "function") &&','typeof res.then === "function"',") {rs(res);}","});","};"].join("");return Function(["Promise","fn"],i)(o,t)}var o=t("./core.js"),a=t("asap");e.exports=o,o.denodeify=function(t,e){return"number"==typeof e&&e!==1/0?r(t,e):i(t)};var s="function (err, res) {if (err) { rj(err); } else { rs(res); }}";o.nodeify=function(t){return function(){var e=Array.prototype.slice.call(arguments),n="function"==typeof e[e.length-1]?e.pop():null,r=this;try{return t.apply(this,arguments).nodeify(n,r)}catch(i){if(null===n||"undefined"==typeof n)return new o(function(t,e){e(i)});a(function(){n.call(r,i)})}}},o.prototype.nodeify=function(t,e){return"function"!=typeof t?this:void this.then(function(n){a(function(){t.call(e,null,n)})},function(n){a(function(){t.call(e,n)})})}},{"./core.js":127,asap:28}],133:[function(t,e,n){"use strict";var r=t("./core.js");e.exports=r,r.enableSynchronous=function(){r.prototype.isPending=function(){return 0==this.getState()},r.prototype.isFulfilled=function(){return 1==this.getState()},r.prototype.isRejected=function(){return 2==this.getState()},r.prototype.getValue=function(){if(3===this._81)return this._65.getValue();if(!this.isFulfilled())throw new Error("Cannot get a value of an unfulfilled promise.");return this._65},r.prototype.getReason=function(){if(3===this._81)return this._65.getReason();if(!this.isRejected())throw new Error("Cannot get a rejection reason of a non-rejected promise.");return this._65},r.prototype.getState=function(){return 3===this._81?this._65.getState():-1===this._81||-2===this._81?0:this._81}},r.disableSynchronous=function(){r.prototype.isPending=void 0,r.prototype.isFulfilled=void 0,r.prototype.isRejected=void 0,r.prototype.getValue=void 0,r.prototype.getReason=void 0,r.prototype.getState=void 0}},{"./core.js":127}],134:[function(t,e,n){(function(){function t(t){function e(e,n,r,i,o,a){for(;o>=0&&a>o;o+=t){var s=i?i[o]:o;r=n(r,e[s],s,e)}return r}return function(n,r,i,o){r=w(r,o,4);var a=!j(n)&&b.keys(n),s=(a||n).length,u=t>0?0:s-1;return arguments.length<3&&(i=n[a?a[u]:u],u+=t),e(n,r,i,a,u,s)}}function r(t){return function(e,n,r){n=x(n,r);for(var i=A(e),o=t>0?0:i-1;o>=0&&i>o;o+=t)if(n(e[o],o,e))return o;return-1}}function i(t,e,n){return function(r,i,o){var a=0,s=A(r);if("number"==typeof o)t>0?a=o>=0?o:Math.max(o+s,a):s=o>=0?Math.min(o+1,s):o+s+1;else if(n&&o&&s)return o=n(r,i),r[o]===i?o:-1;if(i!==i)return o=e(d.call(r,a,s),b.isNaN),o>=0?o+a:-1;for(o=t>0?a:s-1;o>=0&&s>o;o+=t)if(r[o]===i)return o;return-1}}function o(t,e){var n=C.length,r=t.constructor,i=b.isFunction(r)&&r.prototype||c,o="constructor";for(b.has(t,o)&&!b.contains(e,o)&&e.push(o);n--;)o=C[n],o in t&&t[o]!==i[o]&&!b.contains(e,o)&&e.push(o)}var a=this,s=a._,u=Array.prototype,c=Object.prototype,l=Function.prototype,f=u.push,d=u.slice,h=c.toString,p=c.hasOwnProperty,v=Array.isArray,m=Object.keys,g=l.bind,_=Object.create,y=function(){},b=function(t){return t instanceof b?t:this instanceof b?void(this._wrapped=t):new b(t)};"undefined"!=typeof n?("undefined"!=typeof e&&e.exports&&(n=e.exports=b),n._=b):a._=b,b.VERSION="1.8.3";var w=function(t,e,n){if(void 0===e)return t;switch(null==n?3:n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)};case 4:return function(n,r,i,o){return t.call(e,n,r,i,o)}}return function(){return t.apply(e,arguments)}},x=function(t,e,n){return null==t?b.identity:b.isFunction(t)?w(t,e,n):b.isObject(t)?b.matcher(t):b.property(t)};b.iteratee=function(t,e){return x(t,e,1/0)};var k=function(t,e){return function(n){var r=arguments.length;if(2>r||null==n)return n;for(var i=1;r>i;i++)for(var o=arguments[i],a=t(o),s=a.length,u=0;s>u;u++){var c=a[u];e&&void 0!==n[c]||(n[c]=o[c])}return n}},S=function(t){if(!b.isObject(t))return{};if(_)return _(t);y.prototype=t;var e=new y;return y.prototype=null,e},E=function(t){return function(e){return null==e?void 0:e[t]}},O=Math.pow(2,53)-1,A=E("length"),j=function(t){var e=A(t);return"number"==typeof e&&e>=0&&O>=e};b.each=b.forEach=function(t,e,n){e=w(e,n);var r,i;if(j(t))for(r=0,i=t.length;i>r;r++)e(t[r],r,t);else{var o=b.keys(t);for(r=0,i=o.length;i>r;r++)e(t[o[r]],o[r],t)}return t},b.map=b.collect=function(t,e,n){e=x(e,n);for(var r=!j(t)&&b.keys(t),i=(r||t).length,o=Array(i),a=0;i>a;a++){var s=r?r[a]:a;o[a]=e(t[s],s,t)}return o},b.reduce=b.foldl=b.inject=t(1),b.reduceRight=b.foldr=t(-1),b.find=b.detect=function(t,e,n){var r;return r=j(t)?b.findIndex(t,e,n):b.findKey(t,e,n),void 0!==r&&-1!==r?t[r]:void 0},b.filter=b.select=function(t,e,n){var r=[];return e=x(e,n),b.each(t,function(t,n,i){e(t,n,i)&&r.push(t)}),r},b.reject=function(t,e,n){return b.filter(t,b.negate(x(e)),n)},b.every=b.all=function(t,e,n){e=x(e,n);for(var r=!j(t)&&b.keys(t),i=(r||t).length,o=0;i>o;o++){var a=r?r[o]:o;if(!e(t[a],a,t))return!1}return!0},b.some=b.any=function(t,e,n){e=x(e,n);for(var r=!j(t)&&b.keys(t),i=(r||t).length,o=0;i>o;o++){var a=r?r[o]:o;if(e(t[a],a,t))return!0}return!1},b.contains=b.includes=b.include=function(t,e,n,r){return j(t)||(t=b.values(t)),("number"!=typeof n||r)&&(n=0),b.indexOf(t,e,n)>=0},b.invoke=function(t,e){var n=d.call(arguments,2),r=b.isFunction(e);return b.map(t,function(t){var i=r?e:t[e];return null==i?i:i.apply(t,n)})},b.pluck=function(t,e){return b.map(t,b.property(e))},b.where=function(t,e){return b.filter(t,b.matcher(e))},b.findWhere=function(t,e){return b.find(t,b.matcher(e))},b.max=function(t,e,n){var r,i,o=-(1/0),a=-(1/0);if(null==e&&null!=t){t=j(t)?t:b.values(t);for(var s=0,u=t.length;u>s;s++)r=t[s],r>o&&(o=r)}else e=x(e,n),b.each(t,function(t,n,r){i=e(t,n,r),(i>a||i===-(1/0)&&o===-(1/0))&&(o=t,a=i)});return o},b.min=function(t,e,n){var r,i,o=1/0,a=1/0;if(null==e&&null!=t){t=j(t)?t:b.values(t);for(var s=0,u=t.length;u>s;s++)r=t[s],o>r&&(o=r)}else e=x(e,n),b.each(t,function(t,n,r){i=e(t,n,r),(a>i||i===1/0&&o===1/0)&&(o=t,a=i)});return o},b.shuffle=function(t){for(var e,n=j(t)?t:b.values(t),r=n.length,i=Array(r),o=0;r>o;o++)e=b.random(0,o),e!==o&&(i[o]=i[e]),i[e]=n[o];return i},b.sample=function(t,e,n){return null==e||n?(j(t)||(t=b.values(t)),t[b.random(t.length-1)]):b.shuffle(t).slice(0,Math.max(0,e))},b.sortBy=function(t,e,n){return e=x(e,n),b.pluck(b.map(t,function(t,n,r){return{value:t,index:n,criteria:e(t,n,r)}}).sort(function(t,e){var n=t.criteria,r=e.criteria;if(n!==r){if(n>r||void 0===n)return 1;if(r>n||void 0===r)return-1}return t.index-e.index}),"value")};var T=function(t){return function(e,n,r){var i={};return n=x(n,r),b.each(e,function(r,o){var a=n(r,o,e);t(i,r,a)}),i}};b.groupBy=T(function(t,e,n){b.has(t,n)?t[n].push(e):t[n]=[e]}),b.indexBy=T(function(t,e,n){t[n]=e}),b.countBy=T(function(t,e,n){b.has(t,n)?t[n]++:t[n]=1}),b.toArray=function(t){return t?b.isArray(t)?d.call(t):j(t)?b.map(t,b.identity):b.values(t):[]},b.size=function(t){return null==t?0:j(t)?t.length:b.keys(t).length},b.partition=function(t,e,n){e=x(e,n);var r=[],i=[];return b.each(t,function(t,n,o){(e(t,n,o)?r:i).push(t)}),[r,i]},b.first=b.head=b.take=function(t,e,n){return null!=t?null==e||n?t[0]:b.initial(t,t.length-e):void 0},b.initial=function(t,e,n){return d.call(t,0,Math.max(0,t.length-(null==e||n?1:e)))},b.last=function(t,e,n){return null!=t?null==e||n?t[t.length-1]:b.rest(t,Math.max(0,t.length-e)):void 0},b.rest=b.tail=b.drop=function(t,e,n){return d.call(t,null==e||n?1:e)},b.compact=function(t){return b.filter(t,b.identity)};var D=function(t,e,n,r){for(var i=[],o=0,a=r||0,s=A(t);s>a;a++){var u=t[a];if(j(u)&&(b.isArray(u)||b.isArguments(u))){e||(u=D(u,e,n));var c=0,l=u.length;for(i.length+=l;l>c;)i[o++]=u[c++]}else n||(i[o++]=u)}return i};b.flatten=function(t,e){return D(t,e,!1)},b.without=function(t){return b.difference(t,d.call(arguments,1))},b.uniq=b.unique=function(t,e,n,r){b.isBoolean(e)||(r=n,n=e,e=!1),null!=n&&(n=x(n,r));for(var i=[],o=[],a=0,s=A(t);s>a;a++){var u=t[a],c=n?n(u,a,t):u;e?(a&&o===c||i.push(u),o=c):n?b.contains(o,c)||(o.push(c),i.push(u)):b.contains(i,u)||i.push(u)}return i},b.union=function(){return b.uniq(D(arguments,!0,!0))},b.intersection=function(t){for(var e=[],n=arguments.length,r=0,i=A(t);i>r;r++){var o=t[r];if(!b.contains(e,o)){for(var a=1;n>a&&b.contains(arguments[a],o);a++);a===n&&e.push(o)}}return e},b.difference=function(t){var e=D(arguments,!0,!0,1);return b.filter(t,function(t){return!b.contains(e,t)})},b.zip=function(){return b.unzip(arguments)},b.unzip=function(t){for(var e=t&&b.max(t,A).length||0,n=Array(e),r=0;e>r;r++)n[r]=b.pluck(t,r);return n},b.object=function(t,e){for(var n={},r=0,i=A(t);i>r;r++)e?n[t[r]]=e[r]:n[t[r][0]]=t[r][1];return n},b.findIndex=r(1),b.findLastIndex=r(-1),b.sortedIndex=function(t,e,n,r){n=x(n,r,1);for(var i=n(e),o=0,a=A(t);a>o;){var s=Math.floor((o+a)/2);n(t[s])o;o++,t+=n)i[o]=t;return i};var I=function(t,e,n,r,i){if(!(r instanceof e))return t.apply(n,i);var o=S(t.prototype),a=t.apply(o,i);return b.isObject(a)?a:o};b.bind=function(t,e){if(g&&t.bind===g)return g.apply(t,d.call(arguments,1));if(!b.isFunction(t))throw new TypeError("Bind must be called on a function");var n=d.call(arguments,2),r=function(){return I(t,r,e,this,n.concat(d.call(arguments)))};return r},b.partial=function(t){var e=d.call(arguments,1),n=function(){for(var r=0,i=e.length,o=Array(i),a=0;i>a;a++)o[a]=e[a]===b?arguments[r++]:e[a];for(;r=r)throw new Error("bindAll must be passed function names");for(e=1;r>e;e++)n=arguments[e],t[n]=b.bind(t[n],t);return t},b.memoize=function(t,e){var n=function(r){var i=n.cache,o=""+(e?e.apply(this,arguments):r);return b.has(i,o)||(i[o]=t.apply(this,arguments)),i[o]};return n.cache={},n},b.delay=function(t,e){var n=d.call(arguments,2);return setTimeout(function(){return t.apply(null,n)},e)},b.defer=b.partial(b.delay,b,1),b.throttle=function(t,e,n){var r,i,o,a=null,s=0;n||(n={});var u=function(){s=n.leading===!1?0:b.now(),a=null,o=t.apply(r,i),a||(r=i=null)};return function(){var c=b.now();s||n.leading!==!1||(s=c);var l=e-(c-s);return r=this,i=arguments,0>=l||l>e?(a&&(clearTimeout(a),a=null),s=c,o=t.apply(r,i),a||(r=i=null)):a||n.trailing===!1||(a=setTimeout(u,l)),o}},b.debounce=function(t,e,n){var r,i,o,a,s,u=function(){var c=b.now()-a;e>c&&c>=0?r=setTimeout(u,e-c):(r=null,n||(s=t.apply(o,i),r||(o=i=null)))};return function(){o=this,i=arguments,a=b.now();var c=n&&!r;return r||(r=setTimeout(u,e)),c&&(s=t.apply(o,i),o=i=null),s}},b.wrap=function(t,e){return b.partial(e,t)},b.negate=function(t){return function(){return!t.apply(this,arguments)}},b.compose=function(){var t=arguments,e=t.length-1;return function(){for(var n=e,r=t[e].apply(this,arguments);n--;)r=t[n].call(this,r);return r}},b.after=function(t,e){return function(){return--t<1?e.apply(this,arguments):void 0}},b.before=function(t,e){var n;return function(){return--t>0&&(n=e.apply(this,arguments)),1>=t&&(e=null),n}},b.once=b.partial(b.before,2);var M=!{toString:null}.propertyIsEnumerable("toString"),C=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];b.keys=function(t){if(!b.isObject(t))return[];if(m)return m(t);var e=[];for(var n in t)b.has(t,n)&&e.push(n);return M&&o(t,e),e},b.allKeys=function(t){if(!b.isObject(t))return[];var e=[];for(var n in t)e.push(n);return M&&o(t,e),e},b.values=function(t){for(var e=b.keys(t),n=e.length,r=Array(n),i=0;n>i;i++)r[i]=t[e[i]];return r},b.mapObject=function(t,e,n){e=x(e,n);for(var r,i=b.keys(t),o=i.length,a={},s=0;o>s;s++)r=i[s],a[r]=e(t[r],r,t);return a},b.pairs=function(t){for(var e=b.keys(t),n=e.length,r=Array(n),i=0;n>i;i++)r[i]=[e[i],t[e[i]]];return r},b.invert=function(t){for(var e={},n=b.keys(t),r=0,i=n.length;i>r;r++)e[t[n[r]]]=n[r];return e},b.functions=b.methods=function(t){var e=[];for(var n in t)b.isFunction(t[n])&&e.push(n);return e.sort()},b.extend=k(b.allKeys),b.extendOwn=b.assign=k(b.keys),b.findKey=function(t,e,n){e=x(e,n);for(var r,i=b.keys(t),o=0,a=i.length;a>o;o++)if(r=i[o],e(t[r],r,t))return r},b.pick=function(t,e,n){var r,i,o={},a=t;if(null==a)return o;b.isFunction(e)?(i=b.allKeys(a),r=w(e,n)):(i=D(arguments,!1,!1,1),r=function(t,e,n){return e in n},a=Object(a));for(var s=0,u=i.length;u>s;s++){var c=i[s],l=a[c];r(l,c,a)&&(o[c]=l)}return o},b.omit=function(t,e,n){if(b.isFunction(e))e=b.negate(e);else{var r=b.map(D(arguments,!1,!1,1),String);e=function(t,e){return!b.contains(r,e)}}return b.pick(t,e,n)},b.defaults=k(b.allKeys,!0),b.create=function(t,e){var n=S(t);return e&&b.extendOwn(n,e),n},b.clone=function(t){return b.isObject(t)?b.isArray(t)?t.slice():b.extend({},t):t},b.tap=function(t,e){return e(t),t},b.isMatch=function(t,e){var n=b.keys(e),r=n.length;if(null==t)return!r;for(var i=Object(t),o=0;r>o;o++){var a=n[o];if(e[a]!==i[a]||!(a in i))return!1}return!0};var q=function(t,e,n,r){if(t===e)return 0!==t||1/t===1/e;if(null==t||null==e)return t===e;t instanceof b&&(t=t._wrapped),e instanceof b&&(e=e._wrapped);var i=h.call(t);if(i!==h.call(e))return!1;switch(i){case"[object RegExp]":case"[object String]":return""+t==""+e;case"[object Number]":return+t!==+t?+e!==+e:0===+t?1/+t===1/e:+t===+e;case"[object Date]":case"[object Boolean]":return+t===+e}var o="[object Array]"===i;if(!o){if("object"!=typeof t||"object"!=typeof e)return!1;var a=t.constructor,s=e.constructor;if(a!==s&&!(b.isFunction(a)&&a instanceof a&&b.isFunction(s)&&s instanceof s)&&"constructor"in t&&"constructor"in e)return!1}n=n||[],r=r||[];for(var u=n.length;u--;)if(n[u]===t)return r[u]===e;if(n.push(t),r.push(e),o){if(u=t.length,u!==e.length)return!1;for(;u--;)if(!q(t[u],e[u],n,r))return!1}else{var c,l=b.keys(t);if(u=l.length,b.keys(e).length!==u)return!1;for(;u--;)if(c=l[u],!b.has(e,c)||!q(t[c],e[c],n,r))return!1}return n.pop(),r.pop(),!0};b.isEqual=function(t,e){return q(t,e)},b.isEmpty=function(t){return null==t?!0:j(t)&&(b.isArray(t)||b.isString(t)||b.isArguments(t))?0===t.length:0===b.keys(t).length},b.isElement=function(t){return!(!t||1!==t.nodeType)},b.isArray=v||function(t){return"[object Array]"===h.call(t)},b.isObject=function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},b.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(t){b["is"+t]=function(e){return h.call(e)==="[object "+t+"]"}}),b.isArguments(arguments)||(b.isArguments=function(t){return b.has(t,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(b.isFunction=function(t){return"function"==typeof t||!1}),b.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t))},b.isNaN=function(t){return b.isNumber(t)&&t!==+t},b.isBoolean=function(t){return t===!0||t===!1||"[object Boolean]"===h.call(t)},b.isNull=function(t){return null===t},b.isUndefined=function(t){return void 0===t},b.has=function(t,e){return null!=t&&p.call(t,e)},b.noConflict=function(){return a._=s,this},b.identity=function(t){return t},b.constant=function(t){return function(){return t}},b.noop=function(){},b.property=E,b.propertyOf=function(t){return null==t?function(){}:function(e){return t[e]}},b.matcher=b.matches=function(t){return t=b.extendOwn({},t),function(e){return b.isMatch(e,t)}},b.times=function(t,e,n){var r=Array(Math.max(0,t));e=w(e,n,1);for(var i=0;t>i;i++)r[i]=e(i);return r},b.random=function(t,e){return null==e&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1))},b.now=Date.now||function(){return(new Date).getTime()};var L={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},R=b.invert(L),N=function(t){var e=function(e){return t[e]},n="(?:"+b.keys(t).join("|")+")",r=RegExp(n),i=RegExp(n,"g");return function(t){return t=null==t?"":""+t,r.test(t)?t.replace(i,e):t}};b.escape=N(L),b.unescape=N(R),b.result=function(t,e,n){var r=null==t?void 0:t[e];return void 0===r&&(r=n),b.isFunction(r)?r.call(t):r};var P=0;b.uniqueId=function(t){var e=++P+"";return t?t+e:e},b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var F=/(.)^/,U={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},H=/\\|'|\r|\n|\u2028|\u2029/g,Y=function(t){return"\\"+U[t]};b.template=function(t,e,n){!e&&n&&(e=n),e=b.defaults({},e,b.templateSettings);var r=RegExp([(e.escape||F).source,(e.interpolate||F).source,(e.evaluate||F).source].join("|")+"|$","g"),i=0,o="__p+='";t.replace(r,function(e,n,r,a,s){return o+=t.slice(i,s).replace(H,Y),i=s+e.length,n?o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":r?o+="'+\n((__t=("+r+"))==null?'':__t)+\n'":a&&(o+="';\n"+a+"\n__p+='"),e}),o+="';\n",e.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{var a=new Function(e.variable||"obj","_",o)}catch(s){throw s.source=o,s}var u=function(t){return a.call(this,t,b)},c=e.variable||"obj";return u.source="function("+c+"){\n"+o+"}",u},b.chain=function(t){var e=b(t);return e._chain=!0,e};var B=function(t,e){return t._chain?b(e).chain():e};b.mixin=function(t){b.each(b.functions(t),function(e){var n=b[e]=t[e];b.prototype[e]=function(){var t=[this._wrapped];return f.apply(t,arguments),B(this,n.apply(b,t))}})},b.mixin(b),b.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=u[t];b.prototype[t]=function(){var n=this._wrapped;return e.apply(n,arguments),"shift"!==t&&"splice"!==t||0!==n.length||delete n[0],B(this,n)}}),b.each(["concat","join","slice"],function(t){var e=u[t];b.prototype[t]=function(){return B(this,e.apply(this._wrapped,arguments))}}),b.prototype.value=function(){return this._wrapped},b.prototype.valueOf=b.prototype.toJSON=b.prototype.value,b.prototype.toString=function(){return""+this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return b})}).call(this)},{}],135:[function(t,e,n){e.exports={name:"capot",version:"1.3.2",author:{name:"Lupo Montero",url:"http://lupomontero.com"},license:"MIT",repository:"lupomontero/capot",homepage:"https://github.com/lupomontero/capot",scripts:{pretest:"gulp lint",test:"gulp test:server && gulp test:client"},dependencies:{async:"^1.5.2",backbone:"^1.3.1",boom:"^3.1.1",follow:"^0.12.1",good:"^6.6.0","good-console":"^5.3.1",h2o2:"^5.1.0",handlebars:"^4.0.5",hapi:"^13.0.0","hapi-auth-cookie":"^6.1.1",inert:"^3.2.0",joi:"^8.0.4",lodash:"^4.6.1",minimist:"^1.1.3",moment:"^2.12.0",multicouch:"^0.8.2",nodemailer:"^2.3.0",oauth:"^0.9.14",pouchdb:"5.3.0",promise:"^7.1.1",read:"^1.0.6",request:"^2.67.0",which:"^1.2.1"},devDependencies:{browserify:"^13.0.0",eslint:"^2.3.0","eslint-config-hapi":"^9.1.0","eslint-plugin-hapi":"^4.0.0",gulp:"^3.9.1","gulp-concat":"^2.6.0","gulp-declare":"^0.3.0","gulp-eslint":"^2.0.0","gulp-favicons":"^2.2.6","gulp-handlebars":"^4.0.0","gulp-mocha":"^2.2.0","gulp-rename":"^1.2.0","gulp-uglify":"^1.5.3","gulp-util":"^3.0.7","gulp-wrap":"^0.11.0",karma:"^0.13.22","karma-browserify":"^5.0.2","karma-env-preprocessor":"^0.1.1","karma-mocha":"^0.2.2","karma-mocha-reporter":"^2.0.0","karma-phantomjs-launcher":"^1.0.0",longjohn:"^0.2.11",lout:"^9.0.0","merge-stream":"^1.0.0",mkdirp:"^0.5.1",mocha:"^2.3.4","phantomjs-prebuilt":"^2.1.5",rimraf:"^2.5.2",sinon:"^1.17.3","vinyl-buffer":"^1.0.0","vinyl-source-stream":"^1.0.0",vision:"^4.0.1",watchify:"^3.7.0"},browser:{handlebars:"handlebars/runtime.js",pouchdb:"pouchdb/dist/pouchdb.js",extend:"lodash/assignIn.js",omit:"lodash/omit.js"}}},{}]},{},[3]); \ No newline at end of file +!function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){var n=t[a][1][e];return i(n?n:e)},l,l.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a\n

"+l((a=null!=(a=n.key||i&&i.key)?a:u,typeof a===c?a.call(s,{name:"key",hash:{},data:i}):a))+'

\n
\n \n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n \n'},2:function(e,t,n,r,i){return"checked"},compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){var o,a=null!=t?t:{},s=n.helperMissing,u=e.escapeExpression,c=e.lambda;return'

'+u((n.glyphicon||t&&t.glyphicon||s).call(a,"cog",{name:"glyphicon",hash:{},data:i}))+' Configuration

\n\n
\n
\n

'+u((n.glyphicon||t&&t.glyphicon||s).call(a,"globe",{name:"glyphicon",hash:{},data:i}))+' General

\n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n \n
\n
\n
\n\n
\n
\n

'+u((n.glyphicon||t&&t.glyphicon||s).call(a,"send",{name:"glyphicon",hash:{},data:i}))+' Outgoing Mail

\n
\n
\n
\n
\n \n \n
\n
\n \n '+u((n.mailerServicePicker||t&&t.mailerServicePicker||s).call(a,null!=(o=null!=t?t.mailer:t)?o.service:o,{name:"mailerServicePicker",hash:{},data:i}))+'\n
\n
\n \n \n
\n
\n \n \n
\n \n
\n
\n
\n\n
\n
\n

'+u((n.glyphicon||t&&t.glyphicon||s).call(a,"lock",{name:"glyphicon",hash:{},data:i}))+' OAuth

\n
\n
\n\n
\n'+(null!=(o=n.each.call(a,null!=(o=null!=t?t.oauth:t)?o.providers:o,{name:"each",hash:{},fn:e.program(1,i,0),inverse:e.noop,data:i}))?o:"")+'\n \n
\n
\n
\n\n'},useData:!0}),Handlebars.registerPartial("email",Handlebars.template({compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){var o,a=null!=t?t:{},s=n.helperMissing,u="function",c=e.escapeExpression;return'
\n
\n

'+c((o=null!=(o=n.id||(null!=t?t.id:t))?o:s,typeof o===u?o.call(a,{name:"id",hash:{},data:i}):o))+'

\n
\n
\n

'+c((o=null!=(o=n.description||(null!=t?t.description:t))?o:s,typeof o===u?o.call(a,{name:"description",hash:{},data:i}):o))+'

\n
\n \n \n
\n
\n \n \n
\n
\n \n
\n\n"},useData:!0})),this.templates.emails=Handlebars.template({1:function(e,t,n,r,i){var o;return null!=(o=e.invokePartial(r.email,t,{name:"email",data:i,helpers:n,partials:r,decorators:e.decorators}))?o:""},compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){var o;return'

Email Templates

\n\n'+(null!=(o=n.each.call(null!=t?t:{},null!=t?t.models:t,{name:"each",hash:{},fn:e.program(1,i,0),inverse:e.noop,data:i}))?o:"")},usePartial:!0,useData:!0}),this.templates.header=Handlebars.template({1:function(e,t,n,r,i){return' \n'},3:function(e,t,n,r,i){var o=null!=t?t:{},a=n.helperMissing,s=e.escapeExpression;return'\n"},compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){var o,a=null!=t?t:{};return'\n\n'+(null!=(o=n["if"].call(a,null!=(o=null!=t?t.userCtx:t)?o.name:o,{name:"if",hash:{},fn:e.program(3,i,0),inverse:e.noop,data:i}))?o:"")+"\n"},useData:!0}),this.templates.index=Handlebars.template({compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){var o,a=e.escapeExpression,s=e.lambda;return'

Hi Admin!

\n\n
\n
\n

'+a((n.glyphicon||t&&t.glyphicon||n.helperMissing).call(null!=t?t:{},"info-sign",{name:"glyphicon",hash:{},data:i}))+' App Info

\n
\n
\n

Capot

\n

\n Version: '+a(s(null!=(o=null!=t?t.capot:t)?o.version:o,t))+"
\n

\n

CouchDB

\n

\n Version: "+a(s(null!=(o=null!=t?t.couchdb:t)?o.version:o,t))+"
\n UUID: "+a(s(null!=(o=null!=t?t.couchdb:t)?o.uuid:o,t))+"
\n Vendor: "+a(s(null!=(o=null!=(o=null!=t?t.couchdb:t)?o.vendor:o)?o.name:o,t))+" "+a(s(null!=(o=null!=(o=null!=t?t.couchdb:t)?o.vendor:o)?o.version:o,t))+"\n

\n
\n
\n\n"},useData:!0}),this.templates.signin=Handlebars.template({compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){return'
\n
\n \n \n
\n \n
\n'},useData:!0}),this.templates.users=Handlebars.template({1:function(e,t,n,r,i){var o;return" \n "+e.escapeExpression((o=null!=(o=n.name||(null!=t?t.name:t))?o:n.helperMissing,"function"==typeof o?o.call(null!=t?t:{},{name:"name",hash:{},data:i}):o))+"\n \n"},compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){var o,a=null!=t?t:{};return'

'+e.escapeExpression((n.glyphicon||t&&t.glyphicon||n.helperMissing).call(a,"user",{name:"glyphicon",hash:{},data:i}))+' Users

\n\n\n'+(null!=(o=n.each.call(a,null!=t?t.models:t,{name:"each",hash:{},fn:e.program(1,i,0),inverse:e.noop,data:i}))?o:"")+"
\n\n"},useData:!0})},{}],8:[function(e,t,n){"use strict";var r=e("../../client/ui/view");t.exports=r.extend({className:"container",templateName:"header",initialize:function(e){var t=this,n=e.app,i=n.account;r.prototype.initialize.call(t,e);var o=function(){t.model=i.session,t.render()};i.on("init",o),i.on("signin",o),i.on("signout",o),i.on("online",o),i.on("offline",o),n.on("route",function(e){t.$("#main-menu a").each(function(){var t=$(this),n=t.attr("href");"/"===n.charAt(0)&&(n=n.slice(1)),n===e?t.parents("li").addClass("active"):t.parents("li").removeClass("active")})})},events:{'click [data-action="signout"]':"signout"},signout:function(){var e=this.app;return e.account.signOut().then(function(){window.location.href="/"},function(){console.error("signout:fail",arguments)}),!1}})},{"../../client/ui/view":26}],9:[function(e,t,n){"use strict";var r=e("lodash"),i=e("../../client/ui/view"),o=window.Handlebars;o.registerHelper("mailerServicePicker",function(e){var t='",new o.SafeString(t)}),t.exports=i.extend({className:"container",templateName:"config",initialize:function(e){var t=this;i.prototype.initialize.call(t,e);var n=t.app,r=t.model=n.createModel("config");r.once("sync",function(){t.render()}),r.fetch()},events:{"submit #app-form":"save","submit #mailer-form":"save","submit #oauth-form":"save"},save:function(e){e.preventDefault();var t=this,n=t.model,i={name:t.$("#app-name").val(),url:t.$("#app-url").val()},o={from:t.$("#mailer-from").val(),service:t.$("#mailer-service").val(),user:t.$("#mailer-user").val(),pass:t.$("#mailer-pass").val()},a=n.get("oauth");return a.providers=Object.keys(a.providers).reduce(function(e,t){return e[t]={enabled:$("#"+t+"-enabled").is(":checked"),key:$("#"+t+"-key").val(),secret:$("#"+t+"-secret").val(),scopes:$("#"+t+"-scopes").val().split(",").map(function(e){return r.trim(e.toLowerCase())})},e},{}),n.save({app:i,mailer:o,oauth:a},{error:function(e){alert(e.reason||e.message)},success:function(){alert("Config updated!")}}),!1}})},{"../../client/ui/view":26,lodash:126}],10:[function(e,t,n){"use strict";var r=e("../../client/ui/view");t.exports=r.extend({className:"container",templateName:"emails",initialize:function(e){var t=this,n=e.app;r.prototype.initialize.call(t,e);var i=t.model=n.createCollection("emails"),o=Handlebars.partials.email;i.on("change",function(e){var n=o(e.toViewContext());t.$('[data-id="'+e.id+'"]').replaceWith(n)}),i.once("sync",function(){t.render()}),i.fetch()},events:{'click [data-action="save-email"]':"saveEmail"},saveEmail:function(e){var t=$(e.currentTarget),n=t.parents(".panel"),r=n.find("textarea"),i=n.data("id"),o=r.val(),a=this.model.get(i);a.save({text:o})}})},{"../../client/ui/view":26}],11:[function(e,t,n){"use strict";var r=e("../../client/ui/view"),i=e("../../package.json");t.exports=r.extend({className:"container",templateName:"index",initialize:function(e){var t=this,n=e.app;r.prototype.initialize.call(t,e),n.couch.get("/").then(function(e){t.model={capot:i,couchdb:e},t.render()})}})},{"../../client/ui/view":26,"../../package.json":143}],12:[function(e,t,n){"use strict";var r=e("../../client/ui/view"),i=e("../../client/couch");t.exports=r.extend({className:"container",templateName:"signin",initialize:function(e){r.prototype.initialize.call(this,e),this.render()},events:{"submit #signin-form":"submit"},submit:function(e){e.preventDefault();var t={name:"admin",password:$("#pass").val()};return i("/_couch").post("/_session",t).then(function(e){window.location.href="/_admin/"},function(e){alert(e.reason)}),!1}})},{"../../client/couch":15,"../../client/ui/view":26}],13:[function(e,t,n){"use strict";var r=e("../../client/ui/view");t.exports=r.extend({className:"container",templateName:"users",initialize:function(e){var t=this;r.prototype.initialize.call(t,e);var n=t.app,i=t.model=n.createCollection("users");i.once("sync",function(){t.render()}),i.fetch()}})},{"../../client/ui/view":26}],14:[function(e,t,n){"use strict";var r=e("events").EventEmitter,i=e("promise"),o={};o.couch=e("./couch")("/_couch"),o.userDocUrl=function(e){return"/_users/"+encodeURIComponent("org.couchdb.user:"+e)},o.getState=function(){return JSON.parse(window.localStorage.getItem("__capot_session"))},o.setState=function(e){window.localStorage.setItem("__capot_session",JSON.stringify(e))},t.exports=function(e){var t=new r,n=!1;t.id=function(){var e=((t.session||{}).userCtx||{}).roles||[];return e.reduce(function(e,t){var n=/^capot:write:user\/([a-z0-9]+)$/.exec(t);return n&&n[1]?n[1]:e},null)},t.signUp=function(n,r){return new i(function(i,o){var a=function(){e.request("POST","/_session",{email:n,password:r}).then(function(e){return e.roles.length?void t.init().then(i,o):setTimeout(a,1e3)},o)};return r.length<8?o(new Error("Password must be at least 8 chars long")):void e.request("POST","/_users",{email:n,password:r}).then(function(){setTimeout(a,300)},o)})},t.signIn=function(n,r){if(!n||"string"!=typeof n)throw new TypeError("Email must be a string");if(!r||"string"!=typeof r)throw new TypeError("Password must be a string");return e.request("POST","/_session",{email:n,password:r}).then(function(){return t.init()})},t.signOut=function(){return e.request("DELETE","/_session").then(function(){return t.init()})},t.changePassword=function(n,r){if(!n||"string"!=typeof n)throw new TypeError("Password must be a string");if(!r||"string"!=typeof r)throw new TypeError("New password must be a string");var a=t.session.userCtx.name,s=o.userDocUrl(a);return a?r.length<8?new i(function(e,t){t(new Error("Password must be at least 8 chars long"))}):e.request("POST","/_session",{email:a,password:n}).then(function(){return o.couch.get(s)}).then(function(e){return e.password=r,o.couch.put(s,e)}).then(function(){return t.signIn(a,r)}):new i(function(e,t){t(new Error("User is not signed in"))})},t.changeUsername=function(e,t){throw new Error("FIXME: Unimplented!")},t.resetPassword=function(t){return e.request("POST","/_users/"+t+"/_reset",{email:t,baseurl:window.location.origin})},t.destroy=function(){var n=t.session.userCtx.name,r="/_users/"+encodeURIComponent(n);return e.request("GET",r).then(function(t){return e.request("DELETE",r+"?rev="+t._rev)}).then(function(){return t.init()})},t.isSignedIn=function(){var e=(t.session||{}).userCtx||{};return"string"==typeof e.name&&e.name.length>0},t.isAdmin=function(){var e=(t.session||{}).userCtx||{};return e.roles&&e.roles.indexOf("_admin")>=0},t.isOnline=function(){return t.session&&t.session.isOnline},t.isOffline=function(){return!t.isOnline()},t.init=function(r){n?e.log("debug","refreshing account..."):e.log("debug","initializing account..."),r=r||function(){};var a=t.isOnline(),s=t.isSignedIn();return new i(function(i,u){var c=function(){o.setState(t.session),n?a&&t.isOffline()?t.emit("offline"):!a&&t.isOnline()?t.emit("online"):!s&&t.isSignedIn()?t.emit("signin"):s&&!t.isSignedIn()&&t.emit("signout"):(n=!0,t.emit("init"),window.setInterval(t.init.bind(t),3e4)),i(),r()};e.request("GET","/_session").then(function(e){t.session=e,t.session.isOnline=!0,c()},function(n){n&&e.log("error",n),t.session=o.getState()||{},t.session.isOnline=!1,c()})})},t.connectWith=function(t,n){n=n||{};var r="/_oauth/"+t;return n.redirectTo&&(r+="?redirectTo="+encodeURIComponent(n.redirectTo)),new i(function(t,n){e.request("GET",r).then(function(e){window.location.href=e.authenticateUrl},n)})},t.on("init",function(){e.request("GET","/_oauth/session").then(function(e){return"object"==typeof e.data?e.data.cookie?void t.init().then(function(){t.emit("oauth",e)}):t.emit("oauth",e):void 0},function(t){t&&e.log("error",t),401!==xhr.status&&e.log("error","Status: "+xhr.status+"\n"+xhr.responseText)})});var a=function(t){return function(){e.log("debug","account:"+t,Array.prototype.slice.call(arguments,0))}};return e.settings.debug===!0&&["init","signin","signout","offline","online"].forEach(function(e){t.on(e,a(e))}),t}},{"./couch":15,events:33,promise:134}],15:[function(e,t,n){"use strict";var r=e("pouchdb"),i=e("./request"),o={};o.createApi=function(e){var t=i(e);return{get:t.bind(null,"GET"),post:t.bind(null,"POST"),put:t.bind(null,"PUT"),del:t.bind(null,"DELETE")}},t.exports=function(e){"string"==typeof e&&(e={url:e}),/^https?:\/\//.test(e.url)||("/"===e.url.charAt(0)&&(e.url=e.url.slice(1)),e.url=window.location.origin+"/"+e.url);var t=o.createApi(e);return t.db=function(t){return new r(e.url+"/"+encodeURIComponent(t))},t.isAdminParty=function(e){t.get("/_users/_all_docs",function(t,n){t&&401===t.statusCode?e(null,!1):t?e(t):e(null,!0)})},t}},{"./request":18,pouchdb:132}],16:[function(e,t,n){"use strict";var r=e("extend"),i=e("async"),o=e("pouchdb"),a=e("./request"),s=e("./uid"),u=e("./log"),c=e("./account"),l=e("./store"),f={};f.noop=function(){},f.defaults={debug:!1},t.exports=function(e){var t=r({},f.defaults,e),n={settings:t,request:a({url:window.location.origin}),uid:s,log:u(t)},h=n.account=c(n),d=n.store=l(n);return n.log("debug","Dependencies: jQuery "+jQuery.fn.jquery+", PouchDB "+o.version),n.start=function(e){e=e||f.noop,n.log("debug","Starting capot client..."),i.applyEachSeries([i.apply(h.init),i.apply(d.init)],function(t){n.log("info",t||"Capot client successfully started"),e(t)})},n}},{"./account":14,"./log":17,"./request":18,"./store":19,"./uid":27,async:30,extend:112,pouchdb:132}],17:[function(e,t,n){"use strict";var r={};r.pad=function(e,t,n){var r=""+e;"number"!=typeof t&&(t=2),"undefined"==typeof n&&(n="0");var i=t-r.length;if(0>=i)return r;for(var o=0;i>o;++o)r=n+r;return r},r.formatDate=function(e){return[r.pad(e.getHours()),r.pad(e.getMinutes()),r.pad(e.getSeconds()),r.pad(e.getMilliseconds(),3)].join(":")},t.exports=function(e){return function(t){if("undefined"!=typeof console&&"function"==typeof console.log&&("string"==typeof t&&(t=[t]),e.debug||!(t.indexOf("debug")>=0))){var n=Array.prototype.slice.call(arguments,1);1===n.length&&(n=n[0]),"undefined"!=typeof window.console&&"function"==typeof window.console.log&&console.log(r.formatDate(new Date),t,n)}}}},{}],18:[function(e,t,n){"use strict";var r=e("promise");t.exports=function(e){return function(){var t=Array.prototype.slice.call(arguments,0),n=t.shift(),i=t.shift();return"/"!==i.charAt(0)&&(i="/"+i),new r(function(r,o){var a={type:n,url:e.url+i,dataType:"json",timeout:6e4,cache:!1,error:function(e){var t,n;0===e.status?t="Request timed out":e.responseJSON&&e.responseJSON.error?(t=e.responseJSON.error,n=e.responseJSON.reason):t=e.statusText;var r=new Error(t);r.statusCode=e.status,n&&(r.reason=n),o(r)},success:r};if(e.user&&e.pass&&(a.username=e.user,a.password=e.pass),["PUT","POST"].indexOf(n)>=0){var s=t.pop();s&&(a.data=JSON.stringify(s),a.contentType="application/json")}if(t.length){var u=t.shift(),c=Object.keys(u);a.url+=c.reduce(function(e,t){var n=JSON.stringify(u[t]);return e&&(e+="&"),e+encodeURIComponent(t)+"="+encodeURIComponent(n)},"?")}$.ajax(a)})}}},{promise:134}],19:[function(e,t,n){"use strict";var r=e("events").EventEmitter,i=e("promise"),o=e("pouchdb"),a=e("extend"),s=e("omit"),u=e("async"),c={};c.noop=function(){},c.assertDocType=function(e){if("string"!=typeof e)throw new Error("Model type must be a string")},c.parse=function(e){var t=e._id.split("/");return a({id:t.slice(1).join("/"),type:t[0]},s(e,["_id"]))},c.toJSON=function(e){return a({_id:e.type+"/"+e.id},s(e,["id"]))},t.exports=function(e){var t=e.account,n=new r,l=function(e,t){n.emit("sync",e,t),n.emit("sync:"+e,t)};n.sync=function(t){return t=t||c.noop,!n.remoteUrl||e.account.isOffline()?t():void n.remote.sync(n.local,{filter:function(e){return 0!==e._id.indexOf("_design")&&e.$replicate!==!1}}).on("error",l.bind(null,"error")).on("denied",function(e){console.error("sync denied",e)}).on("paused",l.bind(null,"paused")).on("active",l.bind(null,"active")).on("change",l.bind(null,"change")).on("complete",function(e){n.lastSync=e.push.end_time,e.pull.end_time>n.lastSync&&(n.lastSync=e.pull.end_time),l("complete",e),t()})},n.find=function(e,t,r){return c.assertDocType(e),r=r||{},new i(function(i,o){n.local.get(e+"/"+t).then(function(e){var t=c.parse(e);return r.attachments&&e._attachments?void n.getAttachments(e).then(function(e){t._attachments=e,i(t)}):i(t)},o)})},n.findAll=function(e,t){return c.assertDocType(e),t=t||{},new i(function(r,i){n.local.allDocs({include_docs:!0,startkey:e+"/",endkey:e+"0"}).then(function(e){var o=e.rows.map(function(e){return c.parse(e.doc)});return t.attachments?void u.each(o,function(e,t){n.getAttachments(e).then(function(n){e._attachments=n,t()},t)},function(e){return e?i(e):void r(o)}):r(o)},i)})},n.add=function(t,r){c.assertDocType(t);var o=r._attachments||{},l=Object.keys(o),f={},h=l.reduce(function(e,t){var n=o[t];return n instanceof File?f[k]=n:e[k]=n,e},{}),d=a({},s(r,["_attachments"]),{_id:t+"/"+e.uid(),createdAt:new Date,type:t});return Object.keys(h).length&&(d._attachments=h),new i(function(e,t){var r=n.local;r.put(d).then(function(n){d._rev=n.rev;var i=Object.keys(f);return i.length?void u.eachSeries(i,function(e,t){var n=d._id,i=d._rev,o=f[e],a=o.type;r.putAttachment(n,e,i,o,a,function(e,n){return e?t(e):(d._rev=n.rev,void t())})},function(n){return n?t(n):void e(c.parse(d))}):e(c.parse(d))},t)})},n.update=function(e,t,n){c.assertDocType(e)},n.remove=function(e,t){return n.find(e,t).then(function(e){return n.local.put({_deleted:!0},c.toJSON(e)._id,e._rev)})},n.removeAll=function(e){return n.findAll(e).then(function(e){var t=e.map(function(e){var t=c.toJSON(e);return t._deleted=!0,t});return n.local.bulkDocs(t)})},n.attach=function(e,t,n,r){},n.getAttachments=function(e){var t=c.toJSON(e)._id,r=e._attachments||{},o=Object.keys(r);return new i(function(e,i){return o.length?void u.each(o,function(e,i){n.local.getAttachment(t,e,function(t,n){return t?i(t):(r[e].data=n,void i())})},function(t){return t?i(t):void e(r)}):e([])})},n.init=function(r){e.log("debug","capot.store init start"),r=r||c.noop;var i=t.id()||"__capot_anon";n.local=new o(i,{auto_compaction:!0});var a=function(){var t=n.local.changes({since:"now",live:!0,include_docs:!0});t.on("change",function(e){var t=c.parse(e.doc),r=t.type;if(r){var i=function(e){n.emit(e,t,{local:!0}),n.emit(e+":"+r,t,{local:!0})};i(e.deleted||t._deleted?"remove":/^1-/.test(t._rev)?"add":"update"),i("change"),n.sync()}}),e.log("debug","capot.store init ok"),n.emit("init"),r()};t.isSignedIn()&&!t.isAdmin()?(n.remoteUrl=window.location.origin+"/_couch/"+encodeURIComponent("user/"+i),n.remote=new o(n.remoteUrl),n.sync(a)):a()},["signin","signout"].forEach(function(e){t.on(e,n.init.bind(n))});var f=function(t){return function(){e.log("debug","store:"+t,Array.prototype.slice.call(arguments,0))}};return e.settings.debug===!0&&["init","add","update","remove","change","sync"].forEach(function(e){n.on(e,f(e))}),n}},{async:30,events:33,extend:112,omit:127,pouchdb:132,promise:134}],20:[function(e,t,n){"use strict";var r=e("lodash"),i=e("backbone");t.exports=i.View.extend({el:"body",regions:{},events:{"click a":"overrideLink"},initialize:function(e){e=e||{},i.View.prototype.initialize.call(this,e),this.options=e,this.addRegion("main",{view:null,prepend:!0}),this.addRegion("notifications",{view:null}),$("html").removeClass("no-js")},addRegion:function(e,t){var n=r.extend({id:e},t||{});if(!n.$el){var i=t.tagName||"div";n.$el=$("<"+i+' id="'+n.id+'">'),t.className&&n.$el.addClass(t.className)}if(n.$el.attr("data-app-region",e),"main"===e)this.$el.prepend(n.$el);else{var o=n.prepend?"before":"after";this.regions.main.$el[o](n.$el)}this.regions[e]=n,n.view&&this.setRegionView(e,n.view)},setRegionView:function(e,t){var n=this.regions[e],r=n.$el[0];if(!n)throw new Error("Unknown region: "+e);if(!t)throw new Error("No view passed to AppView.setRegionView()");"string"==typeof t&&(t=this.model.createView(t)),t.$el&&!$.contains(r,t.$el)&&n.$el.html(t.$el),n.view=t,this.trigger("region:view",n)},overrideLink:function(e){var t=this.model,n=$(e.currentTarget).attr("href"),i=n.substr(1);if("#"!==n.charAt(0)){var o=r.find(r.keys(t.routes),function(e){return t._routeToRegExp(e).test(i)});"string"==typeof o&&(e.preventDefault(),t.navigate(i,{trigger:!0}))}}})},{backbone:31,lodash:126}],21:[function(e,t,n){"use strict";var r=e("backbone"),i=e("./model"),o=e("lodash"),a={};a.remoteSync=function(e,t,n,r){var i=e.app,a=i.account,s=t.db||"user/"+a.id(),u="/_couch/"+encodeURIComponent(s),c=n+(r.idStartsWith?"/"+r.idStartsWith:""),l={include_docs:!0,startkey:c+(r.descending?"0":"/"),endkey:c+(r.descending?"/":"0")};return o.each(["limit","start","descending"],function(e){r[e]&&(l[e]=r[e])}),i.request("GET",u+"/_all_docs",l).then(function(e){return o.map(e.rows,function(e){var t=e.doc,n=t._id.split("/");return t.id=n.slice(1).join("/"),delete t._id,t})})},a.localSync=function(e,t,n){return e.app.store.findAll(n)},t.exports=r.Collection.extend({model:i,initialize:function(e,t){this.app=t.app,r.Collection.prototype.initialize.call(this,e,t)},comparator:function(e){return-1*e.get("createdAt")},toViewContext:function(){return{models:this.map(function(e){return e.toViewContext?e.toViewContext():e})}}, +sync:function(e,t,n){var r=n.success||function(){},i=n.error||function(){},o=new t.model,s=o.get("type");"read"!==e&&i(null,null,new Error("Sync method not supported"));var u=o.remote||o.db?a.remoteSync:a.localSync;u(t,o,s,n).then(r,function(e){i(null,null,e)})}})},{"./model":24,backbone:31,lodash:126}],22:[function(e,t,n){"use strict";var r=e("moment"),i=window.Handlebars;i.registerHelper("log",function(e){var t=Array.prototype.slice.call(arguments,0,arguments.length-1);console.log.apply(console,t)}),i.registerHelper("formatDate",function(e,t){return 2===arguments.length&&(t="lll"),new i.SafeString(r(e).format(t))}),i.registerHelper("fromNow",function(e){return new i.SafeString(r(e).fromNow())}),i.registerHelper("glyphicon",function(e){var t=' ';return new i.SafeString(t)})},{moment:131}],23:[function(e,t,n){"use strict";var r=window.jQuery||window.$,i=window.Backbone=e("backbone");window.Handlebars=e("handlebars"),i.$=r;var o=e("./router");t.exports=function(e){return new o(e)}},{"./router":25,backbone:31,handlebars:52}],24:[function(e,t,n){"use strict";var r=e("lodash"),i=e("backbone"),o=e("moment"),a={};a.isISODateString=function(e){var t=/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/;return"string"==typeof e&&t.test(e)},a.remoteSync=function(e,t){return void console.log("oh my god!")},a.localSync=function(e,t){var n=t.get("type"),r=(t.app||t.collection.app).store;if("create"===e)return r.add(n,t.toJSON());if("read"===e)return r.find(n,t.id);if("update"!==e){if("delete"===e)return r.remove(n,t.id);throw new Error("Unsupported model sync method")}},t.exports=i.Model.extend({db:null,replicate:!0,remote:!1,initialize:function(e,t){i.Model.prototype.initialize.call(this,e,t),t&&t.app&&(this.app=t.app)},toViewContext:function(){return r.extend({},this.attributes)},parse:function(e){return r.reduce(e,function(e,t,n){return"$replicate"===n?e:(e[n]=a.isISODateString(t)?o(t).toDate():t,e)},{})},toJSON:function(){return r.extend({},this.attributes,{$replicate:this.replicate!==!1})},sync:function(e,t,n){var r=n.success||function(){},i=n.error||function(){},o=this.remote||this.db?a.remoteSync:a.localSync;o(e,t).then(r,function(e){i(null,null,e)})}})},{backbone:31,lodash:126,moment:131}],25:[function(e,t,n){"use strict";var r=e("lodash"),i=e("backbone"),o=e("./app-view"),a=e("./view"),s={};s.getProp=function(e,t){if(!t)return e;var n=t.split("/"),i=n.shift();return e&&e.hasOwnProperty(i)?r.isObject(e[i])?s.getProp(e[i],n.join("/")):e[i]:null};var u=["routePrefix","collections","models","views","templates"];t.exports=i.Router.extend({routePrefix:"",collections:{},models:{},views:{},templates:null,initialize:function(t){var n=this,a=t.capot||e("../")(r.omit(t,u)),s=a.start.bind(a);a.log("debug","Dependencies: Lodash: "+r.VERSION+", Backbone "+i.VERSION+", Handlebars: "+Handlebars.VERSION),i.Router.prototype.initialize.call(n,t),u.forEach(function(e){"undefined"!=typeof t[e]&&(n[e]=t[e])}),r.extend(n,a,{view:new o({model:n}),start:function(){s(function(e){if(e)throw e;i.history.start({pushState:!0})})}}),n.routes||(n.routes={}),n.view.on("region:view",function(e){$("html").attr("class",e.view.templateName)})},route:function(e,t,n){var r=this.routePrefix||"";return 2===arguments.length&&(n=t,t=e),this.routes[e]=n,i.Router.prototype.route.call(this,r+e,t,n)},navigate:function(e,t){var n=this.routePrefix||"";return i.Router.prototype.navigate.call(this,n+e,t)},addRegion:function(e,t){this.view.addRegion(e,t)},setMainView:function(e){var t=(this.view.regions.main||{}).view;t&&t.unsubscribeFromGlobalEvents&&t.unsubscribeFromGlobalEvents(),this.view.setRegionView("main",e),e.subscribeToGlobalEvents()},showView:function(e,t){var n;if(r.isFunction(e)&&e instanceof a)n=e;else if(r.isString(e)&&(n=s.getProp(this.views,e),!n))throw new Error('Unknown view: "'+e+'"');var i=new n(r.extend({app:this},t));return this.setMainView(i),i},showTemplate:function(e){var t=a.extend({templateName:e}),n=new t({app:this});this.setMainView(n),n.render()},requireCondition:function(e,t,n){var r=this;return function(){return e()?void n.apply(this,Array.prototype.slice.call(arguments,0)):r.navigate(t,{trigger:!0})}},requireSignIn:function(e,t){var n=this;return 1===arguments.length&&(t=e,e="signin"),n.requireCondition(function(){return n.account.isSignedIn()},e,t)},requireSignOut:function(e,t){var n=this;return 1===arguments.length&&(t=e,e="dashboard"),n.requireCondition(function(){return n.account.isSignedIn()!==!0},e,t)},requireAdmin:function(e,t){var n=this;return 1===arguments.length&&(t=e,e="signin"),n.requireCondition(function(){return n.account.isAdmin()},e,t)},createView:function(e,t){var n=this.views[e];return new n(r.extend({},t,{app:this}))},createCollection:function(e,t,n){var i=this.collections[e];return new i(t,r.extend({},n,{app:this}))},createModel:function(e,t,n){var i=this.models[e];return new i(t,r.extend({},n,{app:this}))}})},{"../":16,"./app-view":20,"./view":26,backbone:31,lodash:126}],26:[function(e,t,n){"use strict";var r=e("lodash"),i=e("backbone");e("./helpers");var o={};o.getProp=function(e,t){if(!t)return e;var n=t.split("/"),i=n.shift();return e&&e.hasOwnProperty(i)?r.isObject(e[i])?o.getProp(e[i],n.join("/")):e[i]:null},t.exports=i.View.extend({templateName:null,template:null,locals:{},initialize:function(e){i.View.prototype.initialize.call(this,e),this.app=e.app,this.render=r.debounce(this.render,100),this.locals=r.extend(this.locals,e.locals||{})},render:function(e){var t=this.templateName,n=this.app;if(t){var i=o.getProp(n.templates,t);return r.isFunction(i)?(e=e||this.model||{},r.isFunction(e.toViewContext)?e=e.toViewContext():e.attributes?e=e.attributes:r.isArray(e)&&(e={models:r.map(e,function(e){return e.toViewContext?e.toViewContext():e})}),this.$el.html($.trim(i(r.extend({},this.locals,e)))),this.trigger("render"),this):(n.log("error","Template "+t+" not loaded!"),this)}},back:function(e){e.preventDefault(),e.stopPropagation(),window.history.back()},subscribeToGlobalEvents:function(){var e=this;r.each(e._getGlobalEventsHandlers(e.cid),function(e){e.src.on(e.name,e.fn),console.log("View subscribing to global event "+e.name)})},unsubscribeFromGlobalEvents:function(){r.each(this._getGlobalEventsHandlers(this.cid),function(e){e.src.removeListener(e.name,e.fn),console.log("View unsubscribing from global event "+e.name)})},_getGlobalEventsHandlers:r.memoize(function(){var e=this;return r.reduce(e.globalEvents,function(t,n,i){var o=i.split(" "),a=o[0],s=e[n],u={name:o[1]};return r.isFunction(s)?(u.fn=s.bind(e),"account"===a?(u.src=e.app.account,t.push(u)):"store"===a?(u.src=e.app.store,t.push(u)):"task"===a&&(u.src=e.app.task,t.push(u)),t):void 0},[])})})},{"./helpers":22,backbone:31,lodash:126}],27:[function(e,t,n){"use strict";var r={chars:"0123456789abcdefghijklmnopqrstuvwxyz".split("")};t.exports=function(e){var t="",n=r.chars.length;void 0===e&&(e=7);for(var i=0;e>i;++i){var o=Math.random()*n,a=r.chars[Math.floor(o)];t+=String(a).charAt(0)}return t}},{}],28:[function(e,t,n){"use strict";function r(){if(u.length)throw u.shift()}function i(e){var t;t=s.length?s.pop():new o,t.task=e,a(t)}function o(){this.task=null}var a=e("./raw"),s=[],u=[],c=a.makeRequestCallFromTimer(r);t.exports=i,o.prototype.call=function(){try{this.task.call()}catch(e){i.onerror?i.onerror(e):(u.push(e),c())}finally{this.task=null,s[s.length]=this}}},{"./raw":29}],29:[function(e,t,n){(function(e){"use strict";function n(e){s.length||(a(),u=!0),s[s.length]=e}function r(){for(;cl){for(var t=0,n=s.length-c;n>t;t++)s[t]=s[t+c];s.length-=c,c=0}}s.length=0,c=0,u=!1}function i(e){var t=1,n=new f(e),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}function o(e){return function(){function t(){clearTimeout(n),clearInterval(r),e()}var n=setTimeout(t,0),r=setInterval(t,50)}}t.exports=n;var a,s=[],u=!1,c=0,l=1024,f=e.MutationObserver||e.WebKitMutationObserver;a="function"==typeof f?i(r):o(r),n.requestFlush=a,n.makeRequestCallFromTimer=o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],30:[function(e,t,n){(function(e,n){!function(){function r(){}function i(e){return e}function o(e){return!!e}function a(e){return!e}function s(e){return function(){if(null===e)throw new Error("Callback was already called.");e.apply(this,arguments),e=null}}function u(e){return function(){null!==e&&(e.apply(this,arguments),e=null)}}function c(e){return F(e)||"number"==typeof e.length&&e.length>=0&&e.length%1===0}function l(e,t){for(var n=-1,r=e.length;++nr?r:null}):(n=H(e),t=n.length,function(){return r++,t>r?n[r]:null})}function g(e,t){return t=null==t?e.length-1:+t,function(){for(var n=Math.max(arguments.length-t,0),r=Array(n),i=0;n>i;i++)r[i]=arguments[i+t];switch(t){case 0:return e.call(this,r);case 1:return e.call(this,arguments[0],r)}}}function y(e){return function(t,n,r){return e(t,r)}}function _(e){return function(t,n,i){i=u(i||r),t=t||[];var o=m(t);if(0>=e)return i(null);var a=!1,c=0,l=!1;!function f(){if(a&&0>=c)return i(null);for(;e>c&&!l;){var r=o();if(null===r)return a=!0,void(0>=c&&i(null));c+=1,n(t[r],r,s(function(e){c-=1,e?(i(e),l=!0):f()}))}}()}}function b(e){return function(t,n,r){return e(R.eachOf,t,n,r)}}function w(e){return function(t,n,r,i){return e(_(n),t,r,i)}}function x(e){return function(t,n,r){return e(R.eachOfSeries,t,n,r)}}function k(e,t,n,i){i=u(i||r),t=t||[];var o=c(t)?[]:{};e(t,function(e,t,r){n(e,function(e,n){o[t]=n,r(e)})},function(e){i(e,o)})}function S(e,t,n,r){var i=[];e(t,function(e,t,r){n(e,function(n){n&&i.push({index:t,value:e}),r()})},function(){r(f(i.sort(function(e,t){return e.index-t.index}),function(e){return e.value}))})}function E(e,t,n,r){S(e,t,function(e,t){n(e,function(e){t(!e)})},r)}function O(e,t,n){return function(r,i,o,a){function s(){a&&a(n(!1,void 0))}function u(e,r,i){return a?void o(e,function(r){a&&t(r)&&(a(n(!0,e)),a=o=!1),i()}):i()}arguments.length>3?e(r,i,u,s):(a=o,o=i,e(r,u,s))}}function A(e,t){return t}function j(e,t,n){n=n||r;var i=c(t)?[]:{};e(t,function(e,t,n){e(g(function(e,r){r.length<=1&&(r=r[0]),i[t]=r,n(e)}))},function(e){n(e,i)})}function T(e,t,n,r){var i=[];e(t,function(e,t,r){n(e,function(e,t){i=i.concat(t||[]),r(e)})},function(e){r(e,i)})}function D(e,t,n){function i(e,t,n,i){if(null!=i&&"function"!=typeof i)throw new Error("task callback must be a function");return e.started=!0,F(t)||(t=[t]),0===t.length&&e.idle()?R.setImmediate(function(){e.drain()}):(l(t,function(t){var o={data:t,callback:i||r};n?e.tasks.unshift(o):e.tasks.push(o),e.tasks.length===e.concurrency&&e.saturated()}),void R.setImmediate(e.process))}function o(e,t){return function(){a-=1;var n=!1,r=arguments;l(t,function(e){l(u,function(t,r){t!==e||n||(u.splice(r,1),n=!0)}),e.callback.apply(e,r)}),e.tasks.length+a===0&&e.drain(),e.process()}}if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var a=0,u=[],c={tasks:[],concurrency:t,payload:n,saturated:r,empty:r,drain:r,started:!1,paused:!1,push:function(e,t){i(c,e,!1,t)},kill:function(){c.drain=r,c.tasks=[]},unshift:function(e,t){i(c,e,!0,t)},process:function(){for(;!c.paused&&a=t;t++)R.setImmediate(c.process)}}};return c}function I(e){return g(function(t,n){t.apply(null,n.concat([g(function(t,n){"object"==typeof console&&(t?console.error&&console.error(t):console[e]&&l(n,function(t){console[e](t)}))})]))})}function M(e){return function(t,n,r){e(h(t),n,r)}}function C(e){return g(function(t,n){var r=g(function(n){var r=this,i=n.pop();return e(t,function(e,t,i){e.apply(r,n.concat([i]))},i)});return n.length?r.apply(this,n):r})}function q(e){return g(function(t){var n=t.pop();t.push(function(){var e=arguments;r?R.setImmediate(function(){n.apply(null,e)}):n.apply(null,e)});var r=!0;e.apply(this,t),r=!1})}var L,R={},P="object"==typeof self&&self.self===self&&self||"object"==typeof n&&n.global===n&&n||this;null!=P&&(L=P.async),R.noConflict=function(){return P.async=L,R};var N=Object.prototype.toString,F=Array.isArray||function(e){return"[object Array]"===N.call(e)},U=function(e){var t=typeof e;return"function"===t||"object"===t&&!!e},H=Object.keys||function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t},Y="function"==typeof setImmediate&&setImmediate,B=Y?function(e){Y(e)}:function(e){setTimeout(e,0)};"object"==typeof e&&"function"==typeof e.nextTick?R.nextTick=e.nextTick:R.nextTick=B,R.setImmediate=Y?B:R.nextTick,R.forEach=R.each=function(e,t,n){return R.eachOf(e,y(t),n)},R.forEachSeries=R.eachSeries=function(e,t,n){return R.eachOfSeries(e,y(t),n)},R.forEachLimit=R.eachLimit=function(e,t,n,r){return _(t)(e,y(n),r)},R.forEachOf=R.eachOf=function(e,t,n){function i(e){c--,e?n(e):null===o&&0>=c&&n(null)}n=u(n||r),e=e||[];for(var o,a=m(e),c=0;null!=(o=a());)c+=1,t(e[o],o,s(i));0===c&&n(null)},R.forEachOfSeries=R.eachOfSeries=function(e,t,n){function i(){var r=!0;return null===a?n(null):(t(e[a],a,s(function(e){if(e)n(e);else{if(a=o(),null===a)return n(null);r?R.setImmediate(i):i()}})),void(r=!1))}n=u(n||r),e=e||[];var o=m(e),a=o();i()},R.forEachOfLimit=R.eachOfLimit=function(e,t,n,r){_(t)(e,n,r)},R.map=b(k),R.mapSeries=x(k),R.mapLimit=w(k),R.inject=R.foldl=R.reduce=function(e,t,n,r){R.eachOfSeries(e,function(e,r,i){n(t,e,function(e,n){t=n,i(e)})},function(e){r(e,t)})},R.foldr=R.reduceRight=function(e,t,n,r){var o=f(e,i).reverse();R.reduce(o,t,n,r)},R.transform=function(e,t,n,r){3===arguments.length&&(r=n,n=t,t=F(e)?[]:{}),R.eachOf(e,function(e,r,i){n(t,e,r,i)},function(e){r(e,t)})},R.select=R.filter=b(S),R.selectLimit=R.filterLimit=w(S),R.selectSeries=R.filterSeries=x(S),R.reject=b(E),R.rejectLimit=w(E),R.rejectSeries=x(E),R.any=R.some=O(R.eachOf,o,i),R.someLimit=O(R.eachOfLimit,o,i),R.all=R.every=O(R.eachOf,a,a),R.everyLimit=O(R.eachOfLimit,a,a),R.detect=O(R.eachOf,i,A),R.detectSeries=O(R.eachOfSeries,i,A),R.detectLimit=O(R.eachOfLimit,i,A),R.sortBy=function(e,t,n){function r(e,t){var n=e.criteria,r=t.criteria;return r>n?-1:n>r?1:0}R.map(e,function(e,n){t(e,function(t,r){t?n(t):n(null,{value:e,criteria:r})})},function(e,t){return e?n(e):void n(null,f(t.sort(r),function(e){return e.value}))})},R.auto=function(e,t,n){function i(e){y.unshift(e)}function o(e){var t=v(y,e);t>=0&&y.splice(t,1)}function a(){c--,l(y.slice(0),function(e){e()})}"function"==typeof arguments[1]&&(n=t,t=null),n=u(n||r);var s=H(e),c=s.length;if(!c)return n(null);t||(t=c);var f={},h=0,m=!1,y=[];i(function(){c||n(null,f)}),l(s,function(r){function s(){return t>h&&d(_,function(e,t){return e&&f.hasOwnProperty(t)},!0)&&!f.hasOwnProperty(r)}function u(){s()&&(h++,o(u),l[l.length-1](y,f))}if(!m){for(var c,l=F(e[r])?e[r]:[e[r]],y=g(function(e,t){if(h--,t.length<=1&&(t=t[0]),e){var i={};p(f,function(e,t){i[t]=e}),i[r]=t,m=!0,n(e,i)}else f[r]=t,R.setImmediate(a)}),_=l.slice(0,l.length-1),b=_.length;b--;){if(!(c=e[_[b]]))throw new Error("Has nonexistent dependency in "+_.join(", "));if(F(c)&&v(c,r)>=0)throw new Error("Has cyclic dependencies")}s()?(h++,l[l.length-1](y,f)):i(u)}})},R.retry=function(e,t,n){function r(e,t){if("number"==typeof t)e.times=parseInt(t,10)||o;else{if("object"!=typeof t)throw new Error("Unsupported argument type for 'times': "+typeof t);e.times=parseInt(t.times,10)||o,e.interval=parseInt(t.interval,10)||a}}function i(e,t){function n(e,n){return function(r){e(function(e,t){r(!e||n,{err:e,result:t})},t)}}function r(e){return function(t){setTimeout(function(){t(null)},e)}}for(;u.times;){var i=!(u.times-=1);s.push(n(u.task,i)),!i&&u.interval>0&&s.push(r(u.interval))}R.series(s,function(t,n){n=n[n.length-1],(e||u.callback)(n.err,n.result)})}var o=5,a=0,s=[],u={times:o,interval:a},c=arguments.length;if(1>c||c>3)throw new Error("Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)");return 2>=c&&"function"==typeof e&&(n=t,t=e),"function"!=typeof e&&r(u,e),u.callback=n,u.task=t,u.callback?i():i},R.waterfall=function(e,t){function n(e){return g(function(r,i){if(r)t.apply(null,[r].concat(i));else{var o=e.next();o?i.push(n(o)):i.push(t),q(e).apply(null,i)}})}if(t=u(t||r),!F(e)){var i=new Error("First argument to waterfall must be an array of functions");return t(i)}return e.length?void n(R.iterator(e))():t()},R.parallel=function(e,t){j(R.eachOf,e,t)},R.parallelLimit=function(e,t,n){j(_(t),e,n)},R.series=function(e,t){j(R.eachOfSeries,e,t)},R.iterator=function(e){function t(n){function r(){return e.length&&e[n].apply(null,arguments),r.next()}return r.next=function(){return nr;){var o=r+(i-r+1>>>1);n(t,e[o])>=0?r=o:i=o-1}return r}function o(e,t,o,a){if(null!=a&&"function"!=typeof a)throw new Error("task callback must be a function");return e.started=!0,F(t)||(t=[t]),0===t.length?R.setImmediate(function(){e.drain()}):void l(t,function(t){var s={data:t,priority:o,callback:"function"==typeof a?a:r};e.tasks.splice(i(e.tasks,s,n)+1,0,s),e.tasks.length===e.concurrency&&e.saturated(),R.setImmediate(e.process)})}var a=R.queue(e,t);return a.push=function(e,t,n){o(a,e,t,n)},delete a.unshift,a},R.cargo=function(e,t){return D(e,1,t)},R.log=I("log"),R.dir=I("dir"),R.memoize=function(e,t){var n={},r={},o=Object.prototype.hasOwnProperty;t=t||i;var a=g(function(i){var a=i.pop(),s=t.apply(null,i);o.call(n,s)?R.setImmediate(function(){a.apply(null,n[s])}):o.call(r,s)?r[s].push(a):(r[s]=[a],e.apply(null,i.concat([g(function(e){n[s]=e;var t=r[s];delete r[s];for(var i=0,o=t.length;o>i;i++)t[i].apply(null,e)})])))});return a.memo=n,a.unmemoized=e,a},R.unmemoize=function(e){return function(){return(e.unmemoized||e).apply(null,arguments)}},R.times=M(R.map),R.timesSeries=M(R.mapSeries),R.timesLimit=function(e,t,n,r){return R.mapLimit(h(e),t,n,r)},R.seq=function(){var e=arguments;return g(function(t){var n=this,i=t[t.length-1];"function"==typeof i?t.pop():i=r,R.reduce(e,t,function(e,t,r){t.apply(n,e.concat([g(function(e,t){r(e,t)})]))},function(e,t){i.apply(n,[e].concat(t))})})},R.compose=function(){return R.seq.apply(null,Array.prototype.reverse.call(arguments))},R.applyEach=C(R.eachOf),R.applyEachSeries=C(R.eachOfSeries),R.forever=function(e,t){function n(e){return e?i(e):void o(n)}var i=s(t||r),o=q(e);n()},R.ensureAsync=q,R.constant=g(function(e){var t=[null].concat(e);return function(e){return e.apply(this,t)}}),R.wrapSync=R.asyncify=function(e){return g(function(t){var n,r=t.pop();try{n=e.apply(this,t)}catch(i){return r(i)}U(n)&&"function"==typeof n.then?n.then(function(e){r(null,e)})["catch"](function(e){r(e.message?e:new Error(e))}):r(null,n)})},"object"==typeof t&&t.exports?t.exports=R:"function"==typeof define&&define.amd?define([],function(){return R}):P.async=R}()}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:133}],31:[function(e,t,n){(function(t){!function(r){var i="object"==typeof self&&self.self===self&&self||"object"==typeof t&&t.global===t&&t;if("function"==typeof define&&define.amd)define(["underscore","jquery","exports"],function(e,t,n){i.Backbone=r(i,n,e,t)});else if("undefined"!=typeof n){var o,a=e("underscore");try{o=e("jquery")}catch(s){}r(i,n,a,o)}else i.Backbone=r(i,{},i._,i.jQuery||i.Zepto||i.ender||i.$)}(function(e,t,n,r){var i=e.Backbone,o=Array.prototype.slice;t.VERSION="1.3.3",t.$=r,t.noConflict=function(){return e.Backbone=i,this},t.emulateHTTP=!1,t.emulateJSON=!1;var a=function(e,t,r){switch(e){case 1:return function(){return n[t](this[r])};case 2:return function(e){return n[t](this[r],e)};case 3:return function(e,i){return n[t](this[r],u(e,this),i)};case 4:return function(e,i,o){return n[t](this[r],u(e,this),i,o)};default:return function(){var e=o.call(arguments);return e.unshift(this[r]),n[t].apply(n,e)}}},s=function(e,t,r){n.each(t,function(t,i){n[i]&&(e.prototype[i]=a(t,i,r))})},u=function(e,t){return n.isFunction(e)?e:n.isObject(e)&&!t._isModel(e)?c(e):n.isString(e)?function(t){return t.get(e)}:e},c=function(e){var t=n.matches(e);return function(e){return t(e.attributes)}},l=t.Events={},f=/\s+/,h=function(e,t,r,i,o){var a,s=0;if(r&&"object"==typeof r){void 0!==i&&"context"in o&&void 0===o.context&&(o.context=i);for(a=n.keys(r);sr;r++)n[r]=arguments[r+1];return h(g,this._events,e,void 0,n),this};var g=function(e,t,n,r){if(e){var i=e[t],o=e.all;i&&o&&(o=o.slice()),i&&y(i,r),o&&y(o,[t].concat(r))}return e},y=function(e,t){var n,r=-1,i=e.length,o=t[0],a=t[1],s=t[2];switch(t.length){case 0:for(;++rr;r++)e[r+n]=t[r];for(r=0;rthis.length&&(i=this.length),0>i&&(i+=this.length+1);var o,a,s=[],u=[],c=[],l=[],f={},h=t.add,d=t.merge,p=t.remove,v=!1,m=this.comparator&&null==i&&t.sort!==!1,g=n.isString(this.comparator)?this.comparator:null;for(a=0;ae&&(e+=this.length),this.models[e]},where:function(e,t){return this[t?"find":"filter"](e)},findWhere:function(e){return this.where(e,!0); +},sort:function(e){var t=this.comparator;if(!t)throw new Error("Cannot sort a set without a comparator");e||(e={});var r=t.length;return n.isFunction(t)&&(t=n.bind(t,this)),1===r||n.isString(t)?this.models=this.sortBy(t):this.models.sort(t),e.silent||this.trigger("sort",this,e),this},pluck:function(e){return this.map(e+"")},fetch:function(e){e=n.extend({parse:!0},e);var t=e.success,r=this;return e.success=function(n){var i=e.reset?"reset":"set";r[i](n,e),t&&t.call(e.context,r,n,e),r.trigger("sync",r,n,e)},H(this,e),this.sync("read",this,e)},create:function(e,t){t=t?n.clone(t):{};var r=t.wait;if(e=this._prepareModel(e,t),!e)return!1;r||this.add(e,t);var i=this,o=t.success;return t.success=function(e,t,n){r&&i.add(e,n),o&&o.call(n.context,e,t,n)},e.save(null,t),e},parse:function(e,t){return e},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(e){return e[this.model.prototype.idAttribute||"id"]},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(this._isModel(e))return e.collection||(e.collection=this),e;t=t?n.clone(t):{},t.collection=this;var r=new this.model(e,t);return r.validationError?(this.trigger("invalid",this,r.validationError,t),!1):r},_removeModels:function(e,t){for(var n=[],r=0;r7),this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.history||!this.history.pushState),this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(P,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var t=this.root.slice(0,-1)||"/";return this.location.replace(t+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;var r=document.body,i=r.insertBefore(this.iframe,r.firstChild).contentWindow;i.document.open(),i.document.close(),i.location.hash="#"+this.fragment}var o=window.addEventListener||function(e,t){return attachEvent("on"+e,t)};return this._usePushState?o("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?o("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.options.silent?void 0:this.loadUrl()},stop:function(){var e=window.removeEventListener||function(e,t){return detachEvent("on"+e,t)};this._usePushState?e("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&e("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),L.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){var t=this.getFragment();return t===this.fragment&&this.iframe&&(t=this.getHash(this.iframe.contentWindow)),t===this.fragment?!1:(this.iframe&&this.navigate(t),void this.loadUrl())},loadUrl:function(e){return this.matchRoot()?(e=this.fragment=this.getFragment(e),n.some(this.handlers,function(t){return t.route.test(e)?(t.callback(e),!0):void 0})):!1},navigate:function(e,t){if(!L.started)return!1;t&&t!==!0||(t={trigger:!!t}),e=this.getFragment(e||"");var n=this.root;""!==e&&"?"!==e.charAt(0)||(n=n.slice(0,-1)||"/");var r=n+e;if(e=this.decodeFragment(e.replace(N,"")),this.fragment!==e){if(this.fragment=e,this._usePushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,r);else{if(!this._wantsHashChange)return this.location.assign(r);if(this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getHash(this.iframe.contentWindow)){var i=this.iframe.contentWindow;t.replace||(i.document.open(),i.document.close()),this._updateHash(i.location,e,t.replace)}}return t.trigger?this.loadUrl(e):void 0}},_updateHash:function(e,t,n){if(n){var r=e.href.replace(/(javascript:|#).*$/,"");e.replace(r+"#"+t)}else e.hash="#"+t}}),t.history=new L;var F=function(e,t){var r,i=this;return r=e&&n.has(e,"constructor")?e.constructor:function(){return i.apply(this,arguments)},n.extend(r,i,t),r.prototype=n.create(i.prototype,e),r.prototype.constructor=r,r.__super__=i.prototype,r};_.extend=w.extend=D.extend=O.extend=L.extend=F;var U=function(){throw new Error('A "url" property or function must be specified')},H=function(e,t){var n=t.error;t.error=function(r){n&&n.call(t.context,e,r,t),e.trigger("error",e,r,t)}};return t})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{jquery:32,underscore:142}],32:[function(e,t,n){},{}],33:[function(e,t,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!o(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,n,r,o,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[e],s(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),n.apply(this,o)}else if(a(n))for(o=Array.prototype.slice.call(arguments,1),c=n.slice(),r=c.length,u=0;r>u;u++)c[u].apply(this,o);return!0},r.prototype.addListener=function(e,t){var n;if(!i(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,i(t.listener)?t.listener:t),this._events[e]?a(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,a(this._events[e])&&!this._events[e].warned&&(n=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,o,s;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],o=n.length,r=-1,n===t||i(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(s=o;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){r=s;break}if(0>r)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],i(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},{}],34:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(){var e=new s.HandlebarsEnvironment;return d.extend(e,s),e.SafeString=c["default"],e.Exception=f["default"],e.Utils=d,e.escapeExpression=d.escapeExpression,e.VM=v,e.template=function(t){return v.template(t,e)},e}n.__esModule=!0;var a=e("./handlebars/base"),s=i(a),u=e("./handlebars/safe-string"),c=r(u),l=e("./handlebars/exception"),f=r(l),h=e("./handlebars/utils"),d=i(h),p=e("./handlebars/runtime"),v=i(p),m=e("./handlebars/no-conflict"),g=r(m),y=o();y.create=o,g["default"](y),y["default"]=y,n["default"]=y,t.exports=n["default"]},{"./handlebars/base":35,"./handlebars/exception":38,"./handlebars/no-conflict":48,"./handlebars/runtime":49,"./handlebars/safe-string":50,"./handlebars/utils":51}],35:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t,n){this.helpers=e||{},this.partials=t||{},this.decorators=n||{},u.registerDefaultHelpers(this),c.registerDefaultDecorators(this)}n.__esModule=!0,n.HandlebarsEnvironment=i;var o=e("./utils"),a=e("./exception"),s=r(a),u=e("./helpers"),c=e("./decorators"),l=e("./logger"),f=r(l),h="4.0.5";n.VERSION=h;var d=7;n.COMPILER_REVISION=d;var p={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0"};n.REVISION_CHANGES=p;var v="[object Object]";i.prototype={constructor:i,logger:f["default"],log:f["default"].log,registerHelper:function(e,t){if(o.toString.call(e)===v){if(t)throw new s["default"]("Arg not supported with multiple helpers");o.extend(this.helpers,e)}else this.helpers[e]=t},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,t){if(o.toString.call(e)===v)o.extend(this.partials,e);else{if("undefined"==typeof t)throw new s["default"]('Attempting to register a partial called "'+e+'" as undefined');this.partials[e]=t}},unregisterPartial:function(e){delete this.partials[e]},registerDecorator:function(e,t){if(o.toString.call(e)===v){if(t)throw new s["default"]("Arg not supported with multiple decorators");o.extend(this.decorators,e)}else this.decorators[e]=t},unregisterDecorator:function(e){delete this.decorators[e]}};var m=f["default"].log;n.log=m,n.createFrame=o.createFrame,n.logger=f["default"]},{"./decorators":36,"./exception":38,"./helpers":39,"./logger":47,"./utils":51}],36:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){a["default"](e)}n.__esModule=!0,n.registerDefaultDecorators=i;var o=e("./decorators/inline"),a=r(o)},{"./decorators/inline":37}],37:[function(e,t,n){"use strict";n.__esModule=!0;var r=e("../utils");n["default"]=function(e){e.registerDecorator("inline",function(e,t,n,i){var o=e;return t.partials||(t.partials={},o=function(i,o){var a=n.partials;n.partials=r.extend({},a,t.partials);var s=e(i,o);return n.partials=a,s}),t.partials[i.args[0]]=i.fn,o})},t.exports=n["default"]},{"../utils":51}],38:[function(e,t,n){"use strict";function r(e,t){var n=t&&t.loc,o=void 0,a=void 0;n&&(o=n.start.line,a=n.start.column,e+=" - "+o+":"+a);for(var s=Error.prototype.constructor.call(this,e),u=0;u0?(n.ids&&(n.ids=[n.name]),e.helpers.each(t,n)):i(this);if(n.data&&n.ids){var a=r.createFrame(n.data);a.contextPath=r.appendContextPath(n.data.contextPath,n.name),n={data:a}}return o(t,n)})},t.exports=n["default"]},{"../utils":51}],41:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}n.__esModule=!0;var i=e("../utils"),o=e("../exception"),a=r(o);n["default"]=function(e){e.registerHelper("each",function(e,t){function n(t,n,o){c&&(c.key=t,c.index=n,c.first=0===n,c.last=!!o,l&&(c.contextPath=l+t)),u+=r(e[t],{data:c,blockParams:i.blockParams([e[t],t],[l+t,null])})}if(!t)throw new a["default"]("Must pass iterator to #each");var r=t.fn,o=t.inverse,s=0,u="",c=void 0,l=void 0;if(t.data&&t.ids&&(l=i.appendContextPath(t.data.contextPath,t.ids[0])+"."),i.isFunction(e)&&(e=e.call(this)),t.data&&(c=i.createFrame(t.data)),e&&"object"==typeof e)if(i.isArray(e))for(var f=e.length;f>s;s++)s in e&&n(s,s,s===e.length-1);else{var h=void 0;for(var d in e)e.hasOwnProperty(d)&&(void 0!==h&&n(h,s-1),h=d,s++);void 0!==h&&n(h,s-1,!0)}return 0===s&&(u=o(this)),u})},t.exports=n["default"]},{"../exception":38,"../utils":51}],42:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}n.__esModule=!0;var i=e("../exception"),o=r(i);n["default"]=function(e){e.registerHelper("helperMissing",function(){if(1!==arguments.length)throw new o["default"]('Missing helper: "'+arguments[arguments.length-1].name+'"')})},t.exports=n["default"]},{"../exception":38}],43:[function(e,t,n){"use strict";n.__esModule=!0;var r=e("../utils");n["default"]=function(e){e.registerHelper("if",function(e,t){return r.isFunction(e)&&(e=e.call(this)),!t.hash.includeZero&&!e||r.isEmpty(e)?t.inverse(this):t.fn(this)}),e.registerHelper("unless",function(t,n){return e.helpers["if"].call(this,t,{fn:n.inverse,inverse:n.fn,hash:n.hash})})},t.exports=n["default"]},{"../utils":51}],44:[function(e,t,n){"use strict";n.__esModule=!0,n["default"]=function(e){e.registerHelper("log",function(){for(var t=[void 0],n=arguments[arguments.length-1],r=0;r=0?t:parseInt(e,10)}return e},log:function(e){if(e=i.lookupLevel(e),"undefined"!=typeof console&&i.lookupLevel(i.level)<=e){var t=i.methodMap[e];console[t]||(t="log");for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;n>o;o++)r[o-1]=arguments[o];console[t].apply(console,r)}}};n["default"]=i,t.exports=n["default"]},{"./utils":51}],48:[function(e,t,n){(function(e){"use strict";n.__esModule=!0,n["default"]=function(t){var n="undefined"!=typeof e?e:window,r=n.Handlebars;t.noConflict=function(){return n.Handlebars===t&&(n.Handlebars=r),t}},t.exports=n["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],49:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e){var t=e&&e[0]||1,n=g.COMPILER_REVISION;if(t!==n){if(n>t){var r=g.REVISION_CHANGES[n],i=g.REVISION_CHANGES[t];throw new m["default"]("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+r+") or downgrade your runtime to an older version ("+i+").")}throw new m["default"]("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+e[1]+").")}}function a(e,t){function n(n,r,i){i.hash&&(r=p.extend({},r,i.hash),i.ids&&(i.ids[0]=!0)),n=t.VM.resolvePartial.call(this,n,r,i);var o=t.VM.invokePartial.call(this,n,r,i);if(null==o&&t.compile&&(i.partials[i.name]=t.compile(n,e.compilerOptions,t),o=i.partials[i.name](r,i)),null!=o){if(i.indent){for(var a=o.split("\n"),s=0,u=a.length;u>s&&(a[s]||s+1!==u);s++)a[s]=i.indent+a[s];o=a.join("\n")}return o}throw new m["default"]("The partial "+i.name+" could not be compiled when running in runtime-only mode")}function r(t){function n(t){return""+e.main(i,t,i.helpers,i.partials,a,u,s)}var o=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],a=o.data;r._setup(o),!o.partial&&e.useData&&(a=f(t,a));var s=void 0,u=e.useBlockParams?[]:void 0;return e.useDepths&&(s=o.depths?t!==o.depths[0]?[t].concat(o.depths):o.depths:[t]),(n=h(e.main,n,i,o.depths||[],a,u))(t,o)}if(!t)throw new m["default"]("No environment passed to template");if(!e||!e.main)throw new m["default"]("Unknown template object: "+typeof e);e.main.decorator=e.main_d,t.VM.checkRevision(e.compiler);var i={strict:function(e,t){if(!(t in e))throw new m["default"]('"'+t+'" not defined in '+e);return e[t]},lookup:function(e,t){for(var n=e.length,r=0;n>r;r++)if(e[r]&&null!=e[r][t])return e[r][t]},lambda:function(e,t){return"function"==typeof e?e.call(t):e},escapeExpression:p.escapeExpression,invokePartial:n,fn:function(t){var n=e[t];return n.decorator=e[t+"_d"],n},programs:[],program:function(e,t,n,r,i){var o=this.programs[e],a=this.fn(e);return t||i||r||n?o=s(this,e,a,t,n,r,i):o||(o=this.programs[e]=s(this,e,a)),o},data:function(e,t){for(;e&&t--;)e=e._parent;return e},merge:function(e,t){var n=e||t;return e&&t&&e!==t&&(n=p.extend({},t,e)),n},noop:t.VM.noop,compilerInfo:e.compiler};return r.isTop=!0,r._setup=function(n){n.partial?(i.helpers=n.helpers,i.partials=n.partials,i.decorators=n.decorators):(i.helpers=i.merge(n.helpers,t.helpers),e.usePartial&&(i.partials=i.merge(n.partials,t.partials)),(e.usePartial||e.useDecorators)&&(i.decorators=i.merge(n.decorators,t.decorators)))},r._child=function(t,n,r,o){if(e.useBlockParams&&!r)throw new m["default"]("must pass block params");if(e.useDepths&&!o)throw new m["default"]("must pass parent depths");return s(i,t,e[t],n,0,r,o)},r}function s(e,t,n,r,i,o,a){function s(t){var i=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],s=a;return a&&t!==a[0]&&(s=[t].concat(a)),n(e,t,e.helpers,e.partials,i.data||r,o&&[i.blockParams].concat(o),s)}return s=h(n,s,e,a,r,o),s.program=t,s.depth=a?a.length:0,s.blockParams=i||0,s}function u(e,t,n){return e?e.call||n.name||(n.name=e,e=n.partials[e]):e="@partial-block"===n.name?n.data["partial-block"]:n.partials[n.name],e}function c(e,t,n){n.partial=!0,n.ids&&(n.data.contextPath=n.ids[0]||n.data.contextPath);var r=void 0;if(n.fn&&n.fn!==l&&(n.data=g.createFrame(n.data),r=n.data["partial-block"]=n.fn,r.partials&&(n.partials=p.extend({},n.partials,r.partials))),void 0===e&&r&&(e=r),void 0===e)throw new m["default"]("The partial "+n.name+" could not be found");return e instanceof Function?e(t,n):void 0}function l(){return""}function f(e,t){return t&&"root"in t||(t=t?g.createFrame(t):{},t.root=e),t}function h(e,t,n,r,i,o){if(e.decorator){var a={};t=e.decorator(t,a,n,r&&r[0],i,o,r),p.extend(t,a)}return t}n.__esModule=!0,n.checkRevision=o,n.template=a,n.wrapProgram=s,n.resolvePartial=u,n.invokePartial=c,n.noop=l;var d=e("./utils"),p=i(d),v=e("./exception"),m=r(v),g=e("./base")},{"./base":35,"./exception":38,"./utils":51}],50:[function(e,t,n){"use strict";function r(e){this.string=e}n.__esModule=!0,r.prototype.toString=r.prototype.toHTML=function(){return""+this.string},n["default"]=r,t.exports=n["default"]},{}],51:[function(e,t,n){"use strict";function r(e){return f[e]}function i(e){for(var t=1;tn;n++)if(e[n]===t)return n;return-1}function a(e){if("string"!=typeof e){if(e&&e.toHTML)return e.toHTML();if(null==e)return"";if(!e)return e+"";e=""+e}return d.test(e)?e.replace(h,r):e}function s(e){return e||0===e?!(!m(e)||0!==e.length):!0}function u(e){var t=i({},e);return t._parent=e,t}function c(e,t){return e.path=t,e}function l(e,t){return(e?e+".":"")+t}n.__esModule=!0,n.extend=i,n.indexOf=o,n.escapeExpression=a,n.isEmpty=s,n.createFrame=u,n.blockParams=c,n.appendContextPath=l;var f={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},h=/[&<>"'`=]/g,d=/[&<>"'`=]/,p=Object.prototype.toString;n.toString=p;var v=function(e){return"function"==typeof e};v(/x/)&&(n.isFunction=v=function(e){return"function"==typeof e&&"[object Function]"===p.call(e)}),n.isFunction=v;var m=Array.isArray||function(e){return e&&"object"==typeof e?"[object Array]"===p.call(e):!1};n.isArray=m},{}],52:[function(e,t,n){t.exports=e("./dist/cjs/handlebars.runtime")["default"]},{"./dist/cjs/handlebars.runtime":34}],53:[function(e,t,n){function r(){}var i=e("./_nativeCreate"),o=Object.prototype;r.prototype=i?i(null):o,t.exports=r},{"./_nativeCreate":108}],54:[function(e,t,n){var r=e("./_getNative"),i=e("./_root"),o=r(i,"Map");t.exports=o},{"./_getNative":86,"./_root":109}],55:[function(e,t,n){function r(e){var t=-1,n=e?e.length:0;for(this.clear();++t-1}var i=e("./_baseIndexOf");t.exports=r},{"./_baseIndexOf":73}],60:[function(e,t,n){function r(e,t,n){for(var r=-1,i=e.length;++rn)return!1;var r=e.length-1;return n==r?e.pop():a.call(e,n,1),!0}var i=e("./_assocIndexOf"),o=Array.prototype,a=o.splice;t.exports=r},{"./_assocIndexOf":68}],66:[function(e,t,n){function r(e,t){var n=i(e,t);return 0>n?void 0:e[n][1]}var i=e("./_assocIndexOf");t.exports=r},{"./_assocIndexOf":68}],67:[function(e,t,n){function r(e,t){return i(e,t)>-1}var i=e("./_assocIndexOf");t.exports=r},{"./_assocIndexOf":68}],68:[function(e,t,n){function r(e,t){for(var n=e.length;n--;)if(i(e[n][0],t))return n;return-1}var i=e("./eq");t.exports=r},{"./eq":113}],69:[function(e,t,n){function r(e,t,n){var r=i(e,t);0>r?e.push([t,n]):e[r][1]=n}var i=e("./_assocIndexOf");t.exports=r},{"./_assocIndexOf":68}],70:[function(e,t,n){function r(e,t,n,r){var f=-1,h=o,d=!0,p=e.length,v=[],m=t.length;if(!p)return v;n&&(t=s(t,u(n))),r?(h=a,d=!1):t.length>=l&&(h=c,d=!1,t=new i(t));e:for(;++f0&&n(l)?t>1?r(l,t-1,n,a,s):i(s,l):a||(s[s.length]=l)}return s}var i=e("./_arrayPush"),o=e("./_isFlattenable");t.exports=r},{"./_arrayPush":62,"./_isFlattenable":96}],72:[function(e,t,n){function r(e,t,n){var r=t(e);return o(e)?r:i(r,n(e))}var i=e("./_arrayPush"),o=e("./isArray");t.exports=r},{"./_arrayPush":62,"./isArray":115}],73:[function(e,t,n){function r(e,t,n){if(t!==t)return i(e,n);for(var r=n-1,o=e.length;++r1?n[o-1]:void 0,s=o>2?n[2]:void 0;for(a="function"==typeof a?(o--,a):void 0,s&&i(n[0],n[1],s)&&(a=3>o?void 0:a,o=1),t=Object(t);++r-1&&e%1==0&&t>e}var i=9007199254740991,o=/^(?:0|[1-9]\d*)$/;t.exports=r},{}],99:[function(e,t,n){function r(e,t,n){if(!s(n))return!1;var r=typeof t;return("number"==r?o(n)&&a(t,n.length):"string"==r&&t in n)?i(n[t],e):!1}var i=e("./eq"),o=e("./isArrayLike"),a=e("./_isIndex"),s=e("./isObject");t.exports=r},{"./_isIndex":98,"./eq":113,"./isArrayLike":116,"./isObject":121}],100:[function(e,t,n){function r(e){var t=typeof e;return"number"==t||"boolean"==t||"string"==t&&"__proto__"!=e||null==e}t.exports=r},{}],101:[function(e,t,n){function r(e){var t=e&&e.constructor,n="function"==typeof t&&t.prototype||i;return e===n}var i=Object.prototype;t.exports=r},{}],102:[function(e,t,n){function r(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}t.exports=r},{}],103:[function(e,t,n){function r(){this.__data__={hash:new i,map:o?new o:[],string:new i}}var i=e("./_Hash"),o=e("./_Map");t.exports=r},{"./_Hash":53,"./_Map":54}],104:[function(e,t,n){function r(e){var t=this.__data__;return s(e)?a("string"==typeof e?t.string:t.hash,e):i?t.map["delete"](e):o(t.map,e)}var i=e("./_Map"),o=e("./_assocDelete"),a=e("./_hashDelete"),s=e("./_isKeyable");t.exports=r},{"./_Map":54,"./_assocDelete":65,"./_hashDelete":90,"./_isKeyable":100}],105:[function(e,t,n){function r(e){var t=this.__data__;return s(e)?a("string"==typeof e?t.string:t.hash,e):i?t.map.get(e):o(t.map,e)}var i=e("./_Map"),o=e("./_assocGet"),a=e("./_hashGet"),s=e("./_isKeyable");t.exports=r},{"./_Map":54,"./_assocGet":66,"./_hashGet":91,"./_isKeyable":100}],106:[function(e,t,n){function r(e){var t=this.__data__;return s(e)?a("string"==typeof e?t.string:t.hash,e):i?t.map.has(e):o(t.map,e)}var i=e("./_Map"),o=e("./_assocHas"),a=e("./_hashHas"),s=e("./_isKeyable");t.exports=r},{"./_Map":54,"./_assocHas":67,"./_hashHas":92,"./_isKeyable":100}],107:[function(e,t,n){function r(e,t){var n=this.__data__;return s(e)?a("string"==typeof e?n.string:n.hash,e,t):i?n.map.set(e,t):o(n.map,e,t),this}var i=e("./_Map"),o=e("./_assocSet"),a=e("./_hashSet"),s=e("./_isKeyable");t.exports=r},{"./_Map":54,"./_assocSet":69,"./_hashSet":93,"./_isKeyable":100}],108:[function(e,t,n){var r=e("./_getNative"),i=r(Object,"create");t.exports=i},{"./_getNative":86}],109:[function(e,t,n){(function(r){var i=e("./_checkGlobal"),o={"function":!0,object:!0},a=o[typeof n]&&n&&!n.nodeType?n:void 0,s=o[typeof t]&&t&&!t.nodeType?t:void 0,u=i(a&&s&&"object"==typeof r&&r),c=i(o[typeof self]&&self),l=i(o[typeof window]&&window),f=i(o[typeof this]&&this),h=u||l!==(f&&f.window)&&l||c||f||Function("return this")();t.exports=h}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_checkGlobal":81}],110:[function(e,t,n){function r(e){return"string"==typeof e||i(e)?e:e+""}var i=e("./isSymbol");t.exports=r},{"./isSymbol":124}],111:[function(e,t,n){function r(e){if(null!=e){try{return i.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var i=Function.prototype.toString;t.exports=r},{}],112:[function(e,t,n){var r=e("./_assignValue"),i=e("./_copyObject"),o=e("./_createAssigner"),a=e("./isArrayLike"),s=e("./_isPrototype"),u=e("./keysIn"),c=Object.prototype,l=c.propertyIsEnumerable,f=!l.call({valueOf:1},"valueOf"),h=o(function(e,t){if(f||s(t)||a(t))return void i(t,u(t),e);for(var n in t)r(e,n,t[n])});t.exports=h},{"./_assignValue":64,"./_copyObject":82,"./_createAssigner":83,"./_isPrototype":101,"./isArrayLike":116,"./keysIn":125}],113:[function(e,t,n){function r(e,t){return e===t||e!==e&&t!==t}t.exports=r},{}],114:[function(e,t,n){function r(e){return i(e)&&s.call(e,"callee")&&(!c.call(e,"callee")||u.call(e)==o)}var i=e("./isArrayLikeObject"),o="[object Arguments]",a=Object.prototype,s=a.hasOwnProperty,u=a.toString,c=a.propertyIsEnumerable;t.exports=r},{"./isArrayLikeObject":117}],115:[function(e,t,n){var r=Array.isArray;t.exports=r},{}],116:[function(e,t,n){function r(e){return null!=e&&a(i(e))&&!o(e)}var i=e("./_getLength"),o=e("./isFunction"),a=e("./isLength");t.exports=r},{"./_getLength":85,"./isFunction":118,"./isLength":119}],117:[function(e,t,n){function r(e){return o(e)&&i(e)}var i=e("./isArrayLike"),o=e("./isObjectLike");t.exports=r},{"./isArrayLike":116,"./isObjectLike":122}],118:[function(e,t,n){function r(e){var t=i(e)?u.call(e):"";return t==o||t==a}var i=e("./isObject"),o="[object Function]",a="[object GeneratorFunction]",s=Object.prototype,u=s.toString;t.exports=r},{"./isObject":121}],119:[function(e,t,n){function r(e){return"number"==typeof e&&e>-1&&e%1==0&&i>=e}var i=9007199254740991;t.exports=r},{}],120:[function(e,t,n){function r(e){if(!a(e))return!1;var t=i(e)||o(e)?d:c;return t.test(s(e))}var i=e("./isFunction"),o=e("./_isHostObject"),a=e("./isObject"),s=e("./_toSource"),u=/[\\^$.*+?()[\]{}|]/g,c=/^\[object .+?Constructor\]$/,l=Object.prototype,f=Function.prototype.toString,h=l.hasOwnProperty,d=RegExp("^"+f.call(h).replace(u,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=r},{"./_isHostObject":97,"./_toSource":111,"./isFunction":118,"./isObject":121}],121:[function(e,t,n){function r(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}t.exports=r},{}],122:[function(e,t,n){function r(e){return!!e&&"object"==typeof e}t.exports=r},{}],123:[function(e,t,n){function r(e){return"string"==typeof e||!i(e)&&o(e)&&u.call(e)==a}var i=e("./isArray"),o=e("./isObjectLike"),a="[object String]",s=Object.prototype,u=s.toString;t.exports=r},{"./isArray":115,"./isObjectLike":122}],124:[function(e,t,n){function r(e){return"symbol"==typeof e||i(e)&&s.call(e)==o}var i=e("./isObjectLike"),o="[object Symbol]",a=Object.prototype,s=a.toString;t.exports=r},{"./isObjectLike":122}],125:[function(e,t,n){function r(e){for(var t=-1,n=s(e),r=i(e),u=r.length,l=o(e),f=!!l,h=l||[],d=h.length;++t-1}function d(e,t,n){for(var r=-1,i=e.length;++r-1;);return n}function C(e,t){for(var n=e.length;n--&&x(t,e[n],0)>-1;);return n}function q(e){return e&&e.Object===Object?e:null}function L(e,t){if(e!==t){var n=null===e,r=e===Q,i=e===e,o=null===t,a=t===Q,s=t===t;if(e>t&&!o||!i||n&&!a&&s||r&&s)return 1;if(t>e&&!n||!s||o&&!r&&i||a&&i)return-1}return 0}function R(e,t,n){for(var r=-1,i=e.criteria,o=t.criteria,a=i.length,s=n.length;++r=s)return u;var c=n[r];return u*("desc"==c?-1:1)}}return e.index-t.index}function P(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&r++;return r}function N(e){return function(t,n){var r;return t===Q&&n===Q?0:(t!==Q&&(r=t),n!==Q&&(r=r===Q?n:e(r,n)),r)}}function F(e){return Dn[e]}function U(e){return In[e]}function H(e){return"\\"+qn[e]}function Y(e,t,n){for(var r=e.length,i=t+(n?0:-1);n?i--:++i-1&&e%1==0&&t>e}function V(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}function $(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function G(e,t){for(var n=-1,r=e.length,i=0,o=[];++nt,i=n?e.length:0,o=Ti(0,i,this.__views__),a=o.start,s=o.end,u=s-a,c=r?s:a-1,l=this.__iteratees__,f=l.length,h=0,d=Nc(u,this.__takeCount__);if(!n||te>i||i==u&&d==u)return Ir(e,this.__actions__);var p=[];e:for(;u--&&d>h;){c+=t;for(var v=-1,m=e[c];++vn)return!1;var r=e.length-1;return n==r?e.pop():Dc.call(e,n,1),!0}function sn(e,t){var n=cn(e,t);return 0>n?Q:e[n][1]}function un(e,t){return cn(e,t)>-1}function cn(e,t){for(var n=e.length;n--;)if(Ha(e[n][0],t))return n;return-1}function ln(e,t,n){var r=cn(e,t);0>r?e.push([t,n]):e[r][1]=n}function fn(e,t,n,r){return e===Q||Ha(e,lc[n])&&!dc.call(r,n)?t:e}function hn(e,t,n){(n===Q||Ha(e[t],n))&&("number"!=typeof t||n!==Q||t in e)||(e[t]=n)}function dn(e,t,n){var r=e[t];dc.call(e,t)&&Ha(r,n)&&(n!==Q||t in e)||(e[t]=n)}function pn(e,t,n,r){return sl(e,function(e,i,o){t(r,e,n(e),o)}),r}function vn(e,t){return e&&Jr(t,$s(t),e)}function mn(e,t){for(var n=-1,r=null==e,i=t.length,o=Array(i);++n=e?e:n),t!==Q&&(e=e>=t?e:t)),e}function yn(e,t,n,r,i,o,a){var s;if(r&&(s=o?r(e,i,o,a):r(e)),s!==Q)return s;if(!os(e))return e;var c=Zl(e);if(c){if(s=Ii(e),!t)return zr(e,s)}else{var l=ji(e),f=l==Re||l==Pe;if(Xl(e))return Nr(e,t);if(l==Ue||l==Ie||f&&!o){if(B(e))return o?e:{};if(s=Mi(f?{}:e),!t)return Kr(e,vn(s,e))}else{if(!Tn[l])return o?e:{};s=Ci(e,l,yn,t)}}a||(a=new Qt);var h=a.get(e);if(h)return h;if(a.set(e,s),!c)var d=n?_i(e):$s(e);return u(d||e,function(i,o){d&&(o=i,i=e[o]),dn(s,o,yn(i,t,n,r,o,e,a))}),s}function _n(e){var t=$s(e),n=t.length;return function(r){if(null==r)return!n;for(var i=n;i--;){var o=t[i],a=e[o],s=r[o];if(s===Q&&!(o in Object(r))||!a(s))return!1}return!0}}function xn(e){return os(e)?Ac(e):{}}function Dn(e,t,n){if("function"!=typeof e)throw new uc(ne);return Tc(function(){e.apply(Q,n)},t)}function In(e,t,n,r){var i=-1,o=h,a=!0,s=e.length,u=[],c=t.length;if(!s)return u;n&&(t=p(t,D(n))),r?(o=d,a=!1):t.length>=te&&(o=Zt,a=!1,t=new Kt(t));e:for(;++in&&(n=-n>i?0:i+n),r=r===Q||r>i?i:js(r),0>r&&(r+=i),r=n>r?0:Ts(r);r>n;)e[n++]=t;return e}function qn(e,t){var n=[];return sl(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}function Pn(e,t,n,r,i){var o=-1,a=e.length;for(n||(n=Li),i||(i=[]);++o0&&n(s)?t>1?Pn(s,t-1,n,r,i):v(i,s):r||(i[i.length]=s)}return i}function Nn(e,t){return e&&cl(e,t,$s)}function Un(e,t){return e&&ll(e,t,$s)}function Hn(e,t){return f(t,function(t){return ns(e[t])})}function Yn(e,t){t=Ni(t,e)?[t]:Rr(t);for(var n=0,r=t.length;null!=e&&r>n;)e=e[t[n++]];return n&&n==r?e:Q}function Bn(e,t,n){var r=t(e);return Zl(e)?r:v(r,n(e))}function $n(e,t){return dc.call(e,t)||"object"==typeof e&&t in e&&null===Oi(e)}function Gn(e,t){return t in Object(e)}function zn(e,t,n){return e>=Nc(t,n)&&e=120&&l.length>=120)?new Kt(a&&l):Q}l=e[0];var f=-1,v=s[0];e:for(;++ft?n:0,W(t,n)?e[t]:Q}function lr(e,t,n){var r=-1;t=p(t.length?t:[Pu],D(xi()));var i=ir(e,function(e,n,i){var o=p(t,function(t){return t(e)});return{criteria:o,index:++r,value:e}});return O(i,function(e,t){return R(e,t,n)})}function fr(e,t){return e=Object(e),m(t,function(t,n){return n in e&&(t[n]=e[n]),t},{})}function hr(e,t){for(var n=-1,r=bi(e),i=r.length,o={};++n-1;)s!==e&&Dc.call(s,u,1),Dc.call(e,u,1);return e}function mr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(r==n||i!=o){var o=i;if(W(i))Dc.call(e,i,1);else if(Ni(i,e))delete e[i];else{var a=Rr(i),s=$i(e,a);null!=s&&delete s[mo(a)]}}}return e}function gr(e,t){return e+Mc(Uc()*(t-e+1))}function yr(e,t,n,r){for(var i=-1,o=Pc(Ic((t-e)/(n||1)),0),a=Array(o);o--;)a[r?o:++i]=e,e+=n;return a}function _r(e,t){var n="";if(!e||1>t||t>Ee)return n;do t%2&&(n+=e),t=Mc(t/2),t&&(e+=e);while(t);return n}function br(e,t,n,r){t=Ni(t,e)?[t]:Rr(t);for(var i=-1,o=t.length,a=o-1,s=e;null!=s&&++it&&(t=-t>i?0:i+t),n=n>i?i:n,0>n&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r=i){for(;i>r;){var o=r+i>>>1,a=e[o];(n?t>=a:t>a)&&null!==a?r=o+1:i=o}return i}return Sr(e,t,Pu,n)}function Sr(e,t,n,r){t=n(t);for(var i=0,o=e?e.length:0,a=t!==t,s=null===t,u=t===Q;o>i;){var c=Mc((i+o)/2),l=n(e[c]),f=l!==Q,h=l===l;if(a)var d=h||r;else d=s?h&&f&&(r||null!=l):u?h&&(r||f):null==l?!1:r?t>=l:t>l;d?i=c+1:o=c}return Nc(o,Te)}function Er(e){return Or(e)}function Or(e,t){for(var n=0,r=e.length,i=e[0],o=t?t(i):i,a=o,s=1,u=[i];++n=te){var c=t?null:hl(e);if(c)return z(c);a=!1,i=Zt,u=new Kt}else u=t?[]:s;e:for(;++rr?t[r]:Q;n(a,e[r],s)}return a}function qr(e){return Ga(e)?e:[]}function Lr(e){return"function"==typeof e?e:Pu}function Rr(e){return Zl(e)?e:gl(e)}function Pr(e,t,n){var r=e.length;return n=n===Q?r:n,!t&&n>=r?e:wr(e,t,n)}function Nr(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}function Fr(e){var t=new e.constructor(e.byteLength);return new xc(t).set(new xc(e)),t}function Ur(e,t){var n=t?Fr(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Hr(e,t,n){var i=t?n($(e),!0):$(e);return m(i,r,new e.constructor)}function Yr(e){var t=new e.constructor(e.source,Ot.exec(e));return t.lastIndex=e.lastIndex,t}function Br(e,t,n){var r=t?n(z(e),!0):z(e);return m(r,i,new e.constructor)}function Wr(e){return ol?Object(ol.call(e)):{}}function Vr(e,t){var n=t?Fr(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function $r(e,t,n,r){for(var i=-1,o=e.length,a=n.length,s=-1,u=t.length,c=Pc(o-a,0),l=Array(u+c),f=!r;++si)&&(l[n[i]]=e[i]);for(;c--;)l[s++]=e[i++];return l}function Gr(e,t,n,r){for(var i=-1,o=e.length,a=-1,s=n.length,u=-1,c=t.length,l=Pc(o-s,0),f=Array(l+c),h=!r;++ii)&&(f[d+n[a]]=e[i++]);return f}function zr(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n1?n[i-1]:Q,a=i>2?n[2]:Q;for(o="function"==typeof o?(i--,o):Q,a&&Pi(n[0],n[1],a)&&(o=3>i?Q:o,i=1),t=Object(t);++ra&&s[0]!==c&&s[a-1]!==c?[]:G(s,c);if(a-=l.length,n>a)return di(e,t,si,r.placeholder,Q,s,l,Q,Q,n-a);var f=this&&this!==Wn&&this instanceof r?i:e;return o(f,this,s)}var i=ii(e);return r}function ai(e){return Ia(function(t){t=Pn(t,1);var n=t.length,r=n,i=q.prototype.thru;for(e&&t.reverse();r--;){var o=t[r];if("function"!=typeof o)throw new uc(ne);if(i&&!a&&"wrapper"==wi(o))var a=new q([],!0)}for(r=a?r:n;++r=te)return a.plant(r).value();for(var i=0,o=n?t[i].apply(this,e):r;++ig){var x=G(_,b);return di(e,t,si,l.placeholder,n,_,x,s,u,c-g)}var k=h?n:this,S=d?k[e]:e;return g=_.length,s?_=Gi(_,s):v&&g>1&&_.reverse(),f&&g>u&&(_.length=u),this&&this!==Wn&&this instanceof l&&(S=m||ii(S)),S.apply(k,_)}var f=t&he,h=t&oe,d=t&ae,p=t&(ue|ce),v=t&pe,m=d?Q:ii(e);return l}function ui(e,t){return function(n,r){return Kn(n,e,t(r),{})}}function ci(e){return Ia(function(t){return t=1==t.length&&Zl(t[0])?p(t[0],D(xi())):p(Pn(t,1,Ri),D(xi())),Ia(function(n){var r=this;return e(t,function(e){return o(e,r,n)})})})}function li(e,t){t=t===Q?" ":t+"";var n=t.length;if(2>n)return n?_r(t,e):t;var r=_r(t,Ic(e/J(t)));return Sn.test(t)?Pr(K(r),0,e).join(""):r.slice(0,e)}function fi(e,t,n,r){function i(){for(var t=-1,u=arguments.length,c=-1,l=r.length,f=Array(l+u),h=this&&this!==Wn&&this instanceof i?s:e;++ct?1:-1:Ds(r)||0,yr(t,n,r,e)}}function di(e,t,n,r,i,o,a,s,u,c){var l=t&ue,f=l?a:Q,h=l?Q:a,d=l?o:Q,p=l?Q:o;t|=l?le:fe,t&=~(l?fe:le), +t&se||(t&=~(oe|ae));var v=[e,t,i,d,f,p,h,s,u,c],m=n.apply(Q,v);return Ui(e)&&ml(m,v),m.placeholder=r,m}function pi(e){var t=ac[e];return function(e,n){if(e=Ds(e),n=js(n)){var r=(Cs(e)+"e").split("e"),i=t(r[0]+"e"+(+r[1]+n));return r=(Cs(i)+"e").split("e"),+(r[0]+"e"+(+r[1]-n))}return t(e)}}function vi(e,t,n,r,i,o,a,s){var u=t&ae;if(!u&&"function"!=typeof e)throw new uc(ne);var c=r?r.length:0;if(c||(t&=~(le|fe),r=i=Q),a=a===Q?a:Pc(js(a),0),s=s===Q?s:js(s),c-=i?i.length:0,t&fe){var l=r,f=i;r=i=Q}var h=u?Q:dl(e),d=[e,t,n,r,i,l,f,o,a,s];if(h&&Wi(d,h),e=d[0],t=d[1],n=d[2],r=d[3],i=d[4],s=d[9]=null==d[9]?u?0:e.length:Pc(d[9]-c,0),!s&&t&(ue|ce)&&(t&=~(ue|ce)),t&&t!=oe)p=t==ue||t==ce?oi(e,t,s):t!=le&&t!=(oe|le)||i.length?si.apply(Q,d):fi(e,t,n,r);else var p=ti(e,t,n);var v=h?fl:ml;return v(p,d)}function mi(e,t,n,r,i,o){var a=-1,s=i&me,u=i&ve,c=e.length,l=t.length;if(c!=l&&!(s&&l>c))return!1;var f=o.get(e);if(f)return f==t;var h=!0;for(o.set(e,t);++ai,a=r==he&&n==ue||r==he&&n==de&&e[7].length<=t[8]||r==(he|de)&&t[7].length<=t[8]&&n==ue;if(!o&&!a)return e;r&oe&&(e[2]=t[2],i|=n&oe?0:se);var s=t[3];if(s){var u=e[3];e[3]=u?$r(u,s,t[4]):s,e[4]=u?G(e[3],ie):t[4]}return s=t[5],s&&(u=e[5],e[5]=u?Gr(u,s,t[6]):s,e[6]=u?G(e[5],ie):t[6]),s=t[7],s&&(e[7]=s),r&he&&(e[8]=null==e[8]?t[8]:Nc(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}function Vi(e,t,n,r,i,o){return os(e)&&os(t)&&sr(e,t,Q,Vi,o.set(t,e)),e}function $i(e,t){return 1==t.length?e:Yn(e,wr(t,0,-1))}function Gi(e,t){for(var n=e.length,r=Nc(t.length,n),i=zr(e);r--;){var o=t[r];e[r]=W(o,n)?i[o]:Q}return e}function zi(e){return"string"==typeof e||bs(e)?e:e+""}function Ji(e){if(null!=e){try{return hc.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Ki(e){if(e instanceof Mt)return e.clone();var t=new q(e.__wrapped__,e.__chain__);return t.__actions__=zr(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function Zi(e,t,n){t=(n?Pi(e,t,n):t===Q)?1:Pc(js(t),0);var r=e?e.length:0;if(!r||1>t)return[];for(var i=0,o=0,a=Array(Ic(r/t));r>i;)a[o++]=wr(e,i,i+=t);return a}function Xi(e){for(var t=-1,n=e?e.length:0,r=0,i=[];++te)return e?zr(t):[];for(var n=Array(e-1);e--;)n[e-1]=arguments[e];return s(t,Pn(n,1))}function eo(e,t,n){var r=e?e.length:0;return r?(t=n||t===Q?1:js(t),wr(e,0>t?0:t,r)):[]}function to(e,t,n){var r=e?e.length:0;return r?(t=n||t===Q?1:js(t),t=r-t,wr(e,0,0>t?0:t)):[]}function no(e,t){return e&&e.length?Dr(e,xi(t,3),!0,!0):[]}function ro(e,t){return e&&e.length?Dr(e,xi(t,3),!0):[]}function io(e,t,n,r){var i=e?e.length:0;return i?(n&&"number"!=typeof n&&Pi(e,t,n)&&(n=0,r=i),Cn(e,t,n,r)):[]}function oo(e,t){return e&&e.length?w(e,xi(t,3)):-1}function ao(e,t){return e&&e.length?w(e,xi(t,3),!0):-1}function so(e){var t=e?e.length:0;return t?Pn(e,1):[]}function uo(e){var t=e?e.length:0;return t?Pn(e,Se):[]}function co(e,t){var n=e?e.length:0;return n?(t=t===Q?1:js(t),Pn(e,t)):[]}function lo(e){for(var t=-1,n=e?e.length:0,r={};++tn&&(n=Pc(r+n,0)),x(e,t,n)):-1}function po(e){return to(e,1)}function vo(e,t){return e?Lc.call(e,t):""}function mo(e){var t=e?e.length:0;return t?e[t-1]:Q}function go(e,t,n){var r=e?e.length:0;if(!r)return-1;var i=r;if(n!==Q&&(i=js(n),i=(0>i?Pc(r+i,0):Nc(i,r-1))+1),t!==t)return Y(e,i,!0);for(;i--;)if(e[i]===t)return i;return-1}function yo(e,t){return e&&e.length?cr(e,js(t)):Q}function _o(e,t){return e&&e.length&&t&&t.length?vr(e,t):e}function bo(e,t,n){return e&&e.length&&t&&t.length?vr(e,t,xi(n)):e}function wo(e,t,n){return e&&e.length&&t&&t.length?vr(e,t,Q,n):e}function xo(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],o=e.length;for(t=xi(t,3);++rr&&Ha(e[r],t))return r}return-1}function jo(e,t){return kr(e,t,!0)}function To(e,t,n){return Sr(e,t,xi(n),!0)}function Do(e,t){var n=e?e.length:0;if(n){var r=kr(e,t,!0)-1;if(Ha(e[r],t))return r}return-1}function Io(e){return e&&e.length?Er(e):[]}function Mo(e,t){return e&&e.length?Or(e,xi(t)):[]}function Co(e){return eo(e,1)}function qo(e,t,n){return e&&e.length?(t=n||t===Q?1:js(t),wr(e,0,0>t?0:t)):[]}function Lo(e,t,n){var r=e?e.length:0;return r?(t=n||t===Q?1:js(t),t=r-t,wr(e,0>t?0:t,r)):[]}function Ro(e,t){return e&&e.length?Dr(e,xi(t,3),!1,!0):[]}function Po(e,t){return e&&e.length?Dr(e,xi(t,3)):[]}function No(e){return e&&e.length?Ar(e):[]}function Fo(e,t){return e&&e.length?Ar(e,xi(t)):[]}function Uo(e,t){return e&&e.length?Ar(e,Q,t):[]}function Ho(e){if(!e||!e.length)return[];var t=0;return e=f(e,function(e){return Ga(e)?(t=Pc(e.length,t),!0):void 0}),j(t,function(t){return p(e,dr(t))})}function Yo(e,t){if(!e||!e.length)return[];var n=Ho(e);return null==t?n:p(n,function(e){return o(t,Q,e)})}function Bo(e,t){return Cr(e||[],t||[],dn)}function Wo(e,t){return Cr(e||[],t||[],br)}function Vo(e){var n=t(e);return n.__chain__=!0,n}function $o(e,t){return t(e),e}function Go(e,t){return t(e)}function zo(){return Vo(this)}function Jo(){return new q(this.value(),this.__chain__)}function Ko(){this.__values__===Q&&(this.__values__=As(this.value()));var e=this.__index__>=this.__values__.length,t=e?Q:this.__values__[this.__index__++];return{done:e,value:t}}function Zo(){return this}function Xo(e){for(var t,r=this;r instanceof n;){var i=Ki(r);i.__index__=0,i.__values__=Q,t?o.__wrapped__=i:t=i;var o=i;r=r.__wrapped__}return o.__wrapped__=e,t}function Qo(){var e=this.__wrapped__;if(e instanceof Mt){var t=e;return this.__actions__.length&&(t=new Mt(this)),t=t.reverse(),t.__actions__.push({func:Go,args:[ko],thisArg:Q}),new q(t,this.__chain__)}return this.thru(ko)}function ea(){return Ir(this.__wrapped__,this.__actions__)}function ta(e,t,n){var r=Zl(e)?l:Mn;return n&&Pi(e,t,n)&&(t=Q),r(e,xi(t,3))}function na(e,t){var n=Zl(e)?f:qn;return n(e,xi(t,3))}function ra(e,t){if(t=xi(t,3),Zl(e)){var n=w(e,t);return n>-1?e[n]:Q}return b(e,t,sl)}function ia(e,t){if(t=xi(t,3),Zl(e)){var n=w(e,t,!0);return n>-1?e[n]:Q}return b(e,t,ul)}function oa(e,t){return Pn(fa(e,t),1)}function aa(e,t){return Pn(fa(e,t),Se)}function sa(e,t,n){return n=n===Q?1:js(n),Pn(fa(e,t),n)}function ua(e,t){return"function"==typeof t&&Zl(e)?u(e,t):sl(e,xi(t))}function ca(e,t){return"function"==typeof t&&Zl(e)?c(e,t):ul(e,xi(t))}function la(e,t,n,r){e=$a(e)?e:su(e),n=n&&!r?js(n):0;var i=e.length;return 0>n&&(n=Pc(i+n,0)),_s(e)?i>=n&&e.indexOf(t,n)>-1:!!i&&x(e,t,n)>-1}function fa(e,t){var n=Zl(e)?p:ir;return n(e,xi(t,3))}function ha(e,t,n,r){return null==e?[]:(Zl(t)||(t=null==t?[]:[t]),n=r?Q:n,Zl(n)||(n=null==n?[]:[n]),lr(e,t,n))}function da(e,t,n){var r=Zl(e)?m:E,i=arguments.length<3;return r(e,xi(t,4),n,i,sl)}function pa(e,t,n){var r=Zl(e)?g:E,i=arguments.length<3;return r(e,xi(t,4),n,i,ul)}function va(e,t){var n=Zl(e)?f:qn;return t=xi(t,3),n(e,function(e,n,r){return!t(e,n,r)})}function ma(e){var t=$a(e)?e:su(e),n=t.length;return n>0?t[gr(0,n-1)]:Q}function ga(e,t,n){var r=-1,i=As(e),o=i.length,a=o-1;for(t=(n?Pi(e,t,n):t===Q)?1:gn(js(t),0,o);++r0&&(n=t.apply(this,arguments)),1>=e&&(t=Q),n}}function Sa(e,t,n){t=n?Q:t;var r=vi(e,ue,Q,Q,Q,Q,Q,t);return r.placeholder=Sa.placeholder,r}function Ea(e,t,n){t=n?Q:t;var r=vi(e,ce,Q,Q,Q,Q,Q,t);return r.placeholder=Ea.placeholder,r}function Oa(e,t,n){function r(t){var n=h,r=d;return h=d=Q,y=t,v=e.apply(r,n)}function i(e){return y=e,m=Tc(s,t),_?r(e):v}function o(e){var n=e-g,r=e-y,i=t-n;return b?Nc(i,p-r):i}function a(e){var n=e-g,r=e-y;return!g||n>=t||0>n||b&&r>=p}function s(){var e=Yl();return a(e)?u(e):void(m=Tc(s,o(e)))}function u(e){return kc(m),m=Q,w&&h?r(e):(h=d=Q,v)}function c(){m!==Q&&kc(m),g=y=0,h=d=m=Q}function l(){return m===Q?v:u(Yl())}function f(){var e=Yl(),n=a(e);if(h=arguments,d=this,g=e,n){if(m===Q)return i(g);if(b)return kc(m),m=Tc(s,t),r(g)}return m===Q&&(m=Tc(s,t)),v}var h,d,p,v,m,g=0,y=0,_=!1,b=!1,w=!0;if("function"!=typeof e)throw new uc(ne);return t=Ds(t)||0,os(n)&&(_=!!n.leading,b="maxWait"in n,p=b?Pc(Ds(n.maxWait)||0,t):p,w="trailing"in n?!!n.trailing:w),f.cancel=c,f.flush=l,f}function Aa(e){return vi(e,pe)}function ja(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new uc(ne);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a),a};return n.cache=new(ja.Cache||Wt),n}function Ta(e){if("function"!=typeof e)throw new uc(ne);return function(){return!e.apply(this,arguments)}}function Da(e){return ka(2,e)}function Ia(e,t){if("function"!=typeof e)throw new uc(ne);return t=Pc(t===Q?e.length-1:js(t),0),function(){for(var n=arguments,r=-1,i=Pc(n.length-t,0),a=Array(i);++rt}function Ba(e,t){return e>=t}function Wa(e){return Ga(e)&&dc.call(e,"callee")&&(!jc.call(e,"callee")||mc.call(e)==Ie)}function Va(e){return as(e)&&mc.call(e)==ze}function $a(e){return null!=e&&is(pl(e))&&!ns(e)}function Ga(e){return as(e)&&$a(e)}function za(e){return e===!0||e===!1||as(e)&&mc.call(e)==Ce}function Ja(e){return as(e)&&mc.call(e)==qe}function Ka(e){return!!e&&1===e.nodeType&&as(e)&&!vs(e)}function Za(e){if($a(e)&&(Zl(e)||_s(e)||ns(e.splice)||Wa(e)||Xl(e)))return!e.length;if(as(e)){var t=ji(e);if(t==Ne||t==Be)return!e.size}for(var n in e)if(dc.call(e,n))return!1;return!(Zc&&$s(e).length)}function Xa(e,t){return Xn(e,t)}function Qa(e,t,n){n="function"==typeof n?n:Q;var r=n?n(e,t):Q;return r===Q?Xn(e,t,n):!!r}function es(e){return as(e)?mc.call(e)==Le||"string"==typeof e.message&&"string"==typeof e.name:!1}function ts(e){return"number"==typeof e&&qc(e)}function ns(e){var t=os(e)?mc.call(e):"";return t==Re||t==Pe}function rs(e){return"number"==typeof e&&e==js(e)}function is(e){return"number"==typeof e&&e>-1&&e%1==0&&Ee>=e}function os(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function as(e){return!!e&&"object"==typeof e}function ss(e){return as(e)&&ji(e)==Ne}function us(e,t){return e===t||er(e,t,ki(t))}function cs(e,t,n){return n="function"==typeof n?n:Q,er(e,t,ki(t),n)}function ls(e){return ps(e)&&e!=+e}function fs(e){if(!os(e))return!1;var t=ns(e)||B(e)?yc:Dt;return t.test(Ji(e))}function hs(e){return null===e}function ds(e){return null==e}function ps(e){return"number"==typeof e||as(e)&&mc.call(e)==Fe}function vs(e){if(!as(e)||mc.call(e)!=Ue||B(e))return!1;var t=Oi(e);if(null===t)return!0;var n=dc.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&hc.call(n)==vc}function ms(e){return os(e)&&mc.call(e)==Ye}function gs(e){return rs(e)&&e>=-Ee&&Ee>=e}function ys(e){return as(e)&&ji(e)==Be}function _s(e){return"string"==typeof e||!Zl(e)&&as(e)&&mc.call(e)==We}function bs(e){return"symbol"==typeof e||as(e)&&mc.call(e)==Ve}function ws(e){return as(e)&&is(e.length)&&!!jn[mc.call(e)]}function xs(e){return e===Q}function ks(e){return as(e)&&ji(e)==$e}function Ss(e){return as(e)&&mc.call(e)==Ge}function Es(e,t){return t>e}function Os(e,t){return t>=e}function As(e){if(!e)return[];if($a(e))return _s(e)?K(e):zr(e);if(Oc&&e[Oc])return V(e[Oc]());var t=ji(e),n=t==Ne?$:t==Be?z:su;return n(e)}function js(e){if(!e)return 0===e?e:0;if(e=Ds(e),e===Se||e===-Se){var t=0>e?-1:1;return t*Oe}var n=e%1;return e===e?n?e-n:e:0}function Ts(e){return e?gn(js(e),0,je):0}function Ds(e){if("number"==typeof e)return e;if(bs(e))return Ae;if(os(e)){var t=ns(e.valueOf)?e.valueOf():e;e=os(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(bt,"");var n=Tt.test(e);return n||It.test(e)?Rn(e.slice(2),n?2:8):jt.test(e)?Ae:+e}function Is(e){return Jr(e,Gs(e))}function Ms(e){return gn(js(e),-Ee,Ee)}function Cs(e){if("string"==typeof e)return e;if(null==e)return"";if(bs(e))return al?al.call(e):"";var t=e+"";return"0"==t&&1/e==-Se?"-0":t}function qs(e,t){var n=xn(e);return t?vn(n,t):n}function Ls(e,t){return b(e,xi(t,3),Nn,!0)}function Rs(e,t){return b(e,xi(t,3),Un,!0)}function Ps(e,t){return null==e?e:cl(e,xi(t),Gs)}function Ns(e,t){return null==e?e:ll(e,xi(t),Gs)}function Fs(e,t){return e&&Nn(e,xi(t))}function Us(e,t){return e&&Un(e,xi(t))}function Hs(e){return null==e?[]:Hn(e,$s(e))}function Ys(e){return null==e?[]:Hn(e,Gs(e))}function Bs(e,t,n){var r=null==e?Q:Yn(e,t);return r===Q?n:r}function Ws(e,t){return null!=e&&Di(e,t,$n)}function Vs(e,t){return null!=e&&Di(e,t,Gn)}function $s(e){var t=Hi(e);if(!t&&!$a(e))return nr(e);var n=qi(e),r=!!n,i=n||[],o=i.length;for(var a in e)!$n(e,a)||r&&("length"==a||W(a,o))||t&&"constructor"==a||i.push(a);return i}function Gs(e){for(var t=-1,n=Hi(e),r=rr(e),i=r.length,o=qi(e),a=!!o,s=o||[],u=s.length;++tt){var r=e;e=t,t=r}if(n||e%1||t%1){var i=Uc();return Nc(e+i*(t-e+Ln("1e-"+((i+"").length-1))),t)}return gr(e,t)}function hu(e){return wf(Cs(e).toLowerCase())}function du(e){return e=Cs(e),e&&e.replace(Ct,F).replace(wn,"")}function pu(e,t,n){e=Cs(e),t="string"==typeof t?t:t+"";var r=e.length;return n=n===Q?r:gn(js(n),0,r),n-=t.length,n>=0&&e.indexOf(t,n)==n}function vu(e){return e=Cs(e),e&&ft.test(e)?e.replace(ct,U):e}function mu(e){return e=Cs(e),e&&_t.test(e)?e.replace(yt,"\\$&"):e}function gu(e,t,n){e=Cs(e),t=js(t);var r=t?J(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return li(Mc(i),n)+e+li(Ic(i),n)}function yu(e,t,n){e=Cs(e),t=js(t);var r=t?J(e):0;return t&&t>r?e+li(t-r,n):e}function _u(e,t,n){e=Cs(e),t=js(t);var r=t?J(e):0;return t&&t>r?li(t-r,n)+e:e}function bu(e,t,n){return n||null==t?t=0:t&&(t=+t),e=Cs(e).replace(bt,""),Fc(e,t||(At.test(e)?16:10))}function wu(e,t,n){return t=(n?Pi(e,t,n):t===Q)?1:js(t),_r(Cs(e),t)}function xu(){var e=arguments,t=Cs(e[0]);return e.length<3?t:Hc.call(t,e[1],e[2])}function ku(e,t,n){return n&&"number"!=typeof n&&Pi(e,t,n)&&(t=n=Q),(n=n===Q?je:n>>>0)?(e=Cs(e),e&&("string"==typeof t||null!=t&&!ms(t))&&(t+="",""==t&&Sn.test(e))?Pr(K(e),0,n):Bc.call(e,t,n)):[]}function Su(e,t,n){return e=Cs(e),n=gn(js(n),0,e.length),e.lastIndexOf(t,n)==n}function Eu(e,n,r){var i=t.templateSettings;r&&Pi(e,n,r)&&(n=Q),e=Cs(e),n=tf({},n,i,fn);var o,a,s=tf({},n.imports,i.imports,fn),u=$s(s),c=I(s,u),l=0,f=n.interpolate||qt,h="__p += '",d=sc((n.escape||qt).source+"|"+f.source+"|"+(f===pt?Et:qt).source+"|"+(n.evaluate||qt).source+"|$","g"),p="//# sourceURL="+("sourceURL"in n?n.sourceURL:"lodash.templateSources["+ ++An+"]")+"\n";e.replace(d,function(t,n,r,i,s,u){return r||(r=i),h+=e.slice(l,u).replace(Lt,H),n&&(o=!0,h+="' +\n__e("+n+") +\n'"),s&&(a=!0,h+="';\n"+s+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=u+t.length,t}),h+="';\n";var v=n.variable;v||(h="with (obj) {\n"+h+"\n}\n"),h=(a?h.replace(ot,""):h).replace(at,"$1").replace(st,"$1;"),h="function("+(v||"obj")+") {\n"+(v?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var m=xf(function(){return Function(u,p+"return "+h).apply(Q,c)});if(m.source=h,es(m))throw m;return m}function Ou(e){return Cs(e).toLowerCase()}function Au(e){return Cs(e).toUpperCase()}function ju(e,t,n){if(e=Cs(e),!e)return e;if(n||t===Q)return e.replace(bt,"");if(!(t+=""))return e;var r=K(e),i=K(t),o=M(r,i),a=C(r,i)+1;return Pr(r,o,a).join("")}function Tu(e,t,n){if(e=Cs(e),!e)return e;if(n||t===Q)return e.replace(xt,"");if(!(t+=""))return e;var r=K(e),i=C(r,K(t))+1;return Pr(r,0,i).join("")}function Du(e,t,n){if(e=Cs(e),!e)return e;if(n||t===Q)return e.replace(wt,"");if(!(t+=""))return e;var r=K(e),i=M(r,K(t));return Pr(r,i).join("")}function Iu(e,t){var n=ge,r=ye;if(os(t)){var i="separator"in t?t.separator:i;n="length"in t?js(t.length):n,r="omission"in t?Cs(t.omission):r}e=Cs(e);var o=e.length;if(Sn.test(e)){var a=K(e);o=a.length}if(n>=o)return e;var s=n-J(r);if(1>s)return r;var u=a?Pr(a,0,s).join(""):e.slice(0,s);if(i===Q)return u+r;if(a&&(s+=u.length-s),ms(i)){if(e.slice(s).search(i)){var c,l=u;for(i.global||(i=sc(i.source,Cs(Ot.exec(i))+"g")),i.lastIndex=0;c=i.exec(l);)var f=c.index;u=u.slice(0,f===Q?s:f)}}else if(e.indexOf(i,s)!=s){var h=u.lastIndexOf(i);h>-1&&(u=u.slice(0,h))}return u+r}function Mu(e){return e=Cs(e),e&<.test(e)?e.replace(ut,Z):e}function Cu(e,t,n){return e=Cs(e),t=n?Q:t,t===Q&&(t=En.test(e)?kn:kt),e.match(t)||[]}function qu(e){var t=e?e.length:0,n=xi();return e=t?p(e,function(e){if("function"!=typeof e[1])throw new uc(ne);return[n(e[0]),e[1]]}):[],Ia(function(n){for(var r=-1;++re||e>Ee)return[];var n=je,r=Nc(e,je);t=xi(t),e-=je;for(var i=j(r,t);++n0){if(++e>=_e)return n}else e=0;return fl(n,r)}}(),gl=ja(function(e){var t=[];return Cs(e).replace(gt,function(e,n,r,i){t.push(r?i.replace(St,"$1"):n||e)}),t}),yl=Ia(function(e,t){return Ga(e)?In(e,Pn(t,1,Ga,!0)):[]}),_l=Ia(function(e,t){var n=mo(t);return Ga(n)&&(n=Q),Ga(e)?In(e,Pn(t,1,Ga,!0),xi(n)):[]}),bl=Ia(function(e,t){var n=mo(t);return Ga(n)&&(n=Q),Ga(e)?In(e,Pn(t,1,Ga,!0),Q,n):[]}),wl=Ia(function(e){var t=p(e,qr);return t.length&&t[0]===e[0]?Jn(t):[]}),xl=Ia(function(e){var t=mo(e),n=p(e,qr);return t===mo(n)?t=Q:n.pop(),n.length&&n[0]===e[0]?Jn(n,xi(t)):[]}),kl=Ia(function(e){var t=mo(e),n=p(e,qr);return t===mo(n)?t=Q:n.pop(),n.length&&n[0]===e[0]?Jn(n,Q,t):[]}),Sl=Ia(_o),El=Ia(function(e,t){t=p(Pn(t,1),String);var n=mn(e,t);return mr(e,t.sort(L)),n}),Ol=Ia(function(e){return Ar(Pn(e,1,Ga,!0))}),Al=Ia(function(e){var t=mo(e);return Ga(t)&&(t=Q),Ar(Pn(e,1,Ga,!0),xi(t))}),jl=Ia(function(e){var t=mo(e);return Ga(t)&&(t=Q),Ar(Pn(e,1,Ga,!0),Q,t)}),Tl=Ia(function(e,t){return Ga(e)?In(e,t):[]}),Dl=Ia(function(e){return Mr(f(e,Ga))}),Il=Ia(function(e){var t=mo(e);return Ga(t)&&(t=Q),Mr(f(e,Ga),xi(t))}),Ml=Ia(function(e){var t=mo(e);return Ga(t)&&(t=Q),Mr(f(e,Ga),Q,t)}),Cl=Ia(Ho),ql=Ia(function(e){var t=e.length,n=t>1?e[t-1]:Q;return n="function"==typeof n?(e.pop(),n):Q,Yo(e,n)}),Ll=Ia(function(e){e=Pn(e,1);var t=e.length,n=t?e[0]:0,r=this.__wrapped__,i=function(t){return mn(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Mt&&W(n)?(r=r.slice(n,+n+(t?1:0)),r.__actions__.push({func:Go,args:[i],thisArg:Q}),new q(r,this.__chain__).thru(function(e){return t&&!e.length&&e.push(Q),e})):this.thru(i)}),Rl=Zr(function(e,t,n){dc.call(e,n)?++e[n]:e[n]=1}),Pl=Zr(function(e,t,n){dc.call(e,n)?e[n].push(t):e[n]=[t]}),Nl=Ia(function(e,t,n){var r=-1,i="function"==typeof t,a=Ni(t),s=$a(e)?Array(e.length):[];return sl(e,function(e){var u=i?t:a&&null!=e?e[t]:Q;s[++r]=u?o(u,e,n):Zn(e,t,n)}),s}),Fl=Zr(function(e,t,n){e[n]=t}),Ul=Zr(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Hl=Ia(function(e,t){if(null==e)return[];var n=t.length;return n>1&&Pi(e,t[0],t[1])?t=[]:n>2&&Pi(t[0],t[1],t[2])&&(t=[t[0]]),t=1==t.length&&Zl(t[0])?t[0]:Pn(t,1,Ri),lr(e,t,[])}),Yl=ic.now,Bl=Ia(function(e,t,n){var r=oe;if(n.length){var i=G(n,Ei(Bl));r|=le}return vi(e,r,t,n,i)}),Wl=Ia(function(e,t,n){var r=oe|ae;if(n.length){var i=G(n,Ei(Wl));r|=le}return vi(t,r,e,n,i)}),Vl=Ia(function(e,t){return Dn(e,1,t)}),$l=Ia(function(e,t,n){return Dn(e,Ds(t)||0,n)});ja.Cache=Wt;var Gl=Ia(function(e,t){t=1==t.length&&Zl(t[0])?p(t[0],D(xi())):p(Pn(t,1,Ri),D(xi()));var n=t.length;return Ia(function(r){for(var i=-1,a=Nc(r.length,n);++i0||0>t)?new Mt(n):(0>e?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==Q&&(t=js(t),n=0>t?n.dropRight(-t):n.take(t-e)),n)},Mt.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Mt.prototype.toArray=function(){return this.take(je)},Nn(Mt.prototype,function(e,n){var r=/^(?:filter|find|map|reject)|While$/.test(n),i=/^(?:head|last)$/.test(n),o=t[i?"take"+("last"==n?"Right":""):n],a=i||/^find/.test(n);o&&(t.prototype[n]=function(){var n=this.__wrapped__,s=i?[1]:arguments,u=n instanceof Mt,c=s[0],l=u||Zl(n),f=function(e){var n=o.apply(t,v([e],s));return i&&h?n[0]:n};l&&r&&"function"==typeof c&&1!=c.length&&(u=l=!1);var h=this.__chain__,d=!!this.__actions__.length,p=a&&!h,m=u&&!d;if(!a&&l){n=m?n:new Mt(this);var g=e.apply(n,s);return g.__actions__.push({func:Go,args:[f],thisArg:Q}),new q(g,h)}return p&&m?e.apply(this,s):(g=this.thru(f),p?i?g.value()[0]:g.value():g)})}),u(["pop","push","shift","sort","splice","unshift"],function(e){var n=cc[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);t.prototype[e]=function(){var e=arguments;if(i&&!this.__chain__){var t=this.value();return n.apply(Zl(t)?t:[],e)}return this[r](function(t){return n.apply(Zl(t)?t:[],e)})}}),Nn(Mt.prototype,function(e,n){var r=t[n];if(r){var i=r.name+"",o=Xc[i]||(Xc[i]=[]);o.push({name:n,func:r})}}),Xc[si(Q,ae).name]=[{name:"wrapper",func:Q}],Mt.prototype.clone=Rt,Mt.prototype.reverse=Pt,Mt.prototype.value=Nt,t.prototype.at=Ll,t.prototype.chain=zo,t.prototype.commit=Jo,t.prototype.next=Ko,t.prototype.plant=Xo,t.prototype.reverse=Qo,t.prototype.toJSON=t.prototype.valueOf=t.prototype.value=ea,Oc&&(t.prototype[Oc]=Zo),t}var Q,ee="4.11.1",te=200,ne="Expected a function",re="__lodash_hash_undefined__",ie="__lodash_placeholder__",oe=1,ae=2,se=4,ue=8,ce=16,le=32,fe=64,he=128,de=256,pe=512,ve=1,me=2,ge=30,ye="...",_e=150,be=16,we=1,xe=2,ke=3,Se=1/0,Ee=9007199254740991,Oe=1.7976931348623157e308,Ae=NaN,je=4294967295,Te=je-1,De=je>>>1,Ie="[object Arguments]",Me="[object Array]",Ce="[object Boolean]",qe="[object Date]",Le="[object Error]",Re="[object Function]",Pe="[object GeneratorFunction]",Ne="[object Map]",Fe="[object Number]",Ue="[object Object]",He="[object Promise]",Ye="[object RegExp]",Be="[object Set]",We="[object String]",Ve="[object Symbol]",$e="[object WeakMap]",Ge="[object WeakSet]",ze="[object ArrayBuffer]",Je="[object DataView]",Ke="[object Float32Array]",Ze="[object Float64Array]",Xe="[object Int8Array]",Qe="[object Int16Array]",et="[object Int32Array]",tt="[object Uint8Array]",nt="[object Uint8ClampedArray]",rt="[object Uint16Array]",it="[object Uint32Array]",ot=/\b__p \+= '';/g,at=/\b(__p \+=) '' \+/g,st=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ut=/&(?:amp|lt|gt|quot|#39|#96);/g,ct=/[&<>"'`]/g,lt=RegExp(ut.source),ft=RegExp(ct.source),ht=/<%-([\s\S]+?)%>/g,dt=/<%([\s\S]+?)%>/g,pt=/<%=([\s\S]+?)%>/g,vt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,mt=/^\w*$/,gt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,yt=/[\\^$.*+?()[\]{}|]/g,_t=RegExp(yt.source),bt=/^\s+|\s+$/g,wt=/^\s+/,xt=/\s+$/,kt=/[a-zA-Z0-9]+/g,St=/\\(\\)?/g,Et=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ot=/\w*$/,At=/^0x/i,jt=/^[-+]0x[0-9a-f]+$/i,Tt=/^0b[01]+$/i,Dt=/^\[object .+?Constructor\]$/,It=/^0o[0-7]+$/i,Mt=/^(?:0|[1-9]\d*)$/,Ct=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,qt=/($^)/,Lt=/['\n\r\u2028\u2029\\]/g,Rt="\\ud800-\\udfff",Pt="\\u0300-\\u036f\\ufe20-\\ufe23",Nt="\\u20d0-\\u20f0",Ft="\\u2700-\\u27bf",Ut="a-z\\xdf-\\xf6\\xf8-\\xff",Ht="\\xac\\xb1\\xd7\\xf7",Yt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Bt="\\u2018\\u2019\\u201c\\u201d",Wt=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Vt="A-Z\\xc0-\\xd6\\xd8-\\xde",$t="\\ufe0e\\ufe0f",Gt=Ht+Yt+Bt+Wt,zt="['’]",Jt="["+Rt+"]",Kt="["+Gt+"]",Zt="["+Pt+Nt+"]",Xt="\\d+",Qt="["+Ft+"]",en="["+Ut+"]",tn="[^"+Rt+Gt+Xt+Ft+Ut+Vt+"]",nn="\\ud83c[\\udffb-\\udfff]",rn="(?:"+Zt+"|"+nn+")",on="[^"+Rt+"]",an="(?:\\ud83c[\\udde6-\\uddff]){2}",sn="[\\ud800-\\udbff][\\udc00-\\udfff]",un="["+Vt+"]",cn="\\u200d",ln="(?:"+en+"|"+tn+")",fn="(?:"+un+"|"+tn+")",hn="(?:"+zt+"(?:d|ll|m|re|s|t|ve))?",dn="(?:"+zt+"(?:D|LL|M|RE|S|T|VE))?",pn=rn+"?",vn="["+$t+"]?",mn="(?:"+cn+"(?:"+[on,an,sn].join("|")+")"+vn+pn+")*",gn=vn+pn+mn,yn="(?:"+[Qt,an,sn].join("|")+")"+gn,_n="(?:"+[on+Zt+"?",Zt,an,sn,Jt].join("|")+")",bn=RegExp(zt,"g"),wn=RegExp(Zt,"g"),xn=RegExp(nn+"(?="+nn+")|"+_n+gn,"g"),kn=RegExp([un+"?"+en+"+"+hn+"(?="+[Kt,un,"$"].join("|")+")",fn+"+"+dn+"(?="+[Kt,un+ln,"$"].join("|")+")",un+"?"+ln+"+"+hn,un+"+"+dn,Xt,yn].join("|"),"g"),Sn=RegExp("["+cn+Rt+Pt+Nt+$t+"]"),En=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,On=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","Reflect","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],An=-1,jn={};jn[Ke]=jn[Ze]=jn[Xe]=jn[Qe]=jn[et]=jn[tt]=jn[nt]=jn[rt]=jn[it]=!0,jn[Ie]=jn[Me]=jn[ze]=jn[Ce]=jn[Je]=jn[qe]=jn[Le]=jn[Re]=jn[Ne]=jn[Fe]=jn[Ue]=jn[Ye]=jn[Be]=jn[We]=jn[$e]=!1;var Tn={};Tn[Ie]=Tn[Me]=Tn[ze]=Tn[Je]=Tn[Ce]=Tn[qe]=Tn[Ke]=Tn[Ze]=Tn[Xe]=Tn[Qe]=Tn[et]=Tn[Ne]=Tn[Fe]=Tn[Ue]=Tn[Ye]=Tn[Be]=Tn[We]=Tn[Ve]=Tn[tt]=Tn[nt]=Tn[rt]=Tn[it]=!0,Tn[Le]=Tn[Re]=Tn[$e]=!1;var Dn={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"},In={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Mn={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Cn={"function":!0,object:!0},qn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ln=parseFloat,Rn=parseInt,Pn=Cn[typeof n]&&n&&!n.nodeType?n:Q,Nn=Cn[typeof t]&&t&&!t.nodeType?t:Q,Fn=Nn&&Nn.exports===Pn?Pn:Q,Un=q(Pn&&Nn&&"object"==typeof e&&e),Hn=q(Cn[typeof self]&&self),Yn=q(Cn[typeof window]&&window),Bn=q(Cn[typeof this]&&this),Wn=Un||Yn!==(Bn&&Bn.window)&&Yn||Hn||Bn||Function("return this")(),Vn=X();(Yn||Hn||{})._=Vn,"function"==typeof define&&"object"==typeof define.amd&&define.amd?define(function(){return Vn}):Pn&&Nn?(Fn&&((Nn.exports=Vn)._=Vn),Pn._=Vn):Wn._=Vn}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],127:[function(e,t,n){var r=e("./_arrayMap"),i=e("./_baseDifference"),o=e("./_baseFlatten"),a=e("./_basePick"),s=e("./_getAllKeysIn"),u=e("./rest"),c=e("./_toKey"),l=u(function(e,t){return null==e?{}:(t=r(o(t,1),c),a(e,i(s(e),t)))});t.exports=l},{"./_arrayMap":61,"./_baseDifference":70,"./_baseFlatten":71,"./_basePick":75,"./_getAllKeysIn":84,"./_toKey":110,"./rest":128}],128:[function(e,t,n){function r(e,t){if("function"!=typeof e)throw new TypeError(a);return t=s(void 0===t?e.length-1:o(t),0),function(){for(var n=arguments,r=-1,o=s(n.length-t,0),a=Array(o);++re?-1:1;return t*a}var n=e%1;return e===e?n?e-n:e:0}var i=e("./toNumber"),o=1/0,a=1.7976931348623157e308;t.exports=r},{"./toNumber":130}],130:[function(e,t,n){function r(e){if("number"==typeof e)return e;if(a(e))return s;if(o(e)){var t=i(e.valueOf)?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(u,"");var n=l.test(e);return n||f.test(e)?h(e.slice(2),n?2:8):c.test(e)?s:+e}var i=e("./isFunction"),o=e("./isObject"),a=e("./isSymbol"),s=NaN,u=/^\s+|\s+$/g,c=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,f=/^0o[0-7]+$/i,h=parseInt;t.exports=r},{"./isFunction":118,"./isObject":121,"./isSymbol":124}],131:[function(e,t,n){!function(e,r){"object"==typeof n&&"undefined"!=typeof t?t.exports=r():"function"==typeof define&&define.amd?define(r):e.moment=r()}(this,function(){"use strict";function n(){return ur.apply(null,arguments)}function r(e){ur=e}function i(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function o(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function a(e,t){var n,r=[];for(n=0;n0)for(n in lr)r=lr[n],i=t[r],p(i)||(e[r]=i);return e}function m(e){v(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),fr===!1&&(fr=!0,n.updateOffset(this),fr=!1)}function g(e){return e instanceof m||null!=e&&null!=e._isAMomentObject}function y(e){return 0>e?Math.ceil(e):Math.floor(e)}function _(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=y(t)),n}function b(e,t,n){var r,i=Math.min(e.length,t.length),o=Math.abs(e.length-t.length),a=0;for(r=0;i>r;r++)(n&&e[r]!==t[r]||!n&&_(e[r])!==_(t[r]))&&a++;return a+o}function w(e){n.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function x(e,t){var r=!0;return u(function(){return null!=n.deprecationHandler&&n.deprecationHandler(null,e),r&&(w(e+"\nArguments: "+Array.prototype.slice.call(arguments).join(", ")+"\n"+(new Error).stack),r=!1),t.apply(this,arguments)},t)}function k(e,t){null!=n.deprecationHandler&&n.deprecationHandler(e,t),hr[e]||(w(t),hr[e]=!0)}function S(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function E(e){return"[object Object]"===Object.prototype.toString.call(e)}function O(e){var t,n;for(n in e)t=e[n],S(t)?this[n]=t:this["_"+n]=t;this._config=e,this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function A(e,t){var n,r=u({},e);for(n in t)s(t,n)&&(E(e[n])&&E(t[n])?(r[n]={},u(r[n],e[n]),u(r[n],t[n])):null!=t[n]?r[n]=t[n]:delete r[n]);return r}function j(e){null!=e&&this.set(e)}function T(e){return e?e.toLowerCase().replace("_","-"):e}function D(e){for(var t,n,r,i,o=0;o0;){if(r=I(i.slice(0,t).join("-")))return r;if(n&&n.length>=t&&b(i,n,!0)>=t-1)break;t--}o++}return null}function I(n){var r=null;if(!mr[n]&&"undefined"!=typeof t&&t&&t.exports)try{r=pr._abbr,e("./locale/"+n),M(r)}catch(i){}return mr[n]}function M(e,t){var n;return e&&(n=p(t)?L(e):C(e,t),n&&(pr=n)),pr._abbr}function C(e,t){return null!==t?(t.abbr=e,null!=mr[e]?(k("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale"),t=A(mr[e]._config,t)):null!=t.parentLocale&&(null!=mr[t.parentLocale]?t=A(mr[t.parentLocale]._config,t):k("parentLocaleUndefined","specified parentLocale is not defined yet")),mr[e]=new j(t),M(e),mr[e]):(delete mr[e],null)}function q(e,t){if(null!=t){var n;null!=mr[e]&&(t=A(mr[e]._config,t)),n=new j(t),n.parentLocale=mr[e],mr[e]=n,M(e)}else null!=mr[e]&&(null!=mr[e].parentLocale?mr[e]=mr[e].parentLocale:null!=mr[e]&&delete mr[e]);return mr[e]}function L(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return pr;if(!i(e)){if(t=I(e))return t;e=[e]}return D(e)}function R(){return dr(mr)}function P(e,t){var n=e.toLowerCase();gr[n]=gr[n+"s"]=gr[t]=e}function N(e){return"string"==typeof e?gr[e]||gr[e.toLowerCase()]:void 0}function F(e){var t,n,r={};for(n in e)s(e,n)&&(t=N(n),t&&(r[t]=e[n]));return r}function U(e,t){return function(r){return null!=r?(Y(this,e,r),n.updateOffset(this,t),this):H(this,e)}}function H(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function Y(e,t,n){e.isValid()&&e._d["set"+(e._isUTC?"UTC":"")+t](n)}function B(e,t){var n;if("object"==typeof e)for(n in e)this.set(n,e[n]);else if(e=N(e),S(this[e]))return this[e](t);return this}function W(e,t,n){var r=""+Math.abs(e),i=t-r.length,o=e>=0;return(o?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}function V(e,t,n,r){var i=r;"string"==typeof r&&(i=function(){return this[r]()}),e&&(wr[e]=i),t&&(wr[t[0]]=function(){return W(i.apply(this,arguments),t[1],t[2])}),n&&(wr[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function $(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function G(e){var t,n,r=e.match(yr);for(t=0,n=r.length;n>t;t++)wr[r[t]]?r[t]=wr[r[t]]:r[t]=$(r[t]);return function(t){var i,o="";for(i=0;n>i;i++)o+=r[i]instanceof Function?r[i].call(t,e):r[i];return o}}function z(e,t){return e.isValid()?(t=J(t,e.localeData()),br[t]=br[t]||G(t),br[t](e)):e.localeData().invalidDate()}function J(e,t){function n(e){return t.longDateFormat(e)||e}var r=5;for(_r.lastIndex=0;r>=0&&_r.test(e);)e=e.replace(_r,n),_r.lastIndex=0,r-=1;return e}function K(e,t,n){Fr[e]=S(t)?t:function(e,r){return e&&n?n:t}}function Z(e,t){return s(Fr,e)?Fr[e](t._strict,t._locale):new RegExp(X(e))}function X(e){return Q(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,r,i){return t||n||r||i}))}function Q(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function ee(e,t){var n,r=t;for("string"==typeof e&&(e=[e]),"number"==typeof t&&(r=function(e,n){n[t]=_(e)}),n=0;nr;++r)o=c([2e3,r]),this._shortMonthsParse[r]=this.monthsShort(o,"").toLocaleLowerCase(),this._longMonthsParse[r]=this.months(o,"").toLocaleLowerCase();return n?"MMM"===t?(i=vr.call(this._shortMonthsParse,a),-1!==i?i:null):(i=vr.call(this._longMonthsParse,a),-1!==i?i:null):"MMM"===t?(i=vr.call(this._shortMonthsParse,a),-1!==i?i:(i=vr.call(this._longMonthsParse,a),-1!==i?i:null)):(i=vr.call(this._longMonthsParse,a),-1!==i?i:(i=vr.call(this._shortMonthsParse,a),-1!==i?i:null))}function se(e,t,n){var r,i,o;if(this._monthsParseExact)return ae.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),r=0;12>r;r++){if(i=c([2e3,r]),n&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[r]||(o="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[r]=new RegExp(o.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[r].test(e))return r;if(n&&"MMM"===t&&this._shortMonthsParse[r].test(e))return r;if(!n&&this._monthsParse[r].test(e))return r}}function ue(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=_(t);else if(t=e.localeData().monthsParse(t),"number"!=typeof t)return e;return n=Math.min(e.date(),re(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e}function ce(e){return null!=e?(ue(this,e),n.updateOffset(this,!0),this):H(this,"Month")}function le(){return re(this.year(),this.month())}function fe(e){return this._monthsParseExact?(s(this,"_monthsRegex")||de.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex}function he(e){return this._monthsParseExact?(s(this,"_monthsRegex")||de.call(this),e?this._monthsStrictRegex:this._monthsRegex):this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex}function de(){function e(e,t){return t.length-e.length}var t,n,r=[],i=[],o=[];for(t=0;12>t;t++)n=c([2e3,t]),r.push(this.monthsShort(n,"")),i.push(this.months(n,"")),o.push(this.months(n,"")),o.push(this.monthsShort(n,""));for(r.sort(e),i.sort(e),o.sort(e),t=0;12>t;t++)r[t]=Q(r[t]),i[t]=Q(i[t]),o[t]=Q(o[t]);this._monthsRegex=new RegExp("^("+o.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+r.join("|")+")","i")}function pe(e){var t,n=e._a;return n&&-2===f(e).overflow&&(t=n[Yr]<0||n[Yr]>11?Yr:n[Br]<1||n[Br]>re(n[Hr],n[Yr])?Br:n[Wr]<0||n[Wr]>24||24===n[Wr]&&(0!==n[Vr]||0!==n[$r]||0!==n[Gr])?Wr:n[Vr]<0||n[Vr]>59?Vr:n[$r]<0||n[$r]>59?$r:n[Gr]<0||n[Gr]>999?Gr:-1,f(e)._overflowDayOfYear&&(Hr>t||t>Br)&&(t=Br),f(e)._overflowWeeks&&-1===t&&(t=zr),f(e)._overflowWeekday&&-1===t&&(t=Jr),f(e).overflow=t),e}function ve(e){var t,n,r,i,o,a,s=e._i,u=ti.exec(s)||ni.exec(s);if(u){for(f(e).iso=!0,t=0,n=ii.length;n>t;t++)if(ii[t][1].exec(u[1])){i=ii[t][0],r=ii[t][2]!==!1;break}if(null==i)return void(e._isValid=!1);if(u[3]){for(t=0,n=oi.length;n>t;t++)if(oi[t][1].exec(u[3])){o=(u[2]||" ")+oi[t][0];break}if(null==o)return void(e._isValid=!1)}if(!r&&null!=o)return void(e._isValid=!1);if(u[4]){if(!ri.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=i+(o||"")+(a||""),De(e)}else e._isValid=!1}function me(e){var t=ai.exec(e._i);return null!==t?void(e._d=new Date(+t[1])):(ve(e),void(e._isValid===!1&&(delete e._isValid,n.createFromInputFallback(e))))}function ge(e,t,n,r,i,o,a){var s=new Date(e,t,n,r,i,o,a);return 100>e&&e>=0&&isFinite(s.getFullYear())&&s.setFullYear(e),s}function ye(e){var t=new Date(Date.UTC.apply(null,arguments));return 100>e&&e>=0&&isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e),t}function _e(e){return be(e)?366:365}function be(e){return e%4===0&&e%100!==0||e%400===0}function we(){return be(this.year())}function xe(e,t,n){var r=7+t-n,i=(7+ye(e,0,r).getUTCDay()-t)%7;return-i+r-1}function ke(e,t,n,r,i){var o,a,s=(7+n-r)%7,u=xe(e,r,i),c=1+7*(t-1)+s+u;return 0>=c?(o=e-1,a=_e(o)+c):c>_e(e)?(o=e+1,a=c-_e(e)):(o=e,a=c),{year:o,dayOfYear:a}}function Se(e,t,n){var r,i,o=xe(e.year(),t,n),a=Math.floor((e.dayOfYear()-o-1)/7)+1;return 1>a?(i=e.year()-1,r=a+Ee(i,t,n)):a>Ee(e.year(),t,n)?(r=a-Ee(e.year(),t,n),i=e.year()+1):(i=e.year(),r=a),{week:r,year:i}}function Ee(e,t,n){var r=xe(e,t,n),i=xe(e+1,t,n);return(_e(e)-r+i)/7}function Oe(e,t,n){return null!=e?e:null!=t?t:n}function Ae(e){var t=new Date(n.now());return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}function je(e){var t,n,r,i,o=[];if(!e._d){for(r=Ae(e),e._w&&null==e._a[Br]&&null==e._a[Yr]&&Te(e),e._dayOfYear&&(i=Oe(e._a[Hr],r[Hr]),e._dayOfYear>_e(i)&&(f(e)._overflowDayOfYear=!0),n=ye(i,0,e._dayOfYear),e._a[Yr]=n.getUTCMonth(),e._a[Br]=n.getUTCDate()),t=0;3>t&&null==e._a[t];++t)e._a[t]=o[t]=r[t];for(;7>t;t++)e._a[t]=o[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[Wr]&&0===e._a[Vr]&&0===e._a[$r]&&0===e._a[Gr]&&(e._nextDay=!0,e._a[Wr]=0),e._d=(e._useUTC?ye:ge).apply(null,o),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Wr]=24)}}function Te(e){var t,n,r,i,o,a,s,u;t=e._w,null!=t.GG||null!=t.W||null!=t.E?(o=1,a=4,n=Oe(t.GG,e._a[Hr],Se(Ne(),1,4).year),r=Oe(t.W,1),i=Oe(t.E,1),(1>i||i>7)&&(u=!0)):(o=e._locale._week.dow,a=e._locale._week.doy,n=Oe(t.gg,e._a[Hr],Se(Ne(),o,a).year),r=Oe(t.w,1),null!=t.d?(i=t.d,(0>i||i>6)&&(u=!0)):null!=t.e?(i=t.e+o,(t.e<0||t.e>6)&&(u=!0)):i=o),1>r||r>Ee(n,o,a)?f(e)._overflowWeeks=!0:null!=u?f(e)._overflowWeekday=!0:(s=ke(n,r,i,o,a),e._a[Hr]=s.year,e._dayOfYear=s.dayOfYear)}function De(e){if(e._f===n.ISO_8601)return void ve(e);e._a=[],f(e).empty=!0;var t,r,i,o,a,s=""+e._i,u=s.length,c=0;for(i=J(e._f,e._locale).match(yr)||[],t=0;t0&&f(e).unusedInput.push(a),s=s.slice(s.indexOf(r)+r.length),c+=r.length),wr[o]?(r?f(e).empty=!1:f(e).unusedTokens.push(o),ne(o,r,e)):e._strict&&!r&&f(e).unusedTokens.push(o);f(e).charsLeftOver=u-c,s.length>0&&f(e).unusedInput.push(s),f(e).bigHour===!0&&e._a[Wr]<=12&&e._a[Wr]>0&&(f(e).bigHour=void 0),f(e).parsedDateParts=e._a.slice(0),f(e).meridiem=e._meridiem,e._a[Wr]=Ie(e._locale,e._a[Wr],e._meridiem),je(e),pe(e)}function Ie(e,t,n){var r;return null==n?t:null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?(r=e.isPM(n),r&&12>t&&(t+=12),r||12!==t||(t=0),t):t}function Me(e){var t,n,r,i,o;if(0===e._f.length)return f(e).invalidFormat=!0,void(e._d=new Date(NaN));for(i=0;io)&&(r=o,n=t));u(e,n||t)}function Ce(e){if(!e._d){var t=F(e._i);e._a=a([t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),je(e)}}function qe(e){var t=new m(pe(Le(e)));return t._nextDay&&(t.add(1,"d"),t._nextDay=void 0),t}function Le(e){var t=e._i,n=e._f;return e._locale=e._locale||L(e._l),null===t||void 0===n&&""===t?d({nullInput:!0}):("string"==typeof t&&(e._i=t=e._locale.preparse(t)),g(t)?new m(pe(t)):(i(n)?Me(e):n?De(e):o(t)?e._d=t:Re(e),h(e)||(e._d=null),e))}function Re(e){var t=e._i;void 0===t?e._d=new Date(n.now()):o(t)?e._d=new Date(t.valueOf()):"string"==typeof t?me(e):i(t)?(e._a=a(t.slice(0),function(e){return parseInt(e,10)}),je(e)):"object"==typeof t?Ce(e):"number"==typeof t?e._d=new Date(t):n.createFromInputFallback(e)}function Pe(e,t,n,r,i){var o={};return"boolean"==typeof n&&(r=n,n=void 0),o._isAMomentObject=!0,o._useUTC=o._isUTC=i,o._l=n,o._i=e,o._f=t,o._strict=r,qe(o)}function Ne(e,t,n,r){return Pe(e,t,n,r,!1)}function Fe(e,t){var n,r;if(1===t.length&&i(t[0])&&(t=t[0]),!t.length)return Ne();for(n=t[0],r=1;re&&(e=-e,n="-"),n+W(~~(e/60),2)+t+W(~~e%60,2)})}function Ve(e,t){var n=(t||"").match(e)||[],r=n[n.length-1]||[],i=(r+"").match(fi)||["-",0,0],o=+(60*i[1])+_(i[2]);return"+"===i[0]?o:-o}function $e(e,t){var r,i;return t._isUTC?(r=t.clone(),i=(g(e)||o(e)?e.valueOf():Ne(e).valueOf())-r.valueOf(),r._d.setTime(r._d.valueOf()+i),n.updateOffset(r,!1),r):Ne(e).local()}function Ge(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function ze(e,t){var r,i=this._offset||0;return this.isValid()?null!=e?("string"==typeof e?e=Ve(Rr,e):Math.abs(e)<16&&(e=60*e),!this._isUTC&&t&&(r=Ge(this)),this._offset=e,this._isUTC=!0,null!=r&&this.add(r,"m"),i!==e&&(!t||this._changeInProgress?ft(this,ot(e-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,n.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?i:Ge(this):null!=e?this:NaN}function Je(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}function Ke(e){return this.utcOffset(0,e)}function Ze(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Ge(this),"m")),this}function Xe(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Ve(Lr,this._i)),this}function Qe(e){return this.isValid()?(e=e?Ne(e).utcOffset():0,(this.utcOffset()-e)%60===0):!1}function et(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function tt(){if(!p(this._isDSTShifted))return this._isDSTShifted;var e={};if(v(e,this),e=Le(e),e._a){var t=e._isUTC?c(e._a):Ne(e._a);this._isDSTShifted=this.isValid()&&b(e._a,t.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function nt(){return this.isValid()?!this._isUTC:!1}function rt(){return this.isValid()?this._isUTC:!1}function it(){return this.isValid()?this._isUTC&&0===this._offset:!1}function ot(e,t){var n,r,i,o=e,a=null;return Be(e)?o={ms:e._milliseconds,d:e._days,M:e._months}:"number"==typeof e?(o={},t?o[t]=e:o.milliseconds=e):(a=hi.exec(e))?(n="-"===a[1]?-1:1,o={y:0,d:_(a[Br])*n, +h:_(a[Wr])*n,m:_(a[Vr])*n,s:_(a[$r])*n,ms:_(a[Gr])*n}):(a=di.exec(e))?(n="-"===a[1]?-1:1,o={y:at(a[2],n),M:at(a[3],n),w:at(a[4],n),d:at(a[5],n),h:at(a[6],n),m:at(a[7],n),s:at(a[8],n)}):null==o?o={}:"object"==typeof o&&("from"in o||"to"in o)&&(i=ut(Ne(o.from),Ne(o.to)),o={},o.ms=i.milliseconds,o.M=i.months),r=new Ye(o),Be(e)&&s(e,"_locale")&&(r._locale=e._locale),r}function at(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function st(e,t){var n={milliseconds:0,months:0};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function ut(e,t){var n;return e.isValid()&&t.isValid()?(t=$e(t,e),e.isBefore(t)?n=st(e,t):(n=st(t,e),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function ct(e){return 0>e?-1*Math.round(-1*e):Math.round(e)}function lt(e,t){return function(n,r){var i,o;return null===r||isNaN(+r)||(k(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period)."),o=n,n=r,r=o),n="string"==typeof n?+n:n,i=ot(n,r),ft(this,i,e),this}}function ft(e,t,r,i){var o=t._milliseconds,a=ct(t._days),s=ct(t._months);e.isValid()&&(i=null==i?!0:i,o&&e._d.setTime(e._d.valueOf()+o*r),a&&Y(e,"Date",H(e,"Date")+a*r),s&&ue(e,H(e,"Month")+s*r),i&&n.updateOffset(e,a||s))}function ht(e,t){var n=e||Ne(),r=$e(n,this).startOf("day"),i=this.diff(r,"days",!0),o=-6>i?"sameElse":-1>i?"lastWeek":0>i?"lastDay":1>i?"sameDay":2>i?"nextDay":7>i?"nextWeek":"sameElse",a=t&&(S(t[o])?t[o]():t[o]);return this.format(a||this.localeData().calendar(o,this,Ne(n)))}function dt(){return new m(this)}function pt(e,t){var n=g(e)?e:Ne(e);return this.isValid()&&n.isValid()?(t=N(p(t)?"millisecond":t),"millisecond"===t?this.valueOf()>n.valueOf():n.valueOf()t-o?(n=e.clone().add(i-1,"months"),r=(t-o)/(o-n)):(n=e.clone().add(i+1,"months"),r=(t-o)/(n-o)),-(i+r)||0}function xt(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function kt(){var e=this.clone().utc();return 0o&&(t=o),Jt.call(this,e,t,n,r,i))}function Jt(e,t,n,r,i){var o=ke(e,t,n,r,i),a=ye(o.year,0,o.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}function Kt(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)}function Zt(e){return Se(e,this._week.dow,this._week.doy).week}function Xt(){return this._week.dow}function Qt(){return this._week.doy}function en(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")}function tn(e){var t=Se(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")}function nn(e,t){return"string"!=typeof e?e:isNaN(e)?(e=t.weekdaysParse(e),"number"==typeof e?e:null):parseInt(e,10)}function rn(e,t){return i(this._weekdays)?this._weekdays[e.day()]:this._weekdays[this._weekdays.isFormat.test(t)?"format":"standalone"][e.day()]}function on(e){return this._weekdaysShort[e.day()]}function an(e){return this._weekdaysMin[e.day()]}function sn(e,t,n){var r,i,o,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;7>r;++r)o=c([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(o,"").toLocaleLowerCase();return n?"dddd"===t?(i=vr.call(this._weekdaysParse,a),-1!==i?i:null):"ddd"===t?(i=vr.call(this._shortWeekdaysParse,a),-1!==i?i:null):(i=vr.call(this._minWeekdaysParse,a),-1!==i?i:null):"dddd"===t?(i=vr.call(this._weekdaysParse,a),-1!==i?i:(i=vr.call(this._shortWeekdaysParse,a),-1!==i?i:(i=vr.call(this._minWeekdaysParse,a),-1!==i?i:null))):"ddd"===t?(i=vr.call(this._shortWeekdaysParse,a),-1!==i?i:(i=vr.call(this._weekdaysParse,a),-1!==i?i:(i=vr.call(this._minWeekdaysParse,a),-1!==i?i:null))):(i=vr.call(this._minWeekdaysParse,a),-1!==i?i:(i=vr.call(this._weekdaysParse,a),-1!==i?i:(i=vr.call(this._shortWeekdaysParse,a),-1!==i?i:null)))}function un(e,t,n){var r,i,o;if(this._weekdaysParseExact)return sn.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;7>r;r++){if(i=c([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(i,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(i,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(i,"").replace(".",".?")+"$","i")),this._weekdaysParse[r]||(o="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[r]=new RegExp(o.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[r].test(e))return r;if(n&&"ddd"===t&&this._shortWeekdaysParse[r].test(e))return r;if(n&&"dd"===t&&this._minWeekdaysParse[r].test(e))return r;if(!n&&this._weekdaysParse[r].test(e))return r}}function cn(e){if(!this.isValid())return null!=e?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(e=nn(e,this.localeData()),this.add(e-t,"d")):t}function ln(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")}function fn(e){return this.isValid()?null==e?this.day()||7:this.day(this.day()%7?e:e-7):null!=e?this:NaN}function hn(e){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||vn.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex}function dn(e){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||vn.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex}function pn(e){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||vn.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex}function vn(){function e(e,t){return t.length-e.length}var t,n,r,i,o,a=[],s=[],u=[],l=[];for(t=0;7>t;t++)n=c([2e3,1]).day(t),r=this.weekdaysMin(n,""),i=this.weekdaysShort(n,""),o=this.weekdays(n,""),a.push(r),s.push(i),u.push(o),l.push(r),l.push(i),l.push(o);for(a.sort(e),s.sort(e),u.sort(e),l.sort(e),t=0;7>t;t++)s[t]=Q(s[t]),u[t]=Q(u[t]),l[t]=Q(l[t]);this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function mn(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")}function gn(){return this.hours()%12||12}function yn(){return this.hours()||24}function _n(e,t){V(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function bn(e,t){return t._meridiemParse}function wn(e){return"p"===(e+"").toLowerCase().charAt(0)}function xn(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"}function kn(e,t){t[Gr]=_(1e3*("0."+e))}function Sn(){return this._isUTC?"UTC":""}function En(){return this._isUTC?"Coordinated Universal Time":""}function On(e){return Ne(1e3*e)}function An(){return Ne.apply(null,arguments).parseZone()}function jn(e,t,n){var r=this._calendar[e];return S(r)?r.call(t,n):r}function Tn(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e])}function Dn(){return this._invalidDate}function In(e){return this._ordinal.replace("%d",e)}function Mn(e){return e}function Cn(e,t,n,r){var i=this._relativeTime[n];return S(i)?i(e,t,n,r):i.replace(/%d/i,e)}function qn(e,t){var n=this._relativeTime[e>0?"future":"past"];return S(n)?n(t):n.replace(/%s/i,t)}function Ln(e,t,n,r){var i=L(),o=c().set(r,t);return i[n](o,e)}function Rn(e,t,n){if("number"==typeof e&&(t=e,e=void 0),e=e||"",null!=t)return Ln(e,t,n,"month");var r,i=[];for(r=0;12>r;r++)i[r]=Ln(e,r,n,"month");return i}function Pn(e,t,n,r){"boolean"==typeof e?("number"==typeof t&&(n=t,t=void 0),t=t||""):(t=e,n=t,e=!1,"number"==typeof t&&(n=t,t=void 0),t=t||"");var i=L(),o=e?i._week.dow:0;if(null!=n)return Ln(t,(n+o)%7,r,"day");var a,s=[];for(a=0;7>a;a++)s[a]=Ln(t,(a+o)%7,r,"day");return s}function Nn(e,t){return Rn(e,t,"months")}function Fn(e,t){return Rn(e,t,"monthsShort")}function Un(e,t,n){return Pn(e,t,n,"weekdays")}function Hn(e,t,n){return Pn(e,t,n,"weekdaysShort")}function Yn(e,t,n){return Pn(e,t,n,"weekdaysMin")}function Bn(){var e=this._data;return this._milliseconds=Ui(this._milliseconds),this._days=Ui(this._days),this._months=Ui(this._months),e.milliseconds=Ui(e.milliseconds),e.seconds=Ui(e.seconds),e.minutes=Ui(e.minutes),e.hours=Ui(e.hours),e.months=Ui(e.months),e.years=Ui(e.years),this}function Wn(e,t,n,r){var i=ot(t,n);return e._milliseconds+=r*i._milliseconds,e._days+=r*i._days,e._months+=r*i._months,e._bubble()}function Vn(e,t){return Wn(this,e,t,1)}function $n(e,t){return Wn(this,e,t,-1)}function Gn(e){return 0>e?Math.floor(e):Math.ceil(e)}function zn(){var e,t,n,r,i,o=this._milliseconds,a=this._days,s=this._months,u=this._data;return o>=0&&a>=0&&s>=0||0>=o&&0>=a&&0>=s||(o+=864e5*Gn(Kn(s)+a),a=0,s=0),u.milliseconds=o%1e3,e=y(o/1e3),u.seconds=e%60,t=y(e/60),u.minutes=t%60,n=y(t/60),u.hours=n%24,a+=y(n/24),i=y(Jn(a)),s+=i,a-=Gn(Kn(i)),r=y(s/12),s%=12,u.days=a,u.months=s,u.years=r,this}function Jn(e){return 4800*e/146097}function Kn(e){return 146097*e/4800}function Zn(e){var t,n,r=this._milliseconds;if(e=N(e),"month"===e||"year"===e)return t=this._days+r/864e5,n=this._months+Jn(t),"month"===e?n:n/12;switch(t=this._days+Math.round(Kn(this._months)),e){case"week":return t/7+r/6048e5;case"day":return t+r/864e5;case"hour":return 24*t+r/36e5;case"minute":return 1440*t+r/6e4;case"second":return 86400*t+r/1e3;case"millisecond":return Math.floor(864e5*t)+r;default:throw new Error("Unknown unit "+e)}}function Xn(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*_(this._months/12)}function Qn(e){return function(){return this.as(e)}}function er(e){return e=N(e),this[e+"s"]()}function tr(e){return function(){return this._data[e]}}function nr(){return y(this.days()/7)}function rr(e,t,n,r,i){return i.relativeTime(t||1,!!n,e,r)}function ir(e,t,n){var r=ot(e).abs(),i=no(r.as("s")),o=no(r.as("m")),a=no(r.as("h")),s=no(r.as("d")),u=no(r.as("M")),c=no(r.as("y")),l=i=o&&["m"]||o=a&&["h"]||a=s&&["d"]||s=u&&["M"]||u=c&&["y"]||["yy",c];return l[2]=t,l[3]=+e>0,l[4]=n,rr.apply(null,l)}function or(e,t){return void 0===ro[e]?!1:void 0===t?ro[e]:(ro[e]=t,!0)}function ar(e){var t=this.localeData(),n=ir(this,!e,t);return e&&(n=t.pastFuture(+this,n)),t.postformat(n)}function sr(){var e,t,n,r=io(this._milliseconds)/1e3,i=io(this._days),o=io(this._months);e=y(r/60),t=y(e/60),r%=60,e%=60,n=y(o/12),o%=12;var a=n,s=o,u=i,c=t,l=e,f=r,h=this.asSeconds();return h?(0>h?"-":"")+"P"+(a?a+"Y":"")+(s?s+"M":"")+(u?u+"D":"")+(c||l||f?"T":"")+(c?c+"H":"")+(l?l+"M":"")+(f?f+"S":""):"P0D"}var ur,cr;cr=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),n=t.length>>>0,r=0;n>r;r++)if(r in t&&e.call(this,t[r],r,t))return!0;return!1};var lr=n.momentProperties=[],fr=!1,hr={};n.suppressDeprecationWarnings=!1,n.deprecationHandler=null;var dr;dr=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)s(e,t)&&n.push(t);return n};var pr,vr,mr={},gr={},yr=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,_r=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,br={},wr={},xr=/\d/,kr=/\d\d/,Sr=/\d{3}/,Er=/\d{4}/,Or=/[+-]?\d{6}/,Ar=/\d\d?/,jr=/\d\d\d\d?/,Tr=/\d\d\d\d\d\d?/,Dr=/\d{1,3}/,Ir=/\d{1,4}/,Mr=/[+-]?\d{1,6}/,Cr=/\d+/,qr=/[+-]?\d+/,Lr=/Z|[+-]\d\d:?\d\d/gi,Rr=/Z|[+-]\d\d(?::?\d\d)?/gi,Pr=/[+-]?\d+(\.\d{1,3})?/,Nr=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Fr={},Ur={},Hr=0,Yr=1,Br=2,Wr=3,Vr=4,$r=5,Gr=6,zr=7,Jr=8;vr=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t=e?""+e:"+"+e}),V(0,["YY",2],0,function(){return this.year()%100}),V(0,["YYYY",4],0,"year"),V(0,["YYYYY",5],0,"year"),V(0,["YYYYYY",6,!0],0,"year"),P("year","y"),K("Y",qr),K("YY",Ar,kr),K("YYYY",Ir,Er),K("YYYYY",Mr,Or),K("YYYYYY",Mr,Or),ee(["YYYYY","YYYYYY"],Hr),ee("YYYY",function(e,t){t[Hr]=2===e.length?n.parseTwoDigitYear(e):_(e)}),ee("YY",function(e,t){t[Hr]=n.parseTwoDigitYear(e)}),ee("Y",function(e,t){t[Hr]=parseInt(e,10)}),n.parseTwoDigitYear=function(e){return _(e)+(_(e)>68?1900:2e3)};var si=U("FullYear",!0);n.ISO_8601=function(){};var ui=x("moment().min is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var e=Ne.apply(null,arguments);return this.isValid()&&e.isValid()?this>e?this:e:d()}),ci=x("moment().max is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var e=Ne.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:d()}),li=function(){return Date.now?Date.now():+new Date};We("Z",":"),We("ZZ",""),K("Z",Rr),K("ZZ",Rr),ee(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Ve(Rr,e)});var fi=/([\+\-]|\d\d)/gi;n.updateOffset=function(){};var hi=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/,di=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;ot.fn=Ye.prototype;var pi=lt(1,"add"),vi=lt(-1,"subtract");n.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",n.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var mi=x("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});V(0,["gg",2],0,function(){return this.weekYear()%100}),V(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Bt("gggg","weekYear"),Bt("ggggg","weekYear"),Bt("GGGG","isoWeekYear"),Bt("GGGGG","isoWeekYear"),P("weekYear","gg"),P("isoWeekYear","GG"),K("G",qr),K("g",qr),K("GG",Ar,kr),K("gg",Ar,kr),K("GGGG",Ir,Er),K("gggg",Ir,Er),K("GGGGG",Mr,Or),K("ggggg",Mr,Or),te(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,r){t[r.substr(0,2)]=_(e)}),te(["gg","GG"],function(e,t,r,i){t[i]=n.parseTwoDigitYear(e)}),V("Q",0,"Qo","quarter"),P("quarter","Q"),K("Q",xr),ee("Q",function(e,t){t[Yr]=3*(_(e)-1)}),V("w",["ww",2],"wo","week"),V("W",["WW",2],"Wo","isoWeek"),P("week","w"),P("isoWeek","W"),K("w",Ar),K("ww",Ar,kr),K("W",Ar),K("WW",Ar,kr),te(["w","ww","W","WW"],function(e,t,n,r){t[r.substr(0,1)]=_(e)});var gi={dow:0,doy:6};V("D",["DD",2],"Do","date"),P("date","D"),K("D",Ar),K("DD",Ar,kr),K("Do",function(e,t){return e?t._ordinalParse:t._ordinalParseLenient}),ee(["D","DD"],Br),ee("Do",function(e,t){t[Br]=_(e.match(Ar)[0],10)});var yi=U("Date",!0);V("d",0,"do","day"),V("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),V("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),V("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),V("e",0,0,"weekday"),V("E",0,0,"isoWeekday"),P("day","d"),P("weekday","e"),P("isoWeekday","E"),K("d",Ar),K("e",Ar),K("E",Ar),K("dd",function(e,t){return t.weekdaysMinRegex(e)}),K("ddd",function(e,t){return t.weekdaysShortRegex(e)}),K("dddd",function(e,t){return t.weekdaysRegex(e)}),te(["dd","ddd","dddd"],function(e,t,n,r){var i=n._locale.weekdaysParse(e,r,n._strict);null!=i?t.d=i:f(n).invalidWeekday=e}),te(["d","e","E"],function(e,t,n,r){t[r]=_(e)});var _i="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),bi="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),wi="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),xi=Nr,ki=Nr,Si=Nr;V("DDD",["DDDD",3],"DDDo","dayOfYear"),P("dayOfYear","DDD"),K("DDD",Dr),K("DDDD",Sr),ee(["DDD","DDDD"],function(e,t,n){n._dayOfYear=_(e)}),V("H",["HH",2],0,"hour"),V("h",["hh",2],0,gn),V("k",["kk",2],0,yn),V("hmm",0,0,function(){return""+gn.apply(this)+W(this.minutes(),2)}),V("hmmss",0,0,function(){return""+gn.apply(this)+W(this.minutes(),2)+W(this.seconds(),2)}),V("Hmm",0,0,function(){return""+this.hours()+W(this.minutes(),2)}),V("Hmmss",0,0,function(){return""+this.hours()+W(this.minutes(),2)+W(this.seconds(),2)}),_n("a",!0),_n("A",!1),P("hour","h"),K("a",bn),K("A",bn),K("H",Ar),K("h",Ar),K("HH",Ar,kr),K("hh",Ar,kr),K("hmm",jr),K("hmmss",Tr),K("Hmm",jr),K("Hmmss",Tr),ee(["H","HH"],Wr),ee(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),ee(["h","hh"],function(e,t,n){t[Wr]=_(e),f(n).bigHour=!0}),ee("hmm",function(e,t,n){var r=e.length-2;t[Wr]=_(e.substr(0,r)),t[Vr]=_(e.substr(r)),f(n).bigHour=!0}),ee("hmmss",function(e,t,n){var r=e.length-4,i=e.length-2;t[Wr]=_(e.substr(0,r)),t[Vr]=_(e.substr(r,2)),t[$r]=_(e.substr(i)),f(n).bigHour=!0}),ee("Hmm",function(e,t,n){var r=e.length-2;t[Wr]=_(e.substr(0,r)),t[Vr]=_(e.substr(r))}),ee("Hmmss",function(e,t,n){var r=e.length-4,i=e.length-2;t[Wr]=_(e.substr(0,r)),t[Vr]=_(e.substr(r,2)),t[$r]=_(e.substr(i))});var Ei=/[ap]\.?m?\.?/i,Oi=U("Hours",!0);V("m",["mm",2],0,"minute"),P("minute","m"),K("m",Ar),K("mm",Ar,kr),ee(["m","mm"],Vr);var Ai=U("Minutes",!1);V("s",["ss",2],0,"second"),P("second","s"),K("s",Ar),K("ss",Ar,kr),ee(["s","ss"],$r);var ji=U("Seconds",!1);V("S",0,0,function(){return~~(this.millisecond()/100)}),V(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),V(0,["SSS",3],0,"millisecond"),V(0,["SSSS",4],0,function(){return 10*this.millisecond()}),V(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),V(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),V(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),V(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),V(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),P("millisecond","ms"),K("S",Dr,xr),K("SS",Dr,kr),K("SSS",Dr,Sr);var Ti;for(Ti="SSSS";Ti.length<=9;Ti+="S")K(Ti,Cr);for(Ti="S";Ti.length<=9;Ti+="S")ee(Ti,kn);var Di=U("Milliseconds",!1);V("z",0,0,"zoneAbbr"),V("zz",0,0,"zoneName");var Ii=m.prototype;Ii.add=pi,Ii.calendar=ht,Ii.clone=dt,Ii.diff=bt,Ii.endOf=Mt,Ii.format=St,Ii.from=Et,Ii.fromNow=Ot,Ii.to=At,Ii.toNow=jt,Ii.get=B,Ii.invalidAt=Ht,Ii.isAfter=pt,Ii.isBefore=vt,Ii.isBetween=mt,Ii.isSame=gt,Ii.isSameOrAfter=yt,Ii.isSameOrBefore=_t,Ii.isValid=Ft,Ii.lang=mi,Ii.locale=Tt,Ii.localeData=Dt,Ii.max=ci,Ii.min=ui,Ii.parsingFlags=Ut,Ii.set=B,Ii.startOf=It,Ii.subtract=vi,Ii.toArray=Rt,Ii.toObject=Pt,Ii.toDate=Lt,Ii.toISOString=kt,Ii.toJSON=Nt,Ii.toString=xt,Ii.unix=qt,Ii.valueOf=Ct,Ii.creationData=Yt,Ii.year=si,Ii.isLeapYear=we,Ii.weekYear=Wt,Ii.isoWeekYear=Vt,Ii.quarter=Ii.quarters=Kt,Ii.month=ce,Ii.daysInMonth=le,Ii.week=Ii.weeks=en,Ii.isoWeek=Ii.isoWeeks=tn,Ii.weeksInYear=Gt,Ii.isoWeeksInYear=$t,Ii.date=yi,Ii.day=Ii.days=cn,Ii.weekday=ln,Ii.isoWeekday=fn,Ii.dayOfYear=mn,Ii.hour=Ii.hours=Oi,Ii.minute=Ii.minutes=Ai,Ii.second=Ii.seconds=ji,Ii.millisecond=Ii.milliseconds=Di,Ii.utcOffset=ze,Ii.utc=Ke,Ii.local=Ze,Ii.parseZone=Xe,Ii.hasAlignedHourOffset=Qe,Ii.isDST=et,Ii.isDSTShifted=tt,Ii.isLocal=nt,Ii.isUtcOffset=rt,Ii.isUtc=it,Ii.isUTC=it,Ii.zoneAbbr=Sn,Ii.zoneName=En,Ii.dates=x("dates accessor is deprecated. Use date instead.",yi),Ii.months=x("months accessor is deprecated. Use month instead",ce),Ii.years=x("years accessor is deprecated. Use year instead",si),Ii.zone=x("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Je);var Mi=Ii,Ci={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},qi={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},Li="Invalid date",Ri="%d",Pi=/\d{1,2}/,Ni={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Fi=j.prototype;Fi._calendar=Ci,Fi.calendar=jn,Fi._longDateFormat=qi,Fi.longDateFormat=Tn,Fi._invalidDate=Li,Fi.invalidDate=Dn,Fi._ordinal=Ri,Fi.ordinal=In,Fi._ordinalParse=Pi,Fi.preparse=Mn,Fi.postformat=Mn,Fi._relativeTime=Ni,Fi.relativeTime=Cn,Fi.pastFuture=qn,Fi.set=O,Fi.months=ie,Fi._months=Zr,Fi.monthsShort=oe,Fi._monthsShort=Xr,Fi.monthsParse=se,Fi._monthsRegex=ei,Fi.monthsRegex=he,Fi._monthsShortRegex=Qr,Fi.monthsShortRegex=fe,Fi.week=Zt,Fi._week=gi,Fi.firstDayOfYear=Qt,Fi.firstDayOfWeek=Xt,Fi.weekdays=rn,Fi._weekdays=_i,Fi.weekdaysMin=an,Fi._weekdaysMin=wi,Fi.weekdaysShort=on,Fi._weekdaysShort=bi,Fi.weekdaysParse=un,Fi._weekdaysRegex=xi,Fi.weekdaysRegex=hn,Fi._weekdaysShortRegex=ki,Fi.weekdaysShortRegex=dn,Fi._weekdaysMinRegex=Si,Fi.weekdaysMinRegex=pn,Fi.isPM=wn,Fi._meridiemParse=Ei,Fi.meridiem=xn,M("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,n=1===_(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+n}}),n.lang=x("moment.lang is deprecated. Use moment.locale instead.",M),n.langData=x("moment.langData is deprecated. Use moment.localeData instead.",L);var Ui=Math.abs,Hi=Qn("ms"),Yi=Qn("s"),Bi=Qn("m"),Wi=Qn("h"),Vi=Qn("d"),$i=Qn("w"),Gi=Qn("M"),zi=Qn("y"),Ji=tr("milliseconds"),Ki=tr("seconds"),Zi=tr("minutes"),Xi=tr("hours"),Qi=tr("days"),eo=tr("months"),to=tr("years"),no=Math.round,ro={s:45,m:45,h:22,d:26,M:11},io=Math.abs,oo=Ye.prototype;oo.abs=Bn,oo.add=Vn,oo.subtract=$n,oo.as=Zn,oo.asMilliseconds=Hi,oo.asSeconds=Yi,oo.asMinutes=Bi,oo.asHours=Wi,oo.asDays=Vi,oo.asWeeks=$i,oo.asMonths=Gi,oo.asYears=zi,oo.valueOf=Xn,oo._bubble=zn,oo.get=er,oo.milliseconds=Ji,oo.seconds=Ki,oo.minutes=Zi,oo.hours=Xi,oo.days=Qi,oo.weeks=nr,oo.months=eo,oo.years=to,oo.humanize=ar,oo.toISOString=sr,oo.toString=sr,oo.toJSON=sr,oo.locale=Tt,oo.localeData=Dt,oo.toIsoString=x("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",sr),oo.lang=mi,V("X",0,0,"unix"),V("x",0,0,"valueOf"),K("x",qr),K("X",Pr),ee("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e,10))}),ee("x",function(e,t,n){n._d=new Date(_(e))}),n.version="2.13.0",r(Ne),n.fn=Mi,n.min=Ue,n.max=He,n.now=li,n.utc=c,n.unix=On,n.months=Nn,n.isDate=o,n.locale=M,n.invalid=d,n.duration=ot,n.isMoment=g,n.weekdays=Un,n.parseZone=An,n.localeData=L,n.isDuration=Be,n.monthsShort=Fn,n.weekdaysMin=Yn,n.defineLocale=C,n.updateLocale=q,n.locales=R,n.weekdaysShort=Hn,n.normalizeUnits=N,n.relativeTimeThreshold=or,n.prototype=Mi;var ao=n;return ao})},{}],132:[function(e,t,n){(function(r){!function(e){if("object"==typeof n&&"undefined"!=typeof t)t.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i;i="undefined"!=typeof window?window:"undefined"!=typeof r?r:"undefined"!=typeof self?self:this,i.PouchDB=e()}}(function(){var t;return function n(t,r,i){function o(s,u){if(!r[s]){if(!t[s]){var c="function"==typeof e&&e;if(!u&&c)return c(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var f=r[s]={exports:{}};t[s][0].call(f.exports,function(e){var n=t[s][1][e];return o(n?n:e)},f,f.exports,n,t,r,i)}return r[s].exports}for(var a="function"==typeof e&&e,s=0;s=31}function i(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),!t)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0,o=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r),e}function o(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?n.storage.removeItem("debug"):n.storage.debug=e}catch(t){}}function s(){var e;try{e=n.storage.debug}catch(t){}return e}function u(){try{return window.localStorage}catch(e){}}n=t.exports=e(3),n.log=o,n.formatArgs=i,n.save=a,n.load=s,n.useColors=r,n.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(e){return JSON.stringify(e)},n.enable(s())},{3:3}],3:[function(e,t,n){function r(){return n.colors[l++%n.colors.length]}function i(e){function t(){}function i(){var e=i,t=+new Date,o=t-(c||t);e.diff=o,e.prev=c,e.curr=t,c=t,null==e.useColors&&(e.useColors=n.useColors()),null==e.color&&e.useColors&&(e.color=r());var a=Array.prototype.slice.call(arguments);a[0]=n.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var s=0;a[0]=a[0].replace(/%([a-z%])/g,function(t,r){if("%%"===t)return t;s++;var i=n.formatters[r];if("function"==typeof i){var o=a[s];t=i.call(e,o),a.splice(s,1),s--}return t}),"function"==typeof n.formatArgs&&(a=n.formatArgs.apply(e,a));var u=i.log||n.log||console.log.bind(console);u.apply(e,a)}t.enabled=!1,i.enabled=!0;var o=n.enabled(e)?i:t;return o.namespace=e,o}function o(e){n.save(e);for(var t=(e||"").split(/[\s,]+/),r=t.length,i=0;r>i;i++)t[i]&&(e=t[i].replace(/\*/g,".*?"),"-"===e[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))}function a(){n.enable("")}function s(e){var t,r;for(t=0,r=n.skips.length;r>t;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;r>t;t++)if(n.names[t].test(e))return!0;return!1}function u(e){return e instanceof Error?e.stack||e.message:e; +}n=t.exports=i,n.coerce=u,n.disable=a,n.enable=o,n.enabled=s,n.humanize=e(9),n.names=[],n.skips=[],n.formatters={};var c,l=0},{9:9}],4:[function(e,t,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!o(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,n,r,o,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[e],s(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),n.apply(this,o)}else if(a(n))for(o=Array.prototype.slice.call(arguments,1),c=n.slice(),r=c.length,u=0;r>u;u++)c[u].apply(this,o);return!0},r.prototype.addListener=function(e,t){var n;if(!i(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,i(t.listener)?t.listener:t),this._events[e]?a(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,a(this._events[e])&&!this._events[e].warned&&(n=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,o,s;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],o=n.length,r=-1,n===t||i(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(s=o;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){r=s;break}if(0>r)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],i(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},{}],5:[function(e,t,n){(function(e){"use strict";function n(){l=!0;for(var e,t,n=f.length;n;){for(t=f,f=[],e=-1;++e1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*f;case"days":case"day":case"d":return n*l;case"hours":case"hour":case"hrs":case"hr":case"h":return n*c;case"minutes":case"minute":case"mins":case"min":case"m":return n*u;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}}function i(e){return e>=l?Math.round(e/l)+"d":e>=c?Math.round(e/c)+"h":e>=u?Math.round(e/u)+"m":e>=s?Math.round(e/s)+"s":e+"ms"}function o(e){return a(e,l,"day")||a(e,c,"hour")||a(e,u,"minute")||a(e,s,"second")||e+" ms"}function a(e,t,n){return t>e?void 0:1.5*t>e?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}var s=1e3,u=60*s,c=60*u,l=24*c,f=365.25*l;t.exports=function(e,t){return t=t||{},"string"==typeof e?r(e):t["long"]?o(e):i(e)}},{}],10:[function(e,t,n){"use strict";function r(e){if(null!==e)switch(typeof e){case"boolean":return e?1:0;case"number":return l(e);case"string":return e.replace(/\u0002/g,"").replace(/\u0001/g,"").replace(/\u0000/g,"");case"object":var t=Array.isArray(e),r=t?e:Object.keys(e),i=-1,o=r.length,a="";if(t)for(;++ii;i++){var o=n.collate(e[i],t[i]);if(0!==o)return o}return e.length===t.length?0:e.length>t.length?1:-1}function s(e,t){return e===t?0:e>t?1:-1}function u(e,t){for(var r=Object.keys(e),i=Object.keys(t),o=Math.min(r.length,i.length),a=0;o>a;a++){var s=n.collate(r[a],i[a]);if(0!==s)return s;if(s=n.collate(e[r[a]],t[i[a]]),0!==s)return s}return r.length===i.length?0:r.length>i.length?1:-1}function c(e){var t=["boolean","number","string","object"],n=t.indexOf(typeof e);return~n?null===e?1:Array.isArray(e)?5:3>n?n+2:n+3:Array.isArray(e)?5:void 0}function l(e){if(0===e)return"1";var t=e.toExponential().split(/e\+?/),n=parseInt(t[1],10),r=0>e,i=r?"0":"2",o=(r?-n:n)-f,a=p.padLeft(o.toString(),"0",h);i+=d+a;var s=Math.abs(parseFloat(t[0]));r&&(s=10-s);var u=s.toFixed(20);return u=u.replace(/\.?0+$/,""),i+=d+u}var f=-324,h=3,d="",p=e(11);n.collate=function(e,t){if(e===t)return 0;e=n.normalizeKey(e),t=n.normalizeKey(t);var r=c(e),i=c(t);if(r-i!==0)return r-i;if(null===e)return 0;switch(typeof e){case"number":return e-t;case"boolean":return e===t?0:t>e?-1:1;case"string":return s(e,t)}return Array.isArray(e)?a(e,t):u(e,t)},n.normalizeKey=function(e){switch(typeof e){case"undefined":return null;case"number":return e===1/0||e===-(1/0)||isNaN(e)?null:e;case"object":var t=e;if(Array.isArray(e)){var r=e.length;e=new Array(r);for(var i=0;r>i;i++)e[i]=n.normalizeKey(t[i])}else{if(e instanceof Date)return e.toJSON();if(null!==e){e={};for(var o in t)if(t.hasOwnProperty(o)){var a=t[o];"undefined"!=typeof a&&(e[o]=n.normalizeKey(a))}}}}return e},n.toIndexableString=function(e){var t="\x00";return e=n.normalizeKey(e),c(e)+d+r(e)+t},n.parseIndexableString=function(e){for(var t=[],n=[],r=0;;){var a=e[r++];if("\x00"!==a)switch(a){case"1":t.push(null);break;case"2":t.push("1"===e[r]),r++;break;case"3":var s=i(e,r);t.push(s.num),r+=s.length;break;case"4":for(var u="";;){var c=e[r];if("\x00"===c)break;u+=c,r++}u=u.replace(/\u0001\u0001/g,"\x00").replace(/\u0001\u0002/g,"").replace(/\u0002\u0002/g,""),t.push(u);break;case"5":var l={element:[],index:t.length};t.push(l.element),n.push(l);break;case"6":var f={element:{},index:t.length};t.push(f.element),n.push(f);break;default:throw new Error("bad collationIndex or unexpectedly reached end of input: "+a)}else{if(1===t.length)return t.pop();o(t,n)}}}},{11:11}],11:[function(e,t,n){"use strict";function r(e,t,n){for(var r="",i=n-e.length;r.lengthn;n++){if(n===i)return 1;var o=e.charAt(n),a=t.charAt(n);if(o!==a)return a>o?-1:1}return i>r?-1:0},n.intToDecimalForm=function(e){var t=0>e,n="";do{var r=t?-Math.ceil(e%10):Math.floor(e%10);n=r+n,e=t?Math.ceil(e/10):Math.floor(e/10)}while(e);return t&&"0"!==n&&(n="-"+n),n}},{}],12:[function(e,t,n){"use strict";function r(){this.store={}}function i(e){if(this.store=new r,e&&Array.isArray(e))for(var t=0,n=e.length;n>t;t++)this.add(e[t])}n.Map=r,n.Set=i,r.prototype.mangle=function(e){if("string"!=typeof e)throw new TypeError("key must be a string but Got "+e);return"$"+e},r.prototype.unmangle=function(e){return e.substring(1)},r.prototype.get=function(e){var t=this.mangle(e);return t in this.store?this.store[t]:void 0},r.prototype.set=function(e,t){var n=this.mangle(e);return this.store[n]=t,!0},r.prototype.has=function(e){var t=this.mangle(e);return t in this.store},r.prototype["delete"]=function(e){var t=this.mangle(e);return t in this.store?(delete this.store[t],!0):!1},r.prototype.forEach=function(e){for(var t=Object.keys(this.store),n=0,r=t.length;r>n;n++){var i=t[n],o=this.store[i];i=this.unmangle(i),e(o,i)}},i.prototype.add=function(e){return this.store.set(e,!0)},i.prototype.has=function(e){return this.store.has(e)},i.prototype["delete"]=function(e){return this.store["delete"](e)}},{}],13:[function(e,t,n){function r(){l=!1,s.length?c=s.concat(c):f=-1,c.length&&i()}function i(){if(!l){var e=setTimeout(r);l=!0;for(var t=c.length;t;){for(s=c,c=[];++f1)for(var n=1;n>>32-i,n)}function n(e,n,r,i,o,a,s){return t(n&r|~n&i,e,n,o,a,s)}function r(e,n,r,i,o,a,s){return t(n&i|r&~i,e,n,o,a,s)}function i(e,n,r,i,o,a,s){return t(n^r^i,e,n,o,a,s)}function o(e,n,r,i,o,a,s){return t(r^(n|~i),e,n,o,a,s)}function a(e,t){var a=e[0],s=e[1],u=e[2],c=e[3];a=n(a,s,u,c,t[0],7,-680876936),c=n(c,a,s,u,t[1],12,-389564586),u=n(u,c,a,s,t[2],17,606105819),s=n(s,u,c,a,t[3],22,-1044525330),a=n(a,s,u,c,t[4],7,-176418897),c=n(c,a,s,u,t[5],12,1200080426),u=n(u,c,a,s,t[6],17,-1473231341),s=n(s,u,c,a,t[7],22,-45705983),a=n(a,s,u,c,t[8],7,1770035416),c=n(c,a,s,u,t[9],12,-1958414417),u=n(u,c,a,s,t[10],17,-42063),s=n(s,u,c,a,t[11],22,-1990404162),a=n(a,s,u,c,t[12],7,1804603682),c=n(c,a,s,u,t[13],12,-40341101),u=n(u,c,a,s,t[14],17,-1502002290),s=n(s,u,c,a,t[15],22,1236535329),a=r(a,s,u,c,t[1],5,-165796510),c=r(c,a,s,u,t[6],9,-1069501632),u=r(u,c,a,s,t[11],14,643717713),s=r(s,u,c,a,t[0],20,-373897302),a=r(a,s,u,c,t[5],5,-701558691),c=r(c,a,s,u,t[10],9,38016083),u=r(u,c,a,s,t[15],14,-660478335),s=r(s,u,c,a,t[4],20,-405537848),a=r(a,s,u,c,t[9],5,568446438),c=r(c,a,s,u,t[14],9,-1019803690),u=r(u,c,a,s,t[3],14,-187363961),s=r(s,u,c,a,t[8],20,1163531501),a=r(a,s,u,c,t[13],5,-1444681467),c=r(c,a,s,u,t[2],9,-51403784),u=r(u,c,a,s,t[7],14,1735328473),s=r(s,u,c,a,t[12],20,-1926607734),a=i(a,s,u,c,t[5],4,-378558),c=i(c,a,s,u,t[8],11,-2022574463),u=i(u,c,a,s,t[11],16,1839030562),s=i(s,u,c,a,t[14],23,-35309556),a=i(a,s,u,c,t[1],4,-1530992060),c=i(c,a,s,u,t[4],11,1272893353),u=i(u,c,a,s,t[7],16,-155497632),s=i(s,u,c,a,t[10],23,-1094730640),a=i(a,s,u,c,t[13],4,681279174),c=i(c,a,s,u,t[0],11,-358537222),u=i(u,c,a,s,t[3],16,-722521979),s=i(s,u,c,a,t[6],23,76029189),a=i(a,s,u,c,t[9],4,-640364487),c=i(c,a,s,u,t[12],11,-421815835),u=i(u,c,a,s,t[15],16,530742520),s=i(s,u,c,a,t[2],23,-995338651),a=o(a,s,u,c,t[0],6,-198630844),c=o(c,a,s,u,t[7],10,1126891415),u=o(u,c,a,s,t[14],15,-1416354905),s=o(s,u,c,a,t[5],21,-57434055),a=o(a,s,u,c,t[12],6,1700485571),c=o(c,a,s,u,t[3],10,-1894986606),u=o(u,c,a,s,t[10],15,-1051523),s=o(s,u,c,a,t[1],21,-2054922799),a=o(a,s,u,c,t[8],6,1873313359),c=o(c,a,s,u,t[15],10,-30611744),u=o(u,c,a,s,t[6],15,-1560198380),s=o(s,u,c,a,t[13],21,1309151649),a=o(a,s,u,c,t[4],6,-145523070),c=o(c,a,s,u,t[11],10,-1120210379),u=o(u,c,a,s,t[2],15,718787259),s=o(s,u,c,a,t[9],21,-343485551),e[0]=_(a,e[0]),e[1]=_(s,e[1]),e[2]=_(u,e[2]),e[3]=_(c,e[3])}function s(e){var t,n=[];for(t=0;64>t;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function u(e){var t,n=[];for(t=0;64>t;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function c(e){var t,n,r,i,o,u,c=e.length,l=[1732584193,-271733879,-1732584194,271733878];for(t=64;c>=t;t+=64)a(l,s(e.substring(t-64,t)));for(e=e.substring(t-64),n=e.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;n>t;t+=1)r[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(r[t>>2]|=128<<(t%4<<3),t>55)for(a(l,r),t=0;16>t;t+=1)r[t]=0;return i=8*c,i=i.toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(i[2],16),u=parseInt(i[1],16)||0,r[14]=o,r[15]=u,a(l,r),l}function l(e){var t,n,r,i,o,s,c=e.length,l=[1732584193,-271733879,-1732584194,271733878];for(t=64;c>=t;t+=64)a(l,u(e.subarray(t-64,t)));for(e=c>t-64?e.subarray(t-64):new Uint8Array(0),n=e.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;n>t;t+=1)r[t>>2]|=e[t]<<(t%4<<3);if(r[t>>2]|=128<<(t%4<<3),t>55)for(a(l,r),t=0;16>t;t+=1)r[t]=0;return i=8*c,i=i.toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(i[2],16),s=parseInt(i[1],16)||0,r[14]=o,r[15]=s,a(l,r),l}function f(e){var t,n="";for(t=0;4>t;t+=1)n+=b[e>>8*t+4&15]+b[e>>8*t&15];return n}function h(e){var t;for(t=0;tn;n+=1)o[n]=e.charCodeAt(n);return t?o:i}function v(e){return String.fromCharCode.apply(null,new Uint8Array(e))}function m(e,t,n){var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e)),r.set(new Uint8Array(t),e.byteLength),n?r:r.buffer}function g(e){var t,n=[],r=e.length;for(t=0;r-1>t;t+=2)n.push(parseInt(e.substr(t,2),16));return String.fromCharCode.apply(String,n)}function y(){this.reset()}var _=function(e,t){return e+t&4294967295},b=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];return"5d41402abc4b2a76b9719d911017c592"!==h(c("hello"))&&(_=function(e,t){var n=(65535&e)+(65535&t),r=(e>>16)+(t>>16)+(n>>16);return r<<16|65535&n}),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||!function(){function t(e,t){return e=0|e||0,0>e?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(n,r){var i,o,a,s,u=this.byteLength,c=t(n,u),l=u;return r!==e&&(l=t(r,u)),c>l?new ArrayBuffer(0):(i=l-c,o=new ArrayBuffer(i),a=new Uint8Array(o),s=new Uint8Array(this,c,i),a.set(s),o)}}(),y.prototype.append=function(e){return this.appendBinary(d(e)),this},y.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,n=this._buff.length;for(t=64;n>=t;t+=64)a(this._hash,s(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},y.prototype.end=function(e){var t,n,r=this._buff,i=r.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;i>t;t+=1)o[t>>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(o,i),n=h(this._hash),e&&(n=g(n)),this.reset(),n},y.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},y.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}},y.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},y.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},y.prototype._finish=function(e,t){var n,r,i,o=t;if(e[o>>2]|=128<<(o%4<<3),o>55)for(a(this._hash,e),o=0;16>o;o+=1)e[o]=0;n=8*this._length,n=n.toString(16).match(/(.*?)(.{0,8})$/),r=parseInt(n[2],16),i=parseInt(n[1],16)||0,e[14]=r,e[15]=i,a(this._hash,e)},y.hash=function(e,t){return y.hashBinary(d(e),t)},y.hashBinary=function(e,t){var n=c(e),r=h(n);return t?g(r):r},y.ArrayBuffer=function(){this.reset()},y.ArrayBuffer.prototype.append=function(e){var t,n=m(this._buff.buffer,e,!0),r=n.length;for(this._length+=e.byteLength,t=64;r>=t;t+=64)a(this._hash,u(n.subarray(t-64,t)));return this._buff=r>t-64?new Uint8Array(n.buffer.slice(t-64)):new Uint8Array(0),this},y.ArrayBuffer.prototype.end=function(e){var t,n,r=this._buff,i=r.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;i>t;t+=1)o[t>>2]|=r[t]<<(t%4<<3);return this._finish(o,i),n=h(this._hash),e&&(n=g(n)),this.reset(),n},y.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},y.ArrayBuffer.prototype.getState=function(){var e=y.prototype.getState.call(this);return e.buff=v(e.buff),e},y.ArrayBuffer.prototype.setState=function(e){return e.buff=p(e.buff,!0),y.prototype.setState.call(this,e)},y.ArrayBuffer.prototype.destroy=y.prototype.destroy,y.ArrayBuffer.prototype._finish=y.prototype._finish,y.ArrayBuffer.hash=function(e,t){var n=l(new Uint8Array(e)),r=h(n);return t?g(r):r},y})},{}],16:[function(e,t,n){"use strict";function r(e,t,n){var r=n[n.length-1];e===r.element&&(n.pop(),r=n[n.length-1]);var i=r.element,o=r.index;if(Array.isArray(i))i.push(e);else if(o===t.length-2){var a=t.pop();i[a]=e}else t.push(e)}n.stringify=function(e){var t=[];t.push({obj:e});for(var n,r,i,o,a,s,u,c,l,f,h,d="";n=t.pop();)if(r=n.obj,i=n.prefix||"",o=n.val||"",d+=i,o)d+=o;else if("object"!=typeof r)d+="undefined"==typeof r?null:JSON.stringify(r);else if(null===r)d+="null";else if(Array.isArray(r)){for(t.push({val:"]"}),a=r.length-1;a>=0;a--)s=0===a?"":",",t.push({obj:r[a],prefix:s});t.push({val:"["})}else{u=[];for(c in r)r.hasOwnProperty(c)&&u.push(c);for(t.push({val:"}"}),a=u.length-1;a>=0;a--)l=u[a],f=r[l],h=a>0?",":"",h+=JSON.stringify(l)+":",t.push({obj:f,prefix:h});t.push({val:"{"})}return d},n.parse=function(e){for(var t,n,i,o,a,s,u,c,l,f=[],h=[],d=0;;)if(t=e[d++],"}"!==t&&"]"!==t&&"undefined"!=typeof t)switch(t){case" ":case" ":case"\n":case":":case",":break;case"n":d+=3,r(null,f,h);break;case"t":d+=3,r(!0,f,h);break;case"f":d+=4,r(!1,f,h);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":for(n="",d--;;){if(i=e[d++],!/[\d\.\-e\+]/.test(i)){d--;break}n+=i}r(parseFloat(n),f,h);break;case'"':for(o="",a=void 0,s=0;;){if(u=e[d++],'"'===u&&("\\"!==a||s%2!==1))break;o+=u,a=u,"\\"===a?s++:s=0}r(JSON.parse('"'+o+'"'),f,h);break;case"[":c={element:[],index:f.length},f.push(c.element),h.push(c);break;case"{":l={element:{},index:f.length},f.push(l.element),h.push(l);break;default:throw new Error("unexpectedly reached end of input: "+t)}else{if(1===f.length)return f.pop();r(f.pop(),f,h)}}},{}],17:[function(e,t,n){(function(n,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e["default"]:e}function o(e,t){for(var n={},r=0,i=t.length;i>r;r++){var o=t[r];o in e&&(n[o]=e[o])}return n}function a(e){return e instanceof ArrayBuffer||"undefined"!=typeof Blob&&e instanceof Blob}function s(e){if("function"==typeof e.slice)return e.slice(0);var t=new ArrayBuffer(e.byteLength),n=new Uint8Array(t),r=new Uint8Array(e);return n.set(r),t}function u(e){if(e instanceof ArrayBuffer)return s(e);var t=e.size,n=e.type;return"function"==typeof e.slice?e.slice(0,t,n):e.webkitSlice(0,t,n)}function c(e){var t,n,r;if(!e||"object"!=typeof e)return e;if(Array.isArray(e)){for(t=[],n=0,r=e.length;r>n;n++)t[n]=c(e[n]);return t}if(e instanceof Date)return e.toISOString();if(a(e))return u(e);t={};for(n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var i=c(e[n]);"undefined"!=typeof i&&(t[n]=i)}return t}function l(e){var t=!1;return rr(function(n){if(t)throw new Error("once called more than once");t=!0,e.apply(this,n)})}function f(e){return rr(function(t){t=c(t);var r,i=this,o="function"==typeof t[t.length-1]?t.pop():!1;o&&(r=function(e,t){n.nextTick(function(){o(e,t)})});var a=new lr(function(n,r){var o;try{var a=l(function(e,t){e?r(e):n(t)});t.push(a),o=e.apply(i,t),o&&"function"==typeof o.then&&n(o)}catch(s){r(s)}});return r&&a.then(function(e){r(null,e)},r),a})}function h(e,t){function n(e,t,n){if(fr.enabled){for(var r=[e._db_name,t],i=0;ic;c++)o.push({pos:u+1,ids:s[c]});else{var f=!!a[1].deleted,h=a[0];t&&!(r!==f?r:n!==u?u>n:h>t)||(t=h,n=u,r=f)}}return n+"-"+t}function m(e){return e.ids}function g(e,t){t||(t=v(e));for(var n,r=t.substring(t.indexOf("-")+1),i=e.rev_tree.map(m);n=i.pop();){if(n[0]===r)return!!n[1].deleted;i=i.concat(n[2])}}function y(e){return or("return "+e+";",{})}function _(e){return new Function("doc",["var emitted = false;","var emit = function (a, b) {"," emitted = true;","};","var view = "+e+";","view(doc);","if (emitted) {"," return true;","}"].join("\n"))}function b(e){if(!e)return null;var t=e.split("/");return 2===t.length?t:1===t.length?[e,e]:null}function w(e){var t=b(e);return t?t.join("/"):null}function x(e,t){for(var n,r=e.slice();n=r.pop();)for(var i=n.pos,o=n.ids,a=o[2],s=t(0===a.length,i,o[0],n.ctx,o[1]),u=0,c=a.length;c>u;u++)r.push({pos:i+1,ids:a[u],ctx:s})}function k(e,t){return e.pos-t.pos}function S(e){var t=[];x(e,function(e,n,r,i,o){e&&t.push({rev:n+"-"+r,pos:n,opts:o})}),t.sort(k).reverse();for(var n=0,r=t.length;r>n;n++)delete t[n].pos;return t}function E(e){for(var t=v(e),n=S(e.rev_tree),r=[],i=0,o=n.length;o>i;i++){var a=n[i];a.rev===t||a.opts.deleted||r.push(a.rev)}return r}function O(e){Error.call(this,e.reason),this.status=e.status,this.name=e.error,this.message=e.reason,this.error=!0}function A(e,t,n){function r(t){for(var r in e)"function"!=typeof e[r]&&(this[r]=e[r]);void 0!==n&&(this.name=n),void 0!==t&&(this.reason=t)}return r.prototype=O.prototype,new r(t)}function j(e){var t,n,r,i,o;return n=e.error===!0&&"string"==typeof e.name?e.name:e.error,o=e.reason,r=Pr("name",n,o),e.missing||"missing"===o||"deleted"===o||"not_found"===n?r=pr:"doc_validation"===n?(r=Sr,i=o):"bad_request"===n&&r.message!==o&&(r=Er),r||(r=Pr("status",e.status,o)||br),t=A(r,o,n),i&&(t.message=i),e.id&&(t.id=e.id),e.status&&(t.status=e.status),e.missing&&(t.missing=e.missing),t}function T(e,t,n){function r(){i.cancel()}ir.EventEmitter.call(this);var i=this;this.db=e,t=t?c(t):{};var o=t.complete=l(function(t,n){t?i.emit("error",t):i.emit("complete",n),i.removeAllListeners(),e.removeListener("destroyed",r)});n&&(i.on("complete",function(e){n(null,e)}),i.on("error",n)),e.once("destroyed",r),t.onChange=function(e){t.isCancelled||(i.emit("change",e),i.startSeq&&i.startSeq<=e.seq&&(i.startSeq=!1))};var a=new lr(function(e,n){t.complete=function(t,r){t?n(t):e(r)}});i.once("cancel",function(){e.removeListener("destroyed",r),t.complete(null,{status:"cancelled"})}),this.then=a.then.bind(a),this["catch"]=a["catch"].bind(a),this.then(function(e){o(null,e)},o),e.taskqueue.isReady?i.doChanges(t):e.taskqueue.addTask(function(){i.isCancelled?i.emit("cancel"):i.doChanges(t)})}function D(e,t,n){var r=[{rev:e._rev}];"all_docs"===n.style&&(r=S(t.rev_tree).map(function(e){return{rev:e.rev}}));var i={id:t.id,changes:r,doc:e};return g(t,e._rev)&&(i.deleted=!0),n.conflicts&&(i.doc._conflicts=E(t),i.doc._conflicts.length||delete i.doc._conflicts),i}function I(e,t,n){function r(){var e=[];f.forEach(function(t){t.docs.forEach(function(n){e.push({id:t.id,docs:[n]})})}),n(null,{results:e})}function i(){++l===c&&r()}function a(e,t,n){f[e]={id:t,docs:n},i()}var s=Array.isArray(t)?t:t.docs,u={};s.forEach(function(e){e.id in u?u[e.id].push(e):u[e.id]=[e]});var c=Object.keys(u).length,l=0,f=new Array(c);Object.keys(u).forEach(function(n,r){var i=u[n],s=o(i[0],["atts_since","attachments"]);s.open_revs=i.map(function(e){return e.rev}),s.open_revs=s.open_revs.filter(function(e){return e});var c=function(e){return e};0===s.open_revs.length&&(delete s.open_revs,c=function(e){return[{ok:e}]}),["revs","attachments","binary","ajax"].forEach(function(e){e in t&&(s[e]=t[e])}),e.get(n,s,function(e,t){a(r,n,e?[{error:e}]:c(t))})})}function M(e){return/^_local/.test(e)}function C(e){for(var t,n=[],r=e.slice();t=r.pop();){var i=t.pos,o=t.ids,a=o[0],s=o[1],u=o[2],c=0===u.length,l=t.history?t.history.slice():[];l.push({id:a,opts:s}),c&&n.push({pos:i+1-l.length,ids:l});for(var f=0,h=u.length;h>f;f++)r.push({pos:i+1,ids:u[f],history:l})}return n.reverse()}function q(e){return 0|Math.random()*e}function L(e,t){t=t||Nr.length;var n="",r=-1;if(e){for(;++ro;o++)i=[r[o],{status:"missing"},[i]];return[{pos:n,ids:i}]}function U(e,t){var n,r,i,o={status:"available"};if(e._deleted&&(o.deleted=!0),t)if(e._id||(e._id=L()),r=L(32,16).toLowerCase(),e._rev){if(i=N(e._rev),i.error)return i;e._rev_tree=[{pos:i.prefix,ids:[i.id,{ +status:"missing"},[[r,o,[]]]]}],n=i.prefix+1}else e._rev_tree=[{pos:1,ids:[r,o,[]]}],n=1;else if(e._revisions&&(e._rev_tree=F(e._revisions,o),n=e._revisions.start,r=e._revisions.ids[0]),!e._rev_tree){if(i=N(e._rev),i.error)return i;n=i.prefix,r=i.id,e._rev_tree=[{pos:n,ids:[r,o,[]]}]}P(e._id),e._rev=n+"-"+r;var a={metadata:{},data:{}};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var u="_"===s[0];if(u&&!Fr[s]){var c=A(Sr,s);throw c.message=Sr.message+": "+s,c}u&&!Ur[s]?a.metadata[s.slice(1)]=e[s]:a.data[s]=e[s]}return a}function H(e,t){return t>e?-1:e>t?1:0}function Y(e,t){for(var n=0;n0?t.keys.slice(t.skip):t.keys;if(t.descending&&r.reverse(),!r.length)return e._allDocs({limit:0},n);var i={offset:t.skip};return lr.all(r.map(function(n){var r=Zn.extend({key:n,deleted:"ok"},t);return["limit","skip","keys"].forEach(function(e){delete r[e]}),new lr(function(t,o){e._allDocs(r,function(e,r){return e?o(e):(i.total_rows=r.total_rows,void t(r.rows[0]||{key:n,error:"not_found"}))})})})).then(function(e){return i.rows=e,i})}function z(e){var t=e._compactionQueue[0],r=t.opts,i=t.callback;e.get("_local/compaction")["catch"](function(){return!1}).then(function(t){t&&t.last_seq&&(r.last_seq=t.last_seq),e._compact(r,function(t,r){t?i(t):i(null,r),n.nextTick(function(){e._compactionQueue.shift(),e._compactionQueue.length&&z(e)})})})}function J(e){return"_"===e.charAt(0)?e+"is not a valid attachment name, attachment names cannot start with '_'":!1}function K(e,t,n,r){t.seq=t.seq||0;var i={doc_ids:["_design/"+n],limit:1,since:t.seq};e.changes(i).then(function(e){var n=e.results&&e.results.length&&e.results[0].seq;n&&n>t.seq&&(t.seq=n,delete t.promise),r()})["catch"](r)}function Z(e,t,n){e._ddocCache=e._ddocCache||{},e._ddocCache[t]=e._ddocCache[t]||{};var r=e._ddocCache[t];K(e,r,t,function(i){return i?n(i):(r.promise||(r.promise=new lr(function(n,r){e._get("_design/"+t,{},function(e,t){if(e)return r(e);var i={};["views","filters"].forEach(function(e){i[e]=t.doc[e]}),n(i)})})),void r.promise.then(function(e){n(null,e)})["catch"](n))})}function X(e,t,n,r,i){Z(e,t,function(e,t){if(e)return i(e);var o=t[n]&&t[n][r];return o?void i(null,o):i(A(pr))})}function Q(){ir.EventEmitter.call(this)}function ee(){this.isReady=!1,this.failed=!1,this.queue=[]}function te(e){e&&r.debug&&console.error(e)}function ne(e,t){function n(){o.emit("destroyed",i)}function r(){e.removeListener("destroyed",n),e.emit("destroyed",e)}var i=t.originalName,o=e.constructor,a=o._destructionListeners;e.once("destroyed",n),a.has(i)||a.set(i,[]),a.get(i).push(r)}function re(e,t,n){if(!(this instanceof re))return new re(e,t,n);var r=this;"function"!=typeof t&&"undefined"!=typeof t||(n=t,t={}),e&&"object"==typeof e&&(t=e,e=void 0),"undefined"==typeof n&&(n=te),e=e||t.name,t=c(t),delete t.name,this.__opts=t;var i=n;r.auto_compaction=t.auto_compaction,r.prefix=re.prefix,Q.call(r),r.taskqueue=new ee;var o=new lr(function(i,o){n=function(e,t){return e?o(e):(delete t.then,void i(t))},t=c(t);var a,s,u=t.name||e;return function(){try{if("string"!=typeof u)throw s=new Error("Missing/invalid DB name"),s.code=400,s;if(a=re.parseAdapter(u,t),t.originalName=u,t.name=a.name,t.prefix&&"http"!==a.adapter&&"https"!==a.adapter&&(t.name=t.prefix+t.name),t.adapter=t.adapter||a.adapter,r._adapter=t.adapter,Qn("pouchdb:adapter")("Picked adapter: "+t.adapter),r._db_name=u,!re.adapters[t.adapter])throw s=new Error("Adapter is missing"),s.code=404,s;if(!re.adapters[t.adapter].valid())throw s=new Error("Invalid Adapter"),s.code=404,s}catch(e){r.taskqueue.fail(e)}}(),s?o(s):(r.adapter=t.adapter,r.replicate={},r.replicate.from=function(e,t,n){return r.constructor.replicate(e,r,t,n)},r.replicate.to=function(e,t,n){return r.constructor.replicate(r,e,t,n)},r.sync=function(e,t,n){return r.constructor.sync(r,e,t,n)},r.replicate.sync=r.sync,void re.adapters[t.adapter].call(r,t,function(e){return e?(r.taskqueue.fail(e),void n(e)):(ne(r,t),r.emit("created",r),re.emit("created",t.originalName),r.taskqueue.ready(r),void n(null,r))}))});o.then(function(e){i(null,e)},i),r.then=o.then.bind(o),r["catch"]=o["catch"].bind(o)}function ie(){return"undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage&&"undefined"!=typeof chrome.storage.local}function oe(){return Hr}function ae(e){Object.keys(ir.EventEmitter.prototype).forEach(function(t){"function"==typeof ir.EventEmitter.prototype[t]&&(e[t]=Br[t].bind(Br))});var t=e._destructionListeners=new nr.Map;e.on("destroyed",function(e){t.has(e)&&(t.get(e).forEach(function(e){e()}),t["delete"](e))})}function se(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(n){if("TypeError"!==n.name)throw n;for(var r="undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder,i=new r,o=0;o0&&(r=setTimeout(function(){n.reject(new Error("Load timeout for resource: "+e.url))},e.timeout)),n.promise.then(function(t){return i={statusCode:t.status},e.timeout>0&&clearTimeout(r),i.statusCode>=200&&i.statusCode<300?e.binary?t.blob():t.text():t.json()}).then(function(e){i.statusCode>=200&&i.statusCode<300?t(null,i,e):t(e,i)})["catch"](function(e){t(e,i)}),{abort:n.reject}}function fe(e,t){var n,r,i=!1,o=function(){n.abort()},a=function(){i=!0,n.abort()};n=e.xhr?new e.xhr:new XMLHttpRequest;try{n.open(e.method,e.url)}catch(s){t(s,{statusCode:413})}n.withCredentials="withCredentials"in e?e.withCredentials:!0,"GET"===e.method?delete e.headers["Content-Type"]:e.json&&(e.headers.Accept="application/json",e.headers["Content-Type"]=e.headers["Content-Type"]||"application/json",e.body&&e.processData&&"string"!=typeof e.body&&(e.body=JSON.stringify(e.body))),e.binary&&(n.responseType="arraybuffer"),"body"in e||(e.body=null);for(var u in e.headers)e.headers.hasOwnProperty(u)&&n.setRequestHeader(u,e.headers[u]);return e.timeout>0&&(r=setTimeout(a,e.timeout),n.onprogress=function(){clearTimeout(r),4!==n.readyState&&(r=setTimeout(a,e.timeout))},"undefined"!=typeof n.upload&&(n.upload.onprogress=n.onprogress)),n.onreadystatechange=function(){if(4===n.readyState){var r={statusCode:n.status};if(n.status>=200&&n.status<300){var o;o=e.binary?se([n.response||""],{type:n.getResponseHeader("Content-Type")}):n.responseText,t(null,r,o)}else{var a={};if(i)a=new Error("ETIMEDOUT"),r.statusCode=400;else try{a=JSON.parse(n.response)}catch(s){}t(a,r)}}},e.body&&e.body instanceof Blob?ue(e.body,function(e){n.send(e)}):n.send(e.body),{abort:o}}function he(){try{return new XMLHttpRequest,!0}catch(e){return!1}}function de(e,t){return Wr||e.xhr?fe(e,t):le(e,t)}function pe(){return""}function ve(e,t){function n(t,n,r){if(!e.binary&&e.json&&"string"==typeof t)try{t=JSON.parse(t)}catch(i){return r(i)}Array.isArray(t)&&(t=t.map(function(e){return e.error||e.missing?j(e):e})),e.binary&&Vr(t,n),r(null,t,n)}function r(e,t){var n,r;if(e.code&&e.status){var i=new Error(e.message||e.code);return i.status=e.status,t(i)}if(e.message&&"ETIMEDOUT"===e.message)return t(e);try{n=JSON.parse(e.responseText),r=j(n)}catch(o){r=j(e)}t(r)}e=c(e);var i={method:"GET",headers:{},json:!0,processData:!0,timeout:1e4,cache:!1};return e=Zn.extend(i,e),e.json&&(e.binary||(e.headers.Accept="application/json"),e.headers["Content-Type"]=e.headers["Content-Type"]||"application/json"),e.binary&&(e.encoding=null,e.json=!1),e.processData||(e.json=!1),de(e,function(i,o,a){if(i)return i.status=o?o.statusCode:400,r(i,t);var s,u=o.headers&&o.headers["content-type"],c=a||pe();if(!e.binary&&(e.json||!e.processData)&&"object"!=typeof c&&(/json/.test(u)||/^[\s]*\{/.test(c)&&/\}[\s]*$/.test(c)))try{c=JSON.parse(c.toString())}catch(l){}o.statusCode>=200&&o.statusCode<300?n(c,o,t):(s=j(c),s.status=o.statusCode,t(s))})}function me(e,t){var n=navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",r=-1!==n.indexOf("safari")&&-1===n.indexOf("chrome"),i=-1!==n.indexOf("msie"),o=-1!==n.indexOf("edge"),a=r||(i||o)&&"GET"===e.method,s="cache"in e?e.cache:!0,u=/^blob:/.test(e.url);if(!u&&(a||!s)){var c=-1!==e.url.indexOf("?");e.url+=(c?"&":"?")+"_nonce="+Date.now()}return ve(e,t)}function ge(e){for(var t=Jr.exec(e),n={},r=14;r--;){var i=$r[r],o=t[r]||"",a=-1!==["user","password"].indexOf(i);n[i]=a?decodeURIComponent(o):o}return n[Gr]={},n[$r[12]].replace(zr,function(e,t,r){t&&(n[Gr][t]=r)}),n}function ye(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),i=0;t>i;i++)r[i]=e.charCodeAt(i);return n}function _e(e,t){return se([ye(e)],{type:t})}function be(e,t,n){try{return!e(t,n)}catch(r){var i="Filter function threw: "+r.toString();return A(Er,i)}}function we(e){var t={},n=e.filter&&"function"==typeof e.filter;return t.query=e.query_params,function(r){r.doc||(r.doc={});var i=n&&be(e.filter,r.doc,t);if("object"==typeof i)return i;if(i)return!1;if(e.include_docs){if(!e.attachments)for(var o in r.doc._attachments)r.doc._attachments.hasOwnProperty(o)&&(r.doc._attachments[o].stub=!0)}else delete r.doc;return!0}}function xe(e,t){"console"in r&&"info"in console&&console.info("The above "+e+" is totally normal. "+t)}function ke(e,t,n,r,i){return e.get(t)["catch"](function(n){if(404===n.status)return"http"===e.type()&&xe(404,"PouchDB is just checking if a remote checkpoint exists."),{session_id:r,_id:t,history:[],replicator:ni,version:ti};throw n}).then(function(o){return i.cancelled?void 0:(o.history=(o.history||[]).filter(function(e){return e.session_id!==r}),o.history.unshift({last_seq:n,session_id:r}),o.history=o.history.slice(0,ri),o.version=ti,o.replicator=ni,o.session_id=r,o.last_seq=n,e.put(o)["catch"](function(o){if(409===o.status)return ke(e,t,n,r,i);throw o}))})}function Se(e,t,n,r){this.src=e,this.target=t,this.id=n,this.returnValue=r}function Ee(e,t){if(e.session_id===t.session_id)return{last_seq:e.last_seq,history:e.history||[]};var n=e.history||[],r=t.history||[];return Oe(n,r)}function Oe(e,t){var n=e[0],r=e.slice(1),i=t[0],o=t.slice(1);if(!n||0===t.length)return{last_seq:ii,history:[]};var a=n.session_id;if(Ae(a,t))return{last_seq:n.last_seq,history:e};var s=i.session_id;return Ae(s,r)?{last_seq:i.last_seq,history:o}:Oe(r,o)}function Ae(e,t){var n=t[0],r=t.slice(1);return e&&0!==t.length?e===n.session_id?!0:Ae(e,r):!1}function je(e){return"number"==typeof e.status&&4===Math.floor(e.status/100)}function Te(e,t){e=parseInt(e,10)||0,t=parseInt(t,10),t!==t||e>=t?t=(e||1)<<1:t+=1;var n=Math.random(),r=t-e;return~~(r*n+e)}function De(e){var t=0;return e||(t=2e3),Te(e,t)}function Ie(e,t,n,r){return e.retry===!1?(t.emit("error",n),void t.removeAllListeners()):("function"!=typeof e.back_off_function&&(e.back_off_function=De),t.emit("requestError",n),"active"!==t.state&&"pending"!==t.state||(t.emit("paused",n),t.state="stopped",t.once("active",function(){e.current_back_off=ai})),e.current_back_off=e.current_back_off||ai,e.current_back_off=e.back_off_function(e.current_back_off),void setTimeout(r,e.current_back_off))}function Me(e){return Zr(e)}function Ce(e,t,n,r){(n>0||r0||r0}function o(r){return e.allDocs({keys:r,include_docs:!0}).then(function(e){if(n.cancelled)throw new Error("cancelled");e.rows.forEach(function(e){!e.deleted&&e.doc&&Pe(e.value.rev)&&!i(e.doc)&&(u.push(e.doc),delete t[e.id])})})}function a(){var e=Object.keys(t).filter(function(e){var n=t[e].missing;return 1===n.length&&Pe(n[0])});return e.length>0?o(e):void 0}function s(){return{ok:l,docs:u}}t=c(t);var u=[],l=!0;return lr.resolve().then(a).then(r).then(s)}function Ue(e,t,n,r,i){function o(){return k?lr.resolve():Re(e,t,n).then(function(n){x=n,k=new Se(e,t,x,r)})}function a(){if(P=[],0!==w.docs.length){var e=w.docs;return t.bulkDocs({docs:e,new_edits:!1}).then(function(t){if(r.cancelled)throw p(),new Error("cancelled");var n=[],o={};t.forEach(function(e){e.error&&(i.doc_write_failures++,n.push(e),o[e.id]=e)}),R=R.concat(n),i.docs_written+=w.docs.length-n.length;var a=n.filter(function(e){return"unauthorized"!==e.name&&"forbidden"!==e.name});if(e.forEach(function(e){var t=o[e._id];t?r.emit("denied",c(t)):P.push(e)}),a.length>0){var s=new Error("bulkDocs error");throw s.other_errors=n,d("target.bulkDocs failed to write docs",s),new Error("bulkWrite partial failure")}},function(t){throw i.doc_write_failures+=e.length,t})}}function s(){if(w.error)throw new Error("There was a problem getting docs.");i.last_seq=T=w.seq;var e=c(i);return P.length&&(e.docs=P,r.emit("change",e)),O=!0,k.writeCheckpoint(w.seq,N).then(function(){if(O=!1,r.cancelled)throw p(),new Error("cancelled");w=void 0,y()})["catch"](function(e){throw O=!1,d("writeCheckpoint completed with error",e),e})}function u(){var e={};return w.changes.forEach(function(t){"_user/"!==t.id&&(e[t.id]=t.changes.map(function(e){return e.rev}))}),t.revsDiff(e).then(function(e){if(r.cancelled)throw p(),new Error("cancelled");w.diffs=e})}function l(){return Fe(e,w.diffs,r).then(function(e){w.error=!e.ok,e.docs.forEach(function(e){delete w.diffs[e._id],i.docs_read++,w.docs.push(e)})})}function f(){if(!r.cancelled&&!w){if(0===S.length)return void h(!0);w=S.shift(),u().then(l).then(a).then(s).then(f)["catch"](function(e){d("batch processing terminated with error",e)})}}function h(e){return 0===E.changes.length?void(0!==S.length||w||((D&&F.live||A)&&(r.state="pending",r.emit("paused")),A&&p())):void((e||A||E.changes.length>=I)&&(S.push(E),E={seq:0,changes:[],docs:[]},"pending"!==r.state&&"stopped"!==r.state||(r.state="active",r.emit("active")),f()))}function d(e,t){j||(t.message||(t.message=e),i.ok=!1,i.status="aborting",i.errors.push(t),R=R.concat(t),S=[],E={seq:0,changes:[],docs:[]},p())}function p(){if(!(j||r.cancelled&&(i.status="cancelled",O))){i.status=i.status||"complete",i.end_time=new Date,i.last_seq=T,j=!0;var o=R.filter(function(e){return"unauthorized"!==e.name&&"forbidden"!==e.name});if(o.length>0){var a=R.pop();R.length>0&&(a.other_errors=R),a.result=i,Ie(n,r,a,function(){Ue(e,t,n,r)})}else i.errors=R,r.emit("complete",i),r.removeAllListeners()}}function v(e){if(r.cancelled)return p();var t=we(n)(e);t&&(E.seq=e.seq,E.changes.push(e),h(F.live))}function m(e){return C=!1,r.cancelled?p():(e.results.length>0?(F.since=e.last_seq,y()):D?(F.live=!0,y()):A=!0,void h(!0))}function g(e){return C=!1,r.cancelled?p():void d("changes rejected",e)}function y(){function t(){o.cancel()}function i(){r.removeListener("cancel",t)}if(!C&&!A&&S.lengthi;i++)t+=String.fromCharCode(n[i]);return t}function ze(e,t){if("undefined"==typeof FileReader)return t(Ge((new FileReaderSync).readAsArrayBuffer(e)));var n=new FileReader,r="function"==typeof n.readAsBinaryString;n.onloadend=function(e){var n=e.target.result||"";return r?t(n):void t(Ge(n))},r?n.readAsBinaryString(e):n.readAsArrayBuffer(e)}function Je(e){return new lr(function(t){ze(e,function(e){t(Zr(e))})})}function Ke(e){for(var t=[],n=0,r=e.length;r>n;n++)t=t.concat(e[n]);return t}function Ze(e){var t=e.doc&&e.doc._attachments;t&&Object.keys(t).forEach(function(e){var n=t[e];n.data=$e(n.data,n.content_type)})}function Xe(e){return/^_design/.test(e)?"_design/"+encodeURIComponent(e.slice(8)):/^_local/.test(e)?"_local/"+encodeURIComponent(e.slice(7)):encodeURIComponent(e)}function Qe(e){return e._attachments&&Object.keys(e._attachments)?lr.all(Object.keys(e._attachments).map(function(t){var n=e._attachments[t];return n.data&&"string"!=typeof n.data?Je(n.data).then(function(e){n.data=e}):void 0})):lr.resolve()}function et(e){var t=ge(e);(t.user||t.password)&&(t.auth={username:t.user,password:t.password});var n=t.path.replace(/(^\/|\/$)/g,"").split("/");return t.db=n.pop(),-1===t.db.indexOf("%")&&(t.db=encodeURIComponent(t.db)),t.path=n.join("/"),t}function tt(e,t){return nt(e,e.db+"/"+t)}function nt(e,t){var n=e.path?"/":"";return e.protocol+"://"+e.host+(e.port?":"+e.port:"")+"/"+e.path+n+t}function rt(e){return"?"+Object.keys(e).map(function(t){return t+"="+encodeURIComponent(e[t])}).join("&")}function it(e,t){function n(e,t,n){var r=e.ajax||{},i=Zn.extend(c(p),r,t);return mi(i.method+" "+i.url),Qr.ajax(i,n)}function r(e,t){return new lr(function(r,i){n(e,t,function(e,t){return e?i(e):void r(t)})})}function i(e,t){return h(e,rr(function(e){a().then(function(){return t.apply(this,e)})["catch"](function(t){var n=e.pop();n(t)})}))}function a(){if(e.skipSetup||e.skip_setup)return lr.resolve();if(y)return y;var t={method:"GET",url:d};return y=r({},t)["catch"](function(e){return e&&e.status&&404===e.status?(xe(404,"PouchDB is just detecting if the remote exists."),r({},{method:"PUT",url:d})):lr.reject(e)})["catch"](function(e){return e&&e.status&&412===e.status?!0:lr.reject(e)}),y["catch"](function(){y=null}),y}function s(e){return e.split("/").map(encodeURIComponent).join("/")}var u=this,l=et;e.getHost&&(l=e.getHost);var f=l(e.name,e),d=tt(f,"");e=c(e);var p=e.ajax||{};if(u.getUrl=function(){return d},u.getHeaders=function(){return p.headers||{}},e.auth||f.auth){var v=e.auth||f.auth,m=v.username+":"+v.password,g=Zr(unescape(encodeURIComponent(m)));p.headers=p.headers||{},p.headers.Authorization="Basic "+g}var y;setTimeout(function(){t(null,u)}),u.type=function(){return"http"},u.id=i("id",function(e){n({},{method:"GET",url:nt(f,"")},function(t,n){var r=n&&n.uuid?n.uuid+f.db:tt(f,"");e(null,r)})}),u.request=i("request",function(e,t){e.url=tt(f,e.url),n({},e,t)}),u.compact=i("compact",function(e,t){"function"==typeof e&&(t=e,e={}),e=c(e),n(e,{url:tt(f,"_compact"),method:"POST"},function(){function n(){u.info(function(r,i){i&&!i.compact_running?t(null,{ok:!0}):setTimeout(n,e.interval||200)})}n()})}),u.bulkGet=h("bulkGet",function(e,t){function r(t){var r={};e.revs&&(r.revs=!0),e.attachments&&(r.attachments=!0),n({},{url:tt(f,"_bulk_get"+rt(r)),method:"POST",body:{docs:e.docs}},t)}function i(){function n(e){return function(n,r){u[e]=r.results,++s===i&&t(null,{results:Ke(u)})}}for(var r=di,i=Math.ceil(e.docs.length/r),s=0,u=new Array(i),c=0;i>c;c++){var l=o(e,["revs","attachments"]);l.ajax=p,l.docs=e.docs.slice(c*r,Math.min(e.docs.length,(c+1)*r)),I(a,l,n(c))}}var a=this,s=nt(f,""),u=pi[s];"boolean"!=typeof u?r(function(e,n){if(e){var r=Math.floor(e.status/100);4===r||5===r?(pi[s]=!1,xe(e.status,"PouchDB is just detecting if the remote supports the _bulk_get API."),i()):t(e)}else pi[s]=!0,t(null,n)}):u?r(t):i()}),u._info=function(e){a().then(function(){n({},{method:"GET",url:tt(f,"")},function(t,n){return t?e(t):(n.host=tt(f,""),void e(null,n))})})["catch"](e)},u.get=i("get",function(e,t,n){function i(e){var n=e._attachments,i=n&&Object.keys(n);return n&&i.length?lr.all(i.map(function(i){var o=n[i],a=Xe(e._id)+"/"+s(i)+"?rev="+e._rev;return r(t,{method:"GET",url:tt(f,a),binary:!0}).then(function(e){return t.binary?e:Je(e)}).then(function(e){delete o.stub,delete o.length,o.data=e})})):void 0}function o(e){return Array.isArray(e)?lr.all(e.map(function(e){return e.ok?i(e.ok):void 0})):i(e)}"function"==typeof t&&(n=t,t={}),t=c(t);var a={};t.revs&&(a.revs=!0),t.revs_info&&(a.revs_info=!0),t.open_revs&&("all"!==t.open_revs&&(t.open_revs=JSON.stringify(t.open_revs)),a.open_revs=t.open_revs),t.rev&&(a.rev=t.rev),t.conflicts&&(a.conflicts=t.conflicts),e=Xe(e);var u={method:"GET",url:tt(f,e+rt(a))};r(t,u).then(function(e){return lr.resolve().then(function(){return t.attachments?o(e):void 0}).then(function(){n(null,e)})})["catch"](n)}),u.remove=i("remove",function(e,t,r,i){var o;"string"==typeof t?(o={_id:e,_rev:t},"function"==typeof r&&(i=r,r={})):(o=e,"function"==typeof t?(i=t,r={}):(i=r,r=t));var a=o._rev||r.rev;n(r,{method:"DELETE",url:tt(f,Xe(o._id))+"?rev="+a},i)}),u.getAttachment=i("getAttachment",function(e,t,r,i){"function"==typeof r&&(i=r,r={});var o=r.rev?"?rev="+r.rev:"",a=tt(f,Xe(e))+"/"+s(t)+o;n(r,{method:"GET",url:a,binary:!0},i)}),u.removeAttachment=i("removeAttachment",function(e,t,r,i){var o=tt(f,Xe(e)+"/"+s(t))+"?rev="+r;n({},{method:"DELETE",url:o},i)}),u.putAttachment=i("putAttachment",function(e,t,r,i,o,a){"function"==typeof o&&(a=o,o=i,i=r,r=null);var u=Xe(e)+"/"+s(t),c=tt(f,u);if(r&&(c+="?rev="+r),"string"==typeof i){var l;try{l=Kr(i)}catch(h){return a(A(wr,"Attachment is not a valid base64 string"))}i=l?_e(l,o):""}var d={headers:{"Content-Type":o},method:"PUT",url:c,processData:!1,body:i,timeout:p.timeout||6e4};n({},d,a)}),u._bulkDocs=function(e,t,r){e.new_edits=t.new_edits,a().then(function(){return lr.all(e.docs.map(Qe))}).then(function(){n(t,{method:"POST",url:tt(f,"_bulk_docs"),body:e},function(e,t){return e?r(e):(t.forEach(function(e){e.ok=!0}),void r(null,t))})})["catch"](r)},u.allDocs=i("allDocs",function(e,t){"function"==typeof e&&(t=e,e={}),e=c(e);var n,i={},o="GET";e.conflicts&&(i.conflicts=!0),e.descending&&(i.descending=!0),e.include_docs&&(i.include_docs=!0),e.attachments&&(i.attachments=!0),e.key&&(i.key=JSON.stringify(e.key)),e.start_key&&(e.startkey=e.start_key),e.startkey&&(i.startkey=JSON.stringify(e.startkey)),e.end_key&&(e.endkey=e.end_key),e.endkey&&(i.endkey=JSON.stringify(e.endkey)),"undefined"!=typeof e.inclusive_end&&(i.inclusive_end=!!e.inclusive_end),"undefined"!=typeof e.limit&&(i.limit=e.limit),"undefined"!=typeof e.skip&&(i.skip=e.skip);var a=rt(i);if("undefined"!=typeof e.keys){var s="keys="+encodeURIComponent(JSON.stringify(e.keys));s.length+a.length+1<=vi?a+="&"+s:(o="POST",n={keys:e.keys})}r(e,{method:o,url:tt(f,"_all_docs"+a),body:n}).then(function(n){e.include_docs&&e.attachments&&e.binary&&n.rows.forEach(Ze),t(null,n)})["catch"](t)}),u._changes=function(e){var t="batch_size"in e?e.batch_size:hi;e=c(e),e.timeout="timeout"in e?e.timeout:"timeout"in p?p.timeout:3e4;var r,i=e.timeout?{timeout:e.timeout-5e3}:{},o="undefined"!=typeof e.limit?e.limit:!1;r="return_docs"in e?e.return_docs:"returnDocs"in e?e.returnDocs:!0;var s=o;if(e.style&&(i.style=e.style),(e.include_docs||e.filter&&"function"==typeof e.filter)&&(i.include_docs=!0),e.attachments&&(i.attachments=!0),e.continuous&&(i.feed="longpoll"),e.conflicts&&(i.conflicts=!0),e.descending&&(i.descending=!0),"heartbeat"in e?e.heartbeat&&(i.heartbeat=e.heartbeat):i.heartbeat=1e4,e.filter&&"string"==typeof e.filter&&(i.filter=e.filter,"_view"===e.filter&&e.view&&"string"==typeof e.view&&(i.view=e.view)),e.query_params&&"object"==typeof e.query_params)for(var u in e.query_params)e.query_params.hasOwnProperty(u)&&(i[u]=e.query_params[u]);var l,h="GET";if(e.doc_ids){i.filter="_doc_ids";var d=JSON.stringify(e.doc_ids);d.lengtht?t:s;var c={method:h,url:tt(f,"_changes"+rt(i)),timeout:e.timeout,body:l};m=r,e.aborted||a().then(function(){v=n(e,c,u)})["catch"](u)}},y={results:[]},_=function(n,i){if(!e.aborted){var a=0;if(i&&i.results){a=i.results.length,y.last_seq=i.last_seq;var u={};u.query=e.query_params,i.results=i.results.filter(function(t){s--;var n=we(e)(t);return n&&(e.include_docs&&e.attachments&&e.binary&&Ze(t),r&&y.results.push(t),e.onChange(t)),n})}else if(n)return e.aborted=!0,void e.complete(n);i&&i.last_seq&&(m=i.last_seq);var c=o&&0>=s||i&&t>a||e.descending;(!e.continuous||o&&0>=s)&&c?e.complete(null,y):setTimeout(function(){g(m,_)},0)}};return g(e.since||0,_),{cancel:function(){e.aborted=!0,v&&v.abort()}}},u.revsDiff=i("revsDiff",function(e,t,r){"function"==typeof t&&(r=t,t={}),n(t,{method:"POST",url:tt(f,"_revs_diff"),body:e},r)}),u._close=function(e){e()},u._destroy=function(t,r){n(t,{url:tt(f,""),method:"DELETE"},function(t,n){return t&&t.status&&404!==t.status?r(t):(u.emit("destroyed"),u.constructor.emit("destroyed",e.name),void r(null,n))})}}function ot(){this.promise=new lr(function(e){e()})}function at(e){return ur.hash(e)}function st(e){var t=e.db,n=e.viewName,r=e.map,i=e.reduce,o=e.temporary,a=r.toString()+(i&&i.toString())+"undefined";if(!o&&t._cachedViews){var s=t._cachedViews[a];if(s)return lr.resolve(s)}return t.info().then(function(e){function s(e){e.views=e.views||{};var t=n;-1===t.indexOf("/")&&(t=n+"/"+n);var r=e.views[t]=e.views[t]||{};if(!r[u])return r[u]=!0,e}var u=e.db_name+"-mrview-"+(o?"temp":at(a));return d(t,"_local/mrviews",s).then(function(){return t.registerDependentDatabase(u).then(function(e){var n=e.db;n.auto_compaction=!0;var s={name:u,db:n,sourceDB:t,adapter:t.adapter,mapFun:r,reduceFun:i};return s.db.get("_local/lastSeq")["catch"](function(e){if(404!==e.status)throw e}).then(function(e){return s.seq=e?e.seq:0, +o||(t._cachedViews=t._cachedViews||{},t._cachedViews[a]=s,s.db.once("destroyed",function(){delete t._cachedViews[a]})),s})})})})}function ut(e,t,n,r,i,o){return or("return ("+e.replace(/;\s*$/,"")+");",{emit:t,sum:n,log:r,isArray:i,toJSON:o})}function ct(e){return-1===e.indexOf("/")?[e,e]:e.split("/")}function lt(e){return 1===e.length&&/^1-/.test(e[0].rev)}function ft(e,t){try{e.emit("error",t)}catch(n){console.error("The user's map/reduce function threw an uncaught error.\nYou can debug this error by doing:\nmyDatabase.on('error', function (err) { debugger; });\nPlease double-check your map/reduce function."),console.error(t)}}function ht(e,t,n){try{return{output:t.apply(null,n)}}catch(r){return ft(e,r),{error:r}}}function dt(e,t){var n=Si(e.key,t.key);return 0!==n?n:Si(e.value,t.value)}function pt(e,t,n){return n=n||0,"number"==typeof t?e.slice(n,t+n):n>0?e.slice(n):e}function vt(e){var t=e.value,n=t&&"object"==typeof t&&t._id||e.id;return n}function mt(e){e.rows.forEach(function(e){var t=e.doc&&e.doc._attachments;t&&Object.keys(t).forEach(function(e){var n=t[e];t[e].data=$e(n.data,n.content_type)})})}function gt(e){return function(t){return e.include_docs&&e.attachments&&e.binary&&mt(t),t}}function yt(e){var t="builtin "+e+" function requires map values to be numbers or number arrays";return new Ht(t)}function _t(e){for(var t=0,n=0,r=e.length;r>n;n++){var i=e[n];if("number"!=typeof i){if(!Array.isArray(i))throw yt("_sum");t="number"==typeof t?[t]:t;for(var o=0,a=i.length;a>o;o++){var s=i[o];if("number"!=typeof s)throw yt("_sum");"undefined"==typeof t[o]?t.push(s):t[o]+=s}}else"number"==typeof t?t+=i:t[0]+=i}return t}function bt(e,t,n,r){var i=t[e];"undefined"!=typeof i&&(r&&(i=encodeURIComponent(JSON.stringify(i))),n.push(e+"="+i))}function wt(e){if("undefined"!=typeof e){var t=Number(e);return isNaN(t)||t!==parseInt(e,10)?e:t}}function xt(e){return e.group_level=wt(e.group_level),e.limit=wt(e.limit),e.skip=wt(e.skip),e}function kt(e){if(e){if("number"!=typeof e)return new Ut('Invalid value for integer: "'+e+'"');if(0>e)return new Ut('Invalid value for positive integer: "'+e+'"')}}function St(e,t){var n=e.descending?"endkey":"startkey",r=e.descending?"startkey":"endkey";if("undefined"!=typeof e[n]&&"undefined"!=typeof e[r]&&Si(e[n],e[r])>0)throw new Ut("No rows can match your key range, reverse your start_key and end_key or set {descending : true}");if(t.reduce&&e.reduce!==!1){if(e.include_docs)throw new Ut("{include_docs:true} is invalid for reduce");if(e.keys&&e.keys.length>1&&!e.group&&!e.group_level)throw new Ut("Multi-key fetches for reduce views must use {group: true}")}["group_level","limit","skip"].forEach(function(t){var n=kt(e[t]);if(n)throw n})}function Et(e,t,n){var r,i=[],o="GET";if(bt("reduce",n,i),bt("include_docs",n,i),bt("attachments",n,i),bt("limit",n,i),bt("descending",n,i),bt("group",n,i),bt("group_level",n,i),bt("skip",n,i),bt("stale",n,i),bt("conflicts",n,i),bt("startkey",n,i,!0),bt("start_key",n,i,!0),bt("endkey",n,i,!0),bt("end_key",n,i,!0),bt("inclusive_end",n,i),bt("key",n,i,!0),i=i.join("&"),i=""===i?"":"?"+i,"undefined"!=typeof n.keys){var a=2e3,s="keys="+encodeURIComponent(JSON.stringify(n.keys));s.length+i.length+1<=a?i+=("?"===i[0]?"&":"?")+s:(o="POST","string"==typeof t?r={keys:n.keys}:t.keys=n.keys)}if("string"==typeof t){var u=ct(t);return e.request({method:o,url:"_design/"+u[0]+"/_view/"+u[1]+i,body:r}).then(gt(n))}return r=r||{},Object.keys(t).forEach(function(e){Array.isArray(t[e])?r[e]=t[e]:r[e]=t[e].toString()}),e.request({method:"POST",url:"_temp_view"+i,body:r}).then(gt(n))}function Ot(e,t,n){return new lr(function(r,i){e._query(t,n,function(e,t){return e?i(e):void r(t)})})}function At(e){return new lr(function(t,n){e._viewCleanup(function(e,r){return e?n(e):void t(r)})})}function jt(e){return function(t){if(404===t.status)return e;throw t}}function Tt(e,t,n){function r(){return lt(l)?lr.resolve(s):t.db.get(a)["catch"](jt(s))}function i(e){return e.keys.length?t.db.allDocs({keys:e.keys,include_docs:!0}):lr.resolve({rows:[]})}function o(e,t){for(var n=[],r={},i=0,o=t.rows.length;o>i;i++){var a=t.rows[i],s=a.doc;if(s&&(n.push(s),r[s._id]=!0,s._deleted=!c[s._id],!s._deleted)){var u=c[s._id];"value"in u&&(s.value=u.value)}}var l=Object.keys(c);return l.forEach(function(e){if(!r[e]){var t={_id:e},i=c[e];"value"in i&&(t.value=i.value),n.push(t)}}),e.keys=Di(l.concat(e.keys)),n.push(e),n}var a="_local/doc_"+e,s={_id:a,keys:[]},u=n[e],c=u.indexableKeysToKeyValues,l=u.changes;return r().then(function(e){return i(e).then(function(t){return o(e,t)})})}function Dt(e,t,n){var r="_local/lastSeq";return e.db.get(r)["catch"](jt({_id:r,seq:0})).then(function(r){var i=Object.keys(t);return lr.all(i.map(function(n){return Tt(n,e,t)})).then(function(t){var i=Ke(t);return r.seq=n,i.push(r),e.db.bulkDocs({docs:i})})})}function It(e){var t="string"==typeof e?e:e.name,n=Ci[t];return n||(n=Ci[t]=new ot),n}function Mt(e){return Ti(It(e),function(){return Ct(e)})()}function Ct(e){function t(e,t){var n={id:i._id,key:Oi(e)};"undefined"!=typeof t&&null!==t&&(n.value=Oi(t)),r.push(n)}function n(t,n){return function(){return Dt(e,t,n)}}var r,i,o;if("function"==typeof e.mapFun&&2===e.mapFun.length){var a=e.mapFun;o=function(e){return a(e,t)}}else o=ut(e.mapFun.toString(),t,_t,gi,Array.isArray,JSON.parse);var s=e.seq||0,u=new ot;return new lr(function(t,a){function c(){u.finish().then(function(){e.seq=s,t()})}function l(){function t(e){a(e)}e.sourceDB.changes({conflicts:!0,include_docs:!0,style:"all_docs",since:s,limit:Li}).on("complete",function(t){var a=t.results;if(!a.length)return c();for(var f={},h=0,d=a.length;d>h;h++){var p=a[h];if("_"!==p.doc._id[0]){r=[],i=p.doc,i._deleted||ht(e.sourceDB,o,[i]),r.sort(dt);for(var v,m={},g=0,y=r.length;y>g;g++){var _=r[g],b=[_.key,_.id];0===Si(_.key,v)&&b.push(g);var w=Ei(b);m[w]=_,v=_.key}f[p.doc._id]={indexableKeysToKeyValues:m,changes:p.changes}}s=p.seq}return u.add(n(f,s)),a.lengths;s++){var c=o[s],l=ht(e.sourceDB,r,[c.keys,c.values,!1]);if(l.error&&l.error instanceof Ht)throw l.error;t.push({value:l.error?null:l.output,key:c.groupKey})}return{rows:pt(t,n.limit,n.skip)}}function Lt(e,t){return Ti(It(e),function(){return Rt(e,t)})()}function Rt(e,t){function n(t){return t.include_docs=!0,e.db.allDocs(t).then(function(e){return i=e.total_rows,e.rows.map(function(e){if("value"in e.doc&&"object"==typeof e.doc.value&&null!==e.doc.value){var t=Object.keys(e.doc.value).sort(),n=["id","key","value"];if(!(n>t||t>n))return e.doc.value}var r=Ai(e.doc._id);return{key:r[0],id:r[1],value:"value"in e.doc?e.doc.value:null}})})}function r(n){var r;if(r=o?qt(e,n,t):{total_rows:i,offset:a,rows:n},t.include_docs){var s=Di(n.map(vt));return e.sourceDB.allDocs({keys:s,include_docs:!0,conflicts:t.conflicts,attachments:t.attachments,binary:t.binary}).then(function(e){var t={};return e.rows.forEach(function(e){e.doc&&(t["$"+e.id]=e.doc)}),n.forEach(function(e){var n=vt(e),r=t["$"+n];r&&(e.doc=r)}),r})}return r}var i,o=e.reduceFun&&t.reduce!==!1,a=t.skip||0;if("undefined"==typeof t.keys||t.keys.length||(t.limit=0,delete t.keys),"undefined"!=typeof t.keys){var s=t.keys,u=s.map(function(e){var t={startkey:Ei([e]),endkey:Ei([e,{}])};return n(t)});return lr.all(u).then(Ke).then(r)}var c={descending:t.descending};if(t.start_key&&(t.startkey=t.start_key),t.end_key&&(t.endkey=t.end_key),"undefined"!=typeof t.startkey&&(c.startkey=Ei(t.descending?[t.startkey,{}]:[t.startkey])),"undefined"!=typeof t.endkey){var l=t.inclusive_end!==!1;t.descending&&(l=!l),c.endkey=Ei(l?[t.endkey,{}]:[t.endkey])}if("undefined"!=typeof t.key){var f=Ei([t.key]),h=Ei([t.key,{}]);c.descending?(c.endkey=f,c.startkey=h):(c.startkey=f,c.endkey=h)}return o||("number"==typeof t.limit&&(c.limit=t.limit),c.skip=a),n(c).then(r)}function Pt(e){return e.request({method:"POST",url:"_view_cleanup"})}function Nt(e){return e.get("_local/mrviews").then(function(t){var n={};Object.keys(t.views).forEach(function(e){var t=ct(e),r="_design/"+t[0],i=t[1];n[r]=n[r]||{},n[r][i]=!0});var r={keys:Object.keys(n),include_docs:!0};return e.allDocs(r).then(function(r){var i={};r.rows.forEach(function(e){var r=e.key.substring(8);Object.keys(n[e.key]).forEach(function(n){var o=r+"/"+n;t.views[o]||(o=n);var a=Object.keys(t.views[o]),s=e.doc&&e.doc.views&&e.doc.views[n];a.forEach(function(e){i[e]=i[e]||s})})});var o=Object.keys(i).filter(function(e){return!i[e]}),a=o.map(function(t){return Ti(It(t),function(){return new e.constructor(t,e.__opts).destroy()})()});return lr.all(a).then(function(){return{ok:!0}})})},jt({ok:!0}))}function Ft(e,t,r){if("http"===e.type())return Et(e,t,r);if("function"==typeof e._query)return Ot(e,t,r);if("string"!=typeof t){St(r,t);var i={db:e,viewName:"temp_view/temp_view",map:t.map,reduce:t.reduce,temporary:!0};return qi.add(function(){return st(i).then(function(e){function t(){return e.db.destroy()}return Ii(Mt(e).then(function(){return Lt(e,r)}),t)})}),qi.finish()}var o=t,a=ct(o),s=a[0],u=a[1];return e.getView(s,u).then(function(t){St(r,t);var i={db:e,viewName:o,map:t.map,reduce:t.reduce};return st(i).then(function(e){return"ok"===r.stale||"update_after"===r.stale?("update_after"===r.stale&&n.nextTick(function(){Mt(e)}),Lt(e,r)):Mt(e).then(function(){return Lt(e,r)})})})}function Ut(e){this.status=400,this.name="query_parse_error",this.message=e,this.error=!0;try{Error.captureStackTrace(this,Ut)}catch(t){}}function Ht(e){this.status=500,this.name="invalid_value",this.message=e,this.error=!0;try{Error.captureStackTrace(this,Ht)}catch(t){}}function Yt(e){return Zr(Ge(e))}function Bt(e,t,n){function r(e){try{return Kr(e)}catch(t){var n=A(wr,"Attachment is not a valid base64 string");return{error:n}}}function i(e,n){if(e.stub)return n();if("string"==typeof e.data){var i=r(e.data);if(i.error)return n(i.error);e.length=i.length,"blob"===t?e.data=_e(i,e.content_type):"base64"===t?e.data=Zr(i):e.data=i,ci(i).then(function(t){e.digest="md5-"+t,n()})}else ue(e.data,function(r){"binary"===t?e.data=Ge(r):"base64"===t&&(e.data=Yt(r)),ci(r).then(function(t){e.digest="md5-"+t,e.length=r.byteLength,n()})})}function o(){s++,e.length===s&&(a?n(a):n())}if(!e.length)return n();var a,s=0;e.forEach(function(e){function t(e){a=e,r++,r===n.length&&o()}var n=e.data&&e.data._attachments?Object.keys(e.data._attachments):[],r=0;if(!n.length)return o();for(var s in e.data._attachments)e.data._attachments.hasOwnProperty(s)&&i(e.data._attachments[s],t)})}function Wt(e,t){return e.pos-t.pos}function Vt(e,t,n){for(var r,i=0,o=e.length;o>i;)r=i+o>>>1,n(e[r],t)<0?i=r+1:o=r;return i}function $t(e,t,n){var r=Vt(e,t,n);e.splice(r,0,t)}function Gt(e,t){for(var n,r,i=t,o=e.length;o>i;i++){var a=e[i],s=[a.id,a.opts,[]];r?(r[2].push(s),r=s):n=r=s}return n}function zt(e,t){return e[0]0;){var i=n.pop(),o=i.tree1,a=i.tree2;(o[1].status||a[1].status)&&(o[1].status="available"===o[1].status||"available"===a[1].status?"available":"missing");for(var s=0;ss;s++){var c=e[s];if(c.pos===t.pos&&c.ids[0]===t.ids[0])r=Jt(c.ids,t.ids),i.push({pos:c.pos,ids:r.tree}),o=o||r.conflicts,a=!0;else if(n!==!0){var l=c.pos0;){var v=p.pop();if(0!==v.diff)for(var m=v.ids[2],g=0,y=m.length;y>g;g++)p.push({ids:m[g],diff:v.diff-1,parent:v.ids,parentIdx:g});else v.ids[0]===f.ids[0]&&d.push(v)}var _=d[0];_?(r=Jt(_.ids,f.ids),_.parent[2][_.parentIdx]=r.tree,i.push({pos:l.pos,ids:l.ids}),o=o||r.conflicts,a=!0):i.push(c)}else i.push(c)}return a||i.push(t),i.sort(Wt),{tree:i,conflicts:o||"internal_node"}}function Zt(e,t){for(var n,r=C(e),i={},o=0,a=r.length;a>o;o++){for(var s=r[o],u=s.ids,c=Math.max(0,u.length-t),l={pos:s.pos+c,ids:Gt(u,c)},f=0;c>f;f++){var h=s.pos+f+"-"+u[f].id;i[h]=!0}n=n?Kt(n,l,!0).tree:[l]}return x(n,function(e,t,n){delete i[t+"-"+n]}),{tree:n,revs:Object.keys(i)}}function Xt(e,t,n){var r=Kt(e,t),i=Zt(r.tree,n);return{tree:i.tree,stemmedRevs:i.revs,conflicts:r.conflicts}}function Qt(e,t){for(var n,r=e.slice(),i=t.split("-"),o=parseInt(i[0],10),a=i[1];n=r.pop();){if(n.pos===o&&n.ids[0]===a)return!0;for(var s=n.ids[2],u=0,c=s.length;c>u;u++)r.push({pos:n.pos+1,ids:s[u]})}return!1}function en(e,t,n,r,i,o,a,s){if(Qt(t.rev_tree,n.metadata.rev))return r[i]=n,o();var u=t.winningRev||v(t),c="deleted"in t?t.deleted:g(t,u),l="deleted"in n.metadata?n.metadata.deleted:g(n.metadata),f=/^1-/.test(n.metadata.rev);if(c&&!l&&s&&f){var h=n.data;h._rev=u,h._id=n.metadata.id,n=U(h,s)}var d=Xt(t.rev_tree,n.metadata.rev_tree[0],e),p=s&&(c&&l||!c&&"new_leaf"!==d.conflicts||c&&!l&&"new_branch"===d.conflicts);if(p){var m=A(vr);return r[i]=m,o()}var y=n.metadata.rev;n.metadata.rev_tree=d.tree,n.stemmedRevs=d.stemmedRevs||[],t.rev_map&&(n.metadata.rev_map=t.rev_map);var _,b=v(n.metadata),w=g(n.metadata,b),x=c===w?0:w>c?-1:1;_=y===b?w:g(n.metadata,y),a(n,b,w,_,!0,x,i,o)}function tn(e){return"missing"===e.metadata.rev_tree[0].ids[1].status}function nn(e,t,n,r,i,o,a,s,u){function c(e,t,n){var r=v(e.metadata),i=g(e.metadata,r);if("was_delete"in s&&i)return o[t]=A(pr,"deleted"),n();var u=f&&tn(e);if(u){var c=A(vr);return o[t]=c,n()}var l=i?0:1;a(e,r,i,i,!1,l,t,n)}function l(){++d===p&&u&&u()}e=e||1e3;var f=s.new_edits,h=new nr.Map,d=0,p=t.length;t.forEach(function(e,t){if(e._id&&M(e._id)){var r=e._deleted?"_removeLocal":"_putLocal";return void n[r](e,{ctx:i},function(e,n){o[t]=e||n,l()})}var a=e.metadata.id;h.has(a)?(p--,h.get(a).push([e,t])):h.set(a,[[e,t]])}),h.forEach(function(t,n){function i(){++ur;r++){var o=E[r];if(o._id&&M(o._id))e();else{var a=b.get(o.metadata.id);a.onsuccess=t}}}function l(){q||(o.notify(r._meta.name),r._meta.docCount+=O,a(null,I))}function f(e,t){var n=x.get(e);n.onsuccess=function(n){if(n.target.result)t();else{var r=A(qr,"unknown stub attachment with digest "+e);r.status=412,t(r)}}}function h(e){function t(){++i===n.length&&e(r)}var n=[];if(E.forEach(function(e){e.data&&e.data._attachments&&Object.keys(e.data._attachments).forEach(function(t){var r=e.data._attachments[t];r.stub&&n.push(r.digest)})}),!n.length)return e();var r,i=0;n.forEach(function(e){f(e,function(e){e&&!r&&(r=e),t()})})}function d(e,t,n,r,i,o,a,s){O+=o,e.metadata.winningRev=t,e.metadata.deleted=n;var u=e.data;u._id=e.metadata.id,u._rev=e.metadata.rev,r&&(u._deleted=!0);var c=u._attachments&&Object.keys(u._attachments).length;return c?m(e,t,n,i,a,s):void v(e,t,n,i,a,s)}function p(e){var t=rn(e.metadata);gn(t,e.metadata.id,_)}function v(e,t,n,i,o,a){function s(o){i&&r.auto_compaction?p(e):e.stemmedRevs.length&&gn(e.stemmedRevs,e.metadata.id,_),f.seq=o.target.result,delete f.rev;var a=fn(f,t,n),s=b.put(a);s.onsuccess=c}function u(e){e.preventDefault(),e.stopPropagation();var t=w.index("_doc_id_rev"),n=t.getKey(l._doc_id_rev);n.onsuccess=function(e){var t=w.put(l,e.target.result);t.onsuccess=s}}function c(){I[o]={ok:!0,id:f.id,rev:t},C.set(e.metadata.id,e.metadata),g(e,f.seq,a)}var l=e.data,f=e.metadata;l._doc_id_rev=f.id+"::"+f.rev,delete l._id,delete l._rev;var h=w.put(l);h.onsuccess=s,h.onerror=u}function m(e,t,n,r,i,o){function a(){c===l.length&&v(e,t,n,r,i,o)}function s(){c++,a()}var u=e.data,c=0,l=Object.keys(u._attachments);l.forEach(function(n){var r=e.data._attachments[n];if(r.stub)c++,a();else{var i=r.data;delete r.data,r.revpos=parseInt(t,10);var o=r.digest;y(o,i,s)}})}function g(e,t,n){function r(){++o===a.length&&n()}function i(n){var i=e.data._attachments[n].digest,o=k.put({seq:t,digestSeq:i+"::"+t});o.onsuccess=r,o.onerror=function(e){e.preventDefault(),e.stopPropagation(),r()}}var o=0,a=Object.keys(e.data._attachments||{});if(!a.length)return n();for(var s=0;sj;j++){var D=E[j];D._id&&M(D._id)||(D=E[j]=U(D,n.new_edits),D.error&&!S&&(S=D))}if(S)return a(S);var I=new Array(E.length),C=new nr.Map,q=!1,L=r._meta.blobSupport?"blob":"base64";Bt(E,L,function(e){return e?a(e):void s()})}function bn(e,t,n,r,i){try{if(e&&t)return i?IDBKeyRange.bound(t,e,!n,!1):IDBKeyRange.bound(e,t,!1,!n);if(e)return i?IDBKeyRange.upperBound(e):IDBKeyRange.lowerBound(e);if(t)return i?IDBKeyRange.lowerBound(t,!n):IDBKeyRange.upperBound(t,!n);if(r)return IDBKeyRange.only(r)}catch(o){return{error:o}}return null}function wn(e,t,n,r){return"DataError"===n.name&&0===n.code?r(null,{total_rows:e._meta.docCount,offset:t.skip,rows:[]}):void r(A(jr,n.name,n.message))}function xn(e,t,n,r){function i(e,r){function i(t,n,r){var i=t.id+"::"+r;k.get(i).onsuccess=function(r){n.doc=dn(r.target.result),e.conflicts&&(n.doc._conflicts=E(t)),vn(n.doc,e,_)}}function o(t,n,r){var o={id:r.id,key:r.id,value:{rev:n}},a=r.deleted;if("ok"===e.deleted)S.push(o),a?(o.value.deleted=!0,o.doc=null):e.include_docs&&i(r,o,n);else if(!a&&h--<=0&&(S.push(o),e.include_docs&&i(r,o,n),0===--d))return;t["continue"]()}function a(e){O=t._meta.docCount;var n=e.target.result;if(n){var r=hn(n.value),i=r.winningRev;o(n,i,r)}}function s(){r(null,{total_rows:O,offset:e.skip,rows:S})}function u(){e.attachments?mn(S,e.binary).then(s):s()}var c="startkey"in e?e.startkey:!1,l="endkey"in e?e.endkey:!1,f="key"in e?e.key:!1,h=e.skip||0,d="number"==typeof e.limit?e.limit:-1,p=e.inclusive_end!==!1,v="descending"in e&&e.descending?"prev":null,m=bn(c,l,p,f,v);if(m&&m.error)return wn(t,e,m.error,r);var g=[Hi,Yi];e.attachments&&g.push(Bi);var y=yn(n,g,"readonly");if(y.error)return r(y.error);var _=y.txn,b=_.objectStore(Hi),w=_.objectStore(Yi),x=v?b.openCursor(m,v):b.openCursor(m),k=w.index("_doc_id_rev"),S=[],O=0;_.oncomplete=u,x.onsuccess=a}function o(e,n){return 0===e.limit?n(null,{total_rows:t._meta.docCount,offset:e.skip,rows:[]}):void i(e,n)}o(e,r)}function kn(e){return new lr(function(t){var n=se([""]);e.objectStore(Gi).put(n,"key"),e.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},e.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}})["catch"](function(){return!1})}function Sn(e){ie()?chrome.storage.onChanged.addListener(function(t){null!=t.db_name&&e.emit(t.dbName.newValue)}):oe()&&("undefined"!=typeof addEventListener?addEventListener("storage",function(t){e.emit(t.key)}):window.attachEvent("storage",function(t){e.emit(t.key)}))}function En(){ir.EventEmitter.call(this),this._listeners={},Sn(this)}function On(e,t){var n=this;zi.queue.push({action:function(t){An(n,e,t)},callback:t}),cn(n.constructor)}function An(e,t,r){function i(e){var t=e.createObjectStore(Hi,{keyPath:"id"});e.createObjectStore(Yi,{autoIncrement:!0}).createIndex("_doc_id_rev","_doc_id_rev",{unique:!0}),e.createObjectStore(Bi,{keyPath:"digest"}),e.createObjectStore(Vi,{keyPath:"id",autoIncrement:!1}),e.createObjectStore(Gi),t.createIndex("deletedOrLocal","deletedOrLocal",{unique:!1}),e.createObjectStore($i,{keyPath:"_id"});var n=e.createObjectStore(Wi,{autoIncrement:!0});n.createIndex("seq","seq"),n.createIndex("digestSeq","digestSeq",{unique:!0})}function o(e,t){var n=e.objectStore(Hi);n.createIndex("deletedOrLocal","deletedOrLocal",{unique:!1}),n.openCursor().onsuccess=function(e){var r=e.target.result;if(r){var i=r.value,o=g(i);i.deletedOrLocal=o?"1":"0",n.put(i),r["continue"]()}else t()}}function a(e){e.createObjectStore($i,{keyPath:"_id"}).createIndex("_doc_id_rev","_doc_id_rev",{unique:!0})}function s(e,t){var n=e.objectStore($i),r=e.objectStore(Hi),i=e.objectStore(Yi),o=r.openCursor();o.onsuccess=function(e){var o=e.target.result;if(o){var a=o.value,s=a.id,u=M(s),c=v(a);if(u){var l=s+"::"+c,f=s+"::",h=s+"::~",d=i.index("_doc_id_rev"),p=IDBKeyRange.bound(f,h,!1,!1),m=d.openCursor(p);m.onsuccess=function(e){if(m=e.target.result){var t=m.value;t._doc_id_rev===l&&n.put(t),i["delete"](m.primaryKey),m["continue"]()}else r["delete"](o.primaryKey),o["continue"]()}}else o["continue"]()}else t&&t()}}function u(e){var t=e.createObjectStore(Wi,{autoIncrement:!0});t.createIndex("seq","seq"),t.createIndex("digestSeq","digestSeq",{unique:!0})}function l(e,t){var n=e.objectStore(Yi),r=e.objectStore(Bi),i=e.objectStore(Wi),o=r.count();o.onsuccess=function(e){var r=e.target.result;return r?void(n.openCursor().onsuccess=function(e){var n=e.target.result;if(!n)return t();for(var r=n.value,o=n.primaryKey,a=Object.keys(r._attachments||{}),s={},u=0;ui&&(i=n),t["continue"]()}}function o(){var e=fn(s,s.winningRev,s.deleted),t=r.put(e);t.onsuccess=function(){a["continue"]()}}var a=e.target.result;if(a){var s=t(a.value);return s.winningRev=s.winningRev||v(s),s.seq?o():void i()}}}var d=t.name,p=null;e._meta=null,e.type=function(){return"idb"},e._id=f(function(t){t(null,e._meta.instanceId)}),e._bulkDocs=function(n,r,i){_n(t,n,r,e,p,Zi,i)},e._get=function(e,t,n){function r(){n(a,{doc:i,metadata:o,ctx:s})}var i,o,a,s=t.ctx;if(!s){var u=yn(p,[Hi,Yi,Bi],"readonly");if(u.error)return n(u.error);s=u.txn}s.objectStore(Hi).get(e).onsuccess=function(e){if(o=hn(e.target.result),!o)return a=A(pr,"missing"),r();if(g(o)&&!t.rev)return a=A(pr,"deleted"),r();var n=s.objectStore(Yi),u=t.rev||o.winningRev,c=o.id+"::"+u;n.index("_doc_id_rev").get(c).onsuccess=function(e){return i=e.target.result,i&&(i=dn(i)),i?void r():(a=A(pr,"missing"),r())}}},e._getAttachment=function(e,t,n){var r;if(t.ctx)r=t.ctx;else{var i=yn(p,[Hi,Yi,Bi],"readonly");if(i.error)return n(i.error);r=i.txn}var o=e.digest,a=e.content_type;r.objectStore(Bi).get(o).onsuccess=function(e){var r=e.target.result.body;pn(r,a,t.binary,function(e){n(null,e)})}},e._info=function(t){if(null===p||!Ki.has(d)){var n=new Error("db isn't open");return n.id="idbNull",t(n)}var r,i,o=yn(p,[Yi],"readonly");if(o.error)return t(o.error);var a=o.txn,s=a.objectStore(Yi).openCursor(null,"prev");s.onsuccess=function(t){var n=t.target.result;r=n?n.key:0,i=e._meta.docCount},a.oncomplete=function(){t(null,{doc_count:i,update_seq:r,idb_attachment_format:e._meta.blobSupport?"binary":"base64"})}},e._allDocs=function(t,n){xn(t,e,p,n)},e._changes=function(t){function n(e){function n(){return c.seq!==a?e["continue"]():(u=a,c.winningRev===o._rev?i(o):void r())}function r(){var e=o._id+"::"+c.winningRev,t=g.get(e);t.onsuccess=function(e){i(dn(e.target.result))}}function i(n){var r=t.processChange(n,c,t);r.seq=c.seq;var i=b(r);return"object"==typeof i?t.complete(i):(i&&(_++,f&&y.push(r),t.attachments&&t.include_docs?vn(n,t,h,function(){mn([r],t.binary).then(function(){t.onChange(r)})}):t.onChange(r)),void(_!==l&&e["continue"]()))}var o=dn(e.value),a=e.key;if(s&&!s.has(o._id))return e["continue"]();var c;return(c=w.get(o._id))?n():void(m.get(o._id).onsuccess=function(e){c=hn(e.target.result),w.set(o._id,c),n()})}function r(e){var t=e.target.result;t&&n(t)}function i(){var e=[Hi,Yi];t.attachments&&e.push(Bi);var n=yn(p,e,"readonly");if(n.error)return t.complete(n.error);h=n.txn,h.onabort=ln(t.complete),h.oncomplete=o,v=h.objectStore(Yi),m=h.objectStore(Hi),g=v.index("_doc_id_rev");var i;i=t.descending?v.openCursor(null,"prev"):v.openCursor(IDBKeyRange.lowerBound(t.since,!0)),i.onsuccess=r}function o(){function e(){t.complete(null,{results:y,last_seq:u})}!t.continuous&&t.attachments?mn(y).then(e):e()}if(t=c(t),t.continuous){var a=d+":"+L();return Zi.addListener(d,a,e,t),Zi.notify(d),{cancel:function(){Zi.removeListener(d,a)}}}var s=t.doc_ids&&new nr.Set(t.doc_ids);t.since=t.since||0;var u=t.since,l="limit"in t?t.limit:-1;0===l&&(l=1);var f;f="return_docs"in t?t.return_docs:"returnDocs"in t?t.returnDocs:!0;var h,v,m,g,y=[],_=0,b=we(t),w=new nr.Map;i()},e._close=function(e){return null===p?e(A(_r)):(p.close(),Ki["delete"](d),p=null,void e())},e._getRevisionTree=function(e,t){var n=yn(p,[Hi],"readonly");if(n.error)return t(n.error);var r=n.txn,i=r.objectStore(Hi).get(e);i.onsuccess=function(e){var n=hn(e.target.result);n?t(null,n.rev_tree):t(A(pr))}},e._doCompaction=function(e,t,n){var r=[Hi,Yi,Bi,Wi],i=yn(p,r,"readwrite");if(i.error)return n(i.error);var o=i.txn,a=o.objectStore(Hi);a.get(e).onsuccess=function(n){var r=hn(n.target.result);x(r.rev_tree,function(e,n,r,i,o){var a=n+"-"+r;-1!==t.indexOf(a)&&(o.status="missing")}),gn(t,e,o);var i=r.winningRev,a=r.deleted;o.objectStore(Hi).put(fn(r,i,a))},o.onabort=ln(n),o.oncomplete=function(){n()}},e._getLocal=function(e,t){var n=yn(p,[$i],"readonly");if(n.error)return t(n.error);var r=n.txn,i=r.objectStore($i).get(e);i.onerror=ln(t),i.onsuccess=function(e){var n=e.target.result;n?(delete n._doc_id_rev,t(null,n)):t(A(pr))}},e._putLocal=function(e,t,n){"function"==typeof t&&(n=t,t={}),delete e._revisions;var r=e._rev,i=e._id;r?e._rev="0-"+(parseInt(r.split("-")[1],10)+1):e._rev="0-1";var o,a=t.ctx;if(!a){var s=yn(p,[$i],"readwrite");if(s.error)return n(s.error);a=s.txn,a.onerror=ln(n),a.oncomplete=function(){o&&n(null,o)}}var u,c=a.objectStore($i);r?(u=c.get(i),u.onsuccess=function(i){var a=i.target.result;if(a&&a._rev===r){var s=c.put(e);s.onsuccess=function(){o={ok:!0,id:e._id,rev:e._rev},t.ctx&&n(null,o)}}else n(A(vr))}):(u=c.add(e),u.onerror=function(e){n(A(vr)),e.preventDefault(),e.stopPropagation()},u.onsuccess=function(){o={ok:!0,id:e._id,rev:e._rev},t.ctx&&n(null,o)})},e._removeLocal=function(e,t,n){"function"==typeof t&&(n=t,t={});var r=t.ctx;if(!r){var i=yn(p,[$i],"readwrite");if(i.error)return n(i.error);r=i.txn,r.oncomplete=function(){o&&n(null,o)}}var o,a=e._id,s=r.objectStore($i),u=s.get(a);u.onerror=ln(n),u.onsuccess=function(r){var i=r.target.result;i&&i._rev===e._rev?(s["delete"](a),o={ok:!0,id:a,rev:"0-0"},t.ctx&&n(null,o)):n(A(pr))}},e._destroy=function(e,t){Zi.removeAllListeners(d);var n=Xi.get(d);n&&n.result&&(n.result.close(),Ki["delete"](d));var r=indexedDB.deleteDatabase(d);r.onsuccess=function(){Xi["delete"](d),oe()&&d in localStorage&&delete localStorage[d],t(null,{ok:!0})},r.onerror=ln(t)};var m=Ki.get(d);if(m)return p=m.idb,e._meta=m.global,void n.nextTick(function(){r(null,e)});var y;y=t.storage?jn(d,t.storage):indexedDB.open(d,Ui),Xi.set(d,y),y.onupgradeneeded=function(e){function t(){var e=c[f-1];f++,e&&e(r,t)}var n=e.target.result;if(e.oldVersion<1)return i(n);var r=e.currentTarget.transaction;e.oldVersion<3&&a(n),e.oldVersion<4&&u(n);var c=[o,s,l,h],f=e.oldVersion;t()},y.onsuccess=function(t){p=t.target.result,p.onversionchange=function(){p.close(),Ki["delete"](d)},p.onabort=function(e){console.error("Database has a global failure",e.target.error),p.close(),Ki["delete"](d)};var n=p.transaction([Vi,Gi,Hi],"readwrite"),i=n.objectStore(Vi).get(Vi),o=null,a=null,s=null;i.onsuccess=function(t){var i=function(){null!==o&&null!==a&&null!==s&&(e._meta={name:d,instanceId:s,blobSupport:o,docCount:a},Ki.set(d,{idb:p,global:e._meta}),r(null,e))},u=t.target.result||{id:Vi};d+"_id"in u?(s=u[d+"_id"],i()):(s=L(),u[d+"_id"]=s,n.objectStore(Vi).put(u).onsuccess=function(){i()}),Ji||(Ji=kn(n)),Ji.then(function(e){o=e,i()});var c=n.objectStore(Hi).index("deletedOrLocal");c.count(IDBKeyRange.only("0")).onsuccess=function(e){a=e.target.result,i()}}},y.onerror=function(){var e="Failed to open indexedDB, are you in private browsing mode?"; +console.error(e),r(A(jr,e))}}function jn(e,t){try{return indexedDB.open(e,{version:Ui,storage:t})}catch(n){return indexedDB.open(e,Ui)}}function Tn(e){return decodeURIComponent(window.escape(e))}function Dn(e){return 65>e?e-48:e-55}function In(e,t,n){for(var r="";n>t;)r+=String.fromCharCode(Dn(e.charCodeAt(t++))<<4|Dn(e.charCodeAt(t++)));return r}function Mn(e,t,n){for(var r="";n>t;)r+=String.fromCharCode(Dn(e.charCodeAt(t+2))<<12|Dn(e.charCodeAt(t+3))<<8|Dn(e.charCodeAt(t))<<4|Dn(e.charCodeAt(t+1))),t+=4;return r}function Cn(e,t){return"UTF-8"===t?Tn(In(e,0,e.length)):Mn(e,0,e.length)}function qn(e){return"'"+e+"'"}function Ln(){return"undefined"!=typeof sqlitePlugin?sqlitePlugin.openDatabase.bind(sqlitePlugin):"undefined"!=typeof openDatabase?function(e){return openDatabase(e.name,e.version,e.description,e.size)}:void 0}function Rn(){return"undefined"!=typeof openDatabase||"undefined"!=typeof SQLitePlugin}function Pn(e){return e.replace(/\u0002/g,"").replace(/\u0001/g,"").replace(/\u0000/g,"")}function Nn(e){return e.replace(/\u0001\u0001/g,"\x00").replace(/\u0001\u0002/g,"").replace(/\u0002\u0002/g,"")}function Fn(e){return delete e._id,delete e._rev,JSON.stringify(e)}function Un(e,t,n){return e=JSON.parse(e),e._id=t,e._rev=n,e}function Hn(e){for(var t="(";e--;)t+="?",e&&(t+=",");return t+")"}function Yn(e,t,n,r,i){return"SELECT "+e+" FROM "+("string"==typeof t?t:t.join(" JOIN "))+(n?" ON "+n:"")+(r?" WHERE "+("string"==typeof r?r:r.join(" AND ")):"")+(i?" ORDER BY "+i:"")}function Bn(e,t,n){function r(){++o===e.length&&i()}function i(){if(a.length){var e="SELECT DISTINCT digest AS digest FROM "+oo+" WHERE seq IN "+Hn(a.length);n.executeSql(e,a,function(e,t){for(var n=[],r=0;r0;){var e=k.pop();e(null,b)}}function d(e,t){if(0===t){var n="CREATE TABLE IF NOT EXISTS "+io+" (dbid, db_version INTEGER)",c="CREATE TABLE IF NOT EXISTS "+no+" (digest UNIQUE, escaped TINYINT(1), body BLOB)",l="CREATE TABLE IF NOT EXISTS "+oo+" (digest, seq INTEGER)",f="CREATE TABLE IF NOT EXISTS "+eo+" (id unique, json, winningseq, max_seq INTEGER UNIQUE)",d="CREATE TABLE IF NOT EXISTS "+to+" (seq INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, json, deleted TINYINT(1), doc_id, rev)",p="CREATE TABLE IF NOT EXISTS "+ro+" (id UNIQUE, rev, json)";e.executeSql(c),e.executeSql(p),e.executeSql(l,[],function(){e.executeSql(ho),e.executeSql(po)}),e.executeSql(f,[],function(){e.executeSql(fo),e.executeSql(d,[],function(){e.executeSql(co),e.executeSql(lo),e.executeSql(n,[],function(){var t="INSERT INTO "+io+" (db_version, dbid) VALUES (?,?)";b=L();var n=[Qi,b];e.executeSql(t,n,function(){h()})})})})}else{var v=function(){var n=Qi>t;n&&e.executeSql("UPDATE "+io+" SET db_version = "+Qi);var r="SELECT dbid FROM "+io;e.executeSql(r,[],function(e,t){b=t.rows.item(0).dbid,h()})},m=[r,i,o,a,s,u,v],g=t,y=function(e){m[g-1](e,y),g++};y(e)}}function p(){j.transaction(function(e){l(e,function(){v(e)})},Wn(t),n)}function v(e){var t="SELECT sql FROM sqlite_master WHERE tbl_name = "+io;e.executeSql(t,[],function(e,t){t.rows.length?/db_version/.test(t.rows.item(0).sql)?e.executeSql("SELECT db_version FROM "+io,[],function(e,t){var n=t.rows.item(0).db_version;d(e,n)}):e.executeSql("ALTER TABLE "+io+" ADD COLUMN db_version INTEGER",[],function(){d(e,1)}):d(e,0)})}function m(e,t){if(-1!==_._docCount)return t(_._docCount);var n=Yn("COUNT("+eo+".id) AS 'num'",[eo,to],vo,to+".deleted=0");e.executeSql(n,[],function(e,n){_._docCount=n.rows.item(0).num,t(_._docCount)})}var y,_=this,b=null,w=Vn(e),k=[];_._docCount=-1,_._name=e.name;var S=Zn.extend({},e,{size:w,version:uo}),O=Gn(S);if(O.error)return Wn(t)(O.error);var j=O.db;"function"!=typeof j.readTransaction&&(j.readTransaction=j.transaction),p(),_.type=function(){return"websql"},_._id=f(function(e){e(null,b)}),_._info=function(e){j.readTransaction(function(t){m(t,function(n){var r="SELECT MAX(seq) AS seq FROM "+to;t.executeSql(r,[],function(t,r){var i=r.rows.item(0).seq||0;e(null,{doc_count:n,update_seq:i,sqlite_plugin:j._sqlitePlugin,websql_encoding:y})})})},Wn(e))},_._bulkDocs=function(t,n,r){zn(e,t,n,_,j,so,r)},_._get=function(e,t,n){function r(){n(a,{doc:i,metadata:o,ctx:s})}var i,o,a,s=t.ctx;if(!s)return j.readTransaction(function(r){_._get(e,Zn.extend({ctx:r},t),n)});var u,c;t.rev?(u=Yn(mo,[eo,to],eo+".id="+to+".doc_id",[to+".doc_id=?",to+".rev=?"]),c=[e,t.rev]):(u=Yn(mo,[eo,to],vo,eo+".id=?"),c=[e]),s.executeSql(u,c,function(e,n){if(!n.rows.length)return a=A(pr,"missing"),r();var s=n.rows.item(0);return o=an(s.metadata),s.deleted&&!t.rev?(a=A(pr,"deleted"),r()):(i=Un(s.data,o.id,s.rev),void r())})},_._allDocs=function(e,t){var n,r=[],i="startkey"in e?e.startkey:!1,o="endkey"in e?e.endkey:!1,a="key"in e?e.key:!1,s="descending"in e?e.descending:!1,u="limit"in e?e.limit:-1,c="skip"in e?e.skip:0,l=e.inclusive_end!==!1,f=[],h=[];if(a!==!1)h.push(eo+".id = ?"),f.push(a);else if(i!==!1||o!==!1){if(i!==!1&&(h.push(eo+".id "+(s?"<=":">=")+" ?"),f.push(i)),o!==!1){var d=s?">":"<";l&&(d+="="),h.push(eo+".id "+d+" ?"),f.push(o)}a!==!1&&(h.push(eo+".id = ?"),f.push(a))}"ok"!==e.deleted&&h.push(to+".deleted = 0"),j.readTransaction(function(t){m(t,function(i){if(n=i,0!==u){var o=Yn(mo,[eo,to],vo,h,eo+".id "+(s?"DESC":"ASC"));o+=" LIMIT "+u+" OFFSET "+c,t.executeSql(o,f,function(t,n){for(var i=0,o=n.rows.length;o>i;i++){var a=n.rows.item(i),s=an(a.metadata),u=s.id,c=Un(a.data,u,a.rev),l=c._rev,f={id:u,key:u,value:{rev:l}};if(e.include_docs&&(f.doc=c,f.doc._rev=l,e.conflicts&&(f.doc._conflicts=E(s)),Jn(f.doc,e,_,t)),a.deleted){if("ok"!==e.deleted)continue;f.value.deleted=!0,f.doc=null}r.push(f)}})}})},Wn(t),function(){t(null,{total_rows:n,offset:e.skip,rows:r})})},_._changes=function(e){function t(){var t=eo+".json AS metadata, "+eo+".max_seq AS maxSeq, "+to+".json AS winningDoc, "+to+".rev AS winningRev ",n=eo+" JOIN "+to,u=eo+".id="+to+".doc_id AND "+eo+".winningseq="+to+".seq",c=["maxSeq > ?"],l=[e.since];e.doc_ids&&(c.push(eo+".id IN "+Hn(e.doc_ids.length)),l=l.concat(e.doc_ids));var f="maxSeq "+(r?"DESC":"ASC"),h=Yn(t,n,u,c,f),d=we(e);e.view||e.filter||(h+=" LIMIT "+i);var p=e.since||0;j.readTransaction(function(t){t.executeSql(h,l,function(t,n){function r(t){return function(){e.onChange(t)}}for(var u=0,c=n.rows.length;c>u;u++){var l=n.rows.item(u),f=an(l.metadata);p=l.maxSeq;var h=Un(l.winningDoc,f.id,l.winningRev),v=e.processChange(h,f,e);v.seq=l.maxSeq;var m=d(v);if("object"==typeof m)return e.complete(m);if(m&&(s++,o&&a.push(v),e.attachments&&e.include_docs?Jn(h,e,_,t,r(v)):r(v)()),s===i)break}})},Wn(e.complete),function(){e.continuous||e.complete(null,{results:a,last_seq:p})})}if(e=c(e),e.continuous){var n=_._name+":"+L();return so.addListener(_._name,n,_,e),so.notify(_._name),{cancel:function(){so.removeListener(_._name,n)}}}var r=e.descending;e.since=e.since&&!r?e.since:0;var i="limit"in e?e.limit:-1;0===i&&(i=1);var o;o="return_docs"in e?e.return_docs:"returnDocs"in e?e.returnDocs:!0;var a=[],s=0;t()},_._close=function(e){e()},_._getAttachment=function(e,t,n){var r,i=t.ctx,o=e.digest,a=e.content_type,s="SELECT escaped, CASE WHEN escaped = 1 THEN body ELSE HEX(body) END AS body FROM "+no+" WHERE digest=?";i.executeSql(s,[o],function(e,i){var o=i.rows.item(0),s=o.escaped?Nn(o.body):Cn(o.body,y);r=t.binary?_e(s,a):Zr(s),n(null,r)})},_._getRevisionTree=function(e,t){j.readTransaction(function(n){var r="SELECT json AS metadata FROM "+eo+" WHERE id = ?";n.executeSql(r,[e],function(e,n){if(n.rows.length){var r=an(n.rows.item(0).metadata);t(null,r.rev_tree)}else t(A(pr))})})},_._doCompaction=function(e,t,n){return t.length?void j.transaction(function(n){var r="SELECT json AS metadata FROM "+eo+" WHERE id = ?";n.executeSql(r,[e],function(n,r){var i=an(r.rows.item(0).metadata);x(i.rev_tree,function(e,n,r,i,o){var a=n+"-"+r;-1!==t.indexOf(a)&&(o.status="missing")});var o="UPDATE "+eo+" SET json = ? WHERE id = ?";n.executeSql(o,[sn(i),e])}),Bn(t,e,n)},Wn(n),function(){n()}):n()},_._getLocal=function(e,t){j.readTransaction(function(n){var r="SELECT json, rev FROM "+ro+" WHERE id=?";n.executeSql(r,[e],function(n,r){if(r.rows.length){var i=r.rows.item(0),o=Un(i.json,e,i.rev);t(null,o)}else t(A(pr))})})},_._putLocal=function(e,t,n){function r(e){var r,c;o?(r="UPDATE "+ro+" SET rev=?, json=? WHERE id=? AND rev=?",c=[i,u,a,o]):(r="INSERT INTO "+ro+" (id, rev, json) VALUES (?,?,?)",c=[a,i,u]),e.executeSql(r,c,function(e,r){r.rowsAffected?(s={ok:!0,id:a,rev:i},t.ctx&&n(null,s)):n(A(vr))},function(){return n(A(vr)),!1})}"function"==typeof t&&(n=t,t={}),delete e._revisions;var i,o=e._rev,a=e._id;i=o?e._rev="0-"+(parseInt(o.split("-")[1],10)+1):e._rev="0-1";var s,u=Fn(e);t.ctx?r(t.ctx):j.transaction(r,Wn(n),function(){s&&n(null,s)})},_._removeLocal=function(e,t,n){function r(r){var o="DELETE FROM "+ro+" WHERE id=? AND rev=?",a=[e._id,e._rev];r.executeSql(o,a,function(r,o){return o.rowsAffected?(i={ok:!0,id:e._id,rev:"0-0"},void(t.ctx&&n(null,i))):n(A(pr))})}"function"==typeof t&&(n=t,t={});var i;t.ctx?r(t.ctx):j.transaction(r,Wn(n),function(){i&&n(null,i)})},_._destroy=function(e,t){so.removeAllListeners(_._name),j.transaction(function(e){var t=[eo,to,no,io,ro,oo];t.forEach(function(t){e.executeSql("DROP TABLE IF EXISTS "+t,[])})},Wn(t),function(){oe()&&(delete window.localStorage["_pouch__websqldb_"+_._name],delete window.localStorage[_._name]),t(null,{ok:!0})})}}var Zn=e(7),Xn=i(Zn),Qn=i(e(2)),er=i(e(6)),tr=i(e(8)),nr=e(12),rr=i(e(1)),ir=e(4),or=i(e(14)),ar=e(10),sr=i(ar),ur=i(e(15)),cr=i(e(16)),lr="function"==typeof Promise?Promise:tr,fr=Qn("pouchdb:api");er(O,Error),O.prototype.toString=function(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})};var hr=new O({status:401,error:"unauthorized",reason:"Name or password is incorrect."}),dr=new O({status:400,error:"bad_request",reason:"Missing JSON list of 'docs'"}),pr=new O({status:404,error:"not_found",reason:"missing"}),vr=new O({status:409,error:"conflict",reason:"Document update conflict"}),mr=new O({status:400,error:"invalid_id",reason:"_id field must contain a string"}),gr=new O({status:412,error:"missing_id",reason:"_id is required for puts"}),yr=new O({status:400,error:"bad_request",reason:"Only reserved document ids may start with underscore."}),_r=new O({status:412,error:"precondition_failed",reason:"Database not open"}),br=new O({status:500,error:"unknown_error",reason:"Database encountered an unknown error"}),wr=new O({status:500,error:"badarg",reason:"Some query argument is invalid"}),xr=new O({status:400,error:"invalid_request",reason:"Request was invalid"}),kr=new O({status:400,error:"query_parse_error",reason:"Some query parameter is invalid"}),Sr=new O({status:500,error:"doc_validation",reason:"Bad special document member"}),Er=new O({status:400,error:"bad_request",reason:"Something wrong with the request"}),Or=new O({status:400,error:"bad_request",reason:"Document must be a JSON object"}),Ar=new O({status:404,error:"not_found",reason:"Database not found"}),jr=new O({status:500,error:"indexed_db_went_bad",reason:"unknown"}),Tr=new O({status:500,error:"web_sql_went_bad",reason:"unknown"}),Dr=new O({status:500,error:"levelDB_went_went_bad",reason:"unknown"}),Ir=new O({status:403,error:"forbidden",reason:"Forbidden by design doc validate_doc_update function"}),Mr=new O({status:400,error:"bad_request",reason:"Invalid rev format"}),Cr=new O({status:412,error:"file_exists",reason:"The database could not be created, the file already exists."}),qr=new O({status:412,error:"missing_stub"}),Lr=new O({status:413,error:"invalid_url",reason:"Provided URL is invalid"}),Rr={UNAUTHORIZED:hr,MISSING_BULK_DOCS:dr,MISSING_DOC:pr,REV_CONFLICT:vr,INVALID_ID:mr,MISSING_ID:gr,RESERVED_ID:yr,NOT_OPEN:_r,UNKNOWN_ERROR:br,BAD_ARG:wr,INVALID_REQUEST:xr,QUERY_PARSE_ERROR:kr,DOC_VALIDATION:Sr,BAD_REQUEST:Er,NOT_AN_OBJECT:Or,DB_MISSING:Ar,WSQ_ERROR:Tr,LDB_ERROR:Dr,FORBIDDEN:Ir,INVALID_REV:Mr,FILE_EXISTS:Cr,MISSING_STUB:qr,IDB_ERROR:jr,INVALID_URL:Lr},Pr=function(e,t,n){var r=Object.keys(Rr).filter(function(n){var r=Rr[n];return"function"!=typeof r&&r[e]===t}),i=n&&r.filter(function(e){var t=Rr[e];return t.message===n})[0]||r[0];return i?Rr[i]:null};er(T,ir.EventEmitter),T.prototype.cancel=function(){this.isCancelled=!0,this.db.taskqueue.isReady&&this.emit("cancel")},T.prototype.doChanges=function(e){var t=this,n=e.complete;if(e=c(e),"live"in e&&!("continuous"in e)&&(e.continuous=e.live),e.processChange=D,"latest"===e.since&&(e.since="now"),e.since||(e.since=0),"now"===e.since)return void this.db.info().then(function(r){return t.isCancelled?void n(null,{status:"cancelled"}):(e.since=r.update_seq,void t.doChanges(e))},n);if(e.continuous&&"now"!==e.since&&this.db.info().then(function(e){t.startSeq=e.update_seq},function(e){if("idbNull"!==e.id)throw e}),e.filter&&"string"==typeof e.filter&&("_view"===e.filter?e.view=w(e.view):e.filter=w(e.filter),"http"!==this.db.type()&&!e.doc_ids))return this.filterChanges(e);"descending"in e||(e.descending=!1),e.limit=0===e.limit?1:e.limit,e.complete=n;var r=this.db._changes(e);if(r&&"function"==typeof r.cancel){var i=t.cancel;t.cancel=rr(function(e){r.cancel(),i.apply(this,e)})}},T.prototype.filterChanges=function(e){var t=this,n=e.complete;if("_view"===e.filter){if(!e.view||"string"!=typeof e.view){var r=A(Er,"`view` filter parameter not found or invalid.");return n(r)}var i=b(e.view);this.db.getView(i[0],i[1],function(r,i){return t.isCancelled?n(null,{status:"cancelled"}):r?n(j(r)):i.map?(e.filter=_(i.map),void t.doChanges(e)):n(A(pr))})}else{var o=b(e.filter);if(!o)return t.doChanges(e);this.db.getFilter(o[0],o[1],function(r,i){return t.isCancelled?n(null,{status:"cancelled"}):r?n(j(r)):(e.filter=y(i),void t.doChanges(e))})}};var Nr="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),Fr=R(["_id","_rev","_attachments","_deleted","_revisions","_revs_info","_conflicts","_deleted_conflicts","_local_seq","_rev_tree","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats","_removed"]),Ur=R(["_attachments","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats"]);er(Q,ir.EventEmitter),Q.prototype.post=h("post",function(e,t,n){return"function"==typeof t&&(n=t,t={}),"object"!=typeof e||Array.isArray(e)?n(A(Or)):void this.bulkDocs({docs:[e]},t,B(n))}),Q.prototype.put=h("put",rr(function(e){var t,n,r,i,o=e.shift(),a="_id"in o;if("object"!=typeof o||Array.isArray(o))return(i=e.pop())(A(Or));for(;;)if(t=e.shift(),n=typeof t,"string"!==n||a?"string"!==n||!a||"_rev"in o?"object"===n?r=t:"function"===n&&(i=t):o._rev=t:(o._id=t,a=!0),!e.length)break;return r=r||{},P(o._id),M(o._id)&&"function"==typeof this._putLocal?o._deleted?this._removeLocal(o,i):this._putLocal(o,i):void this.bulkDocs({docs:[o]},r,B(i))})),Q.prototype.putAttachment=h("putAttachment",function(e,t,n,r,i){function o(e){var n="_rev"in e?parseInt(e._rev,10):0;return e._attachments=e._attachments||{},e._attachments[t]={content_type:i,data:r,revpos:++n},a.put(e)}var a=this;return"function"==typeof i&&(i=r,r=n,n=null),"undefined"==typeof i&&(i=r,r=n,n=null),a.get(e).then(function(e){if(e._rev!==n)throw A(vr);return o(e)},function(t){if(t.reason===pr.message)return o({_id:e});throw t})}),Q.prototype.removeAttachment=h("removeAttachment",function(e,t,n,r){var i=this;i.get(e,function(e,o){return e?void r(e):o._rev!==n?void r(A(vr)):o._attachments?(delete o._attachments[t],0===Object.keys(o._attachments).length&&delete o._attachments,void i.put(o,r)):r()})}),Q.prototype.remove=h("remove",function(e,t,n,r){var i;"string"==typeof t?(i={_id:e,_rev:t},"function"==typeof n&&(r=n,n={})):(i=e,"function"==typeof t?(r=t,n={}):(r=n,n=t)),n=n||{},n.was_delete=!0;var o={_id:i._id,_rev:i._rev||n.rev};return o._deleted=!0,M(o._id)&&"function"==typeof this._removeLocal?this._removeLocal(i,r):void this.bulkDocs({docs:[o]},n,B(r))}),Q.prototype.revsDiff=h("revsDiff",function(e,t,n){function r(e,t){s.has(e)||s.set(e,{missing:[]}),s.get(e).missing.push(t)}function i(t,n){var i=e[t].slice(0);x(n,function(e,n,o,a,s){var u=n+"-"+o,c=i.indexOf(u);-1!==c&&(i.splice(c,1),"available"!==s.status&&r(t,u))}),i.forEach(function(e){r(t,e)})}"function"==typeof t&&(n=t,t={});var o=Object.keys(e);if(!o.length)return n(null,{});var a=0,s=new nr.Map;o.map(function(t){this._getRevisionTree(t,function(r,u){if(r&&404===r.status&&"missing"===r.message)s.set(t,{missing:e[t]});else{if(r)return n(r);i(t,u)}if(++a===o.length){var c={};return s.forEach(function(e,t){c[t]=e}),n(null,c)}})},this)}),Q.prototype.bulkGet=h("bulkGet",function(e,t){I(this,e,t)}),Q.prototype.compactDocument=h("compactDocument",function(e,t,n){var r=this;this._getRevisionTree(e,function(i,o){if(i)return n(i);var a=$(o),s=[],u=[];Object.keys(a).forEach(function(e){a[e]>t&&s.push(e)}),x(o,function(e,t,n,r,i){var o=t+"-"+n;"available"===i.status&&-1!==s.indexOf(o)&&u.push(o)}),r._doCompaction(e,u,n)})}),Q.prototype.compact=h("compact",function(e,t){"function"==typeof e&&(t=e,e={});var n=this;e=e||{},n._compactionQueue=n._compactionQueue||[],n._compactionQueue.push({opts:e,callback:t}),1===n._compactionQueue.length&&z(n)}),Q.prototype._compact=function(e,t){function n(e){a.push(i.compactDocument(e.id,0))}function r(e){var n=e.last_seq;lr.all(a).then(function(){return d(i,"_local/compaction",function(e){return!e.last_seq||e.last_seqs)c(u,e,r,i),si(n);else{c(u,e,r,i);var l=u.end(!0),f=Me(l);t(null,f),u.destroy()}}var r="string"==typeof e,i=r?e.length:e.byteLength,o=Math.min(ui,i),a=Math.ceil(i/o),s=0,u=r?new ur:new ur.ArrayBuffer,c=r?qe:Ce;n()});er(He,ir.EventEmitter),He.prototype.cancel=function(){this.cancelled=!0,this.state="cancelled",this.emit("cancel")},He.prototype.ready=function(e,t){function n(){i.cancel()}function r(){e.removeListener("destroyed",n),t.removeListener("destroyed",n)}var i=this;i._readyCalled||(i._readyCalled=!0,e.once("destroyed",n),t.once("destroyed",n),i.once("complete",r))};var li={replicate:Be,toPouch:Ye},fi=li.replicate;er(Ve,ir.EventEmitter),Ve.prototype.cancel=function(){this.canceled||(this.canceled=!0,this.push.cancel(),this.pull.cancel())};var hi=25,di=50,pi={},vi=1800,mi=Qn("pouchdb:http");it.valid=function(){return!0},ot.prototype.add=function(e){return this.promise=this.promise["catch"](function(){}).then(function(){return e()}),this.promise},ot.prototype.finish=function(){return this.promise};var gi,yi=function(e,t){return t&&e.then(function(e){n.nextTick(function(){t(null,e)})},function(e){n.nextTick(function(){t(e)})}),e},_i=function(e){return rr(function(t){var n=t.pop(),r=e.apply(this,t);return"function"==typeof n&&yi(r,n),r})},bi=function(e,t){return e.then(function(e){return t().then(function(){return e})},function(e){return t().then(function(){throw e})})},wi=function(e,t){return function(){var n=arguments,r=this;return e.add(function(){return t.apply(r,n)})}},xi=function(e){for(var t={},n=0,r=e.length;r>n;n++)t["$"+e[n]]=!0;var i=Object.keys(t),o=new Array(i.length);for(n=0,r=i.length;r>n;n++)o[n]=i[n].substring(1);return o},ki={uniq:xi,sequentialize:wi,fin:bi,callbackify:_i,promisedCallback:yi},Si=sr.collate,Ei=sr.toIndexableString,Oi=sr.normalizeKey,Ai=sr.parseIndexableString;gi="undefined"!=typeof console&&"function"==typeof console.log?Function.prototype.bind.call(console.log,console):function(){};var ji=ki.callbackify,Ti=ki.sequentialize,Di=ki.uniq,Ii=ki.fin,Mi=ki.promisedCallback,Ci={},qi=new ot,Li=50,Ri={_sum:function(e,t){return _t(t)},_count:function(e,t){return t.length},_stats:function(e,t){function n(e){for(var t=0,n=0,r=e.length;r>n;n++){var i=e[n];t+=i*i}return t}return{sum:_t(t),min:Math.min.apply(null,t),max:Math.max.apply(null,t),count:t.length,sumsqr:n(t)}}},Pi=ji(function(){var e=this;return e._ddocCache&&delete e._ddocCache,"http"===e.type()?Pt(e):"function"==typeof e._viewCleanup?At(e):Nt(e)}),Ni=function(e,t,n){"function"==typeof t&&(n=t,t={}),t=t?xt(t):{},"function"==typeof e&&(e={map:e});var r=this,i=lr.resolve().then(function(){return Ft(r,e,t)});return Mi(i,n),i};er(Ut,Error),er(Ht,Error);var Fi={query:Ni,viewCleanup:Pi},Ui=5,Hi="document-store",Yi="by-sequence",Bi="attach-store",Wi="attach-seq-store",Vi="meta-store",$i="local-store",Gi="detect-blob-support",zi={running:!1,queue:[]};er(En,ir.EventEmitter),En.prototype.addListener=function(e,t,n,r){function i(){function e(){s=!1}if(a._listeners[t]){if(s)return void(s="waiting");s=!0;var u=o(r,["style","include_docs","attachments","conflicts","filter","doc_ids","view","since","query_params","binary"]);n.changes(u).on("change",function(e){e.seq>r.since&&!r.cancelled&&(r.since=e.seq,r.onChange(e))}).on("complete",function(){"waiting"===s&&setTimeout(function(){i()},0),s=!1}).on("error",e)}}if(!this._listeners[t]){var a=this,s=!1;this._listeners[t]=i,this.on(e,i)}},En.prototype.removeListener=function(e,t){t in this._listeners&&ir.EventEmitter.prototype.removeListener.call(this,e,this._listeners[t])},En.prototype.notifyLocalWindows=function(e){ie()?chrome.storage.local.set({dbName:e}):oe()&&(localStorage[e]="a"===localStorage[e]?"b":"a")},En.prototype.notify=function(e){this.emit(e),this.notifyLocalWindows(e)};var Ji,Ki=new nr.Map,Zi=new En,Xi=new nr.Map;On.valid=function(){var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform);return!e&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange};var Qi=7,eo=qn("document-store"),to=qn("by-sequence"),no=qn("attach-store"),ro=qn("local-store"),io=qn("metadata-store"),oo=qn("attach-seq-store"),ao=new nr.Map,so=new En,uo=1,co="CREATE INDEX IF NOT EXISTS 'by-seq-deleted-idx' ON "+to+" (seq, deleted)",lo="CREATE UNIQUE INDEX IF NOT EXISTS 'by-seq-doc-id-rev' ON "+to+" (doc_id, rev)",fo="CREATE INDEX IF NOT EXISTS 'doc-winningseq-idx' ON "+eo+" (winningseq)",ho="CREATE INDEX IF NOT EXISTS 'attach-seq-seq-idx' ON "+oo+" (seq)",po="CREATE UNIQUE INDEX IF NOT EXISTS 'attach-seq-digest-idx' ON "+oo+" (digest, seq)",vo=to+".seq = "+eo+".winningseq",mo=to+".seq AS seq, "+to+".deleted AS deleted, "+to+".json AS data, "+to+".rev AS rev, "+eo+".json AS metadata";Kn.use_prefix=!("undefined"!=typeof n&&!n.browser),Kn.valid=Rn;var go={idb:On,websql:Kn};re.ajax=me,re.utils=Qr,re.Errors=Rr,re.replicate=li.replicate,re.sync=We,re.version="5.3.2",re.adapter("http",it),re.adapter("https",it),re.plugin(Fi),Object.keys(go).forEach(function(e){re.adapter(e,go[e],!0)}),t.exports=re}).call(this,e(13),"undefined"!=typeof r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{1:1,10:10,12:12,13:13,14:14,15:15,16:16,2:2,4:4,6:6,7:7,8:8}]},{},[17])(17)})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],133:[function(e,t,n){function r(){l=!1,s.length?c=s.concat(c):f=-1,c.length&&i()}function i(){if(!l){var e=setTimeout(r);l=!0;for(var t=c.length;t;){for(s=c,c=[];++f1)for(var n=1;nr;r++)n.push("a"+r);var i=["return function ("+n.join(",")+") {","var self = this;","return new Promise(function (rs, rj) {","var res = fn.call(",["self"].concat(n).concat([s]).join(","),");","if (res &&",'(typeof res === "object" || typeof res === "function") &&','typeof res.then === "function"',") {rs(res);}","});","};"].join("");return Function(["Promise","fn"],i)(o,e)}function i(e){for(var t=Math.max(e.length-1,3),n=[],r=0;t>r;r++)n.push("a"+r);var i=["return function ("+n.join(",")+") {","var self = this;","var args;","var argLength = arguments.length;","if (arguments.length > "+t+") {","args = new Array(arguments.length + 1);","for (var i = 0; i < arguments.length; i++) {","args[i] = arguments[i];","}","}","return new Promise(function (rs, rj) {","var cb = "+s+";","var res;","switch (argLength) {",n.concat(["extra"]).map(function(e,t){return"case "+t+":res = fn.call("+["self"].concat(n.slice(0,t)).concat("cb").join(",")+");break;"}).join(""),"default:","args[argLength] = cb;","res = fn.apply(self, args);","}","if (res &&",'(typeof res === "object" || typeof res === "function") &&','typeof res.then === "function"',") {rs(res);}","});","};"].join("");return Function(["Promise","fn"],i)(o,e)}var o=e("./core.js"),a=e("asap");t.exports=o,o.denodeify=function(e,t){return"number"==typeof t&&t!==1/0?r(e,t):i(e)};var s="function (err, res) {if (err) { rj(err); } else { rs(res); }}";o.nodeify=function(e){return function(){var t=Array.prototype.slice.call(arguments),n="function"==typeof t[t.length-1]?t.pop():null,r=this;try{return e.apply(this,arguments).nodeify(n,r)}catch(i){if(null===n||"undefined"==typeof n)return new o(function(e,t){t(i)});a(function(){n.call(r,i)})}}},o.prototype.nodeify=function(e,t){return"function"!=typeof e?this:void this.then(function(n){a(function(){e.call(t,null,n)})},function(n){a(function(){e.call(t,n)})})}},{"./core.js":135,asap:28}],141:[function(e,t,n){"use strict";var r=e("./core.js");t.exports=r,r.enableSynchronous=function(){r.prototype.isPending=function(){return 0==this.getState()},r.prototype.isFulfilled=function(){return 1==this.getState()},r.prototype.isRejected=function(){return 2==this.getState()},r.prototype.getValue=function(){if(3===this._81)return this._65.getValue();if(!this.isFulfilled())throw new Error("Cannot get a value of an unfulfilled promise.");return this._65},r.prototype.getReason=function(){if(3===this._81)return this._65.getReason();if(!this.isRejected())throw new Error("Cannot get a rejection reason of a non-rejected promise.");return this._65},r.prototype.getState=function(){return 3===this._81?this._65.getState():-1===this._81||-2===this._81?0:this._81}},r.disableSynchronous=function(){r.prototype.isPending=void 0,r.prototype.isFulfilled=void 0,r.prototype.isRejected=void 0,r.prototype.getValue=void 0,r.prototype.getReason=void 0,r.prototype.getState=void 0}},{"./core.js":135}],142:[function(e,t,n){(function(){function e(e){function t(t,n,r,i,o,a){for(;o>=0&&a>o;o+=e){var s=i?i[o]:o;r=n(r,t[s],s,t)}return r}return function(n,r,i,o){r=w(r,o,4);var a=!j(n)&&b.keys(n),s=(a||n).length,u=e>0?0:s-1;return arguments.length<3&&(i=n[a?a[u]:u],u+=e),t(n,r,i,a,u,s)}}function r(e){return function(t,n,r){n=x(n,r);for(var i=A(t),o=e>0?0:i-1;o>=0&&i>o;o+=e)if(n(t[o],o,t))return o;return-1}}function i(e,t,n){return function(r,i,o){var a=0,s=A(r);if("number"==typeof o)e>0?a=o>=0?o:Math.max(o+s,a):s=o>=0?Math.min(o+1,s):o+s+1;else if(n&&o&&s)return o=n(r,i),r[o]===i?o:-1;if(i!==i)return o=t(h.call(r,a,s),b.isNaN),o>=0?o+a:-1;for(o=e>0?a:s-1;o>=0&&s>o;o+=e)if(r[o]===i)return o;return-1}}function o(e,t){var n=C.length,r=e.constructor,i=b.isFunction(r)&&r.prototype||c,o="constructor";for(b.has(e,o)&&!b.contains(t,o)&&t.push(o);n--;)o=C[n],o in e&&e[o]!==i[o]&&!b.contains(t,o)&&t.push(o)}var a=this,s=a._,u=Array.prototype,c=Object.prototype,l=Function.prototype,f=u.push,h=u.slice,d=c.toString,p=c.hasOwnProperty,v=Array.isArray,m=Object.keys,g=l.bind,y=Object.create,_=function(){},b=function(e){return e instanceof b?e:this instanceof b?void(this._wrapped=e):new b(e)};"undefined"!=typeof n?("undefined"!=typeof t&&t.exports&&(n=t.exports=b),n._=b):a._=b,b.VERSION="1.8.3";var w=function(e,t,n){if(void 0===t)return e;switch(null==n?3:n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)};case 4:return function(n,r,i,o){return e.call(t,n,r,i,o)}}return function(){return e.apply(t,arguments)}},x=function(e,t,n){return null==e?b.identity:b.isFunction(e)?w(e,t,n):b.isObject(e)?b.matcher(e):b.property(e)};b.iteratee=function(e,t){return x(e,t,1/0)};var k=function(e,t){return function(n){var r=arguments.length;if(2>r||null==n)return n;for(var i=1;r>i;i++)for(var o=arguments[i],a=e(o),s=a.length,u=0;s>u;u++){var c=a[u];t&&void 0!==n[c]||(n[c]=o[c])}return n}},S=function(e){if(!b.isObject(e))return{};if(y)return y(e);_.prototype=e;var t=new _;return _.prototype=null,t},E=function(e){return function(t){return null==t?void 0:t[e]}},O=Math.pow(2,53)-1,A=E("length"),j=function(e){var t=A(e);return"number"==typeof t&&t>=0&&O>=t};b.each=b.forEach=function(e,t,n){t=w(t,n);var r,i;if(j(e))for(r=0,i=e.length;i>r;r++)t(e[r],r,e);else{var o=b.keys(e);for(r=0,i=o.length;i>r;r++)t(e[o[r]],o[r],e)}return e},b.map=b.collect=function(e,t,n){t=x(t,n);for(var r=!j(e)&&b.keys(e),i=(r||e).length,o=Array(i),a=0;i>a;a++){var s=r?r[a]:a;o[a]=t(e[s],s,e)}return o},b.reduce=b.foldl=b.inject=e(1),b.reduceRight=b.foldr=e(-1),b.find=b.detect=function(e,t,n){var r;return r=j(e)?b.findIndex(e,t,n):b.findKey(e,t,n),void 0!==r&&-1!==r?e[r]:void 0},b.filter=b.select=function(e,t,n){var r=[];return t=x(t,n),b.each(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r},b.reject=function(e,t,n){return b.filter(e,b.negate(x(t)),n)},b.every=b.all=function(e,t,n){t=x(t,n);for(var r=!j(e)&&b.keys(e),i=(r||e).length,o=0;i>o;o++){var a=r?r[o]:o;if(!t(e[a],a,e))return!1}return!0},b.some=b.any=function(e,t,n){t=x(t,n);for(var r=!j(e)&&b.keys(e),i=(r||e).length,o=0;i>o;o++){var a=r?r[o]:o;if(t(e[a],a,e))return!0}return!1},b.contains=b.includes=b.include=function(e,t,n,r){return j(e)||(e=b.values(e)),("number"!=typeof n||r)&&(n=0),b.indexOf(e,t,n)>=0},b.invoke=function(e,t){var n=h.call(arguments,2),r=b.isFunction(t);return b.map(e,function(e){var i=r?t:e[t];return null==i?i:i.apply(e,n)})},b.pluck=function(e,t){return b.map(e,b.property(t))},b.where=function(e,t){return b.filter(e,b.matcher(t))},b.findWhere=function(e,t){return b.find(e,b.matcher(t))},b.max=function(e,t,n){var r,i,o=-(1/0),a=-(1/0);if(null==t&&null!=e){e=j(e)?e:b.values(e);for(var s=0,u=e.length;u>s;s++)r=e[s],r>o&&(o=r)}else t=x(t,n),b.each(e,function(e,n,r){i=t(e,n,r),(i>a||i===-(1/0)&&o===-(1/0))&&(o=e,a=i)});return o},b.min=function(e,t,n){var r,i,o=1/0,a=1/0;if(null==t&&null!=e){e=j(e)?e:b.values(e);for(var s=0,u=e.length;u>s;s++)r=e[s],o>r&&(o=r)}else t=x(t,n),b.each(e,function(e,n,r){i=t(e,n,r),(a>i||i===1/0&&o===1/0)&&(o=e,a=i)});return o},b.shuffle=function(e){for(var t,n=j(e)?e:b.values(e),r=n.length,i=Array(r),o=0;r>o;o++)t=b.random(0,o),t!==o&&(i[o]=i[t]),i[t]=n[o];return i},b.sample=function(e,t,n){return null==t||n?(j(e)||(e=b.values(e)),e[b.random(e.length-1)]):b.shuffle(e).slice(0,Math.max(0,t))},b.sortBy=function(e,t,n){return t=x(t,n),b.pluck(b.map(e,function(e,n,r){return{value:e,index:n,criteria:t(e,n,r)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||void 0===n)return 1;if(r>n||void 0===r)return-1}return e.index-t.index}),"value")};var T=function(e){return function(t,n,r){var i={};return n=x(n,r),b.each(t,function(r,o){var a=n(r,o,t);e(i,r,a)}),i}};b.groupBy=T(function(e,t,n){b.has(e,n)?e[n].push(t):e[n]=[t]}),b.indexBy=T(function(e,t,n){e[n]=t}),b.countBy=T(function(e,t,n){b.has(e,n)?e[n]++:e[n]=1}),b.toArray=function(e){return e?b.isArray(e)?h.call(e):j(e)?b.map(e,b.identity):b.values(e):[]},b.size=function(e){return null==e?0:j(e)?e.length:b.keys(e).length},b.partition=function(e,t,n){t=x(t,n);var r=[],i=[];return b.each(e,function(e,n,o){(t(e,n,o)?r:i).push(e)}),[r,i]},b.first=b.head=b.take=function(e,t,n){return null!=e?null==t||n?e[0]:b.initial(e,e.length-t):void 0},b.initial=function(e,t,n){return h.call(e,0,Math.max(0,e.length-(null==t||n?1:t)))},b.last=function(e,t,n){return null!=e?null==t||n?e[e.length-1]:b.rest(e,Math.max(0,e.length-t)):void 0},b.rest=b.tail=b.drop=function(e,t,n){return h.call(e,null==t||n?1:t)},b.compact=function(e){return b.filter(e,b.identity)};var D=function(e,t,n,r){for(var i=[],o=0,a=r||0,s=A(e);s>a;a++){var u=e[a];if(j(u)&&(b.isArray(u)||b.isArguments(u))){t||(u=D(u,t,n));var c=0,l=u.length;for(i.length+=l;l>c;)i[o++]=u[c++]}else n||(i[o++]=u)}return i};b.flatten=function(e,t){return D(e,t,!1)},b.without=function(e){return b.difference(e,h.call(arguments,1))},b.uniq=b.unique=function(e,t,n,r){b.isBoolean(t)||(r=n,n=t,t=!1),null!=n&&(n=x(n,r));for(var i=[],o=[],a=0,s=A(e);s>a;a++){var u=e[a],c=n?n(u,a,e):u;t?(a&&o===c||i.push(u),o=c):n?b.contains(o,c)||(o.push(c),i.push(u)):b.contains(i,u)||i.push(u)}return i},b.union=function(){return b.uniq(D(arguments,!0,!0))},b.intersection=function(e){for(var t=[],n=arguments.length,r=0,i=A(e);i>r;r++){var o=e[r];if(!b.contains(t,o)){for(var a=1;n>a&&b.contains(arguments[a],o);a++);a===n&&t.push(o)}}return t},b.difference=function(e){var t=D(arguments,!0,!0,1);return b.filter(e,function(e){return!b.contains(t,e)})},b.zip=function(){return b.unzip(arguments)},b.unzip=function(e){for(var t=e&&b.max(e,A).length||0,n=Array(t),r=0;t>r;r++)n[r]=b.pluck(e,r);return n},b.object=function(e,t){for(var n={},r=0,i=A(e);i>r;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},b.findIndex=r(1),b.findLastIndex=r(-1),b.sortedIndex=function(e,t,n,r){n=x(n,r,1);for(var i=n(t),o=0,a=A(e);a>o;){var s=Math.floor((o+a)/2);n(e[s])o;o++,e+=n)i[o]=e;return i};var I=function(e,t,n,r,i){if(!(r instanceof t))return e.apply(n,i);var o=S(e.prototype),a=e.apply(o,i);return b.isObject(a)?a:o};b.bind=function(e,t){if(g&&e.bind===g)return g.apply(e,h.call(arguments,1));if(!b.isFunction(e))throw new TypeError("Bind must be called on a function");var n=h.call(arguments,2),r=function(){return I(e,r,t,this,n.concat(h.call(arguments)))};return r},b.partial=function(e){var t=h.call(arguments,1),n=function(){for(var r=0,i=t.length,o=Array(i),a=0;i>a;a++)o[a]=t[a]===b?arguments[r++]:t[a];for(;r=r)throw new Error("bindAll must be passed function names");for(t=1;r>t;t++)n=arguments[t],e[n]=b.bind(e[n],e);return e},b.memoize=function(e,t){var n=function(r){var i=n.cache,o=""+(t?t.apply(this,arguments):r);return b.has(i,o)||(i[o]=e.apply(this,arguments)),i[o]};return n.cache={},n},b.delay=function(e,t){var n=h.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},b.defer=b.partial(b.delay,b,1),b.throttle=function(e,t,n){var r,i,o,a=null,s=0;n||(n={});var u=function(){s=n.leading===!1?0:b.now(),a=null,o=e.apply(r,i),a||(r=i=null)};return function(){var c=b.now();s||n.leading!==!1||(s=c);var l=t-(c-s);return r=this,i=arguments,0>=l||l>t?(a&&(clearTimeout(a),a=null),s=c,o=e.apply(r,i),a||(r=i=null)):a||n.trailing===!1||(a=setTimeout(u,l)),o}},b.debounce=function(e,t,n){var r,i,o,a,s,u=function(){var c=b.now()-a;t>c&&c>=0?r=setTimeout(u,t-c):(r=null,n||(s=e.apply(o,i),r||(o=i=null)))};return function(){o=this,i=arguments,a=b.now();var c=n&&!r;return r||(r=setTimeout(u,t)),c&&(s=e.apply(o,i),o=i=null),s}},b.wrap=function(e,t){return b.partial(t,e)},b.negate=function(e){return function(){return!e.apply(this,arguments)}},b.compose=function(){var e=arguments,t=e.length-1;return function(){for(var n=t,r=e[t].apply(this,arguments);n--;)r=e[n].call(this,r);return r}},b.after=function(e,t){return function(){return--e<1?t.apply(this,arguments):void 0}},b.before=function(e,t){var n;return function(){return--e>0&&(n=t.apply(this,arguments)),1>=e&&(t=null),n}},b.once=b.partial(b.before,2);var M=!{toString:null}.propertyIsEnumerable("toString"),C=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];b.keys=function(e){if(!b.isObject(e))return[];if(m)return m(e);var t=[];for(var n in e)b.has(e,n)&&t.push(n);return M&&o(e,t),t},b.allKeys=function(e){if(!b.isObject(e))return[];var t=[];for(var n in e)t.push(n);return M&&o(e,t),t},b.values=function(e){for(var t=b.keys(e),n=t.length,r=Array(n),i=0;n>i;i++)r[i]=e[t[i]];return r},b.mapObject=function(e,t,n){t=x(t,n);for(var r,i=b.keys(e),o=i.length,a={},s=0;o>s;s++)r=i[s],a[r]=t(e[r],r,e);return a},b.pairs=function(e){for(var t=b.keys(e),n=t.length,r=Array(n),i=0;n>i;i++)r[i]=[t[i],e[t[i]]];return r},b.invert=function(e){for(var t={},n=b.keys(e),r=0,i=n.length;i>r;r++)t[e[n[r]]]=n[r];return t},b.functions=b.methods=function(e){var t=[];for(var n in e)b.isFunction(e[n])&&t.push(n);return t.sort()},b.extend=k(b.allKeys),b.extendOwn=b.assign=k(b.keys),b.findKey=function(e,t,n){t=x(t,n);for(var r,i=b.keys(e),o=0,a=i.length;a>o;o++)if(r=i[o],t(e[r],r,e))return r},b.pick=function(e,t,n){var r,i,o={},a=e;if(null==a)return o;b.isFunction(t)?(i=b.allKeys(a),r=w(t,n)):(i=D(arguments,!1,!1,1),r=function(e,t,n){return t in n},a=Object(a));for(var s=0,u=i.length;u>s;s++){var c=i[s],l=a[c];r(l,c,a)&&(o[c]=l)}return o},b.omit=function(e,t,n){if(b.isFunction(t))t=b.negate(t);else{var r=b.map(D(arguments,!1,!1,1),String);t=function(e,t){return!b.contains(r,t)}}return b.pick(e,t,n)},b.defaults=k(b.allKeys,!0),b.create=function(e,t){var n=S(e);return t&&b.extendOwn(n,t),n},b.clone=function(e){return b.isObject(e)?b.isArray(e)?e.slice():b.extend({},e):e},b.tap=function(e,t){return t(e),e},b.isMatch=function(e,t){var n=b.keys(t),r=n.length;if(null==e)return!r;for(var i=Object(e),o=0;r>o;o++){var a=n[o];if(t[a]!==i[a]||!(a in i))return!1}return!0};var q=function(e,t,n,r){if(e===t)return 0!==e||1/e===1/t;if(null==e||null==t)return e===t;e instanceof b&&(e=e._wrapped),t instanceof b&&(t=t._wrapped);var i=d.call(e);if(i!==d.call(t))return!1;switch(i){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!==+e?+t!==+t:0===+e?1/+e===1/t:+e===+t;case"[object Date]":case"[object Boolean]":return+e===+t}var o="[object Array]"===i;if(!o){if("object"!=typeof e||"object"!=typeof t)return!1;var a=e.constructor,s=t.constructor;if(a!==s&&!(b.isFunction(a)&&a instanceof a&&b.isFunction(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}n=n||[],r=r||[];for(var u=n.length;u--;)if(n[u]===e)return r[u]===t;if(n.push(e),r.push(t),o){if(u=e.length,u!==t.length)return!1;for(;u--;)if(!q(e[u],t[u],n,r))return!1}else{var c,l=b.keys(e);if(u=l.length,b.keys(t).length!==u)return!1;for(;u--;)if(c=l[u],!b.has(t,c)||!q(e[c],t[c],n,r))return!1}return n.pop(),r.pop(),!0};b.isEqual=function(e,t){return q(e,t)},b.isEmpty=function(e){return null==e?!0:j(e)&&(b.isArray(e)||b.isString(e)||b.isArguments(e))?0===e.length:0===b.keys(e).length},b.isElement=function(e){return!(!e||1!==e.nodeType)},b.isArray=v||function(e){return"[object Array]"===d.call(e)},b.isObject=function(e){var t=typeof e;return"function"===t||"object"===t&&!!e},b.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(e){b["is"+e]=function(t){return d.call(t)==="[object "+e+"]"}}),b.isArguments(arguments)||(b.isArguments=function(e){return b.has(e,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(b.isFunction=function(e){return"function"==typeof e||!1}),b.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},b.isNaN=function(e){return b.isNumber(e)&&e!==+e},b.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"===d.call(e)},b.isNull=function(e){return null===e},b.isUndefined=function(e){return void 0===e},b.has=function(e,t){return null!=e&&p.call(e,t)},b.noConflict=function(){return a._=s,this},b.identity=function(e){return e},b.constant=function(e){return function(){return e}},b.noop=function(){},b.property=E,b.propertyOf=function(e){return null==e?function(){}:function(t){return e[t]}},b.matcher=b.matches=function(e){return e=b.extendOwn({},e),function(t){return b.isMatch(t,e)}},b.times=function(e,t,n){var r=Array(Math.max(0,e));t=w(t,n,1);for(var i=0;e>i;i++)r[i]=t(i);return r},b.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))},b.now=Date.now||function(){return(new Date).getTime()};var L={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},R=b.invert(L),P=function(e){var t=function(t){return e[t]},n="(?:"+b.keys(e).join("|")+")",r=RegExp(n),i=RegExp(n,"g");return function(e){return e=null==e?"":""+e,r.test(e)?e.replace(i,t):e}};b.escape=P(L),b.unescape=P(R),b.result=function(e,t,n){var r=null==e?void 0:e[t];return void 0===r&&(r=n),b.isFunction(r)?r.call(e):r};var N=0;b.uniqueId=function(e){var t=++N+"";return e?e+t:t},b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var F=/(.)^/,U={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},H=/\\|'|\r|\n|\u2028|\u2029/g,Y=function(e){return"\\"+U[e]};b.template=function(e,t,n){!t&&n&&(t=n),t=b.defaults({},t,b.templateSettings);var r=RegExp([(t.escape||F).source,(t.interpolate||F).source,(t.evaluate||F).source].join("|")+"|$","g"),i=0,o="__p+='";e.replace(r,function(t,n,r,a,s){return o+=e.slice(i,s).replace(H,Y),i=s+t.length,n?o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":r?o+="'+\n((__t=("+r+"))==null?'':__t)+\n'":a&&(o+="';\n"+a+"\n__p+='"),t}),o+="';\n",t.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{var a=new Function(t.variable||"obj","_",o)}catch(s){throw s.source=o,s}var u=function(e){return a.call(this,e,b)},c=t.variable||"obj";return u.source="function("+c+"){\n"+o+"}",u},b.chain=function(e){var t=b(e);return t._chain=!0,t};var B=function(e,t){return e._chain?b(t).chain():t};b.mixin=function(e){b.each(b.functions(e),function(t){var n=b[t]=e[t];b.prototype[t]=function(){var e=[this._wrapped];return f.apply(e,arguments),B(this,n.apply(b,e))}})},b.mixin(b),b.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=u[e];b.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),"shift"!==e&&"splice"!==e||0!==n.length||delete n[0],B(this,n)}}),b.each(["concat","join","slice"],function(e){var t=u[e];b.prototype[e]=function(){return B(this,t.apply(this._wrapped,arguments))}}),b.prototype.value=function(){return this._wrapped},b.prototype.valueOf=b.prototype.toJSON=b.prototype.value,b.prototype.toString=function(){ +return""+this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return b})}).call(this)},{}],143:[function(e,t,n){t.exports={name:"capot",version:"1.3.4",author:{name:"Lupo Montero",url:"http://lupomontero.com"},license:"MIT",repository:"lupomontero/capot",homepage:"https://github.com/lupomontero/capot",scripts:{pretest:"gulp lint",test:"gulp test:server && gulp test:client"},dependencies:{async:"^1.5.2",backbone:"^1.3.3",boom:"^3.1.1",follow:"^0.12.1",good:"^6.6.3","good-console":"^5.3.2",h2o2:"^5.1.0",handlebars:"^4.0.5",hapi:"^13.3.0","hapi-auth-cookie":"^6.1.1",inert:"^3.2.0",joi:"^8.0.5",lodash:"^4.11.1",minimist:"^1.1.3",moment:"^2.13.0",multicouch:"^0.8.2",nodemailer:"^2.3.2",oauth:"^0.9.14",pouchdb:"5.3.2",promise:"^7.1.1",read:"^1.0.6",request:"^2.72.0",which:"^1.2.1"},devDependencies:{browserify:"^13.0.0",eslint:"^2.8.0","eslint-config-hapi":"^9.1.0","eslint-plugin-hapi":"^4.0.0",gulp:"^3.9.1","gulp-concat":"^2.6.0","gulp-declare":"^0.3.0","gulp-eslint":"^2.0.0","gulp-favicons":"^2.2.6","gulp-handlebars":"^4.0.0","gulp-mocha":"^2.2.0","gulp-rename":"^1.2.0","gulp-uglify":"^1.5.3","gulp-util":"^3.0.7","gulp-wrap":"^0.11.0",karma:"^0.13.22","karma-browserify":"^5.0.4","karma-env-preprocessor":"^0.1.1","karma-mocha":"^0.2.2","karma-mocha-reporter":"^2.0.2","karma-phantomjs-launcher":"^1.0.0",longjohn:"^0.2.11",lout:"^9.0.0","merge-stream":"^1.0.0",mkdirp:"^0.5.1",mocha:"^2.3.4","phantomjs-prebuilt":"^2.1.7",rimraf:"^2.5.2",sinon:"^1.17.3","vinyl-buffer":"^1.0.0","vinyl-source-stream":"^1.0.0",vision:"^4.1.0",watchify:"^3.7.0"},browser:{handlebars:"handlebars/runtime.js",pouchdb:"pouchdb/dist/pouchdb.js",extend:"lodash/assignIn.js",omit:"lodash/omit.js"}}},{}]},{},[3]); \ No newline at end of file diff --git a/package.json b/package.json index c113e9f..214c29a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "capot", - "version": "1.3.2", + "version": "1.3.4", "author": { "name": "Lupo Montero", "url": "http://lupomontero.com" @@ -54,7 +54,7 @@ "gulp-util": "^3.0.7", "gulp-wrap": "^0.13.0", "karma": "^0.13.22", - "karma-browserify": "^5.0.3", + "karma-browserify": "^5.0.4", "karma-env-preprocessor": "^0.1.1", "karma-mocha": "^1.0.1", "karma-mocha-reporter": "^2.0.1", diff --git a/server/lib/settings.js b/server/lib/settings.js index 5a50496..d565512 100644 --- a/server/lib/settings.js +++ b/server/lib/settings.js @@ -17,7 +17,7 @@ module.exports = function (options) { port: options.port || env.PORT || 3001, cwd: cwd, www: options.www || env.WWW || 'www', - data: Path.join(cwd, 'data'), + data: options.data || env.DATA || Path.join(cwd, 'data'), couchdb: { url: couchdb.url || env.COUCHDB_URL, user: couchdb.user || env.COUCHDB_USER || 'admin',