text: webpackJsonp([1],{113:function(t,r,e){"use strict";var n=function(t){return t&&"object"==typeof t&&"default"in t?t.default:t}(e(237)),o="function"==typeof Promise?Promise:n;t.exports=o},114:function(t,r,e){"use strict";function n(t){return t&&"object"==typeof t&&"default"in t?t.default:t}function o(t){return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer||"undefined"!=typeof Blob&&t instanceof Blob}function c(t){if("function"==typeof t.slice)return t.slice(0);var r=new ArrayBuffer(t.byteLength),e=new Uint8Array(r),n=new Uint8Array(t);return e.set(n),r}function u(t){if(t instanceof ArrayBuffer)return c(t);var r=t.size,e=t.type;return"function"==typeof t.slice?t.slice(0,r,e):t.webkitSlice(0,r,e)}function i(t){var r=Object.getPrototypeOf(t);if(null===r)return!0;var e=r.constructor;return"function"==typeof e&&e instanceof e&&K.call(e)==X}function a(t){var r,e,n;if(!t||"object"!=typeof t)return t;if(Array.isArray(t)){for(r=[],e=0,n=t.length;e<n;e++)r[e]=a(t[e]);return r}if(t instanceof Date)return t.toISOString();if(o(t))return u(t);if(!i(t))return t;r={};for(e in t)if(Object.prototype.hasOwnProperty.call(t,e)){var c=a(t[e]);void 0!==c&&(r[e]=c)}return r}function _(t){var r=!1;return J(function(e){if(r)throw new Error("once called more than once");r=!0,t.apply(this,e)})}function s(t){return J(function(r){r=a(r);var e=this,n="function"==typeof r[r.length-1]&&r.pop(),o=new U(function(n,o){var c;try{var u=_(function(t,r){t?o(t):n(r)});r.push(u),c=t.apply(e,r),c&&"function"==typeof c.then&&n(c)}catch(t){o(t)}});return n&&o.then(function(t){n(null,t)},n),o})}function f(t,r,e){if(t.constructor.listeners("debug").length){for(var n=["api",t.name,r],o=0;o<e.length-1;o++)n.push(e[o]);t.constructor.emit("debug",n);var c=e[e.length-1];e[e.length-1]=function(e,n){var o=["api",t.name,r];o=o.concat(e?["error",e]:["success",n]),t.constructor.emit("debug",o),c(e,n)}}}function l(t,r){return s(J(function(e){if(this._closed)return U.reject(new Error("database is closed"));if(this._destroyed)return U.reject(new Error("database is destroyed"));var n=this;return f(n,t,e),this.taskqueue.isReady?r.apply(this,e):new U(function(r,o){n.taskqueue.addTask(function(c){c?o(c):r(n[t].apply(n,e))})})}))}function d(t,r){for(var e={},n=0,o=r.length;n<o;n++){var c=r[n];c in t&&(e[c]=t[c])}return e}function p(t){return t}function h(t){return[{ok:t}]}function v(t,r,e){function n(){var t=[];l.forEach(function(r){r.docs.forEach(function(e){t.push({id:r.id,docs:[e]})})}),e(null,{results:t})}function o(){++f===s&&n()}function c(t,r,e){l[t]={id:r,docs:e},o()}function u(){if(!(m>=v.length)){var t=Math.min(m+Q,v.length),r=v.slice(m,t);i(r,m),m+=r.length}}function i(e,n){e.forEach(function(e,o){var i=n+o,a=_.get(e),s=d(a[0],["atts_since","attachments"]);s.open_revs=a.map(function(t){return t.rev}),s.open_revs=s.open_revs.filter(p);var f=p;0===s.open_revs.length&&(delete s.open_revs,f=h),["revs","attachments","binary","ajax","latest"].forEach(function(t){t in r&&(s[t]=r[t])}),t.get(e,s,function(t,r){var n;n=t?[{error:t}]:f(r),c(i,e,n),u()})})}var a=r.docs,_=new H.Map;a.forEach(function(t){_.has(t.id)?_.get(t.id).push(t):_.set(t.id,[t])});var s=_.size,f=0,l=new Array(s),v=[];_.forEach(function(t,r){v.push(r)});var m=0;u()}function m(){return"undefined"!=typeof chrome&&void 0!==chrome.storage&&void 0!==chrome.storage.local}function g(){return $}function y(t){m()?chrome.storage.onChanged.addListener(function(r){null!=r.db_name&&t.emit(r.dbName.newValue)}):g()&&("undefined"!=typeof addEventListener?addEventListener("storage",function(r){t.emit(r.key)}):window.attachEvent("storage",function(r){t.emit(r.key)}))}function b(){V.EventEmitter.call(this),this._listeners={},y(this)}function w(t){if("undefined"!==console&&t in console){var r=Array.prototype.slice.call(arguments,1);console[t].apply(console,r)}}function T(t,r){return t=parseInt(t,10)||0,r=parseInt(r,10),r!==r||r<=t?r=(t||1)<<1:r+=1,r>6e5&&(t=3e5,r=6e5),~~((r-t)*Math.random()+t)}function k(t){var r=0;return t||(r=2e3),T(t,r)}function S(t,r){w("info","The above "+t+" is totally normal. "+r)}function x(t,r,e){try{return!t(r,e)}catch(t){var n="Filter function threw: "+t.toString();return G.createError(G.BAD_REQUEST,n)}}function E(t){var r={},e=t.filter&&"function"==typeof t.filter;return r.query=t.query_params,function(n){n.doc||(n.doc={});var o=e&&x(t.filter,n.doc,r);if("object"==typeof o)return o;if(o)return!1;if(t.include_docs){if(!t.attachments)for(var c in n.doc._attachments)n.doc._attachments.hasOwnProperty(c)&&(n.doc._attachments[c].stub=!0)}else delete n.doc;return!0}}function A(t){for(var r=[],e=0,n=t.length;e<n;e++)r=r.concat(t[e]);return r}function O(){}function I(t){var r;if(t?"string"!=typeof t?r=G.createError(G.INVALID_ID):/^_/.test(t)&&!/^_(design|local)/.test(t)&&(r=G.createError(G.RESERVED_ID)):r=G.createError(G.MISSING_ID),r)throw r}function C(){return"undefined"!=typeof cordova||"undefined"!=typeof PhoneGap||"undefined"!=typeof phonegap}function q(t){return"boolean"==typeof t._remote?t._remote:"function"==typeof t.type&&(w("warn","db.type() is deprecated and will be removed in a future version of PouchDB"),"http"===t.type())}function N(t,r){return"listenerCount"in t?t.listenerCount(r):V.EventEmitter.listenerCount(t,r)}function M(t){if(!t)return null;var r=t.split("/");return 2===r.length?r:1===r.length?[t,t]:null}function j(t){var r=M(t);return r?r.join("/"):null}function D(t){for(var r=ut.exec(t),e={},n=14;n--;){var o=nt[n],c=r[n]||"",u=-1!==["user","password"].indexOf(o);e[o]=u?decodeURIComponent(c):c}return e[ot]={},e[nt[12]].replace(ct,function(t,r,n){r&&(e[ot][r]=n)}),e}function R(t,r){var e=[],n=[];for(var o in r)r.hasOwnProperty(o)&&(e.push(o),n.push(r[o]));return e.push(t),Function.apply(null,e).apply(null,n)}function B(t,r,e){return new U(function(n,o){t.get(r,function(c,u){if(c){if(404!==c.status)return o(c);u={}}var i=u._rev,a=e(u);if(!a)return n({updated:!1,rev:i});a._id=r,a._rev=i,n(L(t,a,e))})})}function L(t,r,e){return t.put(r).then(function(t){return{updated:!0,rev:t.rev}},function(n){if(409!==n.status)throw n;return B(t,r._id,e)})}function P(t){return 0|Math.random()*t}function F(t,r){r=r||it.length;var e="",n=-1;if(t){for(;++n<t;)e+=it[P(r)];return e}for(;++n<36;)switch(n){case 8:case 13:case 18:case 23:e+="-";break;case 19:e+=it[3&P(16)|8];break;default:e+=it[P(16)]}return e}Object.defineProperty(r,"__esModule",{value:!0});var $,U=n(e(113)),J=n(e(130)),H=e(165),V=e(87),z=n(e(5)),W=n(e(163)),G=e(568),K=Function.prototype.toString,X=K.call(Object),Q=6;if(m())$=!1;else try{localStorage.setItem("_pouch_check_localstorage",1),$=!!localStorage.getItem("_pouch_check_localstorage")}catch(t){$=!1}z(b,V.EventEmitter),b.prototype.addListener=function(t,r,e,n){function o(){function t(){u=!1}if(c._listeners[r]){if(u)return void(u="waiting");u=!0;var i=d(n,["style","include_docs","attachments","conflicts","filter","doc_ids","view","since","query_params","binary"]);e.changes(i).on("change",function(t){t.seq>n.since&&!n.cancelled&&(n.since=t.seq,n.onChange(t))}).on("complete",function(){"waiting"===u&&W(o),u=!1}).on("error",t)}}if(!this._listeners[r]){var c=this,u=!1;this._listeners[r]=o,this.on(t,o)}},b.prototype.removeListener=function(t,r){r in this._listeners&&(V.EventEmitter.prototype.removeListener.call(this,t,this._listeners[r]),delete this._listeners[r])},b.prototype.notifyLocalWindows=function(t){m()?chrome.storage.local.set({dbName:t}):g()&&(localStorage[t]="a"===localStorage[t]?"b":"a")},b.prototype.notify=function(t){this.emit(t),this.notifyLocalWindows(t)};var Y;Y="function"==typeof Object.assign?Object.assign:function(t){for(var r=Object(t),e=1;e<arguments.length;e++){var n=arguments[e];if(null!=n)for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])}return r};var Z,tt=Y,rt=O.name;Z=rt?function(t){return t.name}:function(t){return t.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]};var et=Z,nt=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],ot="queryKey",ct=/(?:^|&)([^&=]*)=?([^&]*)/g,ut=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,it="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");r.adapterFun=l,r.bulkGetShim=v,r.changesHandler=b,r.clone=a,r.defaultBackOff=k,r.explainError=S,r.assign=tt,r.filterChange=E,r.flatten=A,r.functionName=et,r.guardedConsole=w,r.hasLocalStorage=g,r.invalidIdError=I,r.isChromeApp=m,r.isCordova=C,r.isRemote=q,r.listenerCount=N,r.nextTick=W,r.normalizeDdocFunctionName=j,r.once=_,r.parseDdocFunctionName=M,r.parseUri=D,r.pick=d,r.scopeEval=R,r.toPromise=s,r.upsert=B,r.uuid=F},130:function(t,r,e){"use strict";function n(t){return function(){var r=arguments.length;if(r){for(var e=[],n=-1;++n<r;)e[n]=arguments[n];return t.call(this,e)}return t.call(this,[])}}t.exports=n},163:function(t,r,e){"use strict";(function(r){function e(){s=!0;for(var t,r,e=f.length;e;){for(r=f,f=[],t=-1;++t<e;)r[t]();e=f.length}s=!1}function n(t){1!==f.push(t)||s||o()}var o,c=r.MutationObserver||r.WebKitMutationObserver;if(c){var u=0,i=new c(e),a=r.document.createTextNode("");i.observe(a,{characterData:!0}),o=function(){a.data=u=++u%2}}else if(r.setImmediate||void 0===r.MessageChannel)o="document"in r&&"onreadystatechange"in r.document.createElement("script")?function(){var t=r.document.createElement("script");t.onreadystatechange=function(){e(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},r.document.documentElement.appendChild(t)}:function(){setTimeout(e,0)};else{var _=new r.MessageChannel;_.port1.onmessage=e,o=function(){_.port2.postMessage(0)}}var s,f=[];t.exports=n}).call(r,e(28))},164:function(t,r,e){"use strict";function n(t,r,e){for(var n="",o=e-t.length;n.length<o;)n+=r;return n}function o(t,r,e){return n(t,r,e)+t}function c(t,r){if(t===r)return 0;t=u(t),r=u(r);var e=h(t),n=h(r);if(e-n!=0)return e-n;switch(typeof t){case"number":return t-r;case"boolean":return t<r?-1:1;case"string":return d(t,r)}return Array.isArray(t)?l(t,r):p(t,r)}function u(t){switch(typeof t){case"undefined":return null;case"number":return t===1/0||t===-1/0||isNaN(t)?null:t;case"object":var r=t;if(Array.isArray(t)){var e=t.length;t=new Array(e);for(var n=0;n<e;n++)t[n]=u(r[n])}else{if(t instanceof Date)return t.toJSON();if(null!==t){t={};for(var o in r)if(r.hasOwnProperty(o)){var c=r[o];void 0!==c&&(t[o]=u(c))}}}}return t}function i(t){if(null!==t)switch(typeof t){case"boolean":return t?1:0;case"number":return v(t);case"string":return t.replace(/\u0002/g,"").replace(/\u0001/g,"").replace(/\u0000/g,"");case"object":var r=Array.isArray(t),e=r?t:Object.keys(t),n=-1,o=e.length,c="";if(r)for(;++n<o;)c+=a(e[n]);else for(;++n<o;){var u=e[n];c+=a(u)+a(t[u])}return c}return""}function a(t){return t=u(t),h(t)+y+i(t)+"\0"}function _(t,r){var e,n=r;if("1"===t[r])e=0,r++;else{var o="0"===t[r];r++;var c="",u=t.substring(r,r+g),i=parseInt(u,10)+m;for(o&&(i=-i),r+=g;;){var a=t[r];if("\0"===a)break;c+=a,r++}c=c.split("."),e=1===c.length?parseInt(c,10):parseFloat(c[0]+"."+c[1]),o&&(e-=10),0!==i&&(e=parseFloat(e+"e"+i))}return{num:e,length:r-n}}function s(t,r){var e=t.pop();if(r.length){var n=r[r.length-1];e===n.element&&(r.pop(),n=r[r.length-1]);var o=n.element,c=n.index;if(Array.isArray(o))o.push(e);else if(c===t.length-2){var u=t.pop();o[u]=e}else t.push(e)}}function f(t){for(var r=[],e=[],n=0;;){var o=t[n++];if("\0"!==o)switch(o){case"1":r.push(null);break;case"2":r.push("1"===t[n]),n++;break;case"3":var c=_(t,n);r.push(c.num),n+=c.length;break;case"4":for(var u="";;){var i=t[n];if("\0"===i)break;u+=i,n++}u=u.replace(/\u0001\u0001/g,"\0").replace(/\u0001\u0002/g,"").replace(/\u0002\u0002/g,""),r.push(u);break;case"5":var a={element:[],index:r.length};r.push(a.element),e.push(a);break;case"6":var f={element:{},index:r.length};r.push(f.element),e.push(f);break;default:throw new Error("bad collationIndex or unexpectedly reached end of input: "+o)}else{if(1===r.length)return r.pop();s(r,e)}}}function l(t,r){for(var e=Math.min(t.length,r.length),n=0;n<e;n++){var o=c(t[n],r[n]);if(0!==o)return o}return t.length===r.length?0:t.length>r.length?1:-1}function d(t,r){return t===r?0:t>r?1:-1}function p(t,r){for(var e=Object.keys(t),n=Object.keys(r),o=Math.min(e.length,n.length),u=0;u<o;u++){var i=c(e[u],n[u]);if(0!==i)return i;if(0!==(i=c(t[e[u]],r[n[u]])))return i}return e.length===n.length?0:e.length>n.length?1:-1}function h(t){var r=["boolean","number","string","object"],e=r.indexOf(typeof t);return~e?null===t?1:Array.isArray(t)?5:e<3?e+2:e+3:Array.isArray(t)?5:void 0}function v(t){if(0===t)return"1";var r=t.toExponential().split(/e\+?/),e=parseInt(r[1],10),n=t<0,c=n?"0":"2",u=(n?-e:e)-m,i=o(u.toString(),"0",g);c+=y+i;var a=Math.abs(parseFloat(r[0]));n&&(a=10-a);var _=a.toFixed(20);return _=_.replace(/\.?0+$/,""),c+=y+_}Object.defineProperty(r,"__esModule",{value:!0});var m=-324,g=3,y="";r.collate=c,r.normalizeKey=u,r.toIndexableString=a,r.parseIndexableString=f},165:function(t,r,e){"use strict";function n(t){return"$"+t}function o(t){return t.substring(1)}function c(){this._store={}}function u(t){if(this._store=new c,t&&Array.isArray(t))for(var r=0,e=t.length;r<e;r++)this.add(t[r])}Object.defineProperty(r,"__esModule",{value:!0}),c.prototype.get=function(t){var r=n(t);return this._store[r]},c.prototype.set=function(t,r){var e=n(t);return this._store[e]=r,!0},c.prototype.has=function(t){return n(t)in this._store},c.prototype.delete=function(t){var r=n(t),e=r in this._store;return delete this._store[r],e},c.prototype.forEach=function(t){for(var r=Object.keys(this._store),e=0,n=r.length;e<n;e++){var c=r[e],u=this._store[c];c=o(c),t(u,c)}},Object.defineProperty(c.prototype,"size",{get:function(){return Object.keys(this._store).length}}),u.prototype.add=function(t){return this._store.set(t,!0)},u.prototype.has=function(t){return this._store.has(t)},u.prototype.forEach=function(t){this._store.forEach(function(r,e){t(e)})},Object.defineProperty(u.prototype,"size",{get:function(){return this._store.size}}),!function(){if("undefined"==typeof Symbol||"undefined"==typeof Map||"undefined"==typeof Set)return!1;var t=Object.getOwnPropertyDescriptor(Map,Symbol.species);return t&&"get"in t&&Map[Symbol.species]===Map}()?(r.Set=u,r.Map=c):(r.Set=Set,r.Map=Map)},191:function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(554),o=function(t){return t&&t.__esModule?t:{default:t}}(n);r.default=function(){var t=o.default.Howl,r=new t({src:["/alarm.ogg"]}),e=null,n=function(){c(),e=r.play(),r.fade(1,0,2e3,e)},c=function(){e&&r.stop()};return{start:n,stop:c}}()},237:function(t,r,e){"use strict";function n(){}function o(t){if("function"!=typeof t)throw new TypeError("resolver must be a function");this.state=g,this.queue=[],this.outcome=void 0,t!==n&&a(this,t)}function c(t,r,e){this.promise=t,"function"==typeof r&&(this.onFulfilled=r,this.callFulfilled=this.otherCallFulfilled),"function"==typeof e&&(this.onRejected=e,this.callRejected=this.otherCallRejected)}function u(t,r,e){p(function(){var n;try{n=r(e)}catch(r){return h.reject(t,r)}n===t?h.reject(t,new TypeError("Cannot resolve promise with itself")):h.resolve(t,n)})}function i(t){var r=t&&t.then;if(t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof r)return function(){r.apply(t,arguments)}}function a(t,r){function e(r){c||(c=!0,h.reject(t,r))}function n(r){c||(c=!0,h.resolve(t,r))}function o(){r(n,e)}var c=!1,u=_(o);"error"===u.status&&e(u.value)}function _(t,r){var e={};try{e.value=t(r),e.status="success"}catch(t){e.status="error",e.value=t}return e}function s(t){return t instanceof this?t:h.resolve(new this(n),t)}function f(t){var r=new this(n);return h.reject(r,t)}function l(t){var r=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var e=t.length,o=!1;if(!e)return this.resolve([]);for(var c=new Array(e),u=0,i=-1,a=new this(n);++i<e;)!function(t,n){function i(t){c[n]=t,++u!==e||o||(o=!0,h.resolve(a,c))}r.resolve(t).then(i,function(t){o||(o=!0,h.reject(a,t))})}(t[i],i);return a}function d(t){var r=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var e=t.length,o=!1;if(!e)return this.resolve([]);for(var c=-1,u=new this(n);++c<e;)!function(t){r.resolve(t).then(function(t){o||(o=!0,h.resolve(u,t))},function(t){o||(o=!0,h.reject(u,t))})}(t[c]);return u}var p=e(163),h={},v=["REJECTED"],m=["FULFILLED"],g=["PENDING"];t.exports=o,o.prototype.catch=function(t){return this.then(null,t)},o.prototype.then=function(t,r){if("function"!=typeof t&&this.state===m||"function"!=typeof r&&this.state===v)return this;var e=new this.constructor(n);if(this.state!==g){u(e,this.state===m?t:r,this.outcome)}else this.queue.push(new c(e,t,r));return e},c.prototype.callFulfilled=function(t){h.resolve(this.promise,t)},c.prototype.otherCallFulfilled=function(t){u(this.promise,this.onFulfilled,t)},c.prototype.callRejected=function(t){h.reject(this.promise,t)},c.prototype.otherCallRejected=function(t){u(this.promise,this.onRejected,t)},h.resolve=function(t,r){var e=_(i,r);if("error"===e.status)return h.reject(t,e.value);var n=e.value;if(n)a(t,n);else{t.state=m,t.outcome=r;for(var o=-1,c=t.queue.length;++o<c;)t.queue[o].callFulfilled(r)}return t},h.reject=function(t,r){t.state=v,t.outcome=r;for(var e=-1,n=t.queue.length;++e<n;)t.queue[e].callRejected(r);return t},o.resolve=s,o.reject=f,o.all=l,o.race=d},242:function(t,r,e){"use strict";function n(t,r){t=t||[],r=r||{};try{return new Blob(t,r)}catch(c){if("TypeError"!==c.name)throw c;for(var e="undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder,n=new e,o=0;o<t.length;o+=1)n.append(t[o]);return n.getBlob(r.type)}}function o(t){for(var r=t.length,e=new ArrayBuffer(r),n=new Uint8Array(e),o=0;o<r;o++)n[o]=t.charCodeAt(o);return e}function c(t,r){return n([o(t)],{type:r})}function u(t,r){return c(d(t),r)}function i(t){for(var r="",e=new Uint8Array(t),n=e.byteLength,o=0;o<n;o++)r+=String.fromCharCode(e[o]);return r}function a(t,r){if("undefined"==typeof FileReader)return r(i((new FileReaderSync).readAsArrayBuffer(t)));var e=new FileReader,n="function"==typeof e.readAsBinaryString;e.onloadend=function(t){var e=t.target.result||"";if(n)return r(e);r(i(e))},n?e.readAsBinaryString(t):e.readAsArrayBuffer(t)}function _(t,r){a(t,function(t){r(t)})}function s(t,r){_(t,function(t){r(p(t))})}function f(t,r){if("undefined"==typeof FileReader)return r((new FileReaderSync).readAsArrayBuffer(t));var e=new FileReader;e.onloadend=function(t){var e=t.target.result||new ArrayBuffer(0);r(e)},e.readAsArrayBuffer(t)}function l(){}Object.defineProperty(r,"__esModule",{value:!0});var d=function(t){return atob(t)},p=function(t){return btoa(t)};r.atob=d,r.btoa=p,r.base64StringToBlobOrBuffer=u,r.binaryStringToArrayBuffer=o,r.binaryStringToBlobOrBuffer=c,r.blob=n,r.blobOrBufferToBase64=s,r.blobOrBufferToBinaryString=_,r.readAsArrayBuffer=f,r.readAsBinaryString=a,r.typedBuffer=l},243:function(t,r,e){"use strict";(function(t){function n(t){return _.btoa(t)}function o(t,r,e){return t.webkitSlice?t.webkitSlice(r,e):t.slice(r,e)}function c(t,r,e,n,c){(e>0||n<r.size)&&(r=o(r,e,n)),_.readAsArrayBuffer(r,function(r){t.append(r),c()})}function u(t,r,e,n,o){(e>0||n<r.length)&&(r=r.substring(e,n)),t.appendBinary(r),o()}function i(t,r){function e(){f(i)}function o(){var t=v.end(!0),e=n(t);r(e),v.destroy()}function i(){var r=h*d,n=r+d;h++,h<p?m(v,t,r,n,e):m(v,t,r,n,o)}var a="string"==typeof t,_=a?t.length:t.size,d=Math.min(l,_),p=Math.ceil(_/d),h=0,v=a?new s:new s.ArrayBuffer,m=a?u:c;i()}function a(t){return s.hash(t)}Object.defineProperty(r,"__esModule",{value:!0});var _=e(242),s=function(t){return t&&"object"==typeof t&&"default"in t?t.default:t}(e(309)),f=t.setImmediate||t.setTimeout,l=32768;r.binaryMd5=i,r.stringMd5=a}).call(r,e(28))},309:function(t,r,e){!function(r){t.exports=r()}(function(t){"use strict";function r(t,r){var e=t[0],n=t[1],o=t[2],c=t[3];e+=(n&o|~n&c)+r[0]-680876936|0,e=(e<<7|e>>>25)+n|0,c+=(e&n|~e&o)+r[1]-389564586|0,c=(c<<12|c>>>20)+e|0,o+=(c&e|~c&n)+r[2]+606105819|0,o=(o<<17|o>>>15)+c|0,n+=(o&c|~o&e)+r[3]-1044525330|0,n=(n<<22|n>>>10)+o|0,e+=(n&o|~n&c)+r[4]-176418897|0,e=(e<<7|e>>>25)+n|0,c+=(e&n|~e&o)+r[5]+1200080426|0,c=(c<<12|c>>>20)+e|0,o+=(c&e|~c&n)+r[6]-1473231341|0,o=(o<<17|o>>>15)+c|0,n+=(o&c|~o&e)+r[7]-45705983|0,n=(n<<22|n>>>10)+o|0,e+=(n&o|~n&c)+r[8]+1770035416|0,e=(e<<7|e>>>25)+n|0,c+=(e&n|~e&o)+r[9]-1958414417|0,c=(c<<12|c>>>20)+e|0,o+=(c&e|~c&n)+r[10]-42063|0,o=(o<<17|o>>>15)+c|0,n+=(o&c|~o&e)+r[11]-1990404162|0,n=(n<<22|n>>>10)+o|0,e+=(n&o|~n&c)+r[12]+1804603682|0,e=(e<<7|e>>>25)+n|0,c+=(e&n|~e&o)+r[13]-40341101|0,c=(c<<12|c>>>20)+e|0,o+=(c&e|~c&n)+r[14]-1502002290|0,o=(o<<17|o>>>15)+c|0,n+=(o&c|~o&e)+r[15]+1236535329|0,n=(n<<22|n>>>10)+o|0,e+=(n&c|o&~c)+r[1]-165796510|0,e=(e<<5|e>>>27)+n|0,c+=(e&o|n&~o)+r[6]-1069501632|0,c=(c<<9|c>>>23)+e|0,o+=(c&n|e&~n)+r[11]+643717713|0,o=(o<<14|o>>>18)+c|0,n+=(o&e|c&~e)+r[0]-373897302|0,n=(n<<20|n>>>12)+o|0,e+=(n&c|o&~c)+r[5]-701558691|0,e=(e<<5|e>>>27)+n|0,c+=(e&o|n&~o)+r[10]+38016083|0,c=(c<<9|c>>>23)+e|0,o+=(c&n|e&~n)+r[15]-660478335|0,o=(o<<14|o>>>18)+c|0,n+=(o&e|c&~e)+r[4]-405537848|0,n=(n<<20|n>>>12)+o|0,e+=(n&c|o&~c)+r[9]+568446438|0,e=(e<<5|e>>>27)+n|0,c+=(e&o|n&~o)+r[14]-1019803690|0,c=(c<<9|c>>>23)+e|0,o+=(c&n|e&~n)+r[3]-187363961|0,o=(o<<14|o>>>18)+c|0,n+=(o&e|c&~e)+r[8]+1163531501|0,n=(n<<20|n>>>12)+o|0,e+=(n&c|o&~c)+r[13]-1444681467|0,e=(e<<5|e>>>27)+n|0,c+=(e&o|n&~o)+r[2]-51403784|0,c=(c<<9|c>>>23)+e|0,o+=(c&n|e&~n)+r[7]+1735328473|0,o=(o<<14|o>>>18)+c|0,n+=(o&e|c&~e)+r[12]-1926607734|0,n=(n<<20|n>>>12)+o|0,e+=(n^o^c)+r[5]-378558|0,e=(e<<4|e>>>28)+n|0,c+=(e^n^o)+r[8]-2022574463|0,c=(c<<11|c>>>21)+e|0,o+=(c^e^n)+r[11]+1839030562|0,o=(o<<16|o>>>16)+c|0,n+=(o^c^e)+r[14]-35309556|0,n=(n<<23|n>>>9)+o|0,e+=(n^o^c)+r[1]-1530992060|0,e=(e<<4|e>>>28)+n|0,c+=(e^n^o)+r[4]+1272893353|0,c=(c<<11|c>>>21)+e|0,o+=(c^e^n)+r[7]-155497632|0,o=(o<<16|o>>>16)+c|0,n+=(o^c^e)+r[10]-1094730640|0,n=(n<<23|n>>>9)+o|0,e+=(n^o^c)+r[13]+681279174|0,e=(e<<4|e>>>28)+n|0,c+=(e^n^o)+r[0]-358537222|0,c=(c<<11|c>>>21)+e|0,o+=(c^e^n)+r[3]-722521979|0,o=(o<<16|o>>>16)+c|0,n+=(o^c^e)+r[6]+76029189|0,n=(n<<23|n>>>9)+o|0,e+=(n^o^c)+r[9]-640364487|0,e=(e<<4|e>>>28)+n|0,c+=(e^n^o)+r[12]-421815835|0,c=(c<<11|c>>>21)+e|0,o+=(c^e^n)+r[15]+530742520|0,o=(o<<16|o>>>16)+c|0,n+=(o^c^e)+r[2]-995338651|0,n=(n<<23|n>>>9)+o|0,e+=(o^(n|~c))+r[0]-198630844|0,e=(e<<6|e>>>26)+n|0,c+=(n^(e|~o))+r[7]+1126891415|0,c=(c<<10|c>>>22)+e|0,o+=(e^(c|~n))+r[14]-1416354905|0,o=(o<<15|o>>>17)+c|0,n+=(c^(o|~e))+r[5]-57434055|0,n=(n<<21|n>>>11)+o|0,e+=(o^(n|~c))+r[12]+1700485571|0,e=(e<<6|e>>>26)+n|0,c+=(n^(e|~o))+r[3]-1894986606|0,c=(c<<10|c>>>22)+e|0,o+=(e^(c|~n))+r[10]-1051523|0,o=(o<<15|o>>>17)+c|0,n+=(c^(o|~e))+r[1]-2054922799|0,n=(n<<21|n>>>11)+o|0,e+=(o^(n|~c))+r[8]+1873313359|0,e=(e<<6|e>>>26)+n|0,c+=(n^(e|~o))+r[15]-30611744|0,c=(c<<10|c>>>22)+e|0,o+=(e^(c|~n))+r[6]-1560198380|0,o=(o<<15|o>>>17)+c|0,n+=(c^(o|~e))+r[13]+1309151649|0,n=(n<<21|n>>>11)+o|0,e+=(o^(n|~c))+r[4]-145523070|0,e=(e<<6|e>>>26)+n|0,c+=(n^(e|~o))+r[11]-1120210379|0,c=(c<<10|c>>>22)+e|0,o+=(e^(c|~n))+r[2]+718787259|0,o=(o<<15|o>>>17)+c|0,n+=(c^(o|~e))+r[9]-343485551|0,n=(n<<21|n>>>11)+o|0,t[0]=e+t[0]|0,t[1]=n+t[1]|0,t[2]=o+t[2]|0,t[3]=c+t[3]|0}function e(t){var r,e=[];for(r=0;r<64;r+=4)e[r>>2]=t.charCodeAt(r)+(t.charCodeAt(r+1)<<8)+(t.charCodeAt(r+2)<<16)+(t.charCodeAt(r+3)<<24);return e}function n(t){var r,e=[];for(r=0;r<64;r+=4)e[r>>2]=t[r]+(t[r+1]<<8)+(t[r+2]<<16)+(t[r+3]<<24);return e}function o(t){var n,o,c,u,i,a,_=t.length,s=[1732584193,-271733879,-1732584194,271733878];for(n=64;n<=_;n+=64)r(s,e(t.substring(n-64,n)));for(t=t.substring(n-64),o=t.length,c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0;n<o;n+=1)c[n>>2]|=t.charCodeAt(n)<<(n%4<<3);if(c[n>>2]|=128<<(n%4<<3),n>55)for(r(s,c),n=0;n<16;n+=1)c[n]=0;return u=8*_,u=u.toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(u[2],16),a=parseInt(u[1],16)||0,c[14]=i,c[15]=a,r(s,c),s}function c(t){var e,o,c,u,i,a,_=t.length,s=[1732584193,-271733879,-1732584194,271733878];for(e=64;e<=_;e+=64)r(s,n(t.subarray(e-64,e)));for(t=e-64<_?t.subarray(e-64):new Uint8Array(0),o=t.length,c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e=0;e<o;e+=1)c[e>>2]|=t[e]<<(e%4<<3);if(c[e>>2]|=128<<(e%4<<3),e>55)for(r(s,c),e=0;e<16;e+=1)c[e]=0;return u=8*_,u=u.toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(u[2],16),a=parseInt(u[1],16)||0,c[14]=i,c[15]=a,r(s,c),s}function u(t){var r,e="";for(r=0;r<4;r+=1)e+=p[t>>8*r+4&15]+p[t>>8*r&15];return e}function i(t){var r;for(r=0;r<t.length;r+=1)t[r]=u(t[r]);return t.join("")}function a(t){return/[\u0080-\uFFFF]/.test(t)&&(t=unescape(encodeURIComponent(t))),t}function _(t,r){var e,n=t.length,o=new ArrayBuffer(n),c=new Uint8Array(o);for(e=0;e<n;e+=1)c[e]=t.charCodeAt(e);return r?c:o}function s(t){return String.fromCharCode.apply(null,new Uint8Array(t))}function f(t,r,e){var n=new Uint8Array(t.byteLength+r.byteLength);return n.set(new Uint8Array(t)),n.set(new Uint8Array(r),t.byteLength),e?n:n.buffer}function l(t){var r,e=[],n=t.length;for(r=0;r<n-1;r+=2)e.push(parseInt(t.substr(r,2),16));return String.fromCharCode.apply(String,e)}function d(){this.reset()}var p=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];return"5d41402abc4b2a76b9719d911017c592"!==i(o("hello"))&&function(t,r){var e=(65535&t)+(65535&r);return(t>>16)+(r>>16)+(e>>16)<<16|65535&e},"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function r(t,r){return t=0|t||0,t<0?Math.max(t+r,0):Math.min(t,r)}ArrayBuffer.prototype.slice=function(e,n){var o,c,u,i,a=this.byteLength,_=r(e,a),s=a;return n!==t&&(s=r(n,a)),_>s?new ArrayBuffer(0):(o=s-_,c=new ArrayBuffer(o),u=new Uint8Array(c),i=new Uint8Array(this,_,o),u.set(i),c)}}(),d.prototype.append=function(t){return this.appendBinary(a(t)),this},d.prototype.appendBinary=function(t){this._buff+=t,this._length+=t.length;var n,o=this._buff.length;for(n=64;n<=o;n+=64)r(this._hash,e(this._buff.substring(n-64,n)));return this._buff=this._buff.substring(n-64),this},d.prototype.end=function(t){var r,e,n=this._buff,o=n.length,c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(r=0;r<o;r+=1)c[r>>2]|=n.charCodeAt(r)<<(r%4<<3);return this._finish(c,o),e=i(this._hash),t&&(e=l(e)),this.reset(),e},d.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},d.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}},d.prototype.setState=function(t){return this._buff=t.buff,this._length=t.length,this._hash=t.hash,this},d.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},d.prototype._finish=function(t,e){var n,o,c,u=e;if(t[u>>2]|=128<<(u%4<<3),u>55)for(r(this._hash,t),u=0;u<16;u+=1)t[u]=0;n=8*this._length,n=n.toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(n[2],16),c=parseInt(n[1],16)||0,t[14]=o,t[15]=c,r(this._hash,t)},d.hash=function(t,r){return d.hashBinary(a(t),r)},d.hashBinary=function(t,r){var e=o(t),n=i(e);return r?l(n):n},d.ArrayBuffer=function(){this.reset()},d.ArrayBuffer.prototype.append=function(t){var e,o=f(this._buff.buffer,t,!0),c=o.length;for(this._length+=t.byteLength,e=64;e<=c;e+=64)r(this._hash,n(o.subarray(e-64,e)));return this._buff=e-64<c?new Uint8Array(o.buffer.slice(e-64)):new Uint8Array(0),this},d.ArrayBuffer.prototype.end=function(t){var r,e,n=this._buff,o=n.length,c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(r=0;r<o;r+=1)c[r>>2]|=n[r]<<(r%4<<3);return this._finish(c,o),e=i(this._hash),t&&(e=l(e)),this.reset(),e},d.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},d.ArrayBuffer.prototype.getState=function(){var t=d.prototype.getState.call(this);return t.buff=s(t.buff),t},d.ArrayBuffer.prototype.setState=function(t){return t.buff=_(t.buff,!0),d.prototype.setState.call(this,t)},d.ArrayBuffer.prototype.destroy=d.prototype.destroy,d.ArrayBuffer.prototype._finish=d.prototype._finish,d.ArrayBuffer.hash=function(t,r){var e=c(new Uint8Array(t)),n=i(e);return r?l(n):n},d})},311:function(t,r,e){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){return function(){var r=t.apply(this,arguments);return new Promise(function(t,e){function n(o,c){try{var u=r[o](c),i=u.value}catch(t){return void e(t)}if(!u.done)return Promise.resolve(i).then(function(t){n("next",t)},function(t){n("throw",t)});t(i)}return n("next")})}}function c(){var t=localStorage.getItem("device-id");return t||(t=(0,w.default)(64),localStorage.setItem("device-id",t)),t}function u(){var t=localStorage.getItem("first-visit");return t||localStorage.setItem("first-visit","false"),!!t}var i=function(){function t(t,r){var e=[],n=!0,o=!1,c=void 0;try{for(var u,i=t[Symbol.iterator]();!(n=(u=i.next()).done)&&(e.push(u.value),!r||e.length!==r);n=!0);}catch(t){o=!0,c=t}finally{try{!n&&i.return&&i.return()}finally{if(o)throw c}}return e}return function(r,e){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return t(r,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=e(191),_=n(a),s=e(321),f=n(s),l=e(323),d=n(l),p=e(74),h=n(p),v=e(76),m=n(v),g=e(322),y=n(g),b=e(131),w=n(b),T=e(190),k=n(T),S=e(238),x=n(S),E={PATH:"/Users/jigargosar/GitHub/elm-simple-gtd/node_modules/.bin:/Users/jigargosar/GitHub/elm-simple-gtd/node_modules/.bin:/Users/jigargosar/GitHub/elm-simple-gtd/node_modules/.bin:/Users/jigargosar/google-cloud-sdk/bin:node_modules/.bin:/Users/jigargosar/.config/yarn/global/node_modules/.bin:/Users/jigargosar/.yarn/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Racket v6.4/bin:/Users/jigargosar/libs/android-sdk-macosx/tools:/Users/jigargosar/libs/android-sdk-macosx/platform-tools",PWD:"/Users/jigargosar/GitHub/elm-simple-gtd",NODE_ENV:"production",npm_package_version:"0.18.62",SHLVL:"1",_:"/Users/jigargosar/GitHub/elm-simple-gtd/node_modules/.bin/webpack",__CF_USER_TEXT_ENCODING:"0x1F5:0x0:0x0"},A=E.npm_package_version;window.appBoot=function(){function t(){return r.apply(this,arguments)}var r=o(regeneratorRuntime.mark(function t(){var r,n,a,s,l,p,v,g,b,w,T,S=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=c(),n=u(),a=(0,h.default)("#elm-container"),a.on("keydown",".entity-list",function(t){"PAPER-INPUT"!==t.target.tagName&&(" "===t.key&&"PAPER-INPUT"!==t.target.tagName?t.preventDefault():"ArrowUp"!==t.key&&"ArrowDown"!==t.key||t.preventDefault())}),a.get(0).addEventListener("keydown",function(t){var r=(0,h.default)(t.target).closest("[data-prevent-default-keys]");if(0!==r.length){var e=r.data("prevent-default-keys").split(",");m.default.contains(t.key)(e)&&t.preventDefault()}},!0),t.next=7,(0,d.default)("todo-db");case 7:return t.t0=t.sent,t.next=10,(0,d.default)("project-db");case 10:return t.t1=t.sent,t.next=13,(0,d.default)("context-db");case 13:return t.t2=t.sent,s={"todo-db":t.t0,"project-db":t.t1,"context-db":t.t2},l=m.default.map(function(t){return t.findAll()})(s),p=x.default.createInstance({name:"SimpleGTD.com offline store"}),t.next=19,p.getItem("local-pref");case 19:return v=t.sent,t.t3=Date.now(),t.next=23,l["todo-db"];case 23:return t.t4=t.sent,t.next=26,l["project-db"];case 26:return t.t5=t.sent,t.next=29,l["context-db"];case 29:t.t6=t.sent,t.t7=localStorage.getItem("pouchdb.remote-sync-uri")||"",t.t8=!1,t.t9=A,t.t10=r,t.t11={isFirstVisit:n,deviceId:r,npmPackageVersion:A,isDevelopmentMode:!1},t.t12=v,g={now:t.t3,encodedTodoList:t.t4,encodedProjectList:t.t5,encodedContextList:t.t6,pouchDBRemoteSyncURI:t.t7,developmentMode:t.t8,appVersion:t.t9,deviceId:t.t10,config:t.t11,localPref:t.t12},b=e(546),w=b.Main.embed(document.getElementById("elm-container"),g),T=f.default.setup(w,m.default.values(s),r),m.default.mapObjIndexed(function(t,r){return t.onChange(function(t){return w.ports.pouchDBChanges.send([r,t])})})(s),w.ports.syncWithRemotePouch.subscribe(function(){var t=o(regeneratorRuntime.mark(function t(r){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:localStorage.setItem("pouchdb.remote-sync-uri",r),m.default.map(function(t){return t.startRemoteSync(r,"sgtd2-")})(s);case 2:case"end":return t.stop()}},t,S)}));return function(r){return t.apply(this,arguments)}}()),w.ports.pouchDBUpsert.subscribe(function(){var t=o(regeneratorRuntime.mark(function t(r){var e=i(r,3),n=e[0],o=e[1],c=e[2];return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:s[n].upsert(o,c).catch(console.error);case 1:case"end":return t.stop()}},t,S)}));return function(r){return t.apply(this,arguments)}}()),w.ports.persistLocalPref.subscribe(function(){var t=o(regeneratorRuntime.mark(function t(r){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:p.setItem("local-pref",r).catch(console.error);case 1:case"end":return t.stop()}},t,S)}));return function(r){return t.apply(this,arguments)}}()),y.default.setup(T,w).catch(console.error),w.ports.focusSelector.subscribe(function(t){requestAnimationFrame(function(){(0,h.default)(t).blur().focus()})}),w.ports.focusSelectorIfNoFocus.subscribe(function(t){0===(0,h.default)(":focus, [focused]").length&&(0,h.default)(t).focus()}),w.ports.positionPopupMenu.subscribe(function(t){requestAnimationFrame(function(){var r=(0,h.default)("#popup-menu");r.position({my:"right top",at:"right top",of:(0,h.default)(t),within:".overlay",collision:"fit"}),r.find(".auto-focus").first().focus();r.on("keydown",":focusable, input:focusable",function(t){if("Tab"===t.key){var e=r.find(":focusable, input:focusable"),n=e.first().get(0),o=e.last().get(0);t.shiftKey?this===n?(t.preventDefault(),t.stopPropagation(),o.focus()):(0,h.default)(this).is('input[type="date"], input[type="time"]')&&(t.preventDefault(),t.stopPropagation(),e.get(h.default.inArray(this,e)-1).focus()):this===o?(t.preventDefault(),t.stopPropagation(),n.focus()):(0,h.default)(this).is('input[type="date"], input[type="time"]')&&(t.preventDefault(),t.stopPropagation(),e.get(h.default.inArray(this,e)+1).focus())}})})}),w.ports.focusInput.subscribe(function(t){requestAnimationFrame(function(){(0,h.default)(".materialize-textarea.auto-focus").each(function(){(0,k.default)(this),this.focus()})}),setTimeout(function(){requestAnimationFrame(function(){var r=document.querySelector(t);r&&document.activeElement!==r&&r.focus(),r&&r.inputElement&&r.inputElement.focus()})},0)}),w.ports.startAlarm.subscribe(function(){_.default.start()}),w.ports.stopAlarm.subscribe(function(){_.default.stop()});case 51:case"end":return t.stop()}},t,this)}));return t}()},321:function(t,r,e){"use strict";function n(t){return function(){var r=t.apply(this,arguments);return new Promise(function(t,e){function n(o,c){try{var u=r[o](c),i=u.value}catch(t){return void e(t)}if(!u.done)return Promise.resolve(i).then(function(t){n("next",t)},function(t){n("throw",t)});t(i)}return n("next")})}}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function t(t,r){var e=[],n=!0,o=!1,c=void 0;try{for(var u,i=t[Symbol.iterator]();!(n=(u=i.next()).done)&&(e.push(u.value),!r||e.length!==r);n=!0);}catch(t){o=!0,c=t}finally{try{!n&&i.return&&i.return()}finally{if(o)throw c}}return e}return function(r,e){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return t(r,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=e(76),u=e(236),i=function(){return{apiKey:"AIzaSyDgqOiOMuTvK3PdzJ0Oz6ctEg-devcgZYc",authDomain:"simple-gtd-prod.firebaseapp.com",databaseURL:"https://simple-gtd-prod.firebaseio.com",projectId:"simple-gtd-prod",storageBucket:"simple-gtd-prod.appspot.com",messagingSenderId:"1061254169900"}}(),a=r.setup=function(t,r,e){function a(t){var r=t.deviceId;return!r||""===r||r===e}function _(t,r){var e="pouch-fire-sync."+r.name+".out.lastSeq",n=localStorage.getItem(e),o=parseInt(n,10)||0,i=r.changes({include_docs:!0,live:!0,since:o}),_=function(n){var o=function(){return localStorage.setItem(e,n.seq),n.seq};if(a(n.doc)){var u=c.compose(c.omit("_rev"),c.merge(n.doc))({firebaseServerPersistedAt:firebase.database.ServerValue.TIMESTAMP});return f.database().ref("/users/"+t+"/"+r.name+"/"+n.id).set(u).then(o)}return Promise.resolve(o())},s=u.fromEvents(i,"error"),l=u.fromEvents(i,"change");return u.merge([l,s]).map(_).flatMap(u.fromPromise).onError(function(t){return console.error("[PouchToFire] ",t)}),i}function s(r,e){function n(t){localStorage.setItem(i,Math.min(t.firebaseServerPersistedAt,Date.now()))}var o=e.name,i="pouch-fire-sync."+o+".in.lastPersistedAt",_=function(r){t.ports.onFirebaseChange.send([o,r]),n(r)},s=localStorage.getItem(i),l=parseInt(s,10)||0,d=f.database().ref("/users/"+r+"/"+o).orderByChild("firebaseServerPersistedAt").startAt(l+1);u.merge([u.fromEvents(d,"child_changed"),u.fromEvents(d,"child_added")]).map(c.invoker(0,"val")).map(function(t){return e.getClean(t._id).then(function(){return a(t)?(n(t),"[FireToELm] ignoring local change: note we receive this message twice when online, since we are setting firebaseServerPersistedAt field."):(_(t),"[FireToELm] sending non-local change")}).catch(function(r){if(404===r.status)return _(t),"[FireToELm] docs not found locally, sending to elm";throw r})}).flatMap(u.fromPromise).onError(function(t){console.error("[FireToELm] ",t)})}var f=firebase.initializeApp(i),l=[];return t.ports.signIn.subscribe(function(){var t=new firebase.auth.GoogleAuthProvider;t.setCustomParameters({prompt:"select_account"}),document.getElementById("firebase-auth").signInWithPopup(t).catch(console.error)}),t.ports.fireStartSync.subscribe(function(){var t=n(regeneratorRuntime.mark(function t(e){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:c.map(function(t){return t.cancel()})(l),l=c.map(function(t){return s(e,t),_(e,t)})(r);case 2:case"end":return t.stop()}},t,void 0)}));return function(r){return t.apply(this,arguments)}}()),t.ports.firebaseSetupOnDisconnect.subscribe(function(t){var r=o(t,2),e=r[0],n=r[1];console.log("[FJS]:firebaseSetupOnDisconnect: called"),f.database().ref("/users/"+e+"/clients/"+n+"/connected").onDisconnect().set(!1)}),t.ports.firebaseRefSet.subscribe(function(t){var r=o(t,2),e=r[0],n=r[1];f.database().ref(e).set(n).catch(console.error)}),t.ports.firebaseRefPush.subscribe(function(t){var r=o(t,2),e=r[0],n=r[1];f.database().ref(e).push(n)}),t.ports.signOut.subscribe(function(){document.getElementById("firebase-auth").signOut().catch(console.error)}),{ref:function(){var t;return(t=f.database()).ref.apply(t,arguments)}}};r.default={setup:a}},322:function(t,r,e){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){return function(){var r=t.apply(this,arguments);return new Promise(function(t,e){function n(o,c){try{var u=r[o](c),i=u.value}catch(t){return void e(t)}if(!u.done)return Promise.resolve(i).then(function(t){n("next",t)},function(t){n("throw",t)});t(i)}return n("next")})}}Object.defineProperty(r,"__esModule",{value:!0});var c=function(){var t=o(regeneratorRuntime.mark(function t(r,e){var n,o,c;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(console.info("Setting up notification ports and sw registration"),!(!1 in navigator)){t.next=4;break}return console.warn("serviceWorker not found in navigator"),t.abrupt("return");case 4:return n="/service-worker.js",navigator.serviceWorker.addEventListener("message",function(t){var r=t.data;if(console.log("JS: serviceWorker.onMessage",t.data,t),r["firebase-messaging-msg-type"])console.info("FBJS: ignoring message event received",r,t);else if(r&&r.data&&r.data.notificationClickedPort){var n=r.data.notificationClickedPort;console.log("JS: sending to port: ",n,r),e.ports[n].send(r)}else console.log("JS: sending to port: notificationClicked ",r),e.ports.notificationClicked.send(r)}),console.info("navigator.serviceWorker.register: ",n),t.next=9,navigator.serviceWorker.register(n);case 9:o=t.sent,c=setInterval(function(){var t=document.getElementById("fb-messaging");if(!t)return void console.warn('document.getElementById("fb-messaging")',t);console.debug("messaging.activate(reg)"),t.activate(o),clearTimeout(c)},100),e.ports.showTodoReminderNotification.subscribe(d(r,o)),e.ports.closeNotification.subscribe(f(o)),e.ports.showRunningTodoNotification.subscribe(l(o));case 14:case"end":return t.stop()}},t,this)}));return function(r,e){return t.apply(this,arguments)}}(),u=e(76),i=n(u),a=e(74),_=(n(a),e(191)),s=n(_);r.default={setup:c};var f=function(t){return function(){var r=o(regeneratorRuntime.mark(function r(e){var n;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.t0=i.default,r.t1=i.default.propEq("tag",e),r.next=4,t.getNotifications();case 4:r.t2=r.sent,n=r.t0.find.call(r.t0,r.t1,r.t2),n&&n.close();case 7:case"end":return r.stop()}},r,void 0)}));return function(t){return r.apply(this,arguments)}}()},l=function(t){return function(){var r=o(regeneratorRuntime.mark(function r(e){var n;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,Notification.requestPermission();case 2:if(n=r.sent,s.default.start(),"granted"===n){r.next=6;break}return r.abrupt("return");case 6:t.showNotification(e.title,{tag:e.tag,requiresInteraction:!0,sticky:!0,renotify:!0,vibrate:[500,110,500,110,450,110,200,110,170,40,450,110,200,110,170,40,500],sound:"/alarm.ogg",icon:"/logo.png",actions:e.actions,body:e.body,data:e.data});case 7:case"end":return r.stop()}},r,void 0)}));return function(t){return r.apply(this,arguments)}}()},d=function(t,r){return function(){var t=o(regeneratorRuntime.mark(function t(e){var n,o,c,u;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.tag,o=e.title,c=e.data,t.next=3,Notification.requestPermission();case 3:if("granted"===(u=t.sent)){t.next=6;break}return t.abrupt("return");case 6:r.showNotification("",{tag:n,requiresInteraction:!0,sticky:!0,renotify:!0,vibrate:[500,110,500,110,450,110,200,110,170,40,450,110,200,110,170,40,500],sound:"/alarm.ogg",icon:"/logo.png",actions:[{title:"Mark Done",action:"mark-done"},{title:"Snooze",action:"snooze"}],body:o,data:c});case 7:case"end":return t.stop()}},t,void 0)}));return function(r){return t.apply(this,arguments)}}()}},323:function(t,r,e){"use strict";function n(t){return function(){var r=t.apply(this,arguments);return new Promise(function(t,e){function n(o,c){try{var u=r[o](c),i=u.value}catch(t){return void e(t)}if(!u.done)return Promise.resolve(i).then(function(t){n("next",t)},function(t){n("throw",t)});t(i)}return n("next")})}}Object.defineProperty(r,"__esModule",{value:!0});var o=e(567),c=e(76);o.debug.disable(),o.plugin(e(569)),o.plugin(e(572));var u=function t(r){return c.when(c.is(Object),c.compose(c.map(t),c.reject(c.isNil)))(r)};r.default=function(){var t=n(regeneratorRuntime.mark(function t(r){var e,i,a,_,s,f,l,d,p,h=function(){var t=n(regeneratorRuntime.mark(function t(){var r;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=c,t.t1=c.prop("ddoc"),t.next=4,e.getIndexes();case 4:return t.t2=t.sent.indexes,r=t.t0.filter.call(t.t0,t.t1,t.t2),t.next=8,Promise.all(c.map(c.bind(e.deleteIndex,e),r));case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),v=function(){var t=n(regeneratorRuntime.mark(function t(){var r;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=function(t){return e.put(c.merge(t,{_deleted:!0}))},t.t0=Promise,t.t1=c,t.t2=r,t.next=6,d();case 6:return t.t3=t.sent,t.t4=t.t1.map.call(t.t1,t.t2,t.t3),t.abrupt("return",t.t0.all.call(t.t0,t.t4));case 9:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),m=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return p=function(t){return e.changes({since:"now",live:!0,include_docs:!0}).on("change",function(r){t(r.doc)}).on("complete",function(t){}).on("error",function(t){console.log(t)})},d=function(){e.allDocs()},f=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"http://localhost:12321",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r,c=""+n+o;console.log("starting sync for "+c);var u=t+"/"+c;i&&i.cancel();var a=e.sync(u,{live:!0,retry:!0},function(t,r){t?console.error("PLDB: sync err "+o,t):console.info("PLDB: sync complete = ",r)});return i=a,a},s=function(t,r){return e.upsert(t,function(t){var e=function(t,r){var e=c.merge(c.__,{_rev:r._rev}),n=c.propSatisfies(c.isEmpty,"_rev");return c.compose(c.when(n,e),u)(t)}(r,t),n=u(t);if(!c.equals(e,n))return e})},_=function(t){return e.bulkDocs(t)},a=function(t){return e.createIndex(t)},e=new o(r),i=null,l=function(){var t=n(regeneratorRuntime.mark(function t(r){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.find(r);case 2:return t.abrupt("return",t.sent.docs);case 3:case"end":return t.stop()}},t,void 0)}));return function(r){return t.apply(this,arguments)}}(),t.next=11,Promise.all(c.map(a,m));case 11:return t.abrupt("return",{find:l,deleteAllDocs:v,bulkDocs:_,_db:e,upsert:s,deleteIndices:h,allDocs:d,startRemoteSync:f,findAll:function(){return l({selector:{_id:{$ne:null}}})},onChange:p,changes:c.bind(e.changes,e),name:r,getClean:function(t){return e.get(t).then(u)}});case 12:case"end":return t.stop()}},t,void 0)}));return function(r){return t.apply(this,arguments)}}()},522:function(t,r,e){(function(n){function o(){return!("undefined"==typeof window||!window||void 0===window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document&&"WebkitAppearance"in document.documentElement.style||"undefined"!=typeof window&&window&&window.console&&(console.firebug||console.exception&&console.table)||"undefined"!=typeof navigator&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function c(t){var e=this.useColors;if(t[0]=(e?"%c":"")+this.namespace+(e?" %c":" ")+t[0]+(e?"%c ":" ")+"+"+r.humanize(this.diff),e){var n="color: "+this.color;t.splice(1,0,n,"color: inherit");var o=0,c=0;t[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(o++,"%c"===t&&(c=o))}),t.splice(c,0,n)}}function u(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function i(t){try{null==t?r.storage.removeItem("debug"):r.storage.debug=t}catch(t){}}function a(){try{return r.storage.debug}catch(t){}if(void 0!==n&&"env"in n)return{PATH:"/Users/jigargosar/GitHub/elm-simple-gtd/node_modules/.bin:/Users/jigargosar/GitHub/elm-simple-gtd/node_modules/.bin:/Users/jigargosar/GitHub/elm-simple-gtd/node_modules/.bin:/Users/jigargosar/google-cloud-sdk/bin:node_modules/.bin:/Users/jigargosar/.config/yarn/global/node_modules/.bin:/Users/jigargosar/.yarn/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Racket v6.4/bin:/Users/jigargosar/libs/android-sdk-macosx/tools:/Users/jigargosar/libs/android-sdk-macosx/platform-tools",PWD:"/Users/jigargosar/GitHub/elm-simple-gtd",NODE_ENV:"production",npm_package_version:"0.18.62",SHLVL:"1",_:"/Users/jigargosar/GitHub/elm-simple-gtd/node_modules/.bin/webpack",__CF_USER_TEXT_ENCODING:"0x1F5:0x0:0x0"}.DEBUG}r=t.exports=e(523),r.log=u,r.formatArgs=c,r.save=i,r.load=a,r.useColors=o,r.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),r.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],r.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},r.enable(a())}).call(r,e(50))},523:function(t,r,e){function n(t){var e,n=0;for(e in t)n=(n<<5)-n+t.charCodeAt(e),n|=0;return r.colors[Math.abs(n)%r.colors.length]}function o(t){function e(){if(e.enabled){var t=e,n=+new Date,o=n-(_||n);t.diff=o,t.prev=_,t.curr=n,_=n;for(var c=new Array(arguments.length),u=0;u<c.length;u++)c[u]=arguments[u];c[0]=r.coerce(c[0]),"string"!=typeof c[0]&&c.unshift("%O");var i=0;c[0]=c[0].replace(/%([a-zA-Z%])/g,function(e,n){if("%%"===e)return e;i++;var o=r.formatters[n];if("function"==typeof o){var u=c[i];e=o.call(t,u),c.splice(i,1),i--}return e}),r.formatArgs.call(t,c);(e.log||r.log||console.log.bind(console)).apply(t,c)}}return e.namespace=t,e.enabled=r.enabled(t),e.useColors=r.useColors(),e.color=n(t),"function"==typeof r.init&&r.init(e),e}function c(t){r.save(t),r.names=[],r.skips=[];for(var e=(t||"").split(/[\s,]+/),n=e.length,o=0;o<n;o++)e[o]&&(t=e[o].replace(/\*/g,".*?"),"-"===t[0]?r.skips.push(new RegExp("^"+t.substr(1)+"$")):r.names.push(new RegExp("^"+t+"$")))}function u(){r.enable("")}function i(t){var e,n;for(e=0,n=r.skips.length;e<n;e++)if(r.skips[e].test(t))return!1;for(e=0,n=r.names.length;e<n;e++)if(r.names[e].test(t))return!0;return!1}function a(t){return t instanceof Error?t.stack||t.message:t}r=t.exports=o.debug=o.default=o,r.coerce=a,r.disable=u,r.enable=c,r.enabled=i,r.humanize=e(560),r.names=[],r.skips=[],r.formatters={};var _},546:function(t,r){(function(){"use strict";function r(t){function r(r){return function(e){return t(r,e)}}return r.arity=2,r.func=t,r}function e(t){function r(r){return function(e){return function(n){return t(r,e,n)}}}return r.arity=3,r.func=t,r}function n(t){function r(r){return function(e){return function(n){return function(o){return t(r,e,n,o)}}}}return r.arity=4,r.func=t,r}function o(t){function r(r){return function(e){return function(n){return function(o){return function(c){return t(r,e,n,o,c)}}}}}return r.arity=5,r.func=t,r}function c(t){function r(r){return function(e){return function(n){return function(o){return function(c){return function(u){return t(r,e,n,o,c,u)}}}}}}return r.arity=6,r.func=t,r}function u(t){function r(r){return function(e){return function(n){return function(o){return function(c){return function(u){return function(i){return t(r,e,n,o,c,u,i)}}}}}}}return r.arity=7,r.func=t,r}function i(t){function r(r){return function(e){return function(n){return function(o){return function(c){return function(u){return function(i){return function(a){return t(r,e,n,o,c,u,i,a)}}}}}}}}return r.arity=8,r.func=t,r}function a(t){function r(r){return function(e){return function(n){return function(o){return function(c){return function(u){return function(i){return function(a){return function(_){return t(r,e,n,o,c,u,i,a,_)}}}}}}}}}return r.arity=9,r.func=t,r}function _(t,r,e){return 2===t.arity?t.func(r,e):t(r)(e)}function s(t,r,e,n){return 3===t.arity?t.func(r,e,n):t(r)(e)(n)}function f(t,r,e,n,o){return 4===t.arity?t.func(r,e,n,o):t(r)(e)(n)(o)}function l(t,r,e,n,o,c){return 5===t.arity?t.func(r,e,n,o,c):t(r)(e)(n)(o)(c)}function d(t,r,e,n,o,c,u){return 6===t.arity?t.func(r,e,n,o,c,u):t(r)(e)(n)(o)(c)(u)}function p(t,r,e,n,o,c,u,i){return 7===t.arity?t.func(r,e,n,o,c,u,i):t(r)(e)(n)(o)(c)(u)(i)}function h(t,r,e,n,o,c,u,i,a){return 8===t.arity?t.func(r,e,n,o,c,u,i,a):t(r)(e)(n)(o)(c)(u)(i)(a)}var v=function(){function t(t,r){return t/r|0}function n(t,r){return t%r}function o(t,r){if(0===r)throw new Error("Cannot perform mod 0. Division by zero error.");var e=t%r,n=0===t?0:r>0?t>=0?e:e+r:-o(-t,-r);return n===r?0:n}function c(t,r){return Math.log(r)/Math.log(t)}function u(t){return-t}function i(t){return t<0?-t:t}function a(t,r){return m.cmp(t,r)<0?t:r}function _(t,r){return m.cmp(t,r)>0?t:r}function s(t,r,e){return m.cmp(e,t)<0?t:m.cmp(e,r)>0?r:e}function f(t,r){return{ctor:w[m.cmp(t,r)+1]}}function l(t,r){return t!==r}function d(t){return!t}function p(t){return t===1/0||t===-1/0}function h(t){return 0|t}function v(t){return t*Math.PI/180}function g(t){return 2*Math.PI*t}function y(t){var r=t._0,e=t._1;return m.Tuple2(r*Math.cos(e),r*Math.sin(e))}function b(t){var r=t._0,e=t._1;return m.Tuple2(Math.sqrt(r*r+e*e),Math.atan2(e,r))}var w=["LT","EQ","GT"];return{div:r(t),rem:r(n),mod:r(o),pi:Math.PI,e:Math.E,cos:Math.cos,sin:Math.sin,tan:Math.tan,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:r(Math.atan2),degrees:v,turns:g,fromPolar:y,toPolar:b,sqrt:Math.sqrt,logBase:r(c),negate:u,abs:i,min:r(a),max:r(_),clamp:e(s),compare:r(f),xor:r(l),not:d,truncate:h,ceiling:Math.ceil,floor:Math.floor,round:Math.round,toFloat:function(t){return t},isNaN:isNaN,isInfinite:p}}(),m=function(){function t(t,r){for(var n,o=[],c=e(t,r,0,o);c&&(n=o.pop());)c=e(n.x,n.y,0,o);return c}function e(t,r,n,o){if(n>100)return o.push({x:t,y:r}),!0;if(t===r)return!0;if("object"!=typeof t){if("function"==typeof t)throw new Error('Trying to use `(==)` on functions. There is no way to know if functions are "the same" in the Elm sense. Read more about this at http://package.elm-lang.org/packages/elm-lang/core/latest/Basics#== which describes why it is this way and what the better version will look like.');return!1}if(null===t||null===r)return!1;if(t instanceof Date)return t.getTime()===r.getTime();if(!("ctor"in t)){for(var c in t)if(!e(t[c],r[c],n+1,o))return!1;return!0}if("RBNode_elm_builtin"!==t.ctor&&"RBEmpty_elm_builtin"!==t.ctor||(t=ue(t),r=ue(r)),"Set_elm_builtin"===t.ctor&&(t=ni(t),r=ni(r)),"::"===t.ctor){for(var u=t,i=r;"::"===u.ctor&&"::"===i.ctor;){if(!e(u._0,i._0,n+1,o))return!1;u=u._1,i=i._1}return u.ctor===i.ctor}if("_Array"===t.ctor){var a=Qr.toJSArray(t),_=Qr.toJSArray(r);if(a.length!==_.length)return!1;for(var s=0;s<a.length;s++)if(!e(a[s],_[s],n+1,o))return!1;return!0}if(!e(t.ctor,r.ctor,n+1,o))return!1;for(var c in t)if(!e(t[c],r[c],n+1,o))return!1;return!0}function n(t,r){if("object"!=typeof t)return t===r?v:t<r?h:m;if(t instanceof String){var e=t.valueOf(),o=r.valueOf();return e===o?v:e<o?h:m}if("::"===t.ctor||"[]"===t.ctor){for(;"::"===t.ctor&&"::"===r.ctor;){var c=n(t._0,r._0);if(c!==v)return c;t=t._1,r=r._1}return t.ctor===r.ctor?v:"[]"===t.ctor?h:m}if("_Tuple"===t.ctor.slice(0,6)){var c,u=t.ctor.slice(6)-0;if(0===u)return v;if(u>=1){if((c=n(t._0,r._0))!==v)return c;if(u>=2){if((c=n(t._1,r._1))!==v)return c;if(u>=3){if((c=n(t._2,r._2))!==v)return c;if(u>=4){if((c=n(t._3,r._3))!==v)return c;if(u>=5){if((c=n(t._4,r._4))!==v)return c;if(u>=6){if((c=n(t._5,r._5))!==v)return c;if(u>=7)throw new Error("Comparison error: cannot compare tuples with more than 6 elements.")}}}}}}return v}throw new Error("Comparison error: comparison is only defined on ints, floats, times, chars, strings, lists of comparable values, and tuples of comparable values.")}function o(t,r){return{ctor:"_Tuple2",_0:t,_1:r}}function c(t){return new String(t)}function u(t){return y++}function i(t,r){var e={};for(var n in t)e[n]=t[n];for(var n in r)e[n]=r[n];return e}function a(t,r){return{ctor:"::",_0:t,_1:r}}function _(t,r){if("string"==typeof t)return t+r;if("[]"===t.ctor)return r;var e=a(t._0,b),n=e;for(t=t._1;"[]"!==t.ctor;)n._1=a(t._0,b),t=t._1,n=n._1;return n._1=r,e}function s(t,r){return function(e){throw new Error("Ran into a `Debug.crash` in module `"+t+"` "+l(r)+"\nThe message provided by the code author is:\n\n    "+e)}}function f(t,r,e){return function(n){throw new Error("Ran into a `Debug.crash` in module `"+t+"`\n\nThis was caused by the `case` expression "+l(r)+".\nOne of the branches ended with a crash and the following value got through:\n\n    "+d(e)+"\n\nThe message provided by the code author is:\n\n    "+n)}}function l(t){return t.start.line==t.end.line?"on line "+t.start.line:"between lines "+t.start.line+" and "+t.end.line}function d(t){var r=typeof t;if("function"===r)return"<function>";if("boolean"===r)return t?"True":"False";if("number"===r)return t+"";if(t instanceof String)return"'"+p(t,!0)+"'";if("string"===r)return'"'+p(t,!1)+'"';if(null===t)return"null";if("object"===r&&"ctor"in t){var e=t.ctor.substring(0,5);if("_Tupl"===e){var n=[];for(var o in t)"ctor"!==o&&n.push(d(t[o]));return"("+n.join(",")+")"}if("_Task"===e)return"<task>";if("_Array"===t.ctor){return"Array.fromList "+d(re(t))}if("<decoder>"===t.ctor)return"<decoder>";if("_Process"===t.ctor)return"<process:"+t.id+">";if("::"===t.ctor){var n="["+d(t._0);for(t=t._1;"::"===t.ctor;)n+=","+d(t._0),t=t._1;return n+"]"}if("[]"===t.ctor)return"[]";if("Set_elm_builtin"===t.ctor)return"Set.fromList "+d(ni(t));if("RBNode_elm_builtin"===t.ctor||"RBEmpty_elm_builtin"===t.ctor)return"Dict.fromList "+d(ue(t));var n="";for(var c in t)if("ctor"!==c){var u=d(t[c]),i=u[0],a="{"===i||"("===i||"<"===i||'"'===i||u.indexOf(" ")<0;n+=" "+(a?u:"("+u+")")}return t.ctor+n}if("object"===r){if(t instanceof Date)return"<"+t.toString()+">";if(t.elm_web_socket)return"<websocket>";var n=[];for(var o in t)n.push(o+" = "+d(t[o]));return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return"<internal structure>"}function p(t,r){var e=t.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return r?e.replace(/\'/g,"\\'"):e.replace(/\"/g,'\\"')}var h=-1,v=0,m=1,g={ctor:"_Tuple0"},y=0,b={ctor:"[]"};return{eq:t,cmp:n,Tuple0:g,Tuple2:o,chr:c,update:i,guid:u,append:r(_),crash:s,crashCase:f,toString:d}}(),g=r(function(t,r){var e=r;return _(t,e._0,e._1)}),y=e(function(t,r,e){return t({ctor:"_Tuple2",_0:r,_1:e})}),b=e(function(t,r,e){return _(t,e,r)}),w=r(function(t,r){return t}),T=function(t){return t},k=k||{};k["<|"]=r(function(t,r){return t(r)});var k=k||{};k["|>"]=r(function(t,r){return r(t)});var k=k||{};k[">>"]=e(function(t,r,e){return r(t(e))});var k=k||{};k["<<"]=e(function(t,r,e){return t(r(e))});var k=k||{};k["++"]=m.append;var S=m.toString,x=(v.isInfinite,v.isNaN,v.toFloat),E=v.ceiling,A=v.floor,O=v.truncate,I=v.round,C=v.not,k=(v.xor,k||{});k["||"]=v.or;var k=k||{};k["&&"]=v.and;var q=v.max,N=v.min,M=v.compare,k=k||{};k[">="]=v.ge;var k=k||{};k["<="]=v.le;var k=k||{};k[">"]=v.gt;var k=k||{};k["<"]=v.lt;var k=k||{};k["/="]=v.neq;var k=k||{};k["=="]=v.eq;var j=(v.e,v.pi,v.clamp),D=(v.logBase,v.abs),R=v.negate,k=(v.sqrt,v.atan2,v.atan,v.asin,v.acos,v.tan,v.sin,v.cos,k||{});k["^"]=v.exp;var k=k||{};k["%"]=v.mod;var B=v.rem,k=k||{};k["//"]=v.div;var k=k||{};k["/"]=v.floatDiv;var k=k||{};k["*"]=v.mul;var k=k||{};k["-"]=v.sub;var k=k||{};k["+"]=v.add;var L=(v.toPolar,v.fromPolar,v.turns,v.degrees,{ctor:"GT"}),P={ctor:"EQ"},F={ctor:"LT"},$=function(){function t(t,r){var e=t+": "+m.toString(r),n=n||{};return n.stdout?n.stdout.write(e):console.log(e),r}function e(t){throw new Error(t)}return{crash:e,log:r(t)}}(),U=($.crash,$.log),J=r(function(t,r){var e=r;return"Just"===e.ctor?e._0:t}),H={ctor:"Nothing"},V=r(function(t,r){var e=r;return"Just"===e.ctor?t(e._0):H}),z=function(t){return{ctor:"Just",_0:t}},W=r(function(t,r){var e=r;return"Just"===e.ctor?z(t(e._0)):H}),G=e(function(t,r,e){var n={ctor:"_Tuple2",_0:r,_1:e};return"_Tuple2"===n.ctor&&"Just"===n._0.ctor&&"Just"===n._1.ctor?z(_(t,n._0._0,n._1._0)):H}),K=(n(function(t,r,e,n){var o={ctor:"_Tuple3",_0:r,_1:e,_2:n};return"_Tuple3"===o.ctor&&"Just"===o._0.ctor&&"Just"===o._1.ctor&&"Just"===o._2.ctor?z(s(t,o._0._0,o._1._0,o._2._0)):H}),o(function(t,r,e,n,o){var c={ctor:"_Tuple4",_0:r,_1:e,_2:n,_3:o};return"_Tuple4"===c.ctor&&"Just"===c._0.ctor&&"Just"===c._1.ctor&&"Just"===c._2.ctor&&"Just"===c._3.ctor?z(f(t,c._0._0,c._1._0,c._2._0,c._3._0)):H}),c(function(t,r,e,n,o,c){var u={ctor:"_Tuple5",_0:r,_1:e,_2:n,_3:o,_4:c};return"_Tuple5"===u.ctor&&"Just"===u._0.ctor&&"Just"===u._1.ctor&&"Just"===u._2.ctor&&"Just"===u._3.ctor&&"Just"===u._4.ctor?z(l(t,u._0._0,u._1._0,u._2._0,u._3._0,u._4._0)):H}),function(){function t(t,r){return{ctor:"::",_0:t,_1:r}}function u(r){for(var e=b,n=r.length;n--;)e=t(r[n],e);return e}function i(t){for(var r=[];"[]"!==t.ctor;)r.push(t._0),t=t._1;return r}function a(t,r,e){for(var n=i(e),o=r,c=n.length;c--;)o=_(t,n[c],o);return o}function d(t,r,e){for(var n=[];"[]"!==r.ctor&&"[]"!==e.ctor;)n.push(_(t,r._0,e._0)),r=r._1,e=e._1;return u(n)}function p(t,r,e,n){for(var o=[];"[]"!==r.ctor&&"[]"!==e.ctor&&"[]"!==n.ctor;)o.push(s(t,r._0,e._0,n._0)),r=r._1,e=e._1,n=n._1;return u(o)}function h(t,r,e,n,o){for(var c=[];"[]"!==r.ctor&&"[]"!==e.ctor&&"[]"!==n.ctor&&"[]"!==o.ctor;)c.push(f(t,r._0,e._0,n._0,o._0)),r=r._1,e=e._1,n=n._1,o=o._1;return u(c)}function v(t,r,e,n,o,c){for(var i=[];"[]"!==r.ctor&&"[]"!==e.ctor&&"[]"!==n.ctor&&"[]"!==o.ctor&&"[]"!==c.ctor;)i.push(l(t,r._0,e._0,n._0,o._0,c._0)),r=r._1,e=e._1,n=n._1,o=o._1,c=c._1;return u(i)}function g(t,r){return u(i(r).sort(function(r,e){return m.cmp(t(r),t(e))}))}function y(t,r){return u(i(r).sort(function(r,e){var n=t(r)(e).ctor;return"EQ"===n?0:"LT"===n?-1:1}))}var b={ctor:"[]"};return{Nil:b,Cons:t,cons:r(t),toArray:i,fromArray:u,foldr:e(a),map2:e(d),map3:n(p),map4:o(h),map5:c(v),sortBy:r(g),sortWith:r(y)}}()),X=K.sortWith,Q=K.sortBy,Y=r(function(t,r){for(;;){if(m.cmp(t,0)<1)return r;var e=r;if("[]"===e.ctor)return r;var n=t-1,o=e._1;t=n,r=o}}),Z=K.map5,tt=K.map4,rt=K.map3,et=K.map2,nt=r(function(t,r){for(;;){var e=r;if("[]"===e.ctor)return!1;if(t(e._0))return!0;var n=t,o=e._1;t=n,r=o}}),ot=r(function(t,r){return!_(nt,function(r){return!t(r)},r)}),ct=K.foldr,ut=e(function(t,r,e){for(;;){var n=e;if("[]"===n.ctor)return r;var o=t,c=_(t,n._0,r),u=n._1;t=o,r=c,e=u}}),it=function(t){return s(ut,r(function(t,r){return r+1}),0,t)},at=function(t){return s(ut,r(function(t,r){return t+r}),0,t)},_t=r(function(t,r){return _(nt,function(r){return m.eq(r,t)},r)}),st=function(t){return"[]"===t.ctor},ft=function(t){var r=t;return"::"===r.ctor?z(r._1):H},lt=function(t){var r=t;return"::"===r.ctor?z(r._0):H},dt=dt||{};dt["::"]=K.cons;var pt=r(function(t,e){return s(ct,r(function(r,e){return{ctor:"::",_0:t(r),_1:e}}),{ctor:"[]"},e)}),ht=r(function(t,e){var n=r(function(r,e){return t(r)?{ctor:"::",_0:r,_1:e}:e});return s(ct,n,{ctor:"[]"},e)}),vt=e(function(t,r,e){var n=t(r);return"Just"===n.ctor?{ctor:"::",_0:n._0,_1:e}:e}),mt=r(function(t,r){return s(ct,vt(t),{ctor:"[]"},r)}),gt=function(t){return s(ut,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),{ctor:"[]"},t)},yt=e(function(t,e,n){var o=r(function(r,e){var n=e;return"::"===n.ctor?{ctor:"::",_0:_(t,r,n._0),_1:e}:{ctor:"[]"}});return gt(s(ut,o,{ctor:"::",_0:e,_1:{ctor:"[]"}},n))}),bt=r(function(t,e){return"[]"===e.ctor?t:s(ct,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),e,t)}),wt=function(t){return s(ct,bt,{ctor:"[]"},t)},Tt=r(function(t,r){return wt(_(pt,t,r))}),kt=r(function(t,e){var n=r(function(r,e){var n=e,o=n._0,c=n._1;return t(r)?{ctor:"_Tuple2",_0:{ctor:"::",_0:r,_1:o},_1:c}:{ctor:"_Tuple2",_0:o,_1:{ctor:"::",_0:r,_1:c}}});return s(ct,n,{ctor:"_Tuple2",_0:{ctor:"[]"},_1:{ctor:"[]"}},e)}),St=(r(function(t,e){var n=e;if("[]"===n.ctor)return{ctor:"[]"};var o=r(function(r,e){return{ctor:"::",_0:t,_1:{ctor:"::",_0:r,_1:e}}}),c=s(ct,o,{ctor:"[]"},n._1);return{ctor:"::",_0:n._0,_1:c}}),e(function(t,r,e){for(;;){if(m.cmp(t,0)<1)return e;var n=r;if("[]"===n.ctor)return e;var o=t-1,c=n._1,u={ctor:"::",_0:n._0,_1:e};t=o,r=c,e=u}})),xt=r(function(t,r){return gt(s(St,t,r,{ctor:"[]"}))}),Et=e(function(t,r,e){if(m.cmp(r,0)<1)return{ctor:"[]"};var n={ctor:"_Tuple2",_0:r,_1:e};t:do{r:do{if("_Tuple2"!==n.ctor)break t;if("[]"===n._1.ctor)return e;if("::"!==n._1._1.ctor){if(1===n._0)break r;break t}switch(n._0){case 1:break r;case 2:return{ctor:"::",_0:n._1._0,_1:{ctor:"::",_0:n._1._1._0,_1:{ctor:"[]"}}};case 3:if("::"===n._1._1._1.ctor)return{ctor:"::",_0:n._1._0,_1:{ctor:"::",_0:n._1._1._0,_1:{ctor:"::",_0:n._1._1._1._0,_1:{ctor:"[]"}}}};break t;default:if("::"===n._1._1._1.ctor&&"::"===n._1._1._1._1.ctor){var o=n._1._1._1._0,c=n._1._1._0,u=n._1._0,i=n._1._1._1._1._0,a=n._1._1._1._1._1;return m.cmp(t,1e3)>0?{ctor:"::",_0:u,_1:{ctor:"::",_0:c,_1:{ctor:"::",_0:o,_1:{ctor:"::",_0:i,_1:_(xt,r-4,a)}}}}:{ctor:"::",_0:u,_1:{ctor:"::",_0:c,_1:{ctor:"::",_0:o,_1:{ctor:"::",_0:i,_1:s(Et,t+1,r-4,a)}}}}}break t}}while(!1);return{ctor:"::",_0:n._1._0,_1:{ctor:"[]"}}}while(!1);return e}),At=r(function(t,r){return s(Et,0,t,r)}),Ot=e(function(t,r,e){for(;;){if(m.cmp(r,0)<1)return t;var n={ctor:"::",_0:e,_1:t},o=r-1,c=e;t=n,r=o,e=c}}),It=r(function(t,r){return s(Ot,{ctor:"[]"},t,r)}),Ct=e(function(t,r,e){for(;;){if(!(m.cmp(t,r)<1))return e;var n=t,o=r-1,c={ctor:"::",_0:r,_1:e};t=n,r=o,e=c}}),qt=r(function(t,r){return s(Ct,t,r,{ctor:"[]"})}),Nt=r(function(t,r){return s(et,t,_(qt,0,it(r)-1),r)}),Mt=function(t){var r=t;return"Ok"===r.ctor?z(r._0):H},jt=r(function(t,r){var e=r;return"Ok"===e.ctor?e._0:t}),Dt=function(t){return{ctor:"Err",_0:t}},Rt=r(function(t,r){var e=r;return"Ok"===e.ctor?t(e._0):Dt(e._0)}),Bt=function(t){return{ctor:"Ok",_0:t}},Lt=r(function(t,r){var e=r;return"Ok"===e.ctor?Bt(t(e._0)):Dt(e._0)}),Pt=e(function(t,r,e){var n={ctor:"_Tuple2",_0:r,_1:e};return"Ok"===n._0.ctor?"Ok"===n._1.ctor?Bt(_(t,n._0._0,n._1._0)):Dt(n._1._0):Dt(n._0._0)}),Ft=(n(function(t,r,e,n){var o={ctor:"_Tuple3",_0:r,_1:e,_2:n};return"Ok"===o._0.ctor?"Ok"===o._1.ctor?"Ok"===o._2.ctor?Bt(s(t,o._0._0,o._1._0,o._2._0)):Dt(o._2._0):Dt(o._1._0):Dt(o._0._0)}),o(function(t,r,e,n,o){var c={ctor:"_Tuple4",_0:r,_1:e,_2:n,_3:o};return"Ok"===c._0.ctor?"Ok"===c._1.ctor?"Ok"===c._2.ctor?"Ok"===c._3.ctor?Bt(f(t,c._0._0,c._1._0,c._2._0,c._3._0)):Dt(c._3._0):Dt(c._2._0):Dt(c._1._0):Dt(c._0._0)}),c(function(t,r,e,n,o,c){var u={ctor:"_Tuple5",_0:r,_1:e,_2:n,_3:o,_4:c};return"Ok"===u._0.ctor?"Ok"===u._1.ctor?"Ok"===u._2.ctor?"Ok"===u._3.ctor?"Ok"===u._4.ctor?Bt(l(t,u._0._0,u._1._0,u._2._0,u._3._0,u._4._0)):Dt(u._4._0):Dt(u._3._0):Dt(u._2._0):Dt(u._1._0):Dt(u._0._0)}),r(function(t,r){var e=r;return"Ok"===e.ctor?Bt(e._0):Dt(t(e._0))})),$t=r(function(t,r){var e=r;return"Just"===e.ctor?Bt(e._0):Dt(t)}),Ut=function(){function t(t){return 0===t.length}function n(t,r){return t+r}function o(t){var r=t[0];return r?z(m.Tuple2(m.chr(r),t.slice(1))):H}function c(t,r){return t+r}function u(t){return K.toArray(t).join("")}function i(t){return t.length}function a(t,r){for(var e=r.split(""),n=e.length;n--;)e[n]=t(m.chr(e[n]));return e.join("")}function s(t,r){return r.split("").map(m.chr).filter(t).join("")}function f(t){return t.split("").reverse().join("")}function l(t,r,e){for(var n=e.length,o=0;o<n;++o)r=_(t,m.chr(e[o]),r);return r}function d(t,r,e){for(var n=e.length;n--;)r=_(t,m.chr(e[n]),r);return r}function p(t,r){return K.fromArray(r.split(t))}function h(t,r){return K.toArray(r).join(t)}function v(t,r){for(var e="";t>0;)1&t&&(e+=r),t>>=1,r+=r;return e}function g(t,r,e){return e.slice(t,r)}function y(t,r){return t<1?"":r.slice(0,t)}function b(t,r){return t<1?"":r.slice(-t)}function w(t,r){return t<1?r:r.slice(t)}function T(t,r){return t<1?r:r.slice(0,-t)}function k(t,r,e){var n=(t-e.length)/2;return v(Math.ceil(n),r)+e+v(0|n,r)}function S(t,r,e){return e+v(t-e.length,r)}function x(t,r,e){return v(t-e.length,r)+e}function E(t){return t.trim()}function A(t){return t.replace(/^\s+/,"")}function O(t){return t.replace(/\s+$/,"")}function I(t){return K.fromArray(t.trim().split(/\s+/g))}function C(t){return K.fromArray(t.split(/\r\n|\r|\n/g))}function q(t){return t.toUpperCase()}function N(t){return t.toLowerCase()}function M(t,r){for(var e=r.length;e--;)if(t(m.chr(r[e])))return!0;return!1}function j(t,r){for(var e=r.length;e--;)if(!t(m.chr(r[e])))return!1;return!0}function D(t,r){return r.indexOf(t)>-1}function R(t,r){return 0===r.indexOf(t)}function B(t,r){return r.length>=t.length&&r.lastIndexOf(t)===r.length-t.length}function L(t,r){var e=t.length;if(e<1)return K.Nil;for(var n=0,o=[];(n=r.indexOf(t,n))>-1;)o.push(n),n+=e;return K.fromArray(o)}function P(t){var r=t.length;if(0===r)return F(t);var e=t[0];if("0"===e&&"x"===t[1]){for(var n=2;n<r;++n){var e=t[n];if(!("0"<=e&&e<="9"||"A"<=e&&e<="F"||"a"<=e&&e<="f"))return F(t)}return Bt(parseInt(t,16))}if(e>"9"||e<"0"&&"-"!==e&&"+"!==e)return F(t);for(var n=1;n<r;++n){var e=t[n];if(e<"0"||"9"<e)return F(t)}return Bt(parseInt(t,10))}function F(t){return Dt("could not convert string '"+t+"' to an Int")}function $(t){if(0===t.length||/[\sxbo]/.test(t))return U(t);var r=+t;return r===r?Bt(r):U(t)}function U(t){return Dt("could not convert string '"+t+"' to a Float")}function J(t){return K.fromArray(t.split("").map(m.chr))}function V(t){return K.toArray(t).join("")}return{isEmpty:t,cons:r(n),uncons:o,append:r(c),concat:u,length:i,map:r(a),filter:r(s),reverse:f,foldl:e(l),foldr:e(d),split:r(p),join:r(h),repeat:r(v),slice:e(g),left:r(y),right:r(b),dropLeft:r(w),dropRight:r(T),pad:e(k),padLeft:e(x),padRight:e(S),trim:E,trimLeft:A,trimRight:O,words:I,lines:C,toUpper:q,toLower:N,any:r(M),all:r(j),contains:r(D),startsWith:r(R),endsWith:r(B),indexes:r(L),toInt:P,toFloat:$,toList:J,fromList:V}}(),Jt=function(){return{fromCode:function(t){return m.chr(String.fromCharCode(t))},toCode:function(t){return t.charCodeAt(0)},toUpper:function(t){return m.chr(t.toUpperCase())},toLower:function(t){return m.chr(t.toLowerCase())},toLocaleUpper:function(t){return m.chr(t.toLocaleUpperCase())},toLocaleLower:function(t){return m.chr(t.toLocaleLowerCase())}}}(),Ht=Jt.fromCode,Vt=Jt.toCode,zt=(Jt.toLocaleLower,Jt.toLocaleUpper,Jt.toLower,Jt.toUpper,e(function(t,r,e){var n=Vt(e);return m.cmp(n,Vt(t))>-1&&m.cmp(n,Vt(r))<1})),Wt=(_(zt,m.chr("A"),m.chr("Z")),_(zt,m.chr("a"),m.chr("z")),_(zt,m.chr("0"),m.chr("9")),_(zt,m.chr("0"),m.chr("7")),Ut.fromList),Gt=Ut.toList,Kt=Ut.toFloat,Xt=Ut.toInt,Qt=(Ut.indexes,Ut.indexes),Yt=Ut.endsWith,Zt=Ut.startsWith,tr=(Ut.contains,Ut.all,Ut.any,Ut.toLower),rr=Ut.toUpper,er=Ut.lines,nr=Ut.words,or=(Ut.trimRight,Ut.trimLeft,Ut.trim),cr=Ut.padRight,ur=Ut.padLeft,ir=(Ut.pad,Ut.dropRight),ar=Ut.dropLeft,_r=Ut.right,sr=Ut.left,fr=Ut.slice,lr=Ut.repeat,dr=Ut.join,pr=Ut.split,hr=(Ut.foldr,Ut.foldl),vr=(Ut.reverse,Ut.filter,Ut.map,Ut.length),mr=Ut.concat,gr=Ut.append,yr=Ut.uncons,br=Ut.cons,wr=function(t){return _(br,t,"")},Tr=Ut.isEmpty,kr=r(function(t,r){var e=r;return{ctor:"_Tuple2",_0:e._0,_1:t(e._1)}}),Sr=r(function(t,r){var e=r;return{ctor:"_Tuple2",_0:t(e._0),_1:e._1}}),xr=function(t){return t._1},Er=function(t){return t._0},Ar=function(){function t(t){return function(r){return function(r,e){r.worker=function(r){if(void 0!==r)throw new Error("The `"+e+"` module does not need flags.\nCall "+e+".worker() with no arguments and you should be all set!");return u(t.init,t.update,t.subscriptions,o)}}}}function n(t){return function(r){return function(e,n){e.worker=function(e){if(void 0===r)throw new Error("Are you trying to sneak a Never value into Elm? Trickster!\nIt looks like "+n+".main is defined with `programWithFlags` but has type `Program Never`.\nUse `program` instead if you do not want flags.");var c=_(Ye.run,r,e);if("Err"===c.ctor)throw new Error(n+".worker(...) was called with an unexpected argument.\nI tried to convert it to an Elm value, but ran into this problem:\n\n"+c._0);return u(t.init(c._0),t.update,t.subscriptions,o)}}}}function o(t,r){return function(t){}}function c(t){var e=v(K.Nil),n=m.Tuple2(m.Tuple0,e);return qi({init:n,view:function(t){return main},update:r(function(t,r){return n}),subscriptions:function(t){return e}})}function u(t,r,e,n){function o(t,n){return Or.nativeBinding(function(o){var c=_(r,t,n);n=c._0,u(n);var i=c._1,s=e(n);y(a,i,s),o(Or.succeed(n))})}function c(t){Or.rawSend(f,t)}var u,a={},s=Or.nativeBinding(function(r){var o=t._0;u=n(c,o);var i=t._1,_=e(o);y(a,i,_),r(Or.succeed(o))}),f=p(s,o),l=i(a,c);return l?{ports:l}:{}}function i(t,r){var e;for(var n in O){var o=O[n];o.isForeign&&(e=e||{},e[n]="cmd"===o.tag?x(n):A(n,r)),t[n]=a(o,r)}return e}function a(t,r){function e(t,r){if("self"===t.ctor)return s(u,n,t._0,r);var e=t._0;switch(o){case"cmd":return s(c,n,e.cmds,r);case"sub":return s(c,n,e.subs,r);case"fx":return f(c,n,e.cmds,e.subs,r)}}var n={main:r,self:void 0},o=t.tag,c=t.onEffects,u=t.onSelfMsg,i=p(t.init,e);return n.self=i,i}function l(t,r){return Or.nativeBinding(function(e){t.main(r),e(Or.succeed(m.Tuple0))})}function d(t,r){return _(Or.send,t.self,{ctor:"self",_0:r})}function p(t,r){function e(t){var o=Or.receive(function(e){return r(e,t)});return _(n,e,o)}var n=Or.andThen,o=_(n,e,t);return Or.rawSpawn(o)}function h(t){return function(r){return{type:"leaf",home:t,value:r}}}function v(t){return{type:"node",branches:t}}function g(t,r){return{type:"map",tagger:t,tree:r}}function y(t,r,e){var n={};b(!0,r,n,null),b(!1,e,n,null);for(var o in t){var c=o in n?n[o]:{cmds:K.Nil,subs:K.Nil};Or.rawSend(t[o],{ctor:"fx",_0:c})}}function b(t,r,e,n){switch(r.type){case"leaf":var o=r.home,c=w(t,o,n,r.value);return void(e[o]=T(t,c,e[o]));case"node":for(var u=r.branches;"[]"!==u.ctor;)b(t,u._0,e,n),u=u._1;return;case"map":return void b(t,r.tree,e,{tagger:r.tagger,rest:n})}}function w(t,r,e,n){function o(t){for(var r=e;r;)t=r.tagger(t),r=r.rest;return t}return _(t?O[r].cmdMap:O[r].subMap,o,n)}function T(t,r,e){return e=e||{cmds:K.Nil,subs:K.Nil},t?(e.cmds=K.Cons(r,e.cmds),e):(e.subs=K.Cons(r,e.subs),e)}function k(t){if(t in O)throw new Error("There can only be one port named `"+t+"`, but your program has multiple.")}function S(t,r){return k(t),O[t]={tag:"cmd",cmdMap:I,converter:r,isForeign:!0},h(t)}function x(t){function r(t,r,e){for(;"[]"!==r.ctor;){for(var n=c,o=u(r._0),a=0;a<n.length;a++)n[a](o);r=r._1}return i}function n(t){c.push(t)}function o(t){c=c.slice();var r=c.indexOf(t);r>=0&&c.splice(r,1)}var c=[],u=O[t].converter,i=Or.succeed(null);return O[t].init=i,O[t].onEffects=e(r),{subscribe:n,unsubscribe:o}}function E(t,r){return k(t),O[t]={tag:"sub",subMap:C,converter:r,isForeign:!0},h(t)}function A(t,r){function n(t,r,e){for(var n=o(t,r,e),c=0;c<s.length;c++)i(s[c]);return s=null,p=i,d=o,n}function o(t,r,e){return f=r,h}function c(t,r,e){return d(t,r,e)}function u(t){s.push(t)}function i(t){for(var e=f;"[]"!==e.ctor;)r(e._0(t)),e=e._1}function a(r){var e=_(fn,l,r);if("Err"===e.ctor)throw new Error("Trying to send an unexpected type of value through port `"+t+"`:\n"+e._0);p(e._0)}var s=[],f=K.Nil,l=O[t].converter,d=n,p=u,h=Or.succeed(null);return O[t].init=h,O[t].onEffects=e(c),{send:a}}var O={},I=r(function(t,r){return r}),C=r(function(t,r){return function(e){return t(r(e))}});return{sendToApp:r(l),sendToSelf:r(d),effectManagers:O,outgoingPort:S,incomingPort:E,htmlToProgram:c,program:t,programWithFlags:n,initialize:u,leaf:h,batch:v,map:r(g)}}(),Or=function(){function t(t){return{ctor:"_Task_succeed",value:t}}function e(t){return{ctor:"_Task_fail",value:t}}function n(t){return{ctor:"_Task_nativeBinding",callback:t,cancel:null}}function o(t,r){return{ctor:"_Task_andThen",callback:t,task:r}}function c(t,r){return{ctor:"_Task_onError",callback:t,task:r}}function u(t){return{ctor:"_Task_receive",callback:t}}function i(t){var r={ctor:"_Process",id:m.guid(),root:t,stack:null,mailbox:[]};return p(r),r}function a(r){return n(function(e){e(t(i(r)))})}function _(t,r){t.mailbox.push(r),p(t)}function s(r,e){return n(function(n){_(r,e),n(t(m.Tuple0))})}function f(r){return n(function(e){var n=r.root;"_Task_nativeBinding"===n.ctor&&n.cancel&&n.cancel(),r.root=null,e(t(m.Tuple0))})}function l(r){return n(function(e){var n=setTimeout(function(){e(t(m.Tuple0))},r);return function(){clearTimeout(n)}})}function d(t,r){for(;t<v;){var e=r.root.ctor;if("_Task_succeed"!==e)if("_Task_fail"!==e)if("_Task_andThen"!==e)if("_Task_onError"!==e){if("_Task_nativeBinding"===e){r.root.cancel=r.root.callback(function(t){r.root=t,p(r)});break}if("_Task_receive"!==e)throw new Error(e);var n=r.mailbox;if(0===n.length)break;r.root=r.root.callback(n.shift()),++t}else r.stack={ctor:"_Task_onError",callback:r.root.callback,rest:r.stack},r.root=r.root.task,++t;else r.stack={ctor:"_Task_andThen",callback:r.root.callback,rest:r.stack},r.root=r.root.task,++t;else{for(;r.stack&&"_Task_andThen"===r.stack.ctor;)r.stack=r.stack.rest;if(null===r.stack)break;r.root=r.stack.callback(r.root.value),r.stack=r.stack.rest,++t}else{for(;r.stack&&"_Task_onError"===r.stack.ctor;)r.stack=r.stack.rest;if(null===r.stack)break;r.root=r.stack.callback(r.root.value),r.stack=r.stack.rest,++t}}return t<v?t+1:(p(r),t)}function p(t){y.push(t),g||(setTimeout(h,0),g=!0)}function h(){for(var t,r=0;r<v&&(t=y.shift());)t.root&&(r=d(r,t));if(!t)return void(g=!1);setTimeout(h,0)}var v=1e4,g=!1,y=[];return{succeed:t,fail:e,nativeBinding:n,andThen:r(o),onError:r(c),receive:u,spawn:a,kill:f,sleep:l,send:r(s),rawSpawn:i,rawSend:_}}(),Ir=Ar.batch,Cr=Ir({ctor:"[]"}),qr=qr||{};qr["!"]=r(function(t,r){return{ctor:"_Tuple2",_0:t,_1:Ir(r)}});var Nr=Ar.map,Mr=Ar.batch,jr=Mr({ctor:"[]"}),Dr=Ar.map,Rr=(Or.succeed,Ar.sendToSelf),Br=Ar.sendToApp,Lr=(Ar.programWithFlags,Ar.program,r(function(t,r){return function(e){return r(t(e))}}),w(Cr),r(function(t,r){return Ir(_(pt,function(t){return t(r)},t))}),e(function(t,r,e){return Ir({ctor:"::",_0:t(e),_1:{ctor:"::",_0:r(e),_1:{ctor:"[]"}}})}),function(){var t=r(function(t,r){var e=t,n=r;return _(qr["!"],{ctor:"::",_0:e._0,_1:n._0},{ctor:"::",_0:e._1,_1:{ctor:"::",_0:n._1,_1:{ctor:"[]"}}})});_(ct,t,{ctor:"_Tuple2",_0:{ctor:"[]"},_1:Cr})}(),r(function(t,r){var e=r;return{ctor:"_Tuple2",_0:e._0,_1:_(Nr,t,e._1)}}),r(function(t,r){var e=r,n=e._0;return _(qr["!"],n,{ctor:"::",_0:e._1,_1:{ctor:"::",_0:t(n),_1:{ctor:"[]"}}})})),Pr=r(function(t,r){var e=r;return _(qr["!"],e._0,{ctor:"::",_0:t,_1:{ctor:"::",_0:e._1,_1:{ctor:"[]"}}})}),Fr=(y(T),r(function(t,r){var e=r,n=t(e._0),o=n._0,c=n._1;return _(qr["!"],o,{ctor:"::",_0:e._1,_1:{ctor:"::",_0:c,_1:{ctor:"[]"}}})})),$r=$r||{};$r["<<<"]=e(function(t,r,e){return _(Fr,t,r(e))});var $r=$r||{};$r[">>>"]=b(r(function(t,r){return _($r["<<<"],t,r)}));var Ur=(Fr(T),_(b,r(function(t,r){return{ctor:"_Tuple2",_0:t,_1:r}}),Cr)),Jr=(c(function(t,r,e,n,o,c){var u=r,i=e,a=n,s=o,f=c;return _(qr["!"],l(t,u._0,i._0,a._0,s._0,f._0),{ctor:"::",_0:u._1,_1:{ctor:"::",_0:i._1,_1:{ctor:"::",_0:a._1,_1:{ctor:"::",_0:s._1,_1:{ctor:"::",_0:f._1,_1:{ctor:"[]"}}}}}})}),o(function(t,r,e,n,o){var c=r,u=e,i=n,a=o;return _(qr["!"],f(t,c._0,u._0,i._0,a._0),{ctor:"::",_0:c._1,_1:{ctor:"::",_0:u._1,_1:{ctor:"::",_0:i._1,_1:{ctor:"::",_0:a._1,_1:{ctor:"[]"}}}}})}),n(function(t,r,e,n){var o=r,c=e,u=n;return _(qr["!"],s(t,o._0,c._0,u._0),{ctor:"::",_0:o._1,_1:{ctor:"::",_0:c._1,_1:{ctor:"::",_0:u._1,_1:{ctor:"[]"}}}})}),e(function(t,r,e){var n=r,o=e;return _(qr["!"],_(t,n._0,o._0),{ctor:"::",_0:n._1,_1:{ctor:"::",_0:o._1,_1:{ctor:"[]"}}})}),e(function(t,r,e){var n=e;return{ctor:"_Tuple2",_0:r(n._0),_1:_(Nr,t,n._1)}}),r(function(t,r){var e=t,n=r;return _(qr["!"],n._0(e._0),{ctor:"::",_0:n._1,_1:{ctor:"::",_0:e._1,_1:{ctor:"[]"}}})})),Hr=(y(b(Jr)),r(function(t,r){var e=r;return{ctor:"_Tuple2",_0:t(e._0),_1:e._1}})),Vr=T,zr=(_(ut,r(function(t,r){return function(e){return r(t(e))}}),Vr),_(ct,r(function(t,r){return function(e){return t(r(e))}}),Vr),r(function(t,r){var e=r,n=e._1,o=e._0;return"GT"===_(t,o,n).ctor?{ctor:"_Tuple2",_0:n,_1:o}:{ctor:"_Tuple2",_0:o,_1:n}}),r(function(t,r){var e=r,n=e._1,o=e._0;return m.cmp(t(o),t(n))>0?{ctor:"_Tuple2",_0:n,_1:o}:{ctor:"_Tuple2",_0:o,_1:n}}),function(t){var r=t;return{ctor:"_Tuple2",_0:r._1,_1:r._0}}),Wr=r(function(t,r){var e=r;return{ctor:"_Tuple2",_0:t(e._0),_1:t(e._1)}}),Gr=(e(function(t,r,e){var n=e;return{ctor:"_Tuple2",_0:t(n._0),_1:r(n._1)}}),r(function(t,r){var e=r;return{ctor:"_Tuple2",_0:e._0,_1:t(e._1)}})),Kr=r(function(t,r){var e=r;return{ctor:"_Tuple2",_0:t(e._0),_1:e._1}}),Xr=Xr||{};Xr["=>"]=r(function(t,r){return{ctor:"_Tuple2",_0:t,_1:r}});var Qr=function(){function t(t,r){if(t<0||t>=R(r))throw new Error("Index "+t+" is out of range. Check the length of your array first or use getMaybe or getWithDefault.");return n(t,r)}function n(t,r){for(var e=r.height;e>0;e--){for(var n=t>>5*e;r.lengths[n]<=t;)n++;n>0&&(t-=r.lengths[n-1]),r=r.table[n]}return r.table[t]}function o(t,r,e){return t<0||R(e)<=t?e:c(t,r,e)}function c(t,r,e){if(e=D(e),0===e.height)e.table[t]=r;else{var n=B(t,e);n>0&&(t-=e.lengths[n-1]),e.table[n]=c(t,r,e.table[n])}return e}function u(t,r){return t<=0?W:i(r,Math.floor(Math.log(t)/Math.log(V)),0,t)}function i(t,r,e,n){if(0===r){for(var o=new Array((n-e)%(V+1)),c=0;c<o.length;c++)o[c]=t(e+c);return{ctor:"_Array",height:0,table:o}}for(var u=Math.pow(V,r),o=new Array(Math.ceil((n-e)/u)),a=new Array(o.length),c=0;c<o.length;c++)o[c]=i(t,r-1,e+c*u,Math.min(e+(c+1)*u,n)),a[c]=R(o[c])+(c>0?a[c-1]:0);return{ctor:"_Array",height:r,table:o,lengths:a}}function a(t){if("[]"===t.ctor)return W;for(var r=new Array(V),e=[],n=0;"[]"!==t.ctor;)if(r[n]=t._0,t=t._1,++n===V){var o={ctor:"_Array",height:0,table:r};s(o,e),r=new Array(V),n=0}if(n>0){var o={ctor:"_Array",height:0,table:r.splice(0,n)};s(o,e)}for(var c=0;c<e.length-1;c++)e[c].table.length>0&&s(e[c],e);var u=e[e.length-1];return u.height>0&&1===u.table.length?u.table[0]:u}function s(t,r){var e=t.height;if(r.length===e){var n={ctor:"_Array",height:e+1,table:[],lengths:[]};r.push(n)}r[e].table.push(t);var o=R(t);r[e].lengths.length>0&&(o+=r[e].lengths[r[e].lengths.length-1]),r[e].lengths.push(o),r[e].table.length===V&&(s(r[e],r),r[e]={ctor:"_Array",height:e+1,table:[],lengths:[]})}function f(t,r){var e=l(t,r);return null!==e?e:F(r,L(t,r.height))}function l(t,r){if(0===r.height){if(r.table.length<V){var e={ctor:"_Array",height:0,table:r.table.slice()};return e.table.push(t),e}return null}var n=l(t,M(r));if(null!==n){var e=D(r);return e.table[e.table.length-1]=n,e.lengths[e.lengths.length-1]++,e}if(r.table.length<V){var o=L(t,r.height-1),e=D(r);return e.table.push(o),e.lengths.push(e.lengths[e.lengths.length-1]+R(o)),e}return null}function d(t){return p(K.Nil,t)}function p(t,r){for(var e=r.table.length-1;e>=0;e--)t=0===r.height?K.Cons(r.table[e],t):p(t,r.table[e]);return t}function h(t,r){var e={ctor:"_Array",height:r.height,table:new Array(r.table.length)};r.height>0&&(e.lengths=r.lengths);for(var n=0;n<r.table.length;n++)e.table[n]=0===r.height?t(r.table[n]):h(t,r.table[n]);return e}function v(t,r){return m(t,r,0)}function m(t,r,e){var n={ctor:"_Array",height:r.height,table:new Array(r.table.length)};r.height>0&&(n.lengths=r.lengths);for(var o=0;o<r.table.length;o++)n.table[o]=0===r.height?_(t,e+o,r.table[o]):m(t,r.table[o],0==o?e:e+r.lengths[o-1]);return n}function g(t,r,e){if(0===e.height)for(var n=0;n<e.table.length;n++)r=_(t,e.table[n],r);else for(var n=0;n<e.table.length;n++)r=g(t,r,e.table[n]);return r}function y(t,r,e){if(0===e.height)for(var n=e.table.length;n--;)r=_(t,e.table[n],r);else for(var n=e.table.length;n--;)r=y(t,r,e.table[n]);return r}function b(t,r,e){return t<0&&(t+=R(e)),r<0&&(r+=R(e)),T(t,w(r,e))}function w(t,r){if(t===R(r))return r;if(0===r.height){var e={ctor:"_Array",height:0};return e.table=r.table.slice(0,t),e}var n=B(t,r),o=w(t-(n>0?r.lengths[n-1]:0),r.table[n]);if(0===n)return o;var e={ctor:"_Array",height:r.height,table:r.table.slice(0,n),lengths:r.lengths.slice(0,n)};return o.table.length>0&&(e.table[n]=o,e.lengths[n]=R(o)+(n>0?e.lengths[n-1]:0)),e}function T(t,r){if(0===t)return r;if(0===r.height){var e={ctor:"_Array",height:0};return e.table=r.table.slice(t,r.table.length+1),e}var n=B(t,r),o=T(t-(n>0?r.lengths[n-1]:0),r.table[n]);if(n===r.table.length-1)return o;var e={ctor:"_Array",height:r.height,table:r.table.slice(n,r.table.length+1),lengths:new Array(r.table.length-n)};e.table[0]=o;for(var c=0,u=0;u<e.table.length;u++)c+=R(e.table[u]),e.lengths[u]=c;return e}function k(t,r){if(0===t.table.length)return r;if(0===r.table.length)return t;var e=S(t,r);if(e[0].table.length+e[1].table.length<=V){if(0===e[0].table.length)return e[1];if(0===e[1].table.length)return e[0];if(e[0].table=e[0].table.concat(e[1].table),e[0].height>0){for(var n=R(e[0]),o=0;o<e[1].lengths.length;o++)e[1].lengths[o]+=n;e[0].lengths=e[0].lengths.concat(e[1].lengths)}return e[0]}if(e[0].height>0){var c=A(t,r);c>z&&(e=N(e[0],e[1],c))}return F(e[0],e[1])}function S(t,r){if(0===t.height&&0===r.height)return[t,r];if(1!==t.height||1!==r.height)if(t.height===r.height){t=D(t),r=D(r);var e=S(M(t),j(r));x(t,e[1]),E(r,e[0])}else if(t.height>r.height){t=D(t);var e=S(M(t),r);x(t,e[0]),r=P(e[1],e[1].height+1)}else{r=D(r);var e=S(t,j(r)),n=0===e[0].table.length?0:1,o=0===n?1:0;E(r,e[n]),t=P(e[o],e[o].height+1)}if(0===t.table.length||0===r.table.length)return[t,r];var c=A(t,r);return c<=z?[t,r]:N(t,r,c)}function x(t,r){var e=t.table.length-1;t.table[e]=r,t.lengths[e]=R(r),t.lengths[e]+=e>0?t.lengths[e-1]:0}function E(t,r){if(r.table.length>0){t.table[0]=r,t.lengths[0]=R(r);for(var e=R(t.table[0]),n=1;n<t.lengths.length;n++)e+=R(t.table[n]),t.lengths[n]=e}else{t.table.shift();for(var n=1;n<t.lengths.length;n++)t.lengths[n]=t.lengths[n]-t.lengths[0];t.lengths.shift()}}function A(t,r){for(var e=0,n=0;n<t.table.length;n++)e+=t.table[n].table.length;for(var n=0;n<r.table.length;n++)e+=r.table[n].table.length;return t.table.length+r.table.length-(Math.floor((e-1)/V)+1)}function O(t,r,e){return e<t.length?t[e]:r[e-t.length]}function I(t,r,e,n){e<t.length?t[e]=n:r[e-t.length]=n}function C(t,r,e,n){I(t.table,r.table,e,n);var o=0===e||e===t.lengths.length?0:O(t.lengths,t.lengths,e-1);I(t.lengths,r.lengths,e,o+R(n))}function q(t,r){r<0&&(r=0);var e={ctor:"_Array",height:t,table:new Array(r)};return t>0&&(e.lengths=new Array(r)),e}function N(t,r,e){for(var n=q(t.height,Math.min(V,t.table.length+r.table.length-e)),o=q(t.height,n.table.length-(t.table.length+r.table.length-e)),c=0;O(t.table,r.table,c).table.length%V==0;)I(n.table,o.table,c,O(t.table,r.table,c)),I(n.lengths,o.lengths,c,O(t.lengths,r.lengths,c)),c++;for(var u=c,i=new q(t.height-1,0),a=0;c-u-(i.table.length>0?1:0)<e;){var _=O(t.table,r.table,c),s=Math.min(V-i.table.length,_.table.length);if(i.table=i.table.concat(_.table.slice(a,s)),i.height>0)for(var f=i.lengths.length,l=f;l<f+s-a;l++)i.lengths[l]=R(i.table[l]),i.lengths[l]+=l>0?i.lengths[l-1]:0;a+=s,_.table.length<=s&&(c++,a=0),i.table.length===V&&(C(n,o,u,i),i=q(t.height-1,0),u++)}for(i.table.length>0&&(C(n,o,u,i),u++);c<t.table.length+r.table.length;)C(n,o,u,O(t.table,r.table,c)),c++,u++;return[n,o]}function M(t){return t.table[t.table.length-1]}function j(t){return t.table[0]}function D(t){var r={ctor:"_Array",height:t.height,table:t.table.slice()};return t.height>0&&(r.lengths=t.lengths.slice()),r}function R(t){return 0===t.height?t.table.length:t.lengths[t.lengths.length-1]}function B(t,r){for(var e=t>>5*r.height;r.lengths[e]<=t;)e++;return e}function L(t,r){return 0===r?{ctor:"_Array",height:0,table:[t]}:{ctor:"_Array",height:r,table:[L(t,r-1)],lengths:[1]}}function P(t,r){return r===t.height?t:{ctor:"_Array",height:r,table:[P(t,r-1)],lengths:[R(t)]}}function F(t,r){return{ctor:"_Array",height:t.height+1,table:[t,r],lengths:[R(t),R(t)+R(r)]}}function $(t){var r=new Array(R(t));return U(r,0,t),r}function U(t,r,e){for(var n=0;n<e.table.length;n++)if(0===e.height)t[r+n]=e.table[n];else{var o=0===n?0:e.lengths[n-1];U(t,r+o,e.table[n])}}function J(t){return 0===t.length?W:H(t,Math.floor(Math.log(t.length)/Math.log(V)),0,t.length)}function H(t,r,e,n){if(0===r)return{ctor:"_Array",height:0,table:t.slice(e,n)};for(var o=Math.pow(V,r),c=new Array(Math.ceil((n-e)/o)),u=new Array(c.length),i=0;i<c.length;i++)c[i]=H(t,r-1,e+i*o,Math.min(e+(i+1)*o,n)),u[i]=R(c[i])+(i>0?u[i-1]:0);return{ctor:"_Array",height:r,table:c,lengths:u}}var V=32,z=2,W={ctor:"_Array",height:0,table:[]};return{empty:W,fromList:a,toList:d,initialize:r(u),append:r(k),push:r(f),slice:e(b),get:r(t),set:e(o),map:r(h),indexedMap:r(v),foldl:e(g),foldr:e(y),length:R,toJSArray:$,fromJSArray:J}}(),Yr=(Qr.append,Qr.length,Qr.slice,Qr.set,r(function(t,r){return m.cmp(0,t)<1&&m.cmp(t,Qr.length(r))<0?z(_(Qr.get,t,r)):H}),Qr.push),Zr=Qr.empty,te=(r(function(t,e){var n=r(function(r,e){return t(r)?_(Qr.push,r,e):e});return s(Qr.foldl,n,Qr.empty,e)}),Qr.foldr,Qr.foldl),re=(Qr.indexedMap,Qr.map,Qr.toList),ee=(Qr.fromList,Qr.initialize),ne=(r(function(t,r){return _(ee,t,w(r))}),e(function(t,r,e){for(;;){var n=e;if("RBEmpty_elm_builtin"===n.ctor)return r;var o=t,c=s(t,n._1,n._2,s(ne,t,r,n._4)),u=n._3;t=o,r=c,e=u}})),oe=function(t){return s(ne,e(function(t,r,e){return{ctor:"::",_0:t,_1:e}}),{ctor:"[]"},t)},ce=function(t){return s(ne,e(function(t,r,e){return{ctor:"::",_0:r,_1:e}}),{ctor:"[]"},t)},ue=function(t){return s(ne,e(function(t,r,e){return{ctor:"::",_0:{ctor:"_Tuple2",_0:t,_1:r},_1:e}}),{ctor:"[]"},t)},ie=e(function(t,r,e){for(;;){var n=e;if("RBEmpty_elm_builtin"===n.ctor)return r;var o=t,c=s(t,n._1,n._2,s(ie,t,r,n._3)),u=n._4;t=o,r=c,e=u}}),ae=c(function(t,n,o,c,u,i){var a=e(function(r,e,c){for(;;){var u=c,i=u._1,a=u._0,_=a;if("[]"===_.ctor)return{ctor:"_Tuple2",_0:a,_1:s(o,r,e,i)};var l=_._1,d=_._0._1,p=_._0._0;if(!(m.cmp(p,r)<0))return m.cmp(p,r)>0?{ctor:"_Tuple2",_0:a,_1:s(o,r,e,i)}:{ctor:"_Tuple2",_0:l,_1:f(n,p,d,e,i)};var h=r,v=e,g={ctor:"_Tuple2",_0:l,_1:s(t,p,d,i)};r=h,e=v,c=g}}),_=s(ie,a,{ctor:"_Tuple2",_0:ue(c),_1:i},u),l=_._0,d=_._1;return s(ut,r(function(r,e){var n=r;return s(t,n._0,n._1,e)}),d,l)}),_e=n(function(t,r,e,n){return $.crash(mr({ctor:"::",_0:"Internal red-black tree invariant violated, expected ",_1:{ctor:"::",_0:t,_1:{ctor:"::",_0:" and got ",_1:{ctor:"::",_0:S(r),_1:{ctor:"::",_0:"/",_1:{ctor:"::",_0:e,_1:{ctor:"::",_0:"/",_1:{ctor:"::",_0:n,_1:{ctor:"::",_0:"\nPlease report this bug to <https://github.com/elm-lang/core/issues>",_1:{ctor:"[]"}}}}}}}}}}))}),se=function(t){var r=t;t:do{if("RBNode_elm_builtin"===r.ctor){if("BBlack"===r._0.ctor)return!0;break t}if("LBBlack"===r._0.ctor)return!0;break t}while(!1);return!1},fe=r(function(t,r){for(;;){var e=r;if("RBEmpty_elm_builtin"===e.ctor)return t;var n=_(fe,t+1,e._4),o=e._3;t=n,r=o}}),le=r(function(t,r){t:for(;;){var e=r;if("RBEmpty_elm_builtin"===e.ctor)return H;var n=_(M,t,e._1);switch(n.ctor){case"LT":var o=t,c=e._3;t=o,r=c;continue t;case"EQ":return z(e._2);default:var u=t,i=e._4;t=u,r=i;continue t}}}),de=r(function(t,r){return"Just"===_(le,t,r).ctor}),pe=e(function(t,r,e){for(;;){var n=e;if("RBEmpty_elm_builtin"===n.ctor)return{ctor:"_Tuple2",_0:t,_1:r};var o=n._1,c=n._2,u=n._4;t=o,r=c,e=u}}),he={ctor:"NBlack"},ve={ctor:"BBlack"},me={ctor:"Black"},ge=function(t){var r=t;if("RBNode_elm_builtin"===r.ctor){var e=r._0;return m.eq(e,me)||m.eq(e,ve)}return!0},ye={ctor:"Red"},be=function(t){switch(t.ctor){case"Black":return ve;case"Red":return me;case"NBlack":return ye;default:return $.crash("Can't make a double black node more black!")}},we=function(t){switch(t.ctor){case"BBlack":return me;case"Black":return ye;case"Red":return he;default:return $.crash("Can't make a negative black node less black!")}},Te={ctor:"LBBlack"},ke={ctor:"LBlack"},Se=function(t){return{ctor:"RBEmpty_elm_builtin",_0:t}},xe=Se(ke),Ee=function(t){return m.eq(t,xe)},Ae=o(function(t,r,e,n,o){return{ctor:"RBNode_elm_builtin",_0:t,_1:r,_2:e,_3:n,_4:o}}),Oe=function(t){var r=t;return"RBNode_elm_builtin"===r.ctor&&"Red"===r._0.ctor?l(Ae,me,r._1,r._2,r._3,r._4):t},Ie=function(t){var r=t;return"RBNode_elm_builtin"===r.ctor?l(Ae,we(r._0),r._1,r._2,r._3,r._4):Se(ke)},Ce=function(t){return function(r){return function(e){return function(n){return function(o){return function(c){return function(u){return function(i){return function(a){return function(_){return function(s){return l(Ae,we(t),n,o,l(Ae,me,r,e,i,a),l(Ae,me,c,u,_,s))}}}}}}}}}}},qe=function(t){var r=t;return"RBEmpty_elm_builtin"===r.ctor?Se(ke):l(Ae,me,r._1,r._2,r._3,r._4)},Ne=function(t){var r=t;return"RBEmpty_elm_builtin"===r.ctor?$.crash("can't make a Leaf red"):l(Ae,ye,r._1,r._2,r._3,r._4)},Me=function(t){var r=t;t:do{r:do{e:do{n:do{o:do{c:do{u:do{if("RBNode_elm_builtin"!==r.ctor)break t;if("RBNode_elm_builtin"===r._3.ctor)if("RBNode_elm_builtin"===r._4.ctor)switch(r._3._0.ctor){case"Red":switch(r._4._0.ctor){case"Red":if("RBNode_elm_builtin"===r._3._3.ctor&&"Red"===r._3._3._0.ctor)break u;if("RBNode_elm_builtin"===r._3._4.ctor&&"Red"===r._3._4._0.ctor)break c;if("RBNode_elm_builtin"===r._4._3.ctor&&"Red"===r._4._3._0.ctor)break o;if("RBNode_elm_builtin"===r._4._4.ctor&&"Red"===r._4._4._0.ctor)break n;break t;case"NBlack":if("RBNode_elm_builtin"===r._3._3.ctor&&"Red"===r._3._3._0.ctor)break u;if("RBNode_elm_builtin"===r._3._4.ctor&&"Red"===r._3._4._0.ctor)break c;if("BBlack"===r._0.ctor&&"RBNode_elm_builtin"===r._4._3.ctor&&"Black"===r._4._3._0.ctor&&"RBNode_elm_builtin"===r._4._4.ctor&&"Black"===r._4._4._0.ctor)break e;break t;default:if("RBNode_elm_builtin"===r._3._3.ctor&&"Red"===r._3._3._0.ctor)break u;if("RBNode_elm_builtin"===r._3._4.ctor&&"Red"===r._3._4._0.ctor)break c;break t}case"NBlack":switch(r._4._0.ctor){case"Red":if("RBNode_elm_builtin"===r._4._3.ctor&&"Red"===r._4._3._0.ctor)break o;if("RBNode_elm_builtin"===r._4._4.ctor&&"Red"===r._4._4._0.ctor)break n;if("BBlack"===r._0.ctor&&"RBNode_elm_builtin"===r._3._3.ctor&&"Black"===r._3._3._0.ctor&&"RBNode_elm_builtin"===r._3._4.ctor&&"Black"===r._3._4._0.ctor)break r;break t;case"NBlack":if("BBlack"===r._0.ctor){if("RBNode_elm_builtin"===r._4._3.ctor&&"Black"===r._4._3._0.ctor&&"RBNode_elm_builtin"===r._4._4.ctor&&"Black"===r._4._4._0.ctor)break e;if("RBNode_elm_builtin"===r._3._3.ctor&&"Black"===r._3._3._0.ctor&&"RBNode_elm_builtin"===r._3._4.ctor&&"Black"===r._3._4._0.ctor)break r;break t}break t;default:if("BBlack"===r._0.ctor&&"RBNode_elm_builtin"===r._3._3.ctor&&"Black"===r._3._3._0.ctor&&"RBNode_elm_builtin"===r._3._4.ctor&&"Black"===r._3._4._0.ctor)break r;break t}default:switch(r._4._0.ctor){case"Red":if("RBNode_elm_builtin"===r._4._3.ctor&&"Red"===r._4._3._0.ctor)break o;if("RBNode_elm_builtin"===r._4._4.ctor&&"Red"===r._4._4._0.ctor)break n;break t;case"NBlack":if("BBlack"===r._0.ctor&&"RBNode_elm_builtin"===r._4._3.ctor&&"Black"===r._4._3._0.ctor&&"RBNode_elm_builtin"===r._4._4.ctor&&"Black"===r._4._4._0.ctor)break e;break t;default:break t}}else switch(r._3._0.ctor){case"Red":if("RBNode_elm_builtin"===r._3._3.ctor&&"Red"===r._3._3._0.ctor)break u;if("RBNode_elm_builtin"===r._3._4.ctor&&"Red"===r._3._4._0.ctor)break c;break t;case"NBlack":if("BBlack"===r._0.ctor&&"RBNode_elm_builtin"===r._3._3.ctor&&"Black"===r._3._3._0.ctor&&"RBNode_elm_builtin"===r._3._4.ctor&&"Black"===r._3._4._0.ctor)break r;break t;default:break t}else{if("RBNode_elm_builtin"!==r._4.ctor)break t;switch(r._4._0.ctor){case"Red":if("RBNode_elm_builtin"===r._4._3.ctor&&"Red"===r._4._3._0.ctor)break o;if("RBNode_elm_builtin"===r._4._4.ctor&&"Red"===r._4._4._0.ctor)break n;break t;case"NBlack":if("BBlack"===r._0.ctor&&"RBNode_elm_builtin"===r._4._3.ctor&&"Black"===r._4._3._0.ctor&&"RBNode_elm_builtin"===r._4._4.ctor&&"Black"===r._4._4._0.ctor)break e;break t;default:break t}}}while(!1);return Ce(r._0)(r._3._3._1)(r._3._3._2)(r._3._1)(r._3._2)(r._1)(r._2)(r._3._3._3)(r._3._3._4)(r._3._4)(r._4)}while(!1);return Ce(r._0)(r._3._1)(r._3._2)(r._3._4._1)(r._3._4._2)(r._1)(r._2)(r._3._3)(r._3._4._3)(r._3._4._4)(r._4)}while(!1);return Ce(r._0)(r._1)(r._2)(r._4._3._1)(r._4._3._2)(r._4._1)(r._4._2)(r._3)(r._4._3._3)(r._4._3._4)(r._4._4)}while(!1);return Ce(r._0)(r._1)(r._2)(r._4._1)(r._4._2)(r._4._4._1)(r._4._4._2)(r._3)(r._4._3)(r._4._4._3)(r._4._4._4)}while(!1);return l(Ae,me,r._4._3._1,r._4._3._2,l(Ae,me,r._1,r._2,r._3,r._4._3._3),l(je,me,r._4._1,r._4._2,r._4._3._4,Ne(r._4._4)))}while(!1);return l(Ae,me,r._3._4._1,r._3._4._2,l(je,me,r._3._1,r._3._2,Ne(r._3._3),r._3._4._3),l(Ae,me,r._1,r._2,r._3._4._4,r._4))}while(!1);return t},je=o(function(t,r,e,n,o){var c=l(Ae,t,r,e,n,o);return ge(c)?Me(c):c}),De=o(function(t,r,e,n,o){return se(n)||se(o)?l(je,be(t),r,e,Ie(n),Ie(o)):l(Ae,t,r,e,n,o)}),Re=o(function(t,r,e,n,o){var c=o;return"RBEmpty_elm_builtin"===c.ctor?s(Be,t,n,o):l(De,t,r,e,n,l(Re,c._0,c._1,c._2,c._3,c._4))}),Be=e(function(t,r,e){var n={ctor:"_Tuple2",_0:r,_1:e};if("RBEmpty_elm_builtin"!==n._0.ctor){if("RBEmpty_elm_builtin"===n._1.ctor){var o=n._1._0,c=n._0._0,u={ctor:"_Tuple3",_0:t,_1:c,_2:o};return"_Tuple3"===u.ctor&&"Black"===u._0.ctor&&"Red"===u._1.ctor&&"LBlack"===u._2.ctor?l(Ae,me,n._0._1,n._0._2,n._0._3,n._0._4):f(_e,"Black/Red/LBlack",t,S(c),S(o))}var i=n._0._2,a=n._0._4,_=n._0._1,d=l(Re,n._0._0,_,i,n._0._3,a),p=s(pe,_,i,a),h=p._0,v=p._1;return l(De,t,h,v,d,e)}if("RBEmpty_elm_builtin"!==n._1.ctor){var m=n._1._0,g=n._0._0,y={ctor:"_Tuple3",_0:t,_1:g,_2:m};return"_Tuple3"===y.ctor&&"Black"===y._0.ctor&&"LBlack"===y._1.ctor&&"Red"===y._2.ctor?l(Ae,me,n._1._1,n._1._2,n._1._3,n._1._4):f(_e,"Black/LBlack/Red",t,S(g),S(m))}switch(t.ctor){case"Red":return Se(ke);case"Black":return Se(Te);default:return $.crash("cannot have bblack or nblack nodes at this point")}}),Le=r(function(t,r){var e=r;if("RBEmpty_elm_builtin"===e.ctor)return Se(ke);var n=e._1;return l(Ae,e._0,n,_(t,n,e._2),_(Le,t,e._3),_(Le,t,e._4))}),Pe={ctor:"Same"},Fe={ctor:"Remove"},$e={ctor:"Insert"},Ue=e(function(t,r,e){var n=function(e){var o=e;if("RBEmpty_elm_builtin"===o.ctor){var c=r(H);return"Nothing"===c.ctor?{ctor:"_Tuple2",_0:Pe,_1:xe}:{ctor:"_Tuple2",_0:$e,_1:l(Ae,ye,t,c._0,xe,xe)}}var u=o._2,i=o._4,a=o._3,f=o._1,d=o._0;switch(_(M,t,f).ctor){case"EQ":var p=r(z(u));return"Nothing"===p.ctor?{ctor:"_Tuple2",_0:Fe,_1:s(Be,d,a,i)}:{ctor:"_Tuple2",_0:Pe,_1:l(Ae,d,f,p._0,a,i)};case"LT":var h=n(a),v=h._0,m=h._1;switch(v.ctor){case"Same":return{ctor:"_Tuple2",_0:Pe,_1:l(Ae,d,f,u,m,i)};case"Insert":return{ctor:"_Tuple2",_0:$e,_1:l(je,d,f,u,m,i)};default:return{ctor:"_Tuple2",_0:Fe,_1:l(De,d,f,u,m,i)}}default:var g=n(i),v=g._0,y=g._1;switch(v.ctor){case"Same":return{ctor:"_Tuple2",_0:Pe,_1:l(Ae,d,f,u,a,y)};case"Insert":return{ctor:"_Tuple2",_0:$e,_1:l(je,d,f,u,a,y)};default:return{ctor:"_Tuple2",_0:Fe,_1:l(De,d,f,u,a,y)}}}},o=n(e),c=o._0,u=o._1;switch(c.ctor){case"Same":return u;case"Insert":return Oe(u);default:return qe(u)}}),Je=e(function(t,r,e){return s(Ue,t,w(z(r)),e)}),He=r(function(t,r){return s(Je,t,r,xe)}),Ve=r(function(t,r){return s(ie,Je,r,t)}),ze=r(function(t,r){var n=e(function(r,e,n){return _(t,r,e)?s(Je,r,e,n):n});return s(ie,n,xe,r)}),We=r(function(t,e){return _(ze,r(function(t,r){return _(de,t,e)}),t)}),Ge=r(function(t,r){var n=e(function(r,e,n){var o=n,c=o._1,u=o._0;return _(t,r,e)?{ctor:"_Tuple2",_0:s(Je,r,e,u),_1:c}:{ctor:"_Tuple2",_0:u,_1:s(Je,r,e,c)}});return s(ie,n,{ctor:"_Tuple2",_0:xe,_1:xe},r)}),Ke=function(t){return s(ut,r(function(t,r){var e=t;return s(Je,e._0,e._1,r)}),xe,t)},Xe=r(function(t,r){return s(Ue,t,w(H),r)}),Qe=r(function(t,r){return s(ie,e(function(t,r,e){return _(Xe,t,e)}),t,r)}),Ye=function(){function t(t){return{ctor:"<decoder>",tag:"succeed",msg:t}}function _(t){return{ctor:"<decoder>",tag:"fail",msg:t}}function s(t){return{ctor:"<decoder>",tag:t}}function f(t,r){return{ctor:"<decoder>",tag:t,decoder:r}}function l(t){return{ctor:"<decoder>",tag:"null",value:t}}function d(t,r){return{ctor:"<decoder>",tag:"field",field:t,decoder:r}}function p(t,r){return{ctor:"<decoder>",tag:"index",index:t,decoder:r}}function h(t){return{ctor:"<decoder>",tag:"key-value",decoder:t}}function v(t,r){return{ctor:"<decoder>",tag:"map-many",func:t,decoders:r}}function g(t,r){return{ctor:"<decoder>",tag:"andThen",decoder:r,callback:t}}function y(t){return{ctor:"<decoder>",tag:"oneOf",decoders:t}}function b(t,r){return v(t,[r])}function w(t,r,e){return v(t,[r,e])}function T(t,r,e,n){return v(t,[r,e,n])}function k(t,r,e,n,o){return v(t,[r,e,n,o])}function S(t,r,e,n,o,c){return v(t,[r,e,n,o,c])}function x(t,r,e,n,o,c,u){return v(t,[r,e,n,o,c,u])}function E(t,r,e,n,o,c,u,i){return v(t,[r,e,n,o,c,u,i])}function A(t,r,e,n,o,c,u,i,a){return v(t,[r,e,n,o,c,u,i,a])}function O(t){return{tag:"ok",value:t}}function I(t,r){return{tag:"primitive",type:t,value:r}}function C(t,r){return{tag:"index",index:t,rest:r}}function q(t,r){return{tag:"field",field:t,rest:r}}function C(t,r){return{tag:"index",index:t,rest:r}}function N(t){return{tag:"oneOf",problems:t}}function M(t){return{tag:"fail",msg:t}}function j(t){for(var r="_";t;)switch(t.tag){case"primitive":return"Expecting "+t.type+("_"===r?"":" at "+r)+" but instead got: "+D(t.value);case"index":r+="["+t.index+"]",t=t.rest;break;case"field":r+="."+t.field,t=t.rest;break;case"oneOf":for(var e=t.problems,n=0;n<e.length;n++)e[n]=j(e[n]);return"I ran into the following problems"+("_"===r?"":" at "+r)+":\n\n"+e.join("\n");case"fail":return"I ran into a `fail` decoder"+("_"===r?"":" at "+r)+": "+t.msg}}function D(t){return void 0===t?"undefined":JSON.stringify(t)}function R(t,r){var e;try{e=JSON.parse(r)}catch(t){return Dt("Given an invalid JSON: "+t.message)}return B(t,e)}function B(t,r){var e=L(t,r);return"ok"===e.tag?Bt(e.value):Dt(j(e))}function L(t,r){switch(t.tag){case"bool":return"boolean"==typeof r?O(r):I("a Bool",r);case"int":return"number"!=typeof r?I("an Int",r):-2147483647<r&&r<2147483647&&(0|r)===r?O(r):!isFinite(r)||r%1?I("an Int",r):O(r);case"float":return"number"==typeof r?O(r):I("a Float",r);case"string":return"string"==typeof r?O(r):r instanceof String?O(r+""):I("a String",r);case"null":return null===r?O(t.value):I("null",r);case"value":return O(r);case"list":if(!(r instanceof Array))return I("a List",r);for(var e=K.Nil,n=r.length;n--;){var o=L(t.decoder,r[n]);if("ok"!==o.tag)return C(n,o);e=K.Cons(o.value,e)}return O(e);case"array":if(!(r instanceof Array))return I("an Array",r);for(var c=r.length,u=new Array(c),n=c;n--;){var o=L(t.decoder,r[n]);if("ok"!==o.tag)return C(n,o);u[n]=o.value}return O(Qr.fromJSArray(u));case"maybe":var o=L(t.decoder,r);return O("ok"===o.tag?z(o.value):H);case"field":var i=t.field;if("object"!=typeof r||null===r||!(i in r))return I("an object with a field named `"+i+"`",r);var o=L(t.decoder,r[i]);return"ok"===o.tag?o:q(i,o);case"index":var a=t.index;if(!(r instanceof Array))return I("an array",r);if(a>=r.length)return I("a longer array. Need index "+a+" but there are only "+r.length+" entries",r);var o=L(t.decoder,r[a]);return"ok"===o.tag?o:C(a,o);case"key-value":if("object"!=typeof r||null===r||r instanceof Array)return I("an object",r);var _=K.Nil;for(var s in r){var o=L(t.decoder,r[s]);if("ok"!==o.tag)return q(s,o);var f=m.Tuple2(s,o.value);_=K.Cons(f,_)}return O(_);case"map-many":for(var l=t.func,d=t.decoders,n=0;n<d.length;n++){var o=L(d[n],r);if("ok"!==o.tag)return o;l=l(o.value)}return O(l);case"andThen":var o=L(t.decoder,r);return"ok"!==o.tag?o:L(t.callback(o.value),r);case"oneOf":for(var p=[],h=t.decoders;"[]"!==h.ctor;){var o=L(h._0,r);if("ok"===o.tag)return o;p.push(o),h=h._1}return N(p);case"fail":return M(t.msg);case"succeed":return O(t.msg)}}function P(t,r){if(t===r)return!0;if(t.tag!==r.tag)return!1;switch(t.tag){case"succeed":case"fail":return t.msg===r.msg;case"bool":case"int":case"float":case"string":case"value":return!0;case"null":return t.value===r.value;case"list":case"array":case"maybe":case"key-value":return P(t.decoder,r.decoder);case"field":return t.field===r.field&&P(t.decoder,r.decoder);case"index":return t.index===r.index&&P(t.decoder,r.decoder);case"map-many":return t.func===r.func&&F(t.decoders,r.decoders);case"andThen":return t.callback===r.callback&&P(t.decoder,r.decoder);case"oneOf":return F(t.decoders,r.decoders)}}function F(t,r){var e=t.length;if(e!==r.length)return!1;for(var n=0;n<e;n++)if(!P(t[n],r[n]))return!1;return!0}function $(t,r){return JSON.stringify(r,null,t)}function U(t){return t}function J(t){for(var r={};"[]"!==t.ctor;){var e=t._0;r[e._0]=e._1,t=t._1}return r}return{encode:r($),runOnString:r(R),run:r(B),decodeNull:l,decodePrimitive:s,decodeContainer:r(f),decodeField:r(d),decodeIndex:r(p),map1:r(b),map2:e(w),map3:n(T),map4:o(k),map5:c(S),map6:u(x),map7:i(E),map8:a(A),decodeKeyValuePairs:h,andThen:r(g),fail:_,succeed:t,oneOf:y,identity:U,encodeNull:null,encodeArray:Qr.toJSArray,encodeList:K.toArray,encodeObject:J,equality:P}}(),Ze=(Ye.encodeList,Ye.encodeArray,Ye.encodeObject),tn=Ye.encodeNull,rn=Ye.identity,en=Ye.identity,nn=Ye.identity,on=Ye.identity,cn=(Ye.encode,Ye.decodeNull),un=Ye.decodePrimitive("value"),an=Ye.andThen,_n=Ye.fail,sn=Ye.succeed,fn=Ye.run,ln=Ye.runOnString,dn=(Ye.map8,Ye.map7,Ye.map6,Ye.map5,Ye.map4),pn=Ye.map3,hn=Ye.map2,vn=Ye.map1,mn=Ye.oneOf,gn=Ye.decodeIndex,yn=Ye.decodeField,bn=r(function(t,r){return s(ct,yn,r,t)}),wn=(Ye.decodeKeyValuePairs,function(t){return _(Ye.decodeContainer,"list",t)}),Tn=Ye.decodePrimitive("float"),kn=Ye.decodePrimitive("int"),Sn=Ye.decodePrimitive("bool"),xn=Ye.decodePrimitive("string"),En=sn,An=(an(T),hn(r(function(t,r){return r(t)}))),On=e(function(t,r,e){var n=function(t){return mn({ctor:"::",_0:t,_1:{ctor:"::",_0:cn(e),_1:{ctor:"[]"}}})};return _(an,function(o){var c=_(fn,t,o);if("Ok"===c.ctor){var u=_(fn,n(r),c._0);return"Ok"===u.ctor?sn(u._0):_n(u._0)}return sn(e)},un)}),In=(n(function(t,r,e,n){return _(An,s(On,_(bn,t,un),r,e),n)}),n(function(t,r,e,n){return _(An,s(On,_(yn,t,un),r,e),n)})),Cn=(e(function(t,r,e){return _(An,_(bn,t,r),e)}),e(function(t,r,e){return _(An,_(yn,t,r),e)})),qn=function(){return{and:r(function(t,r){return t&r}),or:r(function(t,r){return t|r}),xor:r(function(t,r){return t^r}),complement:function(t){return~t},shiftLeftBy:r(function(t,r){return r<<t}),shiftRightBy:r(function(t,r){return r>>t}),shiftRightZfBy:r(function(t,r){return r>>>t})}}(),Nn=(qn.shiftRightZfBy,qn.shiftRightBy,qn.shiftLeftBy,qn.complement,qn.xor,qn.or,qn.and,r(function(t,r){return{locale:t,includeSeconds:r}}),function(t){return{ctor:"AlmostXYears",_0:t}}),Mn=function(t){return{ctor:"OverXYears",_0:t}},jn=function(t){return{ctor:"AboutXYears",_0:t}},Dn=function(t){return{ctor:"XMonths",_0:t}},Rn=function(t){return{ctor:"AboutXMonths",_0:t}},Bn=function(t){return{ctor:"XDays",_0:t}},Ln=function(t){return{ctor:"AboutXHours",_0:t}},Pn=function(t){return{ctor:"XMinutes",_0:t}},Fn=function(t){return{ctor:"LessThanXMinutes",_0:t}},$n={ctor:"HalfAMinute"},Un=function(t){return{ctor:"LessThanXSeconds",_0:t}},Jn=function(){function t(t){var r=new Date(t);return isNaN(r.getTime())?Dt("Unable to parse '"+t+"' as a date. Dates must be in the ISO 8601 format."):Bt(r)}var r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return{fromString:t,year:function(t){return t.getFullYear()},month:function(t){return{ctor:e[t.getMonth()]}},day:function(t){return t.getDate()},hour:function(t){return t.getHours()},minute:function(t){return t.getMinutes()},second:function(t){return t.getSeconds()},millisecond:function(t){return t.getMilliseconds()},toTime:function(t){return t.getTime()},fromTime:function(t){return new Date(t)},dayOfWeek:function(t){return{ctor:r[t.getDay()]}}}}(),Hn=Or.onError,Vn=Or.andThen,zn=r(function(t,r){var e=r;return Or.spawn(_(Vn,Br(t),e._0))}),Wn=Or.fail,Gn=(r(function(t,r){return _(Hn,function(r){return Wn(t(r))},r)}),Or.succeed),Kn=r(function(t,r){return _(Vn,function(r){return Gn(t(r))},r)}),Xn=e(function(t,r,e){return _(Vn,function(r){return _(Vn,function(e){return Gn(_(t,r,e))},e)},r)}),Qn=(n(function(t,r,e,n){return _(Vn,function(r){return _(Vn,function(e){return _(Vn,function(n){return Gn(s(t,r,e,n))},n)},e)},r)}),o(function(t,r,e,n,o){return _(Vn,function(r){return _(Vn,function(e){return _(Vn,function(n){return _(Vn,function(o){return Gn(f(t,r,e,n,o))},o)},n)},e)},r)}),c(function(t,r,e,n,o,c){return _(Vn,function(r){return _(Vn,function(e){return _(Vn,function(n){return _(Vn,function(o){return _(Vn,function(c){return Gn(l(t,r,e,n,o,c))},c)},o)},n)},e)},r)}),function(t){var e=t;return"[]"===e.ctor?Gn({ctor:"[]"}):s(Xn,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),e._0,Qn(e._1))}),Yn=e(function(t,r,e){return _(Kn,function(t){return{ctor:"_Tuple0"}},Qn(_(pt,zn(t),r)))}),Zn=Gn({ctor:"_Tuple0"}),to=e(function(t,r,e){return Gn({ctor:"_Tuple0"})}),ro=Ar.leaf("Task"),eo=function(t){return{ctor:"Perform",_0:t}},no=r(function(t,r){return ro(eo(_(Kn,t,r)))}),oo=r(function(t,r){return ro(eo(_(Hn,function(r){return Gn(t(Dt(r)))},_(Vn,function(r){return Gn(t(Bt(r)))},r))))}),co=r(function(t,r){return eo(_(Kn,t,r._0))});Ar.effectManagers.Task={pkg:"elm-lang/core",init:Zn,onEffects:Yn,onSelfMsg:to,tag:"cmd",cmdMap:co};var uo=function(){function t(t,r){return Or.nativeBinding(function(e){var n=setInterval(function(){Or.rawSpawn(r)},t);return function(){clearInterval(n)}})}return{now:Or.nativeBinding(function(t){t(Or.succeed(Date.now()))}),setInterval_:r(t)}}(),io=uo.setInterval_,ao=e(function(t,r,e){var n=r;if("[]"===n.ctor)return Gn(e);var o=n._0,c=function(r){return s(ao,t,n._1,s(Je,o,r,e))},u=Or.spawn(_(io,o,_(Rr,t,o)));return _(Vn,c,u)}),_o=r(function(t,r){var e=t,n=e._1,o=e._0,c=_(le,o,r);return"Nothing"===c.ctor?s(Je,o,{ctor:"::",_0:n,_1:{ctor:"[]"}},r):s(Je,o,{ctor:"::",_0:n,_1:c._0},r)}),so=uo.now,fo=e(function(t,r,e){var n=_(le,r,e.taggers);if("Nothing"===n.ctor)return Gn(e);var o=function(r){return Qn(_(pt,function(e){return _(Br,t,e(r))},n._0))};return _(Vn,function(t){return Gn(e)},_(Vn,o,so))}),lo=Ar.leaf("Time"),po=r(function(t,r){return{taggers:t,processes:r}}),ho=Gn(_(po,xe,xe)),vo=e(function(t,r,o){var c=o,u=e(function(t,r,e){var n=e;return{ctor:"_Tuple3",_0:n._0,_1:n._1,_2:_(Vn,function(t){return n._2},Or.kill(r))}}),i=n(function(t,r,e,n){var o=n;return{ctor:"_Tuple3",_0:o._0,_1:s(Je,t,e,o._1),_2:o._2}}),a=e(function(t,r,e){var n=e;return{ctor:"_Tuple3",_0:{ctor:"::",_0:t,_1:n._0},_1:n._1,_2:n._2}}),f=s(ut,_o,xe,r),l=d(ae,a,i,u,f,c.processes,{ctor:"_Tuple3",_0:{ctor:"[]"},_1:xe,_2:Gn({ctor:"_Tuple0"})}),p=l._0,h=l._1,v=l._2;return _(Vn,function(t){return Gn(_(po,f,t))},_(Vn,function(r){return s(ao,t,p,h)},v))}),mo=r(function(t,r){return{ctor:"Every",_0:t,_1:r}}),go=r(function(t,r){return lo(_(mo,t,r))}),yo=r(function(t,r){var e=r;return _(mo,e._0,function(r){return t(e._1(r))})});Ar.effectManagers.Time={pkg:"elm-lang/core",init:ho,onEffects:vo,onSelfMsg:fo,tag:"sub",subMap:yo};var bo=Jn.millisecond,wo=Jn.second,To=Jn.minute,ko=Jn.hour,So=Jn.dayOfWeek,xo=Jn.day,Eo=Jn.month,Ao=Jn.year,Oo=Jn.fromTime,Io=Jn.toTime,Co=Jn.fromString,qo=(_(Kn,Oo,so),{ctor:"Sun"}),No={ctor:"Sat"},Mo={ctor:"Fri"},jo={ctor:"Thu"},Do={ctor:"Wed"},Ro={ctor:"Tue"},Bo={ctor:"Mon"},Lo={ctor:"Dec"},Po={ctor:"Nov"},Fo={ctor:"Oct"},$o={ctor:"Sep"},Uo={ctor:"Aug"},Jo={ctor:"Jul"},Ho={ctor:"Jun"},Vo={ctor:"May"},zo={ctor:"Apr"},Wo={ctor:"Mar"},Go={ctor:"Feb"},Ko={ctor:"Jan"},Xo=function(t){switch(t.ctor){case"Mon":return 1;case"Tue":return 2;case"Wed":return 3;case"Thu":return 4;case"Fri":return 5;case"Sat":return 6;default:return 7}},Qo=function(t){switch(t){case 1:return Ko;case 2:return Go;case 3:return Wo;case 4:return zo;case 5:return Vo;case 6:return Ho;case 7:return Jo;case 8:return Uo;case 9:return $o;case 10:return Fo;case 11:return Po;default:return Lo}},Yo=function(t){switch(t.ctor){case"Jan":return 1;case"Feb":return 2;case"Mar":return 3;case"Apr":return 4;case"May":return 5;case"Jun":return 6;case"Jul":return 7;case"Aug":return 8;case"Sep":return 9;case"Oct":return 10;case"Nov":return 11;default:return 12}},Zo=function(t){return m.eq(_(k["%"],t,4),0)&&!m.eq(_(k["%"],t,100),0)||m.eq(_(k["%"],t,400),0)},tc=r(function(t,r){switch(r.ctor){case"Jan":return 31;case"Feb":return Zo(t)?29:28;case"Mar":return 31;case"Apr":return 30;case"May":return 31;case"Jun":return 30;case"Jul":case"Aug":return 31;case"Sep":return 30;case"Oct":return 31;case"Nov":return 30;default:return 31}}),rc=r(function(t,r){switch(r.ctor){case"Jan":return 0;case"Feb":return 31;case"Mar":return Zo(t)?60:59;case"Apr":return Zo(t)?91:90;case"May":return Zo(t)?121:120;case"Jun":return Zo(t)?152:151;case"Jul":return Zo(t)?182:181;case"Aug":return Zo(t)?213:212;case"Sep":return Zo(t)?244:243;case"Oct":return Zo(t)?274:273;case"Nov":return Zo(t)?305:304;default:return Zo(t)?335:334}}),ec=function(t){return 864e5*(t-719163)},nc=function(t){var r=_(k["%"],t,7);return 0===r?7:r},oc=function(t){return(t/4|0)-(t/100|0)+(t/400|0)},cc=function(t){return 365*(t-1)+oc(t-1)},uc=r(function(t,r){return cc(t)+r}),ic=function(t){var r=_(uc,t,4);return r-nc(r)+1},ac=e(function(t,r,e){return ic(t)-1+7*(r-1)+e}),_c=e(function(t,r,e){var n=_(rc,t,r);return cc(t)+n+e}),sc=r(function(t,r){return{ctor:"_Tuple2",_0:t/r|0,_1:_(B,t,r)}}),fc=function(t){var r=_(sc,t,146097),e=r._0,n=r._1,o=_(sc,n,36524),c=o._0,u=o._1,i=_(sc,u,1461),a=i._0,s=i._1,f=_(sc,s,365),l=f._0,d=f._1;return 400*e+100*c+4*a+l+(m.eq(d,0)?0:1)},lc=function(t){var r=4-nc(t);return fc(t+r)},dc=function(t){return 1+((t-ic(lc(t)))/7|0)},pc=(r(function(t,r){for(;;){var e=r;if("[]"===e.ctor)return H;var n=e._0;if(t(n))return z(n);var o=t,c=e._1;t=o,r=c}}),e(function(t,r,e){return dc(s(_c,t,r,e))})),hc=e(function(t,r,e){return lc(s(_c,t,r,e))}),vc=r(function(t,r){return ec(_(uc,t,r))}),mc=e(function(t,r,e){return ec(s(ac,t,r,e))}),gc=e(function(t,r,e){return ec(s(_c,t,r,e))}),yc=n(function(t,r,e,n){return n+1e3*e+6e4*r+36e5*t}),bc=u(function(t,r,e,n,o,c,u){return ec(s(_c,t,r,e))+f(yc,n,o,c,u)}),wc=function(t){var r=Io(t),e=x(p(bc,Ao(t),Eo(t),xo(t),ko(t),To(t),wo(t),bo(t)));return A(e-r)},Tc=function(t){return wc(t)/6e4|0},kc=function(t){return s(hc,Ao(t),Eo(t),xo(t))},Sc=function(t){return s(pc,Ao(t),Eo(t),xo(t))},xc=function(t){return Xo(So(t))},Ec=function(t){var r=f(yc,ko(t),To(t),wo(t),bo(t));return x(r)/x(864e5)},Ac=function(t){return _(rc,Ao(t),Eo(t))+xo(t)},Oc=function(t){return Yo(Eo(t))},Ic=function(t){return E(function(t){return t/3}(x(Oc(t))))},Cc=function(){function t(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function o(t){return new RegExp(t.source,"gi")}function c(t){return new RegExp(t,"g")}function u(t,r){return null!==r.match(t)}function i(t,r,e){t="All"===t.ctor?1/0:t._0;for(var n,o=[],c=0,u=e,i=r.lastIndex,a=-1;c++<t&&(n=r.exec(u))&&a!==r.lastIndex;){for(var _=n.length-1,s=new Array(_);_>0;){var f=n[_];s[--_]=void 0===f?H:z(f)}o.push({match:n[0],submatches:K.fromArray(s),index:n.index,number:c}),a=r.lastIndex}return r.lastIndex=i,K.fromArray(o)}function a(t,r,e,n){function o(r){if(c++>=t)return r;for(var n=arguments.length-3,o=new Array(n);n>0;){var u=arguments[n];o[--n]=void 0===u?H:z(u)}return e({match:r,submatches:K.fromArray(o),index:arguments[arguments.length-2],number:c})}t="All"===t.ctor?1/0:t._0;var c=0;return n.replace(r,o)}function _(t,r,e){if((t="All"===t.ctor?1/0:t._0)===1/0)return K.fromArray(e.split(r));for(var n,o=e,c=[],u=r.lastIndex,i=r.lastIndex;t--&&(n=r.exec(o));)c.push(o.slice(u,n.index)),u=r.lastIndex;return c.push(o.slice(u)),r.lastIndex=i,K.fromArray(c)}return{regex:c,caseInsensitive:o,escape:t,contains:r(u),find:e(i),replace:n(a),split:e(_)}}(),qc=Cc.split,Nc=Cc.replace,Mc=Cc.find,jc=Cc.contains,Dc=(Cc.caseInsensitive,Cc.regex),Rc=Cc.escape,Bc=(n(function(t,r,e,n){return{match:t,submatches:r,index:e,number:n}}),function(t){return{ctor:"AtMost",_0:t}}),Lc={ctor:"All"},Pc=function(t){return Oo(Io(t)-x(6e4*Tc(t)))},Fc=function(t){switch(t){case 1:case 2:case 3:return"abbreviated";case 4:return"full";case 5:return"narrow";case 6:return"short";default:return"invalid"}},$c=Dc("([yYQMwdDEeabhHmsSXx])\\1*|'(?:[^']|'')*?'(?!')"),Uc=e(function(t,r,e){var n=s(ur,2,m.chr("0"),S(_(k["%"],D(e),60))),o=s(ur,2,m.chr("0"),S(D(e)/60|0)),c=m.cmp(e,0)>-1?"+":"-";return r&&m.eq(n,"00")?_(k["++"],c,o):_(k["++"],c,_(k["++"],o,_(k["++"],t,n)))}),Jc=function(t){var r=_(k["%"],t,100);switch(_(N,m.cmp(r,20)<0?r:_(k["%"],r,10),4)){case 0:return"th";case 1:return"st";case 2:return"nd";case 3:return"rd";case 4:return"th";default:return""}},Hc=function(t){return _(k["++"],S(t),Jc(t))},Vc=function(t){var r=_(k["%"],ko(t),12);return 0===r?12:r},zc=function(t){switch(t.ctor){case"Mon":return"Monday";case"Tue":return"Tuesday";case"Wed":return"Wednesday";case"Thu":return"Thursday";case"Fri":return"Friday";case"Sat":return"Saturday";default:return"Sunday"}},Wc=function(t){switch(t.ctor){case"Jan":return"January";case"Feb":return"February";case"Mar":return"March";case"Apr":return"April";case"May":return"May";case"Jun":return"June";case"Jul":return"July";case"Aug":return"August";case"Sep":return"September";case"Oct":return"October";case"Nov":return"November";default:return"December"}},Gc={ctor:"PM"},Kc={ctor:"Noon"},Xc={ctor:"AM"},Qc={ctor:"Midnight"},Yc=function(t){var r=m.eq(To(t),0)&&m.eq(wo(t),0)&&m.eq(bo(t),0),e=ko(t);return m.eq(e,0)&&r?Qc:m.cmp(e,12)<0?Xc:m.eq(e,12)&&r?Kc:Gc},Zc=e(function(t,e,n){t:for(;;){var o=vr(n),c=_(sr,1,n),u=c;switch(u){case"y":var i=o;return 2===i?_(_r,2,s(ur,o,m.chr("0"),S(Ao(e)))):s(ur,o,m.chr("0"),S(Ao(e)));case"Y":var a=o;return 2===a?_(_r,2,s(ur,o,m.chr("0"),S(kc(e)))):s(ur,o,m.chr("0"),S(kc(e)));case"Q":var l=o;switch(l){case 1:case 2:return S(Ic(e));case 3:return _(r(function(t,r){return _(k["++"],t,r)}),"Q",S(Ic(e)));case 4:return Hc(Ic(e));case 5:return S(Ic(e));default:return""}case"M":var d=o;switch(d){case 1:return S(Oc(e));case 2:return s(ur,2,m.chr("0"),S(Oc(e)));case 3:return _(sr,3,Wc(Eo(e)));case 4:return Wc(Eo(e));case 5:return _(sr,1,Wc(Eo(e)));default:return""}case"w":var p=o;switch(p){case 1:return S(Sc(e));case 2:return s(ur,2,m.chr("0"),S(Sc(e)));default:return""}case"d":var h=o;switch(h){case 1:return S(xo(e));case 2:return s(ur,2,m.chr("0"),S(xo(e)));case 3:return Hc(xo(e));default:return""}case"D":var v=o;switch(v){case 1:return S(Ac(e));case 2:return s(ur,2,m.chr("0"),S(Ac(e)));case 3:return s(ur,3,m.chr("0"),S(Ac(e)));default:return""}case"E":var g=Fc(o);switch(g){case"abbreviated":return _(sr,3,zc(So(e)));case"full":return zc(So(e));case"narrow":return _(sr,1,zc(So(e)));case"short":return _(sr,2,zc(So(e)));default:return""}case"e":var y=o;switch(y){case 1:case 2:return S(xc(e));default:var b=t,w=e,T=rr(n);t=b,e=w,n=T;continue t}case"a":var x=Yc(e),E=m.eq(x,Qc)||m.eq(x,Xc)?"A":"P",A=Fc(o);switch(A){case"abbreviated":return _(k["++"],E,"M");case"full":return _(k["++"],E,".M.");case"narrow":return E;default:return""}case"b":var O=Fc(o);switch(O){case"abbreviated":var I=Yc(e);switch(I.ctor){case"Midnight":return"mid.";case"AM":return"am";case"Noon":return"noon";default:return"pm"}case"full":var C=Yc(e);switch(C.ctor){case"Midnight":return"midnight";case"AM":return"a.m.";case"Noon":return"noon";default:return"p.m."}case"narrow":var q=Yc(e);switch(q.ctor){case"Midnight":return"md";case"AM":return"a";case"Noon":return"nn";default:return"p"}default:return""}case"h":var N=o;switch(N){case 1:return S(Vc(e));case 2:return s(ur,2,m.chr("0"),S(Vc(e)));default:return""}case"H":var M=o;switch(M){case 1:return S(ko(e));case 2:return s(ur,2,m.chr("0"),S(ko(e)));default:return""}case"m":var j=o;switch(j){case 1:return S(To(e));case 2:return s(ur,2,m.chr("0"),S(To(e)));default:return""}case"s":var D=o;switch(D){case 1:return S(wo(e));case 2:return s(ur,2,m.chr("0"),S(wo(e)));default:return""}case"S":return s(cr,o,m.chr("0"),_(sr,o,s(ur,3,m.chr("0"),S(bo(e)))));case"X":if(m.cmp(o,4)<0&&(t||m.eq(Tc(e),0)))return"Z";var R=t,B=e,L=tr(n);t=R,e=B,n=L;continue t;case"x":var P=t?0:Tc(e),F=o;switch(F){case 1:return s(Uc,"",!0,P);case 2:return s(Uc,"",!1,P);case 3:return s(Uc,":",!1,P);default:return""}case"'":return m.eq(n,"''")?"'":f(Nc,Lc,Dc("''"),function(t){return"'"},s(fr,1,-1,n));default:return""}}}),tu=e(function(t,r,e){var n=t?Pc(e):e;return f(Nc,Lc,$c,function(r){return s(Zc,t,n,function(t){return t.match}(r))},r)}),ru=(function(){Dc(_(k["++"],"^",_(k["++"],"(\\d{4})",_(k["++"],"(?:",_(k["++"],"(\\-)?(\\d{2})(?:\\2(\\d{2}))?",_(k["++"],"|",_(k["++"],"(\\-)?W(\\d{2})(?:\\5(\\d))?",_(k["++"],"|",_(k["++"],"\\-?(\\d{3})",_(k["++"],")?",_(k["++"],"(?:",_(k["++"],"T(\\d{2})(?:(\\:)?(\\d{2})(?:\\10(\\d{2}))?)?(\\.\\d+)?(?:(Z)|(?:([+\\-])(\\d{2})(?:\\:?(\\d{2}))?))?",")?$"))))))))))))}(),function(t){return Mt(Kt(t))}),eu=(n(function(t,r,e,n){var o=_(J,0,_(V,ru,n)),c=function(){var n=_(pt,V(ru),{ctor:"::",_0:t,_1:{ctor:"::",_0:r,_1:{ctor:"::",_0:e,_1:{ctor:"[]"}}}});t:do{if("::"===n.ctor&&"Just"===n._0.ctor&&"::"===n._1.ctor){if("Just"===n._1._0.ctor){if("::"===n._1._1.ctor){if("Just"===n._1._1._0.ctor){if("[]"===n._1._1._1.ctor)return{ctor:"_Tuple3",_0:n._0._0,_1:n._1._0._0,_2:n._1._1._0._0+o};break t}if("[]"===n._1._1._1.ctor)return{ctor:"_Tuple3",_0:n._0._0,_1:n._1._0._0+o,_2:0};break t}break t}if("::"===n._1._1.ctor&&"Nothing"===n._1._1._0.ctor&&"[]"===n._1._1._1.ctor)return{ctor:"_Tuple3",_0:n._0._0+o,_1:0,_2:0};break t}break t}while(!1);return{ctor:"_Tuple3",_0:0,_1:0,_2:0}}(),u=c._0,i=c._1,a=c._2;return I(u*x(36e5)+i*x(6e4)+a*x(1e3))}),function(t){return Mt(Xt(t))}),nu=(c(function(t,r,e,n,o,c){var u=_(J,1,eu(t)),i={ctor:"_Tuple2",_0:r,_1:n};t:do{if("_Tuple2"===i.ctor){if("Just"===i._0.ctor){if("Nothing"===i._1.ctor)return s(gc,u,Qo(_(J,1,_(V,eu,r))),_(J,1,_(V,eu,e)));break t}if("Just"===i._1.ctor)return s(mc,u,_(J,1,_(V,eu,n)),_(J,1,_(V,eu,o)));break t}break t}while(!1);return _(vc,u,_(J,1,_(V,eu,c)))}),n(function(t,r,e,n){var o={ctor:"_Tuple2",_0:t,_1:r};t:do{if("_Tuple2"===o.ctor){if("Just"===o._0.ctor){if("Z"===o._0._0&&"Nothing"===o._1.ctor)return z(0);break t}if("Just"===o._1.ctor){var c=_(J,0,_(V,eu,n)),u=_(J,0,_(V,eu,e));return z((m.eq(o._1._0,"+")?1:-1)*(60*u+c))}break t}break t}while(!1);return H}),function(t){return{ctor:"_Tuple7",_0:Ao(t),_1:Eo(t),_2:xo(t),_3:ko(t),_4:To(t),_5:wo(t),_6:bo(t)}}),ou=function(t){switch(t){case 1:return Ko;case 2:return zo;case 3:return Jo;default:return Fo}},cu=(e(function(t,r,e){return m.cmp(Io(e),Io(t))<0?t:m.cmp(Io(e),Io(r))>0?r:e}),e(function(t,r,e){return m.cmp(t,e)<1&&m.cmp(e,r)<1||m.cmp(r,e)<1&&m.cmp(e,t)<1})),uu=(e(function(t,r,e){return s(cu,Io(t),Io(r),Io(e))}),r(function(t,r){return _(M,Io(t),Io(r))})),iu=(r(function(t,r){return m.eq(Io(t),Io(r))}),Tc),au=kc,_u=Sc,su=xc,fu=r(function(t,r){return R(_(k["%"],su(r)-Xo(t)+7,7))}),lu=Ec,du=Ic,pu=Oc,hu=function(t){return 12*Ao(t)+pu(t)},vu=r(function(t,r){var e=function(t){return(x(xo(t)-1)+lu(t))/31},n=function(t){return x(hu(t))+e(t)};return O(n(r)-n(t))}),mu=tu(!0),gu=(mu("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"),tu(!1)),yu=(gu("yyyy-MM-dd'T'HH:mm:ss.SSSxxx"),function(t){return Oo(x(t))}),bu=function(t){var r=t,e=r._1,n=r._0;if("Just"===n.ctor)return yu(e-6e4*n._0);var o=iu(yu(e)),c=yu(e-6e4*o),u=iu(c);if(m.eq(o,u))return c;var i=yu(e-6e4*u),a=iu(i);return m.eq(u,a)?i:c},wu=u(function(t,r,e,n,o,c,u){return bu({ctor:"_Tuple2",_0:H,_1:p(bc,t,r,e,n,o,c,u)})}),Tu=r(function(t,r){var e=hu(r)+t+-1,n=e/12|0,o=Qo(_(k["%"],e,12)+1),c=nu(r),u=(c._0,c._1,c._2),i=c._3,a=c._4,s=c._5,f=c._6,l=_(N,u,_(tc,n,o));return p(wu,n,o,l,i,a,s,f)}),ku=e(function(t,r,e){var n=nu(e),o=n._0,c=n._1,u=n._2,i=n._3,a=n._4,s=n._5,f=n._6;switch(t.ctor){case"Millisecond":return Oo(Io(e)+x(r));case"Second":return Oo(Io(e)+x(1e3*r));case"Minute":return Oo(Io(e)+x(6e4*r));case"Hour":return Oo(Io(e)+x(36e5*r));case"Day":return p(wu,o,c,u+r,i,a,s,f);case"Month":return _(Tu,r,e);case"Year":return _(Tu,12*r,e);case"Quarter":return _(Tu,3*r,e);case"Week":default:return p(wu,o,c,u+7*r,i,a,s,f)}}),Su=o(function(t,r,e,n,o){for(;;){if(m.cmp(Io(o),Io(n))<0)return t;var c={ctor:"::",_0:o,_1:t},u=r,i=e,a=n,_=s(ku,r,e,o);t=c,r=u,e=i,n=a,o=_}}),xu=e(function(t,r,e){return bu({ctor:"_Tuple2",_0:H,_1:s(gc,t,r,e)})}),Eu=r(function(t,r){var e=nu(r),n=e._0,o=e._1,c=e._2,u=e._3,i=e._4,a=e._5;switch(t.ctor){case"Millisecond":return r;case"Second":return p(wu,n,o,c,u,i,a,0);case"Minute":return p(wu,n,o,c,u,i,0,0);case"Hour":return p(wu,n,o,c,u,0,0,0);case"Day":return s(xu,n,o,c);case"Month":return s(xu,n,o,1);case"Year":return s(xu,n,Ko,1);case"Quarter":return s(xu,n,ou(du(r)),1);case"Week":case"Monday":return s(xu,n,o,c+_(fu,Bo,r));case"Tuesday":return s(xu,n,o,c+_(fu,Ro,r));case"Wednesday":return s(xu,n,o,c+_(fu,Do,r));case"Thursday":return s(xu,n,o,c+_(fu,jo,r));case"Friday":return s(xu,n,o,c+_(fu,Mo,r));case"Saturday":return s(xu,n,o,c+_(fu,No,r));default:return s(xu,n,o,c+_(fu,qo,r))}}),Au=r(function(t,r){var e=_(Eu,t,r);return m.eq(Io(r),Io(e))?r:s(ku,t,1,e)}),Ou=(n(function(t,r,e,n){var o=R(_(q,1,r));return l(Su,{ctor:"[]"},t,o,e,_(Au,t,s(ku,t,o,n)))}),e(function(t,r,e){var n=t,o=r,c=e;return bu({ctor:"_Tuple2",_0:n._0,_1:c._0+o._0})}),function(t){return{ctor:"Offset",_0:t}}),Iu=(Ou(z(0)),Ou(H),function(t){return{ctor:"TimeMS",_0:t}}),Cu=(Iu(0),n(function(t,r,e,n){return Iu(f(yc,t,r,e,n))}),function(t){return{ctor:"DateMS",_0:t}}),qu=(e(function(t,r,e){return Cu(s(gc,t,r,e))}),r(function(t,r){return Cu(_(vc,t,r))}),e(function(t,r,e){return Cu(s(mc,t,r,e))}),{ctor:"Year"}),Nu={ctor:"Month"},Mu={ctor:"Day"},ju=e(function(t,r,e){var n=A(Io(e)-Io(r)),o=t;switch(o.ctor){case"Millisecond":return n;case"Second":return n/1e3|0;case"Minute":return n/6e4|0;case"Hour":return n/36e5|0;case"Day":return n/864e5|0;case"Month":return _(vu,r,e);case"Year":return _(vu,r,e)/12|0;case"Quarter":return _(vu,r,e)/3|0;case"Week":return s(ju,Mu,r,e)/7|0;default:var c=o;return s(ju,Mu,_(Eu,c,r),_(Eu,c,e))/7|0}}),Du={ctor:"Hour"},Ru={ctor:"Minute"},Bu=e(function(t,r,e){t:for(;;){var n=t;switch(n.ctor){case"Millisecond":return m.eq(Io(r),Io(e));case"Second":return m.eq(wo(r),wo(e))&&s(Bu,Ru,r,e);case"Minute":return m.eq(To(r),To(e))&&s(Bu,Du,r,e);case"Hour":return m.eq(ko(r),ko(e))&&s(Bu,Mu,r,e);case"Day":return m.eq(xo(r),xo(e))&&s(Bu,Nu,r,e);case"Month":return m.eq(Eo(r),Eo(e))&&s(Bu,qu,r,e);case"Year":return m.eq(Ao(r),Ao(e));case"Quarter":return m.eq(du(r),du(e))&&s(Bu,qu,r,e);case"Week":return m.eq(_u(r),_u(e))&&m.eq(au(r),au(e));default:var o=n,c=Mu,u=_(Eu,o,r),i=_(Eu,o,e);t=c,r=u,e=i;continue t}}}),Lu={ctor:"Second"},Pu=function(t){return tr(S(t))},Fu=function(t){return"Minute"===t.ctor?_(k["++"],"a ",Pu(t)):_(k["++"],"1 ",Pu(t))},$u=e(function(t,r,e){return 1===e?_(k["++"],t,_(k["++"]," ",Fu(r))):_(k["++"],t,_(k["++"]," ",_(k["++"],S(e),_(k["++"]," ",_(k["++"],Pu(r),"s")))))}),Uu=r(function(t,r){return 1===r?_(k["++"],"1 ",Pu(t)):_(k["++"],S(r),_(k["++"]," ",_(k["++"],Pu(t),"s")))}),Ju=function(t){var r=t;switch(r.ctor){case"LessThanXSeconds":return s($u,"less than",Lu,r._0);case"HalfAMinute":return"half a minute";case"LessThanXMinutes":return s($u,"less than",Ru,r._0);case"XMinutes":return _(Uu,Ru,r._0);case"AboutXHours":return s($u,"about",Du,r._0);case"XDays":return _(Uu,Mu,r._0);case"AboutXMonths":return s($u,"about",Nu,r._0);case"XMonths":return _(Uu,Nu,r._0);case"AboutXYears":return s($u,"about",qu,r._0);case"OverXYears":return s($u,"over",qu,r._0);default:return s($u,"almost",qu,r._0)}},Hu=e(function(t,r,e){var n=t,o=Ju(e);return n.addSuffix?m.eq(r,F)?_(k["++"],"in ",o):_(k["++"],o," ago"):o}),Vu=function(t){var r=I(x(t)/60);return Ln(r)},zu=function(t){return m.cmp(t,5)<0?Un(5):m.cmp(t,10)<0?Un(10):m.cmp(t,20)<0?Un(20):m.cmp(t,40)<0?$n:m.cmp(t,60)<0?Fn(1):Pn(1)},Wu={locale:Hu({addSuffix:!1}),includeSeconds:!1},Gu=function(t){var r=I(x(t)/43200);return Rn(r)},Ku=function(t){var r=I(x(t)/43200);return Dn(r)},Xu=e(function(t,r,e){var n=s(ju,Nu,r,e);if(m.cmp(n,12)<0)return Ku(t);var o=A(x(n)/12),c=_(k["%"],n,12);return m.cmp(c,3)<0?jn(o):m.cmp(c,9)<0?Mn(o):Nn(o+1)}),Qu=function(t){var r=I(x(t)/1440);return Bn(r)},Yu=e(function(t,r,e){var n=iu(r)-iu(e),o=s(ju,Lu,r,e),c=I(x(o)/60)-n;return t&&m.cmp(c,2)<0?zu(o):m.eq(c,0)?Fn(1):m.cmp(c,2)<0?Pn(c):m.cmp(c,45)<0?Pn(c):m.cmp(c,90)<0?Ln(1):m.cmp(c,1440)<0?Vu(c):m.cmp(c,2520)<0?Bn(1):m.cmp(c,43200)<0?Qu(c):m.cmp(c,86400)<0?Gu(c):s(Xu,c,r,e)}),Zu=e(function(t,r,e){var n=t,o=_(uu,r,e),c=m.eq(o,F)?{ctor:"_Tuple2",_0:r,_1:e}:{ctor:"_Tuple2",_0:e,_1:r},u=c._0,i=c._1,a=s(Yu,n.includeSeconds,u,i);return n.locale(o)(a)}),ti=(Zu(Wu),r(function(t,r){var e=r;return{ctor:"_Tuple2",_0:e._0,_1:_(Nr,t,e._1)}}),r(function(t,r){var e=r;return{ctor:"_Tuple2",_0:e._0,_1:Ir({ctor:"::",_0:e._1,_1:{ctor:"::",_0:t,_1:{ctor:"[]"}}})}}),r(function(t,r){var e=r;return{ctor:"_Tuple2",_0:t(e._0),_1:e._1}}),r(function(t,r){return t?r:T}),e(function(t,r,e){var n=e,o=_(t,r,n._0),c=o._0,u=o._1;return{ctor:"_Tuple2",_0:c,_1:Ir({ctor:"::",_0:n._1,_1:{ctor:"::",_0:u,_1:{ctor:"[]"}}})}})),ri=e(function(t,r,e){var n=ti(t);return s(ut,n,e,r)}),ei=(e(function(t,r,n){var o=n;return s(ne,e(function(r,e,n){return _(t,r,n)}),r,o._0)}),e(function(t,r,n){var o=n;return s(ie,e(function(r,e,n){return _(t,r,n)}),r,o._0)})),ni=function(t){return oe(t._0)},oi=r(function(t,r){return _(de,t,r._0)}),ci=function(t){return{ctor:"Set_elm_builtin",_0:t}},ui=ci(xe),ii=function(t){return ci(_(He,t,{ctor:"_Tuple0"}))},ai=r(function(t,r){return ci(s(Je,t,{ctor:"_Tuple0"},r._0))}),_i=function(t){return s(ut,ai,ui,t)},si=(r(function(t,r){return _i(_(pt,t,ni(r)))}),r(function(t,r){return ci(_(Xe,t,r._0))})),fi=(r(function(t,r){var e=t,n=r;return ci(_(Ve,e._0,n._0))}),r(function(t,r){var e=t,n=r;return ci(_(We,e._0,n._0))}),r(function(t,r){var e=t,n=r;return ci(_(Qe,e._0,n._0))}),r(function(t,e){var n=e;return ci(_(ze,r(function(r,e){return t(r)}),n._0))}),r(function(t,e){var n=e,o=_(Ge,r(function(r,e){return t(r)}),n._0),c=o._0,u=o._1;return{ctor:"_Tuple2",_0:ci(c),_1:ci(u)}}),r(function(t,e){var n=function(t){var r=t,e=lt(r._1);return"Just"===e.ctor?{ctor:"::",_0:e._0(r._0),_1:{ctor:"[]"}}:{ctor:"[]"}};return _(r(function(t,e){for(;;){var o=t,c=o._0,u=o._1;if("Just"!==u.ctor)return e;var i=u._0,a={ctor:"_Tuple2",_0:c,_1:ft(i)},s=_(r(function(t,r){return _(k["++"],t,r)}),e,n({ctor:"_Tuple2",_0:c,_1:i}));t=a,e=s}}),{ctor:"_Tuple2",_0:e,_1:z(t)},{ctor:"[]"})})),li=(r(function(t,r){var e=t;return{ctor:"_Tuple4",_0:e._0(r),_1:e._1(r),_2:e._2(r),_3:e._3(r)}}),r(function(t,r){var e=t;return{ctor:"_Tuple3",_0:e._0(r),_1:e._1(r),_2:e._2(r)}})),di=r(function(t,r){var e=t;return{ctor:"_Tuple2",_0:e._0(r),_1:e._1(r)}}),pi=(r(function(t,r){var e=r;return f(t,e._0,e._1,e._2,e._3)}),r(function(t,r){var e=r;return s(t,e._0,e._1,e._2)})),hi=(o(function(t,r,e,n,o){return t({ctor:"_Tuple4",_0:r,_1:e,_2:n,_3:o})}),n(function(t,r,e,n){return t({ctor:"_Tuple3",_0:r,_1:e,_2:n})}),r(function(t,r){var e=r;return{ctor:"_Tuple4",_0:t(e._0),_1:t(e._1),_2:t(e._2),_3:t(e._3)}}),r(function(t,r){var e=r;return{ctor:"_Tuple3",_0:t(e._0),_1:t(e._1),_2:t(e._2)}}),r(function(t,r){var e=r;return{ctor:"_Tuple2",_0:t(e._0),_1:t(e._1)}}),r(function(t,r){return m.cmp(t,0)<0?H:lt(_(Y,t,r))}),r(function(t,e){var n=_(At,1,e);return"::"===n.ctor?"Ok"===n._0.ctor&&"[]"===n._1.ctor?_(Lt,r(function(t,r){return{ctor:"::",_0:t,_1:r}})(n._0._0),_(hi,t,_(Y,1,e))):Dt(t):Bt({ctor:"[]"})})),vi=(r(function(t,r){var e=r;return"_Tuple4"===e.ctor&&"Ok"===e._0.ctor&&"Ok"===e._1.ctor&&"Ok"===e._2.ctor&&"Ok"===e._3.ctor?Bt({ctor:"_Tuple4",_0:e._0._0,_1:e._1._0,_2:e._2._0,_3:e._3._0}):Dt(t)}),r(function(t,r){var e=r;return"_Tuple3"===e.ctor&&"Ok"===e._0.ctor&&"Ok"===e._1.ctor&&"Ok"===e._2.ctor?Bt({ctor:"_Tuple3",_0:e._0._0,_1:e._1._0,_2:e._2._0}):Dt(t)}),r(function(t,r){var e=r;return"_Tuple2"===e.ctor&&"Ok"===e._0.ctor&&"Ok"===e._1.ctor?Bt({ctor:"_Tuple2",_0:e._0._0,_1:e._1._0}):Dt(t)}),function(t){var r=t;return"_Tuple2"===r.ctor&&"Just"===r._0.ctor&&"Just"===r._1.ctor?z({ctor:"_Tuple2",_0:r._0._0,_1:r._1._0}):H}),mi=(r(function(t,r){var e=t(r);return"Ok"===e.ctor?e._0:r}),r(function(t,r){var e=t;return m.cmp(r,e._0)>0&&m.cmp(r,e._1)<0}),r(function(t,r){var e=t;return m.cmp(r,e._0)>-1&&m.cmp(r,e._1)<1}),r(function(t,r){return _(_t,r,t)}),r(function(t,e){var n=x(_(r(function(t,r){return Math.pow(t,r)}),10,t));return s(b,r(function(t,r){return t/r}),n,x(I(_(r(function(t,r){return t*r}),n,e))))}),mi||{});mi["!+>"]=r(function(t,r){return _(Rt,r,t)});var mi=mi||{};mi["?+>"]=r(function(t,r){return _(V,r,t)});var mi=mi||{};mi["!|>"]=r(function(t,r){return _(Lt,r,t)});var mi=mi||{};mi["?|>"]=r(function(t,r){return _(W,r,t)});var mi=mi||{};mi["!="]=r(function(t,r){return _(jt,r,t)});var mi=mi||{};mi["?="]=r(function(t,r){return _(J,r,t)});var mi=mi||{};mi["@@|>"]=r(function(t,r){return _(g,r,t)});var mi=mi||{};mi["..|>"]=r(function(t,r){var e=t;return{ctor:"_Tuple2",_0:r(e._0),_1:r(e._1)}});var mi=mi||{};mi[":|>"]=r(function(t,r){return r({ctor:"::",_0:t,_1:{ctor:"[]"}})});var mi=mi||{};mi[".|>"]=r(function(t,r){return _(pt,r,t)});var mi=mi||{};mi["||>"]=r(function(t,r){return r(t)});var mi=mi||{};mi["#"]=r(function(t,r){return _(b,t,r)});var mi=mi||{};mi[":|::"]=r(function(t,r){return{ctor:"::",_0:t,_1:{ctor:"::",_0:r,_1:{ctor:"[]"}}}});var mi=mi||{};mi[":|++"]=r(function(t,r){return{ctor:"::",_0:t,_1:r}});var mi=mi||{};mi["|::"]=r(function(t,r){return _(k["++"],t,{ctor:"::",_0:r,_1:{ctor:"[]"}})});var mi=mi||{};mi["|++"]=r(function(t,r){return _(k["++"],t,r)});var gi,yi=(_(bn,{ctor:"::",_0:"className",_1:{ctor:"[]"}},xn),_(yn,"scrollTop",Tn)),bi=_(yn,"scrollLeft",Tn),wi=_(yn,"offsetTop",Tn),Ti=_(yn,"offsetLeft",Tn),ki=_(yn,"offsetHeight",Tn),Si=_(yn,"offsetWidth",Tn),xi=function(t){return _(yn,"parentElement",t)},Ei=r(function(t,r){return mn({ctor:"::",_0:_(yn,"offsetParent",cn(t)),_1:{ctor:"::",_0:_(yn,"offsetParent",r),_1:{ctor:"[]"}}})}),Ai=r(function(t,r){return _(an,function(t){var r=t,e=r._1,n=r._0;return _(Ei,{ctor:"_Tuple2",_0:n,_1:e},_(Ai,n,e))},l(dn,n(function(e,n,o,c){return{ctor:"_Tuple2",_0:t+o-e,_1:r+c-n}}),bi,yi,Ti,wi))}),Oi=(f(pn,e(function(t,r,e){var n=t;return{top:n._1,left:n._0,width:r,height:e}}),_(Ai,0,0),Si,ki),function(t){return _(yn,"target",t)}),Ii=(n(function(t,r,e,n){return{top:t,left:r,width:e,height:n}}),function(){function t(t){return{type:"text",text:t}}function o(t){return r(function(r,e){return c(t,r,e)})}function c(t,r,e){for(var n=h(r),o=n.namespace,c=n.facts,u=[],i=0;"[]"!==e.ctor;){var a=e._0;i+=a.descendantsCount||0,u.push(a),e=e._1}return i+=u.length,{type:"node",tag:t,facts:c,children:u,namespace:o,descendantsCount:i}}function u(t,r,e){for(var n=h(r),o=n.namespace,c=n.facts,u=[],i=0;"[]"!==e.ctor;){var a=e._0;i+=a._1.descendantsCount||0,u.push(a),e=e._1}return i+=u.length,{type:"keyed-node",tag:t,facts:c,children:u,namespace:o,descendantsCount:i}}function i(t,r,e){return{type:"custom",facts:h(t).facts,model:r,impl:e}}function a(t,r){return{type:"tagger",tagger:t,node:r,descendantsCount:1+(r.descendantsCount||0)}}function f(t,r,e){return{type:"thunk",func:t,args:r,thunk:e,node:void 0}}function l(t,r){return f(t,[r],function(){return t(r)})}function d(t,r,e){return f(t,[r,e],function(){return _(t,r,e)})}function p(t,r,e,n){return f(t,[r,e,n],function(){return s(t,r,e,n)})}function h(t){for(var r,e={};"[]"!==t.ctor;){var n=t._0,o=n.key;if(o===dt||o===pt||o===lt){var c=e[o]||{};c[n.realKey]=n.value,e[o]=c}else if(o===ft){for(var u=e[o]||{},i=n.value;"[]"!==i.ctor;){var a=i._0;u[a._0]=a._1,i=i._1}e[o]=u}else if("namespace"===o)r=n.value;else if("className"===o){var _=e[o];e[o]=void 0===_?n.value:_+" "+n.value}else e[o]=n.value;t=t._1}return{facts:e,namespace:r}}function v(t){return{key:ft,value:t}}function g(t,r){return{key:t,value:r}}function y(t,r){return{key:dt,realKey:t,value:r}}function b(t,r,e){return{key:pt,realKey:r,value:{value:e,namespace:t}}}function w(t,r,e){return{key:lt,realKey:t,value:{options:r,decoder:e}}}function T(t,r){return(t.options===r.options||t.options.stopPropagation===r.options.stopPropagation&&t.options.preventDefault===r.options.preventDefault)&&Ye.equality(t.decoder,r.decoder)}function k(t,r){return r.key!==lt?r:w(r.realKey,r.value.options,_(vn,t,r.value.decoder))}function S(t,r){switch(t.type){case"thunk":return t.node||(t.node=t.thunk()),S(t.node,r);case"tagger":for(var e=t.node,n=t.tagger;"tagger"===e.type;)"object"!=typeof n?n=[n,e.tagger]:n.push(e.tagger),e=e.node;var o={tagger:n,parent:r},c=S(e,o);return c.elm_event_node_ref=o,c;case"text":return ht.createTextNode(t.text);case"node":var c=t.namespace?ht.createElementNS(t.namespace,t.tag):ht.createElement(t.tag);x(c,r,t.facts);for(var u=t.children,i=0;i<u.length;i++)c.appendChild(S(u[i],r));return c;case"keyed-node":var c=t.namespace?ht.createElementNS(t.namespace,t.tag):ht.createElement(t.tag);x(c,r,t.facts);for(var u=t.children,i=0;i<u.length;i++)c.appendChild(S(u[i]._1,r));return c;case"custom":var c=t.impl.render(t.model);return x(c,r,t.facts),c}}function x(t,r,e){for(var n in e){var o=e[n];switch(n){case ft:E(t,o);break;case lt:A(t,r,o);break;case dt:I(t,o);break;case pt:C(t,o);break;case"value":t[n]!==o&&(t[n]=o);break;default:t[n]=o}}}function E(t,r){var e=t.style;for(var n in r)e[n]=r[n]}function A(t,r,e){var n=t.elm_handlers||{};for(var o in e){var c=n[o],u=e[o];if(void 0===u)t.removeEventListener(o,c),n[o]=void 0;else if(void 0===c){var c=O(r,u);t.addEventListener(o,c),n[o]=c}else c.info=u}t.elm_handlers=n}function O(t,r){function e(r){var n=e.info,o=_(Ye.run,n.decoder,r);if("Ok"===o.ctor){var c=n.options;c.stopPropagation&&r.stopPropagation(),c.preventDefault&&r.preventDefault();for(var u=o._0,i=t;i;){var a=i.tagger;if("function"==typeof a)u=a(u);else for(var s=a.length;s--;)u=a[s](u);i=i.parent}}}return e.info=r,e}function I(t,r){for(var e in r){var n=r[e];void 0===n?t.removeAttribute(e):t.setAttribute(e,n)}}function C(t,r){for(var e in r){var n=r[e],o=n.namespace,c=n.value;void 0===c?t.removeAttributeNS(o,e):t.setAttributeNS(o,e,c)}}function q(t,r){var e=[];return M(t,r,e,0),e}function N(t,r,e){return{index:r,type:t,data:e,domNode:void 0,eventNode:void 0}}function M(t,r,e,n){if(t!==r){var o=t.type,c=r.type;if(o!==c)return void e.push(N("p-redraw",n,r));switch(c){case"thunk":for(var u=t.args,i=r.args,a=u.length,_=t.func===r.func&&a===i.length;_&&a--;)_=u[a]===i[a];if(_)return void(r.node=t.node);r.node=r.thunk();var s=[];return M(t.node,r.node,s,0),void(s.length>0&&e.push(N("p-thunk",n,s)));case"tagger":for(var f=t.tagger,l=r.tagger,d=!1,p=t.node;"tagger"===p.type;)d=!0,"object"!=typeof f?f=[f,p.tagger]:f.push(p.tagger),p=p.node;for(var h=r.node;"tagger"===h.type;)d=!0,"object"!=typeof l?l=[l,h.tagger]:l.push(h.tagger),h=h.node;return d&&f.length!==l.length?void e.push(N("p-redraw",n,r)):((d?j(f,l):f===l)||e.push(N("p-tagger",n,l)),void M(p,h,e,n+1));case"text":if(t.text!==r.text)return void e.push(N("p-text",n,r.text));return;case"node":if(t.tag!==r.tag||t.namespace!==r.namespace)return void e.push(N("p-redraw",n,r));var v=D(t.facts,r.facts);return void 0!==v&&e.push(N("p-facts",n,v)),void R(t,r,e,n);case"keyed-node":if(t.tag!==r.tag||t.namespace!==r.namespace)return void e.push(N("p-redraw",n,r));var v=D(t.facts,r.facts);return void 0!==v&&e.push(N("p-facts",n,v)),void B(t,r,e,n);case"custom":if(t.impl!==r.impl)return void e.push(N("p-redraw",n,r));var v=D(t.facts,r.facts);void 0!==v&&e.push(N("p-facts",n,v));var m=r.impl.diff(t,r);if(m)return void e.push(N("p-custom",n,m));return}}}function j(t,r){for(var e=0;e<t.length;e++)if(t[e]!==r[e])return!1;return!0}function D(t,r,e){var n;for(var o in t)if(o!==ft&&o!==lt&&o!==dt&&o!==pt)if(o in r){var c=t[o],u=r[o];c===u&&"value"!==o||e===lt&&T(c,u)||(n=n||{},n[o]=u)}else n=n||{},n[o]=void 0===e?"string"==typeof t[o]?"":null:e===ft?"":e===lt||e===dt?void 0:{namespace:t[o].namespace,value:void 0};else{var i=D(t[o],r[o]||{},o);i&&(n=n||{},n[o]=i)}for(var a in r)a in t||(n=n||{},n[a]=r[a]);return n}function R(t,r,e,n){var o=t.children,c=r.children,u=o.length,i=c.length;u>i?e.push(N("p-remove-last",n,u-i)):u<i&&e.push(N("p-append",n,c.slice(u)));for(var a=n,_=u<i?u:i,s=0;s<_;s++){a++;var f=o[s];M(f,c[s],e,a),a+=f.descendantsCount||0}}function B(t,r,e,n){for(var o=[],c={},u=[],i=t.children,a=r.children,_=i.length,s=a.length,f=0,l=0,d=n;f<_&&l<s;){var p=i[f],h=a[l],v=p._0,m=h._0,g=p._1,y=h._1;if(v!==m){var b=f+1<_,w=l+1<s;if(b)var T=i[f+1],k=T._0,S=T._1,x=m===k;if(w)var E=a[l+1],A=E._0,O=E._1,I=v===A;if(b&&w&&I&&x)d++,M(g,O,o,d),L(c,o,v,y,l,u),d+=g.descendantsCount||0,d++,P(c,o,v,S,d),d+=S.descendantsCount||0,f+=2,l+=2;else if(w&&I)d++,L(c,o,m,y,l,u),M(g,O,o,d),d+=g.descendantsCount||0,f+=1,l+=2;else if(b&&x)d++,P(c,o,v,g,d),d+=g.descendantsCount||0,d++,M(S,y,o,d),d+=S.descendantsCount||0,f+=2,l+=1;else{if(!b||!w||k!==A)break;d++,P(c,o,v,g,d),L(c,o,m,y,l,u),d+=g.descendantsCount||0,d++,M(S,O,o,d),d+=S.descendantsCount||0,f+=2,l+=2}}else d++,M(g,y,o,d),d+=g.descendantsCount||0,f++,l++}for(;f<_;){d++;var p=i[f],g=p._1;P(c,o,p._0,g,d),d+=g.descendantsCount||0,f++}for(var C;l<s;){C=C||[];var h=a[l];L(c,o,h._0,h._1,void 0,C),l++}(o.length>0||u.length>0||void 0!==C)&&e.push(N("p-reorder",n,{patches:o,inserts:u,endInserts:C}))}function L(t,r,e,n,o,c){var u=t[e];if(void 0===u)return u={tag:"insert",vnode:n,index:o,data:void 0},c.push({index:o,entry:u}),void(t[e]=u);if("remove"===u.tag){c.push({index:o,entry:u}),u.tag="move";var i=[];return M(u.vnode,n,i,u.index),u.index=o,void(u.data.data={patches:i,entry:u})}L(t,r,e+vt,n,o,c)}function P(t,r,e,n,o){var c=t[e];if(void 0===c){var u=N("p-remove",o,void 0);return r.push(u),void(t[e]={tag:"remove",vnode:n,index:o,data:u})}if("insert"===c.tag){c.tag="move";var i=[];M(n,c.vnode,i,o);var u=N("p-remove",o,{patches:i,entry:c});return void r.push(u)}P(t,r,e+vt,n,o)}function F(t,r,e,n){$(t,r,e,0,0,r.descendantsCount,n)}function $(t,r,e,n,o,c,u){for(var i=e[n],a=i.index;a===o;){var _=i.type;if("p-thunk"===_)F(t,r.node,i.data,u);else if("p-reorder"===_){i.domNode=t,i.eventNode=u;var s=i.data.patches;s.length>0&&$(t,r,s,0,o,c,u)}else if("p-remove"===_){i.domNode=t,i.eventNode=u;var f=i.data;if(void 0!==f){f.entry.data=t;var s=f.patches;s.length>0&&$(t,r,s,0,o,c,u)}}else i.domNode=t,i.eventNode=u;if(n++,!(i=e[n])||(a=i.index)>c)return n}switch(r.type){case"tagger":for(var l=r.node;"tagger"===l.type;)l=l.node;return $(t,l,e,n,o+1,c,t.elm_event_node_ref);case"node":for(var d=r.children,p=t.childNodes,h=0;h<d.length;h++){o++;var v=d[h],m=o+(v.descendantsCount||0);if(o<=a&&a<=m&&(n=$(p[h],v,e,n,o,m,u),!(i=e[n])||(a=i.index)>c))return n;o=m}return n;case"keyed-node":for(var d=r.children,p=t.childNodes,h=0;h<d.length;h++){o++;var v=d[h]._1,m=o+(v.descendantsCount||0);if(o<=a&&a<=m&&(n=$(p[h],v,e,n,o,m,u),!(i=e[n])||(a=i.index)>c))return n;o=m}return n;case"text":case"thunk":throw new Error("should never traverse `text` or `thunk` nodes like this")}}function U(t,r,e,n){return 0===e.length?t:(F(t,r,e,n),J(t,e))}function J(t,r){for(var e=0;e<r.length;e++){var n=r[e],o=n.domNode,c=H(o,n);o===t&&(t=c)}return t}function H(t,r){switch(r.type){case"p-redraw":return V(t,r.data,r.eventNode);case"p-facts":return x(t,r.eventNode,r.data),t;case"p-text":return t.replaceData(0,t.length,r.data),t;case"p-thunk":return J(t,r.data);case"p-tagger":return void 0!==t.elm_event_node_ref?t.elm_event_node_ref.tagger=r.data:t.elm_event_node_ref={tagger:r.data,parent:r.eventNode},t;case"p-remove-last":for(var e=r.data;e--;)t.removeChild(t.lastChild);return t;case"p-append":for(var n=r.data,e=0;e<n.length;e++)t.appendChild(S(n[e],r.eventNode));return t;case"p-remove":var o=r.data;if(void 0===o)return t.parentNode.removeChild(t),t;var c=o.entry;return void 0!==c.index&&t.parentNode.removeChild(t),c.data=J(t,o.patches),t;case"p-reorder":return z(t,r);case"p-custom":var u=r.data;return u.applyPatch(t,u.data);default:throw new Error("Ran into an unknown patch!")}}function V(t,r,e){var n=t.parentNode,o=S(r,e);return void 0===o.elm_event_node_ref&&(o.elm_event_node_ref=t.elm_event_node_ref),n&&o!==t&&n.replaceChild(o,t),o}function z(t,r){var e=r.data,n=W(e.endInserts,r);t=J(t,e.patches);for(var o=e.inserts,c=0;c<o.length;c++){var u=o[c],i=u.entry,a="move"===i.tag?i.data:S(i.vnode,r.eventNode);t.insertBefore(a,t.childNodes[u.index])}return void 0!==n&&t.appendChild(n),t}function W(t,r){if(void 0!==t){for(var e=ht.createDocumentFragment(),n=0;n<t.length;n++){var o=t[n],c=o.entry;e.appendChild("move"===c.tag?c.data:S(c.vnode,r.eventNode))}return e}}function G(t){return r(function(r,e){return function(n){return function(o,c,u){var i=t(n,c);void 0===u?Z(e,o,c,i):et(_(r,u,e),o,c,i)}}})}function K(t){var e=m.Tuple2(m.Tuple0,Cr);return _(mt,gi,{init:e,view:function(){return t},update:r(function(){return e}),subscriptions:function(){return jr}})()}function X(t,r){return function(t,e,n){if(void 0===e)return t;Y("The `"+r+"` module does not need flags.\nInitialize it with no arguments and you should be all set!",n)}}function Q(t,r){return function(e,n,o){if(void 0===t){var c="Are you trying to sneak a Never value into Elm? Trickster!\nIt looks like "+r+".main is defined with `programWithFlags` but has type `Program Never`.\nUse `program` instead if you do not want flags.";Y(c,o)}var u=_(Ye.run,t,n);if("Ok"===u.ctor)return e(u._0);var c="Trying to initialize the `"+r+"` module with an unexpected flag.\nI tried to convert it to an Elm value, but ran into this problem:\n\n"+u._0;Y(c,o)}}function Y(t,r){throw r&&(r.innerHTML='<div style="padding-left:1em;"><h2 style="font-weight:normal;"><b>Oops!</b> Something went wrong when starting your Elm program.</h2><pre style="padding-left:1em;">'+t+"</pre></div>"),new Error(t)}function Z(t,r,e,n){r.embed=function(r,e){for(;r.lastChild;)r.removeChild(r.lastChild);return Ar.initialize(n(t.init,e,r),t.update,t.subscriptions,tt(r,t.view))},r.fullscreen=function(r){return Ar.initialize(n(t.init,r,document.body),t.update,t.subscriptions,tt(document.body,t.view))}}function tt(t,r){return function(e,n){var o={tagger:e,parent:void 0},c=r(n),u=S(c,o);return t.appendChild(u),rt(u,r,c,o)}}function rt(t,r,e,n){function o(){switch(u){case"NO_REQUEST":throw new Error("Unexpected draw callback.\nPlease report this to <https://github.com/elm-lang/virtual-dom/issues>.");case"PENDING_REQUEST":yt(o),u="EXTRA_REQUEST";var e=r(c),a=q(i,e);return t=U(t,i,a,n),void(i=e);case"EXTRA_REQUEST":return void(u="NO_REQUEST")}}var c,u="NO_REQUEST",i=e;return function(t){"NO_REQUEST"===u&&yt(o),u="PENDING_REQUEST",c=t}}function et(t,r,e,n){r.fullscreen=function(r){var o={doc:void 0};return Ar.initialize(n(t.init,r,document.body),t.update(nt(o)),t.subscriptions,ot(e,document.body,o,t.view,t.viewIn,t.viewOut))},r.embed=function(r,o){var c={doc:void 0};return Ar.initialize(n(t.init,o,r),t.update(nt(c)),t.subscriptions,ot(e,r,c,t.view,t.viewIn,t.viewOut))}}function nt(t){return Or.nativeBinding(function(r){var e=t.doc;if(e){var n=e.getElementsByClassName("debugger-sidebar-messages")[0];n&&(n.scrollTop=n.scrollHeight)}r(Or.succeed(m.Tuple0))})}function ot(t,r,e,n,o,c){return function(u,i){var a={tagger:u,parent:void 0},_={tagger:u,parent:void 0},s=n(i),f=S(s,a);r.appendChild(f);var l=rt(f,n,s,a),d=o(i)._1,p=S(d,_);r.appendChild(p);var h=it(a,p,o),v=rt(p,h,d,_),m=ct(i,c,_,r,t,e);return function(t){l(t),v(t),m(t)}}}function ct(t,r,e,n,o,c){var u,i;return function(t){if(t.isDebuggerOpen){if(!c.doc)return u=r(t),void(i=ut(o,c,u,e));ht=c.doc;var n=r(t),a=q(u,n);i=U(i,u,a,e),u=n,ht=document}}}function ut(t,r,e,n){function o(){r.doc=void 0,i.close()}var c=screen.width-900,u=screen.height-360,i=window.open("","","width=900,height=360,left="+c+",top="+u);ht=i.document,r.doc=ht,ht.title="Debugger - "+t,ht.body.style.margin="0",ht.body.style.padding="0";var a=S(e,n);return ht.body.appendChild(a),ht.addEventListener("keydown",function(t){t.metaKey&&82===t.which&&window.location.reload(),38===t.which&&(n.tagger({ctor:"Up"}),t.preventDefault()),40===t.which&&(n.tagger({ctor:"Down"}),t.preventDefault())}),window.addEventListener("unload",o),i.addEventListener("unload",function(){r.doc=void 0,window.removeEventListener("unload",o),n.tagger({ctor:"Close"})}),ht=document,a}function it(t,r,e){var n,o=st(r),c="Normal",u=t.tagger,i=function(){};return function(r){var a=e(r),_=a._0.ctor;return t.tagger="Normal"===_?u:i,c!==_&&(at("removeEventListener",o,c),at("addEventListener",o,_),"Normal"===c&&(n=document.body.style.overflow,document.body.style.overflow="hidden"),"Normal"===_&&(document.body.style.overflow=n),c=_),a._1}}function at(t,r,e){switch(e){case"Normal":return;case"Pause":return _t(t,r,bt);case"Message":return _t(t,r,wt)}}function _t(t,r,e){for(var n=0;n<e.length;n++)document.body[t](e[n],r,!0)}function st(t){return function(r){if("keydown"!==r.type||!r.metaKey||82!==r.which){for(var e="scroll"===r.type||"wheel"===r.type,n=r.target;null!==n;){if("elm-overlay-message-details"===n.className&&e)return;if(n===t&&!e)return;n=n.parentNode}r.stopPropagation(),r.preventDefault()}}}var ft="STYLE",lt="EVENT",dt="ATTR",pt="ATTR_NS",ht="undefined"!=typeof document?document:{},vt="_elmW6BL",mt=G(X),gt=G(Q),yt="undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(t){setTimeout(t,1e3/60)},bt=["click","dblclick","mousemove","mouseup","mousedown","mouseenter","mouseleave","touchstart","touchend","touchcancel","touchmove","pointerdown","pointerup","pointerover","pointerout","pointerenter","pointerleave","pointermove","pointercancel","dragstart","drag","dragend","dragenter","dragover","dragleave","drop","keyup","keydown","keypress","input","change","focus","blur"],wt=bt.concat("wheel","scroll");return{node:o,text:t,custom:i,map:r(a),on:e(w),style:v,property:r(g),attribute:r(y),attributeNS:e(b),mapProperty:r(k),lazy:r(l),lazy2:e(d),lazy3:n(p),keyedNode:e(u),program:mt,programWithFlags:gt,staticProgram:K}}()),Ci=function(t){return _(Ii.programWithFlags,void 0,t)},qi=function(t){return _(Ii.program,gi,t)},Ni=Ii.keyedNode,Mi=(Ii.lazy3,Ii.lazy2,Ii.lazy,{stopPropagation:!1,preventDefault:!1}),ji=Ii.on,Di=r(function(t,r){return s(ji,t,Mi,r)}),Ri=Ii.style,Bi=(Ii.mapProperty,Ii.attributeNS,Ii.attribute),Li=Ii.property,Pi=Ii.map,Fi=Ii.text,$i=Ii.node,Ui=(r(function(t,r){return{stopPropagation:t,preventDefault:r}}),Ci),Ji=qi,Hi=Pi,Vi=Fi,zi=$i,Wi=(zi("body"),zi("section"),zi("nav"),zi("article"),zi("aside"),zi("h1")),Gi=zi("h2"),Ki=zi("h3"),Xi=zi("h4"),Qi=zi("h5"),Yi=zi("h6"),Zi=(zi("header"),zi("footer"),zi("address"),zi("main"),zi("p")),ta=zi("hr"),ra=zi("pre"),ea=zi("blockquote"),na=zi("ol"),oa=zi("ul"),ca=zi("li"),ua=(zi("dl"),zi("dt"),zi("dd"),zi("figure"),zi("figcaption"),zi("div")),ia=zi("a"),aa=zi("em"),_a=zi("strong"),sa=(zi("small"),zi("s"),zi("cite"),zi("q"),zi("dfn"),zi("abbr"),zi("time"),zi("code")),fa=(zi("var"),zi("samp"),zi("kbd"),zi("sub"),zi("sup"),zi("i")),la=(zi("b"),zi("u"),zi("mark"),zi("ruby"),zi("rt"),zi("rp"),zi("bdi"),zi("bdo"),zi("span")),da=zi("br"),pa=(zi("wbr"),zi("ins"),zi("del"),zi("img")),ha=(zi("iframe"),zi("embed"),zi("object"),zi("param"),zi("video"),zi("audio"),zi("source"),zi("track"),zi("canvas"),zi("math"),zi("table"),zi("caption"),zi("colgroup"),zi("col"),zi("tbody"),zi("thead"),zi("tfoot"),zi("tr"),zi("td"),zi("th"),zi("form"),zi("fieldset"),zi("legend"),zi("label")),va=zi("input"),ma=(zi("button"),zi("select"),zi("datalist"),zi("optgroup"),zi("option"),zi("textarea")),ga=(zi("keygen"),zi("output"),zi("progress"),zi("meter"),zi("details"),zi("summary"),zi("menuitem"),zi("menu"),function(t){return zi(_(k["++"],"app-",t))}),ya=ga("drawer"),ba=ga("drawer-layout"),wa=ga("header"),Ta=ga("header-layout"),ka=(ga("route"),ga("toolbar")),Sa=Bi,xa=function(t){return _(Sa,"tabIndex",S(t))},Ea=Li,Aa=r(function(t,r){return _(Ea,t,on(r))}),Oa=function(t){return _(Aa,"className",t)},Ia=function(t){return _(Aa,"id",t)},Ca=function(t){return _(Aa,"title",t)},qa=function(t){return _(Aa,"src",t)},Na=function(t){return _(Aa,"alt",t)},Ma=function(t){return _(Aa,"type",t)},ja=function(t){return _(Aa,"value",t)},Da=function(t){return _(Aa,"defaultValue",t)},Ra=function(t){return _(Aa,"href",t)},Ba=function(t){return _(Aa,"target",t)},La=function(t){return _(Aa,"start",S(t))},Pa=r(function(t,r){return _(Ea,t,rn(r))}),Fa=function(t){return _(Pa,"autofocus",t)},$a=function(t){return Oa(_(dr," ",_(pt,Er,_(ht,xr,t))))},Ua=Ri,Ja=r(function(t,r){return _(Ea,t,on(r))}),Ha=(Ja("selected"),Ja("path"),Ja("label"),Ja("icon"),r(function(t,r){return _(Ea,t,rn(r))})),Va=(Ja("attrForSelected"),_(yn,"keyCode",kn),_(bn,{ctor:"::",_0:"target",_1:{ctor:"::",_0:"checked",_1:{ctor:"[]"}}},Sn),_(bn,{ctor:"::",_0:"target",_1:{ctor:"::",_0:"value",_1:{ctor:"[]"}}},xn)),za=Mi,Wa=ji,Ga=Di,Ka=(m.update(za,{preventDefault:!0}),function(t){return _(Ga,"input",_(vn,t,Va))}),Xa=function(t){return _(Ga,"mousedown",sn(t))},Qa=function(t){return _(Ga,"click",sn(t))},Ya=(r(function(t,r){return{stopPropagation:t,preventDefault:r}}),_(bn,{ctor:"::",_0:"detail",_1:{ctor:"::",_0:"value",_1:{ctor:"[]"}}},xn)),Za=r(function(t,r){return _(Ga,_(k["++"],t,"-changed"),_(vn,r,Ya))}),t_=(Za("value"),Za("selected"),function(t){return zi(_(k["++"],"paper-",t))}),r_=(t_("badge"),t_("behaviors"),t_("button")),e_=(t_("card"),t_("checkbox"),t_("dialog"),t_("dialog-behavior"),t_("dialog-scrollable"),t_("drawer-panel"),t_("dropdown-menu"),t_("fab")),n_=(t_("header-panel"),t_("icon-button"),t_("input"),t_("item")),o_=(t_("icon-item"),t_("item-body")),c_=t_("listbox"),u_=(t_("material"),t_("menu"),t_("menu-button")),i_=(t_("progress"),t_("radio-button"),t_("radio-group"),t_("ripple"),t_("scroll-header-panel"),t_("slider"),t_("spinner"),t_("styles"),t_("tabs"),t_("tab"),t_("toast"),t_("toggle-button"),t_("toolbar"),t_("tooltip"),r(function(t,r){return s(ie,e(function(r,e,n){return"Just"===n.ctor?n:_(t,r,e)?z({ctor:"_Tuple2",_0:r,_1:e}):H}),H,r)}),r(function(t,r){return s(ie,e(function(r,e,n){var o=_(t,r,e);return"Just"===o.ctor?s(Je,r,o._0,n):n}),xe,r)}),r(function(t,r){return s(ie,e(function(r,e,n){return s(Je,t(r),e,n)}),xe,r)}),r(function(t,e){return s(ei,r(function(t,r){return _(J,r,_(W,function(e){return s(Je,t,e,r)},_(le,t,e)))}),xe,t)}),r(function(t,r){return s(ei,Xe,r,t)}),r(function(t,e){return _(ze,r(function(r,e){return!_(t,r,e)}),e)}),r(function(t,e){return s(ut,r(function(r,e){return s(Je,t(r),r,e)}),xe,e)}),r(function(t,e){return s(ct,r(function(e,n){return s(Ue,t(e),function(t){return z(_(J,{ctor:"::",_0:e,_1:{ctor:"[]"}},_(W,r(function(t,r){return{ctor:"::",_0:t,_1:r}})(e),t)))},n)}),xe,e)})),a_=r(function(t,r){var e=r;return"Nothing"===e.ctor?tn:t(e._0)}),__=e(function(t,r,e){var n=m.cmp(it(e),0)>0,o=m.cmp(t,0)>0&&m.cmp(r,0)>0,c=_(Y,r,e),u=_(At,t,e);return o&&n?{ctor:"::",_0:u,_1:s(__,t,r,c)}:{ctor:"[]"}}),s_=(r(function(t,r){return s(__,t,t,r)}),e(function(t,r,e){var n=m.cmp(t,0)>0&&m.cmp(r,0)>0,o=_(Y,r,e),c=_(At,t,e),u=m.eq(t,it(c));return n&&u?{ctor:"::",_0:c,_1:s(s_,t,r,o)}:{ctor:"[]"}})),f_=(r(function(t,r){return s(s_,t,t,r)}),Z(o(function(t,r,e,n,o){return{ctor:"_Tuple5",_0:t,_1:r,_2:e,_3:n,_4:o}})),tt(n(function(t,r,e,n){return{ctor:"_Tuple4",_0:t,_1:r,_2:e,_3:n}})),rt(e(function(t,r,e){return{ctor:"_Tuple3",_0:t,_1:r,_2:e}})),et(r(function(t,r){return{ctor:"_Tuple2",_0:t,_1:r}}))),l_=function(t){return function(e){return _(ot,T,s(et,r(function(t,r){return m.eq(t,r)}),t,e))}},d_=(r(function(t,r){return _(l_,gt(t),gt(r))}),function(t){var r=t;if("[]"===r.ctor)return{ctor:"[]"};var e=r._1,n=r._0;return{ctor:"::",_0:{ctor:"_Tuple2",_0:n,_1:e},_1:_(pt,function(t){var r=t;return{ctor:"_Tuple2",_0:r._0,_1:{ctor:"::",_0:n,_1:r._1}}},d_(e))}}),p_=r(function(t,r){var e=r;if("::"===e.ctor){var n=e._0;return{ctor:"::",_0:{ctor:"::",_0:t,_1:n},_1:{ctor:"::",_0:n,_1:e._1}}}return{ctor:"[]"}}),h_=_(ct,p_,{ctor:"::",_0:{ctor:"[]"},_1:{ctor:"[]"}}),v_=(r(function(t,r){return _(nt,l_(t),h_(r))}),_(ct,r(function(t,e){return{ctor:"::",_0:{ctor:"[]"},_1:_(pt,r(function(t,r){return{ctor:"::",_0:t,_1:r}})(t),e)}}),{ctor:"::",_0:{ctor:"[]"},_1:{ctor:"[]"}}),r(function(t,r){var e=r;if("[]"===e.ctor)return{ctor:"[]"};if("[]"===e._1.ctor)return{ctor:"::",_0:{ctor:"::",_0:e._0,_1:{ctor:"[]"}},_1:{ctor:"[]"}};var n=e._0,o=_(v_,t,e._1);return"::"===o.ctor?_(t,n,e._1._0)?{ctor:"::",_0:{ctor:"::",_0:n,_1:o._0},_1:o._1}:{ctor:"::",_0:{ctor:"::",_0:n,_1:{ctor:"[]"}},_1:o}:{ctor:"[]"}})),m_=(r(function(t,e){var n=r(function(t,r){var e=r;return"Nothing"===e.ctor?H:"[]"===e._0.ctor?H:m.eq(t,e._0._0)?z(e._0._1):H});return s(ut,n,z(e),t)}),r(function(t,r){return{ctor:"_Tuple2",_0:_(At,t,r),_1:_(Y,t,r)}})),g_=e(function(t,r,e){for(;;){var n={ctor:"_Tuple2",_0:t,_1:r};{if("_Tuple2"!==n.ctor||"::"!==n._0.ctor||"::"!==n._1.ctor)return gt(e);var o=_(m_,n._0._0,r),c=o._0,u=o._1,i=n._0._1,a=u,s={ctor:"::",_0:c,_1:e};t=i,r=a,e=s}}}),y_=(r(function(t,r){return s(g_,t,r,{ctor:"[]"})}),r(function(t,r){var e=t(r);return"Nothing"===e.ctor?{ctor:"[]"}:{ctor:"::",_0:e._0._0,_1:_(y_,t,e._0._1)}})),b_=r(function(t,r){var e=r;if("[]"===e.ctor)return{ctor:"[]"};if("[]"===e._1.ctor)return{ctor:"::",_0:e._0,_1:{ctor:"[]"}};var n=_(b_,t,e._1);return"::"===n.ctor?{ctor:"::",_0:_(t,e._0,n._0),_1:n}:{ctor:"[]"}}),w_=e(function(t,r,e){var n=e;if("[]"===n.ctor)return{ctor:"::",_0:r,_1:{ctor:"[]"}};var o=s(w_,t,r,n._1);return"::"===o.ctor?{ctor:"::",_0:_(t,n._0,o._0),_1:o}:{ctor:"[]"}}),T_=(r(function(t,r){var e=r;return"[]"===e.ctor?{ctor:"[]"}:s(yt,t,e._0,e._1)}),e(function(t,e,n){var o=r(function(r,e){var n=e,o=n._0;return{ctor:"_Tuple2",_0:o-1,_1:s(t,o,r,n._1)}});return xr(s(ct,o,{ctor:"_Tuple2",_0:it(n)-1,_1:e},n))}),e(function(t,e,n){var o=r(function(r,e){var n=e,o=n._0;return{ctor:"_Tuple2",_0:o+1,_1:s(t,o,r,n._1)}});return xr(s(ut,o,{ctor:"_Tuple2",_0:0,_1:e},n))}),r(function(t,e){var n=r(function(r,e){return z(function(){var n=e;return"Nothing"===n.ctor?r:_(t,r,n._0)}())});return s(ct,n,H,e)}),r(function(t,e){var n=r(function(r,e){return z(function(){var n=e;return"Nothing"===n.ctor?r:_(t,n._0,r)}())});return s(ut,n,H,e)})),k_=e(function(t,r,e){t:for(;;){var n={ctor:"_Tuple2",_0:t,_1:r};r:do{if("::"===n._0.ctor){if("::"===n._1.ctor){var o=n._0._1,c=n._1._1,u=_(k["++"],e,{ctor:"::",_0:n._0._0,_1:{ctor:"::",_0:n._1._0,_1:{ctor:"[]"}}});t=o,r=c,e=u;continue t}break r}if("[]"===n._1.ctor)break r;return _(k["++"],e,n._1)}while(!1);return _(k["++"],e,n._0)}}),S_=r(function(t,r){return s(k_,t,r,{ctor:"[]"})}),x_=function(t){var e=t;return"[]"===e.ctor?{ctor:"::",_0:{ctor:"[]"},_1:{ctor:"[]"}}:_(Tt,function(t){var e=t;return _(pt,r(function(t,r){return{ctor:"::",_0:t,_1:r}})(e._0),x_(e._1))},d_(e))},E_=(r(function(t,r){return _(_t,t,x_(r))}),function(t){var e=t;if("[]"===e.ctor)return{ctor:"[]"};var n=e._0,o=r(function(t,r){return{ctor:"::",_0:t,_1:{ctor:"::",_0:{ctor:"::",_0:n,_1:t},_1:r}}});return{ctor:"::",_0:{ctor:"::",_0:n,_1:{ctor:"[]"}},_1:s(ct,o,{ctor:"[]"},E_(e._1))}}),A_=function(t){return{ctor:"::",_0:{ctor:"[]"},_1:E_(t)}},O_=(r(function(t,r){return _(_t,t,A_(r))}),r(function(t,r){return _(ht,function(r){return!t(r)},r)}),r(function(t,r){if(m.cmp(t,0)<0)return r;var e=ft(_(Y,t,r)),n=_(At,t,r),o=e;return"Nothing"===o.ctor?r:_(bt,n,o._0)}),r(function(t,e){var n=r(function(r,e){var n=r,o=e,c=_(t,n._0,o._0);return"EQ"===c.ctor?_(M,n._1,o._1):c}),o=_(Nt,r(function(t,r){return{ctor:"_Tuple2",_0:r,_1:t}}),e);return _(pt,Er,_(X,n,o))}),e(function(t,r,e){if(m.cmp(t,0)<0)return H;var n=ft(_(Y,t,e)),o=_(At,t,e),c=n;return"Nothing"===c.ctor?H:z(_(bt,o,{ctor:"::",_0:r,_1:c._0}))}),r(function(t,r){var e=r;if("[]"===e.ctor)return{ctor:"[]"};var n=e._1,o=e._0;return m.eq(t,o)?n:{ctor:"::",_0:o,_1:_(O_,t,n)}})),I_=e(function(t,e,n){return _(Nt,r(function(r,n){return t(r)?e(n):n}),n)}),C_=(e(function(t,e,n){return m.cmp(t,0)<0||m.cmp(t,it(n))>-1?H:z(s(I_,r(function(t,r){return m.eq(t,r)})(t),e,n))}),e(function(t,r,e){return _(pt,function(e){return t(e)?r(e):e},e)})),q_=(e(function(t,r,e){return s(C_,t,w(r),e)}),function(t){return function(e){return _(pt,Er,_(ht,function(r){return t(r._1)},_(Nt,r(function(t,r){return{ctor:"_Tuple2",_0:t,_1:r}}),e)))}}),N_=function(t){return function(r){return lt(_(q_,t,r))}},M_=r(function(t,r){for(;;){var e=r;if("[]"===e.ctor)return H;var n=e._0;if(t(n))return z(n);var o=t,c=e._1;t=o,r=c}}),j_=Tt,D_=(e(function(t,r,e){return _(j_,function(r){return _(j_,function(e){return{ctor:"::",_0:_(t,r,e),_1:{ctor:"[]"}}},e)},r)}),n(function(t,r,e,n){return _(j_,function(r){return _(j_,function(e){return _(j_,function(n){return{ctor:"::",_0:s(t,r,e,n),_1:{ctor:"[]"}}},n)},e)},r)}),o(function(t,r,e,n,o){return _(j_,function(r){return _(j_,function(e){return _(j_,function(n){return _(j_,function(o){return{ctor:"::",_0:f(t,r,e,n,o),_1:{ctor:"[]"}}},o)},n)},e)},r)}),r(function(t,e){return s(et,r(function(t,r){return t(r)}),t,e)}),e(function(t,r,e){for(;;){var n=e;if("[]"===n.ctor)return{ctor:"[]"};var o=n._1,c=n._0,u=t(c);{if(!_(oi,u,r))return{ctor:"::",_0:c,_1:s(D_,t,_(ai,u,r),o)};var i=t,a=r,f=o;t=i,r=a,e=f}}})),R_=r(function(t,r){return s(D_,t,ui,r)}),B_=(r(function(t,r){return m.eq(it(r),it(_(R_,t,r)))}),function(t){return s(D_,T,ui,t)}),L_=r(function(t,r){for(;;){var e=r;if("[]"===e.ctor)return{ctor:"[]"};{if(!t(e._0))return r;var n=t,o=e._1;t=n,r=o}}}),P_=r(function(t,r){var e=r;if("[]"===e.ctor)return{ctor:"[]"};var n=e._0;return t(n)?{ctor:"::",_0:n,_1:_(P_,t,e._1)}:{ctor:"[]"}}),F_=r(function(t,r){return{ctor:"_Tuple2",_0:_(P_,t,r),_1:_(L_,t,r)}}),$_=r(function(t,r){var e=r;if("[]"===e.ctor)return{ctor:"[]"};var n=e._0,o=_(F_,t(n),e._1),c=o._0,u=o._1;return{ctor:"::",_0:{ctor:"::",_0:n,_1:c},_1:_($_,t,u)}}),U_=($_(r(function(t,r){return m.eq(t,r)})),r(function(t,e){var n=r(function(r,e){var n=e,o=n._1,c=t(r);return m.cmp(c,o)<0?{ctor:"_Tuple2",_0:r,_1:c}:{ctor:"_Tuple2",_0:n._0,_1:o}}),o=e;if("::"===o.ctor){if("[]"===o._1.ctor)return z(o._0);var c=o._0;return z(Er(s(ut,n,{ctor:"_Tuple2",_0:c,_1:t(c)},o._1)))}return H}),r(function(t,e){var n=r(function(r,e){var n=e,o=n._1,c=t(r);return m.cmp(c,o)>0?{ctor:"_Tuple2",_0:r,_1:c}:{ctor:"_Tuple2",_0:n._0,_1:o}}),o=e;if("::"===o.ctor){if("[]"===o._1.ctor)return z(o._0);var c=o._0;return z(Er(s(ut,n,{ctor:"_Tuple2",_0:c,_1:t(c)},o._1)))}return H}),function(t){var r=t;return"[]"===r.ctor?H:z({ctor:"_Tuple2",_0:r._0,_1:r._1})}),J_=(e(function(t,e,n){for(;;){if(m.eq(t,e))return z(n);{if(!(m.cmp(t,e)>0)){if(m.cmp(t,0)<0)return H;var o=_(m_,t,n),c=o._0,u=o._1,i=_(m_,e-t,u),a=i._0,f=i._1;return s(G,r(function(t,r){var e=t,n=r;return wt({ctor:"::",_0:c,_1:{ctor:"::",_0:{ctor:"::",_0:n._0,_1:e._1},_1:{ctor:"::",_0:{ctor:"::",_0:e._0,_1:n._1},_1:{ctor:"[]"}}}})}),U_(a),U_(f))}var l=e,d=t,p=n;t=l,e=d,n=p}}}),r(function(t,r){var e=t(r);return"Just"===e.ctor?{ctor:"::",_0:r,_1:_(J_,t,e._0)}:{ctor:"::",_0:r,_1:{ctor:"[]"}}})),H_=r(function(t,r){return m.cmp(t,0)<0?H:lt(_(Y,t,r))}),V_=V_||{};V_["!!"]=b(H_);var z_=(function(){var t=r(function(t,r){return function(e){return _(J,t,_(W,r,e))}});_(ct,function(e){return function(n){return z(s(t,{ctor:"[]"},r(function(t,r){return{ctor:"::",_0:t,_1:r}})(e),n))}},H)}(),T_(b(w)),r(function(t,r){var e=t;return"Nothing"===e.ctor?r:{ctor:"::",_0:e._0,_1:r}})),W_=(_(ct,z_,{ctor:"[]"}),r(function(t,r){var e=_(W,t,r);return"Just"===e.ctor&&!0===e._0?r:H}),function(t){var e=r(function(r,e){var n=t(r);return"Nothing"===n.ctor?H:_(W,Yr(n._0),e)});_(te,e,z(Zr))}(T),function(t){var e=r(function(e,n){var o=t(e);return"Nothing"===o.ctor?H:_(W,r(function(t,r){return{ctor:"::",_0:t,_1:r}})(o._0),n)});_(ct,e,z({ctor:"[]"}))}(T),r(function(t,r){return"Nothing"===r.ctor?t:r})),G_=r(function(t,r){return"Nothing"===r.ctor?t({ctor:"_Tuple0"}):r}),K_=(r(function(t,r){return"Nothing"===t.ctor?r({ctor:"_Tuple0"}):t}),r(function(t,r){return"Nothing"===t.ctor?r:t}),G(w),G(b(w)),G(r(function(t,r){return r(t)})),e(function(t,r,e){var n=e;return"Nothing"===n.ctor?t({ctor:"_Tuple0"}):r(n._0)})),X_=e(function(t,r,e){var n=e;return"Nothing"===n.ctor?t:r(n._0)}),Q_=Q_||{};Q_["?"]=r(function(t,r){return _(J,r,t)});var Y_=(r(function(t,r){return"Err"===r.ctor?t:r}),r(function(t,r){return"Err"===r.ctor?t({ctor:"_Tuple0"}):r}),r(function(t,r){return"Err"===t.ctor?r({ctor:"_Tuple0"}):t}),r(function(t,r){return"Err"===t.ctor?r:t}),r(function(t,r){var e={ctor:"_Tuple2",_0:t,_1:r};return"Err"===e._1.ctor?Dt(e._1._0):_(Lt,e._1._0,e._0)}),_(ct,Pt(r(function(t,r){return{ctor:"::",_0:t,_1:r}})),Bt({ctor:"[]"})),e(function(t,r,e){var n=e;return"Ok"===n.ctor?Bt(r(n._0)):Dt(t(n._0))}),e(function(t,r,e){var n=e;return"Ok"===n.ctor?r(n._0):t(n._0)}),e(function(t,r,e){var n=e;return"Ok"===n.ctor?r(n._0):t}),r(function(t,r){var e=r;return"Ok"===e.ctor?e._0:t(e._0)}),function(){var t={ctor:"::",_0:{ctor:"_Tuple2",_0:"[à-æ]",_1:"a"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"[À-Æ]",_1:"A"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ç",_1:"c"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Ç",_1:"C"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"[è-ë]",_1:"e"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"[È-Ë]",_1:"E"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"[ì-ï]",_1:"i"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"[Ì-Ï]",_1:"I"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ñ",_1:"n"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Ñ",_1:"N"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"[ò-ö]",_1:"o"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"[Ò-Ö]",_1:"O"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"[ù-ü]",_1:"u"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"[Ù-Ü]",_1:"U"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ý",_1:"y"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ÿ",_1:"y"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Ý",_1:"Y"},_1:{ctor:"[]"}}}}}}}}}}}}}}}}}};_(pt,function(t){var r=t;return{ctor:"_Tuple2",_0:Dc(r._0),_1:r._1}},t)}(),function(t){return Tr(t)?H:z(t)}),Z_=(r(function(t,r){return _(J,"",_(W,_(b,sr,r),lt(gt(_(Qt,t,r)))))}),r(function(t,e){return _(J,"",_(W,function(n){return s(b,ar,e,_(r(function(t,r){return t+r}),vr(t),n))},lt(gt(_(Qt,t,e)))))}),r(function(t,r){for(;;){var e=r;if("[]"===e.ctor)return t;if("Just"===e._0.ctor)return e._0._0;var n=t,o=e._1;t=n,r=o}})),ts=function(t){return _(Z_,"",t)},rs=(r(function(t,r){return _(dr,"",_(pt,function(t){return ts(function(t){return t.submatches}(t))},s(Mc,Bc(1),Dc(_(k["++"],"^(.*?)",Rc(t))),r)))}),r(function(t,r){return _(dr,"",_(pt,function(t){return ts(function(t){return t.submatches}(t))},s(Mc,Bc(1),Dc(_(k["++"],Rc(t),"(.*)$")),r)))}),e(function(t,r,e){return m.eq(e,1)?_(k["++"],"1 ",t):_(k["++"],S(e),_(k["++"]," ",r))}),e(function(t,r,e){for(;;){var n=e;if("[]"===n.ctor)return r;if("[]"===n._1.ctor)return _(k["++"],r,_(k["++"],t,n._0));var o=t,c=_(k["++"],r,_(k["++"],", ",n._0)),u=n._1;t=o,r=c,e=u}}),e(function(t,r,e){return m.cmp(vr(e),t)<1?e:_(k["++"],_(sr,t-vr(r),e),r)})),es=r(function(t,r){return s(rs,t,"...",r)}),ns=(r(function(t,r){return m.eq(vr(t),0)||m.eq(vr(r),0)?0:it(_(Qt,t,r))}),function(t){return tr(f(Nc,Lc,Dc("[_-\\s]+"),w("-"),f(Nc,Lc,Dc("([A-Z])"),function(t){return _(gr,"-",function(t){return t.match}(t))},or(t))))}),os=function(t){return tr(f(Nc,Lc,Dc("[_-\\s]+"),w("_"),f(Nc,Lc,Dc("([a-z\\d])([A-Z]+)"),function(t){return _(dr,"_",_(mt,T,function(t){return t.submatches}(t)))},or(t))))},cs=(r(function(t,r){if(_(Zt,t,r)&&_(Yt,t,r)){var e=vr(t);return _(ir,e,_(ar,e,r))}return r}),r(function(t,r){return _(k["++"],t,_(k["++"],r,t))}),function(t){return Dc(_(k["++"],".{1,",_(k["++"],S(t),"}(\\s+|$)|\\S+?(\\s+|$)")))}),us=(r(function(t,r){return m.cmp(vr(r),t)<1?r:s(b,gr,"...",f(Nc,Lc,Dc("([\\.,;:\\s])+$"),w(""),_(dr,"",_(pt,function(t){return t.match},s(Mc,Bc(1),cs(t),r)))))}),r(function(t,r){return m.cmp(t,0)<1?{ctor:"[]"}:_(pt,function(t){return t.match},s(Mc,Lc,cs(t),r))})),is=e(function(t,r,e){return _(dr,r,_(us,t,e))}),as=(r(function(t,r){return s(is,t,"\n",r)}),e(function(t,r,e){for(;;){if(""===r)return gt(e);var n=t,o=_(ar,t,r),c={ctor:"::",_0:s(fr,0,t,r),_1:e};t=n,r=o,e=c}})),_s=r(function(t,r){return m.eq(t,0)||m.eq(r,"")?{ctor:"::",_0:r,_1:{ctor:"[]"}}:s(as,t,r,{ctor:"[]"})}),ss=e(function(t,r,e){return _(dr,r,_(_s,t,e))}),fs=(r(function(t,r){return s(ss,t,"\n",r)}),n(function(t,r,e,n){return _(k["++"],s(fr,0,r,n),_(k["++"],t,s(fr,e,vr(n),n)))})),ls=(e(function(t,r,e){return f(fs,t,r,r,e)}),e(function(t,r,e){return f(Nc,Lc,Dc(Rc(t)),function(t){return r},e)}),r(function(t,r){return _(J,"",_(W,function(r){var e=r;return _(br,t(e._0),e._1)},yr(r)))}),Or.kill),ds=(Or.sleep,Or.spawn),ps=function(){function t(t){return function(r,e,n){return Or.nativeBinding(function(o){function c(t){var r=_(fn,e,t);"Ok"===r.ctor&&Or.rawSpawn(n(r._0))}return t.addEventListener(r,c),function(){t.removeEventListener(r,c)}})}}function n(t,r){return Or.nativeBinding(function(e){y(function(){var n=document.getElementById(t);if(null===n)return void e(Or.fail({ctor:"NotFound",_0:t}));e(Or.succeed(r(n)))})})}function o(t){return n(t,function(t){return t.focus(),m.Tuple0})}function c(t){return n(t,function(t){return t.blur(),m.Tuple0})}function u(t){return n(t,function(t){return t.scrollTop})}function i(t,r){return n(t,function(t){return t.scrollTop=r,m.Tuple0})}function a(t){return n(t,function(t){return t.scrollTop=t.scrollHeight,m.Tuple0})}function s(t){return n(t,function(t){return t.scrollLeft})}function f(t,r){return n(t,function(t){return t.scrollLeft=r,m.Tuple0})}function l(t){return n(t,function(t){return t.scrollLeft=t.scrollWidth,m.Tuple0})}function d(t,r){return n(r,function(r){switch(t.ctor){case"Content":return r.scrollWidth;case"VisibleContent":return r.clientWidth;case"VisibleContentWithBorders":return r.offsetWidth;case"VisibleContentWithBordersAndMargins":var e=r.getBoundingClientRect();return e.right-e.left}})}function p(t,r){return n(r,function(r){switch(t.ctor){case"Content":return r.scrollHeight;case"VisibleContent":return r.clientHeight;case"VisibleContentWithBorders":return r.offsetHeight;case"VisibleContentWithBordersAndMargins":var e=r.getBoundingClientRect();return e.bottom-e.top}})}var h={addEventListener:function(){},removeEventListener:function(){}},v=t("undefined"!=typeof document?document:h),g=t("undefined"!=typeof window?window:h),y="undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(t){t()};return{onDocument:e(v),onWindow:e(g),focus:o,blur:c,getScrollTop:u,setScrollTop:r(i),getScrollLeft:s,setScrollLeft:r(f),toBottom:a,toRight:l,height:r(p),width:r(d)}}(),hs=(ps.blur,ps.focus,ps.onWindow),vs=ps.onDocument,ms=Ni,gs=(ms("ol"),ms("ul"),function(){function t(t){return encodeURIComponent(t)}function e(t){try{return z(decodeURIComponent(t))}catch(t){return H}}function n(t,r){return Or.nativeBinding(function(e){var n=new XMLHttpRequest;o(n,r),n.addEventListener("error",function(){e(Or.fail({ctor:"NetworkError"}))}),n.addEventListener("timeout",function(){e(Or.fail({ctor:"Timeout"}))}),n.addEventListener("load",function(){e(i(n,t.expect.responseToResult))});try{n.open(t.method,t.url,!0)}catch(r){return e(Or.fail({ctor:"BadUrl",_0:t.url}))}return c(n,t),u(n,t.body),function(){n.abort()}})}function o(t,r){"Nothing"!==r.ctor&&t.addEventListener("progress",function(t){t.lengthComputable&&Or.rawSpawn(r._0({bytes:t.loaded,bytesExpected:t.total}))})}function c(t,r){function e(r){t.setRequestHeader(r._0,r._1)}_(pt,e,r.headers),t.responseType=r.expect.responseType,t.withCredentials=r.withCredentials,"Just"===r.timeout.ctor&&(t.timeout=r.timeout._0)}function u(t,r){switch(r.ctor){case"EmptyBody":return void t.send();case"StringBody":return t.setRequestHeader("Content-Type",r._0),void t.send(r._1);case"FormDataBody":return void t.send(r._0)}}function i(t,r){var e=a(t);if(t.status<200||300<=t.status)return e.body=t.responseText,Or.fail({ctor:"BadStatus",_0:e});var n=r(e);return"Ok"===n.ctor?Or.succeed(n._0):(e.body=t.responseText,Or.fail({ctor:"BadPayload",_0:n._0,_1:e}))}function a(t){return{status:{code:t.status,message:t.statusText},headers:f(t.getAllResponseHeaders()),url:t.responseURL,body:t.response}}function f(t){var r=xe;if(!t)return r;for(var e=t.split("\r\n"),n=e.length;n--;){var o=e[n],c=o.indexOf(": ");if(c>0){var u=o.substring(0,c),i=o.substring(c+2);r=s(Ue,u,function(t){return z("Just"===t.ctor?i+", "+t._0:i)},r)}}return r}function l(t){return{responseType:"text",responseToResult:t}}function d(t,r){return{responseType:r.responseType,responseToResult:function(e){var n=r.responseToResult(e);return _(Lt,t,n)}}}function p(t){for(var r=new FormData;"[]"!==t.ctor;){var e=t._0;r.append(e._0,e._1),t=t._1}return{ctor:"FormDataBody",_0:r}}return{toTask:r(n),expectStringResponse:l,mapExpect:r(d),multipart:p,encodeUri:t,decodeUri:e}}()),ys=(r(function(t,r){return m.update(r,{expect:_(gs.mapExpect,t,r.expect)})}),u(function(t,r,e,n,o,c,u){return{method:t,headers:r,url:e,body:n,expect:o,timeout:c,withCredentials:u}}),function(t){return{ctor:"Request",_0:t}}),bs=(r(function(t,r){return{ctor:"StringBody",_0:t,_1:r}}),{ctor:"EmptyBody"}),ws=(r(function(t,r){return{ctor:"Header",_0:t,_1:r}}),gs.decodeUri),Ts=gs.encodeUri,ks=gs.expectStringResponse,Ss=function(t){return ks(function(r){return _(ln,t,r.body)})},xs=(ks(function(t){return Bt(t.body)}),gs.multipart,bs),Es=ys,As=(e(function(t,r,e){return Es({method:"POST",headers:{ctor:"[]"},url:t,body:r,expect:Ss(e),timeout:H,withCredentials:!1})}),r(function(t,r){return Es({method:"GET",headers:{ctor:"[]"},url:t,body:xs,expect:Ss(r),timeout:H,withCredentials:!1})})),Os=function(t){var r=t;return _(gs.toTask,r._0,H)},Is=r(function(t,r){return _(oo,t,Os(r))}),Cs=(n(function(t,r,e,n){return{url:t,status:r,headers:e,body:n}}),r(function(t,r){return{ctor:"BadPayload",_0:t,_1:r}}),r(function(t,r){return{ctor:"StringPart",_0:t,_1:r}}),e(function(t,r,e){var n=r,o=_(le,n.category,e);if("Nothing"===o.ctor)return Gn(e);var c=function(r){return _(Br,t,r(n.keyCode))};return _(Vn,function(t){return Gn(e)},Qn(_(pt,c,o._0.taggers)))})),qs=qs||{};qs["&>"]=r(function(t,r){return _(Vn,function(t){return r},t)});var Ns=Gn(xe),Ms=r(function(t,r){var e=r;return z("Nothing"===e.ctor?{ctor:"::",_0:t,_1:{ctor:"[]"}}:{ctor:"::",_0:t,_1:e._0})}),js=r(function(t,r){for(;;){var e=t;if("[]"===e.ctor)return r;var n=e._1,o=s(Ue,e._0._0,Ms(e._0._1),r);t=n,r=o}}),Ds=function(t){return _(js,t,xe)},Rs=_(yn,"keyCode",kn),Bs=Ar.leaf("Keyboard"),Ls=r(function(t,r){return{taggers:t,pid:r}}),Ps=r(function(t,r){return{category:t,keyCode:r}}),Fs=e(function(t,r,o){var c=e(function(r,e,n){return _(Vn,function(n){return _(Vn,function(t){return Gn(s(Je,r,_(Ls,e,t),n))},ds(s(vs,r,Rs,function(e){return _(Rr,t,_(Ps,r,e))})))},n)}),u=n(function(t,r,e,n){return _(Kn,_(Je,t,_(Ls,e,r.pid)),n)}),i=e(function(t,r,e){var n=r;return _(qs["&>"],ls(n.pid),e)});return d(ae,i,u,c,o,Ds(r),Gn(xe))}),$s=r(function(t,r){return{ctor:"MySub",_0:t,_1:r}}),Us=function(t){return Bs(_($s,"keydown",t))},Js=function(t){return Bs(_($s,"keyup",t))},Hs=r(function(t,r){var e=r;return _($s,e._0,function(r){return t(e._1(r))})});Ar.effectManagers.Keyboard={pkg:"elm-lang/keyboard",init:Ns,onEffects:Fs,onSelfMsg:Cs,tag:"sub",subMap:Hs};var Vs=function(){function t(t){var r,e=!1;return function(n){return e||(r=t(n),e=!0),r}}return{memoize:t}}(),zs=function(t){return t._0({ctor:"_Tuple0"})},Ws=function(t){return{ctor:"Lazy",_0:t}},Gs=function(t){return Ws(Vs.memoize(t))},Ks=(r(function(t,r){return Gs(function(e){return t(zs(r))})}),e(function(t,r,e){return Gs(function(n){return _(t,zs(r),zs(e))})}),n(function(t,r,e,n){return Gs(function(o){return s(t,zs(r),zs(e),zs(n))})}),o(function(t,r,e,n,o){return Gs(function(c){return f(t,zs(r),zs(e),zs(n),zs(o))})}),c(function(t,r,e,n,o,c){return Gs(function(u){return l(t,zs(r),zs(e),zs(n),zs(o),zs(c))})}),r(function(t,r){return Gs(function(e){return _(zs,t,zs(r))})}),r(function(t,r){return Gs(function(e){return zs(t(zs(r)))})}),function(){function t(t){return Or.nativeBinding(function(r){0!==t&&history.go(t),r(Or.succeed(m.Tuple0))})}function r(t){return Or.nativeBinding(function(r){history.pushState({},"",t),r(Or.succeed(c()))})}function e(t){return Or.nativeBinding(function(r){history.replaceState({},"",t),r(Or.succeed(c()))})}function n(t){return Or.nativeBinding(function(r){document.location.reload(t),r(Or.succeed(m.Tuple0))})}function o(t){return Or.nativeBinding(function(r){try{window.location=t}catch(t){document.location.reload(!1)}r(Or.succeed(m.Tuple0))})}function c(){var t=document.location;return{href:t.href,host:t.host,hostname:t.hostname,protocol:t.protocol,origin:t.origin,port_:t.port,pathname:t.pathname,search:t.search,hash:t.hash,username:t.username,password:t.password}}function u(){return-1!==window.navigator.userAgent.indexOf("Trident")}return{go:t,setLocation:o,reloadPage:n,pushState:r,replaceState:e,getLocation:c,isInternetExplorer11:u}}()),Xs=Ks.replaceState,Qs=Ks.pushState,Ys=Ks.go,Zs=Ks.reloadPage,tf=Ks.setLocation,rf=rf||{};rf["&>"]=r(function(t,r){return _(Vn,function(t){return r},t)});var ef=e(function(t,r,e){var n=function(r){return _(Br,t,r._0(e))};return _(rf["&>"],Qn(_(pt,n,r)),Gn({ctor:"_Tuple0"}))}),nf=e(function(t,r,e){var n=e;switch(n.ctor){case"Jump":return Ys(n._0);case"New":return _(Vn,_(ef,t,r),Qs(n._0));case"Modify":return _(Vn,_(ef,t,r),Xs(n._0));case"Visit":return tf(n._0);default:return Zs(n._0)}}),of=function(t){var r=t;return"Normal"===r.ctor?ls(r._0):_(rf["&>"],ls(r._0),ls(r._1))},cf=e(function(t,r,e){return _(rf["&>"],s(ef,t,e.subs,r),Gn(e))}),uf=Ar.leaf("Navigation"),af=Ar.leaf("Navigation"),_f=r(function(t,r){return{subs:t,popWatcher:r}}),sf=Gn(_(_f,{ctor:"[]"},H)),ff=function(t){return{ctor:"Reload",_0:t}},lf=(af(ff(!1)),af(ff(!0)),function(t){return{ctor:"Visit",_0:t}}),df=function(t){return{ctor:"Modify",_0:t}},pf=function(t){return af(df(t))},hf=function(t){return{ctor:"New",_0:t}},vf=function(t){return af(hf(t))},mf=function(t){return{ctor:"Jump",_0:t}},gf=r(function(t,r){var e=r;switch(e.ctor){case"Jump":return mf(e._0);case"New":return hf(e._0);case"Modify":return df(e._0);case"Visit":return lf(e._0);default:return ff(e._0)}}),yf=function(t){return{ctor:"Monitor",_0:t}},bf=(r(function(t,r){var e=r.init(Ks.getLocation({ctor:"_Tuple0"})),n=function(e){return Mr({ctor:"::",_0:uf(yf(t)),_1:{ctor:"::",_0:r.subscriptions(e),_1:{ctor:"[]"}}})};return Ji({init:e,view:r.view,update:r.update,subscriptions:n})}),r(function(t,r){var e=function(t){return _(r.init,t,Ks.getLocation({ctor:"_Tuple0"}))},n=function(e){return Mr({ctor:"::",_0:uf(yf(t)),_1:{ctor:"::",_0:r.subscriptions(e),_1:{ctor:"[]"}}})};return Ui({init:e,view:r.view,update:r.update,subscriptions:n})})),wf=r(function(t,r){var e=r;return yf(function(r){return t(e._0(r))})}),Tf=r(function(t,r){return{ctor:"InternetExplorer",_0:t,_1:r}}),kf=function(t){return{ctor:"Normal",_0:t}},Sf=function(t){var r=function(r){return _(Rr,t,Ks.getLocation({ctor:"_Tuple0"}))};return Ks.isInternetExplorer11({ctor:"_Tuple0"})?s(Xn,Tf,ds(s(hs,"popstate",un,r)),ds(s(hs,"hashchange",un,r))):_(Kn,kf,ds(s(hs,"popstate",un,r)))},xf=n(function(t,r,e,n){var o=n,c=o.popWatcher,u=function(){var r={ctor:"_Tuple2",_0:e,_1:c};t:do{if("[]"===r._0.ctor){if("Just"===r._1.ctor)return _(rf["&>"],of(r._1._0),Gn(_(_f,e,H)));break t}if("Nothing"===r._1.ctor)return _(Kn,function(t){return _(_f,e,z(t))},Sf(t));break t}while(!1);return Gn(_(_f,e,c))}();return _(rf["&>"],Qn(_(pt,_(nf,t,e),r)),u)});Ar.effectManagers.Navigation={pkg:"elm-lang/navigation",init:sf,onEffects:xf,onSelfMsg:cf,tag:"fx",cmdMap:gf,subMap:wf};var Ef=_(Li,"namespace",on("http://www.w3.org/2000/svg")),Af=e(function(t,r,e){return s($i,t,{ctor:"::",_0:Ef,_1:r},e)}),Of=(Af("svg"),Af("foreignObject"),Af("animate"),Af("animateColor"),Af("animateMotion"),Af("animateTransform"),Af("mpath"),Af("set"),Af("a"),Af("defs"),Af("g"),Af("marker"),Af("mask"),Af("pattern"),Af("switch"),Af("symbol"),Af("desc"),Af("metadata"),Af("title"),Af("feBlend"),Af("feColorMatrix"),Af("feComponentTransfer"),Af("feComposite"),Af("feConvolveMatrix"),Af("feDiffuseLighting"),Af("feDisplacementMap"),Af("feFlood"),Af("feFuncA"),Af("feFuncB"),Af("feFuncG"),Af("feFuncR"),Af("feGaussianBlur"),Af("feImage"),Af("feMerge"),Af("feMergeNode"),Af("feMorphology"),Af("feOffset"),Af("feSpecularLighting"),Af("feTile"),Af("feTurbulence"),Af("font"),Af("linearGradient"),Af("radialGradient"),Af("stop"),Af("circle"),Af("ellipse"),Af("image"),Af("line"),Af("path"),Af("polygon"),Af("polyline"),Af("rect"),Af("use"),Af("feDistantLight"),Af("fePointLight"),Af("feSpotLight"),Af("altGlyph"),Af("altGlyphDef"),Af("altGlyphItem"),Af("glyph"),Af("glyphRef"),Af("textPath"),Af("text"),Af("tref"),Af("tspan"),Af("clipPath"),Af("colorProfile"),Af("cursor"),Af("filter"),Af("script"),Af("style"),Af("view"),Di),If=r(function(t,r){return _(Of,t,sn(r))}),Cf=(If("begin"),If("end"),If("repeat"),If("abort"),If("error"),If("resize"),If("scroll"),If("load"),If("unload"),If("zoom"),If("activate"),If("click"),If("focusin")),qf=(If("focusout"),If("mousedown"),If("mousemove"),If("mouseout"),If("mouseover"),If("mouseup"),r(function(t,r){return{i18n:t,format:r}}),r(function(t,r){var e=function(){switch(r){case 1:return"1st";case 21:return"21st";case 2:return"2nd";case 22:return"22nd";case 3:return"3rd";case 23:return"23rd";case 31:return"31st";default:return _(k["++"],S(r),"th")}}();return t?s(ur,4,m.chr(" "),e):e})),Nf=function(t){switch(t.ctor){case"Jan":return"January";case"Feb":return"February";case"Mar":return"March";case"Apr":return"April";case"May":return"May";case"Jun":return"June";case"Jul":return"July";case"Aug":return"August";case"Sep":return"September";case"Oct":return"October";case"Nov":return"November";default:return"December"}},Mf=function(t){switch(t.ctor){case"Jan":return"Jan";case"Feb":return"Feb";case"Mar":return"Mar";case"Apr":return"Apr";case"May":return"May";case"Jun":return"Jun";case"Jul":return"Jul";case"Aug":return"Aug";case"Sep":return"Sep";case"Oct":return"Oct";case"Nov":return"Nov";default:return"Dec"}},jf=function(t){switch(t.ctor){case"Mon":return"Monday";case"Tue":return"Tuesday";case"Wed":return"Wednesday";case"Thu":return"Thursday";case"Fri":return"Friday";case"Sat":return"Saturday";default:return"Sunday"}},Df=function(t){switch(t.ctor){case"Mon":return"Mon";case"Tue":return"Tue";case"Wed":return"Wed";case"Thu":return"Thu";case"Fri":return"Fri";case"Sat":return"Sat";default:return"Sun"}},Rf={i18n:{dayShort:Df,dayName:jf,monthShort:Mf,monthName:Nf,dayOfMonthWithSuffix:qf},format:{date:"%-m/%-d/%Y",longDate:"%A, %B %d, %Y",time:"%-H:%M %p",longTime:"%-H:%M:%S %p",dateTime:"%-m/%-d/%Y %-I:%M %p",firstDayOfWeek:qo}},Bf=function(t){return m.cmp(t,1)<1?Ko:m.eq(t,2)?Go:m.eq(t,3)?Wo:m.eq(t,4)?zo:m.eq(t,5)?Vo:m.eq(t,6)?Ho:m.eq(t,7)?Jo:m.eq(t,8)?Uo:m.eq(t,9)?$o:m.eq(t,10)?Fo:m.eq(t,11)?Po:Lo},Lf=function(t){switch(t.ctor){case"Jan":return 1;case"Feb":return 2;case"Mar":return 3;case"Apr":return 4;case"May":return 5;case"Jun":return 6;case"Jul":return 7;case"Aug":return 8;case"Sep":return 9;case"Oct":return 10;case"Nov":return 11;default:return 12}},Pf=function(t){return m.eq(_(k["%"],t,4),0)&&!m.eq(_(k["%"],t,100),0)||m.eq(_(k["%"],t,400),0)},Ff=r(function(t,r){switch(r.ctor){case"Jan":return 31;case"Feb":return Pf(t)?29:28;case"Mar":return 31;case"Apr":return 30;case"May":return 31;case"Jun":return 30;case"Jul":case"Aug":return 31;case"Sep":return 30;case"Oct":return 31;case"Nov":return 30;default:return 31}}),$f=function(t){return _(Ff,Ao(t),Eo(t))},Uf=function(t){return A(Io(t))},Jf=function(t){return Oo(x(t))},Hf=function(t){switch(t.ctor){case"Mon":return 1;case"Tue":return 2;case"Wed":return 3;case"Thu":return 4;case"Fri":return 5;case"Sat":return 6;default:return 7}},Vf=A(1),zf=1e3*Vf,Wf=60*zf,Gf=60*Wf,Kf=24*Gf,Xf=7*Kf,Qf=(r(function(t,r){var e=bo(t)-bo(r),n=wo(t)-wo(r),o=To(t)-To(r),c=ko(t)-ko(r),u=Uf(t)-Uf(r),i=u-c*Gf-o*Wf-n*zf-e*Vf,a=i/Kf|0,s=function(){if(m.cmp(a,0)<0){var t=D(a);return{ctor:"_Tuple2",_0:R(t/7|0),_1:R(_(k["%"],t,7))}}return{ctor:"_Tuple2",_0:a/7|0,_1:_(k["%"],a,7)}}();return{week:s._0,day:s._1,hour:c,minute:o,second:n,millisecond:e}}),e(function(t,e,n){return Jf(_(r(function(t,r){return t+r}),e*t,Uf(n)))})),Yf=function(t){var r=t;switch(r.ctor){case"Millisecond":return Vf;case"Second":return zf;case"Minute":return Wf;case"Hour":return Gf;case"Day":return Kf;case"Week":return Xf;default:var e=r._0;return Vf*e.millisecond+zf*e.second+Wf*e.minute+Gf*e.hour+Kf*e.day+Xf*e.week}},Zf=function(t){return Qf(Yf(t))},tl=(c(function(t,r,e,n,o,c){return{week:t,day:r,hour:e,minute:n,second:o,millisecond:c}}),function(t){return{ctor:"Delta",_0:t}}),rl={ctor:"Week"},el={ctor:"Day"},nl={ctor:"Hour"},ol={ctor:"Minute"},cl={ctor:"Second"},ul={ctor:"Millisecond"},il=e(function(t,r,e){var n=((153*(r+(m.cmp(r,2)>0?-3:9))+2)/5|0)+e-1,o=t-(m.cmp(r,2)<1?1:0),c=(m.cmp(o,0)>-1?o:o-399)/400|0,u=o-400*c;return 146097*c+(365*u+(u/4|0)-(u/100|0)+n)-719468}),al=u(function(t,r,e,n,o,c,u){var i=Lf(r),a=m.cmp(t,0)<0?0:t,f=s(j,1,_(Ff,a,r),e),l=s(il,a,i,f);return Yf(tl({millisecond:s(j,0,999,u),second:s(j,0,59,c),minute:s(j,0,59,o),hour:s(j,0,23,n),day:l,week:0}))}),_l=function(t){return p(al,Ao(t),Eo(t),xo(t),ko(t),To(t),wo(t),bo(t))},sl=function(t){var r=_l(t);return(A(Io(t))-r)/Wf|0},fl=r(function(t,e){return Jf(_(r(function(t,r){return t+r}),t*Wf,Uf(e)))}),ll=(r(function(t,r){return s(Zf,ol,sl(r)-sl(t),r)}),Uf),dl=Wf,pl=Lf,hl=Hf,vl=r(function(t,r){var e=hl(r),n=hl(t);return m.cmp(n,e)<0?7+n-e:n-e}),ml=Bf,gl=Jf,yl=$f,bl=Ff,wl=Oo(0),Tl=function(){var t=60*ko(wl)+To(wl);return m.eq(Ao(wl),1969)?0-(t-1440):0-t}(),kl=sl,Sl=function(t){var r=s(Zf,ul,t+Tl*dl,wl),e=kl(r);return m.eq(e,Tl)?r:s(Zf,ol,e-Tl,r)},xl=u(function(t,r,e,n,o,c,u){return Sl(p(al,t,r,e,n,o,c,u))}),El=(s(xl,1970,Ko,1),function(t){return{ctor:"_Tuple2",_0:t/60|0,_1:_(k["%"],t,60)}}),Al=r(function(t,r){return function(e){return s(ur,t,r,S(e))}}),Ol=function(t){return function(r){return s(ur,2,t,S(r))}},Il=function(t){return m.eq(_(k["%"],t,12),0)?12:_(k["%"],t,12)},Cl=r(function(t,r){var e=El(D(r)),n=e._0,o=e._1;return _(k["++"],m.cmp(r,0)<1?"+":"-",_(k["++"],_(Ol,m.chr("0"),n),_(k["++"],t,_(Ol,m.chr("0"),o))))}),ql=function(t){return _(V,T,t)},Nl=n(function(t,r,e,n){var o=_(J," ",ql(lt(n.submatches)));switch(o){case"Y":return s(Al,4,m.chr("0"),Ao(e));case"y":return _(_r,2,s(Al,2,m.chr("0"),Ao(e)));case"m":return _(Ol,m.chr("0"),pl(Eo(e)));case"_m":return _(Ol,m.chr(" "),pl(Eo(e)));case"-m":return S(pl(Eo(e)));case"B":return t.i18n.monthName(Eo(e));case"^B":return rr(t.i18n.monthName(Eo(e)));case"b":return t.i18n.monthShort(Eo(e));case"^b":return rr(t.i18n.monthShort(Eo(e)));case"d":return _(Ol,m.chr("0"),xo(e));case"-d":return S(xo(e));case"-@d":return _(t.i18n.dayOfMonthWithSuffix,!1,xo(e));case"e":return _(Ol,m.chr(" "),xo(e));case"@e":return _(t.i18n.dayOfMonthWithSuffix,!0,xo(e));case"A":return t.i18n.dayName(So(e));case"^A":return rr(t.i18n.dayName(So(e)));case"a":return t.i18n.dayShort(So(e));case"^a":return rr(t.i18n.dayShort(So(e)));case"H":return _(Ol,m.chr("0"),ko(e));case"-H":return S(ko(e));case"k":return _(Ol,m.chr(" "),ko(e));case"I":return _(Ol,m.chr("0"),Il(ko(e)));case"-I":return S(Il(ko(e)));case"l":return _(Ol,m.chr(" "),Il(ko(e)));case"p":return m.cmp(ko(e),12)<0?"AM":"PM";case"P":return m.cmp(ko(e),12)<0?"am":"pm";case"M":return _(Ol,m.chr("0"),To(e));case"S":return _(Ol,m.chr("0"),wo(e));case"L":return s(Al,3,m.chr("0"),bo(e));case"%":return o;case"z":return _(Cl,"",r);case":z":return _(Cl,":",r);default:return""}}),Ml=Dc("%(y|Y|m|_m|-m|B|^B|b|^b|d|-d|-@d|e|@e|A|^A|a|^a|H|-H|k|I|-I|l|p|P|M|S|%|L|z|:z)"),jl=n(function(t,r,e,n){var o=kl(n);return f(Nc,Lc,Ml,s(Nl,t,r,_(fl,o-r,n)),e)}),Dl=e(function(t,r,e){return f(jl,t,kl(e),r,e)}),Rl=(e(function(t,r,e){return f(jl,t,0,r,e)}),_(Dl,Rf,"%Y-%m-%dT%H:%M:%S.%L%:z"),_(Dl,Rf,"%Y-%m-%dT%H:%M:%S.%L"),{date:{months:{jan:"January",feb:"February",mar:"March",apr:"April",may:"May",jun:"June",jul:"July",aug:"August",sep:"September",oct:"October",nov:"November",dec:"December"},monthsAbbrev:{jan:"Jan",feb:"Feb",mar:"Mar",apr:"Apr",may:"May",jun:"Jun",jul:"Jul",aug:"Aug",sep:"Sep",oct:"Oct",nov:"Nov",dec:"Dec"},wdays:{mon:"Monday",tue:"Tuesday",wed:"Wednesday",thu:"Thursday",fri:"Friday",sat:"Saturday",sun:"Sunday"},wdaysAbbrev:{mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat",sun:"Sun"},defaultFormat:H},time:{am:"am",pm:"pm",defaultFormat:H},timeZones:H,defaultFormat:H}),Bl=(n(function(t,r,e,n){return{date:t,time:r,timeZones:e,defaultFormat:n}}),u(function(t,r,e,n,o,c,u){return{mon:t,tue:r,wed:e,thu:n,fri:o,sat:c,sun:u}}),function(t){return function(r){return s(ur,2,t,S(r))}}),Ll=function(t){return m.eq(t,0)?12:t},Pl=function(t){return _(k["%"],t,12)},Fl=r(function(t,r){switch(r.ctor){case"Mon":return t.mon;case"Tue":return t.tue;case"Wed":return t.wed;case"Thu":return t.thu;case"Fri":return t.fri;case"Sat":return t.sat;default:return t.sun}}),$l=r(function(t,r){switch(r.ctor){case"Jan":return t.jan;case"Feb":return t.feb;case"Mar":return t.mar;case"Apr":return t.apr;case"May":return t.may;case"Jun":return t.jun;case"Jul":return t.jul;case"Aug":return t.aug;case"Sep":return t.sep;case"Oct":return t.oct;case"Nov":return t.nov;default:return t.dec}}),Ul=function(t){switch(t.ctor){case"Jan":return 1;case"Feb":return 2;case"Mar":return 3;case"Apr":return 4;case"May":return 5;case"Jun":return 6;case"Jul":return 7;case"Aug":return 8;case"Sep":return 9;case"Oct":return 10;case"Nov":return 11;default:return 12}},Jl=e(function(t,r,e){switch(function(){var t=e.submatches;return"::"===t.ctor&&"Just"===t._0.ctor&&"[]"===t._1.ctor?t._0._0:" "}()){case"%":return"%";case"Y":return S(Ao(r));case"y":return _(_r,2,S(Ao(r)));case"m":return s(ur,2,m.chr("0"),S(Ul(Eo(r))));case"B":return _($l,t.date.months,Eo(r));case"b":return _($l,t.date.monthsAbbrev,Eo(r));case"d":return _(Bl,m.chr("0"),xo(r));case"e":return _(Bl,m.chr(" "),xo(r));case"a":return _(Fl,t.date.wdaysAbbrev,So(r));case"A":return _(Fl,t.date.wdays,So(r));case"H":return _(Bl,m.chr("0"),ko(r));case"k":return _(Bl,m.chr(" "),ko(r));case"I":return _(Bl,m.chr("0"),Ll(Pl(ko(r))));case"l":return _(Bl,m.chr(" "),Ll(Pl(ko(r))));case"p":return rr(m.cmp(ko(r),12)<0?t.time.am:t.time.pm);case"P":return m.cmp(ko(r),12)<0?t.time.am:t.time.pm;case"M":return _(Bl,m.chr("0"),To(r));case"S":return _(Bl,m.chr("0"),wo(r));default:return""}}),Hl=Dc("%(%|Y|y|m|B|b|d|e|a|A|H|k|I|l|p|P|M|S)"),Vl=e(function(t,r,e){return f(Nc,Lc,Hl,_(Jl,t,e),r)}),zl=r(function(t,r){return s(Vl,Rl,t,r)}),Wl=(zl("%Y-%m-%dT%H:%M:%SZ"),r(function(t,r){return _(zl,t,Oo(r))})),Gl=r(function(t,r){var e=65535&r,n=65535&r>>>16,o=65535&t;return 0|o*e+((65535&t>>>16)*e+o*n<<16>>>0)}),Kl=n(function(t,r,e,n){for(;;){if(m.cmp(r,1)<0)return{ctor:"_Tuple2",_0:t,_1:n};var o=e(n),c=o._0,u=o._1,i={ctor:"::",_0:c,_1:t},a=r-1,_=e,s=u;t=i,r=a,e=_,n=s}}),Xl=function(t){var r=t,e=r._0,n=277803737*(e^e>>>4+(e>>>28));return(n>>>22^n)>>>0},Ql=r(function(t,r){return t._0(r)}),Yl=e(function(t,r,e){for(;;){var n=_(Ql,t,e),o=n._0,c=n._1;if(r(o))return{ctor:"_Tuple2",_0:o,_1:c};var u=t,i=r,a=c;t=u,r=i,e=a}}),Zl=function(t){return{ctor:"Generator",_0:t}},td=r(function(t,r){var e=r;return Zl(function(r){return f(Kl,{ctor:"[]"},t,e._0,r)})}),rd=function(t){return Zl(function(r){return{ctor:"_Tuple2",_0:t,_1:r}})},ed=r(function(t,r){var e=r;return Zl(function(r){var n=e._0(r),o=n._0,c=n._1;return{ctor:"_Tuple2",_0:t(o),_1:c}})}),nd=e(function(t,r,e){var n=r,o=e;return Zl(function(r){var e=n._0(r),c=e._0,u=e._1,i=o._0(u),a=i._0,s=i._1;return{ctor:"_Tuple2",_0:_(t,c,a),_1:s}})}),od=(r(function(t,e){return s(nd,r(function(t,r){return{ctor:"_Tuple2",_0:t,_1:r}}),t,e)}),nd(r(function(t,r){return r(t)})),n(function(t,r,e,n){var o=r,c=e,u=n;return Zl(function(r){var e=o._0(r),n=e._0,i=e._1,a=c._0(i),_=a._0,f=a._1,l=u._0(f),d=l._0,p=l._1;return{ctor:"_Tuple2",_0:s(t,n,_,d),_1:p}})})),cd=(o(function(t,r,e,n,o){var c=r,u=e,i=n,a=o;return Zl(function(r){var e=c._0(r),n=e._0,o=e._1,_=u._0(o),s=_._0,l=_._1,d=i._0(l),p=d._0,h=d._1,v=a._0(h),m=v._0,g=v._1;return{ctor:"_Tuple2",_0:f(t,n,s,p,m),_1:g}})}),c(function(t,r,e,n,o,c){var u=r,i=e,a=n,_=o,s=c;return Zl(function(r){var e=u._0(r),n=e._0,o=e._1,c=i._0(o),f=c._0,d=c._1,p=a._0(d),h=p._0,v=p._1,m=_._0(v),g=m._0,y=m._1,b=s._0(y),w=b._0,T=b._1;return{ctor:"_Tuple2",_0:l(t,n,f,h,g,w),_1:T}})}),r(function(t,r){var e=r;return Zl(function(r){var n=e._0(r),o=n._0,c=n._1;return(0,t(o)._0)(c)})})),ud=(r(function(t,r){return _(cd,function(t){return t?_(ed,z,r):rd(H)},t)}),r(function(t,r){return Zl(_(Yl,r,t))}),r(function(t,r){return{ctor:"Seed",_0:t,_1:r}})),id=function(t){var r=t,e=r._1;return _(ud,1664525*r._0+e>>>0,e)},ad=function(t){var r=id(_(ud,0,1013904223)),e=r._0,n=r._1;return id(_(ud,e+t>>>0,n))},_d=(r(function(t,r){return _(no,t,_(Kn,function(t){return Er(_(Ql,r,ad(I(t))))},so))}),r(function(t,r){return Zl(function(e){var n=m.cmp(t,r)<0?{ctor:"_Tuple2",_0:t,_1:r}:{ctor:"_Tuple2",_0:r,_1:t},o=n._0,c=n._1,u=c-o+1;if(m.eq(u-1&u,0))return{ctor:"_Tuple2",_0:((u-1&Xl(e))>>>0)+o,_1:id(e)};var i=_(B,0-u>>>0,u)>>>0;return function(t){for(;;){var r=id(t),e=Xl(t);if(!(m.cmp(e,i)<0))return{ctor:"_Tuple2",_0:_(B,e,u)+o,_1:r};t=r}}(e)})})),sd=_(ed,r(function(t,r){return m.eq(t,r)})(1),_(_d,0,1)),fd=(r(function(t,r){return _(ed,function(e){return e?t:r},sd)}),function(){var t=r(function(t,r){for(;;){var e=r;if("[]"===e.ctor)return H;if(m.eq(t,0))return z(e._0);var n=t-1,o=e._1;t=n,r=o}})}(),r(function(t,r){return Zl(function(e){var n=D(r-t),o=Xl(e),c=1*x(67108863&o),u=id(e),i=Xl(u);return{ctor:"_Tuple2",_0:(134217728*c+1*x(134217727&i))/9007199254740992*n+t,_1:id(u)}})})),ld=function(t){var e=r(function(t,r){for(;;){var e=t;{if("::"!==e.ctor||"_Tuple2"!==e._0.ctor)return m.crashCase("Random.Pcg",{start:{line:677,column:13},end:{line:685,column:77}},e)("Empty list passed to Random.Pcg.frequency!");var n=e._0._0;if(m.cmp(r,n)<1)return e._0._1;var o=e._1,c=r-n;t=o,r=c}}}),n=at(_(pt,function(t){return D(Er(t))},t));return _(cd,e(t),_(fd,0,n))},dd=Zl(function(t){var r=_(_d,0,4294967295),n=_(Ql,f(od,e(function(t,r,e){return{ctor:"_Tuple3",_0:t,_1:r,_2:e}}),r,r,r),t),o=n._0._0,c=n._0._1,u=n._0._2;return{ctor:"_Tuple2",_0:n._1,_1:id(_(ud,o,1|c^u))}}),pd=(r(function(t,r){var e=r,n=e._1,o=c(function(r,e,n,o,c,u){t:for(;;){var i=c>>>1,a=_(Gl,n,n),s=_(Gl,n+1,o),f=m.eq(1&c,1)?{ctor:"_Tuple2",_0:_(Gl,r,n),_1:_(Gl,e,n)+o>>>0}:{ctor:"_Tuple2",_0:r,_1:e},l=f._0,d=f._1;if(m.eq(i,0)){if(m.cmp(t,0)<0&&u){var p=l,h=d,v=a,g=s;r=p,e=h,n=v,o=g,c=-1,u=!1;continue t}return{ctor:"_Tuple2",_0:l,_1:d}}var y=l,b=d,w=a,T=s,k=i,S=u;r=y,e=b,n=w,o=T,c=k,u=S}}),u=d(o,1,0,1664525,n,t,!0),i=u._0,a=u._1;return _(ud,_(Gl,i,e._0)+a>>>0,n)}),mn({ctor:"::",_0:s(hn,ud,_(gn,0,kn),_(gn,1,kn)),_1:{ctor:"::",_0:_(vn,ad,kn),_1:{ctor:"[]"}}}),r(function(t,r){return{x:t,y:r}}),r(function(t,e){return _(ht,r(function(t,r){return!m.eq(t,r)})(t),e)})),hd=r(function(t,e){return _(r(function(t,r){return{ctor:"::",_0:t,_1:r}}),t,_(pd,t,e))}),vd=function(t){return{ctor:"Up",_0:t}},md=function(t){return{ctor:"Down",_0:t}},gd=Mr({ctor:"::",_0:Us(md),_1:{ctor:"::",_0:Js(vd),_1:{ctor:"[]"}}}),yd=function(t){return{ctor:"State",_0:t}},bd=yd({ctor:"[]"}),wd=r(function(t,r){var e=r,n=e._0,o=t;return yd("Down"===o.ctor?_(hd,o._0,n):_(pd,o._0,n))}),Td=function(t){return{ctor:"KeyUp",_0:t}},kd=function(t){return{ctor:"KeyDown",_0:t}},Sd={ctor:"Other"},xd={ctor:"Altgr"},Ed={ctor:"Meta"},Ad={ctor:"Quote"},Od={ctor:"CloseBracket"},Id={ctor:"BackSlash"},Cd={ctor:"OpenBracket"},qd={ctor:"BackQuote"},Nd={ctor:"Slash"},Md={ctor:"Period"},jd={ctor:"Minus"},Dd={ctor:"Comma"},Rd={ctor:"VolumeUp"},Bd={ctor:"VolumeDown"},Ld={ctor:"VolumeMute"},Pd={ctor:"Tilde"},Fd={ctor:"CloseCurlyBracket"},$d={ctor:"OpenCurlyBracket"},Ud={ctor:"HyphenMinus"},Jd={ctor:"Pipe"},Hd={ctor:"Plus"},Vd={ctor:"Asterisk"},zd={ctor:"CloseParen"},Wd={ctor:"OpenParen"},Gd={ctor:"Underscore"},Kd={ctor:"Ampersand"},Xd={ctor:"Percent"},Qd={ctor:"Dollar"},Yd={ctor:"Hash"},Zd={ctor:"DoubleQuote"},tp={ctor:"Exclamation"},rp={ctor:"Circumflex"},ep={ctor:"ScrollLock"},np={ctor:"NumLock"},op={ctor:"F24"},cp={ctor:"F23"},up={ctor:"F22"},ip={ctor:"F21"},ap={ctor:"F20"},_p={ctor:"F19"},sp={ctor:"F18"},fp={ctor:"F17"},lp={ctor:"F16"},dp={ctor:"F15"},pp={ctor:"F14"},hp={ctor:"F13"},vp={ctor:"F12"},mp={ctor:"F11"},gp={ctor:"F10"},yp={ctor:"F9"},bp={ctor:"F8"},wp={ctor:"F7"},Tp={ctor:"F6"},kp={ctor:"F5"},Sp={ctor:"F4"},xp={ctor:"F3"},Ep={ctor:"F2"},Ap={ctor:"F1"},Op={ctor:"Divide"},Ip={ctor:"Decimal"},Cp={ctor:"Subtract"},qp={ctor:"Separator"},Np={ctor:"Add"},Mp={ctor:"Multiply"},jp={ctor:"Numpad9"},Dp={ctor:"Numpad8"},Rp={ctor:"Numpad7"},Bp={ctor:"Numpad6"},Lp={ctor:"Numpad5"},Pp={ctor:"Numpad4"},Fp={ctor:"Numpad3"},$p={ctor:"Numpad2"},Up={ctor:"Numpad1"},Jp={ctor:"Numpad0"},Hp={ctor:"Sleep"},Vp={ctor:"ContextMenu"},zp={ctor:"Super"},Wp={ctor:"CharZ"},Gp={ctor:"CharY"},Kp={ctor:"CharX"},Xp={ctor:"CharW"},Qp={ctor:"CharV"},Yp={ctor:"CharU"},Zp={ctor:"CharT"},th={ctor:"CharS"},rh={ctor:"CharR"},eh={ctor:"CharQ"},nh={ctor:"CharP"},oh={ctor:"CharO"},ch={ctor:"CharN"},uh={ctor:"CharM"},ih={ctor:"CharL"},ah={ctor:"CharK"},_h={ctor:"CharJ"},sh={ctor:"CharI"},fh={ctor:"CharH"},lh={ctor:"CharG"},dh={ctor:"CharF"},ph={ctor:"CharE"},hh={ctor:"CharD"},vh={ctor:"CharC"},mh={ctor:"CharB"},gh={ctor:"CharA"},yh={ctor:"At"},bh={ctor:"QuestionMark"},wh={ctor:"GreaterThan"},Th={ctor:"Equals"},kh={ctor:"LessThan"},Sh={ctor:"Semicolon"},xh={ctor:"Colon"},Eh={ctor:"Number9"},Ah={ctor:"Number8"},Oh={ctor:"Number7"},Ih={ctor:"Number6"},Ch={ctor:"Number5"},qh={ctor:"Number4"},Nh={ctor:"Number3"},Mh={ctor:"Number2"},jh={ctor:"Number1"},Dh={ctor:"Number0"},Rh={ctor:"Delete"},Bh={ctor:"Insert"},Lh={ctor:"PrintScreen"},Ph={ctor:"Execute"},Fh={ctor:"Print"},$h={ctor:"Select"},Uh={ctor:"ArrowDown"},Jh={ctor:"ArrowRight"},Hh={ctor:"ArrowUp"},Vh={ctor:"ArrowLeft"},zh={ctor:"Home"},Wh={ctor:"End"},Gh={ctor:"PageDown"},Kh={ctor:"PageUp"},Xh={ctor:"Space"},Qh={ctor:"ModeChange"},Yh={ctor:"Accept"},Zh={ctor:"NonConvert"},tv={ctor:"Convert"},rv={ctor:"Escape"},ev={ctor:"CapsLock"},nv={ctor:"Pause"},ov={ctor:"Alt"},cv={ctor:"Control"},uv={ctor:"Shift"},iv={ctor:"Enter"},av={ctor:"Clear"},_v={ctor:"Tab"},sv={ctor:"BackSpace"},fv={ctor:"Help"},lv={ctor:"Cancel"},dv={ctor:"::",_0:{ctor:"_Tuple2",_0:3,_1:lv},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:6,_1:fv},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:8,_1:sv},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:9,_1:_v},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:12,_1:av},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:13,_1:iv},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:16,_1:uv},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:17,_1:cv},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:18,_1:ov},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:19,_1:nv},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:20,_1:ev},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:27,_1:rv},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:28,_1:tv},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:29,_1:Zh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:30,_1:Yh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:31,_1:Qh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:32,_1:Xh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:33,_1:Kh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:34,_1:Gh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:35,_1:Wh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:36,_1:zh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:37,_1:Vh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:38,_1:Hh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:39,_1:Jh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:40,_1:Uh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:41,_1:$h},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:42,_1:Fh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:43,_1:Ph},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:44,_1:Lh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:45,_1:Bh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:46,_1:Rh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:48,_1:Dh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:49,_1:jh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:50,_1:Mh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:51,_1:Nh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:52,_1:qh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:53,_1:Ch},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:54,_1:Ih},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:55,_1:Oh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:56,_1:Ah},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:57,_1:Eh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:58,_1:xh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:59,_1:Sh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:60,_1:kh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:61,_1:Th},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:62,_1:wh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:63,_1:bh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:64,_1:yh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:65,_1:gh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:66,_1:mh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:67,_1:vh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:68,_1:hh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:69,_1:ph},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:70,_1:dh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:71,_1:lh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:72,_1:fh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:73,_1:sh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:74,_1:_h},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:75,_1:ah},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:76,_1:ih},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:77,_1:uh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:78,_1:ch},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:79,_1:oh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:80,_1:nh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:81,_1:eh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:82,_1:rh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:83,_1:th},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:84,_1:Zp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:85,_1:Yp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:86,_1:Qp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:87,_1:Xp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:88,_1:Kp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:89,_1:Gp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:90,_1:Wp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:91,_1:zp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:93,_1:Vp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:95,_1:Hp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:96,_1:Jp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:97,_1:Up},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:98,_1:$p},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:99,_1:Fp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:100,_1:Pp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:101,_1:Lp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:102,_1:Bp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:103,_1:Rp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:104,_1:Dp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:105,_1:jp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:106,_1:Mp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:107,_1:Np},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:108,_1:qp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:109,_1:Cp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:110,_1:Ip},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:111,_1:Op},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:112,_1:Ap},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:113,_1:Ep},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:114,_1:xp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:115,_1:Sp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:116,_1:kp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:117,_1:Tp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:118,_1:wp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:119,_1:bp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:120,_1:yp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:121,_1:gp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:122,_1:mp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:123,_1:vp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:124,_1:hp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:125,_1:pp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:126,_1:dp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:127,_1:lp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:128,_1:fp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:129,_1:sp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:130,_1:_p},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:131,_1:ap},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:132,_1:ip},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:133,_1:up},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:134,_1:cp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:135,_1:op},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:144,_1:np},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:145,_1:ep},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:160,_1:rp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:161,_1:tp},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:162,_1:Zd},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:163,_1:Yd},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:164,_1:Qd},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:165,_1:Xd},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:166,_1:Kd},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:167,_1:Gd},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:168,_1:Wd},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:169,_1:zd},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:170,_1:Vd},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:171,_1:Hd},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:172,_1:Jd},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:173,_1:Ud},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:174,_1:$d},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:175,_1:Fd},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:176,_1:Pd},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:181,_1:Ld},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:182,_1:Bd},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:183,_1:Rd},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:186,_1:Sh},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:187,_1:Th},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:188,_1:Dd},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:189,_1:jd},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:190,_1:Md},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:191,_1:Nd},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:192,_1:qd},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:219,_1:Cd},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:220,_1:Id},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:221,_1:Od},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:222,_1:Ad},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:224,_1:Ed},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:225,_1:xd},_1:{ctor:"[]"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},pv=function(t){return _(J,0,lt(_(pt,Er,_(ht,function(e){return _(r(function(t,r){return m.eq(t,r)}),t,xr(e))},dv))))},hv=r(function(t,r){var e=r;return _(_t,pv(t),e._0)}),vv=Ke(dv),mv=function(t){return _(J,Sd,_(le,t,vv))},gv=(r(function(t,r){var e=r,n=e._0,o=t;if("Down"===o.ctor){var c=o._0,u=_(hd,c,n),i=m.eq(it(u),it(n))?H:z(kd(mv(c)));return{ctor:"_Tuple2",_0:yd(u),_1:i}}var a=o._0,u=_(pd,a,n),i=m.eq(it(u),it(n))?H:z(Td(mv(a)));return{ctor:"_Tuple2",_0:yd(u),_1:i}}),_(vn,mv,_(yn,"keyCode",kn))),yv=function(t){var r=t-65536;return{ctor:"::",_0:55296+(r>>10),_1:{ctor:"::",_0:_(k["%"],r,1024)+56320,_1:{ctor:"[]"}}}},bv=function(t){return m.cmp(t,65535)<1?{ctor:"::",_0:Ht(t),_1:{ctor:"[]"}}:_(pt,Ht,yv(t))},wv=function(t){return Wt(_(Tt,bv,t))},Tv=function(t){return Wt(bv(t))},kv=(r(function(t,r){return 1024*(t-55296)+r-56320+65536}),Ke({ctor:"::",_0:{ctor:"_Tuple2",_0:"quot",_1:{ctor:"::",_0:34,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"amp",_1:{ctor:"::",_0:38,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"apos",_1:{ctor:"::",_0:39,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"lt",_1:{ctor:"::",_0:60,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"gt",_1:{ctor:"::",_0:62,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"nbsp",_1:{ctor:"::",_0:160,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"iexcl",_1:{ctor:"::",_0:161,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"cent",_1:{ctor:"::",_0:162,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"pound",_1:{ctor:"::",_0:163,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"curren",_1:{ctor:"::",_0:164,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"yen",_1:{ctor:"::",_0:165,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"brvbar",_1:{ctor:"::",_0:166,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"sect",_1:{ctor:"::",_0:167,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"uml",_1:{ctor:"::",_0:168,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"copy",_1:{ctor:"::",_0:169,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ordf",_1:{ctor:"::",_0:170,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"laquo",_1:{ctor:"::",_0:171,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"not",_1:{ctor:"::",_0:172,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"shy",_1:{ctor:"::",_0:173,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"reg",_1:{ctor:"::",_0:174,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"macr",_1:{ctor:"::",_0:175,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"deg",_1:{ctor:"::",_0:176,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"plusmn",_1:{ctor:"::",_0:177,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"sup2",_1:{ctor:"::",_0:178,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"sup3",_1:{ctor:"::",_0:179,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"acute",_1:{ctor:"::",_0:180,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"micro",_1:{ctor:"::",_0:181,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"para",_1:{ctor:"::",_0:182,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"middot",_1:{ctor:"::",_0:183,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"cedil",_1:{ctor:"::",_0:184,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"sup1",_1:{ctor:"::",_0:185,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ordm",_1:{ctor:"::",_0:186,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"raquo",_1:{ctor:"::",_0:187,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"frac14",_1:{ctor:"::",_0:188,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"frac12",_1:{ctor:"::",_0:189,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"frac34",_1:{ctor:"::",_0:190,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"iquest",_1:{ctor:"::",_0:191,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Agrave",_1:{ctor:"::",_0:192,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Aacute",_1:{ctor:"::",_0:193,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Acirc",_1:{ctor:"::",_0:194,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Atilde",_1:{ctor:"::",_0:195,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Auml",_1:{ctor:"::",_0:196,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Aring",_1:{ctor:"::",_0:197,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"AElig",_1:{ctor:"::",_0:198,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Ccedil",_1:{ctor:"::",_0:199,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Egrave",_1:{ctor:"::",_0:200,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Eacute",_1:{ctor:"::",_0:201,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Ecirc",_1:{ctor:"::",_0:202,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Euml",_1:{ctor:"::",_0:203,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Igrave",_1:{ctor:"::",_0:204,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Iacute",_1:{ctor:"::",_0:205,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Icirc",_1:{ctor:"::",_0:206,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Iuml",_1:{ctor:"::",_0:207,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ETH",_1:{ctor:"::",_0:208,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Ntilde",_1:{ctor:"::",_0:209,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Ograve",_1:{ctor:"::",_0:210,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Oacute",_1:{ctor:"::",_0:211,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Ocirc",_1:{ctor:"::",_0:212,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Otilde",_1:{ctor:"::",_0:213,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Ouml",_1:{ctor:"::",_0:214,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"times",_1:{ctor:"::",_0:215,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Oslash",_1:{ctor:"::",_0:216,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Ugrave",_1:{ctor:"::",_0:217,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Uacute",_1:{ctor:"::",_0:218,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Ucirc",_1:{ctor:"::",_0:219,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Uuml",_1:{ctor:"::",_0:220,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Yacute",_1:{ctor:"::",_0:221,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"THORN",_1:{ctor:"::",_0:222,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"szlig",_1:{ctor:"::",_0:223,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"agrave",_1:{ctor:"::",_0:224,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"aacute",_1:{ctor:"::",_0:225,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"acirc",_1:{ctor:"::",_0:226,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"atilde",_1:{ctor:"::",_0:227,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"auml",_1:{ctor:"::",_0:228,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"aring",_1:{ctor:"::",_0:229,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"aelig",_1:{ctor:"::",_0:230,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ccedil",_1:{ctor:"::",_0:231,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"egrave",_1:{ctor:"::",_0:232,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"eacute",_1:{ctor:"::",_0:233,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ecirc",_1:{ctor:"::",_0:234,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"euml",_1:{ctor:"::",_0:235,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"igrave",_1:{ctor:"::",_0:236,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"iacute",_1:{ctor:"::",_0:237,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"icirc",_1:{ctor:"::",_0:238,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"iuml",_1:{ctor:"::",_0:239,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"eth",_1:{ctor:"::",_0:240,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ntilde",_1:{ctor:"::",_0:241,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ograve",_1:{ctor:"::",_0:242,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"oacute",_1:{ctor:"::",_0:243,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ocirc",_1:{ctor:"::",_0:244,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"otilde",_1:{ctor:"::",_0:245,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ouml",_1:{ctor:"::",_0:246,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"divide",_1:{ctor:"::",_0:247,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"oslash",_1:{ctor:"::",_0:248,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ugrave",_1:{ctor:"::",_0:249,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"uacute",_1:{ctor:"::",_0:250,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ucirc",_1:{ctor:"::",_0:251,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"uuml",_1:{ctor:"::",_0:252,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"yacute",_1:{ctor:"::",_0:253,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"thorn",_1:{ctor:"::",_0:254,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"yuml",_1:{ctor:"::",_0:255,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"OElig",_1:{ctor:"::",_0:338,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"oelig",_1:{ctor:"::",_0:339,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Scaron",_1:{ctor:"::",_0:352,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"scaron",_1:{ctor:"::",_0:353,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Yuml",_1:{ctor:"::",_0:376,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"fnof",_1:{ctor:"::",_0:402,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"circ",_1:{ctor:"::",_0:710,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"tilde",_1:{ctor:"::",_0:732,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Alpha",_1:{ctor:"::",_0:913,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Beta",_1:{ctor:"::",_0:914,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Gamma",_1:{ctor:"::",_0:915,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Delta",_1:{ctor:"::",_0:916,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Epsilon",_1:{ctor:"::",_0:917,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Zeta",_1:{ctor:"::",_0:918,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Eta",_1:{ctor:"::",_0:919,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Theta",_1:{ctor:"::",_0:920,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Iota",_1:{ctor:"::",_0:921,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Kappa",_1:{ctor:"::",_0:922,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Lambda",_1:{ctor:"::",_0:923,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Mu",_1:{ctor:"::",_0:924,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Nu",_1:{ctor:"::",_0:925,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Xi",_1:{ctor:"::",_0:926,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Omicron",_1:{ctor:"::",_0:927,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Pi",_1:{ctor:"::",_0:928,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Rho",_1:{ctor:"::",_0:929,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Sigma",_1:{ctor:"::",_0:931,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Tau",_1:{ctor:"::",_0:932,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Upsilon",_1:{ctor:"::",_0:933,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Phi",_1:{ctor:"::",_0:934,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Chi",_1:{ctor:"::",_0:935,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Psi",_1:{ctor:"::",_0:936,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Omega",_1:{ctor:"::",_0:937,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"alpha",_1:{ctor:"::",_0:945,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"beta",_1:{ctor:"::",_0:946,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"gamma",_1:{ctor:"::",_0:947,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"delta",_1:{ctor:"::",_0:948,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"epsilon",_1:{ctor:"::",_0:949,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"zeta",_1:{ctor:"::",_0:950,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"eta",_1:{ctor:"::",_0:951,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"theta",_1:{ctor:"::",_0:952,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"iota",_1:{ctor:"::",_0:953,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"kappa",_1:{ctor:"::",_0:954,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"lambda",_1:{ctor:"::",_0:955,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"mu",_1:{ctor:"::",_0:956,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"nu",_1:{ctor:"::",_0:957,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"xi",_1:{ctor:"::",_0:958,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"omicron",_1:{ctor:"::",_0:959,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"pi",_1:{ctor:"::",_0:960,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"rho",_1:{ctor:"::",_0:961,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"sigmaf",_1:{ctor:"::",_0:962,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"sigma",_1:{ctor:"::",_0:963,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"tau",_1:{ctor:"::",_0:964,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"upsilon",_1:{ctor:"::",_0:965,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"phi",_1:{ctor:"::",_0:966,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"chi",_1:{ctor:"::",_0:967,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"psi",_1:{ctor:"::",_0:968,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"omega",_1:{ctor:"::",_0:969,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"thetasym",_1:{ctor:"::",_0:977,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"upsih",_1:{ctor:"::",_0:978,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"piv",_1:{ctor:"::",_0:982,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ensp",_1:{ctor:"::",_0:8194,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"emsp",_1:{ctor:"::",_0:8195,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"thinsp",_1:{ctor:"::",_0:8201,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"zwnj",_1:{ctor:"::",_0:8204,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"zwj",_1:{ctor:"::",_0:8205,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"lrm",_1:{ctor:"::",_0:8206,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"rlm",_1:{ctor:"::",_0:8207,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ndash",_1:{ctor:"::",_0:8211,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"mdash",_1:{ctor:"::",_0:8212,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"lsquo",_1:{ctor:"::",_0:8216,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"rsquo",_1:{ctor:"::",_0:8217,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"sbquo",_1:{ctor:"::",_0:8218,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ldquo",_1:{ctor:"::",_0:8220,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"rdquo",_1:{ctor:"::",_0:8221,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"bdquo",_1:{ctor:"::",_0:8222,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"dagger",_1:{ctor:"::",_0:8224,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Dagger",_1:{ctor:"::",_0:8225,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"bull",_1:{ctor:"::",_0:8226,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"hellip",_1:{ctor:"::",_0:8230,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"permil",_1:{ctor:"::",_0:8240,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"prime",_1:{ctor:"::",_0:8242,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"Prime",_1:{ctor:"::",_0:8243,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"lsaquo",_1:{ctor:"::",_0:8249,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"rsaquo",_1:{ctor:"::",_0:8250,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"oline",_1:{ctor:"::",_0:8254,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"frasl",_1:{ctor:"::",_0:8260,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"euro",_1:{ctor:"::",_0:8364,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"image",_1:{ctor:"::",_0:8465,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"weierp",_1:{ctor:"::",_0:8472,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"real",_1:{ctor:"::",_0:8476,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"trade",_1:{ctor:"::",_0:8482,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"alefsym",_1:{ctor:"::",_0:8501,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"larr",_1:{ctor:"::",_0:8592,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"uarr",_1:{ctor:"::",_0:8593,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"rarr",_1:{ctor:"::",_0:8594,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"darr",_1:{ctor:"::",_0:8595,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"harr",_1:{ctor:"::",_0:8596,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"crarr",_1:{ctor:"::",_0:8629,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"lArr",_1:{ctor:"::",_0:8656,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"uArr",_1:{ctor:"::",_0:8657,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"rArr",_1:{ctor:"::",_0:8658,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"dArr",_1:{ctor:"::",_0:8659,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"hArr",_1:{ctor:"::",_0:8660,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"forall",_1:{ctor:"::",_0:8704,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"part",_1:{ctor:"::",_0:8706,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"exist",_1:{ctor:"::",_0:8707,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"empty",_1:{ctor:"::",_0:8709,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"nabla",_1:{ctor:"::",_0:8711,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"isin",_1:{ctor:"::",_0:8712,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"notin",_1:{ctor:"::",_0:8713,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ni",_1:{ctor:"::",_0:8715,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"prod",_1:{ctor:"::",_0:8719,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"sum",_1:{ctor:"::",_0:8721,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"minus",_1:{ctor:"::",_0:8722,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"lowast",_1:{ctor:"::",_0:8727,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"radic",_1:{ctor:"::",_0:8730,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"prop",_1:{ctor:"::",_0:8733,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"infin",_1:{ctor:"::",_0:8734,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ang",_1:{ctor:"::",_0:8736,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"and",_1:{ctor:"::",_0:8743,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"or",_1:{ctor:"::",_0:8744,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"cap",_1:{ctor:"::",_0:8745,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"cup",_1:{ctor:"::",_0:8746,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"int",_1:{ctor:"::",_0:8747,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"there4",_1:{ctor:"::",_0:8756,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"sim",_1:{ctor:"::",_0:8764,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"cong",_1:{ctor:"::",_0:8773,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"asymp",_1:{ctor:"::",_0:8776,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ne",_1:{ctor:"::",_0:8800,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"equiv",_1:{ctor:"::",_0:8801,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"le",_1:{ctor:"::",_0:8804,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"ge",_1:{ctor:"::",_0:8805,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"sub",_1:{ctor:"::",_0:8834,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"sup",_1:{ctor:"::",_0:8835,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"nsub",_1:{ctor:"::",_0:8836,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"sube",_1:{ctor:"::",_0:8838,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"supe",_1:{ctor:"::",_0:8839,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"oplus",_1:{ctor:"::",_0:8853,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"otimes",_1:{ctor:"::",_0:8855,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"perp",_1:{ctor:"::",_0:8869,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"sdot",_1:{ctor:"::",_0:8901,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"lceil",_1:{ctor:"::",_0:8968,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"rceil",_1:{ctor:"::",_0:8969,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"lfloor",_1:{ctor:"::",_0:8970,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"rfloor",_1:{ctor:"::",_0:8971,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"lang",_1:{ctor:"::",_0:9001,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"rang",_1:{ctor:"::",_0:9002,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"loz",_1:{ctor:"::",_0:9674,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"spades",_1:{ctor:"::",_0:9824,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"clubs",_1:{ctor:"::",_0:9827,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"hearts",_1:{ctor:"::",_0:9829,_1:{ctor:"[]"}}},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"diams",_1:{ctor:"::",_0:9830,_1:{ctor:"[]"}}},_1:{ctor:"[]"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}})),Sv=function(t){return _(J,t.match,_(W,wv,_(V,_(b,le,kv),_(J,H,lt(t.submatches)))))},xv=Dc("&([0-9a-zA-Z]+);"),Ev=s(Nc,Lc,xv,Sv),Av=function(t){return s(ut,r(function(t,r){return 16*r+_(k["%"],Vt(t),39)-9}),0,Gt(tr(t)))},Ov=Dc("&#[Xx]([0-9a-fA-F]{1,8});"),Iv=function(t){var r=_(k["%"],t,16),e=_(k["%"],t,131070);return m.cmp(t,131070)>-1&&(m.cmp(0,e)<1&&m.cmp(e,15)<1||m.cmp(65536,e)<1&&m.cmp(e,65551)<1)&&(m.eq(r,14)||m.eq(r,15))},Cv=function(t){return m.eq(t,9)||m.eq(t,10)||m.eq(t,13)||m.eq(t,133)||m.cmp(32,t)<1&&m.cmp(t,126)<1||m.cmp(160,t)<1&&m.cmp(t,55295)<1||m.cmp(57344,t)<1&&m.cmp(t,64975)<1||m.cmp(65008,t)<1&&m.cmp(t,65533)<1||m.cmp(65536,t)<1&&m.cmp(t,1114109)<1},qv=function(t){return Cv(t)&&!Iv(t)?Tv(t):wr(Ht(65533))},Nv=function(t){return _(J,t.match,_(W,function(t){return qv(Av(t))},_(J,H,lt(t.submatches))))},Mv=s(Nc,Lc,Ov,Nv),jv=function(t){return _(J,t.match,_(W,qv,_(V,function(t){return Mt(Xt(t))},_(J,H,lt(t.submatches)))))},Dv=Dc("&#([0-9]{1,8});"),Rv=s(Nc,Lc,Dv,jv),Bv=function(t){return m.eq(_(k["%"],t,2),0)},Lv=r(function(t,r){var e=r;return"Ok"===e.ctor?r:t(e._0)}),Pv=function(t){return f(Nc,Lc,Dc(_(k["++"],"[",_(k["++"]," \\t\\f\\v\\r\\n","]+"))),function(t){return" "},or(t))},Fv=function(t){var e=r(function(t,r){var e=r;return"Just"===e.ctor?z(e._0):t});return s(ut,e,H,t)},$v=Dc("(\\\\+)([!\"#$%&\\'()*+,./:;<=>?@[\\\\\\]^_`{|}~-])"),Uv=s(Nc,Lc,$v,function(t){var r=t.submatches;return"::"===r.ctor&&"Just"===r._0.ctor&&"::"===r._1.ctor&&"Just"===r._1._0.ctor?_(k["++"],_(lr,vr(r._0._0)/2|0,"\\"),r._1._0._0):t.match}),Jv=function(t){return Mv(Rv(Ev(Uv(t))))},Hv=function(t){return function(r){return f(Nc,Bc(1),Dc(_(k["++"],"^ {0,",_(k["++"],S(t),"}"))),function(t){return""},f(Nc,Lc,Dc("\\t"),function(t){return"    "},r))}},Vv=Dc("^ +"),zv=function(t){return _(J,0,_(W,function(t){return vr(function(t){return t.match}(t))},lt(s(Mc,Bc(1),Vv,f(Nc,Lc,Dc("\\t"),function(t){return"    "},t)))))},Wv=function(t){return tr(Pv(t))},Gv=_(k["++"],"(?:[",_(k["++"]," \\t\\f\\v\\r\\n",_(k["++"],"]+",_(k["++"],"(?:'([^'\\\\]*(?:\\\\.[^'\\\\]*)*)'|",_(k["++"],'"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|',"\\(([^\\)\\\\]*(?:\\\\.[^\\)\\\\]*)*)\\)))?"))))),Kv={ctor:"::",_0:"name",_1:{ctor:"::",_0:"class",_1:{ctor:"[]"}}},Xv={ctor:"::",_0:"address",_1:{ctor:"::",_0:"article",_1:{ctor:"::",_0:"aside",_1:{ctor:"::",_0:"b",_1:{ctor:"::",_0:"blockquote",_1:{ctor:"::",_0:"br",_1:{ctor:"::",_0:"caption",_1:{ctor:"::",_0:"center",_1:{ctor:"::",_0:"cite",_1:{ctor:"::",_0:"code",_1:{ctor:"::",_0:"col",_1:{ctor:"::",_0:"colgroup",_1:{ctor:"::",_0:"dd",_1:{ctor:"::",_0:"details",_1:{ctor:"::",_0:"div",_1:{ctor:"::",_0:"dl",_1:{ctor:"::",_0:"dt",_1:{ctor:"::",_0:"figcaption",_1:{ctor:"::",_0:"figure",_1:{ctor:"::",_0:"footer",_1:{ctor:"::",_0:"h1",_1:{ctor:"::",_0:"h2",_1:{ctor:"::",_0:"h3",_1:{ctor:"::",_0:"h4",_1:{ctor:"::",_0:"h5",_1:{ctor:"::",_0:"h6",_1:{ctor:"::",_0:"hr",_1:{ctor:"::",_0:"i",_1:{ctor:"::",_0:"legend",_1:{ctor:"::",_0:"li",_1:{ctor:"::",_0:"menu",_1:{ctor:"::",_0:"menuitem",_1:{ctor:"::",_0:"nav",_1:{ctor:"::",_0:"ol",_1:{ctor:"::",_0:"optgroup",_1:{ctor:"::",_0:"option",_1:{ctor:"::",_0:"p",_1:{ctor:"::",_0:"pre",_1:{ctor:"::",_0:"section",_1:{ctor:"::",_0:"strike",_1:{ctor:"::",_0:"summary",_1:{ctor:"::",_0:"small",_1:{ctor:"::",_0:"table",_1:{ctor:"::",_0:"tbody",_1:{ctor:"::",_0:"td",_1:{ctor:"::",_0:"tfoot",_1:{ctor:"::",_0:"th",_1:{ctor:"::",_0:"thead",_1:{ctor:"::",_0:"tr",_1:{ctor:"::",_0:"ul",_1:{ctor:"[]"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},Qv={allowedHtmlElements:Xv,allowedHtmlAttributes:Kv},Yv=(r(function(t,r){return{softAsHardLineBreak:t,rawHtml:r}}),r(function(t,r){return{allowedHtmlElements:t,allowedHtmlAttributes:r}}),{softAsHardLineBreak:!1,rawHtml:function(t){return{ctor:"Sanitize",_0:t}}(Qv)}),Zv=function(t){return s(ut,tm,"",t)},tm=r(function(t,r){var e=t;switch(e.ctor){case"Text":return _(k["++"],r,e._0);case"HardLineBreak":return _(k["++"],r," ");case"CodeInline":return _(k["++"],r,e._0);case"Link":case"Image":case"HtmlInline":return _(k["++"],r,Zv(e._2));case"Emphasis":default:return _(k["++"],r,Zv(e._1))}}),rm=function(t){var r=t,e=r._0;return _(Sa,e,_(J,e,r._1))},em=pt(rm),nm=(r(function(t,r){return{ctor:"Custom",_0:t,_1:r}}),r(function(t,r){return{ctor:"Emphasis",_0:t,_1:r}})),om=r(function(t,e){var n=_(J,om(H),t),o=e;switch(o.ctor){case"Text":return Vi(o._0);case"HardLineBreak":return _(da,{ctor:"[]"},{ctor:"[]"});case"CodeInline":return _(sa,{ctor:"[]"},{ctor:"::",_0:Vi(o._0),_1:{ctor:"[]"}});case"Link":var c=o._0,u=o._2,i=o._1;return"Just"===i.ctor?_(ia,{ctor:"::",_0:Ra(c),_1:{ctor:"::",_0:Ca(i._0),_1:{ctor:"[]"}}},_(pt,n,u)):_(ia,{ctor:"::",_0:Ra(c),_1:{ctor:"[]"}},_(pt,n,u));case"Image":var a=o._0,f=o._2,l=o._1;return"Just"===l.ctor?_(pa,{ctor:"::",_0:Na(Zv(f)),_1:{ctor:"::",_0:qa(a),_1:{ctor:"::",_0:Ca(l._0),_1:{ctor:"[]"}}}},{ctor:"[]"}):_(pa,{ctor:"::",_0:Na(Zv(f)),_1:{ctor:"::",_0:qa(a),_1:{ctor:"[]"}}},{ctor:"[]"});case"HtmlInline":return s(zi,o._0,em(o._1),_(pt,n,o._2));case"Emphasis":var d=o._0,p=o._1;switch(d){case 1:return _(aa,{ctor:"[]"},_(pt,n,p));case 2:return _(_a,{ctor:"[]"},_(pt,n,p));default:return m.cmp(d-2,0)>0?_(_a,{ctor:"[]"},s(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),{ctor:"[]"},n(_(nm,d-2,p)))):_(aa,{ctor:"[]"},_(pt,n,p))}default:return Vi("")}}),cm=om(H),um=e(function(t,r,e){return{ctor:"HtmlInline",_0:t,_1:r,_2:e}}),im=e(function(t,r,e){return{ctor:"Image",_0:t,_1:r,_2:e}}),am=e(function(t,r,e){return{ctor:"Link",_0:t,_1:r,_2:e}}),_m=function(t){return{ctor:"CodeInline",_0:t}},sm={ctor:"HardLineBreak"},fm=function(t){return{ctor:"Text",_0:t}},lm=r(function(t,e){var n=e;switch(n.ctor){case"Link":var o=n._2;return _(r(function(t,r){return _(k["++"],t,r)}),t(s(am,n._0,n._1,o)),wt(_(pt,lm(t),o)));case"Image":var c=n._2;return _(r(function(t,r){return _(k["++"],t,r)}),t(s(im,n._0,n._1,c)),wt(_(pt,lm(t),c)));case"HtmlInline":var u=n._2;return _(r(function(t,r){return _(k["++"],t,r)}),t(s(um,n._0,n._1,u)),wt(_(pt,lm(t),u)));case"Emphasis":var i=n._1;return _(r(function(t,r){return _(k["++"],t,r)}),t(_(nm,n._0,i)),wt(_(pt,lm(t),i)));default:return t(e)}}),dm=r(function(t,r){var e=r;switch(e.ctor){case"Link":return t(s(am,e._0,e._1,_(pt,dm(t),e._2)));case"Image":return t(s(im,e._0,e._1,_(pt,dm(t),e._2)));case"HtmlInline":return t(s(um,e._0,e._1,_(pt,dm(t),e._2)));case"Emphasis":return t(_(nm,e._0,_(pt,dm(t),e._1)));default:return t(r)}}),pm=function(t){return _(pt,hm,t)},hm=function(t){var r=t,e=r._0,n=e.type_;switch(n.ctor){case"NormalType":return fm(e.text);case"HardLineBreakType":return sm;case"CodeType":return _m(e.text);case"AutolinkType":return s(am,n._0._1,H,{ctor:"::",_0:fm(n._0._0),_1:{ctor:"[]"}});case"LinkType":return s(am,n._0._0,n._0._1,pm(e.matches));case"ImageType":return s(im,n._0._0,n._0._1,pm(e.matches));case"HtmlType":var o=n._0;return s(um,o.tag,o.attributes,pm(e.matches));default:return _(nm,n._0,pm(e.matches))}},vm=r(function(t,r){var e=r.meaning;if("EmphasisToken"===e.ctor&&"_Tuple2"===e._1.ctor){var n=t.meaning;return"EmphasisToken"===n.ctor&&"_Tuple2"===n._1.ctor&&(!!m.eq(e._0,n._0)&&(!m.eq(e._1._0,e._1._1)&&!m.eq(n._1._0,n._1._1)||!m.eq(_(k["%"],t.length+r.length,3),0)))}return!1}),mm=Dc("%(?:3B|2C|2F|3F|3A|40|26|3D|2B|24|23|25)"),gm=function(t){return f(Nc,Lc,mm,function(t){return _(J,t.match,ws(t.match))},Ts(t))},ym=Dc(_(k["++"],"^\\[\\s*(",_(k["++"],"[^\\[\\]\\\\]*(?:\\\\.[^\\[\\]\\\\]*)*",")\\s*\\]"))),bm=function(t){var r=t;return{ctor:"_Tuple2",_0:gm(Jv(r._0)),_1:_(W,Jv,r._1)}},wm=_(k["++"],"(?:<([^<>",_(k["++"]," \\t\\f\\v\\r\\n",_(k["++"],"]*)>|([^",_(k["++"]," \\t\\f\\v\\r\\n",_(k["++"],"\\(\\)\\\\]*(?:\\\\.[^",_(k["++"]," \\t\\f\\v\\r\\n","\\(\\)\\\\]*)*))")))))),Tm=Dc(_(k["++"],"^\\(\\s*",_(k["++"],wm,_(k["++"],Gv,"\\s*\\)")))),km=r(function(t,r){var e=r.matches;return"[]"===e.ctor?{ctor:"_Tuple2",_0:t,_1:r}:{ctor:"_Tuple2",_0:_(ht,function(t){return m.cmp(t.index,e._0._0.end)>-1},t),_1:r}}),Sm=function(t){var r=t.matches;if("[]"===r.ctor)return Dt({ctor:"_Tuple0"});var e=r._1,n=r._0._0,o=_(ht,function(t){var r=t,e=r._0;return m.cmp(n.end,e.start)>0&&m.cmp(n.end,e.end)<0},e);return st(e)||st(o)?Bt(t):Dt({ctor:"_Tuple0"})},xm=function(t){switch(t.meaning.ctor){case"LinkOpenToken":case"ImageOpenToken":return!0;default:return!1}},Em=r(function(t,r){var e=r.meaning;return"HtmlToken"===e.ctor&&!1===e._0&&m.eq(t.tag,e._1.tag)}),Am={ctor:"::",_0:"area",_1:{ctor:"::",_0:"base",_1:{ctor:"::",_0:"br",_1:{ctor:"::",_0:"col",_1:{ctor:"::",_0:"embed",_1:{ctor:"::",_0:"hr",_1:{ctor:"::",_0:"img",_1:{ctor:"::",_0:"input",_1:{ctor:"::",_0:"keygen",_1:{ctor:"::",_0:"link",_1:{ctor:"::",_0:"meta",_1:{ctor:"::",_0:"param",_1:{ctor:"::",_0:"source",_1:{ctor:"::",_0:"track",_1:{ctor:"::",_0:"wbr",_1:{ctor:"[]"}}}}}}}}}}}}}}}},Om=function(t){return _(_t,t.tag,Am)},Im=function(t){var r=t.submatches;t:do{if("::"===r.ctor&&"Just"===r._0.ctor){if(""===r._0._0)return H;if("::"===r._1.ctor&&"::"===r._1._1.ctor&&"::"===r._1._1._1.ctor){var e=Fv({ctor:"::",_0:r._1._0,_1:{ctor:"::",_0:r._1._1._0,_1:{ctor:"::",_0:r._1._1._1._0,_1:{ctor:"[]"}}}});return z({ctor:"_Tuple2",_0:r._0._0,_1:e})}break t}break t}while(!1);return H},Cm=Dc("([a-zA-Z:_][a-zA-Z0-9\\-_.:]*)(?: ?= ?(?:\"([^\"]*)\"|'([^']*)'|([^\\s\"'=<>`]*)))?"),qm=function(t){return _(mt,Im,s(Mc,Lc,Cm,t))},Nm=Dc("^(\\/)?([a-zA-Z][a-zA-Z0-9\\-]*)(?:\\s+([^<>]*?))?(\\/)?$"),Mm=Dc("^([a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~\\-]+@[a-zA-Z0-9](?:[a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?)*)$"),jm=Dc("^([A-Za-z][A-Za-z0-9.+\\-]{1,31}:[^<>\\x00-\\x20]*)$"),Dm=r(function(t,r){var e=r.meaning;return"CodeToken"===e.ctor&&(e._0?m.eq(r.length-1,t.length):m.eq(r.length,t.length))}),Rm=r(function(t,r){return t({ctor:"_Tuple2",_0:r.tokens,_1:m.update(r,{tokens:{ctor:"[]"}})})}),Bm=Dc("(?:(\\\\+)|( *))\\n"),Lm=Dc("(?:(\\\\+)|( {2,}))\\n"),Pm=Dc("(\\\\*)(\\<)"),Fm=Dc("(\\\\*)(\\>)"),$m=Dc("(\\\\*)(\\])"),Um=Dc("(\\\\*)(\\!)?(\\[)"),Jm=jc(Dc("[!-#%-\\*,-/:;\\?@\\[-\\]_\\{\\}]")),Hm=jc(Dc("\\s")),Vm=function(t){var r=wr(t);return Hm(r)?0:Jm(r)?1:2},zm=function(t){return _(J,0,_(W,Vm,t))},Wm=function(t){return _(J,0,_(W,function(t){return zm(_(W,Er,yr(t)))},t))},Gm=Dc("(\\\\*)([^_])?(\\_+)([^_])?"),Km=Dc("(\\\\*)([^*])?(\\*+)([^*])?"),Xm=Dc("(\\\\*)(\\`+)"),Qm=r(function(t,e){var n=r(function(r,e){var n=e,o=n._0,c=n._1;return"Nothing"===o.ctor?t(r)?{ctor:"_Tuple3",_0:z(r),_1:c,_2:{ctor:"[]"}}:{ctor:"_Tuple3",_0:H,_1:{ctor:"::",_0:r,_1:c},_2:{ctor:"[]"}}:{ctor:"_Tuple3",_0:o,_1:c,_2:{ctor:"::",_0:r,_1:n._2}}});return function(t){var r=t;return _(W,function(t){return{ctor:"_Tuple3",_0:t,_1:gt(r._1),_2:gt(r._2)}},r._0)}(s(ut,n,{ctor:"_Tuple3",_0:H,_1:{ctor:"[]"},_2:{ctor:"[]"}},e))}),Ym=function(t){return m.update(t,{tokens:gt(t.tokens)})},Zm=r(function(t,r){return m.update(r,{tokens:_(ht,t,r.tokens)})}),tg=r(function(t,r){return m.update(t,{tokens:{ctor:"::",_0:r,_1:t.tokens}})}),rg=r(function(t,r){return m.update(t,{matches:{ctor:"::",_0:r,_1:t.matches}})}),eg=e(function(t,r,e){return{rawText:e,tokens:{ctor:"[]"},matches:{ctor:"[]"},options:t,refs:r}}),ng=(o(function(t,r,e,n,o){return{rawText:t,tokens:r,matches:e,options:n,refs:o}}),e(function(t,r,e){return{index:t,length:r,meaning:e}}),u(function(t,r,e,n,o,c,u){return{type_:t,start:r,end:e,textStart:n,textEnd:o,text:c,matches:u}}),r(function(t,r){return{tag:t,attributes:r}})),og={ctor:"HardLineBreakToken"},cg=function(t){var r=t.submatches;t:do{if("::"===r.ctor){if("Just"===r._0.ctor){var e=vr(r._0._0);return Bv(e)?H:z({index:t.index+e-1,length:2,meaning:og})}if("::"===r._1.ctor&&"Just"===r._1._0.ctor)return z({index:t.index,length:vr(t.match),meaning:og});break t}break t}while(!1);return H},ug=function(t){var r=t.submatches;t:do{if("::"===r.ctor){if("Just"===r._0.ctor){var e=vr(r._0._0);return z(Bv(e)?{index:t.index+e,length:1,meaning:og}:{index:t.index+e-1,length:2,meaning:og})}if("::"===r._1.ctor&&"Just"===r._1._0.ctor)return z({index:t.index,length:vr(t.match),meaning:og});break t}break t}while(!1);return H},ig=r(function(t,r){return t?_(mt,ug,s(Mc,Lc,Bm,r)):_(mt,cg,s(Mc,Lc,Lm,r))}),ag={ctor:"SoftLineBreakToken"},_g=r(function(t,r){return{ctor:"EmphasisToken",_0:t,_1:r}}),sg=e(function(t,r,e){var n=e.submatches;if("::"===n.ctor&&"Just"===n._0.ctor&&"::"===n._1.ctor&&"::"===n._1._1.ctor&&"Just"===n._1._1._0.ctor&&"::"===n._1._1._1.ctor){var o=n._1._0,c=n._1._1._0._0,u=_(J,0,_(W,vr,o)),i=!m.eq(e.index,0)&&m.eq(u,0)?z(s(fr,e.index-1,e.index,r)):o,a=vr(n._0._0),f=!Bv(a)&&m.eq(u,0)||m.eq(i,z("\\")),l={ctor:"_Tuple2",_0:f?1:Wm(i),_1:Wm(n._1._1._1._0)},d=f?vr(c)-1:vr(c),p=e.index+a+u+(f?1:0);return m.cmp(d,0)<1||m.eq(t,m.chr("_"))&&m.eq(l,{ctor:"_Tuple2",_0:2,_1:2})?H:z({index:p,length:d,meaning:_(_g,t,l)})}return H}),fg=function(t){return _(mt,_(sg,m.chr("*"),t),s(Mc,Lc,Km,t))},lg=function(t){return _(mt,_(sg,m.chr("_"),t),s(Mc,Lc,Gm,t))},dg=r(function(t,r){return{ctor:"HtmlToken",_0:t,_1:r}}),pg=e(function(t,e,n){var o=n.submatches;t:do{if("::"!==o.ctor||"::"!==o._1.ctor||"Just"!==o._1._0.ctor)break t;if(""===o._1._0._0)return H;if("::"!==o._1._1.ctor||"::"!==o._1._1._1.ctor)break t;var c=o._1._0._0,u=o._0,i=r(function(t,r){return _(ht,function(t){return _(_t,Er(t),r)},t)}),a=_(J,{ctor:"[]"},_(W,qm,o._1._1._0)),s=m.eq(u,H)||!m.eq(u,H)&&m.eq(a,{ctor:"[]"}),f=function(r){return _(tg,t,{index:e.start,length:e.end-e.start,meaning:_(dg,m.eq(u,H)&&m.eq(o._1._1._1._0,H),_(ng,c,r))})},l=t.options.rawHtml;switch(l.ctor){case"ParseUnsafe":return s?z(f(a)):H;case"Sanitize":return _(_t,c,l._0.allowedHtmlElements)&&s?z(f(_(i,a,l._0.allowedHtmlAttributes))):H;default:return H}}while(!1);return H}),hg=r(function(t,r){var e=r,n=e._0;return"DontParse"===t.options.rawHtml.ctor?H:_(V,_(pg,t,n),lt(s(Mc,Bc(1),Nm,n.text)))}),vg=function(t){return{ctor:"RightAngleBracket",_0:t}},mg=function(t){var r=t.submatches;if("::"===r.ctor&&"Just"===r._0.ctor&&"::"===r._1.ctor&&"Just"===r._1._0.ctor){var e=vr(r._0._0);return z({index:t.index+e,length:1,meaning:vg(!Bv(e))})}return H},gg=function(t){return _(mt,mg,s(Mc,Lc,Fm,t))},yg=function(t){return{ctor:"CharToken",_0:t}},bg=function(t){var r=t.submatches;if("::"===r.ctor&&"Just"===r._0.ctor&&"::"===r._1.ctor&&"Just"===r._1._0.ctor){var e=vr(r._0._0);return Bv(e)?z({index:t.index+e,length:1,meaning:yg(m.chr("]"))}):H}return H},wg=function(t){return _(mt,bg,s(Mc,Lc,$m,t))},Tg=function(t){var r=t.submatches;if("::"===r.ctor&&"Just"===r._0.ctor&&"::"===r._1.ctor&&"Just"===r._1._0.ctor){var e=vr(r._0._0);return Bv(e)?z({index:t.index+e,length:1,meaning:yg(m.chr("<"))}):H}return H},kg=function(t){return _(mt,Tg,s(Mc,Lc,Pm,t))},Sg={ctor:"ImageOpenToken"},xg=function(t){return{ctor:"LinkOpenToken",_0:t}},Eg=function(t){var r=t.submatches;if("::"===r.ctor&&"Just"===r._0.ctor&&"::"===r._1.ctor&&"::"===r._1._1.ctor&&"Just"===r._1._1._0.ctor){var e=r._1._0,n=vr(r._0._0),o=!Bv(n),c=o?_(W,function(t){return xg(!0)},e):z(_(J,xg(!0),_(W,function(t){return Sg},e))),u=m.eq(c,z(Sg))?2:1,i=t.index+n+(o&&m.eq(e,z("!"))?1:0);return _(W,function(t){return{index:i,length:u,meaning:t}},c)}return H},Ag=function(t){return _(mt,Eg,s(Mc,Lc,Um,t))},Og=function(t){return{ctor:"CodeToken",_0:t}},Ig=function(t){var r=t.submatches;if("::"===r.ctor&&"Just"===r._0.ctor&&"::"===r._1.ctor&&"Just"===r._1._0.ctor){var e=vr(r._0._0);return z({index:t.index+e,length:vr(r._1._0._0),meaning:Og(!Bv(e))})}return H},Cg=function(t){return _(mt,Ig,s(Mc,Lc,Xm,t))},qg=function(t){return m.update(t,{tokens:_(Q,function(t){return t.index},_(r(function(t,r){return _(k["++"],t,r)}),gg(t.rawText),_(r(function(t,r){return _(k["++"],t,r)}),kg(t.rawText),_(r(function(t,r){return _(k["++"],t,r)}),_(ig,t.options.softAsHardLineBreak,t.rawText),_(r(function(t,r){return _(k["++"],t,r)}),wg(t.rawText),_(r(function(t,r){return _(k["++"],t,r)}),Ag(t.rawText),_(r(function(t,r){return _(k["++"],t,r)}),lg(t.rawText),_(r(function(t,r){return _(k["++"],t,r)}),fg(t.rawText),Cg(t.rawText)))))))))})},Ng=function(t){return{ctor:"Match",_0:t}},Mg=r(function(t,r){return Ng({type_:r,start:t.index,end:t.index+t.length,textStart:0,textEnd:0,text:"",matches:{ctor:"[]"}})}),jg=r(function(t,r){return Ng(m.update(r,{start:r.start-t.textStart,end:r.end-t.textStart,textStart:r.textStart-t.textStart,textEnd:r.textEnd-t.textStart}))}),Dg=r(function(t,r){return Ng(m.update(t,{matches:{ctor:"::",_0:_(jg,t,r),_1:t.matches}}))}),Rg=r(function(t,r){var e=t,n=e._0,o=r;if("[]"===o.ctor)return{ctor:"::",_0:Ng(n),_1:{ctor:"[]"}};var c=o._0._0;return m.cmp(c.end,n.start)<1?{ctor:"::",_0:Ng(n),_1:r}:m.cmp(c.start,n.start)<0&&m.cmp(c.end,n.end)>0?{ctor:"::",_0:_(Dg,c,n),_1:o._1}:r}),Bg=function(t){return _(pt,function(t){var r=t,e=r._0;return Ng(m.update(e,{matches:Bg(e.matches)}))},s(ut,Rg,{ctor:"[]"},_(Q,function(t){return t._0.start},t)))},Lg=function(t){return m.update(t,{matches:Bg(t.matches)})},Pg=function(t){return{ctor:"EmphasisType",_0:t}},Fg=function(t){return{ctor:"HtmlType",_0:t}},$g=function(t){return{ctor:"ImageType",_0:t}},Ug=function(t){return{ctor:"LinkType",_0:t}},Jg=e(function(t,r,e){var n=e.submatches;if("::"===n.ctor&&"::"===n._1.ctor&&"::"===n._1._1.ctor&&"::"===n._1._1._1.ctor&&"::"===n._1._1._1._1.ctor){var o=Fv({ctor:"::",_0:n._1._1._0,_1:{ctor:"::",_0:n._1._1._1._0,_1:{ctor:"::",_0:n._1._1._1._1._0,_1:{ctor:"[]"}}}}),c=function(r){return Ng(m.update(t,{type_:function(){return"ImageType"===t.type_.ctor?$g:Ug}()(bm({ctor:"_Tuple2",_0:r,_1:o})),end:t.end+vr(e.match)}))},u=Fv({ctor:"::",_0:n._0,_1:{ctor:"::",_0:n._1._0,_1:{ctor:"[]"}}});return _(W,c,u)}return H}),Hg=function(t){var r=t,e=r._1._0,n=r._0,o=r._2;return _($t,{ctor:"_Tuple3",_0:n,_1:Ng(e),_2:o},_(W,rg(o),_(V,_(Jg,e,o),lt(s(Mc,Bc(1),Tm,n)))))},Vg=e(function(t,r,e){var n=_(J,0,_(W,function(t){return vr(function(t){return t.match}(t))},e)),o=function(r){return Ng(m.update(t,{type_:function(){return"ImageType"===t.type_.ctor?$g:Ug}()(bm(r)),end:t.end+n}))},c=function(r){return Tr(r)?t.text:r}(_(J,t.text,_(J,H,_(J,H,_(W,function(t){return lt(function(t){return t.submatches}(t))},e))))),u=_(le,Wv(c),r.refs);return _(W,o,u)}),zg=function(t){var r=t,e=r._1._0,n=r._0,o=r._2;return _($t,{ctor:"_Tuple3",_0:n,_1:Ng(e),_2:o},_(W,rg(o),s(Vg,e,o,lt(s(Mc,Bc(1),ym,n)))))},Wg=function(t){return{ctor:"AutolinkType",_0:t}},Gg=function(t){var r=t,e=r._0;return _(jc,jm,e.text)?Bt(Ng(m.update(e,{type_:Wg({ctor:"_Tuple2",_0:e.text,_1:gm(e.text)})}))):Dt(Ng(e))},Kg=function(t){var r=t,e=r._0;return _(jc,Mm,e.text)?Bt(Ng(m.update(e,{type_:Wg({ctor:"_Tuple2",_0:e.text,_1:_(k["++"],"mailto:",gm(e.text))})}))):Dt(Ng(e))},Xg={ctor:"CodeType"},Qg={ctor:"HardLineBreakType"},Yg=function(t){for(;;){var e=t,n=e._1,o=e._0;if("[]"===o.ctor)return Ym(n);var c=o._1,u=o._0;if(m.eq(u.meaning,og)||m.eq(u.meaning,ag)&&n.options.softAsHardLineBreak){t=_(r(function(t,r){return{ctor:"_Tuple2",_0:t,_1:r}}),c,m.update(n,{matches:{ctor:"::",_0:_(Mg,u,Qg),_1:n.matches}}))}else{t={ctor:"_Tuple2",_0:c,_1:_(tg,n,u)}}}},Zg=function(t){return _(Rm,Yg,_(Rm,oy,_(Rm,ay,_(Rm,uy,_(Rm,ty,t)))))},ty=function(t){t:for(;;){var e=t,n=e._1,o=e._0;if("[]"===o.ctor)return Ym(n);var c=o._1,u=o._0,i=u.meaning;switch(i.ctor){case"CodeToken":var a=_(r(function(t,r){return{ctor:"_Tuple2",_0:t,_1:r}}),c,_(J,_(tg,n,u),_(W,_(ny,u,n),_(Qm,Dm(u),n.tokens))));t=a;continue t;case"RightAngleBracket":var f=_(r(function(t,r){return{ctor:"_Tuple2",_0:t,_1:r}}),c,_(Zm,function(t){return _(r(function(t,r){return!m.eq(t,r)}),yg(m.chr("<")),function(t){return t.meaning}(t))},_(J,n,_(V,s(ry,u,i._0,n),_(Qm,function(t){return _(r(function(t,r){return m.eq(t,r)}),yg(m.chr("<")),function(t){return t.meaning}(t))},n.tokens)))));t=f;continue t;default:var l={ctor:"_Tuple2",_0:c,_1:_(tg,n,u)};t=l;continue t}}},ry=n(function(t,r,e,n){var o=n,c=o._2;return function(t){var n=t;return"Err"===n.ctor?r?Mt(t):_(hg,m.update(e,{tokens:c}),n._0):Mt(t)}(_(Lt,function(t){return m.update(e,{matches:{ctor:"::",_0:t,_1:e.matches},tokens:c})},_(Lv,Kg,Gg(d(ey,e,function(t){return t},Xg,o._0,t,{ctor:"[]"})))))}),ey=c(function(t,r,e,n,o,c){var u=o.index,i=n.index+n.length,a=o.index+o.length,f=n.index,l={type_:e,start:f,end:a,textStart:i,textEnd:u,text:r(s(fr,i,u,t.rawText)),matches:{ctor:"[]"}},d=_(pt,function(t){return _(jg,l,t._0)},function(t){return t.matches}(Zg(m.update(t,{tokens:c,matches:{ctor:"[]"}}))));return Ng(m.update(l,{matches:d}))}),ny=e(function(t,r,e){var n=e,o=n._0,c=m.eq(o.meaning,Og(!0))?m.update(o,{index:o.index+1,length:o.length-1}):o;return m.update(r,{matches:{ctor:"::",_0:d(ey,r,Pv,Xg,c,t,{ctor:"[]"}),_1:r.matches},tokens:n._2})}),oy=function(t){t:for(;;){var r=t,e=r._1,n=r._0;if("[]"===n.ctor)return Ym(e);var o=n._1,c=n._0,u=c.meaning;if("EmphasisToken"!==u.ctor||"_Tuple2"!==u._1.ctor){var i={ctor:"_Tuple2",_0:o,_1:_(tg,e,c)};t=i}else{var a=u._1._1,f=u._1._0;if(m.eq(f,a)){if(m.eq(a,0)||m.eq(u._0,m.chr("_"))&&!m.eq(a,1)){var l={ctor:"_Tuple2",_0:o,_1:e};t=l;continue t}var d=_(J,{ctor:"_Tuple2",_0:o,_1:_(tg,e,c)},_(W,s(cy,c,o,e),_(Qm,vm(c),e.tokens)));t=d;continue t}if(m.cmp(f,a)<0){var p={ctor:"_Tuple2",_0:o,_1:_(tg,e,c)};t=p;continue t}var h=_(J,{ctor:"_Tuple2",_0:o,_1:e},_(W,s(cy,c,o,e),_(Qm,vm(c),e.tokens)));t=h}}},cy=n(function(t,r,e,n){var o=n,c=o._2,u=o._0,i=u.length-t.length,a=m.eq(i,0)?{ctor:"_Tuple4",_0:u,_1:t,_2:c,_3:r}:m.cmp(i,0)>0?{ctor:"_Tuple4",_0:m.update(u,{index:u.index+i,length:t.length}),_1:t,_2:{ctor:"::",_0:m.update(u,{length:i}),_1:c},_3:r}:{ctor:"_Tuple4",_0:u,_1:m.update(t,{length:u.length}),_2:c,_3:{ctor:"::",_0:m.update(t,{index:t.index+u.length,length:0-i}),_1:r}},_=a._0,s=a._1,f=a._2,l=a._3,p=d(ey,e,function(t){return t},Pg(_.length),_,s,gt(o._1));return{ctor:"_Tuple2",_0:l,_1:m.update(e,{matches:{ctor:"::",_0:p,_1:e.matches},tokens:f})}}),uy=function(t){t:for(;;){var e=t,n=e._1,o=e._0;if("[]"===o.ctor)return Ym(n);var c=o._1,u=o._0,i=u.meaning;if("HtmlToken"!==i.ctor){var a={ctor:"_Tuple2",_0:c,_1:_(tg,n,u)};t=a}else{var f=i._1;if(Om(f)||!i._0){var l=_(r(function(t,r){return{ctor:"_Tuple2",_0:t,_1:r}}),c,_(rg,n,_(Mg,u,Fg(f))));t=l;continue t}var d=_(J,_(r(function(t,r){return{ctor:"_Tuple2",_0:t,_1:r}}),c,_(rg,n,_(Mg,u,Fg(f)))),_(W,s(iy,u,n,f),_(Qm,Em(f),c)));t=d}}},iy=n(function(t,r,e,n){var o=n;return{ctor:"_Tuple2",_0:o._2,_1:m.update(r,{matches:{ctor:"::",_0:d(ey,r,function(t){return t},Fg(e),t,o._0,o._1),_1:r.matches}})}}),ay=function(t){for(;;){var r=t,e=r._1,n=r._0;if("[]"===n.ctor)return Ym(e);var o=n._1,c=n._0,u=c.meaning;if("CharToken"!==u.ctor||"]"!==u._0.valueOf()){t={ctor:"_Tuple2",_0:o,_1:_(tg,e,c)}}else{t=_(J,{ctor:"_Tuple2",_0:o,_1:e},_(V,s(_y,c,o,e),_(Qm,xm,e.tokens)))}}},_y=n(function(t,r,e,n){var o=n,c=o._2,u=o._0,i=o._1,a=function(t){var r=function(t){return"LinkOpenToken"===t.meaning.ctor?m.update(t,{meaning:xg(!1)}):t};return m.update(t,{tokens:_(pt,r,t.tokens)})},s={ctor:"_Tuple2",_0:r,_1:m.update(e,{tokens:_(k["++"],i,c)})},f=function(r){return d(ey,e,function(t){return t},r?Ug({ctor:"_Tuple2",_0:"",_1:H}):$g({ctor:"_Tuple2",_0:"",_1:H}),u,t,gt(i))},l=_(ar,t.index+1,e.rawText),p=function(t){return{ctor:"_Tuple3",_0:l,_1:f(t),_2:m.update(e,{tokens:c})}},h=u.meaning;switch(h.ctor){case"ImageOpenToken":return Mt(_(Lv,function(t){return Bt(s)},_(Lt,km(r),_(Rt,Sm,_(Ft,function(t){return{ctor:"_Tuple0"}},_(Lv,zg,Hg(p(!1))))))));case"LinkOpenToken":return!0===h._0?Mt(_(Lv,function(t){return Bt(s)},_(Lt,km(r),_(Lt,a,_(Rt,Sm,_(Ft,function(t){return{ctor:"_Tuple0"}},_(Lv,zg,Hg(p(!0))))))))):z(s);default:return H}}),sy={ctor:"NormalType"},fy=function(t){return Ng({type_:sy,start:0,end:0,textStart:0,textEnd:0,text:Jv(t),matches:{ctor:"[]"}})},ly=e(function(t,r,e){var n=r,o=n._0,c=Ng(m.update(o,{matches:s(dy,o.text,{ctor:"[]"},o.matches)})),u=e;if("[]"===u.ctor){var i=_(ar,o.end,t);return Tr(i)?{ctor:"::",_0:c,_1:{ctor:"[]"}}:{ctor:"::",_0:c,_1:{ctor:"::",_0:fy(i),_1:{ctor:"[]"}}}}var a=u._0._0;return m.eq(a.type_,sy)?{ctor:"::",_0:c,_1:e}:m.eq(o.end,a.start)?{ctor:"::",_0:c,_1:e}:m.cmp(o.end,a.start)<0?{ctor:"::",_0:c,_1:{ctor:"::",_0:fy(s(fr,o.end,a.start,t)),_1:e}}:e}),dy=e(function(t,r,e){for(;;){var n=e;if("[]"===n.ctor){var o=r;if("[]"===o.ctor)return Tr(t)?{ctor:"[]"}:{ctor:"::",_0:fy(t),_1:{ctor:"[]"}};var c=o._0._0;return m.cmp(c.start,0)>0?{ctor:"::",_0:fy(_(sr,c.start,t)),_1:r}:r}var u=t,i=s(ly,t,n._0,r),a=n._1;t=u,r=i,e=a}}),py=function(t){return m.update(t,{matches:s(dy,t.rawText,{ctor:"[]"},t.matches)})},hy=e(function(t,r,e){return pm(function(t){return t.matches}(py(Lg(Zg(qg(s(eg,t,r,or(e))))))))}),vy=r(function(t,r){var e=r;switch(e.ctor){case"Paragraph":return wt(_(pt,lm(t),e._1));case"Heading":return wt(_(pt,lm(t),e._2));case"PlainInlines":return wt(_(pt,lm(t),e._0));default:return{ctor:"[]"}}}),my=e(function(t,e,n){var o=_(J,_(my,H,e),t),c=_(J,cm,e),u=n;switch(u.ctor){case"BlankLine":return{ctor:"[]"};case"Heading":return{ctor:"::",_0:function(){switch(u._1){case 1:return Wi({ctor:"[]"});case 2:return Gi({ctor:"[]"});case 3:return Ki({ctor:"[]"});case 4:return Xi({ctor:"[]"});case 5:return Qi({ctor:"[]"});default:return Yi({ctor:"[]"})}}()(_(pt,c,u._2)),_1:{ctor:"[]"}};case"ThematicBreak":return{ctor:"::",_0:_(ta,{ctor:"[]"},{ctor:"[]"}),_1:{ctor:"[]"}};case"Paragraph":return{ctor:"::",_0:_(Zi,{ctor:"[]"},_(pt,c,u._1)),_1:{ctor:"[]"}};case"CodeBlock":if("Fenced"===u._0.ctor){var i=function(t){return{ctor:"::",_0:_(ra,{ctor:"[]"},{ctor:"::",_0:_(sa,t,{ctor:"::",_0:Vi(u._1),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}},a=u._0._1.language;return i("Just"===a.ctor?{ctor:"::",_0:Oa(_(k["++"],"language-",a._0)),_1:{ctor:"[]"}}:{ctor:"[]"})}return{ctor:"::",_0:_(ra,{ctor:"[]"},{ctor:"::",_0:_(sa,{ctor:"[]"},{ctor:"::",_0:Vi(u._1),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}),_1:{ctor:"[]"}};case"BlockQuote":return s(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),{ctor:"[]"},_(ea,{ctor:"[]"},wt(_(pt,o,u._0))));case"List":return s(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),{ctor:"[]"},function(){var t=u._0.type_;if("Ordered"===t.ctor){var r=t._0;return na(m.eq(r,1)?{ctor:"[]"}:{ctor:"::",_0:La(r),_1:{ctor:"[]"}})}return oa({ctor:"[]"})}()(_(pt,function(t){return _(ca,{ctor:"[]"},wt(_(pt,o,t)))},u._1)));case"PlainInlines":return _(pt,c,u._0);default:return s(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),{ctor:"[]"},_(ua,{ctor:"[]"},_(r(function(t,r){return{ctor:"::",_0:t,_1:r}}),Vi(_(k["++"],"Unhandled custom block:",S(u._0))),wt(_(pt,o,u._1)))))}}),gy=_(my,H,H),yy=r(function(t,r){return _(de,r.inside,t)?t:s(Je,r.inside,{ctor:"_Tuple2",_0:r.url,_1:r.maybeTitle},t)}),by=Dc(_(k["++"],"^\\s*\\[(",_(k["++"],"[^\\[\\]\\\\]*(?:\\\\.[^\\[\\]\\\\]*)*",_(k["++"],")\\]:",_(k["++"],"\\s*(?:<([^<>\\s]*)>|([^\\s]*))",_(k["++"],Gv,"\\s*(?![^\\n])")))))),wy=function(t){var r=t.submatches;if("::"===r.ctor&&"Just"===r._0.ctor&&"::"===r._1.ctor&&"::"===r._1._1.ctor&&"::"===r._1._1._1.ctor&&"::"===r._1._1._1._1.ctor&&"::"===r._1._1._1._1._1.ctor){var e=function(e){return{matchLength:vr(t.match),inside:r._0._0,url:e,maybeTitle:Fv({ctor:"::",_0:r._1._1._1._0,_1:{ctor:"::",_0:r._1._1._1._1._0,_1:{ctor:"::",_0:r._1._1._1._1._1._0,_1:{ctor:"[]"}}}})}},n=Fv({ctor:"::",_0:r._1._0,_1:{ctor:"::",_0:r._1._1._0,_1:{ctor:"[]"}}});return _(W,e,n)}return H},Ty=function(t){return _(V,function(t){return m.eq(t.url,"")||m.eq(t.inside,"")?H:z(t)},_(W,function(t){return m.update(t,{inside:Wv(t.inside)})},_(V,wy,lt(s(Mc,Bc(1),by,t)))))},ky=function(t){return m.eq(_(_r,2,t),"  ")?_(k["++"],or(t),"  "):or(t)},Sy=function(t){t:for(;;){var r=t;if("[]"===r.ctor)return!1;var e=r._0;r:do{if("::"!==e.ctor)break r;switch(e._0.ctor){case"BlankLine":return"[]"!==e._1.ctor;case"List":var n=e._0._1;t=n;continue t;default:break r}}while(!1);return!1}},xy=Dc("^( *([\\*\\-\\+])( {0,4}))(?:[ \\t](.*))?$"),Ey=Dc("^( *(\\d{1,9})([.)])( {0,4}))(?:[ \\t](.*))?$"),Ay=r(function(t,r){var e=r.submatches;if("::"===e.ctor&&"Just"===e._0.ctor){var n=e._0._0;return m.cmp(vr(n),t.fenceLength)>-1&&m.eq(_(sr,1,n),t.fenceChar)}return!1}),Oy=Dc("^ {0,3}(`{3,}|~{3,})\\s*$"),Iy=function(t){return function(r){return _(J,!1,_(W,Ay(t),lt(s(Mc,Bc(1),Oy,r))))}},Cy=Dc("^( {0,3})(`{3,}(?!.*`)|~{3,}(?!.*~))(.*)$"),qy=r(function(t,r){for(;;){var e=t;{if("::"!==e.ctor||"BlankLine"!==e._0.ctor)return{ctor:"_Tuple2",_0:t,_1:r};var n=e._1,o={ctor:"::",_0:e._0._0,_1:r};t=n,r=o}}}),Ny=Dc("^(?: {4,4}| {0,3}\\t)(.*)$"),My=Dc("^ {0,3}(?:>[ ]?)(.*)$"),jy=Dc(_(k["++"],"^ {0,3}(?:",_(k["++"],"(?:\\*[ \\t]*){3,}",_(k["++"],"|(?:_[ \\t]*){3,}","|(?:-[ \\t]*){3,})[ \\t]*$")))),Dy=function(t){var r=t.submatches;if("::"===r.ctor&&"Just"===r._0.ctor){var e=r._0._0;return z(_(Zt,"=",e)?{ctor:"_Tuple2",_0:1,_1:e}:{ctor:"_Tuple2",_0:2,_1:e})}return H},Ry=Dc("^ {0,3}(=+|-+)[ \\t]*$"),By=Dc(_(k["++"],"^ {0,3}(#{1,6})",_(k["++"],"(?:[ \\t]+[ \\t#]+$|[ \\t]+|$)","(.*?)(?:\\s+[ \\t#]*)?$"))),Ly=Dc("^\\s*$"),Py=function(t){var r=t,e=r._2,n=r._0,o=r._1,c=vr(o),u=m.cmp(c,4)>-1,i=u?_(k["++"],o,e):e,a=u||_(jc,Ly,e)?n.indentLength-c:n.indentLength;return{ctor:"_Tuple2",_0:m.update(n,{indentLength:a}),_1:i}},Fy=r(function(t,r){var e=_(ar,r.matchLength,t);return _(jc,Ly,e)?H:z(e)}),$y=r(function(t,r){t:for(;;){var e=Ty(r);if("Just"===e.ctor){var n=e._0,o=_(yy,t,n),c=_(Fy,r,n),u=c;if("Just"===u.ctor){var i=o,a=u._0;t=i,r=a;continue t}return{ctor:"_Tuple2",_0:o,_1:H}}return{ctor:"_Tuple2",_0:t,_1:z(r)}}}),Uy=(n(function(t,r,e,n){return{indentLength:t,fenceLength:r,fenceChar:e,language:n}}),n(function(t,r,e,n){return{type_:t,indentLength:r,delimiter:e,isLoose:n}}),n(function(t,r,e,n){return{matchLength:t,inside:r,url:e,maybeTitle:n}}),r(function(t,r){return{ctor:"Custom",_0:t,_1:r}})),Jy=function(t){return{ctor:"PlainInlines",_0:t}},Hy=r(function(t,r){return{ctor:"List",_0:t,_1:r}}),Vy=function(t){return{ctor:"BlockQuote",_0:t}},zy=r(function(t,r){var e=r;switch(e.ctor){case"BlockQuote":return t(Vy(_(pt,zy(t),e._0)));case"List":return t(_(Hy,e._0,_(pt,pt(zy(t)),e._1)));case"Custom":return t(_(Uy,e._0,_(pt,zy(t),e._1)));default:return t(r)}}),Wy=r(function(t,e){var n=e;switch(n.ctor){case"BlockQuote":var o=n._0;return _(r(function(t,r){return _(k["++"],t,r)}),t(Vy(o)),wt(_(pt,Wy(t),o)));case"List":var c=n._1;return _(r(function(t,r){return _(k["++"],t,r)}),t(_(Hy,n._0,c)),wt(wt(_(pt,pt(Wy(t)),c))));case"Custom":var u=n._1;return _(r(function(t,r){return _(k["++"],t,r)}),t(_(Uy,n._0,u)),wt(_(pt,Wy(t),u)));default:return t(e)}}),Gy=(r(function(t,r){return _(Wy,vy(t),r)}),r(function(t,r){return{ctor:"Paragraph",_0:t,_1:r}})),Ky=r(function(t,r){return _(Gy,_(k["++"],t,_(k["++"],"\n",ky(r))),{ctor:"[]"})}),Xy=r(function(t,e){var n=e;t:do{if("::"!==n.ctor)break t;switch(n._0.ctor){case"Paragraph":return z({ctor:"::",_0:_(Ky,n._0._0,t),_1:n._1});case"BlockQuote":return _(W,function(t){return{ctor:"::",_0:Vy(t),_1:n._1}},_(Xy,t,n._0._0));case"List":var o=n._0._1;return"::"===o.ctor?_(W,function(t){return s(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),n._1,_(Hy,n._0._0,s(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),o._1,t)))},_(Xy,t,o._0)):H;default:break t}}while(!1);return H}),Qy=r(function(t,r){return _(J,{ctor:"::",_0:_(Gy,ky(t),{ctor:"[]"}),_1:r},_(Xy,t,r))}),Yy=r(function(t,e){var n=e,o=n._0,c=n._1,u=t;switch(u.ctor){case"Paragraph":var i=_($y,xe,u._0),a=i._0,f=i._1,l=_(Ve,a,o),d=f;return"Just"===d.ctor?{ctor:"_Tuple2",_0:l,_1:{ctor:"::",_0:_(Gy,d._0,{ctor:"[]"}),_1:c}}:{ctor:"_Tuple2",_0:l,_1:c};case"List":var p=s(ut,r(function(t,e){var n=e;return _(kr,_(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),n._1),_(Zy,n._0,t))}),{ctor:"_Tuple2",_0:o,_1:{ctor:"[]"}},u._1),l=p._0,h=p._1;return{ctor:"_Tuple2",_0:l,_1:{ctor:"::",_0:_(Hy,u._0,h),_1:c}};case"BlockQuote":return _(kr,_(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),c),_(kr,Vy,_(Zy,o,u._0)));case"Custom":return _(kr,_(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),c),_(kr,Uy(u._0),_(Zy,o,u._1)));default:return{ctor:"_Tuple2",_0:o,_1:{ctor:"::",_0:t,_1:c}}}}),Zy=function(t){return _(ut,Yy,{ctor:"_Tuple2",_0:t,_1:{ctor:"[]"}})},tb=r(function(t,r){return{ctor:"CodeBlock",_0:t,_1:r}}),rb=e(function(t,r,e){return{ctor:"Heading",_0:t,_1:r,_2:e}}),eb=function(t){var r=t.submatches;return"::"===r.ctor&&"Just"===r._0.ctor&&"::"===r._1.ctor&&"Just"===r._1._0.ctor?z(s(rb,r._1._0._0,vr(r._0._0),{ctor:"[]"})):H},nb=function(t){var e=t,n=e._0,o=e._1;return _($t,{ctor:"_Tuple2",_0:n,_1:o},_(W,_(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),o),_(V,eb,lt(s(Mc,Bc(1),By,n)))))},ob=e(function(t,r,e){var n=e,o=r;return"::"===o.ctor&&"Paragraph"===o._0.ctor?z({ctor:"::",_0:s(rb,o._0._0,n._0,{ctor:"[]"}),_1:o._1}):H}),cb=function(t){var r=t,e=r._0,n=r._1;return _($t,{ctor:"_Tuple2",_0:e,_1:n},_(V,_(ob,e,n),_(V,Dy,lt(s(Mc,Bc(1),Ry,e)))))},ub=n(function(t,e,n,o){var c=_(J,Yv,t),u=o;switch(u.ctor){case"Heading":var i=u._0;return s(rb,i,u._1,s(hy,c,n,i));case"Paragraph":var a=u._0,f=s(hy,c,n,a),l=f;return"::"===l.ctor&&"HtmlInline"===l._0.ctor&&"[]"===l._1.ctor?Jy(f):e?_(Gy,a,f):Jy(f);case"BlockQuote":return Vy(s(ib,t,!0,{ctor:"_Tuple2",_0:n,_1:u._0}));case"List":var d=u._0;return _(Hy,d,s(b,pt,u._1,function(e){return s(ib,t,d.isLoose,_(r(function(t,r){return{ctor:"_Tuple2",_0:t,_1:r}}),n,e))}));case"Custom":return _(Uy,u._0,s(ib,t,!0,{ctor:"_Tuple2",_0:n,_1:u._1}));default:return o}}),ib=e(function(t,r,e){var n=e;return _(pt,s(ub,t,r,n._0),n._1)}),ab=r(function(t,r){var e=r;switch(e.ctor){case"Paragraph":return _(Gy,e._0,_(pt,dm(t),e._1));case"Heading":return s(rb,e._0,e._1,_(pt,dm(t),e._2));case"PlainInlines":return Jy(_(pt,dm(t),e._0));default:return r}}),_b=(r(function(t,r){return _(zy,ab(t),r)}),{ctor:"ThematicBreak"}),sb=function(t){var r=t,e=r._0,n=r._1;return _($t,{ctor:"_Tuple2",_0:e,_1:n},_(W,function(t){return{ctor:"::",_0:_b,_1:n}},lt(s(Mc,Bc(1),jy,e))))},fb=function(t){return{ctor:"BlankLine",_0:t}},lb=r(function(t,r){return{ctor:"Fenced",_0:t,_1:r}}),db=r(function(t,e){var n=t;t:do{if("::"!==n.ctor)break t;switch(n._0.ctor){case"CodeBlock":if("Fenced"===n._0._0.ctor&&!0===n._0._0._0)return s(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),n._1,_(tb,_(lb,!0,n._0._0._1),_(k["++"],n._0._1,"\n")));break t;case"List":return{ctor:"::",_0:_(Hy,n._0._0,_(pb,e,n._0._1)),_1:n._1};default:break t}}while(!1);return{ctor:"::",_0:fb(e.match),_1:t}}),pb=r(function(t,r){var e=r;return"[]"===e.ctor?{ctor:"::",_0:{ctor:"::",_0:fb(t.match),_1:{ctor:"[]"}},_1:{ctor:"[]"}}:{ctor:"::",_0:_(db,e._0,t),_1:e._1}}),hb=function(t){var r=t,e=r._0,n=r._1;return _($t,{ctor:"_Tuple2",_0:e,_1:n},_(W,db(n),lt(s(Mc,Bc(1),Ly,e))))},vb=function(t){var r=t.submatches;if("::"===r.ctor&&"Just"===r._0.ctor&&"::"===r._1.ctor&&"Just"===r._1._0.ctor&&"::"===r._1._1.ctor&&"Just"===r._1._1._0.ctor){var e=r._1._0._0;return z(_(lb,!0,{indentLength:vr(r._0._0),fenceLength:vr(e),fenceChar:_(sr,1,e),language:_(W,Jv,_(V,function(t){return m.eq(t,"")?H:z(t)},lt(nr(r._1._1._0._0))))}))}return H},mb=function(t){var e=t,n=e._0,o=e._1;return _($t,{ctor:"_Tuple2",_0:n,_1:o},_(W,_(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),o),_(W,function(t){return _(tb,t,"")},_(V,vb,lt(s(Mc,Bc(1),Cy,n))))))},gb=e(function(t,r,e){return _(Iy,t,e)?_(tb,_(lb,!1,t),r):_(tb,_(lb,!0,t),_(k["++"],r,_(k["++"],_(Hv,t.indentLength,e),"\n")))}),yb={ctor:"Indented"},bb=r(function(t,e){var n=e,o=n._0;return"::"===o.ctor&&"CodeBlock"===o._0.ctor&&"Indented"===o._0._0.ctor?z(s(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),o._1,_(tb,yb,s(b,r(function(t,r){return _(k["++"],t,r)}),_(k["++"],t,"\n"),_(r(function(t,r){return _(k["++"],t,r)}),o._0._1,mr(_(pt,function(t){return _(k["++"],_(Hv,4,t),"\n")},n._1))))))):H}),wb=r(function(t,e){var n=t;t:do{if("::"!==n.ctor)break t;switch(n._0.ctor){case"CodeBlock":if("Indented"===n._0._0.ctor)return s(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),n._1,_(tb,yb,_(k["++"],n._0._1,_(k["++"],e,"\n"))));break t;case"BlankLine":return _(J,s(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),t,_(tb,yb,_(k["++"],e,"\n"))),_(bb,e,_(qy,n._1,{ctor:"::",_0:n._0._0,_1:{ctor:"[]"}})));default:break t}}while(!1);return _(J,s(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),t,_(tb,yb,_(k["++"],e,"\n"))),_(Xy,e,t))}),Tb=function(t){var r=t,e=r._0,n=r._1;return _($t,{ctor:"_Tuple2",_0:e,_1:n},_(W,wb(n),_(J,H,_(J,H,_(W,function(t){return lt(function(t){return t.submatches}(t))},lt(s(Mc,Bc(1),Ny,e)))))))},kb=function(t){return{ctor:"Ordered",_0:t}},Sb={ctor:"Unordered"},xb=function(t){var r=t.submatches;return"::"===r.ctor&&"Just"===r._0.ctor&&"::"===r._1.ctor&&"Just"===r._1._0.ctor&&"::"===r._1._1.ctor&&"Just"===r._1._1._0.ctor&&"::"===r._1._1._1.ctor&&"Just"===r._1._1._1._0.ctor&&"::"===r._1._1._1._1.ctor?z({ctor:"_Tuple3",_0:{type_:_(jt,Sb,_(Lt,kb,Xt(r._1._0._0))),indentLength:vr(r._0._0)+1,delimiter:r._1._1._0._0,isLoose:!1},_1:r._1._1._1._0._0,_2:_(J,"",r._1._1._1._1._0)}):H},Eb=function(t){return _($t,t,_(V,xb,lt(s(Mc,Bc(1),Ey,t))))},Ab=function(t){var r=t.submatches;return"::"===r.ctor&&"Just"===r._0.ctor&&"::"===r._1.ctor&&"Just"===r._1._0.ctor&&"::"===r._1._1.ctor&&"Just"===r._1._1._0.ctor&&"::"===r._1._1._1.ctor&&"[]"===r._1._1._1._1.ctor?z({ctor:"_Tuple3",_0:{type_:Sb,indentLength:vr(r._0._0)+1,delimiter:r._1._0._0,isLoose:!1},_1:r._1._1._0._0,_2:_(J,"",r._1._1._1._0)}):H},Ob=function(t){return _($t,t,_(V,Ab,lt(s(Mc,Bc(1),xy,t))))},Ib=function(t){var e=t,n=e._0,o=e._1;return _(Ft,_(b,r(function(t,r){return{ctor:"_Tuple2",_0:t,_1:r}}),o),_(Lt,_(Cb,n,o),_(Lt,Py,_(Lv,Ob,Eb(n)))))},Cb=e(function(t,e,n){var o=n,c=o._0,u=_(qb,o._1,{ctor:"[]"}),i={ctor:"::",_0:_(Hy,c,{ctor:"::",_0:u,_1:{ctor:"[]"}}),_1:e},a=e;t:do{if("::"!==a.ctor)break t;switch(a._0.ctor){case"List":var f=a._0._0,l=a._0._1;return m.eq(c.delimiter,f.delimiter)?s(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),a._1,_(Hy,m.update(f,{indentLength:c.indentLength,isLoose:f.isLoose||Sy(l)}),{ctor:"::",_0:u,_1:l})):i;case"Paragraph":var d=a._0._0,p=a._1,h=u;if("::"===h.ctor&&"BlankLine"===h._0.ctor&&"[]"===h._1.ctor)return{ctor:"::",_0:_(Ky,d,t),_1:p};var v=c.type_;return"Ordered"===v.ctor?1===v._0?i:{ctor:"::",_0:_(Ky,d,t),_1:p}:i;default:break t}}while(!1);return i}),qb=r(function(t,e){var n=e;t:do{if("::"!==n.ctor)break t;switch(n._0.ctor){case"CodeBlock":if("Fenced"===n._0._0.ctor&&!0===n._0._0._0)return s(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),n._1,s(gb,n._0._0._1,n._0._1,t));break t;case"List":var o=n._0._0;return m.cmp(zv(t),o.indentLength)>-1?l(jb,t,o,n._0._1,e,n._1):_(jt,_(Qy,t,e),_(Lv,Nb,_(Lv,nb,_(Lv,cb,_(Lv,mb,_(Lv,Tb,_(Lv,hb,_(Lv,Ib,sb({ctor:"_Tuple2",_0:t,_1:e})))))))));default:break t}}while(!1);return _(Db,t,e)}),Nb=function(t){var r=t,e=r._0,n=r._1;return _($t,{ctor:"_Tuple2",_0:e,_1:n},_(W,Mb(n),_(J,H,_(J,H,_(W,function(t){return lt(function(t){return t.submatches}(t))},lt(s(Mc,Bc(1),My,e)))))))},Mb=r(function(t,e){var n=t;return"::"===n.ctor&&"BlockQuote"===n._0.ctor?s(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),n._1,Vy(_(qb,e,n._0._0))):s(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),t,Vy(_(qb,e,{ctor:"[]"})))}),jb=o(function(t,e,n,o,c){var u=n;if("[]"===u.ctor)return s(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),c,_(Hy,e,s(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),{ctor:"[]"},s(b,qb,{ctor:"[]"},_(Hv,e.indentLength,t)))));var i=u._0,a=_(Hv,e.indentLength,t),f=function(t){return s(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),c,_(Hy,t,s(b,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),u._1,_(qb,a,i))))},l=i;t:do{if("::"!==l.ctor)break t;switch(l._0.ctor){case"BlankLine":return"[]"===l._1.ctor?f(e):_(ot,function(t){return"BlankLine"===t.ctor},l._1)?_(Db,t,o):f(m.update(e,{isLoose:!0}));case"List":return f(m.cmp(zv(a),l._0._0.indentLength)>-1?e:Sy(l._0._1)?m.update(e,{isLoose:!0}):e);default:break t}}while(!1);return f(e)}),Db=r(function(t,r){return _(jt,_(Qy,t,r),_(Lv,Ib,_(Lv,sb,_(Lv,Nb,_(Lv,nb,_(Lv,cb,_(Lv,mb,_(Lv,Tb,hb({ctor:"_Tuple2",_0:t,_1:r})))))))))}),Rb=r(function(t,r){for(;;){var e=t;if("[]"===e.ctor)return r;var n=e._1,o=_(qb,e._0,r);t=n,r=o}}),Bb=function(t){return function(r){return s(ib,t,!0,_(Zy,xe,s(b,Rb,{ctor:"[]"},er(r))))}},Lb=(r(function(t,r){return wt(_(pt,gy,_(Bb,t,r)))}),r(function(t,r){var e=_(bt,r.path,t);return m.update(r,{path:e})}),r(function(t,r){var e=_(Xe,t,r.query);return m.update(r,{query:e})}),e(function(t,r,e){var n=_(He,t,r);return m.update(e,{query:n})}),e(function(t,r,e){var n=Tr(r)?_(Xe,t,e.query):s(Je,t,r,e.query);return m.update(e,{query:n})}),function(t){var r=ue(t.query),e=_(pt,function(t){var r=t;return{ctor:"_Tuple2",_0:Ts(r._0),_1:Ts(r._1)}},r),n=_(pt,function(t){var r=t;return _(k["++"],r._0,_(k["++"],"=",r._1))},e);return Ee(t.query)?"":_(k["++"],"?",_(dr,"&",n))}),Pb=function(t){var r=_(pr,"=",t),e=_(J,"",lt(r)),n=_(J,"",ws(e)),o=_(J,"",lt(_(Y,1,r)));return{ctor:"_Tuple2",_0:n,_1:_(J,"",ws(o))}},Fb=function(t){var r=_(pr,"&",t);return Tr(t)?{ctor:"[]"}:_(pt,Pb,r)},$b=function(t){return Ke(Fb(t))},Ub=function(t){return _(J,"",lt(_(pr,"#",_(J,"",lt(_(Y,1,_(pr,"?",t)))))))},Jb=function(t){return $b(Ub(t))},Hb=function(t){return _(J,"",lt(_(Y,1,_(pr,"#",t))))},Vb=function(t){return Hb(t)},zb=function(t){return _(pr,".",t)},Wb=function(t){var r=_(pr,"://",t);return 1===it(r)?"":_(J,"",lt(r))},Gb=function(t){var r=Dc(":\\d+"),e=s(Mc,Bc(1),r,t);return function(r){var e=r;if("Ok"===e.ctor)return e._0;switch(Wb(t)){case"http":return 80;case"https":return 443;case"ftp":return 21;case"sftp":return 22;default:return 0}}(Xt(_(ar,1,_(J,"",lt(_(pt,function(t){return t.match},e))))))},Kb=(r(function(t,r){var e=_(pr,t,r),n=lt(e);switch(it(e)){case 0:case 1:return"";default:return _(J,"",n)}}),r(function(t,r){var e=_(pr,t,r);return _(J,"",lt(e))})),Xb=r(function(t,r){var e=_(pr,t,r);return _(J,"",lt(gt(e)))}),Qb=function(t){var r=_(k["++"],"(",_(k["++"],"((\\w|-)+\\.)+(\\w|-)+",_(k["++"],"|",_(k["++"],"localhost",")"))));return _(J,"",lt(_(pt,function(t){return t.match},s(Mc,Bc(1),Dc(r),_(Kb,"/",_(Xb,"//",t))))))},Yb=function(t){return zb(Qb(t))},Zb=function(t){var r=Qb(t);return f(Nc,Bc(1),Dc(":\\d+"),function(t){return""},f(Nc,Bc(1),Dc(r),function(t){return""},_(Kb,"#",_(Kb,"?",_(Xb,"//",t)))))},tw=function(t){return _(jc,Dc("^/"),Zb(t))},rw=function(t){return _(jc,Dc("/$"),Zb(t))},ew=(r(function(t,r){var e=_(pr,t,r);switch(it(e)){case 0:case 1:return"";default:return _(J,"",lt(gt(e)))}}),function(t){return!Tr(t)}),nw=function(t){return _(pt,J(""),_(pt,ws,_(ht,ew,_(pr,"/",t))))},ow=function(t){return nw(Zb(t))},cw=function(t){return{host:Yb(t),hash:Vb(t),password:"",path:ow(t),hasLeadingSlash:tw(t),hasTrailingSlash:rw(t),port_:Gb(t),protocol:Wb(t),query:Jb(t),username:""}},uw=function(t){return _(k["++"],"/",_(k["++"],_(dr,"/",t.path),t.hasTrailingSlash&&!st(t.path)?"/":""))},iw=r(function(t,r){return m.eq(t.path,r.path)&&m.eq(t.hasTrailingSlash,r.hasTrailingSlash)&&m.eq(t.hash,r.hash)&&m.eq(ue(t.query),ue(r.query))}),aw=r(function(t,r){return _(iw,cw(r.url),t)?H:z(r)}),_w=r(function(t,r){return m.update(r,{url:t(r.url)})}),sw=r(function(t,r){return _(_w,_(Zt,"?",r.url)?function(r){return _(k["++"],uw(t),r)}:_(Zt,"#",r.url)?function(r){return _(k["++"],uw(t),_(k["++"],Lb(t),r))}:function(t){return t},r)}),fw=function(t){return function(){return"NewEntry"===t.entry.ctor?vf:pf}()(t.url)},lw=function(t){return _(bf,t.locationToMessage,{init:t.init,update:t.update,view:t.view,subscriptions:t.subscriptions})},dw=(e(function(t,r,e){var n=e;return"RouterMsg"===n.ctor?t(n._0):r(n._0)}),function(t){return{delta2url:t.delta2url,location2messages:t.location2messages,update:t.update,subscriptions:t.subscriptions,view:t.view}}),pw=(c(function(t,r,e,n,o,c){return{delta2url:t,location2messages:r,init:e,update:n,subscriptions:o,view:c}}),c(function(t,r,e,n,o,c){return{delta2url:t,location2messages:r,init:e,update:n,subscriptions:o,view:c}}),o(function(t,r,e,n,o){return{delta2url:t,location2messages:r,update:e,subscriptions:n,view:o}}),r(function(t,r){return{entry:t,url:r}}),r(function(t,r){return{reportedUrl:t,expectedUrlChanges:r}}),o(function(t,r,e,n,o){return{locationToMessage:t,init:r,update:e,view:n,subscriptions:o}}),o(function(t,r,e,n,o){return{locationToMessage:t,init:r,update:e,view:n,subscriptions:o}}),{ctor:"NewEntry"}),hw=r(function(t,r){return{ctor:"WrappedModel",_0:t,_1:r}}),vw=(r(function(t,r){var e=r;return _(hw,t(e._0),e._1)}),function(t){return{ctor:"UserMsg",_0:t}}),mw=r(function(t,r){var e=r;return _(Hi,vw,t.view(e._0))}),gw=r(function(t,r){var e=r;return _(Dr,vw,t.subscriptions(e._0))}),yw=n(function(t,r,e,n){var o={expectedUrlChanges:0,reportedUrl:cw(n.href)},c=s(ri,r.update,r.location2messages(n),t(e)),u=c._0,i=c._1;return{ctor:"_Tuple2",_0:_(hw,u,o),_1:_(Nr,vw,i)}}),bw=(e(function(t,r,e){var n={expectedUrlChanges:0,reportedUrl:cw(e.href)},o=s(ri,r.update,r.location2messages(e),t),c=o._0,u=o._1;return{ctor:"_Tuple2",_0:_(hw,c,n),_1:_(Nr,vw,u)}}),e(function(t,r,e){var n=e,o=n._0,c=n._1,u=r;if("RouterMsg"===u.ctor){var i=u._0,a={reportedUrl:cw(i.href),expectedUrlChanges:m.cmp(c.expectedUrlChanges,0)>0?c.expectedUrlChanges-1:0};if(m.cmp(c.expectedUrlChanges,0)>0)return{ctor:"_Tuple2",_0:_(hw,o,a),_1:Cr};var f=s(ri,t.update,t.location2messages(i),{ctor:"_Tuple2",_0:o,_1:Cr}),l=f._0,d=f._1;return{ctor:"_Tuple2",_0:_(hw,l,a),_1:_(Nr,vw,d)}}var p=_(t.update,u._0,o),l=p._0,h=p._1,v=_(V,aw(c.reportedUrl),_(W,sw(c.reportedUrl),_(t.delta2url,o,l))),g=v;if("Just"===g.ctor){var y=g._0;return{ctor:"_Tuple2",_0:_(hw,l,{reportedUrl:cw(y.url),expectedUrlChanges:c.expectedUrlChanges+1}),_1:_(Nr,vw,Ir({ctor:"::",_0:fw(y),_1:{ctor:"::",_0:h,_1:{ctor:"[]"}}}))}}return{ctor:"_Tuple2",_0:_(hw,l,c),_1:_(Nr,vw,h)}})),ww=function(t){return{ctor:"RouterMsg",_0:t}},Tw=function(t){var r=dw(t);return{locationToMessage:ww,init:_(yw,t.init,r),update:bw(r),view:mw(r),subscriptions:gw(r)}},kw=r(function(t,r){var n=r,o=n._0,c=t?"$":"#",u=m.eq(o.hash,"")?"":_(k["++"],c,Ts(o.hash)),i=e(function(t,r,e){return{ctor:"::",_0:_(k["++"],Ts(t),_(k["++"],"=",Ts(r))),_1:e}}),a=_(dr,"/",_(pt,Ts,o.path)),f=t?"^":"?",l=Ee(o.query)?"":_(k["++"],f,_(dr,"&",s(ie,i,{ctor:"[]"},o.query))),d=t?"#!/":"/";return{entry:o.entry,url:_(k["++"],d,_(k["++"],a,_(k["++"],l,u)))}}),Sw=(kw(!1),kw(!0)),xw=(r(function(t,r){return _(le,t,r._0.query)}),function(t){return t._0.path}),Ew=function(t){return{ctor:"Builder",_0:t}},Aw=Ew({entry:pw,path:{ctor:"[]"},query:xe,hash:""}),Ow=(r(function(t,r){var e=r,n=e._0;return Ew(m.update(n,{path:t(n.path)}))}),r(function(t,r){var e=r;return Ew(m.update(e._0,{path:t}))})),Iw=r(function(t,r){var e=r,n=e._0;return Ew(m.update(n,{query:t(n.query)}))}),Cw=(r(function(t,r){return Iw(_(Je,t,r))}),r(function(t,r){return Iw(_(Ue,t,r))}),r(function(t,r){var e=r;return Ew(m.update(e._0,{query:t}))}),r(function(t,r){var e=r,n=e._0;return Ew(m.update(n,{hash:t(n.hash)}))}),r(function(t,r){var e=r;return Ew(m.update(e._0,{hash:t}))}),function(t){var r=cw(f(Nc,Bc(1),Dc("\\^"),w("?"),f(Nc,Bc(1),Dc("$"),w("#"),f(Nc,Bc(1),Dc("^!"),w(""),function(t){return t.hash}(cw(t))))));return Ew({entry:pw,path:r.path,query:r.query,hash:r.hash})}),qw=(n(function(t,r,e,n){var o=ll(n),c=ll(e),u=_(q,c,o),i=_(N,c,o),a=ll(r);switch(t.ctor){case"Between":return m.cmp(a,i)>0&&m.cmp(a,u)<0;case"BetweenOpenStart":return m.cmp(a,i)>-1&&m.cmp(a,u)<0;case"BetweenOpenEnd":return m.cmp(a,i)>0&&m.cmp(a,u)<1;default:return m.cmp(a,i)>-1&&m.cmp(a,u)<1}}),e(function(t,r,e){var n=ll(e),o=ll(r);switch(t.ctor){case"Before":return m.cmp(o,n)<0;case"After":return m.cmp(o,n)>0;case"Same":return m.eq(o,n);case"SameOrBefore":return m.cmp(o,n)<1;default:return m.cmp(o,n)>-1}})),Nw={ctor:"After"},Mw=e(function(t,r,e){var n=s(il,Ao(r),pl(Eo(r)),xo(r));return(s(il,Ao(t),pl(Eo(t)),xo(t))-n)*e}),jw=(r(function(t,r){return s(qw,Nw,t,r)?s(Mw,t,r,1):s(Mw,r,t,-1)}),e(function(t,r,e){var o=n(function(t,r,e,n){return m.cmp(r,e)<0?{ctor:"_Tuple2",_0:t-1,_1:n+r-e}:{ctor:"_Tuple2",_0:t,_1:r-e}}),c=bo(r),u=bo(t),i=wo(r),a=wo(t),s=To(r),l=To(t),d=ko(r),p=ko(t),h=xo(r),v=xo(t),g=Eo(r),y=pl(g),b=Eo(t),w=pl(b),T=Ao(r),k=_(bl,T,g),S=Ao(t),x=f(o,S-T,w,y,12),E=x._0,A=x._1,O=f(o,A,v,h,k),I=O._0,C=O._1,q=f(o,C,p,d,24),N=q._0,M=q._1,j=f(o,M,l,s,60),D=j._0,R=j._1,B=f(o,R,a,i,60),L=B._0,P=B._1,F=f(o,P,u,c,1e3);return{year:E*e,month:I*e,day:N*e,hour:D*e,minute:L*e,second:F._0*e,millisecond:F._1*e}})),Dw=(r(function(t,r){return s(qw,Nw,t,r)?s(jw,t,r,1):s(jw,r,t,-1)}),r(function(t,r){var e=xo(r),n=pl(Eo(r)),o=n+t,c=_(k["%"],o,12),u=m.cmp(o,0)<0?(o/12|0)-1:o/12|0,i=Ao(r),a=s(il,i,n,e),f=i+u,l=_(N,_(bl,f,ml(o)),e),d=s(il,f,c,l);return s(Zf,el,d-a,r)})),Rw=r(function(t,r){return _(Dw,12*t,r)}),Bw=r(function(t,r){var e=kl(r),n=kl(t);if(m.eq(n,e))return r;var o=s(Zf,ul,(e-n)*dl,r),c=kl(o);return m.eq(c,e)?o:r}),Lw=function(t){var r=t;switch(r.ctor){case"Millisecond":case"Second":case"Minute":case"Hour":return!1;case"Day":case"Week":case"Month":case"Year":return!0;default:var e=r._0;return!m.eq(e.day,0)||!m.eq(e.month,0)||!m.eq(e.year,0)}},Pw=(u(function(t,r,e,n,o,c,u){return{year:t,month:r,day:e,hour:n,minute:o,second:c,millisecond:u}}),{ctor:"Year"}),Fw={ctor:"Month"},$w=e(function(t,r,e){var n=t;switch(n.ctor){case"Millisecond":return s(Zf,ul,r,e);case"Second":return s(Zf,cl,r,e);case"Minute":return s(Zf,ol,r,e);case"Hour":return s(Zf,nl,r,e);case"Day":return s(Zf,el,r,e);case"Week":return s(Zf,rl,r,e);case"Month":return _(Dw,r,e);case"Year":return _(Rw,r,e);default:var o=n._0;return s(Zf,tl({week:0,day:o.day,hour:o.hour,minute:o.minute,second:o.second,millisecond:o.millisecond}),r,s($w,Fw,o.month,s($w,Pw,o.year,e)))}}),Uw=e(function(t,r,e){var n=s($w,t,r,e);return Lw(t)?_(Bw,e,n):n}),Jw={ctor:"Day"},Hw={ctor:"Hour"},Vw={ctor:"Minute"},zw={ctor:"Second"},Ww={ctor:"Millisecond"},Gw=e(function(t,r,e){var n=hl(t),o=So(e),c=_(vl,o,r),u=hl(o),i=n-u,a=m.cmp(c+i,0)<0?i+7:i;return s(Uw,Jw,a,e)}),Kw=r(function(t,r){var e=pl(Eo(r)),n=pl(t);return s(Uw,Fw,n-e,r)}),Xw=r(function(t,r){var e=t;switch(e.ctor){case"Millisecond":return s(Uw,Ww,s(j,0,999,e._0)-bo(r),r);case"Second":return s(Uw,zw,s(j,0,59,e._0)-wo(r),r);case"Minute":return s(Uw,Vw,s(j,0,59,e._0)-To(r),r);case"Hour":return s(Uw,Hw,s(j,0,23,e._0)-ko(r),r);case"DayOfWeek":return s(Gw,e._0._0,e._0._1,r);case"DayOfMonth":var n=yl(r);return s(Uw,Jw,s(j,1,n,e._0)-xo(r),r);case"Month":return _(Kw,e._0,r);default:var o=e._0,c=m.cmp(o,0)<0?0:o;return s(Uw,Pw,c-Ao(r),r)}}),Qw=(r(function(t,r){var e=t;switch(e.ctor){case"Millisecond":var n=e._0;return m.cmp(n,0)<0||m.cmp(n,999)>0?H:z(s(Uw,Ww,n-bo(r),r));case"Second":var o=e._0;return m.cmp(o,0)<0||m.cmp(o,59)>0?H:z(s(Uw,zw,o-wo(r),r));case"Minute":var c=e._0;return m.cmp(c,0)<0||m.cmp(c,59)>0?H:z(s(Uw,Vw,c-To(r),r));case"Hour":var u=e._0;return m.cmp(u,0)<0||m.cmp(u,23)>0?H:z(s(Uw,Hw,u-ko(r),r));case"DayOfWeek":return z(s(Gw,e._0._0,e._0._1,r));case"DayOfMonth":var i=e._0,a=yl(r);return m.cmp(i,1)<0||m.cmp(i,a)>0?H:z(s(Uw,Jw,i-xo(r),r));case"Month":return z(_(Kw,e._0,r));default:var f=e._0;return m.cmp(f,0)<0?H:z(s(Uw,Pw,f-Ao(r),r))}}),function(t){return{ctor:"Month",_0:t}}),Yw=function(t){return{ctor:"DayOfMonth",_0:t}},Zw=function(t){return{ctor:"Hour",_0:t}},tT=function(t){return{ctor:"Minute",_0:t}},rT=function(t){return{ctor:"Second",_0:t}},eT=function(t){return{ctor:"Millisecond",_0:t}},nT={ctor:"Year"},oT={ctor:"Month"},cT={ctor:"Day"},uT={ctor:"Hour"},iT={ctor:"Minute"},aT={ctor:"Second"},_T=r(function(t,r){switch(t.ctor){case"Millisecond":return r;case"Second":return _(Xw,eT(0),r);case"Minute":return _(Xw,rT(0),_(_T,aT,r));case"Hour":return _(Xw,tT(0),_(_T,iT,r));case"Day":return _(Xw,Zw(0),_(_T,uT,r));case"Month":return _(Xw,Yw(1),_(_T,cT,r));default:return sT(r)}}),sT=function(t){var r=_(Xw,Yw(1),t),e=_(Xw,Qw(Ko),r),n=ll(r)-ll(e),o=gl(ll(t)-n);return _(_T,oT,o)},fT=r(function(t,r){switch(t.ctor){case"Millisecond":return r;case"Second":return _(Xw,eT(999),r);case"Minute":return _(Xw,rT(59),_(fT,aT,r));case"Hour":return _(Xw,tT(59),_(fT,iT,r));case"Day":return _(Xw,Zw(23),_(fT,uT,r));case"Month":return _(Xw,Yw(31),_(fT,cT,r));default:var e=s(Uw,Pw,1,r),n=_(_T,nT,e);return s(Uw,Ww,-1,n)}}),lT=r(function(t,r){for(;;){var e=r;if("[]"===e.ctor)return H;var n=e._0;if(t(n))return z(n);var o=t,c=e._1;t=o,r=c}}),dT=function(t){var r=t;switch(r.ctor){case"KeyCombo":return r._1;case"KeyCombo2":return r._2;case"KeyCombo3":return r._3;default:return r._4}},pT=function(t){var r=t;switch(r.ctor){case"KeyCombo":return{ctor:"::",_0:r._0,_1:{ctor:"[]"}};case"KeyCombo2":return{ctor:"::",_0:r._0,_1:{ctor:"::",_0:r._1,_1:{ctor:"[]"}}};case"KeyCombo3":return{ctor:"::",_0:r._0,_1:{ctor:"::",_0:r._1,_1:{ctor:"::",_0:r._2,_1:{ctor:"[]"}}}};default:return{ctor:"::",_0:r._0,_1:{ctor:"::",_0:r._1,_1:{ctor:"::",_0:r._2,_1:{ctor:"::",_0:r._3,_1:{ctor:"[]"}}}}}}},hT=r(function(t,r){return _(ot,function(r){return _(hv,r,t)},r)}),vT=function(t){return _(lT,function(r){return _(hT,t.keys,pT(r))},t.combos)},mT=function(t){return _(no,function(t){return t},Gn(dT(t)))},gT=r(function(t,r){return m.eq(t,r.activeCombo)?{ctor:"[]"}:_(J,{ctor:"[]"},_(W,function(t){return{ctor:"::",_0:mT(t),_1:{ctor:"[]"}}},t))}),yT=function(t){var r=vT(t);return _(qr["!"],m.update(t,{activeCombo:r}),_(gT,r,t))},bT=th,wT=rh,TT=nh,kT=uv,ST=r(function(t,r){return yT(m.update(r,{keys:_(wd,t,r.keys)}))}),xT=function(t){return _(Dr,t.toMsg,gd)},ET=function(t){return{keys:bd,combos:t.combos,toMsg:t.toMsg,activeCombo:H}},AT=(n(function(t,r,e,n){return{keys:t,combos:r,toMsg:e,activeCombo:n}}),o(function(t,r,e,n,o){return{ctor:"KeyCombo4",_0:t,_1:r,_2:e,_3:n,_4:o}})),OT=(r(function(t,r){var e=t;return l(AT,e._0,e._1,e._2,e._3,r)}),n(function(t,r,e,n){return{ctor:"KeyCombo3",_0:t,_1:r,_2:e,_3:n}})),IT=(r(function(t,r){var e=t;return f(OT,e._0,e._1,e._2,r)}),e(function(t,r,e){return{ctor:"KeyCombo2",_0:t,_1:r,_2:e}})),CT=r(function(t,r){var e=t;return s(IT,e._0,e._1,r)}),qT=r(function(t,r){return{ctor:"KeyCombo",_0:t,_1:r}}),NT=(r(function(t,r){return _(qT,t,r)}),r(function(t,e){for(;;){var n=t;if("[]"===n.ctor)return e;var o=n._0,c=function(t){var e=vr(o),n=r(function(r,n){var o=n,c=o._0,u={ctor:"::",_0:s(fr,r,r+e,t),_1:{ctor:"[]"}},i=m.eq(c,r)?{ctor:"[]"}:{ctor:"::",_0:s(fr,c,r,t),_1:{ctor:"[]"}};return{ctor:"_Tuple2",_0:r+e,_1:_(k["++"],o._1,_(k["++"],i,u))}}),c=_(Qt,o,t),u=s(ut,n,{ctor:"_Tuple2",_0:0,_1:{ctor:"[]"}},c),i=xr(u),a=Er(u),f=vr(t),l=m.eq(a,f)?{ctor:"[]"}:{ctor:"::",_0:s(fr,a,f,t),_1:{ctor:"[]"}};return _(k["++"],i,l)},u=s(ut,r(function(t,r){return _(k["++"],r,c(t))}),{ctor:"[]"},e),i=n._1,a=u;t=i,e=a}})),MT=function(t){var r=t;if("[]"===r.ctor)return{ctor:"_Tuple2",_0:0,_1:{ctor:"[]"}};var e=r._0,n=_(kt,function(t){return m.cmp(t,e)<0},r._1),o=MT(Er(n)),c=st(xr(o))?0:1,u=MT(xr(n));return{ctor:"_Tuple2",_0:Er(o)+c+Er(u),_1:_(k["++"],xr(o),_(k["++"],{ctor:"::",_0:e,_1:{ctor:"[]"}},xr(u)))}},jT={ctor:"[]"},DT=n(function(t,r,e,n){return{score:t,offset:r,length:e,keys:n}}),RT=e(function(t,e,n){var o=r(function(t,r){var e=_(Qt,wr(t),n),o=lt(_(ht,function(t){return!_(_t,t,r)},e)),c=o;return"Just"===c.ctor?_(k["++"],r,{ctor:"::",_0:c._0,_1:{ctor:"[]"}}):r}),c=s(hr,o,jT,e),u=MT(c),i=Er(u)*t.movePenalty,a=(vr(n)-it(c))*t.addPenalty,l=(vr(e)-it(c))*t.removePenalty;return f(DT,i+a+l,0,vr(n),xr(u))}),BT=r(function(t,r){return{score:t,matches:r}}),LT=e(function(t,r,e){return{addPenalty:t,movePenalty:r,removePenalty:e}}),PT=s(LT,1,100,1e3),FT=n(function(t,n,o,c){var u=_(BT,0,{ctor:"[]"}),i=e(function(t,n,o){var c=r(function(t,r){return _(k["++"],r,_(It,t-it(r),""))}),u=e(function(t,r,e){return _(At,it(e)-(t-r-1),e)});return s(e(function(t,e,n){return{ctor:"_Tuple2",_0:s(ut,r(function(t,r){return vr(t)+r}),0,_(At,e,n)),_1:_(Y,e,n)}}),t,n,s(u,t,n,_(c,t,o)))}),a=_(NT,n,{ctor:"::",_0:c,_1:{ctor:"[]"}}),l=_(NT,n,{ctor:"::",_0:o,_1:{ctor:"[]"}}),d=r(function(t,r){var e=t;switch(e.ctor){case"AddPenalty":return m.update(r,{addPenalty:e._0});case"RemovePenalty":return m.update(r,{removePenalty:e._0});default:return m.update(r,{movePenalty:e._0})}}),p=s(ut,d,PT,t),h=r(function(t,e){var n=e,o=n._0,u=r(function(r,e){var n=e,o=n._1,c=n._0,u=o+vr(r),i=s(RT,p,t,r);return{ctor:"_Tuple2",_0:m.cmp(i.score,c.score)<0?m.update(i,{offset:o}):c,_1:u}}),i=vr(t)*p.removePenalty+vr(t)*p.movePenalty+vr(c)*p.addPenalty,a=f(DT,i,o,0,{ctor:"[]"});return Er(s(ut,u,{ctor:"_Tuple2",_0:a,_1:o},n._1))}),v=r(function(t,r){var e=r,n=e._0,o=e._1,c=_(h,t,s(i,it(l),o,a));return{ctor:"_Tuple2",_0:m.update(n,{score:c.score+n.score,matches:_(k["++"],n.matches,{ctor:"::",_0:c,_1:{ctor:"[]"}})}),_1:o+1}});return Er(s(ut,v,{ctor:"_Tuple2",_0:u,_1:0},l))}),$T=r(function(t,r){return t+r}),UT=r(function(t,r){return t-r}),JT=(b(UT),r(function(t,r){return!m.eq(t,r)}),r(function(t,r){return m.eq(t,r)})),HT=r(function(t,r){return t&&r}),VT=(r(function(t,r){return t||r}),r(function(t,r){return m.cmp(t,r)<1})),zT=(b(VT),r(function(t,r){return m.cmp(t,r)<0})),WT=(b(zT),r(function(t,r){return m.cmp(t,r)>0}),r(function(t,e){var n=r(function(r,e){return t(r)?e:{ctor:"::",_0:r,_1:e}});return s(ct,n,{ctor:"[]"},e)}),n(function(t,r,e,n){return t(n)?r(n):e(n)})),GT=e(function(t,r,e){return f(WT,t,r,function(t){return e},e)}),KT=function(t){return GT(function(r){return!t(r)})},XT=e(function(t,r,e){return _(pi,r,_(li,t,e))}),QT=(e(function(t,r,e){return _(g,r,_(di,t,e))}),e(function(t,r,e){return _(mi["?="],_(mi["?|>"],t(e),_(mi["#"],r,e)),e)})),YT=(e(function(t,r,e){var n=t;return s(XT,{ctor:"_Tuple3",_0:n._0,_1:n._1,_2:T},r,e)}),e(function(t,r,e){return _(r,t(e),e)}),r(function(t,r){return r(t)})),ZT=r(function(t,r){return _(ot,YT(r),t)}),tk=r(function(t,r){return _(nt,YT(r),t)}),rk=rk||{};rk[">>>>"]=o(function(t,r,e,n,o){return r(s(t,e,n,o))});var rk=rk||{};rk["<<<<"]=b(r(function(t,r){return _(rk[">>>>"],t,r)}));var rk=rk||{};rk[">>>"]=n(function(t,r,e,n){return r(_(t,e,n))});var rk=rk||{};rk["<<<"]=b(r(function(t,r){return _(rk[">>>"],t,r)}));var rk=rk||{};rk[">>?+"]=r(function(t,r){return function(e){return _(V,r,t(e))}});var rk=rk||{};rk[">>?="]=r(function(t,r){return function(e){return _(J,r,t(e))}});var rk=rk||{};rk[">>?"]=r(function(t,r){return function(e){return _(W,r,t(e))}});var rk=rk||{};rk["?>>"]=r(function(t,r){return function(e){return _(W,r,t(e))}});var rk=rk||{};rk[".#|>"]=b(Nt);var rk=rk||{};rk["=>"]=r(function(t,r){return{ctor:"_Tuple2",_0:t,_1:r}});var ek=r(function(t,e){return Oi(s(ut,r(function(t,r){return xi(r)}),e,_(qt,0,t)))}),nk=_(yn,"id",xn),ok=r(function(t,r){return mn({ctor:"::",_0:_(an,function(t){var e=it(r);return _(ok,_(ek,e,nk),{ctor:"::",_0:t,_1:r})},t),_1:{ctor:"::",_0:sn(r),_1:{ctor:"[]"}}})}),ck=_(ok,Oi(nk),{ctor:"[]"}),uk=r(function(t,r){var e=function(t){return sn(r)},n=function(r){return _n(_(k["++"],"domIds not found in event target path: ",S(t)))};return _(an,function(r){return s(K_,e,n,_(M_,_(mi["#"],_t,t),r))},ck)}),ik=(_(rk[">>>"],uk,Ga("click")),r(function(t,r){return _(Ea,t,rn(r))})),ak=(r(function(t,r){return _(Ea,t,on(r))}),{stopPropagation:!0,preventDefault:!0}),_k=function(t){return _(Wa,t,ak)},sk=function(t){return _(_k,"click",sn(t))},fk={stopPropagation:!0,preventDefault:!1},lk=function(t){return _(Wa,t,fk)},dk=function(t){return _(lk,"click",sn(t))},pk=function(t){return _(lk,"mousedown",sn(t))},hk=function(t){return _(Ga,"change",_(vn,t,Va))},vk=(r(function(t,r){return _(Ga,_(k["++"],ns(t),"-changed"),_(vn,r,_(bn,{ctor:"::",_0:"detail",_1:{ctor:"::",_0:"value",_1:{ctor:"[]"}}},xn)))}),e(function(t,r,e){return _(Ga,_(k["++"],ns(t),"-changed"),_(vn,e,_(bn,{ctor:"::",_0:"detail",_1:{ctor:"::",_0:"value",_1:{ctor:"[]"}}},r)))})),mk=r(function(t,r){return _(Ga,_(k["++"],ns(t),"-changed"),_(vn,r,_(bn,{ctor:"::",_0:"detail",_1:{ctor:"::",_0:"value",_1:{ctor:"[]"}}},Sn)))}),gk=(_(Ha,"noLabelFloatP",!0),Sa("selected"),Sa("label"),_(Sa,"slot","dropdown-content")),yk=_(Sa,"slot","dropdown-trigger"),bk=_(Ha,"dynamicAlign",!0),wk=(_(Sa,"secondary","true"),zi("paper-icon-button")),Tk=Sa("icon"),kk=(r(function(t,r){return _(wk,_(k["++"],r,{ctor:"::",_0:Tk(t),_1:{ctor:"[]"}}),{ctor:"[]"})}),Tk("done-all"),zi("iron-icon")),Sk=r(function(t,r){return _(kk,_(k["++"],r,{ctor:"::",_0:Tk(t),_1:{ctor:"[]"}}),{ctor:"[]"})}),xk=e(function(t,r,e){return _(r_,{ctor:"::",_0:Oa("icon-text font-caption"),_1:{ctor:"::",_0:dk(e),_1:{ctor:"[]"}}},{ctor:"::",_0:_(Sk,t,{ctor:"::",_0:Oa("big"),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:Vi(r),_1:{ctor:"[]"}}})}),Ek=_(Ha,"customSw",!0),Ak=r(function(t,r){return m.update(r,{token:t})}),Ok=r(function(t,r){return m.update(r,{connected:t})}),Ik=function(t){return Ze({ctor:"::",_0:_(rk["=>"],"id",on(t.id)),_1:{ctor:"::",_0:_(rk["=>"],"token",_(a_,on,t.token)),_1:{ctor:"::",_0:_(rk["=>"],"connected",rn(t.connected)),_1:{ctor:"[]"}}}})},Ck=(a_(on),function(t){return t.photoURL}),qk=function(t){var r=t;return"NotLoggedIn"===r.ctor?H:z(r._0.id)},Nk=function(t){var r=t;return"NotLoggedIn"===r.ctor?H:lt(r._0.providerData)},Mk=mk("data"),jk=function(t){return mn({ctor:"::",_0:cn(H),_1:{ctor:"::",_0:_(vn,z,t),_1:{ctor:"[]"}}})}(xn),Dk=_(vk,"token",jk),Rk=function(t){return{id:t,connected:!1,token:H}},Bk=Ar.outgoingPort("signIn",function(t){return null}),Lk=Ar.outgoingPort("signOut",function(t){return null}),Pk=Ar.outgoingPort("firebaseRefSet",function(t){return[t._0,t._1]}),Fk=r(function(t,r){return Pk({ctor:"_Tuple2",_0:_(k["++"],"/users/",_(k["++"],r,_(k["++"],"/clients/",t.id))),_1:Ik(t)})}),$k=(Ar.outgoingPort("firebaseRefPush",function(t){return[t._0,t._1]}),Ar.outgoingPort("fireStartSync",function(t){return t})),Uk=$k,Jk=Ar.outgoingPort("firebaseSetupOnDisconnect",function(t){return[t._0,t._1]}),Hk=r(function(t,r){return Jk({ctor:"_Tuple2",_0:r,_1:t.id})}),Vk=Ar.incomingPort("onFirebaseChange",_(an,function(t){return _(an,function(r){return sn({ctor:"_Tuple2",_0:t,_1:r})},_(gn,1,un))},_(gn,0,xn))),zk=function(t){return Vk(g(t))},Wk=r(function(t,r){return{id:t,providerData:r}}),Gk=o(function(t,r,e,n,o){return{displayName:t,email:r,photoURL:e,providerId:n,uid:o}}),Kk=s(Cn,"uid",xn,s(Cn,"providerId",xn,s(Cn,"photoURL",xn,s(Cn,"email",xn,s(Cn,"displayName",xn,sn(Gk)))))),Xk=(e(function(t,r,e){return{id:t,connected:r,token:e}}),function(t){return{ctor:"LoggedIn",_0:t}}),Qk={ctor:"NotLoggedIn"},Yk=mn({ctor:"::",_0:_(vn,Xk,s(Cn,"providerData",wn(Kk),s(Cn,"uid",xn,sn(Wk)))),_1:{ctor:"::",_0:sn(Qk),_1:{ctor:"[]"}}}),Zk=_(vk,"user",Yk),tS=function(t){return m.update(t,{deleted:!t.deleted})},rS=r(function(t,r){return m.update(r,{deviceId:t})}),eS=r(function(t,r){return m.update(r,{modifiedAt:t})}),nS=(r(function(t,r){return m.update(r,{deleted:t})}),function(t){return t.modifiedAt}),oS=function(t){return t.deleted},cS=function(t){return!oS(t)},uS=function(t){return{ctor:"::",_0:_(rk["=>"],"_id",on(t.id)),_1:{ctor:"::",_0:_(rk["=>"],"_rev",on(t.rev)),_1:{ctor:"::",_0:_(rk["=>"],"createdAt",nn(I(t.createdAt))),_1:{ctor:"::",_0:_(rk["=>"],"modifiedAt",nn(I(t.modifiedAt))),_1:{ctor:"::",_0:_(rk["=>"],"deleted",rn(t.deleted)),_1:{ctor:"::",_0:_(rk["=>"],"deviceId",on(t.deviceId)),_1:{ctor:"[]"}}}}}}}},iS=r(function(t,r){return Ze(_(k["++"],uS(r),t(r)))}),aS=function(t){return f(In,"deviceId",xn,"",f(In,"deleted",Sn,!1,f(In,"modifiedAt",Tn,0,f(In,"createdAt",Tn,0,f(In,"_rev",xn,"",s(Cn,"_id",xn,t))))))},_S=function(t){return t.id},sS=function(t){return function(r){return _(JT,t,_S(r))}},fS=r(function(t,r){return m.eq(_S(t),_S(r))}),lS=(c(function(t,r,e,n,o,c){return{id:t,rev:r,deleted:e,createdAt:n,modifiedAt:o,deviceId:c}}),r(function(t,r){return _(an,function(e){var n=_(fn,r,e);return"Ok"===n.ctor?sn(n._0):_n(_(U,t,n._0))},un)})),dS=(hv(zp),hv(Ed),hv(ov),hv(cv),hv(uv),wd),pS=function(t){return _(Dr,t,gd)},hS=bd,vS=function(t){return Js(function(r){return t(mv(r))})},mS=r(function(t,r){return _(an,function(e){_(U,"actualKey, expectedKey",{ctor:"_Tuple2",_0:e,_1:t});return m.eq(t,e)?sn(r):_n("Not intrested")},gv)}),gS=function(t){return _(Ga,"keyup",_(mS,iv,t))},yS=function(t){return t.isShiftDown||t.isMetaDown||t.isControlDown||t.isAltDown},bS=function(t){return!yS(t)},wS=_(vn,mv,_(yn,"keyCode",kn)),TS=c(function(t,r,e,n,o,c){return{key:t,isShiftDown:r,isMetaDown:e,isControlDown:n,isAltDown:o,keyString:c}}),kS=s(Cn,"key",xn,s(Cn,"altKey",Sn,s(Cn,"ctrlKey",Sn,s(Cn,"metaKey",Sn,s(Cn,"shiftKey",Sn,_(An,wS,sn(TS))))))),SS=function(t){return _(Ga,"keydown",_(vn,t,_(lS,"kd",kS)))},xS=function(t){return _(lk,"keydown",_(vn,t,_(lS,"kd",kS)))},ES=(b(r(function(t,r){return{ctor:"::",_0:t,_1:r}})),b(H_)),AS=function(t){return"[]"===t.ctor?0:it(t)-1},OS=function(t){return _(mi["#"],function(t){return _(j,0,AS(t))},t)},IS=b(OS),CS=function(t){return!0},qS=function(t){return function(r){return _(ot,T,_(fi,t,r))}},NS=e(function(t,r,e){return _(t._0.set,r,e)}),MS=e(function(t,r,e){return s(NS,r,e,t)}),jS=e(function(t,r,e){return _(mi["?="],_(mi["?|>"],r,_(MS,e,t)),e)}),DS=e(function(t,r,e){return s(jS,r,e,t)}),RS=r(function(t,r){return t._0.get(r)}),BS=e(function(t,r,e){return s(MS,e,t,r(_(RS,t,e)))}),LS=e(function(t,r,e){return _(mi["?="],_(mi["?|>"],r(_(RS,t,e)),_(MS,e,t)),e)}),PS=e(function(t,r,e){return _(kr,_(MS,e,t),r(_(RS,t,e)))}),FS=e(function(t,r,e){return _(mi["?|>"],r(_(RS,t,e)),kr(_(MS,e,t)))}),$S=e(function(t,r,e){return _(Sr,_(MS,e,t),r(_(RS,t,e)))}),US=r(function(t,r){return s(BS,t,C,r)}),JS=(r(function(t,r){return{get:t,set:r}}),function(t){return{ctor:"Field",_0:t}}),HS=r(function(t,r){return JS({get:t,set:r})}),VS=r(function(t,r){return JS({get:t,set:r})}),zS=r(function(t,r){t(r);return r}),WS=r(function(t,r){return zS(function(e){return _(U,r,t(e))})}),GS=function(t){return _(ed,t,dd)},KS=function(t){return ad(I(t))},XS=_(ed,function(t){return Ht(t+48)},_(_d,0,9)),QS=_(ed,function(t){return Ht(t+65)},_(_d,0,25)),YS=_(ed,function(t){return Ht(t+97)},_(_d,0,25)),ZS=ld({ctor:"::",_0:{ctor:"_Tuple2",_0:26,_1:YS},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:26,_1:QS},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:10,_1:XS},_1:{ctor:"[]"}}}}),tx=_(ed,Wt,_(td,64,ZS)),rx=function(t){return _(ed,t,tx)},ex=r(function(t,r){return m.update(r,{dict:t})}),nx=(b(ex),r(function(t,r){return m.update(r,{seed:t})})),ox=(r(function(t,r){return _(nx,t(r),r)}),function(t){return t.seed}),cx=r(function(t,r){return _(kr,_(mi["#"],nx,r),_(Ql,t,ox(r)))}),ux=r(function(t,r){return Mt(_(Ft,U(_(k["++"],"Store ",r.name)),_(fn,r.decoder,t)))}),ix=e(function(t,r,e){return function(n){return _(rS,e.deviceId,_(eS,r,t(n)))}}),ax=function(t){return _(Je,_S(t),t)},_x=b(ax),sx=(r(function(t,r){return _(iS,r.otherFieldsEncoder,t)}),_(HS,function(t){return t.dict},r(function(t,r){return m.update(r,{dict:t})}))),fx=n(function(t,n,o,c){var u=s(ix,o,n,c),i=e(function(t,r,e){var n=e,o=u(r);return{ctor:"_Tuple2",_0:{ctor:"::",_0:{ctor:"_Tuple2",_0:r,_1:o},_1:n._0},_1:_(_x,n._1,o)}});return s(PS,sx,function(e){return s(ie,i,{ctor:"_Tuple2",_0:{ctor:"[]"},_1:e},_(ze,r(function(r,e){return t(e)}),e))},c)}),lx=function(t){return _(BS,sx,_(Je,_S(t),t))},dx=r(function(t,r){return _(mi["?|>"],_(ux,t,r),function(t){return{ctor:"_Tuple2",_0:t,_1:_(lx,t,r)}})}),px=r(function(t,r){return function(t){var r=t,e=r._0;return{ctor:"_Tuple2",_0:e,_1:_(lx,e,r._1)}}(_(mi["#"],cx,r)(rx(t(r.deviceId))))}),hx=function(t){return function(e){return ce(_(ze,r(function(r,e){return t(e)}),_(RS,sx,e)))}},vx=function(t){return function(r){return _(M_,t,ce(_(RS,sx,r)))}},mx=function(t){return function(r){return _(le,t,_(RS,sx,r))}},gx=(r(function(t,r){var e=_(lx,t,r),n=function(t){return r},o=_S(t);return _(mi["?="],_(mi["?|>"],_(mx,o,r),n),e)}),function(t){return Ee(_(RS,sx,t))}),yx=RS(sx),bx=function(t){return function(r){return _(mt,function(t){var r=t;if("Ok"===r.ctor)return z(r._0);_(U,"Error while decoding Project",r._0);return H},_(pt,fn(t),r))}},wx=o(function(t,r,e,n,o){return GS(function(c){return{seed:c,dict:Ke(_(mi[".|>"],_(bx,e,o),di({ctor:"_Tuple2",_0:_S,_1:T}))),name:t,otherFieldsEncoder:r,decoder:e,deviceId:n}})}),Tx=Ar.outgoingPort("pouchDBUpsert",function(t){return[t._0,t._1,t._2]}),kx=r(function(t,r){return Tx({ctor:"_Tuple3",_0:t.name,_1:r.id,_2:_(iS,t.otherFieldsEncoder,r)})}),Sx=n(function(t,r,e,n){return _(Kr,function(t){return Ir(_(pt,function(t){return _(kx,n,xr(t))},t))},f(fx,t,r,e,n))}),xx=r(function(t,r){return _(mi["?="],_(mi["?|>"],_(ux,t,r),kx(r)),Cr)}),Ex=Ar.incomingPort("pouchDBChanges",_(an,function(t){return _(an,function(r){return sn({ctor:"_Tuple2",_0:t,_1:r})},_(gn,1,un))},_(gn,0,xn))),Ax=function(t){return Ex(g(t))},Ox=(c(function(t,r,e,n,o,c){return{seed:t,dict:r,otherFieldsEncoder:e,decoder:n,name:o,deviceId:c}}),function(t){return t.archived}),Ix=function(t){return!Ox(t)},Cx=qS({ctor:"::",_0:cS,_1:{ctor:"::",_0:Ix,_1:{ctor:"[]"}}}),qx=qS({ctor:"::",_0:cS,_1:{ctor:"::",_0:Ox,_1:{ctor:"[]"}}}),Nx=function(t){return t.name},Mx=function(t){var r=function(t){return _(g,M,_(Wr,function(t){return R(nS(t))},t))},e=function(t){return _(g,M,_(Wr,Nx,t))};return function(n){var o=n;return!0===o._0?!1===o._1?F:r(t):!0===o._1?L:e(t)}(_(Wr,Ox,t))},jx=function(t){return X(r(function(r,e){var n={ctor:"_Tuple2",_0:t(r),_1:t(e)};return!0===n._0?!1===n._1?F:P:!0===n._1?L:Mx({ctor:"_Tuple2",_0:r,_1:e})}))},Dx=function(t){return{ctor:"::",_0:_(rk["=>"],"name",on(t.name)),_1:{ctor:"::",_0:_(rk["=>"],"archived",rn(t.archived)),_1:{ctor:"[]"}}}},Rx=i(function(t,r,e,n,o,c,u,i){return{id:t,rev:r,deviceId:c,createdAt:e,modifiedAt:n,deleted:!1,archived:!!o||i,name:u}}),Bx=f(In,"archived",Sn,!1,s(Cn,"name",xn,aS(En(Rx)))),Lx=function(t){return s(wx,t,Dx,Bx)},Px=_(VS,function(t){return t.archived},r(function(t,r){return m.update(r,{archived:t})})),Fx=US(Px),$x=(r(function(t,r){return{name:t,archived:r}}),JT(""),Rx),Ux=n(function(t,r,e,n){return h($x,n,"",r,r,!1,e,t,!1)}),Jx=h($x,"","",0,0,!1,"","No Project",!1),Hx=function(t){return _(ht,t,{ctor:"::",_0:Jx,_1:{ctor:"[]"}})},Vx=JT(Jx),zx=jx(Vx),Wx=r(function(t,r){return m.update(r,{name:t})}),Gx=function(t){return t.name},Kx=Lx("project-db"),Xx=Lx("context-db"),Qx=r(function(t,r){return m.update(r,{name:t})}),Yx=function(t){return t.name},Zx=(JT(""),Rx),tE=n(function(t,r,e,n){return h(Zx,n,"",r,r,!1,e,t,!1)}),rE=h(Zx,"","",0,0,!1,"","Inbox",!1),eE=function(t){return _(ht,t,{ctor:"::",_0:rE,_1:{ctor:"[]"}})},nE=JT(rE),oE=jx(nE),cE=function(t){var r=t;switch(r.ctor){case"NoReminder":return H;case"WithReminder":return z(r._1);default:return H}},uE=(r(function(t,r){return!m.eq(cE(t),cE(r))}),function(t){var r=t;switch(r.ctor){case"NoReminder":case"WithReminder":return z(r._0);default:return H}}),iE=function(t){var r=function(t){return _(rk["=>"],"dueAt",en(t))},e=function(){var e=t;switch(e.ctor){case"NoReminder":return{ctor:"::",_0:r(e._0),_1:{ctor:"[]"}};case"WithReminder":return{ctor:"::",_0:r(e._0),_1:{ctor:"::",_0:_(rk["=>"],"reminderAt",en(e._1)),_1:{ctor:"[]"}}};default:return{ctor:"[]"}}}();return Ze(e)},aE={ctor:"Unscheduled"},_E=aE,sE=r(function(t,r){return{ctor:"WithReminder",_0:t,_1:r}}),fE=function(t){return _(sE,t,t)},lE=function(t){return _(mi["?="],_(mi["?|>"],t,fE),_E)},dE=r(function(t,r){return _(sE,t,r)}),pE=r(function(t,r){var e=r;switch(e.ctor){case"NoReminder":case"WithReminder":return _(sE,e._0,t);default:return r}}),hE=function(t){return pE(t+9e5)},vE=function(t){return{ctor:"NoReminder",_0:t}},mE=function(t){return vE(t)},gE=function(){return _(an,function(t){return mn({ctor:"::",_0:_(an,function(r){return sn(_(dE,t,r))},_(bn,{ctor:"::",_0:"schedule",_1:{ctor:"::",_0:"reminderAt",_1:{ctor:"[]"}}},Tn)),_1:{ctor:"::",_0:sn(mE(t)),_1:{ctor:"[]"}}})},_(bn,{ctor:"::",_0:"schedule",_1:{ctor:"::",_0:"dueAt",_1:{ctor:"[]"}}},Tn))}(),yE=function(){return _(an,function(t){return mn({ctor:"::",_0:_(an,function(r){return sn(_(dE,t,r))},_(bn,{ctor:"::",_0:"reminder",_1:{ctor:"::",_0:"at",_1:{ctor:"[]"}}},Tn)),_1:{ctor:"::",_0:sn(mE(t)),_1:{ctor:"[]"}}})},_(yn,"dueAt",Tn))}(),bE=mn({ctor:"::",_0:gE,_1:{ctor:"::",_0:yE,_1:{ctor:"::",_0:sn(_E),_1:{ctor:"[]"}}}}),wE=function(t){var r=t;switch(r.ctor){case"WithReminder":return vE(r._0);case"NoReminder":default:return t}},TE=function(t){return function(r){return _(ot,T,_(fi,t,r))}},kE=function(t){return t.contextId},SE=function(t){return function(r){return _(JT,_S(t),kE(r))}},xE=function(t){return t.done},EE=function(t){return t.text},AE=function(t){return{ctor:"::",_0:_(rk["=>"],"done",rn(xE(t))),_1:{ctor:"::",_0:_(rk["=>"],"text",on(EE(t))),_1:{ctor:"::",_0:_(rk["=>"],"projectId",on(t.projectId)),_1:{ctor:"::",_0:_(rk["=>"],"contextId",on(t.contextId)),_1:{ctor:"::",_0:_(rk["=>"],"schedule",iE(t.schedule)),_1:{ctor:"[]"}}}}}}},OE=function(t){return function(r){return function(e){return function(n){return function(o){return function(c){return function(u){return function(i){return function(a){return function(_){return function(s){return{id:t,rev:r,createdAt:e,modifiedAt:n,deviceId:c,deleted:o,done:u,text:i,schedule:a,projectId:_,contextId:s}}}}}}}}}}}},IE=function(t){return f(In,"contextId",xn,"",f(In,"projectId",xn,"",_(An,bE,s(Cn,"text",xn,f(In,"done",Sn,!1,t)))))}(aS(En(OE))),CE=n(function(t,r,e,n){return OE(n)("")(t)(t)(!1)(e)(!1)(r)(_E)("")("")}),qE=_(HS,function(t){return t.deleted},r(function(t,r){return m.update(r,{deleted:t})})),NE=_(HS,function(t){return t.contextId},r(function(t,r){return m.update(r,{contextId:t})})),ME=_(HS,function(t){return t.projectId},r(function(t,r){return m.update(r,{projectId:t})})),jE=_(HS,function(t){return t.schedule},r(function(t,r){return m.update(r,{schedule:t})})),DE=r(function(t,r){return s(BS,jE,t,r)}),RE=_(HS,function(t){return t.text},r(function(t,r){return m.update(r,{text:t})})),BE=_(HS,function(t){return t.done},r(function(t,r){return m.update(r,{done:t})})),LE=function(t){return t.modifiedAt},PE=function(t){return t.createdAt},FE=function(t){return t.projectId},$E=function(t){return function(r){return _(JT,_S(t),FE(r))}},UE=function(t){return t.deleted},JE=UE,HE=tk({ctor:"::",_0:JE,_1:{ctor:"::",_0:xE,_1:{ctor:"[]"}}}),VE=function(t){return!HE(t)},zE=function(t){return!UE(t)},WE=(TE({ctor:"::",_0:zE,_1:{ctor:"::",_0:xE,_1:{ctor:"[]"}}}),TE({ctor:"::",_0:UE,_1:{ctor:"[]"}}),function(t){return cE(function(t){return t.schedule}(t))}),GE=r(function(t,r){return!!VE(r)&&function(r){return s(X_,!1,function(r){return m.cmp(r,t)<1},WE(r))}(r)}),KE=function(t){return uE(function(t){return t.schedule}(t))},XE=function(t){return _(W_,KE(t),WE(t))},QE=(o(function(t,r,e,n,o){return{done:t,text:r,schedule:e,projectId:n,contextId:o}}),function(t){return{ctor:"AutoSnooze",_0:t}}),YE=function(t){return{ctor:"SnoozeTill",_0:t}},ZE={ctor:"TurnReminderOff"},tA={ctor:"ToggleDeleted"},rA={ctor:"ToggleDone"},eA=function(t){return{ctor:"SetProject",_0:t}},nA=function(t){return{ctor:"CopyProjectAndContextId",_0:t}},oA=function(t){return{ctor:"SetProjectId",_0:t}},cA=function(t){return{ctor:"SetContext",_0:t}},uA=function(t){return{ctor:"SetScheduleFromMaybeTime",_0:t}},iA=function(t){return{ctor:"SetContextId",_0:t}},aA=function(t){var r=t;switch(r.ctor){case"SetText":return _(NS,RE,r._0);case"SetContextId":return _(NS,NE,r._0);case"SetProjectId":return _(NS,ME,r._0);case"SetSchedule":return _(NS,jE,r._0);case"CopyProjectAndContextId":var e=r._0;return function(t){return _(aA,oA(e.projectId),_(aA,iA(e.contextId),t))};case"SetProject":return _(NS,ME,_S(r._0));case"SetContext":return _(NS,NE,_S(r._0));case"ToggleDone":return _(BS,BE,C);case"MarkDone":return _(NS,BE,!0);case"ToggleDeleted":return _(BS,qE,C);case"SetScheduleFromMaybeTime":return _(NS,jE,lE(r._0));case"TurnReminderOff":return DE(wE);case"SnoozeTill":return DE(pE(r._0));default:return DE(hE(r._0))}},_A=function(t){return{ctor:"SetText",_0:t}},sA={ctor:"MarkDone"},fA=(r(function(t,r){return{onMouseDown:t,children:r}}),function(t){return{ctor:"_Tuple2",_0:t.key,_1:_(ca,{ctor:"::",_0:Qa(t.onClick),_1:{ctor:"::",_0:xa(t.tabIndexValue),_1:{ctor:"::",_0:xS(t.onKeyDown),_1:{ctor:"::",_0:$a({ctor:"::",_0:_(rk["=>"],"auto-focus",t.isFocused),_1:{ctor:"::",_0:_(rk["=>"],"collection-item",!0),_1:{ctor:"::",_0:_(rk["=>"],"active",t.isSelected),_1:{ctor:"[]"}}}}),_1:{ctor:"[]"}}}}},{ctor:"::",_0:t.view,_1:{ctor:"[]"}})}}),lA=function(t){return t?0:-1},dA=e(function(t,r,e){return{key:t.itemKey(e),isSelected:t.isSelectedAt(r),isFocused:t.isFocusedAt(r),tabIndexValue:t.tabIndexValueAt(r),onClick:t.onSelect(e),view:t.itemView(e),onKeyDown:t.onKeyDownAt(r)}}),pA=function(t){return function(r){return _(g,bt,zr(_(m_,t,r)))}},hA=r(function(t,r){return m.update(r,{maybeFocusKey:z(t)})}),vA=b(hA),mA=e(function(t,r,e){var n=function(t){return _(mi["?="],_(mi["?|>"],t,function(t){return e.onStateChanged(_(vA,r,e.itemKey(t)))}),e.noOp)},o=function(){var n=function(r){return _(N_,function(t){return _(JT,r,e.itemKey(t))},t)};return _(mi["?+>"],r.maybeFocusKey,_(rk[">>?"],n,IS(t)))}(),c=IS(t),u=_(mi["?|>"],_(N_,e.isSelected,t),c),i=_(mi["?="],_(W_,u,o),0),a=function(r){var o=function(){var t=wr(r),n=tr;return function(r){return _(Zt,n(t),n(e.itemSearchText(r)))}}();return n(_(M_,o,_(pA,i+1,t)))},s=JT(i),f=function(r){var o=r,u=function(r){return n(_(mi["#"],H_,t)(c(i+r)))};switch(o.key.ctor){case"Enter":return _(mi["?="],_(mi["?|>"],_(H_,i,t),e.onSelect),e.noOp);case"ArrowUp":return u(-1);case"ArrowDown":return u(1);default:var s=Gt(o.keyString);return"::"===s.ctor&&"[]"===s._1.ctor?a(s._0):e.noOp}},l=function(t){return s(t)?f:function(t){return e.noOp}};return{isFocusedAt:s,isSelectedAt:_(mi["?="],_(mi["?|>"],u,JT),function(t){return!1}),tabIndexValueAt:function(t){return lA(s(t))},onKeyDownAt:l,onSelect:e.onSelect,itemView:e.itemView,itemKey:e.itemKey}}),gA=e(function(t,r,e){var n=s(mA,t,r,e),o=_(rk[".#|>"],t,_(rk[">>>"],dA(n),fA));return _(ua,{ctor:"::",_0:Oa("overlay"),_1:{ctor:"::",_0:dk(e.onOutsideMouseDown),_1:{ctor:"::",_0:xS(function(t){return e.noOp}),_1:{ctor:"[]"}}}},{ctor:"::",_0:s(ms,"ul",{ctor:"::",_0:Ia("popup-menu"),_1:{ctor:"::",_0:Oa("collection z-depth-4"),_1:{ctor:"::",_0:_(Sa,"data-prevent-default-keys","Tab"),_1:{ctor:"[]"}}}},o),_1:{ctor:"[]"}})}),yA={maybeFocusKey:H},bA=(i(function(t,r,e,n,o,c,u,i){return{onSelect:t,itemKey:r,itemSearchText:e,itemView:n,isSelected:o,onStateChanged:c,noOp:u,onOutsideMouseDown:i}}),u(function(t,r,e,n,o,c,u){return{isFocusedAt:t,isSelectedAt:r,tabIndexValueAt:e,onKeyDownAt:n,onSelect:o,itemView:c,itemKey:u}}),u(function(t,r,e,n,o,c,u){return{key:t,isFocused:r,tabIndexValue:e,isSelected:n,onClick:o,onKeyDown:c,view:u}}),{menuState:yA,searchText:""}),wA=(r(function(t,r){return{menuState:t,searchText:r}}),_(VS,function(t){return t.showArchived},r(function(t,r){return m.update(r,{showArchived:t})}))),TA=US(wA),kA=function(t){return _(NS,wA,t)},SA=function(t){return _(BS,t,kA(!1))},xA=_(VS,function(t){return t.expanded},r(function(t,r){return m.update(r,{expanded:t})})),EA=US(xA),AA=_(HS,function(t){return t.projects},r(function(t,r){return m.update(r,{projects:t})})),OA=function(t){return _(RS,xA,_(RS,AA,t))},IA=function(t){return s(KT,OA,SA(AA),s(BS,AA,EA,t))},CA=function(t){return _(RS,wA,_(RS,AA,t))},qA=_(BS,AA,TA),NA=_(HS,function(t){return t.contexts},r(function(t,r){return m.update(r,{contexts:t})})),MA=function(t){return _(RS,xA,_(RS,NA,t))},jA=function(t){return s(KT,MA,SA(NA),s(BS,NA,EA,t))},DA=function(t){return _(RS,wA,_(RS,NA,t))},RA=_(BS,NA,TA),BA={expanded:!0,showArchived:!1},LA={contexts:BA,projects:BA},PA=function(t){return Ze({ctor:"::",_0:_(rk["=>"],"expanded",rn(t.expanded)),_1:{ctor:"::",_0:_(rk["=>"],"showArchived",rn(t.showArchived)),_1:{ctor:"[]"}}})},FA=function(t){return Ze({ctor:"::",_0:_(rk["=>"],"contexts",PA(t.contexts)),_1:{ctor:"::",_0:_(rk["=>"],"projects",PA(t.projects)),_1:{ctor:"[]"}}})},$A=r(function(t,r){return{expanded:t,showArchived:r}}),UA=f(In,"showArchived",Sn,!1,s(Cn,"expanded",Sn,sn($A))),JA=r(function(t,r){return{contexts:t,projects:r}}),HA=s(Cn,"projects",UA,s(Cn,"contexts",UA,sn(JA))),VA={ctor:"OnToggleShowArchivedProjects"},zA={ctor:"OnToggleShowArchivedContexts"},WA={ctor:"OnToggleExpandContextList"},GA={ctor:"OnToggleExpandProjectList"},KA=Ar.outgoingPort("focusInput",function(t){return t}),XA=function(t){return Pr(KA(t))}(".auto-focus"),QA=Ar.outgoingPort("focusSelector",function(t){return t}),YA=Ar.outgoingPort("focusSelectorIfNoFocus",function(t){return t}),ZA=function(t){return Pr(YA(t))},tO=Ar.outgoingPort("positionPopupMenu",function(t){return t}),rO=(e(function(t,r,e){return{noOp:t,focus:r,logString:e}}),function(t){return{ctor:"LogString",_0:t}}),eO=function(t){return{ctor:"Focus",_0:t}},nO={ctor:"NoOp"},oO=function(t){t:for(;;){var r=t;switch(r.ctor){case"NoOp":return Pr(Cr);case"Focus":return Pr(QA(r._0));default:var e=(_(U,"CM:LogString",r._0),nO);t=e;continue t}}},cO=function(t){var r=t;switch(r.ctor){case"ContextsView":return{ctor:"::",_0:"lists",_1:{ctor:"::",_0:"contexts",_1:{ctor:"[]"}}};case"ProjectsView":return{ctor:"::",_0:"lists",_1:{ctor:"::",_0:"projects",_1:{ctor:"[]"}}};case"ProjectView":var e=r._0;return Tr(e)?{ctor:"::",_0:"project",_1:{ctor:"::",_0:"NotAssigned",_1:{ctor:"[]"}}}:{ctor:"::",_0:"project",_1:{ctor:"::",_0:e,_1:{ctor:"[]"}}};case"ContextView":var n=r._0;return Tr(n)?{ctor:"::",_0:"Inbox",_1:{ctor:"[]"}}:{ctor:"::",_0:"context",_1:{ctor:"::",_0:n,_1:{ctor:"[]"}}};case"BinView":return{ctor:"::",_0:"bin",_1:{ctor:"[]"}};case"DoneView":return{ctor:"::",_0:"done",_1:{ctor:"[]"}};default:return{ctor:"::",_0:"recent",_1:{ctor:"[]"}}}},uO=r(function(t,r){var e=fS,n={ctor:"_Tuple2",_0:t,_1:r};t:do{if("_Tuple2"===n.ctor){if("Group"===n._0.ctor){if("Group"===n._1.ctor){var o={ctor:"_Tuple2",_0:n._0._0,_1:n._1._0};r:do{if("_Tuple2"===o.ctor){if("Project"===o._0.ctor){if("Project"===o._1.ctor)return _(e,o._0._0,o._1._0);break r}if("Context"===o._1.ctor)return _(e,o._0._0,o._1._0);break r}break r}while(!1);return!1}break t}if("Task"===n._1.ctor)return _(e,n._0._0,n._1._0);break t}break t}while(!1);return!1}),iO=e(function(t,r,e){return _(W_,lt(r),_(ES,r,_(IS,r,_($T,t,_(mi["?="],_(N_,uO(e),r),0)))))}),aO=function(t){var r=t;if("Task"===r.ctor)return _S(r._0);var e=r._0;return _S("Project"===e.ctor?e._0:e._0)},_O=function(t){return{ctor:"Context",_0:t}},sO=_O,fO=function(t){return{ctor:"Project",_0:t}},lO=fO,dO=function(t){return{ctor:"Task",_0:t}},pO=dO,hO=function(t){return{ctor:"Group",_0:t}},vO=function(t){return hO(_O(t))},mO=function(t){return hO(fO(t))},gO={ctor:"RecentView"},yO={ctor:"DoneView"},bO={ctor:"BinView"},wO=function(t){return{ctor:"ProjectView",_0:t}},TO={ctor:"ProjectsView"},kO=function(t){return{ctor:"ContextView",_0:t}},SO={ctor:"ContextsView"},xO=SO,EO=function(t){var r=xw(t);t:do{if("::"!==r.ctor)break t;if("[]"===r._1.ctor)switch(r._0){case"bin":return z(bO);case"done":return z(yO);case"recent":return z(gO);case"Inbox":return z(kO(""));default:break t}else{if("[]"!==r._1._1.ctor)break t;switch(r._0){case"lists":switch(r._1._0){case"contexts":return z(SO);case"projects":return z(TO);default:break t}case"context":return z(kO(r._1._0));case"project":return z("NotAssigned"===r._1._0?wO(""):wO(r._1._0));default:break t}}}while(!1);return H},AO=r(function(t,r){var e=wO(FE(t)),n=kO(kE(t));switch(r.ctor){case"ProjectsView":case"ProjectView":return n;case"ContextsView":case"ContextView":return e;case"BinView":case"DoneView":default:return SO}}),OO=r(function(t,r){var e=r;if("Group"===e.ctor){var n=e._0;return"Context"===n.ctor?kO(_S(n._0)):wO(_S(n._0))}var o=e._0;return _(mi["?="],_(mi["?|>"],t,AO(o)),kO(kE(o)))}),IO={ctor:"Goto"},CO={ctor:"ToggleSelected"},qO={ctor:"OnFocusIn"},NO=function(t){return{ctor:"NameChanged",_0:t}},MO={ctor:"Save"},jO={ctor:"ToggleArchived"},DO={ctor:"ToggleDeleted"},RO={ctor:"StartEditing"},BO=r(function(t,r){return{project:r,todoList:t(r),groupEntity:lO(r)}}),LO=r(function(t,r){var e=function(t){return _(ht,$E(t),r.todoList)},n=zx(_(mt,T,_(mi[".|>"],B_(_(mi[".|>"],r.todoList,FE)),t)));return _(mi[".|>"],n,BO(e))}),PO=r(function(t,r){return{context:r,todoList:t(r),groupEntity:sO(r)}}),FO=r(function(t,r){var e=function(t){return _(ht,SE(t),r.todoList)},n=oE(_(mt,T,_(mi[".|>"],B_(_(mi[".|>"],r.todoList,kE)),t)));return _(mi[".|>"],n,PO(e))}),$O=(e(function(t,r,e){return{context:t,todoList:r,groupEntity:e}}),e(function(t,r,e){return{project:t,todoList:r,groupEntity:e}}),r(function(t,r){return{ctor:"TodoForest",_0:t,_1:r}})),UO=$O,JO=function(t){return{ctor:"ProjectForest",_0:t}},HO=r(function(t,r){return JO(_(mi[".|>"],r,BO(t)))}),VO=function(t){return{ctor:"ContextForest",_0:t}},zO=r(function(t,r){return VO(_(mi[".|>"],r,PO(t)))}),WO=function(t){var r=t;switch(r.ctor){case"ContextRoot":return{ctor:"::",_0:vO(r._0.context),_1:WO(JO(r._1))};case"ProjectRoot":return{ctor:"::",_0:mO(r._0.project),_1:WO(VO(r._1))};case"ContextForest":return _(Tt,function(t){return{ctor:"::",_0:vO(t.context),_1:_(mi[".|>"],t.todoList,dO)}},r._0);case"ProjectForest":return _(Tt,function(t){return{ctor:"::",_0:mO(t.project),_1:_(mi[".|>"],t.todoList,dO)}},r._0);default:return _(mi[".|>"],r._1,dO)}},GO=r(function(t,r){return{ctor:"ProjectRoot",_0:t,_1:r}}),KO=e(function(t,r,e){return function(t){return _(GO,t,_(FO,r,t))}(_(BO,t,e))}),XO=r(function(t,r){return{ctor:"ContextRoot",_0:t,_1:r}}),QO=e(function(t,r,e){return function(t){return _(XO,t,_(LO,r,t))}(_(PO,t,e))}),YO=r(function(t,r){return m.update(r,{name:t})}),ZO=e(function(t,r,e){return{id:_S(e),name:Nx(e),entity:t(e),isArchived:Ox(e),nameLabel:r}}),tI=_(ZO,vO,"Context Name"),rI=_(ZO,mO,"Project Name"),eI=(o(function(t,r,e,n,o){return{id:t,name:r,entity:e,isArchived:n,nameLabel:o}}),r(function(t,r){return m.update(r,{fields:t})})),nI=(r(function(t,r){return _(eI,t(r),r)}),function(t){return t.fields}),oI=r(function(t,r){return _(eI,t(nI(r)),r)}),cI=(r(function(t,r){return oI(_(Je,t,r))}),e(function(t,r,e){return function(t){return m.update(t,{updatedAt:e})}(m.update(r,{input:t}))})),uI=e(function(t,r,e){var n=(m.cmp(t-e.updatedAt,1e3)>0?s(Nc,Bc(1),Dc(_(k["++"],"^",Rc(e.input))),function(t){return""}):T)(r);return s(cI,n,e,t)}),iI=function(t){return{input:"",updatedAt:t}},aI=(r(function(t,r){return{input:t,updatedAt:r}}),r(function(t,r){return m.update(r,{menuState:t})}),function(t){return{taskId:t,menuState:yA}}),_I=(r(function(t,r){return{taskId:t,menuState:r}}),r(function(t,r){return m.update(r,{text:t})})),sI=function(t){return t.text},fI=r(function(t,r){return{text:r,referenceEntity:t}}),lI=(r(function(t,r){return{text:t,referenceEntity:r}}),r(function(t,r){return m.update(r,{menuState:t})})),dI=function(t){return{todo:t,menuState:yA}},pI=(r(function(t,r){return{todo:t,menuState:r}}),r(function(t,r){var e=t;return m.update(r,{todoText:e._0})})),hI=function(t){return{id:_S(t),todoText:EE(t),entity:dO(t)}},vI=(e(function(t,r,e){return{id:t,todoText:r,entity:e}}),function(t){return{ctor:"SetText",_0:t}}),mI=function(t){var r=t,e=_(k["++"],r.date,_(k["++"]," ",r.time));return _(mi["!="],_(mi["!|>"],Co(e),function(t){return z(Io(t))}),H)},gI=r(function(t,r){var e=t;switch(e.ctor){case"SetDate":return m.update(r,{date:e._0});case"SetTime":return m.update(r,{time:e._0});default:return m.update(r,{menuState:e._0})}}),yI=r(function(t,r){var e=_(mi["?="],WE(t),r+36e5);return{id:_S(t),date:_(Wl,"%Y-%m-%d",e),time:_(Wl,"%H:%M",e),menuState:yA}}),bI=(n(function(t,r,e,n){return{id:t,date:r,time:e,menuState:n}}),function(t){return{ctor:"SetTime",_0:t}}),wI=function(t){return{ctor:"SetDate",_0:t}},TI={ctor:"None"},kI=TI,SI={ctor:"FirstVisit"},xI=SI,EI=function(t){return{ctor:"EditSyncSettings",_0:t}},AI=(function(t){}(bA),function(t){return{ctor:"LaunchBar",_0:t}}),OI=function(t){return{ctor:"EditTodoProject",_0:t}},II=function(t){return{ctor:"EditTodoContext",_0:t}},CI=function(t){return{ctor:"EditTodoReminder",_0:t}},qI=function(t){return{ctor:"TaskMoreMenu",_0:t}},NI=function(t){return qI(aI(t))},MI=function(t){return{ctor:"EditProject",_0:t}},jI=function(t){return MI(rI(t))},DI=_(rk[">>>"],YO,MI),RI=function(t){return{ctor:"EditContext",_0:t}},BI=function(t){return RI(tI(t))},LI=_(rk[">>>"],YO,RI),PI=function(t){return{ctor:"EditTask",_0:t}},FI=function(t){return PI(hI(t))},$I=function(t){var r=t;if("Group"===r.ctor){var e=r._0;return"Context"===e.ctor?BI(e._0):jI(e._0)}return FI(r._0)},UI=function(t){return{ctor:"NewTodo",_0:t}},JI=r(function(t,r){var e=r;return"SnoozeForMilli"===e.ctor?t+e._0:Io(s(ku,Du,10,_(Au,Mu,Oo(t))))}),HI=r(function(t,r){return{id:t,text:r}}),VI=function(t){return _(HI,_S(t),EE(t))},zI={ctor:"SnoozeView"},WI={ctor:"InitialView"},GI=r(function(t,r){return{ctor:"Active",_0:t,_1:r}}),KI=function(t){return _(GI,WI,VI(t))},XI=GI(zI),QI=(_(GI,WI,_(HI,"dummy-todo-id","dummy todo")),{ctor:"None"}),YI=QI,ZI={ctor:"Close"},tC={ctor:"MarkDone"},rC={ctor:"Dismiss"},eC=function(t){return{ctor:"SnoozeTill",_0:t}},nC={ctor:"ShowSnoozeOptions"},oC={ctor:"SnoozeTillTomorrow"},cC=function(t){return{ctor:"SnoozeForMilli",_0:t}},uC=Ar.outgoingPort("startAlarm",function(t){return null}),iC=(Ar.outgoingPort("stopAlarm",function(t){return null}),Ar.outgoingPort("closeNotification",function(t){return t})),aC=(r(function(t,r){return{action:t,data:r}}),o(function(t,r,e,n,o){return{tag:t,title:r,body:e,actions:n,data:o}}),e(function(t,r,e){return{title:t,tag:r,data:e}}),r(function(t,r){return{action:t,data:r}}),{ctor:"OnProcessPendingNotificationCronTick"}),_C=function(t){return{ctor:"OnShowMoreMenu",_0:t}},sC=r(function(t,r){return{ctor:"UpdateReminderForm",_0:t,_1:r}}),fC=function(t){return{ctor:"Upsert",_0:t}},lC={ctor:"UpdateTimeTracker"},dC={ctor:"GotoRunning"},pC=function(t){return{ctor:"ShowReminderOverlayForTodoId",_0:t}},hC=function(t){return{ctor:"OnReminderNotificationClicked",_0:t}},vC=function(t){return{ctor:"RunningNotificationResponse",_0:t}},mC={ctor:"TogglePaused"},gC={ctor:"StopRunning"},yC=function(t){return{ctor:"SwitchOrStartRunning",_0:t}},bC=s(wx,"todo-db",AE,IE),wC=function(t){var r=t;switch(r.ctor){case"Project":return Gx(r._0);case"Context":return Yx(r._0);case"Projects":return"Projects";default:return"Contexts"}},TC=r(function(t,r){var e=function(t){return s(FT,{ctor:"[]"},{ctor:"[]"},t)},n=os,o=function(t){return n(wC(t))}(r),c=n(t),u={ctor:"_Tuple2",_0:Gt(t),_1:r};t:do{if("_Tuple2"!==u.ctor||"::"!==u._0.ctor||"[]"!==u._0._1.ctor)break t;switch(u._0._0.valueOf()){case"#":if("Projects"===u._1.ctor)return{ctor:"_Tuple2",_0:r,_1:_(e,c,"#")};break t;case"@":if("Contexts"===u._1.ctor)return{ctor:"_Tuple2",_0:r,_1:_(e,c,"@")};break t;default:break t}}while(!1);return{ctor:"_Tuple2",_0:r,_1:_(e,c,o)}}),kC={ctor:"Contexts"},SC={ctor:"Projects"},xC=function(t){return{ctor:"Project",_0:t}},EC=function(t){return{ctor:"Context",_0:t}},AC=e(function(t,r,e){var n=_(mi[".|>"],e,xC),o=_(mi[".|>"],r,EC),c=_(k["++"],n,_(k["++"],o,{ctor:"::",_0:SC,_1:{ctor:"::",_0:kC,_1:{ctor:"[]"}}})),u=function(){var r=Gt(t);t:do{if("::"!==r.ctor)break t;switch(r._0.valueOf()){case"#":return _(k["++"],{ctor:"::",_0:SC,_1:{ctor:"[]"}},n);case"@":return _(k["++"],{ctor:"::",_0:kC,_1:{ctor:"[]"}},o);default:break t}}while(!1);return c}();return _(Q,function(t){return function(t){return t.score}(xr(t))},_(mi[".|>"],u,TC(t)))}),OC=EC(rE),IC={ctor:"Open"},CC=r(function(t,r){return{ctor:"OnInputChanged",_0:t,_1:r}}),qC=function(t){return{ctor:"OnEnter",_0:t}},NC=_(ua,{ctor:"::",_0:Oa("divider"),_1:{ctor:"[]"}},{ctor:"[]"}),MC=r(function(t,r){return _(ua,r,{ctor:"::",_0:_(ia,{ctor:"::",_0:Oa("btn-flat btn-floating x24 "),_1:{ctor:"[]"}},{ctor:"::",_0:_(fa,{ctor:"::",_0:Oa("default-color material-icons"),_1:{ctor:"[]"}},{ctor:"::",_0:Vi(t),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}),_1:{ctor:"[]"}})}),jC=r(function(t,r){return _(ua,r,{ctor:"::",_0:_(ia,{ctor:"::",_0:Oa("btn-flat btn-floating"),_1:{ctor:"[]"}},{ctor:"::",_0:_(fa,{ctor:"::",_0:Oa("default-color material-icons"),_1:{ctor:"[]"}},{ctor:"::",_0:Vi(t),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}),_1:{ctor:"[]"}})}),DC=r(function(t,r){return _(ua,r,{ctor:"::",_0:_(fa,{ctor:"::",_0:Oa("material-icons"),_1:{ctor:"[]"}},{ctor:"::",_0:Vi(t),_1:{ctor:"[]"}}),_1:{ctor:"[]"}})}),RC=function(t){return _(fa,{ctor:"::",_0:Oa("default-color material-icons"),_1:{ctor:"[]"}},{ctor:"::",_0:Vi(t),_1:{ctor:"[]"}})},BC=function(t){return _(X_,!1,function(r){return _(sS,r.todoId,t)})},LC=r(function(t,r){var e=r.state;return"Running"===e.ctor?r.totalTime+(t-e._0):r.totalTime}),PC=W,FC=PC(function(t){return t.todoId}),$C=z,UC=r(function(t,r){var e=r;if("Nothing"===e.ctor)return{ctor:"_Tuple2",_0:H,_1:r};var n=e._0;return _(kr,$C,function(){if(m.cmp(t,n.nextAlarmAt)>-1){var r=m.update(n,{nextAlarmAt:t+6e5}),e={todoId:n.todoId,elapsedTime:_(LC,t,r)};return{ctor:"_Tuple2",_0:z(e),_1:r}}return{ctor:"_Tuple2",_0:H,_1:n}}())}),JC=H,HC=(r(function(t,r){return{todoId:t,elapsedTime:r}}),n(function(t,r,e,n){return{todoId:t,totalTime:r,state:e,nextAlarmAt:n}}),{ctor:"Paused"}),VC=function(t){return{ctor:"Running",_0:t}},zC=r(function(t,r){return $C({todoId:t,totalTime:0,state:VC(r),nextAlarmAt:r+6e5})}),WC=e(function(t,r,e){return"Nothing"===e.ctor?_(zC,t,r):JC}),GC=r(function(t,r){return _(U,"switchOrStartRunning",_(K_,function(e){return _(zC,t,r)},function(r){return $C(m.update(r,{todoId:t}))}))}),KC=function(t){return PC(function(r){var e=r.state;return"Running"===e.ctor?m.update(r,{totalTime:r.totalTime+(t-e._0),state:HC}):m.update(r,{state:VC(t)})})},XC=function(t){return yx(function(t){return t.projectStore}(t))},QC=function(t){return yx(function(t){return t.contextStore}(t))},YC=r(function(t,r){return _(W_,lt(t),_(M_,uO(r.focusInEntity),t))}),ZC=r(function(t,r){return _(N_,uO(r.focusInEntity),t)}),tq=r(function(t,r){return m.update(r,{keyboardState:t})}),rq=(r(function(t,r){return _(tq,t(r),r)}),function(t){return t.keyboardState}),eq=r(function(t,r){return _(tq,t(rq(r)),r)}),nq=(r(function(t,r){return m.update(r,{now:t(r)})}),r(function(t,r){return m.update(r,{now:t})})),oq=function(t){return t.now},cq=r(function(t,r){return m.update(r,{contextStore:t})}),uq=(b(cq),r(function(t,r){return _(cq,t(r),r)}),function(t){return t.contextStore}),iq=r(function(t,r){return m.update(r,{projectStore:t})}),aq=(b(iq),r(function(t,r){return _(iq,t(r),r)}),function(t){return t.projectStore}),_q=(r(function(t,r){return _(iq,t(aq(r)),r)}),r(function(t,r){return m.update(r,{todoStore:t})})),sq=function(t){return t.todoStore},fq=(r(function(t,r){return m.update(r,{todoStore:t(sq(r))})}),r(function(t,r){return m.update(r,{selectedEntityIdSet:t})})),lq=(r(function(t,r){return _(fq,t(r),r)}),function(t){return t.selectedEntityIdSet}),dq=r(function(t,r){return _(fq,t(lq(r)),r)}),pq=r(function(t,r){return _(oi,t,r)?_(si,t,r):_(ai,t,r)}),hq=r(function(t,r){return m.update(r,{layout:t})}),vq=(r(function(t,r){return _(hq,t(r),r)}),function(t){return t.layout}),mq=r(function(t,r){return _(hq,t(vq(r)),r)}),gq=function(t){var r=t.mainViewType;return"EntityListView"===r.ctor?z(r._0):H},yq=aO,bq=function(t){return dq(pq(yq(t)))},wq=function(t){return t.mainViewType},Tq=r(function(t,r){switch(t){case"todo-db":return function(t){return _(xx,r,sq(t))};case"project-db":return function(t){return _(xx,r,aq(t))};case"context-db":return function(t){return _(xx,r,uq(t))};default:return function(t){return Cr}}}),kq=(r(function(t,r){return _(kr,_(mi["#"],_q,r),t)}),function(t){return function(r){return _(G_,function(r){return _(M_,sS(t),{ctor:"::",_0:rE,_1:{ctor:"[]"}})},_(mx,t,function(t){return t.contextStore}(r)))}}),Sq=b(kq),xq=function(t){return function(r){return _(G_,function(r){return _(M_,sS(t),{ctor:"::",_0:Jx,_1:{ctor:"[]"}})},_(mx,t,function(t){return t.projectStore}(r)))}},Eq=b(xq),Aq=function(t){return function(r){return _(mx,t,sq(r))}},Oq=fq(ui),Iq=r(function(t,r){return Oq(m.update(r,{mainViewType:t}))}),Cq=r(function(t,r){return m.update(r,{editMode:t})}),qq=r(function(t,r){return _(Cq,t(r),r)}),Nq=function(t){return t.editMode},Mq=Cq(kI),jq=function(t){return{uri:t.pouchDBRemoteSyncURI}},Dq=function(t){var r=function(){var r=t.editMode;return"EditSyncSettings"===r.ctor?z(r._0):H}();return _(mi["?="],r,jq(t))},Rq=e(function(t,r,e){var n=e.editMode;switch(n.ctor){case"EditContext":return _(Cq,_(LI,t,n._0),e);case"EditProject":return _(Cq,_(DI,t,n._0),e);default:return e}}),Bq=r(function(t,r){return _(Cq,$I(t),r)}),Lq=function(t){return Cq(II(dI(t)))},Pq=function(t){return Cq(OI(dI(t)))},Fq=function(t){return qq(function(r){return CI(_(yI,t,function(t){return t.now}(r)))})},$q=r(function(t,r){return m.update(r,{reminderOverlay:XI(t)})}),Uq=function(t){return m.update(t,{reminderOverlay:YI})},Jq=r(function(t,r){return m.update(r,{reminderOverlay:KI(t)})}),Hq=function(t){return _(QT,Aq(t),Jq)},Vq=function(t){return _(rk[">>?="],_(rk[">>?"],function(r){return _(Eq,t,FE(r))},Cx),!0)},zq=function(t){return _(hx,ZT({ctor:"::",_0:VE,_1:{ctor:"::",_0:Vq(t),_1:{ctor:"[]"}}}),t.todoStore)},Wq=function(t){return _(rk[">>?="],_(rk[">>?"],function(r){return _(Sq,t,kE(r))},Cx),!0)},Gq=function(t){return _(hx,ZT({ctor:"::",_0:VE,_1:{ctor:"::",_0:Wq(t),_1:{ctor:"[]"}}}),t.todoStore)},Kq=r(function(t,r){return zx(_(bt,Hx(t),_(hx,t,r.projectStore)))}),Xq=Kq(Cx),Qq=r(function(t,r){return oE(_(bt,eE(t),_(hx,t,r.contextStore)))}),Yq=Qq(Cx),Zq=e(function(t,r,e){return _(Q,r,_(hx,t,e.todoStore))}),tN=function(t){return _(Zq,t,function(t){return R(PE(t))})},rN=r(function(t,r){return _(tN,qS({ctor:"::",_0:VE,_1:{ctor:"::",_0:SE(t),_1:{ctor:"::",_0:Vq(r),_1:{ctor:"[]"}}}}),r)}),eN=r(function(t,r){return _(tN,qS({ctor:"::",_0:VE,_1:{ctor:"::",_0:$E(t),_1:{ctor:"::",_0:Wq(r),_1:{ctor:"[]"}}}}),r)}),nN=function(t){return _(Zq,t,function(t){return R(LE(t))})},oN=r(function(t,r){var e=_(mi["#"],kq,r),n=_(mi["#"],xq,r),o=_(mi["#"],eN,r),c=_(mi["#"],rN,r),u=t;switch(u.ctor){case"ContextsView":return _(zO,c,Yq(r));case"ProjectsView":return _(HO,o,Xq(r));case"ContextView":return s(QO,c,n,_(mi["?="],_(kq,u._0,r),rE));case"ProjectView":return s(KO,o,e,_(mi["?="],_(xq,u._0,r),Jx));case"BinView":return _(UO,"Bin",_(nN,oS,r));case"DoneView":return _(UO,"Done",_(nN,qS({ctor:"::",_0:cS,_1:{ctor:"::",_0:xE,_1:{ctor:"[]"}}}),r));default:return _(UO,"Recent",_(nN,CS,r))}}),cN=function(t){var r=t.mainViewType;return"EntityListView"===r.ctor?WO(_(oN,r._0,t)):{ctor:"[]"}},uN=function(t){return _(g,HT,_(di,{ctor:"_Tuple2",_0:function(t){return!function(t){return t.forceNarrow}(t)},_1:function(t){return t.narrow}},vq(t)))},iN=function(t){return function(t){return t.forceNarrow}(function(t){return t.layout}(t))},aN=function(t){return mq(function(r){return m.update(r,{narrow:t})})},_N=mq(function(t){return m.update(t,{forceNarrow:!t.forceNarrow})}),sN=function(t){return qk(function(t){return t.user}(t))},fN=function(t){return Nk(function(t){return t.user}(t))},lN=vO(rE),dN=_(HS,function(t){return t.keyComboModel},r(function(t,r){return m.update(r,{keyComboModel:t})})),pN=function(t){return _($S,dN,ST(t))},hN=_(HS,function(t){return t.focusInEntity},r(function(t,r){return m.update(r,{focusInEntity:t})})),vN=function(t){return _(NS,hN,t)},mN=r(function(t,r){return _(mi["?="],_(mi["?|>"],vi({ctor:"_Tuple2",_0:_(mi["?|>"],_(Aq,t,r),dO),_1:z(r)}),g(vN)),r)}),gN=_(rk[">>>"],iO,LS(hN)),yN=r(function(t,n){return _(r(function(t,r){var n=e(function(t,r,e){return s(DS,e,hN,_(W_,lt(r),_(mi["#"],H_,r)(_(OS,t,r))))}),o=function(r){return _(n,r,cN(t))};return function(){var t=r;return"_Tuple2"===t.ctor&&"Just"===t._0.ctor&&"Nothing"===t._1.ctor?o(t._0._0):T}()(t)}),n,_(Wr,function(r){return _(mi["#"],ZC,t)(cN(r))},{ctor:"_Tuple2",_0:t,_1:n}))}),bN=n(function(t,r,e,n){return _(Hr,yN(n),zr(s(PS,e,s(Sx,_(mi["#"],function(t){return oi(_S(t))},t),n.now,r),n)))}),wN=r(function(t,r){var n=e(function(t,r,e){return s(DS,e,hN,_(W_,lt(r),_(mi["#"],H_,r)(_(OS,t,r))))}),o=function(r){return _(n,r,cN(t))};return function(){var t=r;if("_Tuple2"===t.ctor&&"Just"===t._0.ctor){if("Just"===t._1.ctor){var e=t._0._0,n=t._1._0;return m.cmp(e,n)<0?o(e):m.cmp(e,n)>0?o(e+1):T}return o(t._0._0)}return T}()(t)}),TN=r(function(t,r){return _(wN,r,_(Wr,function(r){return _(mi["#"],ZC,t)(cN(r))},{ctor:"_Tuple2",_0:t,_1:r}))}),kN=_(HS,function(t){return t.user},r(function(t,r){return m.update(r,{user:t})})),SN=NS(kN),xN=_(HS,function(t){return t.editMode},r(function(t,r){return m.update(r,{editMode:t})})),EN=function(t){return _(NS,xN,AI(iI(t)))},AN=e(function(t,r,e){return _(NS,xN,AI(s(uI,t,r,e)))}),ON=function(t){return s(NS,xN,UI(_(fI,t.focusInEntity,"")),t)},IN=_(NS,xN,UI(_(fI,lN,""))),CN=r(function(t,r){return _(NS,xN,UI(_(_I,r,t)))}),qN=_(HS,function(t){return t.firebaseClient},r(function(t,r){return m.update(r,{firebaseClient:t})})),NN=r(function(t,r){return s(BS,qN,Ak(t),m.update(r,{fcmToken:t}))}),MN=function(t){return _(BS,qN,Ok(t))},jN=(_(HS,function(t){return t.now},r(function(t,r){return m.update(r,{now:t})})),_(HS,function(t){return t.keyboardState},r(function(t,r){return m.update(r,{keyboardState:t})})),_(HS,function(t){return t.todoStore},r(function(t,r){return m.update(r,{todoStore:t})}))),DN=function(t){return _(PS,jN,px(t))},RN=r(function(t,r){return xr(_(DN,_(CE,r.now,t),r))}),BN=e(function(t,r,e){var n=aA(r);return _(Hr,TN(e),zr(s(PS,jN,s(Sx,t,e.now,n),e)))}),LN=r(function(t,r){return _(BN,sS(r),t)}),PN=e(function(t,r,e){var n=_(JI,e.now,t);return function(t){return _(Sr,Uq,s(LN,YE(n),r,t))}(e)}),FN=function(t){var r=function(r){return function(t){var e=t,n=e._0;return _(mi["?|>"],_(Aq,r,n),function(t){return{ctor:"_Tuple2",_0:{ctor:"_Tuple2",_0:t,_1:n},_1:e._1}})}(s(LN,QE(t.now),r,t))};return _(mi["?+>"],_(vx,GE(t.now),t.todoStore),function(t){return r(_S(t))})},$N=e(function(t,r,e){return s(BN,_(mi["#"],function(t){return oi(_S(t))},r),t,e)}),UN=e(function(t,r,e){var n=_(oi,r,e.selectedEntityIdSet)?e.selectedEntityIdSet:ii(r);return s($N,t,n,e)}),JN=_(HS,function(t){return t.projectStore},r(function(t,r){return m.update(r,{projectStore:t})})),HN=r(function(t,r){return xr(s(PS,JN,px(_(Ux,t,r.now)),r))}),VN=r(function(t,r){return s(bN,ii(t),r,JN)}),zN=_(HS,function(t){return t.contextStore},r(function(t,r){return m.update(r,{contextStore:t})})),WN=r(function(t,r){return xr(s(PS,zN,px(_(tE,t,r.now)),r))}),GN=r(function(t,r){switch(t){case"todo-db":return _(rk[">>?"],_(FS,jN,dx(r)),Sr(pO));case"project-db":return _(rk[">>?"],_(FS,JN,dx(r)),Sr(mO));case"context-db":return _(rk[">>?"],_(FS,zN,dx(r)),Sr(vO));default:return function(t){return H}}}),KN=r(function(t,r){return s(bN,ii(t),r,zN)}),XN=function(t){var r=t.editMode;switch(r.ctor){case"EditContext":var e=r._0;return s(KN,e.id,Qx(e.name),t);case"EditProject":var n=r._0;return s(VN,n.id,Wx(n.name),t);case"EditTask":var o=r._0;return s(LN,_A(o.todoText),o.id,t);case"EditTodoReminder":var c=r._0;return s(LN,uA(mI(c)),c.id,t);case"EditTodoContext":case"EditTodoProject":case"TaskMoreMenu":return Ur(t);case"NewTodo":var u=r._0;return _(g,function(t){return function(r){return _(Sr,mN(t),s(LN,function(){var t=u.referenceEntity;if("Task"===t.ctor)return nA(t._0);var r=t._0;return"Context"===r.ctor?cA(r._0):eA(r._0)}(),t,r))}},_(Sr,_S,_(DN,_(CE,t.now,sI(u)),t)));case"EditSyncSettings":return Ur(m.update(t,{pouchDBRemoteSyncURI:r._0.uri}));case"LaunchBar":case"ActionList":case"None":default:return Ur(t)}},QN=r(function(t,r){var e=yq(t);return function(){var r=t;if("Group"===r.ctor){return"Context"===r._0.ctor?_(KN,e,tS):_(VN,e,tS)}return _(LN,tA,e)}()(r)}),YN=r(function(t,r){var e=yq(t);return function(){var r=t;if("Group"===r.ctor){return"Context"===r._0.ctor?_(KN,e,Fx):_(VN,e,Fx)}return _(LN,rA,e)}()(r)}),ZN=_(HS,function(t){return t.appDrawerModel},r(function(t,r){return m.update(r,{appDrawerModel:t})})),tM=(BS(ZN),function(t){return Hr(_(BS,ZN,t))}),rM={appDrawer:LA},eM=function(t){return Ze({ctor:"::",_0:_(rk["=>"],"appDrawer",FA(t.appDrawerModel)),_1:{ctor:"[]"}})},nM=(r(function(t,r){return{narrow:t,forceNarrow:r}}),function(t){return{appDrawer:t}}),oM=f(In,"appDrawer",HA,LA,sn(nM)),cM={ctor:"OnPersistLocalPref"},uM=function(t){return{ctor:"OnAppDrawerMsg",_0:t}},iM={ctor:"OnSetDomFocusToFocusInEntity"},aM=function(t){return{ctor:"OnCloseNotification",_0:t}},_M=function(t){return{ctor:"OnKeyCombo",_0:t}},sM=r(function(t,r){return{ctor:"OnTodoMsgWithTime",_0:t,_1:r}}),fM=function(t){return{ctor:"OnTodoMsg",_0:t}},lM=fM(gC),dM=fM(mC),pM=fM(dC),hM={ctor:"::",_0:_(CT,{ctor:"_Tuple2",_0:kT,_1:bT},lM),_1:{ctor:"::",_0:_(CT,{ctor:"_Tuple2",_0:kT,_1:TT},dM),_1:{ctor:"::",_0:_(CT,{ctor:"_Tuple2",_0:kT,_1:wT},pM),_1:{ctor:"[]"}}}},vM=r(function(t,r){return{ctor:"OnLaunchBarMsgWithNow",_0:t,_1:r}}),mM=function(t){return{ctor:"OnLaunchBarMsg",_0:t}},gM=r(function(t,r){return{ctor:"OnEntityAction",_0:t,_1:r}}),yM=function(t){return{ctor:"OnGlobalKeyUp",_0:t}},bM=function(t){return{ctor:"OnKeyboardMsg",_0:t}},wM=function(t){return{ctor:"OnNowChanged",_0:t}},TM=function(t){return{ctor:"OnSetEntityListView",_0:t}},kM=function(t){return{ctor:"OnSetViewType",_0:t}},SM=r(function(t,r){return{ctor:"OnEntityListKeyDown",_0:t,_1:r}}),xM=r(function(t,r){return{ctor:"UpdateTodoForm",_0:t,_1:r}}),EM=r(function(t,r){return{ctor:"OnEditTodoContextMenuStateChanged",_0:t,_1:r}}),AM=r(function(t,r){return{ctor:"OnEditTodoProjectMenuStateChanged",_0:t,_1:r}}),OM=r(function(t,r){return{ctor:"UpdateRemoteSyncFormUri",_0:t,_1:r}}),IM={ctor:"OnSaveCurrentForm"},CM=function(t){return{ctor:"StartEditingProject",_0:t}},qM=function(t){return{ctor:"StartEditingContext",_0:t}},NM=function(t){return{ctor:"StartEditingReminder",_0:t}},MM=function(t){return{ctor:"OnCreateDefaultEntitiesWithResult",_0:t}},jM={ctor:"OnCreateDefaultEntities"},DM={ctor:"OnDeactivateEditingMode"},RM=r(function(t,r){return{ctor:"NewTodoTextChanged",_0:t,_1:r}}),BM={ctor:"NewContext"},LM={ctor:"NewProject"},PM={ctor:"NewTodoForInbox"},FM={ctor:"NewTodo"},$M=r(function(t,r){return{ctor:"SetTodoProject",_0:t,_1:r}}),UM=r(function(t,r){return{ctor:"SetTodoContext",_0:t,_1:r}}),JM=function(t){return{ctor:"ToggleTodoDone",_0:t}},HM=function(t){return{ctor:"OnLayoutNarrowChanged",_0:t}},VM={ctor:"ToggleDrawer"},zM=function(t){return{ctor:"ReminderOverlayAction",_0:t}},WM=(r(function(t,r){return{ctor:"TodoAction",_0:t,_1:r}}),function(t){return{ctor:"RemotePouchSync",_0:t}}),GM={ctor:"SignOut"},KM={ctor:"OnSignIn"},XM=function(t){return{ctor:"OnFirebaseConnectionChanged",_0:t}},QM=function(t){return{ctor:"OnFCMTokenChanged",_0:t}},YM=function(t){return{ctor:"OnUserChanged",_0:t}},ZM=r(function(t,r){return{ctor:"OnFirebaseChange",_0:t,_1:r}}),tj=function(t){return{ctor:"OnEntityUpsert",_0:t}},rj=r(function(t,r){return{ctor:"OnPouchDBChange",_0:t,_1:r}}),ej=function(t){return{ctor:"OnCommonMsg",_0:t}},nj=function(t){return{noOp:t(nO),focus:function(r){return t(eO(r))},logString:function(r){return t(rO(r))}}}(ej),oj=nj.noOp,cj={ctor:"NOOP"},uj={ctor:"SyncView"},ij=function(t){return{ctor:"EntityListView",_0:t}},aj=ij(xO),_j=function(t){var r=_(mi["!="],_(Ft,U("Unable to decode localPref"),_(fn,oM,t.localPref)),rM),n=Rk(t.deviceId),o=t,c=o.now,u=o.encodedTodoList,i=o.encodedProjectList,a=o.encodedContextList,s=o.pouchDBRemoteSyncURI,l=f(od,e(function(t,r,e){return{ctor:"_Tuple3",_0:t,_1:r,_2:e}}),_(bC,t.deviceId,u),_(Kx,t.deviceId,i),_(Xx,t.deviceId,a)),d=_(Ql,l,KS(c)),p=d._0._0,h=d._0._1,v=d._0._2,m=(d._1,gx(p)||gx(v)||gx(h)?xI:kI),g={now:c,todoStore:p,projectStore:h,contextStore:v,editMode:m,mainViewType:aj,keyboardState:hS,showDeleted:!1,reminderOverlay:YI,pouchDBRemoteSyncURI:s,user:Qk,fcmToken:H,developmentMode:t.developmentMode,selectedEntityIdSet:ui,layout:{narrow:!1,forceNarrow:!1},appVersion:t.appVersion,deviceId:t.deviceId,focusInEntity:lN,timeTracker:JC,firebaseClient:n,keyComboModel:ET({toMsg:_M,combos:hM}),config:t.config,appDrawerModel:r.appDrawer};return Ur(g)},sj=function(t){return ij(wO(_S(t)))},fj=function(t){return Iq(sj(t))},lj=function(t){return function(t){var r=t,e=r._0;return _(Bq,mO(e),_(fj,e,r._1))}(_(Gr,_(mi["#"],iq,t),_(px,_(Ux,"<New Project>",t.now),t.projectStore)))},dj=function(t){return ij(kO(_S(t)))},pj=function(t){return Iq(dj(t))},hj=function(t){return function(t){var r=t,e=r._0;return _(Bq,vO(e),_(pj,e,r._1))}(_(Gr,_(mi["#"],cq,t),_(px,_(tE,"<New Context>",t.now),t.contextStore)))},vj=Iq(ij(SO)),mj=function(t){return Iq(ij(t))},gj=r(function(t,r){var e=gq(r);return _(mi["#"],mj,r)(_(OO,e,t))}),yj=r(function(t,r){var e={ctor:"::",_0:"r1",_1:{ctor:"::",_0:"222",_1:{ctor:"::",_0:"r3",_1:{ctor:"::",_0:"r4",_1:{ctor:"::",_0:"r5",_1:{ctor:"[]"}}}}}},n=_(mi[".|>"],e,function(t){return _(ua,{ctor:"[]"},{ctor:"::",_0:Vi(t),_1:{ctor:"[]"}})}),o=r.searchText;return _(ua,{ctor:"::",_0:Oa("overlay"),_1:{ctor:"::",_0:Qa(DM),_1:{ctor:"[]"}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("modal fixed-top-20p"),_1:{ctor:"::",_0:dk(cj),_1:{ctor:"::",_0:xS(function(t){return cj}),_1:{ctor:"[]"}}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("modal-content"),_1:{ctor:"[]"}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("input-field"),_1:{ctor:"[]"}},{ctor:"::",_0:_(va,{ctor:"::",_0:Fa(!0),_1:{ctor:"::",_0:Da(o),_1:{ctor:"[]"}}},{ctor:"[]"}),_1:{ctor:"::",_0:_(ha,{ctor:"::",_0:Oa("active"),_1:{ctor:"[]"}},{ctor:"::",_0:Vi("Enter action or option name"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}),_1:{ctor:"::",_0:_(ua,{ctor:"[]"},n),_1:{ctor:"[]"}}}),_1:{ctor:"[]"}}),_1:{ctor:"[]"}})}),bj=function(t){var r=t;return"Just"===r.ctor?{ctor:"::",_0:r._0,_1:{ctor:"[]"}}:{ctor:"[]"}},wj=e(function(t,r,e){var n=e.name,o=r.isNull(e),c=o?r.nullIcon:{name:r.defaultIconName,color:"#9e9e9e"},u={name:_(k["++"],r.namePrefix,n),backgroundColor:c.color},i=gM(r.toEntity(e)),a=(i(RO),_S(e)),s=it(t(a));return{id:a,name:n,isDeleted:oS(e),isEmpty:m.eq(s,0),count:s,onActiveStateChanged:function(t){return t?kM(ij(r.getViewType(a))):nj.noOp},icon:c,appHeader:u}}),Tj=r(function(t,r){var e=t.filter(r),n=_(i_,t.groupByFn,t.todoList),o=function(t){return _(mi["?="],_(le,t,n),{ctor:"[]"})};return _(mi[".|>"],e,_(wj,o,t))}),kj=function(t){var r=Qq(Cx),e={groupByFn:kE,todoList:zq(t),namePrefix:"@",filter:r,toEntity:vO,nullEntity:rE,isNull:nE,nullIcon:{name:"inbox",color:"#42a5f5"},defaultIconName:"fiber_manual_record",getViewType:kO},n=_(Tj,e,t),o=bj(lt(n)),c=Qq(qx),u=m.update(e,{filter:c});return{entityList:_(Y,1,n),nullVMAsList:o,archivedEntityList:_(Tj,u,t),viewType:SO,title:"Contexts",className:"contexts",showDeleted:t.showDeleted,showArchived:DA(t.appDrawerModel),onAddClicked:BM,icon:{name:"group_work",color:"rgb(68, 138, 255)"},onToggleExpanded:uM(WA),onToggleShowArchived:uM(zA),isExpanded:MA(t.appDrawerModel)}},Sj=function(t){var r=Kq(Cx),e={groupByFn:FE,todoList:Gq(t),namePrefix:"#",filter:r,toEntity:mO,nullEntity:Jx,isNull:Vx,nullIcon:{name:"apps",color:"rgb(179, 157, 219)"},defaultIconName:"apps",getViewType:wO},n=_(Tj,e,t),o=(bj(lt(n)),Kq(qx)),c=m.update(e,{filter:o});return{entityList:_(Y,1,n),nullVMAsList:{ctor:"[]"},archivedEntityList:_(Tj,c,t),viewType:TO,title:"Projects",className:"projects",showDeleted:t.showDeleted,showArchived:CA(t.appDrawerModel),onAddClicked:LM,icon:{name:"group_work",color:"rgb(124, 77, 255)"},onToggleExpanded:uM(GA),onToggleShowArchived:uM(VA),isExpanded:OA(t.appDrawerModel)}},xj=(r(function(t,r){return{name:t,color:r}}),i(function(t,r,e,n,o,c,u,i){return{id:t,name:r,appHeader:e,isDeleted:n,isEmpty:o,count:c,onActiveStateChanged:u,icon:i}}),r(function(t,r){return{name:t,archived:r}}),r(function(t,r){return _(r_,{ctor:"::",_0:Qa(r),_1:{ctor:"[]"}},{ctor:"::",_0:Vi(t?"Unarchive":"Archive"),_1:{ctor:"[]"}})})),Ej=function(t){return _(r_,{ctor:"::",_0:Qa(t),_1:{ctor:"[]"}},{ctor:"::",_0:Vi("Delete"),_1:{ctor:"[]"}})},Aj=function(t){return _(r_,{ctor:"::",_0:Qa(t),_1:{ctor:"[]"}},{ctor:"::",_0:Vi("Cancel"),_1:{ctor:"[]"}})},Oj=function(t){return _(r_,{ctor:"::",_0:Qa(t),_1:{ctor:"[]"}},{ctor:"::",_0:Vi("Ok"),_1:{ctor:"[]"}})},Ij=e(function(t,r,e){return _(ua,{ctor:"::",_0:Oa("layout horizontal-reverse"),_1:{ctor:"[]"}},_(k["++"],{ctor:"::",_0:Oj(t),_1:{ctor:"::",_0:Aj(r),_1:{ctor:"[]"}}},e))}),Cj=function(t){return s(Ij,IM,DM,t)},qj=function(t){return Cj({ctor:"::",_0:Ej(t),_1:{ctor:"[]"}})},Nj=r(function(t,r){return Cj({ctor:"::",_0:_(xj,t,r),_1:{ctor:"[]"}})}),Mj=Cj({ctor:"[]"}),jj=r(function(t,r){return _(ua,{ctor:"::",_0:Oa("layout horizontal center"),_1:{ctor:"[]"}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("font-nowrap"),_1:{ctor:"[]"}},{ctor:"::",_0:Vi(t),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Ua({ctor:"::",_0:_(rk["=>"],"padding","0 0 1rem 0.1rem "),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:Oa("text-secondary"),_1:{ctor:"[]"}}},{ctor:"::",_0:Vi(_(k["++"]," ",_(k["++"],S(r),""))),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}})}),Dj=function(t){return _(ua,{ctor:"::",_0:Oa("layout horizontal center"),_1:{ctor:"[]"}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("font-nowrap"),_1:{ctor:"[]"}},{ctor:"::",_0:Vi(t.name),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Ua({ctor:"::",_0:_(rk["=>"],"padding","0 0 1rem 0.1rem "),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:Oa("text-secondary"),_1:{ctor:"[]"}}},{ctor:"::",_0:Vi(_(k["++"]," ",_(k["++"],S(t.count),""))),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}})},Rj=n(function(t,e,n,o){var c=function(t){return M_(function(r){return _(JT,t,function(t){return t.id}(r))})},u=r(function(t,r){return function(e){return function(t){var r=t;return{ctor:"_Tuple2",_0:r.name,_1:r.backgroundColor}}(_(rk[">>?="],_(rk[">>?"],G_(function(e){return _(c,t,r.nullVMAsList)}),function(t){return t.appHeader}),{name:"o_O",backgroundColor:"rgb(68, 138, 255)"})(e))}(_(G_,function(e){return _(c,t,r.archivedEntityList)},_(c,t,r.entityList)))}),i=t;if("EntityListView"!==i.ctor)return{ctor:"_Tuple2",_0:"Custom Sync",_1:"rgb(68, 138, 255)"};var a=i._0;switch(a.ctor){case"ContextsView":return{ctor:"_Tuple2",_0:n.title,_1:n.icon.color};case"ContextView":return _(u,a._0,n);case"ProjectsView":return{ctor:"_Tuple2",_0:e.title,_1:e.icon.color};case"ProjectView":return _(u,a._0,e);case"BinView":return{ctor:"_Tuple2",_0:"Bin",_1:"rgb(68, 138, 255)"};case"DoneView":return{ctor:"_Tuple2",_0:"Done",_1:"rgb(68, 138, 255)"};default:return{ctor:"_Tuple2",_0:"Recent",_1:"rgb(68, 138, 255)"}}}),Bj=function(t){var r=oq(t),e=(Nq(t),t.mainViewType),n=Sj(t),o=kj(t),c=f(Rj,e,n,o,t);return{contexts:o,projects:n,viewName:c._0,header:{backgroundColor:c._1},now:r,selectedEntityIdSet:t.selectedEntityIdSet,projectByIdDict:XC(t),contextByIdDict:QC(t)}},Lj=(i(function(t,r,e,n,o,c,u,i){return{contexts:t,projects:r,viewName:e,header:n,now:o,projectByIdDict:c,contextByIdDict:u,selectedEntityIdSet:i}}),e(function(t,r,e){return _(ca,{ctor:"::",_0:Oa(""),_1:{ctor:"::",_0:Qa(TM(r)),_1:{ctor:"[]"}}},{ctor:"::",_0:RC(t),_1:{ctor:"::",_0:_(Qi,{ctor:"[]"},{ctor:"::",_0:Vi(e),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}})})),Pj=e(function(t,r,e){return _(ca,{ctor:"::",_0:Oa(""),_1:{ctor:"::",_0:Qa(kM(r)),_1:{ctor:"[]"}}},{ctor:"::",_0:RC(t),_1:{ctor:"::",_0:_(ua,{ctor:"[]"},{ctor:"::",_0:Vi(e),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}})}),Fj=(e(function(t,r,e){return _(ca,{ctor:"::",_0:Oa(""),_1:{ctor:"::",_0:Qa(kM(r)),_1:{ctor:"[]"}}},{ctor:"::",_0:RC(t),_1:{ctor:"::",_0:_(Qi,{ctor:"[]"},{ctor:"::",_0:Vi(e),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}})}),function(t){return _(ca,{ctor:"::",_0:Qa(t.onActiveStateChanged(!0)),_1:{ctor:"[]"}},{ctor:"::",_0:_(DC,t.icon.name,{ctor:"::",_0:Ua({ctor:"::",_0:_(rk["=>"],"color",t.icon.color),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("font-nowrap"),_1:{ctor:"[]"}},{ctor:"::",_0:Dj(t),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}})}),$j=function(t){var r=t.showArchived?{ctor:"_Tuple3",_0:"visibility_off",_1:"Hide Archived",_2:_(pt,Fj,t.archivedEntityList)}:{ctor:"_Tuple3",_0:"visibility",_1:" Show Archived",_2:{ctor:"[]"}},e=r._0,n=r._1,o=r._2,c=it(t.archivedEntityList);return{ctor:"::",_0:_(ca,{ctor:"::",_0:Oa(""),_1:{ctor:"::",_0:Qa(t.onToggleShowArchived),_1:{ctor:"[]"}}},{ctor:"::",_0:RC(e),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("font-nowrap"),_1:{ctor:"[]"}},{ctor:"::",_0:_(jj,n,c),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}),_1:{ctor:"::",_0:_(ca,{ctor:"::",_0:$a({ctor:"::",_0:_(rk["=>"],"list-container",!0),_1:{ctor:"::",_0:_(rk["=>"],"expanded",t.showArchived),_1:{ctor:"[]"}}}),_1:{ctor:"[]"}},{ctor:"::",_0:_(oa,{ctor:"[]"},o),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}},Uj=r(function(t,r){var e=_(mi[".|>"],t.nullVMAsList,Fj),n=t,o=n.viewType,c=n.onAddClicked,u=n.onToggleExpanded,i=n.isExpanded,a=m.eq(ij(o),r),s=kM(ij(o)),f=a?u:s,l=i?"expand_less":"expand_more";return _(k["++"],e,{ctor:"::",_0:_(ca,{ctor:"::",_0:Qa(f),_1:{ctor:"[]"}},{ctor:"::",_0:_(DC,t.icon.name,{ctor:"::",_0:Ua({ctor:"::",_0:_(rk["=>"],"color",t.icon.color),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(Qi,{ctor:"[]"},{ctor:"::",_0:Vi(t.title),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(jC,l,{ctor:"::",_0:dk(u),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}}),_1:{ctor:"::",_0:_(ca,{ctor:"::",_0:$a({ctor:"::",_0:_(rk["=>"],"list-container",!0),_1:{ctor:"::",_0:_(rk["=>"],"expanded",i),_1:{ctor:"[]"}}}),_1:{ctor:"[]"}},{ctor:"::",_0:_(oa,{ctor:"[]"},_(k["++"],{ctor:"[]"},_(k["++"],_(pt,Fj,t.entityList),_(k["++"],{ctor:"::",_0:_(ca,{ctor:"::",_0:Oa(""),_1:{ctor:"::",_0:sk(c),_1:{ctor:"[]"}}},{ctor:"::",_0:RC("add"),_1:{ctor:"::",_0:_(ua,{ctor:"[]"},{ctor:"::",_0:Vi("Add New"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}),_1:{ctor:"[]"}},$j(t))))),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}})}),Jj=r(function(t,r){var e=t,n=e.contexts,o=e.projects;return _(ua,{ctor:"::",_0:Oa("app-drawer-list-container"),_1:{ctor:"[]"}},{ctor:"::",_0:_(oa,{ctor:"[]"},_(k["++"],{ctor:"[]"},_(k["++"],_(Uj,n,r.mainViewType),_(k["++"],_(Uj,o,r.mainViewType),_(k["++"],{ctor:"::",_0:NC,_1:{ctor:"[]"}},{ctor:"::",_0:s(Lj,"sort",gO,"Recent"),_1:{ctor:"::",_0:s(Lj,"delete",bO,"Bin"),_1:{ctor:"::",_0:s(Lj,"done",yO,"Done"),_1:{ctor:"::",_0:NC,_1:{ctor:"::",_0:s(Pj,"settings",uj,"Advance Settings"),_1:{ctor:"[]"}}}}}}))))),_1:{ctor:"[]"}})}),Hj=r(function(t,r){switch(r.ctor){case"OnToggleExpandContextList":return function(r){return _(t,cM,_(tM,jA,r))};case"OnToggleExpandProjectList":return function(r){return _(t,cM,_(tM,IA,r))};case"OnToggleShowArchivedContexts":return function(r){return _(t,cM,_(tM,RA,r))};default:return function(r){return _(t,cM,_(tM,qA,r))}}}),Vj=function(t){var r=Dq(t);return _(ua,{ctor:"::",_0:Ia("custom-sync-container"),_1:{ctor:"[]"}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("z-depth-2 static layout vertical "),_1:{ctor:"[]"}},{ctor:"::",_0:_(Qi,{ctor:"::",_0:Oa("layout horizontal center"),_1:{ctor:"[]"}},{ctor:"::",_0:RC("settings"),_1:{ctor:"::",_0:Vi("Advance Settings"),_1:{ctor:"[]"}}}),_1:{ctor:"::",_0:_(Zi,{ctor:"[]"},{ctor:"::",_0:Vi("Sync your data with any CouchDB compatible server"),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("input-field"),_1:{ctor:"::",_0:xS(function(t){return cj}),_1:{ctor:"[]"}}},{ctor:"::",_0:_(va,{ctor:"::",_0:Da(r.uri),_1:{ctor:"::",_0:Fa(!0),_1:{ctor:"::",_0:Ka(OM(r)),_1:{ctor:"[]"}}}},{ctor:"[]"}),_1:{ctor:"::",_0:_(ha,{ctor:"::",_0:Oa("active"),_1:{ctor:"[]"}},{ctor:"::",_0:Vi("Cloudant or any CouchDB URL"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}),_1:{ctor:"::",_0:_(ua,{ctor:"[]"},{ctor:"::",_0:_(r_,{ctor:"::",_0:function(t){return Qa(WM(t))}(r),_1:{ctor:"[]"}},{ctor:"::",_0:Vi("Sync Now"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}}}),_1:{ctor:"[]"}})},zj=e(function(t,r,e){var n=e.name,o=t.isNull(e),c=o?t.nullIcon:{name:t.defaultIconName,color:"#9e9e9e"},u=(_(k["++"],t.namePrefix,n),c.color,gM(t.toEntity(e))),i=o?cj:u(DO),a=o?cj:u(RO),s=function(t){switch(t.key.ctor){case"CharE":return a;case"Delete":return i;case"CharG":return u(IO);default:return nj.noOp}},f=function(){var t=Ox(e);return{iconName:t?"unarchive":"archive",onClick:u(jO),isArchived:t}}();return{id:_S(e),name:n,namePrefix:t.namePrefix,count:it(r),isEditable:!o,isDeleted:oS(e),archive:f,startEditingMsg:a,onDeleteClicked:i,onSaveClicked:u(MO),onNameChanged:function(t){return u(NO(t))},onCancelClicked:DM,icon:c,onFocusIn:u(qO),onKeyDownMsg:s,tabindexAV:t.getTabIndexAVForEntity(t.toEntity(e)),todoList:r,getTabIndexAVForEntity:t.getTabIndexAVForEntity}}),Wj=e(function(t,r,e){return s(zj,{groupByFn:kE,namePrefix:"@",toEntity:vO,nullEntity:rE,isNull:nE,nullIcon:{name:"inbox",color:"#42a5f5"},defaultIconName:"av:fiber-manual-record",getViewType:kO,getTabIndexAVForEntity:t},r,e)}),Gj=e(function(t,r,e){return s(zj,{groupByFn:FE,namePrefix:"#",toEntity:mO,nullEntity:Jx,isNull:Vx,nullIcon:{name:"inbox",color:"#42a5f5"},defaultIconName:"av:fiber-manual-record",getViewType:wO,getTabIndexAVForEntity:t},r,e)}),Kj=(r(function(t,r){return{name:t,color:r}}),a(function(t,r,e,n,o,c,u,i,a){return{groupByFn:t,namePrefix:r,toEntity:e,nullEntity:n,isNull:o,nullIcon:c,defaultIconName:u,getViewType:i,getTabIndexAVForEntity:a}}),r(function(t,r){return s(ju,Mu,_(Au,Mu,t),_(Au,Mu,r))})),Xj=r(function(t,r){var e=_(Kj,t,r),n=zl("%e %b"),o=or(n(r)),c=zl("%l:%M%P"),u=or(c(r));return m.eq(e,0)?u:m.eq(e,-1)?_(k["++"],"Yesterday ",u):m.eq(e,1)?_(k["++"],"Tomorrow ",u):m.cmp(e,1)>0&&m.cmp(e,7)<0?_(k["++"],_(zl,"%A ",r),u):_(k["++"],o,_(k["++"]," ",u))}),Qj=function(t){var r=I(t),e=(_(k["%"],r,1e3),_(k["%"],r/1e3|0,60));return{ctor:"::",_0:r/36e5|0,_1:{ctor:"::",_0:_(k["%"],r/6e4|0,60),_1:{ctor:"::",_0:e,_1:{ctor:"[]"}}}}},Yj=r(function(t,r){var e=Oo,n=e(t),o=e(r);return _(Xj,n,o)}),Zj=r(function(t,r){return _(Kj,Oo(t),Oo(r))}),tD=(function(){var t=function(t){var r=function(t){return S(D(t))}(t);return m.cmp(t,0)>0?_(k["++"],r," days left"):m.cmp(t,0)<0?_(k["++"],r," days ago"):""};_(rk[">>>"],Zj,t)}(),Wl("%a %e %b %Y %l:%M%P"),function(){var t=function(t){var r=t;return _(k["++"],S(r._1),r._0)},r={ctor:"::",_0:"h",_1:{ctor:"::",_0:"m",_1:{ctor:"::",_0:"s",_1:{ctor:"[]"}}}};return function(e){return _(dr," ",_(mt,s(WT,function(t){return _(JT,0,xr(t))},function(t){return H},function(r){return z(t(r))}),_(f_,r,Qj(e))))}}()),rD=function(t){return _(dr,":",_(pt,function(t){return s(ur,2,m.chr("0"),S(t))},Qj(t)))},eD=function(t){switch(t.valueOf()){case"\f":return"\\f";case"\n":return"\\n";case"\r":return"\\r";case"\t":return"\\t";case"\v":return"\\v";case"\b":return"[\\b]";default:return wr(t)}},nD=function(t){return m.eq(t,m.chr("\\"))?"\\\\":m.eq(t,m.chr("\b"))?"\\b":_(_t,t,{ctor:"::",_0:m.chr("["),_1:{ctor:"::",_0:m.chr("]"),_1:{ctor:"::",_0:m.chr("-"),_1:{ctor:"[]"}}}})?_(k["++"],"\\",wr(t)):eD(t)},oD={ctor:"::",_0:m.chr("-"),_1:{ctor:"::",_0:m.chr("/"),_1:{ctor:"::",_0:m.chr("\\"),_1:{ctor:"::",_0:m.chr("^"),_1:{ctor:"::",_0:m.chr("$"),_1:{ctor:"::",_0:m.chr("*"),_1:{ctor:"::",_0:m.chr("+"),_1:{ctor:"::",_0:m.chr("#"),_1:{ctor:"::",_0:m.chr("?"),_1:{ctor:"::",_0:m.chr("."),_1:{ctor:"::",_0:m.chr("("),_1:{ctor:"::",_0:m.chr(")"),_1:{ctor:"::",_0:m.chr("|"),_1:{ctor:"::",_0:m.chr("["),_1:{ctor:"::",_0:m.chr("]"),_1:{ctor:"::",_0:m.chr("{"),_1:{ctor:"::",_0:m.chr("}"),_1:{ctor:"[]"}}}}}}}}}}}}}}}}}},cD=function(t){return _(_t,t,oD)?_(k["++"],"\\",wr(t)):eD(t)},uD=function(t){var r=t;switch(r.ctor){case"ZeroPlus":return"*";case"OnePlus":return"+";case"ZeroOrOne":return"?";case"Exactly":return _(k["++"],"{",_(k["++"],S(r._0),"}"));case"Between":return _(k["++"],"{",_(k["++"],S(r._0),_(k["++"],",",_(k["++"],S(r._1),"}"))));case"LazyZeroPlus":return"*?";case"LazyOnePlus":return"+?";case"LazyZeroOrOne":return"??";default:return _(k["++"],"{",_(k["++"],S(r._0),_(k["++"],",",_(k["++"],S(r._1),"}?"))))}},iD={ctor:"Empty"},aD=function(t){var r=function(t){return gr(function(){return"Choice"===t.ctor?_(k["++"],"(?:",_(k["++"],aD(t),")")):aD(t)}())},e=t;switch(e.ctor){case"Remember":return _(r,e._1,_(k["++"],"(",_(k["++"],aD(e._0),")")));case"OneOf":return _(r,e._1,function(t){return _(k["++"],"[",_(k["++"],t,"]"))}(mr(_(pt,nD,e._0))));case"NoneOf":return _(r,e._1,function(t){return _(k["++"],"[^",_(k["++"],t,"]"))}(mr(_(pt,nD,e._0))));case"Choice":var n=e._0,o=e._1;return _(r,o,function(t){return!m.eq(o,iD)&&m.cmp(it(n),1)>0?_(k["++"],"(?:",_(k["++"],t,")")):t}(_(dr,"|",_(pt,aD,n))));case"Postfix":return _(r,e._2,_(_D,e._0,e._1));case"Lookahead":return _(k["++"],"(?:",_(k["++"],aD(e._1),_(k["++"],")(?=",_(k["++"],aD(e._0),")"))));case"NegativeLookahead":return _(k["++"],"(?:",_(k["++"],aD(e._1),_(k["++"],")(?!",_(k["++"],aD(e._0),")"))));case"Raw":return _(r,e._1,e._0);case"Unescaped":return _(r,e._1,cD(e._0));default:return""}},_D=r(function(t,r){return function(){var t=r;t:do{switch(t.ctor){case"Unescaped":case"Raw":if("Empty"===t._1.ctor)return!1;break t;case"Empty":return!1;case"NoneOf":case"OneOf":case"Remember":if("Empty"===t._1.ctor)return!1;break t;default:break t}}while(!1);return!0}()?_(k["++"],"(?:",_(k["++"],aD(r),_(k["++"],")",uD(t)))):_(k["++"],aD(r),uD(t))}),sD=(r(function(t,r){return{ctor:"Unescaped",_0:t,_1:r}}),r(function(t,r){return{ctor:"Raw",_0:t,_1:r}})),fD=(r(function(t,r){return{ctor:"NegativeLookahead",_0:t,_1:r}}),r(function(t,r){return{ctor:"Lookahead",_0:t,_1:r}}),e(function(t,r,e){return{ctor:"Postfix",_0:t,_1:r,_2:e}})),lD=(r(function(t,r){return{ctor:"Choice",_0:t,_1:r}}),r(function(t,r){return{ctor:"NoneOf",_0:t,_1:r}}),r(function(t,r){return{ctor:"OneOf",_0:t,_1:r}}),r(function(t,r){return{ctor:"Remember",_0:t,_1:r}}),r(function(t,r){return{ctor:"LazyBetween",_0:t,_1:r}})),dD=r(function(t,r){return{ctor:"Between",_0:t,_1:r}}),pD=function(t){return{ctor:"Exactly",_0:t}},hD={ctor:"ZeroOrOne"},vD={ctor:"OnePlus"},mD={ctor:"ZeroPlus"},gD=function(t){return aD(t(iD))},yD=(sD("."),sD("\\S"),sD("\\s"),sD("\\D"),sD("\\d"),r(function(t,r){var e=t(iD);t:do{switch(e.ctor){case"Postfix":if("Empty"===e._2.ctor)return"OnePlus"===e._0.ctor?s(fD,vD,e._1,r):s(fD,mD,e._1,r);break t;case"Empty":return r;default:break t}}while(!1);return s(fD,vD,t(iD),r)}),r(function(t,r){var e=t(iD);t:do{switch(e.ctor){case"Postfix":if("Empty"===e._2.ctor)return"ZeroOrOne"===e._0.ctor?s(fD,hD,e._1,r):s(fD,mD,e._1,r);break t;case"Empty":return r;default:break t}}while(!1);return s(fD,hD,t(iD),r)}),e(function(t,r,e){return m.cmp(t,r)>0||m.cmp(t,0)<0||m.cmp(r,0)<0?T:m.eq(t,r)?_(fD,pD(t),e(iD)):_(fD,_(lD,t,r),e(iD))}),e(function(t,r,e){return m.cmp(t,r)>0||m.cmp(t,0)<0||m.cmp(r,0)<0?T:m.eq(t,r)?_(fD,pD(t),e(iD)):_(fD,_(dD,t,r),e(iD))}),r(function(t,r){return m.cmp(t,0)<1?T:_(fD,pD(t),r(iD))}),sD("\\B"),sD("\\b"),r(function(t,r){var e=t,n=e.alignEnd?"$":"",o=e.alignBeginning?"^":"";return _(k["++"],o,_(k["++"],gD(r),n))}),r(function(t,r){return{alignBeginning:t,alignEnd:r}}),function(){var t=Dc(_(k["++"],"^","[A-Za-z]+://"));return s(Nc,Lc,t,function(t){return""})}()),bD=Dc(_(k["++"],"[A-Za-z]+://","\\S+")),wD=function(t){return function(r){return _(gr,t,_(gr,"-menu-key-",_S(r)))}},TD=r(function(t,r){var e=t,n=e.todo;return{onSelect:_(mi["#"],UM,n),isSelected:sS(kE(n)),itemKey:wD("context"),itemSearchText:Yx,itemView:function(t){return Vi(Yx(t))},onStateChanged:EM(e),noOp:nj.noOp,onOutsideMouseDown:DM}}),kD=r(function(t,r){return s(gA,Yq(r),t.menuState,_(TD,t,r))}),SD=r(function(t,r){var e=t,n=e.todo;return{onSelect:_(mi["#"],$M,n),isSelected:sS(FE(n)),itemKey:wD("project"),itemSearchText:Gx,itemView:function(t){return Vi(Gx(t))},onStateChanged:AM(e),noOp:nj.noOp,onOutsideMouseDown:DM}}),xD=r(function(t,r){return s(gA,Xq(r),t.menuState,_(SD,t,r))}),ED=function(t){var r=function(r){return fM(_(sC,t,r))};return _(ua,{ctor:"::",_0:Oa("overlay"),_1:{ctor:"::",_0:dk(DM),_1:{ctor:"::",_0:xS(function(t){return cj}),_1:{ctor:"[]"}}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Ia("popup-menu"),_1:{ctor:"::",_0:Oa("z-depth-4 static"),_1:{ctor:"::",_0:dk(nj.noOp),_1:{ctor:"[]"}}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("font-subhead"),_1:{ctor:"[]"}},{ctor:"::",_0:Vi("Select date and time"),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("input-field"),_1:{ctor:"[]"}},{ctor:"::",_0:_(va,{ctor:"::",_0:Ma("date"),_1:{ctor:"::",_0:Oa("auto-focus"),_1:{ctor:"::",_0:ja(t.date),_1:{ctor:"::",_0:hk(function(t){return r(wI(t))}),_1:{ctor:"[]"}}}}},{ctor:"[]"}),_1:{ctor:"::",_0:_(ha,{ctor:"::",_0:Oa("active"),_1:{ctor:"[]"}},{ctor:"::",_0:Vi("Date"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("input-field"),_1:{ctor:"[]"}},{ctor:"::",_0:_(va,{ctor:"::",_0:Ma("time"),_1:{ctor:"::",_0:ja(t.time),_1:{ctor:"::",_0:hk(function(t){return r(bI(t))}),_1:{ctor:"[]"}}}},{ctor:"[]"}),_1:{ctor:"::",_0:_(ha,{ctor:"::",_0:Oa("active"),_1:{ctor:"[]"}},{ctor:"::",_0:Vi("Time"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}),_1:{ctor:"::",_0:Mj,_1:{ctor:"[]"}}}}}),_1:{ctor:"[]"}})},AD=kD,OD=xD,ID=DM,CD=r(function(t,r){var e=_(gM,t.entity,DO),n=function(r){return _(xM,t,vI(r))},o=t.todoText;return _(ua,{ctor:"::",_0:Oa("overlay"),_1:{ctor:"::",_0:dk(ID),_1:{ctor:"::",_0:xS(function(t){return cj}),_1:{ctor:"[]"}}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("modal fixed-center"),_1:{ctor:"::",_0:dk(cj),_1:{ctor:"[]"}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("modal-content"),_1:{ctor:"[]"}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("input-field"),_1:{ctor:"::",_0:xS(function(t){return cj}),_1:{ctor:"[]"}}},{ctor:"::",_0:_(ma,{ctor:"::",_0:Oa("materialize-textarea auto-focus"),_1:{ctor:"::",_0:Da(o),_1:{ctor:"::",_0:Ka(n),_1:{ctor:"[]"}}}},{ctor:"[]"}),_1:{ctor:"::",_0:_(ha,{ctor:"[]"},{ctor:"::",_0:Vi("Task"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}),_1:{ctor:"::",_0:qj(e),_1:{ctor:"[]"}}}),_1:{ctor:"[]"}}),_1:{ctor:"[]"}})}),qD=function(t){return _(ua,{ctor:"::",_0:Oa("overlay"),_1:{ctor:"::",_0:dk(ID),_1:{ctor:"::",_0:xS(function(t){return cj}),_1:{ctor:"[]"}}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("modal fixed-center"),_1:{ctor:"::",_0:dk(cj),_1:{ctor:"[]"}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("modal-content"),_1:{ctor:"[]"}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("input-field"),_1:{ctor:"[]"}},{ctor:"::",_0:_(ma,{ctor:"::",_0:Oa("materialize-textarea auto-focus"),_1:{ctor:"::",_0:Ka(RM(t)),_1:{ctor:"::",_0:Da(sI(t)),_1:{ctor:"[]"}}}},{ctor:"[]"}),_1:{ctor:"::",_0:_(ha,{ctor:"::",_0:Oa("active"),_1:{ctor:"[]"}},{ctor:"::",_0:Vi("New Task"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}),_1:{ctor:"::",_0:Mj,_1:{ctor:"[]"}}}),_1:{ctor:"[]"}}),_1:{ctor:"[]"}})},ND=r(function(t,r){var e=function(r){Oo(t),Oo(r);return m.cmp(r,t)<0?"Overdue":_(Yj,t,r)},n=_(mi["?="],_(mi["?|>"],XE(r),e),"");return{displayText:n,isOverDue:m.eq(n,"Overdue"),startEditingMsg:NM(r)}}),MD=function(t){return _(ua,{ctor:"::",_0:Ia(_(k["++"],"edit-schedule-button-",t.key)),_1:{ctor:"::",_0:Oa("layout horizontal center-center"),_1:{ctor:"::",_0:Qa(t.reminder.startEditingMsg),_1:{ctor:"[]"}}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:$a({ctor:"::",_0:_(rk["=>"],"overdue",t.reminder.isOverDue),_1:{ctor:"::",_0:_(rk["=>"],"reminder-text",!0),_1:{ctor:"[]"}}}),_1:{ctor:"[]"}},{ctor:"::",_0:Vi(t.reminder.displayText),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(MC,"schedule",{ctor:"::",_0:t.tabindexAV,_1:{ctor:"[]"}}),_1:{ctor:"[]"}}})},jD=function(t){return _(r_,{ctor:"::",_0:Ia(_(k["++"],"edit-project-button-",t.key)),_1:{ctor:"::",_0:Ua({ctor:"::",_0:_(rk["=>"],"height","24px"),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:Oa("small padding-0 margin-0 shrink"),_1:{ctor:"::",_0:t.tabindexAV,_1:{ctor:"::",_0:Qa(t.showProjectDropdownMsg),_1:{ctor:"[]"}}}}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("title primary-text-color"),_1:{ctor:"[]"}},{ctor:"::",_0:Vi(t.projectDisplayName),_1:{ctor:"[]"}}),_1:{ctor:"[]"}})},DD=function(t){return _(r_,{ctor:"::",_0:Ia(_(k["++"],"edit-context-button-",t.key)),_1:{ctor:"::",_0:Ua({ctor:"::",_0:_(rk["=>"],"height","24px"),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:Oa("small padding-0 margin-0 shrink"),_1:{ctor:"::",_0:t.tabindexAV,_1:{ctor:"::",_0:Qa(t.showContextDropdownMsg),_1:{ctor:"[]"}}}}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("title primary-text-color"),_1:{ctor:"[]"}},{ctor:"::",_0:Vi(t.contextDisplayName),_1:{ctor:"[]"}}),_1:{ctor:"[]"}})},RD=function(t){return _(MC,"more_vert",{ctor:"::",_0:Ia(_(k["++"],"todo-more-menu-button-",t.key)),_1:{ctor:"::",_0:pk(cj),_1:{ctor:"::",_0:Qa(t.onMoreMenuClicked),_1:{ctor:"::",_0:t.tabindexAV,_1:{ctor:"[]"}}}}})},BD=function(t){return _(jC,"done",{ctor:"::",_0:$a({ctor:"::",_0:_(rk["=>"],"done-icon",!0),_1:{ctor:"::",_0:_(rk["=>"],"is-done",t.isDone),_1:{ctor:"[]"}}}),_1:{ctor:"::",_0:pk(cj),_1:{ctor:"::",_0:Qa(t.toggleDoneMsg),_1:{ctor:"::",_0:t.tabindexAV,_1:{ctor:"[]"}}}}})},LD=function(t){var r=_(mi[".|>"],s(qc,Lc,bD,t),Vi),e=function(t){return _(ia,{ctor:"::",_0:Ra(t),_1:{ctor:"::",_0:Ba("_blank"),_1:{ctor:"::",_0:pk(cj),_1:{ctor:"[]"}}}},{ctor:"::",_0:Vi(tr(_(es,30,yD(t)))),_1:{ctor:"[]"}})},n=_(mi[".|>"],s(Mc,Lc,bD,t),function(t){return e(function(t){return t.match}(t))});return _(S_,r,n)},PD=function(t){return _(ua,{ctor:"::",_0:$a({ctor:"::",_0:_(rk["=>"],"todo-item focusable-list-item collection-item",!0),_1:{ctor:"::",_0:_(rk["=>"],"selected",t.isSelected),_1:{ctor:"::",_0:_(rk["=>"],"can-be-focused",t.canBeFocused),_1:{ctor:"[]"}}}}),_1:{ctor:"::",_0:Cf(t.onFocusIn),_1:{ctor:"::",_0:t.tabindexAV,_1:{ctor:"::",_0:SS(t.onKeyDownMsg),_1:{ctor:"::",_0:_(Sa,"data-key",t.key),_1:{ctor:"[]"}}}}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("display-text-container layout horizontal"),_1:{ctor:"::",_0:Xa(t.startEditingMsg),_1:{ctor:"[]"}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("self-start"),_1:{ctor:"[]"}},{ctor:"::",_0:BD(t),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("display-text"),_1:{ctor:"[]"}},LD(t.displayText)),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("self-start"),_1:{ctor:"[]"}},{ctor:"::",_0:RD(t),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("layout horizontal end-justified"),_1:{ctor:"[]"}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Ua({ctor:"::",_0:_(rk["=>"],"margin","0 8px"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}},{ctor:"::",_0:MD(t),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Ua({ctor:"::",_0:_(rk["=>"],"padding","0 8px"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}},{ctor:"::",_0:DD(t),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Ua({ctor:"::",_0:_(rk["=>"],"padding","0 8px"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}},{ctor:"::",_0:jD(t),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}}),_1:{ctor:"[]"}}})},FD=function(t){return{ctor:"_Tuple2",_0:t.key,_1:PD(t)}},$D=function(t){var r=_(rk[">>?="],function(t){return Y_(or(t))},"< empty >"),e=Dc("\\n\\n\\n(.|\n)*");return f(Nc,Bc(1),e,function(t){return"\n..."},r(EE(t)))},UD=e(function(t,r,e){var n=fM,o=gM(dO(e)),c=r?o(RO):cj,u=o(DO),i=kE(e),a=FE(e),s=es(15),f=_(gr,"#",s(_(mi["?="],_(rk[">>?"],_(mi["#"],le,t.projectByIdDict),Gx)(a),""))),l=s(_(gr,"@",_(mi["?="],_(rk[">>?"],_(mi["#"],le,t.contextByIdDict),Yx)(i),"Inbox"))),d=_S(e),p=JM(d),h=t.now,v=_(ND,h,e),m=function(t){var r=t;if(!bS(r))return nj.noOp;switch(r.key.ctor){case"Space":return o(CO);case"CharE":return c;case"CharD":return p;case"Delete":return u;case"CharP":return CM(e);case"CharC":return qM(e);case"CharR":return v.startEditingMsg;case"CharG":return o(IO);case"CharS":return n(yC(d));default:return nj.noOp}},g=function(){return xa(r?0:-1)}();return{isDone:xE(e),key:d,isDeleted:UE(e),onKeyDownMsg:m,displayText:$D(e),projectDisplayName:f,contextDisplayName:l,showContextDropdownMsg:qM(e),showProjectDropdownMsg:CM(e),startEditingMsg:c,canBeFocused:r,toggleDoneMsg:p,reminder:v,onFocusIn:o(qO),tabindexAV:g,isSelected:_(oi,d,t.selectedEntityIdSet),onMoreMenuClicked:n(_C(d))}}),JD=(e(function(t,r,e){return{displayText:t,isOverDue:r,startEditingMsg:e}}),function(t){var r=_(jC,t.archive.iconName,{ctor:"::",_0:dk(t.archive.onClick),_1:{ctor:"::",_0:t.tabindexAV,_1:{ctor:"[]"}}}),e=t.isEditable?_(jC,"create",{ctor:"::",_0:dk(t.startEditingMsg),_1:{ctor:"::",_0:t.tabindexAV,_1:{ctor:"[]"}}}):_(la,{ctor:"[]"},{ctor:"[]"}),n=t.archive.isArchived?r:e;return _(ua,{ctor:"::",_0:t.tabindexAV,_1:{ctor:"::",_0:Cf(t.onFocusIn),_1:{ctor:"::",_0:SS(t.onKeyDownMsg),_1:{ctor:"::",_0:$a({ctor:"::",_0:_(rk["=>"],"entity-item focusable-list-item collection-item",!0),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("layout horizontal justified center"),_1:{ctor:"[]"}},{ctor:"::",_0:_(Qi,{ctor:"::",_0:Oa("font-nowrap ellipsis"),_1:{ctor:"[]"}},{ctor:"::",_0:_(jj,_(k["++"],t.namePrefix,t.name),t.count),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("layout horizontal center"),_1:{ctor:"[]"}},{ctor:"::",_0:n,_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}),_1:{ctor:"[]"}})}),HD=function(t){return{ctor:"_Tuple2",_0:t.id,_1:JD(t)}},VD=r(function(t,r){return s(ms,"div",{ctor:"::",_0:Oa("collection"),_1:{ctor:"[]"}},{ctor:"::",_0:{ctor:"_Tuple2",_0:r.id,_1:JD(r)},_1:_(mi[".|>"],r.todoList,t)})}),zD=r(function(t,r){return{ctor:"_Tuple2",_0:r.id,_1:_(VD,t,r)}}),WD=r(function(t,r){var e=_(At,75,r),n=it(r);return{ctor:"::",_0:{ctor:"_Tuple2",_0:t,_1:s(ms,"div",{ctor:"::",_0:Oa("todo-list collection"),_1:{ctor:"[]"}},{ctor:"::",_0:{ctor:"_Tuple2",_0:t,_1:_(ua,{ctor:"::",_0:Oa("collection-item"),_1:{ctor:"[]"}},{ctor:"::",_0:_(Qi,{ctor:"[]"},{ctor:"::",_0:_(jj,t,n),_1:{ctor:"[]"}}),_1:{ctor:"[]"}})},_1:e})},_1:{ctor:"[]"}}}),GD=function(t){return HD(t)},KD=r(function(t,r){return _(zD,t,r)}),XD=e(function(t,r,e){var n=function(t){return _(mi["?="],_(mi["?|>"],r,uO(t)),!1)},o=function(t){var r=n(t)?0:-1;return xa(r)},c=function(t){var r=t;return s(Wj,o,r.todoList,r.context)},u=function(t){var r=t;return s(Gj,o,r.todoList,r.project)},i=function(t){var r=n(dO(t));return FD(s(UD,e,r,t))},a=function(t){return _(mi[".|>"],t,function(t){return _(KD,i,c(t))})},f=function(t){return _(mi[".|>"],t,function(t){return _(KD,i,u(t))})},l=pt(i),d=t;switch(d.ctor){case"ContextRoot":var p=GD(c(d._0));return{ctor:"::",_0:p,_1:f(d._1)};case"ProjectRoot":var p=GD(u(d._0));return{ctor:"::",_0:p,_1:a(d._1)};case"ContextForest":return a(d._0);case"ProjectForest":return f(d._0);default:return _(WD,d._0,l(d._1))}}),QD=e(function(t,r,e){var n=_(oN,t,r),o=WO(n),c=_(YC,o,r);return s(ms,"div",{ctor:"::",_0:Oa("entity-list focusable-list"),_1:{ctor:"::",_0:SS(SM(o)),_1:{ctor:"[]"}}},s(XD,n,c,e))}),YD=function(t){return _(ua,{ctor:"::",_0:Ia("firebase-container"),_1:{ctor:"[]"}},{ctor:"::",_0:s(zi,"firebase-auth",{ctor:"::",_0:Ia("firebase-auth"),_1:{ctor:"::",_0:Zk(YM),_1:{ctor:"[]"}}},{ctor:"[]"}),_1:{ctor:"::",_0:s(zi,"firebase-messaging",{ctor:"::",_0:Ia("fb-messaging"),_1:{ctor:"::",_0:Dk(QM),_1:{ctor:"::",_0:Ek,_1:{ctor:"[]"}}}},{ctor:"[]"}),_1:{ctor:"::",_0:s(zi,"firebase-document",{ctor:"::",_0:_(Sa,"path",".info/connected"),_1:{ctor:"::",_0:Mk(XM),_1:{ctor:"[]"}}},{ctor:"[]"}),_1:{ctor:"[]"}}}})},ZD=(pt(g(Sa)),function(t){var r=DM,e=IM,n=gM(t.entity),o=function(t){return n(NO(t))},c=n(jO);return _(ua,{ctor:"::",_0:Oa("overlay"),_1:{ctor:"::",_0:dk(r),_1:{ctor:"::",_0:xS(function(t){return cj}),_1:{ctor:"[]"}}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("modal fixed-center"),_1:{ctor:"::",_0:dk(cj),_1:{ctor:"[]"}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("modal-content"),_1:{ctor:"[]"}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("input-field"),_1:{ctor:"::",_0:xS(function(t){return cj}),_1:{ctor:"::",_0:dk(cj),_1:{ctor:"[]"}}}},{ctor:"::",_0:_(va,{ctor:"::",_0:Oa("auto-focus"),_1:{ctor:"::",_0:Fa(!0),_1:{ctor:"::",_0:Da(t.name),_1:{ctor:"::",_0:gS(e),_1:{ctor:"::",_0:Ka(o),_1:{ctor:"[]"}}}}}},{ctor:"[]"}),_1:{ctor:"::",_0:_(ha,{ctor:"::",_0:Oa("active"),_1:{ctor:"[]"}},{ctor:"::",_0:Vi(t.nameLabel),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}),_1:{ctor:"::",_0:_(Nj,t.isArchived,c),_1:{ctor:"[]"}}}),_1:{ctor:"[]"}}),_1:{ctor:"[]"}})}),tR=r(function(t,r){var e=s(AC,t.input,Yq(r),Xq(r)),n=_(mi["?="],_(mi["?|>"],lt(e),Er),OC),o=wC(n),c=function(t){return"Enter"===t.key.ctor?mM(qC(n)):nj.noOp};return _(ua,{ctor:"::",_0:Oa("overlay"),_1:{ctor:"::",_0:xS(c),_1:{ctor:"::",_0:dk(DM),_1:{ctor:"[]"}}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Ia("launch-bar-container"),_1:{ctor:"::",_0:Oa("layout horizontal"),_1:{ctor:"::",_0:_(Sa,"onclick","console.log('focusing');document.getElementById('hidden-input').focus(); event.stopPropagation(); event.preventDefault();"),_1:{ctor:"::",_0:Ka(function(r){return mM(_(CC,t,r))}),_1:{ctor:"[]"}}}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("flex-auto ellipsis"),_1:{ctor:"[]"}},{ctor:"::",_0:Vi(o),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("no-wrap input typing"),_1:{ctor:"[]"}},{ctor:"::",_0:Vi(t.input),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(va,{ctor:"::",_0:Ia("hidden-input"),_1:{ctor:"::",_0:Oa("auto-focus"),_1:{ctor:"::",_0:Fa(!0),_1:{ctor:"::",_0:ja(t.input),_1:{ctor:"[]"}}}}},{ctor:"[]"}),_1:{ctor:"[]"}}}}),_1:{ctor:"[]"}})}),rR=function(t){return Fr(function(r){return _(mi["?="],t(r),Ur(r))})},eR=(b(Fr),function(t){return Lr(function(r){return _(mi["?="],t(r),Cr)})}),nR=(r(function(t,r){return Fr(function(e){return _(mi["?="],_(mi["?|>"],t(e),r),e)})}),r(function(t,r){return Fr(function(e){return _(r,t(e),e)})}),r(function(t,r){return Hr(function(e){return _(r,t(e),e)})}),r(function(t,r){return Fr(function(e){return _(r,t(e),Ur(e))})})),oR=(r(function(t,r){return Fr(function(e){return _(YT,Ur(e),_(mi["?="],_(mi["?|>"],t(e),r),T))})}),function(t){return{ctor:"::",_0:t,_1:{ctor:"[]"}}}),cR=function(t){return s(K_,function(r){var e=xw(t);return"::"===e.ctor&&"custom-sync"===e._0&&"[]"===e._1.ctor?{ctor:"::",_0:kM(uj),_1:{ctor:"[]"}}:{ctor:"::",_0:kM(aj),_1:{ctor:"[]"}}},function(t){return oR(TM(t))},EO(t))},uR=function(t){return cR(Cw(t.href))},iR=function(t){var r=wq(t);return"EntityListView"===r.ctor?cO(r._0):{ctor:"::",_0:"custom-sync",_1:{ctor:"[]"}}},aR=r(function(t,r){return z(_(Ow,iR(r),Aw))}),_R=_(rk[">>>"],aR,W(Sw)),sR=function(t){return tO(_(k["++"],"#todo-more-menu-button-",t))},fR=r(function(t,r){var e=_(M_,function(r){var e=r;return"Task"===e.ctor&&_(sS,t,e._0)},cN(r));return s(K_,function(e){return vj(_(mN,t,r))},_(mi["#"],vN,r),e)}),lR=b(fR),dR=function(t){return _(mi["?="],_(mi["?|>"],FC(t.timeTracker),lR(t)),t)},pR=function(t){return _(rk[">>?="],W(t),Cr)},hR=Fr,vR=Pr,mR=Hr,gR=_(rk[">>>"],NS,Hr),yR=_(rk[">>>"],BS,Hr),bR=_(HS,function(t){return t.timeTracker},r(function(t,r){return m.update(r,{timeTracker:t})})),wR=Ar.outgoingPort("showTodoReminderNotification",function(t){return{title:t.title,tag:t.tag,data:{id:t.data.id}}}),TR=function(t){var r=t,e=r._0,n=function(){var t=_S(e);return{title:EE(e),tag:t,data:{id:t}}}(),o={ctor:"::",_0:wR(n),_1:{ctor:"::",_0:uC({ctor:"_Tuple0"}),_1:{ctor:"[]"}}};return _(qr["!"],r._1,o)},kR=Ar.incomingPort("notificationClicked",_(an,function(t){return _(an,function(r){return sn({action:t,data:r})},_(yn,"data",_(an,function(t){return sn({id:t})},_(yn,"id",xn))))},_(yn,"action",xn))),SR=Ar.outgoingPort("showRunningTodoNotification",function(t){return{tag:t.tag,title:t.title,body:t.body,actions:K.toArray(t.actions).map(function(t){return{title:t.title,action:t.action}}),data:{id:t.data.id,notificationClickedPort:t.data.notificationClickedPort,skipFocusActionList:K.toArray(t.data.skipFocusActionList).map(function(t){return t})}}}),xR=function(t){var e=t,n=r(function(t,r){var e=tD(t.elapsedTime),n=_S(r);return{tag:n,title:_(k["++"],"You have been working for ",e),body:EE(r),actions:{ctor:"::",_0:{title:"Continue",action:"continue"},_1:{ctor:"::",_0:{title:"Stop",action:"stop"},_1:{ctor:"[]"}}},data:{id:n,notificationClickedPort:"onRunningTodoNotificationClicked",skipFocusActionList:{ctor:"::",_0:"continue",_1:{ctor:"[]"}}}}});return _(pR,SR,_(mi["?+>"],e._0,function(t){return _(mi["?|>"],_(Aq,t.todoId,e._1),n(t))}))},ER=function(t){return hR(function(r){return _(di,{ctor:"_Tuple2",_0:xr,_1:xR},s(PS,bR,UC(t),r))})},AR=e(function(t,r,e){var n=e;switch(n.ctor){case"OnShowMoreMenu":var o=n._0;return function(t){return _(Pr,sR(o),_(Hr,Cq(NI(o)),t))};case"UpdateReminderForm":return Hr(function(t){return Cq(CI(t))}(_(gI,n._1,n._0)));case"ToggleRunning":return _(yR,bR,_(WC,n._0,r));case"InitRunning":return _(gR,bR,_(zC,n._0,r));case"SwitchOrStartRunning":return _(yR,bR,_(GC,n._0,r));case"TogglePaused":return _(yR,bR,KC(r));case"StopRunning":return _(gR,bR,JC);case"GotoRunning":return function(r){return _(t,iM,_(mR,dR,r))};case"UpdateTimeTracker":return ER(r);case"Upsert":var c=n._0;return mR(function(t){return HE(c)&&_(BC,c,t.timeTracker)?s(NS,bR,JC,t):t});case"OnReminderNotificationClicked":var u=n._0.data.id;return m.eq(n._0.action,"mark-done")?function(t){return _(vR,iC(u),_(Fr,_(LN,sA,u),t))}:function(r){return t(fM(pC(r)))}(u);case"ShowReminderOverlayForTodoId":return Hr(Hq(n._0));case"RunningNotificationResponse":var i=n._0,u=i.data.id;return function(r){return _(t,aM(u),function(){switch(i.action){case"stop":return t(lM);case"continue":return T;default:return t(pM)}}()(r))};default:return rR(_(rk[">>?"],FN,Fr(TR)))}}),OR=Ar.incomingPort("onRunningTodoNotificationClicked",_(an,function(t){return _(an,function(r){return sn({action:t,data:r})},_(yn,"data",_(an,function(t){return sn({id:t})},_(yn,"id",xn))))},_(yn,"action",xn))),IR=function(t){return Mr({ctor:"::",_0:kR(function(t){return fM(hC(t))}),_1:{ctor:"::",_0:OR(function(t){return fM(vC(t))}),_1:{ctor:"::",_0:_(go,1e3,sM(lC)),_1:{ctor:"::",_0:_(go,3e4,function(t){return fM(aC)}),_1:{ctor:"[]"}}}}})},CR=function(t){return _(ua,{ctor:"::",_0:Oa("layout vertical"),_1:{ctor:"::",_0:Ua({ctor:"::",_0:_(rk["=>"],"position","relative"),_1:{ctor:"::",_0:_(rk["=>"],"top","5px"),_1:{ctor:"[]"}}}),_1:{ctor:"[]"}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("ellipsis"),_1:{ctor:"[]"}},{ctor:"::",_0:Vi(t.displayText),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("layout horizontal start"),_1:{ctor:"::",_0:Ua({ctor:"::",_0:_(rk["=>"],"position","relative"),_1:{ctor:"::",_0:_(rk["=>"],"top","-5px"),_1:{ctor:"[]"}}}),_1:{ctor:"[]"}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("self-center"),_1:{ctor:"::",_0:Ua({ctor:"::",_0:_(rk["=>"],"margin-right","1rem"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}},{ctor:"::",_0:Vi(t.displayTime),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(jC,t.playPauseIconName,{ctor:"::",_0:Qa(t.onTogglePause),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(jC,"stop",{ctor:"::",_0:Qa(t.onStop),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}}),_1:{ctor:"[]"}}})},qR=r(function(t,r){var e=_(mi["?="],_(mi["?|>"],_(Aq,r.todoId,t),EE),r.todoId),n=function(){var e=r.state;return"Running"===e.ctor?{ctor:"_Tuple2",_0:r.totalTime+(t.now-e._0),_1:"pause"}:{ctor:"_Tuple2",_0:r.totalTime,_1:"play_arrow"}}(),o=n._0,c=n._1;return{displayText:e,displayTime:rD(o),playPauseIconName:c,onStop:lM,onTogglePause:dM}}),NR=function(t){return _(mi["?|>"],t.timeTracker,function(r){return CR(_(qR,t,r))})},MR=(r(function(t,r){return{displayText:t,displayTime:r}}),r(function(t,r){return _(n_,{ctor:"[]"},{ctor:"::",_0:_(o_,{ctor:"[]"},{ctor:"::",_0:_(ia,{ctor:"::",_0:Ba("_blank"),_1:{ctor:"::",_0:Ra(t),_1:{ctor:"[]"}}},{ctor:"::",_0:Vi(r),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}),_1:{ctor:"[]"}})})),jR=function(t){var r=fN(t),e=_(mi["?="],_(mi["?|>"],r,function(t){return _(Sa,"src",Ck(t))}),Tk("account-circle")),n=_(mi["?="],_(mi["?|>"],r,function(t){return _(n_,{ctor:"::",_0:Qa(GM),_1:{ctor:"[]"}},{ctor:"::",_0:Vi("SignOut"),_1:{ctor:"[]"}})}),_(n_,{ctor:"::",_0:Qa(KM),_1:{ctor:"[]"}},{ctor:"::",_0:Vi("SignIn"),_1:{ctor:"[]"}}));return _(u_,{ctor:"::",_0:bk,_1:{ctor:"::",_0:_(ik,"noOverlap",!0),_1:{ctor:"::",_0:_(ik,"closeOnActivate",!0),_1:{ctor:"[]"}}}},{ctor:"::",_0:s(zi,"iron-icon",{ctor:"::",_0:e,_1:{ctor:"::",_0:Oa("account"),_1:{ctor:"::",_0:yk,_1:{ctor:"[]"}}}},{ctor:"[]"}),_1:{ctor:"::",_0:_(c_,{ctor:"::",_0:Oa(""),_1:{ctor:"::",_0:gk,_1:{ctor:"[]"}}},{ctor:"::",_0:n,_1:{ctor:"::",_0:_(MR,"https://groups.google.com/forum/#!forum/simplegtd","Forums/Discuss"),_1:{ctor:"::",_0:_(MR,"https://github.com/jigargosar/elm-simple-gtd/blob/master/CHANGELOG.md",_(k["++"],"Changelog v",t.appVersion)),_1:{ctor:"::",_0:_(MR,"https://github.com/jigargosar/elm-simple-gtd","Github"),_1:{ctor:"[]"}}}}}),_1:{ctor:"[]"}}})},DR=r(function(t,r){return{ctor:"::",_0:_(wk,{ctor:"::",_0:Tk("menu"),_1:{ctor:"::",_0:xa(-1),_1:{ctor:"::",_0:_(Sa,"drawer-toggle",""),_1:{ctor:"::",_0:Qa(VM),_1:{ctor:"::",_0:Oa("hide-when-wide"),_1:{ctor:"[]"}}}}}},{ctor:"[]"}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("flex-auto"),_1:{ctor:"::",_0:Ua({ctor:"::",_0:_(rk["=>"],"max-width","80%"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}},t),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("flex-auto"),_1:{ctor:"[]"}},{ctor:"[]"}),_1:{ctor:"::",_0:jR(r),_1:{ctor:"[]"}}}}}}),RR=r(function(t,r){var e=t.viewName;return{ctor:"::",_0:_(Qi,{ctor:"::",_0:Oa("ellipsis title"),_1:{ctor:"::",_0:Ca(e),_1:{ctor:"[]"}}},{ctor:"::",_0:Vi(e),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}),BR=r(function(t,r){var e=_(mi["?="],_(mi["?|>"],NR(r),oR),_(RR,t,r));return _(DR,e,r)}),LR=r(function(t,r){var e=uN(r)?{ctor:"::",_0:_(Sa,"condenses",""),_1:{ctor:"::",_0:_(Sa,"reveals",""),_1:{ctor:"[]"}}}:{ctor:"::",_0:_(Sa,"fixed",""),_1:{ctor:"[]"}},n=_(k["++"],{ctor:"::",_0:Ia("main-header"),_1:{ctor:"::",_0:_(Sa,"slot","header"),_1:{ctor:"::",_0:_(Sa,"effects","waterfall"),_1:{ctor:"[]"}}}},e);return _(wa,n,{ctor:"::",_0:_(ka,{ctor:"::",_0:Ua({ctor:"::",_0:_(rk["=>"],"color","white"),_1:{ctor:"::",_0:_(rk["=>"],"background-color",t.header.backgroundColor),_1:{ctor:"[]"}}}),_1:{ctor:"[]"}},_(BR,t,r)),_1:{ctor:"[]"}})}),PR=function(t){var r=t.developmentMode?{ctor:"_Tuple2",_0:_(k["++"],"Dev v",t.appVersion),_1:_(k["++"],"v",t.appVersion)}:{ctor:"_Tuple2",_0:"SimpleGTD.com",_1:_(k["++"],"v",t.appVersion)},e=r._0;return _(ua,{ctor:"::",_0:Ia("left-header"),_1:{ctor:"[]"}},{ctor:"::",_0:_(ua,{ctor:"[]"},{ctor:"::",_0:Vi(e),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("small layout horizontal "),_1:{ctor:"[]"}},{ctor:"::",_0:_(ia,{ctor:"::",_0:Ba("_blank"),_1:{ctor:"::",_0:Ra("https://github.com/jigargosar/elm-simple-gtd/blob/master/CHANGELOG.md"),_1:{ctor:"::",_0:xa(-1),_1:{ctor:"[]"}}}},{ctor:"::",_0:Vi(_(k["++"],"v",t.appVersion)),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(ia,{ctor:"::",_0:Ba("_blank"),_1:{ctor:"::",_0:Ra("https://groups.google.com/forum/#!newtopic/simplegtd"),_1:{ctor:"::",_0:xa(-1),_1:{ctor:"[]"}}}},{ctor:"::",_0:Vi("Discuss"),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(ia,{ctor:"::",_0:Ba("_blank"),_1:{ctor:"::",_0:Ra("mailto:jigar.gosar@gmail.com"),_1:{ctor:"::",_0:xa(-1),_1:{ctor:"[]"}}}},{ctor:"::",_0:Vi("Feedback"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}}),_1:{ctor:"[]"}}})},FR=r(function(t,r){return _(ya,{ctor:"::",_0:_(ik,"swipeOpen",!0),_1:{ctor:"::",_0:_(Sa,"slot","drawer"),_1:{ctor:"[]"}}},{ctor:"::",_0:_(Ta,{ctor:"::",_0:_(Sa,"has-scrolling-region",""),_1:{ctor:"[]"}},{ctor:"::",_0:_(wa,{ctor:"::",_0:_(ik,"fixed",!0),_1:{ctor:"::",_0:_(Sa,"slot","header"),_1:{ctor:"[]"}}},{ctor:"::",_0:_(ka,{ctor:"::",_0:Ua({ctor:"::",_0:_(rk["=>"],"color","white"),_1:{ctor:"::",_0:_(rk["=>"],"background-color",t.header.backgroundColor),_1:{ctor:"[]"}}}),_1:{ctor:"[]"}},{ctor:"::",_0:_(ua,{ctor:"[]"},{ctor:"::",_0:_(wk,{ctor:"::",_0:Tk("menu"),_1:{ctor:"::",_0:xa(-1),_1:{ctor:"::",_0:_(Sa,"drawer-toggle",""),_1:{ctor:"::",_0:Qa(VM),_1:{ctor:"[]"}}}}},{ctor:"[]"}),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:PR(r),_1:{ctor:"[]"}}}),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(Jj,t,r),_1:{ctor:"[]"}}}),_1:{ctor:"[]"}})}),$R=r(function(t,r){var e=zM(ZI);return _(ua,{ctor:"::",_0:Oa("full-view fixed-top"),_1:{ctor:"::",_0:dk(e),_1:{ctor:"[]"}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("fixed-bottom top-shadow static"),_1:{ctor:"[]"}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("font-headline"),_1:{ctor:"[]"}},{ctor:"::",_0:Vi(t.text),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("layout horizontal flex-auto-children"),_1:{ctor:"[]"}},r),_1:{ctor:"[]"}}}),_1:{ctor:"[]"}})}),UR=r(function(t,r){if("InitialView"===t.ctor){var e={onDismissClicked:zM(rC),onDoneClicked:zM(tC),onSnoozeClicked:zM(nC)};return _($R,r,{ctor:"::",_0:s(xk,"notification:do-not-disturb","dismiss",e.onDismissClicked),_1:{ctor:"::",_0:s(xk,"av:snooze","snooze",e.onSnoozeClicked),_1:{ctor:"::",_0:s(xk,"done","done!",e.onDoneClicked),_1:{ctor:"[]"}}}})}var n=function(t){return zM(eC(t))},e={snoozeFor15Min:n(cC(9e5)),snoozeFor1Hour:n(cC(36e5)),snoozeFor3Hours:n(cC(108e5)),snoozeTillTomorrow:n(oC)};return _($R,r,{ctor:"::",_0:s(xk,"av:snooze","15 min",e.snoozeFor15Min),_1:{ctor:"::",_0:s(xk,"av:snooze","1 hour",e.snoozeFor1Hour),_1:{ctor:"::",_0:s(xk,"av:snooze","3 hour",e.snoozeFor3Hours),_1:{ctor:"::",_0:s(xk,"av:snooze","tomorrow",e.snoozeTillTomorrow),_1:{ctor:"[]"}}}}})}),JR=function(t){var r=t.reminderOverlay;return"Active"===r.ctor?z(_(UR,r._0,r._1)):H},HR=function(t){return{onSelect:function(t){return cj},isSelected:function(t){return!1},itemKey:T,itemSearchText:T,itemView:Vi,onStateChanged:function(t){return cj},noOp:cj,onOutsideMouseDown:DM}},VR=function(t){return s(gA,{ctor:"::",_0:"Comming Soon",_1:{ctor:"::",_0:"Split",_1:{ctor:"::",_0:"Delete",_1:{ctor:"[]"}}}},t.menuState,HR())},zR=(r(function(t,r){return{type_:t,displayName:r}}),function(t){return _(e_,{ctor:"::",_0:Ia("add-fab"),_1:{ctor:"::",_0:_(Sa,"icon","add"),_1:{ctor:"::",_0:_(Sa,"mini",""),_1:{ctor:"::",_0:Qa(FM),_1:{ctor:"::",_0:xa(-1),_1:{ctor:"[]"}}}}}},{ctor:"[]"})}),WR=r(function(t,r){return _(ua,{ctor:"::",_0:Ia("main-content"),_1:{ctor:"[]"}},{ctor:"::",_0:function(){var e=wq(r);return"EntityListView"===e.ctor?s(QD,e._0,r,t):Vj(r)}(),_1:{ctor:"[]"}})}),GR=function(t){var r=iN(t),e=Bj(t);return _(ba,{ctor:"::",_0:_(ik,"forceNarrow",r),_1:{ctor:"::",_0:_(mk,"narrow",HM),_1:{ctor:"[]"}}},{ctor:"::",_0:_(FR,e,t),_1:{ctor:"::",_0:_(Ta,{ctor:"::",_0:_(Sa,"has-scrolling-region",""),_1:{ctor:"[]"}},{ctor:"::",_0:_(LR,e,t),_1:{ctor:"::",_0:_(WR,e,t),_1:{ctor:"[]"}}}),_1:{ctor:"[]"}}})},KR=_(ua,{ctor:"::",_0:Oa("overlay"),_1:{ctor:"::",_0:dk(oj),_1:{ctor:"[]"}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Ia("welcome"),_1:{ctor:"::",_0:Oa("modal fixed-center"),_1:{ctor:"[]"}}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("modal-content"),_1:{ctor:"[]"}},{ctor:"::",_0:_(Xi,{ctor:"[]"},{ctor:"::",_0:Vi("Welcome to SimpleGTD.com"),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("divider"),_1:{ctor:"[]"}},{ctor:"[]"}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("row section"),_1:{ctor:"[]"}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("col s12 m6"),_1:{ctor:"[]"}},{ctor:"::",_0:_(la,{ctor:"::",_0:Oa("flow-text"),_1:{ctor:"[]"}},{ctor:"::",_0:Vi("Already have an account with us?"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("col s12 m6"),_1:{ctor:"[]"}},{ctor:"::",_0:_(ia,{ctor:"::",_0:Oa("btn"),_1:{ctor:"::",_0:Qa(KM),_1:{ctor:"[]"}}},{ctor:"::",_0:Vi("Signin"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("divider"),_1:{ctor:"[]"}},{ctor:"[]"}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("row section"),_1:{ctor:"[]"}},{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("col s12 m6"),_1:{ctor:"[]"}},{ctor:"::",_0:_(la,{ctor:"::",_0:Oa("flow-text"),_1:{ctor:"[]"}},{ctor:"::",_0:Vi("Or lets"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("col s12 m6"),_1:{ctor:"[]"}},{ctor:"::",_0:_(ia,{ctor:"::",_0:Oa("btn"),_1:{ctor:"::",_0:Qa(jM),_1:{ctor:"[]"}}},{ctor:"::",_0:Vi("Get Started"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}),_1:{ctor:"[]"}}}}}}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("divider"),_1:{ctor:"[]"}},{ctor:"[]"}),_1:{ctor:"::",_0:_(ua,{ctor:"::",_0:Oa("right-align"),_1:{ctor:"[]"}},{ctor:"::",_0:_(ia,{ctor:"::",_0:Oa("btn btn-flat"),_1:{ctor:"::",_0:Qa(DM),_1:{ctor:"[]"}}},{ctor:"::",_0:Vi("Skip creating sample items"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}}),_1:{ctor:"[]"}}),XR=function(t){var r=function(){var r=Nq(t);switch(r.ctor){case"LaunchBar":return _(tR,r._0,t);case"TaskMoreMenu":return VR(r._0);case"EditTodoContext":return _(AD,r._0,t);case"EditTodoProject":return _(OD,r._0,t);case"EditTodoReminder":return ED(r._0);case"FirstVisit":return KR;case"ActionList":return _(yj,t,r._0);case"EditProject":case"EditContext":return ZD(r._0);case"EditTask":return _(CD,r._0,t);case"NewTodo":return qD(r._0);default:return _(la,{ctor:"[]"},{ctor:"[]"})}}();return _(mt,T,{ctor:"::",_0:z(r),_1:{ctor:"::",_0:JR(t),_1:{ctor:"[]"}}})},QR=function(t){var r=_(k["++"],{ctor:"::",_0:GR(t),_1:{ctor:"::",_0:zR(),_1:{ctor:"[]"}}},XR(t));return _(ua,{ctor:"::",_0:Ia("app-view"),_1:{ctor:"[]"}},r)},YR=function(t){return _(ua,{ctor:"::",_0:Ia("root"),_1:{ctor:"[]"}},{ctor:"::",_0:YD(),_1:{ctor:"::",_0:QR(t),_1:{ctor:"[]"}}})},ZR=function(t){return eR(_(rk[">>?"],sN,Uk))},tB=function(t){return tO(_(k["++"],"#edit-schedule-button-",_S(t)))},rB=function(t){return tO(_(k["++"],"#edit-project-button-",_S(t)))},eB=function(t){return tO(_(k["++"],"#edit-context-button-",_S(t)))},nB=function(t){return _(mi["?|>"],sN(t),Hk(t.firebaseClient))},oB=function(t){return _(mi["?|>"],sN(t),Fk(t.firebaseClient))},cB=Pr,uB=function(t){return Fr(function(r){return function(){var e=r.reminderOverlay;if("Active"!==e.ctor)return Ur;var n=e._1,o=n.id,c=t;switch(c.ctor){case"Dismiss":return function(t){return _(Pr,iC(o),_(Sr,Uq,s(LN,ZE,o,t)))};case"ShowSnoozeOptions":return function(t){return Ur(_($q,n,t))};case"SnoozeTill":return function(t){return _(Pr,iC(o),_(Fr,_(PN,c._0,o),Ur(t)))};case"Close":return function(t){return Ur(Uq(t))};default:return function(t){return _(Pr,iC(o),_(Sr,Uq,s(LN,sA,o,t)))}}}()(r)})},iB=function(t){return Hr(nq(t))},aB=nj.focus(".entity-list .focusable-list-item[tabindex=0]"),_B=r(function(t,r){return Fr(_(UN,t,_S(r)))}),sB=(_(rk[">>>"],WS,Hr),Hr),fB=r(function(t,r){!function(){var r=t;t:do{switch(r.ctor){case"OnNowChanged":return H;case"OnTodoMsg":case"OnTodoMsgWithTime":if("UpdateTimeTracker"===r._0.ctor)return H;break t;default:break t}}while(!1)}();return r}),lB=function(t){return cB(_(no,t,so))},dB=(_(rk[">>>"],NS,sB),_(rk[">>>"],BS,sB),function(t){return Mr({ctor:"::",_0:_(go,1e3,wM),_1:{ctor:"::",_0:pS(bM),_1:{ctor:"::",_0:vS(yM),_1:{ctor:"::",_0:Ax(rj),_1:{ctor:"::",_0:zk(ZM),_1:{ctor:"::",_0:xT(t.keyComboModel),_1:{ctor:"::",_0:IR(),_1:{ctor:"[]"}}}}}}}})}),pB=Ar.outgoingPort("syncWithRemotePouch",function(t){return t}),hB=Ar.outgoingPort("persistLocalPref",function(t){return t}),vB=function(t){return function(r){return _(Hr,fB(t),function(){var r=t;switch(r.ctor){case"NOOP":return T;case"OnCommonMsg":return oO(r._0);case"OnPouchDBChange":return rR(_(rk[">>?"],_(rk[">>?"],_(GN,r._0,r._1),Sr(tj)),g(vB)));case"OnEntityUpsert":var e=r._0;return"Task"===e.ctor?mB(fC(e._0)):T;case"OnFirebaseChange":return Lr(_(Tq,r._0,r._1));case"OnSignIn":return function(t){return _(gB,DM,_(Pr,Bk({ctor:"_Tuple0"}),t))};case"SignOut":return Pr(Lk({ctor:"_Tuple0"}));case"OnUserChanged":var n=r._0;return function(t){return _(ZR,n,_(eR,nB,_(eR,oB,_(Hr,SN(n),t))))};case"OnFCMTokenChanged":return function(t){return _(eR,oB,_(Hr,NN(r._0),t))};case"OnFirebaseConnectionChanged":return function(t){return _(eR,oB,_(Hr,MN(r._0),t))};case"OnSetDomFocusToFocusInEntity":return gB(aB);case"OnEntityListKeyDown":var o=r._0;switch(r._1.key.ctor){case"ArrowUp":return function(t){return _(gB,iM,_(Hr,_(gN,-1,o),t))};case"ArrowDown":return function(t){return _(gB,iM,_(Hr,_(gN,1,o),t))};default:return T}case"ToggleDrawer":return Hr(_N);case"OnLayoutNarrowChanged":return Hr(aN(r._0));case"RemotePouchSync":return function(t){return _(Lr,function(t){return pB(function(t){return t.pouchDBRemoteSyncURI}(t))},_(gB,IM,t))};case"ToggleShowDeletedEntity":return Hr(function(t){return m.update(t,{showDeleted:!t.showDeleted})});case"TodoAction":return T;case"ReminderOverlayAction":return uB(r._0);case"ToggleTodoDone":return Fr(_(LN,rA,r._0));case"SetTodoContext":return function(t){return _(gB,DM,s(_B,cA(r._0),r._1,t))};case"SetTodoProject":return function(t){return _(gB,DM,s(_B,eA(r._0),r._1,t))};case"NewTodoTextChanged":return Hr(_(CN,r._0,r._1));case"OnDeactivateEditingMode":return function(t){return _(gB,aB,_(Hr,Mq,t))};case"OnCreateDefaultEntitiesWithResult":_(U,"result",r._0);return T;case"OnCreateDefaultEntities":var c=_(Is,MM,_(As,"https://firebasestorage.googleapis.com/v0/b/simple-gtd-prod.appspot.com/o/public%2Fwelcome-entities.json?alt=media",un));return function(t){return _(cB,c,_(gB,DM,_(sB,function(t){return _(RN,"use `ArrowUp` and `ArrowDown` keys to focus item",_(RN,"press `r` to set schedule/reminder",_(RN,"press `p` to set project",_(RN,"press `c` to set context",_(RN,"press `e` to edit text",_(RN,"press `i` to create and add to Inbox",_(RN,"Click `+` or press `q` for quick add",_(WN,"zz SomeDay/Maybe",_(WN,"3 Waiting For",_(WN,"2 Next Actions",_(WN,"1 Now",_(HN,"GTD: Learn",_(HN,"Explore SimpleGTD.com",t)))))))))))))},t)))};case"StartEditingReminder":var u=r._0;return function(t){return _(Pr,tB(u),_(Hr,Fq(u),t))};case"StartEditingContext":var i=r._0;return function(t){return _(Pr,eB(i),_(Hr,Lq(i),t))};case"StartEditingProject":var a=r._0;return function(t){return _(Pr,rB(a),_(Hr,Pq(a),t))};case"UpdateTodoForm":return Hr(function(t){return Cq(PI(t))}(_(pI,r._1,r._0)));case"OnEditTodoProjectMenuStateChanged":return function(t){return XA(_(Hr,function(t){return Cq(OI(t))}(_(lI,r._1,r._0)),t))};case"OnEditTodoContextMenuStateChanged":return function(t){return XA(_(Hr,function(t){return Cq(II(t))}(_(lI,r._1,r._0)),t))};case"UpdateRemoteSyncFormUri":return Hr(function(t){return Cq(EI(t))}(m.update(r._0,{uri:r._1})));case"OnSetViewType":return Hr(Iq(r._0));case"OnSetEntityListView":return Hr(mj(r._0));case"OnNowChanged":return iB(r._0);case"OnKeyboardMsg":return function(t){return _(ZA,".entity-list .focusable-list-item[tabindex=0]",_(Hr,eq(dS(r._0)),t))};case"OnSaveCurrentForm":return function(t){return _(gB,DM,_(Fr,XN,t))};case"NewTodo":return function(t){return XA(_(Hr,ON,t))};case"NewTodoForInbox":return function(t){return XA(_(Hr,IN,t))};case"NewProject":return function(t){return XA(_(Hr,lj,t))};case"NewContext":return function(t){return XA(_(Hr,hj,t))};case"OnEntityAction":var f=r._0,l=r._1;switch(l.ctor){case"StartEditing":return function(t){return XA(_(Hr,Bq(f),t))};case"NameChanged":return Hr(_(Rq,l._0,f));case"Save":return gB(IM);case"ToggleDeleted":return function(t){return _(gB,DM,_(Fr,QN(f),t))};case"ToggleArchived":return function(t){return _(gB,DM,_(Fr,YN(f),t))};case"OnFocusIn":return Hr(vN(f));case"ToggleSelected":return Hr(bq(f));default:return Hr(gj(f))}case"OnLaunchBarMsgWithNow":var d=r._1,p=r._0;switch(p.ctor){case"OnEnter":return function(t){return function(){var t=p._0;switch(t.ctor){case"Project":return sB(fj(t._0));case"Projects":return sB(mj(TO));case"Context":return sB(pj(t._0));default:return sB(mj(SO))}}()(_(gB,DM,t))};case"OnInputChanged":return sB(s(AN,d,p._1,p._0));default:return function(t){return XA(_(sB,EN(d),t))}}case"OnLaunchBarMsg":return lB(vM(r._0));case"OnCloseNotification":return cB(iC(r._0));case"OnGlobalKeyUp":return yB(r._0);case"OnKeyCombo":return Fr(pN(r._0));case"OnTodoMsg":return lB(sM(r._0));case"OnTodoMsgWithTime":return s(AR,gB,r._1,r._0);case"OnAppDrawerMsg":return _(Hj,gB,r._0);default:return Lr(function(t){return hB(eM(t))})}}()(Ur(r)))}},mB=function(t){return gB(fM(t))},gB=function(t){return Fr(vB(t))},yB=function(t){return _(nR,Nq,function(r){var e={ctor:"_Tuple2",_0:t,_1:r};t:do{if("_Tuple2"!==e.ctor)break t;if("None"!==e._1.ctor){if("Escape"===e._0.ctor)return gB(DM);break t}var n=e._0;switch(n.ctor){case"Escape":return Hr(Oq);case"CharQ":return gB(FM);case"CharI":return gB(PM);case"Slash":return gB(mM(IC));default:return T}}while(!1);return T})},bB=function(t){return lw(Tw(t))}({delta2url:_R,location2messages:uR,init:_j,update:vB,view:YR,subscriptions:dB})(_(an,function(t){return _(an,function(r){return _(an,function(e){return _(an,function(n){return _(an,function(o){return _(an,function(c){return _(an,function(u){return _(an,function(i){return _(an,function(a){return _(an,function(_){return sn({appVersion:t,config:r,developmentMode:e,deviceId:n,encodedContextList:o,encodedProjectList:c,encodedTodoList:u,localPref:i,now:a,pouchDBRemoteSyncURI:_})},_(yn,"pouchDBRemoteSyncURI",xn))},_(yn,"now",Tn))},_(yn,"localPref",un))},_(yn,"encodedTodoList",wn(un)))},_(yn,"encodedProjectList",wn(un)))},_(yn,"encodedContextList",wn(un)))},_(yn,"deviceId",xn))},_(yn,"developmentMode",Sn))},_(yn,"config",_(an,function(t){return sn({isFirstVisit:t})},_(yn,"isFirstVisit",Sn))))},_(yn,"appVersion",xn))),wB=(b(ut(function(t){return Fr(vB(t))})),{});wB.Main=wB.Main||{},void 0!==bB&&bB(wB.Main,"Main",void 0);var TB=function(){};if(t.hot&&function(r){function e(){return++f}function n(t,r){var e=[];for(var o in t){var c=t[o],u=r?r+"."+o:o;"fullscreen"in c?e.push({path:u,module:c}):e=e.concat(n(c,u))}return e}function o(t,r){for(var e=r.split("."),n=t,o=0;o<e.length;++o){var c=e[o];if(c in n&&(n=n[c]),!n)return null}return n}function c(t,r,n,o){var c=e(),u={id:c,path:n,domNode:t,flags:r,portSubscribes:o,elmProxy:null,lastState:null,callbacks:[]};return u.subscribe=function(t){return u.callbacks.push(t),function(){u.callbacks.splice(u.callbacks.indexOf(t),1)}},u.dispatch=function(t){u.callbacks.forEach(function(r){r(t,{flags:u.flags,state:"_0"in u.lastState?u.lastState._0:u.lastState})})},s[c]=u}function u(t,r){var e=r.embed,n=r.fullscreen;r.embed=function(r,n){var o,u={};return d=c(r,n,t,u),o=e(r,n),a(o,u),o=d.elmProxy={ports:o.ports,hot:{subscribe:d.subscribe}},d=null,o},r.fullscreen=function(r){var e,o={};return d=c(document.body,r,t,o),e=n(r),a(e,o),e=d.elmProxy={ports:e.ports,hot:{subscribe:d.subscribe}},d=null,e}}function i(t,r){console.log("[elm-hot] Hot-swapping module: "+r.path),p=r;for(var e=r.domNode;e.lastChild;)e.removeChild(e.lastChild);var n,c=o(t,r.path);if(c){r.dispatch("swap");var u=r.flags;n=r.isFullscreen?c.fullscreen(u):c.embed(e,u),r.elmProxy.ports=n.ports,Object.keys(r.portSubscribes).forEach(function(t){if(t in n.ports&&"subscribe"in n.ports[t]){var e=r.portSubscribes[t];if(!e.length)return;console.log("[elm-hot] Reconnect "+e.length+" handler(s) to port '"+t+"' ("+r.path+")."),e.forEach(function(r){n.ports[t].subscribe(r)})}else delete r.portSubscribes[t],console.log("[elm-hot] Port was removed: "+t)})}else console.log("[elm-hot] Module was removed: "+r.path);p=null}function a(t,r){var e=Object.keys(t.ports||{});return e.length&&e.filter(function(r){return"subscribe"in t.ports[r]}).forEach(function(e){var n=t.ports[e],o=n.subscribe,c=n.unsubscribe;t.ports[e]=Object.assign(n,{subscribe:function(t){return console.log("[elm-hot] ports."+e+".subscribe called."),r[e]?r[e].push(t):r[e]=[t],o.call(n,t)},unsubscribe:function(t){console.log("[elm-hot] ports."+e+".unsubscribe called.");var o=r[e];return o&&-1!==o.indexOf(t)?o.splice(o.lastIndexOf(t),1):console.warn("[elm-hot] ports."+e+".unsubscribe: handler not subscribed"),c.call(n,t)}})}),r}var _=function(){try{if(Ar.initialize)return"0.18"}catch(t){}try{if(1===Ci.length)return"0.17"}catch(t){}return"unknown"}();if(console.log("[elm-hot] Elm version:",_),"0.17"===_)throw new Error("[elm-hot] Please use elm-hot-loader@0.4.x");if("0.18"!==_)throw new Error("[elm-hot] Elm version not supported.");"function"!=typeof Object.assign&&(Object.assign=function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");t=Object(t);for(var r=1;r<arguments.length;r++){var e=arguments[r];if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t});var s=t.hot.data?t.hot.data.instances||{}:{},f=t.hot.data?t.hot.data.uid||0:0,l=[],d=null,p=null;t.hot.accept(),t.hot.dispose(function(t){if(t.instances=s,t.uid=f,Or.nativeBinding=function(){return Or.fail(new Error("[elm-hot] Inactive Elm instance."))},l.length){console.log("[elm-hot] Killing "+l.length+" running processes...");try{l.forEach(function(t){t()})}catch(t){console.warn("[elm-hot] Kill process error: "+t.message)}}});var h=Ar.initialize;Ar.initialize=function(t,r,e,n){function o(t){return t&&"object"==typeof t&&"boolean"==typeof t.isDebuggerOpen&&"state"in t}var c=d,u=p,i=!!p,a=!0,_=o(t._0);return p&&(_?t._0.state=p.lastState:t._0=p.lastState),h(t,r,function(t){var r;if(i){i=!1;try{r=e(t)}catch(t){throw new Error("[elm-hot] Hot-swapping is not possible, please reload page. Error: "+t.message)}}else r=e(t);return c?o(t)?c.lastState=t.state:c.lastState=t:c=u,a=!1,r},n)};var v=Or.nativeBinding;Or.nativeBinding=function(){var t=v.apply(this,arguments),r=t.callback;return t.callback=function(){var t=r.apply(this,arguments);return t?(l.push(t),function(){return l.splice(l.indexOf(t),1),t()}):t},t},TB=function(t){var r=[];for(var e in s){var o=s[e];o.domNode.parentNode?i(t,o):r.push(e)}r.forEach(function(t){delete o[t]}),n(t).forEach(function(t){u(t.path,t.module)})}}(),TB(wB),"function"==typeof define&&define.amd)return void define([],function(){return wB});if("object"==typeof t)return void(t.exports=wB);var kB=this.Elm;if(void 0===kB)return void(this.Elm=wB);for(var SB in wB){if(SB in kB)throw new Error("There are two Elm modules called `"+SB+"` on this page! Rename one of them.");kB[SB]=wB[SB]}}).call(this)},554:function(t,r,e){(function(e){var n,o;/*!
   *  howler.js v2.0.3
   *  howlerjs.com
   *
   *  (c) 2013-2017, James Simpson of GoldFire Studios
   *  goldfirestudios.com
   *
   *  MIT License
   */
  !function(){"use strict";var c=function(){this.init()};c.prototype={init:function(){var t=this||u;return t._counter=0,t._codecs={},t._howls=[],t._muted=!1,t._volume=1,t._canPlayEvent="canplaythrough",t._navigator="undefined"!=typeof window&&window.navigator?window.navigator:null,t.masterGain=null,t.noAudio=!1,t.usingWebAudio=!0,t.autoSuspend=!0,t.ctx=null,t.mobileAutoEnable=!0,t._setup(),t},volume:function(t){var r=this||u;if(t=parseFloat(t),r.ctx||p(),void 0!==t&&t>=0&&t<=1){if(r._volume=t,r._muted)return r;r.usingWebAudio&&(r.masterGain.gain.value=t);for(var e=0;e<r._howls.length;e++)if(!r._howls[e]._webAudio)for(var n=r._howls[e]._getSoundIds(),o=0;o<n.length;o++){var c=r._howls[e]._soundById(n[o]);c&&c._node&&(c._node.volume=c._volume*t)}return r}return r._volume},mute:function(t){var r=this||u;r.ctx||p(),r._muted=t,r.usingWebAudio&&(r.masterGain.gain.value=t?0:r._volume);for(var e=0;e<r._howls.length;e++)if(!r._howls[e]._webAudio)for(var n=r._howls[e]._getSoundIds(),o=0;o<n.length;o++){var c=r._howls[e]._soundById(n[o]);c&&c._node&&(c._node.muted=!!t||c._muted)}return r},unload:function(){for(var t=this||u,r=t._howls.length-1;r>=0;r--)t._howls[r].unload();return t.usingWebAudio&&t.ctx&&void 0!==t.ctx.close&&(t.ctx.close(),t.ctx=null,p()),t},codecs:function(t){return(this||u)._codecs[t.replace(/^x-/,"")]},_setup:function(){var t=this||u;if(t.state=t.ctx?t.ctx.state||"running":"running",t._autoSuspend(),!t.usingWebAudio)if("undefined"!=typeof Audio)try{var r=new Audio;void 0===r.oncanplaythrough&&(t._canPlayEvent="canplay")}catch(r){t.noAudio=!0}else t.noAudio=!0;try{var r=new Audio;r.muted&&(t.noAudio=!0)}catch(t){}return t.noAudio||t._setupCodecs(),t},_setupCodecs:function(){var t=this||u,r=null;try{r="undefined"!=typeof Audio?new Audio:null}catch(r){return t}if(!r||"function"!=typeof r.canPlayType)return t;var e=r.canPlayType("audio/mpeg;").replace(/^no$/,""),n=t._navigator&&t._navigator.userAgent.match(/OPR\/([0-6].)/g),o=n&&parseInt(n[0].split("/")[1],10)<33;return t._codecs={mp3:!(o||!e&&!r.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!e,opus:!!r.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!r.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!r.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!r.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),aac:!!r.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!r.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(r.canPlayType("audio/x-m4a;")||r.canPlayType("audio/m4a;")||r.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(r.canPlayType("audio/x-mp4;")||r.canPlayType("audio/mp4;")||r.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!r.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,""),webm:!!r.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,""),dolby:!!r.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(r.canPlayType("audio/x-flac;")||r.canPlayType("audio/flac;")).replace(/^no$/,"")},t},_enableMobileAudio:function(){var t=this||u,r=/iPhone|iPad|iPod|Android|BlackBerry|BB10|Silk|Mobi/i.test(t._navigator&&t._navigator.userAgent),e=!!("ontouchend"in window||t._navigator&&t._navigator.maxTouchPoints>0||t._navigator&&t._navigator.msMaxTouchPoints>0);if(!t._mobileEnabled&&t.ctx&&(r||e)){t._mobileEnabled=!1,t._mobileUnloaded||44100===t.ctx.sampleRate||(t._mobileUnloaded=!0,t.unload()),t._scratchBuffer=t.ctx.createBuffer(1,1,22050);var n=function(){var r=t.ctx.createBufferSource();r.buffer=t._scratchBuffer,r.connect(t.ctx.destination),void 0===r.start?r.noteOn(0):r.start(0),r.onended=function(){r.disconnect(0),t._mobileEnabled=!0,t.mobileAutoEnable=!1,document.removeEventListener("touchend",n,!0)}};return document.addEventListener("touchend",n,!0),t}},_autoSuspend:function(){var t=this;if(t.autoSuspend&&t.ctx&&void 0!==t.ctx.suspend&&u.usingWebAudio){for(var r=0;r<t._howls.length;r++)if(t._howls[r]._webAudio)for(var e=0;e<t._howls[r]._sounds.length;e++)if(!t._howls[r]._sounds[e]._paused)return t;return t._suspendTimer&&clearTimeout(t._suspendTimer),t._suspendTimer=setTimeout(function(){t.autoSuspend&&(t._suspendTimer=null,t.state="suspending",t.ctx.suspend().then(function(){t.state="suspended",t._resumeAfterSuspend&&(delete t._resumeAfterSuspend,t._autoResume())}))},3e4),t}},_autoResume:function(){var t=this;if(t.ctx&&void 0!==t.ctx.resume&&u.usingWebAudio)return"running"===t.state&&t._suspendTimer?(clearTimeout(t._suspendTimer),t._suspendTimer=null):"suspended"===t.state?(t.state="resuming",t.ctx.resume().then(function(){t.state="running";for(var r=0;r<t._howls.length;r++)t._howls[r]._emit("resume")}),t._suspendTimer&&(clearTimeout(t._suspendTimer),t._suspendTimer=null)):"suspending"===t.state&&(t._resumeAfterSuspend=!0),t}};var u=new c,i=function(t){var r=this;if(!t.src||0===t.src.length)return void console.error("An array of source files must be passed with any new Howl.");r.init(t)};i.prototype={init:function(t){var r=this;return u.ctx||p(),r._autoplay=t.autoplay||!1,r._format="string"!=typeof t.format?t.format:[t.format],r._html5=t.html5||!1,r._muted=t.mute||!1,r._loop=t.loop||!1,r._pool=t.pool||5,r._preload="boolean"!=typeof t.preload||t.preload,r._rate=t.rate||1,r._sprite=t.sprite||{},r._src="string"!=typeof t.src?t.src:[t.src],r._volume=void 0!==t.volume?t.volume:1,r._duration=0,r._state="unloaded",r._sounds=[],r._endTimers={},r._queue=[],r._onend=t.onend?[{fn:t.onend}]:[],r._onfade=t.onfade?[{fn:t.onfade}]:[],r._onload=t.onload?[{fn:t.onload}]:[],r._onloaderror=t.onloaderror?[{fn:t.onloaderror}]:[],r._onpause=t.onpause?[{fn:t.onpause}]:[],r._onplay=t.onplay?[{fn:t.onplay}]:[],r._onstop=t.onstop?[{fn:t.onstop}]:[],r._onmute=t.onmute?[{fn:t.onmute}]:[],r._onvolume=t.onvolume?[{fn:t.onvolume}]:[],r._onrate=t.onrate?[{fn:t.onrate}]:[],r._onseek=t.onseek?[{fn:t.onseek}]:[],r._onresume=[],r._webAudio=u.usingWebAudio&&!r._html5,void 0!==u.ctx&&u.ctx&&u.mobileAutoEnable&&u._enableMobileAudio(),u._howls.push(r),r._autoplay&&r._queue.push({event:"play",action:function(){r.play()}}),r._preload&&r.load(),r},load:function(){var t=this,r=null;if(u.noAudio)return void t._emit("loaderror",null,"No audio support.");"string"==typeof t._src&&(t._src=[t._src]);for(var e=0;e<t._src.length;e++){var n,o;if(t._format&&t._format[e])n=t._format[e];else{if("string"!=typeof(o=t._src[e])){t._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}n=/^data:audio\/([^;,]+);/i.exec(o),n||(n=/\.([^.]+)$/.exec(o.split("?",1)[0])),n&&(n=n[1].toLowerCase())}if(n||console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),n&&u.codecs(n)){r=t._src[e];break}}return r?(t._src=r,t._state="loading","https:"===window.location.protocol&&"http:"===r.slice(0,5)&&(t._html5=!0,t._webAudio=!1),new a(t),t._webAudio&&s(t),t):void t._emit("loaderror",null,"No codec support for selected audio sources.")},play:function(t,r){var e=this,n=null;if("number"==typeof t)n=t,t=null;else{if("string"==typeof t&&"loaded"===e._state&&!e._sprite[t])return null;if(void 0===t){t="__default";for(var o=0,c=0;c<e._sounds.length;c++)e._sounds[c]._paused&&!e._sounds[c]._ended&&(o++,n=e._sounds[c]._id);1===o?t=null:n=null}}var i=n?e._soundById(n):e._inactiveSound();if(!i)return null;if(n&&!t&&(t=i._sprite||"__default"),"loaded"!==e._state&&!e._sprite[t])return e._queue.push({event:"play",action:function(){e.play(e._soundById(i._id)?i._id:void 0)}}),i._id;if(n&&!i._paused)return r||setTimeout(function(){e._emit("play",i._id)},0),i._id;e._webAudio&&u._autoResume();var a=Math.max(0,i._seek>0?i._seek:e._sprite[t][0]/1e3),_=Math.max(0,(e._sprite[t][0]+e._sprite[t][1])/1e3-a),s=1e3*_/Math.abs(i._rate);i._paused=!1,i._ended=!1,i._sprite=t,i._seek=a,i._start=e._sprite[t][0]/1e3,i._stop=(e._sprite[t][0]+e._sprite[t][1])/1e3,i._loop=!(!i._loop&&!e._sprite[t][2]);var f=i._node;if(e._webAudio){var l=function(){e._refreshBuffer(i);var t=i._muted||e._muted?0:i._volume;f.gain.setValueAtTime(t,u.ctx.currentTime),i._playStart=u.ctx.currentTime,void 0===f.bufferSource.start?i._loop?f.bufferSource.noteGrainOn(0,a,86400):f.bufferSource.noteGrainOn(0,a,_):i._loop?f.bufferSource.start(0,a,86400):f.bufferSource.start(0,a,_),s!==1/0&&(e._endTimers[i._id]=setTimeout(e._ended.bind(e,i),s)),r||setTimeout(function(){e._emit("play",i._id)},0)},d="running"===u.state;if("loaded"===e._state&&d)l();else{var p=d||"loaded"!==e._state?"load":"resume";e.once(p,l,d?i._id:null),e._clearTimer(i._id)}}else{var h=function(){f.currentTime=a,f.muted=i._muted||e._muted||u._muted||f.muted,f.volume=i._volume*u.volume(),f.playbackRate=i._rate,f.play(),s!==1/0&&(e._endTimers[i._id]=setTimeout(e._ended.bind(e,i),s)),r||e._emit("play",i._id)},v="loaded"===e._state&&(window&&window.ejecta||!f.readyState&&u._navigator.isCocoonJS);if(4===f.readyState||v)h();else{var m=function(){h(),f.removeEventListener(u._canPlayEvent,m,!1)};f.addEventListener(u._canPlayEvent,m,!1),e._clearTimer(i._id)}}return i._id},pause:function(t){var r=this;if("loaded"!==r._state)return r._queue.push({event:"pause",action:function(){r.pause(t)}}),r;for(var e=r._getSoundIds(t),n=0;n<e.length;n++){r._clearTimer(e[n]);var o=r._soundById(e[n]);if(o&&!o._paused&&(o._seek=r.seek(e[n]),o._rateSeek=0,o._paused=!0,r._stopFade(e[n]),o._node))if(r._webAudio){if(!o._node.bufferSource)return r;void 0===o._node.bufferSource.stop?o._node.bufferSource.noteOff(0):o._node.bufferSource.stop(0),r._cleanBuffer(o._node)}else isNaN(o._node.duration)&&o._node.duration!==1/0||o._node.pause();arguments[1]||r._emit("pause",o?o._id:null)}return r},stop:function(t,r){var e=this;if("loaded"!==e._state)return e._queue.push({event:"stop",action:function(){e.stop(t)}}),e;for(var n=e._getSoundIds(t),o=0;o<n.length;o++){e._clearTimer(n[o]);var c=e._soundById(n[o]);if(c&&(c._seek=c._start||0,c._rateSeek=0,c._paused=!0,c._ended=!0,e._stopFade(n[o]),c._node))if(e._webAudio){if(!c._node.bufferSource)return r||e._emit("stop",c._id),e;void 0===c._node.bufferSource.stop?c._node.bufferSource.noteOff(0):c._node.bufferSource.stop(0),e._cleanBuffer(c._node)}else isNaN(c._node.duration)&&c._node.duration!==1/0||(c._node.currentTime=c._start||0,c._node.pause());c&&!r&&e._emit("stop",c._id)}return e},mute:function(t,r){var e=this;if("loaded"!==e._state)return e._queue.push({event:"mute",action:function(){e.mute(t,r)}}),e;if(void 0===r){if("boolean"!=typeof t)return e._muted;e._muted=t}for(var n=e._getSoundIds(r),o=0;o<n.length;o++){var c=e._soundById(n[o]);c&&(c._muted=t,e._webAudio&&c._node?c._node.gain.setValueAtTime(t?0:c._volume,u.ctx.currentTime):c._node&&(c._node.muted=!!u._muted||t),e._emit("mute",c._id))}return e},volume:function(){var t,r,e=this,n=arguments;if(0===n.length)return e._volume;if(1===n.length||2===n.length&&void 0===n[1]){e._getSoundIds().indexOf(n[0])>=0?r=parseInt(n[0],10):t=parseFloat(n[0])}else n.length>=2&&(t=parseFloat(n[0]),r=parseInt(n[1],10));var o;if(!(void 0!==t&&t>=0&&t<=1))return o=r?e._soundById(r):e._sounds[0],o?o._volume:0;if("loaded"!==e._state)return e._queue.push({event:"volume",action:function(){e.volume.apply(e,n)}}),e;void 0===r&&(e._volume=t),r=e._getSoundIds(r);for(var c=0;c<r.length;c++)(o=e._soundById(r[c]))&&(o._volume=t,n[2]||e._stopFade(r[c]),e._webAudio&&o._node&&!o._muted?o._node.gain.setValueAtTime(t,u.ctx.currentTime):o._node&&!o._muted&&(o._node.volume=t*u.volume()),e._emit("volume",o._id));return e},fade:function(t,r,e,n){var o=this,c=Math.abs(t-r),i=t>r?"out":"in",a=c/.01,_=a>0?e/a:e;if(_<4&&(a=Math.ceil(a/(4/_)),_=4),"loaded"!==o._state)return o._queue.push({event:"fade",action:function(){o.fade(t,r,e,n)}}),o;o.volume(t,n);for(var s=o._getSoundIds(n),f=0;f<s.length;f++){var l=o._soundById(s[f]);if(l){if(n||o._stopFade(s[f]),o._webAudio&&!l._muted){var d=u.ctx.currentTime,p=d+e/1e3;l._volume=t,l._node.gain.setValueAtTime(t,d),l._node.gain.linearRampToValueAtTime(r,p)}var h=t;l._interval=setInterval(function(e,c){a>0&&(h+="in"===i?.01:-.01),h=Math.max(0,h),h=Math.min(1,h),h=Math.round(100*h)/100,o._webAudio?(void 0===n&&(o._volume=h),c._volume=h):o.volume(h,e,!0),(r<t&&h<=r||r>t&&h>=r)&&(clearInterval(c._interval),c._interval=null,o.volume(r,e),o._emit("fade",e))}.bind(o,s[f],l),_)}}return o},_stopFade:function(t){var r=this,e=r._soundById(t);return e&&e._interval&&(r._webAudio&&e._node.gain.cancelScheduledValues(u.ctx.currentTime),clearInterval(e._interval),e._interval=null,r._emit("fade",t)),r},loop:function(){var t,r,e,n=this,o=arguments;if(0===o.length)return n._loop;if(1===o.length){if("boolean"!=typeof o[0])return!!(e=n._soundById(parseInt(o[0],10)))&&e._loop;t=o[0],n._loop=t}else 2===o.length&&(t=o[0],r=parseInt(o[1],10));for(var c=n._getSoundIds(r),u=0;u<c.length;u++)(e=n._soundById(c[u]))&&(e._loop=t,n._webAudio&&e._node&&e._node.bufferSource&&(e._node.bufferSource.loop=t,t&&(e._node.bufferSource.loopStart=e._start||0,e._node.bufferSource.loopEnd=e._stop)));return n},rate:function(){var t,r,e=this,n=arguments;if(0===n.length)r=e._sounds[0]._id;else if(1===n.length){var o=e._getSoundIds(),c=o.indexOf(n[0]);c>=0?r=parseInt(n[0],10):t=parseFloat(n[0])}else 2===n.length&&(t=parseFloat(n[0]),r=parseInt(n[1],10));var i;if("number"!=typeof t)return i=e._soundById(r),i?i._rate:e._rate;if("loaded"!==e._state)return e._queue.push({event:"rate",action:function(){e.rate.apply(e,n)}}),e;void 0===r&&(e._rate=t),r=e._getSoundIds(r);for(var a=0;a<r.length;a++)if(i=e._soundById(r[a])){i._rateSeek=e.seek(r[a]),i._playStart=e._webAudio?u.ctx.currentTime:i._playStart,i._rate=t,e._webAudio&&i._node&&i._node.bufferSource?i._node.bufferSource.playbackRate.value=t:i._node&&(i._node.playbackRate=t);var _=e.seek(r[a]),s=(e._sprite[i._sprite][0]+e._sprite[i._sprite][1])/1e3-_,f=1e3*s/Math.abs(i._rate);!e._endTimers[r[a]]&&i._paused||(e._clearTimer(r[a]),e._endTimers[r[a]]=setTimeout(e._ended.bind(e,i),f)),e._emit("rate",i._id)}return e},seek:function(){var t,r,e=this,n=arguments;if(0===n.length)r=e._sounds[0]._id;else if(1===n.length){var o=e._getSoundIds(),c=o.indexOf(n[0]);c>=0?r=parseInt(n[0],10):(r=e._sounds[0]._id,t=parseFloat(n[0]))}else 2===n.length&&(t=parseFloat(n[0]),r=parseInt(n[1],10));if(void 0===r)return e;if("loaded"!==e._state)return e._queue.push({event:"seek",action:function(){e.seek.apply(e,n)}}),e;var i=e._soundById(r);if(i){if(!("number"==typeof t&&t>=0)){if(e._webAudio){var a=e.playing(r)?u.ctx.currentTime-i._playStart:0,_=i._rateSeek?i._rateSeek-i._seek:0;return i._seek+(_+a*Math.abs(i._rate))}return i._node.currentTime}var s=e.playing(r);s&&e.pause(r,!0),i._seek=t,i._ended=!1,e._clearTimer(r),s&&e.play(r,!0),!e._webAudio&&i._node&&(i._node.currentTime=t),e._emit("seek",r)}return e},playing:function(t){var r=this;if("number"==typeof t){var e=r._soundById(t);return!!e&&!e._paused}for(var n=0;n<r._sounds.length;n++)if(!r._sounds[n]._paused)return!0;return!1},duration:function(t){var r=this,e=r._duration,n=r._soundById(t);return n&&(e=r._sprite[n._sprite][1]/1e3),e},state:function(){return this._state},unload:function(){for(var t=this,r=t._sounds,e=0;e<r.length;e++){r[e]._paused||t.stop(r[e]._id),t._webAudio||(r[e]._node.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA",r[e]._node.removeEventListener("error",r[e]._errorFn,!1),r[e]._node.removeEventListener(u._canPlayEvent,r[e]._loadFn,!1)),delete r[e]._node,t._clearTimer(r[e]._id);var n=u._howls.indexOf(t);n>=0&&u._howls.splice(n,1)}var o=!0;for(e=0;e<u._howls.length;e++)if(u._howls[e]._src===t._src){o=!1;break}return _&&o&&delete _[t._src],u.noAudio=!1,t._state="unloaded",t._sounds=[],t=null,null},on:function(t,r,e,n){var o=this,c=o["_on"+t];return"function"==typeof r&&c.push(n?{id:e,fn:r,once:n}:{id:e,fn:r}),o},off:function(t,r,e){var n=this,o=n["_on"+t],c=0;if(r){for(c=0;c<o.length;c++)if(r===o[c].fn&&e===o[c].id){o.splice(c,1);break}}else if(t)n["_on"+t]=[];else{var u=Object.keys(n);for(c=0;c<u.length;c++)0===u[c].indexOf("_on")&&Array.isArray(n[u[c]])&&(n[u[c]]=[])}return n},once:function(t,r,e){var n=this;return n.on(t,r,e,1),n},_emit:function(t,r,e){for(var n=this,o=n["_on"+t],c=o.length-1;c>=0;c--)o[c].id&&o[c].id!==r&&"load"!==t||(setTimeout(function(t){t.call(this,r,e)}.bind(n,o[c].fn),0),o[c].once&&n.off(t,o[c].fn,o[c].id));return n},_loadQueue:function(){var t=this;if(t._queue.length>0){var r=t._queue[0];t.once(r.event,function(){t._queue.shift(),t._loadQueue()}),r.action()}return t},_ended:function(t){var r=this,e=t._sprite,n=!(!t._loop&&!r._sprite[e][2]);if(r._emit("end",t._id),!r._webAudio&&n&&r.stop(t._id,!0).play(t._id),r._webAudio&&n){r._emit("play",t._id),t._seek=t._start||0,t._rateSeek=0,t._playStart=u.ctx.currentTime;var o=1e3*(t._stop-t._start)/Math.abs(t._rate);r._endTimers[t._id]=setTimeout(r._ended.bind(r,t),o)}return r._webAudio&&!n&&(t._paused=!0,t._ended=!0,t._seek=t._start||0,t._rateSeek=0,r._clearTimer(t._id),r._cleanBuffer(t._node),u._autoSuspend()),r._webAudio||n||r.stop(t._id),r},_clearTimer:function(t){var r=this;return r._endTimers[t]&&(clearTimeout(r._endTimers[t]),delete r._endTimers[t]),r},_soundById:function(t){for(var r=this,e=0;e<r._sounds.length;e++)if(t===r._sounds[e]._id)return r._sounds[e];return null},_inactiveSound:function(){var t=this;t._drain();for(var r=0;r<t._sounds.length;r++)if(t._sounds[r]._ended)return t._sounds[r].reset();return new a(t)},_drain:function(){var t=this,r=t._pool,e=0,n=0;if(!(t._sounds.length<r)){for(n=0;n<t._sounds.length;n++)t._sounds[n]._ended&&e++;for(n=t._sounds.length-1;n>=0;n--){if(e<=r)return;t._sounds[n]._ended&&(t._webAudio&&t._sounds[n]._node&&t._sounds[n]._node.disconnect(0),t._sounds.splice(n,1),e--)}}},_getSoundIds:function(t){var r=this;if(void 0===t){for(var e=[],n=0;n<r._sounds.length;n++)e.push(r._sounds[n]._id);return e}return[t]},_refreshBuffer:function(t){var r=this;return t._node.bufferSource=u.ctx.createBufferSource(),t._node.bufferSource.buffer=_[r._src],t._panner?t._node.bufferSource.connect(t._panner):t._node.bufferSource.connect(t._node),t._node.bufferSource.loop=t._loop,t._loop&&(t._node.bufferSource.loopStart=t._start||0,t._node.bufferSource.loopEnd=t._stop),t._node.bufferSource.playbackRate.value=t._rate,r},_cleanBuffer:function(t){var r=this;if(r._scratchBuffer){t.bufferSource.onended=null,t.bufferSource.disconnect(0);try{t.bufferSource.buffer=r._scratchBuffer}catch(t){}}return t.bufferSource=null,r}};var a=function(t){this._parent=t,this.init()};a.prototype={init:function(){var t=this,r=t._parent;return t._muted=r._muted,t._loop=r._loop,t._volume=r._volume,t._muted=r._muted,t._rate=r._rate,t._seek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++u._counter,r._sounds.push(t),t.create(),t},create:function(){var t=this,r=t._parent,e=u._muted||t._muted||t._parent._muted?0:t._volume;return r._webAudio?(t._node=void 0===u.ctx.createGain?u.ctx.createGainNode():u.ctx.createGain(),t._node.gain.setValueAtTime(e,u.ctx.currentTime),t._node.paused=!0,t._node.connect(u.masterGain)):(t._node=new Audio,t._errorFn=t._errorListener.bind(t),t._node.addEventListener("error",t._errorFn,!1),t._loadFn=t._loadListener.bind(t),t._node.addEventListener(u._canPlayEvent,t._loadFn,!1),t._node.src=r._src,t._node.preload="auto",t._node.volume=e*u.volume(),t._node.load()),t},reset:function(){var t=this,r=t._parent;return t._muted=r._muted,t._loop=r._loop,t._volume=r._volume,t._muted=r._muted,t._rate=r._rate,t._seek=0,t._rateSeek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++u._counter,t},_errorListener:function(){var t=this;t._parent._emit("loaderror",t._id,t._node.error?t._node.error.code:0),t._node.removeEventListener("error",t._errorListener,!1)},_loadListener:function(){var t=this,r=t._parent;r._duration=Math.ceil(10*t._node.duration)/10,0===Object.keys(r._sprite).length&&(r._sprite={__default:[0,1e3*r._duration]}),"loaded"!==r._state&&(r._state="loaded",r._emit("load"),r._loadQueue()),t._node.removeEventListener(u._canPlayEvent,t._loadFn,!1)}};var _={},s=function(t){var r=t._src;if(_[r])return t._duration=_[r].duration,void d(t);if(/^data:[^;]+;base64,/.test(r)){for(var e=atob(r.split(",")[1]),n=new Uint8Array(e.length),o=0;o<e.length;++o)n[o]=e.charCodeAt(o);l(n.buffer,t)}else{var c=new XMLHttpRequest;c.open("GET",r,!0),c.responseType="arraybuffer",c.onload=function(){var r=(c.status+"")[0];if("0"!==r&&"2"!==r&&"3"!==r)return void t._emit("loaderror",null,"Failed loading audio file with status: "+c.status+".");l(c.response,t)},c.onerror=function(){t._webAudio&&(t._html5=!0,t._webAudio=!1,t._sounds=[],delete _[r],t.load())},f(c)}},f=function(t){try{t.send()}catch(r){t.onerror()}},l=function(t,r){u.ctx.decodeAudioData(t,function(t){t&&r._sounds.length>0&&(_[r._src]=t,d(r,t))},function(){r._emit("loaderror",null,"Decoding audio data failed.")})},d=function(t,r){r&&!t._duration&&(t._duration=r.duration),0===Object.keys(t._sprite).length&&(t._sprite={__default:[0,1e3*t._duration]}),"loaded"!==t._state&&(t._state="loaded",t._emit("load"),t._loadQueue())},p=function(){try{"undefined"!=typeof AudioContext?u.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?u.ctx=new webkitAudioContext:u.usingWebAudio=!1}catch(t){u.usingWebAudio=!1}var t=/iP(hone|od|ad)/.test(u._navigator&&u._navigator.platform),r=u._navigator&&u._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),e=r?parseInt(r[1],10):null;if(t&&e&&e<9){var n=/safari/.test(u._navigator&&u._navigator.userAgent.toLowerCase());(u._navigator&&u._navigator.standalone&&!n||u._navigator&&!u._navigator.standalone&&!n)&&(u.usingWebAudio=!1)}u.usingWebAudio&&(u.masterGain=void 0===u.ctx.createGain?u.ctx.createGainNode():u.ctx.createGain(),u.masterGain.gain.value=1,u.masterGain.connect(u.ctx.destination)),u._setup()};n=[],void 0!==(o=function(){return{Howler:u,Howl:i}}.apply(r,n))&&(t.exports=o),r.Howler=u,r.Howl=i,"undefined"!=typeof window?(window.HowlerGlobal=c,window.Howler=u,window.Howl=i,window.Sound=a):void 0!==e&&(e.HowlerGlobal=c,e.Howler=u,e.Howl=i,e.Sound=a)}(),/*!
   *  Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
   *  
   *  howler.js v2.0.3
   *  howlerjs.com
   *
   *  (c) 2013-2017, James Simpson of GoldFire Studios
   *  goldfirestudios.com
   *
   *  MIT License
   */
  function(){"use strict";HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(t){var r=this;if(!r.ctx||!r.ctx.listener)return r;for(var e=r._howls.length-1;e>=0;e--)r._howls[e].stereo(t);return r},HowlerGlobal.prototype.pos=function(t,r,e){var n=this;return n.ctx&&n.ctx.listener?(r="number"!=typeof r?n._pos[1]:r,e="number"!=typeof e?n._pos[2]:e,"number"!=typeof t?n._pos:(n._pos=[t,r,e],n.ctx.listener.setPosition(n._pos[0],n._pos[1],n._pos[2]),n)):n},HowlerGlobal.prototype.orientation=function(t,r,e,n,o,c){var u=this;if(!u.ctx||!u.ctx.listener)return u;var i=u._orientation;return r="number"!=typeof r?i[1]:r,e="number"!=typeof e?i[2]:e,n="number"!=typeof n?i[3]:n,o="number"!=typeof o?i[4]:o,c="number"!=typeof c?i[5]:c,"number"!=typeof t?i:(u._orientation=[t,r,e,n,o,c],u.ctx.listener.setOrientation(t,r,e,n,o,c),u)},Howl.prototype.init=function(t){return function(r){var e=this;return e._orientation=r.orientation||[1,0,0],e._stereo=r.stereo||null,e._pos=r.pos||null,e._pannerAttr={coneInnerAngle:void 0!==r.coneInnerAngle?r.coneInnerAngle:360,coneOuterAngle:void 0!==r.coneOuterAngle?r.coneOuterAngle:360,coneOuterGain:void 0!==r.coneOuterGain?r.coneOuterGain:0,distanceModel:void 0!==r.distanceModel?r.distanceModel:"inverse",maxDistance:void 0!==r.maxDistance?r.maxDistance:1e4,panningModel:void 0!==r.panningModel?r.panningModel:"HRTF",refDistance:void 0!==r.refDistance?r.refDistance:1,rolloffFactor:void 0!==r.rolloffFactor?r.rolloffFactor:1},e._onstereo=r.onstereo?[{fn:r.onstereo}]:[],e._onpos=r.onpos?[{fn:r.onpos}]:[],e._onorientation=r.onorientation?[{fn:r.onorientation}]:[],t.call(this,r)}}(Howl.prototype.init),Howl.prototype.stereo=function(r,e){var n=this;if(!n._webAudio)return n;if("loaded"!==n._state)return n._queue.push({event:"stereo",action:function(){n.stereo(r,e)}}),n;var o=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===e){if("number"!=typeof r)return n._stereo;n._stereo=r,n._pos=[r,0,0]}for(var c=n._getSoundIds(e),u=0;u<c.length;u++){var i=n._soundById(c[u]);if(i){if("number"!=typeof r)return i._stereo;i._stereo=r,i._pos=[r,0,0],i._node&&(i._pannerAttr.panningModel="equalpower",i._panner&&i._panner.pan||t(i,o),"spatial"===o?i._panner.setPosition(r,0,0):i._panner.pan.value=r),n._emit("stereo",i._id)}}return n},Howl.prototype.pos=function(r,e,n,o){var c=this;if(!c._webAudio)return c;if("loaded"!==c._state)return c._queue.push({event:"pos",action:function(){c.pos(r,e,n,o)}}),c;if(e="number"!=typeof e?0:e,n="number"!=typeof n?-.5:n,void 0===o){if("number"!=typeof r)return c._pos;c._pos=[r,e,n]}for(var u=c._getSoundIds(o),i=0;i<u.length;i++){var a=c._soundById(u[i]);if(a){if("number"!=typeof r)return a._pos;a._pos=[r,e,n],a._node&&(a._panner&&!a._panner.pan||t(a,"spatial"),a._panner.setPosition(r,e,n)),c._emit("pos",a._id)}}return c},Howl.prototype.orientation=function(r,e,n,o){var c=this;if(!c._webAudio)return c;if("loaded"!==c._state)return c._queue.push({event:"orientation",action:function(){c.orientation(r,e,n,o)}}),c;if(e="number"!=typeof e?c._orientation[1]:e,n="number"!=typeof n?c._orientation[2]:n,void 0===o){if("number"!=typeof r)return c._orientation;c._orientation=[r,e,n]}for(var u=c._getSoundIds(o),i=0;i<u.length;i++){var a=c._soundById(u[i]);if(a){if("number"!=typeof r)return a._orientation;a._orientation=[r,e,n],a._node&&(a._panner||(a._pos||(a._pos=c._pos||[0,0,-.5]),t(a,"spatial")),a._panner.setOrientation(r,e,n)),c._emit("orientation",a._id)}}return c},Howl.prototype.pannerAttr=function(){var r,e,n,o=this,c=arguments;if(!o._webAudio)return o;if(0===c.length)return o._pannerAttr;if(1===c.length){if("object"!=typeof c[0])return n=o._soundById(parseInt(c[0],10)),n?n._pannerAttr:o._pannerAttr;r=c[0],void 0===e&&(o._pannerAttr={coneInnerAngle:void 0!==r.coneInnerAngle?r.coneInnerAngle:o._coneInnerAngle,coneOuterAngle:void 0!==r.coneOuterAngle?r.coneOuterAngle:o._coneOuterAngle,coneOuterGain:void 0!==r.coneOuterGain?r.coneOuterGain:o._coneOuterGain,distanceModel:void 0!==r.distanceModel?r.distanceModel:o._distanceModel,maxDistance:void 0!==r.maxDistance?r.maxDistance:o._maxDistance,panningModel:void 0!==r.panningModel?r.panningModel:o._panningModel,refDistance:void 0!==r.refDistance?r.refDistance:o._refDistance,rolloffFactor:void 0!==r.rolloffFactor?r.rolloffFactor:o._rolloffFactor})}else 2===c.length&&(r=c[0],e=parseInt(c[1],10));for(var u=o._getSoundIds(e),i=0;i<u.length;i++)if(n=o._soundById(u[i])){var a=n._pannerAttr;a={coneInnerAngle:void 0!==r.coneInnerAngle?r.coneInnerAngle:a.coneInnerAngle,coneOuterAngle:void 0!==r.coneOuterAngle?r.coneOuterAngle:a.coneOuterAngle,coneOuterGain:void 0!==r.coneOuterGain?r.coneOuterGain:a.coneOuterGain,distanceModel:void 0!==r.distanceModel?r.distanceModel:a.distanceModel,maxDistance:void 0!==r.maxDistance?r.maxDistance:a.maxDistance,panningModel:void 0!==r.panningModel?r.panningModel:a.panningModel,refDistance:void 0!==r.refDistance?r.refDistance:a.refDistance,rolloffFactor:void 0!==r.rolloffFactor?r.rolloffFactor:a.rolloffFactor};var _=n._panner;_?(_.coneInnerAngle=a.coneInnerAngle,_.coneOuterAngle=a.coneOuterAngle,_.coneOuterGain=a.coneOuterGain,_.distanceModel=a.distanceModel,_.maxDistance=a.maxDistance,_.panningModel=a.panningModel,_.refDistance=a.refDistance,_.rolloffFactor=a.rolloffFactor):(n._pos||(n._pos=o._pos||[0,0,-.5]),t(n,"spatial"))}return o},Sound.prototype.init=function(t){return function(){var r=this,e=r._parent;r._orientation=e._orientation,r._stereo=e._stereo,r._pos=e._pos,r._pannerAttr=e._pannerAttr,t.call(this),r._stereo?e.stereo(r._stereo):r._pos&&e.pos(r._pos[0],r._pos[1],r._pos[2],r._id)}}(Sound.prototype.init),Sound.prototype.reset=function(t){return function(){var r=this,e=r._parent;return r._orientation=e._orientation,r._pos=e._pos,r._pannerAttr=e._pannerAttr,t.call(this)}}(Sound.prototype.reset);var t=function(t,r){r=r||"spatial","spatial"===r?(t._panner=Howler.ctx.createPanner(),t._panner.coneInnerAngle=t._pannerAttr.coneInnerAngle,t._panner.coneOuterAngle=t._pannerAttr.coneOuterAngle,t._panner.coneOuterGain=t._pannerAttr.coneOuterGain,t._panner.distanceModel=t._pannerAttr.distanceModel,t._panner.maxDistance=t._pannerAttr.maxDistance,t._panner.panningModel=t._pannerAttr.panningModel,t._panner.refDistance=t._pannerAttr.refDistance,t._panner.rolloffFactor=t._pannerAttr.rolloffFactor,t._panner.setPosition(t._pos[0],t._pos[1],t._pos[2]),t._panner.setOrientation(t._orientation[0],t._orientation[1],t._orientation[2])):(t._panner=Howler.ctx.createStereoPanner(),t._panner.pan.value=t._stereo),t._panner.connect(t._node),t._paused||t._parent.pause(t._id,!0).play(t._id)}}()}).call(r,e(28))},560:function(t,r){function e(t){if(t=String(t),!(t.length>1e4)){var r=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(r){var e=parseFloat(r[1]);switch((r[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return e*s;case"days":case"day":case"d":return e*_;case"hours":case"hour":case"hrs":case"hr":case"h":return e*a;case"minutes":case"minute":case"mins":case"min":case"m":return e*i;case"seconds":case"second":case"secs":case"sec":case"s":return e*u;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function n(t){return t>=_?Math.round(t/_)+"d":t>=a?Math.round(t/a)+"h":t>=i?Math.round(t/i)+"m":t>=u?Math.round(t/u)+"s":t+"ms"}function o(t){return c(t,_,"day")||c(t,a,"hour")||c(t,i,"minute")||c(t,u,"second")||t+" ms"}function c(t,r,e){if(!(t<r))return t<1.5*r?Math.floor(t/r)+" "+e:Math.ceil(t/r)+" "+e+"s"}var u=1e3,i=60*u,a=60*i,_=24*a,s=365.25*_;t.exports=function(t,r){r=r||{};var c=typeof t;if("string"===c&&t.length>0)return e(t);if("number"===c&&!1===isNaN(t))return r.long?o(t):n(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},566:function(t,r,e){"use strict";function n(){this.promise=new f(function(t){t()})}function o(t){if(!t)return"undefined";switch(typeof t){case"function":case"string":return t.toString();default:return JSON.stringify(t)}}function c(t,r){return o(t)+o(r)+"undefined"}function u(t,r,e,n,o,u){var i,a=c(e,n);if(!o&&(i=t._cachedViews=t._cachedViews||{},i[a]))return i[a];var _=t.info().then(function(c){function _(t){t.views=t.views||{};var e=r;-1===e.indexOf("/")&&(e=r+"/"+r);var n=t.views[e]=t.views[e]||{};if(!n[s])return n[s]=!0,t}var s=c.db_name+"-mrview-"+(o?"temp":v.stringMd5(a));return d.upsert(t,"_local/"+u,_).then(function(){return t.registerDependentDatabase(s).then(function(r){var o=r.db;o.auto_compaction=!0;var c={name:s,db:o,sourceDB:t,adapter:t.adapter,mapFun:e,reduceFun:n};return c.db.get("_local/lastSeq").catch(function(t){if(404!==t.status)throw t}).then(function(t){return c.seq=t?t.seq:0,i&&c.db.once("destroyed",function(){delete i[a]}),c})})})});return i&&(i[a]=_),_}function i(t){return-1===t.indexOf("/")?[t,t]:t.split("/")}function a(t){return 1===t.length&&/^1-/.test(t[0].rev)}function _(t,r){try{t.emit("error",r)}catch(t){d.guardedConsole("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."),d.guardedConsole("error",r)}}function s(t,r,e,o){function c(t,r,e){try{r(e)}catch(r){_(t,r)}}function s(t,r,e,n,o){try{return{output:r(e,n,o)}}catch(r){return _(t,r),{error:r}}}function v(t,r){var e=h.collate(t.key,r.key);return 0!==e?e:h.collate(t.value,r.value)}function w(t,r,e){return e=e||0,"number"==typeof r?t.slice(e,r+e):e>0?t.slice(e):t}function T(t){var r=t.value;return r&&"object"==typeof r&&r._id||t.id}function k(t){t.rows.forEach(function(t){var r=t.doc&&t.doc._attachments;r&&Object.keys(r).forEach(function(t){var e=r[t];r[t].data=p.base64StringToBlobOrBuffer(e.data,e.content_type)})})}function S(t){return function(r){return t.include_docs&&t.attachments&&t.binary&&k(r),r}}function x(t,r,e,n){var o=r[t];void 0!==o&&(n&&(o=encodeURIComponent(JSON.stringify(o))),e.push(t+"="+o))}function E(t){if(void 0!==t){var r=Number(t);return isNaN(r)||r!==parseInt(t,10)?t:r}}function A(t){return t.group_level=E(t.group_level),t.limit=E(t.limit),t.skip=E(t.skip),t}function O(t){if(t){if("number"!=typeof t)return new m.QueryParseError('Invalid value for integer: "'+t+'"');if(t<0)return new m.QueryParseError('Invalid value for positive integer: "'+t+'"')}}function I(t,r){var e=t.descending?"endkey":"startkey",n=t.descending?"startkey":"endkey";if(void 0!==t[e]&&void 0!==t[n]&&h.collate(t[e],t[n])>0)throw new m.QueryParseError("No rows can match your key range, reverse your start_key and end_key or set {descending : true}");if(r.reduce&&!1!==t.reduce){if(t.include_docs)throw new m.QueryParseError("{include_docs:true} is invalid for reduce");if(t.keys&&t.keys.length>1&&!t.group&&!t.group_level)throw new m.QueryParseError("Multi-key fetches for reduce views must use {group: true}")}["group_level","limit","skip"].forEach(function(r){var e=O(t[r]);if(e)throw e})}function C(t,r,e){var n,o=[],c="GET";if(x("reduce",e,o),x("include_docs",e,o),x("attachments",e,o),x("limit",e,o),x("descending",e,o),x("group",e,o),x("group_level",e,o),x("skip",e,o),x("stale",e,o),x("conflicts",e,o),x("startkey",e,o,!0),x("start_key",e,o,!0),x("endkey",e,o,!0),x("end_key",e,o,!0),x("inclusive_end",e,o),x("key",e,o,!0),o=o.join("&"),o=""===o?"":"?"+o,void 0!==e.keys){var u="keys="+encodeURIComponent(JSON.stringify(e.keys));u.length+o.length+1<=2e3?o+=("?"===o[0]?"&":"?")+u:(c="POST","string"==typeof r?n={keys:e.keys}:r.keys=e.keys)}if("string"==typeof r){var a=i(r);return t.request({method:c,url:"_design/"+a[0]+"/_view/"+a[1]+o,body:n}).then(S(e))}return n=n||{},Object.keys(r).forEach(function(t){Array.isArray(r[t])?n[t]=r[t]:n[t]=r[t].toString()}),t.request({method:"POST",url:"_temp_view"+o,body:n}).then(S(e))}function q(t,r,e){return new f(function(n,o){t._query(r,e,function(t,r){if(t)return o(t);n(r)})})}function N(t){return new f(function(r,e){t._viewCleanup(function(t,n){if(t)return e(t);r(n)})})}function M(t){return function(r){if(404===r.status)return t;throw r}}function j(t,r,e){function n(t){return t.keys.length?r.db.allDocs({keys:t.keys,include_docs:!0}):f.resolve({rows:[]})}function o(t,r){for(var e=[],n=new l.Set,o=0,c=r.rows.length;o<c;o++){var u=r.rows[o],i=u.doc;if(i&&(e.push(i),n.add(i._id),i._deleted=!_.has(i._id),!i._deleted)){var a=_.get(i._id);"value"in a&&(i.value=a.value)}}var s=m.mapToKeysArray(_);return s.forEach(function(t){if(!n.has(t)){var r={_id:t},o=_.get(t);"value"in o&&(r.value=o.value),e.push(r)}}),t.keys=m.uniq(s.concat(t.keys)),e.push(t),e}var c="_local/doc_"+t,u={_id:c,keys:[]},i=e.get(t),_=i[0],s=i[1];return function(){return a(s)?f.resolve(u):r.db.get(c).catch(M(u))}().then(function(t){return n(t).then(function(r){return o(t,r)})})}function D(t,r,e){return t.db.get("_local/lastSeq").catch(M({_id:"_local/lastSeq",seq:0})).then(function(n){var o=m.mapToKeysArray(r);return f.all(o.map(function(e){return j(e,t,r)})).then(function(r){var o=d.flatten(r);return n.seq=e,o.push(n),t.db.bulkDocs({docs:o})})})}function R(t){var r="string"==typeof t?t:t.name,e=g[r];return e||(e=g[r]=new n),e}function B(t){return m.sequentialize(R(t),function(){return L(t)})()}function L(t){function e(t,r){var e={id:f._id,key:h.normalizeKey(t)};void 0!==r&&null!==r&&(e.value=h.normalizeKey(r)),s.push(e)}function o(r,e){return function(){return D(t,r,e)}}function u(){return t.sourceDB.changes({conflicts:!0,include_docs:!0,style:"all_docs",since:p,limit:b}).then(i)}function i(t){var r=t.results;if(r.length){var e=a(r);if(m.add(o(e,p)),!(r.length<b))return u()}}function a(r){for(var e=new l.Map,n=0,o=r.length;n<o;n++){var u=r[n];if("_"!==u.doc._id[0]){s=[],f=u.doc,f._deleted||c(t.sourceDB,d,f),s.sort(v);var i=_(s);e.set(u.doc._id,[i,u.changes])}p=u.seq}return e}function _(t){for(var r,e=new l.Map,n=0,o=t.length;n<o;n++){var c=t[n],u=[c.key,c.id];n>0&&0===h.collate(c.key,r)&&u.push(n),e.set(h.toIndexableString(u),c),r=c.key}return e}var s,f,d=r(t.mapFun,e),p=t.seq||0,m=new n;return u().then(function(){return m.finish()}).then(function(){t.seq=p})}function P(t,r,n){0===n.group_level&&delete n.group_level;var o=n.group||n.group_level,c=e(t.reduceFun),u=[],i=isNaN(n.group_level)?Number.POSITIVE_INFINITY:n.group_level;r.forEach(function(t){var r=u[u.length-1],e=o?t.key:null;if(o&&Array.isArray(e)&&(e=e.slice(0,i)),r&&0===h.collate(r.groupKey,e))return r.keys.push([t.key,t.id]),void r.values.push(t.value);u.push({keys:[[t.key,t.id]],values:[t.value],groupKey:e})}),r=[];for(var a=0,_=u.length;a<_;a++){var f=u[a],l=s(t.sourceDB,c,f.keys,f.values,!1);if(l.error&&l.error instanceof m.BuiltInError)throw l.error;r.push({value:l.error?null:l.output,key:f.groupKey})}return{rows:w(r,n.limit,n.skip)}}function F(t,r){return m.sequentialize(R(t),function(){return $(t,r)})()}function $(t,r){function e(r){return r.include_docs=!0,t.db.allDocs(r).then(function(t){return o=t.total_rows,t.rows.map(function(t){if("value"in t.doc&&"object"==typeof t.doc.value&&null!==t.doc.value){var r=Object.keys(t.doc.value).sort(),e=["id","key","value"];if(!(r<e||r>e))return t.doc.value}var n=h.parseIndexableString(t.doc._id);return{key:n[0],id:n[1],value:"value"in t.doc?t.doc.value:null}})})}function n(e){var n;if(n=c?P(t,e,r):{total_rows:o,offset:u,rows:e},r.include_docs){var i=m.uniq(e.map(T));return t.sourceDB.allDocs({keys:i,include_docs:!0,conflicts:r.conflicts,attachments:r.attachments,binary:r.binary}).then(function(t){var r=new l.Map;return t.rows.forEach(function(t){r.set(t.id,t.doc)}),e.forEach(function(t){var e=T(t),n=r.get(e);n&&(t.doc=n)}),n})}return n}var o,c=t.reduceFun&&!1!==r.reduce,u=r.skip||0;if(void 0===r.keys||r.keys.length||(r.limit=0,delete r.keys),void 0!==r.keys){var i=r.keys,a=i.map(function(t){return e({startkey:h.toIndexableString([t]),endkey:h.toIndexableString([t,{}])})});return f.all(a).then(d.flatten).then(n)}var _,s,p={descending:r.descending};if("start_key"in r&&(_=r.start_key),"startkey"in r&&(_=r.startkey),"end_key"in r&&(s=r.end_key),"endkey"in r&&(s=r.endkey),void 0!==_&&(p.startkey=r.descending?h.toIndexableString([_,{}]):h.toIndexableString([_])),void 0!==s){var v=!1!==r.inclusive_end;r.descending&&(v=!v),p.endkey=h.toIndexableString(v?[s,{}]:[s])}if(void 0!==r.key){var g=h.toIndexableString([r.key]),y=h.toIndexableString([r.key,{}]);p.descending?(p.endkey=g,p.startkey=y):(p.startkey=g,p.endkey=y)}return c||("number"==typeof r.limit&&(p.limit=r.limit),p.skip=u),e(p).then(n)}function U(t){return t.request({method:"POST",url:"_view_cleanup"})}function J(r){return r.get("_local/"+t).then(function(t){var e=new l.Map;Object.keys(t.views).forEach(function(t){var r=i(t),n="_design/"+r[0],o=r[1],c=e.get(n);c||(c=new l.Set,e.set(n,c)),c.add(o)});var n={keys:m.mapToKeysArray(e),include_docs:!0};return r.allDocs(n).then(function(n){var o={};n.rows.forEach(function(r){var n=r.key.substring(8);e.get(r.key).forEach(function(e){var c=n+"/"+e;t.views[c]||(c=e);var u=Object.keys(t.views[c]),i=r.doc&&r.doc.views&&r.doc.views[e];u.forEach(function(t){o[t]=o[t]||i})})});var c=Object.keys(o).filter(function(t){return!o[t]}),u=c.map(function(t){return m.sequentialize(R(t),function(){return new r.constructor(t,r.__opts).destroy()})()});return f.all(u).then(function(){return{ok:!0}})})},M({ok:!0}))}function H(r,e,n){if("function"==typeof r._query)return q(r,e,n);if(d.isRemote(r))return C(r,e,n);if("string"!=typeof e)return I(n,e),y.add(function(){return u(r,"temp_view/temp_view",e.map,e.reduce,!0,t).then(function(t){return m.fin(B(t).then(function(){return F(t,n)}),function(){return t.db.destroy()})})}),y.finish();var c=e,a=i(c),_=a[0],s=a[1];return r.get("_design/"+_).then(function(e){var i=e.views&&e.views[s];if(!i)throw new m.NotFoundError("ddoc "+e._id+" has no view named "+s);return o(e,s),I(n,i),u(r,c,i.map,i.reduce,!1,t).then(function(t){return"ok"===n.stale||"update_after"===n.stale?("update_after"===n.stale&&d.nextTick(function(){B(t)}),F(t,n)):B(t).then(function(){return F(t,n)})})})}function V(t,r,e){var n=this;"function"==typeof r&&(e=r,r={}),r=r?A(r):{},"function"==typeof t&&(t={map:t});var o=f.resolve().then(function(){return H(n,t,r)});return m.promisedCallback(o,e),o}return{query:V,viewCleanup:m.callbackify(function(){var t=this;return"function"==typeof t._viewCleanup?N(t):d.isRemote(t)?U(t):J(t)})}}var f=function(t){return t&&"object"==typeof t&&"default"in t?t.default:t}(e(113)),l=e(165),d=e(114),p=e(242),h=e(164),v=e(243),m=e(570);n.prototype.add=function(t){return this.promise=this.promise.catch(function(){}).then(function(){return t()}),this.promise},n.prototype.finish=function(){return this.promise};var g={},y=new n,b=50;t.exports=s},567:function(t,r,e){"use strict";(function(r){function n(t){return t&&"object"==typeof t&&"default"in t?t.default:t}function o(t){return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer||"undefined"!=typeof Blob&&t instanceof Blob}function c(t){if("function"==typeof t.slice)return t.slice(0);var r=new ArrayBuffer(t.byteLength),e=new Uint8Array(r),n=new Uint8Array(t);return e.set(n),r}function u(t){if(t instanceof ArrayBuffer)return c(t);var r=t.size,e=t.type;return"function"==typeof t.slice?t.slice(0,r,e):t.webkitSlice(0,r,e)}function i(t){var r=Object.getPrototypeOf(t);if(null===r)return!0;var e=r.constructor;return"function"==typeof e&&e instanceof e&&vo.call(e)==mo}function a(t){var r,e,n;if(!t||"object"!=typeof t)return t;if(Array.isArray(t)){for(r=[],e=0,n=t.length;e<n;e++)r[e]=a(t[e]);return r}if(t instanceof Date)return t.toISOString();if(o(t))return u(t);if(!i(t))return t;r={};for(e in t)if(Object.prototype.hasOwnProperty.call(t,e)){var c=a(t[e]);void 0!==c&&(r[e]=c)}return r}function _(t){var r=!1;return io(function(e){if(r)throw new Error("once called more than once");r=!0,t.apply(this,e)})}function s(t){return io(function(r){r=a(r);var e=this,n="function"==typeof r[r.length-1]&&r.pop(),o=new ho(function(n,o){var c;try{var u=_(function(t,r){t?o(t):n(r)});r.push(u),c=t.apply(e,r),c&&"function"==typeof c.then&&n(c)}catch(t){o(t)}});return n&&o.then(function(t){n(null,t)},n),o})}function f(t,r,e){if(t.constructor.listeners("debug").length){for(var n=["api",t.name,r],o=0;o<e.length-1;o++)n.push(e[o]);t.constructor.emit("debug",n);var c=e[e.length-1];e[e.length-1]=function(e,n){var o=["api",t.name,r];o=o.concat(e?["error",e]:["success",n]),t.constructor.emit("debug",o),c(e,n)}}}function l(t,r){return s(io(function(e){if(this._closed)return ho.reject(new Error("database is closed"));if(this._destroyed)return ho.reject(new Error("database is destroyed"));var n=this;return f(n,t,e),this.taskqueue.isReady?r.apply(this,e):new ho(function(r,o){n.taskqueue.addTask(function(c){c?o(c):r(n[t].apply(n,e))})})}))}function d(t){return"$"+t}function p(t){return t.substring(1)}function h(){this._store={}}function v(t){if(this._store=new h,t&&Array.isArray(t))for(var r=0,e=t.length;r<e;r++)this.add(t[r])}function m(t,r){for(var e={},n=0,o=r.length;n<o;n++){var c=r[n];c in t&&(e[c]=t[c])}return e}function g(t){return t}function y(t){return[{ok:t}]}function b(t,r,e){function n(){var t=[];l.forEach(function(r){r.docs.forEach(function(e){t.push({id:r.id,docs:[e]})})}),e(null,{results:t})}function o(){++f===s&&n()}function c(t,r,e){l[t]={id:r,docs:e},o()}function u(){if(!(p>=d.length)){var t=Math.min(p+wo,d.length),r=d.slice(p,t);i(r,p),p+=r.length}}function i(e,n){e.forEach(function(e,o){var i=n+o,a=_.get(e),s=m(a[0],["atts_since","attachments"]);s.open_revs=a.map(function(t){return t.rev}),s.open_revs=s.open_revs.filter(g);var f=g;0===s.open_revs.length&&(delete s.open_revs,f=y),["revs","attachments","binary","ajax","latest"].forEach(function(t){t in r&&(s[t]=r[t])}),t.get(e,s,function(t,r){var n;n=t?[{error:t}]:f(r),c(i,e,n),u()})})}var a=r.docs,_=new yo;a.forEach(function(t){_.has(t.id)?_.get(t.id).push(t):_.set(t.id,[t])});var s=_.size,f=0,l=new Array(s),d=[];_.forEach(function(t,r){d.push(r)});var p=0;u()}function w(){return"undefined"!=typeof chrome&&void 0!==chrome.storage&&void 0!==chrome.storage.local}function T(){return bo}function k(t){w()?chrome.storage.onChanged.addListener(function(r){null!=r.db_name&&t.emit(r.dbName.newValue)}):T()&&("undefined"!=typeof addEventListener?addEventListener("storage",function(r){t.emit(r.key)}):window.attachEvent("storage",function(r){t.emit(r.key)}))}function S(){ao.EventEmitter.call(this),this._listeners={},k(this)}function x(t){if("undefined"!==console&&t in console){var r=Array.prototype.slice.call(arguments,1);console[t].apply(console,r)}}function E(t,r){return t=parseInt(t,10)||0,r=parseInt(r,10),r!==r||r<=t?r=(t||1)<<1:r+=1,r>6e5&&(t=3e5,r=6e5),~~((r-t)*Math.random()+t)}function A(t){var r=0;return t||(r=2e3),E(t,r)}function O(t,r){x("info","The above "+t+" is totally normal. "+r)}function I(t,r,e){Error.call(this,e),this.status=t,this.name=r,this.message=e,this.error=!0}function C(t,r){function e(r){for(var e in t)"function"!=typeof t[e]&&(this[e]=t[e]);void 0!==r&&(this.reason=r)}return e.prototype=I.prototype,new e(r)}function q(t){if("object"!=typeof t){var r=t;t=Co,t.data=r}return"error"in t&&"conflict"===t.error&&(t.name="conflict",t.status=409),"name"in t||(t.name=t.error||"unknown"),"status"in t||(t.status=500),"message"in t||(t.message=t.message||t.reason),t}function N(t,r,e){try{return!t(r,e)}catch(t){var n="Filter function threw: "+t.toString();return C(jo,n)}}function M(t){var r={},e=t.filter&&"function"==typeof t.filter;return r.query=t.query_params,function(n){n.doc||(n.doc={});var o=e&&N(t.filter,n.doc,r);if("object"==typeof o)return o;if(o)return!1;if(t.include_docs){if(!t.attachments)for(var c in n.doc._attachments)n.doc._attachments.hasOwnProperty(c)&&(n.doc._attachments[c].stub=!0)}else delete n.doc;return!0}}function j(t){for(var r=[],e=0,n=t.length;e<n;e++)r=r.concat(t[e]);return r}function D(){}function R(t){var r;if(t?"string"!=typeof t?r=C(Ao):/^_/.test(t)&&!/^_(design|local)/.test(t)&&(r=C(Io)):r=C(Oo),r)throw r}function B(t){return"boolean"==typeof t._remote?t._remote:"function"==typeof t.type&&(x("warn","db.type() is deprecated and will be removed in a future version of PouchDB"),"http"===t.type())}function L(t,r){return"listenerCount"in t?t.listenerCount(r):ao.EventEmitter.listenerCount(t,r)}function P(t){if(!t)return null;var r=t.split("/");return 2===r.length?r:1===r.length?[t,t]:null}function F(t){var r=P(t);return r?r.join("/"):null}function $(t){for(var r=Ho.exec(t),e={},n=14;n--;){var o=$o[n],c=r[n]||"",u=-1!==["user","password"].indexOf(o);e[o]=u?decodeURIComponent(c):c}return e[Uo]={},e[$o[12]].replace(Jo,function(t,r,n){r&&(e[Uo][r]=n)}),e}function U(t,r){var e=[],n=[];for(var o in r)r.hasOwnProperty(o)&&(e.push(o),n.push(r[o]));return e.push(t),Function.apply(null,e).apply(null,n)}function J(t,r,e){return new ho(function(n,o){t.get(r,function(c,u){if(c){if(404!==c.status)return o(c);u={}}var i=u._rev,a=e(u);if(!a)return n({updated:!1,rev:i});a._id=r,a._rev=i,n(H(t,a,e))})})}function H(t,r,e){return t.put(r).then(function(t){return{updated:!0,rev:t.rev}},function(n){if(409!==n.status)throw n;return J(t,r._id,e)})}function V(t){return 0|Math.random()*t}function z(t,r){r=r||Vo.length;var e="",n=-1;if(t){for(;++n<t;)e+=Vo[V(r)];return e}for(;++n<36;)switch(n){case 8:case 13:case 18:case 23:e+="-";break;case 19:e+=Vo[3&V(16)|8];break;default:e+=Vo[V(16)]}return e}function W(t){for(var r,e,n,o,c=t.rev_tree.slice();o=c.pop();){var u=o.ids,i=u[2],a=o.pos;if(i.length)for(var _=0,s=i.length;_<s;_++)c.push({pos:a+1,ids:i[_]});else{var f=!!u[1].deleted,l=u[0];r&&!(n!==f?n:e!==a?e<a:r<l)||(r=l,e=a,n=f)}}return e+"-"+r}function G(t,r){for(var e,n=t.slice();e=n.pop();)for(var o=e.pos,c=e.ids,u=c[2],i=r(0===u.length,o,c[0],e.ctx,c[1]),a=0,_=u.length;a<_;a++)n.push({pos:o+1,ids:u[a],ctx:i})}function K(t,r){return t.pos-r.pos}function X(t){var r=[];G(t,function(t,e,n,o,c){t&&r.push({rev:e+"-"+n,pos:e,opts:c})}),r.sort(K).reverse();for(var e=0,n=r.length;e<n;e++)delete r[e].pos;return r}function Q(t){for(var r=W(t),e=X(t.rev_tree),n=[],o=0,c=e.length;o<c;o++){var u=e[o];u.rev===r||u.opts.deleted||n.push(u.rev)}return n}function Y(t){var r=[];return G(t.rev_tree,function(t,e,n,o,c){"available"!==c.status||t||(r.push(e+"-"+n),c.status="missing")}),r}function Z(t){for(var r,e=[],n=t.slice();r=n.pop();){var o=r.pos,c=r.ids,u=c[0],i=c[1],a=c[2],_=0===a.length,s=r.history?r.history.slice():[];s.push({id:u,opts:i}),_&&e.push({pos:o+1-s.length,ids:s});for(var f=0,l=a.length;f<l;f++)n.push({pos:o+1,ids:a[f],history:s})}return e.reverse()}function tt(t,r){return t.pos-r.pos}function rt(t,r,e){for(var n,o=0,c=t.length;o<c;)n=o+c>>>1,e(t[n],r)<0?o=n+1:c=n;return o}function et(t,r,e){var n=rt(t,r,e);t.splice(n,0,r)}function nt(t,r){for(var e,n,o=r,c=t.length;o<c;o++){var u=t[o],i=[u.id,u.opts,[]];n?(n[2].push(i),n=i):e=n=i}return e}function ot(t,r){return t[0]<r[0]?-1:1}function ct(t,r){for(var e=[{tree1:t,tree2:r}],n=!1;e.length>0;){var o=e.pop(),c=o.tree1,u=o.tree2;(c[1].status||u[1].status)&&(c[1].status="available"===c[1].status||"available"===u[1].status?"available":"missing");for(var i=0;i<u[2].length;i++)if(c[2][0]){for(var a=!1,_=0;_<c[2].length;_++)c[2][_][0]===u[2][i][0]&&(e.push({tree1:c[2][_],tree2:u[2][i]}),a=!0);a||(n="new_branch",et(c[2],u[2][i],ot))}else n="new_leaf",c[2][0]=u[2][i]}return{conflicts:n,tree:t}}function ut(t,r,e){var n,o=[],c=!1,u=!1;if(!t.length)return{tree:[r],conflicts:"new_leaf"};for(var i=0,a=t.length;i<a;i++){var _=t[i];if(_.pos===r.pos&&_.ids[0]===r.ids[0])n=ct(_.ids,r.ids),o.push({pos:_.pos,ids:n.tree}),c=c||n.conflicts,u=!0;else if(!0!==e){var s=_.pos<r.pos?_:r,f=_.pos<r.pos?r:_,l=f.pos-s.pos,d=[],p=[];for(p.push({ids:s.ids,diff:l,parent:null,parentIdx:null});p.length>0;){var h=p.pop();if(0!==h.diff)for(var v=h.ids[2],m=0,g=v.length;m<g;m++)p.push({ids:v[m],diff:h.diff-1,parent:h.ids,parentIdx:m});else h.ids[0]===f.ids[0]&&d.push(h)}var y=d[0];y?(n=ct(y.ids,f.ids),y.parent[2][y.parentIdx]=n.tree,o.push({pos:s.pos,ids:s.ids}),c=c||n.conflicts,u=!0):o.push(_)}else o.push(_)}return u||o.push(r),o.sort(tt),{tree:o,conflicts:c||"internal_node"}}function it(t,r){for(var e,n,o=Z(t),c=0,u=o.length;c<u;c++){var i,a=o[c],_=a.ids;if(_.length>r){e||(e={});var s=_.length-r;i={pos:a.pos+s,ids:nt(_,s)};for(var f=0;f<s;f++){var l=a.pos+f+"-"+_[f].id;e[l]=!0}}else i={pos:a.pos,ids:nt(_,0)};n=n?ut(n,i,!0).tree:[i]}return e&&G(n,function(t,r,n){delete e[r+"-"+n]}),{tree:n,revs:e?Object.keys(e):[]}}function at(t,r,e){var n=ut(t,r),o=it(n.tree,e);return{tree:o.tree,stemmedRevs:o.revs,conflicts:n.conflicts}}function _t(t,r){for(var e,n=t.slice(),o=r.split("-"),c=parseInt(o[0],10),u=o[1];e=n.pop();){if(e.pos===c&&e.ids[0]===u)return!0;for(var i=e.ids[2],a=0,_=i.length;a<_;a++)n.push({pos:e.pos+1,ids:i[a]})}return!1}function st(t){return t.ids}function ft(t,r){r||(r=W(t));for(var e,n=r.substring(r.indexOf("-")+1),o=t.rev_tree.map(st);e=o.pop();){if(e[0]===n)return!!e[1].deleted;o=o.concat(e[2])}}function lt(t){return/^_local/.test(t)}function dt(t,r){for(var e,n=r.rev_tree.slice();e=n.pop();){var o=e.pos,c=e.ids,u=c[0],i=c[1],a=c[2],_=0===a.length,s=e.history?e.history.slice():[];if(s.push({id:u,pos:o,opts:i}),_)for(var f=0,l=s.length;f<l;f++){var d=s[f],p=d.pos+"-"+d.id;if(p===t)return o+"-"+u}for(var h=0,v=a.length;h<v;h++)n.push({pos:o+1,ids:a[h],history:s})}throw new Error("Unable to resolve latest revision for id "+r.id+", rev "+t)}function pt(t,r){try{t.emit("change",r)}catch(t){x("error",'Error in .on("change", function):',t)}}function ht(t,r,e){function n(){o.cancel()}ao.EventEmitter.call(this);var o=this;this.db=t,r=r?a(r):{};var c=r.complete=_(function(r,e){r?L(o,"error")>0&&o.emit("error",r):o.emit("complete",e),o.removeAllListeners(),t.removeListener("destroyed",n)});e&&(o.on("complete",function(t){e(null,t)}),o.on("error",e)),t.once("destroyed",n),r.onChange=function(t){o.isCancelled||pt(o,t)};var u=new ho(function(t,e){r.complete=function(r,n){r?e(r):t(n)}});o.once("cancel",function(){t.removeListener("destroyed",n),r.complete(null,{status:"cancelled"})}),this.then=u.then.bind(u),this.catch=u.catch.bind(u),this.then(function(t){c(null,t)},c),t.taskqueue.isReady?o.validateChanges(r):t.taskqueue.addTask(function(t){t?r.complete(t):o.isCancelled?o.emit("cancel"):o.validateChanges(r)})}function vt(t,r,e){var n=[{rev:t._rev}];"all_docs"===e.style&&(n=X(r.rev_tree).map(function(t){return{rev:t.rev}}));var o={id:r.id,changes:n,doc:t};return ft(r,t._rev)&&(o.deleted=!0),e.conflicts&&(o.doc._conflicts=Q(r),o.doc._conflicts.length||delete o.doc._conflicts),o}function mt(t,r){return t<r?-1:t>r?1:0}function gt(t){return function(r,e){r||e[0]&&e[0].error?t(r||e[0]):t(null,e.length?e[0]:e)}}function yt(t){for(var r=0;r<t.length;r++){var e=t[r];if(e._deleted)delete e._attachments;else if(e._attachments)for(var n=Object.keys(e._attachments),o=0;o<n.length;o++){var c=n[o];e._attachments[c]=m(e._attachments[c],["data","digest","content_type","length","revpos","stub"])}}}function bt(t,r){var e=mt(t._id,r._id);return 0!==e?e:mt(t._revisions?t._revisions.start:0,r._revisions?r._revisions.start:0)}function wt(t){var r={},e=[];return G(t,function(t,n,o,c){var u=n+"-"+o;return t&&(r[u]=0),void 0!==c&&e.push({from:c,to:u}),u}),e.reverse(),e.forEach(function(t){void 0===r[t.from]?r[t.from]=1+r[t.to]:r[t.from]=Math.min(r[t.from],1+r[t.to])}),r}function Tt(t,r,e){var n="limit"in r?r.keys.slice(r.skip,r.limit+r.skip):r.skip>0?r.keys.slice(r.skip):r.keys;if(r.descending&&n.reverse(),!n.length)return t._allDocs({limit:0},e);var o={offset:r.skip};return ho.all(n.map(function(e){var n=ko({key:e,deleted:"ok"},r);return["limit","skip","keys"].forEach(function(t){delete n[t]}),new ho(function(r,c){t._allDocs(n,function(t,n){if(t)return c(t);o.total_rows=n.total_rows,r(n.rows[0]||{key:e,error:"not_found"})})})})).then(function(t){return o.rows=t,o})}function kt(t){var r=t._compactionQueue[0],e=r.opts,n=r.callback;t.get("_local/compaction").catch(function(){return!1}).then(function(r){r&&r.last_seq&&(e.last_seq=r.last_seq),t._compact(e,function(r,e){r?n(r):n(null,e),so(function(){t._compactionQueue.shift(),t._compactionQueue.length&&kt(t)})})})}function St(t){return"_"===t.charAt(0)&&t+" is not a valid attachment name, attachment names cannot start with '_'"}function xt(){ao.EventEmitter.call(this)}function Et(){this.isReady=!1,this.failed=!1,this.queue=[]}function At(t,r){var e=t.match(/([a-z\-]*):\/\/(.*)/);if(e)return{name:/https?/.test(e[1])?e[1]+"://"+e[2]:e[2],adapter:e[1]};var n=It.adapters,o=It.preferredAdapters,c=It.prefix,u=r.adapter;if(!u)for(var i=0;i<o.length;++i){u=o[i];{if(!("idb"===u&&"websql"in n&&T()&&localStorage["_pouch__websqldb_"+c+t]))break;x("log",'PouchDB is downgrading "'+t+'" to WebSQL to avoid data loss, because it was already opened with WebSQL.')}}var a=n[u];return{name:a&&"use_prefix"in a&&!a.use_prefix?t:c+t,adapter:u}}function Ot(t){function r(){t.removeListener("closed",n),t.constructor.emit("destroyed",t.name)}function e(){t.removeListener("destroyed",r),t.removeListener("closed",n),t.emit("destroyed")}function n(){t.removeListener("destroyed",r),o.delete(t.name)}var o=t.constructor._destructionListeners;t.once("destroyed",r),t.once("closed",n),o.has(t.name)||o.set(t.name,[]),o.get(t.name).push(e)}function It(t,r){if(!(this instanceof It))return new It(t,r);var e=this;if(r=r||{},t&&"object"==typeof t&&(r=t,t=r.name,delete r.name),this.__opts=r=a(r),e.auto_compaction=r.auto_compaction,e.prefix=It.prefix,"string"!=typeof t)throw new Error("Missing/invalid DB name");var n=(r.prefix||"")+t,o=At(n,r);if(r.name=o.name,r.adapter=r.adapter||o.adapter,e.name=t,e._adapter=r.adapter,It.emit("debug",["adapter","Picked adapter: ",r.adapter]),!It.adapters[r.adapter]||!It.adapters[r.adapter].valid())throw new Error("Invalid Adapter: "+r.adapter);xt.call(e),e.taskqueue=new Et,e.adapter=r.adapter,It.adapters[r.adapter].call(e,r,function(t){if(t)return e.taskqueue.fail(t);Ot(e),e.emit("created",e),It.emit("created",e.name),e.taskqueue.ready(e)})}function Ct(t){t.debug=fo;var r={};t.on("debug",function(t){var e=t[0],n=t.slice(1);r[e]||(r[e]=fo("pouchdb:"+e)),r[e].apply(null,n)})}function qt(t,r){for(var e=t,n=0,o=r.length;n<o;n++){if(!(e=e[r[n]]))break}return e}function Nt(t,r){return t<r?-1:t>r?1:0}function Mt(t){for(var r=[],e="",n=0,o=t.length;n<o;n++){var c=t[n];"."===c?n>0&&"\\"===t[n-1]?e=e.substring(0,e.length-1)+".":(r.push(e),e=""):e+=c}return r.push(e),r}function jt(t){return Wo.indexOf(t)>-1}function Dt(t){return Object.keys(t)[0]}function Rt(t){return t[Dt(t)]}function Bt(t){var r={};return t.forEach(function(t){Object.keys(t).forEach(function(e){var n=t[e];if("object"!=typeof n&&(n={$eq:n}),jt(e))n instanceof Array?r[e]=n.map(function(t){return Bt([t])}):r[e]=Bt([n]);else{var o=r[e]=r[e]||{};Object.keys(n).forEach(function(t){var r=n[t];return"$gt"===t||"$gte"===t?Lt(t,r,o):"$lt"===t||"$lte"===t?Pt(t,r,o):"$ne"===t?Ft(r,o):"$eq"===t?$t(r,o):void(o[t]=r)})}})}),r}function Lt(t,r,e){void 0===e.$eq&&(void 0!==e.$gte?"$gte"===t?r>e.$gte&&(e.$gte=r):r>=e.$gte&&(delete e.$gte,e.$gt=r):void 0!==e.$gt?"$gte"===t?r>e.$gt&&(delete e.$gt,e.$gte=r):r>e.$gt&&(e.$gt=r):e[t]=r)}function Pt(t,r,e){void 0===e.$eq&&(void 0!==e.$lte?"$lte"===t?r<e.$lte&&(e.$lte=r):r<=e.$lte&&(delete e.$lte,e.$lt=r):void 0!==e.$lt?"$lte"===t?r<e.$lt&&(delete e.$lt,e.$lte=r):r<e.$lt&&(e.$lt=r):e[t]=r)}function Ft(t,r){"$ne"in r?r.$ne.push(t):r.$ne=[t]}function $t(t,r){delete r.$gt,delete r.$gte,delete r.$lt,delete r.$lte,delete r.$ne,r.$eq=t}function Ut(t){var r=a(t),e=!1;"$and"in r&&(r=Bt(r.$and),e=!0),["$or","$nor"].forEach(function(t){t in r&&r[t].forEach(function(t){for(var r=Object.keys(t),e=0;e<r.length;e++){var n=r[e],o=t[n];"object"==typeof o&&null!==o||(t[n]={$eq:o})}})}),"$not"in r&&(r.$not=Bt([r.$not]));for(var n=Object.keys(r),o=0;o<n.length;o++){var c=n[o],u=r[c];"object"!=typeof u||null===u?u={$eq:u}:"$ne"in u&&!e&&(u.$ne=[u.$ne]),r[c]=u}return r}function Jt(t,r,e){for(var n="",o=e-t.length;n.length<o;)n+=r;return n}function Ht(t,r,e){return Jt(t,r,e)+t}function Vt(t,r){if(t===r)return 0;t=zt(t),r=zt(r);var e=rr(t),n=rr(r);if(e-n!=0)return e-n;switch(typeof t){case"number":return t-r;case"boolean":return t<r?-1:1;case"string":return Zt(t,r)}return Array.isArray(t)?Yt(t,r):tr(t,r)}function zt(t){switch(typeof t){case"undefined":return null;case"number":return t===1/0||t===-1/0||isNaN(t)?null:t;case"object":var r=t;if(Array.isArray(t)){var e=t.length;t=new Array(e);for(var n=0;n<e;n++)t[n]=zt(r[n])}else{if(t instanceof Date)return t.toJSON();if(null!==t){t={};for(var o in r)if(r.hasOwnProperty(o)){var c=r[o];void 0!==c&&(t[o]=zt(c))}}}}return t}function Wt(t){if(null!==t)switch(typeof t){case"boolean":return t?1:0;case"number":return er(t);case"string":return t.replace(/\u0002/g,"").replace(/\u0001/g,"").replace(/\u0000/g,"");case"object":var r=Array.isArray(t),e=r?t:Object.keys(t),n=-1,o=e.length,c="";if(r)for(;++n<o;)c+=Gt(e[n]);else for(;++n<o;){var u=e[n];c+=Gt(u)+Gt(t[u])}return c}return""}function Gt(t){return t=zt(t),rr(t)+Xo+Wt(t)+"\0"}function Kt(t,r){var e,n=r;if("1"===t[r])e=0,r++;else{var o="0"===t[r];r++;var c="",u=t.substring(r,r+Ko),i=parseInt(u,10)+Go;for(o&&(i=-i),r+=Ko;;){var a=t[r];if("\0"===a)break;c+=a,r++}c=c.split("."),e=1===c.length?parseInt(c,10):parseFloat(c[0]+"."+c[1]),o&&(e-=10),0!==i&&(e=parseFloat(e+"e"+i))}return{num:e,length:r-n}}function Xt(t,r){var e=t.pop();if(r.length){var n=r[r.length-1];e===n.element&&(r.pop(),n=r[r.length-1]);var o=n.element,c=n.index;if(Array.isArray(o))o.push(e);else if(c===t.length-2){var u=t.pop();o[u]=e}else t.push(e)}}function Qt(t){for(var r=[],e=[],n=0;;){var o=t[n++];if("\0"!==o)switch(o){case"1":r.push(null);break;case"2":r.push("1"===t[n]),n++;break;case"3":var c=Kt(t,n);r.push(c.num),n+=c.length;break;case"4":for(var u="";;){var i=t[n];if("\0"===i)break;u+=i,n++}u=u.replace(/\u0001\u0001/g,"\0").replace(/\u0001\u0002/g,"").replace(/\u0002\u0002/g,""),r.push(u);break;case"5":var a={element:[],index:r.length};r.push(a.element),e.push(a);break;case"6":var _={element:{},index:r.length};r.push(_.element),e.push(_);break;default:throw new Error("bad collationIndex or unexpectedly reached end of input: "+o)}else{if(1===r.length)return r.pop();Xt(r,e)}}}function Yt(t,r){for(var e=Math.min(t.length,r.length),n=0;n<e;n++){var o=Vt(t[n],r[n]);if(0!==o)return o}return t.length===r.length?0:t.length>r.length?1:-1}function Zt(t,r){return t===r?0:t>r?1:-1}function tr(t,r){for(var e=Object.keys(t),n=Object.keys(r),o=Math.min(e.length,n.length),c=0;c<o;c++){var u=Vt(e[c],n[c]);if(0!==u)return u;if(0!==(u=Vt(t[e[c]],r[n[c]])))return u}return e.length===n.length?0:e.length>n.length?1:-1}function rr(t){var r=["boolean","number","string","object"],e=r.indexOf(typeof t);return~e?null===t?1:Array.isArray(t)?5:e<3?e+2:e+3:Array.isArray(t)?5:void 0}function er(t){if(0===t)return"1";var r=t.toExponential().split(/e\+?/),e=parseInt(r[1],10),n=t<0,o=n?"0":"2",c=(n?-e:e)-Go,u=Ht(c.toString(),"0",Ko);o+=Xo+u;var i=Math.abs(parseFloat(r[0]));n&&(i=10-i);var a=i.toFixed(20);return a=a.replace(/\.?0+$/,""),o+=Xo+a}function nr(t){function r(r){return t.map(function(t){var e=Dt(t),n=Mt(e);return qt(r,n)})}return function(t,e){var n=r(t.doc),o=r(e.doc),c=Vt(n,o);return 0!==c?c:Nt(t.doc._id,e.doc._id)}}function or(t,r,e){if(t=t.filter(function(t){return cr(t.doc,r.selector,e)}),r.sort){var n=nr(r.sort);t=t.sort(n),"string"!=typeof r.sort[0]&&"desc"===Rt(r.sort[0])&&(t=t.reverse())}if("limit"in r||"skip"in r){var o=r.skip||0,c=("limit"in r?r.limit:t.length)+o;t=t.slice(o,c)}return t}function cr(t,r,e){return e.every(function(e){if(ur(t))return!1;var n=r[e],o=Mt(e),c=qt(t,o);return jt(e)?ar(e,n,t):ir(n,t,o,c)})}function ur(t){return/^_design\//.test(t._id)}function ir(t,r,e,n){return!t||Object.keys(t).every(function(o){var c=t[o];return _r(o,r,c,e,n)})}function ar(t,r,e){return"$or"===t?r.some(function(t){return cr(e,t,Object.keys(t))}):"$not"===t?!cr(e,r,Object.keys(r)):!r.find(function(t){return cr(e,t,Object.keys(t))})}function _r(t,r,e,n,o){if(!Qo[t])throw new Error('unknown operator "'+t+'" - should be one of $eq, $lte, $lt, $gt, $gte, $exists, $ne, $in, $nin, $size, $mod, $regex, $elemMatch, $type or $all');return Qo[t](r,e,n,o)}function sr(t){return void 0!==t&&null!==t}function fr(t){return void 0!==t}function lr(t,r){var e=r[0],n=r[1];if(0===e)throw new Error("Bad divisor, cannot divide by zero");if(parseInt(e,10)!==e)throw new Error("Divisor is not an integer");if(parseInt(n,10)!==n)throw new Error("Modulus is not an integer");return parseInt(t,10)===t&&t%e===n}function dr(t,r){return r.some(function(r){return t instanceof Array?t.indexOf(r)>-1:t===r})}function pr(t,r){return r.every(function(r){return t.indexOf(r)>-1})}function hr(t,r){return t.length===r}function vr(t,r){return new RegExp(r).test(t)}function mr(t,r){switch(r){case"null":return null===t;case"boolean":return"boolean"==typeof t;case"number":return"number"==typeof t;case"string":return"string"==typeof t;case"array":return t instanceof Array;case"object":return"[object Object]"==={}.toString.call(t)}throw new Error(r+" not supported as a type.Please use one of object, string, array, number, boolean or null.")}function gr(t,r){if("object"!=typeof r)throw"Selector error: expected a JSON object";r=Ut(r);var e={doc:t},n=or([e],{selector:r},Object.keys(r));return n&&1===n.length}function yr(t){return U('"use strict";\nreturn '+t+";",{})}function br(t){return U(["return function(doc) {",'  "use strict";',"  var emitted = false;","  var emit = function (a, b) {","    emitted = true;","  };","  var view = "+t+";","  view(doc);","  if (emitted) {","    return true;","  }","};"].join("\n"),{})}function wr(t,r){if(t.selector&&t.filter&&"_selector"!==t.filter){var e="string"==typeof t.filter?t.filter:"function";return r(new Error('selector invalid for filter "'+e+'"'))}r()}function Tr(t){t.view&&!t.filter&&(t.filter="_view"),t.selector&&!t.filter&&(t.filter="_selector"),t.filter&&"string"==typeof t.filter&&("_view"===t.filter?t.view=F(t.view):t.filter=F(t.filter))}function kr(t,r){return r.filter&&"string"==typeof r.filter&&!r.doc_ids&&!B(t.db)}function Sr(t,r){var e=r.complete;if("_view"===r.filter){if(!r.view||"string"!=typeof r.view){var n=C(jo,"`view` filter parameter not found or invalid.");return e(n)}var o=P(r.view);t.db.get("_design/"+o[0],function(n,c){if(t.isCancelled)return e(null,{status:"cancelled"});if(n)return e(q(n));var u=c&&c.views&&c.views[o[1]]&&c.views[o[1]].map;if(!u)return e(C(xo,c.views?"missing json key: "+o[1]:"missing json key: views"));r.filter=br(u),t.doChanges(r)})}else if(r.selector)r.filter=function(t){return gr(t,r.selector)},t.doChanges(r);else{var c=P(r.filter);t.db.get("_design/"+c[0],function(n,o){if(t.isCancelled)return e(null,{status:"cancelled"});if(n)return e(q(n));var u=o&&o.filters&&o.filters[c[1]];if(!u)return e(C(xo,o&&o.filters?"missing json key: "+c[1]:"missing json key: filters"));r.filter=yr(u),t.doChanges(r)})}}function xr(t){t._changesFilterPlugin={validate:wr,normalize:Tr,shouldFilter:kr,filter:Sr}}function Er(t){return t.reduce(function(t,r){return t[r]=!0,t},{})}function Ar(t){if(!/^\d+\-./.test(t))return C(Lo);var r=t.indexOf("-"),e=t.substring(0,r),n=t.substring(r+1);return{prefix:parseInt(e,10),id:n}}function Or(t,r){for(var e=t.start-t.ids.length+1,n=t.ids,o=[n[0],r,[]],c=1,u=n.length;c<u;c++)o=[n[c],{status:"missing"},[o]];return[{pos:e,ids:o}]}function Ir(t,r){var e,n,o,c={status:"available"};if(t._deleted&&(c.deleted=!0),r)if(t._id||(t._id=z()),n=z(32,16).toLowerCase(),t._rev){if(o=Ar(t._rev),o.error)return o;t._rev_tree=[{pos:o.prefix,ids:[o.id,{status:"missing"},[[n,c,[]]]]}],e=o.prefix+1}else t._rev_tree=[{pos:1,ids:[n,c,[]]}],e=1;else if(t._revisions&&(t._rev_tree=Or(t._revisions,c),e=t._revisions.start,n=t._revisions.ids[0]),!t._rev_tree){if(o=Ar(t._rev),o.error)return o;e=o.prefix,n=o.id,t._rev_tree=[{pos:e,ids:[n,c,[]]}]}R(t._id),t._rev=e+"-"+n;var u={metadata:{},data:{}};for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var a="_"===i[0];if(a&&!Zo[i]){var _=C(Mo,i);throw _.message=Mo.message+": "+i,_}a&&!tc[i]?u.metadata[i.slice(1)]=t[i]:u.data[i]=t[i]}return u}function Cr(t,r){t=t||[],r=r||{};try{return new Blob(t,r)}catch(c){if("TypeError"!==c.name)throw c;for(var e="undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder,n=new e,o=0;o<t.length;o+=1)n.append(t[o]);return n.getBlob(r.type)}}function qr(t){for(var r=t.length,e=new ArrayBuffer(r),n=new Uint8Array(e),o=0;o<r;o++)n[o]=t.charCodeAt(o);return e}function Nr(t,r){return Cr([qr(t)],{type:r})}function Mr(t,r){return Nr(rc(t),r)}function jr(t){for(var r="",e=new Uint8Array(t),n=e.byteLength,o=0;o<n;o++)r+=String.fromCharCode(e[o]);return r}function Dr(t,r){if("undefined"==typeof FileReader)return r(jr((new FileReaderSync).readAsArrayBuffer(t)));var e=new FileReader,n="function"==typeof e.readAsBinaryString;e.onloadend=function(t){var e=t.target.result||"";if(n)return r(e);r(jr(e))},n?e.readAsBinaryString(t):e.readAsArrayBuffer(t)}function Rr(t,r){Dr(t,function(t){r(t)})}function Br(t,r){Rr(t,function(t){r(ec(t))})}function Lr(t,r){if("undefined"==typeof FileReader)return r((new FileReaderSync).readAsArrayBuffer(t));var e=new FileReader;e.onloadend=function(t){var e=t.target.result||new ArrayBuffer(0);r(e)},e.readAsArrayBuffer(t)}function Pr(t){return ec(t)}function Fr(t,r,e){return t.webkitSlice?t.webkitSlice(r,e):t.slice(r,e)}function $r(t,r,e,n,o){(e>0||n<r.size)&&(r=Fr(r,e,n)),Lr(r,function(r){t.append(r),o()})}function Ur(t,r,e,n,o){(e>0||n<r.length)&&(r=r.substring(e,n)),t.appendBinary(r),o()}function Jr(t,r){function e(){nc(o)}function n(){var t=s.end(!0),e=Pr(t);r(e),s.destroy()}function o(){var r=_*i,o=r+i;_++,_<a?f(s,t,r,o,e):f(s,t,r,o,n)}var c="string"==typeof t,u=c?t.length:t.size,i=Math.min(oc,u),a=Math.ceil(u/i),_=0,s=c?new lo:new lo.ArrayBuffer,f=c?Ur:$r;o()}function Hr(t){return lo.hash(t)}function Vr(t){try{return rc(t)}catch(t){var r=C(qo,"Attachment is not a valid base64 string");return{error:r}}}function zr(t,r,e){var n=Vr(t.data);if(n.error)return e(n.error);t.length=n.length,t.data="blob"===r?Nr(n,t.content_type):"base64"===r?ec(n):n,Jr(n,function(r){t.digest="md5-"+r,e()})}function Wr(t,r,e){Jr(t.data,function(n){t.digest="md5-"+n,t.length=t.data.size||t.data.length||0,"binary"===r?Rr(t.data,function(r){t.data=r,e()}):"base64"===r?Br(t.data,function(r){t.data=r,e()}):e()})}function Gr(t,r,e){if(t.stub)return e();"string"==typeof t.data?zr(t,r,e):Wr(t,r,e)}function Kr(t,r,e){function n(){c++,t.length===c&&(o?e(o):e())}if(!t.length)return e();var o,c=0;t.forEach(function(t){function e(t){o=t,++u===c.length&&n()}var c=t.data&&t.data._attachments?Object.keys(t.data._attachments):[],u=0;if(!c.length)return n();for(var i in t.data._attachments)t.data._attachments.hasOwnProperty(i)&&Gr(t.data._attachments[i],r,e)})}function Xr(t,r,e,n,o,c,u,i){if(_t(r.rev_tree,e.metadata.rev))return n[o]=e,c();var a=r.winningRev||W(r),_="deleted"in r?r.deleted:ft(r,a),s="deleted"in e.metadata?e.metadata.deleted:ft(e.metadata),f=/^1-/.test(e.metadata.rev);if(_&&!s&&i&&f){var l=e.data;l._rev=a,l._id=e.metadata.id,e=Ir(l,i)}var d=at(r.rev_tree,e.metadata.rev_tree[0],t);if(i&&(_&&s&&"new_leaf"!==d.conflicts||!_&&"new_leaf"!==d.conflicts||_&&!s&&"new_branch"===d.conflicts)){var p=C(Eo);return n[o]=p,c()}var h=e.metadata.rev;e.metadata.rev_tree=d.tree,e.stemmedRevs=d.stemmedRevs||[],r.rev_map&&(e.metadata.rev_map=r.rev_map);var v,m=W(e.metadata),g=ft(e.metadata,m),y=_===g?0:_<g?-1:1;v=h===m?g:ft(e.metadata,h),u(e,m,g,v,!0,y,o,c)}function Qr(t){return"missing"===t.metadata.rev_tree[0].ids[1].status}function Yr(t,r,e,n,o,c,u,i,a){function _(t,r,e){var n=W(t.metadata),o=ft(t.metadata,n);if("was_delete"in i&&o)return c[r]=C(xo,"deleted"),e();if(f&&Qr(t)){var a=C(Eo);return c[r]=a,e()}u(t,n,o,o,!1,o?0:1,r,e)}function s(){++d===p&&a&&a()}t=t||1e3;var f=i.new_edits,l=new yo,d=0,p=r.length;r.forEach(function(t,r){if(t._id&&lt(t._id)){var n=t._deleted?"_removeLocal":"_putLocal";return void e[n](t,{ctx:o},function(t,e){c[r]=t||e,s()})}var u=t.metadata.id;l.has(u)?(p--,l.get(u).push([t,r])):l.set(u,[[t,r]])}),l.forEach(function(r,e){function o(){++a<r.length?i():s()}function i(){var i=r[a],s=i[0],l=i[1];if(n.has(e))Xr(t,n.get(e),s,c,l,o,u,f);else{var d=at([],s.metadata.rev_tree[0],t);s.metadata.rev_tree=d.tree,s.stemmedRevs=d.stemmedRevs||[],_(s,l,o)}}var a=0;i()})}function Zr(t){try{return JSON.parse(t)}catch(r){return po.parse(t)}}function te(t){try{return JSON.stringify(t)}catch(r){return po.stringify(t)}}function re(t){return function(r){var e="unknown_error";r.target&&r.target.error&&(e=r.target.error.name||r.target.error.message),t(C(Ro,e,r.type))}}function ee(t,r,e){return{data:te(t),winningRev:r,deletedOrLocal:e?"1":"0",seq:t.seq,id:t.id}}function ne(t){if(!t)return null;var r=Zr(t.data);return r.winningRev=t.winningRev,r.deleted="1"===t.deletedOrLocal,r.seq=t.seq,r}function oe(t){if(!t)return t;var r=t._doc_id_rev.lastIndexOf(":");return t._id=t._doc_id_rev.substring(0,r-1),t._rev=t._doc_id_rev.substring(r+1),delete t._doc_id_rev,t}function ce(t,r,e,n){e?n(t?"string"!=typeof t?t:Mr(t,r):Cr([""],{type:r})):t?"string"!=typeof t?Dr(t,function(t){n(ec(t))}):n(t):n("")}function ue(t,r,e,n){function o(){++i===u.length&&n&&n()}function c(t,r){var n=t._attachments[r],c=n.digest;e.objectStore(ac).get(c).onsuccess=function(t){n.body=t.target.result.body,o()}}var u=Object.keys(t._attachments||{});if(!u.length)return n&&n();var i=0;u.forEach(function(e){r.attachments&&r.include_docs?c(t,e):(t._attachments[e].stub=!0,o())})}function ie(t,r){return ho.all(t.map(function(t){if(t.doc&&t.doc._attachments){var e=Object.keys(t.doc._attachments);return ho.all(e.map(function(e){var n=t.doc._attachments[e];if("body"in n){var o=n.body,c=n.content_type;return new ho(function(u){ce(o,c,r,function(r){t.doc._attachments[e]=ko(m(n,["digest","content_type"]),{data:r}),u()})})}}))}}))}function ae(t,r,e){function n(){--_||o()}function o(){c.length&&c.forEach(function(t){a.index("digestSeq").count(IDBKeyRange.bound(t+"::",t+"::",!1,!1)).onsuccess=function(r){r.target.result||i.delete(t)}})}var c=[],u=e.objectStore(ic),i=e.objectStore(ac),a=e.objectStore(_c),_=t.length;t.forEach(function(t){var e=u.index("_doc_id_rev"),o=r+"::"+t;e.getKey(o).onsuccess=function(t){var r=t.target.result;if("number"!=typeof r)return n();u.delete(r),a.index("seq").openCursor(IDBKeyRange.only(r)).onsuccess=function(t){var r=t.target.result;if(r){var e=r.value.digestSeq.split("::")[0];c.push(e),a.delete(r.primaryKey),r.continue()}else n()}}})}function _e(t,r,e){try{return{txn:t.transaction(r,e)}}catch(t){return{error:t}}}function se(t,r,e,n,o,c){function u(){var t=[uc,ic,ac,fc,_c,sc],r=_e(o,t,"readwrite");if(r.error)return c(r.error);y=r.txn,y.onabort=re(c),y.ontimeout=re(c),y.oncomplete=f,b=y.objectStore(uc),w=y.objectStore(ic),T=y.objectStore(ac),k=y.objectStore(_c),S=y.objectStore(sc),S.get(sc).onsuccess=function(t){E=t.target.result,_()},d(function(t){if(t)return R=!0,c(t);s()})}function i(){N=!0,_()}function a(){Yr(t.revs_limit,A,n,D,y,j,p,e,i)}function _(){E&&N&&(E.docCount+=M,S.put(E))}function s(){function t(){++e===A.length&&a()}function r(r){var e=ne(r.target.result);e&&D.set(e.id,e),t()}if(A.length)for(var e=0,n=0,o=A.length;n<o;n++){var c=A[n];if(c._id&&lt(c._id))t();else{var u=b.get(c.metadata.id);u.onsuccess=r}}}function f(){R||(dc.notify(n._meta.name),c(null,j))}function l(t,r){T.get(t).onsuccess=function(e){if(e.target.result)r();else{var n=C(Po,"unknown stub attachment with digest "+t);n.status=412,r(n)}}}function d(t){function r(){++o===e.length&&t(n)}var e=[];if(A.forEach(function(t){t.data&&t.data._attachments&&Object.keys(t.data._attachments).forEach(function(r){var n=t.data._attachments[r];n.stub&&e.push(n.digest)})}),!e.length)return t();var n,o=0;e.forEach(function(t){l(t,function(t){t&&!n&&(n=t),r()})})}function p(t,r,e,n,o,c,u,i){t.metadata.winningRev=r,t.metadata.deleted=e;var a=t.data;if(a._id=t.metadata.id,a._rev=t.metadata.rev,n&&(a._deleted=!0),a._attachments&&Object.keys(a._attachments).length)return v(t,r,e,o,u,i);M+=c,_(),h(t,r,e,o,u,i)}function h(t,r,e,o,c,u){function i(c){var u=t.stemmedRevs||[];o&&n.auto_compaction&&(u=u.concat(Y(t.metadata))),u&&u.length&&ae(u,t.metadata.id,y),f.seq=c.target.result;var i=ee(f,r,e);b.put(i).onsuccess=_}function a(t){t.preventDefault(),t.stopPropagation(),w.index("_doc_id_rev").getKey(s._doc_id_rev).onsuccess=function(t){w.put(s,t.target.result).onsuccess=i}}function _(){j[c]={ok:!0,id:f.id,rev:f.rev},D.set(t.metadata.id,t.metadata),m(t,f.seq,u)}var s=t.data,f=t.metadata;s._doc_id_rev=f.id+"::"+f.rev,delete s._id,delete s._rev;var l=w.put(s);l.onsuccess=i,l.onerror=a}function v(t,r,e,n,o,c){function u(){_===s.length&&h(t,r,e,n,o,c)}function i(){_++,u()}var a=t.data,_=0,s=Object.keys(a._attachments);s.forEach(function(e){var n=t.data._attachments[e];if(n.stub)_++,u();else{var o=n.data;delete n.data,n.revpos=parseInt(r,10);g(n.digest,o,i)}})}function m(t,r,e){function n(){++o===c.length&&e()}var o=0,c=Object.keys(t.data._attachments||{});if(!c.length)return e();for(var u=0;u<c.length;u++)!function(e){var o=t.data._attachments[e].digest,c=k.put({seq:r,digestSeq:o+"::"+r});c.onsuccess=n,c.onerror=function(t){t.preventDefault(),t.stopPropagation(),n()}}(c[u])}function g(t,r,e){T.count(t).onsuccess=function(n){if(n.target.result)return e();var o={digest:t,body:r};T.put(o).onsuccess=e}}for(var y,b,w,T,k,S,x,E,A=r.docs,O=0,I=A.length;O<I;O++){var q=A[O];q._id&&lt(q._id)||(q=A[O]=Ir(q,e.new_edits),q.error&&!x&&(x=q))}if(x)return c(x);var N=!1,M=0,j=new Array(A.length),D=new yo,R=!1,B=n._meta.blobSupport?"blob":"base64";Kr(A,B,function(t){if(t)return c(t);u()})}function fe(t,r,e,n,o){function c(t){s=t.target.result,_&&o(_,s,f)}function u(t){_=t.target.result,s&&o(_,s,f)}function i(){if(!_.length)return o();var e,i=_[_.length-1];if(r&&r.upper)try{e=IDBKeyRange.bound(i,r.upper,!0,r.upperOpen)}catch(t){if("DataError"===t.name&&0===t.code)return o()}else e=IDBKeyRange.lowerBound(i,!0);r=e,_=null,s=null,t.getAll(r,n).onsuccess=c,t.getAllKeys(r,n).onsuccess=u}function a(t){var r=t.target.result;if(!r)return o();o([r.key],[r.value],r)}var _,s,f,l="function"==typeof t.getAll&&"function"==typeof t.getAllKeys&&n>1&&!e;l?(f={continue:i},t.getAll(r,n).onsuccess=c,t.getAllKeys(r,n).onsuccess=u):e?t.openCursor(r,"prev").onsuccess=a:t.openCursor(r).onsuccess=a}function le(t,r,e){function n(t){var r=t.target.result;r?(o.push(r.value),r.continue()):e({target:{result:o}})}if("function"==typeof t.getAll)return void(t.getAll(r).onsuccess=e);var o=[];t.openCursor(r).onsuccess=n}function de(t,r,e,n,o){try{if(t&&r)return o?IDBKeyRange.bound(r,t,!e,!1):IDBKeyRange.bound(t,r,!1,!e);if(t)return o?IDBKeyRange.upperBound(t):IDBKeyRange.lowerBound(t);if(r)return o?IDBKeyRange.lowerBound(r,!e):IDBKeyRange.upperBound(r,!e);if(n)return IDBKeyRange.only(n)}catch(t){return{error:t}}return null}function pe(t,r,e){function n(r,e,n){var o=r.id+"::"+n;x.get(o).onsuccess=function(n){if(e.doc=oe(n.target.result),t.conflicts){var o=Q(r);o.length&&(e.doc._conflicts=o)}ue(e.doc,t,b)}}function o(r,e){var o={id:e.id,key:e.id,value:{rev:r}},c=e.deleted;"ok"===t.deleted?(E.push(o),c?(o.value.deleted=!0,o.doc=null):t.include_docs&&n(e,o,r)):!c&&d--<=0&&(E.push(o),t.include_docs&&n(e,o,r))}function c(t){for(var r=0,e=t.length;r<e&&E.length!==p;r++){var n=t[r],c=ne(n);o(c.winningRev,c)}}function u(t,r,e){e&&(c(r),E.length<p&&e.continue())}function i(r){var e=r.target.result;t.descending&&(e=e.reverse()),c(e)}function a(){e(null,{total_rows:w,offset:t.skip,rows:E})}function _(){t.attachments?ie(E,t.binary).then(a):a()}var s="startkey"in t&&t.startkey,f="endkey"in t&&t.endkey,l="key"in t&&t.key,d=t.skip||0,p="number"==typeof t.limit?t.limit:-1,h=!1!==t.inclusive_end,v=de(s,f,h,l,t.descending),m=v&&v.error;if(m&&("DataError"!==m.name||0!==m.code))return e(C(Ro,m.name,m.message));var g=[uc,ic,sc];t.attachments&&g.push(ac);var y=_e(r,g,"readonly");if(y.error)return e(y.error);var b=y.txn;b.oncomplete=_,b.onabort=re(e);var w,T=b.objectStore(uc),k=b.objectStore(ic),S=b.objectStore(sc),x=k.index("_doc_id_rev"),E=[];return S.get(sc).onsuccess=function(t){w=t.target.result.docCount},m||0===p?void 0:-1===p?le(T,v,i):void fe(T,v,t.descending,p+d,u)}function he(t){return new ho(function(r){var e=Cr([""]);t.objectStore(lc).put(e,"key").onsuccess=function(){var t=navigator.userAgent.match(/Chrome\/(\d+)/),e=navigator.userAgent.match(/Edge\//);r(e||!t||parseInt(t[1],10)>=43)},t.onabort=function(t){t.preventDefault(),t.stopPropagation(),r(!1)}}).catch(function(){return!1})}function ve(t,r){t.objectStore(uc).index("deletedOrLocal").count(IDBKeyRange.only("0")).onsuccess=function(t){r(t.target.result)}}function me(t,r,e,n){try{t(r,e)}catch(r){n.emit("error",r)}}function ge(){!pc&&hc.length&&(pc=!0,hc.shift()())}function ye(t,r,e){hc.push(function(){t(function(t,n){me(r,t,n,e),pc=!1,so(function(){ge(e)})})}),ge()}function be(t,r,e,n){function o(r,e,n){function o(r,e){var n=t.processChange(e,r,t);l=n.seq=r.seq;var o=w(n);if("object"==typeof o)return t.complete(o);o&&(b++,p&&y.push(n),t.attachments&&t.include_docs?ue(e,t,h,function(){ie([n],t.binary).then(function(){t.onChange(n)})}):t.onChange(n))}function c(){for(var t=0,r=i.length;t<r&&b!==d;t++){var e=i[t];if(e){o(a[t],e)}}b!==d&&n.continue()}if(n&&r.length){var i=new Array(r.length),a=new Array(r.length),_=0;e.forEach(function(t,e){u(oe(t),r[e],function(t,n){a[e]=t,i[e]=n,++_===r.length&&c()})})}}function c(t,r,e,n){if(e.seq!==r)return n();if(e.winningRev===t._rev)return n(e,t);var o=t._id+"::"+e.winningRev;g.get(o).onsuccess=function(t){n(e,oe(t.target.result))}}function u(t,r,e){if(f&&!f.has(t._id))return e();var n=T.get(t._id);if(n)return c(t,r,n,e);m.get(t._id).onsuccess=function(o){n=ne(o.target.result),T.set(t._id,n),c(t,r,n,e)}}function i(){t.complete(null,{results:y,last_seq:l})}function _(){!t.continuous&&t.attachments?ie(y).then(i):i()}if(t=a(t),t.continuous){var s=e+":"+z();return dc.addListener(e,s,r,t),dc.notify(e),{cancel:function(){dc.removeListener(e,s)}}}var f=t.doc_ids&&new go(t.doc_ids);t.since=t.since||0;var l=t.since,d="limit"in t?t.limit:-1;0===d&&(d=1);var p;p="return_docs"in t?t.return_docs:!("returnDocs"in t)||t.returnDocs;var h,v,m,g,y=[],b=0,w=M(t),T=new yo,k=[uc,ic];t.attachments&&k.push(ac);var S=_e(n,k,"readonly");if(S.error)return t.complete(S.error);h=S.txn,h.onabort=re(t.complete),h.oncomplete=_,v=h.objectStore(ic),m=h.objectStore(uc),g=v.index("_doc_id_rev"),fe(v,t.since&&!t.descending?IDBKeyRange.lowerBound(t.since,!0):null,t.descending,d,o)}function we(t,r){var e=this;ye(function(r){Te(e,t,r)},r,e.constructor)}function Te(t,r,e){function n(t){var r=t.createObjectStore(uc,{keyPath:"id"});t.createObjectStore(ic,{autoIncrement:!0}).createIndex("_doc_id_rev","_doc_id_rev",{unique:!0}),t.createObjectStore(ac,{keyPath:"digest"}),t.createObjectStore(sc,{keyPath:"id",autoIncrement:!1}),t.createObjectStore(lc),r.createIndex("deletedOrLocal","deletedOrLocal",{unique:!1}),t.createObjectStore(fc,{keyPath:"_id"});var e=t.createObjectStore(_c,{autoIncrement:!0});e.createIndex("seq","seq"),e.createIndex("digestSeq","digestSeq",{unique:!0})}function o(t,r){var e=t.objectStore(uc);e.createIndex("deletedOrLocal","deletedOrLocal",{unique:!1}),e.openCursor().onsuccess=function(t){var n=t.target.result;if(n){var o=n.value,c=ft(o);o.deletedOrLocal=c?"1":"0",e.put(o),n.continue()}else r()}}function c(t){t.createObjectStore(fc,{keyPath:"_id"}).createIndex("_doc_id_rev","_doc_id_rev",{unique:!0})}function u(t,r){var e=t.objectStore(fc),n=t.objectStore(uc),o=t.objectStore(ic);n.openCursor().onsuccess=function(t){var c=t.target.result;if(c){var u=c.value,i=u.id,a=lt(i),_=W(u);if(a){var s=i+"::"+_,f=i+"::",l=i+"::~",d=o.index("_doc_id_rev"),p=IDBKeyRange.bound(f,l,!1,!1),h=d.openCursor(p);h.onsuccess=function(t){if(h=t.target.result){var r=h.value;r._doc_id_rev===s&&e.put(r),o.delete(h.primaryKey),h.continue()}else n.delete(c.primaryKey),c.continue()}}else c.continue()}else r&&r()}}function i(t){var r=t.createObjectStore(_c,{autoIncrement:!0});r.createIndex("seq","seq"),r.createIndex("digestSeq","digestSeq",{unique:!0})}function a(t,r){var e=t.objectStore(ic),n=t.objectStore(ac),o=t.objectStore(_c);n.count().onsuccess=function(t){if(!t.target.result)return r();e.openCursor().onsuccess=function(t){var e=t.target.result;if(!e)return r();for(var n=e.value,c=e.primaryKey,u=Object.keys(n._attachments||{}),i={},a=0;a<u.length;a++)i[n._attachments[u[a]].digest]=!0;var _=Object.keys(i);for(a=0;a<_.length;a++){var s=_[a];o.put({seq:c,digestSeq:s+"::"+c})}e.continue()}}}function _(t){function r(t){return t.data?ne(t):(t.deleted="1"===t.deletedOrLocal,t)}var e=t.objectStore(ic),n=t.objectStore(uc);n.openCursor().onsuccess=function(t){function o(){var t=ee(u,u.winningRev,u.deleted);n.put(t).onsuccess=function(){c.continue()}}var c=t.target.result;if(c){var u=r(c.value);if(u.winningRev=u.winningRev||W(u),u.seq)return o();!function(){var t=u.id+"::",r=u.id+"::",n=e.index("_doc_id_rev").openCursor(IDBKeyRange.bound(t,r)),c=0;n.onsuccess=function(t){var r=t.target.result;if(!r)return u.seq=c,o();var e=r.primaryKey;e>c&&(c=e),r.continue()}}()}}}var f=r.name,l=null;t._meta=null,t._remote=!1,t.type=function(){return"idb"},t._id=s(function(r){r(null,t._meta.instanceId)}),t._bulkDocs=function(e,n,o){se(r,e,n,t,l,o)},t._get=function(t,r,e){function n(){e(u,{doc:o,metadata:c,ctx:i})}var o,c,u,i=r.ctx;if(!i){var a=_e(l,[uc,ic,ac],"readonly");if(a.error)return e(a.error);i=a.txn}i.objectStore(uc).get(t).onsuccess=function(t){if(!(c=ne(t.target.result)))return u=C(xo,"missing"),n();var e;if(r.rev)e=r.latest?dt(r.rev,c):r.rev;else{e=c.winningRev;if(ft(c))return u=C(xo,"deleted"),n()}var a=i.objectStore(ic),_=c.id+"::"+e;a.index("_doc_id_rev").get(_).onsuccess=function(t){if(o=t.target.result,o&&(o=oe(o)),!o)return u=C(xo,"missing"),n();n()}}},t._getAttachment=function(t,r,e,n,o){var c;if(n.ctx)c=n.ctx;else{var u=_e(l,[uc,ic,ac],"readonly");if(u.error)return o(u.error);c=u.txn}var i=e.digest,a=e.content_type;c.objectStore(ac).get(i).onsuccess=function(t){ce(t.target.result.body,a,n.binary,function(t){o(null,t)})}},t._info=function(r){var e,n,o=_e(l,[sc,ic],"readonly");if(o.error)return r(o.error);var c=o.txn;c.objectStore(sc).get(sc).onsuccess=function(t){n=t.target.result.docCount},c.objectStore(ic).openCursor(null,"prev").onsuccess=function(t){var r=t.target.result;e=r?r.key:0},c.oncomplete=function(){r(null,{doc_count:n,update_seq:e,idb_attachment_format:t._meta.blobSupport?"binary":"base64"})}},t._allDocs=function(t,r){pe(t,l,r)},t._changes=function(r){be(r,t,f,l)},t._close=function(t){l.close(),vc.delete(f),t()},t._getRevisionTree=function(t,r){var e=_e(l,[uc],"readonly");if(e.error)return r(e.error);e.txn.objectStore(uc).get(t).onsuccess=function(t){var e=ne(t.target.result);e?r(null,e.rev_tree):r(C(xo))}},t._doCompaction=function(t,r,e){var n=[uc,ic,ac,_c],o=_e(l,n,"readwrite");if(o.error)return e(o.error);var c=o.txn;c.objectStore(uc).get(t).onsuccess=function(e){var n=ne(e.target.result);G(n.rev_tree,function(t,e,n,o,c){var u=e+"-"+n;-1!==r.indexOf(u)&&(c.status="missing")}),ae(r,t,c);var o=n.winningRev,u=n.deleted;c.objectStore(uc).put(ee(n,o,u))},c.onabort=re(e),c.oncomplete=function(){e()}},t._getLocal=function(t,r){var e=_e(l,[fc],"readonly");if(e.error)return r(e.error);var n=e.txn,o=n.objectStore(fc).get(t);o.onerror=re(r),o.onsuccess=function(t){var e=t.target.result;e?(delete e._doc_id_rev,r(null,e)):r(C(xo))}},t._putLocal=function(t,r,e){"function"==typeof r&&(e=r,r={}),delete t._revisions;var n=t._rev,o=t._id;t._rev=n?"0-"+(parseInt(n.split("-")[1],10)+1):"0-1";var c,u=r.ctx;if(!u){var i=_e(l,[fc],"readwrite");if(i.error)return e(i.error);u=i.txn,u.onerror=re(e),u.oncomplete=function(){c&&e(null,c)}}var a,_=u.objectStore(fc);n?(a=_.get(o),a.onsuccess=function(o){var u=o.target.result;if(u&&u._rev===n){_.put(t).onsuccess=function(){c={ok:!0,id:t._id,rev:t._rev},r.ctx&&e(null,c)}}else e(C(Eo))}):(a=_.add(t),a.onerror=function(t){e(C(Eo)),t.preventDefault(),t.stopPropagation()},a.onsuccess=function(){c={ok:!0,id:t._id,rev:t._rev},r.ctx&&e(null,c)})},t._removeLocal=function(t,r,e){"function"==typeof r&&(e=r,r={});var n=r.ctx;if(!n){var o=_e(l,[fc],"readwrite");if(o.error)return e(o.error);n=o.txn,n.oncomplete=function(){c&&e(null,c)}}var c,u=t._id,i=n.objectStore(fc),a=i.get(u);a.onerror=re(e),a.onsuccess=function(n){var o=n.target.result;o&&o._rev===t._rev?(i.delete(u),c={ok:!0,id:u,rev:"0-0"},r.ctx&&e(null,c)):e(C(xo))}},t._destroy=function(t,r){dc.removeAllListeners(f);var e=mc.get(f);e&&e.result&&(e.result.close(),vc.delete(f));var n=indexedDB.deleteDatabase(f);n.onsuccess=function(){mc.delete(f),T()&&f in localStorage&&delete localStorage[f],r(null,{ok:!0})},n.onerror=re(r)};var d=vc.get(f);if(d)return l=d.idb,t._meta=d.global,so(function(){e(null,t)});var p;p=r.storage?ke(f,r.storage):indexedDB.open(f,cc),mc.set(f,p),p.onupgradeneeded=function(t){function r(){var t=f[l-1];l++,t&&t(s,r)}var e=t.target.result;if(t.oldVersion<1)return n(e);var s=t.currentTarget.transaction;t.oldVersion<3&&c(e),t.oldVersion<4&&i(e);var f=[o,u,a,_],l=t.oldVersion;r()},p.onsuccess=function(r){function n(){void 0!==i&&s&&(t._meta={name:f,instanceId:a,blobSupport:i},vc.set(f,{idb:l,global:t._meta}),e(null,t))}function o(){if(void 0!==u&&void 0!==c){var t=f+"_id";t in c?a=c[t]:c[t]=a=z(),c.docCount=u,_.objectStore(sc).put(c)}}l=r.target.result,l.onversionchange=function(){l.close(),vc.delete(f)},l.onabort=function(t){x("error","Database has a global failure",t.target.error),l.close(),vc.delete(f)};var c,u,i,a,_=l.transaction([sc,lc,uc],"readwrite"),s=!1;_.objectStore(sc).get(sc).onsuccess=function(t){c=t.target.result||{id:sc},o()},ve(_,function(t){u=t,o()}),Yo||(Yo=he(_)),Yo.then(function(t){i=t,n()}),_.oncomplete=function(){s=!0,n()}},p.onerror=function(){var t="Failed to open indexedDB, are you in private browsing mode?";x("error",t),e(C(Ro,t))}}function ke(t,r){try{return indexedDB.open(t,{version:cc,storage:r})}catch(r){return indexedDB.open(t,cc)}}function Se(t){return decodeURIComponent(escape(t))}function xe(t){return t<65?t-48:t-55}function Ee(t,r,e){for(var n="";r<e;)n+=String.fromCharCode(xe(t.charCodeAt(r++))<<4|xe(t.charCodeAt(r++)));return n}function Ae(t,r,e){for(var n="";r<e;)n+=String.fromCharCode(xe(t.charCodeAt(r+2))<<12|xe(t.charCodeAt(r+3))<<8|xe(t.charCodeAt(r))<<4|xe(t.charCodeAt(r+1))),r+=4;return n}function Oe(t,r){return"UTF-8"===r?Se(Ee(t,0,t.length)):Ae(t,0,t.length)}function Ie(t){return"'"+t+"'"}function Ce(t){return t.replace(/\u0002/g,"").replace(/\u0001/g,"").replace(/\u0000/g,"")}function qe(t){return t.replace(/\u0001\u0001/g,"\0").replace(/\u0001\u0002/g,"").replace(/\u0002\u0002/g,"")}function Ne(t){return delete t._id,delete t._rev,JSON.stringify(t)}function Me(t,r,e){return t=JSON.parse(t),t._id=r,t._rev=e,t}function je(t){for(var r="(";t--;)r+="?",t&&(r+=",");return r+")"}function De(t,r,e,n,o){return"SELECT "+t+" FROM "+("string"==typeof r?r:r.join(" JOIN "))+(e?" ON "+e:"")+(n?" WHERE "+("string"==typeof n?n:n.join(" AND ")):"")+(o?" ORDER BY "+o:"")}function Re(t,r,e){function n(){++c===t.length&&o()}function o(){if(u.length){var t="SELECT DISTINCT digest AS digest FROM "+xc+" WHERE seq IN "+je(u.length);e.executeSql(t,u,function(t,r){for(var e=[],n=0;n<r.rows.length;n++)e.push(r.rows.item(n).digest);if(e.length){var o="DELETE FROM "+xc+" WHERE seq IN ("+u.map(function(){return"?"}).join(",")+")";t.executeSql(o,u,function(t){var r="SELECT digest FROM "+xc+" WHERE digest IN ("+e.map(function(){return"?"}).join(",")+")";t.executeSql(r,e,function(t,r){for(var n=new go,o=0;o<r.rows.length;o++)n.add(r.rows.item(o).digest);e.forEach(function(r){n.has(r)||(t.executeSql("DELETE FROM "+xc+" WHERE digest=?",[r]),t.executeSql("DELETE FROM "+Tc+" WHERE digest=?",[r]))})})})}})}}if(t.length){var c=0,u=[];t.forEach(function(t){var o="SELECT seq FROM "+wc+" WHERE doc_id=? AND rev=?";e.executeSql(o,[r,t],function(t,r){if(!r.rows.length)return n();var e=r.rows.item(0).seq;u.push(e),t.executeSql("DELETE FROM "+wc+" WHERE seq=?",[e],n)})})}}function Be(t){return function(r){x("error","WebSQL threw an error",r);var e=r&&r.constructor.toString().match(/function ([^\(]+)/),n=e&&e[1]||r.type,o=r.target||r.message;t(C(Bo,o,n))}}function Le(t){return"size"in t?1e6*t.size:"undefined"!=typeof navigator&&/Android/.test(navigator.userAgent)?5e6:1}function Pe(t,r,e,n,o,c,u){function i(){if(y)return u(y);c.notify(n._name),u(null,b)}function a(t,r){var e="SELECT count(*) as cnt FROM "+Tc+" WHERE digest=?";g.executeSql(e,[t],function(e,n){if(0===n.rows.item(0).cnt){var o=C(Po,"unknown stub attachment with digest "+t);r(o)}else r()})}function _(t){function r(){++o===e.length&&t(n)}var e=[];if(v.forEach(function(t){t.data&&t.data._attachments&&Object.keys(t.data._attachments).forEach(function(r){var n=t.data._attachments[r];n.stub&&e.push(n.digest)})}),!e.length)return t();var n,o=0;e.forEach(function(t){a(t,function(t){t&&!n&&(n=t),r()})})}function s(t,r,e,o,c,u,i,a){function _(){function r(t,r){function n(){return++o===c.length&&r(),!1}var o=0,c=Object.keys(e._attachments||{});if(!c.length)return r();for(var u=0;u<c.length;u++)!function(r){var o="INSERT INTO "+xc+" (digest, seq) VALUES (?,?)",c=[e._attachments[r].digest,t];g.executeSql(o,c,n,n)}(c[u])}var e=t.data,n=o?1:0,c=e._id,u=e._rev,i=Ne(e),a="INSERT INTO "+wc+" (doc_id, rev, json, deleted) VALUES (?, ?, ?, ?);",_=[c,u,i,n];g.executeSql(a,_,function(t,e){var n=e.insertId;r(n,function(){l(t,n)})},function(){var t=De("seq",wc,null,"doc_id=? AND rev=?");return g.executeSql(t,[c,u],function(t,e){var o=e.rows.item(0).seq,a="UPDATE "+wc+" SET json=?, deleted=? WHERE doc_id=? AND rev=?;",_=[i,n,c,u];t.executeSql(a,_,function(t){r(o,function(){l(t,o)})})}),!1})}function s(t){p||(t?(p=t,a(p)):h===v.length&&_())}function f(t){h++,s(t)}function l(e,o){var u=t.metadata.id,_=t.stemmedRevs||[];c&&n.auto_compaction&&(_=Y(t.metadata).concat(_)),_.length&&Re(_,u,e),t.metadata.seq=o;var s=t.metadata.rev;delete t.metadata.rev;var f=c?"UPDATE "+bc+" SET json=?, max_seq=?, winningseq=(SELECT seq FROM "+wc+" WHERE doc_id="+bc+".id AND rev=?) WHERE id=?":"INSERT INTO "+bc+" (id, winningseq, max_seq, json) VALUES (?,?,?,?);",l=te(t.metadata),d=c?[l,o,r,u]:[u,o,o,l];e.executeSql(f,d,function(){b[i]={ok:!0,id:t.metadata.id,rev:s},w.set(u,t.metadata),a()})}var p=null,h=0;t.data._id=t.metadata.id,t.data._rev=t.metadata.rev;var v=Object.keys(t.data._attachments||{});o&&(t.data._deleted=!0),v.forEach(function(e){var n=t.data._attachments[e];if(n.stub)h++,s();else{var o=n.data;delete n.data,n.revpos=parseInt(r,10);d(n.digest,o,f)}}),v.length||_()}function f(){Yr(t.revs_limit,v,n,w,g,b,s,e)}function l(t){function r(){++e===v.length&&t()}if(!v.length)return t();var e=0;v.forEach(function(t){if(t._id&&lt(t._id))return r();var e=t.metadata.id;g.executeSql("SELECT json FROM "+bc+" WHERE id = ?",[e],function(t,n){if(n.rows.length){var o=Zr(n.rows.item(0).json);w.set(e,o)}r()})})}function d(t,r,e){var n="SELECT digest FROM "+Tc+" WHERE digest=?";g.executeSql(n,[t],function(o,c){if(c.rows.length)return e();n="INSERT INTO "+Tc+" (digest, body, escaped) VALUES (?,?,1)",o.executeSql(n,[t,Ce(r)],function(){e()},function(){return e(),!1})})}var p=e.new_edits,h=r.docs,v=h.map(function(t){return t._id&&lt(t._id)?t:Ir(t,p)}),m=v.filter(function(t){return t.error});if(m.length)return u(m[0]);var g,y,b=new Array(v.length),w=new yo;Kr(v,"binary",function(t){if(t)return u(t);o.transaction(function(t){g=t,_(function(t){t?y=t:l(f)})},Be(u),i)})}function Fe(t){return t.websql(t.name,t.version,t.description,t.size)}function $e(t){try{return{db:Fe(t)}}catch(t){return{error:t}}}function Ue(t){var r=Ec.get(t.name);return r||(r=$e(t),Ec.set(t.name,r)),r}function Je(t,r,e,n,o){function c(){++a===i.length&&o&&o()}function u(t,o){var u=t._attachments[o],i={binary:r.binary,ctx:n};e._getAttachment(t._id,o,u,i,function(r,e){t._attachments[o]=ko(m(u,["digest","content_type"]),{data:e}),c()})}var i=Object.keys(t._attachments||{});if(!i.length)return o&&o();var a=0;i.forEach(function(e){r.attachments&&r.include_docs?u(t,e):(t._attachments[e].stub=!0,c())})}function He(t,r){function e(){T()&&(window.localStorage["_pouch__websqldb_"+y._name]=!0),r(null,y)}function n(t,r){t.executeSql(qc),t.executeSql("ALTER TABLE "+wc+" ADD COLUMN deleted TINYINT(1) DEFAULT 0",[],function(){t.executeSql(Ic),t.executeSql("ALTER TABLE "+bc+" ADD COLUMN local TINYINT(1) DEFAULT 0",[],function(){t.executeSql("CREATE INDEX IF NOT EXISTS 'doc-store-local-idx' ON "+bc+" (local, id)");var e="SELECT "+bc+".winningseq AS seq, "+bc+".json AS metadata FROM "+wc+" JOIN "+bc+" ON "+wc+".seq = "+bc+".winningseq";t.executeSql(e,[],function(t,e){for(var n=[],o=[],c=0;c<e.rows.length;c++){var u=e.rows.item(c),i=u.seq,a=JSON.parse(u.metadata);ft(a)&&n.push(i),lt(a.id)&&o.push(a.id)}t.executeSql("UPDATE "+bc+"SET local = 1 WHERE id IN "+je(o.length),o,function(){t.executeSql("UPDATE "+wc+" SET deleted = 1 WHERE seq IN "+je(n.length),n,r)})})})})}function o(t,r){var e="CREATE TABLE IF NOT EXISTS "+kc+" (id UNIQUE, rev, json)";t.executeSql(e,[],function(){var e="SELECT "+bc+".id AS id, "+wc+".json AS data FROM "+wc+" JOIN "+bc+" ON "+wc+".seq = "+bc+".winningseq WHERE local = 1";t.executeSql(e,[],function(t,e){function n(){if(!o.length)return r(t);var e=o.shift(),c=JSON.parse(e.data)._rev;t.executeSql("INSERT INTO "+kc+" (id, rev, json) VALUES (?,?,?)",[e.id,c,e.data],function(t){t.executeSql("DELETE FROM "+bc+" WHERE id=?",[e.id],function(t){t.executeSql("DELETE FROM "+wc+" WHERE seq=?",[e.seq],function(){n()})})})}for(var o=[],c=0;c<e.rows.length;c++)o.push(e.rows.item(c));n()})})}function c(t,r){function e(e){function n(){if(!e.length)return r(t);var o=e.shift(),c=Oe(o.hex,g),u=c.lastIndexOf("::"),i=c.substring(0,u),a=c.substring(u+2),_="UPDATE "+wc+" SET doc_id=?, rev=? WHERE doc_id_rev=?";t.executeSql(_,[i,a,c],function(){n()})}n()}var n="ALTER TABLE "+wc+" ADD COLUMN doc_id";t.executeSql(n,[],function(t){var r="ALTER TABLE "+wc+" ADD COLUMN rev";t.executeSql(r,[],function(t){t.executeSql(Cc,[],function(t){var r="SELECT hex(doc_id_rev) as hex FROM "+wc;t.executeSql(r,[],function(t,r){for(var n=[],o=0;o<r.rows.length;o++)n.push(r.rows.item(o));e(n)})})})})}function u(t,r){function e(t){var e="SELECT COUNT(*) AS cnt FROM "+Tc;t.executeSql(e,[],function(t,e){function n(){var e=De(Dc+", "+bc+".id AS id",[bc,wc],jc,null,bc+".id ");e+=" LIMIT "+c+" OFFSET "+o,o+=c,t.executeSql(e,[],function(t,e){if(!e.rows.length)return r(t);for(var o={},c=0;c<e.rows.length;c++)for(var u=e.rows.item(c),i=Me(u.data,u.id,u.rev),a=Object.keys(i._attachments||{}),_=0;_<a.length;_++){var s=i._attachments[a[_]];!function(t,r){var e=o[t]=o[t]||[];-1===e.indexOf(r)&&e.push(r)}(s.digest,u.seq)}var f=[];if(Object.keys(o).forEach(function(t){o[t].forEach(function(r){f.push([t,r])})}),!f.length)return n();var l=0;f.forEach(function(r){var e="INSERT INTO "+xc+" (digest, seq) VALUES (?,?)";t.executeSql(e,r,function(){++l===f.length&&n()})})})}if(!e.rows.item(0).cnt)return r(t);var o=0,c=10;n()})}var n="CREATE TABLE IF NOT EXISTS "+xc+" (digest, seq INTEGER)";t.executeSql(n,[],function(t){t.executeSql(Mc,[],function(t){t.executeSql(Nc,[],e)})})}function i(t,r){var e="ALTER TABLE "+Tc+" ADD COLUMN escaped TINYINT(1) DEFAULT 0";t.executeSql(e,[],r)}function _(t,r){var e="ALTER TABLE "+bc+" ADD COLUMN max_seq INTEGER";t.executeSql(e,[],function(t){var e="UPDATE "+bc+" SET max_seq=(SELECT MAX(seq) FROM "+wc+" WHERE doc_id=id)";t.executeSql(e,[],function(t){var e="CREATE UNIQUE INDEX IF NOT EXISTS 'doc-max-seq-idx' ON "+bc+" (max_seq)";t.executeSql(e,[],r)})})}function f(t,r){t.executeSql('SELECT HEX("a") AS hex',[],function(t,e){var n=e.rows.item(0).hex;g=2===n.length?"UTF-8":"UTF-16",r()})}function l(){for(;k.length>0;){k.pop()(null,b)}}function d(t,r){if(0===r){var e="CREATE TABLE IF NOT EXISTS "+Sc+" (dbid, db_version INTEGER)",a="CREATE TABLE IF NOT EXISTS "+Tc+" (digest UNIQUE, escaped TINYINT(1), body BLOB)",s="CREATE TABLE IF NOT EXISTS "+xc+" (digest, seq INTEGER)",f="CREATE TABLE IF NOT EXISTS "+bc+" (id unique, json, winningseq, max_seq INTEGER UNIQUE)",d="CREATE TABLE IF NOT EXISTS "+wc+" (seq INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, json, deleted TINYINT(1), doc_id, rev)",p="CREATE TABLE IF NOT EXISTS "+kc+" (id UNIQUE, rev, json)";t.executeSql(a),t.executeSql(p),t.executeSql(s,[],function(){t.executeSql(Nc),t.executeSql(Mc)}),t.executeSql(f,[],function(){t.executeSql(qc),t.executeSql(d,[],function(){t.executeSql(Ic),t.executeSql(Cc),t.executeSql(e,[],function(){var r="INSERT INTO "+Sc+" (db_version, dbid) VALUES (?,?)";b=z();var e=[yc,b];t.executeSql(r,e,function(){l()})})})})}else{var h=function(){r<yc&&t.executeSql("UPDATE "+Sc+" SET db_version = "+yc);var e="SELECT dbid FROM "+Sc;t.executeSql(e,[],function(t,r){b=r.rows.item(0).dbid,l()})},v=[n,o,c,u,i,_,h],m=r,g=function(t){v[m-1](t,g),m++};g(t)}}function p(t){var r="SELECT sql FROM sqlite_master WHERE tbl_name = "+Sc;t.executeSql(r,[],function(t,r){r.rows.length?/db_version/.test(r.rows.item(0).sql)?t.executeSql("SELECT db_version FROM "+Sc,[],function(t,r){d(t,r.rows.item(0).db_version)}):t.executeSql("ALTER TABLE "+Sc+" ADD COLUMN db_version INTEGER",[],function(){d(t,1)}):d(t,0)})}function h(t,r){var e="SELECT MAX(seq) AS seq FROM "+wc;t.executeSql(e,[],function(t,e){var n=e.rows.item(0).seq||0;r(n)})}function v(t,r){var e=De("COUNT("+bc+".id) AS 'num'",[bc,wc],jc,wc+".deleted=0");t.executeSql(e,[],function(t,e){r(e.rows.item(0).num)})}function m(t,r,e,n,o){var c=De(Dc,[bc,wc],jc,bc+".id=?"),u=[r];t.executeSql(c,u,function(t,r){if(!r.rows.length){var c=C(xo,"missing");return o(c)}var u=r.rows.item(0),i=Zr(u.metadata);n(dt(e,i))})}var g,y=this,b=null,w=Le(t),k=[];y._name=t.name;var S=ko({},t,{version:Oc,description:t.name,size:w}),x=Ue(S);if(x.error)return Be(r)(x.error);var E=x.db;"function"!=typeof E.readTransaction&&(E.readTransaction=E.transaction),function(){E.transaction(function(t){f(t,function(){p(t)})},Be(r),e)}(),y._remote=!1,y.type=function(){return"websql"},y._id=s(function(t){t(null,b)}),y._info=function(t){var r,e;E.readTransaction(function(t){h(t,function(t){r=t}),v(t,function(t){e=t})},Be(t),function(){t(null,{doc_count:e,update_seq:r,websql_encoding:g})})},y._bulkDocs=function(r,e,n){Pe(t,r,e,y,E,Ac,n)},y._get=function(t,r,e){function n(t){e(t,{doc:o,metadata:c,ctx:u})}var o,c,u=r.ctx;if(!u)return E.readTransaction(function(n){y._get(t,ko({ctx:n},r),e)});var i,a;if(r.rev){if(r.latest)return void m(u,t,r.rev,function(n){r.latest=!1,r.rev=n,y._get(t,r,e)},n);i=De(Dc,[bc,wc],bc+".id="+wc+".doc_id",[wc+".doc_id=?",wc+".rev=?"]),a=[t,r.rev]}else i=De(Dc,[bc,wc],jc,bc+".id=?"),a=[t];u.executeSql(i,a,function(t,e){if(!e.rows.length){return n(C(xo,"missing"))}var u=e.rows.item(0);if(c=Zr(u.metadata),u.deleted&&!r.rev){return n(C(xo,"deleted"))}o=Me(u.data,c.id,u.rev),n()})},y._allDocs=function(t,r){var e,n=[],o="startkey"in t&&t.startkey,c="endkey"in t&&t.endkey,u="key"in t&&t.key,i="descending"in t&&t.descending,a="limit"in t?t.limit:-1,_="skip"in t?t.skip:0,s=!1!==t.inclusive_end,f=[],l=[];if(!1!==u)l.push(bc+".id = ?"),f.push(u);else if(!1!==o||!1!==c){if(!1!==o&&(l.push(bc+".id "+(i?"<=":">=")+" ?"),f.push(o)),!1!==c){var d=i?">":"<";s&&(d+="="),l.push(bc+".id "+d+" ?"),f.push(c)}!1!==u&&(l.push(bc+".id = ?"),f.push(u))}"ok"!==t.deleted&&l.push(wc+".deleted = 0"),E.readTransaction(function(r){if(v(r,function(t){e=t}),0!==a){var o=De(Dc,[bc,wc],jc,l,bc+".id "+(i?"DESC":"ASC"));o+=" LIMIT "+a+" OFFSET "+_,r.executeSql(o,f,function(r,e){for(var o=0,c=e.rows.length;o<c;o++){var u=e.rows.item(o),i=Zr(u.metadata),a=i.id,_=Me(u.data,a,u.rev),s=_._rev,f={id:a,key:a,value:{rev:s}};if(t.include_docs){if(f.doc=_,f.doc._rev=s,t.conflicts){var l=Q(i);l.length&&(f.doc._conflicts=l)}Je(f.doc,t,y,r)}if(u.deleted){if("ok"!==t.deleted)continue;f.value.deleted=!0,f.doc=null}n.push(f)}})}},Be(r),function(){r(null,{total_rows:e,offset:t.skip,rows:n})})},y._changes=function(t){if(t=a(t),t.continuous){var r=y._name+":"+z();return Ac.addListener(y._name,r,y,t),Ac.notify(y._name),{cancel:function(){Ac.removeListener(y._name,r)}}}var e=t.descending;t.since=t.since&&!e?t.since:0;var n="limit"in t?t.limit:-1;0===n&&(n=1);var o;o="return_docs"in t?t.return_docs:!("returnDocs"in t)||t.returnDocs;var c=[],u=0;!function(){var r=bc+".json AS metadata, "+bc+".max_seq AS maxSeq, "+wc+".json AS winningDoc, "+wc+".rev AS winningRev ",i=bc+" JOIN "+wc,a=bc+".id="+wc+".doc_id AND "+bc+".winningseq="+wc+".seq",_=["maxSeq > ?"],s=[t.since];t.doc_ids&&(_.push(bc+".id IN "+je(t.doc_ids.length)),s=s.concat(t.doc_ids));var f="maxSeq "+(e?"DESC":"ASC"),l=De(r,i,a,_,f),d=M(t);t.view||t.filter||(l+=" LIMIT "+n);var p=t.since||0;E.readTransaction(function(r){r.executeSql(l,s,function(r,e){function i(r){return function(){t.onChange(r)}}for(var a=0,_=e.rows.length;a<_;a++){var s=e.rows.item(a),f=Zr(s.metadata);p=s.maxSeq;var l=Me(s.winningDoc,f.id,s.winningRev),h=t.processChange(l,f,t);h.seq=s.maxSeq;var v=d(h);if("object"==typeof v)return t.complete(v);if(v&&(u++,o&&c.push(h),t.attachments&&t.include_docs?Je(l,t,y,r,i(h)):i(h)()),u===n)break}})},Be(t.complete),function(){t.continuous||t.complete(null,{results:c,last_seq:p})})}()},y._close=function(t){t()},y._getAttachment=function(t,r,e,n,o){var c,u=n.ctx,i=e.digest,a=e.content_type,_="SELECT escaped, CASE WHEN escaped = 1 THEN body ELSE HEX(body) END AS body FROM "+Tc+" WHERE digest=?";u.executeSql(_,[i],function(t,r){var e=r.rows.item(0),u=e.escaped?qe(e.body):Oe(e.body,g);c=n.binary?Nr(u,a):ec(u),o(null,c)})},y._getRevisionTree=function(t,r){E.readTransaction(function(e){var n="SELECT json AS metadata FROM "+bc+" WHERE id = ?";e.executeSql(n,[t],function(t,e){if(e.rows.length){var n=Zr(e.rows.item(0).metadata);r(null,n.rev_tree)}else r(C(xo))})})},y._doCompaction=function(t,r,e){if(!r.length)return e();E.transaction(function(e){var n="SELECT json AS metadata FROM "+bc+" WHERE id = ?";e.executeSql(n,[t],function(e,n){var o=Zr(n.rows.item(0).metadata);G(o.rev_tree,function(t,e,n,o,c){var u=e+"-"+n;-1!==r.indexOf(u)&&(c.status="missing")});var c="UPDATE "+bc+" SET json = ? WHERE id = ?";e.executeSql(c,[te(o),t])}),Re(r,t,e)},Be(e),function(){e()})},y._getLocal=function(t,r){E.readTransaction(function(e){var n="SELECT json, rev FROM "+kc+" WHERE id=?";e.executeSql(n,[t],function(e,n){if(n.rows.length){var o=n.rows.item(0),c=Me(o.json,t,o.rev);r(null,c)}else r(C(xo))})})},y._putLocal=function(t,r,e){function n(t){var n,_;c?(n="UPDATE "+kc+" SET rev=?, json=? WHERE id=? AND rev=?",_=[o,a,u,c]):(n="INSERT INTO "+kc+" (id, rev, json) VALUES (?,?,?)",_=[u,o,a]),t.executeSql(n,_,function(t,n){n.rowsAffected?(i={ok:!0,id:u,rev:o},r.ctx&&e(null,i)):e(C(Eo))},function(){return e(C(Eo)),!1})}"function"==typeof r&&(e=r,r={}),delete t._revisions;var o,c=t._rev,u=t._id;o=t._rev=c?"0-"+(parseInt(c.split("-")[1],10)+1):"0-1";var i,a=Ne(t);r.ctx?n(r.ctx):E.transaction(n,Be(e),function(){i&&e(null,i)})},y._removeLocal=function(t,r,e){function n(n){var c="DELETE FROM "+kc+" WHERE id=? AND rev=?",u=[t._id,t._rev];n.executeSql(c,u,function(n,c){if(!c.rowsAffected)return e(C(xo));o={ok:!0,id:t._id,rev:"0-0"},r.ctx&&e(null,o)})}"function"==typeof r&&(e=r,r={});var o;r.ctx?n(r.ctx):E.transaction(n,Be(e),function(){o&&e(null,o)})},y._destroy=function(t,r){Ac.removeAllListeners(y._name),E.transaction(function(t){[bc,wc,Tc,Sc,kc,xc].forEach(function(r){t.executeSql("DROP TABLE IF EXISTS "+r,[])})},Be(r),function(){T()&&(delete window.localStorage["_pouch__websqldb_"+y._name],delete window.localStorage[y._name]),r(null,{ok:!0})})}}function Ve(){try{return openDatabase("_pouch_validate_websql",1,"",1),!0}catch(t){return!1}}function ze(){if("undefined"==typeof indexedDB||null===indexedDB||!/iP(hone|od|ad)/.test(navigator.userAgent))return!0;var t=T(),r="_pouch__websqldb_valid_"+navigator.userAgent;if(t&&localStorage[r])return"1"===localStorage[r];var e=Ve();return t&&(localStorage[r]=e?"1":"0"),e}function We(){return"function"==typeof openDatabase&&ze()}function Ge(t,r,e,n){return openDatabase(t,r,e,n)}function Ke(t,r){var e=ko({websql:Ge},t);He.call(this,e,r)}function Xe(){for(var t={},r=new ho(function(r,e){t.resolve=r,t.reject=e}),e=new Array(arguments.length),n=0;n<e.length;n++)e[n]=arguments[n];return t.promise=r,ho.resolve().then(function(){return fetch.apply(null,e)}).then(function(r){t.resolve(r)}).catch(function(r){t.reject(r)}),t}function Qe(t,r){var e,n,o,c=new Headers,u={method:t.method,credentials:"include",headers:c};return t.json&&(c.set("Accept","application/json"),c.set("Content-Type",t.headers["Content-Type"]||"application/json")),t.body&&t.processData&&"string"!=typeof t.body?u.body=JSON.stringify(t.body):u.body="body"in t?t.body:null,Object.keys(t.headers).forEach(function(r){t.headers.hasOwnProperty(r)&&c.set(r,t.headers[r])}),e=Xe(t.url,u),t.timeout>0&&(n=setTimeout(function(){e.reject(new Error("Load timeout for resource: "+t.url))},t.timeout)),e.promise.then(function(r){return o={statusCode:r.status},t.timeout>0&&clearTimeout(n),o.statusCode>=200&&o.statusCode<300?t.binary?r.blob():r.text():r.json()}).then(function(t){o.statusCode>=200&&o.statusCode<300?r(null,o,t):(t.status=o.statusCode,r(t))}).catch(function(t){t||(t=new Error("canceled")),r(t)}),{abort:e.reject}}function Ye(t,r){var e,n,o=!1,c=function(){e.abort(),a()},u=function(){o=!0,e.abort(),a()},i={abort:c},a=function(){clearTimeout(n),i.abort=function(){},e&&(e.onprogress=void 0,e.upload&&(e.upload.onprogress=void 0),e.onreadystatechange=void 0,e=void 0)};e=t.xhr?new t.xhr:new XMLHttpRequest;try{e.open(t.method,t.url)}catch(t){return r(new Error(t.name||"Url is invalid"))}e.withCredentials=!("withCredentials"in t)||t.withCredentials,"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&&(e.responseType="arraybuffer"),"body"in t||(t.body=null);for(var _ in t.headers)t.headers.hasOwnProperty(_)&&e.setRequestHeader(_,t.headers[_]);return t.timeout>0&&(n=setTimeout(u,t.timeout),e.onprogress=function(){clearTimeout(n),4!==e.readyState&&(n=setTimeout(u,t.timeout))},void 0!==e.upload&&(e.upload.onprogress=e.onprogress)),e.onreadystatechange=function(){if(4===e.readyState){var n={statusCode:e.status};if(e.status>=200&&e.status<300){var c;c=t.binary?Cr([e.response||""],{type:e.getResponseHeader("Content-Type")}):e.responseText,r(null,n,c)}else{var u={};if(o)u=new Error("ETIMEDOUT"),u.code="ETIMEDOUT";else if("string"==typeof e.response)try{u=JSON.parse(e.response)}catch(t){}u.status=e.status,r(u)}a()}},t.body&&t.body instanceof Blob?Lr(t.body,function(t){e.send(t)}):e.send(t.body),i}function Ze(t,r){return Bc||t.xhr?Ye(t,r):Qe(t,r)}function tn(){return""}function rn(t,r){function e(r,e,n){if(!t.binary&&t.json&&"string"==typeof r)try{r=JSON.parse(r)}catch(t){return n(t)}Array.isArray(r)&&(r=r.map(function(t){return t.error||t.missing?q(t):t})),t.binary&&Lc(r,e),n(null,r,e)}return t=a(t),t=ko({method:"GET",headers:{},json:!0,processData:!0,timeout:1e4,cache:!1},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),Ze(t,function(n,o,c){if(n)return r(q(n));var u,i=o.headers&&o.headers["content-type"],a=c||tn();if(!t.binary&&(t.json||!t.processData)&&"object"!=typeof a&&(/json/.test(i)||/^[\s]*\{/.test(a)&&/\}[\s]*$/.test(a)))try{a=JSON.parse(a.toString())}catch(t){}o.statusCode>=200&&o.statusCode<300?e(a,o,r):(u=q(a),u.status=o.statusCode,r(u))})}function en(t,r){var e=navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",n=-1!==e.indexOf("safari")&&-1===e.indexOf("chrome"),o=-1!==e.indexOf("msie"),c=-1!==e.indexOf("edge"),u=n||(o||c)&&"GET"===t.method,i=!("cache"in t)||t.cache;if(!/^blob:/.test(t.url)&&(u||!i)){var a=-1!==t.url.indexOf("?");t.url+=(a?"&":"?")+"_nonce="+Date.now()}return rn(t,r)}function nn(t,r){return new ho(function(e,n){function o(){s++,t[f++]().then(u,i)}function c(){++l===d?_?n(_):e():a()}function u(){s--,c()}function i(t){s--,_=_||t,c()}function a(){for(;s<r&&f<d;)o()}var _,s=0,f=0,l=0,d=t.length;a()})}function on(t){var r=t.doc&&t.doc._attachments;r&&Object.keys(r).forEach(function(t){var e=r[t];e.data=Mr(e.data,e.content_type)})}function cn(t){return/^_design/.test(t)?"_design/"+encodeURIComponent(t.slice(8)):/^_local/.test(t)?"_local/"+encodeURIComponent(t.slice(7)):encodeURIComponent(t)}function un(t){return t._attachments&&Object.keys(t._attachments)?ho.all(Object.keys(t._attachments).map(function(r){var e=t._attachments[r];if(e.data&&"string"!=typeof e.data)return new ho(function(t){Br(e.data,t)}).then(function(t){e.data=t})})):ho.resolve()}function an(t){if(!t.prefix)return!1;var r=$(t.prefix).protocol;return"http"===r||"https"===r}function _n(t,r){if(an(r)){var e=r.name.substr(r.prefix.length);t=r.prefix+encodeURIComponent(e)}var n=$(t);(n.user||n.password)&&(n.auth={username:n.user,password:n.password});var o=n.path.replace(/(^\/|\/$)/g,"").split("/");return n.db=o.pop(),-1===n.db.indexOf("%")&&(n.db=encodeURIComponent(n.db)),n.path=o.join("/"),n}function sn(t,r){return fn(t,t.db+"/"+r)}function fn(t,r){var e=t.path?"/":"";return t.protocol+"://"+t.host+(t.port?":"+t.port:"")+"/"+t.path+e+r}function ln(t){return"?"+Object.keys(t).map(function(r){return r+"="+encodeURIComponent(t[r])}).join("&")}function dn(t,r){function e(t,r,e){var n=t.ajax||{},o=ko(a(f),n,r),c=a(f.headers||{});return o.headers=ko(c,n.headers,r.headers||{}),i.constructor.listeners("debug").length&&i.constructor.emit("debug",["http",o.method,o.url]),i._ajax(o,e)}function n(t,r){return new ho(function(n,o){e(t,r,function(t,r){if(t)return o(t);n(r)})})}function o(t,r){return l(t,io(function(t){c().then(function(){return r.apply(this,t)}).catch(function(r){t.pop()(r)})}))}function c(){return t.skipSetup||t.skip_setup?ho.resolve():v||(v=n({},{method:"GET",url:s}).catch(function(t){return t&&t.status&&404===t.status?(O(404,"PouchDB is just detecting if the remote exists."),n({},{method:"PUT",url:s})):ho.reject(t)}).catch(function(t){return!(!t||!t.status||412!==t.status)||ho.reject(t)}),v.catch(function(){v=null}),v)}function u(t){return t.split("/").map(encodeURIComponent).join("/")}var i=this,_=_n(t.name,t),s=sn(_,"");t=a(t);var f=t.ajax||{};if(t.auth||_.auth){var d=t.auth||_.auth,p=d.username+":"+d.password,h=ec(unescape(encodeURIComponent(p)));f.headers=f.headers||{},f.headers.Authorization="Basic "+h}i._ajax=en;var v;so(function(){r(null,i)}),i._remote=!0,i.type=function(){return"http"},i.id=o("id",function(t){e({},{method:"GET",url:fn(_,"")},function(r,e){var n=e&&e.uuid?e.uuid+_.db:sn(_,"");t(null,n)})}),i.request=o("request",function(t,r){t.url=sn(_,t.url),e({},t,r)}),i.compact=o("compact",function(t,r){"function"==typeof t&&(r=t,t={}),t=a(t),e(t,{url:sn(_,"_compact"),method:"POST"},function(){function e(){i.info(function(n,o){o&&!o.compact_running?r(null,{ok:!0}):setTimeout(e,t.interval||200)})}e()})}),i.bulkGet=l("bulkGet",function(t,r){function n(r){var n={};t.revs&&(n.revs=!0),t.attachments&&(n.attachments=!0),t.latest&&(n.latest=!0),e(t,{url:sn(_,"_bulk_get"+ln(n)),method:"POST",body:{docs:t.docs}},r)}function o(){for(var e=Fc,n=Math.ceil(t.docs.length/e),o=0,u=new Array(n),i=0;i<n;i++){var a=m(t,["revs","attachments","latest"]);a.ajax=f,a.docs=t.docs.slice(i*e,Math.min(t.docs.length,(i+1)*e)),b(c,a,function(t){return function(e,c){u[t]=c.results,++o===n&&r(null,{results:j(u)})}}(i))}}var c=this,u=fn(_,""),i=$c[u];"boolean"!=typeof i?n(function(t,e){t?($c[u]=!1,O(t.status,"PouchDB is just detecting if the remote supports the _bulk_get API."),o()):($c[u]=!0,r(null,e))}):i?n(r):o()}),i._info=function(t){c().then(function(){e({},{method:"GET",url:sn(_,"")},function(r,e){if(r)return t(r);e.host=sn(_,""),t(null,e)})}).catch(t)},i.get=o("get",function(t,r,e){function o(t){function e(e){var c=o[e],i=cn(t._id)+"/"+u(e)+"?rev="+t._rev;return n(r,{method:"GET",url:sn(_,i),binary:!0}).then(function(t){return r.binary?t:new ho(function(r){Br(t,r)})}).then(function(t){delete c.stub,delete c.length,c.data=t})}var o=t._attachments,c=o&&Object.keys(o);if(o&&c.length){return nn(c.map(function(t){return function(){return e(t)}}),5)}}function c(t){return Array.isArray(t)?ho.all(t.map(function(t){if(t.ok)return o(t.ok)})):o(t)}"function"==typeof r&&(e=r,r={}),r=a(r);var i={};r.revs&&(i.revs=!0),r.revs_info&&(i.revs_info=!0),r.latest&&(i.latest=!0),r.open_revs&&("all"!==r.open_revs&&(r.open_revs=JSON.stringify(r.open_revs)),i.open_revs=r.open_revs),r.rev&&(i.rev=r.rev),r.conflicts&&(i.conflicts=r.conflicts),t=cn(t);var s={method:"GET",url:sn(_,t+ln(i))};n(r,s).then(function(t){return ho.resolve().then(function(){if(r.attachments)return c(t)}).then(function(){e(null,t)})}).catch(e)}),i.remove=o("remove",function(t,r,n,o){var c;"string"==typeof r?(c={_id:t,_rev:r},"function"==typeof n&&(o=n,n={})):(c=t,"function"==typeof r?(o=r,n={}):(o=n,n=r));var u=c._rev||n.rev;e(n,{method:"DELETE",url:sn(_,cn(c._id))+"?rev="+u},o)}),i.getAttachment=o("getAttachment",function(t,r,n,o){"function"==typeof n&&(o=n,n={});var c=n.rev?"?rev="+n.rev:"";e(n,{method:"GET",url:sn(_,cn(t))+"/"+u(r)+c,binary:!0},o)}),i.removeAttachment=o("removeAttachment",function(t,r,n,o){e({},{method:"DELETE",url:sn(_,cn(t)+"/"+u(r))+"?rev="+n},o)}),i.putAttachment=o("putAttachment",function(t,r,n,o,c,i){"function"==typeof c&&(i=c,c=o,o=n,n=null);var a=cn(t)+"/"+u(r),s=sn(_,a);if(n&&(s+="?rev="+n),"string"==typeof o){var l;try{l=rc(o)}catch(t){return i(C(qo,"Attachment is not a valid base64 string"))}o=l?Nr(l,c):""}e({},{headers:{"Content-Type":c},method:"PUT",url:s,processData:!1,body:o,timeout:f.timeout||6e4},i)}),i._bulkDocs=function(t,r,n){t.new_edits=r.new_edits,c().then(function(){return ho.all(t.docs.map(un))}).then(function(){e(r,{method:"POST",url:sn(_,"_bulk_docs"),timeout:r.timeout,body:t},function(t,r){if(t)return n(t);r.forEach(function(t){t.ok=!0}),n(null,r)})}).catch(n)},i._put=function(t,r,n){c().then(function(){return un(t)}).then(function(){e(r,{method:"PUT",url:sn(_,cn(t._id)),body:t},function(t,r){if(t)return n(t);n(null,r)})}).catch(n)},i.allDocs=o("allDocs",function(t,r){"function"==typeof t&&(r=t,t={}),t=a(t);var e,o={},c="GET";t.conflicts&&(o.conflicts=!0),t.descending&&(o.descending=!0),t.include_docs&&(o.include_docs=!0),t.attachments&&(o.attachments=!0),t.key&&(o.key=JSON.stringify(t.key)),t.start_key&&(t.startkey=t.start_key),t.startkey&&(o.startkey=JSON.stringify(t.startkey)),t.end_key&&(t.endkey=t.end_key),t.endkey&&(o.endkey=JSON.stringify(t.endkey)),void 0!==t.inclusive_end&&(o.inclusive_end=!!t.inclusive_end),void 0!==t.limit&&(o.limit=t.limit),void 0!==t.skip&&(o.skip=t.skip);var u=ln(o);void 0!==t.keys&&(c="POST",e={keys:t.keys}),n(t,{method:c,url:sn(_,"_all_docs"+u),body:e}).then(function(e){t.include_docs&&t.attachments&&t.binary&&e.rows.forEach(on),r(null,e)}).catch(r)}),i._changes=function(t){var r="batch_size"in t?t.batch_size:Pc;t=a(t),t.timeout="timeout"in t?t.timeout:"timeout"in f?f.timeout:3e4;var n,o=t.timeout?{timeout:t.timeout-5e3}:{},u=void 0!==t.limit&&t.limit;n="return_docs"in t?t.return_docs:!("returnDocs"in t)||t.returnDocs;var i=u;if(t.style&&(o.style=t.style),(t.include_docs||t.filter&&"function"==typeof t.filter)&&(o.include_docs=!0),t.attachments&&(o.attachments=!0),t.continuous&&(o.feed="longpoll"),t.conflicts&&(o.conflicts=!0),t.descending&&(o.descending=!0),"heartbeat"in t?t.heartbeat&&(o.heartbeat=t.heartbeat):t.continuous&&(o.heartbeat=1e4),t.filter&&"string"==typeof t.filter&&(o.filter=t.filter),t.view&&"string"==typeof t.view&&(o.filter="_view",o.view=t.view),t.query_params&&"object"==typeof t.query_params)for(var s in t.query_params)t.query_params.hasOwnProperty(s)&&(o[s]=t.query_params[s]);var l,d="GET";t.doc_ids?(o.filter="_doc_ids",d="POST",l={doc_ids:t.doc_ids}):t.selector&&(o.filter="_selector",d="POST",l={selector:t.selector});var p,h,v=function(n,a){if(!t.aborted){o.since=n,"object"==typeof o.since&&(o.since=JSON.stringify(o.since)),t.descending?u&&(o.limit=i):o.limit=!u||i>r?r:i;var s={method:d,url:sn(_,"_changes"+ln(o)),timeout:t.timeout,body:l};h=n,t.aborted||c().then(function(){p=e(t,s,a)}).catch(a)}},m={results:[]},g=function(e,o){if(!t.aborted){var c=0;if(o&&o.results){c=o.results.length,m.last_seq=o.last_seq;({}).query=t.query_params,o.results=o.results.filter(function(r){i--;var e=M(t)(r);return e&&(t.include_docs&&t.attachments&&t.binary&&on(r),n&&m.results.push(r),t.onChange(r)),e})}else if(e)return t.aborted=!0,void t.complete(e);o&&o.last_seq&&(h=o.last_seq);var a=u&&i<=0||o&&c<r||t.descending;(!t.continuous||u&&i<=0)&&a?t.complete(null,m):so(function(){v(h,g)})}};return v(t.since||0,g),{cancel:function(){t.aborted=!0,p&&p.abort()}}},i.revsDiff=o("revsDiff",function(t,r,n){"function"==typeof r&&(n=r,r={}),e(r,{method:"POST",url:sn(_,"_revs_diff"),body:t},n)}),i._close=function(t){t()},i._destroy=function(t,r){e(t,{url:sn(_,""),method:"DELETE"},function(t,e){if(t&&t.status&&404!==t.status)return r(t);r(null,e)})}}function pn(t){this.status=400,this.name="query_parse_error",this.message=t,this.error=!0;try{Error.captureStackTrace(this,pn)}catch(t){}}function hn(t){this.status=404,this.name="not_found",this.message=t,this.error=!0;try{Error.captureStackTrace(this,hn)}catch(t){}}function vn(t){this.status=500,this.name="invalid_value",this.message=t,this.error=!0;try{Error.captureStackTrace(this,vn)}catch(t){}}function mn(t,r){return r&&t.then(function(t){so(function(){r(null,t)})},function(t){so(function(){r(t)})}),t}function gn(t){return io(function(r){var e=r.pop(),n=t.apply(this,r);return"function"==typeof e&&mn(n,e),n})}function yn(t,r){return t.then(function(t){return r().then(function(){return t})},function(t){return r().then(function(){throw t})})}function bn(t,r){return function(){var e=arguments,n=this;return t.add(function(){return r.apply(n,e)})}}function wn(t){var r=new go(t),e=new Array(r.size),n=-1;return r.forEach(function(t){e[++n]=t}),e}function Tn(t){var r=new Array(t.size),e=-1;return t.forEach(function(t,n){r[++e]=n}),r}function kn(t){return new vn("builtin "+t+" function requires map values to be numbers or number arrays")}function Sn(t){for(var r=0,e=0,n=t.length;e<n;e++){var o=t[e];if("number"!=typeof o){if(!Array.isArray(o))throw kn("_sum");r="number"==typeof r?[r]:r;for(var c=0,u=o.length;c<u;c++){var i=o[c];if("number"!=typeof i)throw kn("_sum");void 0===r[c]?r.push(i):r[c]+=i}}else"number"==typeof r?r+=o:r[0]+=o}return r}function xn(t,r){return U("return ("+t.replace(/;\s*$/,"")+");",{emit:r,sum:Sn,log:Jc,isArray:Hc,toJSON:Vc})}function En(){this.promise=new ho(function(t){t()})}function An(t){if(!t)return"undefined";switch(typeof t){case"function":case"string":return t.toString();default:return JSON.stringify(t)}}function On(t,r){return An(t)+An(r)+"undefined"}function In(t,r,e,n,o,c){var u,i=On(e,n);if(!o&&(u=t._cachedViews=t._cachedViews||{},u[i]))return u[i];var a=t.info().then(function(a){function _(t){t.views=t.views||{};var e=r;-1===e.indexOf("/")&&(e=r+"/"+r);var n=t.views[e]=t.views[e]||{};if(!n[s])return n[s]=!0,t}var s=a.db_name+"-mrview-"+(o?"temp":Hr(i));return J(t,"_local/"+c,_).then(function(){return t.registerDependentDatabase(s).then(function(r){var o=r.db;o.auto_compaction=!0;var c={name:s,db:o,sourceDB:t,adapter:t.adapter,mapFun:e,reduceFun:n};return c.db.get("_local/lastSeq").catch(function(t){if(404!==t.status)throw t}).then(function(t){return c.seq=t?t.seq:0,u&&c.db.once("destroyed",function(){delete u[i]}),c})})})});return u&&(u[i]=a),a}function Cn(t){return-1===t.indexOf("/")?[t,t]:t.split("/")}function qn(t){return 1===t.length&&/^1-/.test(t[0].rev)}function Nn(t,r){try{t.emit("error",r)}catch(t){x("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."),x("error",r)}}function Mn(t,r){if("function"==typeof t&&2===t.length){var e=t;return function(t){return e(t,r)}}return xn(t.toString(),r)}function jn(t){return Kc[t]?Kc[t]:xn(t.toString())}function Dn(t,r){var e=t.views&&t.views[r];if("string"!=typeof e.map)throw new hn("ddoc "+t._id+" has no string view named "+r+", instead found object of type: "+typeof e.map)}function Rn(t,r,e){return Xc.query.call(this,t,r,e)}function Bn(t){return Xc.viewCleanup.call(this,t)}function Ln(t){return/^1-/.test(t)}function Pn(t,r,e){return!t._attachments||!t._attachments[e]||t._attachments[e].digest!==r._attachments[e].digest}function Fn(t,r){var e=Object.keys(r._attachments);return ho.all(e.map(function(e){return t.getAttachment(r._id,e,{rev:r._rev})}))}function $n(t,r,e){var n=B(r)&&!B(t),o=Object.keys(e._attachments);return n?t.get(e._id).then(function(n){return ho.all(o.map(function(o){return Pn(n,e,o)?r.getAttachment(e._id,o):t.getAttachment(n._id,o)}))}).catch(function(t){if(404!==t.status)throw t;return Fn(r,e)}):Fn(r,e)}function Un(t){var r=[];return Object.keys(t).forEach(function(e){t[e].missing.forEach(function(t){r.push({id:e,rev:t})})}),{docs:r,revs:!0,latest:!0}}function Jn(t,r,e,n){function o(){var o=Un(e);if(o.docs.length)return t.bulkGet(o).then(function(e){if(n.cancelled)throw new Error("cancelled");return ho.all(e.results.map(function(e){return ho.all(e.docs.map(function(e){var n=e.ok;return e.error&&(l=!1),n&&n._attachments?$n(r,t,n).then(function(t){var r=Object.keys(n._attachments);return t.forEach(function(t,e){var o=n._attachments[r[e]];delete o.stub,delete o.length,o.data=t}),n}):n}))})).then(function(t){f=f.concat(j(t).filter(Boolean))})})}function c(t){return t._attachments&&Object.keys(t._attachments).length>0}function u(t){return t._conflicts&&t._conflicts.length>0}function i(r){return t.allDocs({keys:r,include_docs:!0,conflicts:!0}).then(function(t){if(n.cancelled)throw new Error("cancelled");t.rows.forEach(function(t){t.deleted||!t.doc||!Ln(t.value.rev)||c(t.doc)||u(t.doc)||(t.doc._conflicts&&delete t.doc._conflicts,f.push(t.doc),delete e[t.id])})})}function _(){var t=Object.keys(e).filter(function(t){var r=e[t].missing;return 1===r.length&&Ln(r[0])});if(t.length>0)return i(t)}function s(){return{ok:l,docs:f}}e=a(e);var f=[],l=!0;return ho.resolve().then(_).then(o).then(s)}function Hn(t,r,e,n,o){return t.get(r).catch(function(e){if(404===e.status)return"http"!==t.adapter&&"https"!==t.adapter||O(404,"PouchDB is just checking if a remote checkpoint exists."),{session_id:n,_id:r,history:[],replicator:Zc,version:Yc};throw e}).then(function(c){if(!o.cancelled&&c.last_seq!==e)return c.history=(c.history||[]).filter(function(t){return t.session_id!==n}),c.history.unshift({last_seq:e,session_id:n}),c.history=c.history.slice(0,tu),c.version=Yc,c.replicator=Zc,c.session_id=n,c.last_seq=e,t.put(c).catch(function(c){if(409===c.status)return Hn(t,r,e,n,o);throw c})})}function Vn(t,r,e,n){this.src=t,this.target=r,this.id=e,this.returnValue=n}function zn(t,r){return t.session_id===r.session_id?{last_seq:t.last_seq,history:t.history}:Wn(t.history,r.history)}function Wn(t,r){var e=t[0],n=t.slice(1),o=r[0],c=r.slice(1);return e&&0!==r.length?Gn(e.session_id,r)?{last_seq:e.last_seq,history:t}:Gn(o.session_id,n)?{last_seq:o.last_seq,history:c}:Wn(n,c):{last_seq:ru,history:[]}}function Gn(t,r){var e=r[0],n=r.slice(1);return!(!t||0===r.length)&&(t===e.session_id||Gn(t,n))}function Kn(t){return"number"==typeof t.status&&4===Math.floor(t.status/100)}function Xn(t,r,e,n){if(!1===t.retry)return r.emit("error",e),void r.removeAllListeners();if("function"!=typeof t.back_off_function&&(t.back_off_function=A),r.emit("requestError",e),"active"===r.state||"pending"===r.state){r.emit("paused",e),r.state="stopped";var o=function(){t.current_back_off=nu},c=function(){r.removeListener("active",o)};r.once("paused",c),r.once("active",o)}t.current_back_off=t.current_back_off||nu,t.current_back_off=t.back_off_function(t.current_back_off),setTimeout(n,t.current_back_off)}function Qn(t){return Object.keys(t).sort(Vt).reduce(function(r,e){return r[e]=t[e],r},{})}function Yn(t,r,e){var n=e.doc_ids?e.doc_ids.sort(Vt):"",o=e.filter?e.filter.toString():"",c="",u="",i="";return e.selector&&(i=JSON.stringify(e.selector)),e.filter&&e.query_params&&(c=JSON.stringify(Qn(e.query_params))),e.filter&&"_view"===e.filter&&(u=e.view.toString()),ho.all([t.id(),r.id()]).then(function(t){var r=t[0]+t[1]+o+u+c+n+i;return new ho(function(t){Jr(r,t)})}).then(function(t){return"_local/"+(t=t.replace(/\//g,".").replace(/\+/g,"_"))})}function Zn(t,r,e,n,o){function c(){return k?ho.resolve():Yn(t,r,e).then(function(e){T=e,k=new Vn(t,r,T,n)})}function u(){if(L=[],0!==w.docs.length){var t=w.docs,c={timeout:e.timeout};return r.bulkDocs({docs:t,new_edits:!1},c).then(function(r){if(n.cancelled)throw p(),new Error("cancelled");var e=Object.create(null);r.forEach(function(t){t.error&&(e[t.id]=t)});var c=Object.keys(e).length;o.doc_write_failures+=c,o.docs_written+=t.length-c,t.forEach(function(t){var r=e[t._id];if(r){if(o.errors.push(r),"unauthorized"!==r.name&&"forbidden"!==r.name)throw r;n.emit("denied",a(r))}else L.push(t)})},function(r){throw o.doc_write_failures+=t.length,r})}}function i(){if(w.error)throw new Error("There was a problem getting docs.");o.last_seq=I=w.seq;var t=a(o);return L.length&&(t.docs=L,n.emit("change",t)),E=!0,k.writeCheckpoint(w.seq,P).then(function(){if(E=!1,n.cancelled)throw p(),new Error("cancelled");w=void 0,g()}).catch(function(t){throw b(t),t})}function _(){var t={};return w.changes.forEach(function(r){"_user/"!==r.id&&(t[r.id]=r.changes.map(function(t){return t.rev}))}),r.revsDiff(t).then(function(t){if(n.cancelled)throw p(),new Error("cancelled");w.diffs=t})}function s(){return Jn(t,r,w.diffs,n).then(function(t){w.error=!t.ok,t.docs.forEach(function(t){delete w.diffs[t._id],o.docs_read++,w.docs.push(t)})})}function f(){if(!n.cancelled&&!w){if(0===S.length)return void l(!0);w=S.shift(),_().then(s).then(u).then(i).then(f).catch(function(t){d("batch processing terminated with error",t)})}}function l(t){if(0===x.changes.length)return void(0!==S.length||w||((q&&F.live||A)&&(n.state="pending",n.emit("paused")),A&&p()));(t||A||x.changes.length>=N)&&(S.push(x),x={seq:0,changes:[],docs:[]},"pending"!==n.state&&"stopped"!==n.state||(n.state="active",n.emit("active")),f())}function d(t,r){O||(r.message||(r.message=t),o.ok=!1,o.status="aborting",S=[],x={seq:0,changes:[],docs:[]},p(r))}function p(c){O||n.cancelled&&(o.status="cancelled",E)||(o.status=o.status||"complete",o.end_time=new Date,o.last_seq=I,O=!0,c?(c=C(c),c.result=o,"unauthorized"===c.name||"forbidden"===c.name?(n.emit("error",c),n.removeAllListeners()):Xn(e,n,c,function(){Zn(t,r,e,n)})):(n.emit("complete",o),n.removeAllListeners()))}function h(t){if(n.cancelled)return p();M(e)(t)&&(x.seq=t.seq,x.changes.push(t),l(0===S.length&&F.live))}function v(t){if(D=!1,n.cancelled)return p();if(t.results.length>0)F.since=t.last_seq,g(),l(!0);else{var r=function(){q?(F.live=!0,g()):A=!0,l(!0)};w||0!==t.results.length?r():(E=!0,k.writeCheckpoint(t.last_seq,P).then(function(){E=!1,o.last_seq=I=t.last_seq,r()}).catch(b))}}function m(t){if(D=!1,n.cancelled)return p();d("changes rejected",t)}function g(){function r(){c.cancel()}function o(){n.removeListener("cancel",r)}if(!D&&!A&&S.length<j){D=!0,n._changes&&(n.removeListener("cancel",n._abortChanges),n._changes.cancel()),n.once("cancel",r);var c=t.changes(F).on("change",h);c.then(o,o),c.then(v).catch(m),e.retry&&(n._changes=c,n._abortChanges=r)}}function y(){c().then(function(){return n.cancelled?void p():k.getCheckpoint().then(function(t){I=t,F={since:I,limit:N,batch_size:N,style:"all_docs",doc_ids:R,selector:B,return_docs:!0},e.filter&&("string"!=typeof e.filter?F.include_docs=!0:F.filter=e.filter),"heartbeat"in e&&(F.heartbeat=e.heartbeat),"timeout"in e&&(F.timeout=e.timeout),e.query_params&&(F.query_params=e.query_params),e.view&&(F.view=e.view),g()})}).catch(function(t){d("getCheckpoint rejected with ",t)})}function b(t){E=!1,d("writeCheckpoint completed with error",t)}var w,T,k,S=[],x={seq:0,changes:[],docs:[]},E=!1,A=!1,O=!1,I=0,q=e.continuous||e.live||!1,N=e.batch_size||100,j=e.batches_limit||10,D=!1,R=e.doc_ids,B=e.selector,L=[],P=z();o=o||{ok:!0,start_time:new Date,docs_read:0,docs_written:0,doc_write_failures:0,errors:[]};var F={};if(n.ready(t,r),n.cancelled)return void p();n._addedListeners||(n.once("cancel",p),"function"==typeof e.complete&&(n.once("error",e.complete),n.once("complete",function(t){e.complete(null,t)})),n._addedListeners=!0),void 0===e.since?y():c().then(function(){return E=!0,k.writeCheckpoint(e.since,P)}).then(function(){if(E=!1,n.cancelled)return void p();I=e.since,y()}).catch(b)}function to(){ao.EventEmitter.call(this),this.cancelled=!1,this.state="pending";var t=this,r=new ho(function(r,e){t.once("complete",r),t.once("error",e)});t.then=function(t,e){return r.then(t,e)},t.catch=function(t){return r.catch(t)},t.catch(function(){})}function ro(t,r){var e=r.PouchConstructor;return"string"==typeof t?new e(t,r):t}function eo(t,r,e,n){if("function"==typeof e&&(n=e,e={}),void 0===e&&(e={}),e.doc_ids&&!Array.isArray(e.doc_ids))throw C(jo,"`doc_ids` filter parameter is not a list.");e.complete=n,e=a(e),e.continuous=e.continuous||e.live,e.retry="retry"in e&&e.retry,e.PouchConstructor=e.PouchConstructor||this;var o=new to(e);return Zn(ro(t,e),ro(r,e),e,o),o}function no(t,r,e,n){return"function"==typeof e&&(n=e,e={}),void 0===e&&(e={}),e=a(e),e.PouchConstructor=e.PouchConstructor||this,t=ro(t,e),r=ro(r,e),new oo(t,r,e,n)}function oo(t,r,e,n){function o(t){p.emit("change",{direction:"pull",change:t})}function c(t){p.emit("change",{direction:"push",change:t})}function u(t){p.emit("denied",{direction:"push",doc:t})}function i(t){p.emit("denied",{direction:"pull",doc:t})}function a(){p.pushPaused=!0,p.pullPaused&&p.emit("paused")}function _(){p.pullPaused=!0,p.pushPaused&&p.emit("paused")}function s(){p.pushPaused=!1,p.pullPaused&&p.emit("active",{direction:"push"})}function f(){p.pullPaused=!1,p.pushPaused&&p.emit("active",{direction:"pull"})}function l(t){return function(r,e){var n="change"===r&&(e===o||e===c),l="denied"===r&&(e===i||e===u),d="paused"===r&&(e===_||e===a),h="active"===r&&(e===f||e===s);(n||l||d||h)&&(r in m||(m[r]={}),m[r][t]=!0,2===Object.keys(m[r]).length&&p.removeAllListeners(r))}}function d(t,r,e){-1==t.listeners(r).indexOf(e)&&t.on(r,e)}var p=this;this.canceled=!1;var h=e.push?ko({},e,e.push):e,v=e.pull?ko({},e,e.pull):e;this.push=eo(t,r,h),this.pull=eo(r,t,v),this.pushPaused=!0,this.pullPaused=!0;var m={};e.live&&(this.push.on("complete",p.pull.cancel.bind(p.pull)),this.pull.on("complete",p.push.cancel.bind(p.push))),this.on("newListener",function(t){"change"===t?(d(p.pull,"change",o),d(p.push,"change",c)):"denied"===t?(d(p.pull,"denied",i),d(p.push,"denied",u)):"active"===t?(d(p.pull,"active",f),d(p.push,"active",s)):"paused"===t&&(d(p.pull,"paused",_),d(p.push,"paused",a))}),this.on("removeListener",function(t){"change"===t?(p.pull.removeListener("change",o),p.push.removeListener("change",c)):"denied"===t?(p.pull.removeListener("denied",i),p.push.removeListener("denied",u)):"active"===t?(p.pull.removeListener("active",f),p.push.removeListener("active",s)):"paused"===t&&(p.pull.removeListener("paused",_),p.push.removeListener("paused",a))}),this.pull.on("removeListener",l("pull")),this.push.on("removeListener",l("push"));var g=ho.all([this.push,this.pull]).then(function(t){var r={push:t[0],pull:t[1]};return p.emit("complete",r),n&&n(null,r),p.removeAllListeners(),r},function(t){if(p.cancel(),n?n(t):p.emit("error",t),p.removeAllListeners(),n)throw t});this.then=function(t,r){return g.then(t,r)},this.catch=function(t){return g.catch(t)}}function co(t){t.replicate=eo,t.sync=no,Object.defineProperty(t.prototype,"replicate",{get:function(){var t=this;return{from:function(r,e,n){return t.constructor.replicate(r,t,e,n)},to:function(r,e,n){return t.constructor.replicate(t,r,e,n)}}}}),t.prototype.sync=function(t,r,e){return this.constructor.sync(this,t,r,e)}}var uo=n(e(237)),io=n(e(130)),ao=e(87),_o=n(e(5)),so=n(e(163)),fo=n(e(522)),lo=n(e(309)),po=n(e(800)),ho="function"==typeof Promise?Promise:uo,vo=Function.prototype.toString,mo=vo.call(Object);h.prototype.get=function(t){var r=d(t);return this._store[r]},h.prototype.set=function(t,r){var e=d(t);return this._store[e]=r,!0},h.prototype.has=function(t){return d(t)in this._store},h.prototype.delete=function(t){var r=d(t),e=r in this._store;return delete this._store[r],e},h.prototype.forEach=function(t){for(var r=Object.keys(this._store),e=0,n=r.length;e<n;e++){var o=r[e],c=this._store[o];o=p(o),t(c,o)}},Object.defineProperty(h.prototype,"size",{get:function(){return Object.keys(this._store).length}}),v.prototype.add=function(t){return this._store.set(t,!0)},v.prototype.has=function(t){return this._store.has(t)},v.prototype.forEach=function(t){this._store.forEach(function(r,e){t(e)})},Object.defineProperty(v.prototype,"size",{get:function(){return this._store.size}});var go,yo;!function(){if("undefined"==typeof Symbol||"undefined"==typeof Map||"undefined"==typeof Set)return!1;var t=Object.getOwnPropertyDescriptor(Map,Symbol.species);return t&&"get"in t&&Map[Symbol.species]===Map}()?(go=v,yo=h):(go=Set,yo=Map);var bo,wo=6;if(w())bo=!1;else try{localStorage.setItem("_pouch_check_localstorage",1),bo=!!localStorage.getItem("_pouch_check_localstorage")}catch(t){bo=!1}_o(S,ao.EventEmitter),S.prototype.addListener=function(t,r,e,n){function o(){function t(){u=!1}if(c._listeners[r]){if(u)return void(u="waiting");u=!0;var i=m(n,["style","include_docs","attachments","conflicts","filter","doc_ids","view","since","query_params","binary"]);e.changes(i).on("change",function(t){t.seq>n.since&&!n.cancelled&&(n.since=t.seq,n.onChange(t))}).on("complete",function(){"waiting"===u&&so(o),u=!1}).on("error",t)}}if(!this._listeners[r]){var c=this,u=!1;this._listeners[r]=o,this.on(t,o)}},S.prototype.removeListener=function(t,r){r in this._listeners&&(ao.EventEmitter.prototype.removeListener.call(this,t,this._listeners[r]),delete this._listeners[r])},S.prototype.notifyLocalWindows=function(t){w()?chrome.storage.local.set({dbName:t}):T()&&(localStorage[t]="a"===localStorage[t]?"b":"a")},S.prototype.notify=function(t){this.emit(t),this.notifyLocalWindows(t)};var To;To="function"==typeof Object.assign?Object.assign:function(t){for(var r=Object(t),e=1;e<arguments.length;e++){var n=arguments[e];if(null!=n)for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])}return r};var ko=To;_o(I,Error),I.prototype.toString=function(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})};var So=(new I(401,"unauthorized","Name or password is incorrect."),new I(400,"bad_request","Missing JSON list of 'docs'")),xo=new I(404,"not_found","missing"),Eo=new I(409,"conflict","Document update conflict"),Ao=new I(400,"bad_request","_id field must contain a string"),Oo=new I(412,"missing_id","_id is required for puts"),Io=new I(400,"bad_request","Only reserved document ids may start with underscore."),Co=(new I(412,"precondition_failed","Database not open"),new I(500,"unknown_error","Database encountered an unknown error")),qo=new I(500,"badarg","Some query argument is invalid"),No=(new I(400,"invalid_request","Request was invalid"),new I(400,"query_parse_error","Some query parameter is invalid")),Mo=new I(500,"doc_validation","Bad special document member"),jo=new I(400,"bad_request","Something wrong with the request"),Do=new I(400,"bad_request","Document must be a JSON object"),Ro=(new I(404,"not_found","Database not found"),new I(500,"indexed_db_went_bad","unknown")),Bo=new I(500,"web_sql_went_bad","unknown"),Lo=(new I(500,"levelDB_went_went_bad","unknown"),new I(403,"forbidden","Forbidden by design doc validate_doc_update function"),new I(400,"bad_request","Invalid rev format")),Po=(new I(412,"file_exists","The database could not be created, the file already exists."),new I(412,"missing_stub","A pre-existing attachment stub wasn't found")),Fo=(new I(413,"invalid_url","Provided URL is invalid"),D.name);var $o=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],Uo="queryKey",Jo=/(?:^|&)([^&=]*)=?([^&]*)/g,Ho=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Vo="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");_o(ht,ao.EventEmitter),ht.prototype.cancel=function(){this.isCancelled=!0,this.db.taskqueue.isReady&&this.emit("cancel")},ht.prototype.validateChanges=function(t){var r=t.complete,e=this;It._changesFilterPlugin?It._changesFilterPlugin.validate(t,function(n){if(n)return r(n);e.doChanges(t)}):e.doChanges(t)},ht.prototype.doChanges=function(t){var r=this,e=t.complete;if(t=a(t),"live"in t&&!("continuous"in t)&&(t.continuous=t.live),t.processChange=vt,"latest"===t.since&&(t.since="now"),t.since||(t.since=0),"now"===t.since)return void this.db.info().then(function(n){if(r.isCancelled)return void e(null,{status:"cancelled"});t.since=n.update_seq,r.doChanges(t)},e);if(It._changesFilterPlugin){if(It._changesFilterPlugin.normalize(t),It._changesFilterPlugin.shouldFilter(this,t))return It._changesFilterPlugin.filter(this,t)}else["doc_ids","filter","selector","view"].forEach(function(r){r in t&&x("warn",'The "'+r+'" option was passed in to changes/replicate, but pouchdb-changes-filter plugin is not installed, so it was ignored. Please install the plugin to enable filtering.')});"descending"in t||(t.descending=!1),t.limit=0===t.limit?1:t.limit,t.complete=e;var n=this.db._changes(t);if(n&&"function"==typeof n.cancel){var o=r.cancel;r.cancel=io(function(t){n.cancel(),o.apply(this,t)})}},_o(xt,ao.EventEmitter),xt.prototype.post=l("post",function(t,r,e){if("function"==typeof r&&(e=r,r={}),"object"!=typeof t||Array.isArray(t))return e(C(Do));this.bulkDocs({docs:[t]},r,gt(e))}),xt.prototype.put=l("put",function(t,r,e){return"function"==typeof r&&(e=r,r={}),"object"!=typeof t||Array.isArray(t)?e(C(Do)):(R(t._id),lt(t._id)&&"function"==typeof this._putLocal?t._deleted?this._removeLocal(t,e):this._putLocal(t,e):void("function"==typeof this._put&&!1!==r.new_edits?this._put(t,r,e):this.bulkDocs({docs:[t]},r,gt(e))))}),xt.prototype.putAttachment=l("putAttachment",function(t,r,e,n,o){function c(t){var e="_rev"in t?parseInt(t._rev,10):0;return t._attachments=t._attachments||{},t._attachments[r]={content_type:o,data:n,revpos:++e},u.put(t)}var u=this;return"function"==typeof o&&(o=n,n=e,e=null),void 0===o&&(o=n,n=e,e=null),o||x("warn","Attachment",r,"on document",t,"is missing content_type"),u.get(t).then(function(t){if(t._rev!==e)throw C(Eo);return c(t)},function(r){if(r.reason===xo.message)return c({_id:t});throw r})}),xt.prototype.removeAttachment=l("removeAttachment",function(t,r,e,n){var o=this;o.get(t,function(t,c){return t?void n(t):c._rev!==e?void n(C(Eo)):c._attachments?(delete c._attachments[r],0===Object.keys(c._attachments).length&&delete c._attachments,void o.put(c,n)):n()})}),xt.prototype.remove=l("remove",function(t,r,e,n){var o;"string"==typeof r?(o={_id:t,_rev:r},"function"==typeof e&&(n=e,e={})):(o=t,"function"==typeof r?(n=r,e={}):(n=e,e=r)),e=e||{},e.was_delete=!0;var c={_id:o._id,_rev:o._rev||e.rev};if(c._deleted=!0,lt(c._id)&&"function"==typeof this._removeLocal)return this._removeLocal(o,n);this.bulkDocs({docs:[c]},e,gt(n))}),xt.prototype.revsDiff=l("revsDiff",function(t,r,e){function n(t,r){i.has(t)||i.set(t,{missing:[]}),i.get(t).missing.push(r)}function o(r,e){var o=t[r].slice(0);G(e,function(t,e,c,u,i){var a=e+"-"+c,_=o.indexOf(a);-1!==_&&(o.splice(_,1),"available"!==i.status&&n(r,a))}),o.forEach(function(t){n(r,t)})}"function"==typeof r&&(e=r,r={});var c=Object.keys(t);if(!c.length)return e(null,{});var u=0,i=new yo;c.map(function(r){this._getRevisionTree(r,function(n,a){if(n&&404===n.status&&"missing"===n.message)i.set(r,{missing:t[r]});else{if(n)return e(n);o(r,a)}if(++u===c.length){var _={};return i.forEach(function(t,r){_[r]=t}),e(null,_)}})},this)}),xt.prototype.bulkGet=l("bulkGet",function(t,r){b(this,t,r)}),xt.prototype.compactDocument=l("compactDocument",function(t,r,e){var n=this;this._getRevisionTree(t,function(o,c){if(o)return e(o);var u=wt(c),i=[],a=[];Object.keys(u).forEach(function(t){u[t]>r&&i.push(t)}),G(c,function(t,r,e,n,o){var c=r+"-"+e;"available"===o.status&&-1!==i.indexOf(c)&&a.push(c)}),n._doCompaction(t,a,e)})}),xt.prototype.compact=l("compact",function(t,r){"function"==typeof t&&(r=t,t={});var e=this;t=t||{},e._compactionQueue=e._compactionQueue||[],e._compactionQueue.push({opts:t,callback:r}),1===e._compactionQueue.length&&kt(e)}),xt.prototype._compact=function(t,r){function e(t){u.push(o.compactDocument(t.id,0))}function n(t){var e=t.last_seq;ho.all(u).then(function(){return J(o,"_local/compaction",function(t){return(!t.last_seq||t.last_seq<e)&&(t.last_seq=e,t)})}).then(function(){r(null,{ok:!0})}).catch(r)}var o=this,c={return_docs:!1,last_seq:t.last_seq||0},u=[];o.changes(c).on("change",e).on("complete",n).on("error",r)},xt.prototype.get=l("get",function(t,r,e){function n(){var n=[],u=o.length;if(!u)return e(null,n);o.forEach(function(o){c.get(t,{rev:o,revs:r.revs,latest:r.latest,attachments:r.attachments},function(t,r){if(t)n.push({missing:o});else{for(var c,i=0,a=n.length;i<a;i++)if(n[i].ok&&n[i].ok._rev===r._rev){c=!0;break}c||n.push({ok:r})}--u||e(null,n)})})}if("function"==typeof r&&(e=r,r={}),"string"!=typeof t)return e(C(Ao));if(lt(t)&&"function"==typeof this._getLocal)return this._getLocal(t,e);var o=[],c=this;if(!r.open_revs)return this._get(t,r,function(t,n){if(t)return e(t);var o=n.doc,u=n.metadata,i=n.ctx;if(r.conflicts){var a=Q(u);a.length&&(o._conflicts=a)}if(ft(u,o._rev)&&(o._deleted=!0),r.revs||r.revs_info){for(var _=o._rev.split("-"),s=parseInt(_[0],10),f=_[1],l=Z(u.rev_tree),d=null,p=0;p<l.length;p++){var h=l[p],v=h.ids.map(function(t){return t.id}).indexOf(f);(v===s-1||!d&&-1!==v)&&(d=h)}var m=d.ids.map(function(t){return t.id}).indexOf(o._rev.split("-")[1])+1,g=d.ids.length-m;if(d.ids.splice(m,g),d.ids.reverse(),r.revs&&(o._revisions={start:d.pos+d.ids.length-1,ids:d.ids.map(function(t){return t.id})}),r.revs_info){var y=d.pos+d.ids.length;o._revs_info=d.ids.map(function(t){return y--,{rev:y+"-"+t.id,status:t.opts.status}})}}if(r.attachments&&o._attachments){var b=o._attachments,w=Object.keys(b).length;if(0===w)return e(null,o);Object.keys(b).forEach(function(t){this._getAttachment(o._id,t,b[t],{rev:o._rev,binary:r.binary,ctx:i},function(r,n){var c=o._attachments[t];c.data=n,delete c.stub,delete c.length,--w||e(null,o)})},c)}else{if(o._attachments)for(var T in o._attachments)o._attachments.hasOwnProperty(T)&&(o._attachments[T].stub=!0);e(null,o)}});if("all"===r.open_revs)this._getRevisionTree(t,function(t,r){if(t)return e(t);o=X(r).map(function(t){return t.rev}),n()});else{if(!Array.isArray(r.open_revs))return e(C(Co,"function_clause"));o=r.open_revs;for(var u=0;u<o.length;u++){var i=o[u];if("string"!=typeof i||!/^\d+-/.test(i))return e(C(Lo))}n()}}),xt.prototype.getAttachment=l("getAttachment",function(t,r,e,n){var o=this;e instanceof Function&&(n=e,e={}),this._get(t,e,function(c,u){return c?n(c):u.doc._attachments&&u.doc._attachments[r]?(e.ctx=u.ctx,e.binary=!0,o._getAttachment(t,r,u.doc._attachments[r],e,n),void 0):n(C(xo))})}),xt.prototype.allDocs=l("allDocs",function(t,r){if("function"==typeof t&&(r=t,t={}),t.skip=void 0!==t.skip?t.skip:0,t.start_key&&(t.startkey=t.start_key),t.end_key&&(t.endkey=t.end_key),"keys"in t){if(!Array.isArray(t.keys))return r(new TypeError("options.keys must be an array"));var e=["startkey","endkey","key"].filter(function(r){return r in t})[0];if(e)return void r(C(No,"Query parameter `"+e+"` is not compatible with multi-get"));if(!B(this))return Tt(this,t,r)}return this._allDocs(t,r)}),xt.prototype.changes=function(t,r){return"function"==typeof t&&(r=t,t={}),new ht(this,t,r)},xt.prototype.close=l("close",function(t){return this._closed=!0,this.emit("closed"),this._close(t)}),xt.prototype.info=l("info",function(t){var r=this;this._info(function(e,n){if(e)return t(e);n.db_name=n.db_name||r.name,n.auto_compaction=!(!r.auto_compaction||B(r)),n.adapter=r.adapter,t(null,n)})}),xt.prototype.id=l("id",function(t){return this._id(t)}),xt.prototype.type=function(){return"function"==typeof this._type?this._type():this.adapter},xt.prototype.bulkDocs=l("bulkDocs",function(t,r,e){if("function"==typeof r&&(e=r,r={}),r=r||{},Array.isArray(t)&&(t={docs:t}),!t||!t.docs||!Array.isArray(t.docs))return e(C(So));for(var n=0;n<t.docs.length;++n)if("object"!=typeof t.docs[n]||Array.isArray(t.docs[n]))return e(C(Do));var o;if(t.docs.forEach(function(t){t._attachments&&Object.keys(t._attachments).forEach(function(r){o=o||St(r),t._attachments[r].content_type||x("warn","Attachment",r,"on document",t._id,"is missing content_type")})}),o)return e(C(jo,o));"new_edits"in r||(r.new_edits=!("new_edits"in t)||t.new_edits);var c=this;r.new_edits||B(c)||t.docs.sort(bt),yt(t.docs);var u=t.docs.map(function(t){return t._id});return this._bulkDocs(t,r,function(t,n){if(t)return e(t);if(r.new_edits||(n=n.filter(function(t){return t.error})),!B(c))for(var o=0,i=n.length;o<i;o++)n[o].id=n[o].id||u[o];e(null,n)})}),xt.prototype.registerDependentDatabase=l("registerDependentDatabase",function(t,r){function e(r){return r.dependentDbs=r.dependentDbs||{},!r.dependentDbs[t]&&(r.dependentDbs[t]=!0,r)}var n=new this.constructor(t,this.__opts);J(this,"_local/_pouch_dependentDbs",e).then(function(){r(null,{db:n})}).catch(r)}),xt.prototype.destroy=l("destroy",function(t,r){function e(){n._destroy(t,function(t,e){if(t)return r(t);n._destroyed=!0,n.emit("destroyed"),r(null,e||{ok:!0})})}"function"==typeof t&&(r=t,t={});var n=this,o=!("use_prefix"in n)||n.use_prefix;if(B(n))return e();n.get("_local/_pouch_dependentDbs",function(t,c){if(t)return 404!==t.status?r(t):e();var u=c.dependentDbs,i=n.constructor,a=Object.keys(u).map(function(t){var r=o?t.replace(new RegExp("^"+i.prefix),""):t;return new i(r,n.__opts).destroy()});ho.all(a).then(e,r)})}),Et.prototype.execute=function(){var t;if(this.failed)for(;t=this.queue.shift();)t(this.failed);else for(;t=this.queue.shift();)t()},Et.prototype.fail=function(t){this.failed=t,this.execute()},Et.prototype.ready=function(t){this.isReady=!0,this.db=t,this.execute()},Et.prototype.addTask=function(t){this.queue.push(t),this.failed&&this.execute()},_o(It,xt),It.adapters={},It.preferredAdapters=[],It.prefix="_pouch_";var zo=new ao.EventEmitter;!function(t){Object.keys(ao.EventEmitter.prototype).forEach(function(r){"function"==typeof ao.EventEmitter.prototype[r]&&(t[r]=zo[r].bind(zo))});var r=t._destructionListeners=new yo;t.on("destroyed",function(t){r.get(t).forEach(function(t){t()}),r.delete(t)})}(It),It.adapter=function(t,r,e){r.valid()&&(It.adapters[t]=r,e&&It.preferredAdapters.push(t))},It.plugin=function(t){if("function"==typeof t)t(It);else{if("object"!=typeof t||0===Object.keys(t).length)throw new Error('Invalid plugin: got "'+t+'", expected an object or a function');Object.keys(t).forEach(function(r){It.prototype[r]=t[r]})}return this.__defaults&&(It.__defaults=ko({},this.__defaults)),It},It.defaults=function(t){function r(t,e){if(!(this instanceof r))return new r(t,e);e=e||{},t&&"object"==typeof t&&(e=t,t=e.name,delete e.name),e=ko({},r.__defaults,e),It.call(this,t,e)}return _o(r,It),r.preferredAdapters=It.preferredAdapters.slice(),Object.keys(It).forEach(function(t){t in r||(r[t]=It[t])}),r.__defaults=ko({},this.__defaults,t),r};var Wo=["$or","$nor","$not"],Go=-324,Ko=3,Xo="",Qo={$elemMatch:function(t,r,e,n){return!!Array.isArray(n)&&(0!==n.length&&("object"==typeof n[0]?n.some(function(t){return cr(t,r,Object.keys(r))}):n.some(function(n){return ir(r,t,e,n)})))},$eq:function(t,r,e,n){return fr(n)&&0===Vt(n,r)},$gte:function(t,r,e,n){return fr(n)&&Vt(n,r)>=0},$gt:function(t,r,e,n){return fr(n)&&Vt(n,r)>0},$lte:function(t,r,e,n){return fr(n)&&Vt(n,r)<=0},$lt:function(t,r,e,n){return fr(n)&&Vt(n,r)<0},$exists:function(t,r,e,n){return r?fr(n):!fr(n)},$mod:function(t,r,e,n){return sr(n)&&lr(n,r)},$ne:function(t,r,e,n){return r.every(function(t){return 0!==Vt(n,t)})},$in:function(t,r,e,n){return sr(n)&&dr(n,r)},$nin:function(t,r,e,n){return sr(n)&&!dr(n,r)},$size:function(t,r,e,n){return sr(n)&&hr(n,r)},$all:function(t,r,e,n){return Array.isArray(n)&&pr(n,r)},$regex:function(t,r,e,n){return sr(n)&&vr(n,r)},$type:function(t,r,e,n){return mr(n,r)}};It.plugin(Ct),It.plugin(xr),It.version="6.2.0";var Yo,Zo=Er(["_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"]),tc=Er(["_attachments","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats"]),rc=function(t){return atob(t)},ec=function(t){return btoa(t)},nc=r.setImmediate||r.setTimeout,oc=32768,cc=5,uc="document-store",ic="by-sequence",ac="attach-store",_c="attach-seq-store",sc="meta-store",fc="local-store",lc="detect-blob-support",dc=new S,pc=!1,hc=[],vc=new yo,mc=new yo;we.valid=function(){return!("undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform))&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange};var gc=function(t){t.adapter("idb",we,!0)},yc=7,bc=Ie("document-store"),wc=Ie("by-sequence"),Tc=Ie("attach-store"),kc=Ie("local-store"),Sc=Ie("metadata-store"),xc=Ie("attach-seq-store"),Ec=new yo,Ac=new S,Oc=1,Ic="CREATE INDEX IF NOT EXISTS 'by-seq-deleted-idx' ON "+wc+" (seq, deleted)",Cc="CREATE UNIQUE INDEX IF NOT EXISTS 'by-seq-doc-id-rev' ON "+wc+" (doc_id, rev)",qc="CREATE INDEX IF NOT EXISTS 'doc-winningseq-idx' ON "+bc+" (winningseq)",Nc="CREATE INDEX IF NOT EXISTS 'attach-seq-seq-idx' ON "+xc+" (seq)",Mc="CREATE UNIQUE INDEX IF NOT EXISTS 'attach-seq-digest-idx' ON "+xc+" (digest, seq)",jc=wc+".seq = "+bc+".winningseq",Dc=wc+".seq AS seq, "+wc+".deleted AS deleted, "+wc+".json AS data, "+wc+".rev AS rev, "+bc+".json AS metadata";Ke.valid=We,Ke.use_prefix=!0;var Rc=function(t){t.adapter("websql",Ke,!0)},Bc=function(){try{return new XMLHttpRequest,!0}catch(t){return!1}}(),Lc=function(){},Pc=25,Fc=50,$c={};dn.valid=function(){return!0};var Uc=function(t){t.adapter("http",dn,!1),t.adapter("https",dn,!1)};_o(pn,Error),_o(hn,Error),_o(vn,Error);var Jc=x.bind(null,"log"),Hc=Array.isArray,Vc=JSON.parse;En.prototype.add=function(t){return this.promise=this.promise.catch(function(){}).then(function(){return t()}),this.promise},En.prototype.finish=function(){return this.promise};var zc={},Wc=new En,Gc=50,Kc={_sum:function(t,r){return Sn(r)},_count:function(t,r){return r.length},_stats:function(t,r){return{sum:Sn(r),min:Math.min.apply(null,r),max:Math.max.apply(null,r),count:r.length,sumsqr:function(t){for(var r=0,e=0,n=t.length;e<n;e++){var o=t[e];r+=o*o}return r}(r)}}},Xc=function(t,r,e,n){function o(t,r,e){try{r(e)}catch(r){Nn(t,r)}}function c(t,r,e,n,o){try{return{output:r(e,n,o)}}catch(r){return Nn(t,r),{error:r}}}function u(t,r){var e=Vt(t.key,r.key);return 0!==e?e:Vt(t.value,r.value)}function i(t,r,e){return e=e||0,"number"==typeof r?t.slice(e,r+e):e>0?t.slice(e):t}function a(t){var r=t.value;return r&&"object"==typeof r&&r._id||t.id}function _(t){t.rows.forEach(function(t){var r=t.doc&&t.doc._attachments;r&&Object.keys(r).forEach(function(t){var e=r[t];r[t].data=Mr(e.data,e.content_type)})})}function s(t){return function(r){return t.include_docs&&t.attachments&&t.binary&&_(r),r}}function f(t,r,e,n){var o=r[t];void 0!==o&&(n&&(o=encodeURIComponent(JSON.stringify(o))),e.push(t+"="+o))}function l(t){if(void 0!==t){var r=Number(t);return isNaN(r)||r!==parseInt(t,10)?t:r}}function d(t){return t.group_level=l(t.group_level),t.limit=l(t.limit),t.skip=l(t.skip),t}function p(t){if(t){if("number"!=typeof t)return new pn('Invalid value for integer: "'+t+'"');if(t<0)return new pn('Invalid value for positive integer: "'+t+'"')}}function h(t,r){var e=t.descending?"endkey":"startkey",n=t.descending?"startkey":"endkey";if(void 0!==t[e]&&void 0!==t[n]&&Vt(t[e],t[n])>0)throw new pn("No rows can match your key range, reverse your start_key and end_key or set {descending : true}");if(r.reduce&&!1!==t.reduce){if(t.include_docs)throw new pn("{include_docs:true} is invalid for reduce");if(t.keys&&t.keys.length>1&&!t.group&&!t.group_level)throw new pn("Multi-key fetches for reduce views must use {group: true}")}["group_level","limit","skip"].forEach(function(r){var e=p(t[r]);if(e)throw e})}function v(t,r,e){var n,o=[],c="GET";if(f("reduce",e,o),f("include_docs",e,o),f("attachments",e,o),f("limit",e,o),f("descending",e,o),f("group",e,o),f("group_level",e,o),f("skip",e,o),f("stale",e,o),f("conflicts",e,o),f("startkey",e,o,!0),f("start_key",e,o,!0),f("endkey",e,o,!0),f("end_key",e,o,!0),f("inclusive_end",e,o),f("key",e,o,!0),o=o.join("&"),o=""===o?"":"?"+o,void 0!==e.keys){var u="keys="+encodeURIComponent(JSON.stringify(e.keys));u.length+o.length+1<=2e3?o+=("?"===o[0]?"&":"?")+u:(c="POST","string"==typeof r?n={keys:e.keys}:r.keys=e.keys)}if("string"==typeof r){var i=Cn(r);return t.request({method:c,url:"_design/"+i[0]+"/_view/"+i[1]+o,body:n}).then(s(e))}return n=n||{},Object.keys(r).forEach(function(t){Array.isArray(r[t])?n[t]=r[t]:n[t]=r[t].toString()}),t.request({method:"POST",url:"_temp_view"+o,body:n}).then(s(e))}function m(t,r,e){return new ho(function(n,o){t._query(r,e,function(t,r){if(t)return o(t);n(r)})})}function g(t){return new ho(function(r,e){t._viewCleanup(function(t,n){if(t)return e(t);r(n)})})}function y(t){return function(r){if(404===r.status)return t;throw r}}function b(t,r,e){function n(t){return t.keys.length?r.db.allDocs({keys:t.keys,include_docs:!0}):ho.resolve({rows:[]})}function o(t,r){for(var e=[],n=new go,o=0,c=r.rows.length;o<c;o++){var u=r.rows[o],i=u.doc;if(i&&(e.push(i),n.add(i._id),i._deleted=!a.has(i._id),!i._deleted)){var _=a.get(i._id);"value"in _&&(i.value=_.value)}}var s=Tn(a);return s.forEach(function(t){if(!n.has(t)){var r={_id:t},o=a.get(t);"value"in o&&(r.value=o.value),e.push(r)}}),t.keys=wn(s.concat(t.keys)),e.push(t),e}var c="_local/doc_"+t,u={_id:c,keys:[]},i=e.get(t),a=i[0],_=i[1];return function(){return qn(_)?ho.resolve(u):r.db.get(c).catch(y(u))}().then(function(t){return n(t).then(function(r){return o(t,r)})})}function w(t,r,e){return t.db.get("_local/lastSeq").catch(y({_id:"_local/lastSeq",seq:0})).then(function(n){var o=Tn(r);return ho.all(o.map(function(e){return b(e,t,r)})).then(function(r){var o=j(r);return n.seq=e,o.push(n),t.db.bulkDocs({docs:o})})})}function T(t){var r="string"==typeof t?t:t.name,e=zc[r];return e||(e=zc[r]=new En),e}function k(t){return bn(T(t),function(){return S(t)})()}function S(t){function e(t,r){var e={id:f._id,key:zt(t)};void 0!==r&&null!==r&&(e.value=zt(r)),s.push(e)}function n(r,e){return function(){return w(t,r,e)}}function c(){return t.sourceDB.changes({conflicts:!0,include_docs:!0,style:"all_docs",since:d,limit:Gc}).then(i)}function i(t){var r=t.results;if(r.length){var e=a(r);if(p.add(n(e,d)),!(r.length<Gc))return c()}}function a(r){for(var e=new yo,n=0,c=r.length;n<c;n++){var i=r[n];if("_"!==i.doc._id[0]){s=[],f=i.doc,f._deleted||o(t.sourceDB,l,f),s.sort(u);var a=_(s);e.set(i.doc._id,[a,i.changes])}d=i.seq}return e}function _(t){for(var r,e=new yo,n=0,o=t.length;n<o;n++){var c=t[n],u=[c.key,c.id];n>0&&0===Vt(c.key,r)&&u.push(n),e.set(Gt(u),c),r=c.key}return e}var s,f,l=r(t.mapFun,e),d=t.seq||0,p=new En;return c().then(function(){return p.finish()}).then(function(){t.seq=d})}function x(t,r,n){0===n.group_level&&delete n.group_level;var o=n.group||n.group_level,u=e(t.reduceFun),a=[],_=isNaN(n.group_level)?Number.POSITIVE_INFINITY:n.group_level;r.forEach(function(t){var r=a[a.length-1],e=o?t.key:null;if(o&&Array.isArray(e)&&(e=e.slice(0,_)),r&&0===Vt(r.groupKey,e))return r.keys.push([t.key,t.id]),void r.values.push(t.value);a.push({keys:[[t.key,t.id]],values:[t.value],groupKey:e})}),r=[];for(var s=0,f=a.length;s<f;s++){var l=a[s],d=c(t.sourceDB,u,l.keys,l.values,!1);if(d.error&&d.error instanceof vn)throw d.error;r.push({value:d.error?null:d.output,key:l.groupKey})}return{rows:i(r,n.limit,n.skip)}}function E(t,r){return bn(T(t),function(){return A(t,r)})()}function A(t,r){function e(r){return r.include_docs=!0,t.db.allDocs(r).then(function(t){return o=t.total_rows,t.rows.map(function(t){if("value"in t.doc&&"object"==typeof t.doc.value&&null!==t.doc.value){var r=Object.keys(t.doc.value).sort(),e=["id","key","value"];if(!(r<e||r>e))return t.doc.value}var n=Qt(t.doc._id);return{key:n[0],id:n[1],value:"value"in t.doc?t.doc.value:null}})})}function n(e){var n;if(n=c?x(t,e,r):{total_rows:o,offset:u,rows:e},r.include_docs){var i=wn(e.map(a));return t.sourceDB.allDocs({keys:i,include_docs:!0,conflicts:r.conflicts,attachments:r.attachments,binary:r.binary}).then(function(t){var r=new yo;return t.rows.forEach(function(t){r.set(t.id,t.doc)}),e.forEach(function(t){var e=a(t),n=r.get(e);n&&(t.doc=n)}),n})}return n}var o,c=t.reduceFun&&!1!==r.reduce,u=r.skip||0;if(void 0===r.keys||r.keys.length||(r.limit=0,delete r.keys),void 0!==r.keys){var i=r.keys,_=i.map(function(t){return e({startkey:Gt([t]),endkey:Gt([t,{}])})});return ho.all(_).then(j).then(n)}var s,f,l={descending:r.descending};if("start_key"in r&&(s=r.start_key),"startkey"in r&&(s=r.startkey),"end_key"in r&&(f=r.end_key),"endkey"in r&&(f=r.endkey),void 0!==s&&(l.startkey=Gt(r.descending?[s,{}]:[s])),void 0!==f){var d=!1!==r.inclusive_end;r.descending&&(d=!d),l.endkey=Gt(d?[f,{}]:[f])}if(void 0!==r.key){var p=Gt([r.key]),h=Gt([r.key,{}]);l.descending?(l.endkey=p,l.startkey=h):(l.startkey=p,l.endkey=h)}return c||("number"==typeof r.limit&&(l.limit=r.limit),l.skip=u),e(l).then(n)}function O(t){return t.request({method:"POST",url:"_view_cleanup"})}function I(r){return r.get("_local/"+t).then(function(t){var e=new yo;Object.keys(t.views).forEach(function(t){var r=Cn(t),n="_design/"+r[0],o=r[1],c=e.get(n);c||(c=new go,e.set(n,c)),c.add(o)});var n={keys:Tn(e),include_docs:!0};return r.allDocs(n).then(function(n){var o={};n.rows.forEach(function(r){var n=r.key.substring(8);e.get(r.key).forEach(function(e){var c=n+"/"+e;t.views[c]||(c=e);var u=Object.keys(t.views[c]),i=r.doc&&r.doc.views&&r.doc.views[e];u.forEach(function(t){o[t]=o[t]||i})})});var c=Object.keys(o).filter(function(t){return!o[t]}),u=c.map(function(t){return bn(T(t),function(){return new r.constructor(t,r.__opts).destroy()})()});return ho.all(u).then(function(){return{ok:!0}})})},y({ok:!0}))}function C(r,e,o){if("function"==typeof r._query)return m(r,e,o);if(B(r))return v(r,e,o);if("string"!=typeof e)return h(o,e),Wc.add(function(){return In(r,"temp_view/temp_view",e.map,e.reduce,!0,t).then(function(t){return yn(k(t).then(function(){return E(t,o)}),function(){return t.db.destroy()})})}),Wc.finish();var c=e,u=Cn(c),i=u[0],a=u[1];return r.get("_design/"+i).then(function(e){var u=e.views&&e.views[a];if(!u)throw new hn("ddoc "+e._id+" has no view named "+a);return n(e,a),h(o,u),In(r,c,u.map,u.reduce,!1,t).then(function(t){return"ok"===o.stale||"update_after"===o.stale?("update_after"===o.stale&&so(function(){k(t)}),E(t,o)):k(t).then(function(){return E(t,o)})})})}function q(t,r,e){var n=this;"function"==typeof r&&(e=r,r={}),r=r?d(r):{},"function"==typeof t&&(t={map:t});var o=ho.resolve().then(function(){return C(n,t,r)});return mn(o,e),o}return{query:q,viewCleanup:gn(function(){var t=this;return"function"==typeof t._viewCleanup?g(t):B(t)?O(t):I(t)})}}("mrviews",Mn,jn,Dn),Qc={query:Rn,viewCleanup:Bn},Yc=1,Zc="pouchdb",tu=5,ru=0;Vn.prototype.writeCheckpoint=function(t,r){var e=this;return this.updateTarget(t,r).then(function(){return e.updateSource(t,r)})},Vn.prototype.updateTarget=function(t,r){return Hn(this.target,this.id,t,r,this.returnValue)},Vn.prototype.updateSource=function(t,r){var e=this;return this.readOnlySource?ho.resolve(!0):Hn(this.src,this.id,t,r,this.returnValue).catch(function(t){if(Kn(t))return e.readOnlySource=!0,!0;throw t})};var eu={undefined:function(t,r){return 0===Vt(t.last_seq,r.last_seq)?r.last_seq:0},1:function(t,r){return zn(r,t).last_seq}};Vn.prototype.getCheckpoint=function(){var t=this;return t.target.get(t.id).then(function(r){return t.readOnlySource?ho.resolve(r.last_seq):t.src.get(t.id).then(function(t){if(r.version!==t.version)return ru;var e;return e=r.version?r.version.toString():"undefined",e in eu?eu[e](r,t):ru},function(e){if(404===e.status&&r.last_seq)return t.src.put({_id:t.id,last_seq:ru}).then(function(){return ru},function(e){return Kn(e)?(t.readOnlySource=!0,r.last_seq):ru});throw e})}).catch(function(t){if(404!==t.status)throw t;return ru})};var nu=0;_o(to,ao.EventEmitter),to.prototype.cancel=function(){this.cancelled=!0,this.state="cancelled",this.emit("cancel")},to.prototype.ready=function(t,r){function e(){o.cancel()}function n(){t.removeListener("destroyed",e),r.removeListener("destroyed",e)}var o=this;o._readyCalled||(o._readyCalled=!0,t.once("destroyed",e),r.once("destroyed",e),o.once("complete",n))},_o(oo,ao.EventEmitter),oo.prototype.cancel=function(){this.canceled||(this.canceled=!0,this.push.cancel(),this.pull.cancel())},It.plugin(gc).plugin(Rc).plugin(Uc).plugin(Qc).plugin(co),t.exports=It}).call(r,e(28))},568:function(t,r,e){"use strict";function n(t,r,e){Error.call(this,e),this.status=t,this.name=r,this.message=e,this.error=!0}function o(t,r){function e(r){for(var e in t)"function"!=typeof t[e]&&(this[e]=t[e]);void 0!==r&&(this.reason=r)}return e.prototype=n.prototype,new e(r)}function c(t){if("object"!=typeof t){var r=t;t=p,t.data=r}return"error"in t&&"conflict"===t.error&&(t.name="conflict",t.status=409),"name"in t||(t.name=t.error||"unknown"),"status"in t||(t.status=500),"message"in t||(t.message=t.message||t.reason),t}Object.defineProperty(r,"__esModule",{value:!0}),function(t){return t&&"object"==typeof t&&"default"in t?t.default:t}(e(5))(n,Error),n.prototype.toString=function(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})};var u=new n(401,"unauthorized","Name or password is incorrect."),i=new n(400,"bad_request","Missing JSON list of 'docs'"),a=new n(404,"not_found","missing"),_=new n(409,"conflict","Document update conflict"),s=new n(400,"bad_request","_id field must contain a string"),f=new n(412,"missing_id","_id is required for puts"),l=new n(400,"bad_request","Only reserved document ids may start with underscore."),d=new n(412,"precondition_failed","Database not open"),p=new n(500,"unknown_error","Database encountered an unknown error"),h=new n(500,"badarg","Some query argument is invalid"),v=new n(400,"invalid_request","Request was invalid"),m=new n(400,"query_parse_error","Some query parameter is invalid"),g=new n(500,"doc_validation","Bad special document member"),y=new n(400,"bad_request","Something wrong with the request"),b=new n(400,"bad_request","Document must be a JSON object"),w=new n(404,"not_found","Database not found"),T=new n(500,"indexed_db_went_bad","unknown"),k=new n(500,"web_sql_went_bad","unknown"),S=new n(500,"levelDB_went_went_bad","unknown"),x=new n(403,"forbidden","Forbidden by design doc validate_doc_update function"),E=new n(400,"bad_request","Invalid rev format"),A=new n(412,"file_exists","The database could not be created, the file already exists."),O=new n(412,"missing_stub","A pre-existing attachment stub wasn't found"),I=new n(413,"invalid_url","Provided URL is invalid");r.UNAUTHORIZED=u,r.MISSING_BULK_DOCS=i,r.MISSING_DOC=a,r.REV_CONFLICT=_,r.INVALID_ID=s,r.MISSING_ID=f,r.RESERVED_ID=l,r.NOT_OPEN=d,r.UNKNOWN_ERROR=p,r.BAD_ARG=h,r.INVALID_REQUEST=v,r.QUERY_PARSE_ERROR=m,r.DOC_VALIDATION=g,r.BAD_REQUEST=y,r.NOT_AN_OBJECT=b,r.DB_MISSING=w,r.WSQ_ERROR=k,r.LDB_ERROR=S,r.FORBIDDEN=x,r.INVALID_REV=E,r.FILE_EXISTS=A,r.MISSING_STUB=O,r.IDB_ERROR=T,r.INVALID_URL=I,r.createError=o,r.generateErrorFromResponse=c},569:function(t,r,e){"use strict";(function(r){function n(t){return t&&"object"==typeof t&&"default"in t?t.default:t}function o(t){return t=st.clone(t),t.index||(t.index={}),["type","name","ddoc"].forEach(function(r){t.index[r]&&(t[r]=t.index[r],delete t.index[r])}),t.fields&&(t.index.fields=t.fields,delete t.fields),t.type||(t.type="json"),t}function c(t,r,e){r=o(r),t.request({method:"POST",url:"_index",body:r},e)}function u(t,r,e){t.request({method:"POST",url:"_find",body:r},e)}function i(t,r){t.request({method:"GET",url:"_index"},r)}function a(t,r,e){var n=r.ddoc,o=r.type||"json",c=r.name;if(!n)return e(new Error("you must provide an index's ddoc"));if(!c)return e(new Error("you must provide an index's name"));var u="_index/"+[n,o,c].map(encodeURIComponent).join("/");t.request({method:"DELETE",url:u},e)}function _(t){return function(){for(var r=arguments.length,e=new Array(r),n=-1;++n<r;)e[n]=arguments[n];return t.call(this,e)}}function s(t){return _(function(r){var e=r.pop(),n=t.apply(this,r);return f(n,e),n})}function f(t,e){return t.then(function(t){r.nextTick(function(){e(null,t)})},function(t){r.nextTick(function(){e(t)})}),t}function l(t){for(var r={},e=0,n=t.length;e<n;e++)r=st.assign(r,t[e]);return r}function d(t,r){for(var e={},n=0,o=r.length;n<o;n++){var c=lt.parseField(r[n]),u=lt.getFieldFromDoc(t,c);void 0!==u&&lt.setFieldInDoc(e,c,u)}return e}function p(t,r){for(var e=0,n=Math.min(t.length,r.length);e<n;e++)if(t[e]!==r[e])return!1;return!0}function h(t,r){return!(t.length>r.length)&&p(t,r)}function v(t,r){t=t.slice();for(var e=0,n=r.length;e<n;e++){var o=r[e];if(!t.length)break;var c=t.indexOf(o);if(-1===c)return!1;t.splice(c,1)}return!0}function m(t){for(var r={},e=0,n=t.length;e<n;e++)r[t[e]]=!0;return r}function g(t,r){for(var e=null,n=-1,o=0,c=t.length;o<c;o++){var u=t[o],i=r(u);i>n&&(n=i,e=u)}return e}function y(t,r){if(t.length!==r.length)return!1;for(var e=0,n=t.length;e<n;e++)if(t[e]!==r[e])return!1;return!0}function b(t){for(var r={},e=0;e<t.length;e++)r["$"+t[e]]=!0;return Object.keys(r).map(function(t){return t.substring(1)})}function w(t,r){return function(e){for(var n=[],o=0,c=t.length;o<c;o++){for(var u=lt.parseField(t[o]),i=e,a=0,_=u.length;a<_;a++){if(!(i=i[u[a]]))return}n.push(i)}r(n)}}function T(t,r){var e=lt.parseField(t);return function(t){for(var n=t,o=0,c=e.length;o<c;o++){if(!(n=n[e[o]]))return}r(n)}}function k(t,r){return function(e){r(e[t])}}function S(t,r){return function(e){for(var n=[],o=0,c=t.length;o<c;o++)n.push(e[t[o]]);r(n)}}function x(t){for(var r=0,e=t.length;r<e;r++){if(-1!==t[r].indexOf("."))return!1}return!0}function E(t,r){var e=x(t),n=1===t.length;return e?n?k(t[0],r):S(t,r):n?T(t[0],r):w(t,r)}function A(t,r){return E(Object.keys(t.fields),r)}function O(){throw new Error("reduce not supported")}function I(t,r){var e=t.views[r];if(!e.map||!e.map.fields)throw new Error("ddoc "+t._id+" with view "+r+" doesn't have map.fields defined. maybe it wasn't created by this plugin?")}function C(t){if(!Array.isArray(t))throw new Error("invalid sort json - should be an array");return t.map(function(t){if("string"==typeof t){var r={};return r[t]="asc",r}return t})}function q(t){return t.fields=t.fields.map(function(t){if("string"==typeof t){var r={};return r[t]="asc",r}return t}),t}function N(t,r){for(var e=[],n=0;n<r.def.fields.length;n++){var o=lt.getKey(r.def.fields[n]);e.push(t[o])}return e}function M(t,r,e){for(var n=e.def.fields,o=0,c=t.length;o<c;o++){var u=t[o],i=N(u.doc,e);if(1===n.length)i=i[0];else for(;i.length>r.length;)i.pop();if(Math.abs(pt.collate(i,r))>0)break}return o>0?t.slice(o):t}function j(t){var r=st.clone(t);return delete r.startkey,delete r.endkey,delete r.inclusive_start,delete r.inclusive_end,"endkey"in t&&(r.startkey=t.endkey),"startkey"in t&&(r.endkey=t.startkey),"inclusive_start"in t&&(r.inclusive_end=t.inclusive_start),"inclusive_end"in t&&(r.inclusive_start=t.inclusive_end),r}function D(t){var r=t.fields.filter(function(t){return"asc"===lt.getValue(t)});if(0!==r.length&&r.length!==t.fields.length)throw new Error("unsupported mixed sorting")}function R(t,r){if(r.defaultUsed&&t.sort){var e=t.sort.filter(function(t){return"_id"!==Object.keys(t)[0]}).map(function(t){return Object.keys(t)[0]});if(e.length>0)throw new Error('Cannot sort on field(s) "'+e.join(",")+'" when using the default index')}r.defaultUsed}function B(t){if("object"!=typeof t.selector)throw new Error("you must provide a selector when you find()")}function L(t,r){var e,n=Object.keys(t),o=r?r.map(lt.getKey):[];return e=n.length>=o.length?n:o,0===o.length?{fields:e}:(e=e.sort(function(t,r){var e=o.indexOf(t);-1===e&&(e=Number.MAX_VALUE);var n=o.indexOf(r);return-1===n&&(n=Number.MAX_VALUE),e<n?-1:e>n?1:0}),{fields:e,sortOrder:r.map(lt.getKey)})}function P(t,r){function e(t){return t._rev&&"query"!==t.language&&(_=!0),t.language="query",t.views=t.views||{},!(s=!!t.views[u])&&(t.views[u]={map:{fields:l(r.index.fields)},reduce:"_count",options:{def:n}},t)}r=o(r);var n=st.clone(r.index);r.index=q(r.index),D(r.index);var c=ht.stringMd5(JSON.stringify(r)),u=r.name||"idx-"+c,i=r.ddoc||"idx-"+c,a="_design/"+i,_=!1,s=!1;return t.constructor.emit("debug",["find","creating index",a]),st.upsert(t,a,e).then(function(){if(_)throw new Error('invalid language for ddoc with id "'+a+'" (should be "query")')}).then(function(){var r=i+"/"+u;return mt.query.call(t,r,{limit:0,reduce:!1}).then(function(){return{id:a,name:u,result:s?"exists":"created"}})})}function F(t){return t.allDocs({startkey:"_design/",endkey:"_design/",include_docs:!0}).then(function(t){var r={indexes:[{ddoc:null,name:"_all_docs",type:"special",def:{fields:[{_id:"asc"}]}}]};return r.indexes=vt(r.indexes,t.rows.filter(function(t){return"query"===t.doc.language}).map(function(t){return(void 0!==t.doc.views?Object.keys(t.doc.views):[]).map(function(r){var e=t.doc.views[r];return{ddoc:t.id,name:r,type:"json",def:q(e.options.def)}})})),r.indexes.sort(function(t,r){return lt.compare(t.name,r.name)}),r.total_rows=r.indexes.length,r})}function $(t,r){for(var e=t.def.fields.map(lt.getKey),n=0,o=e.length;n<o;n++){if(r===e[n])return!0}return!1}function U(t,r){var e=t[r];return"$eq"!==lt.getKey(e)}function J(t,r){var e=r.def.fields.map(lt.getKey);return t.slice().sort(function(t,r){var n=e.indexOf(t),o=e.indexOf(r);return-1===n&&(n=Number.MAX_VALUE),-1===o&&(o=Number.MAX_VALUE),lt.compare(n,o)})}function H(t,r,e){e=J(e,t);for(var n=!1,o=0,c=e.length;o<c;o++){var u=e[o];if(n||!$(t,u))return e.slice(o);o<c-1&&U(r,u)&&(n=!0)}return[]}function V(t){var r=[];return Object.keys(t).forEach(function(e){var n=t[e];Object.keys(n).forEach(function(t){"$ne"===t&&r.push(e)})}),r}function z(t,r,e,n){return J(b(vt(t,H(r,e,n),V(e))),r)}function W(t,r,e){if(r){var n=h(r,t),o=p(e,t);return n&&o}return v(e,t)}function G(t){return-1===bt.indexOf(t)}function K(t,r){var e=t[0],n=r[e];return void 0===n||!!Object.keys(n).some(function(t){return!G(t)})&&!(1===Object.keys(n).length&&"$ne"===lt.getKey(n))}function X(t,r,e,n){var o=t.def.fields.map(lt.getKey);return!!W(o,r,e)&&K(o,n)}function Q(t,r,e,n){return n.reduce(function(n,o){return X(o,e,r,t)&&n.push(o),n},[])}function Y(t,r,e,n){function o(t){for(var r=t.def.fields.map(lt.getKey),e=0,n=0,o=r.length;n<o;n++){var c=r[n];i[c]&&e++}return e}var c=Q(t,r,e,n);if(0===c.length){var u=n[0];return u.defaultUsed=!0,u}if(1===c.length)return c[0];var i=m(r);return g(c,o)}function Z(t,r){switch(t){case"$eq":return{key:r};case"$lte":return{endkey:r};case"$gte":return{startkey:r};case"$lt":return{endkey:r,inclusive_end:!1};case"$gt":return{startkey:r,inclusive_start:!1}}}function tt(t,r){var e,n=lt.getKey(r.def.fields[0]),o=t[n]||{},c=[],u=Object.keys(o);return u.forEach(function(t){if(G(t))return void c.push(n);var r=o[t],u=Z(t,r);e=e?l([e,u]):u}),{queryOpts:e,inMemoryFields:c}}function rt(t,r){switch(t){case"$eq":return{startkey:r,endkey:r};case"$lte":return{endkey:r};case"$gte":return{startkey:r};case"$lt":return{endkey:r,inclusive_end:!1};case"$gt":return{startkey:r,inclusive_start:!1}}}function et(t,r){function e(t){!1!==n&&i.push(gt),!1!==o&&a.push(yt),u=c.slice(t)}for(var n,o,c=r.def.fields.map(lt.getKey),u=[],i=[],a=[],_=0,s=c.length;_<s;_++){var f=c[_],d=t[f];if(!d||!Object.keys(d).length){e(_);break}if(_>0){if(Object.keys(d).some(G)){e(_);break}var p="$gt"in d||"$gte"in d||"$lt"in d||"$lte"in d,h=Object.keys(t[c[_-1]]),v=y(h,["$eq"]),m=y(h,Object.keys(d));if(p&&!v&&!m){e(_);break}}for(var g=Object.keys(d),b=null,w=0;w<g.length;w++){var T=g[w],k=d[T],S=rt(T,k);b=b?l([b,S]):S}i.push("startkey"in b?b.startkey:gt),a.push("endkey"in b?b.endkey:yt),"inclusive_start"in b&&(n=b.inclusive_start),"inclusive_end"in b&&(o=b.inclusive_end)}var x={startkey:i,endkey:a};return void 0!==n&&(x.inclusive_start=n),void 0!==o&&(x.inclusive_end=o),{queryOpts:x,inMemoryFields:u}}function nt(t){return{queryOpts:{startkey:null},inMemoryFields:[Object.keys(t)]}}function ot(t,r){return r.defaultUsed?nt(t,r):1===r.def.fields.length?tt(t,r):et(t,r)}function ct(t,r){var e=t.selector,n=t.sort,o=L(e,n),c=o.fields,u=o.sortOrder,i=Y(e,c,u,r),a=ot(e,i);return{queryOpts:a.queryOpts,index:i,inMemoryFields:z(a.inMemoryFields,i,e,c)}}function ut(t){return t.ddoc.substring(8)+"/"+t.name}function it(t,r){var e=st.clone(r);return e.descending?("endkey"in e&&"string"!=typeof e.endkey&&(e.endkey=""),"startkey"in e&&"string"!=typeof e.startkey&&(e.limit=0)):("startkey"in e&&"string"!=typeof e.startkey&&(e.startkey=""),"endkey"in e&&"string"!=typeof e.endkey&&(e.limit=0)),"key"in e&&"string"!=typeof e.key&&(e.limit=0),t.allDocs(e)}function at(t,r){return r.selector&&(r.selector=lt.massageSelector(r.selector)),r.sort&&(r.sort=C(r.sort)),B(r),F(t).then(function(e){t.constructor.emit("debug",["find","planning query",r]);var n=ct(r,e.indexes);t.constructor.emit("debug",["find","query plan",n]);var o=n.index;R(r,o);var c=st.assign({include_docs:!0,reduce:!1},n.queryOpts);return"startkey"in c&&"endkey"in c&&pt.collate(c.startkey,c.endkey)>0?{docs:[]}:(r.sort&&"string"!=typeof r.sort[0]&&"desc"===lt.getValue(r.sort[0])&&(c.descending=!0,c=j(c)),n.inMemoryFields.length||("limit"in r&&(c.limit=r.limit),"skip"in r&&(c.skip=r.skip)),ft.resolve().then(function(){if("_all_docs"===o.name)return it(t,c);var r=ut(o);return mt.query.call(t,r,c)}).then(function(t){!1===c.inclusive_start&&(t.rows=M(t.rows,c.startkey,o)),n.inMemoryFields.length&&(t.rows=lt.filterInMemoryFields(t.rows,r,n.inMemoryFields));var e={docs:t.rows.map(function(t){var e=t.doc;return r.fields?d(e,r.fields):e})};return o.defaultUsed&&(e.warning="no matching index found, create an index to optimize query time"),e}))})}function _t(t,r){function e(t){return 1===Object.keys(t.views).length&&t.views[o]?{_id:n,_deleted:!0}:(delete t.views[o],t)}if(!r.ddoc)throw new Error("you must supply an index.ddoc when deleting");if(!r.name)throw new Error("you must supply an index.name when deleting");var n=r.ddoc,o=r.name;return st.upsert(t,n,e).then(function(){return mt.viewCleanup.apply(t)}).then(function(){return{ok:!0}})}var st=e(114),ft=n(e(113)),lt=e(571),dt=n(e(566)),pt=e(164),ht=e(243),vt=_(function(t){for(var r=[],e=0,n=t.length;e<n;e++){var o=t[e];Array.isArray(o)?r=r.concat(vt.apply(null,o)):r.push(o)}return r}),mt=dt("indexes",A,O,I),gt=null,yt={"":{}},bt=["$eq","$gt","$gte","$lt","$lte"],wt=s(P),Tt=s(at),kt=s(F),St=s(_t),xt={};xt.createIndex=st.toPromise(function(t,r){if("object"!=typeof t)return r(new Error("you must provide an index to create"));(st.isRemote(this)?c:wt)(this,t,r)}),xt.find=st.toPromise(function(t,r){if(void 0===r&&(r=t,t=void 0),"object"!=typeof t)return r(new Error("you must provide search parameters to find()"));(st.isRemote(this)?u:Tt)(this,t,r)}),xt.getIndexes=st.toPromise(function(t){(st.isRemote(this)?i:kt)(this,t)}),xt.deleteIndex=st.toPromise(function(t,r){if("object"!=typeof t)return r(new Error("you must provide an index to delete"));(st.isRemote(this)?a:St)(this,t,r)}),t.exports=xt}).call(r,e(50))},570:function(t,r,e){"use strict";function n(t){return t&&"object"==typeof t&&"default"in t?t.default:t}function o(t){this.status=400,this.name="query_parse_error",this.message=t,this.error=!0;try{Error.captureStackTrace(this,o)}catch(t){}}function c(t){this.status=404,this.name="not_found",this.message=t,this.error=!0;try{Error.captureStackTrace(this,c)}catch(t){}}function u(t){this.status=500,this.name="invalid_value",this.message=t,this.error=!0;try{Error.captureStackTrace(this,u)}catch(t){}}function i(t,r){return r&&t.then(function(t){h.nextTick(function(){r(null,t)})},function(t){h.nextTick(function(){r(t)})}),t}function a(t){return p(function(r){var e=r.pop(),n=t.apply(this,r);return"function"==typeof e&&i(n,e),n})}function _(t,r){return t.then(function(t){return r().then(function(){return t})},function(t){return r().then(function(){throw t})})}function s(t,r){return function(){var e=arguments,n=this;return t.add(function(){return r.apply(n,e)})}}function f(t){var r=new d.Set(t),e=new Array(r.size),n=-1;return r.forEach(function(t){e[++n]=t}),e}function l(t){var r=new Array(t.size),e=-1;return t.forEach(function(t,n){r[++e]=n}),r}Object.defineProperty(r,"__esModule",{value:!0});var d=e(165),p=n(e(130)),h=e(114),v=n(e(5));v(o,Error),v(c,Error),v(u,Error),r.uniq=f,r.sequentialize=s,r.fin=_,r.callbackify=a,r.promisedCallback=i,r.mapToKeysArray=l,r.QueryParseError=o,r.NotFoundError=c,r.BuiltInError=u},571:function(t,r,e){"use strict";function n(t,r){for(var e=t,n=0,o=r.length;n<o;n++){if(!(e=e[r[n]]))break}return e}function o(t,r,e){for(var n=0,o=r.length;n<o-1;n++){t=t[r[n]]={}}t[r[o-1]]=e}function c(t,r){return t<r?-1:t>r?1:0}function u(t){for(var r=[],e="",n=0,o=t.length;n<o;n++){var c=t[n];"."===c?n>0&&"\\"===t[n-1]?e=e.substring(0,e.length-1)+".":(r.push(e),e=""):e+=c}return r.push(e),r}function i(t){return j.indexOf(t)>-1}function a(t){return Object.keys(t)[0]}function _(t){return t[a(t)]}function s(t){var r={};return t.forEach(function(t){Object.keys(t).forEach(function(e){var n=t[e];if("object"!=typeof n&&(n={$eq:n}),i(e))n instanceof Array?r[e]=n.map(function(t){return s([t])}):r[e]=s([n]);else{var o=r[e]=r[e]||{};Object.keys(n).forEach(function(t){var r=n[t];return"$gt"===t||"$gte"===t?f(t,r,o):"$lt"===t||"$lte"===t?l(t,r,o):"$ne"===t?d(r,o):"$eq"===t?p(r,o):void(o[t]=r)})}})}),r}function f(t,r,e){void 0===e.$eq&&(void 0!==e.$gte?"$gte"===t?r>e.$gte&&(e.$gte=r):r>=e.$gte&&(delete e.$gte,e.$gt=r):void 0!==e.$gt?"$gte"===t?r>e.$gt&&(delete e.$gt,e.$gte=r):r>e.$gt&&(e.$gt=r):e[t]=r)}function l(t,r,e){void 0===e.$eq&&(void 0!==e.$lte?"$lte"===t?r<e.$lte&&(e.$lte=r):r<=e.$lte&&(delete e.$lte,e.$lt=r):void 0!==e.$lt?"$lte"===t?r<e.$lt&&(delete e.$lt,e.$lte=r):r<e.$lt&&(e.$lt=r):e[t]=r)}function d(t,r){"$ne"in r?r.$ne.push(t):r.$ne=[t]}function p(t,r){delete r.$gt,delete r.$gte,delete r.$lt,delete r.$lte,delete r.$ne,r.$eq=t}function h(t){var r=N.clone(t),e=!1;"$and"in r&&(r=s(r.$and),e=!0),["$or","$nor"].forEach(function(t){t in r&&r[t].forEach(function(t){for(var r=Object.keys(t),e=0;e<r.length;e++){var n=r[e],o=t[n];"object"==typeof o&&null!==o||(t[n]={$eq:o})}})}),"$not"in r&&(r.$not=s([r.$not]));for(var n=Object.keys(r),o=0;o<n.length;o++){var c=n[o],u=r[c];"object"!=typeof u||null===u?u={$eq:u}:"$ne"in u&&!e&&(u.$ne=[u.$ne]),r[c]=u}return r}function v(t){function r(r){return t.map(function(t){var e=a(t),o=u(e);return n(r,o)})}return function(t,e){var n=r(t.doc),o=r(e.doc),u=M.collate(n,o);return 0!==u?u:c(t.doc._id,e.doc._id)}}function m(t,r,e){if(t=t.filter(function(t){return g(t.doc,r.selector,e)}),r.sort){var n=v(r.sort);t=t.sort(n),"string"!=typeof r.sort[0]&&"desc"===_(r.sort[0])&&(t=t.reverse())}if("limit"in r||"skip"in r){var o=r.skip||0,c=("limit"in r?r.limit:t.length)+o;t=t.slice(o,c)}return t}function g(t,r,e){return e.every(function(e){if(y(t))return!1;var o=r[e],c=u(e),a=n(t,c);return i(e)?w(e,o,t):b(o,t,c,a)})}function y(t){return/^_design\//.test(t._id)}function b(t,r,e,n){return!t||Object.keys(t).every(function(o){var c=t[o];return T(o,r,c,e,n)})}function w(t,r,e){return"$or"===t?r.some(function(t){return g(e,t,Object.keys(t))}):"$not"===t?!g(e,r,Object.keys(r)):!r.find(function(t){return g(e,t,Object.keys(t))})}function T(t,r,e,n,o){if(!D[t])throw new Error('unknown operator "'+t+'" - should be one of $eq, $lte, $lt, $gt, $gte, $exists, $ne, $in, $nin, $size, $mod, $regex, $elemMatch, $type or $all');return D[t](r,e,n,o)}function k(t){return void 0!==t&&null!==t}function S(t){return void 0!==t}function x(t,r){var e=r[0],n=r[1];if(0===e)throw new Error("Bad divisor, cannot divide by zero");if(parseInt(e,10)!==e)throw new Error("Divisor is not an integer");if(parseInt(n,10)!==n)throw new Error("Modulus is not an integer");return parseInt(t,10)===t&&t%e===n}function E(t,r){return r.some(function(r){return t instanceof Array?t.indexOf(r)>-1:t===r})}function A(t,r){return r.every(function(r){return t.indexOf(r)>-1})}function O(t,r){return t.length===r}function I(t,r){return new RegExp(r).test(t)}function C(t,r){switch(r){case"null":return null===t;case"boolean":return"boolean"==typeof t;case"number":return"number"==typeof t;case"string":return"string"==typeof t;case"array":return t instanceof Array;case"object":return"[object Object]"==={}.toString.call(t)}throw new Error(r+" not supported as a type.Please use one of object, string, array, number, boolean or null.")}function q(t,r){if("object"!=typeof r)throw"Selector error: expected a JSON object";r=h(r);var e={doc:t},n=m([e],{selector:r},Object.keys(r));return n&&1===n.length}Object.defineProperty(r,"__esModule",{value:!0});var N=e(114),M=e(164),j=["$or","$nor","$not"],D={$elemMatch:function(t,r,e,n){return!!Array.isArray(n)&&(0!==n.length&&("object"==typeof n[0]?n.some(function(t){return g(t,r,Object.keys(r))}):n.some(function(n){return b(r,t,e,n)})))},$eq:function(t,r,e,n){return S(n)&&0===M.collate(n,r)},$gte:function(t,r,e,n){return S(n)&&M.collate(n,r)>=0},$gt:function(t,r,e,n){return S(n)&&M.collate(n,r)>0},$lte:function(t,r,e,n){return S(n)&&M.collate(n,r)<=0},$lt:function(t,r,e,n){return S(n)&&M.collate(n,r)<0},$exists:function(t,r,e,n){return r?S(n):!S(n)},$mod:function(t,r,e,n){return k(n)&&x(n,r)},$ne:function(t,r,e,n){return r.every(function(t){return 0!==M.collate(n,t)})},$in:function(t,r,e,n){return k(n)&&E(n,r)},$nin:function(t,r,e,n){return k(n)&&!E(n,r)},$size:function(t,r,e,n){return k(n)&&O(n,r)},$all:function(t,r,e,n){return Array.isArray(n)&&A(n,r)},$regex:function(t,r,e,n){return k(n)&&I(n,r)},$type:function(t,r,e,n){return C(n,r)}};r.massageSelector=h,r.matchesSelector=q,r.filterInMemoryFields=m,r.createFieldSorter=v,r.rowFilter=g,r.isCombinationalField=i,r.getKey=a,r.getValue=_,r.getFieldFromDoc=n,r.setFieldInDoc=o,r.compare=c,r.parseField=u},572:function(t,r,e){"use strict";function n(t,r,e){return"string"!=typeof r?c.reject(new Error("doc id is required")):t.get(r).catch(function(t){if(404!==t.status)throw t;return{}}).then(function(n){var c=n._rev,u=e(n);return u?(u._id=r,u._rev=c,o(t,u,e)):{updated:!1,rev:c,id:r}})}function o(t,r,e){return t.put(r).then(function(t){return{updated:!0,rev:t.rev,id:r._id}},function(o){if(409!==o.status)throw o;return n(t,r._id,e)})}var c=e(113);r.upsert=function(t,r,e){var o=this,c=n(o,t,r);if("function"!=typeof e)return c;c.then(function(t){e(null,t)},e)},r.putIfNotExists=function(t,r,e){var o=this;"string"!=typeof t&&(e=r,r=t,t=r._id);var c=function(t){return!t._rev&&r},u=n(o,t,c);if("function"!=typeof e)return u;u.then(function(t){e(null,t)},e)},"undefined"!=typeof window&&window.PouchDB&&window.PouchDB.plugin(r)},800:function(t,r,e){"use strict";function n(t,r,e){var n=e[e.length-1];t===n.element&&(e.pop(),n=e[e.length-1]);var o=n.element,c=n.index;if(Array.isArray(o))o.push(t);else if(c===r.length-2){var u=r.pop();o[u]=t}else r.push(t)}r.stringify=function(t){var r=[];r.push({obj:t});for(var e,n,o,c,u,i,a,_,s,f,l,d="";e=r.pop();)if(n=e.obj,o=e.prefix||"",c=e.val||"",d+=o,c)d+=c;else if("object"!=typeof n)d+=void 0===n?null:JSON.stringify(n);else if(null===n)d+="null";else if(Array.isArray(n)){for(r.push({val:"]"}),u=n.length-1;u>=0;u--)i=0===u?"":",",r.push({obj:n[u],prefix:i});r.push({val:"["})}else{a=[];for(_ in n)n.hasOwnProperty(_)&&a.push(_);for(r.push({val:"}"}),u=a.length-1;u>=0;u--)s=a[u],f=n[s],l=u>0?",":"",l+=JSON.stringify(s)+":",r.push({obj:f,prefix:l});r.push({val:"{"})}return d},r.parse=function(t){for(var r,e,o,c,u,i,a,_,s,f=[],l=[],d=0;;)if("}"!==(r=t[d++])&&"]"!==r&&void 0!==r)switch(r){case" ":case"\t":case"\n":case":":case",":break;case"n":d+=3,n(null,f,l);break;case"t":d+=3,n(!0,f,l);break;case"f":d+=4,n(!1,f,l);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":for(e="",d--;;){if(o=t[d++],!/[\d\.\-e\+]/.test(o)){d--;break}e+=o}n(parseFloat(e),f,l);break;case'"':for(c="",u=void 0,i=0;;){if('"'===(a=t[d++])&&("\\"!==u||i%2!=1))break;c+=a,u=a,"\\"===u?i++:i=0}n(JSON.parse('"'+c+'"'),f,l);break;case"[":_={element:[],index:f.length},f.push(_.element),l.push(_);break;case"{":s={element:{},index:f.length},f.push(s.element),l.push(s);break;default:throw new Error("unexpectedly reached end of input: "+r)}else{if(1===f.length)return f.pop();n(f.pop(),f,l)}}},806:function(t,r,e){t.exports=e(311)}},[806]);