Files
standardnotes-app-web/dist/javascripts/app.js
2020-03-14 12:05:38 -05:00

23 lines
1.0 MiB
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=211)}([function(e,t,n){e.exports=n(90)},function(e,t){function n(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}e.exports=function(e){return function(){var t=this,r=arguments;return new Promise((function(i,a){var o=e.apply(t,r);function s(e){n(o,i,a,s,c,"next",e)}function c(e){n(o,i,a,s,c,"throw",e)}s(void 0)}))}}},function(e,t,n){window,e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/dist/",n(n.s=211)}([function(e,t,n){e.exports=n(94)},function(e,t,n){"use strict";(function(e){n.d(t,"h",(function(){return d})),n.d(t,"o",(function(){return v})),n.d(t,"g",(function(){return y})),n.d(t,"m",(function(){return m})),n.d(t,"k",(function(){return g})),n.d(t,"l",(function(){return b})),n.d(t,"n",(function(){return w})),n.d(t,"i",(function(){return k})),n.d(t,"z",(function(){return x})),n.d(t,"q",(function(){return S})),n.d(t,"f",(function(){return _})),n.d(t,"x",(function(){return $})),n.d(t,"u",(function(){return P})),n.d(t,"b",(function(){return O})),n.d(t,"v",(function(){return C})),n.d(t,"c",(function(){return E})),n.d(t,"s",(function(){return A})),n.d(t,"r",(function(){return I})),n.d(t,"p",(function(){return j})),n.d(t,"a",(function(){return D})),n.d(t,"e",(function(){return M})),n.d(t,"t",(function(){return T})),n.d(t,"d",(function(){return R})),n.d(t,"j",(function(){return L})),n.d(t,"y",(function(){return N})),n.d(t,"w",(function(){return F}));var r=n(0),i=n.n(r),a=n(4),o=n.n(a),s=n(90),c=n.n(s),u=n(91),l=n.n(u);function f(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function p(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){f(a,r,i,o,s,"next",e)}function s(e){f(a,r,i,o,s,"throw",e)}o(void 0)}))}}function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(){return"undefined"!=typeof window?window:void 0!==e?e:null}function v(){return null!==d()}function y(e,t,n){return e.find((function(e){return e[t]===n}))}function m(e){return null!==e&&("function"==typeof e||"object"===h(e))}function g(e){return null!==e&&"function"==typeof e}function b(e){return null==e}function w(e){return"string"==typeof e||e instanceof String}function k(e,t){return e>t?e:t}function x(e,t,n){return l()(e.concat(t),(function(e,t){var r=!0,i=!1,a=void 0;try{for(var o,s=n[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var c=o.value;if(e[c]!==t[c])return!1}}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return!0}))}function S(e){return e[e.length-1]}function _(e,t){var n=!0,r=!1,i=void 0;try{for(var a,o=t[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;e.push(s)}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}}function $(e,t){var n=!0,r=!1,i=void 0;try{for(var a,o=t[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;e.splice(e.indexOf(s),1)}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}}function P(e,t){e.splice(e.indexOf(t),1)}function O(e,t){return e.filter((function(e){return!t.includes(e)})).concat(t.filter((function(t){return!e.includes(t)})))}function C(e,t){e.splice(t,1)}function E(e,t){var n=e.slice();return C(n,t),n}function A(e,t){if(e){var n=!0,r=!1,i=void 0;try{for(var a,o=t[Symbol.iterator]();!(n=(a=o.next()).done);n=!0)delete e[a.value]}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}}}function I(e,t){var n=Object.assign({},e),r=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(r=(o=s.next()).done);r=!0)delete n[o.value]}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}function j(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.map((function(e,t){return 0===t?e.trim().replace(/[\/]*$/g,""):e.trim().replace(/(^[\/]*|[\/]*$)/g,"")})).filter((function(e){return e.length})).join("/")}function D(e){return JSON.parse(JSON.stringify(e))}function M(e,t){if(!e||!t)throw"Attempting to deepMerge with null values";return c()(e,t,(function(e,t){if(o()(e))return t})),e}function T(e,t){var n={},r=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var c=o.value;n[c]=e[c]}}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return D(n)}function R(e){var t=Object.getOwnPropertyNames(e),n=!0,r=!1,i=void 0;try{for(var a,o=t[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value,c=e[s];e[s]=c&&"object"===h(c)?R(c):c}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}return Object.freeze(e)}function L(e,t){var n=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),t);return n&&!b(n.get)}function N(e,t){var n=t/4;return e.substring(0,n)}function F(e){return U.apply(this,arguments)}function U(){return(U=p(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.warn("Sleeping for",t),e.abrupt("return",new Promise((function(e,n){setTimeout((function(){e()}),t)})));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}}).call(this,n(54))},function(e,t,n){var r=n(18),i=n(186);e.exports=function(e,t){var n=[];if(!e||!e.length)return n;var a=-1,o=[],s=e.length;for(t=r(t,3);++a<s;){var c=e[a];t(c,a,e)&&(n.push(c),o.push(a))}return i(e,o),n}},function(e,t,n){var r=n(71)(n(183));e.exports=r},function(e,t){var n=Array.isArray;e.exports=n},function(e,t,n){var r=n(178)(n(179));e.exports=r},function(e,t,n){(function(e){var n,r,i,a;function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}window,a=function(){return function(e){function t(t){for(var n,i,a=t[0],o=t[1],s=0,c=[];s<a.length;s++)i=a[s],Object.prototype.hasOwnProperty.call(r,i)&&r[i]&&c.push(r[i][0]),r[i]=0;for(n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n]);for(u&&u(t);c.length;)c.shift()()}var n={},r={1:0,2:0};function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[],n=r[e];if(0!==n)if(n)t.push(n[2]);else{var a=new Promise((function(t,i){n=r[e]=[t,i]}));t.push(n[2]=a);var o,s=document.createElement("script");s.charset="utf-8",s.timeout=120,i.nc&&s.setAttribute("nonce",i.nc),s.src=function(e){return i.p+""+({0:"libsodium",3:"vendors~libsodium"}[e]||e)+".bundle.js"}(e);var c=new Error;o=function(t){s.onerror=s.onload=null,clearTimeout(u);var n=r[e];if(0!==n){if(n){var i=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+i+": "+a+")",c.name="ChunkLoadError",c.type=i,c.request=a,n[1](c)}r[e]=void 0}};var u=setTimeout((function(){o({type:"timeout",target:s})}),12e4);s.onerror=s.onload=o,document.head.appendChild(s)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==o(e)&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/dist/",i.oe=function(e){throw console.error(e),e};var a=window.webpackJsonpSNCrypto=window.webpackJsonpSNCrypto||[],s=a.push.bind(a);a.push=t,a=a.slice();for(var c=0;c<a.length;c++)t(a[c]);var u=s;return i(i.s=11)}([function(e,t,n){e.exports=n(6)},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return c})),n.d(t,"j",(function(){return u})),n.d(t,"o",(function(){return l})),n.d(t,"k",(function(){return f})),n.d(t,"i",(function(){return p})),n.d(t,"n",(function(){return h})),n.d(t,"p",(function(){return d})),n.d(t,"d",(function(){return y})),n.d(t,"c",(function(){return g})),n.d(t,"l",(function(){return w})),n.d(t,"g",(function(){return x})),n.d(t,"b",(function(){return _})),n.d(t,"m",(function(){return P})),n.d(t,"h",(function(){return C})),n.d(t,"f",(function(){return A})),n.d(t,"e",(function(){return I})),n.d(t,"q",(function(){return j}));var r=n(0),i=n.n(r);function a(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function o(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){a(o,r,i,s,c,"next",e)}function c(e){a(o,r,i,s,c,"throw",e)}s(void 0)}))}}var s=n(7),c=n(2).Buffer;function u(){return"undefined"!=typeof window?window:void 0!==e?e:null}function l(){return!("undefined"!=typeof document&&document.documentMode||/Edge/.test(navigator.userAgent))&&u().crypto&&!!u().crypto.subtle}function f(){return u().crypto?u().crypto.subtle:null}function p(){var e=u(),t=e.crypto||e.msCrypto;if(t){var n=new Uint32Array(4);t.getRandomValues(n);var r=-1;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){r++;var t=n[r>>3]>>r%8*4&15;return("x"===e?t:3&t|8).toString(16)}))}var i=(new Date).getTime();return e.performance&&"function"==typeof e.performance.now&&(i+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=(i+16*Math.random())%16|0;return i=Math.floor(i/16),("x"===e?t:3&t|8).toString(16)}))}function h(e){return"string"==typeof e||e instanceof String}function d(e){return v.apply(this,arguments)}function v(){return(v=o(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){var r=new Blob([t]),i=new FileReader;i.onload=function(t){e(t.target.result)},i.readAsArrayBuffer(r)})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function y(e){return m.apply(this,arguments)}function m(){return(m=o(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){var r=new Blob([t]),i=new FileReader;i.onload=function(t){e(t.target.result)},i.readAsText(r)})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function g(e){return b.apply(this,arguments)}function b(){return(b=o(i.a.mark((function e(t){var n,r,a,o;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(n=new Uint8Array(t),r="",o=0;o<n.byteLength;o++)(a=n[o].toString(16)).length<2&&(a="0"+a),r+=a;return e.abrupt("return",r);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function w(e){return k.apply(this,arguments)}function k(){return(k=o(i.a.mark((function e(t){var n,r;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(n=[],r=0;r<t.length;r+=2)n.push(parseInt(t.substr(r,2),16));return e.abrupt("return",new Uint8Array(n));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function x(e){return S.apply(this,arguments)}function S(){return(S=o(i.a.mark((function e(t){var n,r,a,o;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,I(t);case 2:for(n=e.sent,r=n.length,a=new Uint8Array(r),o=0;o<r;o++)a[o]=n.charCodeAt(o);return e.abrupt("return",a.buffer);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _(e){return $.apply(this,arguments)}function $(){return($=o(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){var r=new Blob([t],{type:"application/octet-binary"}),i=new FileReader;i.onload=function(t){var n=t.target.result;e(n.substr(n.indexOf(",")+1))},i.readAsDataURL(r)})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function P(e){return O.apply(this,arguments)}function O(){return(O=o(i.a.mark((function e(t){var n;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=c.from(t,"hex"),e.abrupt("return",n.toString("base64"));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function C(e){return E.apply(this,arguments)}function E(){return(E=o(i.a.mark((function e(t){var n;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=c.from(t,"base64"),e.abrupt("return",n.toString("hex"));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function A(e){return u().btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(function(e,t){return String.fromCharCode("0x"+t)})))}function I(e){return u().atob(e)}function j(e){return D.apply(this,arguments)}function D(){return(D=o(i.a.mark((function e(t){var n,r=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.length>1&&void 0!==r[1]?r[1]:"binary",!c.isBuffer(t)){e.next=5;break}return e.abrupt("return",t);case 5:if(null!==t){e.next=9;break}return e.abrupt("return",null);case 9:if("string"!=typeof t){e.next=13;break}return e.abrupt("return",c.from(t,n));case 13:if(!(t instanceof Uint8Array)){e.next=17;break}return e.abrupt("return",s(t));case 17:if(!(t instanceof Promise)){e.next=21;break}return e.abrupt("return",t);case 21:throw new TypeError("Invalid type; string or buffer expected");case 22:case"end":return e.stop()}}),e)})))).apply(this,arguments)}}).call(this,n(3))},function(e,t,n){"use strict";(function(e){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/
var r=n(8),i=n(9),a=n(5);function o(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(o()<t)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=c.prototype:(null===e&&(e=new c(t)),e.length=t),e}function c(e,t,n){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(this,e)}return u(this,e,t,n)}function u(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),c.TYPED_ARRAY_SUPPORT?(e=t).__proto__=c.prototype:e=p(e,t),e}(e,t,n,r):"string"==typeof t?function(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!c.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|d(t,n),i=(e=s(e,r)).write(t,n);return i!==r&&(e=e.slice(0,i)),e}(e,t,n):function(e,t){if(c.isBuffer(t)){var n=0|h(t.length);return 0===(e=s(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?s(e,0):p(e,t);if("Buffer"===t.type&&a(t.data))return p(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function f(e,t){if(l(t),e=s(e,t<0?0:0|h(t)),!c.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function p(e,t){var n=t.length<0?0:0|h(t.length);e=s(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function h(e){if(e>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function d(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return K(e).length;default:if(r)return U(e).length;t=(""+t).toLowerCase(),r=!0}}function v(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return E(this,t,n);case"utf8":case"utf-8":return P(this,t,n);case"ascii":return O(this,t,n);case"latin1":case"binary":return C(this,t,n);case"base64":return $(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function m(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:g(e,t,n,r,i);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):g(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,n,r,i){var a,o=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,c/=2,n/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var l=-1;for(a=n;a<s;a++)if(u(e,a)===u(t,-1===l?0:a-l)){if(-1===l&&(l=a),a-l+1===c)return l*o}else-1!==l&&(a-=a-l),l=-1}else for(n+c>s&&(n=s-c),a=n;a>=0;a--){for(var f=!0,p=0;p<c;p++)if(u(e,a+p)!==u(t,p)){f=!1;break}if(f)return a}return-1}function b(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");r>a/2&&(r=a/2);for(var o=0;o<r;++o){var s=parseInt(t.substr(2*o,2),16);if(isNaN(s))return o;e[n+o]=s}return o}function w(e,t,n,r){return V(U(t,e.length-n),e,n,r)}function k(e,t,n,r){return V(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function x(e,t,n,r){return k(e,t,n,r)}function S(e,t,n,r){return V(K(t),e,n,r)}function _(e,t,n,r){return V(function(e,t){for(var n,r,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)r=(n=e.charCodeAt(o))>>8,i=n%256,a.push(i),a.push(r);return a}(t,e.length-n),e,n,r)}function $(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function P(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var a,o,s,c,u=e[i],l=null,f=u>239?4:u>223?3:u>191?2:1;if(i+f<=n)switch(f){case 1:u<128&&(l=u);break;case 2:128==(192&(a=e[i+1]))&&(c=(31&u)<<6|63&a)>127&&(l=c);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(c=(15&u)<<12|(63&a)<<6|63&o)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(c=(15&u)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&c<1114112&&(l=c)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=4096));return n}(r)}function O(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function C(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function E(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",a=t;a<n;++a)i+=F(e[a]);return i}function A(e,t,n){for(var r=e.slice(t,n),i="",a=0;a<r.length;a+=2)i+=String.fromCharCode(r[a]+256*r[a+1]);return i}function I(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function j(e,t,n,r,i,a){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function D(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-n,2);i<a;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function M(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-n,4);i<a;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function T(e,t,n,r,i,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function R(e,t,n,r,a){return a||T(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function L(e,t,n,r,a){return a||T(e,0,n,8),i.write(e,t,n,r,52,8),n+8}t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=o(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,n){return u(null,e,t,n)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,n){return function(e,t,n,r){return l(t),t<=0?s(e,t):void 0!==n?"string"==typeof r?s(e,t).fill(n,r):s(e,t).fill(n):s(e,t)}(null,e,t,n)},c.allocUnsafe=function(e){return f(null,e)},c.allocUnsafeSlow=function(e){return f(null,e)},c.isBuffer=function(e){return!(null==e||!e._isBuffer)},c.compare=function(e,t){if(!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!a(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=c.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!c.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},c.byteLength=d,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)y(this,t,t+1);return this},c.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},c.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},c.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?P(this,0,e):v.apply(this,arguments)},c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},c.prototype.compare=function(e,t,n,r,i){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(r>>>=0),o=(n>>>=0)-(t>>>=0),s=Math.min(a,o),u=this.slice(r,i),l=e.slice(t,n),f=0;f<s;++f)if(u[f]!==l[f]){a=u[f],o=l[f];break}return a<o?-1:o<a?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return m(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return m(this,e,t,n,!1)},c.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return k(this,e,t,n);case"latin1":case"binary":return x(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},c.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),c.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=c.prototype;else{var i=t-e;n=new c(i,void 0);for(var a=0;a<i;++a)n[a]=this[a+e]}return n},c.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r},c.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUInt8=function(e,t){return t||I(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||I(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||I(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||I(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},c.prototype.readInt8=function(e,t){return t||I(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||I(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||I(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||I(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||I(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||I(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||I(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||j(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},c.prototype.writeUIntBE=function(e,t,n,r){e=+e,t|=0,n|=0,r||j(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):M(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);j(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<n&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);j(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):M(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return R(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return R(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return L(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return L(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,a=r-n;if(this===e&&n<t&&t<r)for(i=a-1;i>=0;--i)e[i+t]=this[i+n];else if(a<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+a),t);return a},c.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var a;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a<n;++a)this[a]=e;else{var o=c.isBuffer(e)?e:U(new c(e,r).toString()),s=o.length;for(a=0;a<n-t;++a)this[a+t]=o[a%s]}return this};var N=/[^+\/0-9A-Za-z-_]/g;function F(e){return e<16?"0"+e.toString(16):e.toString(16)}function U(e,t){var n;t=t||1/0;for(var r=e.length,i=null,a=[],o=0;o<r;++o){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function K(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(N,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function V(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(3))},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"===("undefined"==typeof window?"undefined":n(window))&&(r=window)}e.exports=r},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){(function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}var n=function(e){"use strict";var n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function c(e,t,n,r){var i=t&&t.prototype instanceof f?t:f,a=Object.create(i.prototype),o=new S(r||[]);return a._invoke=function(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=w(o,n);if(s){if(s===l)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=u(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(e,n,o),a}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var l={};function f(){}function p(){}function h(){}var d={};d[a]=function(){return this};var v=Object.getPrototypeOf,y=v&&v(v(_([])));y&&y!==n&&r.call(y,a)&&(d=y);var m=h.prototype=f.prototype=Object.create(d);function g(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function b(e,n){var i;this._invoke=function(a,o){function s(){return new n((function(i,s){!function i(a,o,s,c){var l=u(e[a],e,o);if("throw"!==l.type){var f=l.arg,p=f.value;return p&&"object"===t(p)&&r.call(p,"__await")?n.resolve(p.__await).then((function(e){i("next",e,s,c)}),(function(e){i("throw",e,s,c)})):n.resolve(p).then((function(e){f.value=e,s(f)}),(function(e){return i("throw",e,s,c)}))}c(l.arg)}(a,o,i,s)}))}return i=i?i.then(s,s):s()}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=u(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,l;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function _(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:$}}function $(){return{value:void 0,done:!0}}return p.prototype=m.constructor=h,h.constructor=p,h[s]=p.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,s in e||(e[s]="GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},g(b.prototype),b.prototype[o]=function(){return this},e.AsyncIterator=b,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new b(c(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},g(m),m[s]="Generator",m[a]=function(){return this},m.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=_,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(s&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,l):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),x(n),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;x(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:_(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},e}("object"===t(e)?e.exports:{});try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}}).call(this,n(4)(e))},function(e,t,n){(function(t){var r=n(10).strict;e.exports=function(e){if(r(e)){var n=t.from(e.buffer);return e.byteLength!==e.buffer.byteLength&&(n=n.slice(e.byteOffset,e.byteOffset+e.byteLength)),n}return t.from(e)}}).call(this,n(2).Buffer)},function(e,t,n){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=u(e),o=r[0],s=r[1],c=new a(function(e,t,n){return 3*(t+n)/4-n}(0,o,s)),l=0,f=s>0?o-4:o;for(n=0;n<f;n+=4)t=i[e.charCodeAt(n)]<<18|i[e.charCodeAt(n+1)]<<12|i[e.charCodeAt(n+2)]<<6|i[e.charCodeAt(n+3)],c[l++]=t>>16&255,c[l++]=t>>8&255,c[l++]=255&t;return 2===s&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,c[l++]=255&t),1===s&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t),c},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],o=0,s=n-i;o<s;o+=16383)a.push(l(e,o,o+16383>s?s:o+16383));return 1===i?(t=e[n-1],a.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],a.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),a.join("")};for(var r=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,c=o.length;s<c;++s)r[s]=o[s],i[o.charCodeAt(s)]=s;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var i,a,o=[],s=t;s<n;s+=3)i=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),o.push(r[(a=i)>>18&63]+r[a>>12&63]+r[a>>6&63]+r[63&a]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,i){var a,o,s=8*i-r-1,c=(1<<s)-1,u=c>>1,l=-7,f=n?i-1:0,p=n?-1:1,h=e[t+f];for(f+=p,a=h&(1<<-l)-1,h>>=-l,l+=s;l>0;a=256*a+e[t+f],f+=p,l-=8);for(o=a&(1<<-l)-1,a>>=-l,l+=r;l>0;o=256*o+e[t+f],f+=p,l-=8);if(0===a)a=1-u;else{if(a===c)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,r),a-=u}return(h?-1:1)*o*Math.pow(2,a-r)},t.write=function(e,t,n,r,i,a){var o,s,c,u=8*a-i-1,l=(1<<u)-1,f=l>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:a-1,d=r?1:-1,v=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+f>=1?p/c:p*Math.pow(2,1-f))*c>=2&&(o++,c/=2),o+f>=l?(s=0,o=l):o+f>=1?(s=(t*c-1)*Math.pow(2,i),o+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;e[n+h]=255&s,h+=d,s/=256,i-=8);for(o=o<<i|s,u+=i;u>0;e[n+h]=255&o,h+=d,o/=256,u-=8);e[n+h-d]|=128*v}},function(e,t){e.exports=i,i.strict=a,i.loose=o;var n=Object.prototype.toString,r={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function i(e){return a(e)||o(e)}function a(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function o(e){return r[n.call(e)]}},function(e,t,n){"use strict";n.r(t),n.d(t,"SNPureCrypto",(function(){return c})),n.d(t,"SNWebCrypto",(function(){return w})),n.d(t,"isWebCryptoAvailable",(function(){return a.o})),n.d(t,"Buffer",(function(){return a.a})),n.d(t,"base64Encode",(function(){return a.f})),n.d(t,"base64Decode",(function(){return a.e})),n.d(t,"base64ToHex",(function(){return a.h})),n.d(t,"hexToBase64",(function(){return a.m}));var r=n(0),i=n.n(r),a=n(1);function s(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}var c=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r,o;return t=e,(n=[{key:"generateUUIDSync",value:function(){return Object(a.i)()}},{key:"generateUUID",value:(r=i.a.mark((function e(){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Object(a.i)());case 1:case"end":return e.stop()}}),e)})),o=function(){var e=this,t=arguments;return new Promise((function(n,i){var a=r.apply(e,t);function o(e){s(a,n,i,o,c,"next",e)}function c(e){s(a,n,i,o,c,"throw",e)}o(void 0)}))},function(){return o.apply(this,arguments)})},{key:"timingSafeEqual",value:function(e,t){var n=String(e),r=String(t),i=n.length,a=0;i!==r.length&&(r=n,a=1);for(var o=0;o<i;o++)a|=n.charCodeAt(o)^r.charCodeAt(o);return 0===a}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e}();function u(e){return(u="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}function l(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function f(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){l(a,r,i,o,s,"next",e)}function s(e){l(a,r,i,o,s,"throw",e)}o(void 0)}))}}function p(e,t){return!t||"object"!==u(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var v=a.k(),y="AES-CBC",m="SHA-256",g="PBKDF2",b="HMAC",w=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=p(this,h(t).call(this))).ready=Promise.all([n.e(3),n.e(0)]).then(n.bind(null,168)).then((function(t){return e.sodium=t,e.sodium.ready})),e}var r,o,s,c,u,l,w,k,x,S,_,$,P,O;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}(t,e),r=t,(o=[{key:"pbkdf2",value:(O=f(i.a.mark((function e(t,n,r,a){var o;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.webCryptoImportKey(t,g,["deriveBits"]);case 2:if(o=e.sent){e.next=6;break}return console.error("Key is null, unable to continue"),e.abrupt("return",null);case 6:return e.abrupt("return",this.webCryptoDeriveBits(o,n,r,a));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return O.apply(this,arguments)})},{key:"generateRandomKey",value:(P=f(i.a.mark((function e(t){var n,r;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t/8,r=a.j().crypto.getRandomValues(new Uint8Array(n)),e.abrupt("return",a.c(r));case 3:case"end":return e.stop()}}),e)}))),function(e){return P.apply(this,arguments)})},{key:"aes256CbcEncrypt",value:($=f(i.a.mark((function e(t,n,r){var o,s,c,u,l,f,p;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.l(r);case 2:return o=e.sent,e.next=5,a.l(n);case 5:return s=e.sent,c={name:y,iv:s},e.next=9,this.webCryptoImportKey(o,c.name,["encrypt"]);case 9:return u=e.sent,e.next=12,a.p(t);case 12:return l=e.sent,e.next=15,crypto.subtle.encrypt(c,u,l);case 15:return f=e.sent,e.next=18,a.b(f);case 18:return p=e.sent,e.abrupt("return",p);case 20:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return $.apply(this,arguments)})},{key:"aes256CbcDecrypt",value:(_=f(i.a.mark((function e(t,n,r){var o,s,c,u,l;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.l(r);case 2:return o=e.sent,e.next=5,a.l(n);case 5:return s=e.sent,c={name:y,iv:s},e.next=9,this.webCryptoImportKey(o,c.name,["decrypt"]);case 9:return u=e.sent,e.next=12,a.g(t);case 12:return l=e.sent,e.abrupt("return",crypto.subtle.decrypt(c,u,l).then(function(){var e=f(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",a.d(t));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()).catch((function(e){return console.error("Error performing AES-CBC decryption:",e),null})));case 14:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return _.apply(this,arguments)})},{key:"hmac256",value:(S=f(i.a.mark((function e(t,n){var r,o,s;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.l(n);case 2:return r=e.sent,e.next=5,this.webCryptoImportKey(r,b,["sign"],{name:m});case 5:return o=e.sent,e.next=8,a.p(t);case 8:return s=e.sent,e.abrupt("return",crypto.subtle.sign({name:b},o,s).then((function(e){return a.c(e)})).catch((function(e){return console.error("Error computing HMAC:",e),null})));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"sha256",value:(x=f(i.a.mark((function e(t){var n,r;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.p(t);case 2:return n=e.sent,e.next=5,crypto.subtle.digest(m,n);case 5:return r=e.sent,e.abrupt("return",a.c(r));case 7:case"end":return e.stop()}}),e)}))),function(e){return x.apply(this,arguments)})},{key:"unsafeSha1",value:(k=f(i.a.mark((function e(t){var n,r;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.p(t);case 2:return n=e.sent,e.next=5,crypto.subtle.digest("SHA-1",n);case 5:return r=e.sent,e.abrupt("return",a.c(r));case 7:case"end":return e.stop()}}),e)}))),function(e){return k.apply(this,arguments)})},{key:"webCryptoImportKey",value:(w=f(i.a.mark((function e(t,n,r,o){var s;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.n(t)){e.next=6;break}return e.next=3,a.p(t);case 3:e.t0=e.sent,e.next=7;break;case 6:e.t0=t;case 7:return s=e.t0,e.abrupt("return",v.importKey("raw",s,{name:n,hash:o},!1,r).then((function(e){return e})).catch((function(e){return console.error(e),null})));case 9:case"end":return e.stop()}}),e)}))),function(e,t,n,r){return w.apply(this,arguments)})},{key:"webCryptoDeriveBits",value:(l=f(i.a.mark((function e(t,n,r,o){var s;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=g,e.next=3,a.p(n);case 3:return e.t1=e.sent,e.t2=r,e.t3={name:"SHA-512"},s={name:e.t0,salt:e.t1,iterations:e.t2,hash:e.t3},e.abrupt("return",v.deriveBits(s,t,o).then((function(e){return a.c(new Uint8Array(e))})).catch((function(e){return console.error(e),null})));case 8:case"end":return e.stop()}}),e)}))),function(e,t,n,r){return l.apply(this,arguments)})},{key:"argon2",value:(u=f(i.a.mark((function e(t,n,r,o,s){var c;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.ready;case 2:return e.t0=this.sodium,e.t1=s,e.next=6,a.q(t,"binary");case 6:return e.t2=e.sent,e.next=9,a.q(n,"hex");case 9:return e.t3=e.sent,e.t4=r,e.t5=o,e.t6=this.sodium.crypto_pwhash_ALG_DEFAULT,c=e.t0.crypto_pwhash.call(e.t0,e.t1,e.t2,e.t3,e.t4,e.t5,e.t6,"hex"),e.abrupt("return",c);case 15:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return u.apply(this,arguments)})},{key:"xchacha20Encrypt",value:(c=f(i.a.mark((function e(t,n,r,o){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.ready;case 2:if(48===n.length){e.next=4;break}throw"Nonce must be 24 bytes";case 4:return e.t0=this.sodium,e.next=7,a.q(t);case 7:return e.t1=e.sent,e.next=10,a.q(o);case 10:return e.t2=e.sent,e.next=13,a.q(n,"hex");case 13:return e.t3=e.sent,e.next=16,a.q(r,"hex");case 16:return e.t4=e.sent,e.abrupt("return",e.t0.crypto_aead_xchacha20poly1305_ietf_encrypt.call(e.t0,e.t1,e.t2,null,e.t3,e.t4,"base64"));case 18:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return c.apply(this,arguments)})},{key:"xchacha20Decrypt",value:(s=f(i.a.mark((function e(t,n,r,o){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.ready;case 2:if(48===n.length){e.next=4;break}throw"Nonce must be 24 bytes";case 4:return e.prev=4,e.t0=this.sodium,e.next=8,a.q(t,"base64");case 8:return e.t1=e.sent,e.next=11,a.q(o);case 11:return e.t2=e.sent,e.next=14,a.q(n,"hex");case 14:return e.t3=e.sent,e.next=17,a.q(r,"hex");case 17:return e.t4=e.sent,e.abrupt("return",e.t0.crypto_aead_xchacha20poly1305_ietf_decrypt.call(e.t0,null,e.t1,e.t2,e.t3,e.t4,"text"));case 21:return e.prev=21,e.t5=e.catch(4),e.abrupt("return",null);case 24:case"end":return e.stop()}}),e,this,[[4,21]])}))),function(e,t,n,r){return s.apply(this,arguments)})}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,o),t}(c)}])},"object"==o(t)&&"object"==o(e)?e.exports=a():(r=[],void 0===(i="function"==typeof(n=a)?n.apply(t,r):n)||(e.exports=i))}).call(this,n(16)(e))},function(e,t,n){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i=n(56),a="object"==("undefined"==typeof self?"undefined":r(self))&&self&&self.Object===Object&&self,o=i||a||Function("return this")();e.exports=o},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}e.exports=function(e){var t=n(e);return null!=e&&("object"==t||"function"==t)}},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}e.exports=function(e){return null!=e&&"object"==n(e)}},function(e,t,n){var r=n(105),i=n(110);e.exports=function(e,t){var n=i(e,t);return r(n)?n:void 0}},function(e,t,n){var r=n(37),i=n(44);e.exports=function(e){return null!=e&&i(e.length)&&!r(e)}},function(e,t,n){var r=n(13),i=n(106),a=n(107),o=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":o&&o in Object(e)?i(e):a(e)}},function(e,t,n){var r=n(7).Symbol;e.exports=r},function(e,t,n){var r=n(68),i=n(39);e.exports=function(e,t,n,a){var o=!n;n||(n={});for(var s=-1,c=t.length;++s<c;){var u=t[s],l=a?a(n[u],e[u],u,n,e):void 0;void 0===l&&(l=e[u]),o?i(n,u,l):r(n,u,l)}return n}},function(e,t,n){var r=n(69),i=n(155),a=n(11);e.exports=function(e){return a(e)?r(e):i(e)}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,n){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i=n(147),a=n(161),o=n(47),s=n(4),c=n(171);e.exports=function(e){return"function"==typeof e?e:null==e?o:"object"==r(e)?s(e)?a(e[0],e[1]):i(e):c(e)}},function(e,t,n){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i=n(12),a=n(9);e.exports=function(e){return"symbol"==r(e)||a(e)&&"[object Symbol]"==i(e)}},function(e,t,n){var r=n(19);e.exports=function(e){if("string"==typeof e||r(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}},function(e,t,n){var r=n(74);e.exports=function(e){return e&&e.length?r(e):[]}},function(e,t,n){var r=n(23),i=n(100),a=n(101),o=n(102),s=n(103),c=n(104);function u(e){var t=this.__data__=new r(e);this.size=t.size}u.prototype.clear=i,u.prototype.delete=a,u.prototype.get=o,u.prototype.has=s,u.prototype.set=c,e.exports=u},function(e,t,n){var r=n(95),i=n(96),a=n(97),o=n(98),s=n(99);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,e.exports=c},function(e,t,n){var r=n(17);e.exports=function(e,t){for(var n=e.length;n--;)if(r(e[n][0],t))return n;return-1}},function(e,t,n){var r=n(10)(Object,"create");e.exports=r},function(e,t,n){var r=n(119);e.exports=function(e,t){var n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.map}},function(e,t,n){var r=n(126),i=n(9),a=Object.prototype,o=a.hasOwnProperty,s=a.propertyIsEnumerable,c=r(function(){return arguments}())?r:function(e){return i(e)&&o.call(e,"callee")&&!s.call(e,"callee")};e.exports=c},function(e,t,n){(function(e){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i=n(7),a=n(128),o="object"==r(t)&&t&&!t.nodeType&&t,s=o&&"object"==r(e)&&e&&!e.nodeType&&e,c=s&&s.exports===o?i.Buffer:void 0,u=(c?c.isBuffer:void 0)||a;e.exports=u}).call(this,n(16)(e))},function(e,t){e.exports=function(e){return function(t){return e(t)}}},function(e,t,n){var r=n(69),i=n(132),a=n(11);e.exports=function(e){return a(e)?r(e,!0):i(e)}},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r=/^(?:0|[1-9]\d*)$/;e.exports=function(e,t){var i=n(e);return!!(t=null==t?9007199254740991:t)&&("number"==i||"symbol"!=i&&r.test(e))&&e>-1&&e%1==0&&e<t}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}},function(e,t,n){var r=n(157),i=n(36),a=n(158),o=n(79),s=n(159),c=n(12),u=n(57),l=u(r),f=u(i),p=u(a),h=u(o),d=u(s),v=c;(r&&"[object DataView]"!=v(new r(new ArrayBuffer(1)))||i&&"[object Map]"!=v(new i)||a&&"[object Promise]"!=v(a.resolve())||o&&"[object Set]"!=v(new o)||s&&"[object WeakMap]"!=v(new s))&&(v=function(e){var t=c(e),n="[object Object]"==t?e.constructor:void 0,r=n?u(n):"";if(r)switch(r){case l:return"[object DataView]";case f:return"[object Map]";case p:return"[object Promise]";case h:return"[object Set]";case d:return"[object WeakMap]"}return t}),e.exports=v},function(e,t,n){var r=n(4),i=n(52),a=n(163),o=n(166);e.exports=function(e,t){return r(e)?e:i(e,t)?[e]:a(o(e))}},function(e,t,n){var r=n(55),i=n(70)((function(e,t,n){r(e,t,n)}));e.exports=i},function(e,t,n){var r=n(10)(n(7),"Map");e.exports=r},function(e,t,n){var r=n(12),i=n(8);e.exports=function(e){if(!i(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},function(e,t,n){var r=n(111),i=n(118),a=n(120),o=n(121),s=n(122);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,e.exports=c},function(e,t,n){var r=n(59);e.exports=function(e,t,n){"__proto__"==t&&r?r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},function(e,t,n){var r=n(63);e.exports=function(e){var t=new e.constructor(e.byteLength);return new r(t).set(new r(e)),t}},function(e,t){e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}},function(e,t,n){var r=n(65)(Object.getPrototypeOf,Object);e.exports=r},function(e,t){var n=Object.prototype;e.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||n)}},function(e,t){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},function(e,t,n){var r=n(129),i=n(29),a=n(46),o=a&&a.isTypedArray,s=o?i(o):r;e.exports=s},function(e,t,n){(function(e){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i=n(56),a="object"==r(t)&&t&&!t.nodeType&&t,o=a&&"object"==r(e)&&e&&!e.nodeType&&e,s=o&&o.exports===a&&i.process,c=function(){try{return o&&o.require&&o.require("util").types||s&&s.binding&&s.binding("util")}catch(e){}}();e.exports=c}).call(this,n(16)(e))},function(e,t){e.exports=function(e){return e}},function(e,t){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}},function(e,t){e.exports=function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}},function(e,t,n){var r=n(154),i=n(84),a=Object.prototype.propertyIsEnumerable,o=Object.getOwnPropertySymbols,s=o?function(e){return null==e?[]:(e=Object(e),r(o(e),(function(t){return a.call(e,t)})))}:i;e.exports=s},function(e,t,n){var r=n(34),i=n(20);e.exports=function(e,t){for(var n=0,a=(t=r(t,e)).length;null!=e&&n<a;)e=e[i(t[n++])];return n&&n==a?e:void 0}},function(e,t,n){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i=n(4),a=n(19),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;e.exports=function(e,t){if(i(e))return!1;var n=r(e);return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!a(e))||s.test(e)||!o.test(e)||null!=t&&e in Object(t)}},function(e,t,n){var r=n(18),i=n(210);e.exports=function(e,t,n){return i(e,t,r(n,2))}},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"===("undefined"==typeof window?"undefined":n(window))&&(r=window)}e.exports=r},function(e,t,n){var r=n(22),i=n(58),a=n(60),o=n(124),s=n(8),c=n(30),u=n(67);e.exports=function e(t,n,l,f,p){t!==n&&a(n,(function(a,c){if(p||(p=new r),s(a))o(t,n,c,l,e,f,p);else{var h=f?f(u(t,c),a,c+"",t,n,p):void 0;void 0===h&&(h=a),i(t,c,h)}}),c)}},function(e,t,n){(function(t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r="object"==(void 0===t?"undefined":n(t))&&t&&t.Object===Object&&t;e.exports=r}).call(this,n(54))},function(e,t){var n=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return n.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},function(e,t,n){var r=n(39),i=n(17);e.exports=function(e,t,n){(void 0===n||i(e[t],n))&&(void 0!==n||t in e)||r(e,t,n)}},function(e,t,n){var r=n(10),i=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=i},function(e,t,n){var r=n(123)();e.exports=r},function(e,t,n){(function(e){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i=n(7),a="object"==r(t)&&t&&!t.nodeType&&t,o=a&&"object"==r(e)&&e&&!e.nodeType&&e,s=o&&o.exports===a?i.Buffer:void 0,c=s?s.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,r=c?c(n):new e.constructor(n);return e.copy(r),r}}).call(this,n(16)(e))},function(e,t,n){var r=n(40);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}},function(e,t,n){var r=n(7).Uint8Array;e.exports=r},function(e,t,n){var r=n(125),i=n(42),a=n(43);e.exports=function(e){return"function"!=typeof e.constructor||a(e)?{}:r(i(e))}},function(e,t){e.exports=function(e,t){return function(n){return e(t(n))}}},function(e,t,n){var r=n(12),i=n(42),a=n(9),o=Function.prototype,s=Object.prototype,c=o.toString,u=s.hasOwnProperty,l=c.call(Object);e.exports=function(e){if(!a(e)||"[object Object]"!=r(e))return!1;var t=i(e);if(null===t)return!0;var n=u.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&c.call(n)==l}},function(e,t){e.exports=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}},function(e,t,n){var r=n(39),i=n(17),a=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var o=e[t];a.call(e,t)&&i(o,n)&&(void 0!==n||t in e)||r(e,t,n)}},function(e,t,n){var r=n(131),i=n(27),a=n(4),o=n(28),s=n(31),c=n(45),u=Object.prototype.hasOwnProperty;e.exports=function(e,t){var n=a(e),l=!n&&i(e),f=!n&&!l&&o(e),p=!n&&!l&&!f&&c(e),h=n||l||f||p,d=h?r(e.length,String):[],v=d.length;for(var y in e)!t&&!u.call(e,y)||h&&("length"==y||f&&("offset"==y||"parent"==y)||p&&("buffer"==y||"byteLength"==y||"byteOffset"==y)||s(y,v))||d.push(y);return d}},function(e,t,n){var r=n(71),i=n(138);e.exports=function(e){return r((function(t,n){var r=-1,a=n.length,o=a>1?n[a-1]:void 0,s=a>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(a--,o):void 0,s&&i(n[0],n[1],s)&&(o=a<3?void 0:o,a=1),t=Object(t);++r<a;){var c=n[r];c&&e(t,c,r,o)}return t}))}},function(e,t,n){var r=n(47),i=n(72),a=n(73);e.exports=function(e,t){return a(i(e,t,r),e+"")}},function(e,t,n){var r=n(134),i=Math.max;e.exports=function(e,t,n){return t=i(void 0===t?e.length-1:t,0),function(){for(var a=arguments,o=-1,s=i(a.length-t,0),c=Array(s);++o<s;)c[o]=a[t+o];o=-1;for(var u=Array(t+1);++o<t;)u[o]=a[o];return u[t]=n(c),r(e,this,u)}}},function(e,t,n){var r=n(135),i=n(137)(r);e.exports=i},function(e,t,n){var r=n(75),i=n(141),a=n(144),o=n(78),s=n(145),c=n(48);e.exports=function(e,t,n){var u=-1,l=i,f=e.length,p=!0,h=[],d=h;if(n)p=!1,l=a;else if(f>=200){var v=t?null:s(e);if(v)return c(v);p=!1,l=o,d=new r}else d=t?[]:h;e:for(;++u<f;){var y=e[u],m=t?t(y):y;if(y=n||0!==y?y:0,p&&m==m){for(var g=d.length;g--;)if(d[g]===m)continue e;t&&d.push(m),h.push(y)}else l(d,m,n)||(d!==h&&d.push(m),h.push(y))}return h}},function(e,t,n){var r=n(38),i=n(139),a=n(140);function o(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t<n;)this.add(e[t])}o.prototype.add=o.prototype.push=i,o.prototype.has=a,e.exports=o},function(e,t,n){var r=n(77),i=n(142),a=n(143);e.exports=function(e,t,n){return t==t?a(e,t,n):r(e,i,n)}},function(e,t){e.exports=function(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}},function(e,t){e.exports=function(e,t){return e.has(t)}},function(e,t,n){var r=n(10)(n(7),"Set");e.exports=r},function(e,t,n){var r=n(149),i=n(9);e.exports=function e(t,n,a,o,s){return t===n||(null==t||null==n||!i(t)&&!i(n)?t!=t&&n!=n:r(t,n,a,o,e,s))}},function(e,t,n){var r=n(75),i=n(150),a=n(78);e.exports=function(e,t,n,o,s,c){var u=1&n,l=e.length,f=t.length;if(l!=f&&!(u&&f>l))return!1;var p=c.get(e);if(p&&c.get(t))return p==t;var h=-1,d=!0,v=2&n?new r:void 0;for(c.set(e,t),c.set(t,e);++h<l;){var y=e[h],m=t[h];if(o)var g=u?o(m,y,h,t,e,c):o(y,m,h,e,t,c);if(void 0!==g){if(g)continue;d=!1;break}if(v){if(!i(t,(function(e,t){if(!a(v,t)&&(y===e||s(y,e,n,o,c)))return v.push(t)}))){d=!1;break}}else if(y!==m&&!s(y,m,n,o,c)){d=!1;break}}return c.delete(e),c.delete(t),d}},function(e,t,n){var r=n(83),i=n(50),a=n(15);e.exports=function(e){return r(e,a,i)}},function(e,t,n){var r=n(49),i=n(4);e.exports=function(e,t,n){var a=t(e);return i(e)?a:r(a,n(e))}},function(e,t){e.exports=function(){return[]}},function(e,t,n){var r=n(8);e.exports=function(e){return e==e&&!r(e)}},function(e,t){e.exports=function(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in Object(n))}}},function(e,t,n){var r=n(34),i=n(187),a=n(188),o=n(20);e.exports=function(e,t){return t=r(t,e),null==(e=a(e,t))||delete e[o(i(t))]}},function(e,t,n){var r=n(49),i=n(42),a=n(50),o=n(84),s=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)r(t,a(e)),e=i(e);return t}:o;e.exports=s},function(e,t,n){var r=n(83),i=n(88),a=n(30);e.exports=function(e){return r(e,a,i)}},function(e,t,n){var r=n(55),i=n(70)((function(e,t,n,i){r(e,t,n,i)}));e.exports=i},function(e,t,n){var r=n(74);e.exports=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?r(e,void 0,t):[]}},function(e,t,n){var r=n(32),i=n(18),a=n(174),o=n(4);e.exports=function(e,t){return(o(e)?r:a)(e,i(t,3))}},function(e,t,n){var r=n(32),i=n(190),a=n(87),o=n(34),s=n(14),c=n(205),u=n(206),l=n(89),f=u((function(e,t){var n={};if(null==e)return n;var u=!1;t=r(t,(function(t){return t=o(t,e),u||(u=t.length>1),t})),s(e,l(e),n),u&&(n=i(n,7,c));for(var f=t.length;f--;)a(n,t[f]);return n}));e.exports=f},function(e,t,n){(function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var n=function(e){"use strict";var n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function c(e,t,n,r){var i=t&&t.prototype instanceof f?t:f,a=Object.create(i.prototype),o=new S(r||[]);return a._invoke=function(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=w(o,n);if(s){if(s===l)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=u(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(e,n,o),a}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var l={};function f(){}function p(){}function h(){}var d={};d[a]=function(){return this};var v=Object.getPrototypeOf,y=v&&v(v(_([])));y&&y!==n&&r.call(y,a)&&(d=y);var m=h.prototype=f.prototype=Object.create(d);function g(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function b(e,n){var i;this._invoke=function(a,o){function s(){return new n((function(i,s){!function i(a,o,s,c){var l=u(e[a],e,o);if("throw"!==l.type){var f=l.arg,p=f.value;return p&&"object"===t(p)&&r.call(p,"__await")?n.resolve(p.__await).then((function(e){i("next",e,s,c)}),(function(e){i("throw",e,s,c)})):n.resolve(p).then((function(e){f.value=e,s(f)}),(function(e){return i("throw",e,s,c)}))}c(l.arg)}(a,o,i,s)}))}return i=i?i.then(s,s):s()}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=u(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,l;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function _(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:$}}function $(){return{value:void 0,done:!0}}return p.prototype=m.constructor=h,h.constructor=p,h[s]=p.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,s in e||(e[s]="GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},g(b.prototype),b.prototype[o]=function(){return this},e.AsyncIterator=b,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new b(c(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},g(m),m[s]="Generator",m[a]=function(){return this},m.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=_,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(s&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,l):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),x(n),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;x(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:_(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},e}("object"===t(e)?e.exports:{});try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}}).call(this,n(16)(e))},function(e,t){e.exports=function(){this.__data__=[],this.size=0}},function(e,t,n){var r=n(24),i=Array.prototype.splice;e.exports=function(e){var t=this.__data__,n=r(t,e);return!(n<0||(n==t.length-1?t.pop():i.call(t,n,1),--this.size,0))}},function(e,t,n){var r=n(24);e.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][1]}},function(e,t,n){var r=n(24);e.exports=function(e){return r(this.__data__,e)>-1}},function(e,t,n){var r=n(24);e.exports=function(e,t){var n=this.__data__,i=r(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}},function(e,t,n){var r=n(23);e.exports=function(){this.__data__=new r,this.size=0}},function(e,t){e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},function(e,t){e.exports=function(e){return this.__data__.get(e)}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t,n){var r=n(23),i=n(36),a=n(38);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var o=n.__data__;if(!i||o.length<199)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new a(o)}return n.set(e,t),this.size=n.size,this}},function(e,t,n){var r=n(37),i=n(108),a=n(8),o=n(57),s=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,l=c.toString,f=u.hasOwnProperty,p=RegExp("^"+l.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!a(e)||i(e))&&(r(e)?p:s).test(o(e))}},function(e,t,n){var r=n(13),i=Object.prototype,a=i.hasOwnProperty,o=i.toString,s=r?r.toStringTag:void 0;e.exports=function(e){var t=a.call(e,s),n=e[s];try{e[s]=void 0;var r=!0}catch(e){}var i=o.call(e);return r&&(t?e[s]=n:delete e[s]),i}},function(e,t){var n=Object.prototype.toString;e.exports=function(e){return n.call(e)}},function(e,t,n){var r,i=n(109),a=(r=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";e.exports=function(e){return!!a&&a in e}},function(e,t,n){var r=n(7)["__core-js_shared__"];e.exports=r},function(e,t){e.exports=function(e,t){return null==e?void 0:e[t]}},function(e,t,n){var r=n(112),i=n(23),a=n(36);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(a||i),string:new r}}},function(e,t,n){var r=n(113),i=n(114),a=n(115),o=n(116),s=n(117);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,e.exports=c},function(e,t,n){var r=n(25);e.exports=function(){this.__data__=r?r(null):{},this.size=0}},function(e,t){e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},function(e,t,n){var r=n(25),i=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(r){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return i.call(t,e)?t[e]:void 0}},function(e,t,n){var r=n(25),i=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:i.call(t,e)}},function(e,t,n){var r=n(25);e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}},function(e,t,n){var r=n(26);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}e.exports=function(e){var t=n(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},function(e,t,n){var r=n(26);e.exports=function(e){return r(this,e).get(e)}},function(e,t,n){var r=n(26);e.exports=function(e){return r(this,e).has(e)}},function(e,t,n){var r=n(26);e.exports=function(e,t){var n=r(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this}},function(e,t){e.exports=function(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(!1===n(a[c],c,a))break}return t}}},function(e,t,n){var r=n(58),i=n(61),a=n(62),o=n(41),s=n(64),c=n(27),u=n(4),l=n(127),f=n(28),p=n(37),h=n(8),d=n(66),v=n(45),y=n(67),m=n(130);e.exports=function(e,t,n,g,b,w,k){var x=y(e,n),S=y(t,n),_=k.get(S);if(_)r(e,n,_);else{var $=w?w(x,S,n+"",e,t,k):void 0,P=void 0===$;if(P){var O=u(S),C=!O&&f(S),E=!O&&!C&&v(S);$=S,O||C||E?u(x)?$=x:l(x)?$=o(x):C?(P=!1,$=i(S,!0)):E?(P=!1,$=a(S,!0)):$=[]:d(S)||c(S)?($=x,c(x)?$=m(x):h(x)&&!p(x)||($=s(S))):P=!1}P&&(k.set(S,$),b($,S,g,w,k),k.delete(S)),r(e,n,$)}}},function(e,t,n){var r=n(8),i=Object.create,a=function(){function e(){}return function(t){if(!r(t))return{};if(i)return i(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();e.exports=a},function(e,t,n){var r=n(12),i=n(9);e.exports=function(e){return i(e)&&"[object Arguments]"==r(e)}},function(e,t,n){var r=n(11),i=n(9);e.exports=function(e){return i(e)&&r(e)}},function(e,t){e.exports=function(){return!1}},function(e,t,n){var r=n(12),i=n(44),a=n(9),o={};o["[object Float32Array]"]=o["[object Float64Array]"]=o["[object Int8Array]"]=o["[object Int16Array]"]=o["[object Int32Array]"]=o["[object Uint8Array]"]=o["[object Uint8ClampedArray]"]=o["[object Uint16Array]"]=o["[object Uint32Array]"]=!0,o["[object Arguments]"]=o["[object Array]"]=o["[object ArrayBuffer]"]=o["[object Boolean]"]=o["[object DataView]"]=o["[object Date]"]=o["[object Error]"]=o["[object Function]"]=o["[object Map]"]=o["[object Number]"]=o["[object Object]"]=o["[object RegExp]"]=o["[object Set]"]=o["[object String]"]=o["[object WeakMap]"]=!1,e.exports=function(e){return a(e)&&i(e.length)&&!!o[r(e)]}},function(e,t,n){var r=n(14),i=n(30);e.exports=function(e){return r(e,i(e))}},function(e,t){e.exports=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}},function(e,t,n){var r=n(8),i=n(43),a=n(133),o=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return a(e);var t=i(e),n=[];for(var s in e)("constructor"!=s||!t&&o.call(e,s))&&n.push(s);return n}},function(e,t){e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},function(e,t){e.exports=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}},function(e,t,n){var r=n(136),i=n(59),a=n(47),o=i?function(e,t){return i(e,"toString",{configurable:!0,enumerable:!1,value:r(t),writable:!0})}:a;e.exports=o},function(e,t){e.exports=function(e){return function(){return e}}},function(e,t){var n=Date.now;e.exports=function(e){var t=0,r=0;return function(){var i=n(),a=16-(i-r);if(r=i,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}},function(e,t,n){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i=n(17),a=n(11),o=n(31),s=n(8);e.exports=function(e,t,n){if(!s(n))return!1;var c=r(t);return!!("number"==c?a(n)&&o(t,n.length):"string"==c&&t in n)&&i(n[t],e)}},function(e,t){e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t,n){var r=n(76);e.exports=function(e,t){return!(null==e||!e.length)&&r(e,t,0)>-1}},function(e,t){e.exports=function(e){return e!=e}},function(e,t){e.exports=function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}},function(e,t){e.exports=function(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}},function(e,t,n){var r=n(79),i=n(146),a=n(48),o=r&&1/a(new r([,-0]))[1]==1/0?function(e){return new r(e)}:i;e.exports=o},function(e,t){e.exports=function(){}},function(e,t,n){var r=n(148),i=n(160),a=n(86);e.exports=function(e){var t=i(e);return 1==t.length&&t[0][2]?a(t[0][0],t[0][1]):function(n){return n===e||r(n,e,t)}}},function(e,t,n){var r=n(22),i=n(80);e.exports=function(e,t,n,a){var o=n.length,s=o,c=!a;if(null==e)return!s;for(e=Object(e);o--;){var u=n[o];if(c&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++o<s;){var l=(u=n[o])[0],f=e[l],p=u[1];if(c&&u[2]){if(void 0===f&&!(l in e))return!1}else{var h=new r;if(a)var d=a(f,p,l,e,t,h);if(!(void 0===d?i(p,f,3,a,h):d))return!1}}return!0}},function(e,t,n){var r=n(22),i=n(81),a=n(151),o=n(153),s=n(33),c=n(4),u=n(28),l=n(45),f="[object Object]",p=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,h,d,v){var y=c(e),m=c(t),g=y?"[object Array]":s(e),b=m?"[object Array]":s(t),w=(g="[object Arguments]"==g?f:g)==f,k=(b="[object Arguments]"==b?f:b)==f,x=g==b;if(x&&u(e)){if(!u(t))return!1;y=!0,w=!1}if(x&&!w)return v||(v=new r),y||l(e)?i(e,t,n,h,d,v):a(e,t,g,n,h,d,v);if(!(1&n)){var S=w&&p.call(e,"__wrapped__"),_=k&&p.call(t,"__wrapped__");if(S||_){var $=S?e.value():e,P=_?t.value():t;return v||(v=new r),d($,P,n,h,v)}}return!!x&&(v||(v=new r),o(e,t,n,h,d,v))}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}},function(e,t,n){var r=n(13),i=n(63),a=n(17),o=n(81),s=n(152),c=n(48),u=r?r.prototype:void 0,l=u?u.valueOf:void 0;e.exports=function(e,t,n,r,u,f,p){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!f(new i(e),new i(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return a(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var h=s;case"[object Set]":var d=1&r;if(h||(h=c),e.size!=t.size&&!d)return!1;var v=p.get(e);if(v)return v==t;r|=2,p.set(e,t);var y=o(h(e),h(t),r,u,f,p);return p.delete(e),y;case"[object Symbol]":if(l)return l.call(e)==l.call(t)}return!1}},function(e,t){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},function(e,t,n){var r=n(82),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,a,o,s){var c=1&n,u=r(e),l=u.length;if(l!=r(t).length&&!c)return!1;for(var f=l;f--;){var p=u[f];if(!(c?p in t:i.call(t,p)))return!1}var h=s.get(e);if(h&&s.get(t))return h==t;var d=!0;s.set(e,t),s.set(t,e);for(var v=c;++f<l;){var y=e[p=u[f]],m=t[p];if(a)var g=c?a(m,y,p,t,e,s):a(y,m,p,e,t,s);if(!(void 0===g?y===m||o(y,m,n,a,s):g)){d=!1;break}v||(v="constructor"==p)}if(d&&!v){var b=e.constructor,w=t.constructor;b!=w&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof w&&w instanceof w)&&(d=!1)}return s.delete(e),s.delete(t),d}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}},function(e,t,n){var r=n(43),i=n(156),a=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return i(e);var t=[];for(var n in Object(e))a.call(e,n)&&"constructor"!=n&&t.push(n);return t}},function(e,t,n){var r=n(65)(Object.keys,Object);e.exports=r},function(e,t,n){var r=n(10)(n(7),"DataView");e.exports=r},function(e,t,n){var r=n(10)(n(7),"Promise");e.exports=r},function(e,t,n){var r=n(10)(n(7),"WeakMap");e.exports=r},function(e,t,n){var r=n(85),i=n(15);e.exports=function(e){for(var t=i(e),n=t.length;n--;){var a=t[n],o=e[a];t[n]=[a,o,r(o)]}return t}},function(e,t,n){var r=n(80),i=n(162),a=n(168),o=n(52),s=n(85),c=n(86),u=n(20);e.exports=function(e,t){return o(e)&&s(t)?c(u(e),t):function(n){var o=i(n,e);return void 0===o&&o===t?a(n,e):r(t,o,3)}}},function(e,t,n){var r=n(51);e.exports=function(e,t,n){var i=null==e?void 0:r(e,t);return void 0===i?n:i}},function(e,t,n){var r=n(164),i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,a=/\\(\\)?/g,o=r((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(i,(function(e,n,r,i){t.push(r?i.replace(a,"$1"):n||e)})),t}));e.exports=o},function(e,t,n){var r=n(165);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},function(e,t,n){var r=n(38);function i(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function n(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(i.Cache||r),n}i.Cache=r,e.exports=i},function(e,t,n){var r=n(167);e.exports=function(e){return null==e?"":r(e)}},function(e,t,n){var r=n(13),i=n(32),a=n(4),o=n(19),s=r?r.prototype:void 0,c=s?s.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(a(t))return i(t,e)+"";if(o(t))return c?c.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},function(e,t,n){var r=n(169),i=n(170);e.exports=function(e,t){return null!=e&&i(e,t,r)}},function(e,t){e.exports=function(e,t){return null!=e&&t in Object(e)}},function(e,t,n){var r=n(34),i=n(27),a=n(4),o=n(31),s=n(44),c=n(20);e.exports=function(e,t,n){for(var u=-1,l=(t=r(t,e)).length,f=!1;++u<l;){var p=c(t[u]);if(!(f=null!=e&&n(e,p)))break;e=e[p]}return f||++u!=l?f:!!(l=null==e?0:e.length)&&s(l)&&o(p,l)&&(a(e)||i(e))}},function(e,t,n){var r=n(172),i=n(173),a=n(52),o=n(20);e.exports=function(e){return a(e)?r(o(e)):i(e)}},function(e,t){e.exports=function(e){return function(t){return null==t?void 0:t[e]}}},function(e,t,n){var r=n(51);e.exports=function(e){return function(t){return r(t,e)}}},function(e,t,n){var r=n(175),i=n(11);e.exports=function(e,t){var n=-1,a=i(e)?Array(e.length):[];return r(e,(function(e,r,i){a[++n]=t(e,r,i)})),a}},function(e,t,n){var r=n(176),i=n(177)(r);e.exports=i},function(e,t,n){var r=n(60),i=n(15);e.exports=function(e,t){return e&&r(e,t,i)}},function(e,t,n){var r=n(11);e.exports=function(e,t){return function(n,i){if(null==n)return n;if(!r(n))return e(n,i);for(var a=n.length,o=t?a:-1,s=Object(n);(t?o--:++o<a)&&!1!==i(s[o],o,s););return n}}},function(e,t,n){var r=n(18),i=n(11),a=n(15);e.exports=function(e){return function(t,n,o){var s=Object(t);if(!i(t)){var c=r(n,3);t=a(t),n=function(e){return c(s[e],e,s)}}var u=e(t,n,o);return u>-1?s[c?t[u]:u]:void 0}}},function(e,t,n){var r=n(77),i=n(18),a=n(180),o=Math.max;e.exports=function(e,t,n){var s=null==e?0:e.length;if(!s)return-1;var c=null==n?0:a(n);return c<0&&(c=o(s+c,0)),r(e,i(t,3),c)}},function(e,t,n){var r=n(181);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},function(e,t,n){var r=n(182);e.exports=function(e){return e?(e=r(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},function(e,t,n){var r=n(8),i=n(19),a=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(a,"");var n=s.test(e);return n||c.test(e)?u(e.slice(2),n?2:8):o.test(e)?NaN:+e}},function(e,t,n){var r=n(184);e.exports=function(e,t){return e&&e.length&&t&&t.length?r(e,t):e}},function(e,t,n){var r=n(32),i=n(76),a=n(185),o=n(29),s=n(41),c=Array.prototype.splice;e.exports=function(e,t,n,u){var l=u?a:i,f=-1,p=t.length,h=e;for(e===t&&(t=s(t)),n&&(h=r(e,o(n)));++f<p;)for(var d=0,v=t[f],y=n?n(v):v;(d=l(h,y,d,u))>-1;)h!==e&&c.call(h,d,1),c.call(e,d,1);return e}},function(e,t){e.exports=function(e,t,n,r){for(var i=n-1,a=e.length;++i<a;)if(r(e[i],t))return i;return-1}},function(e,t,n){var r=n(87),i=n(31),a=Array.prototype.splice;e.exports=function(e,t){for(var n=e?t.length:0,o=n-1;n--;){var s=t[n];if(n==o||s!==c){var c=s;i(s)?a.call(e,s,1):r(e,s)}}return e}},function(e,t){e.exports=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},function(e,t,n){var r=n(51),i=n(189);e.exports=function(e,t){return t.length<2?e:r(e,i(t,0,-1))}},function(e,t){e.exports=function(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}},function(e,t,n){var r=n(22),i=n(191),a=n(68),o=n(192),s=n(193),c=n(61),u=n(41),l=n(194),f=n(195),p=n(82),h=n(89),d=n(33),v=n(196),y=n(197),m=n(64),g=n(4),b=n(28),w=n(201),k=n(8),x=n(203),S=n(15),_={};_["[object Arguments]"]=_["[object Array]"]=_["[object ArrayBuffer]"]=_["[object DataView]"]=_["[object Boolean]"]=_["[object Date]"]=_["[object Float32Array]"]=_["[object Float64Array]"]=_["[object Int8Array]"]=_["[object Int16Array]"]=_["[object Int32Array]"]=_["[object Map]"]=_["[object Number]"]=_["[object Object]"]=_["[object RegExp]"]=_["[object Set]"]=_["[object String]"]=_["[object Symbol]"]=_["[object Uint8Array]"]=_["[object Uint8ClampedArray]"]=_["[object Uint16Array]"]=_["[object Uint32Array]"]=!0,_["[object Error]"]=_["[object Function]"]=_["[object WeakMap]"]=!1,e.exports=function e(t,n,$,P,O,C){var E,A=1&n,I=2&n,j=4&n;if($&&(E=O?$(t,P,O,C):$(t)),void 0!==E)return E;if(!k(t))return t;var D=g(t);if(D){if(E=v(t),!A)return u(t,E)}else{var M=d(t),T="[object Function]"==M||"[object GeneratorFunction]"==M;if(b(t))return c(t,A);if("[object Object]"==M||"[object Arguments]"==M||T&&!O){if(E=I||T?{}:m(t),!A)return I?f(t,s(E,t)):l(t,o(E,t))}else{if(!_[M])return O?t:{};E=y(t,M,A)}}C||(C=new r);var R=C.get(t);if(R)return R;C.set(t,E),x(t)?t.forEach((function(r){E.add(e(r,n,$,r,t,C))})):w(t)&&t.forEach((function(r,i){E.set(i,e(r,n,$,i,t,C))}));var L=j?I?h:p:I?keysIn:S,N=D?void 0:L(t);return i(N||t,(function(r,i){N&&(r=t[i=r]),a(E,i,e(r,n,$,i,t,C))})),E}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}},function(e,t,n){var r=n(14),i=n(15);e.exports=function(e,t){return e&&r(t,i(t),e)}},function(e,t,n){var r=n(14),i=n(30);e.exports=function(e,t){return e&&r(t,i(t),e)}},function(e,t,n){var r=n(14),i=n(50);e.exports=function(e,t){return r(e,i(e),t)}},function(e,t,n){var r=n(14),i=n(88);e.exports=function(e,t){return r(e,i(e),t)}},function(e,t){var n=Object.prototype.hasOwnProperty;e.exports=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&n.call(e,"index")&&(r.index=e.index,r.input=e.input),r}},function(e,t,n){var r=n(40),i=n(198),a=n(199),o=n(200),s=n(62);e.exports=function(e,t,n){var c=e.constructor;switch(t){case"[object ArrayBuffer]":return r(e);case"[object Boolean]":case"[object Date]":return new c(+e);case"[object DataView]":return i(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return s(e,n);case"[object Map]":return new c;case"[object Number]":case"[object String]":return new c(e);case"[object RegExp]":return a(e);case"[object Set]":return new c;case"[object Symbol]":return o(e)}}},function(e,t,n){var r=n(40);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}},function(e,t){var n=/\w*$/;e.exports=function(e){var t=new e.constructor(e.source,n.exec(e));return t.lastIndex=e.lastIndex,t}},function(e,t,n){var r=n(13),i=r?r.prototype:void 0,a=i?i.valueOf:void 0;e.exports=function(e){return a?Object(a.call(e)):{}}},function(e,t,n){var r=n(202),i=n(29),a=n(46),o=a&&a.isMap,s=o?i(o):r;e.exports=s},function(e,t,n){var r=n(33),i=n(9);e.exports=function(e){return i(e)&&"[object Map]"==r(e)}},function(e,t,n){var r=n(204),i=n(29),a=n(46),o=a&&a.isSet,s=o?i(o):r;e.exports=s},function(e,t,n){var r=n(33),i=n(9);e.exports=function(e){return i(e)&&"[object Set]"==r(e)}},function(e,t,n){var r=n(66);e.exports=function(e){return r(e)?void 0:e}},function(e,t,n){var r=n(207),i=n(72),a=n(73);e.exports=function(e){return a(i(e,void 0,r),e+"")}},function(e,t,n){var r=n(208);e.exports=function(e){return null!=e&&e.length?r(e,1):[]}},function(e,t,n){var r=n(49),i=n(209);e.exports=function e(t,n,a,o,s){var c=-1,u=t.length;for(a||(a=i),s||(s=[]);++c<u;){var l=t[c];n>0&&a(l)?n>1?e(l,n-1,a,o,s):r(s,l):o||(s[s.length]=l)}return s}},function(e,t,n){var r=n(13),i=n(27),a=n(4),o=r?r.isConcatSpreadable:void 0;e.exports=function(e){return a(e)||i(e)||!!(o&&e&&e[o])}},function(e,t,n){var r=n(19),i=Math.floor,a=Math.min;e.exports=function(e,t,n,o){t=n(t);for(var s=0,c=null==e?0:e.length,u=t!=t,l=null===t,f=r(t),p=void 0===t;s<c;){var h=i((s+c)/2),d=n(e[h]),v=void 0!==d,y=null===d,m=d==d,g=r(d);if(u)var b=o||m;else b=p?m&&(o||v):l?m&&v&&(o||!y):f?m&&v&&!y&&(o||!g):!y&&!g&&(o?d<=t:d<t);b?s=h+1:c=h}return a(c,4294967294)}},function(e,t,n){"use strict";n.r(t),n.d(t,"SNApplication",(function(){return mu})),n.d(t,"SNProtocolService",(function(){return xs})),n.d(t,"SNProtocolOperator001",(function(){return de})),n.d(t,"SNProtocolOperator002",(function(){return $e})),n.d(t,"SNProtocolOperator003",(function(){return Me})),n.d(t,"SNProtocolOperator004",(function(){return ze})),n.d(t,"DeviceInterface",(function(){return xu})),n.d(t,"SNItem",(function(){return R})),n.d(t,"SNItemsKey",(function(){return Xe})),n.d(t,"SNPredicate",(function(){return v})),n.d(t,"SNNote",(function(){return zt})),n.d(t,"SNTag",(function(){return Ft})),n.d(t,"SNSmartTag",(function(){return ln})),n.d(t,"SNActionsExtension",(function(){return Dt})),n.d(t,"Action",(function(){return Ot})),n.d(t,"SNTheme",(function(){return yn})),n.d(t,"SNEncryptedStorage",(function(){return $n})),n.d(t,"SNComponent",(function(){return ct})),n.d(t,"SNEditor",(function(){return xt})),n.d(t,"SNComponentManager",(function(){return Va})),n.d(t,"HistorySession",(function(){return Rs})),n.d(t,"ItemHistory",(function(){return Ms})),n.d(t,"ItemHistoryEntry",(function(){return _s})),n.d(t,"SNPrivileges",(function(){return an})),n.d(t,"SNWebCrypto",(function(){return Z.SNWebCrypto})),n.d(t,"SNModelManager",(function(){return co})),n.d(t,"SNHttpService",(function(){return Qa})),n.d(t,"DeviceAuthService",(function(){return pu})),n.d(t,"ChallengeResponse",(function(){return Su})),n.d(t,"PureService",(function(){return qi})),n.d(t,"SNStorageService",(function(){return Uo})),n.d(t,"StoragePersistencePolicies",(function(){return Ro})),n.d(t,"StorageEncryptionPolicies",(function(){return Lo})),n.d(t,"StorageValueModes",(function(){return No})),n.d(t,"ValueModesKeys",(function(){return Fo})),n.d(t,"Challenges",(function(){return $})),n.d(t,"SNSyncService",(function(){return au})),n.d(t,"SyncSources",(function(){return iu})),n.d(t,"SyncModes",(function(){return ru})),n.d(t,"TIMING_STRATEGY_RESOLVE_ON_NEXT",(function(){return tu})),n.d(t,"TIMING_STRATEGY_FORCE_SPAWN_NEW",(function(){return nu})),n.d(t,"SNSessionManager",(function(){return la})),n.d(t,"SNMigrationService",(function(){return hs})),n.d(t,"SNAlertService",(function(){return ea})),n.d(t,"SNHistoryManager",(function(){return Bs})),n.d(t,"SNPrivilegesService",(function(){return nc})),n.d(t,"SNSingletonManager",(function(){return yo})),n.d(t,"SNKeyManager",(function(){return dc})),n.d(t,"KEY_MODE_ROOT_KEY_NONE",(function(){return lc})),n.d(t,"KEY_MODE_ROOT_KEY_ONLY",(function(){return fc})),n.d(t,"KEY_MODE_ROOT_KEY_PLUS_WRAPPER",(function(){return pc})),n.d(t,"KEY_MODE_WRAPPER_ONLY",(function(){return hc})),n.d(t,"SNApiService",(function(){return xa})),n.d(t,"findInArray",(function(){return o.g})),n.d(t,"isNullOrUndefined",(function(){return o.l})),n.d(t,"deepMerge",(function(){return o.e})),n.d(t,"extendArray",(function(){return o.f})),n.d(t,"removeFromIndex",(function(){return o.v})),n.d(t,"subtractFromArray",(function(){return o.x})),n.d(t,"arrayByDifference",(function(){return o.b})),n.d(t,"uniqCombineObjArrays",(function(){return o.z})),n.d(t,"greaterOfTwoDates",(function(){return o.i})),n.d(t,"getGlobalScope",(function(){return o.h})),n.d(t,"truncateHexString",(function(){return o.y})),n.d(t,"Uuid",(function(){return j})),n.d(t,"EncryptionIntents",(function(){return F})),n.d(t,"isLocalStorageIntent",(function(){return U})),n.d(t,"isFileIntent",(function(){return K})),n.d(t,"isDecryptedIntent",(function(){return V})),n.d(t,"intentRequiresEncryption",(function(){return B})),n.d(t,"ContentTypes",(function(){return c})),n.d(t,"ApplicationEvents",(function(){return g})),n.d(t,"Environments",(function(){return w})),n.d(t,"Platforms",(function(){return k})),n.d(t,"isEnvironmentWebOrDesktop",(function(){return S})),n.d(t,"isEnvironmentMobile",(function(){return _})),n.d(t,"platformFromString",(function(){return x})),n.d(t,"SyncEvents",(function(){return y})),n.d(t,"SNPureItemPayload",(function(){return qn})),n.d(t,"SNStorageItemPayload",(function(){return er})),n.d(t,"PayloadCollection",(function(){return f})),n.d(t,"CreateMaxPayloadFromAnyObject",(function(){return Ri})),n.d(t,"CreateSourcedPayloadFromObject",(function(){return Ni})),n.d(t,"PayloadSources",(function(){return Ln})),n.d(t,"isPayloadSourceRetrieved",(function(){return Nn})),n.d(t,"ProtocolVersions",(function(){return L})),n.d(t,"PayloadFormats",(function(){return Q})),n.d(t,"StorageKeys",(function(){return P})),n.d(t,"BaseMigration",(function(){return as})),n.d(t,"ProtectedActions",(function(){return Js})),n.d(t,"PrivilegeCredentials",(function(){return Qs})),n.d(t,"PRIVILEGE_SESSION_LENGTH_NONE",(function(){return Zs})),n.d(t,"PRIVILEGE_SESSION_LENGTH_FIVE_MINUTES",(function(){return Xs})),n.d(t,"PRIVILEGE_SESSION_LENGTH_ONE_HOUR",(function(){return ec})),n.d(t,"PRIVILEGE_SESSION_LENGTH_ONE_WEEK",(function(){return tc}));var r={};n.r(r),n.d(r,"Migration20200115",(function(){return Jo}));var i=n(0),a=n.n(i),o=n(1);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c={Item:"SF|Item",RootKey:"SN|RootKey|NoSync",ItemsKey:"SN|ItemsKey",EncryptedStorage:"SN|EncryptedStorage",Note:"Note",Tag:"Tag",SmartTag:"SN|SmartTag",Component:"SN|Component",Editor:"SN|Editor",ActionsExtension:"Extension",UserPrefs:"SN|UserPreferences",Privileges:"SN|Privileges",HistorySession:"SN|HistorySession",Theme:"SN|Theme",Mfa:"SF|MFA",ServerExtension:"SF|Extension",FilesafeCredentials:"SN|FileSafe|Credentials",FilesafeFileMetadata:"SN|FileSafe|FileMetadata",FilesafeIntegration:"SN|FileSafe|Integration",ExtensionRepo:"SN|ExtensionRepo"};function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var f=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.payloads,r=void 0===n?[]:n,i=t.source;u(this,e),this.source=i,this.payloadMap={},this.allPayloads=r;var a=!0,o=!1,s=void 0;try{for(var c,l=r[Symbol.iterator]();!(a=(c=l.next()).done);a=!0){var f=c.value;this.payloadMap[f.uuid]=f}}catch(e){o=!0,s=e}finally{try{a||null==l.return||l.return()}finally{if(o)throw s}}Object.freeze(this)}var t,n;return t=e,(n=[{key:"findPayload",value:function(e){return this.payloadMap[e]}},{key:"concat",value:function(t){var n=t.allPayloads.slice(),r=!0,i=!1,a=void 0;try{for(var s,c=this.allPayloads[Symbol.iterator]();!(r=(s=c.next()).done);r=!0){var u=s.value;Object(o.g)(t.allPayloads,"uuid",u.uuid)||n.push(u)}}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return new e({payloads:n,source:this.source})}},{key:"payloadsThatReferencePayload",value:function(e){for(var t=[],n=0,r=Object.keys(this.payloadMap);n<r.length;n++){var i=r[n],a=this.findPayload(i);a.errorDecrypting||Object(o.g)(a.content.references,"uuid",e.uuid)&&t.push(a)}return t}}])&&l(t.prototype,n),e}();function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var h=function(){function e(t){var n=t.collections;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.collections=n,Object.freeze(this)}var t,n;return t=e,(n=[{key:"collectionForSource",value:function(e){return this.collections.find((function(t){return t.source===e}))}}])&&p(t.prototype,n),e}();function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var v=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.keypath=t,this.operator=n,this.value=r,e.IsRecursiveOperator(this.operator)&&(this.value=this.value.map((function(t){return Array.isArray(t)?e.FromArray(t):t})))}var t,n;return t=e,(n=[{key:"CompoundPredicate",value:function(t){return new e("ignored","and",t)}},{key:"FromArray",value:function(t){return new e(t[0],t[1],t[2])}},{key:"ObjectSatisfiesPredicate",value:function(t,n){if(Array.isArray(n)&&(n=this.FromArray(n)),e.IsRecursiveOperator(n.operator)){if("and"===n.operator){var r=!0,i=!1,a=void 0;try{for(var o,s=n.value[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var c=o.value;if(!this.ObjectSatisfiesPredicate(t,c))return!1}}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return!0}if("or"===n.operator){var u=!0,l=!1,f=void 0;try{for(var p,h=n.value[Symbol.iterator]();!(u=(p=h.next()).done);u=!0){var d=p.value;if(this.ObjectSatisfiesPredicate(t,d))return!0}}catch(e){l=!0,f=e}finally{try{u||null==h.return||h.return()}finally{if(l)throw f}}return!1}}var v=n.value;"string"==typeof v&&v.includes(".ago")&&(v=this.DateFromString(v));var y=n.keypath.split(".").reduce((function(e,t){return e&&e[t]}),t),m=[!1,"",null,void 0,NaN];return void 0===y?"!="===n.operator?!m.includes(n.value):m.includes(n.value):"="===n.operator?Array.isArray(y)?JSON.stringify(y)===JSON.stringify(v):y===v:"!="===n.operator?Array.isArray(y)?JSON.stringify(y)!==JSON.stringify(v):y!==v:"<"===n.operator?y<v:">"===n.operator?y>v:"<="===n.operator?y<=v:">="===n.operator?y>=v:"startsWith"===n.operator?y.startsWith(v):"in"===n.operator?-1!==v.indexOf(y):"includes"===n.operator?this.resolveIncludesPredicate(y,v):"matches"===n.operator&&new RegExp(v).test(y)}},{key:"resolveIncludesPredicate",value:function(t,n){if("string"==typeof n)return t.includes(n);var r;r=Array.isArray(n)?e.FromArray(n):n;var i=!0,a=!1,o=void 0;try{for(var s,c=t[Symbol.iterator]();!(i=(s=c.next()).done);i=!0){var u=s.value;if(this.ObjectSatisfiesPredicate(u,r))return!0}}catch(e){a=!0,o=e}finally{try{i||null==c.return||c.return()}finally{if(a)throw o}}return!1}},{key:"ItemSatisfiesPredicate",value:function(t,n){return Array.isArray(n)&&(n=e.FromArray(n)),this.ObjectSatisfiesPredicate(t,n)}},{key:"ItemSatisfiesPredicates",value:function(e,t){var n=!0,r=!1,i=void 0;try{for(var a,o=t[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;if(!this.ItemSatisfiesPredicate(e,s))return!1}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}return!0}},{key:"DateFromString",value:function(e){var t=e.split("."),n=t[1],r=new Date,i=parseInt(t[0]);return"days"===n?r.setDate(r.getDate()-i):"hours"===n&&r.setHours(r.getHours()-i),r}},{key:"IsRecursiveOperator",value:function(e){return["and","or"].includes(e)}}])&&d(t,n),e}(),y={FullSyncCompleted:"sync:full-completed",SingleSyncCompleted:"sync:single-completed",DownloadFirstSyncCompleted:"sync:initial-completed",SyncTakingTooLong:"sync:taking-too-long",SyncError:"sync:error",SyncException:"sync:sync-exception",InvalidSession:"sync:invalid-session",MajorDataChange:"major-data-change",LocalDataIncrementalLoad:"local-data-incremental-load",EnterOutOfSync:"enter-out-of-sync",ExitOutOfSync:"exit-out-of-sync"};function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var g={SignedIn:2,SignedOut:3,CompletedSync:5,FailedSync:6,HighLatencySync:7,EnteredOutOfSync:8,ExitedOutOfSync:9,Started:10,Launched:11,KeyStatusChanged:12};function b(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var w={Web:1,Desktop:2,Mobile:3},k={Ios:1,Android:2,MacWeb:3,MacDesktop:4,WindowsWeb:5,WindowsDesktop:6,LinuxWeb:7,LinuxDesktop:8};function x(e){return{"mac-web":k.MacWeb,"mac-desktop":k.MacDesktop,"linux-web":k.LinuxWeb,"linux-desktop":k.LinuxDesktop,"windows-web":k.WindowsWeb,"windows-desktop":k.WindowsDesktop,ios:k.Ios,android:k.Android}[e]}function S(e){return e===w.Web||e===w.Desktop}function _(e){return e===w.Mobile}var $={LocalPasscode:1,AccountPassword:2,Biometric:3},P={RootKeyParams:"ROOT_KEY_PARAMS",WrappedRootKey:"WRAPPED_ROOT_KEY",RootKeyWrapperKeyParams:"ROOT_KEY_WRAPPER_KEY_PARAMS",Session:"session",User:"user",ServerHost:"server",LegacyUuid:"uuid",LastSyncToken:"syncToken",PaginationToken:"cursorToken",StorageObject:"storage",BiometricPrefs:"biometrics_prefs",MobilePasscodeTiming:"passcode_timing",PrivilegesExpirey:"SessionExpiresAtKey",PrivilegesSessionLength:"SessionLengthKey",SessionHistoryPersistable:"sessionHistory_persist",SessionHistoryRevisions:"sessionHistory_revisions",SessionHistoryOptimize:"sessionHistory_autoOptimize"};function O(e,t){return e?"".concat(e,"-").concat(t):t}function C(e){var t=e.leftContent,n=e.rightContent,r=e.keysToIgnore,i=e.appDataKeysToIgnore;if((t=JSON.parse(JSON.stringify(t))).appData){var a=t.appData["org.standardnotes.sn"];Object(o.s)(a,i),a?0===Object.keys(a).length&&delete t.appData:delete t.appData}if(Object(o.s)(t,r),(n=JSON.parse(JSON.stringify(n))).appData){var s=n.appData["org.standardnotes.sn"];Object(o.s)(s,i),s?0===Object.keys(s).length&&delete n.appData:delete n.appData}return Object(o.s)(n,r),JSON.stringify(t)===JSON.stringify(n)}function E(e,t,n){return n||(n=[]),!C({leftContent:e.content,rightContent:t.content,keysToIgnore:e.contentKeysToIgnoreWhenCheckingEquality().concat(n),appDataKeysToIgnore:e.appDatacontentKeysToIgnoreWhenCheckingEquality()})}function A(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function I(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var j=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r,i;return t=e,(n=[{key:"SetGenerators",value:function(e){var t=e.syncImpl,n=e.asyncImpl;this.syncUuidFunc=t,this.asyncUuidFunc=n}},{key:"canGenSync",value:function(){return!Object(o.l)(this.syncUuidFunc)}},{key:"GenerateUuid",value:(r=a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.syncUuidFunc){e.next=4;break}return e.abrupt("return",this.syncUuidFunc());case 4:return e.abrupt("return",this.asyncUuidFunc());case 5:case"end":return e.stop()}}),e,this)})),i=function(){var e=this,t=arguments;return new Promise((function(n,i){var a=r.apply(e,t);function o(e){A(a,n,i,o,s,"next",e)}function s(e){A(a,n,i,o,s,"throw",e)}o(void 0)}))},function(){return i.apply(this,arguments)})},{key:"GenerateUuidSynchronously",value:function(){return this.syncUuidFunc()}}])&&I(t,n),e}();function D(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function M(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function T(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var R=function(){function e(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.content={references:[],appData:M({},"org.standardnotes.sn",{})},this.resetLocalReferencePointers(),t){if(!t.isPayload)throw"Attempting to construct SNItem from non-payload object ".concat(t,".");this.updateFromPayload(t)}this.uuid||j.canGenSync()&&(this.uuid=j.GenerateUuidSynchronously())}var t,n,r,i;return t=e,(n=[{key:"payloadRepresentation",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.override;return Ri({object:this,override:t})}},{key:"populateDefaultContentValues",value:function(){this.errorDecrypting||this.deleted||(this.content.references||(this.content.references=[]),this.content.appData||(this.content.appData=M({},"org.standardnotes.sn",{})))}},{key:"initUUID",value:(r=a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.uuid){t.next=4;break}return t.next=3,e.GenerateUuid();case 3:this.uuid=t.sent;case 4:case"end":return t.stop()}}),t,this)})),i=function(){var e=this,t=arguments;return new Promise((function(n,i){var a=r.apply(e,t);function o(e){D(a,n,i,o,s,"next",e)}function s(e){D(a,n,i,o,s,"throw",e)}o(void 0)}))},function(){return i.apply(this,arguments)})},{key:"updateFromPayload",value:function(e){if(e){var t=[ne.Content],n=!0,r=!1,i=void 0;try{for(var a,s=e.fields()[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value;if(!Object(o.j)(this,c)){var u=e[c];if(t.includes(c)){var l=Object(o.a)(u||null);this[c]=l}else this[c]=u}}}catch(e){r=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw i}}this.content?this.mapContentToLocalProperties(this.content):!0===e.deleted&&this.handleDeletedContent(),this.dirtiedDate&&"string"==typeof this.dirtiedDate&&(this.dirtiedDate=new Date(this.dirtiedDate)),this.lastSyncBegan&&"string"==typeof this.lastSyncBegan&&(this.lastSyncBegan=new Date(this.lastSyncBegan)),this.lastSyncEnd&&"string"==typeof this.lastSyncEnd&&(this.lastSyncEnd=new Date(this.lastSyncEnd)),this.created_at?this.created_at=new Date(this.created_at):this.created_at=new Date,this.updated_at?this.updated_at=new Date(this.updated_at):this.updated_at=new Date(0),this._client_updated_at=null,this.populateDefaultContentValues()}}},{key:"mapContentToLocalProperties",value:function(e){}},{key:"collapseContent",value:function(){var e=this.structureParams();return Object(o.e)(this.content,e),e}},{key:"structureParams",value:function(){return this.getContentCopy()}},{key:"handleDeletedContent",value:function(){}},{key:"setDirty",value:function(e){var t=e.dirty,n=e.updateClientDate;if(!e.authorized)throw"Do not call setDirty directly. Use modelManager.setItemDirty";this.dirty=t,this.dirtiedDate=new Date,t&&n?this.client_updated_at=new Date:this.hasRawClientUpdatedAtValue()||(this.client_updated_at=new Date(this.updated_at)),this.collapseContent()}},{key:"updateLocalRelationships",value:function(){for(var e=this.content.references.map((function(e){return e.uuid})),t=0,n=Object.keys(this._referencedItems);t<n.length;t++){var r=n[t],i=this._referencedItems[r];e.includes(i.uuid)||(delete this._referencedItems[r],i.setIsNoLongerReferencedBy(this))}}},{key:"addItemAsRelationship",value:function(e){if(e.setIsBeingReferencedBy(this),this._referencedItems[e.uuid]||(this._referencedItems[e.uuid]=e),!this.hasRelationshipWithItem(e)){var t=this.content.references||[];t.push({uuid:e.uuid,content_type:e.content_type}),this.content.references=t}}},{key:"removeItemAsRelationship",value:function(e){e.setIsNoLongerReferencedBy(this),this.removeReferenceWithUuid(e.uuid),delete this._referencedItems[e.uuid]}},{key:"setIsBeingReferencedBy",value:function(e){this._referencingItems[e.uuid]||(this._referencingItems[e.uuid]=e)}},{key:"setIsNoLongerReferencedBy",value:function(e){delete this._referencingItems[e.uuid]}},{key:"removeReferenceWithUuid",value:function(e){var t=this.content.references||[];t=t.filter((function(t){return t.uuid!==e})),this.content.references=t,delete this._referencedItems[e]}},{key:"hasRelationshipWithItem",value:function(e){var t=this.content.references.find((function(t){return t.uuid===e.uuid}));return!Object(o.l)(t)}},{key:"isBeingRemovedLocally",value:function(){for(var e=0,t=Object.keys(this._referencedItems);e<t.length;e++){var n=t[e];this._referencedItems[n].setIsNoLongerReferencedBy(this)}}},{key:"resetLocalReferencePointers",value:function(){this._referencingItems={},this._referencedItems={}}},{key:"didCompleteMapping",value:function(e){}},{key:"setDomainDataItem",value:function(e,t,n){if(n){if(!this.errorDecrypting){this.content.appData||(this.content.appData={});var r=this.content.appData[n];r||(r={}),r[e]=t,this.content.appData[n]=r}}else console.error("DEFAULT_APP_DOMAIN needs to be set.")}},{key:"getDomainDataItem",value:function(e,t){if(t){if(!this.errorDecrypting){this.content.appData||(this.content.appData={});var n=this.content.appData[t];return n?n[e]:null}}else console.error("DEFAULT_APP_DOMAIN needs to be set.")}},{key:"setAppDataItem",value:function(e,t){this.setDomainDataItem(e,t,"org.standardnotes.sn")}},{key:"getAppDataItem",value:function(e){return this.getDomainDataItem(e,"org.standardnotes.sn")}},{key:"hasRawClientUpdatedAtValue",value:function(){return null!=this.getAppDataItem("client_updated_at")}},{key:"contentKeysToIgnoreWhenCheckingEquality",value:function(){return["conflict_of"]}},{key:"appDatacontentKeysToIgnoreWhenCheckingEquality",value:function(){return["client_updated_at"]}},{key:"getContentCopy",value:function(){return JSON.parse(JSON.stringify(this.content))}},{key:"strategyWhenConflictingWithItem",value:function(e){var t=e.item;return this.errorDecrypting?Fr.KeepLeftDuplicateRight:this.isSingleton?Fr.KeepLeft:this.deleted||t.deleted?Fr.KeepRight:E(this,t)?E(this,t,["references"])?Fr.KeepLeftDuplicateRight:Fr.KeepLeftMergeRefs:Fr.KeepRight}},{key:"isItemContentEqualWith",value:function(e){return C({leftContent:this.content,rightContent:e.content,keysToIgnore:this.contentKeysToIgnoreWhenCheckingEquality(),appDataKeysToIgnore:this.appDatacontentKeysToIgnoreWhenCheckingEquality()})}},{key:"satisfiesPredicate",value:function(e){return v.ItemSatisfiesPredicate(this,e)}},{key:"createdAtString",value:function(){return this.dateToLocalizedString(this.created_at)}},{key:"updatedAtString",value:function(){return this.dateToLocalizedString(this.client_updated_at)}},{key:"updatedAtTimestamp",value:function(){return this.updated_at.getTime()}},{key:"dateToLocalizedString",value:function(t){if("undefined"!=typeof Intl&&Intl.DateTimeFormat){if(!e.sharedDateFormatter){var n=navigator.languages&&navigator.languages.length?navigator.languages[0]:navigator.language;e.sharedDateFormatter=new Intl.DateTimeFormat(n,{year:"numeric",month:"short",day:"2-digit",weekday:"long",hour:"2-digit",minute:"2-digit"})}return e.sharedDateFormatter.format(t)}return t.toDateString()+" "+t.toLocaleTimeString()}},{key:"isItem",get:function(){return!0}},{key:"referencedItemsCount",get:function(){return Object.keys(this._referencedItems).length}},{key:"referencingItemsCount",get:function(){return Object.keys(this._referencingItems).length}},{key:"allReferencingItems",get:function(){var e=this;return Object.keys(this._referencingItems).map((function(t){return e._referencingItems[t]}))}},{key:"pinned",get:function(){return this.getAppDataItem("pinned")}},{key:"archived",get:function(){return this.getAppDataItem("archived")}},{key:"locked",get:function(){return this.getAppDataItem("locked")}},{key:"client_updated_at",get:function(){if(!this._client_updated_at){var e=this.getAppDataItem("client_updated_at");this._client_updated_at=e?new Date(e):new Date(this.updated_at)}return this._client_updated_at},set:function(e){this._client_updated_at=e,this.setAppDataItem("client_updated_at",e)}},{key:"neverSynced",get:function(){return!this.updated_at||0===this.updated_at.getTime()}},{key:"isSingleton",get:function(){return!1}},{key:"singletonPredicate",get:function(){throw"Must override SNItem.singletonPredicate"}},{key:"singletonStrategy",get:function(){return 1}}])&&T(t.prototype,n),e}(),L={V000Base64Decrypted:"000",V001:"001",V002:"002",V003:"003",V004:"004",VersionLength:3};function N(e,t){return Number(e)-Number(t)}var F={Sync:0,SyncDecrypted:1,LocalStorageEncrypted:2,LocalStorageDecrypted:3,LocalStoragePreferEncrypted:4,FileEncrypted:5,FileDecrypted:6,FilePreferEncrypted:7};function U(e){return e===F.LocalStorageEncrypted||e===F.LocalStorageDecrypted||e===F.LocalStoragePreferEncrypted}function K(e){return e===F.FileEncrypted||e===F.FileDecrypted||e===F.FilePreferEncrypted}function V(e){return e===F.SyncDecrypted||e===F.LocalStorageDecrypted||e===F.FileDecrypted}function B(e){return e===F.Sync||e===F.LocalStorageEncrypted||e===F.FileEncrypted}function H(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function z(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function W(e,t,n){return t&&z(e.prototype,t),n&&z(e,n),e}var q=function(){var e,t;function n(e){var t=e.uuid,r=e.content;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),this.uuid=t,this.content=Object(o.a)(r),this.content.version||(this.content.dataAuthenticationKey?this.content.version=L.V002:this.content.version=L.V001),!this.content.version)throw"Attempting to create key without version.";Object.freeze(this)}return W(n,null,[{key:"Create",value:(e=a.a.mark((function e(t){var r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.uuid,i=t.content,r){e.next=5;break}return e.next=4,j.GenerateUuid();case 4:r=e.sent;case 5:return e.abrupt("return",new n({uuid:r,content:i}));case 6:case"end":return e.stop()}}),e)})),t=function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){H(a,r,i,o,s,"next",e)}function s(e){H(a,r,i,o,s,"throw",e)}o(void 0)}))},function(e){return t.apply(this,arguments)})}]),W(n,[{key:"compare",value:function(e){if(this.version!==e.version)return!1;var t=this.serverPassword&&e.serverPassword;return this.masterKey===e.masterKey&&(!t||this.serverPassword===e.serverPassword)}},{key:"getPersistableValue",value:function(){var e={version:this.version};return this.masterKey&&(e.masterKey=this.masterKey),this.dataAuthenticationKey&&(e.dataAuthenticationKey=this.dataAuthenticationKey),e}},{key:"version",get:function(){return this.content.version}},{key:"isRootKey",get:function(){return!0}},{key:"itemsKey",get:function(){return this.masterKey}},{key:"masterKey",get:function(){return this.content.masterKey}},{key:"serverPassword",get:function(){return this.content.serverPassword}},{key:"dataAuthenticationKey",get:function(){return this.content.dataAuthenticationKey}}],[{key:"contentType",value:function(){return c.RootKey}}]),n}();function G(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Y(e){return new J(e)}var J=function(){function e(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!Object(o.m)(t)||t.isKeyParamsObject)throw"Attempting to construct root key params with non-object";this.content=t}var t,n;return t=e,(n=[{key:"getPortableValue",value:function(){return N(this.version,L.V003)>=0?Object(o.r)(this.content,["pw_cost"]):this.content}},{key:"isKeyParamsObject",get:function(){return!0}},{key:"kdfIterations",get:function(){return this.content.pw_cost}},{key:"seed",get:function(){return this.content.pw_nonce}},{key:"identifier",get:function(){return this.content.identifier||this.content.email}},{key:"salt",get:function(){return this.content.pw_salt}},{key:"version",get:function(){return this.content.version}}])&&G(t.prototype,n),e}(),Q={EncryptedString:0,DecryptedBareObject:1,DecryptedBase64String:2},Z=n(6);function X(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function ee(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){X(a,r,i,o,s,"next",e)}function s(e){X(a,r,i,o,s,"throw",e)}o(void 0)}))}}function te(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var ne={Uuid:"uuid",ContentType:"content_type",ItemsKeyId:"items_key_id",EncItemKey:"enc_item_key",Content:"content",CreatedAt:"created_at",UpdatedAt:"updated_at",Deleted:"deleted",Legacy003AuthHash:"auth_hash",Legacy003AuthParams:"auth_params",Dirty:"dirty",DirtiedDate:"dirtiedDate",WaitingForKey:"waitingForKey",ErrorDecrypting:"errorDecrypting",ErrorDecryptingChanged:"errorDecryptingValueChanged",Dummy:"dummy",LastSyncBegan:"lastSyncBegan",LastSyncEnd:"lastSyncEnd"};function re(e){return(re="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ie(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ae(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function oe(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){ae(a,r,i,o,s,"next",e)}function s(e){ae(a,r,i,o,s,"throw",e)}o(void 0)}))}}function se(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ce(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ue(e,t){return!t||"object"!==re(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function le(e,t,n){return(le="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=fe(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function fe(e){return(fe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function pe(e,t){return(pe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var he="00000000000000000000000000000000",de=function(e){function t(){return se(this,t),ue(this,fe(t).apply(this,arguments))}var n,r,i,o,s,c,u,l,f,p,h;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&pe(e,t)}(t,e),n=t,r=[{key:"generateNewItemsKeyContent",value:(h=oe(a.a.mark((function e(){var t,n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=3,this.crypto.generateRandomKey(256);case 3:return t=e.sent,n=this.constructor.versionString(),e.abrupt("return",{itemsKey:t,version:n});case 6:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"createRootKey",value:(p=oe(a.a.mark((function e(t){var n,r,i,o,s,c,u;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.identifier,r=t.password,i=this.constructor.pwCost(),e.next=4,this.crypto.generateRandomKey(128);case 4:return o=e.sent,e.next=7,this.crypto.unsafeSha1(n+"SN"+o);case 7:return s=e.sent,e.next=10,this.deriveKey({password:r,pwSalt:s,pwCost:i});case 10:return c=e.sent,u=Y({email:n,pw_cost:i,pw_nonce:o,pw_salt:s,version:L.V001}),e.abrupt("return",{key:c,keyParams:u});case 13:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"computeRootKey",value:(f=oe(a.a.mark((function e(t){var n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.password,(r=t.keyParams).isKeyParamsObject){e.next=3;break}throw"Attempting to compute root key with non params object.";case 3:return e.next=5,this.deriveKey({password:n,pwSalt:r.salt,pwCost:r.kdfIterations});case 5:return i=e.sent,e.abrupt("return",i);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"decryptString",value:(l=oe(a.a.mark((function e(t,n){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.crypto.aes256CbcDecrypt(t,he,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return l.apply(this,arguments)})},{key:"encryptString",value:(u=oe(a.a.mark((function e(t,n){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.crypto.aes256CbcEncrypt(t,he,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"generateEncryptionParameters",value:(c=oe(a.a.mark((function e(n){var r,i,o,s,c,u,l,f,p,h,d;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.payload,o=n.key,(s=n.format)!==Q.DecryptedBareObject&&s!==Q.DecryptedBase64String){e.next=3;break}return e.abrupt("return",le(fe(t.prototype),"generateEncryptionParameters",this).call(this,{payload:i,key:o,format:s}));case 3:if(s===Q.EncryptedString){e.next=5;break}throw"Unsupport format for generateEncryptionParameters ".concat(s);case 5:if(o&&o.itemsKey){e.next=7;break}throw"Attempting to generateEncryptionParameters with no itemsKey.";case 7:return e.next=9,this.crypto.generateRandomKey(512);case 9:return c=e.sent,e.next=12,this.encryptString(c,o.itemsKey);case 12:return u=e.sent,e.next=15,this.firstHalfOfKey(c);case 15:return l=e.sent,e.next=18,this.secondHalfOfKey(c);case 18:return f=e.sent,e.next=21,this.encryptString(JSON.stringify(i.content),l);case 21:return p=e.sent,h=o.version+p,e.next=25,this.crypto.hmac256(h,f);case 25:return d=e.sent,e.abrupt("return",Ki((ie(r={},ne.ItemsKeyId,o.isItemsKey?o.uuid:null),ie(r,ne.Content,h),ie(r,ne.EncItemKey,u),ie(r,ne.Legacy003AuthHash,d),r)));case 27:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"generateDecryptedParameters",value:(s=oe(a.a.mark((function e(n){var r,i,o,s,c,u,l,f,p,h,d,v,y,m;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.encryptedParameters,i=n.key,(o=r.getContentFormat())!==Q.DecryptedBareObject&&o!==Q.DecryptedBase64String){e.next=4;break}return e.abrupt("return",le(fe(t.prototype),"generateDecryptedParameters",this).call(this,{encryptedParameters:r,key:i}));case 4:if(r.enc_item_key){e.next=7;break}return console.error("Missing item encryption key, skipping decryption."),e.abrupt("return",r);case 7:if(s=r.enc_item_key,s=L.V001+s,!(c=this.encryptionComponentsFromString(s,i.itemsKey)).uuid||c.uuid===r.uuid){e.next=13;break}return console.error("Item key params UUID does not match item UUID"),e.abrupt("return",Vi({encryptionParameters:r,override:(u={},ie(u,ne.ErrorDecrypting,!0),ie(u,ne.ErrorDecryptingChanged,!r.errorDecrypting),u)}));case 13:return e.next=15,this.decryptString(c.contentCiphertext,c.encryptionKey);case 15:if(l=e.sent){e.next=19;break}return console.error("Error decrypting parameters",r),e.abrupt("return",Vi({encryptionParameters:r,override:(f={},ie(f,ne.ErrorDecrypting,!0),ie(f,ne.ErrorDecryptingChanged,!r.errorDecrypting),f)}));case 19:return e.next=21,this.firstHalfOfKey(l);case 21:if(p=e.sent,!(h=this.encryptionComponentsFromString(r.content,p)).uuid||h.uuid===r.uuid){e.next=25;break}return e.abrupt("return",Vi({encryptionParameters:r,override:(d={},ie(d,ne.ErrorDecrypting,!0),ie(d,ne.ErrorDecryptingChanged,!r.errorDecrypting),d)}));case 25:return e.next=27,this.decryptString(h.contentCiphertext,h.encryptionKey);case 27:if(v=e.sent){e.next=32;break}return e.abrupt("return",Vi({encryptionParameters:r,override:(y={},ie(y,ne.ErrorDecrypting,!0),ie(y,ne.ErrorDecryptingChanged,!r.errorDecrypting),y)}));case 32:return e.abrupt("return",Vi({encryptionParameters:r,override:(m={},ie(m,ne.Content,JSON.parse(v)),ie(m,ne.ErrorDecrypting,!1),ie(m,ne.ErrorDecryptingChanged,!0===r.errorDecrypting),ie(m,ne.WaitingForKey,!1),m)}));case 33:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"encryptionComponentsFromString",value:function(e,t){var n=e.substring(0,L.VersionLength);return{contentCiphertext:e.substring(L.VersionLength,e.length),encryptionVersion:n,encryptionKey:t}}},{key:"deriveKey",value:(o=oe(a.a.mark((function e(){var t,n,r,i,o,s,c,u=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=u.length>0&&void 0!==u[0]?u[0]:{},n=t.password,r=t.pwSalt,i=t.pwCost,e.next=3,this.crypto.pbkdf2(n,r,i,512);case 3:return o=e.sent,e.next=6,this.splitKey({key:o,numParts:2});case 6:return s=e.sent,e.next=9,q.Create({content:{serverPassword:s[0],masterKey:s[1],version:this.constructor.versionString()}});case 9:return c=e.sent,e.abrupt("return",c);case 11:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})}],i=[{key:"pwCost",value:function(){return 3e3}},{key:"versionString",value:function(){return L.V001}}],r&&ce(n.prototype,r),i&&ce(n,i),t}(function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.crypto=t}var t,n,r,i,o,s,c,u,l;return t=e,(n=[{key:"firstHalfOfKey",value:(l=ee(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t.substring(0,t.length/2));case 1:case"end":return e.stop()}}),e)}))),function(e){return l.apply(this,arguments)})},{key:"secondHalfOfKey",value:(u=ee(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t.substring(t.length/2,t.length));case 1:case"end":return e.stop()}}),e)}))),function(e){return u.apply(this,arguments)})},{key:"splitKey",value:(c=ee(a.a.mark((function e(t){var n,r,i,o,s,c,u;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(n=t.key,r=t.numParts,i=n.length,o=i/r,s=[],c=0;c<r;c++)u=n.slice(o*c,o*(c+1)),s.push(u);return e.abrupt("return",s);case 6:case"end":return e.stop()}}),e)}))),function(e){return c.apply(this,arguments)})},{key:"generateNewItemsKeyContent",value:(s=ee(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw"Must override generateNewItemsKeyContent";case 1:case"end":return e.stop()}}),e)}))),function(){return s.apply(this,arguments)})},{key:"createItemsKey",value:(o=ee(a.a.mark((function e(){var t,n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.generateNewItemsKeyContent();case 2:return t=e.sent,n=Ri({object:{content:t}}),r=new Xe(n),e.next=7,r.initUUID();case 7:return e.abrupt("return",r);case 8:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"generateEncryptionParameters",value:(i=ee(a.a.mark((function e(t){var n,r,i,o,s;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.payload,t.key,(r=t.format)!==Q.DecryptedBareObject){e.next=5;break}return e.abrupt("return",Ki({content:n.content}));case 5:if(r!==Q.DecryptedBase64String){e.next=14;break}return i=JSON.stringify(n.content),e.next=9,Object(Z.base64Encode)(i);case 9:return o=e.sent,s=L.V000Base64Decrypted+o,e.abrupt("return",Ki({content:s}));case 14:throw"Must override generateEncryptionParameters to handle format ".concat(r,".");case 15:case"end":return e.stop()}}),e)}))),function(e){return i.apply(this,arguments)})},{key:"generateDecryptedParameters",value:(r=ee(a.a.mark((function e(t){var n,r,i,o,s;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.encryptedParameters,t.key,n.isEncryptionParameters){e.next=3;break}throw"Atempting to generate decrypted parameters from non-parameters object.";case 3:if((r=n.getContentFormat())!==Q.DecryptedBareObject){e.next=8;break}return e.abrupt("return",Ki(n));case 8:if(r!==Q.DecryptedBase64String){e.next=23;break}return i=n.content.substring(L.VersionLength,n.content.length),e.prev=10,e.next=13,Object(Z.base64Decode)(i);case 13:s=e.sent,o=JSON.parse(s),e.next=20;break;case 17:e.prev=17,e.t0=e.catch(10),o=n.content;case 20:return e.abrupt("return",Vi({encryptionParameters:n,override:{content:o}}));case 23:throw"Must override generateDecryptedParameters to handle format ".concat(r,".");case 24:case"end":return e.stop()}}),e,null,[[10,17]])}))),function(e){return r.apply(this,arguments)})}])&&te(t.prototype,n),e}());function ve(e){return(ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ye(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function me(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function ge(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){me(a,r,i,o,s,"next",e)}function s(e){me(a,r,i,o,s,"throw",e)}o(void 0)}))}}function be(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function we(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ke(e,t){return!t||"object"!==ve(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function xe(e,t,n){return(xe="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Se(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function Se(e){return(Se=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _e(e,t){return(_e=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var $e=function(e){function t(){return be(this,t),ke(this,Se(t).apply(this,arguments))}var n,r,i,o,s,c,u,l,f,p,h,d,v;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_e(e,t)}(t,e),n=t,r=[{key:"generateNewItemsKeyContent",value:(v=ge(a.a.mark((function e(){var t,n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=256,e.next=3,this.crypto.generateRandomKey(t);case 3:return n=e.sent,e.next=6,this.crypto.generateRandomKey(t);case 6:return r=e.sent,i=this.constructor.versionString(),e.abrupt("return",{itemsKey:n,dataAuthenticationKey:r,version:i});case 9:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{key:"createRootKey",value:(d=ge(a.a.mark((function e(t){var n,r,i,o,s,c,u;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.identifier,r=t.password,i=this.constructor.pwCost(),e.next=4,this.crypto.generateRandomKey(128);case 4:return o=e.sent,e.next=7,this.crypto.unsafeSha1(n+":"+o);case 7:return s=e.sent,e.next=10,this.deriveKey({password:r,pwSalt:s,pwCost:i});case 10:return c=e.sent,u=Y({email:n,pw_cost:i,pw_nonce:o,pw_salt:s,version:L.V002}),e.abrupt("return",{key:c,keyParams:u});case 13:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"computeRootKey",value:(h=ge(a.a.mark((function e(t){var n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.password,(r=t.keyParams).isKeyParamsObject){e.next=3;break}throw"Attempting to compute root key with non params object.";case 3:return e.next=5,this.deriveKey({password:n,pwSalt:r.salt,pwCost:r.kdfIterations});case 5:return i=e.sent,e.abrupt("return",i);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"decryptString",value:(p=ge(a.a.mark((function e(t,n,r){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.crypto.aes256CbcDecrypt(t,r,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return p.apply(this,arguments)})},{key:"encryptString",value:(f=ge(a.a.mark((function e(t,n,r){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.crypto.aes256CbcEncrypt(t,r,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return f.apply(this,arguments)})},{key:"encryptTextParams",value:(l=ge(a.a.mark((function e(t,n,r,i,o){var s,c,u,l,f;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.crypto.generateRandomKey(128);case 2:return s=e.sent,e.next=5,this.encryptString(t,n,s);case 5:return c=e.sent,u=[o,i,s,c].join(":"),e.next=9,this.crypto.hmac256(u,r);case 9:return l=e.sent,f=[o,l,i,s,c].join(":"),e.abrupt("return",f);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return l.apply(this,arguments)})},{key:"decryptTextParams",value:(u=ge(a.a.mark((function e(t){var n,r,i,o,s,c,u;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.ciphertextToAuth,r=t.contentCiphertext,i=t.encryptionKey,o=t.iv,s=t.authHash,c=t.authKey,i){e.next=3;break}throw"Attempting to decryptTextParams with null encryptionKey";case 3:return e.next=5,this.crypto.hmac256(n,c);case 5:if(u=e.sent,!1!==this.crypto.timingSafeEqual(s,u)){e.next=9;break}return console.error("Auth hash does not match, returning null."),e.abrupt("return",null);case 9:return e.abrupt("return",this.decryptString(r,i,o));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"generateEncryptionParameters",value:(c=ge(a.a.mark((function e(n){var r,i,o,s,c,u,l,f,p;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.payload,o=n.key,(s=n.format)!==Q.DecryptedBareObject&&s!==Q.DecryptedBase64String){e.next=3;break}return e.abrupt("return",xe(Se(t.prototype),"generateEncryptionParameters",this).call(this,{payload:i,key:o,format:s}));case 3:if(s===Q.EncryptedString){e.next=5;break}throw"Unsupport format for generateEncryptionParameters ".concat(s);case 5:if(o&&o.itemsKey){e.next=7;break}throw"Attempting to generateEncryptionParameters with no itemsKey.";case 7:return e.next=9,this.crypto.generateRandomKey(512);case 9:return c=e.sent,e.next=12,this.encryptTextParams(c,o.itemsKey,o.dataAuthenticationKey,i.uuid,o.version);case 12:return u=e.sent,e.next=15,this.firstHalfOfKey(c);case 15:return l=e.sent,e.next=18,this.secondHalfOfKey(c);case 18:return f=e.sent,e.next=21,this.encryptTextParams(JSON.stringify(i.content),l,f,i.uuid,o.version);case 21:return p=e.sent,e.abrupt("return",Ki((ye(r={},ne.ItemsKeyId,o.isItemsKey?o.uuid:null),ye(r,ne.Content,p),ye(r,ne.EncItemKey,u),r)));case 23:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"generateDecryptedParameters",value:(s=ge(a.a.mark((function e(n){var r,i,o,s,c,u,l,f,p,h,d,v,y,m;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.encryptedParameters,i=n.key,(o=r.getContentFormat())!==Q.DecryptedBareObject&&o!==Q.DecryptedBase64String){e.next=4;break}return e.abrupt("return",xe(Se(t.prototype),"generateDecryptedParameters",this).call(this,{encryptedParameters:r,key:i}));case 4:if(r.enc_item_key){e.next=7;break}return console.error("Missing item encryption key, skipping decryption."),e.abrupt("return",r);case 7:if(i&&i.itemsKey){e.next=9;break}throw"Attempting to generateDecryptedParameters with no itemsKey.";case 9:return s=r.enc_item_key,c=this.encryptionComponentsFromString(s,i.itemsKey,i.dataAuthenticationKey),e.next=13,this.decryptTextParams(c);case 13:if(u=e.sent){e.next=17;break}return console.error("Error decrypting item_key parameters",r),e.abrupt("return",Vi({encryptionParameters:r,override:(l={},ye(l,ne.ErrorDecrypting,!0),ye(l,ne.ErrorDecryptingChanged,!r.errorDecrypting),l)}));case 17:return e.next=19,this.firstHalfOfKey(u);case 19:return f=e.sent,e.next=22,this.secondHalfOfKey(u);case 22:return p=e.sent,h=this.encryptionComponentsFromString(r.content,f,p),e.next=26,this.decryptTextParams(h);case 26:if(d=e.sent){e.next=31;break}return e.abrupt("return",Vi({encryptionParameters:r,override:(v={},ye(v,ne.ErrorDecrypting,!0),ye(v,ne.ErrorDecryptingChanged,!r.errorDecrypting),v)}));case 31:return e.prev=31,e.t0=JSON,e.next=35,Object(Z.base64Decode)(h.authParams);case 35:e.t1=e.sent,m=e.t0.parse.call(e.t0,e.t1),e.next=41;break;case 39:e.prev=39,e.t2=e.catch(31);case 41:return e.abrupt("return",Vi({encryptionParameters:r,override:(y={},ye(y,ne.Content,JSON.parse(d)),ye(y,ne.Legacy003AuthParams,m),ye(y,ne.ErrorDecrypting,!1),ye(y,ne.ErrorDecryptingChanged,!0===r.errorDecrypting),ye(y,ne.WaitingForKey,!1),y)}));case 42:case"end":return e.stop()}}),e,this,[[31,39]])}))),function(e){return s.apply(this,arguments)})},{key:"deriveKey",value:(o=ge(a.a.mark((function e(){var t,n,r,i,o,s,c,u=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=u.length>0&&void 0!==u[0]?u[0]:{},n=t.password,r=t.pwSalt,(i=t.pwCost)&&r&&n){e.next=3;break}throw"Attempting to 003.deriveKey with invalid parameters";case 3:return e.next=5,this.crypto.pbkdf2(n,r,i,768);case 5:return o=e.sent,e.next=8,this.splitKey({key:o,numParts:3});case 8:return s=e.sent,e.next=11,q.Create({content:{serverPassword:s[0],masterKey:s[1],dataAuthenticationKey:s[2],version:this.constructor.versionString()}});case 11:return c=e.sent,e.abrupt("return",c);case 13:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"encryptionComponentsFromString",value:function(e,t,n){var r=e.split(":");return{encryptionVersion:r[0],authHash:r[1],uuid:r[2],iv:r[3],contentCiphertext:r[4],ciphertextToAuth:[r[0],r[2],r[3],r[4]].join(":"),encryptionKey:t,authKey:n}}}],i=[{key:"pwCost",value:function(){return 3e3}},{key:"versionString",value:function(){return L.V002}}],r&&we(n.prototype,r),i&&we(n,i),t}(de);function Pe(e){return(Pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Oe(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Ce(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Oe(a,r,i,o,s,"next",e)}function s(e){Oe(a,r,i,o,s,"throw",e)}o(void 0)}))}}function Ee(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ae(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ie(e,t){return!t||"object"!==Pe(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function je(e){return(je=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function De(e,t){return(De=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Me=function(e){function t(){return Ee(this,t),Ie(this,je(t).apply(this,arguments))}var n,r,i,o,s,c;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&De(e,t)}(t,e),n=t,r=[{key:"computeRootKey",value:(c=Ce(a.a.mark((function e(t){var n,r,i,o,s,c;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.password,(r=t.keyParams).isKeyParamsObject){e.next=3;break}throw"Attempting to compute root key with non params object.";case 3:return i=this.constructor.pwCost(),o=this.constructor.versionString(),e.next=7,this.generateSalt(r.identifier,o,i,r.seed);case 7:return s=e.sent,e.next=10,this.deriveKey({password:n,pwSalt:s,pwCost:i});case 10:return c=e.sent,e.abrupt("return",c);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"createRootKey",value:(s=Ce(a.a.mark((function e(t){var n,r,i,o,s,c,u,l;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.identifier,r=t.password,i=this.constructor.versionString(),o=this.constructor.pwCost(),e.next=5,this.crypto.generateRandomKey(256);case 5:return s=e.sent,e.next=8,this.generateSalt(n,i,o,s);case 8:return c=e.sent,e.next=11,this.deriveKey({password:r,pwSalt:c,pwCost:o});case 11:return u=e.sent,l=Y({identifier:n,pw_cost:o,pw_nonce:s,version:i}),e.abrupt("return",{key:u,keyParams:l});case 14:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"generateSalt",value:(o=Ce(a.a.mark((function e(t,n,r,i){var o;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.crypto.sha256([t,"SF",n,r,i].join(":"));case 2:return o=e.sent,e.abrupt("return",o);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return o.apply(this,arguments)})}],i=[{key:"pwCost",value:function(){return 11e4}},{key:"versionString",value:function(){return L.V003}}],r&&Ae(n.prototype,r),i&&Ae(n,i),t}($e);function Te(e){return(Te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Re(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Le(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Ne(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Le(a,r,i,o,s,"next",e)}function s(e){Le(a,r,i,o,s,"throw",e)}o(void 0)}))}}function Fe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ue(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ke(e,t){return!t||"object"!==Te(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Ve(e,t,n){return(Ve="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Be(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function Be(e){return(Be=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function He(e,t){return(He=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ze=function(e){function t(){return Fe(this,t),Ke(this,Be(t).apply(this,arguments))}var n,r,i,s,c,u,l,f,p,h,d,v,y;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&He(e,t)}(t,e),n=t,r=[{key:"generateNewItemsKeyContent",value:(y=Ne(a.a.mark((function e(){var t,n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.crypto.generateRandomKey(256);case 2:return t=e.sent,n=this.constructor.versionString(),e.abrupt("return",{itemsKey:t,version:n});case 5:case"end":return e.stop()}}),e,this)}))),function(){return y.apply(this,arguments)})},{key:"generateSalt",value:(v=Ne(a.a.mark((function e(t){var n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.identifier,r=t.seed,e.next=3,this.crypto.sha256([n,r].join(":"));case 3:return i=e.sent,e.abrupt("return",Object(o.y)(i,128));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"computeRootKey",value:(d=Ne(a.a.mark((function e(t){var n,r,i,o;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.password,(r=t.keyParams).isKeyParamsObject){e.next=3;break}throw"Attempting to compute root key with non params object.";case 3:return e.next=5,this.generateSalt({identifier:r.identifier,seed:r.seed});case 5:return i=e.sent,e.next=8,this.deriveKey({password:n,salt:i,iterations:this.constructor.kdfIterations()});case 8:return o=e.sent,e.abrupt("return",o);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"createRootKey",value:(h=Ne(a.a.mark((function e(t){var n,r,i,o,s,c,u,l;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.identifier,r=t.password,i=this.constructor.versionString(),o=this.constructor.kdfIterations(),e.next=5,this.crypto.generateRandomKey(256);case 5:return s=e.sent,e.next=8,this.generateSalt({identifier:n,seed:s});case 8:return c=e.sent,e.next=11,this.deriveKey({password:r,salt:c,iterations:o});case 11:return u=e.sent,l=Y({identifier:n,pw_cost:o,pw_nonce:s,version:i}),e.abrupt("return",{key:u,keyParams:l});case 14:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"encryptString",value:(p=Ne(a.a.mark((function e(t){var n,r,i,o;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.plaintext,r=t.rawKey,i=t.nonce,o=t.aad,i){e.next=3;break}throw"encryptString null nonce";case 3:if(r){e.next=5;break}throw"encryptString null rawKey";case 5:return e.abrupt("return",this.crypto.xchacha20Encrypt(n,i,r,JSON.stringify(o)));case 6:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"decryptString",value:(f=Ne(a.a.mark((function e(t){var n,r,i,o;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.ciphertext,r=t.rawKey,i=t.nonce,o=t.aad,e.abrupt("return",this.crypto.xchacha20Decrypt(n,i,r,JSON.stringify(o)));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"generateEncryptedProtocolString",value:(l=Ne(a.a.mark((function e(t){var n,r,i,o,s,c,u;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.plaintext,r=t.rawKey,i=t.itemUuid,e.next=3,this.crypto.generateRandomKey(192);case 3:return o=e.sent,s=this.constructor.versionString(),e.next=7,this.encryptString({plaintext:n,rawKey:r,nonce:o,aad:{u:i,v:s}});case 7:return c=e.sent,u=[s,o,c].join(":"),e.abrupt("return",u);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"generateEncryptionParameters",value:(u=Ne(a.a.mark((function e(n){var r,i,o,s,c,u,l,f;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.payload,o=n.key,(s=n.format)!==Q.DecryptedBareObject&&s!==Q.DecryptedBase64String){e.next=3;break}return e.abrupt("return",Ve(Be(t.prototype),"generateEncryptionParameters",this).call(this,{payload:i,key:o,format:s}));case 3:if(s===Q.EncryptedString){e.next=5;break}throw"Unsupport format for generateEncryptionParameters ".concat(s);case 5:if(o&&o.itemsKey){e.next=7;break}throw"Attempting to generateEncryptionParameters with no itemsKey.";case 7:return e.next=9,this.crypto.generateRandomKey(256);case 9:return c=e.sent,u=JSON.stringify(i.content),e.next=13,this.generateEncryptedProtocolString({plaintext:u,rawKey:c});case 13:return l=e.sent,e.next=16,this.generateEncryptedProtocolString({plaintext:c,rawKey:o.itemsKey});case 16:return f=e.sent,e.abrupt("return",Ki((Re(r={},ne.ItemsKeyId,o.isItemsKey?o.uuid:null),Re(r,ne.Content,l),Re(r,ne.EncItemKey,f),r)));case 18:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"generateDecryptedParameters",value:(c=Ne(a.a.mark((function e(n){var r,i,o,s,c,u,l,f,p,h;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.encryptedParameters,i=n.key,(o=r.getContentFormat())!==Q.DecryptedBareObject&&o!==Q.DecryptedBase64String){e.next=4;break}return e.abrupt("return",Ve(Be(t.prototype),"generateDecryptedParameters",this).call(this,{encryptedParameters:r,key:i}));case 4:if(i&&i.itemsKey){e.next=6;break}throw"Attempting to generateDecryptedParameters with no itemsKey.";case 6:return s=this.deconstructEncryptedPayloadString(r.enc_item_key),e.next=9,this.decryptString({ciphertext:s.ciphertext,rawKey:i.itemsKey,nonce:s.nonce,aad:{u:s.uuid,v:s.version}});case 9:if(c=e.sent){e.next=13;break}return console.error("Error decrypting itemKey parameters",r),e.abrupt("return",Vi({encryptionParameters:r,override:(u={},Re(u,ne.ErrorDecrypting,!0),Re(u,ne.ErrorDecryptingChanged,!r.errorDecrypting),u)}));case 13:return l=this.deconstructEncryptedPayloadString(r.content),e.next=16,this.decryptString({ciphertext:l.ciphertext,rawKey:c,nonce:l.nonce,aad:{u:l.uuid,v:l.version}});case 16:if(f=e.sent){e.next=21;break}return e.abrupt("return",Vi({encryptionParameters:r,override:(p={},Re(p,ne.ErrorDecrypting,!0),Re(p,ne.ErrorDecryptingChanged,!r.errorDecrypting),p)}));case 21:return e.abrupt("return",Vi({encryptionParameters:r,override:(h={},Re(h,ne.Content,JSON.parse(f)),Re(h,ne.ErrorDecrypting,!1),Re(h,ne.ErrorDecryptingChanged,!0===r.errorDecrypting),Re(h,ne.WaitingForKey,!1),h)}));case 22:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"deconstructEncryptedPayloadString",value:function(e){var t=e.split(":");return{version:t[0],nonce:t[1],ciphertext:t[2]}}},{key:"deriveKey",value:(s=Ne(a.a.mark((function e(){var t,n,r,i,o,s,c,u,l=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=l.length>0&&void 0!==l[0]?l[0]:{},n=t.password,r=t.salt,(i=t.iterations)&&r&&n){e.next=3;break}throw"Attempting to 004.deriveKey with invalid parameters";case 3:return e.next=5,this.crypto.argon2(n,r,i,67108864,64);case 5:return o=e.sent,e.next=8,this.splitKey({key:o,numParts:2});case 8:return s=e.sent,c=s[0],u=s[1],e.abrupt("return",q.Create({content:{masterKey:c,serverPassword:u,version:this.constructor.versionString()}}));case 12:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})}],i=[{key:"versionString",value:function(){return L.V004}},{key:"kdfIterations",value:function(){return 5}}],r&&Ue(n.prototype,r),i&&Ue(n,i),t}(Me);function We(e){return(We="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function qe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ge(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ye(e,t){return!t||"object"!==We(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Je(e,t,n){return(Je="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Qe(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function Qe(e){return(Qe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ze(e,t){return(Ze=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Xe=function(e){function t(){return qe(this,t),Ye(this,Qe(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ze(e,t)}(t,e),n=t,i=[{key:"FromRaw",value:function(e){return new t(Ri({object:{content:e}}))}}],(r=[{key:"strategyWhenConflictingWithItem",value:function(e){var n=e.item;return this.errorDecrypting?Je(Qe(t.prototype),"strategyWhenConflictingWithItem",this).call(this,{item:n}):Fr.KeepLeft}},{key:"content_type",get:function(){return c.ItemsKey}},{key:"version",get:function(){return this.content.version}},{key:"isItemsKey",get:function(){return!0}},{key:"isDefault",get:function(){return this.content.isDefault}},{key:"itemsKey",get:function(){return this.content.itemsKey}},{key:"dataAuthenticationKey",get:function(){if(this.version===L.V004)throw"Attempting to access legacy data authentication key.";return this.content.dataAuthenticationKey}}])&&Ge(n.prototype,r),i&&Ge(n,i),t}(R);function et(e){return(et="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function tt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function nt(e,t,n){return(nt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=rt(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function rt(e){return(rt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function it(e,t){return(it=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var at="editor-editor",ot="themes",st="editor-stack",ct=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==et(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,rt(t).call(this,e))).componentData||(n.componentData={}),n.disassociatedItemIds||(n.disassociatedItemIds=[]),n.associatedItemIds||(n.associatedItemIds=[]),n}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&it(e,t)}(t,e),n=t,i=[{key:"associativeAreas",value:function(){return[at]}}],(r=[{key:"mapContentToLocalProperties",value:function(e){nt(rt(t.prototype),"mapContentToLocalProperties",this).call(this,e),e.hosted_url||(this.legacy_url=e.url),this.local_url=e.local_url,this.hosted_url=e.hosted_url||e.url,this.offlineOnly=e.offlineOnly,this.name=e.name,this.autoupdateDisabled=e.autoupdateDisabled,this.package_info=e.package_info,this.area=e.area,this.active=e.active,this.permissions=e.permissions,this.permissions||(this.permissions=[]),e.valid_until&&(this.valid_until=new Date(e.valid_until)),this.componentData=e.componentData||{},this.disassociatedItemIds=e.disassociatedItemIds||[],this.associatedItemIds=e.associatedItemIds||[]}},{key:"handleDeletedContent",value:function(){nt(rt(t.prototype),"handleDeletedContent",this).call(this),this.active=!1}},{key:"structureParams",value:function(){var e={legacy_url:this.legacy_url,hosted_url:this.hosted_url,local_url:this.local_url,valid_until:this.valid_until,offlineOnly:this.offlineOnly,name:this.name,area:this.area,package_info:this.package_info,permissions:this.permissions,active:this.active,autoupdateDisabled:this.autoupdateDisabled,componentData:this.componentData,disassociatedItemIds:this.disassociatedItemIds,associatedItemIds:this.associatedItemIds},n=nt(rt(t.prototype),"structureParams",this).call(this);return Object.assign(n,e),n}},{key:"strategyWhenConflictingWithItem",value:function(e){var n=e.item;return this.errorDecrypting?nt(rt(t.prototype),"strategyWhenConflictingWithItem",this).call(this,{item:n}):Fr.KeepLeft}},{key:"isEditor",value:function(){return this.area===at}},{key:"isTheme",value:function(){return this.content_type===c.Theme||this.area===ot}},{key:"isDefaultEditor",value:function(){return!0===this.getAppDataItem("defaultEditor")}},{key:"setLastSize",value:function(e){this.setAppDataItem("lastSize",e)}},{key:"getLastSize",value:function(){return this.getAppDataItem("lastSize")}},{key:"acceptsThemes",value:function(){return!this.content.package_info||!0===this.content.package_info.acceptsThemes}},{key:"getClientDataKey",value:function(){return this.legacy_url?this.legacy_url:this.uuid}},{key:"hasValidHostedUrl",value:function(){return this.hosted_url||this.legacy_url}},{key:"contentKeysToIgnoreWhenCheckingEquality",value:function(){return["active","disassociatedItemIds","associatedItemIds"].concat(nt(rt(t.prototype),"contentKeysToIgnoreWhenCheckingEquality",this).call(this))}},{key:"isAssociative",value:function(){return t.associativeAreas().includes(this.area)}},{key:"associateWithItem",value:function(e){this.associatedItemIds.push(e.uuid)}},{key:"isExplicitlyEnabledForItem",value:function(e){return-1!==this.associatedItemIds.indexOf(e.uuid)}},{key:"isExplicitlyDisabledForItem",value:function(e){return-1!==this.disassociatedItemIds.indexOf(e.uuid)}},{key:"content_type",get:function(){return c.Component}}])&&tt(n.prototype,r),i&&tt(n,i),t}(R),ut=n(92),lt=n.n(ut),ft=n(5),pt=n.n(ft),ht=n(3),dt=n.n(ht),vt=n(2),yt=n.n(vt);function mt(e){return(mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function gt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function bt(e,t,n){return(bt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=wt(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function wt(e){return(wt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function kt(e,t){return(kt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var xt=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==mt(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,wt(t).call(this,e))).notes||(n.notes=[]),n.data||(n.data={}),n}var n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&kt(e,t)}(t,e),n=t,(r=[{key:"mapContentToLocalProperties",value:function(e){bt(wt(t.prototype),"mapContentToLocalProperties",this).call(this,e),this.url=e.url,this.name=e.name,this.data=e.data||{},this.default=e.default,this.systemEditor=e.systemEditor}},{key:"structureParams",value:function(){var e={url:this.url,name:this.name,data:this.data,default:this.default,systemEditor:this.systemEditor},n=bt(wt(t.prototype),"structureParams",this).call(this);return Object.assign(n,e),n}},{key:"referenceParams",value:function(){return lt()(this.notes,(function(e){return{uuid:e.uuid,content_type:e.content_type}}))}},{key:"addItemAsRelationship",value:function(e){e.content_type===c.Note&&(pt()(this.notes,e)||this.notes.push(e)),bt(wt(t.prototype),"addItemAsRelationship",this).call(this,e)}},{key:"removeItemAsRelationship",value:function(e){e.content_type===c.Note&&dt()(this.notes,e),bt(wt(t.prototype),"removeItemAsRelationship",this).call(this,e)}},{key:"removeAndDirtyAllRelationships",value:function(){bt(wt(t.prototype),"removeAndDirtyAllRelationships",this).call(this),this.notes=[]}},{key:"removeReferencesNotPresentIn",value:function(e){var n=this;bt(wt(t.prototype),"removeReferencesNotPresentIn",this).call(this,e);var r=e.map((function(e){return e.uuid}));this.notes.forEach((function(e){r.includes(e.uuid)||yt()(n.notes,{uuid:e.uuid})}))}},{key:"setData",value:function(e,t){return!(JSON.stringify(this.data[e])===JSON.stringify(t)||(this.data[e]=t,0))}},{key:"dataForKey",value:function(e){return this.data[e]||{}}},{key:"content_type",get:function(){return c.Editor}}])&&gt(n.prototype,r),t}(R),St=n(93),_t=n.n(St),$t=n(35),Pt=n.n($t),Ot=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Pt()(this,t),this.running=!1,this.error=!1,this.lastExecuted&&(this.lastExecuted=new Date(this.lastExecuted))};function Ct(e){return(Ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Et(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function At(e,t,n){return(At="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=It(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function It(e){return(It=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function jt(e,t){return(jt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Dt=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t){return!t||"object"!==Ct(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,It(t).call(this,e)),e.actions&&(n.actions=e.actions.map((function(e){return new Ot(e)}))),n.actions||(n.actions=[]),n}var n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&jt(e,t)}(t,e),n=t,(r=[{key:"actionsWithContextForItem",value:function(e){return this.actions.filter((function(t){return t.context===e.content_type||"Item"===t.context}))}},{key:"mapContentToLocalProperties",value:function(e){At(It(t.prototype),"mapContentToLocalProperties",this).call(this,e),this.description=e.description,this.url=e.url,this.name=e.name,this.package_info=e.package_info,this.supported_types=e.supported_types,e.actions&&(this.actions=e.actions.map((function(e){return new Ot(e)})))}},{key:"structureParams",value:function(){var e={name:this.name,url:this.url,package_info:this.package_info,description:this.description,actions:this.actions.map((function(e){return _t()(e,["subrows","subactions"])})),supported_types:this.supported_types},n=At(It(t.prototype),"structureParams",this).call(this);return Object.assign(n,e),n}},{key:"content_type",get:function(){return c.ActionsExtension}}])&&Et(n.prototype,r),t}(R);function Mt(e){return(Mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Tt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Rt(e,t,n){return(Rt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Lt(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function Lt(e){return(Lt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Nt(e,t){return(Nt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Ft=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Mt(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,Lt(t).call(this,e))).content_type||(n.content_type=c.Tag),n.notes||(n.notes=[]),n}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Nt(e,t)}(t,e),n=t,i=[{key:"arrayToDisplayString",value:function(e){return e.sort((function(e,t){return e.title>t.title})).map((function(e,t){return"#"+e.title})).join(" ")}}],(r=[{key:"mapContentToLocalProperties",value:function(e){Rt(Lt(t.prototype),"mapContentToLocalProperties",this).call(this,e),this.title=e.title}},{key:"structureParams",value:function(){var e={title:this.title},n=Rt(Lt(t.prototype),"structureParams",this).call(this);return Object.assign(n,e),n}},{key:"addItemAsRelationship",value:function(e){e.content_type===c.Note&&(Object(o.g)(this.notes,"uuid",e.uuid)||this.notes.push(e)),Rt(Lt(t.prototype),"addItemAsRelationship",this).call(this,e)}},{key:"removeItemAsRelationship",value:function(e){e.content_type===c.Note&&yt()(this.notes,{uuid:e.uuid}),Rt(Lt(t.prototype),"removeItemAsRelationship",this).call(this,e)}},{key:"updateLocalRelationships",value:function(){var e=this,t=this.content.references.map((function(e){return e.uuid}));this.notes.slice().forEach((function(n){t.includes(n.uuid)||(yt()(e.notes,{uuid:n.uuid}),n.setIsNoLongerReferencedBy(e))}))}},{key:"isBeingRemovedLocally",value:function(){var e=this;this.notes.forEach((function(t){t.setIsNoLongerReferencedBy(e)})),this.notes.length=0,Rt(Lt(t.prototype),"isBeingRemovedLocally",this).call(this)}},{key:"didCompleteMapping",value:function(e){var t=!0,n=!1,r=void 0;try{for(var i,a=this.notes[Symbol.iterator]();!(t=(i=a.next()).done);t=!0)i.value.tagDidCompleteMapping(this)}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}}},{key:"isSmartTag",value:function(){return this.content_type===c.SmartTag}}])&&Tt(n.prototype,r),i&&Tt(n,i),t}(R);function Ut(e){return(Ut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Kt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Vt(e,t,n){return(Vt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Bt(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function Bt(e){return(Bt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ht(e,t){return(Ht=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var zt=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Ut(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,Bt(t).call(this,e))).text||(n.text=""),n.tags||(n.tags=[]),n}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ht(e,t)}(t,e),n=t,i=[{key:"filterDummyNotes",value:function(e){return e.filter((function(e){return!e.dummy}))}}],(r=[{key:"mapContentToLocalProperties",value:function(e){Vt(Bt(t.prototype),"mapContentToLocalProperties",this).call(this,e),this.title=e.title,this.text=e.text}},{key:"structureParams",value:function(){var e={title:this.title,text:this.text},n=Vt(Bt(t.prototype),"structureParams",this).call(this);return Object.assign(n,e),n}},{key:"addItemAsRelationship",value:function(e){e.content_type===c.Tag&&e.addItemAsRelationship(this),Vt(Bt(t.prototype),"addItemAsRelationship",this).call(this,e)}},{key:"setIsBeingReferencedBy",value:function(e){e.content_type===c.Tag&&(Object(o.g)(this.tags,"uuid",e.uuid)||this.tags.push(e)),Vt(Bt(t.prototype),"setIsBeingReferencedBy",this).call(this,e),this.clearSavedTagsString()}},{key:"setIsNoLongerReferencedBy",value:function(e){Vt(Bt(t.prototype),"setIsNoLongerReferencedBy",this).call(this,e),e.content_type===c.Tag&&Object(o.u)(this.tags,e),e.content_type===c.Tag&&this.hasRelationshipWithItem(e)&&this.removeReferenceWithUuid(e.uuid),this.clearSavedTagsString()}},{key:"tagDidCompleteMapping",value:function(e){this.clearSavedTagsString()}},{key:"safeText",value:function(){return this.text||""}},{key:"safeTitle",value:function(){return this.title||""}},{key:"clearSavedTagsString",value:function(){this.savedTagsString=null}},{key:"tagsString",value:function(){return this.savedTagsString=Ft.arrayToDisplayString(this.tags),this.savedTagsString}},{key:"content_type",get:function(){return c.Note}}])&&Kt(n.prototype,r),i&&Kt(n,i),t}(R);function Wt(e){return(Wt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function qt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Gt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Yt(e,t){return!t||"object"!==Wt(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Jt(e){return(Jt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Qt(e,t){return(Qt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Zt=function(e){function t(){return qt(this,t),Yt(this,Jt(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Qt(e,t)}(t,e),n=t,i=[{key:"contentType",value:function(){return c.UserPrefs}}],(r=[{key:"isSingleton",get:function(){return!0}},{key:"singletonPredicate",get:function(){return new v("content_type","=",this.content_type)}}])&&Gt(n.prototype,r),i&&Gt(n,i),t}(R);function Xt(e){return(Xt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function en(e){return(en=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function nn(e,t,n){return t&&tn(e.prototype,t),n&&tn(e,n),e}function rn(e,t){return(rn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var an=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Xt(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,en(t).call(this,e))).errorDecrypting||n.content.desktopPrivileges||(n.content.desktopPrivileges={}),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&rn(e,t)}(t,e),nn(t,null,[{key:"contentType",value:function(){return c.Privileges}}]),nn(t,[{key:"setCredentialsForAction",value:function(e,t){this.content.desktopPrivileges[e]=t}},{key:"getCredentialsForAction",value:function(e){return this.content.desktopPrivileges[e]||[]}},{key:"toggleCredentialForAction",value:function(e,t){this.isCredentialRequiredForAction(e,t)?this.removeCredentialForAction(e,t):this.addCredentialForAction(e,t)}},{key:"removeCredentialForAction",value:function(e,t){dt()(this.content.desktopPrivileges[e],t)}},{key:"addCredentialForAction",value:function(e,t){var n=this.getCredentialsForAction(e);n.push(t),this.setCredentialsForAction(e,n)}},{key:"isCredentialRequiredForAction",value:function(e,t){return this.getCredentialsForAction(e).includes(t)}},{key:"isSingleton",get:function(){return!0}},{key:"singletonPredicate",get:function(){return new v("content_type","=",this.content_type)}}]),t}(R);function on(e){return(on="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function sn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function cn(e){return(cn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function un(e,t){return(un=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ln=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==on(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,cn(t).call(this,e))).content_type=c.SmartTag,n}var n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&un(e,t)}(t,e),n=t,(r=[{key:"systemSmartTags",value:function(){var e=Ri({object:{uuid:"all-notes",dummy:!0,content:{title:"All notes",isSystemTag:!0,isAllTag:!0,predicate:new v.FromArray(["content_type","=",c.Note])}}}),n=Ri({object:{uuid:"archived-notes",dummy:!0,content:{title:"Archived",isSystemTag:!0,isArchiveTag:!0,predicate:new v.FromArray(["archived","=",!0])}}}),r=Ri({object:{uuid:"trashed-notes",dummy:!0,content:{title:"Trash",isSystemTag:!0,isTrashTag:!0,predicate:new v.FromArray(["content.trashed","=",!0])}}});return[new t(e),new t(n),new t(r)]}}])&&sn(n,r),t}(Ft);function fn(e){return(fn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function pn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function hn(e,t,n){return(hn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=dn(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function dn(e){return(dn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function vn(e,t){return(vn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var yn=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==fn(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,dn(t).call(this,e))).area="themes",n}var n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&vn(e,t)}(t,e),n=t,(r=[{key:"isLayerable",value:function(){return this.package_info&&this.package_info.layerable}},{key:"strategyWhenConflictingWithItem",value:function(e){var n=e.item;return this.errorDecrypting?hn(dn(t.prototype),"strategyWhenConflictingWithItem",this).call(this,{item:n}):Fr.KeepLeft}},{key:"setMobileRules",value:function(e){this.setAppDataItem("mobileRules",e)}},{key:"getMobileRules",value:function(){return this.getAppDataItem("mobileRules")||{constants:{},rules:{}}}},{key:"hasMobileRules",value:function(){return this.getAppDataItem("mobileRules")}},{key:"setNotAvailOnMobile",value:function(e){this.setAppDataItem("notAvailableOnMobile",e)}},{key:"getNotAvailOnMobile",value:function(){return this.getAppDataItem("notAvailableOnMobile")}},{key:"setMobileActive",value:function(e){this.setAppDataItem("mobileActive",e)}},{key:"isMobileActive",value:function(){return this.getAppDataItem("mobileActive")}},{key:"content_type",get:function(){return c.Theme}}])&&pn(n.prototype,r),t}(ct);function mn(e){return(mn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function gn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function wn(e,t){return!t||"object"!==mn(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function kn(e,t,n){return(kn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=xn(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function xn(e){return(xn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Sn(e,t){return(Sn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var _n,$n=function(e){function t(){return gn(this,t),wn(this,xn(t).apply(this,arguments))}var n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Sn(e,t)}(t,e),n=t,(r=[{key:"mapContentToLocalProperties",value:function(e){kn(xn(t.prototype),"mapContentToLocalProperties",this).call(this,e),this.storage=e.storage}},{key:"content_type",get:function(){return c.EncryptedStorage}}])&&bn(n.prototype,r),t}(R);function Pn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var On=(Pn(_n={},c.Note,zt),Pn(_n,c.Tag,Ft),Pn(_n,c.ItemsKey,Xe),Pn(_n,c.SmartTag,ln),Pn(_n,c.ActionsExtension,Dt),Pn(_n,c.Editor,xt),Pn(_n,c.Theme,yn),Pn(_n,c.Component,ct),Pn(_n,c.Privileges,an),Pn(_n,c.UserPrefs,Zt),_n);function Cn(e){if(!e.isPayload)throw"Attempting to create item from non-payload object.";return new(On[e.content_type]||R)(e)}function En(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function An(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){En(a,r,i,o,s,"next",e)}function s(e){En(a,r,i,o,s,"throw",e)}o(void 0)}))}}function In(e){return jn.apply(this,arguments)}function jn(){return(jn=An(a.a.mark((function e(t){var n,r,i,s,c,u,l,f;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.payload,r=t.baseCollection,i=t.isConflict,s=[],e.next=4,j.GenerateUuid();case 4:return e.t0=e.sent,c={uuid:e.t0,dirty:!0,dirtiedDate:null,lastSyncBegan:null,lastSyncEnd:null},i&&(c.content={conflict_of:n.uuid}),u=Ui({payload:n,override:c}),s.push(u),l=r.payloadsThatReferencePayload(n),e.next=12,Tn({payloads:l,add:[{uuid:u.uuid,content_type:u.content_type}]});case 12:return f=e.sent,Object(o.f)(s,f),e.abrupt("return",s);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Dn(e){return Mn.apply(this,arguments)}function Mn(){return(Mn=An(a.a.mark((function e(t){var n,r,i,s,c,u,l;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.payload,r=t.baseCollection,i=[],e.t0=Ui,e.t1=n,e.next=6,j.GenerateUuid();case 6:return e.t2=e.sent,e.t3={uuid:e.t2,dirty:!0},e.t4={payload:e.t1,override:e.t3},s=(0,e.t0)(e.t4),i.push(s),c=r.payloadsThatReferencePayload(n),e.next=14,Tn({payloads:c,add:[{uuid:s.uuid,content_type:s.content_type}],removeIds:[n.uuid]});case 14:return u=e.sent,Object(o.f)(i,u),l=Ui({payload:n,override:{deleted:!0,dirty:!1,content:{references:[]}}}),i.push(l),e.abrupt("return",i);case 19:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Tn(e){return Rn.apply(this,arguments)}function Rn(){return(Rn=An(a.a.mark((function e(t){var n,r,i,o,s,c,u,l,f,p,h,d,v,y,m,g,b,w,k,x,S,_,$,P;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.payloads,r=t.add,i=t.removeIds,o=[],s=!0,c=!1,u=void 0,e.prev=5,l=n[Symbol.iterator]();case 7:if(s=(f=l.next()).done){e.next=55;break}if(p=f.value,h=p.content.references.slice(),!r){e.next=30;break}for(d=!0,v=!1,y=void 0,e.prev=14,m=r[Symbol.iterator]();!(d=(g=m.next()).done);d=!0)b=g.value,h.push(b);e.next=22;break;case 18:e.prev=18,e.t0=e.catch(14),v=!0,y=e.t0;case 22:e.prev=22,e.prev=23,d||null==m.return||m.return();case 25:if(e.prev=25,!v){e.next=28;break}throw y;case 28:return e.finish(25);case 29:return e.finish(22);case 30:if(!i){e.next=50;break}for(w=!0,k=!1,x=void 0,e.prev=34,S=i[Symbol.iterator]();!(w=(_=S.next()).done);w=!0)$=_.value,yt()(h,{uuid:$});e.next=42;break;case 38:e.prev=38,e.t1=e.catch(34),k=!0,x=e.t1;case 42:e.prev=42,e.prev=43,w||null==S.return||S.return();case 45:if(e.prev=45,!k){e.next=48;break}throw x;case 48:return e.finish(45);case 49:return e.finish(42);case 50:P=Ui({payload:p,override:{dirty:!0,content:{references:h}}}),o.push(P);case 52:s=!0,e.next=7;break;case 55:e.next=61;break;case 57:e.prev=57,e.t2=e.catch(5),c=!0,u=e.t2;case 61:e.prev=61,e.prev=62,s||null==l.return||l.return();case 64:if(e.prev=64,!c){e.next=67;break}throw u;case 67:return e.finish(64);case 68:return e.finish(61);case 69:return e.abrupt("return",o);case 70:case"end":return e.stop()}}),e,null,[[5,57,61,69],[14,18,22,30],[23,,25,29],[34,38,42,50],[43,,45,49],[62,,64,68]])})))).apply(this,arguments)}var Ln={RemoteRetrieved:1,RemoteSaved:2,LocalSaved:3,LocalRetrieved:4,LocalDirtied:5,ComponentRetrieved:6,DesktopInstalled:7,RemoteActionRetrieved:8,FileImport:9,RemoteConflict:10,ImportConflict:11,SaveOrSaving:12,DecryptedTransient:13,ConflictUuid:14,ConflictData:15};function Nn(e){return[Ln.RemoteRetrieved,Ln.ComponentRetrieved,Ln.RemoteActionRetrieved].includes(e)}function Fn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Un=function(){function e(t,n){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t.isItem)throw"Cannot create payload from item directly";if(!n)throw"Do not construct payloads directly. Use generator functions";var r=!0,i=!1,a=void 0;try{for(var s,c=this.constructor.fields()[Symbol.iterator]();!(r=(s=c.next()).done);r=!0){var u=s.value,l=t[u];Object(o.l)(l)||(this[u]=l)}}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}}var t,n,r;return t=e,r=[{key:"fields",value:function(){throw"Must override PurePayload.fields"}}],(n=[{key:"mergedWith",value:function(e){return Ui({payload:this,override:e})}},{key:"fields",value:function(){return this.constructor.fields()}},{key:"getFormat",value:function(){if(Object(o.n)(this.content))return this.content.startsWith(L.V000Base64Decrypted)?Q.DecryptedBase64String:Q.EncryptedString;if(Object(o.m)(this.content))return Q.DecryptedBareObject;throw"Unhandle content format for payload.getFormat()"}},{key:"version",get:function(){return Object(o.n)(this.content)?this.content.substring(0,L.VersionLength):this.content.version}},{key:"isPayload",get:function(){return!0}}])&&Fn(t.prototype,n),r&&Fn(t,r),e}();function Kn(e){return(Kn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Vn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Bn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Hn(e,t){return!t||"object"!==Kn(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function zn(e){return(zn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Wn(e,t){return(Wn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var qn=function(e){function t(){return Vn(this,t),Hn(this,zn(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Wn(e,t)}(t,e),n=t,i=[{key:"fields",value:function(){throw"Must override SNPureItemPayload.fields"}}],(r=[{key:"compareContentFields",value:function(e){var t=new R(this),n=new R(e);return t.isItemContentEqualWith(n)}},{key:"version",get:function(){return this.content.substring(0,L.VersionLength)}},{key:"discardable",get:function(){return this.deleted&&!this.dirty}}])&&Bn(n.prototype,r),i&&Bn(n,i),t}(Un);function Gn(e){return(Gn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Yn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Jn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Qn(e,t){return!t||"object"!==Gn(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Zn(e){return(Zn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Xn(e,t){return(Xn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var er=function(e){function t(){return Yn(this,t),Qn(this,Zn(t).apply(this,arguments))}var n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Xn(e,t)}(t,e),n=t,(r=[{key:"fields",value:function(){return[ne.Uuid,ne.ContentType,ne.ItemsKeyId,ne.EncItemKey,ne.Content,ne.CreatedAt,ne.UpdatedAt,ne.Deleted,ne.Legacy003AuthHash,ne.Legacy003AuthParams,ne.Dirty,ne.DirtiedDate,ne.ErrorDecrypting,ne.WaitingForKey]}}])&&Jn(n,r),t}(qn);function tr(e){return(tr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function nr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ir(e,t){return!t||"object"!==tr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ar(e){return(ar=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function or(e,t){return(or=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var sr=function(e){function t(){return nr(this,t),ir(this,ar(t).apply(this,arguments))}var n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&or(e,t)}(t,e),n=t,(r=[{key:"fields",value:function(){return[ne.Uuid,ne.ContentType,ne.ItemsKeyId,ne.EncItemKey,ne.Content,ne.CreatedAt,ne.UpdatedAt,ne.Deleted,ne.Legacy003AuthHash]}}])&&rr(n,r),t}(qn);function cr(e){return(cr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ur(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function fr(e,t){return!t||"object"!==cr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function pr(e){return(pr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function hr(e,t){return(hr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var dr=function(e){function t(){return ur(this,t),fr(this,pr(t).apply(this,arguments))}var n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&hr(e,t)}(t,e),n=t,(r=[{key:"fields",value:function(){return[ne.Uuid,ne.ContentType,ne.ItemsKeyId,ne.EncItemKey,ne.Content,ne.CreatedAt,ne.UpdatedAt,ne.Legacy003AuthHash]}}])&&lr(n,r),t}(qn);function vr(e){return(vr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function yr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function gr(e,t){return!t||"object"!==vr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function br(e){return(br=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function wr(e,t){return(wr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var kr=function(e){function t(){return yr(this,t),gr(this,br(t).apply(this,arguments))}var n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&wr(e,t)}(t,e),n=t,(r=[{key:"fields",value:function(){return[ne.Uuid,ne.ContentType,ne.ItemsKeyId,ne.EncItemKey,ne.Content,ne.CreatedAt,ne.UpdatedAt,ne.Deleted,ne.Legacy003AuthHash,ne.Legacy003AuthParams,ne.Dirty,ne.DirtiedDate,ne.ErrorDecrypting,ne.ErrorDecryptingChanged,ne.WaitingForKey,ne.Dummy,ne.LastSyncBegan,ne.LastSyncEnd]}}])&&mr(n,r),t}(qn);function xr(e){return(xr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Sr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function $r(e,t){return!t||"object"!==xr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Pr(e){return(Pr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Or(e,t){return(Or=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Cr=function(e){function t(){return Sr(this,t),$r(this,Pr(t).apply(this,arguments))}var n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Or(e,t)}(t,e),n=t,(r=[{key:"fields",value:function(){return[ne.Uuid,ne.ContentType,ne.UpdatedAt,ne.Deleted,ne.Dirty,ne.LastSyncEnd]}}])&&_r(n,r),t}(qn);function Er(e){return(Er="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ar(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ir(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function jr(e,t){return!t||"object"!==Er(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Dr(e){return(Dr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Mr(e,t){return(Mr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Tr=function(e){function t(){return Ar(this,t),jr(this,Dr(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Mr(e,t)}(t,e),n=t,i=[{key:"fields",value:function(){return[ne.ItemsKeyId,ne.EncItemKey,ne.Content,ne.Legacy003AuthHash,ne.ErrorDecrypting,ne.ErrorDecryptingChanged,ne.WaitingForKey]}}],(r=[{key:"getContentFormat",value:function(){return"string"==typeof this.content?this.content.startsWith(L.V000Base64Decrypted)?Q.DecryptedBase64String:Q.EncryptedString:Q.DecryptedBareObject}},{key:"isEncryptionParameters",get:function(){return!0}}])&&Ir(n.prototype,r),i&&Ir(n,i),t}(Un);function Rr(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Lr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Nr=function(){function e(t){var n=t.baseCollection,r=t.applyCollection,i=t.relatedCollectionSet;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.baseCollection=n,this.applyCollection=r,this.relatedCollectionSet=i}var t,n,r,i;return t=e,(n=[{key:"resultingCollection",value:(r=a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw"Must override PayloadDelta.resultingCollection.";case 1:case"end":return e.stop()}}),e)})),i=function(){var e=this,t=arguments;return new Promise((function(n,i){var a=r.apply(e,t);function o(e){Rr(a,n,i,o,s,"next",e)}function s(e){Rr(a,n,i,o,s,"throw",e)}o(void 0)}))},function(){return i.apply(this,arguments)})},{key:"findBasePayload",value:function(e){var t=e.id;return this.baseCollection.findPayload(t)}},{key:"findRelatedPayload",value:function(e){var t=e.id,n=e.source;return this.relatedCollectionSet.collectionForSource(n).findPayload(t)}}])&&Lr(t.prototype,n),e}(),Fr={KeepLeft:1,KeepRight:2,KeepLeftDuplicateRight:3,DuplicateLeftKeepRight:4,KeepLeftMergeRefs:5};function Ur(e){return(Ur="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Kr(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Vr(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Kr(a,r,i,o,s,"next",e)}function s(e){Kr(a,r,i,o,s,"throw",e)}o(void 0)}))}}function Br(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Hr(e){return(Hr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function zr(e,t){return(zr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Wr=function(e){function t(e){var n,r=e.baseCollection,i=e.basePayload,a=e.applyPayload,o=e.source;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Ur(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,Hr(t).call(this,{baseCollection:r}))).basePayload=i,n.applyPayload=a,n.source=o,n}var n,r,i,s;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&zr(e,t)}(t,e),n=t,(r=[{key:"resultingCollection",value:(s=Vr(a.a.mark((function e(){var t,n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Cn(this.basePayload),n=Cn(this.applyPayload),r=t.strategyWhenConflictingWithItem({item:n}),e.next=5,this.payloadsByHandlingStrategy({strategy:r});case 5:return i=e.sent,e.abrupt("return",new f({payloads:i,source:this.source}));case 7:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"payloadsByHandlingStrategy",value:(i=Vr(a.a.mark((function e(t){var n,r,i,s,c,u,l,f,p;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((n=t.strategy)!==Fr.KeepLeft){e.next=3;break}return e.abrupt("return",[this.basePayload]);case 3:if(n!==Fr.KeepRight){e.next=5;break}return e.abrupt("return",[this.applyPayload]);case 5:if(n!==Fr.KeepLeftDuplicateRight){e.next=12;break}return r=Object(o.i)(this.basePayload.updated_at,this.applyPayload.updated_at),i=Ui({payload:this.basePayload,override:{updated_at:r,dirty:!0}}),e.next=10,In({payload:this.applyPayload,baseCollection:this.baseCollection,isConflict:!0});case 10:return s=e.sent,e.abrupt("return",[i].concat(s));case 12:if(n!==Fr.DuplicateLeftKeepRight){e.next=18;break}return e.next=15,In({payload:this.basePayload,baseCollection:this.baseCollection,isConflict:!0});case 15:return c=e.sent,u=this.applyPayload,e.abrupt("return",c.concat([u]));case 18:if(n!==Fr.KeepLeftMergeRefs){e.next=23;break}return l=Object(o.z)(this.basePayload.content.references,this.applyPayload.content.references,["uuid","content_type"]),f=Object(o.i)(this.basePayload.updated_at,this.applyPayload.updated_at),p=Ui({payload:this.basePayload,override:{updated_at:f,dirty:!0,content:{references:l}}}),e.abrupt("return",[p]);case 23:throw"Unhandled strategy";case 24:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})}])&&Br(n.prototype,r),t}(Nr);function qr(e){return(qr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Gr(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Yr(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Gr(a,r,i,o,s,"next",e)}function s(e){Gr(a,r,i,o,s,"throw",e)}o(void 0)}))}}function Jr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Qr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Zr(e,t){return!t||"object"!==qr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Xr(e){return(Xr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ei(e,t){return(ei=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ti=function(e){function t(){return Jr(this,t),Zr(this,Xr(t).apply(this,arguments))}var n,r,i,s;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ei(e,t)}(t,e),n=t,(r=[{key:"resultingCollection",value:(s=Yr(a.a.mark((function e(){var t,n,r,i,s,c,u,l;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],n=!0,r=!1,i=void 0,e.prev=4,s=this.applyCollection.allPayloads[Symbol.iterator]();case 6:if(n=(c=s.next()).done){e.next=15;break}return u=c.value,e.next=10,this.payloadsByHandlingPayload({payload:u,currentResults:t});case 10:l=e.sent,Object(o.f)(t,l);case 12:n=!0,e.next=6;break;case 15:e.next=21;break;case 17:e.prev=17,e.t0=e.catch(4),r=!0,i=e.t0;case 21:e.prev=21,e.prev=22,n||null==s.return||s.return();case 24:if(e.prev=24,!r){e.next=27;break}throw i;case 27:return e.finish(24);case 28:return e.finish(21);case 29:return e.abrupt("return",new f({payloads:t,source:Ln.FileImport}));case 30:case"end":return e.stop()}}),e,this,[[4,17,21,29],[22,,24,28]])}))),function(){return s.apply(this,arguments)})},{key:"payloadsByHandlingPayload",value:(i=Yr(a.a.mark((function e(t){var n,r,i,o,s;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.payload,r=t.currentResults,(i=r.find((function(e){return e.content.conflict_of===n.uuid})))||(i=r.find((function(e){return e.uuid===n.uuid}))),i||(i=this.findBasePayload({id:n.uuid})),i){e.next=6;break}return e.abrupt("return",[n]);case 6:return o=new Wr({baseCollection:this.baseCollection,basePayload:i,applyPayload:n}),e.next=9,o.resultingCollection();case 9:return s=e.sent,e.abrupt("return",s.allPayloads);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})}])&&Qr(n.prototype,r),t}(Nr);function ni(e){return(ni="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ri(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function ii(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ai(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function oi(e,t){return!t||"object"!==ni(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function si(e){return(si=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ci(e,t){return(ci=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ui=function(e){function t(){return ii(this,t),oi(this,si(t).apply(this,arguments))}var n,r,i,s;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ci(e,t)}(t,e),n=t,(r=[{key:"resultingCollection",value:(i=a.a.mark((function e(){var t,n,r,i,s,c,u,l,p;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],n=!0,r=!1,i=void 0,e.prev=4,s=this.applyCollection.allPayloads[Symbol.iterator]();case 6:if(n=(c=s.next()).done){e.next=22;break}if(u=c.value,t.push(u),l=this.findBasePayload({id:u.uuid})){e.next=12;break}return e.abrupt("continue",19);case 12:if(a=l,h=void 0,h=Cn(u),d=Cn(a),!h.isItemContentEqualWith(d)){e.next=15;break}return e.abrupt("continue",19);case 15:return e.next=17,In({payload:l,baseCollection:this.baseCollection,isConflict:!0});case 17:p=e.sent,Object(o.f)(t,p);case 19:n=!0,e.next=6;break;case 22:e.next=28;break;case 24:e.prev=24,e.t0=e.catch(4),r=!0,i=e.t0;case 28:e.prev=28,e.prev=29,n||null==s.return||s.return();case 31:if(e.prev=31,!r){e.next=34;break}throw i;case 34:return e.finish(31);case 35:return e.finish(28);case 36:return e.abrupt("return",new f({payloads:t,source:Ln.RemoteRetrieved}));case 37:case"end":return e.stop()}var a,h,d}),e,this,[[4,24,28,36],[29,,31,35]])})),s=function(){var e=this,t=arguments;return new Promise((function(n,r){var a=i.apply(e,t);function o(e){ri(a,n,r,o,s,"next",e)}function s(e){ri(a,n,r,o,s,"throw",e)}o(void 0)}))},function(){return s.apply(this,arguments)})}])&&ai(n.prototype,r),t}(Nr);function li(e){return(li="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function fi(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function pi(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){fi(a,r,i,o,s,"next",e)}function s(e){fi(a,r,i,o,s,"throw",e)}o(void 0)}))}}function hi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function di(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function vi(e,t){return!t||"object"!==li(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function yi(e){return(yi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function mi(e,t){return(mi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var gi=function(e){function t(){return hi(this,t),vi(this,yi(t).apply(this,arguments))}var n,r,i,s,c;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&mi(e,t)}(t,e),n=t,(r=[{key:"resultingCollection",value:(c=pi(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.applyCollection.source!==Ln.ConflictUuid){e.next=4;break}return e.abrupt("return",this.collectionsByHandlingUuidConflicts());case 4:if(this.applyCollection.source!==Ln.ConflictData){e.next=8;break}return e.abrupt("return",this.collectionsByHandlingDataConflicts());case 8:throw"Unhandled conflict type ".concat(this.applyCollection.source);case 9:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"collectionsByHandlingDataConflicts",value:(s=pi(a.a.mark((function e(){var t,n,r,i,s,c,u,l,p,h,d,v;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],n=!0,r=!1,i=void 0,e.prev=4,s=this.applyCollection.allPayloads[Symbol.iterator]();case 6:if(n=(c=s.next()).done){e.next=27;break}if(u=c.value,l=this.findBasePayload({id:u.uuid})){e.next=12;break}return t.push(u),e.abrupt("continue",24);case 12:if(p=this.findRelatedPayload({id:u.uuid,source:Ln.DecryptedTransient})){e.next=18;break}if(u.deleted){e.next=16;break}throw"Unable to find decrypted counterpart for data conflict.";case 16:return t.push(u),e.abrupt("continue",24);case 18:return h=new Wr({baseCollection:this.baseCollection,basePayload:l,applyPayload:p}),e.next=21,h.resultingCollection();case 21:d=e.sent,v=d.allPayloads,Object(o.f)(t,v);case 24:n=!0,e.next=6;break;case 27:e.next=33;break;case 29:e.prev=29,e.t0=e.catch(4),r=!0,i=e.t0;case 33:e.prev=33,e.prev=34,n||null==s.return||s.return();case 36:if(e.prev=36,!r){e.next=39;break}throw i;case 39:return e.finish(36);case 40:return e.finish(33);case 41:return e.abrupt("return",new f({payloads:t,source:Ln.RemoteRetrieved}));case 42:case"end":return e.stop()}}),e,this,[[4,29,33,41],[34,,36,40]])}))),function(){return s.apply(this,arguments)})},{key:"collectionsByHandlingUuidConflicts",value:(i=pi(a.a.mark((function e(){var t,n,r,i,s,c,u,l,p;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],n=!0,r=!1,i=void 0,e.prev=4,s=this.applyCollection.allPayloads[Symbol.iterator]();case 6:if(n=(c=s.next()).done){e.next=16;break}return u=c.value,l=this.findRelatedPayload({id:u.uuid,source:Ln.DecryptedTransient}),e.next=11,Dn({baseCollection:this.baseCollection,payload:l});case 11:p=e.sent,Object(o.f)(t,p);case 13:n=!0,e.next=6;break;case 16:e.next=22;break;case 18:e.prev=18,e.t0=e.catch(4),r=!0,i=e.t0;case 22:e.prev=22,e.prev=23,n||null==s.return||s.return();case 25:if(e.prev=25,!r){e.next=28;break}throw i;case 28:return e.finish(25);case 29:return e.finish(22);case 30:return e.abrupt("return",new f({payloads:t,source:Ln.RemoteRetrieved}));case 31:case"end":return e.stop()}}),e,this,[[4,18,22,30],[23,,25,29]])}))),function(){return i.apply(this,arguments)})}])&&di(n.prototype,r),t}(Nr);function bi(e){return(bi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function wi(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function ki(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Si(e,t){return!t||"object"!==bi(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function _i(e){return(_i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $i(e,t){return($i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Pi=function(e){function t(){return ki(this,t),Si(this,_i(t).apply(this,arguments))}var n,r,i,s;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&$i(e,t)}(t,e),n=t,(r=[{key:"resultingCollection",value:(i=a.a.mark((function e(){var t,n,r,i,s,c,u,l,p,h,d,v,y,m,g,b,w,k;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],n=[],r=!0,i=!1,s=void 0,e.prev=5,c=this.applyCollection.allPayloads[Symbol.iterator]();case 7:if(r=(u=c.next()).done){e.next=27;break}if(l=u.value,p=this.findRelatedPayload({id:l.uuid,source:Ln.SavedOrSaving}),h=this.findRelatedPayload({id:l.uuid,source:Ln.DecryptedTransient})){e.next=16;break}if(l.deleted){e.next=14;break}throw"Cannot find decrypted for non-deleted payload.";case 14:return t.push(l),e.abrupt("continue",24);case 16:if(!p){e.next=19;break}return n.push(h),e.abrupt("continue",24);case 19:if(!(d=this.findBasePayload({id:l.uuid}))||!d.dirty){e.next=23;break}return n.push(h),e.abrupt("continue",24);case 23:t.push(h);case 24:r=!0,e.next=7;break;case 27:e.next=33;break;case 29:e.prev=29,e.t0=e.catch(5),i=!0,s=e.t0;case 33:e.prev=33,e.prev=34,r||null==c.return||c.return();case 36:if(e.prev=36,!i){e.next=39;break}throw s;case 39:return e.finish(36);case 40:return e.finish(33);case 41:v=[],y=0,m=n;case 43:if(!(y<m.length)){e.next=60;break}if(g=m[y],b=this.findRelatedPayload({id:g.uuid,source:Ln.DecryptedTransient})){e.next=48;break}return e.abrupt("continue",57);case 48:if(w=this.findBasePayload({id:g.uuid})){e.next=51;break}return e.abrupt("continue",57);case 51:if(w.compareContentFields(b)){e.next=57;break}return e.next=55,In({payload:b,baseCollection:this.baseCollection,isConflict:!0});case 55:k=e.sent,Object(o.f)(v,k);case 57:y++,e.next=43;break;case 60:return e.abrupt("return",new f({payloads:t.concat(v),source:Ln.RemoteRetrieved}));case 61:case"end":return e.stop()}}),e,this,[[5,29,33,41],[34,,36,40]])})),s=function(){var e=this,t=arguments;return new Promise((function(n,r){var a=i.apply(e,t);function o(e){wi(a,n,r,o,s,"next",e)}function s(e){wi(a,n,r,o,s,"throw",e)}o(void 0)}))},function(){return s.apply(this,arguments)})}])&&xi(n.prototype,r),t}(Nr);function Oi(e){return(Oi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ci(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ei(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Ai(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ii(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ji(e,t){return!t||"object"!==Oi(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Di(e){return(Di=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Mi(e,t){return(Mi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Ti=function(e){function t(){return Ai(this,t),ji(this,Di(t).apply(this,arguments))}var n,r,i,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Mi(e,t)}(t,e),n=t,(r=[{key:"resultingCollection",value:(i=a.a.mark((function e(){var t,n,r,i,o,s,c,u,l,p,h;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=[],n=!0,r=!1,i=void 0,e.prev=4,o=this.applyCollection.allPayloads[Symbol.iterator]();!(n=(s=o.next()).done);n=!0)u=s.value,l=this.findBasePayload({id:u.uuid}),p=l?l.deleted:u.deleted,h=Ni({object:u,source:Ln.RemoteSaved,override:(c={},Ci(c,ne.LastSyncEnd,new Date),Ci(c,ne.Deleted,p),c)}),t.push(h);e.next=12;break;case 8:e.prev=8,e.t0=e.catch(4),r=!0,i=e.t0;case 12:e.prev=12,e.prev=13,n||null==o.return||o.return();case 15:if(e.prev=15,!r){e.next=18;break}throw i;case 18:return e.finish(15);case 19:return e.finish(12);case 20:return e.abrupt("return",new f({payloads:t,source:Ln.RemoteSaved}));case 21:case"end":return e.stop()}}),e,this,[[4,8,12,20],[13,,15,19]])})),o=function(){var e=this,t=arguments;return new Promise((function(n,r){var a=i.apply(e,t);function o(e){Ei(a,n,r,o,s,"next",e)}function s(e){Ei(a,n,r,o,s,"throw",e)}o(void 0)}))},function(){return o.apply(this,arguments)})}])&&Ii(n.prototype,r),t}(Nr);function Ri(e){var t=e.object,n=e.source,r=e.intent,i=e.override;if(!Object(o.l)(n))throw"Use CreateSourcedPayloadFromObject if creating payload with source.";if(!Object(o.l)(r))throw"Use CreateIntentPayloadFromObject if creating payload with intent.";return Fi({object:t,payloadClass:kr,override:i})}function Li(e){var t=e.object,n=e.intent,r=e.override;return Fi({object:t,payloadClass:function(e){if(e===F.FileEncrypted||e===F.FileDecrypted||e===F.FilePreferEncrypted)return dr;if(e===F.LocalStoragePreferEncrypted||e===F.LocalStorageDecrypted||e===F.LocalStorageEncrypted)return er;if(e===F.Sync||e===F.SyncDecrypted)return sr;throw"No item payload class found for intent ".concat(e)}(n),override:r})}function Ni(e){var t=e.object,n=e.source,r=e.override;return Fi({object:t,payloadClass:Bi(n),override:r})}function Fi(e){var t=e.object,n=e.payloadClass,r=e.override,i=Object(o.t)(t,n.fields());if(r){if(!Object(o.m)(r))throw"Attempting to override payload with non-object";Object(o.e)(i,Object(o.a)(r))}return Object(o.d)(new n(i,!0))}function Ui(e){var t=e.payload,n=e.override,r=Object(o.t)(t,t.fields());return n&&Object(o.e)(r,Object(o.a)(n)),Object(o.d)(new t.constructor(r,!0))}function Ki(e){var t=Object(o.a)(e);return Object(o.d)(new Tr(t,!0))}function Vi(e){var t=e.encryptionParameters,n=e.override;if(!t.isEncryptionParameters)throw"Attempting to copy encryption parameters from non-parameters object.";var r=Object(o.t)(t,Tr.fields());return n&&Object(o.e)(r,Object(o.a)(n)),Object(o.d)(new Tr(r,!0))}function Bi(e){if(e===Ln.FileImport)return dr;if(e===Ln.LocalRetrieved||e===Ln.LocalDirtied)return er;if(e===Ln.RemoteRetrieved||e===Ln.ConflictData||e===Ln.ConflictUuid)return sr;if(e===Ln.LocalSaved||e===Ln.RemoteSaved)return Cr;throw"No item payload class found for source ".concat(e)}function Hi(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function zi(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Hi(a,r,i,o,s,"next",e)}function s(e){Hi(a,r,i,o,s,"throw",e)}o(void 0)}))}}function Wi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var qi=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.eventObservers=[]}var t,n,r,i,o;return t=e,(n=[{key:"addEventObserver",value:function(e){var t=this;return this.eventObservers.push(e),function(){dt()(t.eventObservers,e)}}},{key:"notifyEvent",value:(o=zi(a.a.mark((function e(t,n){var r,i,o,s,c,u;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=!0,i=!1,o=void 0,e.prev=3,s=this.eventObservers[Symbol.iterator]();case 5:if(r=(c=s.next()).done){e.next=12;break}return u=c.value,e.next=9,u(t,n||{});case 9:r=!0,e.next=5;break;case 12:e.next=18;break;case 14:e.prev=14,e.t0=e.catch(3),i=!0,o=e.t0;case 18:e.prev=18,e.prev=19,r||null==s.return||s.return();case 21:if(e.prev=21,!i){e.next=24;break}throw o;case 24:return e.finish(21);case 25:return e.finish(18);case 26:case"end":return e.stop()}}),e,this,[[3,14,18,26],[19,,21,25]])}))),function(e,t){return o.apply(this,arguments)})},{key:"deinit",value:(i=zi(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(){return i.apply(this,arguments)})},{key:"handleApplicationStage",value:(r=zi(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})},{key:"log",value:function(e){if(this.loggingEnabled){for(var t,n=new Date,r=n.toLocaleTimeString().replace(" PM","").replace(" AM",""),i="".concat(r,".").concat(n.getMilliseconds()),a=arguments.length,o=new Array(a>1?a-1:0),s=1;s<a;s++)o[s-1]=arguments[s];o?(t=console).log.apply(t,[i,e].concat(o)):console.log(i,e)}}}])&&Wi(t.prototype,n),e}();function Gi(e){return(Gi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Yi(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Ji(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Yi(a,r,i,o,s,"next",e)}function s(e){Yi(a,r,i,o,s,"throw",e)}o(void 0)}))}}function Qi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Zi(e){return(Zi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Xi(e,t){return(Xi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ea=function(e){function t(e){var n,r=e.deviceInterface;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Gi(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,Zi(t).call(this))).deviceInterface=r,n}var n,r,i,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Xi(e,t)}(t,e),n=t,(r=[{key:"alert",value:(o=Ji(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){window.alert(t.text),e()})));case 1:case"end":return e.stop()}}),e)}))),function(e){return o.apply(this,arguments)})},{key:"confirm",value:(i=Ji(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){window.confirm(t.text)?e():n()})));case 1:case"end":return e.stop()}}),e)}))),function(e){return i.apply(this,arguments)})}])&&Qi(n.prototype,r),t}(qi),ta=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.token=t};function na(e){return"\n Your password must be at least ".concat(e," characters in length.\n For your security, please choose a longer password or,\n ideally, a passphrase, and try again.\n ")}function ra(e,t){return"\n Strict sign in refused server sign in parameters.\n The latest security version is ".concat(t,", but your account is\n reported to have version ").concat(e,". If you'd like to proceed\n with sign in anyway, please disable strict sign in and try again.\n ")}function ia(e){return(ia="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function aa(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function oa(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){aa(a,r,i,o,s,"next",e)}function s(e){aa(a,r,i,o,s,"throw",e)}o(void 0)}))}}function sa(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ca(e){return(ca=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ua(e,t){return(ua=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var la=function(e){function t(e){var n,r=e.storageService,i=e.apiService,a=e.alertService,o=e.protocolService;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),!r||!o)throw"Invalid SessionManager construction";return(n=function(e,t){return!t||"object"!==ia(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,ca(t).call(this))).protocolService=o,n.storageService=r,n.apiService=i,n.alertService=a||new ea,n}var n,r,i,s,c,u,l,f,p;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ua(e,t)}(t,e),n=t,(r=[{key:"initializeFromDisk",value:(p=oa(a.a.mark((function e(){var t,n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.storageService.getValue(P.User);case 2:if(this.user=e.sent,this.user){e.next=8;break}return e.next=6,this.storageService.getValue(P.LegacyUuid);case 6:(t=e.sent)&&(this.user={uuid:t});case 8:return e.next=10,this.storageService.getValue(P.Session);case 10:if(!(n=e.sent)){e.next=14;break}return e.next=14,this.setSession(new ta(n));case 14:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{key:"setSession",value:(f=oa(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.session=t,this.apiService.setSession(this.session);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"online",value:function(){return!this.offline()}},{key:"offline",value:function(){return Object(o.l)(this.session)}},{key:"getUser",value:function(){return this.user}},{key:"signOut",value:(l=oa(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.user=null,this.session=null;case 2:case"end":return e.stop()}}),e,this)}))),function(){return l.apply(this,arguments)})},{key:"register",value:(u=oa(a.a.mark((function e(t){var n,r,i,o,s,c,u=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.email,!((r=t.password).length<8)){e.next=3;break}return e.abrupt("return",this.apiService.error(na(8)));case 3:return e.next=5,this.protocolService.createRootKey({identifier:n,password:r});case 5:return i=e.sent,o=i.key.serverPassword,s=i.keyParams,c=i.key,e.abrupt("return",this.apiService.register({email:n,serverPassword:o,keyParams:s}).then(function(){var e=oa(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.handleAuthResponse(t);case 2:return e.abrupt("return",{response:t,keyParams:s,rootKey:c});case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"signIn",value:(c=oa(a.a.mark((function e(t){var n,r,i,o,s,c,u,l,f,p,h,d,v=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.email,r=t.password,i=t.strict,o=t.mfaKeyPath,s=t.mfaCode,e.next=3,this.apiService.getAccountKeyParams({email:n,mfaKeyPath:o,mfaCode:s}).then((function(e){return{keyParams:v.protocolService.createKeyParams(e)}}));case 3:if(!(c=e.sent).error){e.next=6;break}return e.abrupt("return",c);case 6:if((u=c.keyParams)&&u.version){e.next=9;break}return e.abrupt("return",this.apiService.error("Invalid email or password."));case 9:if(this.protocolService.supportedVersions().includes(u.version)){e.next=15;break}if(!this.protocolService.isVersionNewerThanLibraryVersion(u.version)){e.next=14;break}return e.abrupt("return",this.apiService.error("This version of the application does not support your\n newer account type. Please upgrade to the latest version\n of Standard Notes to sign in."));case 14:return e.abrupt("return",this.apiService.error("The protocol version associated with your account is\n outdated and no longer supported by this application.\n Please visit standardnotes.org/help/security for more\n information."));case 15:if(!this.protocolService.isProtocolVersionOutdated(u.version)){e.next=26;break}if(l=this.protocolService.costMinimumForVersion(u.version),!(u.kdfIterations<l)){e.next=19;break}return e.abrupt("return",this.apiService.error("Unable to login due to insecure password parameters.\n Please visit standardnotes.org/help/security for\n more information."));case 19:return e.next=23,this.alertService.confirm({title:"Update Recommended",text:"The encryption version for your account is outdated and\n requires upgrade. You may proceed with login, but are\n advised to perform a security update using the web or\n desktop application. Please visit\n standardnotes.org/help/security for more information.",confirmButtonText:"Sign In"}).catch((function(){}));case 23:if(e.sent){e.next=26;break}return e.abrupt("return",this.apiService.error());case 26:if(this.protocolService.platformSupportsKeyDerivation(u)){e.next=28;break}return e.abrupt("return",this.apiService.error("Your account was created on a platform with higher security\n capabilities than this browser supports. If we attempted\n to generate your login keys here, it would take hours. Please\n use a browser with more up to date security capabilities,\n like Google Chrome or Firefox, to log in."));case 28:if(!i){e.next=32;break}if(f=this.protocolService.getLatestVersion(),u.version===f){e.next=32;break}return e.abrupt("return",this.apiService.error(ra(u.version,f)));case 32:return e.next=34,this.protocolService.computeRootKey({password:r,keyParams:u}).then((function(e){return{rootKey:e,serverPassword:e.serverPassword}}));case 34:return p=e.sent,h=p.rootKey,d=p.serverPassword,e.abrupt("return",this.apiService.signIn({email:n,serverPassword:d,mfaKeyPath:o,mfaCode:s}).then(function(){var e=oa(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.handleAuthResponse(t);case 2:return e.abrupt("return",{response:t,keyParams:u,rootKey:h});case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 38:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"changePassword",value:(s=oa(a.a.mark((function e(t){var n,r,i,o,s,c,u,l,f,p=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.email,r=t.currentPassword,i=t.currentKeyParams,!((o=t.newPassword).length<8)){e.next=3;break}return e.abrupt("return",this.apiService.error(na(8)));case 3:return e.next=5,this.protocolService.computeRootKey({password:r,keyParams:i}).then((function(e){return e.serverPassword}));case 5:return s=e.sent,e.next=8,this.protocolService.createRootKey({identifier:n,password:o}).then((function(e){return{newRootKey:e.key,newServerPassword:e.key.serverPassword,newKeyParams:e.keyParams}}));case 8:return c=e.sent,u=c.newServerPassword,l=c.newRootKey,f=c.newKeyParams,e.abrupt("return",this.apiService.changePassword({email:n,currentServerPassword:s,newServerPassword:u,newKeyParams:f}).then(function(){var e=oa(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p.handleAuthResponse(t);case 2:return e.abrupt("return",{response:t,keyParams:f,rootKey:l});case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 13:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"handleAuthResponse",value:(i=oa(a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.user,this.user=n,e.next=4,this.storageService.setValue(P.User,n);case 4:return r=new ta(t.token),e.next=7,this.storageService.setValue(P.Session,r);case 7:return e.next=9,this.setSession(r);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})}])&&sa(n.prototype,r),t}(qi),fa="sync_token",pa="cursor_token";function ha(e){return(ha="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function da(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function va(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?da(Object(n),!0).forEach((function(t){ya(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):da(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ya(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ma(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function ga(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){ma(a,r,i,o,s,"next",e)}function s(e){ma(a,r,i,o,s,"throw",e)}o(void 0)}))}}function ba(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function wa(e){return(wa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ka(e,t){return(ka=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var xa=function(e){function t(e){var n,r=e.httpService,i=e.storageService,a=e.host;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==ha(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,wa(t).call(this))).httpService=r,n.storageService=i,n.host=a,n}var n,r,i,s,c,u,l,f,p,h;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ka(e,t)}(t,e),n=t,(r=[{key:"setHost",value:(h=ga(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.host=t,e.next=3,this.storageService.setValue(P.ServerHost,t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"getHost",value:(p=ga(a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.host){e.next=5;break}return e.next=3,this.storageService.getValue(P.ServerHost);case 3:t=e.sent,this.host=t||window._default_sf_server;case 5:return e.abrupt("return",this.host);case 6:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{key:"setSession",value:function(e){this.session=e}},{key:"path",value:(f=ga(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getHost();case 2:if(n=e.sent){e.next=5;break}throw"Attempting to build path ".concat(t," with no host.");case 5:if(t){e.next=7;break}throw"Attempting to build path with null path.";case 7:return e.abrupt("return",Object(o.p)(n,t));case 8:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"params",value:function(e){return Pt()(e,ya({},"api","20190520"))}},{key:"error",value:function(e){return{response:{error:{message:e}}}}},{key:"errorResponse",value:function(e,t){return this.log("".concat(t,": ").concat(e)),Object(o.m)(e)?e:Object(o.n)(e)?this.error(e):this.error(t)}},{key:"getAccountKeyParams",value:(l=ga(a.a.mark((function e(t){var n,r,i,o,s,c,u=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.email,r=t.mfaKeyPath,i=t.mfaCode,e.next=3,this.path("/auth/params");case 3:return o=e.sent,s=this.params(ya({email:n},r,i)),e.next=7,this.httpService.getAbsolute({url:o,params:s}).catch((function(e){return u.errorResponse(e,"A server error occurred while trying to sign in. Please try again.")}));case 7:return c=e.sent,e.abrupt("return",c);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"register",value:(u=ga(a.a.mark((function e(t){var n,r,i,o,s,c,u=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.email,r=t.serverPassword,i=t.keyParams,!this.registering){e.next=3;break}return e.abrupt("return",this.error("An existing registration request is already in progress."));case 3:return this.registering=!0,e.next=6,this.path("/auth");case 6:return o=e.sent,s=this.params(va({password:r,email:n},i.getPortableValue())),e.next=10,this.httpService.postAbsolute({url:o,params:s}).catch((function(e){return u.errorResponse(e,"A server error occurred while trying to register. Please try again.")}));case 10:return c=e.sent,this.registering=!1,e.abrupt("return",c);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"signIn",value:(c=ga(a.a.mark((function e(t){var n,r,i,o,s,c,u,l=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.email,r=t.serverPassword,i=t.mfaKeyPath,o=t.mfaCode,!this.authenticating){e.next=3;break}return e.abrupt("return",this.error("An existing sign in request is already in progress."));case 3:return this.authenticating=!0,e.next=6,this.path("/auth/sign_in");case 6:return s=e.sent,c=this.params(ya({email:n,password:r},i,o)),e.next=10,this.httpService.postAbsolute({url:s,params:c}).catch((function(e){return l.errorResponse(e,"A server error occurred while trying to sign in. Please try again.")}));case 10:return u=e.sent,this.authenticating=!1,e.abrupt("return",u);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"changePassword",value:(s=ga(a.a.mark((function e(t){var n,r,i,o,s,c,u=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.email,n=t.currentServerPassword,r=t.newServerPassword,i=t.newKeyParams,!this.changing){e.next=3;break}return e.abrupt("return",this.error("An existing change password request is already in progress."));case 3:return this.changing=!0,e.next=6,this.path("/auth/change_pw");case 6:return o=e.sent,s=va({current_password:n,new_password:r},i.getPortableValue()),e.next=10,this.httpService.postAbsolute({url:o,params:s,authentication:this.session.token}).catch((function(e){return u.errorResponse(e,"Something went wrong while changing your password.\n Your password was not changed. Please try again.")}));case 10:return c=e.sent,this.changing=!1,e.abrupt("return",c);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"sync",value:(i=ga(a.a.mark((function e(t){var n,r,i,o,s,c,u,l,f,p,h,d=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.payloads,i=t.lastSyncToken,o=t.paginationToken,s=t.limit,c=t.checkIntegrity,u=t.contentType,l=t.customEvent,e.next=3,this.path("/items/sync");case 3:return f=e.sent,p=this.params((ya(n={},"items",r),ya(n,fa,i),ya(n,pa,o),ya(n,"compute_integrity",c),ya(n,"limit",s),ya(n,"content_type",u),ya(n,"event",l),n)),e.next=7,this.httpService.postAbsolute({url:f,params:p,authentication:this.session.token}).catch((function(e){return d.errorResponse(e,"Could not connect to server.")}));case 7:return h=e.sent,e.abrupt("return",h);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})}])&&ba(n.prototype,r),t}(qi),Sa=n(21),_a=n.n(Sa);function $a(e){return($a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Pa(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Oa(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Pa(a,r,i,o,s,"next",e)}function s(e){Pa(a,r,i,o,s,"throw",e)}o(void 0)}))}}function Ca(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ea(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Aa(e,t,n){return(Aa="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Ia(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function Ia(e){return(Ia=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ja(e,t){return(ja=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Da(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ma="stream-items",Ta="stream-context-item",Ra="save-items",La="create-item",Na="create-items",Fa="delete-items",Ua="set-component-data",Ka="component-registered",Va=function(e){function t(e){var n,r=e.modelManager,i=e.syncService,a=e.alertService,o=e.timeout,s=e.environment,c=e.platform;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t){return!t||"object"!==$a(t)&&"function"!=typeof t?Ea(e):t}(this,Ia(t).call(this)),Da(Ea(n),"detectFocusChange",(function(){var e=!0,t=!1,r=void 0;try{for(var i,a=function(){var e=i.value;if(document.activeElement===n.iframeForComponent(e))return n.timeout((function(){n.focusChangedForComponent(e)})),"break"},o=n.activeComponents[Symbol.iterator]();!(e=(i=o.next()).done)&&"break"!==a();e=!0);}catch(e){t=!0,r=e}finally{try{e||null==o.return||o.return()}finally{if(t)throw r}}})),Da(Ea(n),"onWindowMessage",(function(e){n.log("Web app: received message",e),e.data.sessionKey&&n.handleMessage(n.componentForSessionKey(e.data.sessionKey),e.data)})),t.ClientDataDomain="org.standardnotes.sn.components",n.timeout=o||setTimeout.bind(window),n.modelManager=r,n.syncService=i,n.alertService=a,n.environment=s,n.platform=c,n.isDesktop=n.environment===w.Desktop,n.isMobile=n.environment===w.Mobile,n.streamObservers=[],n.contextStreamObservers=[],n.activeComponents=[],n.permissionDialogs=[],n.handlers=[],n.configureForGeneralUsage(),s!==w.Mobile&&n.configureForNonMobileUsage(),n}var n,r,i,u,l,f,p,h,d,v;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ja(e,t)}(t,e),n=t,(r=[{key:"setDesktopManager",value:function(e){this.desktopManager=e,this.configureForDesktop()}},{key:"configureForGeneralUsage",value:function(){var e=this;this.modelManager.addMappingObserver("*",function(){var t=Oa(a.a.mark((function t(n,r,i,o,s){var u,l,f,p,h,d,v,y,m,g,b,w,k,x,S,_,$,P,O,C,E;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:(u=n.filter((function(e){return e.content_type===c.Component||e.content_type===c.Theme}))).length>0&&o!==Ln.RemoteSaved&&e.isDesktop&&e.desktopManager.syncComponentsInstallation(u),l=!0,f=!1,p=void 0,t.prev=5,h=u[Symbol.iterator]();case 7:if(l=(d=h.next()).done){t.next=21;break}if(v=d.value,y=pt()(e.activeComponents,{uuid:v.uuid}),!v.active||v.deleted||y){t.next=15;break}return t.next=13,e.activateComponent(v);case 13:t.next=18;break;case 15:if(v.active||!y){t.next=18;break}return t.next=18,e.deactivateComponent(v);case 18:l=!0,t.next=7;break;case 21:t.next=27;break;case 23:t.prev=23,t.t0=t.catch(5),f=!0,p=t.t0;case 27:t.prev=27,t.prev=28,l||null==h.return||h.return();case 30:if(t.prev=30,!f){t.next=33;break}throw p;case 33:return t.finish(30);case 34:return t.finish(27);case 35:m=!0,g=!1,b=void 0,t.prev=38,w=function(){var t=x.value;if(s&&s===t.component.uuid)return"continue";var r=n.filter((function(e){return-1!==t.contentTypes.indexOf(e.content_type)}));if(0===r.length)return"continue";var i=[{name:Ma,content_types:t.contentTypes.sort()}];e.runWithPermissions(t.component,i,(function(){e.sendItemsInReply(t.component,r,t.originalMessage)}))},k=e.streamObservers[Symbol.iterator]();case 41:if(m=(x=k.next()).done){t.next=48;break}if("continue"!==w()){t.next=45;break}return t.abrupt("continue",45);case 45:m=!0,t.next=41;break;case 48:t.next=54;break;case 50:t.prev=50,t.t1=t.catch(38),g=!0,b=t.t1;case 54:t.prev=54,t.prev=55,m||null==k.return||k.return();case 57:if(t.prev=57,!g){t.next=60;break}throw b;case 60:return t.finish(57);case 61:return t.finish(54);case 62:S=[{name:Ta}],_=!0,$=!1,P=void 0,t.prev=66,O=function(){var t=E.value;if(s&&s===t.component.uuid)return"continue";var r=!0,i=!1,a=void 0;try{for(var c,u=e.handlers[Symbol.iterator]();!(r=(c=u.next()).done);r=!0){var l=c.value;if((l.areas.includes(t.component.area)||l.areas.includes("*"))&&l.contextRequestHandler){var f=l.contextRequestHandler(t.component);f&&function(){var r=pt()(n,{uuid:f.uuid});r&&e.runWithPermissions(t.component,S,(function(){e.sendContextItemInReply(t.component,r,t.originalMessage,o)}))}()}}}catch(e){i=!0,a=e}finally{try{r||null==u.return||u.return()}finally{if(i)throw a}}},C=e.contextStreamObservers[Symbol.iterator]();case 69:if(_=(E=C.next()).done){t.next=76;break}if("continue"!==O()){t.next=73;break}return t.abrupt("continue",73);case 73:_=!0,t.next=69;break;case 76:t.next=82;break;case 78:t.prev=78,t.t2=t.catch(66),$=!0,P=t.t2;case 82:t.prev=82,t.prev=83,_||null==C.return||C.return();case 85:if(t.prev=85,!$){t.next=88;break}throw P;case 88:return t.finish(85);case 89:return t.finish(82);case 90:case"end":return t.stop()}}),t,null,[[5,23,27,35],[28,,30,34],[38,50,54,62],[55,,57,61],[66,78,82,90],[83,,85,89]])})));return function(e,n,r,i,a){return t.apply(this,arguments)}}())}},{key:"isNativeExtension",value:function(e){var t=[window._extensions_manager_location,window._batch_manager_location],n=e.content.hosted_url,r=e.content.local_url&&e.content.local_url.replace("sn://","");return t.includes(n)||t.includes(r)}},{key:"deinit",value:(v=Oa(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Aa(Ia(t.prototype),"deinit",this).call(this),window&&(window.removeEventListener("focus",this.detectFocusChange,!0),window.removeEventListener("blur",this.detectFocusChange,!0),window.removeEventListener("message",this.onWindowMessage));case 2:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{key:"configureForNonMobileUsage",value:function(){window.addEventListener?window.addEventListener("focus",this.detectFocusChange,!0):window.attachEvent("onfocusout",this.detectFocusChange),window.addEventListener?window.addEventListener("blur",this.detectFocusChange,!0):window.attachEvent("onblur",this.detectFocusChange),window.addEventListener("message",this.onWindowMessage)}},{key:"configureForDesktop",value:function(){var e=this;this.desktopManager.registerUpdateObserver((function(t){t.active&&t.isTheme()&&e.postActiveThemesToAllComponents()}))}},{key:"postActiveThemesToAllComponents",value:function(){var e=!0,t=!1,n=void 0;try{for(var r,i=this.components[Symbol.iterator]();!(e=(r=i.next()).done);e=!0){var a=r.value;!a.isTheme()&&a.active&&a.window&&this.postActiveThemesToComponent(a)}}catch(e){t=!0,n=e}finally{try{e||null==i.return||i.return()}finally{if(t)throw n}}}},{key:"getActiveThemes",value:function(){return this.componentsForArea(ot).filter((function(e){return e.active}))}},{key:"urlsForActiveThemes",value:function(){var e=this;return this.getActiveThemes().map((function(t){return e.urlForComponent(t)}))}},{key:"postActiveThemesToComponent",value:function(e){var t={themes:this.urlsForActiveThemes()};this.sendMessageToComponent(e,{action:"themes",data:t})}},{key:"contextItemDidChangeInArea",value:function(e){var t=!0,n=!1,r=void 0;try{for(var i,a=this.handlers[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){var o=i.value;if(!1!==o.areas.includes(e)||o.areas.includes("*")){var s=this.contextStreamObservers.filter((function(t){return t.component.area===e})),c=!0,u=!1,l=void 0;try{for(var f,p=s[Symbol.iterator]();!(c=(f=p.next()).done);c=!0){var h=f.value;if(o.contextRequestHandler){var d=o.contextRequestHandler(h.component);d&&this.sendContextItemInReply(h.component,d,h.originalMessage)}}}catch(e){u=!0,l=e}finally{try{c||null==p.return||p.return()}finally{if(u)throw l}}}}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}}},{key:"setComponentHidden",value:function(e,t){if(t)e.hidden=!0;else if(e.hidden){e.hidden=!1;var n=pt()(this.contextStreamObservers,{identifier:e.uuid});n&&this.handleStreamContextItemMessage(e,n.originalMessage);var r=pt()(this.streamObservers,{identifier:e.uuid});r&&this.handleStreamItemsMessage(e,r.originalMessage)}}},{key:"jsonForItem",value:function(e,n,r){var i={uuid:e.uuid,content_type:e.content_type,created_at:e.created_at,updated_at:e.updated_at,deleted:e.deleted};return i.content=e.collapseContent(),i.clientData=e.getDomainDataItem(n.getClientDataKey(),t.ClientDataDomain)||{},!r||r!==Ln.RemoteSaved&&r!==Ln.LocalSaved||(i.isMetadataUpdate=!0),this.removePrivatePropertiesFromResponseItems([i],n),i}},{key:"sendItemsInReply",value:function(e,t,n,r){var i=this;this.log("Web|componentManager|sendItemsInReply",e,t,n);var a={items:{}},o=t.map((function(t){return i.jsonForItem(t,e,r)}));a.items=o,this.replyToMessage(e,n,a)}},{key:"sendContextItemInReply",value:function(e,t,n,r){this.log("Web|componentManager|sendContextItemInReply",e,t,n);var i={item:this.jsonForItem(t,e,r)};this.replyToMessage(e,n,i)}},{key:"replyToMessage",value:function(e,t,n){var r={action:"reply",original:t,data:n};this.sendMessageToComponent(e,r)}},{key:"sendMessageToComponent",value:function(e,t){var n=[Ka,"themes"];if(!e.hidden||n.includes(t.action)){this.log("Web|sendMessageToComponent",e,t);var r=this.urlForComponent(e);r.startsWith("http")||r.startsWith("file")||(r=window.location.href+r),e.window||this.alertService.alert({text:"Standard Notes is trying to communicate with ".concat(e.name,", \n but an error is occurring. Please restart this extension and try again.")}),this.isMobile&&(t=JSON.stringify(t)),e.window.postMessage(t,r)}else this.log("Component disabled for current item, ignoring messages.",e.name)}},{key:"componentsForArea",value:function(e){return this.components.filter((function(t){return t.area===e}))}},{key:"urlForComponent",value:function(e){if(e.offlineOnly&&!this.isDesktop)return null;if(e.offlineOnly||this.isDesktop&&e.local_url)return e.local_url&&e.local_url.replace("sn://",this.desktopManager.getExtServerHost());var t=e.hosted_url||e.legacy_url;if(this.isMobile){var n=this.platform===k.Ios?"localhost":"10.0.2.2";t=t.replace("localhost",n).replace("sn.local",n)}return t}},{key:"componentForUrl",value:function(e){return this.components.filter((function(t){return t.hosted_url===e||t.legacy_url===e}))[0]}},{key:"componentForSessionKey",value:function(e){var t=pt()(this.components,{sessionKey:e});if(!t){var n=!0,r=!1,i=void 0;try{for(var a,o=this.handlers[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;if(s.componentForSessionKeyHandler&&(t=s.componentForSessionKeyHandler(e)))break}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}}return t}},{key:"handleMessage",value:function(e,t){var n=this;if(!e)return this.log("Component not defined for message, returning",t),void this.alertService.alert({text:"An extension is trying to communicate with Standard Notes,but there is an error establishing a bridge. Please restart the app and try again."});var r=[Ra,"associate-item","deassociate-item",La,Na,Fa,Ua];if(e.readonly&&r.includes(t.action))this.alertService.alert({text:"The extension ".concat(e.name," is trying to save, but it is in a locked state and cannot accept changes.")});else{if(t.action===Ma)this.handleStreamItemsMessage(e,t);else if(t.action===Ta)this.handleStreamContextItemMessage(e,t);else if(t.action===Ua)this.handleSetComponentDataMessage(e,t);else if(t.action===Fa)this.handleDeleteItemsMessage(e,t);else if(t.action===Na||t.action===La)this.handleCreateItemsMessage(e,t);else if(t.action===Ra)this.handleSaveItemsMessage(e,t);else if("toggle-activate-component"===t.action){var i=this.modelManager.findItem(t.data.uuid);this.handleToggleComponentMessage(e,i,t)}else"request-permissions"===t.action?this.handleRequestPermissionsMessage(e,t):"install-local-component"===t.action?this.handleInstallLocalComponentMessage(e,t):"duplicate-item"===t.action&&this.handleDuplicateItemMessage(e,t);var a=!0,o=!1,s=void 0;try{for(var c,u=function(){var r=c.value;r.actionHandler&&(r.areas.includes(e.area)||r.areas.includes("*"))&&n.timeout((function(){r.actionHandler(e,t.action,t.data)}))},l=this.handlers[Symbol.iterator]();!(a=(c=l.next()).done);a=!0)u()}catch(e){o=!0,s=e}finally{try{a||null==l.return||l.return()}finally{if(o)throw s}}}}},{key:"removePrivatePropertiesFromResponseItems",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(n.incoming){var r=["updated_at"],i=!0,a=!1,o=void 0;try{for(var s,c=e[Symbol.iterator]();!(i=(s=c.next()).done);i=!0){var u=s.value;if(u.isItem)console.error("Attempting to pass object. Use JSON.");else{var l=!0,f=!1,p=void 0;try{for(var h,d=r[Symbol.iterator]();!(l=(h=d.next()).done);l=!0){var v=h.value;delete u[v]}}catch(e){f=!0,p=e}finally{try{l||null==d.return||d.return()}finally{if(f)throw p}}}}}catch(e){a=!0,o=e}finally{try{i||null==c.return||c.return()}finally{if(a)throw o}}}if(!t||!this.isNativeExtension(t)){var y=["autoupdateDisabled","permissions","active"];n&&n.includeUrls&&(y=y.concat(["url","hosted_url","local_url"]));var m=!0,g=!1,b=void 0;try{for(var w,k=e[Symbol.iterator]();!(m=(w=k.next()).done);m=!0){var x=w.value;if(x.isItem)console.error("Attempting to pass object. Use JSON.");else{var S=!0,_=!1,$=void 0;try{for(var P,O=y[Symbol.iterator]();!(S=(P=O.next()).done);S=!0){var C=P.value;delete x.content[C]}}catch(e){_=!0,$=e}finally{try{S||null==O.return||O.return()}finally{if(_)throw $}}}}}catch(e){g=!0,b=e}finally{try{m||null==k.return||k.return()}finally{if(g)throw b}}}}},{key:"handleStreamItemsMessage",value:function(e,t){var n=this,r=[{name:Ma,content_types:t.data.content_types.sort()}];this.runWithPermissions(e,r,(function(){pt()(n.streamObservers,{identifier:e.uuid})||n.streamObservers.push({identifier:e.uuid,component:e,originalMessage:t,contentTypes:t.data.content_types});var r=[],i=!0,a=!1,o=void 0;try{for(var s,c=t.data.content_types[Symbol.iterator]();!(i=(s=c.next()).done);i=!0){var u=s.value;r=r.concat(n.modelManager.validItemsForContentType(u))}}catch(e){a=!0,o=e}finally{try{i||null==c.return||c.return()}finally{if(a)throw o}}n.sendItemsInReply(e,r,t)}))}},{key:"handleStreamContextItemMessage",value:function(e,t){var n=this,r=[{name:Ta}];this.runWithPermissions(e,r,(function(){pt()(n.contextStreamObservers,{identifier:e.uuid})||n.contextStreamObservers.push({identifier:e.uuid,component:e,originalMessage:t});var r=!0,i=!1,a=void 0;try{for(var o,s=n.handlersForArea(e.area)[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var c=o.value;if(c.contextRequestHandler){var u=c.contextRequestHandler(e);u&&n.sendContextItemInReply(e,u,t)}}}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}}))}},{key:"isItemIdWithinComponentContextJurisdiction",value:function(e,t){return this.itemIdsInContextJurisdictionForComponent(t).includes(e)}},{key:"itemIdsInContextJurisdictionForComponent",value:function(e){var t=[],n=!0,r=!1,i=void 0;try{for(var a,o=this.handlersForArea(e.area)[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;if(s.contextRequestHandler){var c=s.contextRequestHandler(e);c&&t.push(c.uuid)}}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}return t}},{key:"handlersForArea",value:function(e){return this.handlers.filter((function(t){return t.areas.includes(e)}))}},{key:"handleSaveItemsMessage",value:(d=Oa(a.a.mark((function e(n,r){var i,o,s,c,u,l,f,p,h,d,v,y=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=r.data.items,o=[],s=this.itemIdsInContextJurisdictionForComponent(n),c=i.slice(),u=!0,l=!1,f=void 0,e.prev=7,p=i.slice()[Symbol.iterator]();case 9:if(u=(h=p.next()).done){e.next=18;break}if(d=h.value,!s.includes(d.uuid)){e.next=15;break}return o.push({name:Ta}),dt()(c,d),e.abrupt("break",18);case 15:u=!0,e.next=9;break;case 18:e.next=24;break;case 20:e.prev=20,e.t0=e.catch(7),l=!0,f=e.t0;case 24:e.prev=24,e.prev=25,u||null==p.return||p.return();case 27:if(e.prev=27,!l){e.next=30;break}throw f;case 30:return e.finish(27);case 31:return e.finish(24);case 32:c.length>0&&(v=_a()(c.map((function(e){return e.content_type}))).sort(),o.push({name:Ma,content_types:v})),this.runWithPermissions(n,o,Oa(a.a.mark((function e(){var o,s,c,u,l,f,p,h,d,v,m,g,b,w,k,x,S,_,$,P;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(y.removePrivatePropertiesFromResponseItems(i,n,{includeUrls:!0,incoming:!0}),o=i.map((function(e){return e.uuid})),s=y.modelManager.findItems(o),c=0,u=!0,l=!1,f=void 0,e.prev=7,p=s[Symbol.iterator]();!(u=(h=p.next()).done);u=!0)(d=h.value).locked&&(yt()(i,{uuid:d.uuid}),c++);e.next=15;break;case 11:e.prev=11,e.t0=e.catch(7),l=!0,f=e.t0;case 15:e.prev=15,e.prev=16,u||null==p.return||p.return();case 18:if(e.prev=18,!l){e.next=21;break}throw f;case 21:return e.finish(18);case 22:return e.finish(15);case 23:return c>0&&(v=1===c?"item":"items",m=1===c?"is":"are",y.alertService.alert({title:"Items Locked",text:"".concat(c," ").concat(v," you are attempting to save ").concat(m," locked and cannot be edited.")})),g=i.map((function(e){return Ri({object:e})})),e.next=27,y.modelManager.mapPayloadsToLocalItems({paylods:g,source:Ln.ComponentRetrieved,sourceKey:n.uuid});case 27:b=e.sent,w=!0,k=!1,x=void 0,e.prev=31,S=i[Symbol.iterator]();case 33:if(w=(_=S.next()).done){e.next=46;break}if($=_.value,P=pt()(b,{uuid:$.uuid})){e.next=39;break}return y.alertService.alert({text:"The extension ".concat(n.name," is trying to save an item with type")+"".concat($.content_type,", but that item does not exist. Please restart this extension and try again.")}),e.abrupt("continue",43);case 39:if(P.locked){e.next=43;break}return $.clientData&&P.setDomainDataItem(n.getClientDataKey(),$.clientData,t.ClientDataDomain),e.next=43,y.modelManager.setItemDirty(P,!0,!0,Ln.ComponentRetrieved,n.uuid);case 43:w=!0,e.next=33;break;case 46:e.next=52;break;case 48:e.prev=48,e.t1=e.catch(31),k=!0,x=e.t1;case 52:e.prev=52,e.prev=53,w||null==S.return||S.return();case 55:if(e.prev=55,!k){e.next=58;break}throw x;case 58:return e.finish(55);case 59:return e.finish(52);case 60:y.syncService.sync().then((function(e){var t=Object.assign({},r);t.action=e&&e.error?"save-error":"save-success",y.replyToMessage(n,r,{error:e&&e.error}),y.handleMessage(n,t)}));case 61:case"end":return e.stop()}}),e,null,[[7,11,15,23],[16,,18,22],[31,48,52,60],[53,,55,59]])}))));case 34:case"end":return e.stop()}}),e,this,[[7,20,24,32],[25,,27,31]])}))),function(e,t){return d.apply(this,arguments)})},{key:"handleDuplicateItemMessage",value:function(e,t){var n=this,r=t.data.item,i=this.modelManager.findItem(r.uuid),o=[{name:Ma,content_types:[i.content_type]}];this.runWithPermissions(e,o,Oa(a.a.mark((function r(){var o;return a.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,n.modelManager.duplicateItem({item:i});case 2:o=r.sent,n.syncService.sync(),n.replyToMessage(e,t,{item:n.jsonForItem(o,e)});case 5:case"end":return r.stop()}}),r)}))))}},{key:"handleCreateItemsMessage",value:function(e,n){var r=this,i=n.data.item?[n.data.item]:n.data.items,o=_a()(i.map((function(e){return e.content_type}))),s=[{name:Ma,content_types:o}];this.runWithPermissions(e,s,Oa(a.a.mark((function o(){var s,c,u,l,f,p,h,d,v,y;return a.a.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:r.removePrivatePropertiesFromResponseItems(i,e,{incoming:!0}),s=[],c=!0,u=!1,l=void 0,a.prev=5,f=i[Symbol.iterator]();case 7:if(c=(p=f.next()).done){a.next=21;break}return h=p.value,d=Ni({object:h,source:Ln.RemoteRetrieved}),v=Cn(d),h.clientData&&v.setDomainDataItem(e.getClientDataKey(),h.clientData,t.ClientDataDomain),r.modelManager.addItem(v),a.next=15,r.modelManager.resolveReferencesForItem(v,!0);case 15:return a.next=17,r.modelManager.setItemDirty(v,!0);case 17:s.push(v);case 18:c=!0,a.next=7;break;case 21:a.next=27;break;case 23:a.prev=23,a.t0=a.catch(5),u=!0,l=a.t0;case 27:a.prev=27,a.prev=28,c||null==f.return||f.return();case 30:if(a.prev=30,!u){a.next=33;break}throw l;case 33:return a.finish(30);case 34:return a.finish(27);case 35:r.syncService.sync(),y=n.action===La?{item:r.jsonForItem(s[0],e)}:{items:s.map((function(t){return r.jsonForItem(t,e)}))},r.replyToMessage(e,n,y);case 38:case"end":return a.stop()}}),o,null,[[5,23,27,35],[28,,30,34]])}))))}},{key:"handleDeleteItemsMessage",value:function(e,t){var n=this,r=_a()(t.data.items.map((function(e){return e.content_type}))).sort(),i=[{name:Ma,content_types:r}];this.runWithPermissions(e,i,Oa(a.a.mark((function r(){var i,o,s,u,l,f,p,h,d,v,y;return a.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=t.data.items,o=1===i.length?"item":"items",s=null,u=!0,r.next=6,n.alertService.confirm({text:"Are you sure you want to delete ".concat(i.length," ").concat(o,"?")}).catch((function(){u=!1}));case 6:if(!u){r.next=45;break}l=!0,f=!1,p=void 0,r.prev=10,h=i[Symbol.iterator]();case 12:if(l=(d=h.next()).done){r.next=27;break}if(v=d.value,y=n.modelManager.findItem(v.uuid)){r.next=18;break}return n.alertService.alert({text:"The item you are trying to delete cannot be found."}),r.abrupt("continue",24);case 18:if(![c.Component,c.Theme].includes(y.content_type)){r.next=21;break}return r.next=21,n.deactivateComponent(y,!0);case 21:return r.next=23,n.modelManager.setItemToBeDeleted(y);case 23:n.modelManager.notifyMappingObservers([y],Ln.RemoteSaved);case 24:l=!0,r.next=12;break;case 27:r.next=33;break;case 29:r.prev=29,r.t0=r.catch(10),f=!0,p=r.t0;case 33:r.prev=33,r.prev=34,l||null==h.return||h.return();case 36:if(r.prev=36,!f){r.next=39;break}throw p;case 39:return r.finish(36);case 40:return r.finish(33);case 41:n.syncService.sync(),s={deleted:!0},r.next=46;break;case 45:s={deleted:!1};case 46:n.replyToMessage(e,t,s);case 47:case"end":return r.stop()}}),r,null,[[10,29,33,41],[34,,36,40]])}))))}},{key:"handleRequestPermissionsMessage",value:function(e,t){var n=this;this.runWithPermissions(e,t.data.permissions,(function(){n.replyToMessage(e,t,{approved:!0})}))}},{key:"handleSetComponentDataMessage",value:function(e,t){var n=this;this.runWithPermissions(e,[],Oa(a.a.mark((function r(){return a.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e.componentData=t.data.componentData,r.next=3,n.modelManager.setItemDirty(e,!0);case 3:n.syncService.sync();case 4:case"end":return r.stop()}}),r)}))))}},{key:"handleToggleComponentMessage",value:function(e,t,n){this.toggleComponent(t)}},{key:"toggleComponent",value:(h=Oa(a.a.mark((function e(t){var n,r=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("modal"!==t.area){e.next=4;break}this.openModalComponent(t),e.next=18;break;case 4:if(!t.active){e.next=9;break}return e.next=7,this.deactivateComponent(t);case 7:e.next=18;break;case 9:if(t.content_type!==c.Theme){e.next=16;break}return n=this.getActiveThemes(),e.next=13,this.activateComponent(t);case 13:t.isLayerable()||setTimeout(Oa(a.a.mark((function e(){var t,i,o,s,c,u;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=!0,i=!1,o=void 0,e.prev=3,s=n[Symbol.iterator]();case 5:if(t=(c=s.next()).done){e.next=13;break}if(!(u=c.value)||u.isLayerable()){e.next=10;break}return e.next=10,r.deactivateComponent(u);case 10:t=!0,e.next=5;break;case 13:e.next=19;break;case 15:e.prev=15,e.t0=e.catch(3),i=!0,o=e.t0;case 19:e.prev=19,e.prev=20,t||null==s.return||s.return();case 22:if(e.prev=22,!i){e.next=25;break}throw o;case 25:return e.finish(22);case 26:return e.finish(19);case 27:case"end":return e.stop()}}),e,null,[[3,15,19,27],[20,,22,26]])}))),10),e.next=18;break;case 16:return e.next=18,this.activateComponent(t);case 18:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"handleInstallLocalComponentMessage",value:function(e,t){if(this.isNativeExtension(e)){var n=this.modelManager.findItem(t.data.uuid);this.desktopManager.installComponent(n)}}},{key:"runWithPermissions",value:function(e,t,n){e.permissions||(e.permissions=[]),t=Object(o.a)(t);var r=e.permissions,i=!0,a=!1,s=void 0;try{for(var c,u=function(){var e=c.value,n=r.find((function(t){return t.name===e.name}));if(!n)return"continue";var i=e.content_types;if(!i)return dt()(t,e),"continue";var a=!0,o=!1,s=void 0;try{for(var u,l=n.content_types[Symbol.iterator]();!(a=(u=l.next()).done);a=!0){var f=u.value;dt()(i,f)}}catch(e){o=!0,s=e}finally{try{a||null==l.return||l.return()}finally{if(o)throw s}}0===i.length&&dt()(t,e)},l=t.slice()[Symbol.iterator]();!(i=(c=l.next()).done);i=!0)u()}catch(e){a=!0,s=e}finally{try{i||null==l.return||l.return()}finally{if(a)throw s}}t.length>0?this.promptForPermissions(e,t,(function(e){e&&n()})):n()}},{key:"promptForPermissions",value:function(e,t,n){var r=this,i={};i.component=e,i.permissions=t,i.permissionsString=this.permissionsStringForPermissions(t,e),i.actionBlock=n,i.callback=function(){var n=Oa(a.a.mark((function n(o){var s,c,u,l,f,p;return a.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!o){n.next=24;break}for(s=!0,c=!1,u=void 0,n.prev=4,l=function(){var t=p.value,n=e.permissions.find((function(e){return e.name===t.name}));if(n){var r=n.content_types||[];n.content_types=_a()(r.concat(t.content_types))}else e.permissions.push(t)},f=t[Symbol.iterator]();!(s=(p=f.next()).done);s=!0)l();n.next=13;break;case 9:n.prev=9,n.t0=n.catch(4),c=!0,u=n.t0;case 13:n.prev=13,n.prev=14,s||null==f.return||f.return();case 16:if(n.prev=16,!c){n.next=19;break}throw u;case 19:return n.finish(16);case 20:return n.finish(13);case 21:return n.next=23,r.modelManager.setItemDirty(e,!0);case 23:r.syncService.sync();case 24:r.permissionDialogs=r.permissionDialogs.filter((function(n){return n===i?(n.actionBlock&&n.actionBlock(o),!1):!!(n.component!==e||n.permissions!==t&&(r=t,n.permissions.some((function(e){return!r.find((function(t){return JSON.stringify(t)===JSON.stringify(e)}))}))))||(o&&n.actionBlock&&n.actionBlock(o),!1);var r})),r.permissionDialogs.length>0&&r.presentPermissionsDialog(r.permissionDialogs[0]);case 26:case"end":return n.stop()}}),n,null,[[4,9,13,21],[14,,16,20]])})));return function(e){return n.apply(this,arguments)}}();var o=pt()(this.permissionDialogs,{component:e});this.permissionDialogs.push(i),o?this.log("Existing dialog, not presenting."):this.presentPermissionsDialog(i)}},{key:"presentPermissionsDialog",value:function(e){throw"Must override SNComponentManager.presentPermissionsDialog"}},{key:"openModalComponent",value:function(e){throw"Must override SNComponentManager.presentPermissionsDialog"}},{key:"registerHandler",value:function(e){this.handlers.push(e)}},{key:"deregisterHandler",value:function(e){var t=pt()(this.handlers,{identifier:e});t?this.handlers.splice(this.handlers.indexOf(t),1):this.log("Attempting to deregister non-existing handler")}},{key:"registerComponentWindow",value:(p=Oa(a.a.mark((function e(t,n){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.window===n&&this.log("Web|componentManager","attempting to re-register same component window."),this.log("Web|componentManager|registerComponentWindow",t),t.window=n,e.next=5,j.GenerateUuid();case 5:t.sessionKey=e.sent,this.sendMessageToComponent(t,{action:Ka,sessionKey:t.sessionKey,componentData:t.componentData,data:{uuid:t.uuid,environment:(a=this.environment,(b(o={},w.Web,"web"),b(o,w.Desktop,"desktop"),b(o,w.Mobile,"mobile"),o)[a]),platform:(r=this.platform,(b(i={},k.MacWeb,"mac-web"),b(i,k.MacDesktop,"mac-desktop"),b(i,k.LinuxWeb,"linux-web"),b(i,k.LinuxDesktop,"linux-desktop"),b(i,k.WindowsWeb,"windows-web"),b(i,k.WindowsDesktop,"windows-desktop"),b(i,k.Ios,"ios"),b(i,k.Android,"android"),i)[r]),activeThemeUrls:this.urlsForActiveThemes()}}),this.postActiveThemesToComponent(t),this.desktopManager&&this.desktopManager.notifyComponentActivation(t);case 9:case"end":return e.stop()}var r,i,a,o}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"activateComponent",value:(f=Oa(a.a.mark((function e(t){var n,r,i,o,s,c,u,l,f=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(n=f.length>1&&void 0!==f[1]&&f[1],r=!0!==t.active,t.active=!0,i=!0,o=!1,s=void 0,e.prev=6,c=this.handlers[Symbol.iterator]();!(i=(u=c.next()).done);i=!0)((l=u.value).areas.includes(t.area)||l.areas.includes("*"))&&l.activationHandler&&l.activationHandler(t);e.next=14;break;case 10:e.prev=10,e.t0=e.catch(6),o=!0,s=e.t0;case 14:e.prev=14,e.prev=15,i||null==c.return||c.return();case 17:if(e.prev=17,!o){e.next=20;break}throw s;case 20:return e.finish(17);case 21:return e.finish(14);case 22:if(!r||n){e.next=26;break}return e.next=25,this.modelManager.setItemDirty(t,!0);case 25:this.syncService.sync();case 26:this.activeComponents.includes(t)||this.activeComponents.push(t),t.area===ot&&this.postActiveThemesToAllComponents();case 28:case"end":return e.stop()}}),e,this,[[6,10,14,22],[15,,17,21]])}))),function(e){return f.apply(this,arguments)})},{key:"deactivateComponent",value:(l=Oa(a.a.mark((function e(t){var n,r,i,o,s,c,u,l,f=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(n=f.length>1&&void 0!==f[1]&&f[1],r=!1!==t.active,t.active=!1,t.sessionKey=null,i=!0,o=!1,s=void 0,e.prev=7,c=this.handlers[Symbol.iterator]();!(i=(u=c.next()).done);i=!0)((l=u.value).areas.includes(t.area)||l.areas.includes("*"))&&l.activationHandler&&l.activationHandler(t);e.next=15;break;case 11:e.prev=11,e.t0=e.catch(7),o=!0,s=e.t0;case 15:e.prev=15,e.prev=16,i||null==c.return||c.return();case 18:if(e.prev=18,!o){e.next=21;break}throw s;case 21:return e.finish(18);case 22:return e.finish(15);case 23:if(!r||n){e.next=27;break}return e.next=26,this.modelManager.setItemDirty(t,!0);case 26:this.syncService.sync();case 27:dt()(this.activeComponents,t),this.streamObservers=this.streamObservers.filter((function(e){return e.component!==t})),this.contextStreamObservers=this.contextStreamObservers.filter((function(e){return e.component!==t})),t.area===ot&&this.postActiveThemesToAllComponents();case 31:case"end":return e.stop()}}),e,this,[[7,11,15,23],[16,,18,22]])}))),function(e){return l.apply(this,arguments)})},{key:"reloadComponent",value:(u=Oa(a.a.mark((function e(t){var n,r,i,o,s,c,u=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t.active=!1,n=!0,r=!1,i=void 0,e.prev=4,o=this.handlers[Symbol.iterator]();!(n=(s=o.next()).done);n=!0)((c=s.value).areas.includes(t.area)||c.areas.includes("*"))&&c.activationHandler&&c.activationHandler(t);e.next=12;break;case 8:e.prev=8,e.t0=e.catch(4),r=!0,i=e.t0;case 12:e.prev=12,e.prev=13,n||null==o.return||o.return();case 15:if(e.prev=15,!r){e.next=18;break}throw i;case 18:return e.finish(15);case 19:return e.finish(12);case 20:return this.streamObservers=this.streamObservers.filter((function(e){return e.component!==t})),this.contextStreamObservers=this.contextStreamObservers.filter((function(e){return e.component!==t})),t.area===ot&&this.postActiveThemesToAllComponents(),e.abrupt("return",new Promise((function(e,n){u.timeout((function(){t.active=!0;var n=!0,r=!1,i=void 0;try{for(var a,o=u.handlers[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;(s.areas.includes(t.area)||s.areas.includes("*"))&&(s.activationHandler&&s.activationHandler(t),e())}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}u.activeComponents.includes(t)||u.activeComponents.push(t),t.area===ot&&u.postActiveThemesToAllComponents(),e()}))})));case 24:case"end":return e.stop()}}),e,this,[[4,8,12,20],[13,,15,19]])}))),function(e){return u.apply(this,arguments)})},{key:"deleteComponent",value:(i=Oa(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.modelManager.setItemToBeDeleted(t);case 2:this.syncService.sync();case 3:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"isComponentActive",value:function(e){return e.active}},{key:"iframeForComponent",value:function(e){for(var t=0,n=Array.from(document.getElementsByTagName("iframe"));t<n.length;t++){var r=n[t];if(r.dataset.componentId===e.uuid)return r}}},{key:"focusChangedForComponent",value:function(e){var t=document.activeElement===this.iframeForComponent(e),n=!0,r=!1,i=void 0;try{for(var a,o=this.handlers[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;s.focusHandler&&s.focusHandler(e,t)}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}}},{key:"handleSetSizeEvent",value:function(e,t){var n=function(e,n){var r=Object(o.n)(n.width)?n.width:"".concat(t.width,"px"),i=Object(o.n)(n.height)?n.height:"".concat(t.height,"px");e&&e.setAttribute("style","width:".concat(r,"; height:").concat(i,";"))};if("rooms"===e.area||"modal"===e.area){var r="rooms"===e.area?"inner":"outer",i=document.getElementById("component-content-".concat(r,"-").concat(e.uuid));i&&n(i,t)}else{var a=this.iframeForComponent(e);if(!a)return;if(n(a,t),e.area===st){var s=a.parentElement;s&&n(s,t)}}}},{key:"editorForNote",value:function(e){var t=this.componentsForArea(at),n=!0,r=!1,i=void 0;try{for(var a,o=t[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;if(s.isExplicitlyEnabledForItem(e))return s}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}if(this.isMobile){if(!e.content.mobilePrefersPlainEditor)return this.getDefaultEditor()}else if(!e.getAppDataItem("prefersPlainEditor"))return t.filter((function(e){return e.isDefaultEditor()}))[0]}},{key:"permissionsStringForPermissions",value:function(e,t){var n="",r=e.length,i=function(e,t){return e>0?e===t-1?2===t?" and ":", and ":", ":""};return e.forEach((function(e,a){if(e.name===Ma){for(var o=e.content_types.map((function(e){var t,n,r=(t=e,(n={},s(n,c.Note,"note"),s(n,c.Tag,"tag"),s(n,c.SmartTag,"smart tag"),s(n,c.ActionsExtension,"action-based extension"),s(n,c.Component,"component"),s(n,c.Editor,"editor"),s(n,c.Theme,"theme"),s(n,c.ServerExtension,"server extension"),s(n,c.Mfa,"two-factor authentication setting"),s(n,c.FilesafeCredentials,"FileSafe credential"),s(n,c.FilesafeFileMetadata,"FileSafe file"),s(n,c.FilesafeIntegration,"FileSafe integration"),n)[t]);return r?r+"s":"items of type "+e})),u="",l=0;l<o.length;l++){var f=o[l];u+=i(l,o.length+r-a-1),u+=f}n+=i(a,r),n+=u,o.length>=2&&a<r-1&&(n+=", ")}else if(e.name===Ta){var p,h=(Da(p={},st,"working note"),Da(p,"note-tags","working note"),Da(p,at,"working note"),p);n+=i(a,r),n+=h[t.area]}})),n+"."}},{key:"components",get:function(){return this.modelManager.getItems([c.Component,c.Theme])}}])&&Ca(n.prototype,r),t}(qi);function Ba(e){return(Ba="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ha(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function za(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Ha(a,r,i,o,s,"next",e)}function s(e){Ha(a,r,i,o,s,"throw",e)}o(void 0)}))}}function Wa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qa(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ga(e,t){return!t||"object"!==Ba(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Ya(e){return(Ya=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ja(e,t){return(Ja=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Qa=function(e){function t(){return Wa(this,t),Ga(this,Ya(t).apply(this,arguments))}var n,r,i,s,c,u,l;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ja(e,t)}(t,e),n=t,(r=[{key:"getAbsolute",value:(l=za(a.a.mark((function e(t){var n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.url,r=t.params,i=t.authentication,e.abrupt("return",this.runHttp({verb:"get",url:n,params:r,authentication:i}));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"postAbsolute",value:(u=za(a.a.mark((function e(t){var n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.url,r=t.params,i=t.authentication,e.abrupt("return",this.runHttp({verb:"post",url:n,params:r,authentication:i}));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"patchAbsolute",value:(c=za(a.a.mark((function e(t){var n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.url,r=t.params,i=t.authentication,e.abrupt("return",this.runHttp({verb:"patch",url:n,params:r,authentication:i}));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"runHttp",value:(s=za(a.a.mark((function e(t){var n,r,i,o,s;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.verb,r=t.url,i=t.params,o=t.authentication,s=this.createRequest({verb:n,url:r,params:i,authentication:o}),e.abrupt("return",this.runRequest({request:s,verb:n,params:i}));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"createRequest",value:function(e){var t=e.verb,n=e.url,r=e.params,i=e.authentication,a=new XMLHttpRequest;return"get"===t&&Object.keys(r).length>0&&(n=this.urlForUrlAndParams(n,r)),a.open(t,n,!0),a.setRequestHeader("Content-type","application/json"),i&&a.setRequestHeader("Authorization","Bearer "+i),a}},{key:"runRequest",value:(i=za(a.a.mark((function e(t){var n,r,i,o=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.request,r=t.verb,i=t.params,e.abrupt("return",new Promise((function(e,t){n.onreadystatechange=function(){o.stateChangeHandlerForRequest(n,e,t)},"post"===r||"patch"===r?n.send(JSON.stringify(i)):n.send()})));case 2:case"end":return e.stop()}}),e)}))),function(e){return i.apply(this,arguments)})},{key:"stateChangeHandlerForRequest",value:function(e,t,n){if(4===e.readyState){var r=e.responseText;if(r)try{r=JSON.parse(r)}catch(e){}Object(o.m)(r)||(r={});var i=e.status;i>=200&&i<=299?(r.status=i,t(r)):(console.error("Request error:",r),Object(o.n)(r)&&(r={error:{message:r}}),r.error||(r.error={status:i}),r.status=i,n(r))}}},{key:"urlForUrlAndParams",value:function(e,t){var n=Object.keys(t).map((function(e){return e+"="+encodeURIComponent(t[e])})).join("&");return e.includes("?")?e+"&"+n:e+"?"+n}}])&&qa(n.prototype,r),t}(qi),Za=n(53),Xa=n.n(Za);function eo(e){return(eo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function to(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function no(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function ro(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){no(a,r,i,o,s,"next",e)}function s(e){no(a,r,i,o,s,"throw",e)}o(void 0)}))}}function io(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ao(e,t,n){return(ao="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=oo(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function oo(e){return(oo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function so(e,t){return(so=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var co=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=function(e,t){return!t||"object"!==eo(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,oo(t).call(this))).mappingObservers=[],e.creationObservers=[],e.items=[],e.itemsKeys=[],e.notes=[],e.tags=[],e.components=[],e.itemsHash={},e.resolveQueue={},e.masterCollection=new f,e.systemSmartTags=ln.systemSmartTags(),e}var n,r,i,s,u,l,p,h,d,y,m,g,b,w,k,x,S,_,$,P,O,C,E,A,I,D,M;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&so(e,t)}(t,e),n=t,(r=[{key:"getMasterCollection",value:function(){return this.masterCollection}},{key:"deinit",value:function(){ao(oo(t.prototype),"deinit",this).call(this),this.resetState()}},{key:"resetState",value:function(){this.items.length=0,this.itemsKeys.length=0,this.notes.length=0,this.tags.length=0,this.components.length=0,this.itemsHash={},this.resolveQueue={},this.masterCollection=new f}},{key:"setItemProperties",value:(M=ro(a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.item,r=t.properties,e.abrupt("return",this.setItemsProperties({items:[n],properties:r}));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return M.apply(this,arguments)})},{key:"setItemsProperties",value:(D=ro(a.a.mark((function e(t){var n,r,i,o,s,c,u,l,f,p,h,d,v,y,m;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.items,r=t.properties,i=Object.keys(r),o=!0,s=!1,c=void 0,e.prev=5,u=n[Symbol.iterator]();case 7:if(o=(l=u.next()).done){e.next=31;break}for(f=l.value,p=!0,h=!1,d=void 0,e.prev=12,v=i[Symbol.iterator]();!(p=(y=v.next()).done);p=!0)m=y.value,f[m]=r[m];e.next=20;break;case 16:e.prev=16,e.t0=e.catch(12),h=!0,d=e.t0;case 20:e.prev=20,e.prev=21,p||null==v.return||v.return();case 23:if(e.prev=23,!h){e.next=26;break}throw d;case 26:return e.finish(23);case 27:return e.finish(20);case 28:o=!0,e.next=7;break;case 31:e.next=37;break;case 33:e.prev=33,e.t1=e.catch(5),s=!0,c=e.t1;case 37:e.prev=37,e.prev=38,o||null==u.return||u.return();case 40:if(e.prev=40,!s){e.next=43;break}throw c;case 43:return e.finish(40);case 44:return e.finish(37);case 45:return e.next=47,this.mapItems({items:n});case 47:case"end":return e.stop()}}),e,this,[[5,33,37,45],[12,16,20,28],[21,,23,27],[38,,40,44]])}))),function(e){return D.apply(this,arguments)})},{key:"modifyItem",value:(I=ro(a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.item,r=t.modifier,e.abrupt("return",this.modifyItems({items:[n],modifier:r}));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return I.apply(this,arguments)})},{key:"modifyItems",value:(A=ro(a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.items,r=t.modifier,e.next=3,r();case 3:return e.next=5,this.setItemsDirty(n,!0);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return A.apply(this,arguments)})},{key:"mapCollectionToLocalItems",value:(E=ro(a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.collection,r=t.sourceKey,e.abrupt("return",this.mapPayloadsToLocalItems({payloads:n.allPayloads,source:n.source,sourceKey:r}));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return E.apply(this,arguments)})},{key:"mapItem",value:(C=ro(a.a.mark((function e(t){var n,r,i,o;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.item,r=t.source,i=t.sourceKey,e.next=3,this.mapItems({items:[n],source:r,sourceKey:i});case 3:return o=e.sent,e.abrupt("return",o[0]);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return C.apply(this,arguments)})},{key:"mapItems",value:(O=ro(a.a.mark((function e(t){var n,r,i,o;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.items,r=t.source,i=t.sourceKey,o=n.map((function(e){return e.payloadRepresentation()})),e.abrupt("return",this.mapPayloadsToLocalItems({payloads:o,source:r,sourceKey:i}));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return O.apply(this,arguments)})},{key:"mapPayloadToLocalItem",value:(P=ro(a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.payload,e.next=3,this.mapPayloadsToLocalItems({payloads:[n]});case 3:return r=e.sent,e.abrupt("return",r[0]);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return P.apply(this,arguments)})},{key:"mapPayloadsToLocalItems",value:($=ro(a.a.mark((function e(t){var n,r,i,o,s,c,u,l,p,h,d,v,y,m,g,b,w,k,x,S,_,$,P,O,C,E,A,I,j;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.payloads,r=t.source,i=t.sourceKey,o=[],s=[],c={},u=!0,l=!1,p=void 0,e.prev=7,h=n[Symbol.iterator]();case 9:if(u=(d=h.next()).done){e.next=40;break}if(v=d.value){e.next=14;break}return console.error("Payload is null"),e.abrupt("continue",37);case 14:if(v.isPayload){e.next=16;break}throw"Attempting to map non-payload object into local model.";case 16:if(v.content_type&&v.uuid||v.deleted){e.next=20;break}return console.error("Payload is corrupt:",v),e.abrupt("continue",37);case 20:if(y=this.findItem(v.uuid),m=!1,!0!==v.deleted){e.next=34;break}if(!v.dirty){e.next=28;break}m=!0,y&&(this.removeItemFromRespectiveArray(y),y.updateLocalRelationships()),e.next=34;break;case 28:if(!y){e.next=33;break}return e.next=31,this.removeItemLocally(y);case 31:e.next=34;break;case 33:return e.abrupt("continue",37);case 34:y?y.updateFromPayload(v):(y=Cn(v),this.insertItems({items:[y],globalOnly:m}),s.push(y)),y.errorDecrypting||o.push(y),c[y.uuid]={item:y,payload:v};case 37:u=!0,e.next=9;break;case 40:e.next=46;break;case 42:e.prev=42,e.t0=e.catch(7),l=!0,p=e.t0;case 46:e.prev=46,e.prev=47,u||null==h.return||h.return();case 49:if(e.prev=49,!l){e.next=52;break}throw p;case 52:return e.finish(49);case 53:return e.finish(46);case 54:g=[],b=[],w=0,k=Object.keys(c);case 57:if(!(w<k.length)){e.next=89;break}if(x=k[w],S=c[x],_=S.item,$=S.payload,g.push($),b.push(_),!$.content){e.next=65;break}return e.next=65,this.resolveReferencesForItem(_);case 65:for(P=this.popItemsInterestedInMissingItem({item:_}),O=!0,C=!1,E=void 0,e.prev=69,A=P[Symbol.iterator]();!(O=(I=A.next()).done);O=!0)I.value.addItemAsRelationship(_);e.next=77;break;case 73:e.prev=73,e.t1=e.catch(69),C=!0,E=e.t1;case 77:e.prev=77,e.prev=78,O||null==A.return||A.return();case 80:if(e.prev=80,!C){e.next=83;break}throw E;case 83:return e.finish(80);case 84:return e.finish(77);case 85:_.didCompleteMapping(r);case 86:w++,e.next=57;break;case 89:if(j=new f({payloads:b.map((function(e){return e.payloadRepresentation()})),source:r}),this.masterCollection=this.masterCollection.concat(j),!(s.length>0)){e.next=94;break}return e.next=94,this.notifyCreationObservers(s,r,i);case 94:return e.next=96,this.notifyMappingObservers(o,r,i);case 96:return e.abrupt("return",b);case 97:case"end":return e.stop()}}),e,this,[[7,42,46,54],[47,,49,53],[69,73,77,85],[78,,80,84]])}))),function(e){return $.apply(this,arguments)})},{key:"insertItem",value:function(e){var t=e.item;this.insertItems({items:[t]})}},{key:"insertItems",value:function(e){var t=e.items,n=e.globalOnly,r=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var u=o.value;if(!this.itemsHash[u.uuid]&&(this.itemsHash[u.uuid]=u,this.items.push(u),!n))if(u.content_type===c.ItemsKey)this.itemsKeys.unshift(u);else if(u.content_type===c.Tag){var l=Xa()(this.tags,u,(function(e){return e.title?e.title.toLowerCase():""}));this.tags.splice(l,0,u)}else u.content_type===c.Note?this.notes.unshift(u):u.content_type===c.Component&&this.components.unshift(u)}}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}}},{key:"addItem",value:(_=ro(a.a.mark((function e(t){var n,r=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.length>1&&void 0!==r[1]&&r[1],e.abrupt("return",this.addItems([t],n));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"addItems",value:(S=ro(a.a.mark((function e(t){var n,r=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r.length>1&&void 0!==r[1]&&r[1],console.warn("ModelManager.addItems is depracated. Use mapPayloadsToLocalItems instead."),n=t.map((function(e){return Ri({object:e})})),e.next=5,this.mapPayloadsToLocalItems({payloads:n});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"resolveRelationshipWhenItemAvailable",value:function(e){var t=e.interestedItem,n=e.missingItemId,r=this.resolveQueue[n]||[];r.push(t),this.resolveQueue[n]=r}},{key:"popItemsInterestedInMissingItem",value:function(e){var t=e.item,n=this.resolveQueue[t.uuid];return delete this.resolveQueue[t.uuid],n||[]}},{key:"resolveReferencesForItem",value:(x=ro(a.a.mark((function e(t){var n,r,i,o,s,c,u,l,f,p,h,d,v,y,m,g=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=g.length>1&&void 0!==g[1]&&g[1],!t.errorDecrypting){e.next=3;break}return e.abrupt("return");case 3:if(r=t.content,t.updateLocalRelationships(),r.references&&!t.deleted){e.next=7;break}return e.abrupt("return");case 7:i=r.references.slice(),o=i.map((function(e){return e.uuid})),s=!0,c=this.findItems(o,s),u=!0,l=!1,f=void 0,e.prev=14,p=c.entries()[Symbol.iterator]();case 16:if(u=(h=p.next()).done){e.next=30;break}if(d=to(h.value,2),v=d[0],!(y=d[1])){e.next=25;break}if(t.addItemAsRelationship(y),!n){e.next=23;break}return e.next=23,this.setItemDirty(y,!0);case 23:e.next=27;break;case 25:m=o[v],this.resolveRelationshipWhenItemAvailable({interestedItem:t,missingItemId:m});case 27:u=!0,e.next=16;break;case 30:e.next=36;break;case 32:e.prev=32,e.t0=e.catch(14),l=!0,f=e.t0;case 36:e.prev=36,e.prev=37,u||null==p.return||p.return();case 39:if(e.prev=39,!l){e.next=42;break}throw f;case 42:return e.finish(39);case 43:return e.finish(36);case 44:case"end":return e.stop()}}),e,this,[[14,32,36,44],[37,,39,43]])}))),function(e){return x.apply(this,arguments)})},{key:"addCreationObserver",value:function(e){var t=this;return this.creationObservers.push(e),function(){yt()(t.creationObservers,e)}}},{key:"notifyCreationObservers",value:(k=ro(a.a.mark((function e(t,n,r){var i,o,s,c,u,l;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=!0,o=!1,s=void 0,e.prev=3,c=this.creationObservers[Symbol.iterator]();case 5:if(i=(u=c.next()).done){e.next=12;break}return l=u.value,e.next=9,l.callback({items:t,source:n,sourceKey:r});case 9:i=!0,e.next=5;break;case 12:e.next=18;break;case 14:e.prev=14,e.t0=e.catch(3),o=!0,s=e.t0;case 18:e.prev=18,e.prev=19,i||null==c.return||c.return();case 21:if(e.prev=21,!o){e.next=24;break}throw s;case 24:return e.finish(21);case 25:return e.finish(18);case 26:case"end":return e.stop()}}),e,this,[[3,14,18,26],[19,,21,25]])}))),function(e,t,n){return k.apply(this,arguments)})},{key:"addMappingObserver",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;Array.isArray(e)||(e=[e]);var i={types:e,priority:r,callback:t};return this.mappingObservers.push(i),function(){dt()(n.mappingObservers,i)}}},{key:"notifyMappingObservers",value:(w=ro(a.a.mark((function e(t,n,r){var i,o,s,c,u,l,f;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=this.mappingObservers.sort((function(e,t){return e.priority<t.priority?-1:1})),o=!0,s=!1,c=void 0,e.prev=4,u=a.a.mark((function e(){var i,o,s,c,u,l,p,h,d,v;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(i=f.value,o=i.types.includes("*")?t:t.filter((function(e){return i.types.includes(e.content_type)})),s=[],c=[],u=!0,l=!1,p=void 0,e.prev=7,h=o[Symbol.iterator]();!(u=(d=h.next()).done);u=!0)(v=d.value).deleted?c.push(v):s.push(v);e.next=15;break;case 11:e.prev=11,e.t0=e.catch(7),l=!0,p=e.t0;case 15:e.prev=15,e.prev=16,u||null==h.return||h.return();case 18:if(e.prev=18,!l){e.next=21;break}throw p;case 21:return e.finish(18);case 22:return e.finish(15);case 23:if(!(o.length>0)){e.next=26;break}return e.next=26,i.callback(o,s,c,n,r);case 26:case"end":return e.stop()}}),e,null,[[7,11,15,23],[16,,18,22]])})),l=i[Symbol.iterator]();case 7:if(o=(f=l.next()).done){e.next=12;break}return e.delegateYield(u(),"t0",9);case 9:o=!0,e.next=7;break;case 12:e.next=18;break;case 14:e.prev=14,e.t1=e.catch(4),s=!0,c=e.t1;case 18:e.prev=18,e.prev=19,o||null==l.return||l.return();case 21:if(e.prev=21,!s){e.next=24;break}throw c;case 24:return e.finish(21);case 25:return e.finish(18);case 26:case"end":return e.stop()}}),e,this,[[4,14,18,26],[19,,21,25]])}))),function(e,t,n){return w.apply(this,arguments)})},{key:"setItemDirty",value:(b=ro(a.a.mark((function e(t){var n,r,i,o,s=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=!(s.length>1&&void 0!==s[1])||s[1],r=s.length>2?s[2]:void 0,i=s.length>3?s[3]:void 0,o=s.length>4?s[4]:void 0,t.content_type===c.Tag&&this.reorderTagLocation(t),e.abrupt("return",this.setItemsDirty([t],n,r,i,o));case 6:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"setItemsDirty",value:(g=ro(a.a.mark((function e(t){var n,r,i,o,s,c,u,l,f,p,h=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=!(h.length>1&&void 0!==h[1])||h[1],r=h.length>2?h[2]:void 0,i=h.length>3?h[3]:void 0,o=h.length>4?h[4]:void 0,s=!0,c=!1,u=void 0,e.prev=7,l=t[Symbol.iterator]();case 9:if(s=(f=l.next()).done){e.next=17;break}if((p=f.value).isItem){e.next=13;break}throw"Attempting to dirty non-item object.";case 13:p.setDirty({dirty:n,updateClientDate:r,authorized:!0});case 14:s=!0,e.next=9;break;case 17:e.next=23;break;case 19:e.prev=19,e.t0=e.catch(7),c=!0,u=e.t0;case 23:e.prev=23,e.prev=24,s||null==l.return||l.return();case 26:if(e.prev=26,!c){e.next=29;break}throw u;case 29:return e.finish(26);case 30:return e.finish(23);case 31:return e.abrupt("return",this.mapItems({items:t,source:i||Ln.LocalDirtied,sourceKey:o}));case 32:case"end":return e.stop()}}),e,this,[[7,19,23,31],[24,,26,30]])}))),function(e){return g.apply(this,arguments)})},{key:"duplicateItem",value:(m=ro(a.a.mark((function e(t){var n,r,i,o,s,c;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.item,r=t.isConflict,n.isItem){e.next=3;break}throw"Attempting to duplicate non-item object.";case 3:return i=Ri({object:n}),e.next=6,In({payload:i,baseCollection:this.getMasterCollection(),isConflict:r});case 6:return o=e.sent,e.next=9,this.mapPayloadsToLocalItems({payloads:o});case 9:return s=e.sent,c=s.find((function(e){return e.uuid===o[0].uuid})),e.abrupt("return",c);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"createItem",value:(y=ro(a.a.mark((function e(t){var n,r,i,o,s,c;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.contentType,r=t.content,i=t.add,o=t.needsSync,n){e.next=3;break}throw"Attempting to create item with no contentType";case 3:return e.t0=Ri,e.next=6,j.GenerateUuid();case 6:if(e.t1=e.sent,e.t2=n,e.t3=r,e.t4={uuid:e.t1,content_type:e.t2,content:e.t3},e.t5={object:e.t4},s=(0,e.t0)(e.t5),c=Cn(s),!i){e.next=20;break}if(this.insertItem({item:c}),!o){e.next=18;break}return e.next=18,this.setItemDirty(c);case 18:return e.next=20,this.notifyCreationObservers([c]);case 20:return e.abrupt("return",c);case 21:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"getDirtyItems",value:function(){return this.items.filter((function(e){return e.dirty&&!e.dummy&&(!e.errorDecrypting||e.deleted)}))}},{key:"setItemToBeDeleted",value:(d=ro(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.deleted=!0,t.dummy){e.next=4;break}return e.next=4,this.setItemDirty(t,!0);case 4:return e.next=6,this.handleReferencesForItemDeletion(t);case 6:this.removeItemFromRespectiveArray(t);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"setItemsToBeDeleted",value:(h=ro(a.a.mark((function e(t){var n,r,i,o,s,c;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=!0,r=!1,i=void 0,e.prev=3,o=t[Symbol.iterator]();case 5:if(n=(s=o.next()).done){e.next=12;break}return c=s.value,e.next=9,this.setItemToBeDeleted(c);case 9:n=!0,e.next=5;break;case 12:e.next=18;break;case 14:e.prev=14,e.t0=e.catch(3),r=!0,i=e.t0;case 18:e.prev=18,e.prev=19,n||null==o.return||o.return();case 21:if(e.prev=21,!r){e.next=24;break}throw i;case 24:return e.finish(21);case 25:return e.finish(18);case 26:case"end":return e.stop()}}),e,this,[[3,14,18,26],[19,,21,25]])}))),function(e){return h.apply(this,arguments)})},{key:"handleReferencesForItemDeletion",value:(p=ro(a.a.mark((function e(t){var n,r,i,o,s,c,u,l,f,p,h,d,v,y;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.errorDecrypting){e.next=32;break}n=!0,r=!1,i=void 0,e.prev=4,o=t.content.references[Symbol.iterator]();case 6:if(n=(s=o.next()).done){e.next=18;break}if(c=s.value,!(u=this.findItem(c.uuid))){e.next=15;break}if(t.removeItemAsRelationship(u),!u.hasRelationshipWithItem(t)){e.next=15;break}return u.removeItemAsRelationship(t),e.next=15,this.setItemDirty(u,!0);case 15:n=!0,e.next=6;break;case 18:e.next=24;break;case 20:e.prev=20,e.t0=e.catch(4),r=!0,i=e.t0;case 24:e.prev=24,e.prev=25,n||null==o.return||o.return();case 27:if(e.prev=27,!r){e.next=30;break}throw i;case 30:return e.finish(27);case 31:return e.finish(24);case 32:l=t.allReferencingItems,f=!0,p=!1,h=void 0,e.prev=36,d=l[Symbol.iterator]();case 38:if(f=(v=d.next()).done){e.next=46;break}return(y=v.value).removeItemAsRelationship(t),e.next=43,this.setItemDirty(y,!0);case 43:f=!0,e.next=38;break;case 46:e.next=52;break;case 48:e.prev=48,e.t1=e.catch(36),p=!0,h=e.t1;case 52:e.prev=52,e.prev=53,f||null==d.return||d.return();case 55:if(e.prev=55,!p){e.next=58;break}throw h;case 58:return e.finish(55);case 59:return e.finish(52);case 60:t.resetLocalReferencePointers();case 61:case"end":return e.stop()}}),e,this,[[4,20,24,32],[25,,27,31],[36,48,52,60],[53,,55,59]])}))),function(e){return p.apply(this,arguments)})},{key:"removeItemLocally",value:(l=ro(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:yt()(this.items,{uuid:t.uuid}),delete this.itemsHash[t.uuid],this.removeItemFromRespectiveArray(t),t.isBeingRemovedLocally();case 4:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"removeItemFromRespectiveArray",value:function(e){e.content_type===c.Tag?yt()(this.tags,{uuid:e.uuid}):e.content_type===c.Note?yt()(this.notes,{uuid:e.uuid}):e.content_type===c.Component?yt()(this.components,{uuid:e.uuid}):e.content_type===c.ItemsKey&&yt()(this.itemsKeys,{uuid:e.uuid})}},{key:"getItems",value:function(e){return Array.isArray(e)?this.allItems.filter((function(t){return!t.dummy&&(e.includes(t.content_type)||e.includes("*"))})):this.managedItemsForContentType(e)||this.getItems([e])}},{key:"managedItemsForContentType",value:function(e){return e===c.Note?this.notes:e===c.Component?this.components:e===c.Tag?this.tags:null}},{key:"invalidItems",value:function(){return this.allItems.filter((function(e){return e.errorDecrypting}))}},{key:"validItemsForContentType",value:function(e){return(this.managedItemsForContentType(e)||this.allItems).filter((function(t){return!t.errorDecrypting&&(Array.isArray(e)?e.includes(t.content_type):t.content_type===e)}))}},{key:"findItem",value:function(e){return this.itemsHash[e]}},{key:"findItems",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var c=o.value,u=this.itemsHash[c];(u||t)&&n.push(u)}}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}},{key:"itemsMatchingPredicate",value:function(e){return this.itemsMatchingPredicates([e])}},{key:"itemsMatchingPredicates",value:function(e){return this.filterItemsWithPredicates(this.allItems,e)}},{key:"filterItemsWithPredicates",value:function(e,t){return e.filter((function(e){if(e.deleted)return!1;var n=!0,r=!1,i=void 0;try{for(var a,o=t[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;if(!e.satisfiesPredicate(s))return!1}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}return!0}))}},{key:"importPayloads",value:(u=ro(a.a.mark((function e(t){var n,r,i,o,s,c,u,l,p;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new ti({baseCollection:this.getMasterCollection(),applyCollection:new f({payloads:t,source:Ln.FileImport})}),e.next=3,n.resultingCollection();case 3:return r=e.sent,e.next=6,this.mapCollectionToLocalItems({collection:r});case 6:i=e.sent,o=!0,s=!1,c=void 0,e.prev=10,u=i[Symbol.iterator]();case 12:if(o=(l=u.next()).done){e.next=20;break}return p=l.value,e.next=16,this.setItemDirty(p,!0,!1);case 16:p.deleted=!1;case 17:o=!0,e.next=12;break;case 20:e.next=26;break;case 22:e.prev=22,e.t0=e.catch(10),s=!0,c=e.t0;case 26:e.prev=26,e.prev=27,o||null==u.return||u.return();case 29:if(e.prev=29,!s){e.next=32;break}throw c;case 32:return e.finish(29);case 33:return e.finish(26);case 34:return e.abrupt("return",i);case 35:case"end":return e.stop()}}),e,this,[[10,22,26,34],[27,,29,33]])}))),function(e){return u.apply(this,arguments)})},{key:"noteCount",value:function(){return this.notes.filter((function(e){return!e.dummy})).length}},{key:"removeAllItemsFromMemory",value:function(){var e=!0,t=!1,n=void 0;try{for(var r,i=this.items[Symbol.iterator]();!(e=(r=i.next()).done);e=!0)r.value.deleted=!0}catch(e){t=!0,n=e}finally{try{e||null==i.return||i.return()}finally{if(t)throw n}}this.notifyMappingObservers(this.items),this.resetState()}},{key:"findTagByTitle",value:function(e){return Object(o.g)(this.tags,"title",e)}},{key:"findOrCreateTagByTitle",value:(s=ro(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.findTagByTitle(t)){e.next=5;break}return e.next=4,this.createItem({contentType:"Tag",content:{title:t},add:!0,needsSync:!0});case 4:n=e.sent;case 5:return e.abrupt("return",n);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"reorderTagLocation",value:function(e){dt()(this.tags,e),this.tags.splice(Xa()(this.tags,e,(function(e){return e.title?e.title.toLowerCase():""})),0,e)}},{key:"notesMatchingSmartTag",value:function(e){var t=[new v("content_type","=","Note"),e.content.predicate];if(!e.content.isTrashTag){var n=new v("content.trashed","=",!1);t.push(n)}return this.itemsMatchingPredicates(t)}},{key:"trashSmartTag",value:function(){return this.systemSmartTags.find((function(e){return e.content.isTrashTag}))}},{key:"trashedItems",value:function(){return this.notesMatchingSmartTag(this.trashSmartTag())}},{key:"emptyTrash",value:(i=ro(a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.trashedItems(),e.abrupt("return",this.setItemsToBeDeleted(t));case 2:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"getSmartTags",value:function(){var e=this.validItemsForContentType(c.SmartTag).sort((function(e,t){return e.content.title<t.content.title?-1:1}));return this.systemSmartTags.concat(e)}},{key:"allItems",get:function(){return this.items.slice()}},{key:"allNondummyItems",get:function(){return this.items.filter((function(e){return!e.dummy}))}},{key:"nonDeletedItems",get:function(){return this.items.filter((function(e){return!e.dummy&&!e.deleted}))}}])&&io(n.prototype,r),t}(qi);function uo(e){return(uo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function lo(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function fo(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){lo(a,r,i,o,s,"next",e)}function s(e){lo(a,r,i,o,s,"throw",e)}o(void 0)}))}}function po(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ho(e){return(ho=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function vo(e,t){return(vo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var yo=function(e){function t(e){var n,r=e.modelManager,i=e.syncService;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==uo(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,ho(t).call(this))).syncService=i,n.modelManager=r,n.addObservers(),n.resolveQueue=[],n.registeredPredicates=[],n}var n,r,i,s,c;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&vo(e,t)}(t,e),n=t,(r=[{key:"popResolveQueue",value:function(){var e=this.resolveQueue.slice();return this.resolveQueue=[],e}},{key:"addObservers",value:function(){var e=this;this.modelManager.addCreationObserver({callback:function(t){var n=t.items;e.resolveQueue=e.resolveQueue.concat(n)}}),this.syncService.addEventObserver(function(){var t=fo(a.a.mark((function t(n){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n!==y.DownloadFirstSyncCompleted&&n!==y.FullSyncCompleted){t.next=3;break}return t.next=3,e.resolveSingletonsForItems(e.popResolveQueue(),n);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}},{key:"registerPredicate",value:function(e){this.registeredPredicates.push(e)}},{key:"validItemsMatchingPredicate",value:function(e){return this.modelManager.itemsMatchingPredicate(e).filter((function(e){return!e.deleted&&!e.errorDecrypting}))}},{key:"resolveSingletonsForItems",value:(c=fo(a.a.mark((function e(t,n){var r,i,s,c,u,l,f,p,h,d,v,m=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=function(e){var t=!0,n=!1,r=void 0;try{for(var i,a=m.registeredPredicates[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){var o=i.value;if(e.satisfiesPredicate(o))return m.validItemsMatchingPredicate(o)}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}},i=function(e){return e.isSingleton?m.validItemsMatchingPredicate(e.singletonPredicate):null},s=function(e){return i(e)||r(e)},c=[],u=!0,l=!1,f=void 0,e.prev=7,p=t[Symbol.iterator]();case 9:if(u=(h=p.next()).done){e.next=22;break}if(d=h.value,!c.includes(d)){e.next=13;break}return e.abrupt("continue",19);case 13:if(v=s(d),Object(o.f)(c,v||[]),v&&!(v.length<=1)){e.next=17;break}return e.abrupt("continue",19);case 17:return e.next=19,this.handleStrategy({items:v,strategy:d.singletonStrategy});case 19:u=!0,e.next=9;break;case 22:e.next=28;break;case 24:e.prev=24,e.t0=e.catch(7),l=!0,f=e.t0;case 28:e.prev=28,e.prev=29,u||null==p.return||p.return();case 31:if(e.prev=31,!l){e.next=34;break}throw f;case 34:return e.finish(31);case 35:return e.finish(28);case 36:c.length>0&&n===y.FullSyncCompleted&&setTimeout((function(){m.syncService.sync()}));case 37:case"end":return e.stop()}}),e,this,[[7,24,28,36],[29,,31,35]])}))),function(e,t){return c.apply(this,arguments)})},{key:"handleStrategy",value:(s=fo(a.a.mark((function e(t){var n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.items,1===t.strategy){e.next=3;break}throw"Unhandled singleton strategy";case 3:return r=n.sort((function(e,t){return e.errorDecrypting?1:t.errorDecrypting||e.created_at<t.created_at?-1:1})),i=Object(o.c)(r,0),e.next=7,this.modelManager.setItemsToBeDeleted(i);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"findOrCreateSingleton",value:(i=fo(a.a.mark((function e(t){var n,r,i,o,s,c,u;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.predicate,r=t.createPayload,!((i=this.validItemsMatchingPredicate(n)).length>0)){e.next=4;break}return e.abrupt("return",i[0]);case 4:if(this.syncService.getLastSyncDate()){e.next=7;break}return e.next=7,this.syncService.sync();case 7:if(!((o=this.validItemsMatchingPredicate(n)).length>0)){e.next=10;break}return e.abrupt("return",o[0]);case 10:return s=this.modelManager.itemsMatchingPredicate(n).filter((function(e){return e.errorDecrypting})),e.next=13,this.modelManager.setItemsToBeDeleted(s);case 13:return e.t0=Ui,e.t1=r,e.next=17,j.GenerateUuid();case 17:return e.t2=e.sent,e.t3={uuid:e.t2,dirty:!0},e.t4={payload:e.t1,override:e.t3},c=(0,e.t0)(e.t4),e.next=23,this.modelManager.mapPayloadToLocalItem({payload:c});case 23:return u=e.sent,e.next=26,this.syncService.sync();case 26:return e.abrupt("return",u);case 27:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})}])&&po(n.prototype,r),t}(qi);function mo(e){return(mo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function go(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function bo(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){go(a,r,i,o,s,"next",e)}function s(e){go(a,r,i,o,s,"throw",e)}o(void 0)}))}}function wo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ko(e){return(ko=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function xo(e,t){return(xo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var So=function(e){function t(e){var n,r=e.alertService,i=e.deviceInterface,a=e.httpService,o=e.modelManager,s=e.protocolService,c=e.syncService;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==mo(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,ko(t).call(this))).alertService=r,n.deviceInterface=i,n.httpService=a,n.modelManager=o,n.protocolService=s,n.syncService=c,n.previousPasswords=[],n}var n,r,i,o,s,u,l,f,p,h,d;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&xo(e,t)}(t,e),n=t,(r=[{key:"getExtensions",value:function(){return this.modelManager.validItemsForContentType(c.ActionsExtension)}},{key:"extensionsInContextOfItem",value:function(e){return this.getExtensions().filter((function(t){return t.supported_types.includes(e.content_type)||t.actionsWithContextForItem(e).length>0}))}},{key:"loadExtensionInContextOfItem",value:(d=bo(a.a.mark((function e(t,n){var r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={content_type:n.content_type,item_uuid:n.uuid},e.abrupt("return",this.httpService.getAbsolute({url:t.url,params:r}).then((function(e){return e.description&&(t.description=e.description),e.supported_types&&(t.supported_types=e.supported_types),e.actions?t.actions=e.actions.map((function(e){return new Ot(e)})):t.actions=[],t})).catch((function(e){return console.error("Error loading extension",e),null})));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"runAction",value:(h=bo(a.a.mark((function e(t){var n,r,i,o;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.action,r=t.item,i=t.passwordRequestHandler,n.running=!0,e.t0=n.verb,e.next="get"===e.t0?5:"render"===e.t0?9:"show"===e.t0?13:"post"===e.t0?17:21;break;case 5:return e.next=7,this.handleGetAction({action:n,passwordRequestHandler:i});case 7:return o=e.sent,e.abrupt("break",22);case 9:return e.next=11,this.handleRenderAction({action:n,passwordRequestHandler:i});case 11:return o=e.sent,e.abrupt("break",22);case 13:return e.next=15,this.handleShowAction(n);case 15:return o=e.sent,e.abrupt("break",22);case 17:return e.next=19,this.handlePostAction(n,r);case 19:return o=e.sent,e.abrupt("break",22);case 21:return e.abrupt("break",22);case 22:return n.lastExecuted=new Date,n.running=!1,e.abrupt("return",o);case 25:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"handleGetAction",value:(p=bo(a.a.mark((function e(t){var n,r,i=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.action,r=t.passwordRequestHandler,e.abrupt("return",new Promise((function(e,t){i.alertService.confirm({text:"Are you sure you want to replace the current note contents with this action's results?",onConfirm:function(){i.runConfirmedGetAction({action:n,passwordRequestHandler:r}).then(e)}})})));case 2:case"end":return e.stop()}}),e)}))),function(e){return p.apply(this,arguments)})},{key:"runConfirmedGetAction",value:(f=bo(a.a.mark((function e(t){var n,r,i,o,s,c,u,l,f,p,h,d=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.action,r=t.passwordRequestHandler,e.next=3,this.httpService.getAbsolute({url:n.url}).catch((function(e){var t=e&&e.error||{message:"An issue occurred while processing this action. Please try again."};return d.alertService.alert({text:t.message}),n.error=!0,{error:t}}));case 3:if(!(i=e.sent).error){e.next=6;break}return e.abrupt("return",i);case 6:return n.error=!1,e.next=9,this.payloadByDecryptingResponse({response:i,passwordRequestHandler:r});case 9:return o=e.sent,e.next=12,this.modelManager.mapPayload({payload:o,source:Ln.RemoteActionRetrieved});case 12:for(s=e.sent,c=!0,u=!1,l=void 0,e.prev=16,f=s[Symbol.iterator]();!(c=(p=f.next()).done);c=!0)h=p.value,this.modelManager.setItemDirty(h,!0);e.next=24;break;case 20:e.prev=20,e.t0=e.catch(16),u=!0,l=e.t0;case 24:e.prev=24,e.prev=25,c||null==f.return||f.return();case 27:if(e.prev=27,!u){e.next=30;break}throw l;case 30:return e.finish(27);case 31:return e.finish(24);case 32:return this.syncService.sync(),e.abrupt("return",{response:i,item:i.item});case 34:case"end":return e.stop()}}),e,this,[[16,20,24,32],[25,,27,31]])}))),function(e){return f.apply(this,arguments)})},{key:"handleRenderAction",value:(l=bo(a.a.mark((function e(t){var n,r,i=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.action,r=t.passwordRequestHandler,e.abrupt("return",this.httpService.getAbsolute({url:n.url}).then(function(){var e=bo(a.a.mark((function e(t){var o,s;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.error=!1,e.next=3,i.payloadByDecryptingResponse({response:t,passwordRequestHandler:r});case 3:if(!(o=e.sent)){e.next=7;break}return s=i.modelManager.mapPayload({payload:o}),e.abrupt("return",{response:t,item:s});case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()).catch((function(e){var t=e&&e.error||{message:"An issue occurred while processing this action. Please try again."};return i.alertService.alert({text:t.message}),n.error=!0,{error:t}})));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"payloadByDecryptingResponse",value:(u=bo(a.a.mark((function e(t){var n,r,i,o,s,c,u,l,f,p,h,d,v,y,m;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.response,r=t.key,i=t.passwordRequestHandler,o=Ri({object:n.item}),e.next=4,this.protocolService.payloadByDecryptingPayload({payload:o,key:r});case 4:if((s=e.sent).errorDecrypting){e.next=7;break}return e.abrupt("return",s);case 7:if(n.auth_params){e.next=10;break}return this.alertService.alert({text:"We were unable to decrypt this revision using your current keys, \n and this revision is missing metadata that would allow us to try different \n keys to decrypt it. This can likely be fixed with some manual intervention. \n Please email hello@standardnotes.org for assistance."}),e.abrupt("return",null);case 10:c=[],u=!0,l=!1,f=void 0,e.prev=14,p=this.previousPasswords[Symbol.iterator]();case 16:if(u=(h=p.next()).done){e.next=34;break}if(d=h.value,!c.includes(d)){e.next=20;break}return e.abrupt("continue",31);case 20:return c.push(d),e.next=23,this.protocolService.computeRootKey({password:d,keyParams:n.auth_params});case 23:if(v=e.sent){e.next=26;break}return e.abrupt("continue",31);case 26:return e.next=28,this.payloadByDecryptingResponse({response:n,key:v,passwordRequestHandler:i});case 28:if(!(y=e.sent)){e.next=31;break}return e.abrupt("return",y);case 31:u=!0,e.next=16;break;case 34:e.next=40;break;case 36:e.prev=36,e.t0=e.catch(14),l=!0,f=e.t0;case 40:e.prev=40,e.prev=41,u||null==p.return||p.return();case 43:if(e.prev=43,!l){e.next=46;break}throw f;case 46:return e.finish(43);case 47:return e.finish(40);case 48:return e.next=50,i();case 50:return m=e.sent,this.previousPasswords.push(m),e.abrupt("return",this.payloadByDecryptingResponse({response:n,key:r,passwordRequestHandler:i}));case 53:case"end":return e.stop()}}),e,this,[[14,36,40,48],[41,,43,47]])}))),function(e){return u.apply(this,arguments)})},{key:"handlePostAction",value:(s=bo(a.a.mark((function e(t,n){var r,i,o,s=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r="decrypted"===t.access_type,e.next=3,this.outgoingPayloadForItem({item:n,decrypted:r});case 3:return i=e.sent,o={items:[i]},e.abrupt("return",this.httpService.postAbsolute({url:t.url,params:o}).then((function(e){return t.error=!1,{response:e}})).catch((function(e){return t.error=!0,console.error("Action error response:",e),s.alertService.alert({text:"An issue occurred while processing this action. Please try again."}),{response:e}})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"handleShowAction",value:(o=bo(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.deviceInterface.openUrl(t.url),e.abrupt("return",{response:null});case 2:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"outgoingPayloadForItem",value:(i=bo(a.a.mark((function e(t){var n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.item,r=t.decrypted,i=void 0!==r&&r?F.FileDecrypted:F.FileEncrypted,e.abrupt("return",this.protocolService.payloadByEncryptingPayload({payload:n.payloadRepresentation(),intent:i}));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})}])&&wo(n.prototype,r),t}(qi);function _o(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function $o(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){_o(a,r,i,o,s,"next",e)}function s(e){_o(a,r,i,o,s,"throw",e)}o(void 0)}))}}function Po(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Oo=function(){function e(t){var n=t.application,r=t.challengeResponder;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.application=n,this.challengeResponder=r,this.stageHandlers={},this.registerStageHandlers()}var t,n,r,i,o;return t=e,r=[{key:"timestamp",value:function(){throw"Must override Migration.timestamp"}}],(n=[{key:"registerStageHandlers",value:function(){throw"Must override Migration.registerStageHandlers"}},{key:"registerStageHandler",value:function(e,t){this.stageHandlers[e]=t}},{key:"markDone",value:function(){this.done=!0,this.onDoneHandler&&this.onDoneHandler(),this.onDoneHandler=null}},{key:"onDone",value:function(e){this.onDoneHandler=e}},{key:"handleStage",value:(o=$o(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.stageHandlers[t])){e.next=4;break}return e.next=4,n();case 4:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"requestChallengeResponse",value:(i=$o(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.challengeResponder(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})}])&&Po(t.prototype,n),r&&Po(t,r),e}();function Co(e){return(Co="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Eo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ao(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Io(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Ao(a,r,i,o,s,"next",e)}function s(e){Ao(a,r,i,o,s,"throw",e)}o(void 0)}))}}function jo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Do(e,t,n){return(Do="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Mo(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function Mo(e){return(Mo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function To(e,t){return(To=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Ro={Default:1,Ephemeral:2},Lo={Default:1,Disabled:2},No={Default:1,Nonwrapped:2},Fo={Wrapped:"wrapped",Unwrapped:"unwrapped",Nonwrapped:"nonwrapped"},Uo=function(e){function t(e){var n,r=e.protocolService,i=e.deviceInterface,a=e.namespace;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Co(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,Mo(t).call(this))).deviceInterface=i,n.protocolService=r,n.namespace=a,n.setPersistencePolicy(Ro.Default),n.setEncryptionPolicy(Lo.Default),n.storagePersistable=!1,n}var n,r,i,s,u,l,f,p,h,d,v,y,m,g,b,w,k,x,S,_,$,C,E,A;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&To(e,t)}(t,e),n=t,r=[{key:"handleApplicationStage",value:(A=Io(a.a.mark((function e(n){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Do(Mo(t.prototype),"handleApplicationStage",this).call(this,n);case 2:1===n&&(this.storagePersistable=!0);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return A.apply(this,arguments)})},{key:"setPersistencePolicy",value:(E=Io(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.persistencePolicy=t,this.persistencePolicy!==Ro.Ephemeral){e.next=6;break}return e.next=4,this.deviceInterface.removeAllRawStorageValues();case 4:return e.next=6,this.clearAllPayloads();case 6:case"end":return e.stop()}}),e,this)}))),function(e){return E.apply(this,arguments)})},{key:"setEncryptionPolicy",value:(C=Io(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.encryptionPolicy=t;case 1:case"end":return e.stop()}}),e,this)}))),function(e){return C.apply(this,arguments)})},{key:"isEphemeralSession",value:function(){return this.persistencePolicy===Ro.Ephemeral}},{key:"initializeFromDisk",value:($=Io(a.a.mark((function e(){var t,n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.deviceInterface.getRawStorageValue(this.getPersistenceKey());case 2:t=e.sent,n=t?JSON.parse(t):null,this.setInitialValues(n);case 5:case"end":return e.stop()}}),e,this)}))),function(){return $.apply(this,arguments)})},{key:"persistAsValueToDisk",value:(_=Io(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.deviceInterface.setRawStorageValue(this.getPersistenceKey(),JSON.stringify(t));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"setInitialValues",value:function(e){e||(e=this.defaultValuesObject()),e[Fo.Unwrapped]||(e[Fo.Unwrapped]={}),this.values=e}},{key:"isStorageWrapped",value:function(){var e=this.values[Fo.Wrapped];return!Object(o.l)(e)&&Object.keys(e).length>0}},{key:"canDecryptWithKey",value:(S=Io(a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.values[Fo.Wrapped],e.next=3,this.decryptWrappedValue({wrappedValue:n,key:t,throws:!1});case 3:return r=e.sent,e.abrupt("return",!r.errorDecrypting);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"decryptWrappedValue",value:(x=Io(a.a.mark((function e(t){var n,r,i,o;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.wrappedValue,r=t.key,n.content_type){e.next=3;break}throw"Attempting to decrypt nonexistent wrapped value";case 3:return i=Ri({object:n,override:{content_type:c.EncryptedStorage}}),e.next=6,this.protocolService.payloadByDecryptingPayload({payload:i,key:r});case 6:return o=e.sent,e.abrupt("return",o);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"decryptStorage",value:(k=Io(a.a.mark((function e(){var t,n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.values[Fo.Wrapped],e.next=3,this.decryptWrappedValue({wrappedValue:t});case 3:if(!(n=e.sent).errorDecrypting){e.next=6;break}throw"Unable to decrypt storage.";case 6:this.values[Fo.Unwrapped]=Object(o.a)(n.content),delete this.values[Fo.Wrapped];case 8:case"end":return e.stop()}}),e,this)}))),function(){return k.apply(this,arguments)})},{key:"generatePersistenceValue",value:(w=Io(a.a.mark((function e(){var t,n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Object.assign({},this.values),n=t[Fo.Unwrapped],e.t0=Ri,e.next=5,j.GenerateUuid();case 5:return e.t1=e.sent,e.t2=n,e.t3=c.EncryptedStorage,e.t4={uuid:e.t1,content:e.t2,content_type:e.t3},e.t5={object:e.t4},r=(0,e.t0)(e.t5),e.next=13,this.protocolService.payloadByEncryptingPayload({payload:r,intent:F.LocalStoragePreferEncrypted});case 13:return i=e.sent,t[Fo.Wrapped]=i,t[Fo.Unwrapped]=null,e.abrupt("return",t);case 17:case"end":return e.stop()}}),e,this)}))),function(){return w.apply(this,arguments)})},{key:"repersistToDisk",value:(b=Io(a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.storagePersistable){e.next=2;break}return e.abrupt("return");case 2:if(this.persistencePolicy!==Ro.Ephemeral){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,this.generatePersistenceValue();case 6:return t=e.sent,this.values[Fo.Wrapped]=t[Fo.Wrapped],e.abrupt("return",this.persistAsValueToDisk(t));case 9:case"end":return e.stop()}}),e,this)}))),function(){return b.apply(this,arguments)})},{key:"setValue",value:(g=Io(a.a.mark((function e(t,n){var r,i=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=i.length>2&&void 0!==i[2]?i[2]:No.Default,this.values){e.next=3;break}throw"Attempting to set storage key ".concat(t," before loading local storage.");case 3:return this.values[this.domainKeyForMode(r)][t]=n,e.abrupt("return",this.repersistToDisk());case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return g.apply(this,arguments)})},{key:"getValue",value:(m=Io(a.a.mark((function e(t){var n,r=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.length>1&&void 0!==r[1]?r[1]:No.Default,this.values){e.next=3;break}throw"Attempting to get storage key ".concat(t," before loading local storage.");case 3:if(this.values[this.domainKeyForMode(n)]){e.next=5;break}throw"Storage domain mode not available ".concat(n," for key ").concat(t);case 5:return e.abrupt("return",this.values[this.domainKeyForMode(n)][t]);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"removeValue",value:(y=Io(a.a.mark((function e(t){var n,r=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.length>1&&void 0!==r[1]?r[1]:No.Default,this.values){e.next=3;break}throw"Attempting to remove storage key ".concat(t," before loading local storage.");case 3:return delete this.values[this.domainKeyForMode(n)][t],e.abrupt("return",this.repersistToDisk());case 5:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"getPersistenceKey",value:function(){return O(this.namespace,P.StorageObject)}},{key:"defaultValuesObject",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.wrapped,n=e.unwrapped,r=e.nonwrapped;return this.constructor.defaultValuesObject({wrapped:t,unwrapped:n,nonwrapped:r})}},{key:"domainKeyForMode",value:function(e){return this.constructor.domainKeyForMode(e)}},{key:"clearValues",value:(v=Io(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.setInitialValues(),e.next=3,this.repersistToDisk();case 3:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{key:"getAllRawPayloads",value:(d=Io(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.deviceInterface.getAllRawDatabasePayloads());case 1:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"savePayload",value:(h=Io(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.savePayloads([t]));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"savePayloads",value:(p=Io(a.a.mark((function e(t){var n,r,i,o,s,c,u,l,f;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.persistencePolicy!==Ro.Ephemeral){e.next=2;break}return e.abrupt("return");case 2:n=[],r=[],i=!0,o=!1,s=void 0,e.prev=7,c=t[Symbol.iterator]();case 9:if(i=(u=c.next()).done){e.next=22;break}if(!(l=u.value).discardable){e.next=15;break}n.push(l),e.next=19;break;case 15:return e.next=17,this.protocolService.payloadByEncryptingPayload({payload:l,intent:this.encryptionPolicy===Lo.Default?F.LocalStoragePreferEncrypted:F.LocalStorageDecrypted});case 17:f=e.sent,r.push(f);case 19:i=!0,e.next=9;break;case 22:e.next=28;break;case 24:e.prev=24,e.t0=e.catch(7),o=!0,s=e.t0;case 28:e.prev=28,e.prev=29,i||null==c.return||c.return();case 31:if(e.prev=31,!o){e.next=34;break}throw s;case 34:return e.finish(31);case 35:return e.finish(28);case 36:if(!(n.length>0)){e.next=39;break}return e.next=39,this.deletePayloads(n);case 39:return e.next=41,this.deviceInterface.saveRawDatabasePayloads(r);case 41:case"end":return e.stop()}}),e,this,[[7,24,28,36],[29,,31,35]])}))),function(e){return p.apply(this,arguments)})},{key:"deletePayloads",value:(f=Io(a.a.mark((function e(t){var n,r,i,o,s,c;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=!0,r=!1,i=void 0,e.prev=3,o=t[Symbol.iterator]();case 5:if(n=(s=o.next()).done){e.next=12;break}return c=s.value,e.next=9,this.deletePayloadWithId(c.uuid);case 9:n=!0,e.next=5;break;case 12:e.next=18;break;case 14:e.prev=14,e.t0=e.catch(3),r=!0,i=e.t0;case 18:e.prev=18,e.prev=19,n||null==o.return||o.return();case 21:if(e.prev=21,!r){e.next=24;break}throw i;case 24:return e.finish(21);case 25:return e.finish(18);case 26:case"end":return e.stop()}}),e,this,[[3,14,18,26],[19,,21,25]])}))),function(e){return f.apply(this,arguments)})},{key:"deletePayloadWithId",value:(l=Io(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.deviceInterface.removeRawDatabasePayloadWithId(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"clearAllPayloads",value:(u=Io(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.deviceInterface.removeAllRawDatabasePayloads());case 1:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"clearAllData",value:(s=Io(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Promise.all([this.clearValues(),this.clearAllPayloads()]));case 1:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})}],i=[{key:"defaultValuesObject",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.wrapped,r=void 0===n?{}:n,i=t.unwrapped,a=void 0===i?{}:i,o=t.nonwrapped,s=void 0===o?{}:o;return Eo(e={},Fo.Wrapped,r),Eo(e,Fo.Unwrapped,a),Eo(e,Fo.Nonwrapped,s),e}},{key:"domainKeyForMode",value:function(e){if(e===No.Default)return Fo.Unwrapped;if(e===No.Nonwrapped)return Fo.Nonwrapped;throw"Invalid mode"}}],r&&jo(n.prototype,r),i&&jo(n,i),t}(qi);function Ko(e){return(Ko="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Vo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bo(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Ho(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Bo(a,r,i,o,s,"next",e)}function s(e){Bo(a,r,i,o,s,"throw",e)}o(void 0)}))}}function zo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function qo(e,t){return!t||"object"!==Ko(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Go(e){return(Go=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Yo(e,t){return(Yo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Jo=function(e){function t(){return zo(this,t),qo(this,Go(t).apply(this,arguments))}var n,r,i,s,u,l,f,p,h,d,v,y;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Yo(e,t)}(t,e),n=t,r=[{key:"registerStageHandlers",value:function(){var e=this;this.registerStageHandler(0,Ho(a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!S(e.application.environment)){t.next=4;break}return t.abrupt("return",e.migrateStorageStructureForWebDesktop());case 4:if(!_(e.application.environment)){t.next=6;break}return t.abrupt("return",e.migrateStorageStructureForMobile());case 6:case"end":return t.stop()}}),t)})))),this.registerStageHandler(.9,Ho(a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.migrateArbitraryRawStorageToManagedStorageAllPlatforms();case 2:return t.next=4,e.migrateSessionStorage();case 4:case"end":return t.stop()}}),t)})))),this.registerStageHandler(1.1,Ho(a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.createDefaultItemsKeyForAllPlatforms();case 2:e.markDone();case 3:case"end":return t.stop()}}),t)}))))}},{key:"migrateStorageStructureForWebDesktop",value:(y=Ho(a.a.mark((function e(){var t,n,r,i,s,c,u,l,f,p,h,d,v,y,m,g,b,w;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.application.deviceInterface,Vo(t={},Fo.Wrapped,null),Vo(t,Fo.Unwrapped,{}),Vo(t,Fo.Nonwrapped,{}),r=t,e.next=4,n.getJsonParsedStorageValue("auth_params");case 4:return(i=e.sent)&&(r.nonwrapped[P.RootKeyParams]=i),e.next=8,n.getJsonParsedStorageValue("encryptedStorage");case 8:if(!(s=e.sent)){e.next=35;break}return c=Ri({object:s}),e.next=13,this.webDesktopHelperGetPasscodeKeyAndDecryptEncryptedStorage(c);case 13:if(u=e.sent,l=u.key,f=u.decryptedStoragePayload,p=u.keyParams,r.nonwrapped[P.RootKeyWrapperKeyParams]=p.getPortableValue(),h=Object(o.a)(f.content.storage),r.nonwrapped[P.RootKeyParams]=h.auth_params,d=l,Object(o.l)(h.mk)){e.next=30;break}return e.next=25,this.webDesktopHelperExtractAndWrapAccountKeysFromValueStore(l,h);case 25:v=e.sent,y=v.accountKey,m=v.wrappedKey,d=y,r.nonwrapped[P.WrappedRootKey]=m;case 30:return e.next=32,this.webDesktopHelperEncryptStorage(d,f,h);case 32:r.wrapped=e.sent,e.next=55;break;case 35:return e.next=37,this.application.deviceInterface.getRawStorageValue("ak");case 37:return g=e.sent,b=Object(o.l)(g)?L.V002:L.V003,e.t0=q,e.next=42,this.application.deviceInterface.getRawStorageValue("mk");case 42:return e.t1=e.sent,e.next=45,this.application.deviceInterface.getRawStorageValue("pw");case 45:return e.t2=e.sent,e.t3=g,e.t4=b,e.t5={masterKey:e.t1,serverPassword:e.t2,dataAuthenticationKey:e.t3,version:e.t4},e.t6={content:e.t5},e.next=52,e.t0.Create.call(e.t0,e.t6);case 52:return w=e.sent,e.next=55,this.application.deviceInterface.setKeychainValue(w.getPersistableValue());case 55:return e.next=57,this.allPlatformHelperSetStorageStructure(r);case 57:case"end":return e.stop()}}),e,this)}))),function(){return y.apply(this,arguments)})},{key:"allPlatformHelperSetStorageStructure",value:(v=Ho(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=Uo.defaultValuesObject(t))[Fo.Unwrapped]=null,e.next=4,this.application.deviceInterface.setRawStorageValue(O(this.application.namespace,P.StorageObject),JSON.stringify(n));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"webDesktopHelperGetPasscodeKeyAndDecryptEncryptedStorage",value:(d=Ho(a.a.mark((function e(t){var n,r,i,o,s,c;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.application.deviceInterface.getJsonParsedStorageValue("offlineParams");case 2:n=e.sent,r=this.application.protocolService.createKeyParams(n),i={errorDecrypting:!0};case 5:if(!i.errorDecrypting){e.next=18;break}return e.next=8,this.requestChallengeResponse($.LocalPasscode);case 8:return s=e.sent,c=s.value,e.next=12,this.application.protocolService.computeRootKey({password:c,keyParams:r});case 12:return o=e.sent,e.next=15,this.application.protocolService.payloadByDecryptingPayload({payload:t,key:o});case 15:i=e.sent,e.next=5;break;case 18:return e.abrupt("return",{decryptedStoragePayload:i,key:o,keyParams:r});case 19:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"webDesktopHelperExtractAndWrapAccountKeysFromValueStore",value:(h=Ho(a.a.mark((function e(t,n){var r,i,o,s;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.ak?L.V003:L.V002,e.next=3,q.Create({content:{masterKey:n.mk,serverPassword:n.pw,dataAuthenticationKey:n.ak,version:r}});case 3:if(i=e.sent,delete n.mk,delete n.pw,delete n.ak,o=Ri({object:i}),!t){e.next=12;break}return e.next=11,this.application.protocolService.payloadByEncryptingPayload({payload:o,key:t,intent:F.LocalStorageEncrypted});case 11:s=e.sent;case 12:return e.abrupt("return",{accountKey:i,wrappedKey:s});case 13:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"webDesktopHelperEncryptStorage",value:(p=Ho(a.a.mark((function e(t,n,r){var i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.application.protocolService.payloadByEncryptingPayload({key:t,intent:F.LocalStoragePreferEncrypted,payload:Ui({payload:n,override:{content_type:c.EncryptedStorage,content:r}})});case 2:return i=e.sent,e.abrupt("return",i);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return p.apply(this,arguments)})},{key:"migrateStorageStructureForMobile",value:(f=Ho(a.a.mark((function e(){var t,n,r,i,s,u,l,f,p,h,d,v,y,m,g,b,w,k,x,S,_=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.application.deviceInterface.getJsonParsedStorageValue("encrypted_account_keys");case 2:return n=e.sent,e.next=5,this.application.deviceInterface.getJsonParsedStorageValue("auth_params");case 5:return r=e.sent,e.next=8,this.application.deviceInterface.getJsonParsedStorageValue("pc_params");case 8:return i=e.sent,s={nonwrapped:(t={},Vo(t,P.WrappedRootKey,n),Vo(t,P.RootKeyWrapperKeyParams,i),Vo(t,P.RootKeyParams,r),t),unwrapped:{}},e.next=12,this.application.deviceInterface.getKeychainValue();case 12:if(u=e.sent,!i){e.next=57;break}if(l=this.application.protocolService.createKeyParams(i),f=function(){var e=Ho(a.a.mark((function e(){var t,n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=u.offline.pw,n={serverPassword:null};case 2:if(n.serverPassword===t){e.next=12;break}return e.next=5,_.requestChallengeResponse($.LocalPasscode);case 5:return r=e.sent,i=r.value,e.next=9,_.application.protocolService.computeRootKey({password:i,keyParams:l});case 9:n=e.sent,e.next=2;break;case 12:return e.abrupt("return",n);case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),p=u.offline.timing,s.unwrapped[P.MobilePasscodeTiming]=p,!n){e.next=36;break}return e.next=21,f();case 21:return h=e.sent,e.next=24,this.application.protocolService.payloadByDecryptingPayload({payload:Ri({object:n}),key:h});case 24:return d=e.sent,v=d.content.accountKeys,y=Object(o.l)(v.ak)?L.V002:L.V003,m=Ui({payload:d,override:{content:{masterKey:v.mk,serverPassword:v.pw,dataAuthenticationKey:v.ak,version:v.version||y,accountKeys:null}}}),e.next=30,this.application.protocolService.payloadByEncryptingPayload({payload:m,key:h,intent:F.LocalStoragePreferEncrypted});case 30:return g=e.sent,s.nonwrapped[P.WrappedRootKey]=g,e.next=34,this.application.deviceInterface.clearKeychainValue();case 34:e.next=55;break;case 36:if(n){e.next=55;break}return e.next=39,f();case 39:return b=e.sent,e.t0=Ri,e.next=43,j.GenerateUuid();case 43:return e.t1=e.sent,e.t2=s.unwrapped,e.t3=c.EncryptedStorage,e.t4={uuid:e.t1,content:e.t2,content_type:e.t3},e.t5={object:e.t4},w=(0,e.t0)(e.t5),e.next=51,this.application.protocolService.payloadByEncryptingPayload({payload:w,key:b,intent:F.LocalStoragePreferEncrypted});case 51:return k=e.sent,s.wrapped=k,e.next=55,this.application.deviceInterface.clearKeychainValue();case 55:e.next=65;break;case 57:if(!u||!u.mk){e.next=65;break}return x=Object(o.l)(u.ak)?L.V002:L.V003,e.next=62,q.Create({content:{masterKey:u.mk,serverPassword:u.pw,dataAuthenticationKey:u.ak,version:u.version||x}});case 62:return S=e.sent,e.next=65,this.application.deviceInterface.setKeychainValue(S.getPersistableValue());case 65:return e.next=67,this.allPlatformHelperSetStorageStructure(s);case 67:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"migrateArbitraryRawStorageToManagedStorageAllPlatforms",value:(l=Ho(a.a.mark((function e(){var t,n,r,i,s,c,u,l,f,p,h,d;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.application.deviceInterface.getAllRawStorageKeyValues();case 2:t=e.sent,n=[O(this.application.namespace,P.StorageObject),"encryptedStorage","offlineParams","pc_params"],r=function(e){try{return JSON.parse(e)}catch(t){return e}},i=!0,s=!1,c=void 0,e.prev=8,u=t[Symbol.iterator]();case 10:if(i=(l=u.next()).done){e.next=23;break}if(f=l.value,p=f.key,h=f.value,!n.includes(p)){e.next=16;break}return e.abrupt("continue",20);case 16:if(Object(o.l)(h)){e.next=20;break}return d=r(h),e.next=20,this.application.storageService.setValue(p,d);case 20:i=!0,e.next=10;break;case 23:e.next=29;break;case 25:e.prev=25,e.t0=e.catch(8),s=!0,c=e.t0;case 29:e.prev=29,e.prev=30,i||null==u.return||u.return();case 32:if(e.prev=32,!s){e.next=35;break}throw c;case 35:return e.finish(32);case 36:return e.finish(29);case 37:case"end":return e.stop()}}),e,this,[[8,25,29,37],[30,,32,36]])}))),function(){return l.apply(this,arguments)})},{key:"migrateSessionStorage",value:(u=Ho(a.a.mark((function e(){var t,n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.application.storageService.getValue("jwt");case 2:if(t=e.sent){e.next=5;break}return e.abrupt("return");case 5:return n=new ta(t),e.next=8,this.application.storageService.setValue(P.Session,n);case 8:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"createDefaultItemsKeyForAllPlatforms",value:(s=Ho(a.a.mark((function e(){var t,n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.application.keyManager.getRootKey();case 2:if(!(t=e.sent)){e.next=14;break}return e.next=6,this.application.keyManager.getRootKeyParams();case 6:return n=e.sent,r=Xe.FromRaw({itemsKey:t.masterKey,dataAuthenticationKey:t.dataAuthenticationKey,version:n.version}),e.next=10,r.initUUID();case 10:return e.next=12,this.application.modelManager.mapItem({item:r});case 12:return e.next=14,this.application.modelManager.setItemDirty(r);case 14:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})}],i=[{key:"timestamp",value:function(){return new Date("2020-01-15").getTime()}}],r&&Wo(n.prototype,r),i&&Wo(n,i),t}(Oo);function Qo(e){return(Qo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Zo(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Xo(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Zo(a,r,i,o,s,"next",e)}function s(e){Zo(a,r,i,o,s,"throw",e)}o(void 0)}))}}function es(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ts(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ns(e,t){return!t||"object"!==Qo(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function rs(e){return(rs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function is(e,t){return(is=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var as=function(e){function t(){return es(this,t),ns(this,rs(t).apply(this,arguments))}var n,r,i,s;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&is(e,t)}(t,e),n=t,r=[{key:"registerStageHandlers",value:function(){var e=this;this.registerStageHandler(0,Xo(a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.migrateMigrationTimestampAllPlatforms();case 2:e.markDone();case 3:case"end":return t.stop()}}),t)}))))}},{key:"migrateMigrationTimestampAllPlatforms",value:(s=Xo(a.a.mark((function e(){var t,n,r,i,s,c,u,l,f;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=!1,n=0,r=["migrations","ephemeral","user","cachedThemes","syncToken"];case 3:if(!(n<r.length)){e.next=14;break}return i=r[n],e.next=7,this.application.deviceInterface.getRawStorageValue(i);case 7:if(!e.sent){e.next=11;break}return t=!0,e.abrupt("break",14);case 11:n++,e.next=3;break;case 14:return s=O(this.application.namespace,"last_migration_timestamp"),e.next=17,this.application.deviceInterface.getRawStorageValue(s);case 17:if(c=e.sent,(u=!Object(o.l)(c))||!t){e.next=25;break}return l=new Date(0).getTime(),e.next=23,this.application.deviceInterface.setRawStorageValue(s,l);case 23:e.next=32;break;case 25:if(u||t){e.next=31;break}return f=(new Date).getTime(),e.next=29,this.application.deviceInterface.setRawStorageValue(s,f);case 29:e.next=32;break;case 31:case 32:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})}],i=[{key:"timestamp",value:function(){return new Date("2020-01-01").getTime()}}],r&&ts(n.prototype,r),i&&ts(n,i),t}(Oo);function os(e){return(os="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ss(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function cs(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){ss(a,r,i,o,s,"next",e)}function s(e){ss(a,r,i,o,s,"throw",e)}o(void 0)}))}}function us(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ls(e,t,n){return(ls="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=fs(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function fs(e){return(fs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ps(e,t){return(ps=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var hs=function(e){function t(e){var n,r=e.application,i=e.challengeResponder;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==os(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,fs(t).call(this))).application=r,n.challengeResponder=i,n}var n,i,s,c,u,l,f,p,h;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ps(e,t)}(t,e),n=t,(i=[{key:"initialize",value:(h=cs(a.a.mark((function e(){var t,n=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.runBaseMigration();case 2:return e.next=4,this.getRequiredMigrations();case 4:this.activeMigrations=e.sent,this.activeMigrations.length>0&&(t=Object(o.q)(this.activeMigrations)).onDone(cs(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.saveLastMigrationTimestamp(t.constructor.timestamp());case 2:case"end":return e.stop()}}),e)}))));case 6:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"handleApplicationStage",value:(p=cs(a.a.mark((function e(n){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ls(fs(t.prototype),"handleApplicationStage",this).call(this,n);case 2:return.5===n&&(this.addLoginObserver(),this.addSyncObserver()),e.next=5,this.handleStage(n);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"runBaseMigration",value:(f=cs(a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new as({application:this.application}),e.next=3,t.handleStage(0);case 3:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"getRequiredMigrations",value:(l=cs(a.a.mark((function e(){var t,n,i,o,s,c,u,l,f;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getLastMigrationTimestamp();case 2:for(t=e.sent,n=[],i=Object.keys(r).map((function(e){return r[e]})).sort((function(e,t){var n=e.timestamp(),r=t.timestamp();return n<r?-1:n>r?1:0})),o=!0,s=!1,c=void 0,e.prev=8,u=i[Symbol.iterator]();!(o=(l=u.next()).done);o=!0)(f=l.value).timestamp()>t&&n.push(new f({application:this.application,challengeResponder:this.challengeResponder}));e.next=16;break;case 12:e.prev=12,e.t0=e.catch(8),s=!0,c=e.t0;case 16:e.prev=16,e.prev=17,o||null==u.return||u.return();case 19:if(e.prev=19,!s){e.next=22;break}throw c;case 22:return e.finish(19);case 23:return e.finish(16);case 24:return e.abrupt("return",n);case 25:case"end":return e.stop()}}),e,this,[[8,12,16,24],[17,,19,23]])}))),function(){return l.apply(this,arguments)})},{key:"getTimeStampKey",value:function(){return O(this.application.namespace,"last_migration_timestamp")}},{key:"getLastMigrationTimestamp",value:(u=cs(a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.application.deviceInterface.getRawStorageValue(this.getTimeStampKey());case 2:if(t=e.sent,!Object(o.l)(t)){e.next=5;break}throw"Timestamp should not be null. Be sure to run base migration first.";case 5:return e.abrupt("return",JSON.parse(t));case 6:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"saveLastMigrationTimestamp",value:(c=cs(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.application.deviceInterface.setRawStorageValue(this.getTimeStampKey(),JSON.stringify(t));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"addLoginObserver",value:function(){var e=this;this.application.addEventObserver(function(){var t=cs(a.a.mark((function t(n,r){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n!==g.SignedIn){t.next=3;break}return t.next=3,e.handleStage(3);case 3:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}())}},{key:"addSyncObserver",value:function(){var e=this;this.application.syncService.addEventObserver(function(){var t=cs(a.a.mark((function t(n,r){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n!==y.FullSyncCompleted){t.next=3;break}return t.next=3,e.handleStage(1.3);case 3:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}())}},{key:"handleStage",value:(s=cs(a.a.mark((function e(t){var n,r,i,o,s,c;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=!0,r=!1,i=void 0,e.prev=3,o=this.activeMigrations[Symbol.iterator]();case 5:if(n=(s=o.next()).done){e.next=12;break}return c=s.value,e.next=9,c.handleStage(t);case 9:n=!0,e.next=5;break;case 12:e.next=18;break;case 14:e.prev=14,e.t0=e.catch(3),r=!0,i=e.t0;case 18:e.prev=18,e.prev=19,n||null==o.return||o.return();case 21:if(e.prev=21,!r){e.next=24;break}throw i;case 24:return e.finish(21);case 25:return e.finish(18);case 26:case"end":return e.stop()}}),e,this,[[3,14,18,26],[19,,21,25]])}))),function(e){return s.apply(this,arguments)})}])&&us(n.prototype,i),t}(qi);function ds(e){return(ds="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function vs(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ys(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function ms(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){ys(a,r,i,o,s,"next",e)}function s(e){ys(a,r,i,o,s,"throw",e)}o(void 0)}))}}function gs(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function bs(e,t,n){return(bs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=ws(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function ws(e){return(ws=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ks(e,t){return(ks=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var xs=function(e){function t(e){var n,r=e.modelManager,i=e.crypto;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),!r)throw"Invalid ProtocolService construction.";return(n=function(e,t){return!t||"object"!==ds(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,ws(t).call(this))).operators=[],n.modelManager=r,n.crypto=i,!n.crypto&&Object(o.o)()&&Object(Z.isWebCryptoAvailable)()&&(n.crypto=new Z.SNWebCrypto),j.SetGenerators({syncImpl:n.crypto.generateUUIDSync,asyncImpl:n.crypto.generateUUIDSync}),n}var n,r,i,s,c,u,l,f,p,h,d,v,y,m;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ks(e,t)}(t,e),n=t,(r=[{key:"setKeyManager",value:function(e){this.keyManager=e}},{key:"setItemsKeyManager",value:function(e){var t=this;this.keyObsUnsubscribe=e.addItemsKeyChangeObserver(ms(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.decryptErroredItems();case 2:case"end":return e.stop()}}),e)}))))}},{key:"deinit",value:(m=ms(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.keyObsUnsubscribe(),e.abrupt("return",bs(ws(t.prototype),"deinit",this).call(this));case 2:case"end":return e.stop()}}),e,this)}))),function(){return m.apply(this,arguments)})},{key:"getLatestVersion",value:function(){return L.V004}},{key:"getUserVersion",value:(y=ms(a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.keyManager.getRootKeyParams();case 2:return t=e.sent,e.abrupt("return",t&&t.version);case 4:case"end":return e.stop()}}),e,this)}))),function(){return y.apply(this,arguments)})},{key:"upgradeAvailable",value:(v=ms(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getUserVersion();case 2:return e.t0=e.sent,e.t1=this.getLatestVersion(),e.abrupt("return",e.t0!==e.t1);case 5:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{key:"platformSupportsKeyDerivation",value:function(e){return N(e.version,L.V004)>=0||!!Object(Z.isWebCryptoAvailable)()}},{key:"supportedVersions",value:function(){return[L.V001,L.V002,L.V003,L.V004]}},{key:"isVersionNewerThanLibraryVersion",value:function(e){return 1===N(e,this.getLatestVersion())}},{key:"isProtocolVersionOutdated",value:function(e){var t={};t[L.V001]=Date.parse("2018-01-01"),t[L.V002]=Date.parse("2020-01-01");var n=t[e];return!!n&&new Date>n}},{key:"costMinimumForVersion",value:function(e){if(N(e,L.V003)>=0)throw"Cost minimums only apply to versions <= 002";if(e===L.V001)return de.pwCost();if(e===L.V002)return $e.pwCost();throw"Invalid version for cost minimum: ".concat(e)}},{key:"createOperatorForLatestVersion",value:function(){return this.createOperatorForVersion(this.getLatestVersion())}},{key:"createOperatorForVersion",value:function(e){if(e===L.V001)return new de(this.crypto);if(e===L.V002)return new $e(this.crypto);if(e===L.V003)return new Me(this.crypto);if(e===L.V004)return new ze(this.crypto);if(e===L.V000Base64Decrypted)return this.createOperatorForLatestVersion();throw"Unable to find operator for version ".concat(e)}},{key:"operatorForVersion",value:function(e){var t=e,n=this.operators[t];return n||(n=this.createOperatorForVersion(e),this.operators[t]=n),n}},{key:"defaultOperator",value:function(){return this.operatorForVersion(this.getLatestVersion())}},{key:"computeRootKey",value:(d=ms(a.a.mark((function e(t){var n,r,i,o;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.password,r=t.keyParams,i=r.version,o=this.operatorForVersion(i),e.abrupt("return",o.computeRootKey({password:n,keyParams:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"createRootKey",value:(h=ms(a.a.mark((function e(t){var n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.identifier,r=t.password,i=this.defaultOperator(),e.abrupt("return",i.createRootKey({identifier:n,password:r}));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"payloadContentFormatForIntent",value:function(e){var t=e.key,n=e.intent;if(t){if(n===F.Sync||n===F.FileEncrypted||n===F.FilePreferEncrypted||n===F.LocalStorageEncrypted||n===F.LocalStoragePreferEncrypted)return Q.EncryptedString;throw"Unhandled encrypted case in protocolService.payloadContentFormatForIntent."}if(n===F.LocalStorageDecrypted||n===F.LocalStoragePreferEncrypted||n===F.FileDecrypted||n===F.FilePreferEncrypted)return Q.DecryptedBareObject;if(n===F.SyncDecrypted)return Q.DecryptedBase64String;throw"Unhandled decrypted case in protocolService.payloadContentFormatForIntent."}},{key:"payloadByEncryptingPayload",value:(p=ms(a.a.mark((function e(t){var n,r,i,s,c,u,l;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.payload,r=t.key,i=t.intent,!n.errorDecrypting){e.next=3;break}return e.abrupt("return",n);case 3:if(!Object(o.l)(i)){e.next=5;break}throw"Attempting to encrypt payload with null intent";case 5:if(r||V(i)){e.next=9;break}return e.next=8,this.keyManager.keyToUseForEncryptionOfPayload({payload:n,intent:i});case 8:r=e.sent;case 9:if(r||!B(i)){e.next=11;break}throw"Attempting to generate encrypted payload with no key.";case 11:if(n.getFormat()===Q.DecryptedBareObject){e.next=13;break}throw"Attempting to encrypt already encrypted payload.";case 13:if(n.isPayload){e.next=15;break}throw"Attempting to encrypt non-payload.";case 15:if(n.content){e.next=17;break}throw"Attempting to encrypt payload with no content.";case 17:if(n.uuid){e.next=19;break}throw"Attempting to encrypt payload with no uuid.";case 19:return s=r?r.version:this.getLatestVersion(),c=this.payloadContentFormatForIntent({key:r,intent:i}),u=this.operatorForVersion(s),e.next=24,u.generateEncryptionParameters({payload:n,key:r,format:c});case 24:if(l=e.sent){e.next=27;break}throw"Unable to generate encryption parameters";case 27:return e.abrupt("return",Li({object:n,override:l,intent:i}));case 28:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"payloadsByEncryptingPayloads",value:(f=ms(a.a.mark((function e(t){var n,r,i,s,c,u,l,f,p,h,d;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.payloads,r=t.intent,i=[],s=!0,c=!1,u=void 0,e.prev=5,l=n[Symbol.iterator]();case 7:if(s=(f=l.next()).done){e.next=17;break}return p=f.value,h=Object(o.k)(r)?r(p):r,e.next=12,this.payloadByEncryptingPayload({payload:p,intent:h});case 12:d=e.sent,i.push(d);case 14:s=!0,e.next=7;break;case 17:e.next=23;break;case 19:e.prev=19,e.t0=e.catch(5),c=!0,u=e.t0;case 23:e.prev=23,e.prev=24,s||null==l.return||l.return();case 26:if(e.prev=26,!c){e.next=29;break}throw u;case 29:return e.finish(26);case 30:return e.finish(23);case 31:return e.abrupt("return",i);case 32:case"end":return e.stop()}}),e,this,[[5,19,23,31],[24,,26,30]])}))),function(e){return f.apply(this,arguments)})},{key:"payloadByDecryptingPayload",value:(l=ms(a.a.mark((function e(t){var n,r,i,o,s,c,u;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.payload,r=t.key,n.content){e.next=3;break}throw"Attempting to decrypt payload that has no content.";case 3:if(n.isPayload){e.next=5;break}throw"Attempting to decrypt non-payload.";case 5:if((i=n.getFormat())!==Q.DecryptedBareObject){e.next=8;break}return e.abrupt("return",n);case 8:if(r||i!==Q.EncryptedString){e.next=14;break}return e.next=11,this.keyManager.keyToUseForDecryptionOfPayload({payload:n});case 11:if(r=e.sent){e.next=14;break}return e.abrupt("return",Ri({object:n,override:{waitingForKey:!0,errorDecrypting:!0}}));case 14:return o=n.version,s=this.operatorForVersion(o),c=Ki(n),e.next=19,s.generateDecryptedParameters({encryptedParameters:c,key:r});case 19:return u=e.sent,e.abrupt("return",Ri({object:n,override:u}));case 21:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"payloadsByDecryptingPayloads",value:(u=ms(a.a.mark((function e(t){var n,r,i,s,c,u,l,f,p,h,d;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.payloads,r=t.key,i=[],s=!0,c=!1,u=void 0,e.prev=5,l=n[Symbol.iterator]();case 7:if(s=(f=l.next()).done){e.next=35;break}if(p=f.value){e.next=12;break}return i.push(p),e.abrupt("continue",32);case 12:if(p.isPayload){e.next=14;break}throw"Attempting to decrypt non-payload object in payloadsByDecryptingPayloads.";case 14:if(!0!==p.deleted||!Object(o.l)(p.content)){e.next=17;break}return i.push(p),e.abrupt("continue",32);case 17:if(Object(o.n)(p.content)){e.next=21;break}return i.push(p),e.abrupt("continue",32);case 21:return e.prev=21,e.next=24,this.payloadByDecryptingPayload({payload:p,key:r});case 24:h=e.sent,i.push(h),e.next=32;break;case 28:e.prev=28,e.t0=e.catch(21),i.push(Ri({object:p,override:(d={},vs(d,ne.ErrorDecrypting,!0),vs(d,ne.ErrorDecryptingChanged,!p.errorDecrypting),d)})),console.error("Error decrypting payload",p,e.t0);case 32:s=!0,e.next=7;break;case 35:e.next=41;break;case 37:e.prev=37,e.t1=e.catch(5),c=!0,u=e.t1;case 41:e.prev=41,e.prev=42,s||null==l.return||l.return();case 44:if(e.prev=44,!c){e.next=47;break}throw u;case 47:return e.finish(44);case 48:return e.finish(41);case 49:return e.abrupt("return",i);case 50:case"end":return e.stop()}}),e,this,[[5,37,41,49],[21,28],[42,,44,48]])}))),function(e){return u.apply(this,arguments)})},{key:"decryptErroredItems",value:(c=ms(a.a.mark((function e(){var t,n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==(t=this.modelManager.allItems.filter((function(e){return e.waitingForKey||e.errorDecrypting}))).length){e.next=3;break}return e.abrupt("return");case 3:return n=t.map((function(e){return e.payloadRepresentation()})),e.next=6,this.payloadsByDecryptingPayloads({payloads:n});case 6:return r=e.sent,e.next=9,this.modelManager.mapPayloadsToLocalItems({payloads:r});case 9:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"payloadsByDecryptingBackupFile",value:(s=ms(a.a.mark((function e(t){var n,r,i,o,s,c,u;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.data,r=t.password,i=n.keyParams||n.auth_params,o=n.items,s=o.map((function(e){return Ni({object:e,source:Ln.FileImport})})),!i){e.next=13;break}return e.next=7,this.computeRootKey({password:r,keyParams:i});case 7:return u=e.sent,e.next=10,this.payloadsByDecryptingPayloads({payloads:s,key:u});case 10:c=e.sent,e.next=14;break;case 13:c=s;case 14:return e.abrupt("return",c);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"createKeyParams",value:function(e){if(e.isKeyParamsObject)throw"Attempting to create key params from non-raw value.";return e.version||(e.version=L.V002),Y(e)}},{key:"createBackupFile",value:(i=ms(a.a.mark((function e(){var t,n,r,i,o,s,c,u,l,f,p=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=p.length>0&&void 0!==p[0]?p[0]:{},n=t.subItems,r=t.intent,i=t.returnIfEmpty,o=n||this.modelManager.allItems,!i||0!==o.length){e.next=4;break}return e.abrupt("return",null);case 4:return r||(r=F.FilePreferEncrypted),s=o.map((function(e){return Ri({object:e})})),e.next=8,this.payloadsByEncryptingPayloads({payloads:s,intent:r});case 8:return c=e.sent,u={items:c},e.next=12,this.keyManager.getRootKeyParams();case 12:return(l=e.sent)&&r!==F.FileDecrypted&&(u.keyParams=l.getPortableValue()),f=2,e.abrupt("return",JSON.stringify(u,null,f));case 16:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})}])&&gs(n.prototype,r),t}(qi);function Ss(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var _s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.item=Object(o.e)({},t),this.defaultContentKeyToDiffOn="text",this.textCharDiffLength=0,Object(o.n)(this.item.updated_at)&&(this.item.updated_at=new Date(this.item.updated_at))}var t,n;return t=e,(n=[{key:"setPreviousEntry",value:function(e){this.hasPreviousEntry=null!=e,this.item.content[this.defaultContentKeyToDiffOn]&&(this.textCharDiffLength=e?this.item.content[this.defaultContentKeyToDiffOn].length-e.item.content[this.defaultContentKeyToDiffOn].length:this.item.content[this.defaultContentKeyToDiffOn].length)}},{key:"operationVector",value:function(){return void 0!==this.textCharDiffLength?this.hasPreviousEntry&&0!==this.textCharDiffLength?this.textCharDiffLength<0?-1:1:0:1}},{key:"deltaSize",value:function(){return void 0!==this.textCharDiffLength?Math.abs(this.textCharDiffLength):1}},{key:"isSameAsEntry",value:function(e){if(!e)return!1;var t=new R(Ri({object:this.item})),n=new R(Ri({object:e.item}));return t.isItemContentEqualWith(n)}}])&&Ss(t.prototype,n),e}();function $s(e){return($s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ps(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Os(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Cs(e,t){return!t||"object"!==$s(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Es(e){return(Es=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function As(e,t){return(As=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Is=function(e){function t(){return Ps(this,t),Cs(this,Es(t).apply(this,arguments))}var n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&As(e,t)}(t,e),n=t,(r=[{key:"previewTitle",value:function(){return this.item.updated_at.toLocaleString()}},{key:"previewSubTitle",value:function(){return this.hasPreviousEntry?this.textCharDiffLength<0?"".concat(-1*this.textCharDiffLength," characters removed"):this.textCharDiffLength>0?"".concat(this.textCharDiffLength," characters added"):"Title or metadata changed":"".concat(this.textCharDiffLength," characters loaded")}}])&&Os(n.prototype,r),t}(_s);function js(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ds(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Ms=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(js(this,e),this.entries||(this.entries=[]),t.entries){var n=!0,r=!1,i=void 0;try{for(var a,o=t.entries[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value,c=this.createEntryForItem(s.item);c.setPreviousEntry(this.getLastEntry()),this.entries.push(c)}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}}}var t,n;return t=e,(n=[{key:"createEntryForItem",value:function(e){return function(e){var t,n,r,i=(t={},n=c.Note,r=Is,n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t)[e.content_type];if(!i)throw"Invalid item history class";return new i(e)}(e)}},{key:"getLastEntry",value:function(){return this.entries[this.entries.length-1]}},{key:"addHistoryEntryForItem",value:function(e){var t=this.createEntryForItem(e),n=this.getLastEntry();if(t.setPreviousEntry(n),!t.isSameAsEntry(n))return this.entries.push(t),t}},{key:"clear",value:function(){this.entries.length=0}},{key:"optimize",value:function(){var e=this,t=[],n=function(e){return e.deltaSize()>15},r=function(r,i,a){if(a)t.push(r);else{var o=t.indexOf(r);-1!==o&&t.splice(o,1)}if(a&&n(r)&&-1===r.operationVector()){var s=e.entries[i-1];s&&t.push(s)}};this.entries.forEach((function(t,i){if(0===i||i===e.entries.length-1)r(t,i,!0);else{var a=n(t);r(t,i,a)}})),this.entries=this.entries.filter((function(e,n){return-1!==t.indexOf(e)}))}}])&&Ds(t.prototype,n),e}();function Ts(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Rs=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object.assign(this,t),this.content||(this.content={}),this.content.itemUUIDToItemHistoryMapping||(this.content.itemUUIDToItemHistoryMapping={}),Object.keys(this.content.itemUUIDToItemHistoryMapping).forEach((function(e){var t=n.content.itemUUIDToItemHistoryMapping[e];n.content.itemUUIDToItemHistoryMapping[e]=new Ms(t)})),this.setItemRevisionThreshold(60)}var t,n;return t=e,(n=[{key:"addEntryForItem",value:function(e){return this.historyForItem(e).addHistoryEntryForItem(e)}},{key:"historyForItem",value:function(e){var t=this.content.itemUUIDToItemHistoryMapping[e.uuid];return t||(t=new Ms,this.content.itemUUIDToItemHistoryMapping[e.uuid]=t),t}},{key:"clearItemHistory",value:function(e){this.historyForItem(e).clear()}},{key:"clearAllHistory",value:function(){this.content.itemUUIDToItemHistoryMapping={}}},{key:"setItemRevisionThreshold",value:function(e){this.itemRevisionThreshold=e}},{key:"optimizeHistoryForItem",value:function(e){var t=this.historyForItem(e);t.entries.length>this.itemRevisionThreshold&&t.optimize()}}])&&Ts(t.prototype,n),e}();function Ls(e){return(Ls="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ns(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Fs(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Ns(a,r,i,o,s,"next",e)}function s(e){Ns(a,r,i,o,s,"throw",e)}o(void 0)}))}}function Us(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ks(e){return(Ks=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Vs(e,t){return(Vs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Bs=function(e){function t(e){var n,r=e.modelManager,i=e.storageService,a=e.contentTypes,o=e.timeout;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Ls(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,Ks(t).call(this))).modelManager=r,n.storageService=i,n.contentTypes=a,n.timeout=o,n}var n,r,i,s,c,u,l,f,p;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Vs(e,t)}(t,e),n=t,(r=[{key:"initializeFromDisk",value:(p=Fs(a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.storageService.getValue(P.SessionHistoryPersistable);case 2:return this.persistable=e.sent,e.next=5,this.storageService.getValue(P.SessionHistoryRevisions).then((function(e){return new Rs(e)}));case 5:return this.historySession=e.sent,e.next=8,this.storageService.getValue(P.SessionHistoryOptimize);case 8:t=e.sent,Object(o.l)(t)?this.autoOptimize=!0:this.autoOptimize=t,this.addMappingObserver();case 11:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{key:"addMappingObserver",value:function(){var e=this;this.modelManager.addMappingObserver(this.contentTypes,(function(t,n,r,i,a){if(i!==Ln.LocalDirtied){var o=!0,s=!1,c=void 0;try{for(var u,l=t[Symbol.iterator]();!(o=(u=l.next()).done);o=!0){var f=u.value;try{f.deleted||e.addHistoryEntryForItem(f)}catch(e){console.error("Unable to add item history entry:",e)}}}catch(e){s=!0,c=e}finally{try{o||null==l.return||l.return()}finally{if(s)throw c}}}}))}},{key:"isDiskEnabled",value:function(){return this.persistable}},{key:"isAutoOptimizeEnabled",value:function(){return this.autoOptimize}},{key:"saveToDisk",value:(f=Fs(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.persistable){e.next=2;break}return e.abrupt("return");case 2:this.storageService.setValue(P.SessionHistoryRevisions,this.historySession);case 3:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"setSessionItemRevisionThreshold",value:function(e){this.historySession.setItemRevisionThreshold(e)}},{key:"addHistoryEntryForItem",value:(l=Fs(a.a.mark((function e(t){var n,r,i=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n={uuid:t.uuid,content_type:t.content_type,updated_at:t.updated_at,content:t.getContentCopy()},r=this.historySession.addEntryForItem(n),this.autoOptimize&&this.historySession.optimizeHistoryForItem(t),r&&this.persistable&&(this.diskTimeout&&(this.timeout.hasOwnProperty("cancel")?this.timeout.cancel(this.diskTimeout):clearTimeout(this.diskTimeout)),this.diskTimeout=this.timeout((function(){i.saveToDisk()}),2e3));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"historyForItem",value:function(e){return this.historySession.historyForItem(e)}},{key:"clearHistoryForItem",value:(u=Fs(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.historySession.clearItemHistory(t),e.abrupt("return",this.saveToDisk());case 2:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"clearAllHistory",value:(c=Fs(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.historySession.clearAllHistory(),e.abrupt("return",this.storageService.removeValue(P.SessionHistoryRevisions));case 2:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"toggleDiskSaving",value:(s=Fs(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.persistable=!this.persistable,!this.persistable){e.next=6;break}this.storageService.setValue(P.SessionHistoryPersistable,!0),this.saveToDisk(),e.next=8;break;case 6:return this.storageService.setValue(P.SessionHistoryPersistable,!1),e.abrupt("return",this.storageService.removeValue(P.SessionHistoryRevisions));case 8:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"toggleAutoOptimize",value:(i=Fs(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.autoOptimize=!this.autoOptimize,this.autoOptimize?this.storageService.setValue(P.SessionHistoryOptimize,!0):this.storageService.setValue(P.SessionHistoryOptimize,!1);case 2:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})}])&&Us(n.prototype,r),t}(qi);function Hs(e){return(Hs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function zs(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Ws(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){zs(a,r,i,o,s,"next",e)}function s(e){zs(a,r,i,o,s,"throw",e)}o(void 0)}))}}function qs(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Gs(e){return(Gs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ys(e,t){return(Ys=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Js={ManageExtensions:"ActionManageExtensions",ManageBackups:"ActionManageBackups",ViewProtectedNotes:"ActionViewProtectedNotes",ManagePrivileges:"ActionManagePrivileges",ManagePasscode:"ActionManagePasscode",DeleteNote:"ActionDeleteNote"},Qs={AccountPassword:"CredentialAccountPassword",LocalPasscode:"CredentialLocalPasscode"},Zs=0,Xs=300,ec=3600,tc=604800,nc=function(e){function t(e){var n,r=e.modelManager,i=e.syncService,a=e.singletonManager,o=e.keyManager,s=e.storageService,c=e.sessionManager;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),!(r&&i&&a&&o))throw"Invalid privileges manager construction.";return(n=function(e,t){return!t||"object"!==Hs(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,Gs(t).call(this))).modelManager=r,n.syncService=i,n.singletonManager=a,n.keyManager=o,n.storageService=s,n.sessionManager=c,n.loadDefaults(),n}var n,r,i,o,s,c,u,l,f,p,h,d,y;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ys(e,t)}(t,e),n=t,(r=[{key:"loadDefaults",value:function(){this.availableActions=Object.keys(Js).map((function(e){return Js[e]})),this.availableCredentials=[Qs.AccountPassword,Qs.LocalPasscode],this.sessionLengths=[Zs,Xs,ec,tc]}},{key:"getAvailableActions",value:function(){return this.availableActions}},{key:"getAvailableCredentials",value:function(){return this.availableCredentials}},{key:"netCredentialsForAction",value:(y=Ws(a.a.mark((function e(t){var n,r,i,o,s,c,u,l,f;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPrivileges();case 2:n=e.sent,r=n.getCredentialsForAction(t),i=[],o=!0,s=!1,c=void 0,e.prev=8,u=r[Symbol.iterator]();case 10:if(o=(l=u.next()).done){e.next=27;break}if((f=l.value)!==Qs.AccountPassword){e.next=19;break}return e.next=15,this.sessionManager.online();case 15:e.sent&&i.push(f),e.next=24;break;case 19:if(f!==Qs.LocalPasscode){e.next=24;break}return e.next=22,this.keyManager.hasRootKeyWrapper();case 22:e.sent&&i.push(f);case 24:o=!0,e.next=10;break;case 27:e.next=33;break;case 29:e.prev=29,e.t0=e.catch(8),s=!0,c=e.t0;case 33:e.prev=33,e.prev=34,o||null==u.return||u.return();case 36:if(e.prev=36,!s){e.next=39;break}throw c;case 39:return e.finish(36);case 40:return e.finish(33);case 41:return e.abrupt("return",i);case 42:case"end":return e.stop()}}),e,this,[[8,29,33,41],[34,,36,40]])}))),function(e){return y.apply(this,arguments)})},{key:"getPrivileges",value:(d=Ws(a.a.mark((function e(){var t,n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=an.contentType(),n=new v("content_type","=",t),e.abrupt("return",this.singletonManager.findOrCreateSingleton({predicate:n,createPayload:Ri({object:{content_type:t,content:{}}})}));case 3:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"savePrivileges",value:(h=Ws(a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPrivileges();case 2:return t=e.sent,e.next=5,this.modelManager.setItemDirty(t);case 5:return e.abrupt("return",this.syncService.sync());case 6:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"setSessionLength",value:(p=Ws(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t,i=void 0,(i=new Date).setSeconds(i.getSeconds()+r),n=i,e.next=4,this.storageService.setValue(P.PrivilegesExpirey,n);case 4:return e.next=6,this.storageService.setValue(P.PrivilegesSessionLength,t);case 6:case"end":return e.stop()}var r,i}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"clearSession",value:(f=Ws(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.setSessionLength(Zs));case 1:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"getSelectedSessionLength",value:(l=Ws(a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.storageService.getValue(P.PrivilegesSessionLength);case 2:if(!(t=e.sent)){e.next=7;break}return e.abrupt("return",t);case 7:return e.abrupt("return",Zs);case 8:case"end":return e.stop()}}),e,this)}))),function(){return l.apply(this,arguments)})},{key:"getSessionExpirey",value:(u=Ws(a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.storageService.getValue(P.PrivilegesExpirey);case 2:if(!(t=e.sent)){e.next=7;break}return e.abrupt("return",new Date(t));case 7:return e.abrupt("return",new Date);case 8:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"actionHasPrivilegesConfigured",value:(c=Ws(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.netCredentialsForAction(t);case 2:return e.t0=e.sent.length,e.abrupt("return",e.t0>0);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"actionRequiresPrivilege",value:(s=Ws(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSessionExpirey();case 2:if(!(e.sent>new Date)){e.next=5;break}return e.abrupt("return",!1);case 5:return e.next=7,this.netCredentialsForAction(t);case 7:return n=e.sent,e.abrupt("return",n.length>0);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"authenticateAction",value:(o=Ws(a.a.mark((function e(t,n){var r,i,o,s,c,u,l,f,p;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.netCredentialsForAction(t);case 2:r=e.sent,i=[],o=[],s=!0,c=!1,u=void 0,e.prev=8,l=r[Symbol.iterator]();case 10:if(s=(f=l.next()).done){e.next=19;break}return p=f.value,e.next=14,this.verifyAuthenticationParameters(p,n[p]);case 14:e.sent?i.push(p):o.push(p);case 16:s=!0,e.next=10;break;case 19:e.next=25;break;case 21:e.prev=21,e.t0=e.catch(8),c=!0,u=e.t0;case 25:e.prev=25,e.prev=26,s||null==l.return||l.return();case 28:if(e.prev=28,!c){e.next=31;break}throw u;case 31:return e.finish(28);case 32:return e.finish(25);case 33:return e.abrupt("return",{success:0===o.length,successfulCredentials:i,failedCredentials:o});case 34:case"end":return e.stop()}}),e,this,[[8,21,25,33],[26,,28,32]])}))),function(e,t){return o.apply(this,arguments)})},{key:"verifyAuthenticationParameters",value:(i=Ws(a.a.mark((function e(t,n){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t!==Qs.AccountPassword){e.next=4;break}return e.abrupt("return",this.keyManager.validateAccountPassword(n));case 4:if(t!==Qs.LocalPasscode){e.next=6;break}return e.abrupt("return",this.keyManager.validatePasscode(n));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"displayInfoForCredential",value:function(e){var t={};return t[Qs.AccountPassword]={label:"Account Password",prompt:"Please enter your account password."},t[Qs.LocalPasscode]={label:"Local Passcode",prompt:"Please enter your local passcode."},t[e]}},{key:"displayInfoForAction",value:function(e){var t={};return t[Js.ManageExtensions]={label:"Manage Extensions"},t[Js.ManageBackups]={label:"Download/Import Backups"},t[Js.ViewProtectedNotes]={label:"View Protected Notes"},t[Js.ManagePrivileges]={label:"Manage Privileges"},t[Js.ManagePasscode]={label:"Manage Passcode"},t[Js.DeleteNote]={label:"Delete Notes"},t[e]}},{key:"getSessionLengthOptions",value:function(){return[{value:Zs,label:"Don't Remember"},{value:Xs,label:"5 Minutes"},{value:ec,label:"1 Hour"},{value:tc,label:"1 Week"}]}}])&&qs(n.prototype,r),t}(qi);function rc(e){return(rc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ic(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function ac(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){ic(a,r,i,o,s,"next",e)}function s(e){ic(a,r,i,o,s,"throw",e)}o(void 0)}))}}function oc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function sc(e){return(sc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function cc(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function uc(e,t){return(uc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var lc=0,fc=1,pc=2,hc=3,dc=function(e){function t(e){var n,r=e.modelManager,i=e.storageService,a=e.protocolService,o=e.itemsKeyManager,s=e.deviceInterface;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),!(r&&i&&a&&o&&s))throw"Invalid KeyManager construction";return(n=function(e,t){return!t||"object"!==rc(t)&&"function"!=typeof t?cc(e):t}(this,sc(t).call(this))).keyMode=lc,n.protocolService=a,n.modelManager=r,n.storageService=i,n.itemsKeyManager=o,n.deviceInterface=s,n.keyObservers=[],Object.defineProperty(cc(n),"rootKey",{enumerable:!1,writable:!0}),n}var n,r,i,s,u,l,f,p,h,d,v,y,m,g,b,w,k,x,S,_,$,O,C,E,A;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&uc(e,t)}(t,e),n=t,(r=[{key:"initialize",value:(A=ac(a.a.mark((function e(){var t,n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getWrappedRootKeyFromStorage();case 2:return t=e.sent,e.next=5,this.getAccountKeyParams();case 5:return n=e.sent,e.next=8,this.hasRootKeyWrapper();case 8:if(r=e.sent,i=!Object(o.l)(t)||!Object(o.l)(n),!r||!i){e.next=14;break}this.keyMode=pc,e.next=27;break;case 14:if(!r||i){e.next=18;break}this.keyMode=hc,e.next=27;break;case 18:if(r||!i){e.next=22;break}this.keyMode=fc,e.next=27;break;case 22:if(r||i){e.next=26;break}this.keyMode=lc,e.next=27;break;case 26:throw"Invalid key mode condition";case 27:if(this.keyMode!==fc){e.next=33;break}return e.next=30,this.getRootKeyFromKeychain();case 30:return this.rootKey=e.sent,e.next=33,this.notifyObserversOfChange();case 33:case"end":return e.stop()}}),e,this)}))),function(){return A.apply(this,arguments)})},{key:"onStatusChange",value:function(e){var t=this;return this.keyObservers.push(e),function(){Object(o.u)(t.keyObservers,e)}}},{key:"notifyObserversOfChange",value:(E=ac(a.a.mark((function e(){var t,n,r,i,o,s;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=!0,n=!1,r=void 0,e.prev=3,i=this.keyObservers[Symbol.iterator]();case 5:if(t=(o=i.next()).done){e.next=12;break}return s=o.value,e.next=9,s();case 9:t=!0,e.next=5;break;case 12:e.next=18;break;case 14:e.prev=14,e.t0=e.catch(3),n=!0,r=e.t0;case 18:e.prev=18,e.prev=19,t||null==i.return||i.return();case 21:if(e.prev=21,!n){e.next=24;break}throw r;case 24:return e.finish(21);case 25:return e.finish(18);case 26:case"end":return e.stop()}}),e,this,[[3,14,18,26],[19,,21,25]])}))),function(){return E.apply(this,arguments)})},{key:"getRootKeyFromKeychain",value:(C=ac(a.a.mark((function e(){var t,n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.deviceInterface.getKeychainValue();case 2:if(t=e.sent,!Object(o.l)(t)){e.next=5;break}return e.abrupt("return",null);case 5:return e.next=7,q.Create({content:t});case 7:return n=e.sent,e.abrupt("return",n);case 9:case"end":return e.stop()}}),e,this)}))),function(){return C.apply(this,arguments)})},{key:"saveRootKeyToKeychain",value:(O=ac(a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Object(o.l)(this.rootKey)){e.next=2;break}throw"Attempting to non-existent root key to the keychain.";case 2:if(this.keyMode===fc){e.next=4;break}throw"Should not be persisting wrapped key to keychain.";case 4:return t=this.rootKey.getPersistableValue(),e.next=7,this.deviceInterface.setKeychainValue(t);case 7:case"end":return e.stop()}}),e,this)}))),function(){return O.apply(this,arguments)})},{key:"hasRootKeyWrapper",value:($=ac(a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getRootKeyWrapperKeyParams();case 2:return t=e.sent,e.abrupt("return",!Object(o.l)(t));case 4:case"end":return e.stop()}}),e,this)}))),function(){return $.apply(this,arguments)})},{key:"hasPasscode",value:function(){return this.keyMode===hc||this.keyMode===pc}},{key:"rootKeyNeedsUnwrapping",value:(_=ac(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasRootKeyWrapper();case 2:if(e.t0=e.sent,!e.t0){e.next=5;break}e.t0=Object(o.l)(this.rootKey);case 5:return e.abrupt("return",e.t0);case 6:case"end":return e.stop()}}),e,this)}))),function(){return _.apply(this,arguments)})},{key:"getRootKeyWrapperKeyParams",value:(S=ac(a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.storageService.getValue(P.RootKeyWrapperKeyParams,No.Nonwrapped);case 2:if(t=e.sent){e.next=5;break}return e.abrupt("return",null);case 5:return e.abrupt("return",this.protocolService.createKeyParams(t));case 6:case"end":return e.stop()}}),e,this)}))),function(){return S.apply(this,arguments)})},{key:"getWrappedRootKeyFromStorage",value:(x=ac(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.storageService.getValue(P.WrappedRootKey,No.Nonwrapped));case 1:case"end":return e.stop()}}),e,this)}))),function(){return x.apply(this,arguments)})},{key:"getRootKeyParams",value:(k=ac(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.keyMode!==hc){e.next=4;break}return e.abrupt("return",this.getRootKeyWrapperKeyParams());case 4:if(this.keyMode!==fc&&this.keyMode!==pc){e.next=8;break}return e.abrupt("return",this.getAccountKeyParams());case 8:throw"Unhandled key mode for getRootKeyParams ".concat(this.keyMode);case 9:case"end":return e.stop()}}),e,this)}))),function(){return k.apply(this,arguments)})},{key:"getAccountKeyParams",value:(w=ac(a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.storageService.getValue(P.RootKeyParams,No.Nonwrapped);case 2:if(t=e.sent){e.next=5;break}return e.abrupt("return",null);case 5:return e.abrupt("return",this.protocolService.createKeyParams(t));case 6:case"end":return e.stop()}}),e,this)}))),function(){return w.apply(this,arguments)})},{key:"validateWrappingKey",value:(b=ac(a.a.mark((function e(t){var n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getWrappedRootKeyFromStorage();case 2:if(n=e.sent,this.keyMode!==hc){e.next=7;break}return e.abrupt("return",this.storageService.canDecryptWithKey(t));case 7:if(this.keyMode!==fc&&this.keyMode!==pc){e.next=15;break}return r=Ri({object:n}),e.next=11,this.protocolService.payloadByDecryptingPayload({payload:r,key:t});case 11:return i=e.sent,e.abrupt("return",!i.errorDecrypting);case 15:throw"Unhandled case in validateWrappingKey";case 16:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"computeWrappingKey",value:(g=ac(a.a.mark((function e(t){var n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.passcode,e.next=3,this.getRootKeyWrapperKeyParams();case 3:return r=e.sent,e.next=6,this.protocolService.computeRootKey({password:n,keyParams:r});case 6:return i=e.sent,e.abrupt("return",i);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"unwrapRootKey",value:(m=ac(a.a.mark((function e(t){var n,r,i,o;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.wrappingKey,this.keyMode!==hc){e.next=4;break}return this.rootKey=n,e.abrupt("return");case 4:if(this.keyMode===pc){e.next=6;break}throw"Invalid key mode condition for unwrapping.";case 6:return e.next=8,this.getWrappedRootKeyFromStorage();case 8:return r=e.sent,i=Ri({object:r}),e.next=12,this.protocolService.payloadByDecryptingPayload({payload:i,key:n});case 12:if(!(o=e.sent).errorDecrypting){e.next=17;break}throw"Unable to decrypt root key with provided wrapping key.";case 17:return e.next=19,q.Create({uuid:o.uuid,content:o.content});case 19:return this.rootKey=e.sent,e.next=22,this.notifyObserversOfChange();case 22:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"setNewRootKeyWrapper",value:(y=ac(a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.wrappingKey,r=t.keyParams,this.keyMode!==lc){e.next=5;break}this.keyMode=hc,e.next=10;break;case 5:if(this.keyMode!==fc){e.next=9;break}this.keyMode=pc,e.next=10;break;case 9:throw"Attempting to set wrapper on already wrapped key.";case 10:return e.next=12,this.deviceInterface.clearKeychainValue();case 12:if(this.keyMode!==hc&&this.keyMode!==pc){e.next=27;break}if(this.keyMode!==hc){e.next=19;break}return this.rootKey=n,e.next=17,this.itemsKeyManager.reencryptItemsKeys();case 17:e.next=21;break;case 19:return e.next=21,this.wrapAndPersistRootKey({wrappingKey:n});case 21:return e.next=23,this.storageService.setValue(P.RootKeyWrapperKeyParams,r.getPortableValue(),No.Nonwrapped);case 23:return e.next=25,this.notifyObserversOfChange();case 25:e.next=28;break;case 27:throw"Invalid keyMode on setNewRootKeyWrapper";case 28:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"wrapAndPersistRootKey",value:(v=ac(a.a.mark((function e(t){var n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.wrappingKey,r=Ri({object:this.rootKey,override:{content:this.rootKey.getPersistableValue()}}),e.next=4,this.protocolService.payloadByEncryptingPayload({payload:r,key:n,intent:F.LocalStorageEncrypted});case 4:return i=e.sent,e.next=7,this.storageService.setValue(P.WrappedRootKey,i,No.Nonwrapped);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"removeRootKeyWrapper",value:(d=ac(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.keyMode===hc||this.keyMode===pc){e.next=2;break}throw"Attempting to remove root key wrapper on unwrapped key.";case 2:return this.keyMode===hc?(this.keyMode=lc,this.rootKey=null):this.keyMode===pc&&(this.keyMode=fc),e.next=5,this.storageService.removeValue(P.WrappedRootKey,No.Nonwrapped);case 5:return e.next=7,this.storageService.removeValue(P.RootKeyWrapperKeyParams,No.Nonwrapped);case 7:if(this.keyMode!==fc){e.next=10;break}return e.next=10,this.saveRootKeyToKeychain();case 10:return e.next=12,this.notifyObserversOfChange();case 12:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"setNewRootKey",value:(h=ac(a.a.mark((function e(t){var n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.key,r=t.keyParams,n.isRootKey){e.next=3;break}throw"Root key must be a ".concat(c.RootKey," object.");case 3:if(r){e.next=5;break}throw"keyParams must be supplied if setting root key.";case 5:if(this.keyMode!==hc){e.next=9;break}this.keyMode=pc,e.next=17;break;case 9:if(this.keyMode!==lc){e.next=13;break}this.keyMode=fc,e.next=17;break;case 13:if(this.keyMode!==fc&&this.keyMode!==pc){e.next=16;break}e.next=17;break;case 16:throw"Unhandled key mode for setNewRootKey ".concat(this.keyMode);case 17:if(i=this.rootKey,this.rootKey=n,i!==n){e.next=21;break}throw"Attempting to set root key as same current value.";case 21:return e.next=23,this.storageService.setValue(P.RootKeyParams,r.getPortableValue(),No.Nonwrapped);case 23:if(this.keyMode!==fc){e.next=28;break}return e.next=26,this.saveRootKeyToKeychain();case 26:e.next=31;break;case 28:if(this.keyMode!==pc){e.next=31;break}return e.next=31,this.wrapAndPersistRootKey({wrappingKey:i});case 31:return e.next=33,this.notifyObserversOfChange(c.RootKey);case 33:return e.next=35,this.itemsKeyManager.reencryptItemsKeys();case 35:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"getRootKey",value:(p=ac(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.rootKey);case 1:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{key:"clearLocalKeyState",value:(f=ac(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.deviceInterface.clearKeychainValue();case 2:return e.next=4,this.storageService.removeValue(P.WrappedRootKey,No.Nonwrapped);case 4:return e.next=6,this.storageService.removeValue(P.RootKeyWrapperKeyParams,No.Nonwrapped);case 6:return e.next=8,this.storageService.removeValue(P.RootKeyParams,No.Nonwrapped);case 8:return this.keyMode=lc,this.rootKey=null,e.next=12,this.notifyObserversOfChange();case 12:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"validateAccountPassword",value:(l=ac(a.a.mark((function e(t){var n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getRootKeyParams();case 2:return n=e.sent,e.next=5,this.protocolService.computeRootKey({password:t,keyParams:n});case 5:return r=e.sent,i=r.compare(this.rootKey),e.abrupt("return",i?r:null);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"validatePasscode",value:(u=ac(a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getRootKeyWrapperKeyParams();case 2:return n=e.sent,e.next=5,this.protocolService.computeRootKey({password:t,keyParams:n});case 5:return r=e.sent,e.abrupt("return",this.validateWrappingKey(r));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"contentTypeUsesRootKeyEncryption",value:function(e){return e===c.ItemsKey||e===c.EncryptedStorage}},{key:"keyToUseForEncryptionOfPayload",value:(s=ac(a.a.mark((function e(t){var n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.payload,r=t.intent,!Object(o.l)(r)){e.next=3;break}throw"Intent must be supplied when looking up key for encryption of item.";case 3:if(!this.contentTypeUsesRootKeyEncryption(n.content_type)){e.next=16;break}return e.next=6,this.getRootKey();case 6:if(i=e.sent){e.next=13;break}if(!B(r)){e.next=12;break}throw"Root key encryption is required but no root key is available.";case 12:return e.abrupt("return",null);case 13:return e.abrupt("return",i);case 16:return e.abrupt("return",this.itemsKeyManager.getDefaultItemsKey());case 17:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"keyToUseForDecryptionOfPayload",value:(i=ac(a.a.mark((function e(t){var n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.payload,!this.contentTypeUsesRootKeyEncryption(n.content_type)){e.next=3;break}return e.abrupt("return",this.getRootKey());case 3:if(!n.items_key_id){e.next=6;break}return r=this.itemsKeyManager.itemsKeyForPayload(n),e.abrupt("return",r);case 6:if((i=n.version)!==this.protocolService.getLatestVersion()){e.next=9;break}throw"No associated key found for item encrypted with latest protocol version.";case 9:return e.abrupt("return",this.itemsKeyManager.defaultItemsKeyForItemVersion(i));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})}])&&oc(n.prototype,r),t}(qi);function vc(e){return(vc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function yc(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function mc(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){yc(a,r,i,o,s,"next",e)}function s(e){yc(a,r,i,o,s,"throw",e)}o(void 0)}))}}function gc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function bc(e){return(bc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function wc(e,t){return(wc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var kc=L.V003,xc=function(e){function t(e){var n,r=e.syncService,i=e.modelManager,o=e.protocolService;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==vc(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,bc(t).call(this))).syncService=r,n.modelManager=i,n.protocolService=o,n.keyObservers=[],n.registerSyncObserver(),n.modelManager.addMappingObserver([c.ItemsKey],mc(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.notifyObserversOfChange();case 2:case"end":return e.stop()}}),e)})))),n}var n,r,i,s,u,l,f,p;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&wc(e,t)}(t,e),n=t,(r=[{key:"setKeyManager",value:function(e){this.keyManager=e}},{key:"addItemsKeyChangeObserver",value:function(e){var t=this;return this.keyObservers.push(e),function(){Object(o.u)(t.keyObservers,e)}}},{key:"notifyObserversOfChange",value:(p=mc(a.a.mark((function e(){var t,n,r,i,o,s;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=!0,n=!1,r=void 0,e.prev=3,i=this.keyObservers[Symbol.iterator]();case 5:if(t=(o=i.next()).done){e.next=12;break}return s=o.value,e.next=9,s();case 9:t=!0,e.next=5;break;case 12:e.next=18;break;case 14:e.prev=14,e.t0=e.catch(3),n=!0,r=e.t0;case 18:e.prev=18,e.prev=19,t||null==i.return||i.return();case 21:if(e.prev=21,!n){e.next=24;break}throw r;case 24:return e.finish(21);case 25:return e.finish(18);case 26:case"end":return e.stop()}}),e,this,[[3,14,18,26],[19,,21,25]])}))),function(){return p.apply(this,arguments)})},{key:"registerSyncObserver",value:function(){var e=this;this.syncService.addEventObserver(function(){var t=mc(a.a.mark((function t(n){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n!==y.FullSyncCompleted){t.next=3;break}return t.next=3,e.handleFullSyncCompletion();case 3:if(n!==y.DownloadFirstSyncCompleted){t.next=6;break}return t.next=6,e.handleDownloadFirstSyncCompletion();case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}},{key:"handleDownloadFirstSyncCompletion",value:(f=mc(a.a.mark((function e(){var t,n,r,i,s;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.allItemsKeys,n=t.filter((function(e){return e.neverSynced})),r=t.find((function(e){return!e.neverSynced&&e.isDefault})),Object(o.l)(r)){e.next=9;break}return e.next=7,this.modelManager.setItemsToBeDeleted(n);case 7:e.next=20;break;case 9:return e.next=11,this.keyManager.getRootKey();case 11:if(!(i=e.sent)){e.next=20;break}if(!((s=n.filter((function(e){return e.version!==i.version}))).length>0)){e.next=17;break}return e.next=17,this.modelManager.setItemsToBeDeleted(s);case 17:if(0!==t.length){e.next=20;break}return e.next=20,this.createNewDefaultItemsKey();case 20:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"handleFullSyncCompletion",value:(l=mc(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.getDefaultItemsKey()){e.next=6;break}return e.next=4,this.createNewDefaultItemsKey();case 4:if(this.keyManager.keyMode!==hc){e.next=6;break}return e.abrupt("return",this.syncService.repersistAllItems());case 6:case"end":return e.stop()}}),e,this)}))),function(){return l.apply(this,arguments)})},{key:"itemsKeyForPayload",value:function(e){return this.allItemsKeys.find((function(t){return t.uuid===e.items_key_id}))}},{key:"getDefaultItemsKey",value:function(){return 1===this.allItemsKeys.length?this.allItemsKeys[0]:this.allItemsKeys.find((function(e){return e.isDefault}))}},{key:"reencryptItemsKeys",value:(u=mc(a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!((t=this.allItemsKeys).length>0)){e.next=4;break}return e.next=4,this.modelManager.setItemsDirty(t);case 4:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"defaultItemsKeyForItemVersion",value:(s=mc(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.allItemsKeys.find((function(e){return e.version===t})));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"createNewDefaultItemsKey",value:(i=mc(a.a.mark((function e(){var t,n,r,i,o;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.keyManager.getRootKey();case 2:if(t=e.sent,!(N(n=t?t.version:this.protocolService.getLatestVersion(),kc)<=0)){e.next=10;break}return r=Xe.FromRaw({itemsKey:t.masterKey,dataAuthenticationKey:t.dataAuthenticationKey,version:n}),e.next=8,r.initUUID();case 8:e.next=13;break;case 10:return e.next=12,this.protocolService.operatorForVersion(n).createItemsKey();case 12:r=e.sent;case 13:if(!(i=this.getDefaultItemsKey())){e.next=18;break}return i.content.isDefault=!1,e.next=18,this.modelManager.setItemDirty(i);case 18:return r.content.isDefault=!0,o=r.payloadRepresentation({override:{dirty:!0}}),e.next=22,this.modelManager.mapPayloadToLocalItem({payload:o});case 22:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"allItemsKeys",get:function(){return this.modelManager.itemsKeys}}])&&gc(n.prototype,r),t}(qi);function Sc(e,t){return e.sort((function(e,n){var r=new Date(n.updated_at)-new Date(e.updated_at),i=0,a=0;return t&&(i=t.indexOf(e.content_type),a=t.indexOf(n.content_type),-1===i&&(i=t.length),-1===a&&(a=t.length)),i===a?r:i<a?-1:1}))}function _c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var $c=function(){function e(t){var n=t.interval,r=t.receiver;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.interval=n,this.receiver=r}var t,n;return t=e,(n=[{key:"setSyncInProgress",value:function(e){this.inProgress=!0}},{key:"setUploadStatus",value:function(e){var t=e.completed,n=e.total;this.completedUpload=t,this.totalUpload=n}},{key:"setDownloadStatus",value:function(e){var t=e.downloaded;this.downloaded=t}},{key:"setDatabaseLoadStatus",value:function(e){var t=e.current,n=e.total,r=e.done;this.databaseLoadCurrent=t,this.databaseLoadTotal=n,this.databaseLoadDone=r}},{key:"setDidBegin",value:function(){this.syncing=!0,this.syncStart=new Date}},{key:"setDidEnd",value:function(){this.syncing=!1,this.syncEnd=new Date}},{key:"startTimingMonitor",value:function(){var e=this;this.timingMonitor&&this.this.stopTimingMonitor(),this.timingMonitor=this.interval((function(){e.secondsSinceSyncStart>5&&(e.receiver(y.SyncTakingTooLong),e.stopTimingMonitor())}),500)}},{key:"stopTimingMonitor",value:function(){this.interval.hasOwnProperty("cancel")?this.interval.cancel(this.timingMonitor):clearInterval(this.timingMonitor),this.timingMonitor=null}},{key:"hasError",value:function(){return this.error}},{key:"setError",value:function(e){this.error=e}},{key:"clearError",value:function(){this.error=null}},{key:"reset",value:function(){this.downloaded=0,this.completedUpload=0,this.totalUpload=0,this.inProgress=!1,this.syncing=!1,this.error=null}},{key:"syncInProgress",get:function(){return!0===this.syncing}},{key:"secondsSinceSyncStart",get:function(){return(new Date-this.syncStart)/1e3}}])&&_c(t.prototype,n),e}();function Pc(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Oc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Cc=function(){function e(t){var n=t.receiver,r=t.maxDiscordance;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.discordance=0,this.receiver=n,this.maxDiscordance=r,this.reset()}var t,n,r,i;return t=e,(n=[{key:"setLastPresaveSyncDate",value:function(e){this._lastPreSyncSave=e}},{key:"setLastSyncDate",value:function(e){this._lastSyncDate=e}},{key:"isOutOfSync",value:function(){return this.outOfSync}},{key:"reset",value:function(){this._lastSyncDate=null,this._lastPreSyncSave=null,this.discordance=0,this.outOfSync=!1}},{key:"getLastClientIntegrityHash",value:function(){return this.lastClientHash}},{key:"clearIntegrityHashes",value:function(){this.lastClientHash=null,this.lastServerHash=null}},{key:"setIntegrityHashes",value:(r=a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.clientHash,r=t.serverHash,this.lastClientHash=n,this.lastServerHash=r,r&&0!==r.length&&n&&n!==r?(this.discordance++,this.discordance>=this.maxDiscordance&&!this.outOfSync&&(this.outOfSync=!0,this.receiver(y.EnterOutOfSync))):(this.outOfSync&&(this.outOfSync=!1,this.receiver(y.ExitOutOfSync)),this.discordance=0);case 5:case"end":return e.stop()}}),e,this)})),i=function(){var e=this,t=arguments;return new Promise((function(n,i){var a=r.apply(e,t);function o(e){Pc(a,n,i,o,s,"next",e)}function s(e){Pc(a,n,i,o,s,"throw",e)}o(void 0)}))},function(e){return i.apply(this,arguments)})},{key:"lastPreSyncSaveDate",get:function(){return this._lastPreSyncSave}},{key:"lastSyncDate",get:function(){return this._lastSyncDate}},{key:"needsSync",get:function(){return this.discordance>0&&this.discordance<this.maxDiscordance}}])&&Oc(t.prototype,n),e}();function Ec(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Ac(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Ic=function(){function e(t){var n=t.apiService,r=t.protocolService,i=t.contentType,a=t.customEvent,o=t.limit;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.apiService=n,this.protocolService=r,this.contentType=i,this.customEvent=a,this.limit=o,this.progressObj={retrievedPayloads:[]}}var t,n,r,i;return t=e,(n=[{key:"run",value:(r=a.a.mark((function e(){var t,n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.apiService.sync({lastSyncToken:this.progressObj.lastSyncToken,paginationToken:this.progressObj.paginationToken,limit:this.limit||500,contentType:this.contentType,customEvent:this.customEvent});case 2:return t=e.sent,n=t.retrieved_items.map((function(e){return Ni({object:e,source:Ln.RemoteRetrieved})})),e.next=6,this.protocolService.payloadsByDecryptingPayloads({payloads:n});case 6:if(r=e.sent,this.progressObj.retrievedPayloads=this.progressObj.retrievedPayloads.concat(r),this.progressObj.lastSyncToken=t.sync_token,this.progressObj.paginationToken=t.cursor_token,!t.cursor_token){e.next=14;break}return e.abrupt("return",this.run());case 14:return e.abrupt("return",this.progressObj.retrievedPayloads);case 15:case"end":return e.stop()}}),e,this)})),i=function(){var e=this,t=arguments;return new Promise((function(n,i){var a=r.apply(e,t);function o(e){Ec(a,n,i,o,s,"next",e)}function s(e){Ec(a,n,i,o,s,"throw",e)}o(void 0)}))},function(){return i.apply(this,arguments)})}])&&Ac(t.prototype,n),e}();function jc(e){return e===Ln.RemoteRetrieved?Pi:e===Ln.RemoteSaved?Ti:e===Ln.ConflictData||e===Ln.ConflictUuid?gi:void 0}function Dc(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Mc(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Dc(a,r,i,o,s,"next",e)}function s(e){Dc(a,r,i,o,s,"throw",e)}o(void 0)}))}}function Tc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Rc=function(){function e(t){var n=t.response,r=t.decryptedResponsePayloads,i=t.baseCollection,a=t.payloadsSavedOrSaving;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.response=n,this.baseCollection=i,this.relatedCollectionSet=new h({collections:[new f({payloads:r,source:Ln.DecryptedTransient}),new f({payloads:a,source:Ln.SavedOrSaving})]})}var t,n,r,i;return t=e,(n=[{key:"collectionsByProcessingResponse",value:(i=Mc(a.a.mark((function e(){var t,n,r,i,o;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.next=3,this.collectionByProcessingRawItems({rawItems:this.response.rawRetrievedItems,source:Ln.RemoteRetrieved});case 3:return n=e.sent,t.push(n),e.next=7,this.collectionByProcessingRawItems({rawItems:this.response.rawSavedItems,source:Ln.RemoteSaved});case 7:return r=e.sent,t.push(r),e.next=11,this.collectionByProcessingRawItems({rawItems:this.response.rawUuidConflictItems,source:Ln.ConflictUuid});case 11:return i=e.sent,t.push(i),e.next=15,this.collectionByProcessingRawItems({rawItems:this.response.rawDataConflictItems,source:Ln.ConflictData});case 15:return o=e.sent,t.push(o),e.abrupt("return",t);case 18:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"collectionByProcessingRawItems",value:(r=Mc(a.a.mark((function e(t){var n,r,i,o,s,c,u,l,p=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.rawItems,r=t.source,i=n.map((function(e){return Ni({object:e,source:r})})),o=new f({payloads:i,source:r}),s=jc(r),c=new s({baseCollection:this.baseCollection,applyCollection:o,relatedCollectionSet:this.relatedCollectionSet}),e.next=7,c.resultingCollection();case 7:return u=e.sent,l=u.allPayloads.map((function(e){return Ui({payload:e,override:{dirty:p.finalDirtyStateForPayload(e)}})})),e.abrupt("return",new f({payloads:l,source:r}));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"finalDirtyStateForPayload",value:function(e){var t=this.baseCollection.findPayload(e.uuid);return t?t.dirtiedDate>t.lastSyncBegan:e.dirty}}])&&Tc(t.prototype,n),e}();function Lc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Nc=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.rawResponse=t,Object(o.d)(this)}var t,n;return t=e,(n=[{key:"error",get:function(){return this.rawResponse.error}},{key:"lastSyncToken",get:function(){return this.rawResponse[fa]}},{key:"paginationToken",get:function(){return this.rawResponse[pa]}},{key:"integrityHash",get:function(){return this.rawResponse.integrity_hash}},{key:"checkIntegrity",get:function(){return this.integrityHash&&!this.paginationToken}},{key:"numberOfItemsInvolved",get:function(){return this.rawSavedItems.concat(this.rawRetrievedItems).concat(this.rawItemsFromConflicts).length}},{key:"allProcessedPayloads",get:function(){return this.retrievedPayloads.concat(this.savedPayloads).concat(this.conflictPayloads)}},{key:"savedPayloads",get:function(){return this.rawSavedItems.map((function(e){return Ni({object:e,source:Ln.RemoteSaved})}))}},{key:"retrievedPayloads",get:function(){return this.rawRetrievedItems.map((function(e){return Ni({object:e,source:Ln.RemoteRetrieved})}))}},{key:"conflictPayloads",get:function(){return this.rawItemsFromConflicts.map((function(e){return Ni({object:e,source:Ln.RemoteRetrieved})}))}},{key:"rawSavedItems",get:function(){return this.rawResponse.saved_items||[]}},{key:"rawRetrievedItems",get:function(){return this.rawResponse.retrieved_items||[]}},{key:"rawUuidConflictItems",get:function(){return this.rawConflictObjects.filter((function(e){return"uuid_conflict"===e.type})).map((function(e){return e.unsaved_item||e.item}))}},{key:"rawDataConflictItems",get:function(){return this.rawConflictObjects.filter((function(e){return"sync_conflict"===e.type})).map((function(e){return e.server_item||e.item}))}},{key:"rawItemsFromConflicts",get:function(){var e=this.rawResponse.conflicts||[],t=this.rawResponse.unsaved||[],n=e.map((function(e){return e.unsaved_item||e.server_item})),r=t.map((function(e){return e.item}));return n.concat(r)}},{key:"rawConflictObjects",get:function(){var e=this.rawResponse.conflicts||[],t=this.rawResponse.unsaved||[];return e.concat(t)}},{key:"hasError",get:function(){return!Object(o.l)(this.rawResponse.error)}}])&&Lc(t.prototype,n),e}();function Fc(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Uc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Kc=function(){function e(t){var n=t.payloads,r=t.receiver,i=t.lastSyncToken,a=t.paginationToken,o=t.checkIntegrity,s=t.apiService;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.payloads=n,this.pendingPayloads=n,this.lastSyncToken=i,this.paginationToken=a,this.checkIntegrity=o,this.apiService=s,this.receiver=r,this.responses=[]}var t,n,r,i;return t=e,(n=[{key:"popPayloads",value:function(e){var t=this.pendingPayloads.slice(0,e);return Object(o.x)(this.pendingPayloads,t),t}},{key:"run",value:(r=a.a.mark((function e(){var t,n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.popPayloads(this.upLimit),e.next=3,this.apiService.sync({payloads:t,lastSyncToken:this.lastSyncToken,paginationToken:this.paginationToken,limit:this.downLimit,checkIntegrity:this.checkIntegrity});case 3:return n=e.sent,r=new Nc(n),this.responses.push(r),this.lastSyncToken=r.lastSyncToken,this.paginationToken=r.paginationToken,e.next=10,this.receiver(r,1);case 10:if(this.done){e.next=12;break}return e.abrupt("return",this.run());case 12:case"end":return e.stop()}}),e,this)})),i=function(){var e=this,t=arguments;return new Promise((function(n,i){var a=r.apply(e,t);function o(e){Fc(a,n,i,o,s,"next",e)}function s(e){Fc(a,n,i,o,s,"throw",e)}o(void 0)}))},function(){return i.apply(this,arguments)})},{key:"payloadsSavedOrSaving",get:function(){return Object(o.b)(this.payloads,this.pendingPayloads)}},{key:"done",get:function(){return 0===this.pendingPayloads.length&&!this.paginationToken}},{key:"upLimit",get:function(){return 150}},{key:"downLimit",get:function(){return 150}},{key:"numberOfItemsInvolved",get:function(){var e=0,t=!0,n=!1,r=void 0;try{for(var i,a=this.responses[Symbol.iterator]();!(t=(i=a.next()).done);t=!0)e+=i.value.numberOfItemsInvolved}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}return e}}])&&Uc(t.prototype,n),e}();function Vc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bc(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Hc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var zc=function(){function e(t){var n=t.payloads,r=t.receiver;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.payloads=n,this.receiver=r}var t,n,r,i;return t=e,(n=[{key:"run",value:(r=a.a.mark((function e(){var t,n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.payloads.map((function(e){var t;return Ni({object:e,source:Ln.LocalSaved,override:(t={},Vc(t,ne.Dirty,!1),Vc(t,ne.LastSyncEnd,new Date),t)})})),n={payloads:t},e.next=4,this.receiver(n,1);case 4:case"end":return e.stop()}}),e,this)})),i=function(){var e=this,t=arguments;return new Promise((function(n,i){var a=r.apply(e,t);function o(e){Bc(a,n,i,o,s,"next",e)}function s(e){Bc(a,n,i,o,s,"throw",e)}o(void 0)}))},function(){return i.apply(this,arguments)})}])&&Hc(t.prototype,n),e}();function Wc(e){return(Wc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function qc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Gc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yc(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Jc(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Yc(a,r,i,o,s,"next",e)}function s(e){Yc(a,r,i,o,s,"throw",e)}o(void 0)}))}}function Qc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Zc(e,t,n){return(Zc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Xc(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function Xc(e){return(Xc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eu(e,t){return(eu=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var tu=1,nu=2,ru={Default:1,DownloadFirst:2},iu={External:1,SpawnQueue:2,ResolveQueue:3,MoreDirtyItems:4,AfterDownloadFirst:5,IntegrityCheck:6,ResolveOutOfSync:7},au=function(e){function t(e){var n,r=e.sessionManager,i=e.protocolService,a=e.storageService,o=e.modelManager,s=e.apiService,u=e.interval;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Wc(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,Xc(t).call(this))).sessionManager=r,n.protocolService=i,n.modelManager=o,n.storageService=a,n.apiService=s,n.interval=u,n.statusObservers=[],n.resolveQueue=[],n.spawnQueue=[],n.majorChangeThreshold=15,n.maxDiscordance=5,n.initializeStatus(),n.initializeState(),n.localLoadPriorty=[c.ItemsKey,c.UserPrefs,c.Privileges,c.Component,c.Theme],n.nonEncryptedTypes=[c.Mfa,c.ServerExtension],n}var n,r,i,s,u,l,p,h,d,v,m,g,b,w,k,x,S,_,$,O,C,E,A,I,j,D,M;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&eu(e,t)}(t,e),n=t,(r=[{key:"initializeStatus",value:function(){var e=this;this.opStatus=new $c({interval:this.interval,receiver:function(t){e.notifyEvent(t)}})}},{key:"initializeState",value:function(){var e=this;this.state=new Cc({maxDiscordance:this.maxDiscordance,receiver:function(t){t===y.EnterOutOfSync?e.notifyEvent(y.EnterOutOfSync):t===y.ExitOutOfSync&&e.notifyEvent(y.ExitOutOfSync)}})}},{key:"lockSyncing",value:function(){this.locked=!0}},{key:"unlockSyncing",value:function(){this.locked=!1}},{key:"isOutOfSync",value:function(){return this.state.isOutOfSync()}},{key:"getLastSyncDate",value:function(){return this.state.lastSyncDate}},{key:"resetSyncState",value:function(){this.state.reset()}},{key:"getDatabasePayloads",value:(M=Jc(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.storageService.getAllRawPayloads());case 1:case"end":return e.stop()}}),e,this)}))),function(){return M.apply(this,arguments)})},{key:"isDatabaseLoaded",value:function(){return this.databaseLoaded}},{key:"loadDatabasePayloads",value:(D=Jc(a.a.mark((function e(t){var n,r,i,s,u,l,f,p,h,d,v;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.databaseLoaded){e.next=2;break}throw"Attempting to initialize already initialized local database.";case 2:return n=t.map((function(e){return Ri({object:e})})),r=Sc(n,this.localLoadPriorty),i=r.filter((function(e){return e.content_type===c.ItemsKey})),Object(o.x)(r,i),e.next=8,this.protocolService.payloadsByDecryptingPayloads({payloads:i});case 8:return s=e.sent,e.next=11,this.modelManager.mapPayloadsToLocalItems({payloads:s,source:Ln.LocalRetrieved});case 11:u=r.length,l=100,f=Math.ceil(u/l),p=0;case 15:if(!(p<f)){e.next=28;break}return h=p*l,d=r.slice(h,h+l),e.next=20,this.protocolService.payloadsByDecryptingPayloads({payloads:d});case 20:return v=e.sent,e.next=23,this.modelManager.mapPayloadsToLocalItems({payloads:v,source:Ln.LocalRetrieved});case 23:this.notifyEvent(y.LocalDataIncrementalLoad),this.opStatus.setDatabaseLoadStatus({current:h,total:u});case 25:p++,e.next=15;break;case 28:this.opStatus.setDatabaseLoadStatus({done:!0}),this.databaseLoaded=!0;case 30:case"end":return e.stop()}}),e,this)}))),function(e){return D.apply(this,arguments)})},{key:"setLastSyncToken",value:(j=Jc(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.syncToken=t,e.abrupt("return",this.storageService.setValue(P.LastSyncToken,t));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return j.apply(this,arguments)})},{key:"setPaginationToken",value:(I=Jc(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.cursorToken=t,!t){e.next=5;break}return e.abrupt("return",this.storageService.setValue(P.PaginationToken,t));case 5:return e.abrupt("return",this.storageService.removeValue(P.PaginationToken));case 6:case"end":return e.stop()}}),e,this)}))),function(e){return I.apply(this,arguments)})},{key:"getLastSyncToken",value:(A=Jc(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.syncToken){e.next=4;break}return e.next=3,this.storageService.getValue(P.LastSyncToken);case 3:this.syncToken=e.sent;case 4:return e.abrupt("return",this.syncToken);case 5:case"end":return e.stop()}}),e,this)}))),function(){return A.apply(this,arguments)})},{key:"getPaginationToken",value:(E=Jc(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.cursorToken){e.next=4;break}return e.next=3,this.storageService.getValue(P.PaginationToken);case 3:this.cursorToken=e.sent;case 4:return e.abrupt("return",this.cursorToken);case 5:case"end":return e.stop()}}),e,this)}))),function(){return E.apply(this,arguments)})},{key:"clearSyncPositionTokens",value:(C=Jc(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.syncToken=null,this.cursorToken=null,e.next=4,this.storageService.removeValue(P.LastSyncToken);case 4:return e.next=6,this.storageService.removeValue(P.PaginationToken);case 6:case"end":return e.stop()}}),e,this)}))),function(){return C.apply(this,arguments)})},{key:"itemsNeedingSync",value:(O=Jc(a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.modelManager.getDirtyItems(),e.abrupt("return",t);case 2:case"end":return e.stop()}}),e,this)}))),function(){return O.apply(this,arguments)})},{key:"alternateUuidForItem",value:($=Jc(a.a.mark((function e(t){var n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.isItem){e.next=2;break}throw"Attempting to alternate uuid of non-item object";case 2:return n=Ri({object:t}),e.next=5,Dn({payload:n,baseCollection:this.modelManager.getMasterCollection()});case 5:return r=e.sent,e.next=8,this.modelManager.mapPayloadsToLocalItems({payloads:r,source:Ln.LocalSaved});case 8:return i=e.sent,e.next=11,this.persistPayloads({decryptedPayloads:r});case 11:return e.abrupt("return",i[0]);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return $.apply(this,arguments)})},{key:"markAllItemsAsNeedingSync",value:(_=Jc(a.a.mark((function e(){var t,n,r,i,o,s,c,u,l,f,p,h=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=h.length>0&&void 0!==h[0]?h[0]:{},n=t.alternateUuids,this.log("Marking all items as needing sync"),!n){e.next=30;break}r=this.modelManager.allNondummyItems.filter((function(e){return!e.errorDecrypting})).slice(),i=!0,o=!1,s=void 0,e.prev=7,c=r[Symbol.iterator]();case 9:if(i=(u=c.next()).done){e.next=16;break}return l=u.value,e.next=13,this.alternateUuidForItem(l);case 13:i=!0,e.next=9;break;case 16:e.next=22;break;case 18:e.prev=18,e.t0=e.catch(7),o=!0,s=e.t0;case 22:e.prev=22,e.prev=23,i||null==c.return||c.return();case 25:if(e.prev=25,!o){e.next=28;break}throw s;case 28:return e.finish(25);case 29:return e.finish(22);case 30:return f=this.modelManager.allNondummyItems,p=f.map((function(e){return Ri({object:e,override:{dirty:!0}})})),e.next=34,this.modelManager.mapPayloadsToLocalItems({payloads:p});case 34:return e.next=36,this.persistPayloads({decryptedPayloads:p});case 36:case"end":return e.stop()}}),e,this,[[7,18,22,30],[23,,25,29]])}))),function(){return _.apply(this,arguments)})},{key:"repersistAllItems",value:(S=Jc(a.a.mark((function e(){var t,n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.modelManager.allItems,n=t.map((function(e){return Ri({object:e})})),e.abrupt("return",this.persistPayloads({decryptedPayloads:n}));case 3:case"end":return e.stop()}}),e,this)}))),function(){return S.apply(this,arguments)})},{key:"popPayloadsNeedingPreSyncSave",value:(x=Jc(a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.state.lastPreSyncSaveDate){e.next=3;break}return e.abrupt("return",t);case 3:return r=t.filter((function(e){return!e.dirtiedDate||e.dirtiedDate>n})),this.state.setLastPresaveSyncDate(new Date),e.abrupt("return",r);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"timingStrategyResolveOnNext",value:function(){var e=this;return new Promise((function(t,n){e.resolveQueue.push({resolve:t,reject:n})}))}},{key:"timingStrategyForceSpawnNew",value:function(e){var t=this;return new Promise((function(n,r){t.spawnQueue.push({resolve:n,reject:r,options:e})}))}},{key:"popSpawnQueue",value:function(){if(0===this.spawnQueue.length)return null;var e=this.spawnQueue[0];return Object(o.v)(this.spawnQueue,0),this.log("Syncing again from spawn queue"),this.sync(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qc(Object(n),!0).forEach((function(t){Gc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({timingStrategy:nu,source:iu.SpawnQueue},e.options)).then((function(){e.resolve()})).catch((function(){e.reject()}))}},{key:"payloadsByPreparingForServer",value:function(e){var t=this;return this.protocolService.payloadsByEncryptingPayloads({payloads:e,intent:function(e){return t.nonEncryptedTypes.includes(e.content_type)?F.SyncDecrypted:F.Sync}})}},{key:"sync",value:(k=Jc(a.a.mark((function e(){var t,n,r,i,s,c,u,l,f,p,h,d,v,m,g,b,w,k,x,S,_,$,P,O,C,E,A,I=this,j=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=j.length>0&&void 0!==j[0]?j[0]:{},n=t.timingStrategy,r=t.mode,i=t.checkIntegrity,s=t.source,!this.locked){e.next=4;break}return this.log("Sync Locked"),e.abrupt("return");case 4:return c=function(){return I.syncLock},u=function(){I.syncLock=!0},l=function(){I.syncLock=!1},f=this.opStatus.syncInProgress,p=this.databaseLoaded,(h=!c())&&p&&!f&&u(),s||(s=iu.External),e.next=14,this.itemsNeedingSync();case 14:return d=e.sent,v=d.filter((function(e){return e.neverSynced&&e.deleted})),Object(o.x)(d,v),m=d.map((function(e){return e.payloadRepresentation()})),e.next=20,this.popPayloadsNeedingPreSyncSave(m);case 20:return g=e.sent,e.next=23,this.persistPayloads({decryptedPayloads:g});case 23:if(b=this.resolveQueue.slice(),w=Object(o.l)(n)?tu:n,!f&&p&&h){e.next=36;break}if(this.log(h?f?"Attempting to sync while existing sync in progress.":"Attempting to sync before local database has loaded.":"Another function call has begun preparing for sync."),w!==tu){e.next=31;break}return e.abrupt("return",this.timingStrategyResolveOnNext());case 31:if(w!==nu){e.next=35;break}return e.abrupt("return",this.timingStrategyForceSpawnNew({mode:r,checkIntegrity:i,source:s}));case 35:throw"Unhandled timing strategy ".concat(w);case 36:return this.opStatus.setDidBegin(),k=new Date,e.next=40,this.modelManager.setItemsProperties({items:d,properties:Gc({},ne.LastSyncBegan,k)});case 40:return x=Object(o.l)(r)?ru.Default:r,e.next=43,this.sessionManager.online();case 43:if(S=e.sent,x!==ru.Default){e.next=56;break}if(this.completedInitialSync){e.next=47;break}throw"Attempting to default mode sync without having completed initial.";case 47:if(!S){e.next=53;break}return e.next=50,this.payloadsByPreparingForServer(m);case 50:_=e.sent,e.next=54;break;case 53:_=m;case 54:e.next=57;break;case 56:x===ru.DownloadFirst&&(_=[]);case 57:if(!S){e.next=63;break}return e.next=60,this.syncOnlineOperation({payloads:_,checkIntegrity:i,source:s,mode:x});case 60:$=e.sent,e.next=66;break;case 63:return e.next=65,this.syncOfflineOperation({payloads:_});case 65:$=e.sent;case 66:return e.next=68,$.run();case 68:for(this.opStatus.setDidEnd(),l(),P=!0,O=!1,C=void 0,e.prev=73,E=b[Symbol.iterator]();!(P=(A=E.next()).done);P=!0)A.value.resolve();e.next=81;break;case 77:e.prev=77,e.t0=e.catch(73),O=!0,C=e.t0;case 81:e.prev=81,e.prev=82,P||null==E.return||E.return();case 84:if(e.prev=84,!O){e.next=87;break}throw C;case 87:return e.finish(84);case 88:return e.finish(81);case 89:if(Object(o.x)(this.resolveQueue,b),!this.opStatus.hasError()){e.next=92;break}return e.abrupt("return");case 92:return this.opStatus.reset(),this.state.setLastSyncDate(new Date),$.numberOfItemsInvolved>=this.majorChangeThreshold&&this.notifyEvent(y.MajorDataChange),e.next=97,this.handleNeverSyncedDeleted(v);case 97:if(x===ru.DownloadFirst){e.next=100;break}return e.next=100,this.notifyEvent(y.FullSyncCompleted,{source:s});case 100:if(x!==ru.DownloadFirst){e.next=107;break}return this.completedInitialSync=!0,e.next=104,this.notifyEvent(y.DownloadFirstSyncCompleted);case 104:return e.abrupt("return",this.sync({source:iu.AfterDownloadFirst,checkIntegrity:!0}));case 107:if(this.popSpawnQueue()||!(this.resolveQueue.length>0)){e.next=112;break}this.log("Syncing again from resolve queue"),this.sync({source:iu.ResolveQueue}),e.next=125;break;case 112:return e.next=114,this.itemsNeedingSync();case 114:if(e.t1=e.sent.length,!(e.t1>0)){e.next=119;break}return e.abrupt("return",this.sync({source:iu.MoreDirtyItems}));case 119:if(!$.checkIntegrity){e.next=123;break}this.state.needsSync&&$.done&&(this.log("Syncing again from integrity check"),this.sync({checkIntegrity:!0,timingStrategy:nu,source:iu.IntegrityCheck})),e.next=125;break;case 123:return e.next=125,this.state.clearIntegrityHashes();case 125:case"end":return e.stop()}}),e,this,[[73,77,81,89],[82,,84,88]])}))),function(){return k.apply(this,arguments)})},{key:"syncOnlineOperation",value:(w=Jc(a.a.mark((function e(t){var n,r,i,o,s,c=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.payloads,r=t.checkIntegrity,i=t.source,o=t.mode,this.log("Syncing online user","source:",i,"mode:",o,"payloads:",n),e.t0=Kc,e.t1=this.apiService,e.t2=n,e.t3=r,e.next=8,this.getLastSyncToken();case 8:return e.t4=e.sent,e.next=11,this.getPaginationToken();case 11:return e.t5=e.sent,e.t6=function(){var e=Jc(a.a.mark((function e(t,n){var r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(1!==n){e.next=11;break}if(!(r=t).hasError){e.next=7;break}return e.next=5,c.handleErrorServerResponse({operation:s,response:r});case 5:e.next=9;break;case 7:return e.next=9,c.handleSuccessServerResponse({operation:s,response:r});case 9:e.next=14;break;case 11:if(2!==n){e.next=14;break}return e.next=14,c.handleStatusChange({operation:s});case 14:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),e.t7={apiService:e.t1,payloads:e.t2,checkIntegrity:e.t3,lastSyncToken:e.t4,paginationToken:e.t5,receiver:e.t6},s=new e.t0(e.t7),e.abrupt("return",s);case 16:case"end":return e.stop()}}),e,this)}))),function(e){return w.apply(this,arguments)})},{key:"syncOfflineOperation",value:(b=Jc(a.a.mark((function e(t){var n,r,i=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.payloads,this.log("Syncing offline user",n),r=new zc({payloads:n,receiver:function(){var e=Jc(a.a.mark((function e(t,n){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(1!==n){e.next=5;break}return e.next=3,i.handleOfflineResponse(t);case 3:e.next=8;break;case 5:if(2!==n){e.next=8;break}return e.next=8,i.handleStatusChange({operation:r});case 8:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()}),e.abrupt("return",r);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"handleStatusChange",value:(g=Jc(a.a.mark((function e(t){var n,r,i,o;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.operation,r=n.pendingUploadCount(),i=n.totalUploadCount(),o=i-r,this.opStatus.setUploadStatus({completed:o,total:i});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"handleOfflineResponse",value:(m=Jc(a.a.mark((function e(t){var n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.payloads,r=this.modelManager.getMasterCollection(),i=n.map((function(e){return r.findPayload(e.uuid).mergedWith(e)})),e.next=5,this.persistPayloads({decryptedPayloads:i});case 5:return e.next=7,this.modelManager.mapPayloadsToLocalItems({payloads:n,source:Ln.LocalSaved});case 7:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"handleErrorServerResponse",value:(v=Jc(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.operation,n=t.response,this.log("Sync Error",n),401===n.status&&this.notifyEvent(y.InvalidSession),this.opStatus.setError(n.error),this.notifyEvent(y.SyncError,n.error);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"handleSuccessServerResponse",value:(d=Jc(a.a.mark((function e(t){var n,r,i,s,c,u,l,f,p,h,d,v,m,g,b,w,k,x,S,_,$,P;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.operation,r=t.response,!this._simulate_latency){e.next=4;break}return e.next=4,Object(o.w)(this._simulate_latency.latency);case 4:this.log("Online Sync Response",r.rawResponse),this.setLastSyncToken(r.lastSyncToken),this.setPaginationToken(r.paginationToken),this.opStatus.clearError(),this.opStatus.setDownloadStatus({downloaded:r.allProcessedPayloads.length}),i=[],s=!0,c=!1,u=void 0,e.prev=13,l=r.allProcessedPayloads[Symbol.iterator]();case 15:if(s=(f=l.next()).done){e.next=26;break}if(!(p=f.value).deleted&&p.fields().includes(ne.Content)){e.next=19;break}return e.abrupt("continue",23);case 19:return e.next=21,this.protocolService.payloadByDecryptingPayload({payload:p});case 21:h=e.sent,i.push(h);case 23:s=!0,e.next=15;break;case 26:e.next=32;break;case 28:e.prev=28,e.t0=e.catch(13),c=!0,u=e.t0;case 32:e.prev=32,e.prev=33,s||null==l.return||l.return();case 35:if(e.prev=35,!c){e.next=38;break}throw u;case 38:return e.finish(35);case 39:return e.finish(32);case 40:return d=this.modelManager.getMasterCollection(),v=new Rc({response:r,decryptedResponsePayloads:i,payloadsSavedOrSaving:n.payloadsSavedOrSaving,baseCollection:d}),e.next=44,v.collectionsByProcessingResponse();case 44:m=e.sent,g=!0,b=!1,w=void 0,e.prev=48,k=m[Symbol.iterator]();case 50:if(g=(x=k.next()).done){e.next=62;break}return S=x.value,e.next=54,this.modelManager.mapCollectionToLocalItems({collection:S});case 54:return $=Bi(S.source),_=$.fields().includes(ne.Content)?S.allPayloads:S.allPayloads.map((function(e){return d.findPayload(e.uuid).mergedWith(e)})),e.next=59,this.persistPayloads({decryptedPayloads:_});case 59:g=!0,e.next=50;break;case 62:e.next=68;break;case 64:e.prev=64,e.t1=e.catch(48),b=!0,w=e.t1;case 68:e.prev=68,e.prev=69,g||null==k.return||k.return();case 71:if(e.prev=71,!b){e.next=74;break}throw w;case 74:return e.finish(71);case 75:return e.finish(68);case 76:return e.next=78,this.notifyEvent(y.SingleSyncCompleted,r);case 78:if(!r.checkIntegrity){e.next=84;break}return e.next=81,this.computeDataIntegrityHash();case 81:return P=e.sent,e.next=84,this.state.setIntegrityHashes({clientHash:P,serverHash:r.integrityHash});case 84:case"end":return e.stop()}}),e,this,[[13,28,32,40],[33,,35,39],[48,64,68,76],[69,,71,75]])}))),function(e){return d.apply(this,arguments)})},{key:"handleNeverSyncedDeleted",value:(h=Jc(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.map((function(e){return e.payloadRepresentation({override:{dirty:!1}})})),e.next=3,this.modelManager.mapPayloadsToLocalItems({payloads:n});case 3:return e.next=5,this.persistPayloads({decryptedPayloads:n});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"persistPayloads",value:(p=Jc(a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.decryptedPayloads,0!==(r=void 0===n?[]:n).length){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,this.storageService.savePayloads(r);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"computeDataIntegrityHash",value:(l=Jc(a.a.mark((function e(){var t,n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=this.modelManager.nonDeletedItems.sort((function(e,t){return t.updated_at-e.updated_at})),n=t.map((function(e){return e.updatedAtTimestamp()})),r=n.join(","),e.abrupt("return",this.protocolService.crypto.sha256(r));case 7:return e.prev=7,e.t0=e.catch(0),console.error("Error computing data integrity hash",e.t0),e.abrupt("return",null);case 11:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(){return l.apply(this,arguments)})},{key:"deinit",value:(u=Jc(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zc(Xc(t.prototype),"deinit",this).call(this),this.state.reset(),this.opStatus.reset(),this.resolveQueue=[],this.spawnQueue=[],e.next=7,this.clearSyncPositionTokens();case 7:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"resolveOutOfSync",value:(s=Jc(a.a.mark((function e(){var t,n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new Ic({apiService:this.apiService,protocolService:this.protocolService,customEvent:"resolve-out-of-sync"}),e.next=3,t.run();case 3:return n=e.sent,r=new ui({baseCollection:this.modelManager.getMasterCollection(),applyCollection:new f({payloads:n,source:Ln.RemoteRetrieved})}),e.next=7,r.resultingCollection();case 7:return i=e.sent,e.next=10,this.modelManager.mapCollectionToLocalItems({collection:i});case 10:return e.next=12,this.persistPayloads({decryptedPayloads:i.payloads});case 12:return e.abrupt("return",this.sync({checkIntegrity:!0,source:iu.ResolveOutOfSync}));case 13:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"statelessDownloadAllItems",value:(i=Jc(a.a.mark((function e(){var t,n,r,i,o,s=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]?s[0]:{},n=t.contentType,r=t.customEvent,i=new Ic({apiService:this.apiService,protocolService:this.protocolService,contentType:n,customEvent:r}),e.next=4,i.run();case 4:return o=e.sent,e.abrupt("return",o.map((function(e){return Cn(e)})));case 6:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"ut_setDatabaseLoaded",value:function(e){this.databaseLoaded=e}},{key:"ut_beginLatencySimulator",value:function(e){this._simulate_latency={latency:e||1e3,enabled:!0}}},{key:"ut_endLatencySimulator",value:function(){this._simulate_latency=null}}])&&Qc(n.prototype,r),t}(qi);function ou(e){return(ou="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function su(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function cu(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){su(a,r,i,o,s,"next",e)}function s(e){su(a,r,i,o,s,"throw",e)}o(void 0)}))}}function uu(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function lu(e){return(lu=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function fu(e,t){return(fu=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var pu=function(e){function t(e){var n,r=e.storageService,i=e.keyManager,a=e.protocolService;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==ou(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,lu(t).call(this))).storageService=r,n.keyManager=i,n.protocolService=a,n}var n,r,i,o,s,c;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&fu(e,t)}(t,e),n=t,(r=[{key:"isPasscodeLocked",value:function(){return this.keyManager.rootKeyNeedsUnwrapping()}},{key:"getLaunchChallenges",value:(c=cu(a.a.mark((function e(){var t,n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.next=3,this.keyManager.hasPasscode();case 3:return e.sent&&t.push($.LocalPasscode),e.next=7,this.storageService.getValue(P.BiometricPrefs,No.Nonwrapped);case 7:return(n=e.sent)&&n.enabled&&t.push($.Biometric),e.abrupt("return",t);case 11:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"enableBiometrics",value:(s=cu(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.storageService.setValue(P.BiometricPrefs,{enabled:!0},No.Nonwrapped);case 2:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"validateChallengeResponse",value:(o=cu(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.challenge!==$.LocalPasscode){e.next=4;break}return e.abrupt("return",this.keyManager.validatePasscode(t.value));case 4:if(t.challenge!==$.AccountPassword){e.next=8;break}return e.abrupt("return",this.keyManager.validateAccountPassword(t.value));case 8:if(t.challenge!==$.Biometric){e.next=10;break}return e.abrupt("return",!0===t.value);case 10:throw"Cannot validate challenge type ".concat(t.challenge);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"handleChallengeResponse",value:(i=cu(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.challenge!==$.LocalPasscode){e.next=8;break}return e.next=3,this.keyManager.computeWrappingKey({passcode:t.value});case 3:return n=e.sent,e.next=6,this.keyManager.unwrapRootKey({wrappingKey:n});case 6:e.next=8;break;case 8:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})}])&&uu(n.prototype,r),t}(qi);function hu(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function du(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){hu(a,r,i,o,s,"next",e)}function s(e){hu(a,r,i,o,s,"throw",e)}o(void 0)}))}}function vu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yu(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var mu=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.environment,r=t.platform,i=t.namespace,a=t.host,o=t.deviceInterface,s=t.swapClasses,c=t.skipClasses,u=t.crypto;if(vu(this,e),!o)throw"Device Interface must be supplied.";if(!n)throw"Environment must be supplied when creating an application.";if(!r)throw"Platform must be supplied when creating an application.";this.environment=n,this.platform=r,this.namespace=i||"",this.host=a,this.deviceInterface=o,this.crypto=u,this.swapClasses=s,this.skipClasses=c,this.eventHandlers=[],this.services=[],this.streamObservers=[],this.serviceObservers=[],this.managedSubscribers=[],this.constructServices()}var t,n,r,i,s,u,l,f,p,h,d,v,b,w,k,x,S,_,$,P,O,C,E,A,I,j,D,M,T,R,L,N,F,U,K,V,B,H,z,W,q,G,Y,J,Q,Z,X,ee;return t=e,(n=[{key:"prepareForLaunch",value:(ee=du(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((n=t.callbacks).requiresChallengeResponses){e.next=3;break}throw"Application.launch callbacks are not properly configured.";case 3:return this.launchCallbacks=n,e.next=6,this.deviceInterface.openDatabase();case 6:return e.next=8,this.migrationService.initialize();case 8:return e.next=10,this.handleStage(0);case 10:return e.next=12,this.storageService.initializeFromDisk();case 12:return e.next=14,this.keyManager.initialize();case 14:return e.next=16,this.handleStage(.5);case 16:return this.started=!0,e.next=19,this.notifyEvent(g.Started);case 19:case"end":return e.stop()}}),e,this)}))),function(e){return ee.apply(this,arguments)})},{key:"launch",value:(X=du(a.a.mark((function e(){var t,n,r,i,o=this,s=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]?s[0]:{},n=t.awaitDatabaseLoad,e.next=3,this.handleLaunchAuthentication();case 3:return e.next=5,this.storageService.isStorageWrapped();case 5:if(!e.sent){e.next=8;break}return e.next=8,this.storageService.decryptStorage();case 8:return e.next=10,this.handleStage(.9);case 10:return e.next=12,this.sessionManager.initializeFromDisk();case 12:return this.historyManager.initializeFromDisk(),this.unlocked=!0,e.next=16,this.notifyEvent(g.Launched);case 16:return e.next=18,this.handleStage(1);case 18:return e.next=20,this.syncService.getDatabasePayloads();case 20:return r=e.sent,e.next=23,this.handleStage(1.1);case 23:if(i=this.syncService.loadDatabasePayloads(r).then(du(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!o.dealloced){e.next=2;break}throw"Application has been destroyed.";case 2:return e.next=4,o.handleStage(1.2);case 4:return o.beginAutoSyncTimer(),e.abrupt("return",o.syncService.sync({mode:ru.DownloadFirst}));case 6:case"end":return e.stop()}}),e)})))),!n){e.next=27;break}return e.next=27,i;case 27:case"end":return e.stop()}}),e,this)}))),function(){return X.apply(this,arguments)})},{key:"beginAutoSyncTimer",value:function(){var e=this;this.autoSyncInterval=this.deviceInterface.interval((function(){e.syncService.log("Syncing from autosync"),e.sync()}),3e4)}},{key:"handleLaunchAuthentication",value:(Z=du(a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.deviceAuthService.getLaunchChallenges();case 2:return t=e.sent,e.next=5,this.handleLaunchChallenge(t);case 5:case"end":return e.stop()}}),e,this)}))),function(){return Z.apply(this,arguments)})},{key:"handleLaunchChallenge",value:(Q=du(a.a.mark((function e(t){var n,r,i,s,c,u,l,f,p;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.slice();case 1:if(!(n.length>0)){e.next=43;break}return e.next=4,this.launchCallbacks.requiresChallengeResponses(n);case 4:r=e.sent,i=Array.isArray(r)?r:[r],s=!0,c=!1,u=void 0,e.prev=9,l=i[Symbol.iterator]();case 11:if(s=(f=l.next()).done){e.next=27;break}return p=f.value,e.next=15,this.deviceAuthService.validateChallengeResponse(p);case 15:if(!e.sent){e.next=22;break}return e.next=19,this.deviceAuthService.handleChallengeResponse(p);case 19:Object(o.u)(n,p.challenge),e.next=24;break;case 22:return e.next=24,this.launchCallbacks.handleChallengeFailures([p]);case 24:s=!0,e.next=11;break;case 27:e.next=33;break;case 29:e.prev=29,e.t0=e.catch(9),c=!0,u=e.t0;case 33:e.prev=33,e.prev=34,s||null==l.return||l.return();case 36:if(e.prev=36,!c){e.next=39;break}throw u;case 39:return e.finish(36);case 40:return e.finish(33);case 41:e.next=1;break;case 43:case"end":return e.stop()}}),e,this,[[9,29,33,41],[34,,36,40]])}))),function(e){return Q.apply(this,arguments)})},{key:"getMigrationChallengeResponder",value:function(){var e=this;return function(){var t=du(a.a.mark((function t(n){var r;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.launchCallbacks.requiresChallengeResponses([n]);case 2:return r=t.sent,t.abrupt("return",r[0]);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()}},{key:"handleStage",value:(J=du(a.a.mark((function e(t){var n,r,i,o,s,c;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=!0,r=!1,i=void 0,e.prev=3,o=this.services[Symbol.iterator]();case 5:if(n=(s=o.next()).done){e.next=12;break}return c=s.value,e.next=9,c.handleApplicationStage(t);case 9:n=!0,e.next=5;break;case 12:e.next=18;break;case 14:e.prev=14,e.t0=e.catch(3),r=!0,i=e.t0;case 18:e.prev=18,e.prev=19,n||null==o.return||o.return();case 21:if(e.prev=21,!r){e.next=24;break}throw i;case 24:return e.finish(21);case 25:return e.finish(18);case 26:case"end":return e.stop()}}),e,this,[[3,14,18,26],[19,,21,25]])}))),function(e){return J.apply(this,arguments)})},{key:"addEventObserver",value:function(e,t){var n=this,r={callback:e,singleEvent:t};return this.eventHandlers.push(r),function(){Object(o.u)(n.eventHandlers,r)}}},{key:"addSingleEventObserver",value:function(e,t){return this.addEventObserver((function(n){n===e&&t()}),e)}},{key:"notifyEvent",value:(Y=du(a.a.mark((function e(t,n){var r,i,o,s,c,u;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=!0,i=!1,o=void 0,e.prev=3,s=this.eventHandlers.slice()[Symbol.iterator]();case 5:if(r=(c=s.next()).done){e.next=18;break}if(!(u=c.value).singleEvent||u.singleEvent!==t){e.next=12;break}return e.next=10,u.callback(t,n||{});case 10:e.next=15;break;case 12:if(u.singleEvent){e.next=15;break}return e.next=15,u.callback(t,n||{});case 15:r=!0,e.next=5;break;case 18:e.next=24;break;case 20:e.prev=20,e.t0=e.catch(3),i=!0,o=e.t0;case 24:e.prev=24,e.prev=25,r||null==s.return||s.return();case 27:if(e.prev=27,!i){e.next=30;break}throw o;case 30:return e.finish(27);case 31:return e.finish(24);case 32:case"end":return e.stop()}}),e,this,[[3,20,24,32],[25,,27,31]])}))),function(e,t){return Y.apply(this,arguments)})},{key:"isDatabaseLoaded",value:function(){return this.syncService.isDatabaseLoaded()}},{key:"savePayload",value:(G=du(a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.payload,r=Ui({payload:n,override:{dirty:!0}}),e.next=4,this.modelManager.mapPayloadToLocalItem({payload:r});case 4:return e.next=6,this.syncService.sync();case 6:case"end":return e.stop()}}),e,this)}))),function(e){return G.apply(this,arguments)})},{key:"findItem",value:function(e){var t=e.uuid;return this.modelManager.findItem(t)}},{key:"findItems",value:function(e){var t=e.predicate;return this.modelManager.itemsMatchingPredicate(t)}},{key:"mergeItem",value:(q=du(a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.item,r=t.source,e.abrupt("return",this.modelManager.mapItem({item:n,source:r}));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return q.apply(this,arguments)})},{key:"createItem",value:(W=du(a.a.mark((function e(t){var n,r,i,o,s;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.contentType,r=t.content,i=t.add,o=t.needsSync,e.next=3,this.modelManager.createItem({contentType:n,content:r,add:i,needsSync:o});case 3:return s=e.sent,e.abrupt("return",s);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return W.apply(this,arguments)})},{key:"saveItem",value:(z=du(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.item,e.next=3,this.modelManager.setItemDirty(n,!0);case 3:return e.next=5,this.syncService.sync();case 5:case"end":return e.stop()}}),e,this)}))),function(e){return z.apply(this,arguments)})},{key:"saveItems",value:(H=du(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.items,e.next=3,this.modelManager.setItemsDirty(n);case 3:return e.next=5,this.syncService.sync();case 5:case"end":return e.stop()}}),e,this)}))),function(e){return H.apply(this,arguments)})},{key:"setItemNeedsSync",value:(B=du(a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.item,r=t.updateUserModifiedDate,e.abrupt("return",this.modelManager.setItemDirty(n,!0,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return B.apply(this,arguments)})},{key:"setItemsNeedsSync",value:(V=du(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.items,e.abrupt("return",this.modelManager.setItemsDirty(n));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return V.apply(this,arguments)})},{key:"deleteItem",value:(K=du(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.item,this.modelManager.setItemToBeDeleted(n),this.sync();case 3:case"end":return e.stop()}}),e,this)}))),function(e){return K.apply(this,arguments)})},{key:"deleteItemLocally",value:(U=du(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.item,this.modelManager.removeItemLocally(n);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return U.apply(this,arguments)})},{key:"emptyTrash",value:(F=du(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.modelManager.emptyTrash();case 2:return e.abrupt("return",this.sync());case 3:case"end":return e.stop()}}),e,this)}))),function(){return F.apply(this,arguments)})},{key:"getTrashedItems",value:function(){return this.modelManager.trashedItems()}},{key:"getItems",value:function(e){var t=e.contentType;return this.modelManager.getItems(t)}},{key:"getDisplayableItems",value:function(e){var t=e.contentType;return this.modelManager.validItemsForContentType(t)}},{key:"getNotesMatchingSmartTag",value:function(e){var t=e.smartTag;return this.modelManager.notesMatchingSmartTag(t)}},{key:"findTag",value:function(e){var t=e.title;return this.modelManager.findTagByTitle(t)}},{key:"findOrCreateTag",value:(N=du(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.title,e.abrupt("return",this.modelManager.findOrCreateTagByTitle(n));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return N.apply(this,arguments)})},{key:"getSmartTags",value:function(){return this.modelManager.getSmartTags()}},{key:"getNoteCount",value:function(){return this.modelManager.noteCount()}},{key:"streamItems",value:function(e){var t=this,n=e.contentType,r=e.stream,i=this.modelManager.addMappingObserver(n,(function(e,t,n,i,a){var o=e.map((function(e){return e.content_type}));r({items:e,contentTypes:o,source:i,sourceKey:a})}));return this.streamObservers.push(i),function(){Object(o.u)(t.streamObservers,i)}}},{key:"setHost",value:(L=du(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiService.setHost(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return L.apply(this,arguments)})},{key:"getHost",value:(R=du(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiService.getHost());case 1:case"end":return e.stop()}}),e,this)}))),function(){return R.apply(this,arguments)})},{key:"getUser",value:function(){if(!this.unlocked)throw"Attempting to access user before application unlocked";return this.sessionManager.getUser()}},{key:"getUserVersion",value:(T=du(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.protocolService.getUserVersion());case 1:case"end":return e.stop()}}),e,this)}))),function(){return T.apply(this,arguments)})},{key:"protocolUpgradeAvailable",value:(M=du(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.protocolService.upgradeAvailable());case 1:case"end":return e.stop()}}),e,this)}))),function(){return M.apply(this,arguments)})},{key:"noAccount",value:function(){var e=this.getUser();return Object(o.l)(e)}},{key:"importData",value:(D=du(a.a.mark((function e(t){var n,r,i,o,s,c,u;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.data,r=t.password,i=t.awaitSync,e.next=3,this.protocolService.payloadsByDecryptingBackupFile({data:n,password:r});case 3:return o=e.sent,s=o.filter((function(e){return!e.errorDecrypting})),e.next=7,this.modelManager.importPayloads(s);case 7:if(c=e.sent,u=this.sync(),!i){e.next=12;break}return e.next=12,u;case 12:return e.abrupt("return",{affectedItems:c,errorCount:o.length-s.length});case 13:case"end":return e.stop()}}),e,this)}))),function(e){return D.apply(this,arguments)})},{key:"createBackupFile",value:(j=du(a.a.mark((function e(){var t,n,r,i,o=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:{},n=t.subItems,r=t.intent,i=t.returnIfEmpty,e.abrupt("return",this.protocolService.createBackupFile({subItems:n,intent:r,returnIfEmpty:i}));case 2:case"end":return e.stop()}}),e,this)}))),function(){return j.apply(this,arguments)})},{key:"isEphemeralSession",value:function(){return this.storageService.isEphemeralSession()}},{key:"lockSyncing",value:function(){this.syncService.lockSyncing()}},{key:"unlockSyncing",value:function(){this.syncService.unlockSyncing()}},{key:"getSyncStatus",value:(I=du(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.syncService.status);case 1:case"end":return e.stop()}}),e,this)}))),function(){return I.apply(this,arguments)})},{key:"sync",value:(A=du(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.syncService.sync(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return A.apply(this,arguments)})},{key:"resolveOutOfSync",value:(E=du(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.syncService.resolveOutOfSync());case 1:case"end":return e.stop()}}),e,this)}))),function(){return E.apply(this,arguments)})},{key:"setValue",value:(C=du(a.a.mark((function e(t,n,r){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.storageService.setValue(t,n,r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return C.apply(this,arguments)})},{key:"getValue",value:(O=du(a.a.mark((function e(t,n){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.storageService.getValue(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return O.apply(this,arguments)})},{key:"removeValue",value:(P=du(a.a.mark((function e(t,n){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.storageService.removeValue(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return P.apply(this,arguments)})},{key:"clearDatabase",value:($=du(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.storageService.clearAllPayloads());case 1:case"end":return e.stop()}}),e,this)}))),function(){return $.apply(this,arguments)})},{key:"rewriteItemsKeys",value:(_=du(a.a.mark((function e(){var t,n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.itemsKeyManager.allItemsKeys,n=t.map((function(e){return e.payloadRepresentation()})),e.next=4,this.storageService.deletePayloads(n);case 4:return e.next=6,this.syncService.persistPayloads({decryptedPayloads:n});case 6:case"end":return e.stop()}}),e,this)}))),function(){return _.apply(this,arguments)})},{key:"restart",value:(S=du(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.deinit();case 2:return this.dealloced=!1,this.constructServices(),e.next=6,this.prepareForLaunch({callbacks:this.launchCallbacks});case 6:return e.next=8,this.launch({awaitDatabaseLoad:!0});case 8:case"end":return e.stop()}}),e,this)}))),function(){return S.apply(this,arguments)})},{key:"deinit",value:(x=du(a.a.mark((function e(){var t,n,r,i,o,s,c,u,l,f,p,h,d,v,y,m;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(clearInterval(this.autoSyncInterval),t=!0,n=!1,r=void 0,e.prev=4,i=this.serviceObservers[Symbol.iterator]();!(t=(o=i.next()).done);t=!0)(0,o.value)();e.next=12;break;case 8:e.prev=8,e.t0=e.catch(4),n=!0,r=e.t0;case 12:e.prev=12,e.prev=13,t||null==i.return||i.return();case 15:if(e.prev=15,!n){e.next=18;break}throw r;case 18:return e.finish(15);case 19:return e.finish(12);case 20:for(s=!0,c=!1,u=void 0,e.prev=23,l=this.managedSubscribers[Symbol.iterator]();!(s=(f=l.next()).done);s=!0)(0,f.value)();e.next=31;break;case 27:e.prev=27,e.t1=e.catch(23),c=!0,u=e.t1;case 31:e.prev=31,e.prev=32,s||null==l.return||l.return();case 34:if(e.prev=34,!c){e.next=37;break}throw u;case 37:return e.finish(34);case 38:return e.finish(31);case 39:p=!0,h=!1,d=void 0,e.prev=42,v=this.services[Symbol.iterator]();case 44:if(p=(y=v.next()).done){e.next=52;break}if(!(m=y.value).deinit){e.next=49;break}return e.next=49,m.deinit();case 49:p=!0,e.next=44;break;case 52:e.next=58;break;case 54:e.prev=54,e.t2=e.catch(42),h=!0,d=e.t2;case 58:e.prev=58,e.prev=59,p||null==v.return||v.return();case 61:if(e.prev=61,!h){e.next=64;break}throw d;case 64:return e.finish(61);case 65:return e.finish(58);case 66:this.streamObservers=[],this.clearServices(),this.dealloced=!0,this.started=!1;case 70:case"end":return e.stop()}}),e,this,[[4,8,12,20],[13,,15,19],[23,27,31,39],[32,,34,38],[42,54,58,66],[59,,61,65]])}))),function(){return x.apply(this,arguments)})},{key:"registerService",value:function(e){this.services.push(e)}},{key:"register",value:(k=du(a.a.mark((function e(t){var n,r,i,o,s;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.email,r=t.password,i=t.ephemeral,o=t.mergeLocal,this.lockSyncing(),e.next=4,this.sessionManager.register({email:n,password:r});case 4:if((s=e.sent).response.error){e.next=27;break}return e.next=8,this.keyManager.setNewRootKey({key:s.rootKey,keyParams:s.keyParams});case 8:return this.syncService.resetSyncState(),e.next=11,this.storageService.setPersistencePolicy(i?Ro.Ephemeral:Ro.Default);case 11:if(!o){e.next=16;break}return e.next=14,this.syncService.markAllItemsAsNeedingSync({alternateUuids:!0});case 14:e.next=19;break;case 16:return this.modelManager.removeAllItemsFromMemory(),e.next=19,this.clearDatabase();case 19:return e.next=21,this.notifyEvent(g.SignedIn);case 21:return this.unlockSyncing(),e.next=24,this.syncService.sync({mode:ru.DownloadFirst,timingStrategy:nu});case 24:this.protocolService.decryptErroredItems(),e.next=28;break;case 27:this.unlockSyncing();case 28:return e.abrupt("return",s.response);case 29:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"signIn",value:(w=du(a.a.mark((function e(t){var n,r,i,o,s,c,u,l,f;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.email,r=t.password,i=t.strict,o=t.ephemeral,s=t.mfaKeyPath,c=t.mfaCode,u=t.mergeLocal,l=void 0===u||u,this.lockSyncing(),e.next=4,this.sessionManager.signIn({email:n,password:r,strict:i,mfaKeyPath:s,mfaCode:c});case 4:if((f=e.sent).response.error){e.next=27;break}return e.next=8,this.keyManager.setNewRootKey({key:f.rootKey,keyParams:f.keyParams});case 8:return this.syncService.resetSyncState(),e.next=11,this.storageService.setPersistencePolicy(o?Ro.Ephemeral:Ro.Default);case 11:if(!l){e.next=16;break}return e.next=14,this.syncService.markAllItemsAsNeedingSync({alternateUuids:!0});case 14:e.next=19;break;case 16:return this.modelManager.removeAllItemsFromMemory(),e.next=19,this.clearDatabase();case 19:return e.next=21,this.notifyEvent(g.SignedIn);case 21:return this.unlockSyncing(),e.next=24,this.syncService.sync({mode:ru.DownloadFirst,checkIntegrity:!0,timingStrategy:nu});case 24:this.protocolService.decryptErroredItems(),e.next=28;break;case 27:this.unlockSyncing();case 28:return e.abrupt("return",f.response);case 29:case"end":return e.stop()}}),e,this)}))),function(e){return w.apply(this,arguments)})},{key:"changePassword",value:(b=du(a.a.mark((function e(t){var n,r,i,o,s;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.email,r=t.currentPassword,i=t.newPassword,e.next=3,this.keyManager.getRootKeyParams();case 3:return o=e.sent,this.lockSyncing(),e.next=7,this.sessionManager.changePassword({email:n,currentPassword:r,currentKeyParams:o,newPassword:i});case 7:if((s=e.sent).response.error){e.next=18;break}return e.next=11,this.keyManager.setNewRootKey({key:s.rootKey,keyParams:s.keyParams});case 11:return e.next=13,this.itemsKeyManager.createNewDefaultItemsKey();case 13:return this.unlockSyncing(),e.next=16,this.syncService.sync();case 16:e.next=19;break;case 18:this.unlockSyncing();case 19:return e.abrupt("return",s.response);case 20:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"signOut",value:(v=du(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sessionManager.signOut();case 2:return e.next=4,this.keyManager.clearLocalKeyState();case 4:return e.next=6,this.storageService.clearAllData();case 6:return e.next=8,this.notifyEvent(g.SignedOut);case 8:return e.next=10,this.restart();case 10:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{key:"validateAccountPassword",value:(d=du(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.password,e.abrupt("return",this.keyManager.validateAccountPassword(n));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"isStarted",value:function(){return this.started}},{key:"hasPasscode",value:function(){return this.keyManager.hasPasscode()}},{key:"isLocked",value:(h=du(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.started){e.next=2;break}return e.abrupt("return",!0);case 2:return e.abrupt("return",this.deviceAuthService.isPasscodeLocked());case 3:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"lock",value:(p=du(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.restart());case 1:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{key:"setPasscode",value:(f=du(a.a.mark((function e(t){var n,r,i,o;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.protocolService.crypto.generateUUID();case 2:return n=e.sent,e.next=5,this.protocolService.createRootKey({identifier:n,password:t});case 5:return r=e.sent,i=r.key,o=r.keyParams,e.next=10,this.keyManager.setNewRootKeyWrapper({wrappingKey:i,keyParams:o});case 10:return e.next=12,this.rewriteItemsKeys();case 12:return e.next=14,this.syncService.sync();case 14:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"removePasscode",value:(l=du(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.keyManager.removeRootKeyWrapper();case 2:return e.next=4,this.rewriteItemsKeys();case 4:case"end":return e.stop()}}),e,this)}))),function(){return l.apply(this,arguments)})},{key:"changePasscode",value:(u=du(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.removePasscode();case 2:return e.abrupt("return",this.setPasscode(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"setStorageEncryptionPolicy",value:(s=du(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.storageService.setEncryptionPolicy(t);case 2:return e.abrupt("return",this.syncService.repersistAllItems());case 3:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"generateUuid",value:(i=du(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.protocolService.crypto.generateUUID());case 1:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"changeDeviceInterface",value:(r=du(a.a.mark((function e(t){var n,r,i,o,s,c;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(this.deviceInterface=t,n=!0,r=!1,i=void 0,e.prev=4,o=this.services[Symbol.iterator]();!(n=(s=o.next()).done);n=!0)(c=s.value).deviceInterface&&(c.deviceInterface=t);e.next=12;break;case 8:e.prev=8,e.t0=e.catch(4),r=!0,i=e.t0;case 12:e.prev=12,e.prev=13,n||null==o.return||o.return();case 15:if(e.prev=15,!r){e.next=18;break}throw i;case 18:return e.finish(15);case 19:return e.finish(12);case 20:case"end":return e.stop()}}),e,this,[[4,8,12,20],[13,,15,19]])}))),function(e){return r.apply(this,arguments)})},{key:"constructServices",value:function(){this.createModelManager(),this.createProtocolService(this.modelManager),this.createMigrationService(),this.createAlertManager(),this.createHttpManager(),this.createStorageManager(),this.createApiService(),this.createSessionManager(),this.createSyncManager(),this.createItemsKeyManager(),this.createKeyManager(),this.protocolService.setKeyManager(this.keyManager),this.protocolService.setItemsKeyManager(this.itemsKeyManager),this.itemsKeyManager.setKeyManager(this.keyManager),this.createDeviceAuthService(),this.createSingletonManager(),this.createComponentManager(),this.createPrivilegesManager(),this.createHistoryManager(),this.createActionsManager()}},{key:"clearServices",value:function(){this.migrationService=null,this.alertService=null,this.httpService=null,this.modelManager=null,this.protocolService=null,this.storageService=null,this.apiService=null,this.sessionManager=null,this.syncService=null,this.keyManager=null,this.itemsKeyManager=null,this.deviceAuthService=null,this.singletonManager=null,this.componentManager=null,this.privilegesService=null,this.actionsManager=null,this.services=[]}},{key:"createMigrationService",value:function(){this.migrationService=new(this.getClass(hs))({application:this,challengeResponder:this.getMigrationChallengeResponder()}),this.services.push(this.migrationService)}},{key:"createAlertManager",value:function(){this.shouldSkipClass(ea)||(this.alertService=new(this.getClass(ea))({deviceInterface:this.deviceInterface}),this.services.push(this.alertService))}},{key:"createApiService",value:function(){this.apiService=new(this.getClass(xa))({storageService:this.storageService,httpService:this.httpService,host:this.host}),this.services.push(this.apiService)}},{key:"createComponentManager",value:function(){this.shouldSkipClass(Va)||(this.componentManager=new(this.getClass(Va))({modelManager:this.modelManager,syncService:this.syncService,alertService:this.alertService,timeout:this.deviceInterface.timeout,environment:this.environment,platform:this.platform}),this.services.push(this.componentManager))}},{key:"createHttpManager",value:function(){this.httpService=new(this.getClass(Qa)),this.services.push(this.httpService)}},{key:"createKeyManager",value:function(){var e=this;this.keyManager=new(this.getClass(dc))({modelManager:this.modelManager,storageService:this.storageService,protocolService:this.protocolService,itemsKeyManager:this.itemsKeyManager,deviceInterface:this.deviceInterface}),this.keyManager.onStatusChange(du(a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.notifyEvent(g.KeyStatusChanged);case 2:case"end":return t.stop()}}),t)})))),this.services.push(this.keyManager)}},{key:"createItemsKeyManager",value:function(){this.itemsKeyManager=new(this.getClass(xc))({modelManager:this.modelManager,syncService:this.syncService,protocolService:this.protocolService}),this.services.push(this.itemsKeyManager)}},{key:"createModelManager",value:function(){this.modelManager=new(this.getClass(co)),this.services.push(this.modelManager)}},{key:"createSingletonManager",value:function(){this.singletonManager=new(this.getClass(yo))({modelManager:this.modelManager,syncService:this.syncService}),this.services.push(this.singletonManager)}},{key:"createStorageManager",value:function(){this.storageService=new(this.getClass(Uo))({protocolService:this.protocolService,namespace:this.namespace,deviceInterface:this.deviceInterface}),this.services.push(this.storageService)}},{key:"createProtocolService",value:function(e){this.protocolService=new(this.getClass(xs))({modelManager:e,crypto:this.crypto}),this.services.push(this.protocolService)}},{key:"createSessionManager",value:function(){this.sessionManager=new(this.getClass(la))({storageService:this.storageService,alertService:this.alertService,protocolService:this.protocolService,apiService:this.apiService,timeout:this.deviceInterface.timeout}),this.services.push(this.sessionManager)}},{key:"createSyncManager",value:function(){var e=this;this.syncService=new(this.getClass(au))({modelManager:this.modelManager,storageService:this.storageService,sessionManager:this.sessionManager,protocolService:this.protocolService,apiService:this.apiService,interval:this.deviceInterface.interval});var t=this.syncService.addEventObserver(function(){var t=du(a.a.mark((function t(n){var r;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=n,!(r=(a={},m(a,y.FullSyncCompleted,g.CompletedSync),m(a,y.SyncError,g.FailedSync),m(a,y.SyncTakingTooLong,g.HighLatencySync),m(a,y.EnterOutOfSync,g.EnteredOutOfSync),m(a,y.ExitOutOfSync,g.ExitedOutOfSync),a)[i])){t.next=4;break}return t.next=4,e.notifyEvent(r);case 4:case"end":return t.stop()}var i,a}),t)})));return function(e){return t.apply(this,arguments)}}());this.serviceObservers.push(t),this.services.push(this.syncService)}},{key:"createDeviceAuthService",value:function(){this.deviceAuthService=new(this.getClass(pu))({storageService:this.storageService,protocolService:this.protocolService,keyManager:this.keyManager}),this.services.push(this.deviceAuthService)}},{key:"createPrivilegesManager",value:function(){this.privilegesService=new(this.getClass(nc))({storageService:this.storageService,keyManager:this.keyManager,modelManager:this.modelManager,syncService:this.syncService,sessionManager:this.sessionManager,singletonManager:this.singletonManager}),this.services.push(this.privilegesService)}},{key:"createHistoryManager",value:function(){this.historyManager=new(this.getClass(Bs))({storageService:this.storageService,modelManager:this.modelManager,contentTypes:[c.Note],timeout:this.deviceInterface.timeout}),this.services.push(this.historyManager)}},{key:"createActionsManager",value:function(){this.actionsManager=new(this.getClass(So))({alertService:this.alertService,deviceInterface:this.deviceInterface,httpService:this.httpService,modelManager:this.modelManager,protocolService:this.protocolService,syncService:this.syncService}),this.services.push(this.actionsManager)}},{key:"shouldSkipClass",value:function(e){return this.skipClasses&&this.skipClasses.includes(e)}},{key:"getClass",value:function(e){var t=this.swapClasses&&this.swapClasses.find((function(t){return t.swap===e}));return t?t.with:e}}])&&yu(t.prototype,n),e}();function gu(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function bu(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){gu(a,r,i,o,s,"next",e)}function s(e){gu(a,r,i,o,s,"throw",e)}o(void 0)}))}}function wu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ku(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var xu=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.namespace,r=t.timeout,i=t.interval;if(wu(this,e),!r||!i)throw"'timeout' and 'interval' are required to initialize device interface.";this.namespace=n,this.timeout=r||setTimeout.bind(Object(o.h)()),this.interval=i||setInterval.bind(Object(o.h)())}var t,n,r,i,s,c,u,l,f,p,h,d,v,y,m,g,b;return t=e,(n=[{key:"getRawStorageValue",value:(b=bu(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw"Must override DeviceInterface.getRawStorageValue";case 1:case"end":return e.stop()}}),e)}))),function(e){return b.apply(this,arguments)})},{key:"getJsonParsedStorageValue",value:(g=bu(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getRawStorageValue(t);case 2:return n=e.sent,e.abrupt("return",n?JSON.parse(n):n);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"getAllRawStorageKeyValues",value:(m=bu(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw"Must override DeviceInterface.getAllRawStorageKeyValues";case 1:case"end":return e.stop()}}),e)}))),function(){return m.apply(this,arguments)})},{key:"setRawStorageValue",value:(y=bu(a.a.mark((function e(t,n){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw"Must override DeviceInterface.setRawStorageValue";case 1:case"end":return e.stop()}}),e)}))),function(e,t){return y.apply(this,arguments)})},{key:"removeRawStorageValue",value:(v=bu(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw"Must override DeviceInterface.removeRawStorageValue";case 1:case"end":return e.stop()}}),e)}))),function(e){return v.apply(this,arguments)})},{key:"removeAllRawStorageValues",value:(d=bu(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw"Must override DeviceInterface.removeAllRawStorageValues";case 1:case"end":return e.stop()}}),e)}))),function(){return d.apply(this,arguments)})},{key:"openDatabase",value:(h=bu(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw"Must override DeviceInterface.openDatabase";case 1:case"end":return e.stop()}}),e)}))),function(){return h.apply(this,arguments)})},{key:"getAllRawDatabasePayloads",value:(p=bu(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw"Must override DeviceInterface.getAllRawDatabasePayloads";case 1:case"end":return e.stop()}}),e)}))),function(){return p.apply(this,arguments)})},{key:"saveRawDatabasePayload",value:(f=bu(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw"Must override DeviceInterface.saveRawDatabasePayload";case 1:case"end":return e.stop()}}),e)}))),function(e){return f.apply(this,arguments)})},{key:"saveRawDatabasePayloads",value:(l=bu(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw"Must override DeviceInterface.saveRawDatabasePayloads";case 1:case"end":return e.stop()}}),e)}))),function(e){return l.apply(this,arguments)})},{key:"removeRawDatabasePayloadWithId",value:(u=bu(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw"Must override DeviceInterface.removeRawDatabasePayloadWithId";case 1:case"end":return e.stop()}}),e)}))),function(e){return u.apply(this,arguments)})},{key:"removeAllRawDatabasePayloads",value:(c=bu(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw"Must override DeviceInterface.removeAllRawDatabasePayloads";case 1:case"end":return e.stop()}}),e)}))),function(){return c.apply(this,arguments)})},{key:"getKeychainValue",value:(s=bu(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw"Must override DeviceInterface.getKeychainValue";case 1:case"end":return e.stop()}}),e)}))),function(){return s.apply(this,arguments)})},{key:"setKeychainValue",value:(i=bu(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw"Must override DeviceInterface.setKeychainValue";case 1:case"end":return e.stop()}}),e)}))),function(e){return i.apply(this,arguments)})},{key:"clearKeychainValue",value:(r=bu(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw"Must override DeviceInterface.clearKeychainValue";case 1:case"end":return e.stop()}}),e)}))),function(){return r.apply(this,arguments)})}])&&ku(t.prototype,n),e}(),Su=function e(t){var n=t.challenge,r=t.value;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.challenge=n,this.value=r,Object.freeze(this)}}])},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t,n){var r=n(35),i=n(12);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?i(e):t}},function(e,t,n){var r=n(89);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},function(e,t,n){var r=n(112);function i(t,n,a){return"undefined"!=typeof Reflect&&Reflect.get?e.exports=i=Reflect.get:e.exports=i=function(e,t,n){var i=r(e,t);if(i){var a=Object.getOwnPropertyDescriptor(i,t);return a.get?a.get.call(n):a.value}},i(t,n,a||t)}e.exports=i},function(e,t,n){n(83),e.exports=angular},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty;function i(e,t){return Array.isArray(e)?function(e,t){for(var n,r="",a="",o=Array.isArray(t),s=0;s<e.length;s++)(n=i(e[s]))&&(o&&t[s]&&(n=c(n)),r=r+a+n,a=" ");return r}(e,t):e&&"object"==typeof e?function(e){var t="",n="";for(var i in e)i&&e[i]&&r.call(e,i)&&(t=t+n+i,n=" ");return t}(e):e||""}function a(e){if(!e)return"";if("object"==typeof e){var t="";for(var n in e)r.call(e,n)&&(t=t+n+":"+e[n]+";");return t}return e+""}function o(e,t,n,r){if(!1===t||null==t||!t&&("class"===e||"style"===e))return"";if(!0===t)return" "+(r?e:e+'="'+e+'"');var i=typeof t;return"object"!==i&&"function"!==i||"function"!=typeof t.toJSON||(t=t.toJSON()),"string"==typeof t||(t=JSON.stringify(t),n||-1===t.indexOf('"'))?(n&&(t=c(t))," "+e+'="'+t+'"'):" "+e+"='"+t.replace(/'/g,"&#39;")+"'"}t.merge=function e(t,n){if(1===arguments.length){for(var r=t[0],i=1;i<t.length;i++)r=e(r,t[i]);return r}for(var o in n)if("class"===o){var s=t[o]||[];t[o]=(Array.isArray(s)?s:[s]).concat(n[o]||[])}else if("style"===o){s=(s=a(t[o]))&&";"!==s[s.length-1]?s+";":s;var c=a(n[o]);c=c&&";"!==c[c.length-1]?c+";":c,t[o]=s+c}else t[o]=n[o];return t},t.classes=i,t.style=a,t.attr=o,t.attrs=function(e,t){var n="";for(var s in e)if(r.call(e,s)){var c=e[s];if("class"===s){c=i(c),n=o(s,c,!1,t)+n;continue}"style"===s&&(c=a(c)),n+=o(s,c,!1,t)}return n};var s=/["&<>]/;function c(e){var t=""+e,n=s.exec(t);if(!n)return e;var r,i,a,o="";for(r=n.index,i=0;r<t.length;r++){switch(t.charCodeAt(r)){case 34:a="&quot;";break;case 38:a="&amp;";break;case 60:a="&lt;";break;case 62:a="&gt;";break;default:continue}i!==r&&(o+=t.substring(i,r)),i=r+1,o+=a}return i!==r?o+t.substring(i,r):o}t.escape=c,t.rethrow=function e(t,r,i,a){if(!(t instanceof Error))throw t;if(!("undefined"==typeof window&&r||a))throw t.message+=" on line "+i,t;try{a=a||n(189).readFileSync(r,"utf8")}catch(n){e(t,null,i)}var o=3,s=a.split("\n"),c=Math.max(i-o,0),u=Math.min(s.length,i+o);o=s.slice(c,u).map((function(e,t){var n=t+c+1;return(n==i?" > ":" ")+n+"| "+e})).join("\n");throw t.path=r,t.message=(r||"Pug")+":"+i+"\n"+o+"\n\n"+t.message,t}},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,n){var r=n(38),i="object"==typeof self&&self&&self.Object===Object&&self,a=r||i||Function("return this")();e.exports=a},function(e,t,n){(function(e,r){var i;
/**
* @license
* Lodash <https://lodash.com/>
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/(function(){var a="Expected a function",o="__lodash_placeholder__",s=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],c="[object Arguments]",u="[object Array]",l="[object Boolean]",f="[object Date]",p="[object Error]",h="[object Function]",d="[object GeneratorFunction]",v="[object Map]",y="[object Number]",m="[object Object]",g="[object RegExp]",b="[object Set]",w="[object String]",k="[object Symbol]",x="[object WeakMap]",S="[object ArrayBuffer]",_="[object DataView]",$="[object Float32Array]",P="[object Float64Array]",O="[object Int8Array]",C="[object Int16Array]",E="[object Int32Array]",A="[object Uint8Array]",I="[object Uint16Array]",j="[object Uint32Array]",D=/\b__p \+= '';/g,M=/\b(__p \+=) '' \+/g,T=/(__e\(.*?\)|\b__t\)) \+\n'';/g,R=/&(?:amp|lt|gt|quot|#39);/g,L=/[&<>"']/g,N=RegExp(R.source),F=RegExp(L.source),U=/<%-([\s\S]+?)%>/g,K=/<%([\s\S]+?)%>/g,V=/<%=([\s\S]+?)%>/g,B=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,H=/^\w*$/,z=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,W=/[\\^$.*+?()[\]{}|]/g,q=RegExp(W.source),G=/^\s+|\s+$/g,Y=/^\s+/,J=/\s+$/,Q=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Z=/\{\n\/\* \[wrapped with (.+)\] \*/,X=/,? & /,ee=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,te=/\\(\\)?/g,ne=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,re=/\w*$/,ie=/^[-+]0x[0-9a-f]+$/i,ae=/^0b[01]+$/i,oe=/^\[object .+?Constructor\]$/,se=/^0o[0-7]+$/i,ce=/^(?:0|[1-9]\d*)$/,ue=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,le=/($^)/,fe=/['\n\r\u2028\u2029\\]/g,pe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",he="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",de="[\\ud800-\\udfff]",ve="["+he+"]",ye="["+pe+"]",me="\\d+",ge="[\\u2700-\\u27bf]",be="[a-z\\xdf-\\xf6\\xf8-\\xff]",we="[^\\ud800-\\udfff"+he+me+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",ke="\\ud83c[\\udffb-\\udfff]",xe="[^\\ud800-\\udfff]",Se="(?:\\ud83c[\\udde6-\\uddff]){2}",_e="[\\ud800-\\udbff][\\udc00-\\udfff]",$e="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Pe="(?:"+be+"|"+we+")",Oe="(?:"+$e+"|"+we+")",Ce="(?:"+ye+"|"+ke+")"+"?",Ee="[\\ufe0e\\ufe0f]?"+Ce+("(?:\\u200d(?:"+[xe,Se,_e].join("|")+")[\\ufe0e\\ufe0f]?"+Ce+")*"),Ae="(?:"+[ge,Se,_e].join("|")+")"+Ee,Ie="(?:"+[xe+ye+"?",ye,Se,_e,de].join("|")+")",je=RegExp("[']","g"),De=RegExp(ye,"g"),Me=RegExp(ke+"(?="+ke+")|"+Ie+Ee,"g"),Te=RegExp([$e+"?"+be+"+(?:['](?:d|ll|m|re|s|t|ve))?(?="+[ve,$e,"$"].join("|")+")",Oe+"+(?:['](?:D|LL|M|RE|S|T|VE))?(?="+[ve,$e+Pe,"$"].join("|")+")",$e+"?"+Pe+"+(?:['](?:d|ll|m|re|s|t|ve))?",$e+"+(?:['](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",me,Ae].join("|"),"g"),Re=RegExp("[\\u200d\\ud800-\\udfff"+pe+"\\ufe0e\\ufe0f]"),Le=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Ne=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Fe=-1,Ue={};Ue[$]=Ue[P]=Ue[O]=Ue[C]=Ue[E]=Ue[A]=Ue["[object Uint8ClampedArray]"]=Ue[I]=Ue[j]=!0,Ue[c]=Ue[u]=Ue[S]=Ue[l]=Ue[_]=Ue[f]=Ue[p]=Ue[h]=Ue[v]=Ue[y]=Ue[m]=Ue[g]=Ue[b]=Ue[w]=Ue[x]=!1;var Ke={};Ke[c]=Ke[u]=Ke[S]=Ke[_]=Ke[l]=Ke[f]=Ke[$]=Ke[P]=Ke[O]=Ke[C]=Ke[E]=Ke[v]=Ke[y]=Ke[m]=Ke[g]=Ke[b]=Ke[w]=Ke[k]=Ke[A]=Ke["[object Uint8ClampedArray]"]=Ke[I]=Ke[j]=!0,Ke[p]=Ke[h]=Ke[x]=!1;var Ve={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Be=parseFloat,He=parseInt,ze="object"==typeof e&&e&&e.Object===Object&&e,We="object"==typeof self&&self&&self.Object===Object&&self,qe=ze||We||Function("return this")(),Ge=t&&!t.nodeType&&t,Ye=Ge&&"object"==typeof r&&r&&!r.nodeType&&r,Je=Ye&&Ye.exports===Ge,Qe=Je&&ze.process,Ze=function(){try{var e=Ye&&Ye.require&&Ye.require("util").types;return e||Qe&&Qe.binding&&Qe.binding("util")}catch(e){}}(),Xe=Ze&&Ze.isArrayBuffer,et=Ze&&Ze.isDate,tt=Ze&&Ze.isMap,nt=Ze&&Ze.isRegExp,rt=Ze&&Ze.isSet,it=Ze&&Ze.isTypedArray;function at(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function ot(e,t,n,r){for(var i=-1,a=null==e?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}function st(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function ct(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function ut(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function lt(e,t){for(var n=-1,r=null==e?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function ft(e,t){return!!(null==e?0:e.length)&&kt(e,t,0)>-1}function pt(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function ht(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function dt(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function vt(e,t,n,r){var i=-1,a=null==e?0:e.length;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function yt(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function mt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var gt=$t("length");function bt(e,t,n){var r;return n(e,(function(e,n,i){if(t(e,n,i))return r=n,!1})),r}function wt(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function kt(e,t,n){return t==t?function(e,t,n){var r=n-1,i=e.length;for(;++r<i;)if(e[r]===t)return r;return-1}(e,t,n):wt(e,St,n)}function xt(e,t,n,r){for(var i=n-1,a=e.length;++i<a;)if(r(e[i],t))return i;return-1}function St(e){return e!=e}function _t(e,t){var n=null==e?0:e.length;return n?Ct(e,t)/n:NaN}function $t(e){return function(t){return null==t?void 0:t[e]}}function Pt(e){return function(t){return null==e?void 0:e[t]}}function Ot(e,t,n,r,i){return i(e,(function(e,i,a){n=r?(r=!1,e):t(n,e,i,a)})),n}function Ct(e,t){for(var n,r=-1,i=e.length;++r<i;){var a=t(e[r]);void 0!==a&&(n=void 0===n?a:n+a)}return n}function Et(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function At(e){return function(t){return e(t)}}function It(e,t){return ht(t,(function(t){return e[t]}))}function jt(e,t){return e.has(t)}function Dt(e,t){for(var n=-1,r=e.length;++n<r&&kt(t,e[n],0)>-1;);return n}function Mt(e,t){for(var n=e.length;n--&&kt(t,e[n],0)>-1;);return n}function Tt(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var Rt=Pt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Lt=Pt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function Nt(e){return"\\"+Ve[e]}function Ft(e){return Re.test(e)}function Ut(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function Kt(e,t){return function(n){return e(t(n))}}function Vt(e,t){for(var n=-1,r=e.length,i=0,a=[];++n<r;){var s=e[n];s!==t&&s!==o||(e[n]=o,a[i++]=n)}return a}function Bt(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function Ht(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}function zt(e){return Ft(e)?function(e){var t=Me.lastIndex=0;for(;Me.test(e);)++t;return t}(e):gt(e)}function Wt(e){return Ft(e)?function(e){return e.match(Me)||[]}(e):function(e){return e.split("")}(e)}var qt=Pt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var Gt=function e(t){var n,r=(t=null==t?qe:Gt.defaults(qe.Object(),t,Gt.pick(qe,Ne))).Array,i=t.Date,pe=t.Error,he=t.Function,de=t.Math,ve=t.Object,ye=t.RegExp,me=t.String,ge=t.TypeError,be=r.prototype,we=he.prototype,ke=ve.prototype,xe=t["__core-js_shared__"],Se=we.toString,_e=ke.hasOwnProperty,$e=0,Pe=(n=/[^.]+$/.exec(xe&&xe.keys&&xe.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Oe=ke.toString,Ce=Se.call(ve),Ee=qe._,Ae=ye("^"+Se.call(_e).replace(W,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ie=Je?t.Buffer:void 0,Me=t.Symbol,Re=t.Uint8Array,Ve=Ie?Ie.allocUnsafe:void 0,ze=Kt(ve.getPrototypeOf,ve),We=ve.create,Ge=ke.propertyIsEnumerable,Ye=be.splice,Qe=Me?Me.isConcatSpreadable:void 0,Ze=Me?Me.iterator:void 0,gt=Me?Me.toStringTag:void 0,Pt=function(){try{var e=Xi(ve,"defineProperty");return e({},"",{}),e}catch(e){}}(),Yt=t.clearTimeout!==qe.clearTimeout&&t.clearTimeout,Jt=i&&i.now!==qe.Date.now&&i.now,Qt=t.setTimeout!==qe.setTimeout&&t.setTimeout,Zt=de.ceil,Xt=de.floor,en=ve.getOwnPropertySymbols,tn=Ie?Ie.isBuffer:void 0,nn=t.isFinite,rn=be.join,an=Kt(ve.keys,ve),on=de.max,sn=de.min,cn=i.now,un=t.parseInt,ln=de.random,fn=be.reverse,pn=Xi(t,"DataView"),hn=Xi(t,"Map"),dn=Xi(t,"Promise"),vn=Xi(t,"Set"),yn=Xi(t,"WeakMap"),mn=Xi(ve,"create"),gn=yn&&new yn,bn={},wn=Pa(pn),kn=Pa(hn),xn=Pa(dn),Sn=Pa(vn),_n=Pa(yn),$n=Me?Me.prototype:void 0,Pn=$n?$n.valueOf:void 0,On=$n?$n.toString:void 0;function Cn(e){if(Ho(e)&&!Do(e)&&!(e instanceof jn)){if(e instanceof In)return e;if(_e.call(e,"__wrapped__"))return Oa(e)}return new In(e)}var En=function(){function e(){}return function(t){if(!Bo(t))return{};if(We)return We(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function An(){}function In(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function jn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Dn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Mn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Tn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Rn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Tn;++t<n;)this.add(e[t])}function Ln(e){var t=this.__data__=new Mn(e);this.size=t.size}function Nn(e,t){var n=Do(e),r=!n&&jo(e),i=!n&&!r&&Lo(e),a=!n&&!r&&!i&&Zo(e),o=n||r||i||a,s=o?Et(e.length,me):[],c=s.length;for(var u in e)!t&&!_e.call(e,u)||o&&("length"==u||i&&("offset"==u||"parent"==u)||a&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||oa(u,c))||s.push(u);return s}function Fn(e){var t=e.length;return t?e[Rr(0,t-1)]:void 0}function Un(e,t){return Sa(mi(e),Yn(t,0,e.length))}function Kn(e){return Sa(mi(e))}function Vn(e,t,n){(void 0===n||Eo(e[t],n))&&(void 0!==n||t in e)||qn(e,t,n)}function Bn(e,t,n){var r=e[t];_e.call(e,t)&&Eo(r,n)&&(void 0!==n||t in e)||qn(e,t,n)}function Hn(e,t){for(var n=e.length;n--;)if(Eo(e[n][0],t))return n;return-1}function zn(e,t,n,r){return er(e,(function(e,i,a){t(r,e,n(e),a)})),r}function Wn(e,t){return e&&gi(t,ws(t),e)}function qn(e,t,n){"__proto__"==t&&Pt?Pt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Gn(e,t){for(var n=-1,i=t.length,a=r(i),o=null==e;++n<i;)a[n]=o?void 0:vs(e,t[n]);return a}function Yn(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function Jn(e,t,n,r,i,a){var o,s=1&t,u=2&t,p=4&t;if(n&&(o=i?n(e,r,i,a):n(e)),void 0!==o)return o;if(!Bo(e))return e;var x=Do(e);if(x){if(o=function(e){var t=e.length,n=new e.constructor(t);t&&"string"==typeof e[0]&&_e.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!s)return mi(e,o)}else{var D=na(e),M=D==h||D==d;if(Lo(e))return fi(e,s);if(D==m||D==c||M&&!i){if(o=u||M?{}:ia(e),!s)return u?function(e,t){return gi(e,ta(e),t)}(e,function(e,t){return e&&gi(t,ks(t),e)}(o,e)):function(e,t){return gi(e,ea(e),t)}(e,Wn(o,e))}else{if(!Ke[D])return i?e:{};o=function(e,t,n){var r=e.constructor;switch(t){case S:return pi(e);case l:case f:return new r(+e);case _:return function(e,t){var n=t?pi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case $:case P:case O:case C:case E:case A:case"[object Uint8ClampedArray]":case I:case j:return hi(e,n);case v:return new r;case y:case w:return new r(e);case g:return function(e){var t=new e.constructor(e.source,re.exec(e));return t.lastIndex=e.lastIndex,t}(e);case b:return new r;case k:return i=e,Pn?ve(Pn.call(i)):{}}var i}(e,D,s)}}a||(a=new Ln);var T=a.get(e);if(T)return T;a.set(e,o),Yo(e)?e.forEach((function(r){o.add(Jn(r,t,n,r,e,a))})):zo(e)&&e.forEach((function(r,i){o.set(i,Jn(r,t,n,i,e,a))}));var R=x?void 0:(p?u?Wi:zi:u?ks:ws)(e);return st(R||e,(function(r,i){R&&(r=e[i=r]),Bn(o,i,Jn(r,t,n,i,e,a))})),o}function Qn(e,t,n){var r=n.length;if(null==e)return!r;for(e=ve(e);r--;){var i=n[r],a=t[i],o=e[i];if(void 0===o&&!(i in e)||!a(o))return!1}return!0}function Zn(e,t,n){if("function"!=typeof e)throw new ge(a);return ba((function(){e.apply(void 0,n)}),t)}function Xn(e,t,n,r){var i=-1,a=ft,o=!0,s=e.length,c=[],u=t.length;if(!s)return c;n&&(t=ht(t,At(n))),r?(a=pt,o=!1):t.length>=200&&(a=jt,o=!1,t=new Rn(t));e:for(;++i<s;){var l=e[i],f=null==n?l:n(l);if(l=r||0!==l?l:0,o&&f==f){for(var p=u;p--;)if(t[p]===f)continue e;c.push(l)}else a(t,f,r)||c.push(l)}return c}Cn.templateSettings={escape:U,evaluate:K,interpolate:V,variable:"",imports:{_:Cn}},Cn.prototype=An.prototype,Cn.prototype.constructor=Cn,In.prototype=En(An.prototype),In.prototype.constructor=In,jn.prototype=En(An.prototype),jn.prototype.constructor=jn,Dn.prototype.clear=function(){this.__data__=mn?mn(null):{},this.size=0},Dn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Dn.prototype.get=function(e){var t=this.__data__;if(mn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return _e.call(t,e)?t[e]:void 0},Dn.prototype.has=function(e){var t=this.__data__;return mn?void 0!==t[e]:_e.call(t,e)},Dn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=mn&&void 0===t?"__lodash_hash_undefined__":t,this},Mn.prototype.clear=function(){this.__data__=[],this.size=0},Mn.prototype.delete=function(e){var t=this.__data__,n=Hn(t,e);return!(n<0)&&(n==t.length-1?t.pop():Ye.call(t,n,1),--this.size,!0)},Mn.prototype.get=function(e){var t=this.__data__,n=Hn(t,e);return n<0?void 0:t[n][1]},Mn.prototype.has=function(e){return Hn(this.__data__,e)>-1},Mn.prototype.set=function(e,t){var n=this.__data__,r=Hn(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Tn.prototype.clear=function(){this.size=0,this.__data__={hash:new Dn,map:new(hn||Mn),string:new Dn}},Tn.prototype.delete=function(e){var t=Qi(this,e).delete(e);return this.size-=t?1:0,t},Tn.prototype.get=function(e){return Qi(this,e).get(e)},Tn.prototype.has=function(e){return Qi(this,e).has(e)},Tn.prototype.set=function(e,t){var n=Qi(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Rn.prototype.add=Rn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Rn.prototype.has=function(e){return this.__data__.has(e)},Ln.prototype.clear=function(){this.__data__=new Mn,this.size=0},Ln.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Ln.prototype.get=function(e){return this.__data__.get(e)},Ln.prototype.has=function(e){return this.__data__.has(e)},Ln.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Mn){var r=n.__data__;if(!hn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Tn(r)}return n.set(e,t),this.size=n.size,this};var er=ki(cr),tr=ki(ur,!0);function nr(e,t){var n=!0;return er(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function rr(e,t,n){for(var r=-1,i=e.length;++r<i;){var a=e[r],o=t(a);if(null!=o&&(void 0===s?o==o&&!Qo(o):n(o,s)))var s=o,c=a}return c}function ir(e,t){var n=[];return er(e,(function(e,r,i){t(e,r,i)&&n.push(e)})),n}function ar(e,t,n,r,i){var a=-1,o=e.length;for(n||(n=aa),i||(i=[]);++a<o;){var s=e[a];t>0&&n(s)?t>1?ar(s,t-1,n,r,i):dt(i,s):r||(i[i.length]=s)}return i}var or=xi(),sr=xi(!0);function cr(e,t){return e&&or(e,t,ws)}function ur(e,t){return e&&sr(e,t,ws)}function lr(e,t){return lt(t,(function(t){return Uo(e[t])}))}function fr(e,t){for(var n=0,r=(t=si(t,e)).length;null!=e&&n<r;)e=e[$a(t[n++])];return n&&n==r?e:void 0}function pr(e,t,n){var r=t(e);return Do(e)?r:dt(r,n(e))}function hr(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":gt&&gt in ve(e)?function(e){var t=_e.call(e,gt),n=e[gt];try{e[gt]=void 0;var r=!0}catch(e){}var i=Oe.call(e);r&&(t?e[gt]=n:delete e[gt]);return i}(e):function(e){return Oe.call(e)}(e)}function dr(e,t){return e>t}function vr(e,t){return null!=e&&_e.call(e,t)}function yr(e,t){return null!=e&&t in ve(e)}function mr(e,t,n){for(var i=n?pt:ft,a=e[0].length,o=e.length,s=o,c=r(o),u=1/0,l=[];s--;){var f=e[s];s&&t&&(f=ht(f,At(t))),u=sn(f.length,u),c[s]=!n&&(t||a>=120&&f.length>=120)?new Rn(s&&f):void 0}f=e[0];var p=-1,h=c[0];e:for(;++p<a&&l.length<u;){var d=f[p],v=t?t(d):d;if(d=n||0!==d?d:0,!(h?jt(h,v):i(l,v,n))){for(s=o;--s;){var y=c[s];if(!(y?jt(y,v):i(e[s],v,n)))continue e}h&&h.push(v),l.push(d)}}return l}function gr(e,t,n){var r=null==(e=va(e,t=si(t,e)))?e:e[$a(Na(t))];return null==r?void 0:at(r,e,n)}function br(e){return Ho(e)&&hr(e)==c}function wr(e,t,n,r,i){return e===t||(null==e||null==t||!Ho(e)&&!Ho(t)?e!=e&&t!=t:function(e,t,n,r,i,a){var o=Do(e),s=Do(t),h=o?u:na(e),d=s?u:na(t),x=(h=h==c?m:h)==m,$=(d=d==c?m:d)==m,P=h==d;if(P&&Lo(e)){if(!Lo(t))return!1;o=!0,x=!1}if(P&&!x)return a||(a=new Ln),o||Zo(e)?Bi(e,t,n,r,i,a):function(e,t,n,r,i,a,o){switch(n){case _:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case S:return!(e.byteLength!=t.byteLength||!a(new Re(e),new Re(t)));case l:case f:case y:return Eo(+e,+t);case p:return e.name==t.name&&e.message==t.message;case g:case w:return e==t+"";case v:var s=Ut;case b:var c=1&r;if(s||(s=Bt),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;r|=2,o.set(e,t);var h=Bi(s(e),s(t),r,i,a,o);return o.delete(e),h;case k:if(Pn)return Pn.call(e)==Pn.call(t)}return!1}(e,t,h,n,r,i,a);if(!(1&n)){var O=x&&_e.call(e,"__wrapped__"),C=$&&_e.call(t,"__wrapped__");if(O||C){var E=O?e.value():e,A=C?t.value():t;return a||(a=new Ln),i(E,A,n,r,a)}}if(!P)return!1;return a||(a=new Ln),function(e,t,n,r,i,a){var o=1&n,s=zi(e),c=s.length,u=zi(t).length;if(c!=u&&!o)return!1;var l=c;for(;l--;){var f=s[l];if(!(o?f in t:_e.call(t,f)))return!1}var p=a.get(e);if(p&&a.get(t))return p==t;var h=!0;a.set(e,t),a.set(t,e);var d=o;for(;++l<c;){f=s[l];var v=e[f],y=t[f];if(r)var m=o?r(y,v,f,t,e,a):r(v,y,f,e,t,a);if(!(void 0===m?v===y||i(v,y,n,r,a):m)){h=!1;break}d||(d="constructor"==f)}if(h&&!d){var g=e.constructor,b=t.constructor;g!=b&&"constructor"in e&&"constructor"in t&&!("function"==typeof g&&g instanceof g&&"function"==typeof b&&b instanceof b)&&(h=!1)}return a.delete(e),a.delete(t),h}(e,t,n,r,i,a)}(e,t,n,r,wr,i))}function kr(e,t,n,r){var i=n.length,a=i,o=!r;if(null==e)return!a;for(e=ve(e);i--;){var s=n[i];if(o&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<a;){var c=(s=n[i])[0],u=e[c],l=s[1];if(o&&s[2]){if(void 0===u&&!(c in e))return!1}else{var f=new Ln;if(r)var p=r(u,l,c,e,t,f);if(!(void 0===p?wr(l,u,3,r,f):p))return!1}}return!0}function xr(e){return!(!Bo(e)||(t=e,Pe&&Pe in t))&&(Uo(e)?Ae:oe).test(Pa(e));var t}function Sr(e){return"function"==typeof e?e:null==e?Ws:"object"==typeof e?Do(e)?Er(e[0],e[1]):Cr(e):tc(e)}function _r(e){if(!fa(e))return an(e);var t=[];for(var n in ve(e))_e.call(e,n)&&"constructor"!=n&&t.push(n);return t}function $r(e){if(!Bo(e))return function(e){var t=[];if(null!=e)for(var n in ve(e))t.push(n);return t}(e);var t=fa(e),n=[];for(var r in e)("constructor"!=r||!t&&_e.call(e,r))&&n.push(r);return n}function Pr(e,t){return e<t}function Or(e,t){var n=-1,i=To(e)?r(e.length):[];return er(e,(function(e,r,a){i[++n]=t(e,r,a)})),i}function Cr(e){var t=Zi(e);return 1==t.length&&t[0][2]?ha(t[0][0],t[0][1]):function(n){return n===e||kr(n,e,t)}}function Er(e,t){return ca(e)&&pa(t)?ha($a(e),t):function(n){var r=vs(n,e);return void 0===r&&r===t?ys(n,e):wr(t,r,3)}}function Ar(e,t,n,r,i){e!==t&&or(t,(function(a,o){if(i||(i=new Ln),Bo(a))!function(e,t,n,r,i,a,o){var s=ma(e,n),c=ma(t,n),u=o.get(c);if(u)return void Vn(e,n,u);var l=a?a(s,c,n+"",e,t,o):void 0,f=void 0===l;if(f){var p=Do(c),h=!p&&Lo(c),d=!p&&!h&&Zo(c);l=c,p||h||d?Do(s)?l=s:Ro(s)?l=mi(s):h?(f=!1,l=fi(c,!0)):d?(f=!1,l=hi(c,!0)):l=[]:qo(c)||jo(c)?(l=s,jo(s)?l=os(s):Bo(s)&&!Uo(s)||(l=ia(c))):f=!1}f&&(o.set(c,l),i(l,c,r,a,o),o.delete(c));Vn(e,n,l)}(e,t,o,n,Ar,r,i);else{var s=r?r(ma(e,o),a,o+"",e,t,i):void 0;void 0===s&&(s=a),Vn(e,o,s)}}),ks)}function Ir(e,t){var n=e.length;if(n)return oa(t+=t<0?n:0,n)?e[t]:void 0}function jr(e,t,n){var r=-1;return t=ht(t.length?t:[Ws],At(Ji())),function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(Or(e,(function(e,n,i){return{criteria:ht(t,(function(t){return t(e)})),index:++r,value:e}})),(function(e,t){return function(e,t,n){var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;for(;++r<o;){var c=di(i[r],a[r]);if(c){if(r>=s)return c;var u=n[r];return c*("desc"==u?-1:1)}}return e.index-t.index}(e,t,n)}))}function Dr(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=fr(e,o);n(s,o)&&Kr(a,si(o,e),s)}return a}function Mr(e,t,n,r){var i=r?xt:kt,a=-1,o=t.length,s=e;for(e===t&&(t=mi(t)),n&&(s=ht(e,At(n)));++a<o;)for(var c=0,u=t[a],l=n?n(u):u;(c=i(s,l,c,r))>-1;)s!==e&&Ye.call(s,c,1),Ye.call(e,c,1);return e}function Tr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==a){var a=i;oa(i)?Ye.call(e,i,1):Xr(e,i)}}return e}function Rr(e,t){return e+Xt(ln()*(t-e+1))}function Lr(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=Xt(t/2))&&(e+=e)}while(t);return n}function Nr(e,t){return wa(da(e,t,Ws),e+"")}function Fr(e){return Fn(Es(e))}function Ur(e,t){var n=Es(e);return Sa(n,Yn(t,0,n.length))}function Kr(e,t,n,r){if(!Bo(e))return e;for(var i=-1,a=(t=si(t,e)).length,o=a-1,s=e;null!=s&&++i<a;){var c=$a(t[i]),u=n;if(i!=o){var l=s[c];void 0===(u=r?r(l,c,s):void 0)&&(u=Bo(l)?l:oa(t[i+1])?[]:{})}Bn(s,c,u),s=s[c]}return e}var Vr=gn?function(e,t){return gn.set(e,t),e}:Ws,Br=Pt?function(e,t){return Pt(e,"toString",{configurable:!0,enumerable:!1,value:Bs(t),writable:!0})}:Ws;function Hr(e){return Sa(Es(e))}function zr(e,t,n){var i=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var o=r(a);++i<a;)o[i]=e[i+t];return o}function Wr(e,t){var n;return er(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n}function qr(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;r<i;){var a=r+i>>>1,o=e[a];null!==o&&!Qo(o)&&(n?o<=t:o<t)?r=a+1:i=a}return i}return Gr(e,t,Ws,n)}function Gr(e,t,n,r){t=n(t);for(var i=0,a=null==e?0:e.length,o=t!=t,s=null===t,c=Qo(t),u=void 0===t;i<a;){var l=Xt((i+a)/2),f=n(e[l]),p=void 0!==f,h=null===f,d=f==f,v=Qo(f);if(o)var y=r||d;else y=u?d&&(r||p):s?d&&p&&(r||!h):c?d&&p&&!h&&(r||!v):!h&&!v&&(r?f<=t:f<t);y?i=l+1:a=l}return sn(a,4294967294)}function Yr(e,t){for(var n=-1,r=e.length,i=0,a=[];++n<r;){var o=e[n],s=t?t(o):o;if(!n||!Eo(s,c)){var c=s;a[i++]=0===o?0:o}}return a}function Jr(e){return"number"==typeof e?e:Qo(e)?NaN:+e}function Qr(e){if("string"==typeof e)return e;if(Do(e))return ht(e,Qr)+"";if(Qo(e))return On?On.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Zr(e,t,n){var r=-1,i=ft,a=e.length,o=!0,s=[],c=s;if(n)o=!1,i=pt;else if(a>=200){var u=t?null:Li(e);if(u)return Bt(u);o=!1,i=jt,c=new Rn}else c=t?[]:s;e:for(;++r<a;){var l=e[r],f=t?t(l):l;if(l=n||0!==l?l:0,o&&f==f){for(var p=c.length;p--;)if(c[p]===f)continue e;t&&c.push(f),s.push(l)}else i(c,f,n)||(c!==s&&c.push(f),s.push(l))}return s}function Xr(e,t){return null==(e=va(e,t=si(t,e)))||delete e[$a(Na(t))]}function ei(e,t,n,r){return Kr(e,t,n(fr(e,t)),r)}function ti(e,t,n,r){for(var i=e.length,a=r?i:-1;(r?a--:++a<i)&&t(e[a],a,e););return n?zr(e,r?0:a,r?a+1:i):zr(e,r?a+1:0,r?i:a)}function ni(e,t){var n=e;return n instanceof jn&&(n=n.value()),vt(t,(function(e,t){return t.func.apply(t.thisArg,dt([e],t.args))}),n)}function ri(e,t,n){var i=e.length;if(i<2)return i?Zr(e[0]):[];for(var a=-1,o=r(i);++a<i;)for(var s=e[a],c=-1;++c<i;)c!=a&&(o[a]=Xn(o[a]||s,e[c],t,n));return Zr(ar(o,1),t,n)}function ii(e,t,n){for(var r=-1,i=e.length,a=t.length,o={};++r<i;){var s=r<a?t[r]:void 0;n(o,e[r],s)}return o}function ai(e){return Ro(e)?e:[]}function oi(e){return"function"==typeof e?e:Ws}function si(e,t){return Do(e)?e:ca(e,t)?[e]:_a(ss(e))}var ci=Nr;function ui(e,t,n){var r=e.length;return n=void 0===n?r:n,!t&&n>=r?e:zr(e,t,n)}var li=Yt||function(e){return qe.clearTimeout(e)};function fi(e,t){if(t)return e.slice();var n=e.length,r=Ve?Ve(n):new e.constructor(n);return e.copy(r),r}function pi(e){var t=new e.constructor(e.byteLength);return new Re(t).set(new Re(e)),t}function hi(e,t){var n=t?pi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function di(e,t){if(e!==t){var n=void 0!==e,r=null===e,i=e==e,a=Qo(e),o=void 0!==t,s=null===t,c=t==t,u=Qo(t);if(!s&&!u&&!a&&e>t||a&&o&&c&&!s&&!u||r&&o&&c||!n&&c||!i)return 1;if(!r&&!a&&!u&&e<t||u&&n&&i&&!r&&!a||s&&n&&i||!o&&i||!c)return-1}return 0}function vi(e,t,n,i){for(var a=-1,o=e.length,s=n.length,c=-1,u=t.length,l=on(o-s,0),f=r(u+l),p=!i;++c<u;)f[c]=t[c];for(;++a<s;)(p||a<o)&&(f[n[a]]=e[a]);for(;l--;)f[c++]=e[a++];return f}function yi(e,t,n,i){for(var a=-1,o=e.length,s=-1,c=n.length,u=-1,l=t.length,f=on(o-c,0),p=r(f+l),h=!i;++a<f;)p[a]=e[a];for(var d=a;++u<l;)p[d+u]=t[u];for(;++s<c;)(h||a<o)&&(p[d+n[s]]=e[a++]);return p}function mi(e,t){var n=-1,i=e.length;for(t||(t=r(i));++n<i;)t[n]=e[n];return t}function gi(e,t,n,r){var i=!n;n||(n={});for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;void 0===c&&(c=e[s]),i?qn(n,s,c):Bn(n,s,c)}return n}function bi(e,t){return function(n,r){var i=Do(n)?ot:zn,a=t?t():{};return i(n,e,Ji(r,2),a)}}function wi(e){return Nr((function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&"function"==typeof a?(i--,a):void 0,o&&sa(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=ve(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t}))}function ki(e,t){return function(n,r){if(null==n)return n;if(!To(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=ve(n);(t?a--:++a<i)&&!1!==r(o[a],a,o););return n}}function xi(e){return function(t,n,r){for(var i=-1,a=ve(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(!1===n(a[c],c,a))break}return t}}function Si(e){return function(t){var n=Ft(t=ss(t))?Wt(t):void 0,r=n?n[0]:t.charAt(0),i=n?ui(n,1).join(""):t.slice(1);return r[e]()+i}}function _i(e){return function(t){return vt(Us(js(t).replace(je,"")),e,"")}}function $i(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=En(e.prototype),r=e.apply(n,t);return Bo(r)?r:n}}function Pi(e){return function(t,n,r){var i=ve(t);if(!To(t)){var a=Ji(n,3);t=ws(t),n=function(e){return a(i[e],e,i)}}var o=e(t,n,r);return o>-1?i[a?t[o]:o]:void 0}}function Oi(e){return Hi((function(t){var n=t.length,r=n,i=In.prototype.thru;for(e&&t.reverse();r--;){var o=t[r];if("function"!=typeof o)throw new ge(a);if(i&&!s&&"wrapper"==Gi(o))var s=new In([],!0)}for(r=s?r:n;++r<n;){var c=Gi(o=t[r]),u="wrapper"==c?qi(o):void 0;s=u&&ua(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?s[Gi(u[0])].apply(s,u[3]):1==o.length&&ua(o)?s[c]():s.thru(o)}return function(){var e=arguments,r=e[0];if(s&&1==e.length&&Do(r))return s.plant(r).value();for(var i=0,a=n?t[i].apply(this,e):r;++i<n;)a=t[i].call(this,a);return a}}))}function Ci(e,t,n,i,a,o,s,c,u,l){var f=128&t,p=1&t,h=2&t,d=24&t,v=512&t,y=h?void 0:$i(e);return function m(){for(var g=arguments.length,b=r(g),w=g;w--;)b[w]=arguments[w];if(d)var k=Yi(m),x=Tt(b,k);if(i&&(b=vi(b,i,a,d)),o&&(b=yi(b,o,s,d)),g-=x,d&&g<l){var S=Vt(b,k);return Ti(e,t,Ci,m.placeholder,n,b,S,c,u,l-g)}var _=p?n:this,$=h?_[e]:e;return g=b.length,c?b=ya(b,c):v&&g>1&&b.reverse(),f&&u<g&&(b.length=u),this&&this!==qe&&this instanceof m&&($=y||$i($)),$.apply(_,b)}}function Ei(e,t){return function(n,r){return function(e,t,n,r){return cr(e,(function(e,i,a){t(r,n(e),i,a)})),r}(n,e,t(r),{})}}function Ai(e,t){return function(n,r){var i;if(void 0===n&&void 0===r)return t;if(void 0!==n&&(i=n),void 0!==r){if(void 0===i)return r;"string"==typeof n||"string"==typeof r?(n=Qr(n),r=Qr(r)):(n=Jr(n),r=Jr(r)),i=e(n,r)}return i}}function Ii(e){return Hi((function(t){return t=ht(t,At(Ji())),Nr((function(n){var r=this;return e(t,(function(e){return at(e,r,n)}))}))}))}function ji(e,t){var n=(t=void 0===t?" ":Qr(t)).length;if(n<2)return n?Lr(t,e):t;var r=Lr(t,Zt(e/zt(t)));return Ft(t)?ui(Wt(r),0,e).join(""):r.slice(0,e)}function Di(e){return function(t,n,i){return i&&"number"!=typeof i&&sa(t,n,i)&&(n=i=void 0),t=ns(t),void 0===n?(n=t,t=0):n=ns(n),function(e,t,n,i){for(var a=-1,o=on(Zt((t-e)/(n||1)),0),s=r(o);o--;)s[i?o:++a]=e,e+=n;return s}(t,n,i=void 0===i?t<n?1:-1:ns(i),e)}}function Mi(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=as(t),n=as(n)),e(t,n)}}function Ti(e,t,n,r,i,a,o,s,c,u){var l=8&t;t|=l?32:64,4&(t&=~(l?64:32))||(t&=-4);var f=[e,t,i,l?a:void 0,l?o:void 0,l?void 0:a,l?void 0:o,s,c,u],p=n.apply(void 0,f);return ua(e)&&ga(p,f),p.placeholder=r,ka(p,e,t)}function Ri(e){var t=de[e];return function(e,n){if(e=as(e),(n=null==n?0:sn(rs(n),292))&&nn(e)){var r=(ss(e)+"e").split("e");return+((r=(ss(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Li=vn&&1/Bt(new vn([,-0]))[1]==1/0?function(e){return new vn(e)}:Qs;function Ni(e){return function(t){var n=na(t);return n==v?Ut(t):n==b?Ht(t):function(e,t){return ht(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Fi(e,t,n,i,s,c,u,l){var f=2&t;if(!f&&"function"!=typeof e)throw new ge(a);var p=i?i.length:0;if(p||(t&=-97,i=s=void 0),u=void 0===u?u:on(rs(u),0),l=void 0===l?l:rs(l),p-=s?s.length:0,64&t){var h=i,d=s;i=s=void 0}var v=f?void 0:qi(e),y=[e,t,n,i,s,h,d,c,u,l];if(v&&function(e,t){var n=e[1],r=t[1],i=n|r,a=i<131,s=128==r&&8==n||128==r&&256==n&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!a&&!s)return e;1&r&&(e[2]=t[2],i|=1&n?0:4);var c=t[3];if(c){var u=e[3];e[3]=u?vi(u,c,t[4]):c,e[4]=u?Vt(e[3],o):t[4]}(c=t[5])&&(u=e[5],e[5]=u?yi(u,c,t[6]):c,e[6]=u?Vt(e[5],o):t[6]);(c=t[7])&&(e[7]=c);128&r&&(e[8]=null==e[8]?t[8]:sn(e[8],t[8]));null==e[9]&&(e[9]=t[9]);e[0]=t[0],e[1]=i}(y,v),e=y[0],t=y[1],n=y[2],i=y[3],s=y[4],!(l=y[9]=void 0===y[9]?f?0:e.length:on(y[9]-p,0))&&24&t&&(t&=-25),t&&1!=t)m=8==t||16==t?function(e,t,n){var i=$i(e);return function a(){for(var o=arguments.length,s=r(o),c=o,u=Yi(a);c--;)s[c]=arguments[c];var l=o<3&&s[0]!==u&&s[o-1]!==u?[]:Vt(s,u);if((o-=l.length)<n)return Ti(e,t,Ci,a.placeholder,void 0,s,l,void 0,void 0,n-o);var f=this&&this!==qe&&this instanceof a?i:e;return at(f,this,s)}}(e,t,l):32!=t&&33!=t||s.length?Ci.apply(void 0,y):function(e,t,n,i){var a=1&t,o=$i(e);return function t(){for(var s=-1,c=arguments.length,u=-1,l=i.length,f=r(l+c),p=this&&this!==qe&&this instanceof t?o:e;++u<l;)f[u]=i[u];for(;c--;)f[u++]=arguments[++s];return at(p,a?n:this,f)}}(e,t,n,i);else var m=function(e,t,n){var r=1&t,i=$i(e);return function t(){var a=this&&this!==qe&&this instanceof t?i:e;return a.apply(r?n:this,arguments)}}(e,t,n);return ka((v?Vr:ga)(m,y),e,t)}function Ui(e,t,n,r){return void 0===e||Eo(e,ke[n])&&!_e.call(r,n)?t:e}function Ki(e,t,n,r,i,a){return Bo(e)&&Bo(t)&&(a.set(t,e),Ar(e,t,void 0,Ki,a),a.delete(t)),e}function Vi(e){return qo(e)?void 0:e}function Bi(e,t,n,r,i,a){var o=1&n,s=e.length,c=t.length;if(s!=c&&!(o&&c>s))return!1;var u=a.get(e);if(u&&a.get(t))return u==t;var l=-1,f=!0,p=2&n?new Rn:void 0;for(a.set(e,t),a.set(t,e);++l<s;){var h=e[l],d=t[l];if(r)var v=o?r(d,h,l,t,e,a):r(h,d,l,e,t,a);if(void 0!==v){if(v)continue;f=!1;break}if(p){if(!mt(t,(function(e,t){if(!jt(p,t)&&(h===e||i(h,e,n,r,a)))return p.push(t)}))){f=!1;break}}else if(h!==d&&!i(h,d,n,r,a)){f=!1;break}}return a.delete(e),a.delete(t),f}function Hi(e){return wa(da(e,void 0,Da),e+"")}function zi(e){return pr(e,ws,ea)}function Wi(e){return pr(e,ks,ta)}var qi=gn?function(e){return gn.get(e)}:Qs;function Gi(e){for(var t=e.name+"",n=bn[t],r=_e.call(bn,t)?n.length:0;r--;){var i=n[r],a=i.func;if(null==a||a==e)return i.name}return t}function Yi(e){return(_e.call(Cn,"placeholder")?Cn:e).placeholder}function Ji(){var e=Cn.iteratee||qs;return e=e===qs?Sr:e,arguments.length?e(arguments[0],arguments[1]):e}function Qi(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Zi(e){for(var t=ws(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,pa(i)]}return t}function Xi(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return xr(n)?n:void 0}var ea=en?function(e){return null==e?[]:(e=ve(e),lt(en(e),(function(t){return Ge.call(e,t)})))}:ic,ta=en?function(e){for(var t=[];e;)dt(t,ea(e)),e=ze(e);return t}:ic,na=hr;function ra(e,t,n){for(var r=-1,i=(t=si(t,e)).length,a=!1;++r<i;){var o=$a(t[r]);if(!(a=null!=e&&n(e,o)))break;e=e[o]}return a||++r!=i?a:!!(i=null==e?0:e.length)&&Vo(i)&&oa(o,i)&&(Do(e)||jo(e))}function ia(e){return"function"!=typeof e.constructor||fa(e)?{}:En(ze(e))}function aa(e){return Do(e)||jo(e)||!!(Qe&&e&&e[Qe])}function oa(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&ce.test(e))&&e>-1&&e%1==0&&e<t}function sa(e,t,n){if(!Bo(n))return!1;var r=typeof t;return!!("number"==r?To(n)&&oa(t,n.length):"string"==r&&t in n)&&Eo(n[t],e)}function ca(e,t){if(Do(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Qo(e))||(H.test(e)||!B.test(e)||null!=t&&e in ve(t))}function ua(e){var t=Gi(e),n=Cn[t];if("function"!=typeof n||!(t in jn.prototype))return!1;if(e===n)return!0;var r=qi(n);return!!r&&e===r[0]}(pn&&na(new pn(new ArrayBuffer(1)))!=_||hn&&na(new hn)!=v||dn&&"[object Promise]"!=na(dn.resolve())||vn&&na(new vn)!=b||yn&&na(new yn)!=x)&&(na=function(e){var t=hr(e),n=t==m?e.constructor:void 0,r=n?Pa(n):"";if(r)switch(r){case wn:return _;case kn:return v;case xn:return"[object Promise]";case Sn:return b;case _n:return x}return t});var la=xe?Uo:ac;function fa(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ke)}function pa(e){return e==e&&!Bo(e)}function ha(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in ve(n)))}}function da(e,t,n){return t=on(void 0===t?e.length-1:t,0),function(){for(var i=arguments,a=-1,o=on(i.length-t,0),s=r(o);++a<o;)s[a]=i[t+a];a=-1;for(var c=r(t+1);++a<t;)c[a]=i[a];return c[t]=n(s),at(e,this,c)}}function va(e,t){return t.length<2?e:fr(e,zr(t,0,-1))}function ya(e,t){for(var n=e.length,r=sn(t.length,n),i=mi(e);r--;){var a=t[r];e[r]=oa(a,n)?i[a]:void 0}return e}function ma(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var ga=xa(Vr),ba=Qt||function(e,t){return qe.setTimeout(e,t)},wa=xa(Br);function ka(e,t,n){var r=t+"";return wa(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(Q,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return st(s,(function(n){var r="_."+n[0];t&n[1]&&!ft(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(Z);return t?t[1].split(X):[]}(r),n)))}function xa(e){var t=0,n=0;return function(){var r=cn(),i=16-(r-n);if(n=r,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Sa(e,t){var n=-1,r=e.length,i=r-1;for(t=void 0===t?r:t;++n<t;){var a=Rr(n,i),o=e[a];e[a]=e[n],e[n]=o}return e.length=t,e}var _a=function(e){var t=So(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(z,(function(e,n,r,i){t.push(r?i.replace(te,"$1"):n||e)})),t}));function $a(e){if("string"==typeof e||Qo(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Pa(e){if(null!=e){try{return Se.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Oa(e){if(e instanceof jn)return e.clone();var t=new In(e.__wrapped__,e.__chain__);return t.__actions__=mi(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Ca=Nr((function(e,t){return Ro(e)?Xn(e,ar(t,1,Ro,!0)):[]})),Ea=Nr((function(e,t){var n=Na(t);return Ro(n)&&(n=void 0),Ro(e)?Xn(e,ar(t,1,Ro,!0),Ji(n,2)):[]})),Aa=Nr((function(e,t){var n=Na(t);return Ro(n)&&(n=void 0),Ro(e)?Xn(e,ar(t,1,Ro,!0),void 0,n):[]}));function Ia(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:rs(n);return i<0&&(i=on(r+i,0)),wt(e,Ji(t,3),i)}function ja(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r-1;return void 0!==n&&(i=rs(n),i=n<0?on(r+i,0):sn(i,r-1)),wt(e,Ji(t,3),i,!0)}function Da(e){return(null==e?0:e.length)?ar(e,1):[]}function Ma(e){return e&&e.length?e[0]:void 0}var Ta=Nr((function(e){var t=ht(e,ai);return t.length&&t[0]===e[0]?mr(t):[]})),Ra=Nr((function(e){var t=Na(e),n=ht(e,ai);return t===Na(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?mr(n,Ji(t,2)):[]})),La=Nr((function(e){var t=Na(e),n=ht(e,ai);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?mr(n,void 0,t):[]}));function Na(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Fa=Nr(Ua);function Ua(e,t){return e&&e.length&&t&&t.length?Mr(e,t):e}var Ka=Hi((function(e,t){var n=null==e?0:e.length,r=Gn(e,t);return Tr(e,ht(t,(function(e){return oa(e,n)?+e:e})).sort(di)),r}));function Va(e){return null==e?e:fn.call(e)}var Ba=Nr((function(e){return Zr(ar(e,1,Ro,!0))})),Ha=Nr((function(e){var t=Na(e);return Ro(t)&&(t=void 0),Zr(ar(e,1,Ro,!0),Ji(t,2))})),za=Nr((function(e){var t=Na(e);return t="function"==typeof t?t:void 0,Zr(ar(e,1,Ro,!0),void 0,t)}));function Wa(e){if(!e||!e.length)return[];var t=0;return e=lt(e,(function(e){if(Ro(e))return t=on(e.length,t),!0})),Et(t,(function(t){return ht(e,$t(t))}))}function qa(e,t){if(!e||!e.length)return[];var n=Wa(e);return null==t?n:ht(n,(function(e){return at(t,void 0,e)}))}var Ga=Nr((function(e,t){return Ro(e)?Xn(e,t):[]})),Ya=Nr((function(e){return ri(lt(e,Ro))})),Ja=Nr((function(e){var t=Na(e);return Ro(t)&&(t=void 0),ri(lt(e,Ro),Ji(t,2))})),Qa=Nr((function(e){var t=Na(e);return t="function"==typeof t?t:void 0,ri(lt(e,Ro),void 0,t)})),Za=Nr(Wa);var Xa=Nr((function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,qa(e,n)}));function eo(e){var t=Cn(e);return t.__chain__=!0,t}function to(e,t){return t(e)}var no=Hi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,i=function(t){return Gn(t,e)};return!(t>1||this.__actions__.length)&&r instanceof jn&&oa(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:to,args:[i],thisArg:void 0}),new In(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(void 0),e}))):this.thru(i)}));var ro=bi((function(e,t,n){_e.call(e,n)?++e[n]:qn(e,n,1)}));var io=Pi(Ia),ao=Pi(ja);function oo(e,t){return(Do(e)?st:er)(e,Ji(t,3))}function so(e,t){return(Do(e)?ct:tr)(e,Ji(t,3))}var co=bi((function(e,t,n){_e.call(e,n)?e[n].push(t):qn(e,n,[t])}));var uo=Nr((function(e,t,n){var i=-1,a="function"==typeof t,o=To(e)?r(e.length):[];return er(e,(function(e){o[++i]=a?at(t,e,n):gr(e,t,n)})),o})),lo=bi((function(e,t,n){qn(e,n,t)}));function fo(e,t){return(Do(e)?ht:Or)(e,Ji(t,3))}var po=bi((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var ho=Nr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&sa(e,t[0],t[1])?t=[]:n>2&&sa(t[0],t[1],t[2])&&(t=[t[0]]),jr(e,ar(t,1),[])})),vo=Jt||function(){return qe.Date.now()};function yo(e,t,n){return t=n?void 0:t,Fi(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function mo(e,t){var n;if("function"!=typeof t)throw new ge(a);return e=rs(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}var go=Nr((function(e,t,n){var r=1;if(n.length){var i=Vt(n,Yi(go));r|=32}return Fi(e,r,t,n,i)})),bo=Nr((function(e,t,n){var r=3;if(n.length){var i=Vt(n,Yi(bo));r|=32}return Fi(t,r,e,n,i)}));function wo(e,t,n){var r,i,o,s,c,u,l=0,f=!1,p=!1,h=!0;if("function"!=typeof e)throw new ge(a);function d(t){var n=r,a=i;return r=i=void 0,l=t,s=e.apply(a,n)}function v(e){return l=e,c=ba(m,t),f?d(e):s}function y(e){var n=e-u;return void 0===u||n>=t||n<0||p&&e-l>=o}function m(){var e=vo();if(y(e))return g(e);c=ba(m,function(e){var n=t-(e-u);return p?sn(n,o-(e-l)):n}(e))}function g(e){return c=void 0,h&&r?d(e):(r=i=void 0,s)}function b(){var e=vo(),n=y(e);if(r=arguments,i=this,u=e,n){if(void 0===c)return v(u);if(p)return li(c),c=ba(m,t),d(u)}return void 0===c&&(c=ba(m,t)),s}return t=as(t)||0,Bo(n)&&(f=!!n.leading,o=(p="maxWait"in n)?on(as(n.maxWait)||0,t):o,h="trailing"in n?!!n.trailing:h),b.cancel=function(){void 0!==c&&li(c),l=0,r=u=i=c=void 0},b.flush=function(){return void 0===c?s:g(vo())},b}var ko=Nr((function(e,t){return Zn(e,1,t)})),xo=Nr((function(e,t,n){return Zn(e,as(t)||0,n)}));function So(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new ge(a);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(So.Cache||Tn),n}function _o(e){if("function"!=typeof e)throw new ge(a);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}So.Cache=Tn;var $o=ci((function(e,t){var n=(t=1==t.length&&Do(t[0])?ht(t[0],At(Ji())):ht(ar(t,1),At(Ji()))).length;return Nr((function(r){for(var i=-1,a=sn(r.length,n);++i<a;)r[i]=t[i].call(this,r[i]);return at(e,this,r)}))})),Po=Nr((function(e,t){return Fi(e,32,void 0,t,Vt(t,Yi(Po)))})),Oo=Nr((function(e,t){return Fi(e,64,void 0,t,Vt(t,Yi(Oo)))})),Co=Hi((function(e,t){return Fi(e,256,void 0,void 0,void 0,t)}));function Eo(e,t){return e===t||e!=e&&t!=t}var Ao=Mi(dr),Io=Mi((function(e,t){return e>=t})),jo=br(function(){return arguments}())?br:function(e){return Ho(e)&&_e.call(e,"callee")&&!Ge.call(e,"callee")},Do=r.isArray,Mo=Xe?At(Xe):function(e){return Ho(e)&&hr(e)==S};function To(e){return null!=e&&Vo(e.length)&&!Uo(e)}function Ro(e){return Ho(e)&&To(e)}var Lo=tn||ac,No=et?At(et):function(e){return Ho(e)&&hr(e)==f};function Fo(e){if(!Ho(e))return!1;var t=hr(e);return t==p||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!qo(e)}function Uo(e){if(!Bo(e))return!1;var t=hr(e);return t==h||t==d||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Ko(e){return"number"==typeof e&&e==rs(e)}function Vo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Bo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ho(e){return null!=e&&"object"==typeof e}var zo=tt?At(tt):function(e){return Ho(e)&&na(e)==v};function Wo(e){return"number"==typeof e||Ho(e)&&hr(e)==y}function qo(e){if(!Ho(e)||hr(e)!=m)return!1;var t=ze(e);if(null===t)return!0;var n=_e.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Se.call(n)==Ce}var Go=nt?At(nt):function(e){return Ho(e)&&hr(e)==g};var Yo=rt?At(rt):function(e){return Ho(e)&&na(e)==b};function Jo(e){return"string"==typeof e||!Do(e)&&Ho(e)&&hr(e)==w}function Qo(e){return"symbol"==typeof e||Ho(e)&&hr(e)==k}var Zo=it?At(it):function(e){return Ho(e)&&Vo(e.length)&&!!Ue[hr(e)]};var Xo=Mi(Pr),es=Mi((function(e,t){return e<=t}));function ts(e){if(!e)return[];if(To(e))return Jo(e)?Wt(e):mi(e);if(Ze&&e[Ze])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Ze]());var t=na(e);return(t==v?Ut:t==b?Bt:Es)(e)}function ns(e){return e?(e=as(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function rs(e){var t=ns(e),n=t%1;return t==t?n?t-n:t:0}function is(e){return e?Yn(rs(e),0,4294967295):0}function as(e){if("number"==typeof e)return e;if(Qo(e))return NaN;if(Bo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Bo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(G,"");var n=ae.test(e);return n||se.test(e)?He(e.slice(2),n?2:8):ie.test(e)?NaN:+e}function os(e){return gi(e,ks(e))}function ss(e){return null==e?"":Qr(e)}var cs=wi((function(e,t){if(fa(t)||To(t))gi(t,ws(t),e);else for(var n in t)_e.call(t,n)&&Bn(e,n,t[n])})),us=wi((function(e,t){gi(t,ks(t),e)})),ls=wi((function(e,t,n,r){gi(t,ks(t),e,r)})),fs=wi((function(e,t,n,r){gi(t,ws(t),e,r)})),ps=Hi(Gn);var hs=Nr((function(e,t){e=ve(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&sa(t[0],t[1],i)&&(r=1);++n<r;)for(var a=t[n],o=ks(a),s=-1,c=o.length;++s<c;){var u=o[s],l=e[u];(void 0===l||Eo(l,ke[u])&&!_e.call(e,u))&&(e[u]=a[u])}return e})),ds=Nr((function(e){return e.push(void 0,Ki),at(Ss,void 0,e)}));function vs(e,t,n){var r=null==e?void 0:fr(e,t);return void 0===r?n:r}function ys(e,t){return null!=e&&ra(e,t,yr)}var ms=Ei((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Oe.call(t)),e[t]=n}),Bs(Ws)),gs=Ei((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Oe.call(t)),_e.call(e,t)?e[t].push(n):e[t]=[n]}),Ji),bs=Nr(gr);function ws(e){return To(e)?Nn(e):_r(e)}function ks(e){return To(e)?Nn(e,!0):$r(e)}var xs=wi((function(e,t,n){Ar(e,t,n)})),Ss=wi((function(e,t,n,r){Ar(e,t,n,r)})),_s=Hi((function(e,t){var n={};if(null==e)return n;var r=!1;t=ht(t,(function(t){return t=si(t,e),r||(r=t.length>1),t})),gi(e,Wi(e),n),r&&(n=Jn(n,7,Vi));for(var i=t.length;i--;)Xr(n,t[i]);return n}));var $s=Hi((function(e,t){return null==e?{}:function(e,t){return Dr(e,t,(function(t,n){return ys(e,n)}))}(e,t)}));function Ps(e,t){if(null==e)return{};var n=ht(Wi(e),(function(e){return[e]}));return t=Ji(t),Dr(e,n,(function(e,n){return t(e,n[0])}))}var Os=Ni(ws),Cs=Ni(ks);function Es(e){return null==e?[]:It(e,ws(e))}var As=_i((function(e,t,n){return t=t.toLowerCase(),e+(n?Is(t):t)}));function Is(e){return Fs(ss(e).toLowerCase())}function js(e){return(e=ss(e))&&e.replace(ue,Rt).replace(De,"")}var Ds=_i((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Ms=_i((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Ts=Si("toLowerCase");var Rs=_i((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));var Ls=_i((function(e,t,n){return e+(n?" ":"")+Fs(t)}));var Ns=_i((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Fs=Si("toUpperCase");function Us(e,t,n){return e=ss(e),void 0===(t=n?void 0:t)?function(e){return Le.test(e)}(e)?function(e){return e.match(Te)||[]}(e):function(e){return e.match(ee)||[]}(e):e.match(t)||[]}var Ks=Nr((function(e,t){try{return at(e,void 0,t)}catch(e){return Fo(e)?e:new pe(e)}})),Vs=Hi((function(e,t){return st(t,(function(t){t=$a(t),qn(e,t,go(e[t],e))})),e}));function Bs(e){return function(){return e}}var Hs=Oi(),zs=Oi(!0);function Ws(e){return e}function qs(e){return Sr("function"==typeof e?e:Jn(e,1))}var Gs=Nr((function(e,t){return function(n){return gr(n,e,t)}})),Ys=Nr((function(e,t){return function(n){return gr(e,n,t)}}));function Js(e,t,n){var r=ws(t),i=lr(t,r);null!=n||Bo(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=lr(t,ws(t)));var a=!(Bo(n)&&"chain"in n&&!n.chain),o=Uo(e);return st(i,(function(n){var r=t[n];e[n]=r,o&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__),i=n.__actions__=mi(this.__actions__);return i.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,dt([this.value()],arguments))})})),e}function Qs(){}var Zs=Ii(ht),Xs=Ii(ut),ec=Ii(mt);function tc(e){return ca(e)?$t($a(e)):function(e){return function(t){return fr(t,e)}}(e)}var nc=Di(),rc=Di(!0);function ic(){return[]}function ac(){return!1}var oc=Ai((function(e,t){return e+t}),0),sc=Ri("ceil"),cc=Ai((function(e,t){return e/t}),1),uc=Ri("floor");var lc,fc=Ai((function(e,t){return e*t}),1),pc=Ri("round"),hc=Ai((function(e,t){return e-t}),0);return Cn.after=function(e,t){if("function"!=typeof t)throw new ge(a);return e=rs(e),function(){if(--e<1)return t.apply(this,arguments)}},Cn.ary=yo,Cn.assign=cs,Cn.assignIn=us,Cn.assignInWith=ls,Cn.assignWith=fs,Cn.at=ps,Cn.before=mo,Cn.bind=go,Cn.bindAll=Vs,Cn.bindKey=bo,Cn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Do(e)?e:[e]},Cn.chain=eo,Cn.chunk=function(e,t,n){t=(n?sa(e,t,n):void 0===t)?1:on(rs(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var a=0,o=0,s=r(Zt(i/t));a<i;)s[o++]=zr(e,a,a+=t);return s},Cn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var a=e[t];a&&(i[r++]=a)}return i},Cn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=r(e-1),n=arguments[0],i=e;i--;)t[i-1]=arguments[i];return dt(Do(n)?mi(n):[n],ar(t,1))},Cn.cond=function(e){var t=null==e?0:e.length,n=Ji();return e=t?ht(e,(function(e){if("function"!=typeof e[1])throw new ge(a);return[n(e[0]),e[1]]})):[],Nr((function(n){for(var r=-1;++r<t;){var i=e[r];if(at(i[0],this,n))return at(i[1],this,n)}}))},Cn.conforms=function(e){return function(e){var t=ws(e);return function(n){return Qn(n,e,t)}}(Jn(e,1))},Cn.constant=Bs,Cn.countBy=ro,Cn.create=function(e,t){var n=En(e);return null==t?n:Wn(n,t)},Cn.curry=function e(t,n,r){var i=Fi(t,8,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=e.placeholder,i},Cn.curryRight=function e(t,n,r){var i=Fi(t,16,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=e.placeholder,i},Cn.debounce=wo,Cn.defaults=hs,Cn.defaultsDeep=ds,Cn.defer=ko,Cn.delay=xo,Cn.difference=Ca,Cn.differenceBy=Ea,Cn.differenceWith=Aa,Cn.drop=function(e,t,n){var r=null==e?0:e.length;return r?zr(e,(t=n||void 0===t?1:rs(t))<0?0:t,r):[]},Cn.dropRight=function(e,t,n){var r=null==e?0:e.length;return r?zr(e,0,(t=r-(t=n||void 0===t?1:rs(t)))<0?0:t):[]},Cn.dropRightWhile=function(e,t){return e&&e.length?ti(e,Ji(t,3),!0,!0):[]},Cn.dropWhile=function(e,t){return e&&e.length?ti(e,Ji(t,3),!0):[]},Cn.fill=function(e,t,n,r){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&sa(e,t,n)&&(n=0,r=i),function(e,t,n,r){var i=e.length;for((n=rs(n))<0&&(n=-n>i?0:i+n),(r=void 0===r||r>i?i:rs(r))<0&&(r+=i),r=n>r?0:is(r);n<r;)e[n++]=t;return e}(e,t,n,r)):[]},Cn.filter=function(e,t){return(Do(e)?lt:ir)(e,Ji(t,3))},Cn.flatMap=function(e,t){return ar(fo(e,t),1)},Cn.flatMapDeep=function(e,t){return ar(fo(e,t),1/0)},Cn.flatMapDepth=function(e,t,n){return n=void 0===n?1:rs(n),ar(fo(e,t),n)},Cn.flatten=Da,Cn.flattenDeep=function(e){return(null==e?0:e.length)?ar(e,1/0):[]},Cn.flattenDepth=function(e,t){return(null==e?0:e.length)?ar(e,t=void 0===t?1:rs(t)):[]},Cn.flip=function(e){return Fi(e,512)},Cn.flow=Hs,Cn.flowRight=zs,Cn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];r[i[0]]=i[1]}return r},Cn.functions=function(e){return null==e?[]:lr(e,ws(e))},Cn.functionsIn=function(e){return null==e?[]:lr(e,ks(e))},Cn.groupBy=co,Cn.initial=function(e){return(null==e?0:e.length)?zr(e,0,-1):[]},Cn.intersection=Ta,Cn.intersectionBy=Ra,Cn.intersectionWith=La,Cn.invert=ms,Cn.invertBy=gs,Cn.invokeMap=uo,Cn.iteratee=qs,Cn.keyBy=lo,Cn.keys=ws,Cn.keysIn=ks,Cn.map=fo,Cn.mapKeys=function(e,t){var n={};return t=Ji(t,3),cr(e,(function(e,r,i){qn(n,t(e,r,i),e)})),n},Cn.mapValues=function(e,t){var n={};return t=Ji(t,3),cr(e,(function(e,r,i){qn(n,r,t(e,r,i))})),n},Cn.matches=function(e){return Cr(Jn(e,1))},Cn.matchesProperty=function(e,t){return Er(e,Jn(t,1))},Cn.memoize=So,Cn.merge=xs,Cn.mergeWith=Ss,Cn.method=Gs,Cn.methodOf=Ys,Cn.mixin=Js,Cn.negate=_o,Cn.nthArg=function(e){return e=rs(e),Nr((function(t){return Ir(t,e)}))},Cn.omit=_s,Cn.omitBy=function(e,t){return Ps(e,_o(Ji(t)))},Cn.once=function(e){return mo(2,e)},Cn.orderBy=function(e,t,n,r){return null==e?[]:(Do(t)||(t=null==t?[]:[t]),Do(n=r?void 0:n)||(n=null==n?[]:[n]),jr(e,t,n))},Cn.over=Zs,Cn.overArgs=$o,Cn.overEvery=Xs,Cn.overSome=ec,Cn.partial=Po,Cn.partialRight=Oo,Cn.partition=po,Cn.pick=$s,Cn.pickBy=Ps,Cn.property=tc,Cn.propertyOf=function(e){return function(t){return null==e?void 0:fr(e,t)}},Cn.pull=Fa,Cn.pullAll=Ua,Cn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Mr(e,t,Ji(n,2)):e},Cn.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Mr(e,t,void 0,n):e},Cn.pullAt=Ka,Cn.range=nc,Cn.rangeRight=rc,Cn.rearg=Co,Cn.reject=function(e,t){return(Do(e)?lt:ir)(e,_o(Ji(t,3)))},Cn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],a=e.length;for(t=Ji(t,3);++r<a;){var o=e[r];t(o,r,e)&&(n.push(o),i.push(r))}return Tr(e,i),n},Cn.rest=function(e,t){if("function"!=typeof e)throw new ge(a);return Nr(e,t=void 0===t?t:rs(t))},Cn.reverse=Va,Cn.sampleSize=function(e,t,n){return t=(n?sa(e,t,n):void 0===t)?1:rs(t),(Do(e)?Un:Ur)(e,t)},Cn.set=function(e,t,n){return null==e?e:Kr(e,t,n)},Cn.setWith=function(e,t,n,r){return r="function"==typeof r?r:void 0,null==e?e:Kr(e,t,n,r)},Cn.shuffle=function(e){return(Do(e)?Kn:Hr)(e)},Cn.slice=function(e,t,n){var r=null==e?0:e.length;return r?(n&&"number"!=typeof n&&sa(e,t,n)?(t=0,n=r):(t=null==t?0:rs(t),n=void 0===n?r:rs(n)),zr(e,t,n)):[]},Cn.sortBy=ho,Cn.sortedUniq=function(e){return e&&e.length?Yr(e):[]},Cn.sortedUniqBy=function(e,t){return e&&e.length?Yr(e,Ji(t,2)):[]},Cn.split=function(e,t,n){return n&&"number"!=typeof n&&sa(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=ss(e))&&("string"==typeof t||null!=t&&!Go(t))&&!(t=Qr(t))&&Ft(e)?ui(Wt(e),0,n):e.split(t,n):[]},Cn.spread=function(e,t){if("function"!=typeof e)throw new ge(a);return t=null==t?0:on(rs(t),0),Nr((function(n){var r=n[t],i=ui(n,0,t);return r&&dt(i,r),at(e,this,i)}))},Cn.tail=function(e){var t=null==e?0:e.length;return t?zr(e,1,t):[]},Cn.take=function(e,t,n){return e&&e.length?zr(e,0,(t=n||void 0===t?1:rs(t))<0?0:t):[]},Cn.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?zr(e,(t=r-(t=n||void 0===t?1:rs(t)))<0?0:t,r):[]},Cn.takeRightWhile=function(e,t){return e&&e.length?ti(e,Ji(t,3),!1,!0):[]},Cn.takeWhile=function(e,t){return e&&e.length?ti(e,Ji(t,3)):[]},Cn.tap=function(e,t){return t(e),e},Cn.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new ge(a);return Bo(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),wo(e,t,{leading:r,maxWait:t,trailing:i})},Cn.thru=to,Cn.toArray=ts,Cn.toPairs=Os,Cn.toPairsIn=Cs,Cn.toPath=function(e){return Do(e)?ht(e,$a):Qo(e)?[e]:mi(_a(ss(e)))},Cn.toPlainObject=os,Cn.transform=function(e,t,n){var r=Do(e),i=r||Lo(e)||Zo(e);if(t=Ji(t,4),null==n){var a=e&&e.constructor;n=i?r?new a:[]:Bo(e)&&Uo(a)?En(ze(e)):{}}return(i?st:cr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Cn.unary=function(e){return yo(e,1)},Cn.union=Ba,Cn.unionBy=Ha,Cn.unionWith=za,Cn.uniq=function(e){return e&&e.length?Zr(e):[]},Cn.uniqBy=function(e,t){return e&&e.length?Zr(e,Ji(t,2)):[]},Cn.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Zr(e,void 0,t):[]},Cn.unset=function(e,t){return null==e||Xr(e,t)},Cn.unzip=Wa,Cn.unzipWith=qa,Cn.update=function(e,t,n){return null==e?e:ei(e,t,oi(n))},Cn.updateWith=function(e,t,n,r){return r="function"==typeof r?r:void 0,null==e?e:ei(e,t,oi(n),r)},Cn.values=Es,Cn.valuesIn=function(e){return null==e?[]:It(e,ks(e))},Cn.without=Ga,Cn.words=Us,Cn.wrap=function(e,t){return Po(oi(t),e)},Cn.xor=Ya,Cn.xorBy=Ja,Cn.xorWith=Qa,Cn.zip=Za,Cn.zipObject=function(e,t){return ii(e||[],t||[],Bn)},Cn.zipObjectDeep=function(e,t){return ii(e||[],t||[],Kr)},Cn.zipWith=Xa,Cn.entries=Os,Cn.entriesIn=Cs,Cn.extend=us,Cn.extendWith=ls,Js(Cn,Cn),Cn.add=oc,Cn.attempt=Ks,Cn.camelCase=As,Cn.capitalize=Is,Cn.ceil=sc,Cn.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=as(n))==n?n:0),void 0!==t&&(t=(t=as(t))==t?t:0),Yn(as(e),t,n)},Cn.clone=function(e){return Jn(e,4)},Cn.cloneDeep=function(e){return Jn(e,5)},Cn.cloneDeepWith=function(e,t){return Jn(e,5,t="function"==typeof t?t:void 0)},Cn.cloneWith=function(e,t){return Jn(e,4,t="function"==typeof t?t:void 0)},Cn.conformsTo=function(e,t){return null==t||Qn(e,t,ws(t))},Cn.deburr=js,Cn.defaultTo=function(e,t){return null==e||e!=e?t:e},Cn.divide=cc,Cn.endsWith=function(e,t,n){e=ss(e),t=Qr(t);var r=e.length,i=n=void 0===n?r:Yn(rs(n),0,r);return(n-=t.length)>=0&&e.slice(n,i)==t},Cn.eq=Eo,Cn.escape=function(e){return(e=ss(e))&&F.test(e)?e.replace(L,Lt):e},Cn.escapeRegExp=function(e){return(e=ss(e))&&q.test(e)?e.replace(W,"\\$&"):e},Cn.every=function(e,t,n){var r=Do(e)?ut:nr;return n&&sa(e,t,n)&&(t=void 0),r(e,Ji(t,3))},Cn.find=io,Cn.findIndex=Ia,Cn.findKey=function(e,t){return bt(e,Ji(t,3),cr)},Cn.findLast=ao,Cn.findLastIndex=ja,Cn.findLastKey=function(e,t){return bt(e,Ji(t,3),ur)},Cn.floor=uc,Cn.forEach=oo,Cn.forEachRight=so,Cn.forIn=function(e,t){return null==e?e:or(e,Ji(t,3),ks)},Cn.forInRight=function(e,t){return null==e?e:sr(e,Ji(t,3),ks)},Cn.forOwn=function(e,t){return e&&cr(e,Ji(t,3))},Cn.forOwnRight=function(e,t){return e&&ur(e,Ji(t,3))},Cn.get=vs,Cn.gt=Ao,Cn.gte=Io,Cn.has=function(e,t){return null!=e&&ra(e,t,vr)},Cn.hasIn=ys,Cn.head=Ma,Cn.identity=Ws,Cn.includes=function(e,t,n,r){e=To(e)?e:Es(e),n=n&&!r?rs(n):0;var i=e.length;return n<0&&(n=on(i+n,0)),Jo(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&kt(e,t,n)>-1},Cn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:rs(n);return i<0&&(i=on(r+i,0)),kt(e,t,i)},Cn.inRange=function(e,t,n){return t=ns(t),void 0===n?(n=t,t=0):n=ns(n),function(e,t,n){return e>=sn(t,n)&&e<on(t,n)}(e=as(e),t,n)},Cn.invoke=bs,Cn.isArguments=jo,Cn.isArray=Do,Cn.isArrayBuffer=Mo,Cn.isArrayLike=To,Cn.isArrayLikeObject=Ro,Cn.isBoolean=function(e){return!0===e||!1===e||Ho(e)&&hr(e)==l},Cn.isBuffer=Lo,Cn.isDate=No,Cn.isElement=function(e){return Ho(e)&&1===e.nodeType&&!qo(e)},Cn.isEmpty=function(e){if(null==e)return!0;if(To(e)&&(Do(e)||"string"==typeof e||"function"==typeof e.splice||Lo(e)||Zo(e)||jo(e)))return!e.length;var t=na(e);if(t==v||t==b)return!e.size;if(fa(e))return!_r(e).length;for(var n in e)if(_e.call(e,n))return!1;return!0},Cn.isEqual=function(e,t){return wr(e,t)},Cn.isEqualWith=function(e,t,n){var r=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===r?wr(e,t,void 0,n):!!r},Cn.isError=Fo,Cn.isFinite=function(e){return"number"==typeof e&&nn(e)},Cn.isFunction=Uo,Cn.isInteger=Ko,Cn.isLength=Vo,Cn.isMap=zo,Cn.isMatch=function(e,t){return e===t||kr(e,t,Zi(t))},Cn.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,kr(e,t,Zi(t),n)},Cn.isNaN=function(e){return Wo(e)&&e!=+e},Cn.isNative=function(e){if(la(e))throw new pe("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return xr(e)},Cn.isNil=function(e){return null==e},Cn.isNull=function(e){return null===e},Cn.isNumber=Wo,Cn.isObject=Bo,Cn.isObjectLike=Ho,Cn.isPlainObject=qo,Cn.isRegExp=Go,Cn.isSafeInteger=function(e){return Ko(e)&&e>=-9007199254740991&&e<=9007199254740991},Cn.isSet=Yo,Cn.isString=Jo,Cn.isSymbol=Qo,Cn.isTypedArray=Zo,Cn.isUndefined=function(e){return void 0===e},Cn.isWeakMap=function(e){return Ho(e)&&na(e)==x},Cn.isWeakSet=function(e){return Ho(e)&&"[object WeakSet]"==hr(e)},Cn.join=function(e,t){return null==e?"":rn.call(e,t)},Cn.kebabCase=Ds,Cn.last=Na,Cn.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r;return void 0!==n&&(i=(i=rs(n))<0?on(r+i,0):sn(i,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,i):wt(e,St,i,!0)},Cn.lowerCase=Ms,Cn.lowerFirst=Ts,Cn.lt=Xo,Cn.lte=es,Cn.max=function(e){return e&&e.length?rr(e,Ws,dr):void 0},Cn.maxBy=function(e,t){return e&&e.length?rr(e,Ji(t,2),dr):void 0},Cn.mean=function(e){return _t(e,Ws)},Cn.meanBy=function(e,t){return _t(e,Ji(t,2))},Cn.min=function(e){return e&&e.length?rr(e,Ws,Pr):void 0},Cn.minBy=function(e,t){return e&&e.length?rr(e,Ji(t,2),Pr):void 0},Cn.stubArray=ic,Cn.stubFalse=ac,Cn.stubObject=function(){return{}},Cn.stubString=function(){return""},Cn.stubTrue=function(){return!0},Cn.multiply=fc,Cn.nth=function(e,t){return e&&e.length?Ir(e,rs(t)):void 0},Cn.noConflict=function(){return qe._===this&&(qe._=Ee),this},Cn.noop=Qs,Cn.now=vo,Cn.pad=function(e,t,n){e=ss(e);var r=(t=rs(t))?zt(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return ji(Xt(i),n)+e+ji(Zt(i),n)},Cn.padEnd=function(e,t,n){e=ss(e);var r=(t=rs(t))?zt(e):0;return t&&r<t?e+ji(t-r,n):e},Cn.padStart=function(e,t,n){e=ss(e);var r=(t=rs(t))?zt(e):0;return t&&r<t?ji(t-r,n)+e:e},Cn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),un(ss(e).replace(Y,""),t||0)},Cn.random=function(e,t,n){if(n&&"boolean"!=typeof n&&sa(e,t,n)&&(t=n=void 0),void 0===n&&("boolean"==typeof t?(n=t,t=void 0):"boolean"==typeof e&&(n=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=ns(e),void 0===t?(t=e,e=0):t=ns(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var i=ln();return sn(e+i*(t-e+Be("1e-"+((i+"").length-1))),t)}return Rr(e,t)},Cn.reduce=function(e,t,n){var r=Do(e)?vt:Ot,i=arguments.length<3;return r(e,Ji(t,4),n,i,er)},Cn.reduceRight=function(e,t,n){var r=Do(e)?yt:Ot,i=arguments.length<3;return r(e,Ji(t,4),n,i,tr)},Cn.repeat=function(e,t,n){return t=(n?sa(e,t,n):void 0===t)?1:rs(t),Lr(ss(e),t)},Cn.replace=function(){var e=arguments,t=ss(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Cn.result=function(e,t,n){var r=-1,i=(t=si(t,e)).length;for(i||(i=1,e=void 0);++r<i;){var a=null==e?void 0:e[$a(t[r])];void 0===a&&(r=i,a=n),e=Uo(a)?a.call(e):a}return e},Cn.round=pc,Cn.runInContext=e,Cn.sample=function(e){return(Do(e)?Fn:Fr)(e)},Cn.size=function(e){if(null==e)return 0;if(To(e))return Jo(e)?zt(e):e.length;var t=na(e);return t==v||t==b?e.size:_r(e).length},Cn.snakeCase=Rs,Cn.some=function(e,t,n){var r=Do(e)?mt:Wr;return n&&sa(e,t,n)&&(t=void 0),r(e,Ji(t,3))},Cn.sortedIndex=function(e,t){return qr(e,t)},Cn.sortedIndexBy=function(e,t,n){return Gr(e,t,Ji(n,2))},Cn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=qr(e,t);if(r<n&&Eo(e[r],t))return r}return-1},Cn.sortedLastIndex=function(e,t){return qr(e,t,!0)},Cn.sortedLastIndexBy=function(e,t,n){return Gr(e,t,Ji(n,2),!0)},Cn.sortedLastIndexOf=function(e,t){if(null==e?0:e.length){var n=qr(e,t,!0)-1;if(Eo(e[n],t))return n}return-1},Cn.startCase=Ls,Cn.startsWith=function(e,t,n){return e=ss(e),n=null==n?0:Yn(rs(n),0,e.length),t=Qr(t),e.slice(n,n+t.length)==t},Cn.subtract=hc,Cn.sum=function(e){return e&&e.length?Ct(e,Ws):0},Cn.sumBy=function(e,t){return e&&e.length?Ct(e,Ji(t,2)):0},Cn.template=function(e,t,n){var r=Cn.templateSettings;n&&sa(e,t,n)&&(t=void 0),e=ss(e),t=ls({},t,r,Ui);var i,a,o=ls({},t.imports,r.imports,Ui),s=ws(o),c=It(o,s),u=0,l=t.interpolate||le,f="__p += '",p=ye((t.escape||le).source+"|"+l.source+"|"+(l===V?ne:le).source+"|"+(t.evaluate||le).source+"|$","g"),h="//# sourceURL="+(_e.call(t,"sourceURL")?(t.sourceURL+"").replace(/[\r\n]/g," "):"lodash.templateSources["+ ++Fe+"]")+"\n";e.replace(p,(function(t,n,r,o,s,c){return r||(r=o),f+=e.slice(u,c).replace(fe,Nt),n&&(i=!0,f+="' +\n__e("+n+") +\n'"),s&&(a=!0,f+="';\n"+s+";\n__p += '"),r&&(f+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),u=c+t.length,t})),f+="';\n";var d=_e.call(t,"variable")&&t.variable;d||(f="with (obj) {\n"+f+"\n}\n"),f=(a?f.replace(D,""):f).replace(M,"$1").replace(T,"$1;"),f="function("+(d||"obj")+") {\n"+(d?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var v=Ks((function(){return he(s,h+"return "+f).apply(void 0,c)}));if(v.source=f,Fo(v))throw v;return v},Cn.times=function(e,t){if((e=rs(e))<1||e>9007199254740991)return[];var n=4294967295,r=sn(e,4294967295);e-=4294967295;for(var i=Et(r,t=Ji(t));++n<e;)t(n);return i},Cn.toFinite=ns,Cn.toInteger=rs,Cn.toLength=is,Cn.toLower=function(e){return ss(e).toLowerCase()},Cn.toNumber=as,Cn.toSafeInteger=function(e){return e?Yn(rs(e),-9007199254740991,9007199254740991):0===e?e:0},Cn.toString=ss,Cn.toUpper=function(e){return ss(e).toUpperCase()},Cn.trim=function(e,t,n){if((e=ss(e))&&(n||void 0===t))return e.replace(G,"");if(!e||!(t=Qr(t)))return e;var r=Wt(e),i=Wt(t);return ui(r,Dt(r,i),Mt(r,i)+1).join("")},Cn.trimEnd=function(e,t,n){if((e=ss(e))&&(n||void 0===t))return e.replace(J,"");if(!e||!(t=Qr(t)))return e;var r=Wt(e);return ui(r,0,Mt(r,Wt(t))+1).join("")},Cn.trimStart=function(e,t,n){if((e=ss(e))&&(n||void 0===t))return e.replace(Y,"");if(!e||!(t=Qr(t)))return e;var r=Wt(e);return ui(r,Dt(r,Wt(t))).join("")},Cn.truncate=function(e,t){var n=30,r="...";if(Bo(t)){var i="separator"in t?t.separator:i;n="length"in t?rs(t.length):n,r="omission"in t?Qr(t.omission):r}var a=(e=ss(e)).length;if(Ft(e)){var o=Wt(e);a=o.length}if(n>=a)return e;var s=n-zt(r);if(s<1)return r;var c=o?ui(o,0,s).join(""):e.slice(0,s);if(void 0===i)return c+r;if(o&&(s+=c.length-s),Go(i)){if(e.slice(s).search(i)){var u,l=c;for(i.global||(i=ye(i.source,ss(re.exec(i))+"g")),i.lastIndex=0;u=i.exec(l);)var f=u.index;c=c.slice(0,void 0===f?s:f)}}else if(e.indexOf(Qr(i),s)!=s){var p=c.lastIndexOf(i);p>-1&&(c=c.slice(0,p))}return c+r},Cn.unescape=function(e){return(e=ss(e))&&N.test(e)?e.replace(R,qt):e},Cn.uniqueId=function(e){var t=++$e;return ss(e)+t},Cn.upperCase=Ns,Cn.upperFirst=Fs,Cn.each=oo,Cn.eachRight=so,Cn.first=Ma,Js(Cn,(lc={},cr(Cn,(function(e,t){_e.call(Cn.prototype,t)||(lc[t]=e)})),lc),{chain:!1}),Cn.VERSION="4.17.15",st(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Cn[e].placeholder=Cn})),st(["drop","take"],(function(e,t){jn.prototype[e]=function(n){n=void 0===n?1:on(rs(n),0);var r=this.__filtered__&&!t?new jn(this):this.clone();return r.__filtered__?r.__takeCount__=sn(n,r.__takeCount__):r.__views__.push({size:sn(n,4294967295),type:e+(r.__dir__<0?"Right":"")}),r},jn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),st(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;jn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Ji(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),st(["head","last"],(function(e,t){var n="take"+(t?"Right":"");jn.prototype[e]=function(){return this[n](1).value()[0]}})),st(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");jn.prototype[e]=function(){return this.__filtered__?new jn(this):this[n](1)}})),jn.prototype.compact=function(){return this.filter(Ws)},jn.prototype.find=function(e){return this.filter(e).head()},jn.prototype.findLast=function(e){return this.reverse().find(e)},jn.prototype.invokeMap=Nr((function(e,t){return"function"==typeof e?new jn(this):this.map((function(n){return gr(n,e,t)}))})),jn.prototype.reject=function(e){return this.filter(_o(Ji(e)))},jn.prototype.slice=function(e,t){e=rs(e);var n=this;return n.__filtered__&&(e>0||t<0)?new jn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=rs(t))<0?n.dropRight(-t):n.take(t-e)),n)},jn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},jn.prototype.toArray=function(){return this.take(4294967295)},cr(jn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),i=Cn[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);i&&(Cn.prototype[t]=function(){var t=this.__wrapped__,o=r?[1]:arguments,s=t instanceof jn,c=o[0],u=s||Do(t),l=function(e){var t=i.apply(Cn,dt([e],o));return r&&f?t[0]:t};u&&n&&"function"==typeof c&&1!=c.length&&(s=u=!1);var f=this.__chain__,p=!!this.__actions__.length,h=a&&!f,d=s&&!p;if(!a&&u){t=d?t:new jn(this);var v=e.apply(t,o);return v.__actions__.push({func:to,args:[l],thisArg:void 0}),new In(v,f)}return h&&d?e.apply(this,o):(v=this.thru(l),h?r?v.value()[0]:v.value():v)})})),st(["pop","push","shift","sort","splice","unshift"],(function(e){var t=be[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Cn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Do(i)?i:[],e)}return this[n]((function(n){return t.apply(Do(n)?n:[],e)}))}})),cr(jn.prototype,(function(e,t){var n=Cn[t];if(n){var r=n.name+"";_e.call(bn,r)||(bn[r]=[]),bn[r].push({name:t,func:n})}})),bn[Ci(void 0,2).name]=[{name:"wrapper",func:void 0}],jn.prototype.clone=function(){var e=new jn(this.__wrapped__);return e.__actions__=mi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=mi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=mi(this.__views__),e},jn.prototype.reverse=function(){if(this.__filtered__){var e=new jn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},jn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Do(e),r=t<0,i=n?e.length:0,a=function(e,t,n){var r=-1,i=n.length;for(;++r<i;){var a=n[r],o=a.size;switch(a.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=sn(t,e+o);break;case"takeRight":e=on(e,t-o)}}return{start:e,end:t}}(0,i,this.__views__),o=a.start,s=a.end,c=s-o,u=r?s:o-1,l=this.__iteratees__,f=l.length,p=0,h=sn(c,this.__takeCount__);if(!n||!r&&i==c&&h==c)return ni(e,this.__actions__);var d=[];e:for(;c--&&p<h;){for(var v=-1,y=e[u+=t];++v<f;){var m=l[v],g=m.iteratee,b=m.type,w=g(y);if(2==b)y=w;else if(!w){if(1==b)continue e;break e}}d[p++]=y}return d},Cn.prototype.at=no,Cn.prototype.chain=function(){return eo(this)},Cn.prototype.commit=function(){return new In(this.value(),this.__chain__)},Cn.prototype.next=function(){void 0===this.__values__&&(this.__values__=ts(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},Cn.prototype.plant=function(e){for(var t,n=this;n instanceof An;){var r=Oa(n);r.__index__=0,r.__values__=void 0,t?i.__wrapped__=r:t=r;var i=r;n=n.__wrapped__}return i.__wrapped__=e,t},Cn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof jn){var t=e;return this.__actions__.length&&(t=new jn(this)),(t=t.reverse()).__actions__.push({func:to,args:[Va],thisArg:void 0}),new In(t,this.__chain__)}return this.thru(Va)},Cn.prototype.toJSON=Cn.prototype.valueOf=Cn.prototype.value=function(){return ni(this.__wrapped__,this.__actions__)},Cn.prototype.first=Cn.prototype.head,Ze&&(Cn.prototype[Ze]=function(){return this}),Cn}();qe._=Gt,void 0===(i=function(){return Gt}.call(t,n,t,r))||(r.exports=i)}).call(this)}).call(this,n(39),n(32)(e))},function(e,t){var n=Array.isArray;e.exports=n},function(e,t,n){var r=n(98),i=n(103);e.exports=function(e,t){var n=i(e,t);return r(n)?n:void 0}},function(e,t,n){var r=n(20),i=n(99),a=n(100),o=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":o&&o in Object(e)?i(e):a(e)}},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},function(e,t,n){var r=n(91)(n(105));e.exports=r},function(e,t,n){var r=n(13).Symbol;e.exports=r},function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t,n){var r=n(116),i=n(117),a=n(118),o=n(119),s=n(120);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,e.exports=c},function(e,t,n){var r=n(46);e.exports=function(e,t){for(var n=e.length;n--;)if(r(e[n][0],t))return n;return-1}},function(e,t,n){var r=n(16)(Object,"create");e.exports=r},function(e,t,n){var r=n(134);e.exports=function(e,t){var n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.map}},function(e,t,n){var r=n(17),i=n(18);e.exports=function(e){return"symbol"==typeof e||i(e)&&"[object Symbol]"==r(e)}},function(e,t,n){var r=n(26);e.exports=function(e){if("string"==typeof e||r(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}},function(e,t){e.exports=function(e){return e}},function(e,t,n){var r=n(16)(n(13),"Map");e.exports=r},function(e,t,n){var r=n(126),i=n(133),a=n(135),o=n(136),s=n(137);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,e.exports=c},function(e,t,n){var r=n(155),i=n(161),a=n(53);e.exports=function(e){return a(e)?r(e):i(e)}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},function(e,t,n){var r=n(15),i=n(26),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,o=/^\w*$/;e.exports=function(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!i(e))||(o.test(e)||!a.test(e)||null!=t&&e in Object(t))}},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t,n){var r;window,r=function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}n.r(t);var i=function(){function e(t){var n,r,i,a=this,o=t.title,s=t.text,c=t.buttons;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i=function(e){if("Enter"===e.key){var t=a.primaryButton();t.action&&t.action(),a.dismiss()}},(r="keyupListener")in(n=this)?Object.defineProperty(n,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[r]=i,this.title=o,this.text=s,this.buttons=c}var t,n,i;return t=e,(n=[{key:"buttonsString",value:function(){var e=this.buttons.map((function(e,t){return function(e,t){return"\n <div id='button-".concat(t,"' class='sk-button ").concat(e.style,"'>\n <div class='sk-label'>").concat(e.text,"</div>\n </div>\n ")}(e,t)})).join("");return"\n <div class='sk-button-group'>\n ".concat(e,"\n </div>\n ")}},{key:"templateString",value:function(){var e=this.buttonsString(),t=this.title?"<div class='sk-h3 sk-panel-section-title'>".concat(this.title,"</div>"):"",n=this.text?"<p class='sk-p'>".concat(this.text,"</p>"):"";return'\n <div class="sk-modal">\n <div class="sk-modal-background"></div>\n <div class="sk-modal-content">\n <div class="sn-component">\n <div class="sk-panel" style=\'max-width: 500px;\'>\n <div class="sk-panel-content">\n <div class="sk-panel-section">\n '.concat(t,'\n\n <div class="sk-panel-row">\n ').concat(n,"\n </div>\n\n <div class=\"sk-panel-row\" style='margin-top: 8px;'>\n ").concat(e,"\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n ")}},{key:"dismiss",value:function(){this.onElement.removeChild(this.element),document.removeEventListener("keyup",this.keyupListener)}},{key:"primaryButton",value:function(){var e=this.buttons.find((function(e){return!0===e.primary}));return e||(e=this.buttons[this.buttons.length-1]),e}},{key:"present",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.onElement;n||(n=document.body),this.onElement=n,this.element=document.createElement("div"),this.element.className="sn-component",this.element.innerHTML=this.templateString().trim(),document.addEventListener("keyup",this.keyupListener),this.buttons.forEach((function(t,n){e.element.querySelector("#button-".concat(n)).onclick=function(){t.action&&t.action(),e.dismiss()}})),n.appendChild(this.element)}}])&&r(t.prototype,n),i&&r(t,i),e}();n.d(t,"SKAlert",(function(){return i}))}])},e.exports=r()},function(e,t,n){var r=n(17),i=n(21);e.exports=function(e){if(!i(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,n(39))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){var n=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return n.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}},function(e,t){e.exports=function(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}},function(e,t){e.exports=function(e){return function(t){return e(t)}}},function(e,t,n){var r=n(114),i=n(171),a=n(28),o=n(15),s=n(181);e.exports=function(e){return"function"==typeof e?e:null==e?a:"object"==typeof e?o(e)?i(e[0],e[1]):r(e):s(e)}},function(e,t,n){var r=n(22),i=n(121),a=n(122),o=n(123),s=n(124),c=n(125);function u(e){var t=this.__data__=new r(e);this.size=t.size}u.prototype.clear=i,u.prototype.delete=a,u.prototype.get=o,u.prototype.has=s,u.prototype.set=c,e.exports=u},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,n){var r=n(138),i=n(18);e.exports=function e(t,n,a,o,s){return t===n||(null==t||null==n||!i(t)&&!i(n)?t!=t&&n!=n:r(t,n,a,o,e,s))}},function(e,t,n){var r=n(139),i=n(142),a=n(143);e.exports=function(e,t,n,o,s,c){var u=1&n,l=e.length,f=t.length;if(l!=f&&!(u&&f>l))return!1;var p=c.get(e);if(p&&c.get(t))return p==t;var h=-1,d=!0,v=2&n?new r:void 0;for(c.set(e,t),c.set(t,e);++h<l;){var y=e[h],m=t[h];if(o)var g=u?o(m,y,h,t,e,c):o(y,m,h,e,t,c);if(void 0!==g){if(g)continue;d=!1;break}if(v){if(!i(t,(function(e,t){if(!a(v,t)&&(y===e||s(y,e,n,o,c)))return v.push(t)}))){d=!1;break}}else if(y!==m&&!s(y,m,n,o,c)){d=!1;break}}return c.delete(e),c.delete(t),d}},function(e,t,n){var r=n(157),i=n(18),a=Object.prototype,o=a.hasOwnProperty,s=a.propertyIsEnumerable,c=r(function(){return arguments}())?r:function(e){return i(e)&&o.call(e,"callee")&&!s.call(e,"callee")};e.exports=c},function(e,t,n){(function(e){var r=n(13),i=n(158),a=t&&!t.nodeType&&t,o=a&&"object"==typeof e&&e&&!e.nodeType&&e,s=o&&o.exports===a?r.Buffer:void 0,c=(s?s.isBuffer:void 0)||i;e.exports=c}).call(this,n(32)(e))},function(e,t){var n=/^(?:0|[1-9]\d*)$/;e.exports=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&n.test(e))&&e>-1&&e%1==0&&e<t}},function(e,t,n){var r=n(159),i=n(43),a=n(160),o=a&&a.isTypedArray,s=o?i(o):r;e.exports=s},function(e,t,n){var r=n(37),i=n(33);e.exports=function(e){return null!=e&&i(e.length)&&!r(e)}},function(e,t,n){var r=n(21);e.exports=function(e){return e==e&&!r(e)}},function(e,t){e.exports=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}},function(e,t,n){var r=n(57),i=n(27);e.exports=function(e,t){for(var n=0,a=(t=r(t,e)).length;null!=e&&n<a;)e=e[i(t[n++])];return n&&n==a?e:void 0}},function(e,t,n){var r=n(15),i=n(34),a=n(173),o=n(176);e.exports=function(e,t){return r(e)?e:i(e,t)?[e]:a(o(e))}},function(e,t,n){var r=n(113)(n(184));e.exports=r},function(e,t,n){var r=n(188);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(190);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(191);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(192);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(193);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(194);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(195);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(196);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(197);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(198);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(199);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(200);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(201);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(202);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(203);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(204);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(205);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(206);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(207);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(208);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(209);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(210);e.exports=(r.default||r).apply(r,[])},function(e,t,n){},function(e,t,n){},function(e,t){
/**
* @license AngularJS v1.7.9
* (c) 2010-2018 Google, Inc. http://angularjs.org
* License: MIT
*/
!function(e){"use strict";var t={objectMaxDepth:5,urlErrorParamsEnabled:!0};function n(e){if(!F(e))return t;N(e.objectMaxDepth)&&(t.objectMaxDepth=r(e.objectMaxDepth)?e.objectMaxDepth:NaN),N(e.urlErrorParamsEnabled)&&J(e.urlErrorParamsEnabled)&&(t.urlErrorParamsEnabled=e.urlErrorParamsEnabled)}function r(e){return V(e)&&e>0}function i(e,n){n=n||Error;var r="https://errors.angularjs.org/1.7.9/",i=r.replace(".","\\.")+"[\\s\\S]*",a=new RegExp(i,"g");return function(){var i,o,s=arguments[0],c=arguments[1],u="["+(e?e+":":"")+s+"] ",l=fe(arguments,2).map((function(e){return Ve(e,t.objectMaxDepth)}));if(u+=c.replace(/\{\d+\}/g,(function(e){var t=+e.slice(1,-1);return t<l.length?l[t].replace(a,""):e})),u+="\n"+r+(e?e+"/":"")+s,t.urlErrorParamsEnabled)for(o=0,i="?";o<l.length;o++,i="&")u+=i+"p"+o+"="+encodeURIComponent(l[o]);return new n(u)}}var a,o,s,c,u=/^\/(.+)\/([a-z]*)$/,l=Object.prototype.hasOwnProperty,f=function(e){return K(e)?e.toLowerCase():e},p=function(e){return K(e)?e.toUpperCase():e},h=[].slice,d=[].splice,v=[].push,y=Object.prototype.toString,m=Object.getPrototypeOf,g=i("ng"),b=e.angular||(e.angular={}),w=0;function k(e){if(null==e||G(e))return!1;if(H(e)||K(e)||o&&e instanceof o)return!0;var t="length"in Object(e)&&e.length;return V(t)&&(t>=0&&t-1 in e||"function"==typeof e.item)}function x(e,t,n){var r,i;if(e)if(W(e))for(r in e)"prototype"!==r&&"length"!==r&&"name"!==r&&e.hasOwnProperty(r)&&t.call(n,e[r],r,e);else if(H(e)||k(e)){var a="object"!=typeof e;for(r=0,i=e.length;r<i;r++)(a||r in e)&&t.call(n,e[r],r,e)}else if(e.forEach&&e.forEach!==x)e.forEach(t,n,e);else if(U(e))for(r in e)t.call(n,e[r],r,e);else if("function"==typeof e.hasOwnProperty)for(r in e)e.hasOwnProperty(r)&&t.call(n,e[r],r,e);else for(r in e)l.call(e,r)&&t.call(n,e[r],r,e);return e}function S(e,t,n){for(var r=Object.keys(e).sort(),i=0;i<r.length;i++)t.call(n,e[r[i]],r[i]);return r}function _(e){return function(t,n){e(n,t)}}function $(){return++w}function P(e,t){t?e.$$hashKey=t:delete e.$$hashKey}function O(e,t,n){for(var r=e.$$hashKey,i=0,a=t.length;i<a;++i){var o=t[i];if(F(o)||W(o))for(var s=Object.keys(o),c=0,u=s.length;c<u;c++){var l=s[c],f=o[l];n&&F(f)?B(f)?e[l]=new Date(f.valueOf()):q(f)?e[l]=new RegExp(f):f.nodeName?e[l]=f.cloneNode(!0):te(f)?e[l]=f.clone():"__proto__"!==l&&(F(e[l])||(e[l]=H(f)?[]:{}),O(e[l],[f],!0)):e[l]=f}}return P(e,r),e}function C(e){return O(e,h.call(arguments,1),!1)}function E(e){return O(e,h.call(arguments,1),!0)}function A(e){return parseInt(e,10)}a=e.document.documentMode;var I=Number.isNaN||function(e){return e!=e};function j(e,t){return C(Object.create(e),t)}function D(){}function M(e){return e}function T(e){return function(){return e}}function R(e){return W(e.toString)&&e.toString!==y}function L(e){return void 0===e}function N(e){return void 0!==e}function F(e){return null!==e&&"object"==typeof e}function U(e){return null!==e&&"object"==typeof e&&!m(e)}function K(e){return"string"==typeof e}function V(e){return"number"==typeof e}function B(e){return"[object Date]"===y.call(e)}function H(e){return Array.isArray(e)||e instanceof Array}function z(e){switch(y.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return e instanceof Error}}function W(e){return"function"==typeof e}function q(e){return"[object RegExp]"===y.call(e)}function G(e){return e&&e.window===e}function Y(e){return e&&e.$evalAsync&&e.$watch}function J(e){return"boolean"==typeof e}function Q(e){return e&&W(e.then)}D.$inject=[],M.$inject=[];var Z=/^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array]$/;var X=function(e){return K(e)?e.trim():e},ee=function(e){return e.replace(/([-()[\]{}+?*.$^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08")};function te(e){return!(!e||!(e.nodeName||e.prop&&e.attr&&e.find))}function ne(e){return f(e.nodeName||e[0]&&e[0].nodeName)}function re(e,t){return-1!==Array.prototype.indexOf.call(e,t)}function ie(e,t){var n=e.indexOf(t);return n>=0&&e.splice(n,1),n}function ae(e,t,n){var i,a,o=[],s=[];if(n=r(n)?n:NaN,t){if((a=t)&&V(a.length)&&Z.test(y.call(a))||(i=t,"[object ArrayBuffer]"===y.call(i)))throw g("cpta","Can't copy! TypedArray destination cannot be mutated.");if(e===t)throw g("cpi","Can't copy! Source and destination are identical.");return H(t)?t.length=0:x(t,(function(e,n){"$$hashKey"!==n&&delete t[n]})),o.push(e),s.push(t),c(e,t,n)}return u(e,n);function c(e,t,n){if(--n<0)return"...";var r,i=t.$$hashKey;if(H(e))for(var a=0,o=e.length;a<o;a++)t.push(u(e[a],n));else if(U(e))for(r in e)t[r]=u(e[r],n);else if(e&&"function"==typeof e.hasOwnProperty)for(r in e)e.hasOwnProperty(r)&&(t[r]=u(e[r],n));else for(r in e)l.call(e,r)&&(t[r]=u(e[r],n));return P(t,i),t}function u(e,t){if(!F(e))return e;var n=o.indexOf(e);if(-1!==n)return s[n];if(G(e)||Y(e))throw g("cpws","Can't copy! Making copies of Window or Scope instances is not supported.");var r=!1,i=function(e){switch(y.call(e)){case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Float32Array]":case"[object Float64Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return new e.constructor(u(e.buffer),e.byteOffset,e.length);case"[object ArrayBuffer]":if(!e.slice){var t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(new Uint8Array(e)),t}return e.slice(0);case"[object Boolean]":case"[object Number]":case"[object String]":case"[object Date]":return new e.constructor(e.valueOf());case"[object RegExp]":var n=new RegExp(e.source,e.toString().match(/[^/]*$/)[0]);return n.lastIndex=e.lastIndex,n;case"[object Blob]":return new e.constructor([e],{type:e.type})}if(W(e.cloneNode))return e.cloneNode(!0)}(e);return void 0===i&&(i=H(e)?[]:Object.create(m(e)),r=!0),o.push(e),s.push(i),r?c(e,i,t):i}}function oe(e,t){return e===t||e!=e&&t!=t}function se(e,t){if(e===t)return!0;if(null===e||null===t)return!1;if(e!=e&&t!=t)return!0;var n,r,i,a=typeof e;if(a===typeof t&&"object"===a){if(!H(e)){if(B(e))return!!B(t)&&oe(e.getTime(),t.getTime());if(q(e))return!!q(t)&&e.toString()===t.toString();if(Y(e)||Y(t)||G(e)||G(t)||H(t)||B(t)||q(t))return!1;for(r in i=Ne(),e)if("$"!==r.charAt(0)&&!W(e[r])){if(!se(e[r],t[r]))return!1;i[r]=!0}for(r in t)if(!(r in i)&&"$"!==r.charAt(0)&&N(t[r])&&!W(t[r]))return!1;return!0}if(!H(t))return!1;if((n=e.length)===t.length){for(r=0;r<n;r++)if(!se(e[r],t[r]))return!1;return!0}}return!1}var ce=function(){if(!N(ce.rules)){var t=e.document.querySelector("[ng-csp]")||e.document.querySelector("[data-ng-csp]");if(t){var n=t.getAttribute("ng-csp")||t.getAttribute("data-ng-csp");ce.rules={noUnsafeEval:!n||-1!==n.indexOf("no-unsafe-eval"),noInlineStyle:!n||-1!==n.indexOf("no-inline-style")}}else ce.rules={noUnsafeEval:function(){try{return new Function(""),!1}catch(e){return!0}}(),noInlineStyle:!1}}return ce.rules},ue=function(){if(N(ue.name_))return ue.name_;var t,n,r,i,a=$e.length;for(n=0;n<a;++n)if(r=$e[n],t=e.document.querySelector("["+r.replace(":","\\:")+"jq]")){i=t.getAttribute(r+"jq");break}return ue.name_=i};function le(e,t,n){return e.concat(h.call(t,n))}function fe(e,t){return h.call(e,t||0)}function pe(e,t){var n=arguments.length>2?fe(arguments,2):[];return!W(t)||t instanceof RegExp?t:n.length?function(){return arguments.length?t.apply(e,le(n,arguments,0)):t.apply(e,n)}:function(){return arguments.length?t.apply(e,arguments):t.call(e)}}function he(t,n){var r=n;return"string"==typeof t&&"$"===t.charAt(0)&&"$"===t.charAt(1)?r=void 0:G(n)?r="$WINDOW":n&&e.document===n?r="$DOCUMENT":Y(n)&&(r="$SCOPE"),r}function de(e,t){if(!L(e))return V(t)||(t=t?2:null),JSON.stringify(e,he,t)}function ve(e){return K(e)?JSON.parse(e):e}var ye=/:/g;function me(e,t){e=e.replace(ye,"");var n=Date.parse("Jan 01, 1970 00:00:00 "+e)/6e4;return I(n)?t:n}function ge(e,t){return(e=new Date(e.getTime())).setMinutes(e.getMinutes()+t),e}function be(e,t,n){n=n?-1:1;var r=e.getTimezoneOffset();return ge(e,n*(me(t,r)-r))}function we(e){e=o(e).clone().empty();var t=o("<div></div>").append(e).html();try{return e[0].nodeType===Ue?f(t):t.match(/^(<[^>]+>)/)[1].replace(/^<([\w-]+)/,(function(e,t){return"<"+f(t)}))}catch(e){return f(t)}}function ke(e){try{return decodeURIComponent(e)}catch(e){}}function xe(e){var t={};return x((e||"").split("&"),(function(e){var n,r,i;e&&(r=e=e.replace(/\+/g,"%20"),-1!==(n=e.indexOf("="))&&(r=e.substring(0,n),i=e.substring(n+1)),N(r=ke(r))&&(i=!N(i)||ke(i),l.call(t,r)?H(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i))})),t}function Se(e){return _e(e,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function _e(e,t){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,t?"%20":"+")}var $e=["ng-","data-ng-","ng:","x-ng-"];var Pe=function(t){var n=t.currentScript;if(!n)return!0;if(!(n instanceof e.HTMLScriptElement||n instanceof e.SVGScriptElement))return!1;var r=n.attributes;return[r.getNamedItem("src"),r.getNamedItem("href"),r.getNamedItem("xlink:href")].every((function(e){if(!e)return!0;if(!e.value)return!1;var n=t.createElement("a");if(n.href=e.value,t.location.origin===n.origin)return!0;switch(n.protocol){case"http:":case"https:":case"ftp:":case"blob:":case"file:":case"data:":return!0;default:return!1}}))}(e.document);function Oe(t,n){var r,i,a={};if(x($e,(function(e){var n=e+"app";!r&&t.hasAttribute&&t.hasAttribute(n)&&(r=t,i=t.getAttribute(n))})),x($e,(function(e){var n,a=e+"app";!r&&(n=t.querySelector("["+a.replace(":","\\:")+"]"))&&(r=n,i=n.getAttribute(a))})),r){if(!Pe)return void e.console.error("AngularJS: disabling automatic bootstrap. <script> protocol indicates an extension, document.location.href does not match.");a.strictDi=null!==function(e,t){var n,r,i=$e.length;for(r=0;r<i;++r)if(n=$e[r]+t,K(n=e.getAttribute(n)))return n;return null}(r,"strict-di"),n(r,i?[i]:[],a)}}function Ce(t,n,r){F(r)||(r={});r=C({strictDi:!1},r);var i=function(){if((t=o(t)).injector()){var i=t[0]===e.document?"document":we(t);throw g("btstrpd","App already bootstrapped with this element '{0}'",i.replace(/</,"&lt;").replace(/>/,"&gt;"))}(n=n||[]).unshift(["$provide",function(e){e.value("$rootElement",t)}]),r.debugInfoEnabled&&n.push(["$compileProvider",function(e){e.debugInfoEnabled(!0)}]),n.unshift("ng");var a=Wt(n,r.strictDi);return a.invoke(["$rootScope","$rootElement","$compile","$injector",function(e,t,n,r){e.$apply((function(){t.data("$injector",r),n(t)(e)}))}]),a},a=/^NG_ENABLE_DEBUG_INFO!/,s=/^NG_DEFER_BOOTSTRAP!/;if(e&&a.test(e.name)&&(r.debugInfoEnabled=!0,e.name=e.name.replace(a,"")),e&&!s.test(e.name))return i();e.name=e.name.replace(s,""),b.resumeBootstrap=function(e){return x(e,(function(e){n.push(e)})),i()},W(b.resumeDeferredBootstrap)&&b.resumeDeferredBootstrap()}function Ee(){e.name="NG_ENABLE_DEBUG_INFO!"+e.name,e.location.reload()}function Ae(e){var t=b.element(e).injector();if(!t)throw g("test","no injector found for element argument to getTestability");return t.get("$$testability")}var Ie=/[A-Z]/g;function je(e,t){return t=t||"_",e.replace(Ie,(function(e,n){return(n?t:"")+e.toLowerCase()}))}var De=!1;function Me(e,t,n){if(!e)throw g("areq","Argument '{0}' is {1}",t||"?",n||"required");return e}function Te(e,t,n){return n&&H(e)&&(e=e[e.length-1]),Me(W(e),t,"not a function, got "+(e&&"object"==typeof e?e.constructor.name||"Object":typeof e)),e}function Re(e,t){if("hasOwnProperty"===e)throw g("badname","hasOwnProperty is not a valid {0} name",t)}function Le(e){for(var t,n=e[0],r=e[e.length-1],i=1;n!==r&&(n=n.nextSibling);i++)(t||e[i]!==n)&&(t||(t=o(h.call(e,0,i))),t.push(n));return t||e}function Ne(){return Object.create(null)}function Fe(e){if(null==e)return"";switch(typeof e){case"string":break;case"number":e=""+e;break;default:e=!R(e)||H(e)||B(e)?de(e):e.toString()}return e}var Ue=3;function Ke(e,t){if(H(e)){t=t||[];for(var n=0,r=e.length;n<r;n++)t[n]=e[n]}else if(F(e))for(var i in t=t||{},e)"$"===i.charAt(0)&&"$"===i.charAt(1)||(t[i]=e[i]);return t||e}function Ve(e,t){return"function"==typeof e?e.toString().replace(/ \{[\s\S]*$/,""):L(e)?"undefined":"string"!=typeof e?function(e,t){var n=[];return r(t)&&(e=b.copy(e,null,t)),JSON.stringify(e,(function(e,t){if(F(t=he(e,t))){if(n.indexOf(t)>=0)return"...";n.push(t)}return t}))}(e,t):e}var Be={full:"1.7.9",major:1,minor:7,dot:9,codeName:"pollution-eradication"};st.expando="ng339";var He=st.cache={},ze=1;st._data=function(e){return this.cache[e[this.expando]]||{}};var We=/-([a-z])/g,qe=/^-ms-/,Ge={mouseleave:"mouseout",mouseenter:"mouseover"},Ye=i("jqLite");function Je(e,t){return t.toUpperCase()}function Qe(e){return e.replace(We,Je)}var Ze=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,Xe=/<|&#?\w+;/,et=/<([\w:-]+)/,tt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,nt={option:[1,'<select multiple="multiple">',"</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function rt(e){return!Xe.test(e)}function it(e){var t=e.nodeType;return 1===t||!t||9===t}function at(e,t){var n,r,i,a,o=t.createDocumentFragment(),s=[];if(rt(e))s.push(t.createTextNode(e));else{for(n=o.appendChild(t.createElement("div")),r=(et.exec(e)||["",""])[1].toLowerCase(),i=nt[r]||nt._default,n.innerHTML=i[1]+e.replace(tt,"<$1></$2>")+i[2],a=i[0];a--;)n=n.lastChild;s=le(s,n.childNodes),(n=o.firstChild).textContent=""}return o.textContent="",o.innerHTML="",x(s,(function(e){o.appendChild(e)})),o}nt.optgroup=nt.option,nt.tbody=nt.tfoot=nt.colgroup=nt.caption=nt.thead,nt.th=nt.td;var ot=e.Node.prototype.contains||function(e){return!!(16&this.compareDocumentPosition(e))};function st(t){if(t instanceof st)return t;var n,r,i,a;if(K(t)&&(t=X(t),n=!0),!(this instanceof st)){if(n&&"<"!==t.charAt(0))throw Ye("nosel","Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element");return new st(t)}n?bt(this,(r=t,i=i||e.document,(a=Ze.exec(r))?[i.createElement(a[1])]:(a=at(r,i))?a.childNodes:[])):W(t)?_t(t):bt(this,t)}function ct(e){return e.cloneNode(!0)}function ut(e,t){!t&&it(e)&&o.cleanData([e]),e.querySelectorAll&&o.cleanData(e.querySelectorAll("*"))}function lt(e){var t;for(t in e)return!1;return!0}function ft(e){var t=e.ng339,n=t&&He[t],r=n&&n.events,i=n&&n.data;i&&!lt(i)||r&&!lt(r)||(delete He[t],e.ng339=void 0)}function pt(e,t,n,r){if(N(r))throw Ye("offargs","jqLite#off() does not support the `selector` argument");var i=dt(e),a=i&&i.events,o=i&&i.handle;if(o){if(t){var s=function(t){var r=a[t];N(n)&&ie(r||[],n),N(n)&&r&&r.length>0||(e.removeEventListener(t,o),delete a[t])};x(t.split(" "),(function(e){s(e),Ge[e]&&s(Ge[e])}))}else for(t in a)"$destroy"!==t&&e.removeEventListener(t,o),delete a[t];ft(e)}}function ht(e,t){var n=e.ng339,r=n&&He[n];r&&(t?delete r.data[t]:r.data={},ft(e))}function dt(e,t){var n=e.ng339,r=n&&He[n];return t&&!r&&(e.ng339=n=++ze,r=He[n]={events:{},data:{},handle:void 0}),r}function vt(e,t,n){if(it(e)){var r,i=N(n),a=!i&&t&&!F(t),o=!t,s=dt(e,!a),c=s&&s.data;if(i)c[Qe(t)]=n;else{if(o)return c;if(a)return c&&c[Qe(t)];for(r in t)c[Qe(r)]=t[r]}}}function yt(e,t){return!!e.getAttribute&&(" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").indexOf(" "+t+" ")>-1}function mt(e,t){if(t&&e.setAttribute){var n=(" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," "),r=n;x(t.split(" "),(function(e){e=X(e),r=r.replace(" "+e+" "," ")})),r!==n&&e.setAttribute("class",X(r))}}function gt(e,t){if(t&&e.setAttribute){var n=(" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," "),r=n;x(t.split(" "),(function(e){e=X(e),-1===r.indexOf(" "+e+" ")&&(r+=e+" ")})),r!==n&&e.setAttribute("class",X(r))}}function bt(e,t){if(t)if(t.nodeType)e[e.length++]=t;else{var n=t.length;if("number"==typeof n&&t.window!==t){if(n)for(var r=0;r<n;r++)e[e.length++]=t[r]}else e[e.length++]=t}}function wt(e,t){return kt(e,"$"+(t||"ngController")+"Controller")}function kt(e,t,n){9===e.nodeType&&(e=e.documentElement);for(var r=H(t)?t:[t];e;){for(var i=0,a=r.length;i<a;i++)if(N(n=o.data(e,r[i])))return n;e=e.parentNode||11===e.nodeType&&e.host}}function xt(e){for(ut(e,!0);e.firstChild;)e.removeChild(e.firstChild)}function St(e,t){t||ut(e);var n=e.parentNode;n&&n.removeChild(e)}function _t(t){function n(){e.document.removeEventListener("DOMContentLoaded",n),e.removeEventListener("load",n),t()}"complete"===e.document.readyState?e.setTimeout(t):(e.document.addEventListener("DOMContentLoaded",n),e.addEventListener("load",n))}var $t=st.prototype={ready:_t,toString:function(){var e=[];return x(this,(function(t){e.push(""+t)})),"["+e.join(", ")+"]"},eq:function(e){return o(e>=0?this[e]:this[this.length+e])},length:0,push:v,sort:[].sort,splice:[].splice},Pt={};x("multiple,selected,checked,disabled,readOnly,required,open".split(","),(function(e){Pt[f(e)]=e}));var Ot={};x("input,select,option,textarea,button,form,details".split(","),(function(e){Ot[e]=!0}));var Ct={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max",ngPattern:"pattern",ngStep:"step"};function Et(e,t){var n=Pt[t.toLowerCase()];return n&&Ot[ne(e)]&&n}function At(e,t,n){n.call(e,t)}function It(e,t,n){var r=t.relatedTarget;r&&(r===e||ot.call(e,r))||n.call(e,t)}function jt(){this.$get=function(){return C(st,{hasClass:function(e,t){return e.attr&&(e=e[0]),yt(e,t)},addClass:function(e,t){return e.attr&&(e=e[0]),gt(e,t)},removeClass:function(e,t){return e.attr&&(e=e[0]),mt(e,t)}})}}function Dt(e,t){var n=e&&e.$$hashKey;if(n)return"function"==typeof n&&(n=e.$$hashKey()),n;var r=typeof e;return n="function"===r||"object"===r&&null!==e?e.$$hashKey=r+":"+(t||$)():r+":"+e}x({data:vt,removeData:ht,hasData:function(e){for(var t in He[e.ng339])return!0;return!1},cleanData:function(e){for(var t=0,n=e.length;t<n;t++)ht(e[t]),pt(e[t])}},(function(e,t){st[t]=e})),x({data:vt,inheritedData:kt,scope:function(e){return o.data(e,"$scope")||kt(e.parentNode||e,["$isolateScope","$scope"])},isolateScope:function(e){return o.data(e,"$isolateScope")||o.data(e,"$isolateScopeNoTemplate")},controller:wt,injector:function(e){return kt(e,"$injector")},removeAttr:function(e,t){e.removeAttribute(t)},hasClass:yt,css:function(e,t,n){if(t=function(e){return Qe(e.replace(qe,"ms-"))}(t),!N(n))return e.style[t];e.style[t]=n},attr:function(e,t,n){var r,i=e.nodeType;if(i!==Ue&&2!==i&&8!==i&&e.getAttribute){var a=f(t),o=Pt[a];if(!N(n))return r=e.getAttribute(t),o&&null!==r&&(r=a),null===r?void 0:r;null===n||!1===n&&o?e.removeAttribute(t):e.setAttribute(t,o?a:n)}},prop:function(e,t,n){if(!N(n))return e[t];e[t]=n},text:function(){return e.$dv="",e;function e(e,t){if(L(t)){var n=e.nodeType;return 1===n||n===Ue?e.textContent:""}e.textContent=t}}(),val:function(e,t){if(L(t)){if(e.multiple&&"select"===ne(e)){var n=[];return x(e.options,(function(e){e.selected&&n.push(e.value||e.text)})),n}return e.value}e.value=t},html:function(e,t){if(L(t))return e.innerHTML;ut(e,!0),e.innerHTML=t},empty:xt},(function(e,t){st.prototype[t]=function(t,n){var r,i,a=this.length;if(e!==xt&&L(2===e.length&&e!==yt&&e!==wt?t:n)){if(F(t)){for(r=0;r<a;r++)if(e===vt)e(this[r],t);else for(i in t)e(this[r],i,t[i]);return this}for(var o=e.$dv,s=L(o)?Math.min(a,1):a,c=0;c<s;c++){var u=e(this[c],t,n);o=o?o+u:u}return o}for(r=0;r<a;r++)e(this[r],t,n);return this}})),x({removeData:ht,on:function(e,t,n,r){if(N(r))throw Ye("onargs","jqLite#on() does not support the `selector` or `eventData` parameters");if(it(e)){var i=dt(e,!0),a=i.events,o=i.handle;o||(o=i.handle=function(e,t){var n=function(n,r){n.isDefaultPrevented=function(){return n.defaultPrevented};var i=t[r||n.type],a=i?i.length:0;if(a){if(L(n.immediatePropagationStopped)){var o=n.stopImmediatePropagation;n.stopImmediatePropagation=function(){n.immediatePropagationStopped=!0,n.stopPropagation&&n.stopPropagation(),o&&o.call(n)}}n.isImmediatePropagationStopped=function(){return!0===n.immediatePropagationStopped};var s=i.specialHandlerWrapper||At;a>1&&(i=Ke(i));for(var c=0;c<a;c++)n.isImmediatePropagationStopped()||s(e,n,i[c])}};return n.elem=e,n}(e,a));for(var s=t.indexOf(" ")>=0?t.split(" "):[t],c=s.length,u=function(t,r,i){var s=a[t];s||((s=a[t]=[]).specialHandlerWrapper=r,"$destroy"===t||i||e.addEventListener(t,o)),s.push(n)};c--;)t=s[c],Ge[t]?(u(Ge[t],It),u(t,void 0,!0)):u(t)}},off:pt,one:function(e,t,n){(e=o(e)).on(t,(function r(){e.off(t,n),e.off(t,r)})),e.on(t,n)},replaceWith:function(e,t){var n,r=e.parentNode;ut(e),x(new st(t),(function(t){n?r.insertBefore(t,n.nextSibling):r.replaceChild(t,e),n=t}))},children:function(e){var t=[];return x(e.childNodes,(function(e){1===e.nodeType&&t.push(e)})),t},contents:function(e){return e.contentDocument||e.childNodes||[]},append:function(e,t){var n=e.nodeType;if(1===n||11===n)for(var r=0,i=(t=new st(t)).length;r<i;r++){var a=t[r];e.appendChild(a)}},prepend:function(e,t){if(1===e.nodeType){var n=e.firstChild;x(new st(t),(function(t){e.insertBefore(t,n)}))}},wrap:function(e,t){var n,r,i;n=e,r=o(t).eq(0).clone()[0],(i=n.parentNode)&&i.replaceChild(r,n),r.appendChild(n)},remove:St,detach:function(e){St(e,!0)},after:function(e,t){var n=e,r=e.parentNode;if(r)for(var i=0,a=(t=new st(t)).length;i<a;i++){var o=t[i];r.insertBefore(o,n.nextSibling),n=o}},addClass:gt,removeClass:mt,toggleClass:function(e,t,n){t&&x(t.split(" "),(function(t){var r=n;L(r)&&(r=!yt(e,t)),(r?gt:mt)(e,t)}))},parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},next:function(e){return e.nextElementSibling},find:function(e,t){return e.getElementsByTagName?e.getElementsByTagName(t):[]},clone:ct,triggerHandler:function(e,t,n){var r,i,a,o=t.type||t,s=dt(e),c=s&&s.events,u=c&&c[o];u&&(r={preventDefault:function(){this.defaultPrevented=!0},isDefaultPrevented:function(){return!0===this.defaultPrevented},stopImmediatePropagation:function(){this.immediatePropagationStopped=!0},isImmediatePropagationStopped:function(){return!0===this.immediatePropagationStopped},stopPropagation:D,type:o,target:e},t.type&&(r=C(r,t)),i=Ke(u),a=n?[r].concat(n):[r],x(i,(function(t){r.isImmediatePropagationStopped()||t.apply(e,a)})))}},(function(e,t){st.prototype[t]=function(t,n,r){for(var i,a=0,s=this.length;a<s;a++)L(i)?N(i=e(this[a],t,n,r))&&(i=o(i)):bt(i,e(this[a],t,n,r));return N(i)?i:this}})),st.prototype.bind=st.prototype.on,st.prototype.unbind=st.prototype.off;var Mt=Object.create(null);function Tt(){this._keys=[],this._values=[],this._lastKey=NaN,this._lastIndex=-1}Tt.prototype={_idx:function(e){return e!==this._lastKey&&(this._lastKey=e,this._lastIndex=this._keys.indexOf(e)),this._lastIndex},_transformKey:function(e){return I(e)?Mt:e},get:function(e){e=this._transformKey(e);var t=this._idx(e);if(-1!==t)return this._values[t]},has:function(e){return e=this._transformKey(e),-1!==this._idx(e)},set:function(e,t){e=this._transformKey(e);var n=this._idx(e);-1===n&&(n=this._lastIndex=this._keys.length),this._keys[n]=e,this._values[n]=t},delete:function(e){e=this._transformKey(e);var t=this._idx(e);return-1!==t&&(this._keys.splice(t,1),this._values.splice(t,1),this._lastKey=NaN,this._lastIndex=-1,!0)}};var Rt=Tt,Lt=[function(){this.$get=[function(){return Rt}]}],Nt=/^([^(]+?)=>/,Ft=/^[^(]*\(\s*([^)]*)\)/m,Ut=/,/,Kt=/^\s*(_?)(\S+?)\1\s*$/,Vt=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,Bt=i("$injector");function Ht(e){return Function.prototype.toString.call(e)}function zt(e){var t=Ht(e).replace(Vt,"");return t.match(Nt)||t.match(Ft)}function Wt(e,t){t=!0===t;var n={},r=[],i=new Rt,o={$provide:{provider:h(d),factory:h(y),service:h((function(e,t){return y(e,["$injector",function(e){return e.instantiate(t)}])})),value:h((function(e,t){return y(e,T(t),!1)})),constant:h((function(e,t){Re(e,"constant"),o[e]=t,u[e]=t})),decorator:function(e,t){var n=s.get(e+"Provider"),r=n.$get;n.$get=function(){var e=f.invoke(r,n);return f.invoke(t,null,{$delegate:e})}}}},s=o.$injector=g(o,(function(e,t){throw b.isString(t)&&r.push(t),Bt("unpr","Unknown provider: {0}",r.join(" <- "))})),u={},l=g(u,(function(e,t){var n=s.get(e+"Provider",t);return f.invoke(n.$get,n,void 0,e)})),f=l;o.$injectorProvider={$get:T(l)},f.modules=s.modules=Ne();var p=m(e);return(f=l.get("$injector")).strictDi=t,x(p,(function(e){e&&f.invoke(e)})),f.loadNewModules=function(e){x(m(e),(function(e){e&&f.invoke(e)}))},f;function h(e){return function(t,n){if(!F(t))return e(t,n);x(t,_(e))}}function d(e,t){if(Re(e,"service"),(W(t)||H(t))&&(t=s.instantiate(t)),!t.$get)throw Bt("pget","Provider '{0}' must define $get factory method.",e);return o[e+"Provider"]=t}function v(e,t){return function(){var n=f.invoke(t,this);if(L(n))throw Bt("undef","Provider '{0}' must return a value from $get factory method.",e);return n}}function y(e,t,n){return d(e,{$get:!1!==n?v(e,t):t})}function m(e){Me(L(e)||H(e),"modulesToLoad","not an array");var t,n=[];return x(e,(function(e){if(!i.get(e)){i.set(e,!0);try{K(e)?(t=c(e),f.modules[e]=t,n=n.concat(m(t.requires)).concat(t._runBlocks),r(t._invokeQueue),r(t._configBlocks)):W(e)?n.push(s.invoke(e)):H(e)?n.push(s.invoke(e)):Te(e,"module")}catch(t){throw H(e)&&(e=e[e.length-1]),t.message&&t.stack&&-1===t.stack.indexOf(t.message)&&(t=t.message+"\n"+t.stack),Bt("modulerr","Failed to instantiate module {0} due to:\n{1}",e,t.stack||t.message||t)}}function r(e){var t,n;for(t=0,n=e.length;t<n;t++){var r=e[t],i=s.get(r[0]);i[r[1]].apply(i,r[2])}}})),n}function g(e,i){function s(t,a){if(e.hasOwnProperty(t)){if(e[t]===n)throw Bt("cdep","Circular dependency found: {0}",t+" <- "+r.join(" <- "));return e[t]}try{return r.unshift(t),e[t]=n,e[t]=i(t,a),e[t]}catch(r){throw e[t]===n&&delete e[t],r}finally{r.shift()}}function c(e,n,r){for(var i=[],a=Wt.$$annotate(e,t,r),o=0,c=a.length;o<c;o++){var u=a[o];if("string"!=typeof u)throw Bt("itkn","Incorrect injection token! Expected service name as string, got {0}",u);i.push(n&&n.hasOwnProperty(u)?n[u]:s(u,r))}return i}return{invoke:function(e,t,n,r){"string"==typeof n&&(r=n,n=null);var i=c(e,n,r);return H(e)&&(e=e[e.length-1]),function(e){if(a||"function"!=typeof e)return!1;var t=e.$$ngIsClass;return J(t)||(t=e.$$ngIsClass=/^class\b/.test(Ht(e))),t}(e)?(i.unshift(null),new(Function.prototype.bind.apply(e,i))):e.apply(t,i)},instantiate:function(e,t,n){var r=H(e)?e[e.length-1]:e,i=c(e,t,n);return i.unshift(null),new(Function.prototype.bind.apply(r,i))},get:s,annotate:Wt.$$annotate,has:function(t){return o.hasOwnProperty(t+"Provider")||e.hasOwnProperty(t)}}}}function qt(){var t=!0;this.disableAutoScrolling=function(){t=!1},this.$get=["$window","$location","$rootScope",function(n,r,i){var a=n.document;function s(e){if(e){e.scrollIntoView();var t=function(){var e=c.yOffset;if(W(e))e=e();else if(te(e)){var t=e[0];e="fixed"!==n.getComputedStyle(t).position?0:t.getBoundingClientRect().bottom}else V(e)||(e=0);return e}();if(t){var r=e.getBoundingClientRect().top;n.scrollBy(0,r-t)}}else n.scrollTo(0,0)}function c(e){var t,n,i;(e=K(e)?e:V(e)?e.toString():r.hash())?(t=a.getElementById(e))?s(t):(n=a.getElementsByName(e),i=null,Array.prototype.some.call(n,(function(e){if("a"===ne(e))return i=e,!0})),(t=i)?s(t):"top"===e&&s(null)):s(null)}return t&&i.$watch((function(){return r.hash()}),(function(t,n){var r,a;t===n&&""===t||(r=function(){i.$evalAsync(c)},"complete"===(a=a||e).document.readyState?a.setTimeout(r):o(a).on("load",r))})),c}]}Wt.$$annotate=function(e,t,n){var r,i;if("function"==typeof e){if(!(r=e.$inject)){if(r=[],e.length){if(t)throw K(n)&&n||(n=e.name||function(e){var t=zt(e);return t?"function("+(t[1]||"").replace(/[\s\r\n]+/," ")+")":"fn"}(e)),Bt("strictdi","{0} is not using explicit annotation and cannot be invoked in strict mode",n);x(zt(e)[1].split(Ut),(function(e){e.replace(Kt,(function(e,t,n){r.push(n)}))}))}e.$inject=r}}else H(e)?(Te(e[i=e.length-1],"fn"),r=e.slice(0,i)):Te(e,"fn",!0);return r};var Gt=i("$animate");function Yt(e,t){return e||t?e?t?(H(e)&&(e=e.join(" ")),H(t)&&(t=t.join(" ")),e+" "+t):e:t:""}function Jt(e){return F(e)?e:{}}var Qt=function(){this.$get=D},Zt=function(){var e=new Rt,t=[];this.$get=["$$AnimateRunner","$rootScope",function(n,r){return{enabled:D,on:D,off:D,pin:D,push:function(o,s,c,u){u&&u(),(c=c||{}).from&&o.css(c.from),c.to&&o.css(c.to),(c.addClass||c.removeClass)&&function(n,o,s){var c=e.get(n)||{},u=i(c,o,!0),l=i(c,s,!1);(u||l)&&(e.set(n,c),t.push(n),1===t.length&&r.$$postDigest(a))}(o,c.addClass,c.removeClass);var l=new n;return l.complete(),l}};function i(e,t,n){var r=!1;return t&&x(t=K(t)?t.split(" "):H(t)?t:[],(function(t){t&&(r=!0,e[t]=n)})),r}function a(){x(t,(function(t){var n=e.get(t);if(n){var r=function(e){K(e)&&(e=e.split(" "));var t=Ne();return x(e,(function(e){e.length&&(t[e]=!0)})),t}(t.attr("class")),i="",a="";x(n,(function(e,t){e!==!!r[t]&&(e?i+=(i.length?" ":"")+t:a+=(a.length?" ":"")+t)})),x(t,(function(e){i&&gt(e,i),a&&mt(e,a)})),e.delete(t)}})),t.length=0}}]},Xt=["$provide",function(e){var t=this,n=null,r=null;this.$$registeredAnimations=Object.create(null),this.register=function(n,r){if(n&&"."!==n.charAt(0))throw Gt("notcsel","Expecting class selector starting with '.' got '{0}'.",n);var i=n+"-animation";t.$$registeredAnimations[n.substr(1)]=i,e.factory(i,r)},this.customFilter=function(e){return 1===arguments.length&&(r=W(e)?e:null),r},this.classNameFilter=function(e){if(1===arguments.length&&(n=e instanceof RegExp?e:null)){var t=new RegExp("[(\\s|\\/)]ng-animate[(\\s|\\/)]");if(t.test(n.toString()))throw n=null,Gt("nongcls",'$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the "{0}" CSS class.',"ng-animate")}return n},this.$get=["$$animateQueue",function(e){function t(e,t,n){if(n){var r=function(e){for(var t=0;t<e.length;t++){var n=e[t];if(1===n.nodeType)return n}}(n);!r||r.parentNode||r.previousElementSibling||(n=null)}n?n.after(e):t.prepend(e)}return{on:e.on,off:e.off,pin:e.pin,enabled:e.enabled,cancel:function(e){e.cancel&&e.cancel()},enter:function(n,r,i,a){return r=r&&o(r),i=i&&o(i),t(n,r=r||i.parent(),i),e.push(n,"enter",Jt(a))},move:function(n,r,i,a){return r=r&&o(r),i=i&&o(i),t(n,r=r||i.parent(),i),e.push(n,"move",Jt(a))},leave:function(t,n){return e.push(t,"leave",Jt(n),(function(){t.remove()}))},addClass:function(t,n,r){return(r=Jt(r)).addClass=Yt(r.addclass,n),e.push(t,"addClass",r)},removeClass:function(t,n,r){return(r=Jt(r)).removeClass=Yt(r.removeClass,n),e.push(t,"removeClass",r)},setClass:function(t,n,r,i){return(i=Jt(i)).addClass=Yt(i.addClass,n),i.removeClass=Yt(i.removeClass,r),e.push(t,"setClass",i)},animate:function(t,n,r,i,a){return(a=Jt(a)).from=a.from?C(a.from,n):n,a.to=a.to?C(a.to,r):r,i=i||"ng-inline-animate",a.tempClasses=Yt(a.tempClasses,i),e.push(t,"animate",a)}}}]}],en=function(){this.$get=["$$rAF",function(e){var t=[];function n(n){t.push(n),t.length>1||e((function(){for(var e=0;e<t.length;e++)t[e]();t=[]}))}return function(){var e=!1;return n((function(){e=!0})),function(t){e?t():n(t)}}}]},tn=function(){this.$get=["$q","$sniffer","$$animateAsyncRun","$$isDocumentHidden","$timeout",function(e,t,n,r,i){function a(e){this.setHost(e);var t=n();this._doneCallbacks=[],this._tick=function(e){r()?function(e){i(e,0,!1)}(e):t(e)},this._state=0}return a.chain=function(e,t){var n=0;!function r(){if(n===e.length)return void t(!0);e[n]((function(e){!1!==e?(n++,r()):t(!1)}))}()},a.all=function(e,t){var n=0,r=!0;function i(i){r=r&&i,++n===e.length&&t(r)}x(e,(function(e){e.done(i)}))},a.prototype={setHost:function(e){this.host=e||{}},done:function(e){2===this._state?e():this._doneCallbacks.push(e)},progress:D,getPromise:function(){if(!this.promise){var t=this;this.promise=e((function(e,n){t.done((function(t){!1===t?n():e()}))}))}return this.promise},then:function(e,t){return this.getPromise().then(e,t)},catch:function(e){return this.getPromise().catch(e)},finally:function(e){return this.getPromise().finally(e)},pause:function(){this.host.pause&&this.host.pause()},resume:function(){this.host.resume&&this.host.resume()},end:function(){this.host.end&&this.host.end(),this._resolve(!0)},cancel:function(){this.host.cancel&&this.host.cancel(),this._resolve(!1)},complete:function(e){var t=this;0===t._state&&(t._state=1,t._tick((function(){t._resolve(e)})))},_resolve:function(e){2!==this._state&&(x(this._doneCallbacks,(function(t){t(e)})),this._doneCallbacks.length=0,this._state=2)}},a}]},nn=function(){this.$get=["$$rAF","$q","$$AnimateRunner",function(e,t,n){return function(t,r){var i=r||{};i.$$prepared||(i=ae(i)),i.cleanupStyles&&(i.from=i.to=null),i.from&&(t.css(i.from),i.from=null);var a,o=new n;return{start:s,end:s};function s(){return e((function(){!function(){i.addClass&&(t.addClass(i.addClass),i.addClass=null);i.removeClass&&(t.removeClass(i.removeClass),i.removeClass=null);i.to&&(t.css(i.to),i.to=null)}(),a||o.complete(),a=!0})),o}}}]};function rn(e,t,n,r,i){var a=this,s=e.location,c=e.history,u=e.setTimeout,l=e.clearTimeout,f={},p=i(n);a.isMock=!1,a.$$completeOutstandingRequest=p.completeTask,a.$$incOutstandingRequestCount=p.incTaskCount,a.notifyWhenNoOutstandingRequests=p.notifyWhenNoPendingTasks;var h,d,v=s.href,y=t.find("base"),m=null,g=r.history?function(){try{return c.state}catch(e){}}:D;_(),a.url=function(t,n,i){if(L(i)&&(i=null),s!==e.location&&(s=e.location),c!==e.history&&(c=e.history),t){var o=d===i;if(t=ri(t).href,v===t&&(!r.history||o))return a;var u=v&&nr(v)===nr(t);return v=t,d=i,!r.history||u&&o?(u||(m=t),n?s.replace(t):u?s.hash=function(e){var t=e.indexOf("#");return-1===t?"":e.substr(t)}(t):s.href=t,s.href!==t&&(m=t)):(c[n?"replaceState":"pushState"](i,"",t),_()),m&&(m=t),a}return function(e){return e.replace(/#$/,"")}(m||s.href)},a.state=function(){return h};var b=[],w=!1;function k(){m=null,$()}var S=null;function _(){se(h=L(h=g())?null:h,S)&&(h=S),S=h,d=h}function $(){var e=d;_(),v===a.url()&&e===h||(v=a.url(),d=h,x(b,(function(e){e(a.url(),h)})))}a.onUrlChange=function(t){return w||(r.history&&o(e).on("popstate",k),o(e).on("hashchange",k),w=!0),b.push(t),t},a.$$applicationDestroyed=function(){o(e).off("hashchange popstate",k)},a.$$checkUrlChange=$,a.baseHref=function(){var e=y.attr("href");return e?e.replace(/^(https?:)?\/\/[^/]*/,""):""},a.defer=function(e,t,n){var r;return t=t||0,n=n||p.DEFAULT_TASK_TYPE,p.incTaskCount(n),r=u((function(){delete f[r],p.completeTask(e,n)}),t),f[r]=n,r},a.defer.cancel=function(e){if(f.hasOwnProperty(e)){var t=f[e];return delete f[e],l(e),p.completeTask(D,t),!0}return!1}}function an(){this.$get=["$window","$log","$sniffer","$document","$$taskTrackerFactory",function(e,t,n,r,i){return new rn(e,r,t,n,i)}]}function on(){this.$get=function(){var e={};function t(t,n){if(t in e)throw i("$cacheFactory")("iid","CacheId '{0}' is already taken!",t);var r=0,a=C({},n,{id:t}),o=Ne(),s=n&&n.capacity||Number.MAX_VALUE,c=Ne(),u=null,l=null;return e[t]={put:function(e,t){if(!L(t)){if(s<Number.MAX_VALUE)f(c[e]||(c[e]={key:e}));return e in o||r++,o[e]=t,r>s&&this.remove(l.key),t}},get:function(e){if(s<Number.MAX_VALUE){var t=c[e];if(!t)return;f(t)}return o[e]},remove:function(e){if(s<Number.MAX_VALUE){var t=c[e];if(!t)return;t===u&&(u=t.p),t===l&&(l=t.n),p(t.n,t.p),delete c[e]}e in o&&(delete o[e],r--)},removeAll:function(){o=Ne(),r=0,c=Ne(),u=l=null},destroy:function(){o=null,a=null,c=null,delete e[t]},info:function(){return C({},a,{size:r})}};function f(e){e!==u&&(l?l===e&&(l=e.n):l=e,p(e.n,e.p),p(e,u),(u=e).n=null)}function p(e,t){e!==t&&(e&&(e.p=t),t&&(t.n=e))}}return t.info=function(){var t={};return x(e,(function(e,n){t[n]=e.info()})),t},t.get=function(t){return e[t]},t}}function sn(){this.$get=["$cacheFactory",function(e){return e("templates")}]}var cn=i("$compile");var un=new function(){};function ln(t,n){var r={},i=/^\s*directive:\s*([\w-]+)\s+(.*)$/,s=/(([\w-]+)(?::([^;]+))?;?)/,c=function(e){var t,n={},r=e.split(",");for(t=0;t<r.length;t++)n[r[t]]=!0;return n}("ngSrc,ngSrcset,src,srcset"),u=/^(?:(\^\^?)?(\?)?(\^\^?)?)?/,p=/^(on[a-z]+|formaction)$/,h=Ne();function d(e,t,n){var r=/^([@&]|[=<](\*?))(\??)\s*([\w$]*)$/,i=Ne();return x(e,(function(e,a){if((e=e.trim())in h)i[a]=h[e];else{var o=e.match(r);if(!o)throw cn("iscp","Invalid {3} for directive '{0}'. Definition: {... {1}: '{2}' ...}",t,a,e,n?"controller bindings definition":"isolate scope definition");i[a]={mode:o[1][0],collection:"*"===o[2],optional:"?"===o[3],attrName:o[4]||a},o[4]&&(h[e]=i[a])}})),i}function v(e,t){var n={isolateScope:null,bindToController:null};if(F(e.scope)&&(!0===e.bindToController?(n.bindToController=d(e.scope,t,!0),n.isolateScope={}):n.isolateScope=d(e.scope,t,!1)),F(e.bindToController)&&(n.bindToController=d(e.bindToController,t,!0)),n.bindToController&&!e.controller)throw cn("noctrl","Cannot bind to controller without directive '{0}'s controller.",t);return n}this.directive=function e(n,i){return Me(n,"name"),Re(n,"directive"),K(n)?(!function(e){var t=e.charAt(0);if(!t||t!==f(t))throw cn("baddir","Directive/Component name '{0}' is invalid. The first character must be a lowercase letter",e);if(e!==e.trim())throw cn("baddir","Directive/Component name '{0}' is invalid. The name should not contain leading or trailing whitespaces",e)}(n),Me(i,"directiveFactory"),r.hasOwnProperty(n)||(r[n]=[],t.factory(n+"Directive",["$injector","$exceptionHandler",function(e,t){var i=[];return x(r[n],(function(r,a){try{var o=e.invoke(r);W(o)?o={compile:T(o)}:!o.compile&&o.link&&(o.compile=T(o.link)),o.priority=o.priority||0,o.index=a,o.name=o.name||n,o.require=function(e){var t=e.require||e.controller&&e.name;return!H(t)&&F(t)&&x(t,(function(e,n){var r=e.match(u);e.substring(r[0].length)||(t[n]=r[0]+n)})),t}(o),o.restrict=function(e,t){if(e&&(!K(e)||!/[EACM]/.test(e)))throw cn("badrestrict","Restrict property '{0}' of directive '{1}' is invalid",e,t);return e||"EA"}(o.restrict,n),o.$$moduleName=r.$$moduleName,i.push(o)}catch(e){t(e)}})),i}])),r[n].push(i)):x(n,_(e)),this},this.component=function e(t,n){if(!K(t))return x(t,_(pe(this,e))),this;var r=n.controller||function(){};function i(e){function t(t){return W(t)||H(t)?function(n,r){return e.invoke(t,this,{$element:n,$attrs:r})}:t}var i=n.template||n.templateUrl?n.template:"",a={controller:r,controllerAs:bn(n.controller)||n.controllerAs||"$ctrl",template:t(i),templateUrl:t(n.templateUrl),transclude:n.transclude,scope:{},bindToController:n.bindings||{},restrict:"E",require:n.require};return x(n,(function(e,t){"$"===t.charAt(0)&&(a[t]=e)})),a}return x(n,(function(e,t){"$"===t.charAt(0)&&(i[t]=e,W(r)&&(r[t]=e))})),i.$inject=["$injector"],this.directive(t,i)},this.aHrefSanitizationWhitelist=function(e){return N(e)?(n.aHrefSanitizationWhitelist(e),this):n.aHrefSanitizationWhitelist()},this.imgSrcSanitizationWhitelist=function(e){return N(e)?(n.imgSrcSanitizationWhitelist(e),this):n.imgSrcSanitizationWhitelist()};var m=!0;this.debugInfoEnabled=function(e){return N(e)?(m=e,this):m};var g=!1;this.strictComponentBindingsEnabled=function(e){return N(e)?(g=e,this):g};var b=10;this.onChangesTtl=function(e){return arguments.length?(b=e,this):b};var w=!0;this.commentDirectivesEnabled=function(e){return arguments.length?(w=e,this):w};var k=!0;this.cssClassDirectivesEnabled=function(e){return arguments.length?(k=e,this):k};var S=Ne();this.addPropertySecurityContext=function(e,t,n){var r=e.toLowerCase()+"|"+t.toLowerCase();if(r in S&&S[r]!==n)throw cn("ctxoverride","Property context '{0}.{1}' already set to '{2}', cannot override to '{3}'.",e,t,S[r],n);return S[r]=n,this},function(){function e(e,t){x(t,(function(t){S[t.toLowerCase()]=e}))}e(Fr.HTML,["iframe|srcdoc","*|innerHTML","*|outerHTML"]),e(Fr.CSS,["*|style"]),e(Fr.URL,["area|href","area|ping","a|href","a|ping","blockquote|cite","body|background","del|cite","input|src","ins|cite","q|cite"]),e(Fr.MEDIA_URL,["audio|src","img|src","img|srcset","source|src","source|srcset","track|src","video|src","video|poster"]),e(Fr.RESOURCE_URL,["*|formAction","applet|code","applet|codebase","base|href","embed|src","frame|src","form|action","head|profile","html|manifest","iframe|src","link|href","media|src","object|codebase","object|data","script|src"])}(),this.$get=["$injector","$interpolate","$exceptionHandler","$templateRequest","$parse","$controller","$rootScope","$sce","$animate",function(t,n,h,d,_,$,P,O,E){var A,I=/^\w/,T=e.document.createElement("div"),R=w,N=k,U=b;function V(){try{if(!--U)throw A=void 0,cn("infchng","{0} $onChanges() iterations reached. Aborting!\n",b);P.$apply((function(){for(var e=0,t=A.length;e<t;++e)try{A[e]()}catch(e){h(e)}A=void 0}))}finally{U++}}function B(e,t){if(!e)return e;if(!K(e))throw cn("srcset",'Can\'t pass trusted values to `{0}`: "{1}"',t,e.toString());for(var n="",r=X(e),i=/\s/.test(r)?/(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/:/(,)/,a=r.split(i),o=Math.floor(a.length/2),s=0;s<o;s++){var c=2*s;n+=O.getTrustedMediaUrl(X(a[c])),n+=" "+X(a[c+1])}var u=X(a[2*s]).split(/\s/);return n+=O.getTrustedMediaUrl(X(u[0])),2===u.length&&(n+=" "+X(u[1])),n}function q(e,t){if(t){var n,r,i,a=Object.keys(t);for(n=0,r=a.length;n<r;n++)this[i=a[n]]=t[i]}else this.$attr={};this.$$element=e}function G(e,t){try{e.addClass(t)}catch(e){}}q.prototype={$normalize:dn,$addClass:function(e){e&&e.length>0&&E.addClass(this.$$element,e)},$removeClass:function(e){e&&e.length>0&&E.removeClass(this.$$element,e)},$updateClass:function(e,t){var n=vn(e,t);n&&n.length&&E.addClass(this.$$element,n);var r=vn(t,e);r&&r.length&&E.removeClass(this.$$element,r)},$set:function(e,t,n,r){var i=Et(this.$$element[0],e),a=Ct[e],o=e;i?(this.$$element.prop(e,t),r=i):a&&(this[a]=t,o=a),this[e]=t,r?this.$attr[e]=r:(r=this.$attr[e])||(this.$attr[e]=r=je(e,"-")),"img"===ne(this.$$element)&&"srcset"===e&&(this[e]=t=B(t,"$set('srcset', value)")),!1!==n&&(null===t||L(t)?this.$$element.removeAttr(r):I.test(r)?i&&!1===t?this.$$element.removeAttr(r):this.$$element.attr(r,t):function(e,t,n){T.innerHTML="<span "+t+">";var r=T.firstChild.attributes,i=r[0];r.removeNamedItem(i.name),i.value=n,e.attributes.setNamedItem(i)}(this.$$element[0],r,t));var s=this.$$observers;s&&x(s[o],(function(e){try{e(t)}catch(e){h(e)}}))},$observe:function(e,t){var n=this,r=n.$$observers||(n.$$observers=Ne()),i=r[e]||(r[e]=[]);return i.push(t),P.$evalAsync((function(){i.$$inter||!n.hasOwnProperty(e)||L(n[e])||t(n[e])})),function(){ie(i,t)}}};var Q=n.startSymbol(),Z=n.endSymbol(),ee="{{"===Q&&"}}"===Z?M:function(e){return e.replace(/\{\{/g,Q).replace(/}}/g,Z)},te=/^ng(Attr|Prop|On)([A-Z].*)$/,re=/^(.+)Start$/;return ae.$$addBindingInfo=m?function(e,t){var n=e.data("$binding")||[];H(t)?n=n.concat(t):n.push(t),e.data("$binding",n)}:D,ae.$$addBindingClass=m?function(e){G(e,"ng-binding")}:D,ae.$$addScopeInfo=m?function(e,t,n,r){var i=n?r?"$isolateScopeNoTemplate":"$isolateScope":"$scope";e.data(i,t)}:D,ae.$$addScopeClass=m?function(e,t){G(e,t?"ng-isolate-scope":"ng-scope")}:D,ae.$$createComment=function(t,n){var r="";return m&&(r=" "+(t||"")+": ",n&&(r+=n+" ")),e.document.createComment(r)},ae;function ae(e,t,n,r,i){e instanceof o||(e=o(e));var a=ce(e,t,e,n,r,i);ae.$$addScopeClass(e);var s=null;return function(t,n,r){if(!e)throw cn("multilink","This element has already been linked.");Me(t,"scope"),i&&i.needsNewScope&&(t=t.$parent.$new());var c,u,l,f=(r=r||{}).parentBoundTranscludeFn,p=r.transcludeControllers,h=r.futureParentElement;if(f&&f.$$boundTransclude&&(f=f.$$boundTransclude),s||(u=(c=h)&&c[0],s=u&&"foreignobject"!==ne(u)&&y.call(u).match(/SVG/)?"svg":"html"),l="html"!==s?o(Oe(s,o("<div></div>").append(e).html())):n?$t.clone.call(e):e,p)for(var d in p)l.data("$"+d+"Controller",p[d].instance);return ae.$$addScopeInfo(l,t),n&&n(l,t),a&&a(t,l,l,f),n||(e=a=null),l}}function ce(e,t,n,r,i,s){for(var c,u,l,f,p,h,d,v=[],y=H(e)||e instanceof o,m=0;m<e.length;m++)c=new q,11===a&&ue(e,m,y),(l=(u=he(e[m],[],c,0===m?r:void 0,i)).length?me(u,e[m],c,t,n,null,[],[],s):null)&&l.scope&&ae.$$addScopeClass(c.$$element),p=l&&l.terminal||!(f=e[m].childNodes)||!f.length?null:ce(f,l?(l.transcludeOnThisElement||!l.templateOnThisElement)&&l.transclude:t),(l||p)&&(v.push(m,l,p),h=!0,d=d||l),s=null;return h?function(e,n,r,i){var a,s,c,u,l,f,p,h,y;if(d){var m=n.length;for(y=new Array(m),l=0;l<v.length;l+=3)p=v[l],y[p]=n[p]}else y=n;for(l=0,f=v.length;l<f;)c=y[v[l++]],a=v[l++],s=v[l++],a?(a.scope?(u=e.$new(),ae.$$addScopeInfo(o(c),u)):u=e,h=a.transcludeOnThisElement?le(e,a.transclude,i):!a.templateOnThisElement&&i?i:!i&&t?le(e,t):null,a(s,u,c,r,h)):s&&s(e,c.childNodes,void 0,i)}:null}function ue(e,t,n){var r,i=e[t],a=i.parentNode;if(i.nodeType===Ue)for(;(r=a?i.nextSibling:e[t+1])&&r.nodeType===Ue;)i.nodeValue=i.nodeValue+r.nodeValue,r.parentNode&&r.parentNode.removeChild(r),n&&r===e[t+1]&&e.splice(t+1,1)}function le(e,t,n){function r(r,i,a,o,s){return r||((r=e.$new(!1,s)).$$transcluded=!0),t(r,i,{parentBoundTranscludeFn:n,transcludeControllers:a,futureParentElement:o})}var i=r.$$slots=Ne();for(var a in t.$$slots)t.$$slots[a]?i[a]=le(e,t.$$slots[a],n):i[a]=null;return r}function he(e,t,r,a,o){var c,u,l,f=e.nodeType,p=r.$attr;switch(f){case 1:ke(t,dn(u=ne(e)),"E",a,o);for(var h,d,v,y,m,g=e.attributes,b=0,w=g&&g.length;b<w;b++){var k,x=!1,S=!1,_=!1,$=!1,P=!1;d=(h=g[b]).name,y=h.value,(m=(v=dn(d.toLowerCase())).match(te))?(_="Attr"===m[1],$="Prop"===m[1],P="On"===m[1],d=d.replace(pn,"").toLowerCase().substr(4+m[1].length).replace(/_(.)/g,(function(e,t){return t.toUpperCase()}))):(k=v.match(re))&&xe(k[1])&&(x=d,S=d.substr(0,d.length-5)+"end",d=d.substr(0,d.length-6)),$||P?(r[v]=y,p[v]=h.name,$?Ee(e,t,v,d):Ae(t,v,d)):(p[v=dn(d.toLowerCase())]=d,!_&&r.hasOwnProperty(v)||(r[v]=y,Et(e,v)&&(r[v]=!0)),Ie(e,t,y,v,_),ke(t,v,"A",a,o,x,S))}if("input"===u&&"hidden"===e.getAttribute("type")&&e.setAttribute("autocomplete","off"),!N)break;if(F(l=e.className)&&(l=l.animVal),K(l)&&""!==l)for(;c=s.exec(l);)ke(t,v=dn(c[2]),"C",a,o)&&(r[v]=X(c[3])),l=l.substr(c.index+c[0].length);break;case Ue:!function(e,t){var r=n(t,!0);r&&e.push({priority:0,compile:function(e){var t=e.parent(),n=!!t.length;return n&&ae.$$addBindingClass(t),function(e,t){var i=t.parent();n||ae.$$addBindingClass(i),ae.$$addBindingInfo(i,r.expressions),e.$watch(r,(function(e){t[0].nodeValue=e}))}}})}(t,e.nodeValue);break;case 8:if(!R)break;!function(e,t,n,r,a){try{var o=i.exec(e.nodeValue);if(o){var s=dn(o[1]);ke(t,s,"M",r,a)&&(n[s]=X(o[2]))}}catch(e){}}(e,t,r,a,o)}return t.sort($e),t}function de(e,t,n){var r=[],i=0;if(t&&e.hasAttribute&&e.hasAttribute(t))do{if(!e)throw cn("uterdir","Unterminated attribute, found '{0}' but no matching '{1}' found.",t,n);1===e.nodeType&&(e.hasAttribute(t)&&i++,e.hasAttribute(n)&&i--),r.push(e),e=e.nextSibling}while(i>0);else r.push(e);return o(r)}function ve(e,t,n){return function(r,i,a,o,s){return i=de(i[0],t,n),e(r,i,a,o,s)}}function ye(e,t,n,r,i,a){var o;return e?ae(t,n,r,i,a):function(){return o||(o=ae(t,n,r,i,a),t=n=a=null),o.apply(this,arguments)}}function me(t,n,r,i,a,s,c,u,l){l=l||{};for(var f,p,d,v,y,m=-Number.MAX_VALUE,g=l.newScopeDirective,b=l.controllerDirectives,w=l.newIsolateScopeDirective,k=l.templateDirective,S=l.nonTlbTranscludeDirective,_=!1,P=!1,O=l.hasElementTranscludeDirective,E=r.$$element=o(n),A=s,I=i,j=!1,D=!1,M=0,T=t.length;M<T;M++){var R=(f=t[M]).$$start,N=f.$$end;if(R&&(E=de(n,R,N)),d=void 0,m>f.priority)break;if((y=f.scope)&&(f.templateUrl||(F(y)?(Pe("new/isolated scope",w||g,f,E),w=f):Pe("new/isolated scope",w,f,E)),g=g||f),p=f.name,!j&&(f.replace&&(f.templateUrl||f.template)||f.transclude&&!f.$$tlb)){for(var U,K=M+1;U=t[K++];)if(U.transclude&&!U.$$tlb||U.replace&&(U.templateUrl||U.template)){D=!0;break}j=!0}if(!f.templateUrl&&f.controller&&(b=b||Ne(),Pe("'"+p+"' controller",b[p],f,E),b[p]=f),y=f.transclude)if(_=!0,f.$$tlb||(Pe("transclusion",S,f,E),S=f),"element"===y)O=!0,m=f.priority,d=E,E=r.$$element=o(ae.$$createComment(p,r[p])),n=E[0],De(a,fe(d),n),I=ye(D,d,i,m,A&&A.name,{nonTlbTranscludeDirective:S});else{var V=Ne();if(F(y)){d=e.document.createDocumentFragment();var B=Ne(),z=Ne();for(var G in x(y,(function(e,t){var n="?"===e.charAt(0);e=n?e.substring(1):e,B[e]=t,V[t]=null,z[t]=n})),x(E.contents(),(function(t){var n=B[dn(ne(t))];n?(z[n]=!0,V[n]=V[n]||e.document.createDocumentFragment(),V[n].appendChild(t)):d.appendChild(t)})),x(z,(function(e,t){if(!e)throw cn("reqslot","Required transclusion slot `{0}` was not filled.",t)})),V)if(V[G]){var J=o(V[G].childNodes);V[G]=ye(D,J,i)}d=o(d.childNodes)}else d=o(ct(n)).contents();E.empty(),(I=ye(D,d,i,void 0,void 0,{needsNewScope:f.$$isolateScope||f.$$newScope})).$$slots=V}if(f.template)if(P=!0,Pe("template",k,f,E),k=f,y=W(f.template)?f.template(E,r):f.template,y=ee(y),f.replace){if(A=f,d=rt(y)?[]:yn(Oe(f.templateNamespace,X(y))),n=d[0],1!==d.length||1!==n.nodeType)throw cn("tplrt","Template for directive '{0}' must have exactly one root element. {1}",p,"");De(a,E,n);var Q={$attr:{}},Z=he(n,[],Q),te=t.splice(M+1,t.length-(M+1));(w||g)&&be(Z,w,g),t=t.concat(Z).concat(te),Se(r,Q),T=t.length}else E.html(y);if(f.templateUrl)P=!0,Pe("template",k,f,E),k=f,f.replace&&(A=f),oe=_e(t.splice(M,t.length-M),E,r,a,_&&I,c,u,{controllerDirectives:b,newScopeDirective:g!==f&&g,newIsolateScopeDirective:w,templateDirective:k,nonTlbTranscludeDirective:S}),T=t.length;else if(f.compile)try{v=f.compile(E,r,I);var re=f.$$originalDirective||f;W(v)?ie(null,pe(re,v),R,N):v&&ie(pe(re,v.pre),pe(re,v.post),R,N)}catch(e){h(e,we(E))}f.terminal&&(oe.terminal=!0,m=Math.max(m,f.priority))}return oe.scope=g&&!0===g.scope,oe.transcludeOnThisElement=_,oe.templateOnThisElement=P,oe.transclude=I,l.hasElementTranscludeDirective=O,oe;function ie(e,t,n,r){e&&(n&&(e=ve(e,n,r)),e.require=f.require,e.directiveName=p,(w===f||f.$$isolateScope)&&(e=Te(e,{isolateScope:!0})),c.push(e)),t&&(n&&(t=ve(t,n,r)),t.require=f.require,t.directiveName=p,(w===f||f.$$isolateScope)&&(t=Te(t,{isolateScope:!0})),u.push(t))}function oe(e,t,i,a,s){var l,f,p,d,v,y,m,S,_,P;for(var E in n===i?(_=r,S=r.$$element):_=new q(S=o(i),r),v=t,w?d=t.$new(!0):g&&(v=t.$parent),s&&((m=function(e,t,n,r){var i;Y(e)||(r=n,n=t,t=e,e=void 0);O&&(i=y);n||(n=O?S.parent():S);if(!r)return s(e,t,i,n,D);var a=s.$$slots[r];if(a)return a(e,t,i,n,D);if(L(a))throw cn("noslot",'No parent directive that requires a transclusion with slot name "{0}". Element: {1}',r,we(S))}).$$boundTransclude=s,m.isSlotFilled=function(e){return!!s.$$slots[e]}),b&&(y=function(e,t,n,r,i,a,o){var s=Ne();for(var c in r){var u=r[c],l={$scope:u===o||u.$$isolateScope?i:a,$element:e,$attrs:t,$transclude:n},f=u.controller;"@"===f&&(f=t[u.name]);var p=$(f,l,!0,u.controllerAs);s[u.name]=p,e.data("$"+u.name+"Controller",p.instance)}return s}(S,_,m,b,d,t,w)),w&&(ae.$$addScopeInfo(S,d,!0,!(k&&(k===w||k===w.$$originalDirective))),ae.$$addScopeClass(S,!0),d.$$isolateBindings=w.$$isolateBindings,(P=Fe(t,_,d,d.$$isolateBindings,w)).removeWatches&&d.$on("$destroy",P.removeWatches)),y){var A=b[E],I=y[E],j=A.$$bindings.bindToController;I.instance=I(),S.data("$"+A.name+"Controller",I.instance),I.bindingInfo=Fe(v,_,I.instance,j,A)}for(x(b,(function(e,t){var n=e.require;e.bindToController&&!H(n)&&F(n)&&C(y[t].instance,ge(t,n,S,y))})),x(y,(function(e){var t=e.instance;if(W(t.$onChanges))try{t.$onChanges(e.bindingInfo.initialChanges)}catch(e){h(e)}if(W(t.$onInit))try{t.$onInit()}catch(e){h(e)}W(t.$doCheck)&&(v.$watch((function(){t.$doCheck()})),t.$doCheck()),W(t.$onDestroy)&&v.$on("$destroy",(function(){t.$onDestroy()}))})),l=0,f=c.length;l<f;l++)Re(p=c[l],p.isolateScope?d:t,S,_,p.require&&ge(p.directiveName,p.require,S,y),m);var D=t;for(w&&(w.template||null===w.templateUrl)&&(D=d),e&&e(D,i.childNodes,void 0,s),l=u.length-1;l>=0;l--)Re(p=u[l],p.isolateScope?d:t,S,_,p.require&&ge(p.directiveName,p.require,S,y),m);x(y,(function(e){var t=e.instance;W(t.$postLink)&&t.$postLink()}))}}function ge(e,t,n,r){var i;if(K(t)){var a=t.match(u),o=t.substring(a[0].length),s=a[1]||a[3],c="?"===a[2];if("^^"===s?n=n.parent():i=(i=r&&r[o])&&i.instance,!i){var l="$"+o+"Controller";i="^^"===s&&n[0]&&9===n[0].nodeType?null:s?n.inheritedData(l):n.data(l)}if(!i&&!c)throw cn("ctreq","Controller '{0}', required by directive '{1}', can't be found!",o,e)}else if(H(t)){i=[];for(var f=0,p=t.length;f<p;f++)i[f]=ge(e,t[f],n,r)}else F(t)&&(i={},x(t,(function(t,a){i[a]=ge(e,t,n,r)})));return i||null}function be(e,t,n){for(var r=0,i=e.length;r<i;r++)e[r]=j(e[r],{$$isolateScope:t,$$newScope:n})}function ke(e,n,i,a,o,s,c){if(n===o)return null;var u=null;if(r.hasOwnProperty(n))for(var l,f=t.get(n+"Directive"),p=0,h=f.length;p<h;p++)if(l=f[p],(L(a)||a>l.priority)&&-1!==l.restrict.indexOf(i)){if(s&&(l=j(l,{$$start:s,$$end:c})),!l.$$bindings){var d=l.$$bindings=v(l,l.name);F(d.isolateScope)&&(l.$$isolateBindings=d.isolateScope)}e.push(l),u=l}return u}function xe(e){if(r.hasOwnProperty(e))for(var n=t.get(e+"Directive"),i=0,a=n.length;i<a;i++)if(n[i].multiElement)return!0;return!1}function Se(e,t){var n=t.$attr,r=e.$attr;x(e,(function(r,i){"$"!==i.charAt(0)&&(t[i]&&t[i]!==r&&(r.length?r+=("style"===i?";":" ")+t[i]:r=t[i]),e.$set(i,r,!0,n[i]))})),x(t,(function(t,i){e.hasOwnProperty(i)||"$"===i.charAt(0)||(e[i]=t,"class"!==i&&"style"!==i&&(r[i]=n[i]))}))}function _e(e,t,n,r,i,a,s,c){var u,l,f=[],p=t[0],v=e.shift(),y=j(v,{templateUrl:null,transclude:null,replace:null,$$originalDirective:v}),m=W(v.templateUrl)?v.templateUrl(t,n):v.templateUrl,g=v.templateNamespace;return t.empty(),d(m).then((function(h){var d,b,w,k;if(h=ee(h),v.replace){if(w=rt(h)?[]:yn(Oe(g,X(h))),d=w[0],1!==w.length||1!==d.nodeType)throw cn("tplrt","Template for directive '{0}' must have exactly one root element. {1}",v.name,m);b={$attr:{}},De(r,t,d);var S=he(d,[],b);F(v.scope)&&be(S,!0),e=S.concat(e),Se(n,b)}else d=p,t.html(h);for(e.unshift(y),u=me(e,d,n,i,t,v,a,s,c),x(r,(function(e,n){e===d&&(r[n]=t[0])})),l=ce(t[0].childNodes,i);f.length;){var _=f.shift(),$=f.shift(),P=f.shift(),O=f.shift(),C=t[0];if(!_.$$destroyed){if($!==p){var E=$.className;c.hasElementTranscludeDirective&&v.replace||(C=ct(d)),De(P,o($),C),G(o(C),E)}k=u.transcludeOnThisElement?le(_,u.transclude,O):O,u(l,_,C,r,k)}}f=null})).catch((function(e){z(e)&&h(e)})),function(e,t,n,r,i){var a=i;t.$$destroyed||(f?f.push(t,n,r,a):(u.transcludeOnThisElement&&(a=le(t,u.transclude,i)),u(l,t,n,r,a)))}}function $e(e,t){var n=t.priority-e.priority;return 0!==n?n:e.name!==t.name?e.name<t.name?-1:1:e.index-t.index}function Pe(e,t,n,r){function i(e){return e?" (module: "+e+")":""}if(t)throw cn("multidir","Multiple directives [{0}{1}, {2}{3}] asking for {4} on: {5}",t.name,i(t.$$moduleName),n.name,i(n.$$moduleName),e,we(r))}function Oe(t,n){switch(t=f(t||"html")){case"svg":case"math":var r=e.document.createElement("div");return r.innerHTML="<"+t+">"+n+"</"+t+">",r.childNodes[0].childNodes;default:return n}}function Ce(e){return B(O.valueOf(e),"ng-prop-srcset")}function Ee(e,t,n,r){if(p.test(r))throw cn("nodomevents","Property bindings for HTML DOM event properties are disallowed");var i=ne(e),a=function(e,t){var n=t.toLowerCase();return S[e+"|"+n]||S["*|"+n]}(i,r),o=M;"srcset"!==r||"img"!==i&&"source"!==i?a&&(o=O.getTrusted.bind(O,a)):o=Ce,t.push({priority:100,compile:function(e,t){var i=_(t[n]),a=_(t[n],(function(e){return O.valueOf(e)}));return{pre:function(e,t){function n(){var n=i(e);t[0][r]=o(n)}n(),e.$watch(a,n)}}}})}function Ae(e,t,n){e.push(Pa(_,P,h,t,n,!1))}function Ie(e,t,r,i,a){var o=ne(e),s=function(e,t){return"srcdoc"===t?O.HTML:"src"===t||"ngSrc"===t?-1===["img","video","audio","source","track"].indexOf(e)?O.RESOURCE_URL:O.MEDIA_URL:"xlinkHref"===t?"image"===e?O.MEDIA_URL:"a"===e?O.URL:O.RESOURCE_URL:"form"===e&&"action"===t||"base"===e&&"href"===t||"link"===e&&"href"===t?O.RESOURCE_URL:"a"!==e||"href"!==t&&"ngHref"!==t?void 0:O.URL}(o,i),u=!a,l=c[i]||a,f=n(r,u,s,l);if(f){if("multiple"===i&&"select"===o)throw cn("selmulti","Binding to the 'multiple' attribute is not supported. Element: {0}",we(e));if(p.test(i))throw cn("nodomevents","Interpolations for HTML DOM event attributes are disallowed");t.push({priority:100,compile:function(){return{pre:function(e,t,a){var o=a.$$observers||(a.$$observers=Ne()),c=a[i];c!==r&&(f=c&&n(c,!0,s,l),r=c),f&&(a[i]=f(e),(o[i]||(o[i]=[])).$$inter=!0,(a.$$observers&&a.$$observers[i].$$scope||e).$watch(f,(function(e,t){"class"===i&&e!==t?a.$updateClass(e,t):a.$set(i,e)})))}}}})}}function De(t,n,r){var i,a,s=n[0],c=n.length,u=s.parentNode;if(t)for(i=0,a=t.length;i<a;i++)if(t[i]===s){t[i++]=r;for(var l=i,f=l+c-1,p=t.length;l<p;l++,f++)f<p?t[l]=t[f]:delete t[l];t.length-=c-1,t.context===s&&(t.context=r);break}u&&u.replaceChild(r,s);var h=e.document.createDocumentFragment();for(i=0;i<c;i++)h.appendChild(n[i]);for(o.hasData(s)&&(o.data(r,o.data(s)),o(s).off("$destroy")),o.cleanData(h.querySelectorAll("*")),i=1;i<c;i++)delete n[i];n[0]=r,n.length=1}function Te(e,t){return C((function(){return e.apply(null,arguments)}),e,t)}function Re(e,t,n,r,i,a){try{e(t,n,r,i,a)}catch(e){h(e,we(n))}}function Le(e,t){if(g)throw cn("missingattr","Attribute '{0}' of '{1}' is non-optional and must be set!",e,t)}function Fe(e,t,r,i,a){var o,s=[],c={};function u(t,n,i){W(r.$onChanges)&&!oe(n,i)&&(A||(e.$$postDigest(V),A=[]),o||(o={},A.push(f)),o[t]&&(i=o[t].previousValue),o[t]=new fn(i,n))}function f(){r.$onChanges(o),o=void 0}return x(i,(function(i,o){var f,p,h,d,v,y=i.attrName,m=i.optional;switch(i.mode){case"@":m||l.call(t,y)||(Le(y,a.name),r[o]=t[y]=void 0),v=t.$observe(y,(function(e){if(K(e)||J(e)){var t=r[o];u(o,e,t),r[o]=e}})),t.$$observers[y].$$scope=e,K(f=t[y])?r[o]=n(f)(e):J(f)&&(r[o]=f),c[o]=new fn(un,r[o]),s.push(v);break;case"=":if(!l.call(t,y)){if(m)break;Le(y,a.name),t[y]=void 0}if(m&&!t[y])break;p=_(t[y]),d=p.literal?se:oe,h=p.assign||function(){throw f=r[o]=p(e),cn("nonassign","Expression '{0}' in attribute '{1}' used with directive '{2}' is non-assignable!",t[y],y,a.name)},f=r[o]=p(e);var g=function(t){return d(t,r[o])||(d(t,f)?h(e,t=r[o]):r[o]=t),f=t};g.$stateful=!0,v=i.collection?e.$watchCollection(t[y],g):e.$watch(_(t[y],g),null,p.literal),s.push(v);break;case"<":if(!l.call(t,y)){if(m)break;Le(y,a.name),t[y]=void 0}if(m&&!t[y])break;var b=(p=_(t[y])).literal,w=r[o]=p(e);c[o]=new fn(un,r[o]),v=e[i.collection?"$watchCollection":"$watch"](p,(function(e,t){if(t===e){if(t===w||b&&se(t,w))return;t=w}u(o,e,t),r[o]=e})),s.push(v);break;case"&":if(m||l.call(t,y)||Le(y,a.name),(p=t.hasOwnProperty(y)?_(t[y]):D)===D&&m)break;r[o]=function(t){return p(e,t)}}})),{initialChanges:c,removeWatches:s.length&&function(){for(var e=0,t=s.length;e<t;++e)s[e]()}}}}]}function fn(e,t){this.previousValue=e,this.currentValue=t}ln.$inject=["$provide","$$sanitizeUriProvider"],fn.prototype.isFirstChange=function(){return this.previousValue===un};var pn=/^((?:x|data)[:\-_])/i,hn=/[:\-_]+(.)/g;function dn(e){return e.replace(pn,"").replace(hn,(function(e,t,n){return n?t.toUpperCase():t}))}function vn(e,t){var n="",r=e.split(/\s+/),i=t.split(/\s+/);e:for(var a=0;a<r.length;a++){for(var o=r[a],s=0;s<i.length;s++)if(o===i[s])continue e;n+=(n.length>0?" ":"")+o}return n}function yn(e){var t=(e=o(e)).length;if(t<=1)return e;for(;t--;){var n=e[t];(8===n.nodeType||n.nodeType===Ue&&""===n.nodeValue.trim())&&d.call(e,t,1)}return e}var mn=i("$controller"),gn=/^(\S+)(\s+as\s+([\w$]+))?$/;function bn(e,t){if(t&&K(t))return t;if(K(e)){var n=gn.exec(e);if(n)return n[3]}}function wn(){var e={};this.has=function(t){return e.hasOwnProperty(t)},this.register=function(t,n){Re(t,"controller"),F(t)?C(e,t):e[t]=n},this.$get=["$injector",function(t){return function(r,i,a,o){var s,c,u,l;if(a=!0===a,o&&K(o)&&(l=o),K(r)){if(!(c=r.match(gn)))throw mn("ctrlfmt","Badly formed controller string '{0}'. Must match `__name__ as __id__` or `__name__`.",r);if(u=c[1],l=l||c[3],!(r=e.hasOwnProperty(u)?e[u]:function(e,t,n){if(!t)return e;for(var r,i=t.split("."),a=e,o=i.length,s=0;s<o;s++)r=i[s],e&&(e=(a=e)[r]);return!n&&W(e)?pe(a,e):e}(i.$scope,u,!0)))throw mn("ctrlreg","The controller with the name '{0}' is not registered.",u);Te(r,u,!0)}if(a){var f=(H(r)?r[r.length-1]:r).prototype;return s=Object.create(f||null),l&&n(i,l,s,u||r.name),C((function(){var e=t.invoke(r,s,i,u);return e!==s&&(F(e)||W(e))&&(s=e,l&&n(i,l,s,u||r.name)),s}),{instance:s,identifier:l})}return s=t.instantiate(r,i,u),l&&n(i,l,s,u||r.name),s};function n(e,t,n,r){if(!e||!F(e.$scope))throw i("$controller")("noscp","Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.",r,t);e.$scope[t]=n}}]}function kn(){this.$get=["$window",function(e){return o(e.document)}]}function xn(){this.$get=["$document","$rootScope",function(e,t){var n=e[0],r=n&&n.hidden;function i(){r=n.hidden}return e.on("visibilitychange",i),t.$on("$destroy",(function(){e.off("visibilitychange",i)})),function(){return r}}]}function Sn(){this.$get=["$log",function(e){return function(t,n){e.error.apply(e,arguments)}}]}var _n=function(){this.$get=["$document",function(e){return function(t){return t?!t.nodeType&&t instanceof o&&(t=t[0]):t=e[0].body,t.offsetWidth+1}}]},$n={"Content-Type":"application/json;charset=utf-8"},Pn=/^\[|^\{(?!\{)/,On={"[":/]$/,"{":/}$/},Cn=/^\)]\}',?\n/,En=i("$http");function An(e){return F(e)?B(e)?e.toISOString():de(e):e}function In(){this.$get=function(){return function(e){if(!e)return"";var t=[];return S(e,(function(e,n){null===e||L(e)||W(e)||(H(e)?x(e,(function(e){t.push(_e(n)+"="+_e(An(e)))})):t.push(_e(n)+"="+_e(An(e))))})),t.join("&")}}}function jn(){this.$get=function(){return function(e){if(!e)return"";var t=[];return function e(n,r,i){H(n)?x(n,(function(t,n){e(t,r+"["+(F(t)?n:"")+"]")})):F(n)&&!B(n)?S(n,(function(t,n){e(t,r+(i?"":"[")+n+(i?"":"]"))})):(W(n)&&(n=n()),t.push(_e(r)+"="+(null==n?"":_e(An(n)))))}(e,"",!0),t.join("&")}}}function Dn(e,t){if(K(e)){var n=e.replace(Cn,"").trim();if(n){var r=t("Content-Type"),i=r&&0===r.indexOf("application/json");if(i||(o=(a=n).match(Pn))&&On[o[0]].test(a))try{e=ve(n)}catch(t){if(!i)return e;throw En("baddata",'Data must be a valid JSON object. Received: "{0}". Parse error: "{1}"',e,t)}}}var a,o;return e}function Mn(e){var t,n=Ne();function r(e,t){e&&(n[e]=n[e]?n[e]+", "+t:t)}return K(e)?x(e.split("\n"),(function(e){t=e.indexOf(":"),r(f(X(e.substr(0,t))),X(e.substr(t+1)))})):F(e)&&x(e,(function(e,t){r(f(t),X(e))})),n}function Tn(e){var t;return function(n){if(t||(t=Mn(e)),n){var r=t[f(n)];return void 0===r&&(r=null),r}return t}}function Rn(e,t,n,r){return W(r)?r(e,t,n):(x(r,(function(r){e=r(e,t,n)})),e)}function Ln(e){return 200<=e&&e<300}function Nn(){var e=this.defaults={transformResponse:[Dn],transformRequest:[function(e){return!F(e)||(t=e,"[object File]"===y.call(t))||function(e){return"[object Blob]"===y.call(e)}(e)||function(e){return"[object FormData]"===y.call(e)}(e)?e:de(e);var t}],headers:{common:{Accept:"application/json, text/plain, */*"},post:Ke($n),put:Ke($n),patch:Ke($n)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",paramSerializer:"$httpParamSerializer",jsonpCallbackParam:"callback"},t=!1;this.useApplyAsync=function(e){return N(e)?(t=!!e,this):t};var n=this.interceptors=[],r=this.xsrfWhitelistedOrigins=[];this.$get=["$browser","$httpBackend","$$cookieReader","$cacheFactory","$rootScope","$q","$injector","$sce",function(a,o,s,c,u,l,h,d){var v=c("$http");e.paramSerializer=K(e.paramSerializer)?h.get(e.paramSerializer):e.paramSerializer;var y=[];x(n,(function(e){y.unshift(K(e)?h.get(e):h.invoke(e))}));var m,g=(m=[ti].concat(r.map(ri)),function(e){var t=ri(e);return m.some(ii.bind(null,t))});function b(n){if(!F(n))throw i("$http")("badreq","Http request configuration must be an object. Received: {0}",n);if(!K(d.valueOf(n.url)))throw i("$http")("badreq","Http request configuration url must be a string or a $sce trusted object. Received: {0}",n.url);var r=C({method:"get",transformRequest:e.transformRequest,transformResponse:e.transformResponse,paramSerializer:e.paramSerializer,jsonpCallbackParam:e.jsonpCallbackParam},n);r.headers=function(t){var n,r,i,a=e.headers,o=C({},t.headers);a=C({},a.common,a[f(t.method)]);e:for(n in a){for(i in r=f(n),o)if(f(i)===r)continue e;o[n]=a[n]}return function(e,t){var n,r={};return x(e,(function(e,i){W(e)?null!=(n=e(t))&&(r[i]=n):r[i]=e})),r}(o,Ke(t))}(n),r.method=p(r.method),r.paramSerializer=K(r.paramSerializer)?h.get(r.paramSerializer):r.paramSerializer,a.$$incOutstandingRequestCount("$http");var c=[],m=[],w=l.resolve(r);return x(y,(function(e){(e.request||e.requestError)&&c.unshift(e.request,e.requestError),(e.response||e.responseError)&&m.push(e.response,e.responseError)})),w=k(w,c),w=(w=k(w=w.then((function(n){var r=n.headers,i=Rn(n.data,Tn(r),void 0,n.transformRequest);L(i)&&x(r,(function(e,t){"content-type"===f(t)&&delete r[t]}));L(n.withCredentials)&&!L(e.withCredentials)&&(n.withCredentials=e.withCredentials);return function(n,r){var i,a,c=l.defer(),p=c.promise,h=n.headers,y="jsonp"===f(n.method),m=n.url;y?m=d.getTrustedResourceUrl(m):K(m)||(m=d.valueOf(m));m=function(e,t){t.length>0&&(e+=(-1===e.indexOf("?")?"?":"&")+t);return e}(m,n.paramSerializer(n.params)),y&&(m=function(e,t){var n=e.split("?");if(n.length>2)throw En("badjsonp",'Illegal use more than one "?", in url, "{1}"',e);return x(xe(n[1]),(function(n,r){if("JSON_CALLBACK"===n)throw En("badjsonp",'Illegal use of JSON_CALLBACK in url, "{0}"',e);if(r===t)throw En("badjsonp",'Illegal use of callback param, "{0}", in url, "{1}"',t,e)})),e+=(-1===e.indexOf("?")?"?":"&")+t+"=JSON_CALLBACK"}(m,n.jsonpCallbackParam));b.pendingRequests.push(n),p.then($,$),!n.cache&&!e.cache||!1===n.cache||"GET"!==n.method&&"JSONP"!==n.method||(i=F(n.cache)?n.cache:F(e.cache)?e.cache:v);i&&(N(a=i.get(m))?Q(a)?a.then(_,_):H(a)?S(a[1],a[0],Ke(a[2]),a[3],a[4]):S(a,200,{},"OK","complete"):i.put(m,p));if(L(a)){var w=g(n.url)?s()[n.xsrfCookieName||e.xsrfCookieName]:void 0;w&&(h[n.xsrfHeaderName||e.xsrfHeaderName]=w),o(n.method,m,r,(function(e,n,r,a,o){i&&(Ln(e)?i.put(m,[e,n,Mn(r),a,o]):i.remove(m));function s(){S(n,e,r,a,o)}t?u.$applyAsync(s):(s(),u.$$phase||u.$apply())}),h,n.timeout,n.withCredentials,n.responseType,k(n.eventHandlers),k(n.uploadEventHandlers))}return p;function k(e){if(e){var n={};return x(e,(function(e,r){n[r]=function(n){function r(){e(n)}t?u.$applyAsync(r):u.$$phase?r():u.$apply(r)}})),n}}function S(e,t,r,i,a){(Ln(t=t>=-1?t:0)?c.resolve:c.reject)({data:e,status:t,headers:Tn(r),config:n,statusText:i,xhrStatus:a})}function _(e){S(e.data,e.status,Ke(e.headers()),e.statusText,e.xhrStatus)}function $(){var e=b.pendingRequests.indexOf(n);-1!==e&&b.pendingRequests.splice(e,1)}}(n,i).then(S,S)})),m)).finally((function(){a.$$completeOutstandingRequest(D,"$http")}));function k(e,t){for(var n=0,r=t.length;n<r;){var i=t[n++],a=t[n++];e=e.then(i,a)}return t.length=0,e}function S(e){var t=C({},e);return t.data=Rn(e.data,e.headers,e.status,r.transformResponse),Ln(e.status)?t:l.reject(t)}}return b.pendingRequests=[],function(e){x(arguments,(function(e){b[e]=function(t,n){return b(C({},n||{},{method:e,url:t}))}}))}("get","delete","head","jsonp"),function(e){x(arguments,(function(e){b[e]=function(t,n,r){return b(C({},r||{},{method:e,url:t,data:n}))}}))}("post","put","patch"),b.defaults=e,b}]}function Fn(){this.$get=function(){return function(){return new e.XMLHttpRequest}}}function Un(){this.$get=["$browser","$jsonpCallbacks","$document","$xhrFactory",function(e,t,n,r){return function(e,t,n,r,i){return function(a,o,s,c,u,l,p,h,d,v){if(o=o||e.url(),"jsonp"===f(a))var y=r.createCallback(o),m=function(e,t,n){e=e.replace("JSON_CALLBACK",t);var a=i.createElement("script"),o=null;return a.type="text/javascript",a.src=e,a.async=!0,o=function(e){a.removeEventListener("load",o),a.removeEventListener("error",o),i.body.removeChild(a),a=null;var s=-1,c="unknown";e&&("load"!==e.type||r.wasCalled(t)||(e={type:"error"}),c=e.type,s="error"===e.type?404:200),n&&n(s,c)},a.addEventListener("load",o),a.addEventListener("error",o),i.body.appendChild(a),o}(o,y,(function(e,t){var n=200===e&&r.getResponse(y);S(c,e,n,"",t,"complete"),r.removeCallback(y)}));else{var g=t(a,o),b=!1;g.open(a,o,!0),x(u,(function(e,t){N(e)&&g.setRequestHeader(t,e)})),g.onload=function(){var e=g.statusText||"",t="response"in g?g.response:g.responseText,n=1223===g.status?204:g.status;0===n&&(n=t?200:"file"===ri(o).protocol?404:0),S(c,n,t,g.getAllResponseHeaders(),e,"complete")};if(g.onerror=function(){S(c,-1,null,null,"","error")},g.ontimeout=function(){S(c,-1,null,null,"","timeout")},g.onabort=function(){S(c,-1,null,null,"",b?"timeout":"abort")},x(d,(function(e,t){g.addEventListener(t,e)})),x(v,(function(e,t){g.upload.addEventListener(t,e)})),p&&(g.withCredentials=!0),h)try{g.responseType=h}catch(e){if("json"!==h)throw e}g.send(L(s)?null:s)}if(l>0)var w=n((function(){k("timeout")}),l);else Q(l)&&l.then((function(){k(N(l.$$timeoutId)?"timeout":"abort")}));function k(e){b="timeout"===e,m&&m(),g&&g.abort()}function S(e,t,r,i,a,o){N(w)&&n.cancel(w),m=g=null,e(t,r,i,a,o)}}}(e,r,e.defer,t,n[0])}]}var Kn=b.$interpolateMinErr=i("$interpolate");function Vn(){var e="{{",t="}}";this.startSymbol=function(t){return t?(e=t,this):e},this.endSymbol=function(e){return e?(t=e,this):t},this.$get=["$parse","$exceptionHandler","$sce",function(n,r,i){var a=e.length,o=t.length,s=new RegExp(e.replace(/./g,u),"g"),c=new RegExp(t.replace(/./g,u),"g");function u(e){return"\\\\\\"+e}function l(n){return n.replace(s,e).replace(c,t)}function f(e,t,n,r){var i=e.$watch((function(e){return i(),r(e)}),t,n);return i}function p(s,c,u,p){var h=u===i.URL||u===i.MEDIA_URL;if(!s.length||-1===s.indexOf(e)){if(c)return;var d=l(s);h&&(d=i.getTrusted(u,d));var v=T(d);return v.exp=s,v.expressions=[],v.$$watchDelegate=f,v}p=!!p;for(var y,m,g,b,w,k=0,x=[],S=s.length,_=[],$=[];k<S;){if(-1===(y=s.indexOf(e,k))||-1===(m=s.indexOf(t,y+a))){k!==S&&_.push(l(s.substring(k)));break}k!==y&&_.push(l(s.substring(k,y))),b=s.substring(y+a,m),x.push(b),k=m+o,$.push(_.length),_.push("")}w=1===_.length&&1===$.length;var P=h&&w?void 0:function(e){try{return e=u&&!h?i.getTrusted(u,e):i.valueOf(e),p&&!N(e)?e:Fe(e)}catch(e){r(Kn.interr(s,e))}};if(g=x.map((function(e){return n(e,P)})),!c||x.length){var O=function(e){for(var t=0,n=x.length;t<n;t++){if(p&&L(e[t]))return;_[$[t]]=e[t]}return h?i.getTrusted(u,w?_[0]:_.join("")):(u&&_.length>1&&Kn.throwNoconcat(s),_.join(""))};return C((function(e){var t=0,n=x.length,i=new Array(n);try{for(;t<n;t++)i[t]=g[t](e);return O(i)}catch(e){r(Kn.interr(s,e))}}),{exp:s,expressions:x,$$watchDelegate:function(e,t){var n;return e.$watchGroup(g,(function(r,i){var a=O(r);t.call(this,a,r!==i?n:a,e),n=a}))}})}}return p.startSymbol=function(){return e},p.endSymbol=function(){return t},p}]}Kn.throwNoconcat=function(e){throw Kn("noconcat","Error while interpolating: {0}\nStrict Contextual Escaping disallows interpolations that concatenate multiple expressions when a trusted value is required. See http://docs.angularjs.org/api/ng.$sce",e)},Kn.interr=function(e,t){return Kn("interr","Can't interpolate: {0}\n{1}",e,t.toString())};var Bn=i("$interval");function Hn(){this.$get=["$$intervalFactory","$window",function(e,t){var n={},r=function(e){t.clearInterval(e),delete n[e]},i=e((function(e,r,i){var a=t.setInterval(e,r);return n[a]=i,a}),r);return i.cancel=function(e){if(!e)return!1;if(!e.hasOwnProperty("$$intervalId"))throw Bn("badprom","`$interval.cancel()` called with a promise that was not generated by `$interval()`.");if(!n.hasOwnProperty(e.$$intervalId))return!1;var t=e.$$intervalId,i=n[t];return Mr(i.promise),i.reject("canceled"),r(t),!0},i}]}function zn(){this.$get=["$browser","$q","$$q","$rootScope",function(e,t,n,r){return function(i,a){return function(o,s,c,u){var l=arguments.length>4,f=l?fe(arguments,4):[],p=0,h=N(u)&&!u,d=(h?n:t).defer(),v=d.promise;function y(){l?o.apply(null,f):o(p)}function m(){h?e.defer(y):r.$evalAsync(y),d.notify(p++),c>0&&p>=c&&(d.resolve(p),a(v.$$intervalId)),h||r.$apply()}return c=N(c)?c:0,v.$$intervalId=i(m,s,d,h),v}}}]}var Wn=function(){this.$get=function(){var e=b.callbacks,t={};return{createCallback:function(n){var r="_"+(e.$$counter++).toString(36),i="angular.callbacks."+r,a=function(e){var t=function(e){t.data=e,t.called=!0};return t.id=e,t}(r);return t[i]=e[r]=a,i},wasCalled:function(e){return t[e].called},getResponse:function(e){return t[e].data},removeCallback:function(n){var r=t[n];delete e[r.id],delete t[n]}}}},qn=/^([^?#]*)(\?([^#]*))?(#(.*))?$/,Gn={http:80,https:443,ftp:21},Yn=i("$location");function Jn(e,t,n){var r,i=(r=[],x(t,(function(e,t){H(e)?x(e,(function(e){r.push(_e(t,!0)+(!0===e?"":"="+_e(e,!0)))})):r.push(_e(t,!0)+(!0===e?"":"="+_e(e,!0)))})),r.length?r.join("&"):""),a=n?"#"+Se(n):"";return function(e){for(var t=e.split("/"),n=t.length;n--;)t[n]=Se(t[n].replace(/%2F/g,"/"));return t.join("/")}(e)+(i?"?"+i:"")+a}function Qn(e,t){var n=ri(e);t.$$protocol=n.protocol,t.$$host=n.hostname,t.$$port=A(n.port)||Gn[n.protocol]||null}var Zn=/^\s*[\\/]{2,}/;function Xn(e,t,n){if(Zn.test(e))throw Yn("badpath",'Invalid url "{0}".',e);var r="/"!==e.charAt(0);r&&(e="/"+e);var i=ri(e),a=r&&"/"===i.pathname.charAt(0)?i.pathname.substring(1):i.pathname;t.$$path=function(e,t){for(var n=e.split("/"),r=n.length;r--;)n[r]=decodeURIComponent(n[r]),t&&(n[r]=n[r].replace(/\//g,"%2F"));return n.join("/")}(a,n),t.$$search=xe(i.search),t.$$hash=decodeURIComponent(i.hash),t.$$path&&"/"!==t.$$path.charAt(0)&&(t.$$path="/"+t.$$path)}function er(e,t){return e.slice(0,t.length)===t}function tr(e,t){if(er(t,e))return t.substr(e.length)}function nr(e){var t=e.indexOf("#");return-1===t?e:e.substr(0,t)}function rr(e,t,n){this.$$html5=!0,n=n||"",Qn(e,this),this.$$parse=function(e){var n=tr(t,e);if(!K(n))throw Yn("ipthprfx",'Invalid url "{0}", missing path prefix "{1}".',e,t);Xn(n,this,!0),this.$$path||(this.$$path="/"),this.$$compose()},this.$$normalizeUrl=function(e){return t+e.substr(1)},this.$$parseLinkUrl=function(r,i){return i&&"#"===i[0]?(this.hash(i.slice(1)),!0):(N(a=tr(e,r))?(o=a,s=n&&N(a=tr(n,a))?t+(tr("/",a)||a):e+o):N(a=tr(t,r))?s=t+a:t===r+"/"&&(s=t),s&&this.$$parse(s),!!s);var a,o,s}}function ir(e,t,n){Qn(e,this),this.$$parse=function(r){var i,a=tr(e,r)||tr(t,r);L(a)||"#"!==a.charAt(0)?this.$$html5?i=a:(i="",L(a)&&(e=r,this.replace())):L(i=tr(n,a))&&(i=a),Xn(i,this,!1),this.$$path=function(e,t,n){var r,i=/^\/[A-Z]:(\/.*)/;er(t,n)&&(t=t.replace(n,""));if(i.exec(t))return e;return(r=i.exec(e))?r[1]:e}(this.$$path,i,e),this.$$compose()},this.$$normalizeUrl=function(t){return e+(t?n+t:"")},this.$$parseLinkUrl=function(t,n){return nr(e)===nr(t)&&(this.$$parse(t),!0)}}function ar(e,t,n){this.$$html5=!0,ir.apply(this,arguments),this.$$parseLinkUrl=function(r,i){return i&&"#"===i[0]?(this.hash(i.slice(1)),!0):(e===nr(r)?a=r:(o=tr(t,r))?a=e+n+o:t===r+"/"&&(a=t),a&&this.$$parse(a),!!a);var a,o},this.$$normalizeUrl=function(t){return e+n+t}}var or={$$absUrl:"",$$html5:!1,$$replace:!1,$$compose:function(){this.$$url=Jn(this.$$path,this.$$search,this.$$hash),this.$$absUrl=this.$$normalizeUrl(this.$$url),this.$$urlUpdatedByLocation=!0},absUrl:sr("$$absUrl"),url:function(e){if(L(e))return this.$$url;var t=qn.exec(e);return(t[1]||""===e)&&this.path(decodeURIComponent(t[1])),(t[2]||t[1]||""===e)&&this.search(t[3]||""),this.hash(t[5]||""),this},protocol:sr("$$protocol"),host:sr("$$host"),port:sr("$$port"),path:cr("$$path",(function(e){return"/"===(e=null!==e?e.toString():"").charAt(0)?e:"/"+e})),search:function(e,t){switch(arguments.length){case 0:return this.$$search;case 1:if(K(e)||V(e))e=e.toString(),this.$$search=xe(e);else{if(!F(e))throw Yn("isrcharg","The first argument of the `$location#search()` call must be a string or an object.");x(e=ae(e,{}),(function(t,n){null==t&&delete e[n]})),this.$$search=e}break;default:L(t)||null===t?delete this.$$search[e]:this.$$search[e]=t}return this.$$compose(),this},hash:cr("$$hash",(function(e){return null!==e?e.toString():""})),replace:function(){return this.$$replace=!0,this}};function sr(e){return function(){return this[e]}}function cr(e,t){return function(n){return L(n)?this[e]:(this[e]=t(n),this.$$compose(),this)}}function ur(){var e="!",t={enabled:!1,requireBase:!0,rewriteLinks:!0};this.hashPrefix=function(t){return N(t)?(e=t,this):e},this.html5Mode=function(e){return J(e)?(t.enabled=e,this):F(e)?(J(e.enabled)&&(t.enabled=e.enabled),J(e.requireBase)&&(t.requireBase=e.requireBase),(J(e.rewriteLinks)||K(e.rewriteLinks))&&(t.rewriteLinks=e.rewriteLinks),this):t},this.$get=["$rootScope","$browser","$sniffer","$rootElement","$window",function(n,r,i,a,s){var c,u,l,f,p=r.baseHref(),h=r.url();if(t.enabled){if(!p&&t.requireBase)throw Yn("nobase","$location in HTML5 mode requires a <base> tag to be present!");l=(f=h).substring(0,f.indexOf("/",f.indexOf("//")+2))+(p||"/"),u=i.history?rr:ar}else l=nr(h),u=ir;var d=function(e){return e.substr(0,nr(e).lastIndexOf("/")+1)}(l);(c=new u(l,d,"#"+e)).$$parseLinkUrl(h,h),c.$$state=r.state();var v=/^\s*(javascript|mailto):/i;function y(e,t,n){var i=c.url(),a=c.$$state;try{r.url(e,t,n),c.$$state=r.state()}catch(e){throw c.url(i),c.$$state=a,e}}a.on("click",(function(e){var i=t.rewriteLinks;if(i&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&2!==e.which&&2!==e.button){for(var s=o(e.target);"a"!==ne(s[0]);)if(s[0]===a[0]||!(s=s.parent())[0])return;if(!K(i)||!L(s.attr(i))){var u=s.prop("href"),l=s.attr("href")||s.attr("xlink:href");F(u)&&"[object SVGAnimatedString]"===u.toString()&&(u=ri(u.animVal).href),v.test(u)||!u||s.attr("target")||e.isDefaultPrevented()||c.$$parseLinkUrl(u,l)&&(e.preventDefault(),c.absUrl()!==r.url()&&n.$apply())}}})),c.absUrl()!==h&&r.url(c.absUrl(),!0);var m=!0;return r.onUrlChange((function(e,t){er(e,d)?(n.$evalAsync((function(){var r,i=c.absUrl(),a=c.$$state;c.$$parse(e),c.$$state=t,r=n.$broadcast("$locationChangeStart",e,i,t,a).defaultPrevented,c.absUrl()===e&&(r?(c.$$parse(i),c.$$state=a,y(i,!1,a)):(m=!1,g(i,a)))})),n.$$phase||n.$digest()):s.location.href=e})),n.$watch((function(){if(m||c.$$urlUpdatedByLocation){c.$$urlUpdatedByLocation=!1;var e=r.url(),t=c.absUrl(),a=r.state(),o=c.$$replace,s=!((u=e)===(l=t)||ri(u).href===ri(l).href)||c.$$html5&&i.history&&a!==c.$$state;(m||s)&&(m=!1,n.$evalAsync((function(){var t=c.absUrl(),r=n.$broadcast("$locationChangeStart",t,e,c.$$state,a).defaultPrevented;c.absUrl()===t&&(r?(c.$$parse(e),c.$$state=a):(s&&y(t,o,a===c.$$state?null:c.$$state),g(e,a)))})))}var u,l;c.$$replace=!1})),c;function g(e,t){n.$broadcast("$locationChangeSuccess",c.absUrl(),e,c.$$state,t)}}]}function lr(){var e=!0,t=this;this.debugEnabled=function(t){return N(t)?(e=t,this):e},this.$get=["$window",function(n){var r,i=a||/\bEdge\//.test(n.navigator&&n.navigator.userAgent);return{log:s("log"),info:s("info"),warn:s("warn"),error:s("error"),debug:(r=s("debug"),function(){e&&r.apply(t,arguments)})};function o(e){return z(e)&&(e.stack&&i?e=e.message&&-1===e.stack.indexOf(e.message)?"Error: "+e.message+"\n"+e.stack:e.stack:e.sourceURL&&(e=e.message+"\n"+e.sourceURL+":"+e.line)),e}function s(e){var t=n.console||{},r=t[e]||t.log||D;return function(){var e=[];return x(arguments,(function(t){e.push(o(t))})),Function.prototype.apply.call(r,t,e)}}}]}x([ar,ir,rr],(function(e){e.prototype=Object.create(or),e.prototype.state=function(t){if(!arguments.length)return this.$$state;if(e!==rr||!this.$$html5)throw Yn("nostate","History API state support is available only in HTML5 mode and only in browsers supporting HTML5 History API");return this.$$state=L(t)?null:t,this.$$urlUpdatedByLocation=!0,this}}));var fr=i("$parse"),pr={}.constructor.prototype.valueOf;function hr(e){return e+""}var dr=Ne();x("+ - * / % === !== == != < > <= >= && || ! = |".split(" "),(function(e){dr[e]=!0}));var vr={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},yr=function(e){this.options=e};yr.prototype={constructor:yr,lex:function(e){for(this.text=e,this.index=0,this.tokens=[];this.index<this.text.length;){var t=this.text.charAt(this.index);if('"'===t||"'"===t)this.readString(t);else if(this.isNumber(t)||"."===t&&this.isNumber(this.peek()))this.readNumber();else if(this.isIdentifierStart(this.peekMultichar()))this.readIdent();else if(this.is(t,"(){}[].,;:?"))this.tokens.push({index:this.index,text:t}),this.index++;else if(this.isWhitespace(t))this.index++;else{var n=t+this.peek(),r=n+this.peek(2),i=dr[t],a=dr[n],o=dr[r];if(i||a||o){var s=o?r:a?n:t;this.tokens.push({index:this.index,text:s,operator:!0}),this.index+=s.length}else this.throwError("Unexpected next character ",this.index,this.index+1)}}return this.tokens},is:function(e,t){return-1!==t.indexOf(e)},peek:function(e){var t=e||1;return this.index+t<this.text.length&&this.text.charAt(this.index+t)},isNumber:function(e){return"0"<=e&&e<="9"&&"string"==typeof e},isWhitespace:function(e){return" "===e||"\r"===e||"\t"===e||"\n"===e||"\v"===e||" "===e},isIdentifierStart:function(e){return this.options.isIdentifierStart?this.options.isIdentifierStart(e,this.codePointAt(e)):this.isValidIdentifierStart(e)},isValidIdentifierStart:function(e){return"a"<=e&&e<="z"||"A"<=e&&e<="Z"||"_"===e||"$"===e},isIdentifierContinue:function(e){return this.options.isIdentifierContinue?this.options.isIdentifierContinue(e,this.codePointAt(e)):this.isValidIdentifierContinue(e)},isValidIdentifierContinue:function(e,t){return this.isValidIdentifierStart(e,t)||this.isNumber(e)},codePointAt:function(e){return 1===e.length?e.charCodeAt(0):(e.charCodeAt(0)<<10)+e.charCodeAt(1)-56613888},peekMultichar:function(){var e=this.text.charAt(this.index),t=this.peek();if(!t)return e;var n=e.charCodeAt(0),r=t.charCodeAt(0);return n>=55296&&n<=56319&&r>=56320&&r<=57343?e+t:e},isExpOperator:function(e){return"-"===e||"+"===e||this.isNumber(e)},throwError:function(e,t,n){n=n||this.index;var r=N(t)?"s "+t+"-"+this.index+" ["+this.text.substring(t,n)+"]":" "+n;throw fr("lexerr","Lexer Error: {0} at column{1} in expression [{2}].",e,r,this.text)},readNumber:function(){for(var e="",t=this.index;this.index<this.text.length;){var n=f(this.text.charAt(this.index));if("."===n||this.isNumber(n))e+=n;else{var r=this.peek();if("e"===n&&this.isExpOperator(r))e+=n;else if(this.isExpOperator(n)&&r&&this.isNumber(r)&&"e"===e.charAt(e.length-1))e+=n;else{if(!this.isExpOperator(n)||r&&this.isNumber(r)||"e"!==e.charAt(e.length-1))break;this.throwError("Invalid exponent")}}this.index++}this.tokens.push({index:t,text:e,constant:!0,value:Number(e)})},readIdent:function(){var e=this.index;for(this.index+=this.peekMultichar().length;this.index<this.text.length;){var t=this.peekMultichar();if(!this.isIdentifierContinue(t))break;this.index+=t.length}this.tokens.push({index:e,text:this.text.slice(e,this.index),identifier:!0})},readString:function(e){var t=this.index;this.index++;for(var n="",r=e,i=!1;this.index<this.text.length;){var a=this.text.charAt(this.index);if(r+=a,i){if("u"===a){var o=this.text.substring(this.index+1,this.index+5);o.match(/[\da-f]{4}/i)||this.throwError("Invalid unicode escape [\\u"+o+"]"),this.index+=4,n+=String.fromCharCode(parseInt(o,16))}else{n+=vr[a]||a}i=!1}else if("\\"===a)i=!0;else{if(a===e)return this.index++,void this.tokens.push({index:t,text:r,constant:!0,value:n});n+=a}this.index++}this.throwError("Unterminated quote",t)}};var mr=function(e,t){this.lexer=e,this.options=t};function gr(e,t){return void 0!==e?e:t}function br(e,t){return void 0===e?t:void 0===t?e:e+t}mr.Program="Program",mr.ExpressionStatement="ExpressionStatement",mr.AssignmentExpression="AssignmentExpression",mr.ConditionalExpression="ConditionalExpression",mr.LogicalExpression="LogicalExpression",mr.BinaryExpression="BinaryExpression",mr.UnaryExpression="UnaryExpression",mr.CallExpression="CallExpression",mr.MemberExpression="MemberExpression",mr.Identifier="Identifier",mr.Literal="Literal",mr.ArrayExpression="ArrayExpression",mr.Property="Property",mr.ObjectExpression="ObjectExpression",mr.ThisExpression="ThisExpression",mr.LocalsExpression="LocalsExpression",mr.NGValueParameter="NGValueParameter",mr.prototype={ast:function(e){this.text=e,this.tokens=this.lexer.lex(e);var t=this.program();return 0!==this.tokens.length&&this.throwError("is an unexpected token",this.tokens[0]),t},program:function(){for(var e=[];;)if(this.tokens.length>0&&!this.peek("}",")",";","]")&&e.push(this.expressionStatement()),!this.expect(";"))return{type:mr.Program,body:e}},expressionStatement:function(){return{type:mr.ExpressionStatement,expression:this.filterChain()}},filterChain:function(){for(var e=this.expression();this.expect("|");)e=this.filter(e);return e},expression:function(){return this.assignment()},assignment:function(){var e=this.ternary();if(this.expect("=")){if(!xr(e))throw fr("lval","Trying to assign a value to a non l-value");e={type:mr.AssignmentExpression,left:e,right:this.assignment(),operator:"="}}return e},ternary:function(){var e,t,n=this.logicalOR();return this.expect("?")&&(e=this.expression(),this.consume(":"))?(t=this.expression(),{type:mr.ConditionalExpression,test:n,alternate:e,consequent:t}):n},logicalOR:function(){for(var e=this.logicalAND();this.expect("||");)e={type:mr.LogicalExpression,operator:"||",left:e,right:this.logicalAND()};return e},logicalAND:function(){for(var e=this.equality();this.expect("&&");)e={type:mr.LogicalExpression,operator:"&&",left:e,right:this.equality()};return e},equality:function(){for(var e,t=this.relational();e=this.expect("==","!=","===","!==");)t={type:mr.BinaryExpression,operator:e.text,left:t,right:this.relational()};return t},relational:function(){for(var e,t=this.additive();e=this.expect("<",">","<=",">=");)t={type:mr.BinaryExpression,operator:e.text,left:t,right:this.additive()};return t},additive:function(){for(var e,t=this.multiplicative();e=this.expect("+","-");)t={type:mr.BinaryExpression,operator:e.text,left:t,right:this.multiplicative()};return t},multiplicative:function(){for(var e,t=this.unary();e=this.expect("*","/","%");)t={type:mr.BinaryExpression,operator:e.text,left:t,right:this.unary()};return t},unary:function(){var e;return(e=this.expect("+","-","!"))?{type:mr.UnaryExpression,operator:e.text,prefix:!0,argument:this.unary()}:this.primary()},primary:function(){var e,t;for(this.expect("(")?(e=this.filterChain(),this.consume(")")):this.expect("[")?e=this.arrayDeclaration():this.expect("{")?e=this.object():this.selfReferential.hasOwnProperty(this.peek().text)?e=ae(this.selfReferential[this.consume().text]):this.options.literals.hasOwnProperty(this.peek().text)?e={type:mr.Literal,value:this.options.literals[this.consume().text]}:this.peek().identifier?e=this.identifier():this.peek().constant?e=this.constant():this.throwError("not a primary expression",this.peek());t=this.expect("(","[",".");)"("===t.text?(e={type:mr.CallExpression,callee:e,arguments:this.parseArguments()},this.consume(")")):"["===t.text?(e={type:mr.MemberExpression,object:e,property:this.expression(),computed:!0},this.consume("]")):"."===t.text?e={type:mr.MemberExpression,object:e,property:this.identifier(),computed:!1}:this.throwError("IMPOSSIBLE");return e},filter:function(e){for(var t=[e],n={type:mr.CallExpression,callee:this.identifier(),arguments:t,filter:!0};this.expect(":");)t.push(this.expression());return n},parseArguments:function(){var e=[];if(")"!==this.peekToken().text)do{e.push(this.filterChain())}while(this.expect(","));return e},identifier:function(){var e=this.consume();return e.identifier||this.throwError("is not a valid identifier",e),{type:mr.Identifier,name:e.text}},constant:function(){return{type:mr.Literal,value:this.consume().value}},arrayDeclaration:function(){var e=[];if("]"!==this.peekToken().text)do{if(this.peek("]"))break;e.push(this.expression())}while(this.expect(","));return this.consume("]"),{type:mr.ArrayExpression,elements:e}},object:function(){var e,t=[];if("}"!==this.peekToken().text)do{if(this.peek("}"))break;e={type:mr.Property,kind:"init"},this.peek().constant?(e.key=this.constant(),e.computed=!1,this.consume(":"),e.value=this.expression()):this.peek().identifier?(e.key=this.identifier(),e.computed=!1,this.peek(":")?(this.consume(":"),e.value=this.expression()):e.value=e.key):this.peek("[")?(this.consume("["),e.key=this.expression(),this.consume("]"),e.computed=!0,this.consume(":"),e.value=this.expression()):this.throwError("invalid key",this.peek()),t.push(e)}while(this.expect(","));return this.consume("}"),{type:mr.ObjectExpression,properties:t}},throwError:function(e,t){throw fr("syntax","Syntax Error: Token '{0}' {1} at column {2} of the expression [{3}] starting at [{4}].",t.text,e,t.index+1,this.text,this.text.substring(t.index))},consume:function(e){if(0===this.tokens.length)throw fr("ueoe","Unexpected end of expression: {0}",this.text);var t=this.expect(e);return t||this.throwError("is unexpected, expecting ["+e+"]",this.peek()),t},peekToken:function(){if(0===this.tokens.length)throw fr("ueoe","Unexpected end of expression: {0}",this.text);return this.tokens[0]},peek:function(e,t,n,r){return this.peekAhead(0,e,t,n,r)},peekAhead:function(e,t,n,r,i){if(this.tokens.length>e){var a=this.tokens[e],o=a.text;if(o===t||o===n||o===r||o===i||!t&&!n&&!r&&!i)return a}return!1},expect:function(e,t,n,r){var i=this.peek(e,t,n,r);return!!i&&(this.tokens.shift(),i)},selfReferential:{this:{type:mr.ThisExpression},$locals:{type:mr.LocalsExpression}}};function wr(e,t,n){var r,i,a,o=e.isPure=function(e,t){switch(e.type){case mr.MemberExpression:if(e.computed)return!1;break;case mr.UnaryExpression:return 1;case mr.BinaryExpression:return"+"!==e.operator&&1;case mr.CallExpression:return!1}return void 0===t?2:t}(e,n);switch(e.type){case mr.Program:r=!0,x(e.body,(function(e){wr(e.expression,t,o),r=r&&e.expression.constant})),e.constant=r;break;case mr.Literal:e.constant=!0,e.toWatch=[];break;case mr.UnaryExpression:wr(e.argument,t,o),e.constant=e.argument.constant,e.toWatch=e.argument.toWatch;break;case mr.BinaryExpression:wr(e.left,t,o),wr(e.right,t,o),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.left.toWatch.concat(e.right.toWatch);break;case mr.LogicalExpression:wr(e.left,t,o),wr(e.right,t,o),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.constant?[]:[e];break;case mr.ConditionalExpression:wr(e.test,t,o),wr(e.alternate,t,o),wr(e.consequent,t,o),e.constant=e.test.constant&&e.alternate.constant&&e.consequent.constant,e.toWatch=e.constant?[]:[e];break;case mr.Identifier:e.constant=!1,e.toWatch=[e];break;case mr.MemberExpression:wr(e.object,t,o),e.computed&&wr(e.property,t,o),e.constant=e.object.constant&&(!e.computed||e.property.constant),e.toWatch=e.constant?[]:[e];break;case mr.CallExpression:a=!!e.filter&&function(e,t){return!e(t).$stateful}(t,e.callee.name),r=a,i=[],x(e.arguments,(function(e){wr(e,t,o),r=r&&e.constant,i.push.apply(i,e.toWatch)})),e.constant=r,e.toWatch=a?i:[e];break;case mr.AssignmentExpression:wr(e.left,t,o),wr(e.right,t,o),e.constant=e.left.constant&&e.right.constant,e.toWatch=[e];break;case mr.ArrayExpression:r=!0,i=[],x(e.elements,(function(e){wr(e,t,o),r=r&&e.constant,i.push.apply(i,e.toWatch)})),e.constant=r,e.toWatch=i;break;case mr.ObjectExpression:r=!0,i=[],x(e.properties,(function(e){wr(e.value,t,o),r=r&&e.value.constant,i.push.apply(i,e.value.toWatch),e.computed&&(wr(e.key,t,!1),r=r&&e.key.constant,i.push.apply(i,e.key.toWatch))})),e.constant=r,e.toWatch=i;break;case mr.ThisExpression:case mr.LocalsExpression:e.constant=!1,e.toWatch=[]}}function kr(e){if(1===e.length){var t=e[0].expression,n=t.toWatch;return 1!==n.length?n:n[0]!==t?n:void 0}}function xr(e){return e.type===mr.Identifier||e.type===mr.MemberExpression}function Sr(e){if(1===e.body.length&&xr(e.body[0].expression))return{type:mr.AssignmentExpression,left:e.body[0].expression,right:{type:mr.NGValueParameter},operator:"="}}function _r(e){this.$filter=e}function $r(e){this.$filter=e}function Pr(e,t,n){this.ast=new mr(e,n),this.astCompiler=n.csp?new $r(t):new _r(t)}function Or(e){return W(e.valueOf)?e.valueOf():pr.call(e)}function Cr(){var e,t,n=Ne(),r={true:!0,false:!1,null:null,undefined:void 0};this.addLiteral=function(e,t){r[e]=t},this.setIdentifierFns=function(n,r){return e=n,t=r,this},this.$get=["$filter",function(i){var a={csp:ce().noUnsafeEval,literals:ae(r),isIdentifierStart:W(e)&&e,isIdentifierContinue:W(t)&&t};return o.$$getAst=function(e){return new Pr(new yr(a),i,a).getAst(e).ast},o;function o(e,t){var r,o;switch(typeof e){case"string":if(e=e.trim(),!(r=n[o=e]))r=new Pr(new yr(a),i,a).parse(e),n[o]=p(r);return h(r,t);case"function":return h(e,t);default:return h(D,t)}}function s(e,t,n){return null==e||null==t?e===t:!("object"==typeof e&&"object"==typeof(e=Or(e))&&!n)&&(e===t||e!=e&&t!=t)}function c(e,t,n,r,i){var a,o=r.inputs;if(1===o.length){var c=s;return o=o[0],e.$watch((function(e){var t=o(e);return s(t,c,o.isPure)||(a=r(e,void 0,void 0,[t]),c=t&&Or(t)),a}),t,n,i)}for(var u=[],l=[],f=0,p=o.length;f<p;f++)u[f]=s,l[f]=null;return e.$watch((function(e){for(var t=!1,n=0,i=o.length;n<i;n++){var c=o[n](e);(t||(t=!s(c,u[n],o[n].isPure)))&&(l[n]=c,u[n]=c&&Or(c))}return t&&(a=r(e,void 0,void 0,l)),a}),t,n,i)}function u(e,t,n,r,i){var a,o,s=r.literal?l:N,c=r.$$intercepted||r,u=r.$$interceptor||M,f=r.inputs&&!c.inputs;return d.literal=r.literal,d.constant=r.constant,d.inputs=r.inputs,p(d),a=e.$watch(d,t,n,i);function h(){s(o)&&a()}function d(e,t,n,r){return o=f&&r?r[0]:c(e,t,n,r),s(o)&&e.$$postDigest(h),u(o)}}function l(e){var t=!0;return x(e,(function(e){N(e)||(t=!1)})),t}function f(e,t,n,r){var i=e.$watch((function(e){return i(),r(e)}),t,n);return i}function p(e){return e.constant?e.$$watchDelegate=f:e.oneTime?e.$$watchDelegate=u:e.inputs&&(e.$$watchDelegate=c),e}function h(e,t){if(!t)return e;e.$$interceptor&&(t=function(e,t){function n(n){return t(e(n))}return n.$stateful=e.$stateful||t.$stateful,n.$$pure=e.$$pure&&t.$$pure,n}(e.$$interceptor,t),e=e.$$intercepted);var n=!1,r=function(r,i,a,o){var s=n&&o?o[0]:e(r,i,a,o);return t(s)};return r.$$intercepted=e,r.$$interceptor=t,r.literal=e.literal,r.oneTime=e.oneTime,r.constant=e.constant,t.$stateful||(n=!e.inputs,r.inputs=e.inputs?e.inputs:[e],t.$$pure||(r.inputs=r.inputs.map((function(e){return 2===e.isPure?function(t){return e(t)}:e})))),p(r)}}]}function Er(){var e=!0;this.$get=["$rootScope","$exceptionHandler",function(t,n){return Ir((function(e){t.$evalAsync(e)}),n,e)}],this.errorOnUnhandledRejections=function(t){return N(t)?(e=t,this):e}}function Ar(){var e=!0;this.$get=["$browser","$exceptionHandler",function(t,n){return Ir((function(e){t.defer(e)}),n,e)}],this.errorOnUnhandledRejections=function(t){return N(t)?(e=t,this):e}}function Ir(e,t,n){var r=i("$q",TypeError),a=0,o=[];function s(){return new c}function c(){var e=this.promise=new u;this.resolve=function(t){p(e,t)},this.reject=function(t){h(e,t)},this.notify=function(t){v(e,t)}}function u(){this.$$state={status:0}}function l(){for(;!a&&o.length;){var e=o.shift();if(!jr(e)){Dr(e);var n="Possibly unhandled rejection: "+Ve(e.value);z(e.value)?t(e.value,n):t(n)}}}function f(r){!n||r.pending||2!==r.status||jr(r)||(0===a&&0===o.length&&e(l),o.push(r)),!r.processScheduled&&r.pending&&(r.processScheduled=!0,++a,e((function(){!function(r){var i,o,s;s=r.pending,r.processScheduled=!1,r.pending=void 0;try{for(var c=0,u=s.length;c<u;++c){Dr(r),o=s[c][0],i=s[c][r.status];try{W(i)?p(o,i(r.value)):1===r.status?p(o,r.value):h(o,r.value)}catch(e){h(o,e),e&&!0===e.$$passToExceptionHandler&&t(e)}}}finally{--a,n&&0===a&&e(l)}}(r)})))}function p(e,t){e.$$state.status||(t===e?d(e,r("qcycle","Expected promise to be resolved with value other than itself '{0}'",t)):function e(t,n){var r,i=!1;try{(F(n)||W(n))&&(r=n.then),W(r)?(t.$$state.status=-1,r.call(n,a,o,(function(e){v(t,e)}))):(t.$$state.value=n,t.$$state.status=1,f(t.$$state))}catch(e){o(e)}function a(n){i||(i=!0,e(t,n))}function o(e){i||(i=!0,d(t,e))}}(e,t))}function h(e,t){e.$$state.status||d(e,t)}function d(e,t){e.$$state.value=t,e.$$state.status=2,f(e.$$state)}function v(n,r){var i=n.$$state.pending;n.$$state.status<=0&&i&&i.length&&e((function(){for(var e,n,a=0,o=i.length;a<o;a++){n=i[a][0],e=i[a][3];try{v(n,W(e)?e(r):r)}catch(e){t(e)}}}))}function y(e){var t=new u;return h(t,e),t}function m(e,t,n){var r=null;try{W(n)&&(r=n())}catch(e){return y(e)}return Q(r)?r.then((function(){return t(e)}),y):t(e)}function g(e,t,n,r){var i=new u;return p(i,e),i.then(t,n,r)}C(u.prototype,{then:function(e,t,n){if(L(e)&&L(t)&&L(n))return this;var r=new u;return this.$$state.pending=this.$$state.pending||[],this.$$state.pending.push([r,e,t,n]),this.$$state.status>0&&f(this.$$state),r},catch:function(e){return this.then(null,e)},finally:function(e,t){return this.then((function(t){return m(t,b,e)}),(function(t){return m(t,y,e)}),t)}});var b=g;function w(e){if(!W(e))throw r("norslvr","Expected resolverFn, got '{0}'",e);var t=new u;return e((function(e){p(t,e)}),(function(e){h(t,e)})),t}return w.prototype=u.prototype,w.defer=s,w.reject=y,w.when=g,w.resolve=b,w.all=function(e){var t=new u,n=0,r=H(e)?[]:{};return x(e,(function(e,i){n++,g(e).then((function(e){r[i]=e,--n||p(t,r)}),(function(e){h(t,e)}))})),0===n&&p(t,r),t},w.race=function(e){var t=s();return x(e,(function(e){g(e).then(t.resolve,t.reject)})),t.promise},w}function jr(e){return!!e.pur}function Dr(e){e.pur=!0}function Mr(e){e.$$state&&Dr(e.$$state)}function Tr(){this.$get=["$window","$timeout",function(e,t){var n=e.requestAnimationFrame||e.webkitRequestAnimationFrame,r=e.cancelAnimationFrame||e.webkitCancelAnimationFrame||e.webkitCancelRequestAnimationFrame,i=!!n,a=i?function(e){var t=n(e);return function(){r(t)}}:function(e){var n=t(e,16.66,!1);return function(){t.cancel(n)}};return a.supported=i,a}]}function Rr(){var e=10,t=i("$rootScope"),n=null,r=null;this.digestTtl=function(t){return arguments.length&&(e=t),e},this.$get=["$exceptionHandler","$parse","$browser",function(i,o,s){function c(e){e.currentScope.$$destroyed=!0}function u(){this.$id=$(),this.$$phase=this.$parent=this.$$watchers=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null,this.$root=this,this.$$destroyed=!1,this.$$suspended=!1,this.$$listeners={},this.$$listenerCount={},this.$$watchersCount=0,this.$$isolateBindings=null}u.prototype={constructor:u,$new:function(e,t){var n;return t=t||this,e?(n=new u).$root=this.$root:(this.$$ChildScope||(this.$$ChildScope=function(e){function t(){this.$$watchers=this.$$nextSibling=this.$$childHead=this.$$childTail=null,this.$$listeners={},this.$$listenerCount={},this.$$watchersCount=0,this.$id=$(),this.$$ChildScope=null,this.$$suspended=!1}return t.prototype=e,t}(this)),n=new this.$$ChildScope),n.$parent=t,n.$$prevSibling=t.$$childTail,t.$$childHead?(t.$$childTail.$$nextSibling=n,t.$$childTail=n):t.$$childHead=t.$$childTail=n,(e||t!==this)&&n.$on("$destroy",c),n},$watch:function(e,t,r,i){var a=o(e),s=W(t)?t:D;if(a.$$watchDelegate)return a.$$watchDelegate(this,s,r,a,e);var c=this,u=c.$$watchers,l={fn:s,last:w,get:a,exp:i||e,eq:!!r};return n=null,u||((u=c.$$watchers=[]).$$digestWatchIndex=-1),u.unshift(l),u.$$digestWatchIndex++,g(this,1),function(){var e=ie(u,l);e>=0&&(g(c,-1),e<u.$$digestWatchIndex&&u.$$digestWatchIndex--),n=null}},$watchGroup:function(e,t){var n=new Array(e.length),r=new Array(e.length),i=[],a=this,o=!1,s=!0;if(!e.length){var c=!0;return a.$evalAsync((function(){c&&t(r,r,a)})),function(){c=!1}}if(1===e.length)return this.$watch(e[0],(function(e,i,a){r[0]=e,n[0]=i,t(r,e===i?r:n,a)}));function u(){o=!1;try{s?(s=!1,t(r,r,a)):t(r,n,a)}finally{for(var i=0;i<e.length;i++)n[i]=r[i]}}return x(e,(function(e,t){var n=a.$watch(e,(function(e){r[t]=e,o||(o=!0,a.$evalAsync(u))}));i.push(n)})),function(){for(;i.length;)i.shift()()}},$watchCollection:function(e,t){v.$$pure=o(e).literal,v.$stateful=!v.$$pure;var n,r,i,a=this,s=t.length>1,c=0,u=o(e,v),f=[],p={},h=!0,d=0;function v(e){var t,i,a,o;if(!L(n=e)){if(F(n))if(k(n)){r!==f&&(d=(r=f).length=0,c++),t=n.length,d!==t&&(c++,r.length=d=t);for(var s=0;s<t;s++)o=r[s],a=n[s],o!=o&&a!=a||o===a||(c++,r[s]=a)}else{for(i in r!==p&&(r=p={},d=0,c++),t=0,n)l.call(n,i)&&(t++,a=n[i],o=r[i],i in r?o!=o&&a!=a||o===a||(c++,r[i]=a):(d++,r[i]=a,c++));if(d>t)for(i in c++,r)l.call(n,i)||(d--,delete r[i])}else r!==n&&(r=n,c++);return c}}return this.$watch(u,(function(){if(h?(h=!1,t(n,n,a)):t(n,i,a),s)if(F(n))if(k(n)){i=new Array(n.length);for(var e=0;e<n.length;e++)i[e]=n[e]}else for(var r in i={},n)l.call(n,r)&&(i[r]=n[r]);else i=n}))},$digest:function(){var a,o,c,u,l,d,g,b,k,x=e,_=p.length?f:this,$=[];y("$digest"),s.$$checkUrlChange(),this===f&&null!==r&&(s.defer.cancel(r),S()),n=null;do{l=!1,g=_;for(var P=0;P<p.length;P++){try{(0,(k=p[P]).fn)(k.scope,k.locals)}catch(e){i(e)}n=null}p.length=0;e:do{if(u=!g.$$suspended&&g.$$watchers)for(u.$$digestWatchIndex=u.length;u.$$digestWatchIndex--;)try{if(a=u[u.$$digestWatchIndex])if((o=(0,a.get)(g))===(c=a.last)||(a.eq?se(o,c):I(o)&&I(c))){if(a===n){l=!1;break e}}else l=!0,n=a,a.last=a.eq?ae(o,null):o,(0,a.fn)(o,c===w?o:c,g),x<5&&($[b=4-x]||($[b]=[]),$[b].push({msg:W(a.exp)?"fn: "+(a.exp.name||a.exp.toString()):a.exp,newVal:o,oldVal:c}))}catch(e){i(e)}if(!(d=!g.$$suspended&&g.$$watchersCount&&g.$$childHead||g!==_&&g.$$nextSibling))for(;g!==_&&!(d=g.$$nextSibling);)g=g.$parent}while(g=d);if((l||p.length)&&!x--)throw m(),t("infdig","{0} $digest() iterations reached. Aborting!\nWatchers fired in the last 5 iterations: {1}",e,$)}while(l||p.length);for(m();v<h.length;)try{h[v++]()}catch(e){i(e)}h.length=v=0,s.$$checkUrlChange()},$suspend:function(){this.$$suspended=!0},$isSuspended:function(){return this.$$suspended},$resume:function(){this.$$suspended=!1},$destroy:function(){if(!this.$$destroyed){var e=this.$parent;for(var t in this.$broadcast("$destroy"),this.$$destroyed=!0,this===f&&s.$$applicationDestroyed(),g(this,-this.$$watchersCount),this.$$listenerCount)b(this,this.$$listenerCount[t],t);e&&e.$$childHead===this&&(e.$$childHead=this.$$nextSibling),e&&e.$$childTail===this&&(e.$$childTail=this.$$prevSibling),this.$$prevSibling&&(this.$$prevSibling.$$nextSibling=this.$$nextSibling),this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling),this.$destroy=this.$digest=this.$apply=this.$evalAsync=this.$applyAsync=D,this.$on=this.$watch=this.$watchGroup=function(){return D},this.$$listeners={},this.$$nextSibling=null,function e(t){9===a&&(t.$$childHead&&e(t.$$childHead),t.$$nextSibling&&e(t.$$nextSibling)),t.$parent=t.$$nextSibling=t.$$prevSibling=t.$$childHead=t.$$childTail=t.$root=t.$$watchers=null}(this)}},$eval:function(e,t){return o(e)(this,t)},$evalAsync:function(e,t){f.$$phase||p.length||s.defer((function(){p.length&&f.$digest()}),null,"$evalAsync"),p.push({scope:this,fn:o(e),locals:t})},$$postDigest:function(e){h.push(e)},$apply:function(e){try{y("$apply");try{return this.$eval(e)}finally{m()}}catch(e){i(e)}finally{try{f.$digest()}catch(e){throw i(e),e}}},$applyAsync:function(e){var t=this;e&&d.push((function(){t.$eval(e)})),e=o(e),null===r&&(r=s.defer((function(){f.$apply(S)}),null,"$applyAsync"))},$on:function(e,t){var n=this.$$listeners[e];n||(this.$$listeners[e]=n=[]),n.push(t);var r=this;do{r.$$listenerCount[e]||(r.$$listenerCount[e]=0),r.$$listenerCount[e]++}while(r=r.$parent);var i=this;return function(){var r=n.indexOf(t);-1!==r&&(delete n[r],b(i,1,e))}},$emit:function(e,t){var n,r,a,o=[],s=this,c=!1,u={name:e,targetScope:s,stopPropagation:function(){c=!0},preventDefault:function(){u.defaultPrevented=!0},defaultPrevented:!1},l=le([u],arguments,1);do{for(n=s.$$listeners[e]||o,u.currentScope=s,r=0,a=n.length;r<a;r++)if(n[r])try{n[r].apply(null,l)}catch(e){i(e)}else n.splice(r,1),r--,a--;if(c)break;s=s.$parent}while(s);return u.currentScope=null,u},$broadcast:function(e,t){var n=this,r=n,a=n,o={name:e,targetScope:n,preventDefault:function(){o.defaultPrevented=!0},defaultPrevented:!1};if(!n.$$listenerCount[e])return o;for(var s,c,u,l=le([o],arguments,1);r=a;){for(o.currentScope=r,c=0,u=(s=r.$$listeners[e]||[]).length;c<u;c++)if(s[c])try{s[c].apply(null,l)}catch(e){i(e)}else s.splice(c,1),c--,u--;if(!(a=r.$$listenerCount[e]&&r.$$childHead||r!==n&&r.$$nextSibling))for(;r!==n&&!(a=r.$$nextSibling);)r=r.$parent}return o.currentScope=null,o}};var f=new u,p=f.$$asyncQueue=[],h=f.$$postDigestQueue=[],d=f.$$applyAsyncQueue=[],v=0;return f;function y(e){if(f.$$phase)throw t("inprog","{0} already in progress",f.$$phase);f.$$phase=e}function m(){f.$$phase=null}function g(e,t){do{e.$$watchersCount+=t}while(e=e.$parent)}function b(e,t,n){do{e.$$listenerCount[n]-=t,0===e.$$listenerCount[n]&&delete e.$$listenerCount[n]}while(e=e.$parent)}function w(){}function S(){for(;d.length;)try{d.shift()()}catch(e){i(e)}r=null}}]}function Lr(){var e=/^\s*(https?|s?ftp|mailto|tel|file):/,t=/^\s*((https?|ftp|file|blob):|data:image\/)/;this.aHrefSanitizationWhitelist=function(t){return N(t)?(e=t,this):e},this.imgSrcSanitizationWhitelist=function(e){return N(e)?(t=e,this):t},this.$get=function(){return function(n,r){var i=r?t:e,a=ri(n&&n.trim()).href;return""===a||a.match(i)?n:"unsafe:"+a}}}_r.prototype={compile:function(e){var t=this;this.state={nextId:0,filters:{},fn:{vars:[],body:[],own:{}},assign:{vars:[],body:[],own:{}},inputs:[]},wr(e,t.$filter);var n,r="";if(this.stage="assign",n=Sr(e)){this.state.computing="assign";var i=this.nextId();this.recurse(n,i),this.return_(i),r="fn.assign="+this.generateFunction("assign","s,v,l")}var a=kr(e.body);t.stage="inputs",x(a,(function(e,n){var r="fn"+n;t.state[r]={vars:[],body:[],own:{}},t.state.computing=r;var i=t.nextId();t.recurse(e,i),t.return_(i),t.state.inputs.push({name:r,isPure:e.isPure}),e.watchId=n})),this.state.computing="fn",this.stage="main",this.recurse(e);var o='"'+this.USE+" "+this.STRICT+'";\n'+this.filterPrefix()+"var fn="+this.generateFunction("fn","s,l,a,i")+r+this.watchFns()+"return fn;",s=new Function("$filter","getStringValue","ifDefined","plus",o)(this.$filter,hr,gr,br);return this.state=this.stage=void 0,s},USE:"use",STRICT:"strict",watchFns:function(){var e=[],t=this.state.inputs,n=this;return x(t,(function(t){e.push("var "+t.name+"="+n.generateFunction(t.name,"s")),t.isPure&&e.push(t.name,".isPure="+JSON.stringify(t.isPure)+";")})),t.length&&e.push("fn.inputs=["+t.map((function(e){return e.name})).join(",")+"];"),e.join("")},generateFunction:function(e,t){return"function("+t+"){"+this.varsPrefix(e)+this.body(e)+"};"},filterPrefix:function(){var e=[],t=this;return x(this.state.filters,(function(n,r){e.push(n+"=$filter("+t.escape(r)+")")})),e.length?"var "+e.join(",")+";":""},varsPrefix:function(e){return this.state[e].vars.length?"var "+this.state[e].vars.join(",")+";":""},body:function(e){return this.state[e].body.join("")},recurse:function(e,t,n,r,i,a){var o,s,c,u,l,f=this;if(r=r||D,!a&&N(e.watchId))return t=t||this.nextId(),void this.if_("i",this.lazyAssign(t,this.computedMember("i",e.watchId)),this.lazyRecurse(e,t,n,r,i,!0));switch(e.type){case mr.Program:x(e.body,(function(t,n){f.recurse(t.expression,void 0,void 0,(function(e){s=e})),n!==e.body.length-1?f.current().body.push(s,";"):f.return_(s)}));break;case mr.Literal:u=this.escape(e.value),this.assign(t,u),r(t||u);break;case mr.UnaryExpression:this.recurse(e.argument,void 0,void 0,(function(e){s=e})),u=e.operator+"("+this.ifDefined(s,0)+")",this.assign(t,u),r(u);break;case mr.BinaryExpression:this.recurse(e.left,void 0,void 0,(function(e){o=e})),this.recurse(e.right,void 0,void 0,(function(e){s=e})),u="+"===e.operator?this.plus(o,s):"-"===e.operator?this.ifDefined(o,0)+e.operator+this.ifDefined(s,0):"("+o+")"+e.operator+"("+s+")",this.assign(t,u),r(u);break;case mr.LogicalExpression:t=t||this.nextId(),f.recurse(e.left,t),f.if_("&&"===e.operator?t:f.not(t),f.lazyRecurse(e.right,t)),r(t);break;case mr.ConditionalExpression:t=t||this.nextId(),f.recurse(e.test,t),f.if_(t,f.lazyRecurse(e.alternate,t),f.lazyRecurse(e.consequent,t)),r(t);break;case mr.Identifier:t=t||this.nextId(),n&&(n.context="inputs"===f.stage?"s":this.assign(this.nextId(),this.getHasOwnProperty("l",e.name)+"?l:s"),n.computed=!1,n.name=e.name),f.if_("inputs"===f.stage||f.not(f.getHasOwnProperty("l",e.name)),(function(){f.if_("inputs"===f.stage||"s",(function(){i&&1!==i&&f.if_(f.isNull(f.nonComputedMember("s",e.name)),f.lazyAssign(f.nonComputedMember("s",e.name),"{}")),f.assign(t,f.nonComputedMember("s",e.name))}))}),t&&f.lazyAssign(t,f.nonComputedMember("l",e.name))),r(t);break;case mr.MemberExpression:o=n&&(n.context=this.nextId())||this.nextId(),t=t||this.nextId(),f.recurse(e.object,o,void 0,(function(){f.if_(f.notNull(o),(function(){e.computed?(s=f.nextId(),f.recurse(e.property,s),f.getStringValue(s),i&&1!==i&&f.if_(f.not(f.computedMember(o,s)),f.lazyAssign(f.computedMember(o,s),"{}")),u=f.computedMember(o,s),f.assign(t,u),n&&(n.computed=!0,n.name=s)):(i&&1!==i&&f.if_(f.isNull(f.nonComputedMember(o,e.property.name)),f.lazyAssign(f.nonComputedMember(o,e.property.name),"{}")),u=f.nonComputedMember(o,e.property.name),f.assign(t,u),n&&(n.computed=!1,n.name=e.property.name))}),(function(){f.assign(t,"undefined")})),r(t)}),!!i);break;case mr.CallExpression:t=t||this.nextId(),e.filter?(s=f.filter(e.callee.name),c=[],x(e.arguments,(function(e){var t=f.nextId();f.recurse(e,t),c.push(t)})),u=s+"("+c.join(",")+")",f.assign(t,u),r(t)):(s=f.nextId(),o={},c=[],f.recurse(e.callee,s,o,(function(){f.if_(f.notNull(s),(function(){x(e.arguments,(function(t){f.recurse(t,e.constant?void 0:f.nextId(),void 0,(function(e){c.push(e)}))})),u=o.name?f.member(o.context,o.name,o.computed)+"("+c.join(",")+")":s+"("+c.join(",")+")",f.assign(t,u)}),(function(){f.assign(t,"undefined")})),r(t)})));break;case mr.AssignmentExpression:s=this.nextId(),o={},this.recurse(e.left,void 0,o,(function(){f.if_(f.notNull(o.context),(function(){f.recurse(e.right,s),u=f.member(o.context,o.name,o.computed)+e.operator+s,f.assign(t,u),r(t||u)}))}),1);break;case mr.ArrayExpression:c=[],x(e.elements,(function(t){f.recurse(t,e.constant?void 0:f.nextId(),void 0,(function(e){c.push(e)}))})),u="["+c.join(",")+"]",this.assign(t,u),r(t||u);break;case mr.ObjectExpression:c=[],l=!1,x(e.properties,(function(e){e.computed&&(l=!0)})),l?(t=t||this.nextId(),this.assign(t,"{}"),x(e.properties,(function(e){e.computed?(o=f.nextId(),f.recurse(e.key,o)):o=e.key.type===mr.Identifier?e.key.name:""+e.key.value,s=f.nextId(),f.recurse(e.value,s),f.assign(f.member(t,o,e.computed),s)}))):(x(e.properties,(function(t){f.recurse(t.value,e.constant?void 0:f.nextId(),void 0,(function(e){c.push(f.escape(t.key.type===mr.Identifier?t.key.name:""+t.key.value)+":"+e)}))})),u="{"+c.join(",")+"}",this.assign(t,u)),r(t||u);break;case mr.ThisExpression:this.assign(t,"s"),r(t||"s");break;case mr.LocalsExpression:this.assign(t,"l"),r(t||"l");break;case mr.NGValueParameter:this.assign(t,"v"),r(t||"v")}},getHasOwnProperty:function(e,t){var n=e+"."+t,r=this.current().own;return r.hasOwnProperty(n)||(r[n]=this.nextId(!1,e+"&&("+this.escape(t)+" in "+e+")")),r[n]},assign:function(e,t){if(e)return this.current().body.push(e,"=",t,";"),e},filter:function(e){return this.state.filters.hasOwnProperty(e)||(this.state.filters[e]=this.nextId(!0)),this.state.filters[e]},ifDefined:function(e,t){return"ifDefined("+e+","+this.escape(t)+")"},plus:function(e,t){return"plus("+e+","+t+")"},return_:function(e){this.current().body.push("return ",e,";")},if_:function(e,t,n){if(!0===e)t();else{var r=this.current().body;r.push("if(",e,"){"),t(),r.push("}"),n&&(r.push("else{"),n(),r.push("}"))}},not:function(e){return"!("+e+")"},isNull:function(e){return e+"==null"},notNull:function(e){return e+"!=null"},nonComputedMember:function(e,t){return/^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(t)?e+"."+t:e+'["'+t.replace(/[^$_a-zA-Z0-9]/g,this.stringEscapeFn)+'"]'},computedMember:function(e,t){return e+"["+t+"]"},member:function(e,t,n){return n?this.computedMember(e,t):this.nonComputedMember(e,t)},getStringValue:function(e){this.assign(e,"getStringValue("+e+")")},lazyRecurse:function(e,t,n,r,i,a){var o=this;return function(){o.recurse(e,t,n,r,i,a)}},lazyAssign:function(e,t){var n=this;return function(){n.assign(e,t)}},stringEscapeRegex:/[^ a-zA-Z0-9]/g,stringEscapeFn:function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)},escape:function(e){if(K(e))return"'"+e.replace(this.stringEscapeRegex,this.stringEscapeFn)+"'";if(V(e))return e.toString();if(!0===e)return"true";if(!1===e)return"false";if(null===e)return"null";if(void 0===e)return"undefined";throw fr("esc","IMPOSSIBLE")},nextId:function(e,t){var n="v"+this.state.nextId++;return e||this.current().vars.push(n+(t?"="+t:"")),n},current:function(){return this.state[this.state.computing]}},$r.prototype={compile:function(e){var t,n,r=this;wr(e,r.$filter),(t=Sr(e))&&(n=this.recurse(t));var i,a=kr(e.body);a&&(i=[],x(a,(function(e,t){var n=r.recurse(e);n.isPure=e.isPure,e.input=n,i.push(n),e.watchId=t})));var o=[];x(e.body,(function(e){o.push(r.recurse(e.expression))}));var s=0===e.body.length?D:1===e.body.length?o[0]:function(e,t){var n;return x(o,(function(r){n=r(e,t)})),n};return n&&(s.assign=function(e,t,r){return n(e,r,t)}),i&&(s.inputs=i),s},recurse:function(e,t,n){var r,i,a,o=this;if(e.input)return this.inputs(e.input,e.watchId);switch(e.type){case mr.Literal:return this.value(e.value,t);case mr.UnaryExpression:return i=this.recurse(e.argument),this["unary"+e.operator](i,t);case mr.BinaryExpression:case mr.LogicalExpression:return r=this.recurse(e.left),i=this.recurse(e.right),this["binary"+e.operator](r,i,t);case mr.ConditionalExpression:return this["ternary?:"](this.recurse(e.test),this.recurse(e.alternate),this.recurse(e.consequent),t);case mr.Identifier:return o.identifier(e.name,t,n);case mr.MemberExpression:return r=this.recurse(e.object,!1,!!n),e.computed||(i=e.property.name),e.computed&&(i=this.recurse(e.property)),e.computed?this.computedMember(r,i,t,n):this.nonComputedMember(r,i,t,n);case mr.CallExpression:return a=[],x(e.arguments,(function(e){a.push(o.recurse(e))})),e.filter&&(i=this.$filter(e.callee.name)),e.filter||(i=this.recurse(e.callee,!0)),e.filter?function(e,n,r,o){for(var s=[],c=0;c<a.length;++c)s.push(a[c](e,n,r,o));var u=i.apply(void 0,s,o);return t?{context:void 0,name:void 0,value:u}:u}:function(e,n,r,o){var s,c=i(e,n,r,o);if(null!=c.value){for(var u=[],l=0;l<a.length;++l)u.push(a[l](e,n,r,o));s=c.value.apply(c.context,u)}return t?{value:s}:s};case mr.AssignmentExpression:return r=this.recurse(e.left,!0,1),i=this.recurse(e.right),function(e,n,a,o){var s=r(e,n,a,o),c=i(e,n,a,o);return s.context[s.name]=c,t?{value:c}:c};case mr.ArrayExpression:return a=[],x(e.elements,(function(e){a.push(o.recurse(e))})),function(e,n,r,i){for(var o=[],s=0;s<a.length;++s)o.push(a[s](e,n,r,i));return t?{value:o}:o};case mr.ObjectExpression:return a=[],x(e.properties,(function(e){e.computed?a.push({key:o.recurse(e.key),computed:!0,value:o.recurse(e.value)}):a.push({key:e.key.type===mr.Identifier?e.key.name:""+e.key.value,computed:!1,value:o.recurse(e.value)})})),function(e,n,r,i){for(var o={},s=0;s<a.length;++s)a[s].computed?o[a[s].key(e,n,r,i)]=a[s].value(e,n,r,i):o[a[s].key]=a[s].value(e,n,r,i);return t?{value:o}:o};case mr.ThisExpression:return function(e){return t?{value:e}:e};case mr.LocalsExpression:return function(e,n){return t?{value:n}:n};case mr.NGValueParameter:return function(e,n,r){return t?{value:r}:r}}},"unary+":function(e,t){return function(n,r,i,a){var o=e(n,r,i,a);return o=N(o)?+o:0,t?{value:o}:o}},"unary-":function(e,t){return function(n,r,i,a){var o=e(n,r,i,a);return o=N(o)?-o:-0,t?{value:o}:o}},"unary!":function(e,t){return function(n,r,i,a){var o=!e(n,r,i,a);return t?{value:o}:o}},"binary+":function(e,t,n){return function(r,i,a,o){var s=br(e(r,i,a,o),t(r,i,a,o));return n?{value:s}:s}},"binary-":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o),c=t(r,i,a,o),u=(N(s)?s:0)-(N(c)?c:0);return n?{value:u}:u}},"binary*":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)*t(r,i,a,o);return n?{value:s}:s}},"binary/":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)/t(r,i,a,o);return n?{value:s}:s}},"binary%":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)%t(r,i,a,o);return n?{value:s}:s}},"binary===":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)===t(r,i,a,o);return n?{value:s}:s}},"binary!==":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)!==t(r,i,a,o);return n?{value:s}:s}},"binary==":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)==t(r,i,a,o);return n?{value:s}:s}},"binary!=":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)!=t(r,i,a,o);return n?{value:s}:s}},"binary<":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)<t(r,i,a,o);return n?{value:s}:s}},"binary>":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)>t(r,i,a,o);return n?{value:s}:s}},"binary<=":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)<=t(r,i,a,o);return n?{value:s}:s}},"binary>=":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)>=t(r,i,a,o);return n?{value:s}:s}},"binary&&":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)&&t(r,i,a,o);return n?{value:s}:s}},"binary||":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)||t(r,i,a,o);return n?{value:s}:s}},"ternary?:":function(e,t,n,r){return function(i,a,o,s){var c=e(i,a,o,s)?t(i,a,o,s):n(i,a,o,s);return r?{value:c}:c}},value:function(e,t){return function(){return t?{context:void 0,name:void 0,value:e}:e}},identifier:function(e,t,n){return function(r,i,a,o){var s=i&&e in i?i:r;n&&1!==n&&s&&null==s[e]&&(s[e]={});var c=s?s[e]:void 0;return t?{context:s,name:e,value:c}:c}},computedMember:function(e,t,n,r){return function(i,a,o,s){var c,u,l=e(i,a,o,s);return null!=l&&(c=hr(c=t(i,a,o,s)),r&&1!==r&&l&&!l[c]&&(l[c]={}),u=l[c]),n?{context:l,name:c,value:u}:u}},nonComputedMember:function(e,t,n,r){return function(i,a,o,s){var c=e(i,a,o,s);r&&1!==r&&c&&null==c[t]&&(c[t]={});var u=null!=c?c[t]:void 0;return n?{context:c,name:t,value:u}:u}},inputs:function(e,t){return function(n,r,i,a){return a?a[t]:e(n,r,i)}}},Pr.prototype={constructor:Pr,parse:function(e){var t=this.getAst(e),n=this.astCompiler.compile(t.ast);return n.literal=function(e){return 0===e.body.length||1===e.body.length&&(e.body[0].expression.type===mr.Literal||e.body[0].expression.type===mr.ArrayExpression||e.body[0].expression.type===mr.ObjectExpression)}(t.ast),n.constant=function(e){return e.constant}(t.ast),n.oneTime=t.oneTime,n},getAst:function(e){var t=!1;return":"===(e=e.trim()).charAt(0)&&":"===e.charAt(1)&&(t=!0,e=e.substring(2)),{ast:this.ast.ast(e),oneTime:t}}};var Nr=i("$sce"),Fr={HTML:"html",CSS:"css",MEDIA_URL:"mediaUrl",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},Ur=/_([a-z])/g;function Kr(e){return e.replace(Ur,Je)}function Vr(e){var t=[];return N(e)&&x(e,(function(e){t.push(function(e){if("self"===e)return e;if(K(e)){if(e.indexOf("***")>-1)throw Nr("iwcard","Illegal sequence *** in string matcher. String: {0}",e);return e=ee(e).replace(/\\\*\\\*/g,".*").replace(/\\\*/g,"[^:/.?&;]*"),new RegExp("^"+e+"$")}if(q(e))return new RegExp("^"+e.source+"$");throw Nr("imatcher",'Matchers may only be "self", string patterns or RegExp objects')}(e))})),t}function Br(){this.SCE_CONTEXTS=Fr;var t=["self"],n=[];this.resourceUrlWhitelist=function(e){return arguments.length&&(t=Vr(e)),t},this.resourceUrlBlacklist=function(e){return arguments.length&&(n=Vr(e)),n},this.$get=["$injector","$$sanitizeUri",function(r,i){var a=function(e){throw Nr("unsafe","Attempting to use an unsafe value in a safe context.")};function o(t,n){return"self"===t?ii(n,ti)||function(t){return ii(t,function(){if(e.document.baseURI)return e.document.baseURI;Xr||((Xr=e.document.createElement("a")).href=".",Xr=Xr.cloneNode(!1));return Xr.href}())}(n):!!t.exec(n.href)}function s(e){var t=function(e){this.$$unwrapTrustedValue=function(){return e}};return e&&(t.prototype=new e),t.prototype.valueOf=function(){return this.$$unwrapTrustedValue()},t.prototype.toString=function(){return this.$$unwrapTrustedValue().toString()},t}r.has("$sanitize")&&(a=r.get("$sanitize"));var c=s(),u={};return u[Fr.HTML]=s(c),u[Fr.CSS]=s(c),u[Fr.MEDIA_URL]=s(c),u[Fr.URL]=s(u[Fr.MEDIA_URL]),u[Fr.JS]=s(c),u[Fr.RESOURCE_URL]=s(u[Fr.URL]),{trustAs:function(e,t){var n=u.hasOwnProperty(e)?u[e]:null;if(!n)throw Nr("icontext","Attempted to trust a value in invalid context. Context: {0}; Value: {1}",e,t);if(null===t||L(t)||""===t)return t;if("string"!=typeof t)throw Nr("itype","Attempted to trust a non-string value in a content requiring a string: Context: {0}",e);return new n(t)},getTrusted:function(e,r){if(null===r||L(r)||""===r)return r;var s=u.hasOwnProperty(e)?u[e]:null;if(s&&r instanceof s)return r.$$unwrapTrustedValue();if(W(r.$$unwrapTrustedValue)&&(r=r.$$unwrapTrustedValue()),e===Fr.MEDIA_URL||e===Fr.URL)return i(r.toString(),e===Fr.MEDIA_URL);if(e===Fr.RESOURCE_URL){if(function(e){var r,i,a=ri(e.toString()),s=!1;for(r=0,i=t.length;r<i;r++)if(o(t[r],a)){s=!0;break}if(s)for(r=0,i=n.length;r<i;r++)if(o(n[r],a)){s=!1;break}return s}(r))return r;throw Nr("insecurl","Blocked loading resource from url not allowed by $sceDelegate policy. URL: {0}",r.toString())}if(e===Fr.HTML)return a(r);throw Nr("unsafe","Attempting to use an unsafe value in a safe context.")},valueOf:function(e){return e instanceof c?e.$$unwrapTrustedValue():e}}}]}function Hr(){var e=!0;this.enabled=function(t){return arguments.length&&(e=!!t),e},this.$get=["$parse","$sceDelegate",function(t,n){if(e&&a<8)throw Nr("iequirks","Strict Contextual Escaping does not support Internet Explorer version < 11 in quirks mode. You can fix this by adding the text <!doctype html> to the top of your HTML document. See http://docs.angularjs.org/api/ng.$sce for more information.");var r=Ke(Fr);r.isEnabled=function(){return e},r.trustAs=n.trustAs,r.getTrusted=n.getTrusted,r.valueOf=n.valueOf,e||(r.trustAs=r.getTrusted=function(e,t){return t},r.valueOf=M),r.parseAs=function(e,n){var i=t(n);return i.literal&&i.constant?i:t(n,(function(t){return r.getTrusted(e,t)}))};var i=r.parseAs,o=r.getTrusted,s=r.trustAs;return x(Fr,(function(e,t){var n=f(t);r[Kr("parse_as_"+n)]=function(t){return i(e,t)},r[Kr("get_trusted_"+n)]=function(t){return o(e,t)},r[Kr("trust_as_"+n)]=function(t){return s(e,t)}})),r}]}function zr(){this.$get=["$window","$document",function(e,t){var n={},r=!(!(e.nw&&e.nw.process)&&e.chrome&&(e.chrome.app&&e.chrome.app.runtime||!e.chrome.app&&e.chrome.runtime&&e.chrome.runtime.id))&&e.history&&e.history.pushState,i=A((/android (\d+)/.exec(f((e.navigator||{}).userAgent))||[])[1]),o=/Boxee/i.test((e.navigator||{}).userAgent),s=t[0]||{},c=s.body&&s.body.style,u=!1,l=!1;return c&&(u=!!("transition"in c||"webkitTransition"in c),l=!!("animation"in c||"webkitAnimation"in c)),{history:!(!r||i<4||o),hasEvent:function(e){if("input"===e&&a)return!1;if(L(n[e])){var t=s.createElement("div");n[e]="on"+e in t}return n[e]},csp:ce(),transitions:u,animations:l,android:i}}]}function Wr(){this.$get=T((function(e){return new qr(e)}))}function qr(e){var t={},n=[],r=this.ALL_TASKS_TYPE="$$all$$",i=this.DEFAULT_TASK_TYPE="$$default$$";function a(){var e=n.pop();return e&&e.cb}function o(e){for(var t=n.length-1;t>=0;--t){var r=n[t];if(r.type===e)return n.splice(t,1),r.cb}}this.completeTask=function(n,s){s=s||i;try{n()}finally{!function(e){t[e=e||i]&&(t[e]--,t[r]--)}(s);var c=t[s],u=t[r];if(!u||!c)for(var l,f=u?o:a;l=f(s);)try{l()}catch(t){e.error(t)}}},this.incTaskCount=function(e){t[e=e||i]=(t[e]||0)+1,t[r]=(t[r]||0)+1},this.notifyWhenNoPendingTasks=function(e,i){t[i=i||r]?n.push({type:i,cb:e}):e()}}var Gr=i("$templateRequest");function Yr(){var e;this.httpOptions=function(t){return t?(e=t,this):e},this.$get=["$exceptionHandler","$templateCache","$http","$q","$sce",function(t,n,r,i,a){function o(s,c){o.totalPendingRequests++,K(s)&&!L(n.get(s))||(s=a.getTrustedResourceUrl(s));var u=r.defaults&&r.defaults.transformResponse;return H(u)?u=u.filter((function(e){return e!==Dn})):u===Dn&&(u=null),r.get(s,C({cache:n,transformResponse:u},e)).finally((function(){o.totalPendingRequests--})).then((function(e){return n.put(s,e.data)}),(function(e){c||(e=Gr("tpload","Failed to load template: {0} (HTTP status: {1} {2})",s,e.status,e.statusText),t(e));return i.reject(e)}))}return o.totalPendingRequests=0,o}]}function Jr(){this.$get=["$rootScope","$browser","$location",function(e,t,n){var r={findBindings:function(e,t,n){var r=e.getElementsByClassName("ng-binding"),i=[];return x(r,(function(e){var r=b.element(e).data("$binding");r&&x(r,(function(r){n?new RegExp("(^|\\s)"+ee(t)+"(\\s|\\||$)").test(r)&&i.push(e):-1!==r.indexOf(t)&&i.push(e)}))})),i},findModels:function(e,t,n){for(var r=["ng-","data-ng-","ng\\:"],i=0;i<r.length;++i){var a="["+r[i]+"model"+(n?"=":"*=")+'"'+t+'"]',o=e.querySelectorAll(a);if(o.length)return o}},getLocation:function(){return n.url()},setLocation:function(t){t!==n.url()&&(n.url(t),e.$digest())},whenStable:function(e){t.notifyWhenNoOutstandingRequests(e)}};return r}]}var Qr=i("$timeout");function Zr(){this.$get=["$rootScope","$browser","$q","$$q","$exceptionHandler",function(e,t,n,r,i){var a={};function o(o,s,c){W(o)||(c=s,s=o,o=D);var u,l=fe(arguments,3),f=N(c)&&!c,p=(f?r:n).defer(),h=p.promise;return u=t.defer((function(){try{p.resolve(o.apply(null,l))}catch(e){p.reject(e),i(e)}finally{delete a[h.$$timeoutId]}f||e.$apply()}),s,"$timeout"),h.$$timeoutId=u,a[u]=p,h}return o.cancel=function(e){if(!e)return!1;if(!e.hasOwnProperty("$$timeoutId"))throw Qr("badprom","`$timeout.cancel()` called with a promise that was not generated by `$timeout()`.");if(!a.hasOwnProperty(e.$$timeoutId))return!1;var n=e.$$timeoutId,r=a[n];return Mr(r.promise),r.reject("canceled"),delete a[n],t.defer.cancel(n)},o}]}var Xr,ei=e.document.createElement("a"),ti=ri(e.location.href);ei.href="http://[::1]";var ni="[::1]"===ei.hostname;function ri(e){if(!K(e))return e;var t=e;a&&(ei.setAttribute("href",t),t=ei.href),ei.setAttribute("href",t);var n=ei.hostname;return!ni&&n.indexOf(":")>-1&&(n="["+n+"]"),{href:ei.href,protocol:ei.protocol?ei.protocol.replace(/:$/,""):"",host:ei.host,search:ei.search?ei.search.replace(/^\?/,""):"",hash:ei.hash?ei.hash.replace(/^#/,""):"",hostname:n,port:ei.port,pathname:"/"===ei.pathname.charAt(0)?ei.pathname:"/"+ei.pathname}}function ii(e,t){return e=ri(e),t=ri(t),e.protocol===t.protocol&&e.host===t.host}function ai(){this.$get=T(e)}function oi(e){var t=e[0]||{},n={},r="";function i(e){try{return decodeURIComponent(e)}catch(t){return e}}return function(){var e,a,o,s,c,u=function(e){try{return e.cookie||""}catch(e){return""}}(t);if(u!==r)for(e=(r=u).split("; "),n={},o=0;o<e.length;o++)(s=(a=e[o]).indexOf("="))>0&&(c=i(a.substring(0,s)),L(n[c])&&(n[c]=i(a.substring(s+1))));return n}}function si(){this.$get=oi}function ci(e){function t(n,r){if(F(n)){var i={};return x(n,(function(e,n){i[n]=t(n,e)})),i}return e.factory(n+"Filter",r)}this.register=t,this.$get=["$injector",function(e){return function(t){return e.get(t+"Filter")}}],t("currency",pi),t("date",_i),t("filter",ui),t("json",$i),t("limitTo",Ci),t("lowercase",Pi),t("number",hi),t("orderBy",Ai),t("uppercase",Oi)}function ui(){return function(e,t,n,r){if(!k(e)){if(null==e)return e;throw i("filter")("notarray","Expected array but received: {0}",e)}var a,o;switch(r=r||"$",fi(t)){case"function":a=t;break;case"boolean":case"null":case"number":case"string":o=!0;case"object":a=function(e,t,n,r){var i=F(e)&&n in e;!0===t?t=se:W(t)||(t=function(e,t){return!L(e)&&(null===e||null===t?e===t:!(F(t)||F(e)&&!R(e))&&(e=f(""+e),t=f(""+t),-1!==e.indexOf(t)))});return function(a){return i&&!F(a)?li(a,e[n],t,n,!1):li(a,e,t,n,r)}}(t,n,r,o);break;default:return e}return Array.prototype.filter.call(e,a)}}function li(e,t,n,r,i,a){var o=fi(e),s=fi(t);if("string"===s&&"!"===t.charAt(0))return!li(e,t.substring(1),n,r,i);if(H(e))return e.some((function(e){return li(e,t,n,r,i)}));switch(o){case"object":var c;if(i){for(c in e)if(c.charAt&&"$"!==c.charAt(0)&&li(e[c],t,n,r,!0))return!0;return!a&&li(e,t,n,r,!1)}if("object"===s){for(c in t){var u=t[c];if(!W(u)&&!L(u)){var l=c===r;if(!li(l?e:e[c],u,n,r,l,l))return!1}}return!0}return n(e,t);case"function":return!1;default:return n(e,t)}}function fi(e){return null===e?"null":typeof e}oi.$inject=["$document"],ci.$inject=["$provide"];function pi(e){var t=e.NUMBER_FORMATS;return function(e,n,r){L(n)&&(n=t.CURRENCY_SYM),L(r)&&(r=t.PATTERNS[1].maxFrac);var i=n?/\u00A4/g:/\s*\u00A4\s*/g;return null==e?e:di(e,t.PATTERNS[1],t.GROUP_SEP,t.DECIMAL_SEP,r).replace(i,n)}}function hi(e){var t=e.NUMBER_FORMATS;return function(e,n){return null==e?e:di(e,t.PATTERNS[0],t.GROUP_SEP,t.DECIMAL_SEP,n)}}function di(e,t,n,r,i){if(!K(e)&&!V(e)||isNaN(e))return"";var a,o=!isFinite(e),s=!1,c=Math.abs(e)+"",u="";if(o)u="∞";else{(function(e,t,n,r){var i=e.d,a=i.length-e.i,o=(t=L(t)?Math.min(Math.max(n,a),r):+t)+e.i,s=i[o];if(o>0){i.splice(Math.max(e.i,o));for(var c=o;c<i.length;c++)i[c]=0}else{a=Math.max(0,a),e.i=1,i.length=Math.max(1,o=t+1),i[0]=0;for(var u=1;u<o;u++)i[u]=0}if(s>=5)if(o-1<0){for(var l=0;l>o;l--)i.unshift(0),e.i++;i.unshift(1),e.i++}else i[o-1]++;for(;a<Math.max(0,t);a++)i.push(0);var f=i.reduceRight((function(e,t,n,r){return t+=e,r[n]=t%10,Math.floor(t/10)}),0);f&&(i.unshift(f),e.i++)})(a=function(e){var t,n,r,i,a,o=0;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;"0"===e.charAt(r);r++);if(r===(a=e.length))t=[0],n=1;else{for(a--;"0"===e.charAt(a);)a--;for(n-=r,t=[],i=0;r<=a;r++,i++)t[i]=+e.charAt(r)}return n>22&&(t=t.splice(0,21),o=n-1,n=1),{d:t,e:o,i:n}}(c),i,t.minFrac,t.maxFrac);var l=a.d,f=a.i,p=a.e,h=[];for(s=l.reduce((function(e,t){return e&&!t}),!0);f<0;)l.unshift(0),f++;f>0?h=l.splice(f,l.length):(h=l,l=[0]);var d=[];for(l.length>=t.lgSize&&d.unshift(l.splice(-t.lgSize,l.length).join(""));l.length>t.gSize;)d.unshift(l.splice(-t.gSize,l.length).join(""));l.length&&d.unshift(l.join("")),u=d.join(n),h.length&&(u+=r+h.join("")),p&&(u+="e+"+p)}return e<0&&!s?t.negPre+u+t.negSuf:t.posPre+u+t.posSuf}function vi(e,t,n,r){var i="";for((e<0||r&&e<=0)&&(r?e=1-e:(e=-e,i="-")),e=""+e;e.length<t;)e="0"+e;return n&&(e=e.substr(e.length-t)),i+e}function yi(e,t,n,r,i){return n=n||0,function(a){var o=a["get"+e]();return(n>0||o>-n)&&(o+=n),0===o&&-12===n&&(o=12),vi(o,t,r,i)}}function mi(e,t,n){return function(r,i){var a=r["get"+e]();return i[p((n?"STANDALONE":"")+(t?"SHORT":"")+e)][a]}}function gi(e){var t=new Date(e,0,1).getDay();return new Date(e,0,(t<=4?5:12)-t)}function bi(e){return function(t){var n,r=gi(t.getFullYear()),i=+(n=t,new Date(n.getFullYear(),n.getMonth(),n.getDate()+(4-n.getDay())))-+r;return vi(1+Math.round(i/6048e5),e)}}function wi(e,t){return e.getFullYear()<=0?t.ERAS[0]:t.ERAS[1]}pi.$inject=["$locale"],hi.$inject=["$locale"];var ki={yyyy:yi("FullYear",4,0,!1,!0),yy:yi("FullYear",2,0,!0,!0),y:yi("FullYear",1,0,!1,!0),MMMM:mi("Month"),MMM:mi("Month",!0),MM:yi("Month",2,1),M:yi("Month",1,1),LLLL:mi("Month",!1,!0),dd:yi("Date",2),d:yi("Date",1),HH:yi("Hours",2),H:yi("Hours",1),hh:yi("Hours",2,-12),h:yi("Hours",1,-12),mm:yi("Minutes",2),m:yi("Minutes",1),ss:yi("Seconds",2),s:yi("Seconds",1),sss:yi("Milliseconds",3),EEEE:mi("Day"),EEE:mi("Day",!0),a:function(e,t){return e.getHours()<12?t.AMPMS[0]:t.AMPMS[1]},Z:function(e,t,n){var r=-1*n,i=r>=0?"+":"";return i+=vi(Math[r>0?"floor":"ceil"](r/60),2)+vi(Math.abs(r%60),2)},ww:bi(2),w:bi(1),G:wi,GG:wi,GGG:wi,GGGG:function(e,t){return e.getFullYear()<=0?t.ERANAMES[0]:t.ERANAMES[1]}},xi=/((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))([\s\S]*)/,Si=/^-?\d+$/;function _i(e){var t=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(n,r,i){var a,o,s="",c=[];if(r=r||"mediumDate",r=e.DATETIME_FORMATS[r]||r,K(n)&&(n=Si.test(n)?A(n):function(e){var n;if(n=e.match(t)){var r=new Date(0),i=0,a=0,o=n[8]?r.setUTCFullYear:r.setFullYear,s=n[8]?r.setUTCHours:r.setHours;n[9]&&(i=A(n[9]+n[10]),a=A(n[9]+n[11])),o.call(r,A(n[1]),A(n[2])-1,A(n[3]));var c=A(n[4]||0)-i,u=A(n[5]||0)-a,l=A(n[6]||0),f=Math.round(1e3*parseFloat("0."+(n[7]||0)));return s.call(r,c,u,l,f),r}return e}(n)),V(n)&&(n=new Date(n)),!B(n)||!isFinite(n.getTime()))return n;for(;r;)(o=xi.exec(r))?r=(c=le(c,o,1)).pop():(c.push(r),r=null);var u=n.getTimezoneOffset();return i&&(u=me(i,u),n=be(n,i,!0)),x(c,(function(t){s+=(a=ki[t])?a(n,e.DATETIME_FORMATS,u):"''"===t?"'":t.replace(/(^'|'$)/g,"").replace(/''/g,"'")})),s}}function $i(){return function(e,t){return L(t)&&(t=2),de(e,t)}}_i.$inject=["$locale"];var Pi=T(f),Oi=T(p);function Ci(){return function(e,t,n){return t=Math.abs(Number(t))===1/0?Number(t):A(t),I(t)?e:(V(e)&&(e=e.toString()),k(e)?(n=(n=!n||isNaN(n)?0:A(n))<0?Math.max(0,e.length+n):n,t>=0?Ei(e,n,n+t):0===n?Ei(e,t,e.length):Ei(e,Math.max(0,n+t),n)):e)}}function Ei(e,t,n){return K(e)?e.slice(t,n):h.call(e,t,n)}function Ai(e){return function(r,a,o,s){if(null==r)return r;if(!k(r))throw i("orderBy")("notarray","Expected array but received: {0}",r);H(a)||(a=[a]),0===a.length&&(a=["+"]);var c=a.map((function(t){var n=1,r=M;if(W(t))r=t;else if(K(t)&&("+"!==t.charAt(0)&&"-"!==t.charAt(0)||(n="-"===t.charAt(0)?-1:1,t=t.substring(1)),""!==t&&(r=e(t)).constant)){var i=r();r=function(e){return e[i]}}return{get:r,descending:n}})),u=o?-1:1,l=W(s)?s:n,f=Array.prototype.map.call(r,(function(e,n){return{value:e,tieBreaker:{value:n,type:"number",index:n},predicateValues:c.map((function(r){return function(e,n){var r=typeof e;null===e?r="null":"object"===r&&(e=function(e){if(W(e.valueOf)&&t(e=e.valueOf()))return e;if(R(e)&&t(e=e.toString()))return e;return e}(e));return{value:e,type:r,index:n}}(r.get(e),n)}))}}));return f.sort((function(e,t){for(var r=0,i=c.length;r<i;r++){var a=l(e.predicateValues[r],t.predicateValues[r]);if(a)return a*c[r].descending*u}return(l(e.tieBreaker,t.tieBreaker)||n(e.tieBreaker,t.tieBreaker))*u})),r=f.map((function(e){return e.value}))};function t(e){switch(typeof e){case"number":case"boolean":case"string":return!0;default:return!1}}function n(e,t){var n=0,r=e.type,i=t.type;if(r===i){var a=e.value,o=t.value;"string"===r?(a=a.toLowerCase(),o=o.toLowerCase()):"object"===r&&(F(a)&&(a=e.index),F(o)&&(o=t.index)),a!==o&&(n=a<o?-1:1)}else n="undefined"===r?1:"undefined"===i?-1:"null"===r?1:"null"===i?-1:r<i?-1:1;return n}}function Ii(e){return W(e)&&(e={link:e}),e.restrict=e.restrict||"AC",T(e)}Ai.$inject=["$parse"];var ji=T({restrict:"E",compile:function(e,t){if(!t.href&&!t.xlinkHref)return function(e,t){if("a"===t[0].nodeName.toLowerCase()){var n="[object SVGAnimatedString]"===y.call(t.prop("href"))?"xlink:href":"href";t.on("click",(function(e){t.attr(n)||e.preventDefault()}))}}}}),Di={};x(Pt,(function(e,t){if("multiple"!==e){var n=dn("ng-"+t),r=i;"checked"===e&&(r=function(e,t,r){r.ngModel!==r[n]&&i(e,0,r)}),Di[n]=function(){return{restrict:"A",priority:100,link:r}}}function i(e,r,i){e.$watch(i[n],(function(e){i.$set(t,!!e)}))}})),x(Ct,(function(e,t){Di[t]=function(){return{priority:100,link:function(e,n,r){if("ngPattern"===t&&"/"===r.ngPattern.charAt(0)){var i=r.ngPattern.match(u);if(i)return void r.$set("ngPattern",new RegExp(i[1],i[2]))}e.$watch(r[t],(function(e){r.$set(t,e)}))}}}})),x(["src","srcset","href"],(function(e){var t=dn("ng-"+e);Di[t]=["$sce",function(n){return{priority:99,link:function(r,i,o){var s=e,c=e;"href"===e&&"[object SVGAnimatedString]"===y.call(i.prop("href"))&&(c="xlinkHref",o.$attr[c]="xlink:href",s=null),o.$set(t,n.getTrustedMediaUrl(o[t])),o.$observe(t,(function(t){t?(o.$set(c,t),a&&s&&i.prop(s,o[c])):"href"===e&&o.$set(c,null)}))}}}]}));var Mi={$addControl:D,$getControls:T([]),$$renameControl:function(e,t){e.$name=t},$removeControl:D,$setValidity:D,$setDirty:D,$setPristine:D,$setSubmitted:D,$$setSubmitted:D};function Ti(e,t,n,r,i){this.$$controls=[],this.$error={},this.$$success={},this.$pending=void 0,this.$name=i(t.name||t.ngForm||"")(n),this.$dirty=!1,this.$pristine=!0,this.$valid=!0,this.$invalid=!1,this.$submitted=!1,this.$$parentForm=Mi,this.$$element=e,this.$$animate=r,Fi(this)}Ti.$inject=["$element","$attrs","$scope","$animate","$interpolate"],Ti.prototype={$rollbackViewValue:function(){x(this.$$controls,(function(e){e.$rollbackViewValue()}))},$commitViewValue:function(){x(this.$$controls,(function(e){e.$commitViewValue()}))},$addControl:function(e){Re(e.$name,"input"),this.$$controls.push(e),e.$name&&(this[e.$name]=e),e.$$parentForm=this},$getControls:function(){return Ke(this.$$controls)},$$renameControl:function(e,t){var n=e.$name;this[n]===e&&delete this[n],this[t]=e,e.$name=t},$removeControl:function(e){e.$name&&this[e.$name]===e&&delete this[e.$name],x(this.$pending,(function(t,n){this.$setValidity(n,null,e)}),this),x(this.$error,(function(t,n){this.$setValidity(n,null,e)}),this),x(this.$$success,(function(t,n){this.$setValidity(n,null,e)}),this),ie(this.$$controls,e),e.$$parentForm=Mi},$setDirty:function(){this.$$animate.removeClass(this.$$element,Ma),this.$$animate.addClass(this.$$element,Ta),this.$dirty=!0,this.$pristine=!1,this.$$parentForm.$setDirty()},$setPristine:function(){this.$$animate.setClass(this.$$element,Ma,Ta+" ng-submitted"),this.$dirty=!1,this.$pristine=!0,this.$submitted=!1,x(this.$$controls,(function(e){e.$setPristine()}))},$setUntouched:function(){x(this.$$controls,(function(e){e.$setUntouched()}))},$setSubmitted:function(){for(var e=this;e.$$parentForm&&e.$$parentForm!==Mi;)e=e.$$parentForm;e.$$setSubmitted()},$$setSubmitted:function(){this.$$animate.addClass(this.$$element,"ng-submitted"),this.$submitted=!0,x(this.$$controls,(function(e){e.$$setSubmitted&&e.$$setSubmitted()}))}},Ui({clazz:Ti,set:function(e,t,n){var r=e[t];r?-1===r.indexOf(n)&&r.push(n):e[t]=[n]},unset:function(e,t,n){var r=e[t];r&&(ie(r,n),0===r.length&&delete e[t])}});var Ri=function(e){return["$timeout","$parse",function(t,n){return{name:"form",restrict:e?"EAC":"E",require:["form","^^?form"],controller:Ti,compile:function(n,i){n.addClass(Ma).addClass(ja);var a=i.name?"name":!(!e||!i.ngForm)&&"ngForm";return{pre:function(e,n,i,o){var s=o[0];if(!("action"in i)){var c=function(t){e.$apply((function(){s.$commitViewValue(),s.$setSubmitted()})),t.preventDefault()};n[0].addEventListener("submit",c),n.on("$destroy",(function(){t((function(){n[0].removeEventListener("submit",c)}),0,!1)}))}(o[1]||s.$$parentForm).$addControl(s);var u=a?r(s.$name):D;a&&(u(e,s),i.$observe(a,(function(t){s.$name!==t&&(u(e,void 0),s.$$parentForm.$$renameControl(s,t),(u=r(s.$name))(e,s))}))),n.on("$destroy",(function(){s.$$parentForm.$removeControl(s),u(e,void 0),C(s,Mi)}))}}}};function r(e){return""===e?n('this[""]').assign:n(e).assign||D}}]},Li=Ri(),Ni=Ri(!0);function Fi(e){e.$$classCache={},e.$$classCache[Da]=!(e.$$classCache[ja]=e.$$element.hasClass(ja))}function Ui(e){var t=e.clazz,n=e.set,r=e.unset;function i(e,t,n){n&&!e.$$classCache[t]?(e.$$animate.addClass(e.$$element,t),e.$$classCache[t]=!0):!n&&e.$$classCache[t]&&(e.$$animate.removeClass(e.$$element,t),e.$$classCache[t]=!1)}function a(e,t,n){t=t?"-"+je(t,"-"):"",i(e,ja+t,!0===n),i(e,Da+t,!1===n)}t.prototype.$setValidity=function(e,t,o){var s;L(t)?function(e,t,r,i){e[t]||(e[t]={});n(e[t],r,i)}(this,"$pending",e,o):function(e,t,n,i){e[t]&&r(e[t],n,i);Ki(e[t])&&(e[t]=void 0)}(this,"$pending",e,o),J(t)?t?(r(this.$error,e,o),n(this.$$success,e,o)):(n(this.$error,e,o),r(this.$$success,e,o)):(r(this.$error,e,o),r(this.$$success,e,o)),this.$pending?(i(this,"ng-pending",!0),this.$valid=this.$invalid=void 0,a(this,"",null)):(i(this,"ng-pending",!1),this.$valid=Ki(this.$error),this.$invalid=!this.$valid,a(this,"",this.$valid)),a(this,e,s=this.$pending&&this.$pending[e]?void 0:!this.$error[e]&&(!!this.$$success[e]||null)),this.$$parentForm.$setValidity(e,s,this)}}function Ki(e){if(e)for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}var Vi=/^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/,Bi=/^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i,Hi=/^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[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])?)*$/,zi=/^\s*(-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/,Wi=/^(\d{4,})-(\d{2})-(\d{2})$/,qi=/^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,Gi=/^(\d{4,})-W(\d\d)$/,Yi=/^(\d{4,})-(\d\d)$/,Ji=/^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,Qi=Ne();x("date,datetime-local,month,time,week".split(","),(function(e){Qi[e]=!0}));var Zi={text:function(e,t,n,r,i,a){ea(e,t,n,r,i,a),Xi(r)},date:na("date",Wi,ta(Wi,["yyyy","MM","dd"]),"yyyy-MM-dd"),"datetime-local":na("datetimelocal",qi,ta(qi,["yyyy","MM","dd","HH","mm","ss","sss"]),"yyyy-MM-ddTHH:mm:ss.sss"),time:na("time",Ji,ta(Ji,["HH","mm","ss","sss"]),"HH:mm:ss.sss"),week:na("week",Gi,(function(e,t){if(B(e))return e;if(K(e)){Gi.lastIndex=0;var n=Gi.exec(e);if(n){var r=+n[1],i=+n[2],a=0,o=0,s=0,c=0,u=gi(r),l=7*(i-1);return t&&(a=t.getHours(),o=t.getMinutes(),s=t.getSeconds(),c=t.getMilliseconds()),new Date(r,0,u.getDate()+l,a,o,s,c)}}return NaN}),"yyyy-Www"),month:na("month",Yi,ta(Yi,["yyyy","MM"]),"yyyy-MM"),number:function(e,t,n,r,i,a,o,s){var c;if(ra(e,t,n,r,"number"),ia(r),ea(e,t,n,r,i,a),N(n.min)||n.ngMin){var u=n.min||s(n.ngMin)(e);c=aa(u),r.$validators.min=function(e,t){return r.$isEmpty(t)||L(c)||t>=c},n.$observe("min",(function(e){e!==u&&(c=aa(e),u=e,r.$validate())}))}if(N(n.max)||n.ngMax){var l=n.max||s(n.ngMax)(e),f=aa(l);r.$validators.max=function(e,t){return r.$isEmpty(t)||L(f)||t<=f},n.$observe("max",(function(e){e!==l&&(f=aa(e),l=e,r.$validate())}))}if(N(n.step)||n.ngStep){var p=n.step||s(n.ngStep)(e),h=aa(p);r.$validators.step=function(e,t){return r.$isEmpty(t)||L(h)||ca(t,c||0,h)},n.$observe("step",(function(e){e!==p&&(h=aa(e),p=e,r.$validate())}))}},url:function(e,t,n,r,i,a){ea(e,t,n,r,i,a),Xi(r),r.$validators.url=function(e,t){var n=e||t;return r.$isEmpty(n)||Bi.test(n)}},email:function(e,t,n,r,i,a){ea(e,t,n,r,i,a),Xi(r),r.$validators.email=function(e,t){var n=e||t;return r.$isEmpty(n)||Hi.test(n)}},radio:function(e,t,n,r){var i=!n.ngTrim||"false"!==X(n.ngTrim);L(n.name)&&t.attr("name",$());t.on("change",(function(e){var a;t[0].checked&&(a=n.value,i&&(a=X(a)),r.$setViewValue(a,e&&e.type))})),r.$render=function(){var e=n.value;i&&(e=X(e)),t[0].checked=e===r.$viewValue},n.$observe("value",r.$render)},range:function(e,t,n,r,i,a){ra(e,t,n,r,"range"),ia(r),ea(e,t,n,r,i,a);var o=r.$$hasNativeValidators&&"range"===t[0].type,s=o?0:void 0,c=o?100:void 0,u=o?1:void 0,l=t[0].validity,f=N(n.min),p=N(n.max),h=N(n.step),d=r.$render;r.$render=o&&N(l.rangeUnderflow)&&N(l.rangeOverflow)?function(){d(),r.$setViewValue(t.val())}:d,f&&(s=aa(n.min),r.$validators.min=o?function(){return!0}:function(e,t){return r.$isEmpty(t)||L(s)||t>=s},v("min",(function(e){if(s=aa(e),I(r.$modelValue))return;if(o){var n=t.val();s>n&&(n=s,t.val(n)),r.$setViewValue(n)}else r.$validate()})));p&&(c=aa(n.max),r.$validators.max=o?function(){return!0}:function(e,t){return r.$isEmpty(t)||L(c)||t<=c},v("max",(function(e){if(c=aa(e),I(r.$modelValue))return;if(o){var n=t.val();c<n&&(t.val(c),n=c<s?s:c),r.$setViewValue(n)}else r.$validate()})));h&&(u=aa(n.step),r.$validators.step=o?function(){return!l.stepMismatch}:function(e,t){return r.$isEmpty(t)||L(u)||ca(t,s||0,u)},v("step",(function(e){if(u=aa(e),I(r.$modelValue))return;o?r.$viewValue!==t.val()&&r.$setViewValue(t.val()):r.$validate()})));function v(e,r){t.attr(e,n[e]);var i=n[e];n.$observe(e,(function(e){e!==i&&(i=e,r(e))}))}},checkbox:function(e,t,n,r,i,a,o,s){var c=ua(s,e,"ngTrueValue",n.ngTrueValue,!0),u=ua(s,e,"ngFalseValue",n.ngFalseValue,!1);t.on("change",(function(e){r.$setViewValue(t[0].checked,e&&e.type)})),r.$render=function(){t[0].checked=r.$viewValue},r.$isEmpty=function(e){return!1===e},r.$formatters.push((function(e){return se(e,c)})),r.$parsers.push((function(e){return e?c:u}))},hidden:D,button:D,submit:D,reset:D,file:D};function Xi(e){e.$formatters.push((function(t){return e.$isEmpty(t)?t:t.toString()}))}function ea(e,t,n,r,i,a){var o,s=f(t[0].type);if(!i.android){var c=!1;t.on("compositionstart",(function(){c=!0})),t.on("compositionupdate",(function(e){(L(e.data)||""===e.data)&&(c=!1)})),t.on("compositionend",(function(){c=!1,u()}))}var u=function(e){if(o&&(a.defer.cancel(o),o=null),!c){var i=t.val(),u=e&&e.type;"password"===s||n.ngTrim&&"false"===n.ngTrim||(i=X(i)),(r.$viewValue!==i||""===i&&r.$$hasNativeValidators)&&r.$setViewValue(i,u)}};if(i.hasEvent("input"))t.on("input",u);else{var l=function(e,t,n){o||(o=a.defer((function(){o=null,t&&t.value===n||u(e)})))};t.on("keydown",(function(e){var t=e.keyCode;91===t||15<t&&t<19||37<=t&&t<=40||l(e,this,this.value)})),i.hasEvent("paste")&&t.on("paste cut drop",l)}t.on("change",u),Qi[s]&&r.$$hasNativeValidators&&s===n.type&&t.on("keydown wheel mousedown",(function(e){if(!o){var t=this.validity,n=t.badInput,r=t.typeMismatch;o=a.defer((function(){o=null,t.badInput===n&&t.typeMismatch===r||u(e)}))}})),r.$render=function(){var e=r.$isEmpty(r.$viewValue)?"":r.$viewValue;t.val()!==e&&t.val(e)}}function ta(e,t){return function(n,r){var i,a;if(B(n))return n;if(K(n)){if('"'===n.charAt(0)&&'"'===n.charAt(n.length-1)&&(n=n.substring(1,n.length-1)),Vi.test(n))return new Date(n);if(e.lastIndex=0,i=e.exec(n)){i.shift(),a=r?{yyyy:r.getFullYear(),MM:r.getMonth()+1,dd:r.getDate(),HH:r.getHours(),mm:r.getMinutes(),ss:r.getSeconds(),sss:r.getMilliseconds()/1e3}:{yyyy:1970,MM:1,dd:1,HH:0,mm:0,ss:0,sss:0},x(i,(function(e,n){n<t.length&&(a[t[n]]=+e)}));var o=new Date(a.yyyy,a.MM-1,a.dd,a.HH,a.mm,a.ss||0,1e3*a.sss||0);return a.yyyy<100&&o.setFullYear(a.yyyy),o}}return NaN}}function na(e,t,n,r){return function(i,a,o,s,c,u,l,f){ra(i,a,o,s,e),ea(0,a,o,s,c,u);var p,h,d="time"===e||"datetimelocal"===e;if(s.$parsers.push((function(n){return s.$isEmpty(n)?null:t.test(n)?k(n,p):void(s.$$parserName=e)})),s.$formatters.push((function(e){if(e&&!B(e))throw Ra("datefmt","Expected `{0}` to be a date",e);if(b(e)){p=e;var t=s.$options.getOption("timezone");return t&&(h=t,p=be(p,t,!0)),function(e,t){var n=r;d&&K(s.$options.getOption("timeSecondsFormat"))&&(n=r.replace("ss.sss",s.$options.getOption("timeSecondsFormat")).replace(/:$/,""));var i=l("date")(e,n,t);d&&s.$options.getOption("timeStripZeroSeconds")&&(i=i.replace(/(?::00)?(?:\.000)?$/,""));return i}(e,t)}return p=null,h=null,""})),N(o.min)||o.ngMin){var v=o.min||f(o.ngMin)(i),y=w(v);s.$validators.min=function(e){return!b(e)||L(y)||n(e)>=y},o.$observe("min",(function(e){e!==v&&(y=w(e),v=e,s.$validate())}))}if(N(o.max)||o.ngMax){var m=o.max||f(o.ngMax)(i),g=w(m);s.$validators.max=function(e){return!b(e)||L(g)||n(e)<=g},o.$observe("max",(function(e){e!==m&&(g=w(e),m=e,s.$validate())}))}function b(e){return e&&!(e.getTime&&e.getTime()!=e.getTime())}function w(e){return N(e)&&!B(e)?k(e)||void 0:e}function k(e,t){var r=s.$options.getOption("timezone");h&&h!==r&&(t=ge(t,me(h)));var i=n(e,t);return!isNaN(i)&&r&&(i=be(i,r)),i}}}function ra(e,t,n,r,i){var a=t[0];(r.$$hasNativeValidators=F(a.validity))&&r.$parsers.push((function(e){var n=t.prop("validity")||{};if(!n.badInput&&!n.typeMismatch)return e;r.$$parserName=i}))}function ia(e){e.$parsers.push((function(t){return e.$isEmpty(t)?null:zi.test(t)?parseFloat(t):void(e.$$parserName="number")})),e.$formatters.push((function(t){if(!e.$isEmpty(t)){if(!V(t))throw Ra("numfmt","Expected `{0}` to be a number",t);t=t.toString()}return t}))}function aa(e){return N(e)&&!V(e)&&(e=parseFloat(e)),I(e)?void 0:e}function oa(e){return(0|e)===e}function sa(e){var t=e.toString(),n=t.indexOf(".");if(-1===n){if(-1<e&&e<1){var r=/e-(\d+)$/.exec(t);if(r)return Number(r[1])}return 0}return t.length-n-1}function ca(e,t,n){var r=Number(e),i=!oa(r),a=!oa(t),o=!oa(n);if(i||a||o){var s=i?sa(r):0,c=a?sa(t):0,u=o?sa(n):0,l=Math.max(s,c,u),f=Math.pow(10,l);r*=f,t*=f,n*=f,i&&(r=Math.round(r)),a&&(t=Math.round(t)),o&&(n=Math.round(n))}return(r-t)%n==0}function ua(e,t,n,r,i){var a;if(N(r)){if(!(a=e(r)).constant)throw Ra("constexpr","Expected constant expression for `{0}`, but saw `{1}`.",n,r);return a(t)}return i}var la=["$browser","$sniffer","$filter","$parse",function(e,t,n,r){return{restrict:"E",require:["?ngModel"],link:{pre:function(i,a,o,s){s[0]&&(Zi[f(o.type)]||Zi.text)(i,a,o,s[0],t,e,n,r)}}}}],fa=function(){var e={configurable:!0,enumerable:!1,get:function(){return this.getAttribute("value")||""},set:function(e){this.setAttribute("value",e)}};return{restrict:"E",priority:200,compile:function(t,n){if("hidden"===f(n.type))return{pre:function(t,n,r,i){var a=n[0];a.parentNode&&a.parentNode.insertBefore(a,a.nextSibling),Object.defineProperty&&Object.defineProperty(a,"value",e)}}}}},pa=/^(true|false|\d+)$/,ha=function(){function e(e,t,n){var r=N(n)?n:9===a?"":null;e.prop("value",r),t.$set("value",n)}return{restrict:"A",priority:100,compile:function(t,n){return pa.test(n.ngValue)?function(t,n,r){e(n,r,t.$eval(r.ngValue))}:function(t,n,r){t.$watch(r.ngValue,(function(t){e(n,r,t)}))}}}},da=["$compile",function(e){return{restrict:"AC",compile:function(t){return e.$$addBindingClass(t),function(t,n,r){e.$$addBindingInfo(n,r.ngBind),n=n[0],t.$watch(r.ngBind,(function(e){n.textContent=Fe(e)}))}}}}],va=["$interpolate","$compile",function(e,t){return{compile:function(n){return t.$$addBindingClass(n),function(n,r,i){var a=e(r.attr(i.$attr.ngBindTemplate));t.$$addBindingInfo(r,a.expressions),r=r[0],i.$observe("ngBindTemplate",(function(e){r.textContent=L(e)?"":e}))}}}}],ya=["$sce","$parse","$compile",function(e,t,n){return{restrict:"A",compile:function(r,i){var a=t(i.ngBindHtml),o=t(i.ngBindHtml,(function(t){return e.valueOf(t)}));return n.$$addBindingClass(r),function(t,r,i){n.$$addBindingInfo(r,i.ngBindHtml),t.$watch(o,(function(){var n=a(t);r.html(e.getTrustedHtml(n)||"")}))}}}}],ma=T({restrict:"A",require:"ngModel",link:function(e,t,n,r){r.$viewChangeListeners.push((function(){e.$eval(n.ngChange)}))}});function ga(e,t){var n;return e="ngClass"+e,["$parse",function(o){return{restrict:"AC",link:function(s,c,u){var l,f=c.data("$classCounts"),p=!0;function h(e,t){var n=[];return x(e,(function(e){(t>0||f[e])&&(f[e]=(f[e]||0)+t,f[e]===+(t>0)&&n.push(e))})),n.join(" ")}f||(f=Ne(),c.data("$classCounts",f)),"ngClass"!==e&&(n||(n=o("$index",(function(e){return 1&e}))),s.$watch(n,(function(e){e===t?(n=h(i(n=l),1),u.$addClass(n)):function(e){e=h(i(e),-1),u.$removeClass(e)}(l);var n;p=e}))),s.$watch(o(u[e],a),(function(e){p===t&&function(e,t){var n=i(e),a=i(t),o=r(n,a),s=r(a,n),c=h(o,-1),l=h(s,1);u.$addClass(l),u.$removeClass(c)}(l,e);l=e}))}}}];function r(e,t){if(!e||!e.length)return[];if(!t||!t.length)return e;var n=[];e:for(var r=0;r<e.length;r++){for(var i=e[r],a=0;a<t.length;a++)if(i===t[a])continue e;n.push(i)}return n}function i(e){return e&&e.split(" ")}function a(e){if(!e)return e;var t=e;return H(e)?t=e.map(a).join(" "):F(e)?t=Object.keys(e).filter((function(t){return e[t]})).join(" "):K(e)||(t=e+""),t}}var ba=ga("",!0),wa=ga("Odd",0),ka=ga("Even",1),xa=Ii({compile:function(e,t){t.$set("ngCloak",void 0),e.removeClass("ng-cloak")}}),Sa=[function(){return{restrict:"A",scope:!0,controller:"@",priority:500}}],_a={},$a={blur:!0,focus:!0};function Pa(e,t,n,r,i,a){return{restrict:"A",compile:function(o,s){var c=e(s[r]);return function(e,r){r.on(i,(function(r){var i=function(){c(e,{$event:r})};if(t.$$phase)if(a)e.$evalAsync(i);else try{i()}catch(e){n(e)}else e.$apply(i)}))}}}}x("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),(function(e){var t=dn("ng-"+e);_a[t]=["$parse","$rootScope","$exceptionHandler",function(n,r,i){return Pa(n,r,i,t,e,$a[e])}]}));var Oa=["$animate","$compile",function(e,t){return{multiElement:!0,transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(n,r,i,a,o){var s,c,u;n.$watch(i.ngIf,(function(n){n?c||o((function(n,a){c=a,n[n.length++]=t.$$createComment("end ngIf",i.ngIf),s={clone:n},e.enter(n,r.parent(),r)})):(u&&(u.remove(),u=null),c&&(c.$destroy(),c=null),s&&(u=Le(s.clone),e.leave(u).done((function(e){!1!==e&&(u=null)})),s=null))}))}}}],Ca=["$templateRequest","$anchorScroll","$animate",function(e,t,n){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:b.noop,compile:function(r,i){var a=i.ngInclude||i.src,o=i.onload||"",s=i.autoscroll;return function(r,i,c,u,l){var f,p,h,d=0,v=function(){p&&(p.remove(),p=null),f&&(f.$destroy(),f=null),h&&(n.leave(h).done((function(e){!1!==e&&(p=null)})),p=h,h=null)};r.$watch(a,(function(a){var c=function(e){!1===e||!N(s)||s&&!r.$eval(s)||t()},p=++d;a?(e(a,!0).then((function(e){if(!r.$$destroyed&&p===d){var t=r.$new();u.template=e;var s=l(t,(function(e){v(),n.enter(e,null,i).done(c)}));h=s,(f=t).$emit("$includeContentLoaded",a),r.$eval(o)}}),(function(){r.$$destroyed||p===d&&(v(),r.$emit("$includeContentError",a))})),r.$emit("$includeContentRequested",a)):(v(),u.template=null)}))}}}}],Ea=["$compile",function(t){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(n,r,i,a){if(y.call(r[0]).match(/SVG/))return r.empty(),void t(at(a.template,e.document).childNodes)(n,(function(e){r.append(e)}),{futureParentElement:r});r.html(a.template),t(r.contents())(n)}}}],Aa=Ii({priority:450,compile:function(){return{pre:function(e,t,n){e.$eval(n.ngInit)}}}}),Ia=function(){return{restrict:"A",priority:100,require:"ngModel",link:function(e,t,n,r){var i=n.ngList||", ",a="false"!==n.ngTrim,o=a?X(i):i;r.$parsers.push((function(e){if(!L(e)){var t=[];return e&&x(e.split(o),(function(e){e&&t.push(a?X(e):e)})),t}})),r.$formatters.push((function(e){if(H(e))return e.join(i)})),r.$isEmpty=function(e){return!e||!e.length}}}},ja="ng-valid",Da="ng-invalid",Ma="ng-pristine",Ta="ng-dirty",Ra=i("ngModel");function La(e,t,n,r,i,a,o,s,c){var u;this.$viewValue=Number.NaN,this.$modelValue=Number.NaN,this.$$rawModelValue=void 0,this.$validators={},this.$asyncValidators={},this.$parsers=[],this.$formatters=[],this.$viewChangeListeners=[],this.$untouched=!0,this.$touched=!1,this.$pristine=!0,this.$dirty=!1,this.$valid=!0,this.$invalid=!1,this.$error={},this.$$success={},this.$pending=void 0,this.$name=c(n.name||"",!1)(e),this.$$parentForm=Mi,this.$options=Na,this.$$updateEvents="",this.$$updateEventHandler=this.$$updateEventHandler.bind(this),this.$$parsedNgModel=i(n.ngModel),this.$$parsedNgModelAssign=this.$$parsedNgModel.assign,this.$$ngModelGet=this.$$parsedNgModel,this.$$ngModelSet=this.$$parsedNgModelAssign,this.$$pendingDebounce=null,this.$$parserValid=void 0,this.$$parserName="parse",this.$$currentValidationRunId=0,this.$$scope=e,this.$$rootScope=e.$root,this.$$attr=n,this.$$element=r,this.$$animate=a,this.$$timeout=o,this.$$parse=i,this.$$q=s,this.$$exceptionHandler=t,Fi(this),(u=this).$$scope.$watch((function(e){var t=u.$$ngModelGet(e);return t===u.$modelValue||u.$modelValue!=u.$modelValue&&t!=t||u.$$setModelValue(t),t}))}La.$inject=["$scope","$exceptionHandler","$attrs","$element","$parse","$animate","$timeout","$q","$interpolate"],La.prototype={$$initGetterSetters:function(){if(this.$options.getOption("getterSetter")){var e=this.$$parse(this.$$attr.ngModel+"()"),t=this.$$parse(this.$$attr.ngModel+"($$$p)");this.$$ngModelGet=function(t){var n=this.$$parsedNgModel(t);return W(n)&&(n=e(t)),n},this.$$ngModelSet=function(e,n){W(this.$$parsedNgModel(e))?t(e,{$$$p:n}):this.$$parsedNgModelAssign(e,n)}}else if(!this.$$parsedNgModel.assign)throw Ra("nonassign","Expression '{0}' is non-assignable. Element: {1}",this.$$attr.ngModel,we(this.$$element))},$render:D,$isEmpty:function(e){return L(e)||""===e||null===e||e!=e},$$updateEmptyClasses:function(e){this.$isEmpty(e)?(this.$$animate.removeClass(this.$$element,"ng-not-empty"),this.$$animate.addClass(this.$$element,"ng-empty")):(this.$$animate.removeClass(this.$$element,"ng-empty"),this.$$animate.addClass(this.$$element,"ng-not-empty"))},$setPristine:function(){this.$dirty=!1,this.$pristine=!0,this.$$animate.removeClass(this.$$element,Ta),this.$$animate.addClass(this.$$element,Ma)},$setDirty:function(){this.$dirty=!0,this.$pristine=!1,this.$$animate.removeClass(this.$$element,Ma),this.$$animate.addClass(this.$$element,Ta),this.$$parentForm.$setDirty()},$setUntouched:function(){this.$touched=!1,this.$untouched=!0,this.$$animate.setClass(this.$$element,"ng-untouched","ng-touched")},$setTouched:function(){this.$touched=!0,this.$untouched=!1,this.$$animate.setClass(this.$$element,"ng-touched","ng-untouched")},$rollbackViewValue:function(){this.$$timeout.cancel(this.$$pendingDebounce),this.$viewValue=this.$$lastCommittedViewValue,this.$render()},$validate:function(){if(!I(this.$modelValue)){var e=this.$$lastCommittedViewValue,t=this.$$rawModelValue,n=this.$valid,r=this.$modelValue,i=this.$options.getOption("allowInvalid"),a=this;this.$$runValidators(t,e,(function(e){i||n===e||(a.$modelValue=e?t:void 0,a.$modelValue!==r&&a.$$writeModelToScope())}))}},$$runValidators:function(e,t,n){this.$$currentValidationRunId++;var r,i,a=this.$$currentValidationRunId,o=this;(function(){var e=o.$$parserName;if(!L(o.$$parserValid))return o.$$parserValid||(x(o.$validators,(function(e,t){s(t,null)})),x(o.$asyncValidators,(function(e,t){s(t,null)}))),s(e,o.$$parserValid),o.$$parserValid;s(e,null);return!0})()?!function(){var n=!0;if(x(o.$validators,(function(r,i){var a=Boolean(r(e,t));n=n&&a,s(i,a)})),!n)return x(o.$asyncValidators,(function(e,t){s(t,null)})),!1;return!0}()?c(!1):(r=[],i=!0,x(o.$asyncValidators,(function(n,a){var o=n(e,t);if(!Q(o))throw Ra("nopromise","Expected asynchronous validator to return a promise but got '{0}' instead.",o);s(a,void 0),r.push(o.then((function(){s(a,!0)}),(function(){i=!1,s(a,!1)})))})),r.length?o.$$q.all(r).then((function(){c(i)}),D):c(!0)):c(!1);function s(e,t){a===o.$$currentValidationRunId&&o.$setValidity(e,t)}function c(e){a===o.$$currentValidationRunId&&n(e)}},$commitViewValue:function(){var e=this.$viewValue;this.$$timeout.cancel(this.$$pendingDebounce),(this.$$lastCommittedViewValue!==e||""===e&&this.$$hasNativeValidators)&&(this.$$updateEmptyClasses(e),this.$$lastCommittedViewValue=e,this.$pristine&&this.$setDirty(),this.$$parseAndValidate())},$$parseAndValidate:function(){var e=this.$$lastCommittedViewValue,t=this;if(this.$$parserValid=!L(e)||void 0,this.$setValidity(this.$$parserName,null),this.$$parserName="parse",this.$$parserValid)for(var n=0;n<this.$parsers.length;n++)if(L(e=this.$parsers[n](e))){this.$$parserValid=!1;break}I(this.$modelValue)&&(this.$modelValue=this.$$ngModelGet(this.$$scope));var r=this.$modelValue,i=this.$options.getOption("allowInvalid");function a(){t.$modelValue!==r&&t.$$writeModelToScope()}this.$$rawModelValue=e,i&&(this.$modelValue=e,a()),this.$$runValidators(e,this.$$lastCommittedViewValue,(function(n){i||(t.$modelValue=n?e:void 0,a())}))},$$writeModelToScope:function(){this.$$ngModelSet(this.$$scope,this.$modelValue),x(this.$viewChangeListeners,(function(e){try{e()}catch(e){this.$$exceptionHandler(e)}}),this)},$setViewValue:function(e,t){this.$viewValue=e,this.$options.getOption("updateOnDefault")&&this.$$debounceViewValueCommit(t)},$$debounceViewValueCommit:function(e){var t=this.$options.getOption("debounce");V(t[e])?t=t[e]:V(t.default)&&-1===this.$options.getOption("updateOn").indexOf(e)?t=t.default:V(t["*"])&&(t=t["*"]),this.$$timeout.cancel(this.$$pendingDebounce);var n=this;t>0?this.$$pendingDebounce=this.$$timeout((function(){n.$commitViewValue()}),t):this.$$rootScope.$$phase?this.$commitViewValue():this.$$scope.$apply((function(){n.$commitViewValue()}))},$overrideModelOptions:function(e){this.$options=this.$options.createChild(e),this.$$setUpdateOnEvents()},$processModelValue:function(){var e=this.$$format();this.$viewValue!==e&&(this.$$updateEmptyClasses(e),this.$viewValue=this.$$lastCommittedViewValue=e,this.$render(),this.$$runValidators(this.$modelValue,this.$viewValue,D))},$$format:function(){for(var e=this.$formatters,t=e.length,n=this.$modelValue;t--;)n=e[t](n);return n},$$setModelValue:function(e){this.$modelValue=this.$$rawModelValue=e,this.$$parserValid=void 0,this.$processModelValue()},$$setUpdateOnEvents:function(){this.$$updateEvents&&this.$$element.off(this.$$updateEvents,this.$$updateEventHandler),this.$$updateEvents=this.$options.getOption("updateOn"),this.$$updateEvents&&this.$$element.on(this.$$updateEvents,this.$$updateEventHandler)},$$updateEventHandler:function(e){this.$$debounceViewValueCommit(e&&e.type)}},Ui({clazz:La,set:function(e,t){e[t]=!0},unset:function(e,t){delete e[t]}});var Na,Fa=["$rootScope",function(e){return{restrict:"A",require:["ngModel","^?form","^?ngModelOptions"],controller:La,priority:1,compile:function(t){return t.addClass(Ma).addClass("ng-untouched").addClass(ja),{pre:function(e,t,n,r){var i=r[0],a=r[1]||i.$$parentForm,o=r[2];o&&(i.$options=o.$options),i.$$initGetterSetters(),a.$addControl(i),n.$observe("name",(function(e){i.$name!==e&&i.$$parentForm.$$renameControl(i,e)})),e.$on("$destroy",(function(){i.$$parentForm.$removeControl(i)}))},post:function(t,n,r,i){var a=i[0];function o(){a.$setTouched()}a.$$setUpdateOnEvents(),n.on("blur",(function(){a.$touched||(e.$$phase?t.$evalAsync(o):t.$apply(o))}))}}}}}],Ua=/(\s+|^)default(\s+|$)/;function Ka(e){this.$$options=e}Ka.prototype={getOption:function(e){return this.$$options[e]},createChild:function(e){var t=!1;return x(e=C({},e),(function(n,r){"$inherit"===n?"*"===r?t=!0:(e[r]=this.$$options[r],"updateOn"===r&&(e.updateOnDefault=this.$$options.updateOnDefault)):"updateOn"===r&&(e.updateOnDefault=!1,e[r]=X(n.replace(Ua,(function(){return e.updateOnDefault=!0," "}))))}),this),t&&(delete e["*"],Ba(e,this.$$options)),Ba(e,Na.$$options),new Ka(e)}},Na=new Ka({updateOn:"",updateOnDefault:!0,debounce:0,getterSetter:!1,allowInvalid:!1,timezone:null});var Va=function(){function e(e,t){this.$$attrs=e,this.$$scope=t}return e.$inject=["$attrs","$scope"],e.prototype={$onInit:function(){var e=this.parentCtrl?this.parentCtrl.$options:Na,t=this.$$scope.$eval(this.$$attrs.ngModelOptions);this.$options=e.createChild(t)}},{restrict:"A",priority:10,require:{parentCtrl:"?^^ngModelOptions"},bindToController:!0,controller:e}};function Ba(e,t){x(t,(function(t,n){N(e[n])||(e[n]=t)}))}var Ha=Ii({terminal:!0,priority:1e3}),za=i("ngOptions"),Wa=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([$\w][$\w]*)|(?:\(\s*([$\w][$\w]*)\s*,\s*([$\w][$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,qa=["$compile","$document","$parse",function(t,n,r){var i=e.document.createElement("option"),a=e.document.createElement("optgroup");return{restrict:"A",terminal:!0,require:["select","ngModel"],link:{pre:function(e,t,n,r){r[0].registerOption=D},post:function(e,s,c,u){for(var l=u[0],f=u[1],p=c.multiple,h=0,d=s.children(),v=d.length;h<v;h++)if(""===d[h].value){l.hasEmptyOption=!0,l.emptyOption=d.eq(h);break}s.empty();var y,m=!!l.emptyOption;o(i.cloneNode(!1)).val("?");var g=function(e,t,n){var i=e.match(Wa);if(!i)throw za("iexp","Expected expression in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got '{0}'. Element: {1}",e,we(t));var a=i[5]||i[7],o=i[6],s=/ as /.test(i[0])&&i[1],c=i[9],u=r(i[2]?i[1]:a),l=s&&r(s)||u,f=c&&r(c),p=c?function(e,t){return f(n,t)}:function(e){return Dt(e)},h=function(e,t){return p(e,b(e,t))},d=r(i[2]||i[1]),v=r(i[3]||""),y=r(i[4]||""),m=r(i[8]),g={},b=o?function(e,t){return g[o]=t,g[a]=e,g}:function(e){return g[a]=e,g};function w(e,t,n,r,i){this.selectValue=e,this.viewValue=t,this.label=n,this.group=r,this.disabled=i}function x(e){var t;if(!o&&k(e))t=e;else for(var n in t=[],e)e.hasOwnProperty(n)&&"$"!==n.charAt(0)&&t.push(n);return t}return{trackBy:c,getTrackByValue:h,getWatchables:r(m,(function(e){for(var t=[],r=x(e=e||[]),a=r.length,o=0;o<a;o++){var s=e===r?o:r[o],c=e[s],u=b(c,s),l=p(c,u);if(t.push(l),i[2]||i[1]){var f=d(n,u);t.push(f)}if(i[4]){var h=y(n,u);t.push(h)}}return t})),getOptions:function(){for(var e=[],t={},r=m(n)||[],i=x(r),a=i.length,o=0;o<a;o++){var s=r===i?o:i[o],u=r[s],f=b(u,s),g=l(n,f),k=p(g,f),S=new w(k,g,d(n,f),v(n,f),y(n,f));e.push(S),t[k]=S}return{items:e,selectValueMap:t,getOptionFromViewValue:function(e){return t[h(e)]},getViewValueFromOption:function(e){return c?ae(e.viewValue):e.viewValue}}}}}(c.ngOptions,s,e),b=n[0].createDocumentFragment();function w(e,t){var n=i.cloneNode(!1);t.appendChild(n),function(e,t){e.element=t,t.disabled=e.disabled,e.label!==t.label&&(t.label=e.label,t.textContent=e.label);t.value=e.selectValue}(e,n)}function S(e){var t=y.getOptionFromViewValue(e),n=t&&t.element;return n&&!n.selected&&(n.selected=!0),t}l.generateUnknownOptionValue=function(e){return"?"},p?(l.writeValue=function(e){if(y){var t=e&&e.map(S)||[];y.items.forEach((function(e){e.element.selected&&!re(t,e)&&(e.element.selected=!1)}))}},l.readValue=function(){var e=s.val()||[],t=[];return x(e,(function(e){var n=y.selectValueMap[e];n&&!n.disabled&&t.push(y.getViewValueFromOption(n))})),t},g.trackBy&&e.$watchCollection((function(){if(H(f.$viewValue))return f.$viewValue.map((function(e){return g.getTrackByValue(e)}))}),(function(){f.$render()}))):(l.writeValue=function(e){if(y){var t=s[0].options[s[0].selectedIndex],n=y.getOptionFromViewValue(e);t&&t.removeAttribute("selected"),n?(s[0].value!==n.selectValue&&(l.removeUnknownOption(),s[0].value=n.selectValue,n.element.selected=!0),n.element.setAttribute("selected","selected")):l.selectUnknownOrEmptyOption(e)}},l.readValue=function(){var e=y.selectValueMap[s.val()];return e&&!e.disabled?(l.unselectEmptyOption(),l.removeUnknownOption(),y.getViewValueFromOption(e)):null},g.trackBy&&e.$watch((function(){return g.getTrackByValue(f.$viewValue)}),(function(){f.$render()}))),m&&(t(l.emptyOption)(e),s.prepend(l.emptyOption),8===l.emptyOption[0].nodeType?(l.hasEmptyOption=!1,l.registerOption=function(e,t){""===t.val()&&(l.hasEmptyOption=!0,l.emptyOption=t,l.emptyOption.removeClass("ng-scope"),f.$render(),t.on("$destroy",(function(){var e=l.$isEmptyOptionSelected();l.hasEmptyOption=!1,l.emptyOption=void 0,e&&f.$render()})))}):l.emptyOption.removeClass("ng-scope")),e.$watchCollection(g.getWatchables,(function(){var e=y&&l.readValue();if(y)for(var t=y.items.length-1;t>=0;t--){var n=y.items[t];N(n.group)?St(n.element.parentNode):St(n.element)}y=g.getOptions();var r={};if(y.items.forEach((function(e){var t;N(e.group)?((t=r[e.group])||(t=a.cloneNode(!1),b.appendChild(t),t.label=null===e.group?"null":e.group,r[e.group]=t),w(e,t)):w(e,b)})),s[0].appendChild(b),f.$render(),!f.$isEmpty(e)){var i=l.readValue();(g.trackBy||p?se(e,i):e===i)||(f.$setViewValue(i),f.$render())}}))}}}}],Ga=["$locale","$interpolate","$log",function(e,t,n){var r=/{}/g,i=/^when(Minus)?(.+)$/;return{link:function(a,o,s){var c,u=s.count,l=s.$attr.when&&o.attr(s.$attr.when),p=s.offset||0,h=a.$eval(l)||{},d={},v=t.startSymbol(),y=t.endSymbol(),m=v+u+"-"+p+y,g=b.noop;function w(e){o.text(e||"")}x(s,(function(e,t){var n=i.exec(t);if(n){var r=(n[1]?"-":"")+f(n[2]);h[r]=o.attr(s.$attr[t])}})),x(h,(function(e,n){d[n]=t(e.replace(r,m))})),a.$watch(u,(function(t){var r=parseFloat(t),i=I(r);if(i||r in h||(r=e.pluralCat(r-p)),!(r===c||i&&I(c))){g();var o=d[r];L(o)?(null!=t&&n.debug("ngPluralize: no rule defined for '"+r+"' in "+l),g=D,w()):g=a.$watch(o,w),c=r}}))}}}],Ya=i("ngRef"),Ja=["$parse",function(e){return{priority:-1,restrict:"A",compile:function(t,n){var r=dn(ne(t)),i=e(n.ngRef),a=i.assign||function(){throw Ya("nonassign",'Expression in ngRef="{0}" is non-assignable!',n.ngRef)};return function(e,t,o){var s;if(o.hasOwnProperty("ngRefRead")){if("$element"===o.ngRefRead)s=t;else if(!(s=t.data("$"+o.ngRefRead+"Controller")))throw Ya("noctrl",'The controller for ngRefRead="{0}" could not be found on ngRef="{1}"',o.ngRefRead,n.ngRef)}else s=t.data("$"+r+"Controller");a(e,s=s||t),t.on("$destroy",(function(){i(e)===s&&a(e,null)}))}}}}],Qa=["$parse","$animate","$compile",function(e,t,n){var r=i("ngRepeat"),a=function(e,t,n,r,i,a,o){e[n]=r,i&&(e[i]=a),e.$index=t,e.$first=0===t,e.$last=t===o-1,e.$middle=!(e.$first||e.$last),e.$odd=!(e.$even=0==(1&t))},o=function(e){return e.clone[0]},s=function(e){return e.clone[e.clone.length-1]},c=function(e,t,n){return Dt(n)},u=function(e,t){return t};return{restrict:"A",multiElement:!0,transclude:"element",priority:1e3,terminal:!0,$$tlb:!0,compile:function(i,f){var p=f.ngRepeat,h=n.$$createComment("end ngRepeat",p),d=p.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);if(!d)throw r("iexp","Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",p);var v=d[1],y=d[2],m=d[3],g=d[4];if(!(d=v.match(/^(?:(\s*[$\w]+)|\(\s*([$\w]+)\s*,\s*([$\w]+)\s*\))$/)))throw r("iidexp","'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.",v);var b,w=d[3]||d[1],S=d[2];if(m&&(!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(m)||/^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent|\$root|\$id)$/.test(m)))throw r("badident","alias '{0}' is invalid --- must be a valid JS identifier which is not a reserved name.",m);if(g){var _={$id:Dt},$=e(g);b=function(e,t,n,r){return S&&(_[S]=t),_[w]=n,_.$index=r,$(e,_)}}return function(e,n,i,f,d){var v=Ne();e.$watchCollection(y,(function(i){var f,y,g,$,P,O,C,E,A,I,j,D,M=n[0],T=Ne();if(m&&(e[m]=i),k(i))A=i,E=b||c;else for(var R in E=b||u,A=[],i)l.call(i,R)&&"$"!==R.charAt(0)&&A.push(R);for($=A.length,j=new Array($),f=0;f<$;f++)if(P=i===A?f:A[f],O=i[P],C=E(e,P,O,f),v[C])I=v[C],delete v[C],T[C]=I,j[f]=I;else{if(T[C])throw x(j,(function(e){e&&e.scope&&(v[e.id]=e)})),r("dupes","Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}, Duplicate value: {2}",p,C,O);j[f]={id:C,scope:void 0,clone:void 0},T[C]=!0}for(var L in _&&(_[w]=void 0),v){if(D=Le((I=v[L]).clone),t.leave(D),D[0].parentNode)for(f=0,y=D.length;f<y;f++)D[f].$$NG_REMOVED=!0;I.scope.$destroy()}for(f=0;f<$;f++)if(P=i===A?f:A[f],O=i[P],(I=j[f]).scope){g=M;do{g=g.nextSibling}while(g&&g.$$NG_REMOVED);o(I)!==g&&t.move(Le(I.clone),null,M),M=s(I),a(I.scope,f,w,O,S,P,$)}else d((function(e,n){I.scope=n;var r=h.cloneNode(!1);e[e.length++]=r,t.enter(e,null,M),M=r,I.clone=e,T[I.id]=I,a(I.scope,f,w,O,S,P,$)}));v=T}))}}}}],Za=["$animate",function(e){return{restrict:"A",multiElement:!0,link:function(t,n,r){t.$watch(r.ngShow,(function(t){e[t?"removeClass":"addClass"](n,"ng-hide",{tempClasses:"ng-hide-animate"})}))}}}],Xa=["$animate",function(e){return{restrict:"A",multiElement:!0,link:function(t,n,r){t.$watch(r.ngHide,(function(t){e[t?"addClass":"removeClass"](n,"ng-hide",{tempClasses:"ng-hide-animate"})}))}}}],eo=Ii((function(e,t,n){e.$watchCollection(n.ngStyle,(function(e,n){n&&e!==n&&x(n,(function(e,n){t.css(n,"")})),e&&t.css(e)}))})),to=["$animate","$compile",function(e,t){return{require:"ngSwitch",controller:["$scope",function(){this.cases={}}],link:function(n,r,i,a){var o=i.ngSwitch||i.on,s=[],c=[],u=[],l=[],f=function(e,t){return function(n){!1!==n&&e.splice(t,1)}};n.$watch(o,(function(n){for(var r,i;u.length;)e.cancel(u.pop());for(r=0,i=l.length;r<i;++r){var o=Le(c[r].clone);l[r].$destroy(),(u[r]=e.leave(o)).done(f(u,r))}c.length=0,l.length=0,(s=a.cases["!"+n]||a.cases["?"])&&x(s,(function(n){n.transclude((function(r,i){l.push(i);var a=n.element;r[r.length++]=t.$$createComment("end ngSwitchWhen");var o={clone:r};c.push(o),e.enter(r,a.parent(),a)}))}))}))}}}],no=Ii({transclude:"element",priority:1200,require:"^ngSwitch",multiElement:!0,link:function(e,t,n,r,i){x(n.ngSwitchWhen.split(n.ngSwitchWhenSeparator).sort().filter((function(e,t,n){return n[t-1]!==e})),(function(e){r.cases["!"+e]=r.cases["!"+e]||[],r.cases["!"+e].push({transclude:i,element:t})}))}}),ro=Ii({transclude:"element",priority:1200,require:"^ngSwitch",multiElement:!0,link:function(e,t,n,r,i){r.cases["?"]=r.cases["?"]||[],r.cases["?"].push({transclude:i,element:t})}}),io=i("ngTransclude"),ao=["$compile",function(e){return{restrict:"EAC",compile:function(t){var n=e(t.contents());return t.empty(),function(e,t,r,i,a){if(!a)throw io("orphan","Illegal use of ngTransclude directive in the template! No parent directive that requires a transclusion found. Element: {0}",we(t));r.ngTransclude===r.$attr.ngTransclude&&(r.ngTransclude="");var o=r.ngTransclude||r.ngTranscludeSlot;function s(){n(e,(function(e){t.append(e)}))}a((function(e,n){e.length&&function(e){for(var t=0,n=e.length;t<n;t++){var r=e[t];if(r.nodeType!==Ue||r.nodeValue.trim())return!0}}(e)?t.append(e):(s(),n.$destroy())}),null,o),o&&!a.isSlotFilled(o)&&s()}}}}],oo=["$templateCache",function(e){return{restrict:"E",terminal:!0,compile:function(t,n){if("text/ng-template"===n.type){var r=n.id,i=t[0].text;e.put(r,i)}}}}],so={$setViewValue:D,$render:D};function co(e,t){e.prop("selected",t),e.attr("selected",t)}var uo=["$element","$scope",function(t,n){var r=this,i=new Rt;r.selectValueMap={},r.ngModelCtrl=so,r.multiple=!1,r.unknownOption=o(e.document.createElement("option")),r.hasEmptyOption=!1,r.emptyOption=void 0,r.renderUnknownOption=function(e){var n=r.generateUnknownOptionValue(e);r.unknownOption.val(n),t.prepend(r.unknownOption),co(r.unknownOption,!0),t.val(n)},r.updateUnknownOption=function(e){var n=r.generateUnknownOptionValue(e);r.unknownOption.val(n),co(r.unknownOption,!0),t.val(n)},r.generateUnknownOptionValue=function(e){return"? "+Dt(e)+" ?"},r.removeUnknownOption=function(){r.unknownOption.parent()&&r.unknownOption.remove()},r.selectEmptyOption=function(){r.emptyOption&&(t.val(""),co(r.emptyOption,!0))},r.unselectEmptyOption=function(){r.hasEmptyOption&&co(r.emptyOption,!1)},n.$on("$destroy",(function(){r.renderUnknownOption=D})),r.readValue=function(){var e=t.val(),n=e in r.selectValueMap?r.selectValueMap[e]:e;return r.hasOption(n)?n:null},r.writeValue=function(e){var n=t[0].options[t[0].selectedIndex];if(n&&co(o(n),!1),r.hasOption(e)){r.removeUnknownOption();var i=Dt(e);t.val(i in r.selectValueMap?i:e);var a=t[0].options[t[0].selectedIndex];co(o(a),!0)}else r.selectUnknownOrEmptyOption(e)},r.addOption=function(e,t){if(8!==t[0].nodeType){Re(e,'"option value"'),""===e&&(r.hasEmptyOption=!0,r.emptyOption=t);var n=i.get(e)||0;i.set(e,n+1),s()}},r.removeOption=function(e){var t=i.get(e);t&&(1===t?(i.delete(e),""===e&&(r.hasEmptyOption=!1,r.emptyOption=void 0)):i.set(e,t-1))},r.hasOption=function(e){return!!i.get(e)},r.$hasEmptyOption=function(){return r.hasEmptyOption},r.$isUnknownOptionSelected=function(){return t[0].options[0]===r.unknownOption[0]},r.$isEmptyOptionSelected=function(){return r.hasEmptyOption&&t[0].options[t[0].selectedIndex]===r.emptyOption[0]},r.selectUnknownOrEmptyOption=function(e){null==e&&r.emptyOption?(r.removeUnknownOption(),r.selectEmptyOption()):r.unknownOption.parent().length?r.updateUnknownOption(e):r.renderUnknownOption(e)};var a=!1;function s(){a||(a=!0,n.$$postDigest((function(){a=!1,r.ngModelCtrl.$render()})))}var c=!1;function u(e){c||(c=!0,n.$$postDigest((function(){n.$$destroyed||(c=!1,r.ngModelCtrl.$setViewValue(r.readValue()),e&&r.ngModelCtrl.$render())})))}r.registerOption=function(e,t,n,i,a){var o,c;n.$attr.ngValue?n.$observe("value",(function(e){var n,i=t.prop("selected");N(c)&&(r.removeOption(o),delete r.selectValueMap[c],n=!0),c=Dt(e),o=e,r.selectValueMap[c]=e,r.addOption(e,t),t.attr("value",c),n&&i&&u()})):i?n.$observe("value",(function(e){var n;r.readValue();var i=t.prop("selected");N(o)&&(r.removeOption(o),n=!0),o=e,r.addOption(e,t),n&&i&&u()})):a?e.$watch(a,(function(e,i){n.$set("value",e);var a=t.prop("selected");i!==e&&r.removeOption(i),r.addOption(e,t),i&&a&&u()})):r.addOption(n.value,t);n.$observe("disabled",(function(e){("true"===e||e&&t.prop("selected"))&&(r.multiple?u(!0):(r.ngModelCtrl.$setViewValue(null),r.ngModelCtrl.$render()))})),t.on("$destroy",(function(){var e=r.readValue(),t=n.value;r.removeOption(t),s(),(r.multiple&&e&&-1!==e.indexOf(t)||e===t)&&u(!0)}))}}],lo=function(){return{restrict:"E",require:["select","?ngModel"],controller:uo,priority:1,link:{pre:function(e,t,n,r){var i=r[0],a=r[1];if(!a)return void(i.registerOption=D);if(i.ngModelCtrl=a,t.on("change",(function(){i.removeUnknownOption(),e.$apply((function(){a.$setViewValue(i.readValue())}))})),n.multiple){i.multiple=!0,i.readValue=function(){var e=[];return x(t.find("option"),(function(t){if(t.selected&&!t.disabled){var n=t.value;e.push(n in i.selectValueMap?i.selectValueMap[n]:n)}})),e},i.writeValue=function(e){x(t.find("option"),(function(t){var n=!!e&&(re(e,t.value)||re(e,i.selectValueMap[t.value]));n!==t.selected&&co(o(t),n)}))};var s,c=NaN;e.$watch((function(){c!==a.$viewValue||se(s,a.$viewValue)||(s=Ke(a.$viewValue),a.$render()),c=a.$viewValue})),a.$isEmpty=function(e){return!e||0===e.length}}},post:function(e,t,n,r){var i=r[1];if(!i)return;var a=r[0];i.$render=function(){a.writeValue(i.$viewValue)}}}}},fo=["$interpolate",function(e){return{restrict:"E",priority:100,compile:function(t,n){var r,i;return N(n.ngValue)||(N(n.value)?r=e(n.value,!0):(i=e(t.text(),!0))||n.$set("value",t.text())),function(e,t,n){var a=t.parent(),o=a.data("$selectController")||a.parent().data("$selectController");o&&o.registerOption(e,t,n,r,i)}}}}],po=["$parse",function(e){return{restrict:"A",require:"?ngModel",link:function(t,n,r,i){if(i){var a=r.hasOwnProperty("required")||e(r.ngRequired)(t);r.ngRequired||(r.required=!0),i.$validators.required=function(e,t){return!a||!i.$isEmpty(t)},r.$observe("required",(function(e){a!==e&&(a=e,i.$validate())}))}}}}],ho=["$parse",function(e){return{restrict:"A",require:"?ngModel",compile:function(t,n){var r,i;return n.ngPattern&&(r=n.ngPattern,i="/"===n.ngPattern.charAt(0)&&u.test(n.ngPattern)?function(){return n.ngPattern}:e(n.ngPattern)),function(e,t,n,a){if(a){var o=n.pattern;n.ngPattern?o=i(e):r=n.pattern;var s=mo(o,r,t);n.$observe("pattern",(function(e){var n=s;s=mo(e,r,t),(n&&n.toString())!==(s&&s.toString())&&a.$validate()})),a.$validators.pattern=function(e,t){return a.$isEmpty(t)||L(s)||s.test(t)}}}}}}],vo=["$parse",function(e){return{restrict:"A",require:"?ngModel",link:function(t,n,r,i){if(i){var a=r.maxlength||e(r.ngMaxlength)(t),o=go(a);r.$observe("maxlength",(function(e){a!==e&&(o=go(e),a=e,i.$validate())})),i.$validators.maxlength=function(e,t){return o<0||i.$isEmpty(t)||t.length<=o}}}}}],yo=["$parse",function(e){return{restrict:"A",require:"?ngModel",link:function(t,n,r,i){if(i){var a=r.minlength||e(r.ngMinlength)(t),o=go(a)||-1;r.$observe("minlength",(function(e){a!==e&&(o=go(e)||-1,a=e,i.$validate())})),i.$validators.minlength=function(e,t){return i.$isEmpty(t)||t.length>=o}}}}}];function mo(e,t,n){if(e){if(K(e)&&(e=new RegExp("^"+e+"$")),!e.test)throw i("ngPattern")("noregexp","Expected {0} to be a RegExp but was {1}. Element: {2}",t,e,we(n));return e}}function go(e){var t=A(e);return I(t)?-1:t}e.angular.bootstrap?e.console&&console.log("WARNING: Tried to load AngularJS more than once."):(!function(){var t;if(!De){var n=ue();(s=L(n)?e.jQuery:n?e[n]:void 0)&&s.fn.on?(o=s,C(s.fn,{scope:$t.scope,isolateScope:$t.isolateScope,controller:$t.controller,injector:$t.injector,inheritedData:$t.inheritedData})):o=st,t=o.cleanData,o.cleanData=function(e){for(var n,r,i=0;null!=(r=e[i]);i++)(n=(o._data(r)||{}).events)&&n.$destroy&&o(r).triggerHandler("$destroy");t(e)},b.element=o,De=!0}}(),function(t){C(t,{errorHandlingConfig:n,bootstrap:Ce,copy:ae,extend:C,merge:E,equals:se,element:o,forEach:x,injector:Wt,noop:D,bind:pe,toJson:de,fromJson:ve,identity:M,isUndefined:L,isDefined:N,isString:K,isFunction:W,isObject:F,isNumber:V,isElement:te,isArray:H,version:Be,isDate:B,callbacks:{$$counter:0},getTestability:Ae,reloadWithDebugInfo:Ee,$$minErr:i,$$csp:ce,$$encodeUriSegment:Se,$$encodeUriQuery:_e,$$lowercase:f,$$stringify:Fe,$$uppercase:p}),(c=function(e){var t=i("$injector"),n=i("ng");function r(e,t,n){return e[t]||(e[t]=n())}var a=r(e,"angular",Object);return a.$$minErr=a.$$minErr||i,r(a,"module",(function(){var e={};return function(i,a,o){var s={};return function(e,t){if("hasOwnProperty"===e)throw n("badname","hasOwnProperty is not a valid {0} name",t)}(i,"module"),a&&e.hasOwnProperty(i)&&(e[i]=null),r(e,i,(function(){if(!a)throw t("nomod","Module '{0}' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.",i);var e=[],r=[],c=[],u=f("$injector","invoke","push",r),l={_invokeQueue:e,_configBlocks:r,_runBlocks:c,info:function(e){if(N(e)){if(!F(e))throw n("aobj","Argument '{0}' must be an object","value");return s=e,this}return s},requires:a,name:i,provider:p("$provide","provider"),factory:p("$provide","factory"),service:p("$provide","service"),value:f("$provide","value"),constant:f("$provide","constant","unshift"),decorator:p("$provide","decorator",r),animation:p("$animateProvider","register"),filter:p("$filterProvider","register"),controller:p("$controllerProvider","register"),directive:p("$compileProvider","directive"),component:p("$compileProvider","component"),config:u,run:function(e){return c.push(e),this}};return o&&u(o),l;function f(t,n,r,i){return i||(i=e),function(){return i[r||"push"]([t,n,arguments]),l}}function p(t,n,r){return r||(r=e),function(e,a){return a&&W(a)&&(a.$$moduleName=i),r.push([t,n,arguments]),l}}}))}}))}(e))("ng",["ngLocale"],["$provide",function(e){e.provider({$$sanitizeUri:Lr}),e.provider("$compile",ln).directive({a:ji,input:la,textarea:la,form:Li,script:oo,select:lo,option:fo,ngBind:da,ngBindHtml:ya,ngBindTemplate:va,ngClass:ba,ngClassEven:ka,ngClassOdd:wa,ngCloak:xa,ngController:Sa,ngForm:Ni,ngHide:Xa,ngIf:Oa,ngInclude:Ca,ngInit:Aa,ngNonBindable:Ha,ngPluralize:Ga,ngRef:Ja,ngRepeat:Qa,ngShow:Za,ngStyle:eo,ngSwitch:to,ngSwitchWhen:no,ngSwitchDefault:ro,ngOptions:qa,ngTransclude:ao,ngModel:Fa,ngList:Ia,ngChange:ma,pattern:ho,ngPattern:ho,required:po,ngRequired:po,minlength:yo,ngMinlength:yo,maxlength:vo,ngMaxlength:vo,ngValue:ha,ngModelOptions:Va}).directive({ngInclude:Ea,input:fa}).directive(Di).directive(_a),e.provider({$anchorScroll:qt,$animate:Xt,$animateCss:nn,$$animateJs:Qt,$$animateQueue:Zt,$$AnimateRunner:tn,$$animateAsyncRun:en,$browser:an,$cacheFactory:on,$controller:wn,$document:kn,$$isDocumentHidden:xn,$exceptionHandler:Sn,$filter:ci,$$forceReflow:_n,$interpolate:Vn,$interval:Hn,$$intervalFactory:zn,$http:Nn,$httpParamSerializer:In,$httpParamSerializerJQLike:jn,$httpBackend:Un,$xhrFactory:Fn,$jsonpCallbacks:Wn,$location:ur,$log:lr,$parse:Cr,$rootScope:Rr,$q:Er,$$q:Ar,$sce:Hr,$sceDelegate:Br,$sniffer:zr,$$taskTrackerFactory:Wr,$templateCache:sn,$templateRequest:Yr,$$testability:Jr,$timeout:Zr,$window:ai,$$rAF:Tr,$$jqLite:jt,$$Map:Lt,$$cookieReader:si})}]).info({angularVersion:"1.7.9"})}(b),b.module("ngLocale",[],["$provide",function(e){var t="one",n="other";e.value("$locale",{DATETIME_FORMATS:{AMPMS:["AM","PM"],DAY:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ERANAMES:["Before Christ","Anno Domini"],ERAS:["BC","AD"],FIRSTDAYOFWEEK:6,MONTH:["January","February","March","April","May","June","July","August","September","October","November","December"],SHORTDAY:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],SHORTMONTH:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],STANDALONEMONTH:["January","February","March","April","May","June","July","August","September","October","November","December"],WEEKENDRANGE:[5,6],fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",medium:"MMM d, y h:mm:ss a",mediumDate:"MMM d, y",mediumTime:"h:mm:ss a",short:"M/d/yy h:mm a",shortDate:"M/d/yy",shortTime:"h:mm a"},NUMBER_FORMATS:{CURRENCY_SYM:"$",DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2,minFrac:2,minInt:1,negPre:"-¤",negSuf:"",posPre:"¤",posSuf:""}]},id:"en-us",localeID:"en_US",pluralCat:function(e,r){var i=0|e,a=function(e,t){var n=t;void 0===n&&(n=Math.min(function(e){var t=(e+="").indexOf(".");return-1==t?0:e.length-t-1}(e),3));var r=Math.pow(10,n);return{v:n,f:(e*r|0)%r}}(e,r);return 1==i&&0==a.v?t:n}})}]),o((function(){Oe(e.document,Ce)})))}(window),!window.angular.$$csp().noInlineStyle&&window.angular.element(document.head).prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>')},function(e,t,n){"use strict";var r,i,a,o,s,c,u,l,f,p=angular.$$minErr("$sanitize");angular.module("ngSanitize",[]).provider("$sanitize",(function(){var e=!1,t=!1;this.$get=["$$sanitizeUri",function(n){return e=!0,t&&i(x,w),function(e){var t=[];return l(e,f(t,(function(e,t){return!/^unsafe:/.test(n(e,t))}))),t.join("")}}],this.enableSvg=function(e){return s(e)?(t=e,this):t},this.addValidElements=function(t){return e||(o(t)&&(t={htmlElements:t}),E(w,t.svgElements),E(d,t.htmlVoidElements),E(x,t.htmlVoidElements),E(x,t.htmlElements)),this},this.addValidAttrs=function(t){return e||i(P,C(t,!0)),this},r=angular.bind,i=angular.extend,a=angular.forEach,o=angular.isArray,s=angular.isDefined,c=angular.$$lowercase,angular.noop,l=function(e,t){null==e?e="":"string"!=typeof e&&(e=""+e);var n=A(e);if(!n)return"";var r=5;do{if(0===r)throw p("uinput","Failed to sanitize html because the input is unstable");r--,e=n.innerHTML,n=A(e)}while(e!==n.innerHTML);var i=n.firstChild;for(;i;){switch(i.nodeType){case 1:t.start(i.nodeName.toLowerCase(),I(i.attributes));break;case 3:t.chars(i.textContent)}var a;if(!((a=i.firstChild)||(1===i.nodeType&&t.end(i.nodeName.toLowerCase()),a=M("nextSibling",i))))for(;null==a&&(i=M("parentNode",i))!==n;)a=M("nextSibling",i),1===i.nodeType&&t.end(i.nodeName.toLowerCase());i=a}for(;i=n.firstChild;)n.removeChild(i)},f=function(e,t){var n=!1,i=r(e,e.push);return{start:function(e,r){e=c(e),!n&&k[e]&&(n=e),n||!0!==x[e]||(i("<"),i(e),a(r,(function(n,r){var a=c(r),o="img"===e&&"src"===a||"background"===a;!0!==P[a]||!0===S[a]&&!t(n,o)||(i(" "),i(r),i('="'),i(j(n)),i('"'))})),i(">"))},end:function(e){e=c(e),n||!0!==x[e]||!0===d[e]||(i("</"),i(e),i(">")),e==n&&(n=!1)},chars:function(e){n||i(j(e))}}},u=window.Node.prototype.contains||function(e){return!!(16&this.compareDocumentPosition(e))};var n=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,h=/([^#-~ |!])/g,d=O("area,br,col,hr,img,wbr"),v=O("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),y=O("rp,rt"),m=i({},y,v),g=i({},v,O("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul,progress")),b=i({},y,O("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")),w=O("circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,radialGradient,rect,stop,svg,switch,text,title,tspan"),k=O("script,style"),x=i({},d,g,b,m),S=O("background,cite,href,longdesc,src,xlink:href,xml:base"),_=O("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,valign,value,vspace,width,style"),$=O("accent-height,accumulate,additive,alphabetic,arabic-form,ascent,baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan",!0),P=i({},S,$,_);function O(e,t){return C(e.split(","),t)}function C(e,t){var n,r={};for(n=0;n<e.length;n++)r[t?c(e[n]):e[n]]=!0;return r}function E(e,t){t&&t.length&&i(e,C(t))}var A=function(e,t){var n;if(!t||!t.implementation)throw p("noinert","Can't create an inert html document");var r=((n=t.implementation.createHTMLDocument("inert")).documentElement||n.getDocumentElement()).querySelector("body");return r.innerHTML='<svg><g onload="this.parentNode.remove()"></g></svg>',r.querySelector("svg")?(r.innerHTML='<svg><p><style><img src="</style><img src=x onerror=alert(1)//">',r.querySelector("svg img")?function(t){t="<remove></remove>"+t;try{var n=(new e.DOMParser).parseFromString(t,"text/html").body;return n.firstChild.remove(),n}catch(e){return}}:function(e){r.innerHTML=e,t.documentMode&&D(r);return r}):function(t){t="<remove></remove>"+t;try{t=encodeURI(t)}catch(e){return}var n=new e.XMLHttpRequest;n.responseType="document",n.open("GET","data:text/html;charset=utf-8,"+t,!1),n.send(null);var r=n.response.body;return r.firstChild.remove(),r}}(window,window.document);function I(e){for(var t={},n=0,r=e.length;n<r;n++){var i=e[n];t[i.name]=i.value}return t}function j(e){return e.replace(/&/g,"&amp;").replace(n,(function(e){return"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";"})).replace(h,(function(e){return"&#"+e.charCodeAt(0)+";"})).replace(/</g,"&lt;").replace(/>/g,"&gt;")}function D(e){for(;e;){if(e.nodeType===window.Node.ELEMENT_NODE)for(var t=e.attributes,n=0,r=t.length;n<r;n++){var i=t[n],a=i.name.toLowerCase();"xmlns:ns1"!==a&&0!==a.lastIndexOf("ns1:",0)||(e.removeAttributeNode(i),n--,r--)}var o=e.firstChild;o&&D(o),e=M("nextSibling",e)}}function M(e,t){var n=t[e];if(n&&u.call(t,n))throw p("elclob","Failed to sanitize html because the element is clobbered: {0}",t.outerHTML||t.outerText);return n}})).info({angularVersion:'"NG_VERSION_FULL"'})},function(e,t){!function(e){"use strict";var t=[0,1,2,3,4,4,5,5,6,6,6,6,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,0,0,16,17,18,18,19,19,20,20,20,20,21,21,21,21,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29];function n(){var e=this;function t(e,t){var n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1}e.build_tree=function(n){var r,i,a,o=e.dyn_tree,s=e.stat_desc.static_tree,c=e.stat_desc.elems,u=-1;for(n.heap_len=0,n.heap_max=573,r=0;r<c;r++)0!==o[2*r]?(n.heap[++n.heap_len]=u=r,n.depth[r]=0):o[2*r+1]=0;for(;n.heap_len<2;)o[2*(a=n.heap[++n.heap_len]=u<2?++u:0)]=1,n.depth[a]=0,n.opt_len--,s&&(n.static_len-=s[2*a+1]);for(e.max_code=u,r=Math.floor(n.heap_len/2);r>=1;r--)n.pqdownheap(o,r);a=c;do{r=n.heap[1],n.heap[1]=n.heap[n.heap_len--],n.pqdownheap(o,1),i=n.heap[1],n.heap[--n.heap_max]=r,n.heap[--n.heap_max]=i,o[2*a]=o[2*r]+o[2*i],n.depth[a]=Math.max(n.depth[r],n.depth[i])+1,o[2*r+1]=o[2*i+1]=a,n.heap[1]=a++,n.pqdownheap(o,1)}while(n.heap_len>=2);n.heap[--n.heap_max]=n.heap[1],function(t){var n,r,i,a,o,s,c=e.dyn_tree,u=e.stat_desc.static_tree,l=e.stat_desc.extra_bits,f=e.stat_desc.extra_base,p=e.stat_desc.max_length,h=0;for(a=0;a<=15;a++)t.bl_count[a]=0;for(c[2*t.heap[t.heap_max]+1]=0,n=t.heap_max+1;n<573;n++)(a=c[2*c[2*(r=t.heap[n])+1]+1]+1)>p&&(a=p,h++),c[2*r+1]=a,r>e.max_code||(t.bl_count[a]++,o=0,r>=f&&(o=l[r-f]),s=c[2*r],t.opt_len+=s*(a+o),u&&(t.static_len+=s*(u[2*r+1]+o)));if(0!==h){do{for(a=p-1;0===t.bl_count[a];)a--;t.bl_count[a]--,t.bl_count[a+1]+=2,t.bl_count[p]--,h-=2}while(h>0);for(a=p;0!==a;a--)for(r=t.bl_count[a];0!==r;)(i=t.heap[--n])>e.max_code||(c[2*i+1]!=a&&(t.opt_len+=(a-c[2*i+1])*c[2*i],c[2*i+1]=a),r--)}}(n),function(e,n,r){var i,a,o,s=[],c=0;for(i=1;i<=15;i++)s[i]=c=c+r[i-1]<<1;for(a=0;a<=n;a++)0!==(o=e[2*a+1])&&(e[2*a]=t(s[o]++,o))}(o,e.max_code,n.bl_count)}}function r(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i}n._length_code=[0,1,2,3,4,5,6,7,8,8,9,9,10,10,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,28],n.base_length=[0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224,0],n.base_dist=[0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576],n.d_code=function(e){return e<256?t[e]:t[256+(e>>>7)]},n.extra_lbits=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],n.extra_dbits=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],n.extra_blbits=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],n.bl_order=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],r.static_ltree=[12,8,140,8,76,8,204,8,44,8,172,8,108,8,236,8,28,8,156,8,92,8,220,8,60,8,188,8,124,8,252,8,2,8,130,8,66,8,194,8,34,8,162,8,98,8,226,8,18,8,146,8,82,8,210,8,50,8,178,8,114,8,242,8,10,8,138,8,74,8,202,8,42,8,170,8,106,8,234,8,26,8,154,8,90,8,218,8,58,8,186,8,122,8,250,8,6,8,134,8,70,8,198,8,38,8,166,8,102,8,230,8,22,8,150,8,86,8,214,8,54,8,182,8,118,8,246,8,14,8,142,8,78,8,206,8,46,8,174,8,110,8,238,8,30,8,158,8,94,8,222,8,62,8,190,8,126,8,254,8,1,8,129,8,65,8,193,8,33,8,161,8,97,8,225,8,17,8,145,8,81,8,209,8,49,8,177,8,113,8,241,8,9,8,137,8,73,8,201,8,41,8,169,8,105,8,233,8,25,8,153,8,89,8,217,8,57,8,185,8,121,8,249,8,5,8,133,8,69,8,197,8,37,8,165,8,101,8,229,8,21,8,149,8,85,8,213,8,53,8,181,8,117,8,245,8,13,8,141,8,77,8,205,8,45,8,173,8,109,8,237,8,29,8,157,8,93,8,221,8,61,8,189,8,125,8,253,8,19,9,275,9,147,9,403,9,83,9,339,9,211,9,467,9,51,9,307,9,179,9,435,9,115,9,371,9,243,9,499,9,11,9,267,9,139,9,395,9,75,9,331,9,203,9,459,9,43,9,299,9,171,9,427,9,107,9,363,9,235,9,491,9,27,9,283,9,155,9,411,9,91,9,347,9,219,9,475,9,59,9,315,9,187,9,443,9,123,9,379,9,251,9,507,9,7,9,263,9,135,9,391,9,71,9,327,9,199,9,455,9,39,9,295,9,167,9,423,9,103,9,359,9,231,9,487,9,23,9,279,9,151,9,407,9,87,9,343,9,215,9,471,9,55,9,311,9,183,9,439,9,119,9,375,9,247,9,503,9,15,9,271,9,143,9,399,9,79,9,335,9,207,9,463,9,47,9,303,9,175,9,431,9,111,9,367,9,239,9,495,9,31,9,287,9,159,9,415,9,95,9,351,9,223,9,479,9,63,9,319,9,191,9,447,9,127,9,383,9,255,9,511,9,0,7,64,7,32,7,96,7,16,7,80,7,48,7,112,7,8,7,72,7,40,7,104,7,24,7,88,7,56,7,120,7,4,7,68,7,36,7,100,7,20,7,84,7,52,7,116,7,3,8,131,8,67,8,195,8,35,8,163,8,99,8,227,8],r.static_dtree=[0,5,16,5,8,5,24,5,4,5,20,5,12,5,28,5,2,5,18,5,10,5,26,5,6,5,22,5,14,5,30,5,1,5,17,5,9,5,25,5,5,5,21,5,13,5,29,5,3,5,19,5,11,5,27,5,7,5,23,5],r.static_l_desc=new r(r.static_ltree,n.extra_lbits,257,286,15),r.static_d_desc=new r(r.static_dtree,n.extra_dbits,0,30,15),r.static_bl_desc=new r(null,n.extra_blbits,0,19,7);function i(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}var a=[new i(0,0,0,0,0),new i(4,4,8,4,1),new i(4,5,16,8,1),new i(4,6,32,32,1),new i(4,4,16,16,2),new i(8,16,32,32,2),new i(8,16,128,128,2),new i(8,32,128,256,2),new i(32,128,258,1024,2),new i(32,258,258,4096,2)],o=["need dictionary","stream end","","","stream error","data error","","buffer error","",""];function s(e,t,n,r){var i=e[2*t],a=e[2*n];return i<a||i==a&&r[t]<=r[n]}function c(){var e,t,i,c,u,l,f,p,h,d,v,y,m,g,b,w,k,x,S,_,$,P,O,C,E,A,I,j,D,M,T,R,L,N,F,U,K,V,B,H,z,W=this,q=new n,G=new n,Y=new n;function J(){var e;for(e=0;e<286;e++)T[2*e]=0;for(e=0;e<30;e++)R[2*e]=0;for(e=0;e<19;e++)L[2*e]=0;T[512]=1,W.opt_len=W.static_len=0,U=V=0}function Q(e,t){var n,r,i=-1,a=e[1],o=0,s=7,c=4;for(0===a&&(s=138,c=3),e[2*(t+1)+1]=65535,n=0;n<=t;n++)r=a,a=e[2*(n+1)+1],++o<s&&r==a||(o<c?L[2*r]+=o:0!==r?(r!=i&&L[2*r]++,L[32]++):o<=10?L[34]++:L[36]++,o=0,i=r,0===a?(s=138,c=3):r==a?(s=6,c=3):(s=7,c=4))}function Z(e){W.pending_buf[W.pending++]=e}function X(e){Z(255&e),Z(e>>>8&255)}function ee(e,t){var n,r=t;z>16-r?(X(H|=(n=e)<<z&65535),H=n>>>16-z,z+=r-16):(H|=e<<z&65535,z+=r)}function te(e,t){var n=2*e;ee(65535&t[n],65535&t[n+1])}function ne(e,t){var n,r,i=-1,a=e[1],o=0,s=7,c=4;for(0===a&&(s=138,c=3),n=0;n<=t;n++)if(r=a,a=e[2*(n+1)+1],!(++o<s&&r==a)){if(o<c)do{te(r,L)}while(0!=--o);else 0!==r?(r!=i&&(te(r,L),o--),te(16,L),ee(o-3,2)):o<=10?(te(17,L),ee(o-3,3)):(te(18,L),ee(o-11,7));o=0,i=r,0===a?(s=138,c=3):r==a?(s=6,c=3):(s=7,c=4)}}function re(){16==z?(X(H),H=0,z=0):z>=8&&(Z(255&H),H>>>=8,z-=8)}function ie(e,t){var r,i,a;if(W.pending_buf[K+2*U]=e>>>8&255,W.pending_buf[K+2*U+1]=255&e,W.pending_buf[N+U]=255&t,U++,0===e?T[2*t]++:(V++,e--,T[2*(n._length_code[t]+256+1)]++,R[2*n.d_code(e)]++),0==(8191&U)&&I>2){for(r=8*U,i=$-k,a=0;a<30;a++)r+=R[2*a]*(5+n.extra_dbits[a]);if(r>>>=3,V<Math.floor(U/2)&&r<Math.floor(i/2))return!0}return U==F-1}function ae(e,t){var r,i,a,o,s=0;if(0!==U)do{r=W.pending_buf[K+2*s]<<8&65280|255&W.pending_buf[K+2*s+1],i=255&W.pending_buf[N+s],s++,0===r?te(i,e):(te((a=n._length_code[i])+256+1,e),0!==(o=n.extra_lbits[a])&&ee(i-=n.base_length[a],o),r--,te(a=n.d_code(r),t),0!==(o=n.extra_dbits[a])&&ee(r-=n.base_dist[a],o))}while(s<U);te(256,e),B=e[513]}function oe(){z>8?X(H):z>0&&Z(255&H),H=0,z=0}function se(e,t,n){ee(0+(n?1:0),3),function(e,t,n){oe(),B=8,n&&(X(t),X(~t)),W.pending_buf.set(p.subarray(e,e+t),W.pending),W.pending+=t}(e,t,!0)}function ce(e,t,i){var a,o,s=0;I>0?(q.build_tree(W),G.build_tree(W),s=function(){var e;for(Q(T,q.max_code),Q(R,G.max_code),Y.build_tree(W),e=18;e>=3&&0===L[2*n.bl_order[e]+1];e--);return W.opt_len+=3*(e+1)+5+5+4,e}(),a=W.opt_len+3+7>>>3,(o=W.static_len+3+7>>>3)<=a&&(a=o)):a=o=t+5,t+4<=a&&-1!=e?se(e,t,i):o==a?(ee(2+(i?1:0),3),ae(r.static_ltree,r.static_dtree)):(ee(4+(i?1:0),3),function(e,t,r){var i;for(ee(e-257,5),ee(t-1,5),ee(r-4,4),i=0;i<r;i++)ee(L[2*n.bl_order[i]+1],3);ne(T,e-1),ne(R,t-1)}(q.max_code+1,G.max_code+1,s+1),ae(T,R)),J(),i&&oe()}function ue(t){ce(k>=0?k:-1,$-k,t),k=$,e.flush_pending()}function le(){var t,n,r,i;do{if(0===(i=h-O-$)&&0===$&&0===O)i=u;else if(-1==i)i--;else if($>=u+u-262){p.set(p.subarray(u,u+u),0),P-=u,$-=u,k-=u,r=t=m;do{n=65535&v[--r],v[r]=n>=u?n-u:0}while(0!=--t);r=t=u;do{n=65535&d[--r],d[r]=n>=u?n-u:0}while(0!=--t);i+=u}if(0===e.avail_in)return;t=e.read_buf(p,$+O,i),(O+=t)>=3&&(y=((y=255&p[$])<<w^255&p[$+1])&b)}while(O<262&&0!==e.avail_in)}function fe(e){var t,n,r=E,i=$,a=C,o=$>u-262?$-(u-262):0,s=M,c=f,l=$+258,h=p[i+a-1],v=p[i+a];C>=D&&(r>>=2),s>O&&(s=O);do{if(p[(t=e)+a]==v&&p[t+a-1]==h&&p[t]==p[i]&&p[++t]==p[i+1]){i+=2,t++;do{}while(p[++i]==p[++t]&&p[++i]==p[++t]&&p[++i]==p[++t]&&p[++i]==p[++t]&&p[++i]==p[++t]&&p[++i]==p[++t]&&p[++i]==p[++t]&&p[++i]==p[++t]&&i<l);if(n=258-(l-i),i=l-258,n>a){if(P=e,a=n,n>=s)break;h=p[i+a-1],v=p[i+a]}}}while((e=65535&d[e&c])>o&&0!=--r);return a<=O?a:O}function pe(e){return e.total_in=e.total_out=0,e.msg=null,W.pending=0,W.pending_out=0,t=113,c=0,q.dyn_tree=T,q.stat_desc=r.static_l_desc,G.dyn_tree=R,G.stat_desc=r.static_d_desc,Y.dyn_tree=L,Y.stat_desc=r.static_bl_desc,H=0,z=0,B=8,J(),function(){var e;for(h=2*u,v[m-1]=0,e=0;e<m-1;e++)v[e]=0;A=a[I].max_lazy,D=a[I].good_length,M=a[I].nice_length,E=a[I].max_chain,$=0,k=0,O=0,x=C=2,_=0,y=0}(),0}W.depth=[],W.bl_count=[],W.heap=[],T=[],R=[],L=[],W.pqdownheap=function(e,t){for(var n=W.heap,r=n[t],i=t<<1;i<=W.heap_len&&(i<W.heap_len&&s(e,n[i+1],n[i],W.depth)&&i++,!s(e,r,n[i],W.depth));)n[t]=n[i],t=i,i<<=1;n[t]=r},W.deflateInit=function(e,t,n,r,a,o){return r||(r=8),a||(a=8),o||(o=0),e.msg=null,-1==t&&(t=6),a<1||a>9||8!=r||n<9||n>15||t<0||t>9||o<0||o>2?-2:(e.dstate=W,f=(u=1<<(l=n))-1,b=(m=1<<(g=a+7))-1,w=Math.floor((g+3-1)/3),p=new Uint8Array(2*u),d=[],v=[],F=1<<a+6,W.pending_buf=new Uint8Array(4*F),i=4*F,K=Math.floor(F/2),N=3*F,I=t,j=o,255&r,pe(e))},W.deflateEnd=function(){return 42!=t&&113!=t&&666!=t?-2:(W.pending_buf=null,v=null,d=null,p=null,W.dstate=null,113==t?-3:0)},W.deflateParams=function(e,t,n){var r=0;return-1==t&&(t=6),t<0||t>9||n<0||n>2?-2:(a[I].func!=a[t].func&&0!==e.total_in&&(r=e.deflate(1)),I!=t&&(A=a[I=t].max_lazy,D=a[I].good_length,M=a[I].nice_length,E=a[I].max_chain),j=n,r)},W.deflateSetDictionary=function(e,n,r){var i,a=r,o=0;if(!n||42!=t)return-2;if(a<3)return 0;for(a>u-262&&(o=r-(a=u-262)),p.set(n.subarray(o,o+a),0),$=a,k=a,y=((y=255&p[0])<<w^255&p[1])&b,i=0;i<=a-3;i++)y=(y<<w^255&p[i+2])&b,d[i&f]=v[y],v[y]=i;return 0},W.deflate=function(n,s){var h,g,E,D,M,T;if(s>4||s<0)return-2;if(!n.next_out||!n.next_in&&0!==n.avail_in||666==t&&4!=s)return n.msg=o[4],-2;if(0===n.avail_out)return n.msg=o[7],-5;if(e=n,D=c,c=s,42==t&&(g=8+(l-8<<4)<<8,(E=(I-1&255)>>1)>3&&(E=3),g|=E<<6,0!==$&&(g|=32),t=113,Z((T=g+=31-g%31)>>8&255),Z(255&T)),0!==W.pending){if(e.flush_pending(),0===e.avail_out)return c=-1,0}else if(0===e.avail_in&&s<=D&&4!=s)return e.msg=o[7],-5;if(666==t&&0!==e.avail_in)return n.msg=o[7],-5;if(0!==e.avail_in||0!==O||0!=s&&666!=t){switch(M=-1,a[I].func){case 0:M=function(t){var n,r=65535;for(r>i-5&&(r=i-5);;){if(O<=1){if(le(),0===O&&0==t)return 0;if(0===O)break}if($+=O,O=0,n=k+r,(0===$||$>=n)&&(O=$-n,$=n,ue(!1),0===e.avail_out))return 0;if($-k>=u-262&&(ue(!1),0===e.avail_out))return 0}return ue(4==t),0===e.avail_out?4==t?2:0:4==t?3:1}(s);break;case 1:M=function(t){for(var n,r=0;;){if(O<262){if(le(),O<262&&0==t)return 0;if(0===O)break}if(O>=3&&(y=(y<<w^255&p[$+2])&b,r=65535&v[y],d[$&f]=v[y],v[y]=$),0!==r&&($-r&65535)<=u-262&&2!=j&&(x=fe(r)),x>=3)if(n=ie($-P,x-3),O-=x,x<=A&&O>=3){x--;do{$++,y=(y<<w^255&p[$+2])&b,r=65535&v[y],d[$&f]=v[y],v[y]=$}while(0!=--x);$++}else $+=x,x=0,y=((y=255&p[$])<<w^255&p[$+1])&b;else n=ie(0,255&p[$]),O--,$++;if(n&&(ue(!1),0===e.avail_out))return 0}return ue(4==t),0===e.avail_out?4==t?2:0:4==t?3:1}(s);break;case 2:M=function(t){for(var n,r,i=0;;){if(O<262){if(le(),O<262&&0==t)return 0;if(0===O)break}if(O>=3&&(y=(y<<w^255&p[$+2])&b,i=65535&v[y],d[$&f]=v[y],v[y]=$),C=x,S=P,x=2,0!==i&&C<A&&($-i&65535)<=u-262&&(2!=j&&(x=fe(i)),x<=5&&(1==j||3==x&&$-P>4096)&&(x=2)),C>=3&&x<=C){r=$+O-3,n=ie($-1-S,C-3),O-=C-1,C-=2;do{++$<=r&&(y=(y<<w^255&p[$+2])&b,i=65535&v[y],d[$&f]=v[y],v[y]=$)}while(0!=--C);if(_=0,x=2,$++,n&&(ue(!1),0===e.avail_out))return 0}else if(0!==_){if((n=ie(0,255&p[$-1]))&&ue(!1),$++,O--,0===e.avail_out)return 0}else _=1,$++,O--}return 0!==_&&(n=ie(0,255&p[$-1]),_=0),ue(4==t),0===e.avail_out?4==t?2:0:4==t?3:1}(s)}if(2!=M&&3!=M||(t=666),0==M||2==M)return 0===e.avail_out&&(c=-1),0;if(1==M){if(1==s)ee(2,3),te(256,r.static_ltree),re(),1+B+10-z<9&&(ee(2,3),te(256,r.static_ltree),re()),B=7;else if(se(0,0,!1),3==s)for(h=0;h<m;h++)v[h]=0;if(e.flush_pending(),0===e.avail_out)return c=-1,0}}return 4!=s?0:1}}function u(){this.next_in_index=0,this.next_out_index=0,this.avail_in=0,this.total_in=0,this.avail_out=0,this.total_out=0}u.prototype={deflateInit:function(e,t){return this.dstate=new c,t||(t=15),this.dstate.deflateInit(this,e,t)},deflate:function(e){return this.dstate?this.dstate.deflate(this,e):-2},deflateEnd:function(){if(!this.dstate)return-2;var e=this.dstate.deflateEnd();return this.dstate=null,e},deflateParams:function(e,t){return this.dstate?this.dstate.deflateParams(this,e,t):-2},deflateSetDictionary:function(e,t){return this.dstate?this.dstate.deflateSetDictionary(this,e,t):-2},read_buf:function(e,t,n){var r=this.avail_in;return r>n&&(r=n),0===r?0:(this.avail_in-=r,e.set(this.next_in.subarray(this.next_in_index,this.next_in_index+r),t),this.next_in_index+=r,this.total_in+=r,r)},flush_pending:function(){var e=this.dstate.pending;e>this.avail_out&&(e=this.avail_out),0!==e&&(this.next_out.set(this.dstate.pending_buf.subarray(this.dstate.pending_out,this.dstate.pending_out+e),this.next_out_index),this.next_out_index+=e,this.dstate.pending_out+=e,this.total_out+=e,this.avail_out-=e,this.dstate.pending-=e,0===this.dstate.pending&&(this.dstate.pending_out=0))}};var l=e.zip||e;l.Deflater=l._jzlib_Deflater=function(e){var t=new u,n=new Uint8Array(512),r=e?e.level:-1;void 0===r&&(r=-1),t.deflateInit(r),t.next_out=n,this.append=function(e,r){var i,a=[],o=0,s=0,c=0;if(e.length){t.next_in_index=0,t.next_in=e,t.avail_in=e.length;do{if(t.next_out_index=0,t.avail_out=512,0!=t.deflate(0))throw new Error("deflating: "+t.msg);t.next_out_index&&(512==t.next_out_index?a.push(new Uint8Array(n)):a.push(new Uint8Array(n.subarray(0,t.next_out_index)))),c+=t.next_out_index,r&&t.next_in_index>0&&t.next_in_index!=o&&(r(t.next_in_index),o=t.next_in_index)}while(t.avail_in>0||0===t.avail_out);return i=new Uint8Array(c),a.forEach((function(e){i.set(e,s),s+=e.length})),i}},this.flush=function(){var e,r,i=[],a=0,o=0;do{if(t.next_out_index=0,t.avail_out=512,1!=(e=t.deflate(4))&&0!=e)throw new Error("deflating: "+t.msg);512-t.avail_out>0&&i.push(new Uint8Array(n.subarray(0,t.next_out_index))),o+=t.next_out_index}while(t.avail_in>0||0===t.avail_out);return t.deflateEnd(),r=new Uint8Array(o),i.forEach((function(e){r.set(e,a),a+=e.length})),r}}}(this)},function(e,t){!function(e){"use strict";var t=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],n=[96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,192,80,7,10,0,8,96,0,8,32,0,9,160,0,8,0,0,8,128,0,8,64,0,9,224,80,7,6,0,8,88,0,8,24,0,9,144,83,7,59,0,8,120,0,8,56,0,9,208,81,7,17,0,8,104,0,8,40,0,9,176,0,8,8,0,8,136,0,8,72,0,9,240,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,200,81,7,13,0,8,100,0,8,36,0,9,168,0,8,4,0,8,132,0,8,68,0,9,232,80,7,8,0,8,92,0,8,28,0,9,152,84,7,83,0,8,124,0,8,60,0,9,216,82,7,23,0,8,108,0,8,44,0,9,184,0,8,12,0,8,140,0,8,76,0,9,248,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,196,81,7,11,0,8,98,0,8,34,0,9,164,0,8,2,0,8,130,0,8,66,0,9,228,80,7,7,0,8,90,0,8,26,0,9,148,84,7,67,0,8,122,0,8,58,0,9,212,82,7,19,0,8,106,0,8,42,0,9,180,0,8,10,0,8,138,0,8,74,0,9,244,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,204,81,7,15,0,8,102,0,8,38,0,9,172,0,8,6,0,8,134,0,8,70,0,9,236,80,7,9,0,8,94,0,8,30,0,9,156,84,7,99,0,8,126,0,8,62,0,9,220,82,7,27,0,8,110,0,8,46,0,9,188,0,8,14,0,8,142,0,8,78,0,9,252,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,194,80,7,10,0,8,97,0,8,33,0,9,162,0,8,1,0,8,129,0,8,65,0,9,226,80,7,6,0,8,89,0,8,25,0,9,146,83,7,59,0,8,121,0,8,57,0,9,210,81,7,17,0,8,105,0,8,41,0,9,178,0,8,9,0,8,137,0,8,73,0,9,242,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,202,81,7,13,0,8,101,0,8,37,0,9,170,0,8,5,0,8,133,0,8,69,0,9,234,80,7,8,0,8,93,0,8,29,0,9,154,84,7,83,0,8,125,0,8,61,0,9,218,82,7,23,0,8,109,0,8,45,0,9,186,0,8,13,0,8,141,0,8,77,0,9,250,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,198,81,7,11,0,8,99,0,8,35,0,9,166,0,8,3,0,8,131,0,8,67,0,9,230,80,7,7,0,8,91,0,8,27,0,9,150,84,7,67,0,8,123,0,8,59,0,9,214,82,7,19,0,8,107,0,8,43,0,9,182,0,8,11,0,8,139,0,8,75,0,9,246,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,206,81,7,15,0,8,103,0,8,39,0,9,174,0,8,7,0,8,135,0,8,71,0,9,238,80,7,9,0,8,95,0,8,31,0,9,158,84,7,99,0,8,127,0,8,63,0,9,222,82,7,27,0,8,111,0,8,47,0,9,190,0,8,15,0,8,143,0,8,79,0,9,254,96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,193,80,7,10,0,8,96,0,8,32,0,9,161,0,8,0,0,8,128,0,8,64,0,9,225,80,7,6,0,8,88,0,8,24,0,9,145,83,7,59,0,8,120,0,8,56,0,9,209,81,7,17,0,8,104,0,8,40,0,9,177,0,8,8,0,8,136,0,8,72,0,9,241,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,201,81,7,13,0,8,100,0,8,36,0,9,169,0,8,4,0,8,132,0,8,68,0,9,233,80,7,8,0,8,92,0,8,28,0,9,153,84,7,83,0,8,124,0,8,60,0,9,217,82,7,23,0,8,108,0,8,44,0,9,185,0,8,12,0,8,140,0,8,76,0,9,249,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,197,81,7,11,0,8,98,0,8,34,0,9,165,0,8,2,0,8,130,0,8,66,0,9,229,80,7,7,0,8,90,0,8,26,0,9,149,84,7,67,0,8,122,0,8,58,0,9,213,82,7,19,0,8,106,0,8,42,0,9,181,0,8,10,0,8,138,0,8,74,0,9,245,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,205,81,7,15,0,8,102,0,8,38,0,9,173,0,8,6,0,8,134,0,8,70,0,9,237,80,7,9,0,8,94,0,8,30,0,9,157,84,7,99,0,8,126,0,8,62,0,9,221,82,7,27,0,8,110,0,8,46,0,9,189,0,8,14,0,8,142,0,8,78,0,9,253,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,195,80,7,10,0,8,97,0,8,33,0,9,163,0,8,1,0,8,129,0,8,65,0,9,227,80,7,6,0,8,89,0,8,25,0,9,147,83,7,59,0,8,121,0,8,57,0,9,211,81,7,17,0,8,105,0,8,41,0,9,179,0,8,9,0,8,137,0,8,73,0,9,243,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,203,81,7,13,0,8,101,0,8,37,0,9,171,0,8,5,0,8,133,0,8,69,0,9,235,80,7,8,0,8,93,0,8,29,0,9,155,84,7,83,0,8,125,0,8,61,0,9,219,82,7,23,0,8,109,0,8,45,0,9,187,0,8,13,0,8,141,0,8,77,0,9,251,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,199,81,7,11,0,8,99,0,8,35,0,9,167,0,8,3,0,8,131,0,8,67,0,9,231,80,7,7,0,8,91,0,8,27,0,9,151,84,7,67,0,8,123,0,8,59,0,9,215,82,7,19,0,8,107,0,8,43,0,9,183,0,8,11,0,8,139,0,8,75,0,9,247,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,207,81,7,15,0,8,103,0,8,39,0,9,175,0,8,7,0,8,135,0,8,71,0,9,239,80,7,9,0,8,95,0,8,31,0,9,159,84,7,99,0,8,127,0,8,63,0,9,223,82,7,27,0,8,111,0,8,47,0,9,191,0,8,15,0,8,143,0,8,79,0,9,255],r=[80,5,1,87,5,257,83,5,17,91,5,4097,81,5,5,89,5,1025,85,5,65,93,5,16385,80,5,3,88,5,513,84,5,33,92,5,8193,82,5,9,90,5,2049,86,5,129,192,5,24577,80,5,2,87,5,385,83,5,25,91,5,6145,81,5,7,89,5,1537,85,5,97,93,5,24577,80,5,4,88,5,769,84,5,49,92,5,12289,82,5,13,90,5,3073,86,5,193,192,5,24577],i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,112,112],o=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],s=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];function c(){var e,t,n,r,c,u;function l(e,t,i,a,o,s,l,f,p,h,d){var v,y,m,g,b,w,k,x,S,_,$,P,O,C,E;_=0,b=i;do{n[e[t+_]]++,_++,b--}while(0!==b);if(n[0]==i)return l[0]=-1,f[0]=0,0;for(x=f[0],w=1;w<=15&&0===n[w];w++);for(k=w,x<w&&(x=w),b=15;0!==b&&0===n[b];b--);for(m=b,x>b&&(x=b),f[0]=x,C=1<<w;w<b;w++,C<<=1)if((C-=n[w])<0)return-3;if((C-=n[b])<0)return-3;for(n[b]+=C,u[1]=w=0,_=1,O=2;0!=--b;)u[O]=w+=n[_],O++,_++;b=0,_=0;do{0!==(w=e[t+_])&&(d[u[w]++]=b),_++}while(++b<i);for(i=u[m],u[0]=b=0,_=0,g=-1,P=-x,c[0]=0,$=0,E=0;k<=m;k++)for(v=n[k];0!=v--;){for(;k>P+x;){if(g++,E=(E=m-(P+=x))>x?x:E,(y=1<<(w=k-P))>v+1&&(y-=v+1,O=k,w<E))for(;++w<E&&!((y<<=1)<=n[++O]);)y-=n[O];if(E=1<<w,h[0]+E>1440)return-3;c[g]=$=h[0],h[0]+=E,0!==g?(u[g]=b,r[0]=w,r[1]=x,w=b>>>P-x,r[2]=$-c[g-1]-w,p.set(r,3*(c[g-1]+w))):l[0]=$}for(r[1]=k-P,_>=i?r[0]=192:d[_]<a?(r[0]=d[_]<256?0:96,r[2]=d[_++]):(r[0]=s[d[_]-a]+16+64,r[2]=o[d[_++]-a]),y=1<<k-P,w=b>>>P;w<E;w+=y)p.set(r,3*($+w));for(w=1<<k-1;0!=(b&w);w>>>=1)b^=w;for(b^=w,S=(1<<P)-1;(b&S)!=u[g];)g--,S=(1<<(P-=x))-1}return 0!==C&&1!=m?-5:0}function f(i){var a;for(e||(e=[],t=[],n=new Int32Array(16),r=[],c=new Int32Array(15),u=new Int32Array(16)),t.length<i&&(t=[]),a=0;a<i;a++)t[a]=0;for(a=0;a<16;a++)n[a]=0;for(a=0;a<3;a++)r[a]=0;c.set(n.subarray(0,15),0),u.set(n.subarray(0,16),0)}this.inflate_trees_bits=function(n,r,i,a,o){var s;return f(19),e[0]=0,-3==(s=l(n,0,19,19,null,null,i,r,a,e,t))?o.msg="oversubscribed dynamic bit lengths tree":-5!=s&&0!==r[0]||(o.msg="incomplete dynamic bit lengths tree",s=-3),s},this.inflate_trees_dynamic=function(n,r,c,u,p,h,d,v,y){var m;return f(288),e[0]=0,0!=(m=l(c,0,n,257,i,a,h,u,v,e,t))||0===u[0]?(-3==m?y.msg="oversubscribed literal/length tree":-4!=m&&(y.msg="incomplete literal/length tree",m=-3),m):(f(288),0!=(m=l(c,n,r,0,o,s,d,p,v,e,t))||0===p[0]&&n>257?(-3==m?y.msg="oversubscribed distance tree":-5==m?(y.msg="incomplete distance tree",m=-3):-4!=m&&(y.msg="empty distance tree with lengths",m=-3),m):0)}}c.inflate_trees_fixed=function(e,t,i,a){return e[0]=9,t[0]=5,i[0]=n,a[0]=r,0};function u(){var e,n,r,i,a=0,o=0,s=0,c=0,u=0,l=0,f=0,p=0,h=0,d=0;function v(e,n,r,i,a,o,s,c){var u,l,f,p,h,d,v,y,m,g,b,w,k,x,S,_;v=c.next_in_index,y=c.avail_in,h=s.bitb,d=s.bitk,g=(m=s.write)<s.read?s.read-m-1:s.end-m,b=t[e],w=t[n];do{for(;d<20;)y--,h|=(255&c.read_byte(v++))<<d,d+=8;if(0!==(p=(l=r)[_=3*((f=i)+(u=h&b))]))for(;;){if(h>>=l[_+1],d-=l[_+1],0!=(16&p)){for(p&=15,k=l[_+2]+(h&t[p]),h>>=p,d-=p;d<15;)y--,h|=(255&c.read_byte(v++))<<d,d+=8;for(p=(l=a)[_=3*((f=o)+(u=h&w))];;){if(h>>=l[_+1],d-=l[_+1],0!=(16&p)){for(p&=15;d<p;)y--,h|=(255&c.read_byte(v++))<<d,d+=8;if(x=l[_+2]+(h&t[p]),h>>=p,d-=p,g-=k,m>=x)m-(S=m-x)>0&&2>m-S?(s.window[m++]=s.window[S++],s.window[m++]=s.window[S++],k-=2):(s.window.set(s.window.subarray(S,S+2),m),m+=2,S+=2,k-=2);else{S=m-x;do{S+=s.end}while(S<0);if(k>(p=s.end-S)){if(k-=p,m-S>0&&p>m-S)do{s.window[m++]=s.window[S++]}while(0!=--p);else s.window.set(s.window.subarray(S,S+p),m),m+=p,S+=p,p=0;S=0}}if(m-S>0&&k>m-S)do{s.window[m++]=s.window[S++]}while(0!=--k);else s.window.set(s.window.subarray(S,S+k),m),m+=k,S+=k,k=0;break}if(0!=(64&p))return c.msg="invalid distance code",y+=k=d>>3<(k=c.avail_in-y)?d>>3:k,v-=k,d-=k<<3,s.bitb=h,s.bitk=d,c.avail_in=y,c.total_in+=v-c.next_in_index,c.next_in_index=v,s.write=m,-3;u+=l[_+2],p=l[_=3*(f+(u+=h&t[p]))]}break}if(0!=(64&p))return 0!=(32&p)?(y+=k=d>>3<(k=c.avail_in-y)?d>>3:k,v-=k,d-=k<<3,s.bitb=h,s.bitk=d,c.avail_in=y,c.total_in+=v-c.next_in_index,c.next_in_index=v,s.write=m,1):(c.msg="invalid literal/length code",y+=k=d>>3<(k=c.avail_in-y)?d>>3:k,v-=k,d-=k<<3,s.bitb=h,s.bitk=d,c.avail_in=y,c.total_in+=v-c.next_in_index,c.next_in_index=v,s.write=m,-3);if(u+=l[_+2],0===(p=l[_=3*(f+(u+=h&t[p]))])){h>>=l[_+1],d-=l[_+1],s.window[m++]=l[_+2],g--;break}}else h>>=l[_+1],d-=l[_+1],s.window[m++]=l[_+2],g--}while(g>=258&&y>=10);return y+=k=d>>3<(k=c.avail_in-y)?d>>3:k,v-=k,d-=k<<3,s.bitb=h,s.bitk=d,c.avail_in=y,c.total_in+=v-c.next_in_index,c.next_in_index=v,s.write=m,0}this.init=function(t,a,o,s,c,u){e=0,f=t,p=a,r=o,h=s,i=c,d=u,n=null},this.proc=function(y,m,g){var b,w,k,x,S,_,$,P=0,O=0,C=0;for(C=m.next_in_index,x=m.avail_in,P=y.bitb,O=y.bitk,_=(S=y.write)<y.read?y.read-S-1:y.end-S;;)switch(e){case 0:if(_>=258&&x>=10&&(y.bitb=P,y.bitk=O,m.avail_in=x,m.total_in+=C-m.next_in_index,m.next_in_index=C,y.write=S,g=v(f,p,r,h,i,d,y,m),C=m.next_in_index,x=m.avail_in,P=y.bitb,O=y.bitk,_=(S=y.write)<y.read?y.read-S-1:y.end-S,0!=g)){e=1==g?7:9;break}s=f,n=r,o=h,e=1;case 1:for(b=s;O<b;){if(0===x)return y.bitb=P,y.bitk=O,m.avail_in=x,m.total_in+=C-m.next_in_index,m.next_in_index=C,y.write=S,y.inflate_flush(m,g);g=0,x--,P|=(255&m.read_byte(C++))<<O,O+=8}if(P>>>=n[(w=3*(o+(P&t[b])))+1],O-=n[w+1],0===(k=n[w])){c=n[w+2],e=6;break}if(0!=(16&k)){u=15&k,a=n[w+2],e=2;break}if(0==(64&k)){s=k,o=w/3+n[w+2];break}if(0!=(32&k)){e=7;break}return e=9,m.msg="invalid literal/length code",g=-3,y.bitb=P,y.bitk=O,m.avail_in=x,m.total_in+=C-m.next_in_index,m.next_in_index=C,y.write=S,y.inflate_flush(m,g);case 2:for(b=u;O<b;){if(0===x)return y.bitb=P,y.bitk=O,m.avail_in=x,m.total_in+=C-m.next_in_index,m.next_in_index=C,y.write=S,y.inflate_flush(m,g);g=0,x--,P|=(255&m.read_byte(C++))<<O,O+=8}a+=P&t[b],P>>=b,O-=b,s=p,n=i,o=d,e=3;case 3:for(b=s;O<b;){if(0===x)return y.bitb=P,y.bitk=O,m.avail_in=x,m.total_in+=C-m.next_in_index,m.next_in_index=C,y.write=S,y.inflate_flush(m,g);g=0,x--,P|=(255&m.read_byte(C++))<<O,O+=8}if(P>>=n[(w=3*(o+(P&t[b])))+1],O-=n[w+1],0!=(16&(k=n[w]))){u=15&k,l=n[w+2],e=4;break}if(0==(64&k)){s=k,o=w/3+n[w+2];break}return e=9,m.msg="invalid distance code",g=-3,y.bitb=P,y.bitk=O,m.avail_in=x,m.total_in+=C-m.next_in_index,m.next_in_index=C,y.write=S,y.inflate_flush(m,g);case 4:for(b=u;O<b;){if(0===x)return y.bitb=P,y.bitk=O,m.avail_in=x,m.total_in+=C-m.next_in_index,m.next_in_index=C,y.write=S,y.inflate_flush(m,g);g=0,x--,P|=(255&m.read_byte(C++))<<O,O+=8}l+=P&t[b],P>>=b,O-=b,e=5;case 5:for($=S-l;$<0;)$+=y.end;for(;0!==a;){if(0===_&&(S==y.end&&0!==y.read&&(_=(S=0)<y.read?y.read-S-1:y.end-S),0===_&&(y.write=S,g=y.inflate_flush(m,g),_=(S=y.write)<y.read?y.read-S-1:y.end-S,S==y.end&&0!==y.read&&(_=(S=0)<y.read?y.read-S-1:y.end-S),0===_)))return y.bitb=P,y.bitk=O,m.avail_in=x,m.total_in+=C-m.next_in_index,m.next_in_index=C,y.write=S,y.inflate_flush(m,g);y.window[S++]=y.window[$++],_--,$==y.end&&($=0),a--}e=0;break;case 6:if(0===_&&(S==y.end&&0!==y.read&&(_=(S=0)<y.read?y.read-S-1:y.end-S),0===_&&(y.write=S,g=y.inflate_flush(m,g),_=(S=y.write)<y.read?y.read-S-1:y.end-S,S==y.end&&0!==y.read&&(_=(S=0)<y.read?y.read-S-1:y.end-S),0===_)))return y.bitb=P,y.bitk=O,m.avail_in=x,m.total_in+=C-m.next_in_index,m.next_in_index=C,y.write=S,y.inflate_flush(m,g);g=0,y.window[S++]=c,_--,e=0;break;case 7:if(O>7&&(O-=8,x++,C--),y.write=S,g=y.inflate_flush(m,g),_=(S=y.write)<y.read?y.read-S-1:y.end-S,y.read!=y.write)return y.bitb=P,y.bitk=O,m.avail_in=x,m.total_in+=C-m.next_in_index,m.next_in_index=C,y.write=S,y.inflate_flush(m,g);e=8;case 8:return g=1,y.bitb=P,y.bitk=O,m.avail_in=x,m.total_in+=C-m.next_in_index,m.next_in_index=C,y.write=S,y.inflate_flush(m,g);case 9:return g=-3,y.bitb=P,y.bitk=O,m.avail_in=x,m.total_in+=C-m.next_in_index,m.next_in_index=C,y.write=S,y.inflate_flush(m,g);default:return g=-2,y.bitb=P,y.bitk=O,m.avail_in=x,m.total_in+=C-m.next_in_index,m.next_in_index=C,y.write=S,y.inflate_flush(m,g)}},this.free=function(){}}var l=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function f(e,n){var r,i=this,a=0,o=0,s=0,f=0,p=[0],h=[0],d=new u,v=0,y=new Int32Array(4320),m=new c;i.bitk=0,i.bitb=0,i.window=new Uint8Array(n),i.end=n,i.read=0,i.write=0,i.reset=function(e,t){t&&(t[0]=0),6==a&&d.free(e),a=0,i.bitk=0,i.bitb=0,i.read=i.write=0},i.reset(e,null),i.inflate_flush=function(e,t){var n,r,a;return r=e.next_out_index,(n=((a=i.read)<=i.write?i.write:i.end)-a)>e.avail_out&&(n=e.avail_out),0!==n&&-5==t&&(t=0),e.avail_out-=n,e.total_out+=n,e.next_out.set(i.window.subarray(a,a+n),r),r+=n,(a+=n)==i.end&&(a=0,i.write==i.end&&(i.write=0),(n=i.write-a)>e.avail_out&&(n=e.avail_out),0!==n&&-5==t&&(t=0),e.avail_out-=n,e.total_out+=n,e.next_out.set(i.window.subarray(a,a+n),r),r+=n,a+=n),e.next_out_index=r,i.read=a,t},i.proc=function(e,n){var u,g,b,w,k,x,S,_;for(w=e.next_in_index,k=e.avail_in,g=i.bitb,b=i.bitk,S=(x=i.write)<i.read?i.read-x-1:i.end-x;;)switch(a){case 0:for(;b<3;){if(0===k)return i.bitb=g,i.bitk=b,e.avail_in=k,e.total_in+=w-e.next_in_index,e.next_in_index=w,i.write=x,i.inflate_flush(e,n);n=0,k--,g|=(255&e.read_byte(w++))<<b,b+=8}switch(v=1&(u=7&g),u>>>1){case 0:g>>>=3,g>>>=u=7&(b-=3),b-=u,a=1;break;case 1:var $=[],P=[],O=[[]],C=[[]];c.inflate_trees_fixed($,P,O,C),d.init($[0],P[0],O[0],0,C[0],0),g>>>=3,b-=3,a=6;break;case 2:g>>>=3,b-=3,a=3;break;case 3:return g>>>=3,b-=3,a=9,e.msg="invalid block type",n=-3,i.bitb=g,i.bitk=b,e.avail_in=k,e.total_in+=w-e.next_in_index,e.next_in_index=w,i.write=x,i.inflate_flush(e,n)}break;case 1:for(;b<32;){if(0===k)return i.bitb=g,i.bitk=b,e.avail_in=k,e.total_in+=w-e.next_in_index,e.next_in_index=w,i.write=x,i.inflate_flush(e,n);n=0,k--,g|=(255&e.read_byte(w++))<<b,b+=8}if((~g>>>16&65535)!=(65535&g))return a=9,e.msg="invalid stored block lengths",n=-3,i.bitb=g,i.bitk=b,e.avail_in=k,e.total_in+=w-e.next_in_index,e.next_in_index=w,i.write=x,i.inflate_flush(e,n);o=65535&g,g=b=0,a=0!==o?2:0!==v?7:0;break;case 2:if(0===k)return i.bitb=g,i.bitk=b,e.avail_in=k,e.total_in+=w-e.next_in_index,e.next_in_index=w,i.write=x,i.inflate_flush(e,n);if(0===S&&(x==i.end&&0!==i.read&&(S=(x=0)<i.read?i.read-x-1:i.end-x),0===S&&(i.write=x,n=i.inflate_flush(e,n),S=(x=i.write)<i.read?i.read-x-1:i.end-x,x==i.end&&0!==i.read&&(S=(x=0)<i.read?i.read-x-1:i.end-x),0===S)))return i.bitb=g,i.bitk=b,e.avail_in=k,e.total_in+=w-e.next_in_index,e.next_in_index=w,i.write=x,i.inflate_flush(e,n);if(n=0,(u=o)>k&&(u=k),u>S&&(u=S),i.window.set(e.read_buf(w,u),x),w+=u,k-=u,x+=u,S-=u,0!=(o-=u))break;a=0!==v?7:0;break;case 3:for(;b<14;){if(0===k)return i.bitb=g,i.bitk=b,e.avail_in=k,e.total_in+=w-e.next_in_index,e.next_in_index=w,i.write=x,i.inflate_flush(e,n);n=0,k--,g|=(255&e.read_byte(w++))<<b,b+=8}if(s=u=16383&g,(31&u)>29||(u>>5&31)>29)return a=9,e.msg="too many length or distance symbols",n=-3,i.bitb=g,i.bitk=b,e.avail_in=k,e.total_in+=w-e.next_in_index,e.next_in_index=w,i.write=x,i.inflate_flush(e,n);if(u=258+(31&u)+(u>>5&31),!r||r.length<u)r=[];else for(_=0;_<u;_++)r[_]=0;g>>>=14,b-=14,f=0,a=4;case 4:for(;f<4+(s>>>10);){for(;b<3;){if(0===k)return i.bitb=g,i.bitk=b,e.avail_in=k,e.total_in+=w-e.next_in_index,e.next_in_index=w,i.write=x,i.inflate_flush(e,n);n=0,k--,g|=(255&e.read_byte(w++))<<b,b+=8}r[l[f++]]=7&g,g>>>=3,b-=3}for(;f<19;)r[l[f++]]=0;if(p[0]=7,0!=(u=m.inflate_trees_bits(r,p,h,y,e)))return-3==(n=u)&&(r=null,a=9),i.bitb=g,i.bitk=b,e.avail_in=k,e.total_in+=w-e.next_in_index,e.next_in_index=w,i.write=x,i.inflate_flush(e,n);f=0,a=5;case 5:for(;!(f>=258+(31&(u=s))+(u>>5&31));){var E,A;for(u=p[0];b<u;){if(0===k)return i.bitb=g,i.bitk=b,e.avail_in=k,e.total_in+=w-e.next_in_index,e.next_in_index=w,i.write=x,i.inflate_flush(e,n);n=0,k--,g|=(255&e.read_byte(w++))<<b,b+=8}if(u=y[3*(h[0]+(g&t[u]))+1],(A=y[3*(h[0]+(g&t[u]))+2])<16)g>>>=u,b-=u,r[f++]=A;else{for(_=18==A?7:A-14,E=18==A?11:3;b<u+_;){if(0===k)return i.bitb=g,i.bitk=b,e.avail_in=k,e.total_in+=w-e.next_in_index,e.next_in_index=w,i.write=x,i.inflate_flush(e,n);n=0,k--,g|=(255&e.read_byte(w++))<<b,b+=8}if(b-=u,E+=(g>>>=u)&t[_],g>>>=_,b-=_,(_=f)+E>258+(31&(u=s))+(u>>5&31)||16==A&&_<1)return r=null,a=9,e.msg="invalid bit length repeat",n=-3,i.bitb=g,i.bitk=b,e.avail_in=k,e.total_in+=w-e.next_in_index,e.next_in_index=w,i.write=x,i.inflate_flush(e,n);A=16==A?r[_-1]:0;do{r[_++]=A}while(0!=--E);f=_}}h[0]=-1;var I=[],j=[],D=[],M=[];if(I[0]=9,j[0]=6,u=s,0!=(u=m.inflate_trees_dynamic(257+(31&u),1+(u>>5&31),r,I,j,D,M,y,e)))return-3==u&&(r=null,a=9),n=u,i.bitb=g,i.bitk=b,e.avail_in=k,e.total_in+=w-e.next_in_index,e.next_in_index=w,i.write=x,i.inflate_flush(e,n);d.init(I[0],j[0],y,D[0],y,M[0]),a=6;case 6:if(i.bitb=g,i.bitk=b,e.avail_in=k,e.total_in+=w-e.next_in_index,e.next_in_index=w,i.write=x,1!=(n=d.proc(i,e,n)))return i.inflate_flush(e,n);if(n=0,d.free(e),w=e.next_in_index,k=e.avail_in,g=i.bitb,b=i.bitk,S=(x=i.write)<i.read?i.read-x-1:i.end-x,0===v){a=0;break}a=7;case 7:if(i.write=x,n=i.inflate_flush(e,n),S=(x=i.write)<i.read?i.read-x-1:i.end-x,i.read!=i.write)return i.bitb=g,i.bitk=b,e.avail_in=k,e.total_in+=w-e.next_in_index,e.next_in_index=w,i.write=x,i.inflate_flush(e,n);a=8;case 8:return n=1,i.bitb=g,i.bitk=b,e.avail_in=k,e.total_in+=w-e.next_in_index,e.next_in_index=w,i.write=x,i.inflate_flush(e,n);case 9:return n=-3,i.bitb=g,i.bitk=b,e.avail_in=k,e.total_in+=w-e.next_in_index,e.next_in_index=w,i.write=x,i.inflate_flush(e,n);default:return n=-2,i.bitb=g,i.bitk=b,e.avail_in=k,e.total_in+=w-e.next_in_index,e.next_in_index=w,i.write=x,i.inflate_flush(e,n)}},i.free=function(e){i.reset(e,null),i.window=null,y=null},i.set_dictionary=function(e,t,n){i.window.set(e.subarray(t,t+n),0),i.read=i.write=n},i.sync_point=function(){return 1==a?1:0}}var p=[0,0,255,255];function h(){var e=this;function t(e){return e&&e.istate?(e.total_in=e.total_out=0,e.msg=null,e.istate.mode=7,e.istate.blocks.reset(e,null),0):-2}e.mode=0,e.method=0,e.was=[0],e.need=0,e.marker=0,e.wbits=0,e.inflateEnd=function(t){return e.blocks&&e.blocks.free(t),e.blocks=null,0},e.inflateInit=function(n,r){return n.msg=null,e.blocks=null,r<8||r>15?(e.inflateEnd(n),-2):(e.wbits=r,n.istate.blocks=new f(n,1<<r),t(n),0)},e.inflate=function(e,t){var n,r;if(!e||!e.istate||!e.next_in)return-2;for(t=4==t?-5:0,n=-5;;)switch(e.istate.mode){case 0:if(0===e.avail_in)return n;if(n=t,e.avail_in--,e.total_in++,8!=(15&(e.istate.method=e.read_byte(e.next_in_index++)))){e.istate.mode=13,e.msg="unknown compression method",e.istate.marker=5;break}if(8+(e.istate.method>>4)>e.istate.wbits){e.istate.mode=13,e.msg="invalid window size",e.istate.marker=5;break}e.istate.mode=1;case 1:if(0===e.avail_in)return n;if(n=t,e.avail_in--,e.total_in++,r=255&e.read_byte(e.next_in_index++),((e.istate.method<<8)+r)%31!=0){e.istate.mode=13,e.msg="incorrect header check",e.istate.marker=5;break}if(0==(32&r)){e.istate.mode=7;break}e.istate.mode=2;case 2:if(0===e.avail_in)return n;n=t,e.avail_in--,e.total_in++,e.istate.need=(255&e.read_byte(e.next_in_index++))<<24&4278190080,e.istate.mode=3;case 3:if(0===e.avail_in)return n;n=t,e.avail_in--,e.total_in++,e.istate.need+=(255&e.read_byte(e.next_in_index++))<<16&16711680,e.istate.mode=4;case 4:if(0===e.avail_in)return n;n=t,e.avail_in--,e.total_in++,e.istate.need+=(255&e.read_byte(e.next_in_index++))<<8&65280,e.istate.mode=5;case 5:return 0===e.avail_in?n:(n=t,e.avail_in--,e.total_in++,e.istate.need+=255&e.read_byte(e.next_in_index++),e.istate.mode=6,2);case 6:return e.istate.mode=13,e.msg="need dictionary",e.istate.marker=0,-2;case 7:if(-3==(n=e.istate.blocks.proc(e,n))){e.istate.mode=13,e.istate.marker=0;break}if(0==n&&(n=t),1!=n)return n;n=t,e.istate.blocks.reset(e,e.istate.was),e.istate.mode=12;case 12:return 1;case 13:return-3;default:return-2}},e.inflateSetDictionary=function(e,t,n){var r=0,i=n;return e&&e.istate&&6==e.istate.mode?(i>=1<<e.istate.wbits&&(r=n-(i=(1<<e.istate.wbits)-1)),e.istate.blocks.set_dictionary(t,r,i),e.istate.mode=7,0):-2},e.inflateSync=function(e){var n,r,i,a,o;if(!e||!e.istate)return-2;if(13!=e.istate.mode&&(e.istate.mode=13,e.istate.marker=0),0===(n=e.avail_in))return-5;for(r=e.next_in_index,i=e.istate.marker;0!==n&&i<4;)e.read_byte(r)==p[i]?i++:i=0!==e.read_byte(r)?0:4-i,r++,n--;return e.total_in+=r-e.next_in_index,e.next_in_index=r,e.avail_in=n,e.istate.marker=i,4!=i?-3:(a=e.total_in,o=e.total_out,t(e),e.total_in=a,e.total_out=o,e.istate.mode=7,0)},e.inflateSyncPoint=function(e){return e&&e.istate&&e.istate.blocks?e.istate.blocks.sync_point():-2}}function d(){}d.prototype={inflateInit:function(e){return this.istate=new h,e||(e=15),this.istate.inflateInit(this,e)},inflate:function(e){return this.istate?this.istate.inflate(this,e):-2},inflateEnd:function(){if(!this.istate)return-2;var e=this.istate.inflateEnd(this);return this.istate=null,e},inflateSync:function(){return this.istate?this.istate.inflateSync(this):-2},inflateSetDictionary:function(e,t){return this.istate?this.istate.inflateSetDictionary(this,e,t):-2},read_byte:function(e){return this.next_in.subarray(e,e+1)[0]},read_buf:function(e,t){return this.next_in.subarray(e,e+t)}};var v=e.zip||e;v.Inflater=v._jzlib_Inflater=function(){var e=new d,t=new Uint8Array(512),n=!1;e.inflateInit(),e.next_out=t,this.append=function(r,i){var a,o,s=[],c=0,u=0,l=0;if(0!==r.length){e.next_in_index=0,e.next_in=r,e.avail_in=r.length;do{if(e.next_out_index=0,e.avail_out=512,0!==e.avail_in||n||(e.next_in_index=0,n=!0),a=e.inflate(0),n&&-5===a){if(0!==e.avail_in)throw new Error("inflating: bad input")}else if(0!==a&&1!==a)throw new Error("inflating: "+e.msg);if((n||1===a)&&e.avail_in===r.length)throw new Error("inflating: bad input");e.next_out_index&&(512===e.next_out_index?s.push(new Uint8Array(t)):s.push(new Uint8Array(t.subarray(0,e.next_out_index)))),l+=e.next_out_index,i&&e.next_in_index>0&&e.next_in_index!=c&&(i(e.next_in_index),c=e.next_in_index)}while(e.avail_in>0||0===e.avail_out);return o=new Uint8Array(l),s.forEach((function(e){o.set(e,u),u+=e.length})),o}},this.flush=function(){e.inflateEnd()}}}(this)},function(e,t){!function(e){"use strict";var t,n="File format is not recognized.",r="Error while reading zip file.";try{t=0===new Blob([new DataView(new ArrayBuffer(0))]).size}catch(e){}function i(){this.crc=-1}function a(){}function o(e,t){var n,r;return n=new ArrayBuffer(e),r=new Uint8Array(n),t&&r.set(t,0),{buffer:n,array:r,view:new DataView(n)}}function s(){}function c(e){var t,n=this;n.size=0,n.init=function(r,i){var a=new Blob([e],{type:"text/plain"});(t=new l(a)).init((function(){n.size=t.size,r()}),i)},n.readUint8Array=function(e,n,r,i){t.readUint8Array(e,n,r,i)}}function u(t){var n,r=this;r.size=0,r.init=function(e){for(var i=t.length;"="==t.charAt(i-1);)i--;n=t.indexOf(",")+1,r.size=Math.floor(.75*(i-n)),e()},r.readUint8Array=function(r,i,a){var s,c=o(i),u=4*Math.floor(r/3),l=4*Math.ceil((r+i)/3),f=e.atob(t.substring(u+n,l+n)),p=r-3*Math.floor(u/4);for(s=p;s<p+i;s++)c.array[s-p]=f.charCodeAt(s);a(c.array)}}function l(e){var t=this;t.size=0,t.init=function(n){t.size=e.size,n()},t.readUint8Array=function(t,n,r,i){var a=new FileReader;a.onload=function(e){r(new Uint8Array(e.target.result))},a.onerror=i;try{a.readAsArrayBuffer(function(e,t,n){if(t<0||n<0||t+n>e.size)throw new RangeError("offset:"+t+", length:"+n+", size:"+e.size);return e.slice?e.slice(t,t+n):e.webkitSlice?e.webkitSlice(t,t+n):e.mozSlice?e.mozSlice(t,t+n):e.msSlice?e.msSlice(t,t+n):void 0}(e,t,n))}catch(e){i(e)}}}function f(){}function p(e){var n;this.init=function(e){n=new Blob([],{type:"text/plain"}),e()},this.writeUint8Array=function(e,r){n=new Blob([n,t?e:e.buffer],{type:"text/plain"}),r()},this.getData=function(t,r){var i=new FileReader;i.onload=function(e){t(e.target.result)},i.onerror=r,i.readAsText(n,e)}}function h(t){var n="",r="";this.init=function(e){n+="data:"+(t||"")+";base64,",e()},this.writeUint8Array=function(t,i){var a,o=r.length,s=r;for(r="",a=0;a<3*Math.floor((o+t.length)/3)-o;a++)s+=String.fromCharCode(t[a]);for(;a<t.length;a++)r+=String.fromCharCode(t[a]);s.length>2?n+=e.btoa(s):r=s,i()},this.getData=function(t){t(n+e.btoa(r))}}function d(e){var n;this.init=function(t){n=new Blob([],{type:e}),t()},this.writeUint8Array=function(r,i){n=new Blob([n,t?r:r.buffer],{type:e}),i()},this.getData=function(e){e(n)}}function v(e,t,n,r,i,a,o,s,c,u){var l,f,p,h=0,d=t.sn;function v(){e.removeEventListener("message",y,!1),s(f,p)}function y(t){var n=t.data,i=n.data,s=n.error;if(s)return s.toString=function(){return"Error: "+this.message},void c(s);if(n.sn===d)switch("number"==typeof n.codecTime&&(e.codecTime+=n.codecTime),"number"==typeof n.crcTime&&(e.crcTime+=n.crcTime),n.type){case"append":i?(f+=i.length,r.writeUint8Array(i,(function(){m()}),u)):m();break;case"flush":p=n.crc,i?(f+=i.length,r.writeUint8Array(i,(function(){v()}),u)):v();break;case"progress":o&&o(l+n.loaded,a);break;case"importScripts":case"newTask":case"echo":break;default:console.warn("zip.js:launchWorkerProcess: unknown message: ",n)}}function m(){(l=524288*h)<=a?n.readUint8Array(i+l,Math.min(524288,a-l),(function(n){o&&o(l,a);var r=0===l?t:{sn:d};r.type="append",r.data=n;try{e.postMessage(r,[n.buffer])}catch(t){e.postMessage(r)}h++}),c):e.postMessage({sn:d,type:"flush"})}f=0,e.addEventListener("message",y,!1),m()}function y(e,t,n,r,a,o,s,c,u,l){var f,p=0,h=0,d="input"===o,v="output"===o,y=new i;!function i(){var o;if((f=524288*p)<a)t.readUint8Array(r+f,Math.min(524288,a-f),(function(t){var r;try{r=e.append(t,(function(e){s&&s(f+e,a)}))}catch(e){return void u(e)}r?(h+=r.length,n.writeUint8Array(r,(function(){p++,setTimeout(i,1)}),l),v&&y.append(r)):(p++,setTimeout(i,1)),d&&y.append(t),s&&s(f,a)}),u);else{try{o=e.flush()}catch(e){return void u(e)}o?(v&&y.append(o),h+=o.length,n.writeUint8Array(o,(function(){c(h,y.get())}),l)):c(h,y.get())}}()}function m(t,n,r,i,o,s,c,u,l,f,p){e.zip.useWebWorkers&&c?v(t,{sn:n,codecClass:"NOOP",crcType:"input"},r,i,o,s,l,u,f,p):y(new a,r,i,o,s,"input",l,u,f,p)}function g(e){var t,n,r="",i=["Ç","ü","é","â","ä","à","å","ç","ê","ë","è","ï","î","ì","Ä","Å","É","æ","Æ","ô","ö","ò","û","ù","ÿ","Ö","Ü","ø","£","Ø","×","ƒ","á","í","ó","ú","ñ","Ñ","ª","º","¿","®","¬","½","¼","¡","«","»","_","_","_","¦","¦","Á","Â","À","©","¦","¦","+","+","¢","¥","+","+","-","-","+","-","+","ã","Ã","+","+","-","-","¦","-","+","¤","ð","Ð","Ê","Ë","È","i","Í","Î","Ï","+","+","_","_","¦","Ì","_","Ó","ß","Ô","Ò","õ","Õ","µ","þ","Þ","Ú","Û","Ù","ý","Ý","¯","´","­","±","_","¾","¶","§","÷","¸","°","¨","·","¹","³","²","_"," "];for(t=0;t<e.length;t++)r+=(n=255&e.charCodeAt(t))>127?i[n-128]:String.fromCharCode(n);return r}function b(e){return decodeURIComponent(escape(e))}function w(e){var t,n="";for(t=0;t<e.length;t++)n+=String.fromCharCode(e[t]);return n}function k(e,t,n,r,i){e.version=t.view.getUint16(n,!0),e.bitFlag=t.view.getUint16(n+2,!0),e.compressionMethod=t.view.getUint16(n+4,!0),e.lastModDateRaw=t.view.getUint32(n+6,!0),e.lastModDate=function(e){var t=(4294901760&e)>>16,n=65535&e;try{return new Date(1980+((65024&t)>>9),((480&t)>>5)-1,31&t,(63488&n)>>11,(2016&n)>>5,2*(31&n),0)}catch(e){}}(e.lastModDateRaw),1!=(1&e.bitFlag)?((r||8!=(8&e.bitFlag))&&(e.crc32=t.view.getUint32(n+10,!0),e.compressedSize=t.view.getUint32(n+14,!0),e.uncompressedSize=t.view.getUint32(n+18,!0)),4294967295!==e.compressedSize&&4294967295!==e.uncompressedSize?(e.filenameLength=t.view.getUint16(n+22,!0),e.extraFieldLength=t.view.getUint16(n+24,!0)):i("File is using Zip64 (4gb+ file size).")):i("File contains encrypted entry.")}function x(t,i,a){var s=0;function c(){}c.prototype.getData=function(r,i,c,u){var l=this;function f(e,t){u&&!function(e){var t=o(4);return t.view.setUint32(0,e),l.crc32==t.view.getUint32(0)}(t)?a("CRC failed."):r.getData((function(e){i(e)}))}function p(e){a(e||"Error while reading file data.")}function h(e){a(e||"Error while writing file data.")}t.readUint8Array(l.offset,30,(function(i){var d,g=o(i.length,i);1347093252==g.view.getUint32(0)?(k(l,g,4,!1,a),d=l.offset+30+l.filenameLength+l.extraFieldLength,r.init((function(){0===l.compressionMethod?m(l._worker,s++,t,r,d,l.compressedSize,u,f,c,p,h):function(t,n,r,i,a,o,s,c,u,l,f){var p=s?"output":"none";e.zip.useWebWorkers?v(t,{sn:n,codecClass:"Inflater",crcType:p},r,i,a,o,u,c,l,f):y(new e.zip.Inflater,r,i,a,o,p,u,c,l,f)}(l._worker,s++,t,r,d,l.compressedSize,u,f,c,p,h)}),h)):a(n)}),p)};var u={getEntries:function(e){var i=this._worker;!function(e){if(t.size<22)a(n);else{i(22,(function(){i(Math.min(65558,t.size),(function(){a(n)}))}))}function i(n,i){t.readUint8Array(t.size-n,n,(function(t){for(var n=t.length-22;n>=0;n--)if(80===t[n]&&75===t[n+1]&&5===t[n+2]&&6===t[n+3])return void e(new DataView(t.buffer,n,22));i()}),(function(){a(r)}))}}((function(s){var u,l;u=s.getUint32(16,!0),l=s.getUint16(8,!0),u<0||u>=t.size?a(n):t.readUint8Array(u,t.size-u,(function(t){var r,s,u,f,p=0,h=[],d=o(t.length,t);for(r=0;r<l;r++){if((s=new c)._worker=i,1347092738!=d.view.getUint32(p))return void a(n);k(s,d,p+6,!0,a),s.commentLength=d.view.getUint16(p+32,!0),s.directory=16==(16&d.view.getUint8(p+38)),s.offset=d.view.getUint32(p+42,!0),u=w(d.array.subarray(p+46,p+46+s.filenameLength)),s.filename=2048==(2048&s.bitFlag)?b(u):g(u),s.directory||"/"!=s.filename.charAt(s.filename.length-1)||(s.directory=!0),f=w(d.array.subarray(p+46+s.filenameLength+s.extraFieldLength,p+46+s.filenameLength+s.extraFieldLength+s.commentLength)),s.comment=2048==(2048&s.bitFlag)?b(f):g(f),h.push(s),p+=46+s.filenameLength+s.extraFieldLength+s.commentLength}e(h)}),(function(){a(r)}))}))},close:function(e){this._worker&&(this._worker.terminate(),this._worker=null),e&&e()},_worker:null};e.zip.useWebWorkers?O("inflater",(function(e){u._worker=e,i(u)}),(function(e){a(e)})):i(u)}function S(e){return unescape(encodeURIComponent(e))}function _(e){var t,n=[];for(t=0;t<e.length;t++)n.push(e.charCodeAt(t));return n}function $(t,n,r,i){var a={},s=[],c=0,u=0;function l(e){r(e||"Error while writing zip file.")}function f(e){r(e||"Error while reading file data.")}var p={add:function(n,p,h,d,g){var b,w,k,x=this._worker;function $(e,n){var r=o(16);c+=e||0,r.view.setUint32(0,1347094280),void 0!==n&&(b.view.setUint32(10,n,!0),r.view.setUint32(4,n,!0)),p&&(r.view.setUint32(8,e,!0),b.view.setUint32(14,e,!0),r.view.setUint32(12,p.size,!0),b.view.setUint32(18,p.size,!0)),t.writeUint8Array(r.array,(function(){c+=16,h()}),l)}function P(){g=g||{},n=n.trim(),g.directory&&"/"!=n.charAt(n.length-1)&&(n+="/"),a.hasOwnProperty(n)?r("File already exists."):(w=_(S(n)),s.push(n),function(e){var r;k=g.lastModDate||new Date,b=o(26),a[n]={headerArray:b.array,directory:g.directory,filename:w,offset:c,comment:_(S(g.comment||""))},b.view.setUint32(0,335546376),g.version&&b.view.setUint8(0,g.version),i||0===g.level||g.directory||b.view.setUint16(4,2048),b.view.setUint16(6,(k.getHours()<<6|k.getMinutes())<<5|k.getSeconds()/2,!0),b.view.setUint16(8,(k.getFullYear()-1980<<4|k.getMonth()+1)<<5|k.getDate(),!0),b.view.setUint16(22,w.length,!0),(r=o(30+w.length)).view.setUint32(0,1347093252),r.array.set(b.array,4),r.array.set(w,30),c+=r.array.length,t.writeUint8Array(r.array,e,l)}((function(){p?i||0===g.level?m(x,u++,p,t,0,p.size,!0,$,d,f,l):function(t,n,r,i,a,o,s,c,u){e.zip.useWebWorkers?v(t,{sn:n,options:{level:a},codecClass:"Deflater",crcType:"input"},r,i,0,r.size,s,o,c,u):y(new e.zip.Deflater,r,i,0,r.size,"input",s,o,c,u)}(x,u++,p,t,g.level,$,d,f,l):$()})))}p?p.init(P,f):P()},close:function(e){this._worker&&(this._worker.terminate(),this._worker=null);var n,r,i,u=0,f=0;for(r=0;r<s.length;r++)u+=46+(i=a[s[r]]).filename.length+i.comment.length;for(n=o(u+22),r=0;r<s.length;r++)i=a[s[r]],n.view.setUint32(f,1347092738),n.view.setUint16(f+4,5120),n.array.set(i.headerArray,f+6),n.view.setUint16(f+32,i.comment.length,!0),i.directory&&n.view.setUint8(f+38,16),n.view.setUint32(f+42,i.offset,!0),n.array.set(i.filename,f+46),n.array.set(i.comment,f+46+i.filename.length),f+=46+i.filename.length+i.comment.length;n.view.setUint32(f,1347093766),n.view.setUint16(f+8,s.length,!0),n.view.setUint16(f+10,s.length,!0),n.view.setUint32(f+12,u,!0),n.view.setUint32(f+16,c,!0),t.writeUint8Array(n.array,(function(){t.getData(e)}),l)},_worker:null};e.zip.useWebWorkers?O("deflater",(function(e){p._worker=e,n(p)}),(function(e){r(e)})):n(p)}i.prototype.append=function(e){for(var t=0|this.crc,n=this.table,r=0,i=0|e.length;r<i;r++)t=t>>>8^n[255&(t^e[r])];this.crc=t},i.prototype.get=function(){return~this.crc},i.prototype.table=function(){var e,t,n,r=[];for(e=0;e<256;e++){for(n=e,t=0;t<8;t++)1&n?n=n>>>1^3988292384:n>>>=1;r[e]=n}return r}(),a.prototype.append=function(e,t){return e},a.prototype.flush=function(){},c.prototype=new s,c.prototype.constructor=c,u.prototype=new s,u.prototype.constructor=u,l.prototype=new s,l.prototype.constructor=l,f.prototype.getData=function(e){e(this.data)},p.prototype=new f,p.prototype.constructor=p,h.prototype=new f,h.prototype.constructor=h,d.prototype=new f,d.prototype.constructor=d;var P={deflater:["z-worker.js","deflate.js"],inflater:["z-worker.js","inflate.js"]};function O(t,n,r){if(null===e.zip.workerScripts||null===e.zip.workerScriptsPath){var i,a,o;if(e.zip.workerScripts){if(i=e.zip.workerScripts[t],!Array.isArray(i))return void r(new Error("zip.workerScripts."+t+" is not an array!"));a=i,o=document.createElement("a"),i=a.map((function(e){return o.href=e,o.href}))}else(i=P[t].slice(0))[0]=(e.zip.workerScriptsPath||"")+i[0];var s=new Worker(i[0]);s.codecTime=s.crcTime=0,s.postMessage({type:"importScripts",scripts:i.slice(1)}),s.addEventListener("message",(function e(t){var i=t.data;if(i.error)return s.terminate(),void r(i.error);"importScripts"===i.type&&(s.removeEventListener("message",e),s.removeEventListener("error",c),n(s))})),s.addEventListener("error",c)}else r(new Error("Either zip.workerScripts or zip.workerScriptsPath may be set, not both."));function c(e){s.terminate(),r(e)}}function C(e){console.error(e)}e.zip={Reader:s,Writer:f,BlobReader:l,Data64URIReader:u,TextReader:c,BlobWriter:d,Data64URIWriter:h,TextWriter:p,createReader:function(e,t,n){n=n||C,e.init((function(){x(e,t,n)}),n)},createWriter:function(e,t,n,r){n=n||C,r=!!r,e.init((function(){$(e,t,n,r)}),n)},useWebWorkers:!0,workerScriptsPath:null,workerScripts:null}}(this)},function(e,t){!function(e){"use strict";if(e.zWorkerInitialized)throw new Error("z-worker.js should be run only once");e.zWorkerInitialized=!0,addEventListener("message",(function(e){var n=e.data,r=n.type,i=n.sn,a=t[r];if(a)try{a(n)}catch(e){!function(e,t,n){var r={type:e,sn:t,error:o(n)};postMessage(r)}(r,i,e)}}));var t={importScripts:function(e){e.scripts&&e.scripts.length>0&&importScripts.apply(void 0,e.scripts);postMessage({type:"importScripts"})},newTask:r,append:a,flush:a},n={};function r(t){var r=e[t.codecClass],i=t.sn;if(n[i])throw Error("duplicated sn");n[i]={codec:new r(t.options),crcInput:"input"===t.crcType,crcOutput:"output"===t.crcType,crc:new s},postMessage({type:"newTask",sn:i})}var i=e.performance?e.performance.now.bind(e.performance):Date.now;function a(e){var t=e.sn,a=e.type,o=e.data,s=n[t];!s&&e.codecClass&&(r(e),s=n[t]);var c,u="append"===a,l=i();if(u)try{c=s.codec.append(o,(function(e){postMessage({type:"progress",sn:t,loaded:e})}))}catch(e){throw delete n[t],e}else delete n[t],c=s.codec.flush();var f=i()-l;l=i(),o&&s.crcInput&&s.crc.append(o),c&&s.crcOutput&&s.crc.append(c);var p=i()-l,h={type:a,sn:t,codecTime:f,crcTime:p},d=[];c&&(h.data=c,d.push(c.buffer)),u||!s.crcInput&&!s.crcOutput||(h.crc=s.crc.get());try{postMessage(h,d)}catch(e){postMessage(h)}}function o(e){return{message:e.message,stack:e.stack}}function s(){this.crc=-1}function c(){}s.prototype.append=function(e){for(var t=0|this.crc,n=this.table,r=0,i=0|e.length;r<i;r++)t=t>>>8^n[255&(t^e[r])];this.crc=t},s.prototype.get=function(){return~this.crc},s.prototype.table=function(){var e,t,n,r=[];for(e=0;e<256;e++){for(n=e,t=0;t<8;t++)1&n?n=n>>>1^3988292384:n>>>=1;r[e]=n}return r}(),e.NOOP=c,c.prototype.append=function(e,t){return e},c.prototype.flush=function(){}}(this)},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t,n){var r=function(e){"use strict";var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function s(e,t,n,r){var i=t&&t.prototype instanceof l?t:l,a=Object.create(i.prototype),o=new x(r||[]);return a._invoke=function(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return _()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=b(o,n);if(s){if(s===u)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=c(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}(e,n,o),a}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var u={};function l(){}function f(){}function p(){}var h={};h[i]=function(){return this};var d=Object.getPrototypeOf,v=d&&d(d(S([])));v&&v!==t&&n.call(v,i)&&(h=v);var y=p.prototype=l.prototype=Object.create(h);function m(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function g(e){var t;this._invoke=function(r,i){function a(){return new Promise((function(t,a){!function t(r,i,a,o){var s=c(e[r],e,i);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&n.call(l,"__await")?Promise.resolve(l.__await).then((function(e){t("next",e,a,o)}),(function(e){t("throw",e,a,o)})):Promise.resolve(l).then((function(e){u.value=e,a(u)}),(function(e){return t("throw",e,a,o)}))}o(s.arg)}(r,i,t,a)}))}return t=t?t.then(a,a):a()}}function b(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method))return u;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var r=c(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,u;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function S(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:_}}function _(){return{value:void 0,done:!0}}return f.prototype=y.constructor=p,p.constructor=f,p[o]=f.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,o in e||(e[o]="GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},m(g.prototype),g.prototype[a]=function(){return this},e.AsyncIterator=g,e.async=function(t,n,r,i){var a=new g(s(t,n,r,i));return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},m(y),y[o]="Generator",y[i]=function(){return this},y.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=S,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(s&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,u):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:S(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}(e.exports);try{regeneratorRuntime=r}catch(e){Function("r","regeneratorRuntime = r")(r)}},function(e,t,n){var r=n(28),i=n(92),a=n(94);e.exports=function(e,t){return a(i(e,t,r),e+"")}},function(e,t,n){var r=n(93),i=Math.max;e.exports=function(e,t,n){return t=i(void 0===t?e.length-1:t,0),function(){for(var a=arguments,o=-1,s=i(a.length-t,0),c=Array(s);++o<s;)c[o]=a[t+o];o=-1;for(var u=Array(t+1);++o<t;)u[o]=a[o];return u[t]=n(c),r(e,this,u)}}},function(e,t){e.exports=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}},function(e,t,n){var r=n(95),i=n(104)(r);e.exports=i},function(e,t,n){var r=n(96),i=n(97),a=n(28),o=i?function(e,t){return i(e,"toString",{configurable:!0,enumerable:!1,value:r(t),writable:!0})}:a;e.exports=o},function(e,t){e.exports=function(e){return function(){return e}}},function(e,t,n){var r=n(16),i=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=i},function(e,t,n){var r=n(37),i=n(101),a=n(21),o=n(40),s=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,l=c.toString,f=u.hasOwnProperty,p=RegExp("^"+l.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!a(e)||i(e))&&(r(e)?p:s).test(o(e))}},function(e,t,n){var r=n(20),i=Object.prototype,a=i.hasOwnProperty,o=i.toString,s=r?r.toStringTag:void 0;e.exports=function(e){var t=a.call(e,s),n=e[s];try{e[s]=void 0;var r=!0}catch(e){}var i=o.call(e);return r&&(t?e[s]=n:delete e[s]),i}},function(e,t){var n=Object.prototype.toString;e.exports=function(e){return n.call(e)}},function(e,t,n){var r,i=n(102),a=(r=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";e.exports=function(e){return!!a&&a in e}},function(e,t,n){var r=n(13)["__core-js_shared__"];e.exports=r},function(e,t){e.exports=function(e,t){return null==e?void 0:e[t]}},function(e,t){var n=Date.now;e.exports=function(e){var t=0,r=0;return function(){var i=n(),a=16-(i-r);if(r=i,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}},function(e,t,n){var r=n(106);e.exports=function(e,t){return e&&e.length&&t&&t.length?r(e,t):e}},function(e,t,n){var r=n(41),i=n(107),a=n(110),o=n(43),s=n(111),c=Array.prototype.splice;e.exports=function(e,t,n,u){var l=u?a:i,f=-1,p=t.length,h=e;for(e===t&&(t=s(t)),n&&(h=r(e,o(n)));++f<p;)for(var d=0,v=t[f],y=n?n(v):v;(d=l(h,y,d,u))>-1;)h!==e&&c.call(h,d,1),c.call(e,d,1);return e}},function(e,t,n){var r=n(42),i=n(108),a=n(109);e.exports=function(e,t,n){return t==t?a(e,t,n):r(e,i,n)}},function(e,t){e.exports=function(e){return e!=e}},function(e,t){e.exports=function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}},function(e,t){e.exports=function(e,t,n,r){for(var i=n-1,a=e.length;++i<a;)if(r(e[i],t))return i;return-1}},function(e,t){e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}},function(e,t,n){var r=n(5);e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=r(e)););return e}},function(e,t,n){var r=n(44),i=n(53),a=n(31);e.exports=function(e){return function(t,n,o){var s=Object(t);if(!i(t)){var c=r(n,3);t=a(t),n=function(e){return c(s[e],e,s)}}var u=e(t,n,o);return u>-1?s[c?t[u]:u]:void 0}}},function(e,t,n){var r=n(115),i=n(170),a=n(55);e.exports=function(e){var t=i(e);return 1==t.length&&t[0][2]?a(t[0][0],t[0][1]):function(n){return n===e||r(n,e,t)}}},function(e,t,n){var r=n(45),i=n(47);e.exports=function(e,t,n,a){var o=n.length,s=o,c=!a;if(null==e)return!s;for(e=Object(e);o--;){var u=n[o];if(c&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++o<s;){var l=(u=n[o])[0],f=e[l],p=u[1];if(c&&u[2]){if(void 0===f&&!(l in e))return!1}else{var h=new r;if(a)var d=a(f,p,l,e,t,h);if(!(void 0===d?i(p,f,3,a,h):d))return!1}}return!0}},function(e,t){e.exports=function(){this.__data__=[],this.size=0}},function(e,t,n){var r=n(23),i=Array.prototype.splice;e.exports=function(e){var t=this.__data__,n=r(t,e);return!(n<0)&&(n==t.length-1?t.pop():i.call(t,n,1),--this.size,!0)}},function(e,t,n){var r=n(23);e.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][1]}},function(e,t,n){var r=n(23);e.exports=function(e){return r(this.__data__,e)>-1}},function(e,t,n){var r=n(23);e.exports=function(e,t){var n=this.__data__,i=r(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}},function(e,t,n){var r=n(22);e.exports=function(){this.__data__=new r,this.size=0}},function(e,t){e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},function(e,t){e.exports=function(e){return this.__data__.get(e)}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t,n){var r=n(22),i=n(29),a=n(30);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var o=n.__data__;if(!i||o.length<199)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new a(o)}return n.set(e,t),this.size=n.size,this}},function(e,t,n){var r=n(127),i=n(22),a=n(29);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(a||i),string:new r}}},function(e,t,n){var r=n(128),i=n(129),a=n(130),o=n(131),s=n(132);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,e.exports=c},function(e,t,n){var r=n(24);e.exports=function(){this.__data__=r?r(null):{},this.size=0}},function(e,t){e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},function(e,t,n){var r=n(24),i=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(r){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return i.call(t,e)?t[e]:void 0}},function(e,t,n){var r=n(24),i=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:i.call(t,e)}},function(e,t,n){var r=n(24);e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}},function(e,t,n){var r=n(25);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},function(e,t){e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},function(e,t,n){var r=n(25);e.exports=function(e){return r(this,e).get(e)}},function(e,t,n){var r=n(25);e.exports=function(e){return r(this,e).has(e)}},function(e,t,n){var r=n(25);e.exports=function(e,t){var n=r(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this}},function(e,t,n){var r=n(45),i=n(48),a=n(144),o=n(148),s=n(165),c=n(15),u=n(50),l=n(52),f="[object Object]",p=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,h,d,v){var y=c(e),m=c(t),g=y?"[object Array]":s(e),b=m?"[object Array]":s(t),w=(g="[object Arguments]"==g?f:g)==f,k=(b="[object Arguments]"==b?f:b)==f,x=g==b;if(x&&u(e)){if(!u(t))return!1;y=!0,w=!1}if(x&&!w)return v||(v=new r),y||l(e)?i(e,t,n,h,d,v):a(e,t,g,n,h,d,v);if(!(1&n)){var S=w&&p.call(e,"__wrapped__"),_=k&&p.call(t,"__wrapped__");if(S||_){var $=S?e.value():e,P=_?t.value():t;return v||(v=new r),d($,P,n,h,v)}}return!!x&&(v||(v=new r),o(e,t,n,h,d,v))}},function(e,t,n){var r=n(30),i=n(140),a=n(141);function o(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t<n;)this.add(e[t])}o.prototype.add=o.prototype.push=i,o.prototype.has=a,e.exports=o},function(e,t){e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}},function(e,t){e.exports=function(e,t){return e.has(t)}},function(e,t,n){var r=n(20),i=n(145),a=n(46),o=n(48),s=n(146),c=n(147),u=r?r.prototype:void 0,l=u?u.valueOf:void 0;e.exports=function(e,t,n,r,u,f,p){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!f(new i(e),new i(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return a(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var h=s;case"[object Set]":var d=1&r;if(h||(h=c),e.size!=t.size&&!d)return!1;var v=p.get(e);if(v)return v==t;r|=2,p.set(e,t);var y=o(h(e),h(t),r,u,f,p);return p.delete(e),y;case"[object Symbol]":if(l)return l.call(e)==l.call(t)}return!1}},function(e,t,n){var r=n(13).Uint8Array;e.exports=r},function(e,t){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},function(e,t){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}},function(e,t,n){var r=n(149),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,a,o,s){var c=1&n,u=r(e),l=u.length;if(l!=r(t).length&&!c)return!1;for(var f=l;f--;){var p=u[f];if(!(c?p in t:i.call(t,p)))return!1}var h=s.get(e);if(h&&s.get(t))return h==t;var d=!0;s.set(e,t),s.set(t,e);for(var v=c;++f<l;){var y=e[p=u[f]],m=t[p];if(a)var g=c?a(m,y,p,t,e,s):a(y,m,p,e,t,s);if(!(void 0===g?y===m||o(y,m,n,a,s):g)){d=!1;break}v||(v="constructor"==p)}if(d&&!v){var b=e.constructor,w=t.constructor;b!=w&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof w&&w instanceof w)&&(d=!1)}return s.delete(e),s.delete(t),d}},function(e,t,n){var r=n(150),i=n(152),a=n(31);e.exports=function(e){return r(e,a,i)}},function(e,t,n){var r=n(151),i=n(15);e.exports=function(e,t,n){var a=t(e);return i(e)?a:r(a,n(e))}},function(e,t){e.exports=function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}},function(e,t,n){var r=n(153),i=n(154),a=Object.prototype.propertyIsEnumerable,o=Object.getOwnPropertySymbols,s=o?function(e){return null==e?[]:(e=Object(e),r(o(e),(function(t){return a.call(e,t)})))}:i;e.exports=s},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}},function(e,t){e.exports=function(){return[]}},function(e,t,n){var r=n(156),i=n(49),a=n(15),o=n(50),s=n(51),c=n(52),u=Object.prototype.hasOwnProperty;e.exports=function(e,t){var n=a(e),l=!n&&i(e),f=!n&&!l&&o(e),p=!n&&!l&&!f&&c(e),h=n||l||f||p,d=h?r(e.length,String):[],v=d.length;for(var y in e)!t&&!u.call(e,y)||h&&("length"==y||f&&("offset"==y||"parent"==y)||p&&("buffer"==y||"byteLength"==y||"byteOffset"==y)||s(y,v))||d.push(y);return d}},function(e,t){e.exports=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}},function(e,t,n){var r=n(17),i=n(18);e.exports=function(e){return i(e)&&"[object Arguments]"==r(e)}},function(e,t){e.exports=function(){return!1}},function(e,t,n){var r=n(17),i=n(33),a=n(18),o={};o["[object Float32Array]"]=o["[object Float64Array]"]=o["[object Int8Array]"]=o["[object Int16Array]"]=o["[object Int32Array]"]=o["[object Uint8Array]"]=o["[object Uint8ClampedArray]"]=o["[object Uint16Array]"]=o["[object Uint32Array]"]=!0,o["[object Arguments]"]=o["[object Array]"]=o["[object ArrayBuffer]"]=o["[object Boolean]"]=o["[object DataView]"]=o["[object Date]"]=o["[object Error]"]=o["[object Function]"]=o["[object Map]"]=o["[object Number]"]=o["[object Object]"]=o["[object RegExp]"]=o["[object Set]"]=o["[object String]"]=o["[object WeakMap]"]=!1,e.exports=function(e){return a(e)&&i(e.length)&&!!o[r(e)]}},function(e,t,n){(function(e){var r=n(38),i=t&&!t.nodeType&&t,a=i&&"object"==typeof e&&e&&!e.nodeType&&e,o=a&&a.exports===i&&r.process,s=function(){try{var e=a&&a.require&&a.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=s}).call(this,n(32)(e))},function(e,t,n){var r=n(162),i=n(163),a=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return i(e);var t=[];for(var n in Object(e))a.call(e,n)&&"constructor"!=n&&t.push(n);return t}},function(e,t){var n=Object.prototype;e.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||n)}},function(e,t,n){var r=n(164)(Object.keys,Object);e.exports=r},function(e,t){e.exports=function(e,t){return function(n){return e(t(n))}}},function(e,t,n){var r=n(166),i=n(29),a=n(167),o=n(168),s=n(169),c=n(17),u=n(40),l=u(r),f=u(i),p=u(a),h=u(o),d=u(s),v=c;(r&&"[object DataView]"!=v(new r(new ArrayBuffer(1)))||i&&"[object Map]"!=v(new i)||a&&"[object Promise]"!=v(a.resolve())||o&&"[object Set]"!=v(new o)||s&&"[object WeakMap]"!=v(new s))&&(v=function(e){var t=c(e),n="[object Object]"==t?e.constructor:void 0,r=n?u(n):"";if(r)switch(r){case l:return"[object DataView]";case f:return"[object Map]";case p:return"[object Promise]";case h:return"[object Set]";case d:return"[object WeakMap]"}return t}),e.exports=v},function(e,t,n){var r=n(16)(n(13),"DataView");e.exports=r},function(e,t,n){var r=n(16)(n(13),"Promise");e.exports=r},function(e,t,n){var r=n(16)(n(13),"Set");e.exports=r},function(e,t,n){var r=n(16)(n(13),"WeakMap");e.exports=r},function(e,t,n){var r=n(54),i=n(31);e.exports=function(e){for(var t=i(e),n=t.length;n--;){var a=t[n],o=e[a];t[n]=[a,o,r(o)]}return t}},function(e,t,n){var r=n(47),i=n(172),a=n(178),o=n(34),s=n(54),c=n(55),u=n(27);e.exports=function(e,t){return o(e)&&s(t)?c(u(e),t):function(n){var o=i(n,e);return void 0===o&&o===t?a(n,e):r(t,o,3)}}},function(e,t,n){var r=n(56);e.exports=function(e,t,n){var i=null==e?void 0:r(e,t);return void 0===i?n:i}},function(e,t,n){var r=n(174),i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,a=/\\(\\)?/g,o=r((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(i,(function(e,n,r,i){t.push(r?i.replace(a,"$1"):n||e)})),t}));e.exports=o},function(e,t,n){var r=n(175);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},function(e,t,n){var r=n(30);function i(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(i.Cache||r),n}i.Cache=r,e.exports=i},function(e,t,n){var r=n(177);e.exports=function(e){return null==e?"":r(e)}},function(e,t,n){var r=n(20),i=n(41),a=n(15),o=n(26),s=r?r.prototype:void 0,c=s?s.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(a(t))return i(t,e)+"";if(o(t))return c?c.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},function(e,t,n){var r=n(179),i=n(180);e.exports=function(e,t){return null!=e&&i(e,t,r)}},function(e,t){e.exports=function(e,t){return null!=e&&t in Object(e)}},function(e,t,n){var r=n(57),i=n(49),a=n(15),o=n(51),s=n(33),c=n(27);e.exports=function(e,t,n){for(var u=-1,l=(t=r(t,e)).length,f=!1;++u<l;){var p=c(t[u]);if(!(f=null!=e&&n(e,p)))break;e=e[p]}return f||++u!=l?f:!!(l=null==e?0:e.length)&&s(l)&&o(p,l)&&(a(e)||i(e))}},function(e,t,n){var r=n(182),i=n(183),a=n(34),o=n(27);e.exports=function(e){return a(e)?r(o(e)):i(e)}},function(e,t){e.exports=function(e){return function(t){return null==t?void 0:t[e]}}},function(e,t,n){var r=n(56);e.exports=function(e){return function(t){return r(t,e)}}},function(e,t,n){var r=n(42),i=n(44),a=n(185),o=Math.max;e.exports=function(e,t,n){var s=null==e?0:e.length;if(!s)return-1;var c=null==n?0:a(n);return c<0&&(c=o(s+c,0)),r(e,i(t,3),c)}},function(e,t,n){var r=n(186);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},function(e,t,n){var r=n(187);e.exports=function(e){return e?(e=r(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},function(e,t,n){var r=n(21),i=n(26),a=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(a,"");var n=s.test(e);return n||c.test(e)?u(e.slice(2),n?2:8):o.test(e)?NaN:+e}},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="section editor sn-component" id="editor-column" aria-label="Note"><div class="sn-component"><div class="sk-app-bar no-edges" ng-if="self.state.note.locked" ng-init="self.lockText = \'Note Locked\'" ng-mouseleave="self.lockText = \'Note Locked\'" ng-mouseover="self.lockText = \'Unlock\'"><div class="left"><div class="sk-app-bar-item" ng-click="self.toggleLockNote()"><div class="sk-label warning"><i class="icon ion-locked"></i> {{self.lockText}}</div></div></div></div></div><div class="section-title-bar" id="editor-title-bar" ng-class="{\'locked\' : self.state.note.locked}" ng-show="self.state.note &amp;&amp; !self.state.note.errorDecrypting"><div class="title"><input class="input" id="note-title-editor" ng-blur="self.onNameBlur()" ng-change="self.onTitleChange()" ng-disabled="self.state.note.locked" ng-focus="self.onNameFocus()" ng-keyup="$event.keyCode == 13 &amp;&amp; self.onTitleEnter($event)" ng-model="self.state.note.title" select-on-click="true" spellcheck="false"></div><div id="save-status"><div class="message" ng-class="{\'warning sk-bold\': self.state.syncTakingTooLong, \'danger sk-bold\': self.state.saveError}">{{self.state.noteStatus.message}}</div><div class="desc" ng-show="self.state.noteStatus.desc">{{self.state.noteStatus.desc}}</div></div><div class="editor-tags"><div id="note-tags-component-container" ng-if="self.state.tagsComponent"><component-view class="component-view" component="self.state.tagsComponent" ng-class="{\'locked\' : self.state.note.locked}" ng-style="self.state.note.locked &amp;&amp; {\'pointer-events\' : \'none\'}"></component-view></div><input class="tags-input" ng-blur="self.saveTags()" ng-disabled="self.state.note.locked" ng-if="!(self.state.tagsComponent &amp;&amp; self.state.tagsComponent.active)" ng-keyup="$event.keyCode == 13 &amp;&amp; $event.target.blur();" ng-model="self.state.mutable.tagsString" placeholder="#tags" spellcheck="false" type="text"></div></div><div class="sn-component" ng-if="self.state.note"><div class="sk-app-bar no-edges" id="editor-menu-bar"><div class="left"><div class="sk-app-bar-item" click-outside="self.setMenuState(\'showOptionsMenu\', false)" is-open="self.state.showOptionsMenu" ng-class="{\'selected\' : self.state.showOptionsMenu}" ng-click="self.toggleMenu(\'showOptionsMenu\')"><div class="sk-label">Options</div><div class="sk-menu-panel dropdown-menu" ng-if="self.state.showOptionsMenu"><div class="sk-menu-panel-section"><div class="sk-menu-panel-header"><div class="sk-menu-panel-header-title">Note Options</div></div><menu-row action="self.selectedMenuItem(true); self.togglePin()" desc="\'Pin or unpin a note from the top of your list\'" label="self.state.note.pinned ? \'Unpin\' : \'Pin\'"></menu-row><menu-row action="self.selectedMenuItem(true); self.toggleArchiveNote()" desc="\'Archive or unarchive a note from your Archived system tag\'" label="self.state.note.archived ? \'Unarchive\' : \'Archive\'"></menu-row><menu-row action="self.selectedMenuItem(true); self.toggleLockNote()" desc="\'Locking notes prevents unintentional editing\'" label="self.state.note.locked ? \'Unlock\' : \'Lock\'"></menu-row><menu-row action="self.selectedMenuItem(true); self.toggleProtectNote()" desc="\'Protecting a note will require credentials to view \n it (Manage Privileges via Account menu)\'" label="self.state.note.content.protected ? \'Unprotect\' : \'Protect\'"></menu-row><menu-row action="self.selectedMenuItem(true); self.toggleNotePreview()" circle="self.state.note.content.hidePreview ? \'danger\' : \'success\'" circle-align="\'right\'" desc="\'Hide or unhide the note preview from the list of notes\'" label="\'Preview\'"></menu-row><menu-row action="self.selectedMenuItem(); self.deleteNote()" desc="\'Send this note to the trash\'" label="\'Move to Trash\'" ng-show="!self.state.altKeyDown &amp;&amp; !self.state.note.content.trashed &amp;&amp; !self.state.note.errorDecrypting" stylekit-class="\'warning\'"></menu-row><menu-row action="self.selectedMenuItem(); self.deleteNotePermanantely()" desc="\'Delete this note permanently from all your devices\'" label="\'Delete Permanently\'" ng-show="!self.state.note.content.trashed &amp;&amp; self.state.note.errorDecrypting" stylekit-class="\'danger\'"></menu-row></div><div ng-if="self.state.note.content.trashed || self.state.altKeyDown"><menu-row action="self.selectedMenuItem(true); self.restoreTrashedNote()" desc="\'Undelete this note and restore it back into your notes\'" label="\'Restore\'" ng-show="self.state.note.content.trashed" stylekit-class="\'info\'"></menu-row><menu-row action="self.selectedMenuItem(true); self.deleteNotePermanantely()" desc="\'Delete this note permanently from all your devices\'" label="\'Delete Permanently\'" stylekit-class="\'danger\'"></menu-row><menu-row action="self.selectedMenuItem(true); self.emptyTrash()" desc="\'Permanently delete all notes in the trash\'" label="\'Empty Trash\'" ng-show="self.state.note.content.trashed || !self.state.altKeyDown" stylekit-class="\'danger\'" subtitle="self.getTrashCount() + \' notes in trash\'"></menu-row></div><div class="sk-menu-panel-section"><div class="sk-menu-panel-header"><div class="sk-menu-panel-header-title">Global Display</div></div><menu-row action="self.selectedMenuItem(true); self.toggleKey(self.prefKeyMonospace)" circle="self.state.monospaceEnabled ? \'success\' : \'neutral\'" desc="\'Toggles the font style for the default editor\'" disabled="self.state.selectedEditor" label="\'Monospace Font\'" subtitle="self.state.selectedEditor ? \'Not available with editor extensions\' : null"></menu-row><menu-row action="self.selectedMenuItem(true); self.toggleKey(self.prefKeySpellcheck)" circle="self.state.spellcheck ? \'success\' : \'neutral\'" desc="\'Toggles spellcheck for the default editor\'" disabled="self.state.selectedEditor" label="\'Spellcheck\'" subtitle="\n self.state.selectedEditor \n ? \'Not available with editor extensions\' \n : (self.state.isDesktop ? \'May degrade editor performance\' : null)\n "></menu-row><menu-row action="self.selectedMenuItem(true); self.toggleKey(self.prefKeyMarginResizers)" circle="self.state.marginResizersEnabled ? \'success\' : \'neutral\'" desc="\'Allows for editor left and right margins to be resized\'" faded="!self.state.marginResizersEnabled" label="\'Margin Resizers\'"></menu-row></div></div></div><div class="sk-app-bar-item" click-outside="self.setMenuState(\'showEditorMenu\', false)" is-open="self.state.showEditorMenu" ng-class="{\'selected\' : self.state.showEditorMenu}" ng-click="self.toggleMenu(\'showEditorMenu\')"><div class="sk-label">Editor</div><editor-menu callback="self.editorMenuOnSelect" current-item="self.state.note" ng-if="self.state.showEditorMenu" selected-editor="self.state.selectedEditor"></editor-menu></div><div class="sk-app-bar-item" click-outside="self.setMenuState(\'showExtensions\', false)" is-open="self.state.showExtensions" ng-class="{\'selected\' : self.state.showExtensions}" ng-click="self.toggleMenu(\'showExtensions\')"><div class="sk-label">Actions</div><actions-menu item="self.state.note" ng-if="self.state.showExtensions"></actions-menu></div><div class="sk-app-bar-item" click-outside="self.setMenuState(\'showSessionHistory\', false)" is-open="self.state.showSessionHistory" ng-click="self.toggleMenu(\'showSessionHistory\')"><div class="sk-label">Session History</div><session-history-menu item="self.state.note" ng-if="self.state.showSessionHistory"></session-history-menu></div></div></div></div><div class="editor-content" id="editor-content" ng-if="self.state.noteReady &amp;&amp; !self.state.note.errorDecrypting"><panel-resizer class="left" control="self.leftPanelPuppet" hoverable="true" min-width="300" ng-if="self.state.marginResizersEnabled" on-resize-finish="self.onPanelResizeFinish" panel-id="\'editor-content\'" property="\'left\'"></panel-resizer><component-view class="component-view" component="self.state.selectedEditor" ng-if="self.state.selectedEditor" on-load="self.onEditorLoad"></component-view><textarea class="editable" id="note-text-editor" dir="auto" ng-attr-spellcheck="{{self.state.spellcheck}}" ng-change="self.contentChanged()" ng-click="self.clickedTextArea()" ng-focus="self.onContentFocus()" ng-if="!self.state.selectedEditor" ng-model="self.state.note.text" ng-model-options="{ debounce: self.state.editorDebounce}" ng-readonly="self.state.note.locked" ng-trim="false">{{self.onSystemEditorLoad()}}</textarea><panel-resizer control="self.rightPanelPuppet" hoverable="true" min-width="300" ng-if="self.state.marginResizersEnabled" on-resize-finish="self.onPanelResizeFinish" panel-id="\'editor-content\'" property="\'right\'"></panel-resizer></div><div class="section" ng-show="self.state.note.errorDecrypting"><p class="medium-padding" style="padding-top: 0 !important;">There was an error decrypting this item. Ensure you are running the \nlatest version of this app, then sign out and sign back in to try again.</p></div><div id="editor-pane-component-stack" ng-show="self.state.note"><div class="sk-app-bar no-edges" id="component-stack-menu-bar" ng-if="self.state.componentStack.length"><div class="left"><div class="sk-app-bar-item" ng-click="self.toggleStackComponentForCurrentItem(component)" ng-repeat="component in self.state.componentStack"><div class="sk-app-bar-item-column"><div class="sk-circle small" ng-class="{\'info\' : !component.hidden &amp;&amp; component.active, \'neutral\' : component.hidden || !component.active}"></div></div><div class="sk-app-bar-item-column"><div class="sk-label">{{component.name}}</div></div></div></div></div><div class="sn-component"><component-view class="component-view component-stack-item" component="component" manual-dealloc="true" ng-if="component.active" ng-repeat="component in self.state.componentStack" ng-show="!component.hidden"></component-view></div></div></div>'}},function(e,t){},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="sn-component"><div class="sk-app-bar no-edges no-bottom-edge" id="footer-bar"><div class="left"><div class="sk-app-bar-item" click-outside="ctrl.clickOutsideAccountMenu()" is-open="ctrl.showAccountMenu" ng-click="ctrl.accountMenuPressed()"><div class="sk-app-bar-item-column"><div class="sk-circle small" ng-class="ctrl.error ? \'danger\' : (ctrl.user ? \'info\' : \'neutral\')"></div></div><div class="sk-app-bar-item-column"><div class="sk-label title" ng-class="{red: ctrl.error}">Account</div></div><account-menu close-function="ctrl.closeAccountMenu" ng-click="$event.stopPropagation()" ng-if="ctrl.showAccountMenu"></account-menu></div><div class="sk-app-bar-item"><a class="no-decoration sk-label title" href="https://standardnotes.org/help" rel="noopener" target="_blank">Help</a></div><div class="sk-app-bar-item border"></div><div class="sk-app-bar-item" ng-repeat="room in ctrl.rooms track by room.uuid"><div class="sk-app-bar-item-column" ng-click="ctrl.selectRoom(room)"><div class="sk-label">{{room.name}}</div></div><component-modal component="room" ng-if="room.showRoom" on-dismiss="ctrl.onRoomDismiss"></component-modal></div></div><div class="center"><div class="sk-app-bar-item" ng-show="ctrl.arbitraryStatusMessage"><div class="sk-app-bar-item-column"><span class="neutral sk-label">{{ctrl.arbitraryStatusMessage}}</span></div></div></div><div class="right"><div class="sk-app-bar-item" ng-click="ctrl.openSecurityUpdate()" ng-show="ctrl.securityUpdateAvailable"><span class="success sk-label">Account update available.</span></div><div class="sk-app-bar-item" ng-click="ctrl.clickedNewUpdateAnnouncement()" ng-show="ctrl.newUpdateAvailable == true"><span class="info sk-label">New update available.</span></div><div class="sk-app-bar-item no-pointer" ng-if="ctrl.lastSyncDate &amp;&amp; !ctrl.isRefreshing"><div class="sk-label subtle">Last refreshed {{ctrl.lastSyncDate}}</div></div><div class="sk-app-bar-item" ng-click="ctrl.toggleSyncResolutionMenu()" ng-if="(ctrl.state.outOfSync &amp;&amp; !ctrl.isRefreshing) || ctrl.showSyncResolution"><div class="sk-label warning" ng-if="ctrl.state.outOfSync">Potentially Out of Sync</div><sync-resolution-menu close-function="ctrl.toggleSyncResolutionMenu" ng-click="$event.stopPropagation();" ng-if="ctrl.showSyncResolution"></sync-resolution-menu></div><div class="sk-app-bar-item" ng-if="ctrl.lastSyncDate &amp;&amp; ctrl.isRefreshing"><div class="sk-spinner small"></div></div><div class="sk-app-bar-item" ng-if="ctrl.offline"><div class="sk-label">Offline</div></div><div class="sk-app-bar-item" ng-click="ctrl.refreshData()" ng-if="!ctrl.offline"><div class="sk-label">Refresh</div></div><div class="sk-app-bar-item border" ng-if="ctrl.dockShortcuts.length &gt; 0"></div><div class="sk-app-bar-item dock-shortcut" ng-repeat="shortcut in ctrl.dockShortcuts"><div class="sk-app-bar-item-column" ng-class="{\'underline\': shortcut.component.active}" ng-click="ctrl.selectShortcut(shortcut)"><div class="div" ng-if="shortcut.icon.type == \'circle\'" title="{{shortcut.name}}"><div class="sk-circle small" ng-style="{\'background-color\': shortcut.icon.background_color, \'border-color\': shortcut.icon.border_color}"></div></div><div class="div" ng-if="shortcut.icon.type == \'svg\'" title="{{shortcut.name}}"><div class="svg-item" elem-ready="ctrl.initSvgForShortcut(shortcut)" ng-attr-id="dock-svg-{{shortcut.component.uuid}}"></div></div></div></div><div class="sk-app-bar-item border" ng-if="ctrl.state.hasPasscode"></div><div class="sk-app-bar-item" id="lock-item" ng-click="ctrl.lockApp()" ng-if="ctrl.state.hasPasscode" title="Locks application and wipes unencrypted data from memory."><div class="sk-label"><i class="icon ion-locked" id="footer-lock-icon"></i></div></div></div></div></div>'}},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="sn-component section notes" id="notes-column" aria-label="Notes"><div class="content"><div class="section-title-bar" id="notes-title-bar"><div class="padded"><div class="section-title-bar-header"><div class="title">{{self.state.panelTitle}}</div><div class="sk-button contrast wide" ng-click="self.createNewNote()" title="Create a new note in the selected tag"><div class="sk-label"><i class="icon ion-plus add-button"></i></div></div></div><div class="filter-section" role="search"><input class="filter-bar" id="search-bar" ng-blur="self.onFilterEnter()" ng-change="self.filterTextChanged()" ng-keyup="$event.keyCode == 13 &amp;&amp; self.onFilterEnter();" ng-model="self.state.noteFilter.text" placeholder="Search" select-on-click="true" title="Searches notes in the currently selected tag"><div id="search-clear-button" ng-click="self.clearFilterText();" ng-show="self.state.noteFilter.text">✕</div></div></div><div class="sn-component" id="notes-menu-bar"><div class="sk-app-bar no-edges"><div class="left"><div class="sk-app-bar-item" ng-class="{\'selected\' : self.state.mutable.showMenu}" ng-click="self.state.mutable.showMenu = !self.state.mutable.showMenu"><div class="sk-app-bar-item-column"><div class="sk-label">Options</div></div><div class="sk-app-bar-item-column"><div class="sk-sublabel">{{self.optionsSubtitle()}}</div></div></div><div class="sk-menu-panel dropdown-menu" id="notes-options-menu" ng-show="self.state.mutable.showMenu"><div class="sk-menu-panel-header"><div class="sk-menu-panel-header-title">Sort By</div><a class="info sk-h5" ng-click="self.toggleReverseSort()">{{self.state.sortReverse === true ? \'Disable Reverse Sort\' : \'Enable Reverse Sort\'}}</a></div><menu-row action="self.selectedMenuItem(); self.selectedSortByCreated()" circle="self.state.sortBy == \'created_at\' &amp;&amp; \'success\'" desc="\'Sort notes by newest first\'" label="\'Date Added\'"></menu-row><menu-row action="self.selectedMenuItem(); self.selectedSortByUpdated()" circle="self.state.sortBy == \'client_updated_at\' &amp;&amp; \'success\'" desc="\'Sort notes with the most recently updated first\'" label="\'Date Modified\'"></menu-row><menu-row action="self.selectedMenuItem(); self.selectedSortByTitle()" circle="self.state.sortBy == \'title\' &amp;&amp; \'success\'" desc="\'Sort notes alphabetically by their title\'" label="\'Title\'"></menu-row><div class="sk-menu-panel-section"><div class="sk-menu-panel-header"><div class="sk-menu-panel-header-title">Display</div></div><menu-row action="self.selectedMenuItem(); self.togglePrefKey(\'showArchived\')" circle="self.state.showArchived ? \'success\' : \'danger\'" desc="\'Archived notes are usually hidden.\n You can explicitly show them with this option.\'" faded="!self.state.showArchived" label="\'Archived Notes\'"></menu-row><menu-row action="self.selectedMenuItem(); self.togglePrefKey(\'hidePinned\')" circle="self.state.hidePinned ? \'danger\' : \'success\'" desc="\'Pinned notes always appear on top. You can hide them temporarily\n with this option so you can focus on other notes in the list.\'" faded="self.state.hidePinned" label="\'Pinned Notes\'"></menu-row><menu-row action="self.selectedMenuItem(); self.togglePrefKey(\'hideNotePreview\')" circle="self.state.hideNotePreview ? \'danger\' : \'success\'" desc="\'Hide the note preview for a more condensed list of notes\'" faded="self.state.hideNotePreview" label="\'Note Preview\'"></menu-row><menu-row action="self.selectedMenuItem(); self.togglePrefKey(\'hideDate\')" circle="self.state.hideDate ? \'danger\' : \'success\'" desc="\'Hide the date displayed in each row\'" faded="self.state.hideDate" label="\'Date\'"></menu-row><menu-row action="self.selectedMenuItem(); self.togglePrefKey(\'hideTags\')" circle="self.state.hideTags ? \'danger\' : \'success\'" desc="\'Hide the list of tags associated with each note\'" faded="self.state.hideTags" label="\'Tags\'"></menu-row></div></div></div></div></div></div><div class="scrollable"><div class="infinite-scroll" id="notes-scrollable" can-load="true" infinite-scroll="self.paginate()" threshold="200"><div class="note" ng-repeat="note in self.state.renderedNotes track by note.uuid" ng-class="{\'selected\' : self.state.selectedNote == note}" ng-click="self.selectNote(note, true)"><div class="note-flags" ng-show="note.flags.length &gt; 0"><div class="flag" ng-class="flag.class" ng-repeat="flag in note.flags"><div class="label">{{flag.text}}</div></div></div><div class="name" ng-show="note.title">{{note.title}}</div><div class="note-preview" ng-if="\n !self.state.hideNotePreview &amp;&amp;\n !note.content.hidePreview &amp;&amp;\n !note.content.protected"><div class="html-preview" ng-bind-html="note.content.preview_html" ng-show="note.content.preview_html"></div><div class="plain-preview" ng-show="!note.content.preview_html &amp;&amp; note.content.preview_plain">{{note.content.preview_plain}}</div><div class="default-preview" ng-show="!note.content.preview_html &amp;&amp; !note.content.preview_plain">{{note.text}}</div></div><div class="date faded" ng-show="!self.state.hideDate"><span ng-show="self.state.sortBy == \'client_updated_at\'">Modified {{note.cachedUpdatedAtString || \'Now\'}}</span><span ng-show="self.state.sortBy != \'client_updated_at\'">{{note.cachedCreatedAtString || \'Now\'}}</span></div><div class="tags-string" ng-show="note.shouldShowTags"><div class="faded">{{note.savedTagsString || note.tagsString()}}</div></div></div></div></div></div><panel-resizer collapsable="true" control="self.panelPuppet" default-width="300" hoverable="true" on-resize-finish="self.onPanelResize" panel-id="\'notes-column\'"></panel-resizer></div>'}},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="sn-component section tags" id="tags-column" aria-label="Tags"><div class="component-view-container" ng-if="self.component.active"><component-view class="component-view" component="self.component"></component-view></div><div class="content" id="tags-content" ng-if="!(self.component &amp;&amp; self.component.active)"><div class="tags-title-section section-title-bar"><div class="section-title-bar-header"><div class="sk-h3 title"><span class="sk-bold">Views</span></div><div class="sk-button sk-secondary-contrast wide" ng-click="self.clickedAddNewTag()" title="Create a new tag"><div class="sk-label"><i class="icon ion-plus add-button"></i></div></div></div></div><div class="scrollable"><div class="infinite-scroll"><div class="tag" ng-class="{\'selected\' : self.state.selectedTag == tag, \'faded\' : !tag.content.isAllTag}" ng-click="self.selectTag(tag)" ng-repeat="tag in self.state.smartTags"><div class="tag-info"><input class="title" ng-disabled="true" ng-model="tag.title"><div class="count" ng-show="tag.content.isAllTag">{{self.state.noteCounts[tag.uuid]}}</div></div></div><div class="tags-title-section section-title-bar"><div class="section-title-bar-header"><div class="sk-h3 title"><span class="sk-bold">Tags</span></div></div></div><div class="tag" ng-class="{\'selected\' : self.state.selectedTag == tag}" ng-click="self.selectTag(tag)" ng-repeat="tag in self.state.tags track by tag.uuid"><div class="tag-info"><div class="tag-icon">#</div><input class="title" ng-attr-id="tag-{{tag.uuid}}" ng-blur="self.saveTag($event, tag)" ng-change="self.tagTitleDidChange(tag)" ng-class="{\'editing\' : self.state.editingTag == tag}" ng-click="self.selectTag(tag)" ng-keyup="$event.keyCode == 13 &amp;&amp; $event.target.blur()" ng-model="tag.title" should-focus="self.state.newTag || self.state.editingTag == tag" sn-autofocus="true" spellcheck="false"><div class="count">{{self.state.noteCounts[tag.uuid]}}</div></div><div class="danger small-text bold" ng-show="tag.content.conflict_of">Conflicted Copy</div><div class="danger small-text bold" ng-show="tag.errorDecrypting">Missing Keys</div><div class="menu" ng-show="self.state.selectedTag == tag"><a class="item" ng-click="self.selectedRenameTag($event, tag)" ng-show="!self.state.editingTag">Rename</a><a class="item" ng-click="self.saveTag($event, tag)" ng-show="self.state.editingTag">Save</a><a class="item" ng-click="self.selectedDeleteTag(tag)">Delete</a></div></div><div class="no-tags-placeholder" ng-show="self.state.tags.length == 0">No tags. Create one using the add button above.</div></div></div></div><panel-resizer collapsable="true" control="self.panelPuppet" default-width="150" hoverable="true" on-resize-finish="self.onPanelResize" panel-id="\'tags-column\'"></panel-resizer></div>'}},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="main-ui-view" ng-class="self.platformString" ng-if="self.state.ready"><lock-screen ng-if="self.state.needsUnlock" on-value="self.state.onLockscreenValue" puppet="self.lockScreenPuppet"></lock-screen><div class="app" id="app" ng-class="self.state.appClass" ng-if="!self.state.needsUnlock"><tags-panel></tags-panel><notes-panel></notes-panel><editor-panel></editor-panel></div><footer ng-if="!self.state.needsUnlock"></footer></div>'}},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="sn-component" id="lock-screen"><div class="sk-panel"><div class="sk-panel-header"><div class="sk-panel-header-title">Passcode Required</div></div><div class="sk-panel-content"><div class="sk-panel-section"><form class="sk-panel-form sk-panel-row" ng-submit="ctrl.submitPasscodeForm($event)"><div class="sk-panel-column stretch"><input class="center-text sk-input contrast" id="passcode-input" autocomplete="new-password" autofocus="true" ng-model="ctrl.formData.passcode" placeholder="Enter Passcode" should-focus="true" sn-autofocus="true" type="password"><div class="sk-button-group stretch sk-panel-row form-submit"><button class="sk-button info" type="submit"><div class="sk-label">Unlock</div></button></div></div></form></div></div><div class="sk-panel-footer"><div id="passcode-reset"><a class="sk-a neutral" ng-click="ctrl.forgotPasscode()" ng-if="!ctrl.formData.showRecovery">Forgot?</a><div ng-if="ctrl.formData.showRecovery"><div class="sk-p">If you forgot your local passcode, your only option is to clear \nyour local data from this device and sign back in to your account.</div><div class="sk-panel-row"></div><a class="sk-a danger center-text" ng-click="ctrl.beginDeleteData()">Delete Local Data</a></div></div></div></div></div>'}},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="sn-component"><div class="sk-panel" id="account-panel"><div class="sk-panel-header"><div class="sk-panel-header-title">Account</div><a class="sk-a info close-button" ng-click="self.close()">Close</a></div><div class="sk-panel-content"><div class="sk-panel-section sk-panel-hero" ng-if="\n !self.state.user &amp;&amp; \n !self.state.formData.showLogin &amp;&amp; \n !self.state.formData.showRegister &amp;&amp; \n !self.state.formData.mfa"><div class="sk-panel-row"><div class="sk-h1">Sign in or register to enable sync and end-to-end encryption.</div></div><div class="sk-panel-row"><div class="sk-button-group stretch"><div class="sk-button info featured" ng-click="self.state.formData.showLogin = true"><div class="sk-label">Sign In</div></div><div class="sk-button info featured" ng-click="self.state.formData.showRegister = true"><div class="sk-label">Register</div></div></div></div><div class="sk-panel-row sk-p">Standard Notes is free on every platform, and comes \nstandard with sync and encryption.</div></div><div class="sk-panel-section" ng-if="\n self.state.formData.showLogin || \n self.state.formData.showRegister"><div class="sk-panel-section-title">{{self.state.formData.showLogin ? "Sign In" : "Register"}}</div><form class="sk-panel-form" ng-submit="self.submitAuthForm()"><div class="sk-panel-section"><input class="sk-input contrast" name="email" ng-model="self.state.formData.email" ng-model-options="{allowInvalid: true}" placeholder="Email" required="" should-focus="true" sn-autofocus="true" spellcheck="false" type="email"><input class="sk-input contrast" name="password" ng-model="self.state.formData.user_password" placeholder="Password" required="" sn-enter="self.submitAuthForm()" type="password"><input class="sk-input contrast" name="password_conf" ng-if="self.state.formData.showRegister" ng-model="self.state.formData.password_conf" placeholder="Confirm Password" required="" sn-enter="self.submitAuthForm()" type="password"><div class="sk-panel-row"></div><a class="sk-panel-row sk-bold" ng-click="\n self.state.formData.showAdvanced = !self.state.formData.showAdvanced\n ">Advanced Options</a></div><div class="sk-notification unpadded contrast advanced-options sk-panel-row" ng-if="self.state.formData.showAdvanced"><div class="sk-panel-column stretch"><div class="sk-notification-title sk-panel-row padded-row">Advanced Options</div><div class="bordered-row padded-row"><label class="sk-label">Sync Server Domain</label><input class="sk-input mt-5 sk-base" name="server" ng-model="self.state.formData.url" placeholder="Server URL" required="" type="text"></div><label class="sk-label padded-row sk-panel-row justify-left" ng-if="self.state.formData.showLogin"><div class="sk-horizontal-group tight"><input class="sk-input" ng-model="self.state.formData.strictSignin" type="checkbox"><p class="sk-p">Use strict sign in</p><span><a class="info" href="https://standardnotes.org/help/security" rel="noopener" target="_blank">(Learn more)</a></span></div></label></div></div><div class="sk-panel-section form-submit" ng-if="!self.state.formData.authenticating"><div class="sk-button-group stretch"><div class="sk-button info featured" ng-click="self.submitAuthForm()" ng-disabled="self.state.formData.authenticating"><div class="sk-label">{{self.state.formData.showLogin ? "Sign In" : "Register"}}</div></div></div></div><div class="sk-notification neutral" ng-if="self.state.formData.showRegister"><div class="sk-notification-title">No Password Reset.</div><div class="sk-notification-text">Because your notes are encrypted using your password, \nStandard Notes does not have a password reset option. \nYou cannot forget your password.</div></div><div class="sk-panel-section no-bottom-pad" ng-if="self.state.formData.status"><div class="sk-horizontal-group"><div class="sk-spinner small neutral"></div><div class="sk-label">{{self.state.formData.status}}</div></div></div><div class="sk-panel-section no-bottom-pad" ng-if="!self.state.formData.authenticating"><label class="sk-panel-row justify-left"><div class="sk-horizontal-group tight"><input ng-false-value="true" ng-model="self.state.formData.ephemeral" ng-true-value="false" type="checkbox"><p class="sk-p">Stay signed in</p></div></label><label class="sk-panel-row justify-left" ng-if="self.notesAndTagsCount() &gt; 0"><div class="sk-panel-row"></div><input ng-bind="true" ng-change="self.mergeLocalChanged()" ng-model="self.state.formData.mergeLocal" type="checkbox">Merge local data ({{self.notesAndTagsCount()}} notes and tags)</label></div></form></div><div class="sk-panel-section" ng-if="self.state.formData.mfa"><form class="sk-panel-form" ng-submit="self.submitMfaForm()"><div class="sk-p sk-panel-row">{{self.state.formData.mfa.message}}</div><div class="sk-panel-row"><input class="sk-input contrast" autofocus="true" name="mfa" ng-model="self.state.formData.userMfaCode" placeholder="Enter Code" required="" should-focus="true" sn-autofocus="true"></div><div class="sk-button-group stretch sk-panel-row form-submit" ng-if="!self.state.formData.status"><button class="sk-button info featured" type="submit"><div class="sk-label">Sign In</div></button></div></form><div class="sk-panel-section no-bottom-pad" ng-if="self.state.formData.status"><div class="sk-panel-row"></div><div class="sk-panel-row"></div><div class="sk-horizontal-group"><div class="sk-spinner small neutral"></div><div class="sk-label">{{self.state.formData.status}}</div></div></div></div><div ng-if="\n !self.state.formData.showLogin &amp;&amp; \n !self.state.formData.showRegister &amp;&amp; \n !self.state.formData.mfa"><div class="sk-panel-section" ng-if="self.state.user"><div class="sk-notification danger" ng-if="self.syncStatus.error"><div class="sk-notification-title">Sync Unreachable</div><div class="sk-notification-text">Hmm...we can\'t seem to sync your account. \nThe reason: {{self.syncStatus.error.message}}</div><a class="sk-a info-contrast sk-bold sk-panel-row" href="https://standardnotes.org/help" rel="noopener" target="_blank">Need help?</a></div><div class="sk-panel-row"><div class="sk-panel-column"><div class="sk-h1 sk-bold wrap">{{self.state.user.email}}</div><div class="sk-subtitle subtle normal">{{self.state.server}}</div></div><div class="sk-horizontal-group" delay="1000" delay-hide="true" show="self.syncStatus.syncOpInProgress || self.syncStatus.needsMoreSync"><div class="sk-spinner small info"></div><div class="sk-sublabel">{{"Syncing" + (self.syncStatus.total > 0 ? ":" : "")}}<span ng-if="self.syncStatus.total &gt; 0">{{self.syncStatus.current}}/{{self.syncStatus.total}}</span></div></div></div><div class="sk-panel-row"></div><a class="sk-a info sk-panel-row condensed" ng-click="self.openPasswordWizard(\'change-pw\')">Change Password</a><a class="sk-a info sk-panel-row condensed" ng-click="self.openPrivilegesModal(\'\')" ng-show="self.state.user">Manage Privileges</a><a class="sk-panel-row justify-left condensed success" ng-click="self.openPasswordWizard(\'upgrade-security\')" ng-if="self.state.securityUpdateAvailable"><div class="inline sk-circle small success mr-8"></div><div class="inline">Account Update Available</div></a></div><div class="sk-panel-section"><div class="sk-panel-section-title">Encryption</div><div class="sk-panel-section-subtitle info" ng-if="self.state.encryptionEnabled">{{self.encryptionStatusForNotes()}}</div><p class="sk-p">{{self.state.encryptionStatusString}}</p></div><div class="sk-panel-section"><div class="sk-panel-section-title">Passcode Lock</div><div ng-if="!self.state.hasPasscode"><div ng-if="self.state.canAddPasscode"><div class="sk-panel-row" ng-if="!self.state.formData.showPasscodeForm"><div class="sk-button info" ng-click="self.addPasscodeClicked(); $event.stopPropagation();"><div class="sk-label">Add Passcode</div></div></div><p class="sk-p"> Add a passcode to lock the application and \nencrypt on-device key storage.</p></div><div ng-if="!self.state.canAddPasscode"><p class="sk-p">Adding a passcode is not supported in temporary sessions. Please sign \nout, then sign back in with the "Stay signed in" option checked.</p></div></div><form class="sk-panel-form" ng-if="self.state.formData.showPasscodeForm" ng-submit="self.submitPasscodeForm()"><div class="sk-panel-row"></div><input class="sk-input contrast" ng-model="self.state.formData.passcode" placeholder="Passcode" should-focus="true" sn-autofocus="true" type="password"><input class="sk-input contrast" ng-model="self.state.formData.confirmPasscode" placeholder="Confirm Passcode" type="password"><div class="sk-button-group stretch sk-panel-row form-submit"><button class="sk-button info" type="submit"><div class="sk-label">Set Passcode</div></button></div><a class="neutral sk-a sk-panel-row" ng-click="self.state.formData.showPasscodeForm = false">Cancel</a></form><div ng-if="self.state.hasPasscode &amp;&amp; !self.state.formData.showPasscodeForm"><div class="sk-p">Passcode lock is enabled.</div><div class="sk-notification contrast"><div class="sk-notification-title">Options</div><div class="sk-notification-text"><div class="sk-panel-row"><div class="sk-horizontal-group"><div class="sk-h4 sk-bold">Autolock</div><a class="sk-a info" ng-class="{\n \'boxed\' : option.value == self.state.selectedAutoLockInterval\n }" ng-click="self.selectAutoLockInterval(option.value)" ng-repeat="option in self.state.passcodeAutoLockOptions">{{option.label}}</a></div></div><div class="sk-p">The autolock timer begins when the window or tab loses focus.</div><div class="sk-panel-row"></div><a class="sk-a info sk-panel-row condensed" ng-click="self.openPrivilegesModal(\'\')" ng-show="!self.state.user">Manage Privileges</a><a class="sk-a info sk-panel-row condensed" ng-click="self.changePasscodePressed()">Change Passcode</a><a class="sk-a danger sk-panel-row condensed" ng-click="self.removePasscodePressed()">Remove Passcode</a></div></div></div></div><div class="sk-panel-section" ng-if="!self.state.importData.loading"><div class="sk-panel-section-title">Data Backups</div><div class="sk-p">Download a backup of all your data.</div><div class="sk-panel-row"></div><form class="sk-panel-form sk-panel-row" ng-if="self.state.encryptionEnabled"><div class="sk-input-group"><label class="sk-horizontal-group tight"><input ng-change="self.state.mutable.backupEncrypted = true" ng-model="self.state.mutable.backupEncrypted" ng-value="true" type="radio"><p class="sk-p">Encrypted</p></label><label class="sk-horizontal-group tight"><input ng-change="self.state.mutable.backupEncrypted = false" ng-model="self.state.mutable.backupEncrypted" ng-value="false" type="radio"><p class="sk-p">Decrypted</p></label></div></form><div class="sk-panel-row"></div><div class="sk-button-group sk-panel-row justify-left"><div class="sk-button info" ng-click="self.downloadDataArchive()"><div class="sk-label">Download Backup</div></div><label class="sk-button info"><input file-change="-&gt;" handler="self.importFileSelected(files)" style="display: none;" type="file"><div class="sk-label">Import Backup</div></label></div><span ng-if="self.isDesktopApplication()">Backups are automatically created on desktop and can be managed \nvia the "Backups" top-level menu.</span><div id="import-password-request" ng-if="self.state.importData.requestPassword"><form class="sk-panel-form stretch" ng-submit="self.submitImportPassword()"><p>Enter the account password associated with the import file.</p><input class="sk-input contrast mt-5" autofocus="true" ng-model="self.state.importData.password" placeholder="Enter File Account Password" type="password"><div class="sk-button-group stretch sk-panel-row form-submit"><button class="sk-button info" type="submit"><div class="sk-label">Decrypt & Import</div></button></div><p>Importing from backup will not overwrite existing data, \nbut instead create a duplicate of any differing data.</p><p>If you\'d like to import only a selection of items instead of \nthe whole file, please use the Batch Manager extension.</p></form></div><div class="sk-panel-row"><div class="sk-spinner small info" ng-if="self.state.importData.loading"></div></div></div></div></div><div class="sk-panel-footer"><div class="sk-panel-row"><div class="sk-p left neutral faded">{{self.state.appVersion}}</div><a class="sk-a right" ng-click="self.hidePasswordForm()" ng-if="self.state.formData.showLogin || self.state.formData.showRegister">Cancel</a><a class="sk-a right danger" ng-click="self.destroyLocalData()" ng-if="\n !self.state.formData.showLogin &amp;&amp; \n !self.state.formData.showRegister">{{ self.state.user ? "Sign out and clear local data" : "Clear all local data" }}</a></div></div></div></div>'}},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="sn-component"><div class="sk-menu-panel dropdown-menu"><a class="no-decoration" href="https://standardnotes.org/extensions" ng-if="self.state.extensions.length == 0" rel="noopener" target="blank"><menu-row label="\'Download Actions\'"></menu-row></a><div ng-repeat="extension in self.state.extensions"><div class="sk-menu-panel-header" ng-click="extension.hide = !extension.hide; $event.stopPropagation();"><div class="sk-menu-panel-column"><div class="sk-menu-panel-header-title">{{extension.name}}</div><div class="sk-spinner small loading" ng-if="extension.loading"></div><div ng-if="extension.hide">…</div></div></div><menu-row action="self.executeAction(action, extension);" label="action.label" ng-if="!extension.hide" ng-repeat="action in extension.actionsWithContextForItem(self.props.item)" spinner-class="action.running ? \'info\' : null" sub-rows="action.subrows" subtitle="action.desc"><div class="sk-sublabel" ng-if="action.access_type">Uses <strong>{{action.access_type}}</strong> access to this note.</div></menu-row><menu-row faded="true" label="\'No Actions Available\'" ng-if="extension.actionsWithContextForItem(self.props.item).length == 0"></menu-row></div></div></div>'}},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="sk-modal-background" ng-click="ctrl.dismiss()"></div><div class="sk-modal-content" ng-attr-id="component-content-outer-{{ctrl.component.uuid}}"><div class="sn-component"><div class="sk-panel" ng-attr-id="component-content-inner-{{ctrl.component.uuid}}"><div class="sk-panel-header"><div class="sk-panel-header-title">{{ctrl.component.name}}</div><a class="sk-a info close-button" ng-click="ctrl.dismiss()">Close</a></div><component-view class="component-view" component="ctrl.component"></component-view></div></div></div>'}},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="sn-component" ng-if="ctrl.issueLoading"><div class="sk-app-bar no-edges no-top-edge dynamic-height"><div class="left"><div class="sk-app-bar-item"><div class="sk-label warning">There was an issue loading {{ctrl.component.name}}.</div></div></div><div class="right"><div class="sk-app-bar-item" ng-click="ctrl.reloadComponent()"><div class="sk-button info"><div class="sk-label">Reload</div></div></div></div></div></div><div class="sn-component" ng-if="ctrl.expired"><div class="sk-app-bar no-edges no-top-edge dynamic-height"><div class="left"><div class="sk-app-bar-item"><div class="sk-app-bar-item-column"><div class="sk-circle danger small"></div></div><div class="sk-app-bar-item-column"><div><a class="sk-label sk-base" href="https://dashboard.standardnotes.org" rel="noopener" target="_blank">Your Extended subscription expired on \n{{ctrl.component.dateToLocalizedString(ctrl.component.valid_until)}}.</a><div class="sk-p">Extensions are in a read-only state.</div></div></div></div></div><div class="right"><div class="sk-app-bar-item" ng-click="ctrl.reloadComponent()"><div class="sk-button info"><div class="sk-label">Reload</div></div></div><div class="sk-app-bar-item"><div class="sk-app-bar-item-column"><div class="sk-button warning"><a class="sk-label" href="https://standardnotes.org/help/41/expired" rel="noopener" target="_blank">Help</a></div></div></div></div></div></div><div class="sn-component" ng-if="ctrl.error == \'offline-restricted\'"><div class="sk-panel static"><div class="sk-panel-content"><div class="sk-panel-section stretch"><div class="sk-panel-column"></div><div class="sk-h1 sk-bold">You have restricted this extension to be used offline only.</div><div class="sk-subtitle">Offline extensions are not available in the Web app.</div><div class="sk-panel-row"></div><div class="sk-panel-row"><div class="sk-panel-column"><div class="sk-p">You can either:</div><ul><li class="sk-p"><strong>Enable the Hosted option</strong> for this extension by opening the \'Extensions\' menu and \ntoggling \'Use hosted when local is unavailable\' under this \nextension\'s options. Then press Reload below.</li><li class="sk-p"><strong>Use the Desktop application.</strong></li></ul></div></div><div class="sk-panel-row"><div class="sk-button info" ng-click="ctrl.reloadStatus()" ng-if="!ctrl.reloading"><div class="sk-label">Reload</div></div><div class="sk-spinner info small" ng-if="ctrl.reloading"></div></div></div></div></div></div><div class="sn-component" ng-if="ctrl.error == \'url-missing\'"><div class="sk-panel static"><div class="sk-panel-content"><div class="sk-panel-section stretch"><div class="sk-panel-section-title">This extension is not installed correctly.</div><p>Please uninstall {{ctrl.component.name}}, then re-install it.</p><p>This issue can occur if you access Standard Notes using an older \nversion of the app.\nEnsure you are running at least version 2.1 on all platforms.</p></div></div></div></div><iframe data-component-id="{{ctrl.component.uuid}}" frameborder="0" ng-attr-id="component-iframe-{{ctrl.component.uuid}}" ng-if="ctrl.component &amp;&amp; ctrl.componentValid" ng-src="{{ctrl.getUrl() | trusted}}" sandbox="allow-scripts allow-top-navigation-by-user-activation allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-modals allow-forms">Loading</iframe><div class="loading-overlay" ng-if="ctrl.loading"></div>'}},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="sn-component"><div class="sk-modal large" id="conflict-resolution-modal"><div class="sk-modal-background"></div><div class="sk-modal-content"><div class="sk-panel"><div class="sk-panel-header"><h1 class="sk-panel-header-title">Conflicted items — choose which version to keep</h1><div class="sk-horizontal-group"><a class="sk-a info close-button" ng-click="ctrl.keepItem1()">Keep left</a><a class="sk-a info close-button" ng-click="ctrl.keepItem2()">Keep right</a><a class="sk-a info close-button" ng-click="ctrl.keepBoth()">Keep both</a><a class="sk-a info close-button" ng-click="ctrl.export()">Export</a><a class="sk-a info close-button" ng-click="ctrl.dismiss(); $event.stopPropagation()">Close</a></div></div><div class="sk-panel-content selectable"><div class="sk-panel-section"><h3><strong>Content type:</strong>{{ctrl.contentType}}</h3><p>You may wish to look at the "created_at" and "updated_at" fields\nof the items to gain better context in deciding which to keep.</p></div><div id="items"><div class="sk-panel static item" id="item1"><p class="normal" style="white-space: pre-wrap; font-size: 16px;"> {{ctrl.item1Content}}</p></div><div class="border"></div><div class="sk-panel static item" id="item2"><p class="normal" style="white-space: pre-wrap; font-size: 16px;"> {{ctrl.item2Content}}</p></div></div></div></div></div></div></div>'}},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="sn-component"><div class="sk-menu-panel dropdown-menu"><div class="sk-menu-panel-section"><div class="sk-menu-panel-header"><div class="sk-menu-panel-header-title">Note Editor</div></div><menu-row action="self.selectComponent(null)" circle="self.selectedEditor == null &amp;&amp; \'success\'" label="\'Plain Editor\'"></menu-row><menu-row ng-repeat="editor in self.state.editors" action="self.selectComponent(editor)" button-action="self.toggleDefaultForEditor(editor)" button-class="self.state.defaultEditor == editor ? \'warning\' : \'info\'" button-text="self.state.defaultEditor == editor ? \'Undefault\' : \'Set Default\'" circle="self.selectedEditor === editor &amp;&amp; \'success\'" has-button="self.selectedEditor == editor || self.state.defaultEditor == editor" label="editor.name"><div class="sk-menu-panel-column" ng-if="editor.content.conflict_of || self.shouldDisplayRunningLocallyLabel(editor)"><strong class="danger medium-text" ng-if="editor.content.conflict_of">Conflicted copy</strong><div class="sk-sublabel" ng-if="self.shouldDisplayRunningLocallyLabel(editor)">Running Locally</div></div></menu-row><a class="no-decoration" href="https://standardnotes.org/extensions" ng-if="self.state.editors.length == 0" rel="noopener" target="blank"><menu-row label="\'Download More Editors\'"></menu-row></a></div></div></div>'}},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="sn-component"><div class="sk-modal small auto-height"><div class="sk-modal-background"></div><div class="sk-modal-content"><div class="sn-component"><div class="sk-panel"><div class="sk-panel-header"><div class="sk-h1 sk-panel-header-title">{{ctrl.title}}</div><a class="sk-a info close-button" ng-click="ctrl.dismiss()">Close</a></div><div class="sk-panel-content"><div class="sk-panel-section"><div class="sk-p sk-panel-row">{{ctrl.message}}</div><div class="sk-panel-row"><div class="sk-panel-column stretch"><form ng-submit="ctrl.submit()"><input class="sk-input contrast" ng-model="ctrl.formData.input" placeholder="{{ctrl.placeholder}}" should-focus="true" sn-autofocus="true" type="{{ctrl.type}}"></form></div></div></div></div><div class="sk-panel-footer"><a class="sk-a info right" ng-click="ctrl.submit()">Submit</a></div></div></div></div></div></div>'}},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="sk-menu-panel-row row" ng-attr-title="{{ctrl.desc}}" ng-click="ctrl.onClick($event)"><div class="sk-menu-panel-column"><div class="left"><div class="sk-menu-panel-column" ng-if="\n ctrl.circle &amp;&amp; \n (!ctrl.circleAlign || ctrl.circleAlign == \'left\')\n "><div class="sk-circle small" ng-class="ctrl.circle"></div></div><div class="sk-menu-panel-column" ng-class="{\'faded\' : ctrl.faded || ctrl.disabled}"><div class="sk-label" ng-class="ctrl.stylekitClass">{{ctrl.label}}</div><div class="sk-sublabel" ng-if="ctrl.subtitle">{{ctrl.subtitle}}</div><ng-transclude></ng-transclude></div></div><div class="sk-menu-panel-subrows" ng-if="ctrl.subRows &amp;&amp; ctrl.subRows.length &gt; 0"><menu-row ng-repeat="row in ctrl.subRows" action="row.onClick()" label="row.label" spinner-class="row.spinnerClass" subtitle="row.subtitle"></menu-row></div></div><div class="sk-menu-panel-column" ng-if="ctrl.circle &amp;&amp; ctrl.circleAlign == \'right\'"><div class="sk-circle small" ng-class="ctrl.circle"></div></div><div class="sk-menu-panel-column" ng-if="ctrl.hasButton"><div class="sk-button" ng-class="ctrl.buttonClass" ng-click="ctrl.clickAccessoryButton($event)"><div class="sk-label">{{ctrl.buttonText}}</div></div></div><div class="sk-menu-panel-column" ng-if="ctrl.spinnerClass"><div class="sk-spinner small" ng-class="ctrl.spinnerClass"></div></div></div>'}},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="panel-resizer-column"></div>'}},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="sn-component"><div class="sk-modal small auto-height" id="password-wizard"><div class="sk-modal-background"></div><div class="sk-modal-content"><div class="sn-component"><div class="sk-panel"><div class="sk-panel-header"><div class="sk-panel-header-title">{{ctrl.state.title}}</div><a class="sk-a info close-button" ng-click="ctrl.dismiss()">Close</a></div><div class="sk-panel-content"><div class="sk-panel-section" ng-if="ctrl.state.step == 1"><div class="sk-panel-row"><div class="sk-panel-column stretch"><form class="sk-panel-form"><input class="sk-input contrast" ng-model="ctrl.state.formData.currentPassword" placeholder="Current Password" should-focus="true" sn-autofocus="true" type="password"><input class="sk-input contrast" ng-if="ctrl.props.changePassword" ng-model="ctrl.state.formData.newPassword" placeholder="New Password" type="password"><input class="sk-input contrast" ng-if="ctrl.props.changePassword" ng-model="ctrl.state.formData.newPasswordConfirmation" placeholder="Confirm New Password" type="password"></form></div></div></div><div class="sk-panel-section" ng-if="ctrl.state.step == 2"><div ng-if="ctrl.props.changePassword"><p class="sk-p sk-panel-row info-i">Your password has been successfully changed.</p></div><div ng-if="ctrl.props.securityUpdate"><p class="sk-p sk-panel-row info-i">The account update has been successfully applied to your account.</p></div><p class="sk-p sk-panel-row">Please ensure you are running the latest version of Standard Notes \non all platforms to ensure maximum compatibility.</p></div></div><div class="sk-panel-footer"><div class="empty"></div><a class="sk-a info right" ng-click="ctrl.nextStep()" ng-disabled="ctrl.state.lockContinue"><div class="sk-spinner small inline info mr-5" ng-if="ctrl.state.showSpinner"></div>{{ctrl.state.continueTitle}}</a></div></div></div></div></div></div>'}},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="sk-modal-background" ng-click="ctrl.deny()"></div><div class="sk-modal-content" id="permissions-modal"><div class="sn-component"><div class="sk-panel"><div class="sk-panel-header"><div class="sk-panel-header-title">Activate Extension</div><a class="sk-a info close-button" ng-click="ctrl.deny()">Cancel</a></div><div class="sk-panel-content"><div class="sk-panel-section"><div class="sk-panel-row"><div class="sk-h2"><strong>{{ctrl.component.name}}</strong> would like to interact with your\n {{ctrl.permissionsString}}</div></div><div class="sk-panel-row"><p class="sk-p">Extensions use an offline messaging system to communicate. Learn more at <a class="sk-a info" href="https://standardnotes.org/permissions" rel="noopener" target="_blank">https://standardnotes.org/permissions.</a></p></div></div></div><div class="sk-panel-footer"><div class="sk-button info big block bold" ng-click="ctrl.accept()"><div class="sk-label">Continue</div></div></div></div></div></div>'}},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="sk-modal-background" ng-click="ctrl.cancel()"></div><div class="sk-modal-content" id="privileges-modal"><div class="sn-component"><div class="sk-panel"><div class="sk-panel-header"><div class="sk-panel-header-title">Authentication Required</div><a class="close-button info" ng-click="ctrl.cancel()">Cancel</a></div><div class="sk-panel-content"><div class="sk-panel-section"><div ng-repeat="credential in ctrl.requiredCredentials"><div class="sk-p sk-bold sk-panel-row"><strong>{{ctrl.promptForCredential(credential)}}</strong></div><div class="sk-panel-row"><input class="sk-input contrast" ng-model="ctrl.authParameters[credential]" should-focus="$index == 0" sn-autofocus="true" sn-enter="ctrl.submit()" type="password"></div><div class="sk-panel-row"><label class="sk-label danger" ng-if="ctrl.isCredentialInFailureState(credential)">Invalid authentication. Please try again.</label></div></div><div class="sk-panel-row"></div><div class="sk-panel-row"><div class="sk-horizontal-group"><div class="sk-p sk-bold">Remember For</div><a class="sk-a info" ng-repeat="option in ctrl.sessionLengthOptions" ng-class="{\'boxed\' : option.value == ctrl.selectedSessionLength}" ng-click="ctrl.selectSessionLength(option.value)">{{option.label}}</a></div></div></div></div><div class="sk-panel-footer extra-padding"><div class="sk-button info big block bold" ng-click="ctrl.submit()"><div class="sk-label">Submit</div></div></div></div></div></div>'}},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="sk-modal-background" ng-click="ctrl.cancel()"></div><div class="sk-modal-content" id="privileges-modal"><div class="sn-component"><div class="sk-panel"><div class="sk-panel-header"><div class="sk-panel-header-title">Manage Privileges</div><a class="sk-a close-button info" ng-click="ctrl.cancel()">Done</a></div><div class="sk-panel-content"><div class="sk-panel-section"><table class="sk-table"><thead><tr><th></th><th ng-repeat="cred in ctrl.availableCredentials"><div class="priv-header"><strong>{{ctrl.credentialDisplayInfo[cred].label}}</strong><div class="sk-p font-small" ng-show="!ctrl.credentialDisplayInfo[cred].availability" style="margin-top: 2px">Not Configured</div></div></th></tr></thead><tbody><tr ng-repeat="action in ctrl.availableActions"><td><div class="sk-p">{{ctrl.displayInfoForAction(action)}}</div></td><th ng-repeat="credential in ctrl.availableCredentials"><input ng-checked="ctrl.isCredentialRequiredForAction(action, credential)" ng-click="ctrl.checkboxValueChanged(action, credential)" ng-disabled="!ctrl.credentialDisplayInfo[credential].availability" type="checkbox"></th></tr></tbody></table></div><div class="sk-panel-section" ng-if="ctrl.sessionExpirey &amp;&amp; !ctrl.sessionExpired"><div class="sk-p sk-panel-row"> You will not be asked to authenticate until {{ctrl.sessionExpirey}}.</div><a class="sk-a sk-panel-row info" ng-click="ctrl.clearSession()">Clear Session</a></div></div><div class="sk-panel-footer"><div class="sk-h2 sk-bold">About Privileges</div><div class="sk-panel-section no-bottom-pad"><div class="sk-panel-row"><div class="text-content"><div class="sk-p">Privileges represent interface level authentication for accessing \ncertain items and features. Note that when your application is unlocked,\nyour data exists in temporary memory in an unencrypted state.\nPrivileges are meant to protect against unwanted access in the event of\nan unlocked application, but do not affect data encryption state.</div><p class="sk-p">Privileges sync across your other devices; however, note that if you \nrequire a "Local Passcode" privilege, and another device does not have \na local passcode set up, the local passcode requirement will be ignored \non that device.</p></div></div></div></div></div></div></div>'}},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="sn-component"><div class="sk-modal medium" id="item-preview-modal"><div class="sk-modal-background"></div><div class="sk-modal-content"><div class="sn-component"><div class="sk-panel"><div class="sk-panel-header"><div class="sk-panel-header-title">Preview</div><div class="sk-horizontal-group"><a class="sk-a info close-button" ng-click="ctrl.restore(false)">Restore</a><a class="sk-a info close-button" ng-click="ctrl.restore(true)">Restore as copy</a><a class="sk-a info close-button" ng-click="ctrl.dismiss(); $event.stopPropagation()">Close</a></div></div><div class="sk-panel-content selectable" ng-if="!ctrl.editor"><div class="sk-h2">{{ctrl.content.title}}</div><p class="normal sk-p" style="white-space: pre-wrap; font-size: 16px;">{{ctrl.content.text}}</p></div><component-view class="component-view" component="ctrl.editor" ng-if="ctrl.editor"></component-view></div></div></div></div></div>'}},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="sn-component" id="session-history-menu"><div class="sk-menu-panel dropdown-menu"><div class="sk-menu-panel-header"><div class="sk-menu-panel-header-title">{{ctrl.history.entries.length || \'No\'}} revisions</div><a class="sk-a info sk-h5" ng-click="ctrl.showOptions = !ctrl.showOptions; $event.stopPropagation();">Options</a></div><div ng-if="ctrl.showOptions"><menu-row action="ctrl.clearItemHistory()" label="\'Clear note local history\'"></menu-row><menu-row action="ctrl.clearAllHistory()" label="\'Clear all local history\'"></menu-row><menu-row action="ctrl.toggleAutoOptimize()" label="(ctrl.autoOptimize ? \'Disable\' : \'Enable\') + \' auto cleanup\'"><div class="sk-sublabel">Automatically cleans up small revisions to conserve space.</div></menu-row><menu-row action="ctrl.toggleDiskSaving()" label="(ctrl.diskEnabled ? \'Disable\' : \'Enable\') + \' saving history to disk\'"><div class="sk-sublabel">Saving to disk is not recommended. Decreases performance and increases app \nloading time and memory footprint.</div></menu-row></div><menu-row ng-repeat="revision in ctrl.entries" action="ctrl.openRevision(revision);" label="revision.previewTitle()"><div class="sk-sublabel opaque" ng-class="ctrl.classForRevision(revision)">{{revision.previewSubTitle()}}</div></menu-row></div></div>'}},function(e,t,n){n(10);e.exports=function(e){var t="";return t+='<div class="sn-component"><div class="sk-panel sk-panel-right" id="sync-resolution-menu"><div class="sk-panel-header"><div class="sk-panel-header-title">Out of Sync</div><a class="sk-a info close-button" ng-click="ctrl.close()">Close</a></div><div class="sk-panel-content"><div class="sk-panel-section"><div class="sk-panel-row sk-p">We\'ve detected that the data on the server may not match \nthe data in the current application session.</div><div class="sk-p sk-panel-row"><div class="sk-panel-column"><strong class="sk-panel-row">Option 1 — Restart App:</strong><div class="sk-p"> Quit the application and re-open it. \nSometimes, this may resolve the issue.</div></div></div><div class="sk-p sk-panel-row"><div class="sk-panel-column"><strong class="sk-panel-row">Option 2 (recommended) — Sign Out:</strong><div class="sk-p">Sign out of your account, then sign back in. \nThis will ensure your data is consistent with the server.</div>Be sure to download a backup of your data before doing so.</div></div><div class="sk-p sk-panel-row"><div class="sk-panel-column"><strong class="sk-panel-row">Option 3 — Sync Resolution:</strong><div class="sk-p">We can attempt to reconcile changes by downloading all data from the \nserver. No existing data will be overwritten. If the local contents of \nan item differ from what the server has, a conflicted copy will be created.</div></div></div><div ng-if="!ctrl.status.backupFinished"><div class="sk-p sk-panel-row">Please download a backup before we attempt to \nperform a full account sync resolution.</div><div class="sk-panel-row"><div class="sk-button-group"><div class="sk-button info" ng-click="ctrl.downloadBackup(true)"><div class="sk-label">Encrypted</div></div><div class="sk-button info" ng-click="ctrl.downloadBackup(false)"><div class="sk-label">Decrypted</div></div><div class="sk-button danger" ng-click="ctrl.skipBackup()"><div class="sk-label">Skip</div></div></div></div></div><div ng-if="ctrl.status.backupFinished"><div class="sk-panel-row" ng-if="!ctrl.status.resolving &amp;&amp; !ctrl.status.attemptedResolution"><div class="sk-button info" ng-click="ctrl.performSyncResolution()"><div class="sk-label">Perform Sync Resolution</div></div></div><div class="sk-panel-row justify-left" ng-if="ctrl.status.resolving"><div class="sk-horizontal-group"><div class="sk-spinner small info"></div><div class="sk-label">Attempting sync resolution...</div></div></div><div class="sk-panel-column" ng-if="ctrl.status.fail"><div class="sk-panel-row sk-label danger">Sync Resolution Failed</div><div class="sk-p sk-panel-row">We attempted to reconcile local content and server content, but were \nunable to do so. At this point, we recommend signing out of your account \nand signing back in. You may wish to download a data backup before doing so.</div></div><div class="sk-panel-column" ng-if="ctrl.status.success"><div class="sk-panel-row sk-label success">Sync Resolution Success</div><div class="sk-p sk-panel-row">Your local data is now in sync with the server. You may close this window.</div></div></div></div></div></div></div>'}},function(e,t,n){"use strict";n.r(t);n(81),n(82);var r,i=n(9),a=n.n(i);n(84),n(85),n(86),n(87),n(88);function o(e){return null==e}function s(){try{var e=navigator.platform.toLowerCase(),t="";return-1!==e.indexOf("mac")?t="mac":-1!==e.indexOf("win")&&(t="windows"),-1!==e.indexOf("linux")&&(t="linux"),t+(c()?"-desktop":"-web")}catch(e){return null}}function c(){return window.isElectron}function u(e){c()?e.html5Mode(!1):window.history&&window.history.pushState&&e.html5Mode({enabled:!0,requireBase:!1})}Array.prototype.containsPrimitiveSubset=function(e){var t=this;return!e.some((function(e){return-1===t.indexOf(e)}))},Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(e,t){if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),r=n.length>>>0;if(0===r)return!1;var i,a,o=0|t,s=Math.max(o>=0?o:r-Math.abs(o),0);for(;s<r;){if((i=n[s])===(a=e)||"number"==typeof i&&"number"==typeof a&&isNaN(i)&&isNaN(a))return!0;s++}return!1}}),u.$inject=["$locationProvider"];var l=n(3),f=n.n(l),p=n(6),h=n.n(p),d=n(5),v=n.n(d),y=n(12),m=n.n(y),g=n(7),b=n.n(g),w=n(2),k=n(0),x=n.n(k),S=n(1),_=n.n(S),$=n(4),P=n.n($),O=n(36),C=function(e){function t(){return f()(this,t),h()(this,v()(t).apply(this,arguments))}var n,r;return b()(t,e),P()(t,[{key:"alert",value:(r=_()(x.a.mark((function e(){var t,n,r,i,a,o,s=this,c=arguments;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=c.length>0&&void 0!==c[0]?c[0]:{},n=t.title,r=t.text,i=t.closeButtonText,a=void 0===i?"OK":i,o=t.onClose,e.abrupt("return",new Promise((function(e,t){var i,c=[{text:a,style:"neutral",action:(i=_()(x.a.mark((function t(){return x.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o&&s.deviceInterface.timeout(o),e(!0);case 2:case"end":return t.stop()}}),t)}))),function(){return i.apply(this,arguments)})}];new O.SKAlert({title:n,text:r,buttons:c}).present()})));case 2:case"end":return e.stop()}}),e)}))),function(){return r.apply(this,arguments)})},{key:"confirm",value:(n=_()(x.a.mark((function e(){var t,n,r,i,a,o,s,c,u,l,f,p=this,h=arguments;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=h.length>0&&void 0!==h[0]?h[0]:{},n=t.title,r=t.text,i=t.confirmButtonText,a=void 0===i?"Confirm":i,o=t.cancelButtonText,s=void 0===o?"Cancel":o,c=t.onConfirm,u=t.onCancel,l=t.destructive,f=void 0!==l&&l,e.abrupt("return",new Promise((function(e,t){var i,o,l=[{text:s,style:"neutral",action:(o=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u&&p.deviceInterface.timeout(u),t(!1);case 2:case"end":return e.stop()}}),e)}))),function(){return o.apply(this,arguments)})},{text:a,style:f?"danger":"info",action:(i=_()(x.a.mark((function t(){return x.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:c&&p.deviceInterface.timeout(c),e(!0);case 2:case"end":return t.stop()}}),t)}))),function(){return i.apply(this,arguments)})}];new O.SKAlert({title:n,text:r,buttons:l}).present()})));case 2:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)})}]),t}(w.SNAlertService),E=function(){function e(){f()(this,e),this.locked=!0}var t,n,r,i,a,o;return P()(e,[{key:"setApplication",value:function(e){this.alertService=e.alertService}},{key:"displayOfflineAlert",value:function(){this.alertService.alert({text:"There was an issue loading your offline database. This could happen for two reasons:\n\n1. You're in a private window in your browser. We can't save your data without access to the local database. Please use a non-private window.\n\n2. You have two windows of the app open at the same time. Please close any other app instances and reload the page."})}},{key:"setLocked",value:function(e){this.locked=e}},{key:"openDatabase",value:(o=_()(x.a.mark((function e(){var t,n,r,i=this,a=arguments;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]?a[0]:{},n=t.onUpgradeNeeded,!this.locked){e.next=3;break}throw"Attempting to open locked database";case 3:return r=window.indexedDB.open("standardnotes",1),e.abrupt("return",new Promise((function(e,t){r.onerror=function(t){t.target.errorCode?i.alertService.alert({text:"Offline database issue: "+t.target.errorCode}):i.displayOfflineAlert(),console.error("Offline database issue:",t),e(null)},r.onsuccess=function(t){var n=t.target.result;n.onversionchange=function(e){n.close()},n.onerror=function(e){console.error("Database error: "+e.target.errorCode)},e(n)},r.onblocked=function(e){console.error("Request blocked error:",e.target.errorCode)},r.onupgradeneeded=function(e){var t=e.target.result;t.onversionchange=function(e){t.close()};var r=t.createObjectStore("items",{keyPath:"uuid"});r.createIndex("uuid","uuid",{unique:!0}),r.transaction.oncomplete=function(e){1===t.version&&n&&n()}}})));case 5:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"getAllPayloads",value:(a=_()(x.a.mark((function e(){var t,n,r;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.openDatabase();case 2:return t=e.sent,n=t.transaction("items").objectStore("items"),r=[],e.abrupt("return",new Promise((function(e){n.openCursor().onsuccess=function(t){var n=t.target.result;n?(r.push(n.value),n.continue()):e(r)}})));case 6:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"savePayload",value:(i=_()(x.a.mark((function e(t){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.savePayloads([t]);case 1:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"savePayloads",value:(r=_()(x.a.mark((function e(t){var n,r,i,a=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=function(e){a.alertService.alert({text:"Unable to save changes locally due to an unknown system issue. Issue Code: ".concat(e.code," Issue Name: ").concat(e.name,".")})},0!==t.length){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,this.openDatabase();case 5:return r=e.sent,i=r.transaction("items","readwrite"),e.abrupt("return",new Promise(function(){var e=_()(x.a.mark((function e(r,a){var o,s,c,u,l,f,p,h;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i.oncomplete=function(e){},i.onerror=function(e){console.error("Transaction error:",e.target.errorCode),n(e.target.error)},i.onblocked=function(e){console.error("Transaction blocked error:",e.target.errorCode),n(e.target.error)},i.onabort=function(e){console.error("Offline saving aborted:",e);var t=e.target.error;"QuotaExceededError"===t.name?this.alertService.alert({text:"Unable to save changes locally because your device is out of space. Please free up some disk space and try again, otherwise, your data may end up in an inconsistent state."}):n(t),a(t)},o=i.objectStore("items"),s=function(){var e=_()(x.a.mark((function e(t){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){var r=o.put(t);r.onerror=function(t){console.error("DB put error:",t.target.error),e()},r.onsuccess=e})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),c=!0,u=!1,l=void 0,e.prev=9,f=t[Symbol.iterator]();case 11:if(c=(p=f.next()).done){e.next=18;break}return h=p.value,e.next=15,s(h);case 15:c=!0,e.next=11;break;case 18:e.next=24;break;case 20:e.prev=20,e.t0=e.catch(9),u=!0,l=e.t0;case 24:e.prev=24,e.prev=25,c||null==f.return||f.return();case 27:if(e.prev=27,!u){e.next=30;break}throw l;case 30:return e.finish(27);case 31:return e.finish(24);case 32:r();case 33:case"end":return e.stop()}}),e,null,[[9,20,24,32],[25,,27,31]])})));return function(t,n){return e.apply(this,arguments)}}()));case 8:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"deletePayload",value:(n=_()(x.a.mark((function e(t){var n,r;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.openDatabase();case 2:return n=e.sent,r=n.transaction("items","readwrite").objectStore("items").delete(t),e.abrupt("return",new Promise((function(e,t){r.onsuccess=function(t){e()},r.onerror=function(e){t()}})));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"clearAllPayloads",value:(t=_()(x.a.mark((function e(){var t;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=window.indexedDB.deleteDatabase("standardnotes"),e.abrupt("return",new Promise((function(e,n){t.onerror=function(t){console.error("Error deleting database."),e()},t.onsuccess=function(t){e()},t.onblocked=function(t){console.error("Delete request blocked"),this.alertService.alert({text:"Your browser is blocking Standard Notes from deleting the local database. Make sure there are no other open windows of this app and try again. If the issue persists, please manually delete app data to sign out."}),e()}})));case 2:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})}]),e}(),A=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.namespace,i=n.timeout;return f()(this,t),(e=h()(this,v()(t).call(this,{namespace:r,timeout:i||setTimeout.bind(Object(w.getGlobalScope)()),interval:setInterval.bind(Object(w.getGlobalScope)())}))).createDatabase(),e}var n,r,i,a,o,s,c,u,l,p,d,y,m,g;return b()(t,e),P()(t,[{key:"createDatabase",value:function(){this.database=new E}},{key:"setApplication",value:function(e){this.database.setApplication(e)}},{key:"getRawStorageValue",value:(g=_()(x.a.mark((function e(t){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",localStorage.getItem(t));case 1:case"end":return e.stop()}}),e)}))),function(e){return g.apply(this,arguments)})},{key:"getAllRawStorageKeyValues",value:(m=_()(x.a.mark((function e(){var t,n,r,i;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=[],n=0,r=Object.keys(localStorage);n<r.length;n++)i=r[n],t.push({key:i,value:localStorage[i]});return e.abrupt("return",t);case 3:case"end":return e.stop()}}),e)}))),function(){return m.apply(this,arguments)})},{key:"setRawStorageValue",value:(y=_()(x.a.mark((function e(t,n){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:localStorage.setItem(t,n);case 1:case"end":return e.stop()}}),e)}))),function(e,t){return y.apply(this,arguments)})},{key:"removeRawStorageValue",value:(d=_()(x.a.mark((function e(t){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:localStorage.removeItem(t);case 1:case"end":return e.stop()}}),e)}))),function(e){return d.apply(this,arguments)})},{key:"removeAllRawStorageValues",value:(p=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:localStorage.clear();case 1:case"end":return e.stop()}}),e)}))),function(){return p.apply(this,arguments)})},{key:"openDatabase",value:(l=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.database.setLocked(!1),this.database.openDatabase({onUpgradeNeeded:function(){}});case 2:case"end":return e.stop()}}),e,this)}))),function(){return l.apply(this,arguments)})},{key:"getDatabaseKeyPrefix",value:function(){return this.namespace?"".concat(this.namespace,"-item-"):"item-"}},{key:"keyForPayloadId",value:function(e){return"".concat(this.getDatabaseKeyPrefix()).concat(e)}},{key:"getAllRawDatabasePayloads",value:(u=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.database.getAllPayloads());case 1:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"saveRawDatabasePayload",value:(c=_()(x.a.mark((function e(t){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.database.savePayload(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"saveRawDatabasePayloads",value:(s=_()(x.a.mark((function e(t){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.database.savePayloads(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"removeRawDatabasePayloadWithId",value:(o=_()(x.a.mark((function e(t){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.database.deletePayload(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"removeAllRawDatabasePayloads",value:(a=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.database.clearAllPayloads());case 1:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"getKeychainValue",value:(i=_()(x.a.mark((function e(){var t;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t=localStorage.getItem("keychain"))){e.next=3;break}return e.abrupt("return",JSON.parse(t));case 3:case"end":return e.stop()}}),e)}))),function(){return i.apply(this,arguments)})},{key:"setKeychainValue",value:(r=_()(x.a.mark((function e(t){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:localStorage.setItem("keychain",JSON.stringify(t));case 1:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})},{key:"clearKeychainValue",value:(n=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:localStorage.removeItem("keychain");case 1:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)})},{key:"openUrl",value:function(e){var t=window.open(e,"_blank");t&&t.focus()}}]),t}(w.DeviceInterface),I=function(e){function t(e){var n;f()(this,t);var r=new A({timeout:e});return n=h()(this,v()(t).call(this,{environment:w.Environments.Web,platform:Object(w.platformFromString)(s()),namespace:"",host:window._default_sync_server,deviceInterface:r,swapClasses:[{swap:w.SNAlertService,with:C}]})),r.setApplication(m()(n)),n}return t.$inject=["$timeout"],b()(t,e),t}(w.SNApplication),j=n(19),D=n.n(j),M=1,T=2,R=3,L=4,N=5,F=6,U=7,K=8,V=9,B=10,H=1,z=2,W=function(){function e(t,n,r,i){f()(this,e),this.$timeout=t,this.$rootScope=n,this.application=r,this.godService=i,this.observers=[],this.locked=!0,this.registerVisibilityObservers(),this.addAppEventObserver()}var t,n;return e.$inject=["$timeout","$rootScope","application","godService"],P()(e,[{key:"addAppEventObserver",value:function(){var e=this;this.unsubApp=this.application.addEventObserver(function(){var t=_()(x.a.mark((function t(n){return x.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n===w.ApplicationEvents.Started?e.locked=!0:n===w.ApplicationEvents.Launched&&(e.locked=!1);case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}},{key:"isLocked",value:function(){return this.locked}},{key:"registerVisibilityObservers",value:function(){var e=this;c()?(this.$rootScope.$on("window-lost-focus",(function(){e.notifyEvent(B)})),this.$rootScope.$on("window-gained-focus",(function(){e.notifyEvent(V)}))):document.addEventListener("visibilitychange",(function(t){var n="visible"===document.visibilityState?V:B;e.notifyEvent(n)}))}},{key:"addObserver",value:function(e){var t=this;return this.observers.push(e),function(){D()(t.observers,e)}}},{key:"notifyEvent",value:(n=_()(x.a.mark((function e(t,n){var r=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){r.$timeout(_()(x.a.mark((function i(){var a,o,s,c,u,l;return x.a.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:a=!0,o=!1,s=void 0,i.prev=3,c=r.observers[Symbol.iterator]();case 5:if(a=(u=c.next()).done){i.next=12;break}return l=u.value,i.next=9,l(t,n);case 9:a=!0,i.next=5;break;case 12:i.next=18;break;case 14:i.prev=14,i.t0=i.catch(3),o=!0,s=i.t0;case 18:i.prev=18,i.prev=19,a||null==c.return||c.return();case 21:if(i.prev=21,!o){i.next=24;break}throw s;case 24:return i.finish(21);case 25:return i.finish(18);case 26:e();case 27:case"end":return i.stop()}}),i,null,[[3,14,18,26],[19,,21,25]])}))))})));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return n.apply(this,arguments)})},{key:"setSelectedTag",value:function(e){if(this.selectedTag!==e){var t=this.selectedTag;this.selectedTag=e,this.notifyEvent(M,{tag:e,previousTag:t})}}},{key:"setSelectedNote",value:(t=_()(x.a.mark((function e(t){var n,r=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=function(){var e=_()(x.a.mark((function e(){var n;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.selectedNote,r.selectedNote=t,e.next=4,r.notifyEvent(T,{previousNote:n});case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),e.t0=t&&t.content.protected,!e.t0){e.next=6;break}return e.next=5,this.application.privilegesService.actionRequiresPrivilege(w.ProtectedActions.ViewProtectedNotes);case 5:e.t0=e.sent;case 6:if(!e.t0){e.next=10;break}this.godService.presentPrivilegesModal(w.ProtectedActions.ViewProtectedNotes,n),e.next=11;break;case 10:n();case 11:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getSelectedTag",value:function(){return this.selectedTag}},{key:"getSelectedNote",value:function(){return this.selectedNote}},{key:"setUserPreferences",value:function(e){this.userPreferences=e,this.notifyEvent(R)}},{key:"panelDidResize",value:function(e){var t=e.name,n=e.collapsed;this.notifyEvent(L,{panel:t,collapsed:n})}},{key:"editorDidFocus",value:function(e){this.notifyEvent(N,{eventSource:e})}},{key:"beganBackupDownload",value:function(){this.notifyEvent(F)}},{key:"endedBackupDownload",value:function(e){var t=e.success;this.notifyEvent(U,{success:t})}},{key:"desktopExtensionsReady",value:function(){this.notifyEvent(K)}}]),e}(),q=function(){function e(t,n,r,i){var a=this;if(f()(this,e),!(t&&n&&r&&i))throw"Invalid PureCtrl construction.";this.$scope=t,this.$timeout=n,this.appState=i,this.application=r,this.state=this.getInitialState(),this.props={},t.$on("$destroy",(function(){a.unsubApp(),a.unsubState()}))}var t,n,r,i,a;return e.$inject=["$scope","$timeout","application","appState"],P()(e,[{key:"$onInit",value:function(){this.addAppStateObserver(),this.addAppEventObserver()}},{key:"resetState",value:(a=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.state=this.getInitialState(),e.next=3,this.setState(this.state);case 3:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"getInitialState",value:function(){return{}}},{key:"setState",value:(i=_()(x.a.mark((function e(t){var n=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){n.$timeout((function(){n.state=Object.freeze(Object.assign({},n.state,t)),e()}))})));case 1:case"end":return e.stop()}}),e)}))),function(e){return i.apply(this,arguments)})},{key:"initProps",value:function(e){if(Object.keys(this.props).length>0)throw"Already init-ed props.";this.props=Object.freeze(Object.assign({},this.props,e))}},{key:"addAppStateObserver",value:function(){var e=this;this.unsubState=this.appState.addObserver((function(t,n){e.onAppStateEvent(t,n)}))}},{key:"addAppEventObserver",value:function(){var e=this;this.application.isStarted()&&this.onAppStart(),this.appState.isLocked()||this.onAppLaunch(),this.unsubApp=this.application.addEventObserver(function(){var t=_()(x.a.mark((function t(n){return x.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.onAppEvent(n),n!==w.ApplicationEvents.Started){t.next=8;break}return t.next=4,e.resetState();case 4:return t.next=6,e.onAppStart();case 6:t.next=14;break;case 8:if(n!==w.ApplicationEvents.Launched){t.next=13;break}return t.next=11,e.onAppLaunch();case 11:t.next=14;break;case 13:n===w.ApplicationEvents.CompletedSync?e.onAppSync():n===w.ApplicationEvents.KeyStatusChanged&&e.onAppKeyChange();case 14:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}},{key:"onAppEvent",value:function(e){}},{key:"onAppStateEvent",value:function(e,t){}},{key:"onAppStart",value:(r=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(){return r.apply(this,arguments)})},{key:"onAppLaunch",value:(n=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)})},{key:"onAppKeyChange",value:(t=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})},{key:"onAppSync",value:function(){}}]),e}(),G=n(8),Y=n.n(G),J=n(11),Q=n.n(J),Z=n(58),X=n.n(Z),ee="Tab",te="Backspace",ne="ArrowUp",re="ArrowDown",ie={Shift:"Shift",Ctrl:"Control",Meta:"Meta",Alt:"Alt"},ae="KeyEventDown",oe="KeyEventUp",se=function(){function e(){f()(this,e),this.observers=[],window.addEventListener("keydown",this.handleKeyDown.bind(this)),window.addEventListener("keyup",this.handleKeyUp.bind(this))}return P()(e,[{key:"modifiersForEvent",value:function(e){return Object.keys(ie).map((function(e){return ie[e]})).filter((function(t){return(e.ctrlKey||e.key===ie.Ctrl)&&t===ie.Ctrl||(e.metaKey||e.key===ie.Meta)&&t===ie.Meta||(e.altKey||e.key===ie.Alt)&&t===ie.Alt||(e.shiftKey||e.key===ie.Shift)&&t===ie.Shift}))}},{key:"eventMatchesKeyAndModifiers",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=this.modifiersForEvent(e);if(r.length!==n.length)return!1;var i=!0,a=!1,o=void 0;try{for(var s,c=n[Symbol.iterator]();!(i=(s=c.next()).done);i=!0){var u=s.value;if(!r.includes(u))return!1}}catch(e){a=!0,o=e}finally{try{i||null==c.return||c.return()}finally{if(a)throw o}}return!t||t.toLowerCase()===e.key.toLowerCase()}},{key:"notifyObserver",value:function(e,t){var n=!0,r=!1,i=void 0;try{for(var a,o=this.observers[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;if((!s.element||e.target===s.element)&&((!s.elements||s.elements.includes(e.target))&&(!s.notElement||s.notElement!==e.target)&&(!s.notElementIds||!s.notElementIds.includes(e.target.id))&&this.eventMatchesKeyAndModifiers(e,s.key,s.modifiers))){var c=t===ae?s.onKeyDown:s.onKeyUp;c&&c(e)}}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}}},{key:"handleKeyDown",value:function(e){this.notifyObserver(e,ae)}},{key:"handleKeyUp",value:function(e){this.notifyObserver(e,oe)}},{key:"addKeyObserver",value:function(e){var t={key:e.key,modifiers:e.modifiers,onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp,element:e.element,elements:e.elements,notElement:e.notElement,notElementIds:e.notElementIds};return this.observers.push(t),t}},{key:"removeKeyObserver",value:function(e){this.observers.splice(this.observers.indexOf(e),1)}}]),e}(),ce=n(59),ue=n.n(ce);function le(e){var t=e.title;return e.permanently?"Are you sure you want to permanently delete ".concat(t,"?"):"Are you sure you want to move ".concat(t," to the trash?")}function fe(e){var t=e.count;return"Are you sure you want to permanently delete ".concat(t," note(s)?")}function pe(e){var t=e.errorCount;return"Import complete. ".concat(t," items were not imported because there was an error decrypting them. Make sure the password is correct and try again.")}var he="tagsPanelWidth",de="notesPanelWidth",ve="editorWidth",ye="editorLeft",me="monospaceFont",ge="spellcheck",be="marginResizersEnabled",we="sortBy",ke="sortReverse",xe="showArchived",Se="hidePinned",_e="hideNotePreview",$e="hideDate",Pe="hideTags",Oe=function(){function e(t,n){var r=this;f()(this,e),this.application=n,this.appState=t,this.unsub=n.addSingleEventObserver(w.ApplicationEvents.Launched,(function(){r.streamPreferences(),r.loadSingleton()}))}var t;return e.$inject=["appState","application"],P()(e,[{key:"streamPreferences",value:function(){var e=this;this.application.streamItems({contentType:w.ContentTypes.UserPrefs,stream:function(){e.loadSingleton()}})}},{key:"loadSingleton",value:(t=_()(x.a.mark((function e(){var t,n;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=w.ContentTypes.UserPrefs,n=new w.SNPredicate("content_type","=",t),e.next=4,this.application.singletonManager.findOrCreateSingleton({predicate:n,createPayload:Object(w.CreateMaxPayloadFromAnyObject)({object:{content_type:t,content:{}}})});case 4:this.userPreferences=e.sent,this.preferencesDidChange();case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"preferencesDidChange",value:function(){this.appState.setUserPreferences(this.userPreferences)}},{key:"syncUserPreferences",value:function(){this.userPreferences&&this.application.saveItem({item:this.userPreferences})}},{key:"getValue",value:function(e,t){if(!this.userPreferences)return t;var n=this.userPreferences.getAppDataItem(e);return void 0!==n&&null!=n?n:t}},{key:"setUserPrefValue",value:function(e,t,n){this.userPreferences.setAppDataItem(e,t),n&&this.syncUserPreferences()}}]),e}();function Ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ee(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(n),!0).forEach((function(t){Q()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ce(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ae="pinned",Ie="locked",je="archived",De="prefersPlainEditor",Me="note-text-editor",Te="note-title-editor",Re="editor-content",Le="note-tags-component-container",Ne="Menlo,Consolas,'DejaVu Sans Mono',monospace",Fe="monospace",Ue="inherit",Ke=function(e){function t(e,n,r,i,a,o,s,c){var u;return f()(this,t),u=h()(this,v()(t).call(this,e,n,i,a)),Q()(m()(u),"editorMenuOnSelect",(function(e){if(e&&"editor-editor"!==e.area)"editor-stack"===e.area&&u.toggleStackComponentForCurrentItem(e);else{u.setMenuState("showEditorMenu",!1);var t=e;if(u.state.selectedEditor&&t!==u.state.selectedEditor&&u.disassociateComponentWithCurrentNote(u.state.selectedEditor),t)!0===u.state.note.getAppDataItem(De)&&(u.state.note.setAppDataItem(De,!1),u.application.setItemNeedsSync({item:u.state.note})),u.associateComponentWithCurrentNote(t);else u.state.note.getAppDataItem(De)||(u.state.note.setAppDataItem(De,!0),u.application.setItemNeedsSync({item:u.state.note})),u.reloadFont();u.setState({selectedEditor:t})}u.application.sync()})),Q()(m()(u),"onPanelResizeFinish",(function(e,t,n){n?u.preferencesManager.setUserPrefValue(ve,null):null!=e&&(u.preferencesManager.setUserPrefValue(ve,e),u.leftPanelPuppet.setWidth(e)),null!=t&&(u.preferencesManager.setUserPrefValue(ye,t),u.rightPanelPuppet.setLeft(t)),u.preferencesManager.syncUserPreferences()})),Q()(m()(u),"onEditorLoad",(function(e){u.desktopManager.redoSearch()})),u.$rootScope=r,u.desktopManager=o,u.keyboardManager=s,u.preferencesManager=c,u.leftPanelPuppet={onReady:function(){return u.reloadPreferences()}},u.rightPanelPuppet={onReady:function(){return u.reloadPreferences()}},u.addSyncStatusObserver(),u.registerKeyboardShortcuts(),u.prefKeyMonospace=me,u.prefKeySpellcheck=ge,u.prefKeyMarginResizers=be,u}var n,r,i,o;return t.$inject=["$scope","$timeout","$rootScope","application","appState","desktopManager","keyboardManager","preferencesManager"],b()(t,e),P()(t,[{key:"getInitialState",value:function(){return{componentStack:[],editorDebounce:200,isDesktop:c(),spellcheck:!0,mutable:{tagsString:""}}}},{key:"onAppLaunch",value:function(){Y()(v()(t.prototype),"onAppLaunch",this).call(this),this.streamItems(),this.registerComponentHandler()}},{key:"onAppStateEvent",value:function(e,t){e===T?this.handleNoteSelectionChange(this.appState.getSelectedNote(),t.previousNote):e===R&&this.reloadPreferences()}},{key:"onAppEvent",value:function(e){if(this.state.note)if(e===w.ApplicationEvents.HighLatencySync)this.setState({syncTakingTooLong:!0});else if(e===w.ApplicationEvents.CompletedSync)if(this.setState({syncTakingTooLong:!1}),this.state.note.dirty);else{var t=this.state.note.lastSyncEnd>this.state.note.lastSyncBegan;(this.state.saveError||t)&&this.showAllChangesSavedStatus()}else e===w.ApplicationEvents.FailedSync&&this.state.note.dirty&&this.showErrorStatus()}},{key:"streamItems",value:function(){var e,t,n,r=this;this.application.streamItems({contentType:w.ContentTypes.Note,stream:(e=_()(x.a.mark((function e(t){var n,i;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.items,i=t.source,r.state.note){e.next=3;break}return e.abrupt("return");case 3:if(!r.state.note.deleted&&!r.state.note.content.trashed){e.next=5;break}return e.abrupt("return");case 5:if(Object(w.isPayloadSourceRetrieved)(i)){e.next=7;break}return e.abrupt("return");case 7:if(n.find((function(e){return e.uuid===r.state.note.uuid}))){e.next=10;break}return e.abrupt("return");case 10:r.reloadTagsString();case 11:case"end":return e.stop()}}),e)}))),function(t){return e.apply(this,arguments)})}),this.application.streamItems({contentType:w.ContentTypes.Tag,stream:(t=_()(x.a.mark((function e(t){var n,i,a,o,s,c,u;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.items,t.source,r.state.note){e.next=3;break}return e.abrupt("return");case 3:i=!0,a=!1,o=void 0,e.prev=6,s=n[Symbol.iterator]();case 8:if(i=(c=s.next()).done){e.next=16;break}if(u=c.value,r.state.note.savedTagsString&&!u.deleted&&!u.hasRelationshipWithItem(r.state.note)){e.next=13;break}return r.reloadTagsString(),e.abrupt("break",16);case 13:i=!0,e.next=8;break;case 16:e.next=22;break;case 18:e.prev=18,e.t0=e.catch(6),a=!0,o=e.t0;case 22:e.prev=22,e.prev=23,i||null==s.return||s.return();case 25:if(e.prev=25,!a){e.next=28;break}throw o;case 28:return e.finish(25);case 29:return e.finish(22);case 30:case"end":return e.stop()}}),e,null,[[6,18,22,30],[23,,25,29]])}))),function(e){return t.apply(this,arguments)})}),this.application.streamItems({contentType:w.ContentTypes.Component,stream:(n=_()(x.a.mark((function e(t){var n,i;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.items,t.source,r.state.note){e.next=3;break}return e.abrupt("return");case 3:if(r.reloadComponentStackArray(),0!==n.filter((function(e){return e.isEditor()})).length){e.next=7;break}return e.abrupt("return");case 7:i=r.editorForNote(r.state.note),r.setState({selectedEditor:i}),i||r.reloadFont();case 10:case"end":return e.stop()}}),e)}))),function(e){return n.apply(this,arguments)})})}},{key:"handleNoteSelectionChange",value:(o=_()(x.a.mark((function e(t,n){var r;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.setState({note:this.appState.getSelectedNote(),showExtensions:!1,showOptionsMenu:!1,altKeyDown:!1,noteStatus:null}),t){e.next=4;break}return this.setState({noteReady:!1}),e.abrupt("return");case 4:return(r=this.editorForNote(t))&&r!==this.state.selectedEditor?this.setState({noteReady:!1,selectedEditor:r}):r||this.setState({selectedEditor:null}),e.next=8,this.setState({noteReady:!0});case 8:this.reloadTagsString(),this.reloadPreferences(),t.dummy&&this.focusEditor(),n&&n!==t&&n.dummy&&this.performNoteDeletion(n),this.reloadComponentContext();case 13:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"addSyncStatusObserver",value:function(){}},{key:"editorForNote",value:function(e){return this.application.componentManager.editorForNote(e)}},{key:"setMenuState",value:function(e,t){this.setState(Q()({},e,t)),this.closeAllMenus({exclude:e})}},{key:"toggleMenu",value:function(e){this.setMenuState(e,!this.state[e])}},{key:"closeAllMenus",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.exclude,n=["showOptionsMenu","showEditorMenu","showExtensions","showSessionHistory"],r={},i=0,a=n;i<a.length;i++){var o=a[i];o!==t&&(r[o]=!1)}this.setState(r)}},{key:"hasAvailableExtensions",value:function(){return this.application.actionsManager.extensionsInContextOfItem(this.state.note).length>0}},{key:"performFirefoxPinnedTabFix",value:function(){document.hidden&&window.location.reload()}},{key:"saveNote",value:function(e){var t=this,n=e.bypassDebouncer,r=e.updateClientModified,i=e.dontUpdatePreviews;this.performFirefoxPinnedTabFix();var a=this.state.note;if(a.dummy=!1,a.deleted)this.application.alertService.alert({text:"The note you are attempting to edit has been deleted, and is awaiting sync. Changes you make will be disregarded."});else if(this.application.findItem({uuid:a.uuid})){if(this.showSavingStatus(),!i){var o=a.text||"",s=o.length>80,c=o.substring(0,80)+(s?"...":"");a.content.preview_plain=c,a.content.preview_html=null}this.application.setItemNeedsSync({item:a,updateUserModifiedDate:r}),this.saveTimeout&&this.$timeout.cancel(this.saveTimeout);var u=n||this.application.noAccount()?100:350;this.saveTimeout=this.$timeout((function(){t.application.sync()}),u)}else this.application.alertService.alert({text:"The note you are attempting to save can not be found or has been deleted. Changes you make will not be synced. Please copy this note's text and start a new note."})}},{key:"showSavingStatus",value:function(){this.setStatus({message:"Saving..."},!1)}},{key:"showAllChangesSavedStatus",value:function(){this.setState({saveError:!1,syncTakingTooLong:!1});var e="All changes saved";this.application.noAccount()&&(e+=" (offline)"),this.setStatus({message:e})}},{key:"showErrorStatus",value:function(e){e||(e={message:"Sync Unreachable",desc:"Changes saved offline"}),this.setState({saveError:!0,syncTakingTooLong:!1}),this.setStatus(e)}},{key:"setStatus",value:function(e){var t,n=this,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t=this.state.noteStatus&&this.state.noteStatus.date?400-(new Date-this.state.noteStatus.date):0,(!r||t<0)&&(t=0),this.statusTimeout&&this.$timeout.cancel(this.statusTimeout),this.statusTimeout=this.$timeout((function(){e.date=new Date,n.setState({noteStatus:e})}),t)}},{key:"contentChanged",value:function(){this.saveNote({updateClientModified:!0})}},{key:"onTitleEnter",value:function(e){e.target.blur(),this.onTitleChange(),this.focusEditor()}},{key:"onTitleChange",value:function(){this.saveNote({dontUpdatePreviews:!0,updateClientModified:!0})}},{key:"focusEditor",value:function(){var e=document.getElementById(Me);e&&(this.lastEditorFocusEventSource=z,e.focus())}},{key:"focusTitle",value:function(){document.getElementById(Te).focus()}},{key:"clickedTextArea",value:function(){this.setMenuState("showOptionsMenu",!1)}},{key:"onNameFocus",value:function(){this.editingName=!0}},{key:"onContentFocus",value:function(){this.appState.editorDidFocus(this.lastEditorFocusEventSource),this.lastEditorFocusEventSource=null}},{key:"onNameBlur",value:function(){this.editingName=!1}},{key:"selectedMenuItem",value:function(e){e&&this.setMenuState("showOptionsMenu",!1)}},{key:"deleteNote",value:(i=_()(x.a.mark((function e(t){var n,r=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.state.note.dummy){e.next=3;break}return this.application.alertService.alert({text:"This note is a placeholder and cannot be deleted. To remove from your list, simply navigate to a different note."}),e.abrupt("return");case 3:return n=function(){if(r.state.note.locked)r.application.alertService.alert({text:"This note is locked. If you'd like to delete it, unlock it, and try again."});else{var e=le({title:r.state.note.safeTitle().length?"'".concat(r.state.note.title,"'"):"this note",permanently:t});r.application.alertService.confirm({text:e,destructive:!0,onConfirm:function(){t?r.performNoteDeletion(r.state.note):(r.state.note.content.trashed=!0,r.saveNote({bypassDebouncer:!0,dontUpdatePreviews:!0})),r.appState.setSelectedNote(null),r.setMenuState("showOptionsMenu",!1)}})}},e.next=6,this.application.privilegesService.actionRequiresPrivilege(w.ProtectedActions.DeleteNote);case 6:e.sent?this.godService.presentPrivilegesModal(w.ProtectedActions.DeleteNote,(function(){n()})):n();case 8:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"performNoteDeletion",value:function(e){this.application.deleteItem({item:e}),e===this.state.note&&this.setState({note:null}),e.dummy?this.application.deleteItemLocally({item:e}):this.application.sync()}},{key:"restoreTrashedNote",value:function(){this.state.note.content.trashed=!1,this.saveNote({bypassDebouncer:!0,dontUpdatePreviews:!0}),this.appState.setSelectedNote(null)}},{key:"deleteNotePermanantely",value:function(){this.deleteNote(!0)}},{key:"getTrashCount",value:function(){return this.application.getTrashedItems().length}},{key:"emptyTrash",value:function(){var e=this,t=this.getTrashCount();this.application.alertService.confirm({text:fe({count:t}),destructive:!0,onConfirm:function(){e.application.emptyTrash(),e.application.sync()}})}},{key:"togglePin",value:function(){this.state.note.setAppDataItem(Ae,!this.state.note.pinned),this.saveNote({bypassDebouncer:!0,dontUpdatePreviews:!0})}},{key:"toggleLockNote",value:function(){this.state.note.setAppDataItem(Ie,!this.state.note.locked),this.saveNote({bypassDebouncer:!0,dontUpdatePreviews:!0})}},{key:"toggleProtectNote",value:function(){var e=this;this.state.note.content.protected=!this.state.note.content.protected,this.saveNote({bypassDebouncer:!0,dontUpdatePreviews:!0}),this.application.privilegesService.actionHasPrivilegesConfigured(w.ProtectedActions.ViewProtectedNotes).then((function(t){t||e.godService.presentPrivilegesManagementModal()}))}},{key:"toggleNotePreview",value:function(){this.state.note.content.hidePreview=!this.state.note.content.hidePreview,this.saveNote({bypassDebouncer:!0,dontUpdatePreviews:!0})}},{key:"toggleArchiveNote",value:function(){this.state.note.setAppDataItem(je,!this.state.note.archived),this.saveNote({bypassDebouncer:!0,dontUpdatePreviews:!0})}},{key:"reloadTagsString",value:function(){this.setState({mutable:Ee({},this.state.mutable,{tagsString:this.state.note.tagsString()})})}},{key:"addTag",value:function(e){var t=this.state.note.tags.map((function(e){return e.title}));t.push(e.title),this.saveTags({strings:t})}},{key:"removeTag",value:function(e){var t=this.state.note.tags.map((function(e){return e.title})).filter((function(t){return t!==e.title}));this.saveTags({strings:t})}},{key:"saveTags",value:(r=_()(x.a.mark((function e(){var t,n,r,i,a,o,s,c,u,l,f,p,h,d,v,y,m,g,b,w,k=arguments;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=k.length>0&&void 0!==k[0]?k[0]:{},(n=t.strings)||this.state.mutable.tagsString!==this.state.note.tagsString()){e.next=3;break}return e.abrupt("return");case 3:for(n||(n=this.state.mutable.tagsString.split("#").filter((function(e){return e.length>0})).map((function(e){return e.trim()}))),this.state.note.dummy=!1,r=[],i=!0,a=!1,o=void 0,e.prev=9,s=this.state.note.tags[Symbol.iterator]();!(i=(c=s.next()).done);i=!0)u=c.value,-1===n.indexOf(u.title)&&r.push(u);e.next=17;break;case 13:e.prev=13,e.t0=e.catch(9),a=!0,o=e.t0;case 17:e.prev=17,e.prev=18,i||null==s.return||s.return();case 20:if(e.prev=20,!a){e.next=23;break}throw o;case 23:return e.finish(20);case 24:return e.finish(17);case 25:for(l=0,f=r;l<f.length;l++)f[l].removeItemAsRelationship(this.state.note);this.application.setItemsNeedsSync({items:r}),p=[],h=!0,d=!1,v=void 0,e.prev=31,y=n[Symbol.iterator]();case 33:if(h=(m=y.next()).done){e.next=45;break}if(g=m.value,X()(this.state.note.tags,{title:g})){e.next=42;break}return e.t1=p,e.next=40,this.application.findOrCreateTag({title:g});case 40:e.t2=e.sent,e.t1.push.call(e.t1,e.t2);case 42:h=!0,e.next=33;break;case 45:e.next=51;break;case 47:e.prev=47,e.t3=e.catch(31),d=!0,v=e.t3;case 51:e.prev=51,e.prev=52,h||null==y.return||y.return();case 54:if(e.prev=54,!d){e.next=57;break}throw v;case 57:return e.finish(54);case 58:return e.finish(51);case 59:for(b=0,w=p;b<w.length;b++)w[b].addItemAsRelationship(this.state.note);this.application.saveItems({items:p}),this.reloadTagsString();case 62:case"end":return e.stop()}}),e,this,[[9,13,17,25],[18,,20,24],[31,47,51,59],[52,,54,58]])}))),function(){return r.apply(this,arguments)})},{key:"reloadPreferences",value:function(){var e=this.preferencesManager.getValue(me,!0),t=this.preferencesManager.getValue(ge,!0),n=this.preferencesManager.getValue(be,!0);if(this.setState({monospaceEnabled:e,spellcheck:t,marginResizersEnabled:n}),document.getElementById(Re)&&(this.reloadFont(),this.state.marginResizersEnabled&&this.leftPanelPuppet.ready&&this.rightPanelPuppet.ready)){var r=this.preferencesManager.getValue(ve,null);null!=r&&(this.leftPanelPuppet.setWidth(r),this.rightPanelPuppet.setWidth(r));var i=this.preferencesManager.getValue(ye,null);null!=i&&(this.leftPanelPuppet.setLeft(i),this.rightPanelPuppet.setLeft(i))}}},{key:"reloadFont",value:function(){var e=document.getElementById(Me);e&&(this.state.monospaceEnabled?this.state.isDesktop?e.style.fontFamily=Ne:e.style.fontFamily=Fe:e.style.fontFamily=Ue)}},{key:"toggleKey",value:(n=_()(x.a.mark((function e(t){var n=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this[t]=!this[t],this.preferencesManager.setUserPrefValue(t,this[t],!0),this.reloadFont(),t!==ge){e.next=10;break}return e.next=6,this.setState({noteReady:!1});case 6:this.setState({noteReady:!0}),this.reloadFont(),e.next=11;break;case 10:t===be&&!0===this[t]&&this.$timeout((function(){n.leftPanelPuppet.flash(),n.rightPanelPuppet.flash()}));case 11:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"registerComponentHandler",value:function(){var e=this;this.application.componentManager.registerHandler({identifier:"editor",areas:["note-tags","editor-stack","editor-editor"],activationHandler:function(t){if("note-tags"===t.area)e.setState({tagsComponent:t.active?t:null});else if("editor-editor"===t.area)if(t!==e.state.selectedEditor||t.active){if(e.state.selectedEditor)e.state.selectedEditor.active&&e.state.note&&t.isExplicitlyEnabledForItem(e.state.note)&&!e.state.selectedEditor.isExplicitlyEnabledForItem(e.state.note)&&e.setState({selectedEditor:t});else if(e.state.note){var n=t.isExplicitlyEnabledForItem(e.state.note)||t.isDefaultEditor();t.active&&n?e.setState({selectedEditor:t}):e.setState({selectedEditor:null})}}else e.setState({selectedEditor:null});else"editor-stack"===t.area&&e.reloadComponentContext()},contextRequestHandler:function(t){if(t===e.state.selectedEditor||t===e.state.tagsComponent||e.state.componentStack.includes(t))return e.state.note},focusHandler:function(t,n){t.isEditor()&&n&&e.closeAllMenus()},actionHandler:function(t,n,r){if("set-size"===n){if("container"===r.type&&"note-tags"===t.area){var i=document.getElementById(Le);s=i,u="string"==typeof(c=r).width?c.width:"".concat(r.width,"px"),l="string"==typeof c.height?c.height:"".concat(r.height,"px"),s.setAttribute("style","width: ".concat(u,"; height: ").concat(l,";"))}}else if("associate-item"===n){if("Tag"===r.item.content_type){var a=e.application.findItem({uuid:r.item.uuid});e.addTag(a)}}else if("deassociate-item"===n){var o=e.application.findItem({uuid:r.item.uuid});e.removeTag(o)}else if("save-items"===n){r.items.map((function(e){return e.uuid})).includes(e.state.note.uuid)&&e.showSavingStatus()}var s,c,u,l}})}},{key:"reloadComponentStackArray",value:function(){var e=this.application.componentManager.componentsForArea("editor-stack").sort((function(e,t){return e.name.toLowerCase()<t.name.toLowerCase()?-1:1}));this.setState({componentStack:e})}},{key:"reloadComponentContext",value:function(){if(this.reloadComponentStackArray(),this.state.note){var e=!0,t=!1,n=void 0;try{for(var r,i=this.state.componentStack[Symbol.iterator]();!(e=(r=i.next()).done);e=!0){var a=r.value;a.active&&this.application.componentManager.setComponentHidden(a,!a.isExplicitlyEnabledForItem(this.state.note))}}catch(e){t=!0,n=e}finally{try{e||null==i.return||i.return()}finally{if(t)throw n}}}this.application.componentManager.contextItemDidChangeInArea("note-tags"),this.application.componentManager.contextItemDidChangeInArea("editor-stack"),this.application.componentManager.contextItemDidChangeInArea("editor-editor")}},{key:"toggleStackComponentForCurrentItem",value:function(e){e.hidden||!e.active?(this.application.componentManager.setComponentHidden(e,!1),this.associateComponentWithCurrentNote(e),e.active||this.application.componentManager.activateComponent(e),this.application.componentManager.contextItemDidChangeInArea("editor-stack")):(this.application.componentManager.setComponentHidden(e,!0),this.disassociateComponentWithCurrentNote(e))}},{key:"disassociateComponentWithCurrentNote",value:function(e){var t=this;e.associatedItemIds=e.associatedItemIds.filter((function(e){return e!==t.state.note.uuid})),e.disassociatedItemIds.includes(this.state.note.uuid)||e.disassociatedItemIds.push(this.state.note.uuid),this.application.saveItem({item:e})}},{key:"associateComponentWithCurrentNote",value:function(e){var t=this;e.disassociatedItemIds=e.disassociatedItemIds.filter((function(e){return e!==t.state.note.uuid})),e.associatedItemIds.includes(this.state.note.uuid)||e.associatedItemIds.push(this.state.note.uuid),this.application.saveItem({item:e})}},{key:"registerKeyboardShortcuts",value:function(){var e=this;this.altKeyObserver=this.keyboardManager.addKeyObserver({modifiers:[ie.Alt],onKeyDown:function(){e.setState({altKeyDown:!0})},onKeyUp:function(){e.setState({altKeyDown:!1})}}),this.trashKeyObserver=this.keyboardManager.addKeyObserver({key:te,notElementIds:[Me,Te],modifiers:[ie.Meta],onKeyDown:function(){e.deleteNote()}}),this.deleteKeyObserver=this.keyboardManager.addKeyObserver({key:te,modifiers:[ie.Meta,ie.Shift,ie.Alt],onKeyDown:function(t){t.preventDefault(),e.deleteNote(!0)}})}},{key:"onSystemEditorLoad",value:function(){var e=this;if(!this.loadedTabListener){this.loadedTabListener=!0;var t=document.getElementById(Me);this.tabObserver=this.keyboardManager.addKeyObserver({element:t,key:ee,onKeyDown:function(n){if(!e.state.note.locked&&!n.shiftKey){if(n.preventDefault(),!document.execCommand("insertText",!1,"\t")){var r=t.selectionStart,i=t.selectionEnd;t.value=t.value.substring(0,r)+" "+t.value.substring(i),t.selectionStart=t.selectionEnd=r+4}var a=e.state.note;a.text=t.value,e.setState({note:a}),e.saveNote({bypassDebouncer:!0})}}}),a.a.element(t).on("$destroy",(function(){e.tabObserver&&(e.keyboardManager.removeKeyObserver(e.tabObserver),e.loadedTabListener=!1)}))}}}]),t}(q),Ve=function e(){f()(this,e),this.restrict="E",this.scope={},this.template=ue.a,this.replace=!0,this.controller=Ke,this.controllerAs="self",this.bindToController=!0},Be=n(60),He=n.n(Be),ze=function(e){function t(e,n,r,i,a,o,s,c){var u;return f()(this,t),u=h()(this,v()(t).call(this,e,r,i,a)),Q()(m()(u),"toggleSyncResolutionMenu",(function(){u.showSyncResolution=!u.showSyncResolution})),Q()(m()(u),"closeAccountMenu",(function(){u.showAccountMenu=!1})),u.$rootScope=n,u.nativeExtManager=o,u.statusManager=s,u.godService=c,u.state={hasPasscode:!1},u.rooms=[],u.themesWithIcons=[],u.showSyncResolution=!1,u.addRootScopeListeners(),u.statusManager.addStatusObserver((function(e){u.$timeout((function(){u.arbitraryStatusMessage=e}))})),u}var n;return t.$inject=["$scope","$rootScope","$timeout","application","appState","nativeExtManager","statusManager","godService"],b()(t,e),P()(t,[{key:"onAppLaunch",value:function(){var e=this;Y()(v()(t.prototype),"onAppLaunch",this).call(this);var n=this.application.hasPasscode();this.setState({hasPasscode:n}),this.godService.checkForSecurityUpdate().then((function(t){e.securityUpdateAvailable=t})),this.user=this.application.getUser(),this.updateOfflineStatus(),this.findErrors(),this.streamItems(),this.registerComponentHandler()}},{key:"addRootScopeListeners",value:function(){var e=this;this.$rootScope.$on("security-update-status-changed",(function(){e.securityUpdateAvailable=e.godService.securityUpdateAvailable})),this.$rootScope.$on("reload-ext-data",(function(){e.reloadExtendedData()})),this.$rootScope.$on("new-update-available",(function(){e.$timeout((function(){e.onNewUpdateAvailable()}))}))}},{key:"onAppStateEvent",value:function(e,t){var n=this;e===N?t.eventSource===H&&(this.closeAllRooms(),this.closeAccountMenu()):e===F?this.backupStatus=this.statusManager.addStatusFromString("Saving local backup..."):e===U&&(t.success?this.backupStatus=this.statusManager.replaceStatusWithString(this.backupStatus,"Successfully saved backup."):this.backupStatus=this.statusManager.replaceStatusWithString(this.backupStatus,"Unable to save local backup."),this.$timeout((function(){n.backupStatus=n.statusManager.removeStatus(n.backupStatus)}),2e3))}},{key:"onAppEvent",value:function(e){e===w.ApplicationEvents.EnteredOutOfSync?this.setState({outOfSync:!0}):e===w.ApplicationEvents.ExitedOutOfSync?this.setState({outOfSync:!1}):e===w.ApplicationEvents.CompletedSync?(this.offline&&0===this.application.getNoteCount()&&(this.showAccountMenu=!0),this.syncUpdated(),this.findErrors(),this.updateOfflineStatus()):e===w.ApplicationEvents.FailedSync&&(this.findErrors(),this.updateOfflineStatus())}},{key:"streamItems",value:function(){var e,t,n=this;this.application.streamItems({contentType:w.ContentTypes.Component,stream:(e=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n.rooms=n.application.getItems({contentType:w.ContentTypes.Component}).filter((function(e){return"rooms"===e.area&&!e.deleted})),n.queueExtReload&&(n.queueExtReload=!1,n.reloadExtendedData());case 2:case"end":return e.stop()}}),e)}))),function(){return e.apply(this,arguments)})}),this.application.streamItems({contentType:"SN|Theme",stream:(t=_()(x.a.mark((function e(){var t,r;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=n.application.getDisplayableItems({contentType:w.ContentTypes.Theme}).filter((function(e){return!e.deleted&&e.content.package_info&&e.content.package_info.dock_icon})).sort((function(e,t){return e.name.toLowerCase()<t.name.toLowerCase()?-1:1})),r=t.length!==n.themesWithIcons.length,n.themesWithIcons=t,r&&n.reloadDockShortcuts();case 4:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})})}},{key:"registerComponentHandler",value:function(){var e=this;this.application.componentManager.registerHandler({identifier:"roomBar",areas:["rooms","modal"],activationHandler:function(e){},actionHandler:function(e,t,n){"set-size"===t&&e.setLastSize(n)},focusHandler:function(t,n){t.isEditor()&&n&&(e.closeAllRooms(),e.closeAccountMenu())}})}},{key:"reloadExtendedData",value:function(){var e=this;if(!this.reloadInProgress){this.reloadInProgress=!0;var t=this.rooms.find((function(t){return t.package_info.identifier===e.nativeExtManager.extManagerId}));if(!t)return this.queueExtReload=!0,void(this.reloadInProgress=!1);this.selectRoom(t),this.$timeout((function(){e.selectRoom(t),e.reloadInProgress=!1,e.$rootScope.$broadcast("ext-reload-complete")}),2e3)}}},{key:"updateOfflineStatus",value:function(){this.offline=this.application.noAccount()}},{key:"openSecurityUpdate",value:function(){this.godService.presentPasswordWizard("upgrade-security")}},{key:"findErrors",value:function(){this.error=this.application.getSyncStatus().error}},{key:"accountMenuPressed",value:function(){this.showAccountMenu=!this.showAccountMenu,this.closeAllRooms()}},{key:"lockApp",value:function(){this.application.lock()}},{key:"refreshData",value:function(){var e=this;this.isRefreshing=!0,this.application.sync({timingStrategy:w.TIMING_STRATEGY_FORCE_SPAWN_NEW,checkIntegrity:!0}).then((function(t){e.$timeout((function(){e.isRefreshing=!1}),200),t&&t.error?e.application.alertService.alert({text:"There was an error syncing. Please try again. If all else fails, try signing out and signing back in."}):e.syncUpdated()}))}},{key:"syncUpdated",value:function(){this.lastSyncDate=function(e){if("undefined"!=typeof Intl&&Intl.DateTimeFormat){if(!r){var t=navigator.languages&&navigator.languages.length?navigator.languages[0]:navigator.language;r=new Intl.DateTimeFormat(t,{year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit"})}return r.format(e)}return e.toDateString()+" "+e.toLocaleTimeString()}(new Date)}},{key:"onNewUpdateAvailable",value:function(){this.newUpdateAvailable=!0}},{key:"clickedNewUpdateAnnouncement",value:function(){this.newUpdateAvailable=!1,this.application.alertService.alert({text:"A new update is ready to install. Please use the top-level 'Updates' menu to manage installation."})}},{key:"reloadDockShortcuts",value:function(){var e=[],t=!0,n=!1,r=void 0;try{for(var i,a=this.themesWithIcons[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){var o=i.value,s=o.content.package_info.name,c=o.content.package_info.dock_icon;c&&e.push({name:s,component:o,icon:c})}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}this.dockShortcuts=e.sort((function(e,t){var n=e.icon.type,r=t.icon.type;return n===r?0:"circle"===n&&"svg"===r?-1:"circle"===r&&"svg"===n?1:void 0}))}},{key:"initSvgForShortcut",value:function(e){var t="dock-svg-"+e.component.uuid,n=document.getElementById(t),r=new DOMParser,i=e.component.content.package_info.dock_icon.source,a=r.parseFromString(i,"image/svg+xml");n.appendChild(a.documentElement)}},{key:"selectShortcut",value:function(e){this.application.componentManager.toggleComponent(e.component)}},{key:"onRoomDismiss",value:function(e){e.showRoom=!1}},{key:"closeAllRooms",value:function(){var e=!0,t=!1,n=void 0;try{for(var r,i=this.rooms[Symbol.iterator]();!(e=(r=i.next()).done);e=!0){r.value.showRoom=!1}}catch(e){t=!0,n=e}finally{try{e||null==i.return||i.return()}finally{if(t)throw n}}}},{key:"selectRoom",value:(n=_()(x.a.mark((function e(t){var n,r=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=function(){r.$timeout((function(){t.showRoom=!t.showRoom}))},t.showRoom){e.next=8;break}return e.next=4,this.application.privilegesService.actionRequiresPrivilege(w.ProtectedActions.ManageExtensions);case 4:e.sent?this.godService.presentPrivilegesModal(w.ProtectedActions.ManageExtensions,n):n(),e.next=9;break;case 8:n();case 9:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"clickOutsideAccountMenu",value:function(){this.godService.authenticationInProgress()||(this.showAccountMenu=!1)}}]),t}(q),We=function e(){f()(this,e),this.restrict="E",this.scope={},this.template=He.a,this.controller=ze,this.replace=!0,this.controllerAs="ctrl",this.bindToController=!0},qe=n(14),Ge=n.n(qe),Ye=n(61),Je=n.n(Ye);function Qe(e){var t=e.notes,n=e.selectedTag,r=e.showArchived,i=e.hidePinned,a=e.filterText,o=e.sortBy,s=e.reverse;return function(e){var t=e.notes,n=void 0===t?[]:t,r=e.sortBy,i=e.reverse;return n.sort((function(e,t){return function e(t,n){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t.dummy)return-1;if(n.dummy)return 1;if(!a){if(t.pinned&&n.pinned)return e(t,n,!0);if(t.pinned)return-1;if(n.pinned)return 1}var o=t[r]||"",s=n[r]||"",c=1;if(i&&(c*=-1),"title"===r){if(o=o.toLowerCase(),s=s.toLowerCase(),0===o.length&&0===s.length)return 0;if(0===o.length&&0!==s.length)return 1*c;if(0!==o.length&&0===s.length)return-1*c;c*=-1}return o>s?-1*c:o<s?1*c:0}(e,t)}))}({notes:function(e){var t=e.notes,n=e.selectedTag,r=e.showArchived,i=e.hidePinned,a=e.filterText;return t.filter((function(e){var t=r,o=!i,s=n.content.isTrashTag;return!(!s&&e.content.trashed)&&(n.isSmartTag()&&(t=t||n.content.isArchiveTag||s),!(e.archived&&!t||e.pinned&&!o)&&function(e){var t=e.note,n=e.query;if(0===n.length)return!0;var r=t.safeTitle().toLowerCase(),i=t.safeText().toLowerCase(),a=n.toLowerCase(),o=function(e){var t=e.match(/"(.*?)"/);return t?t[1]:null}(a);if(o)return r.includes(o)||i.includes(o);if(function(e){return!!e.match(/\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b/)}(a))return t.uuid===a;var s=a.split(" "),c=s.every((function(e){return r.indexOf(e)>=0})),u=s.every((function(e){return i.indexOf(e)>=0}));return c||u}({note:e,query:a}))}))}({notes:t,selectedTag:n,showArchived:r,hidePinned:i,filterText:a}),sortBy:o,reverse:s})}function Ze(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Xe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ze(Object(n),!0).forEach((function(t){Q()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ze(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var et=function(e){function t(e,n,r,i,o,s,c,u){var l;return f()(this,t),l=h()(this,v()(t).call(this,e,n,i,o)),Q()(m()(l),"onPanelResize",(function(e,t,n,r){l.preferencesManager.setUserPrefValue(de,e),l.preferencesManager.syncUserPreferences(),l.appState.panelDidResize({name:"notes",collapsed:r})})),l.$rootScope=r,l.application=i,l.appState=o,l.desktopManager=s,l.keyboardManager=c,l.preferencesManager=u,l.state={notes:[],renderedNotes:[],selectedNote:null,tag:null,sortBy:null,showArchived:null,hidePinned:null,sortReverse:null,panelTitle:null,mutable:{showMenu:!1},noteFilter:{text:""}},l.panelPuppet={onReady:function(){return l.reloadPreferences()}},window.onresize=function(e){l.resetPagination({keepCurrentIfLarger:!0})},l.resetPagination(),l.registerKeyboardShortcuts(),a.a.element(document).ready((function(){l.reloadPreferences()})),l}var n,r,i,o,s,c,u,l,p;return t.$inject=["$scope","$timeout","$rootScope","application","appState","desktopManager","keyboardManager","preferencesManager"],b()(t,e),P()(t,[{key:"onAppLaunch",value:function(){Y()(v()(t.prototype),"onAppLaunch",this).call(this),this.streamNotesAndTags(),this.reloadPreferences()}},{key:"onAppStateEvent",value:function(e,t){e===M?this.handleTagChange(this.appState.getSelectedTag(),t.previousTag):e===T?this.handleNoteSelection(this.appState.getSelectedNote()):e===R?(this.reloadPreferences(),this.reloadNotes()):e===N&&this.setShowMenuFalse()}},{key:"onAppEvent",value:function(e){var t=this;e===w.ApplicationEvents.SignedIn?this.state.selectedNote&&this.state.selectedNote.dummy&&(this.application.deleteItemLocally({item:this.state.selectedNote}),this.selectNote(null).then((function(){t.reloadNotes()})),this.createDummyOnSynCompletionIfNoNotes=!0):e===w.ApplicationEvents.CompletedSync&&(0===this.state.notes.length&&this.createNewNote(),this.createDummyOnSynCompletionIfNoNotes&&0===this.state.notes.length&&(this.createDummyOnSynCompletionIfNoNotes=!1,this.createNewNote()))}},{key:"streamNotesAndTags",value:function(){var e,t=this;this.application.streamItems({contentType:[w.ContentTypes.Note,w.ContentTypes.Tag],stream:(e=_()(x.a.mark((function e(n){var r,i,a,o,s,c,u,l,f;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.items,e.next=3,t.reloadNotes();case 3:for((i=t.state.selectedNote)?(i.deleted||i.content.trashed)&&t.selectNextOrCreateNew():t.selectFirstNote(),a=r.filter((function(e){return e.content_type===w.ContentTypes.Note})),o=!0,s=!1,c=void 0,e.prev=9,u=a[Symbol.iterator]();!(o=(l=u.next()).done);o=!0)f=l.value,t.loadFlagsForNote(f),f.cachedCreatedAtString=f.createdAtString(),f.cachedUpdatedAtString=f.updatedAtString();e.next=17;break;case 13:e.prev=13,e.t0=e.catch(9),s=!0,c=e.t0;case 17:e.prev=17,e.prev=18,o||null==u.return||u.return();case 20:if(e.prev=20,!s){e.next=23;break}throw c;case 23:return e.finish(20);case 24:return e.finish(17);case 25:case"end":return e.stop()}}),e,null,[[9,13,17,25],[18,,20,24]])}))),function(t){return e.apply(this,arguments)})})}},{key:"handleTagChange",value:(p=_()(x.a.mark((function e(t,n){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.state.selectedNote||!this.state.selectedNote.dummy){e.next=5;break}return this.application.deleteItemLocally({item:this.state.selectedNote}),n&&Ge.a.remove(n.notes,this.state.selectedNote),e.next=5,this.selectNote(null);case 5:return e.next=7,this.setState({tag:t});case 7:return this.resetScrollPosition(),this.setShowMenuFalse(),e.next=11,this.setNoteFilterText("");case 11:return this.desktopManager.searchText(),this.resetPagination(),e.next=15,this.reloadNotes();case 15:this.state.notes.length>0?this.selectFirstNote():this.application.isDatabaseLoaded()&&(!t.isSmartTag()||t.content.isAllTag?this.createNewNote():this.state.selectedNote&&!this.state.notes.includes(this.state.selectedNote)&&this.selectNote(null));case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"resetScrollPosition",value:function(){var e=document.getElementById("notes-scrollable");e&&(e.scrollTop=0,e.scrollLeft=0)}},{key:"selectNote",value:(l=_()(x.a.mark((function e(t){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.appState.setSelectedNote(t);case 1:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"removeNoteFromList",value:(u=_()(x.a.mark((function e(t){var n;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.state.notes,Ge.a.pull(n,t),e.next=4,this.setState({notes:n,renderedNotes:n.slice(0,this.notesToDisplay)});case 4:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"reloadNotes",value:(c=_()(x.a.mark((function e(){var t,n,r,i,a,o,s;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.state.tag){e.next=2;break}return e.abrupt("return");case 2:for(t=Qe({notes:this.state.tag.notes,selectedTag:this.state.tag,showArchived:this.state.showArchived,hidePinned:this.state.hidePinned,filterText:this.state.noteFilter.text.toLowerCase(),sortBy:this.state.sortBy,reverse:this.state.sortReverse}),n=!0,r=!1,i=void 0,e.prev=6,a=t[Symbol.iterator]();!(n=(o=a.next()).done);n=!0)(s=o.value).errorDecrypting&&this.loadFlagsForNote(s),s.shouldShowTags=this.shouldShowTagsForNote(s);e.next=14;break;case 10:e.prev=10,e.t0=e.catch(6),r=!0,i=e.t0;case 14:e.prev=14,e.prev=15,n||null==a.return||a.return();case 17:if(e.prev=17,!r){e.next=20;break}throw i;case 20:return e.finish(17);case 21:return e.finish(14);case 22:return e.next=24,this.setState({notes:t,renderedNotes:t.slice(0,this.notesToDisplay)});case 24:this.reloadPanelTitle();case 25:case"end":return e.stop()}}),e,this,[[6,10,14,22],[15,,17,21]])}))),function(){return c.apply(this,arguments)})},{key:"setShowMenuFalse",value:function(){this.setState({mutable:Xe({},this.state.mutable,{showMenu:!1})})}},{key:"handleNoteSelection",value:(s=_()(x.a.mark((function e(t){var n;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.state.selectedNote!==t){e.next=2;break}return e.abrupt("return");case 2:return(n=this.state.selectedNote)&&n.dummy&&(this.application.deleteItemLocally({item:n}),this.removeNoteFromList(n)),e.next=6,this.setState({selectedNote:t});case 6:if(t){e.next=8;break}return e.abrupt("return");case 8:this.selectedIndex=Math.max(0,this.displayableNotes().indexOf(t)),t.content.conflict_of&&(t.content.conflict_of=null,this.application.saveItem({item:t})),this.isFiltering()&&this.desktopManager.searchText(this.state.noteFilter.text);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"reloadPreferences",value:function(){var e={},t=this.state.sortBy,n=this.preferencesManager.getValue(we,"created_at");"updated_at"===n&&(n="client_updated_at"),e.sortBy=n,e.sortReverse=this.preferencesManager.getValue(ke,!1),e.showArchived=this.preferencesManager.getValue(xe,!1),e.hidePinned=this.preferencesManager.getValue(Se,!1),e.hideNotePreview=this.preferencesManager.getValue(_e,!1),e.hideDate=this.preferencesManager.getValue($e,!1),e.hideTags=this.preferencesManager.getValue(Pe,!1),this.setState(Xe({},e)),t&&t!==n&&this.selectFirstNote();var r=this.preferencesManager.getValue(de);r&&this.panelPuppet.ready&&(this.panelPuppet.setWidth(r),this.panelPuppet.isCollapsed()&&this.appState.panelDidResize({name:"notes",collapsed:this.panelPuppet.isCollapsed()}))}},{key:"paginate",value:function(){this.notesToDisplay+=this.pageSize,this.reloadNotes(),this.searchSubmitted&&this.desktopManager.searchText(this.state.noteFilter.text)}},{key:"resetPagination",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.keepCurrentIfLarger,n=document.documentElement.clientHeight;this.pageSize=Math.ceil(n/51),0===this.pageSize&&(this.pageSize=20),t&&this.notesToDisplay>this.pageSize||(this.notesToDisplay=this.pageSize)}},{key:"reloadPanelTitle",value:function(){var e;if(this.isFiltering()){var t=this.state.notes.length;e="".concat(t," search results")}else this.state.tag&&(e="".concat(this.state.tag.title));this.setState({panelTitle:e})}},{key:"optionsSubtitle",value:function(){var e="";return"created_at"===this.state.sortBy?e+=" Date Added":"client_updated_at"===this.state.sortBy?e+=" Date Modified":"title"===this.state.sortBy&&(e+=" Title"),this.state.showArchived&&(e+=" | + Archived"),this.state.hidePinned&&(e+=" | Pinned"),this.state.sortReverse&&(e+=" | Reversed"),e}},{key:"loadFlagsForNote",value:function(e){var t=[];return e.pinned&&t.push({text:"Pinned",class:"info"}),e.archived&&t.push({text:"Archived",class:"warning"}),e.content.protected&&t.push({text:"Protected",class:"success"}),e.locked&&t.push({text:"Locked",class:"neutral"}),e.content.trashed&&t.push({text:"Deleted",class:"danger"}),e.content.conflict_of&&t.push({text:"Conflicted Copy",class:"danger"}),e.errorDecrypting&&(e.waitingForKeys?t.push({text:"Waiting For Keys",class:"info"}):t.push({text:"Missing Keys",class:"danger"})),e.deleted&&t.push({text:"Deletion Pending Sync",class:"danger"}),e.flags=t,t}},{key:"displayableNotes",value:function(){return this.state.notes}},{key:"getFirstNonProtectedNote",value:function(){for(var e=this.displayableNotes(),t=0,n=e[t];n&&n.content.protected&&!(++t>=e.length);)n=e[t];return n}},{key:"selectFirstNote",value:function(){var e=this.getFirstNonProtectedNote();e&&this.selectNote(e)}},{key:"selectNextNote",value:function(){var e=this.displayableNotes(),t=e.indexOf(this.state.selectedNote);t+1<e.length&&this.selectNote(e[t+1])}},{key:"selectNextOrCreateNew",value:function(){var e=this.getFirstNonProtectedNote();e?this.selectNote(e):this.state.tag&&this.state.tag.isSmartTag()?this.selectNote(null):this.createNewNote()}},{key:"selectPreviousNote",value:function(){var e=this.displayableNotes(),t=e.indexOf(this.state.selectedNote);return t-1>=0&&(this.selectNote(e[t-1]),!0)}},{key:"createNewNote",value:(o=_()(x.a.mark((function e(){var t,n,r,i;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.appState.getSelectedTag()){e.next=3;break}throw"Attempting to create note with no selected tag";case 3:if(r=!0,!this.isFiltering()){e.next=9;break}n=this.state.noteFilter.text,r=!1,e.next=14;break;case 9:if(!this.state.selectedNote||!this.state.selectedNote.dummy){e.next=13;break}return e.abrupt("return");case 13:n="Note ".concat(this.state.notes.length+1);case 14:return e.next=16,this.application.createItem({contentType:w.ContentTypes.Note,content:{text:"",title:n},add:!0});case 16:(i=e.sent).client_updated_at=new Date,i.dummy=r,this.application.setItemNeedsSync({item:i}),t.isSmartTag()||(t.addItemAsRelationship(i),this.application.setItemNeedsSync({item:t})),this.selectNote(i);case 22:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"isFiltering",value:function(){return this.state.noteFilter.text&&this.state.noteFilter.text.length>0}},{key:"setNoteFilterText",value:(i=_()(x.a.mark((function e(t){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setState({noteFilter:Xe({},this.state.noteFilter,{text:t})});case 2:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"clearFilterText",value:(r=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setNoteFilterText("");case 2:this.onFilterEnter(),this.filterTextChanged(),this.resetPagination();case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"filterTextChanged",value:(n=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.searchSubmitted&&(this.searchSubmitted=!1),e.next=3,this.reloadNotes();case 3:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"onFilterEnter",value:function(){this.searchSubmitted=!0,this.desktopManager.searchText(this.state.noteFilter.text)}},{key:"selectedMenuItem",value:function(){this.setShowMenuFalse()}},{key:"togglePrefKey",value:function(e){this.preferencesManager.setUserPrefValue(e,!this.state[e]),this.preferencesManager.syncUserPreferences()}},{key:"selectedSortByCreated",value:function(){this.setSortBy("created_at")}},{key:"selectedSortByUpdated",value:function(){this.setSortBy("client_updated_at")}},{key:"selectedSortByTitle",value:function(){this.setSortBy("title")}},{key:"toggleReverseSort",value:function(){this.selectedMenuItem(),this.preferencesManager.setUserPrefValue(ke,!this.state.sortReverse),this.preferencesManager.syncUserPreferences()}},{key:"setSortBy",value:function(e){this.preferencesManager.setUserPrefValue(we,e),this.preferencesManager.syncUserPreferences()}},{key:"shouldShowTagsForNote",value:function(e){return!this.state.hideTags&&!e.content.protected&&(this.state.tag.content.isAllTag?e.tags&&e.tags.length>0:!!this.state.tag.isSmartTag()||e.tags&&e.tags.length>1)}},{key:"getSearchBar",value:function(){return document.getElementById("search-bar")}},{key:"registerKeyboardShortcuts",value:function(){var e=this;this.newNoteKeyObserver=this.keyboardManager.addKeyObserver({key:"n",modifiers:[ie.Meta,ie.Ctrl],onKeyDown:function(t){t.preventDefault(),e.createNewNote()}}),this.nextNoteKeyObserver=this.keyboardManager.addKeyObserver({key:re,elements:[document.body,this.getSearchBar()],onKeyDown:function(t){var n=e.getSearchBar();n===document.activeElement&&n.blur(),e.selectNextNote()}}),this.nextNoteKeyObserver=this.keyboardManager.addKeyObserver({key:ne,element:document.body,onKeyDown:function(t){e.selectPreviousNote()}}),this.searchKeyObserver=this.keyboardManager.addKeyObserver({key:"f",modifiers:[ie.Meta,ie.Shift],onKeyDown:function(t){var n=e.getSearchBar();n&&n.focus()}})}}]),t}(q),tt=function e(){f()(this,e),this.scope={},this.template=Je.a,this.replace=!0,this.controller=et,this.controllerAs="self",this.bindToController=!0},nt=n(62),rt=n.n(nt),it=function(e){function t(e,n,r,i,a,o){var s;return f()(this,t),s=h()(this,v()(t).call(this,e,r,i,a)),Q()(m()(s),"onPanelResize",(function(e,t,n,r){s.preferencesManager.setUserPrefValue(he,e,!0),s.appState.panelDidResize({name:"tags",collapsed:r})})),s.$rootScope=n,s.preferencesManager=o,s.panelPuppet={onReady:function(){return s.loadPreferences()}},s.state={tags:[],smartTags:[],noteCounts:{}},s}var n,r,i,a;return t.$inject=["$scope","$rootScope","$timeout","application","appState","preferencesManager"],b()(t,e),P()(t,[{key:"onAppStart",value:function(){Y()(v()(t.prototype),"onAppStart",this).call(this),this.registerComponentHandler()}},{key:"onAppLaunch",value:function(){Y()(v()(t.prototype),"onAppLaunch",this).call(this),this.loadPreferences(),this.beginStreamingItems();var e=this.application.getSmartTags();this.setState({smartTags:e}),this.selectTag(e[0])}},{key:"onAppSync",value:function(){Y()(v()(t.prototype),"onAppSync",this).call(this),this.reloadNoteCounts()}},{key:"beginStreamingItems",value:function(){var e,t=this;this.application.streamItems({contentType:w.ContentTypes.Tag,stream:(e=_()(x.a.mark((function e(n){var r,i;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.items,e.next=3,t.setState({tags:t.application.getItems({contentType:w.ContentTypes.Tag}),smartTags:t.application.getSmartTags()});case 3:t.reloadNoteCounts(),t.state.selectedTag&&((i=r.find((function(e){return e.uuid===t.state.selectedTag.uuid})))&&!i.deleted||t.selectTag(t.state.smartTags[0]));case 5:case"end":return e.stop()}}),e)}))),function(t){return e.apply(this,arguments)})})}},{key:"onAppStateEvent",value:function(e,t){e===R?this.loadPreferences():e===M&&this.setState({selectedTag:this.appState.getSelectedTag()})}},{key:"reloadNoteCounts",value:function(){var e=[];this.state.tags&&(e=e.concat(this.state.tags)),this.state.smartTags&&(e=e.concat(this.state.smartTags));var t={},n=!0,r=!1,i=void 0;try{for(var a,o=e[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value,c=w.SNNote.filterDummyNotes(s.notes).filter((function(e){return!e.archived&&!e.content.trashed}));t[s.uuid]=c.length}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}this.setState({noteCounts:t})}},{key:"loadPreferences",value:function(){if(this.panelPuppet.ready){var e=this.preferencesManager.getValue(he);e&&(this.panelPuppet.setWidth(e),this.panelPuppet.isCollapsed()&&this.appState.panelDidResize({name:"tags",collapsed:this.panelPuppet.isCollapsed()}))}}},{key:"registerComponentHandler",value:function(){var e=this;this.application.componentManager.registerHandler({identifier:"tags",areas:["tags-list"],activationHandler:function(t){e.component=t},contextRequestHandler:function(e){return null},actionHandler:function(t,n,r){if("select-item"===n){if("Tag"===r.item.content_type){var i=e.application.findItem({uuid:r.item.uuid});i&&e.selectTag(i)}else if("SN|SmartTag"===r.item.content_type){var a=new w.SNSmartTag(r.item);e.selectTag(a)}}else"clear-selection"===n&&e.selectTag(e.state.smartTags[0])}})}},{key:"selectTag",value:(a=_()(x.a.mark((function e(t){var n=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.isSmartTag()&&Object.defineProperty(t,"notes",{get:function(){return n.application.getNotesMatchingSmartTag({smartTag:t})}}),t.content.conflict_of&&(t.content.conflict_of=null,this.application.saveItem({item:t})),this.appState.setSelectedTag(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"clickedAddNewTag",value:(i=_()(x.a.mark((function e(){var t;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.state.editingTag){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.application.createItem({contentType:w.ContentTypes.Tag});case 4:t=e.sent,this.setState({previousTag:this.state.selectedTag,selectedTag:t,editingTag:t,newTag:t}),this.application.modelManager.insertItems({items:[t]});case 7:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"tagTitleDidChange",value:function(e){this.setState({editingTag:e})}},{key:"saveTag",value:(r=_()(x.a.mark((function e(t,n){var r,i;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.target.blur(),e.next=3,this.setState({editingTag:null});case 3:if(n.title&&0!==n.title.length){e.next=7;break}return this.state.editingTag?(n.title=this.editingOriginalName,this.editingOriginalName=null):this.state.newTag&&(this.application.modelManager.removeItemLocally(n),this.setState({selectedTag:this.state.previousTag})),this.setState({newTag:null}),e.abrupt("return");case 7:if(this.editingOriginalName=null,r=this.application.findTag({title:n.title}),i=r&&r!==n,this.state.newTag!==n||!i){e.next=15;break}return this.application.alertService.alert({text:"A tag with this name already exists."}),this.application.modelManager.removeItemLocally(n),this.setState({newTag:null}),e.abrupt("return");case 15:this.application.saveItem({item:n}),this.selectTag(n),this.setState({newTag:null});case 18:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"selectedRenameTag",value:(n=_()(x.a.mark((function e(t,n){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.editingOriginalName=n.title,e.next=3,this.setState({editingTag:n});case 3:document.getElementById("tag-"+n.uuid).focus();case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"selectedDeleteTag",value:function(e){this.removeTag(e),this.selectTag(this.state.smartTags[0])}},{key:"removeTag",value:function(e){var t=this;this.application.alertService.confirm({text:"Are you sure you want to delete this tag? Note: deleting a tag will not delete its notes.",destructive:!0,onConfirm:function(){t.application.deleteItem({item:e})}})}}]),t}(q),at=function e(){f()(this,e),this.restrict="E",this.scope={},this.template=rt.a,this.replace=!0,this.controller=it,this.controllerAs="self",this.bindToController=!0},ot=n(63),st=n.n(ot),ct=function(e){function t(e,n,r,i,a,o,c,u,l,p,d,y){var m;return f()(this,t),(m=h()(this,v()(t).call(this,r,a,o,c))).$location=n,m.$rootScope=i,m.$compile=e,m.desktopManager=u,m.lockManager=l,m.statusManager=y,m.themeManager=d,m.platformString=s(),m.state={appClass:""},m.loadApplication(),m.addDragDropHandlers(),m.lockScreenPuppet={focusInput:function(){}},m}var n,r,i,o;return t.$inject=["$compile","$location","$scope","$rootScope","$timeout","application","appState","desktopManager","lockManager","preferencesManager","themeManager","statusManager"],b()(t,e),P()(t,[{key:"onAppStart",value:function(){Y()(v()(t.prototype),"onAppStart",this).call(this),this.overrideComponentManagerFunctions(),this.application.componentManager.setDesktopManager(this.desktopManager),this.setState({ready:!0})}},{key:"onAppLaunch",value:function(){Y()(v()(t.prototype),"onAppLaunch",this).call(this),this.setState({needsUnlock:!1}),this.application.registerService(this.themeManager),this.handleAutoSignInFromParams()}},{key:"watchLockscreenValue",value:(o=_()(x.a.mark((function e(){var t=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){t.setState({onLockscreenValue:function(t){e(new w.ChallengeResponse({challenge:w.Challenges.LocalPasscode,value:t}))}})})));case 1:case"end":return e.stop()}}),e)}))),function(){return o.apply(this,arguments)})},{key:"loadApplication",value:(i=_()(x.a.mark((function e(){var t=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.application.prepareForLaunch({callbacks:{requiresChallengeResponses:function(){var e=_()(x.a.mark((function e(n){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.includes(w.Challenges.LocalPasscode)&&t.setState({needsUnlock:!0}),e.abrupt("return",t.watchLockscreenValue());case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),handleChallengeFailures:function(e){var n=!0,r=!1,i=void 0;try{for(var a,o=e[Symbol.iterator]();!(n=(a=o.next()).done);n=!0)a.value.challenge===w.Challenges.LocalPasscode&&t.application.alertService.alert({text:"Invalid passcode. Please try again.",onClose:function(){t.lockScreenPuppet.focusInput()}})}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}}}});case 2:return e.next=4,this.application.launch();case 4:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"onUpdateAvailable",value:function(){this.$rootScope.$broadcast("new-update-available")}},{key:"onAppStateEvent",value:(r=_()(x.a.mark((function e(t,n){var r;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t!==L){e.next=9;break}"notes"===n.panel&&(this.notesCollapsed=n.collapsed),"tags"===n.panel&&(this.tagsCollapsed=n.collapsed),r="",this.notesCollapsed&&(r+="collapsed-notes"),this.tagsCollapsed&&(r+=" collapsed-tags"),this.setState({appClass:r}),e.next=14;break;case 9:if(t!==V){e.next=14;break}return e.next=12,this.application.isLocked();case 12:if(e.sent){e.next=14;break}this.application.sync();case 14:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"overrideComponentManagerFunctions",value:function(){this.application.componentManager.openModalComponent=function(e){var t=this.$rootScope.$new(!0);t.component=e;var n=this.$compile("<component-modal component='component' class='sk-modal'></component-modal>")(t);a.a.element(document.body).append(n)}.bind(this),this.application.componentManager.presentPermissionsDialog=function(e){var t=this.$rootScope.$new(!0);t.permissionsString=e.permissionsString,t.component=e.component,t.callback=e.callback;var n=this.$compile("<permissions-modal component='component' permissions-string='permissionsString' callback='callback' class='sk-modal'></permissions-modal>")(t);a.a.element(document.body).append(n)}.bind(this)}},{key:"addDragDropHandlers",value:function(){var e=this;window.addEventListener("dragover",(function(e){e.dataTransfer.files.length>0&&e.preventDefault()}),!1),window.addEventListener("drop",(function(t){t.dataTransfer.files.length>0&&(t.preventDefault(),e.application.alertService.alert({text:"Please use FileSafe or the Bold Editor to attach images and files. Learn more at standardnotes.org/filesafe."}))}),!1)}},{key:"handleAutoSignInFromParams",value:(n=_()(x.a.mark((function e(){var t,n,r,i,a;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.$location.search(),n=t.server,r=t.email,i=t.pw,n&&r&&i){e.next=6;break}return e.abrupt("return");case 6:if(!(a=this.application.getUser())){e.next=23;break}if(e.t0=a.email===r,!e.t0){e.next=15;break}return e.next=12,this.application.getHost();case 12:e.t1=e.sent,e.t2=n,e.t0=e.t1===e.t2;case 15:if(!e.t0){e.next=19;break}return e.abrupt("return");case 19:return e.next=21,this.application.signOut();case 21:return e.next=23,this.application.restart();case 23:return e.next=25,this.application.setHost(n);case 25:this.application.signIn({email:r,password:i});case 26:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})}]),t}(q),ut=function e(){f()(this,e),this.template=st.a,this.controller=ct,this.replace=!0,this.controllerAs="self",this.bindToController=!0},lt=n(64),ft=n.n(lt),pt=function(e){function t(e,n,r,i){var a;return f()(this,t),(a=h()(this,v()(t).call(this,e,n,r,i))).formData={},a}var n,r;return t.$inject=["$scope","$timeout","application","appState"],b()(t,e),P()(t,[{key:"$onInit",value:function(){var e=this;Y()(v()(t.prototype),"$onInit",this).call(this),this.puppet.focusInput=function(){e.passcodeInput.focus()}}},{key:"onAppStateEvent",value:(r=_()(x.a.mark((function e(t,n){var r;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t===V&&(r=this.passcodeInput)&&r.focus();case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"submitPasscodeForm",value:(n=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.formData.passcode&&0!==this.formData.passcode.length){e.next=2;break}return e.abrupt("return");case 2:this.passcodeInput.blur(),this.onValue()(this.formData.passcode);case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"forgotPasscode",value:function(){this.formData.showRecovery=!0}},{key:"beginDeleteData",value:function(){var e,t=this;this.application.alertService.confirm({text:"Are you sure you want to clear all local data?",destructive:!0,onConfirm:(e=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.application.signOut();case 2:return e.next=4,t.application.restart();case 4:case"end":return e.stop()}}),e)}))),function(){return e.apply(this,arguments)})})}},{key:"passcodeInput",get:function(){return document.getElementById("passcode-input")}}]),t}(q),ht=function e(){f()(this,e),this.restrict="E",this.template=ft.a,this.controller=pt,this.controllerAs="ctrl",this.bindToController=!0,this.scope={onValue:"&",puppet:"="}};function dt(e){return{restrict:"A",scope:{shouldFocus:"="},link:function(t,n){e((function(){t.shouldFocus&&n[0].focus()}))}}}function vt(e){return{restrict:"A",replace:!1,link:function(t,n,r){var i=!1;n.bind("click",(function(e){i=!1,r.isOpen&&e.stopPropagation()})),e.bind("click",(function(){event.target.closest(".sk-modal")||i||(t.$apply(r.clickOutside),i=!0)}))}}}function yt(e){return{restrict:"A",scope:{show:"=",delay:"@"},link:function(t,n,r){function i(e){e?n.css({display:""}):n.css({display:"none"})}i(!1),t.$watch("show",(function(n){n?function(){t.hidePromise&&(e.cancel(t.hidePromise),t.hidePromise=null);i(!0)}():function(){t.hidePromise=e(i.bind(this,!1),(n=parseInt(t.delay),a.a.isNumber(n)?n:200));var n}()}))}}}function mt(e){return{restrict:"A",link:function(t,n,r){n.ready((function(){t.$apply((function(){e(r.elemReady)(t)}))}))}}}function gt(e,t,n){return{link:function(e,t,n){var r=parseInt(n.threshold)||0,i=t[0];t.on("scroll",(function(){e.$eval(n.canLoad)&&i.scrollTop+i.offsetHeight>=i.scrollHeight-r&&e.$apply(n.infiniteScroll)}))}}}function bt(e){return{restrict:"A",link:function(t,n,r){n.on("focus",(function(){e.getSelection().toString()||this.setSelectionRange(0,this.value.length)}))}}}dt.$inject=["$timeout"],vt.$inject=["$document"],yt.$inject=["$timeout"],mt.$inject=["$parse"],gt.$inject=["$rootScope","$window","$timeout"],bt.$inject=["$window"];var wt=n(65),kt=n.n(wt);function xt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function St(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?xt(Object(n),!0).forEach((function(t){Q()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var _t=function(e){function t(e,n,r,i,a,o,s,c,u){var l;return f()(this,t),(l=h()(this,v()(t).call(this,e,r,a,o))).$rootScope=n,l.appState=o,l.application=a,l.archiveManager=s,l.godService=c,l.lockManager=u,l.state={appVersion:"v"+(window.electronAppVersion||i),passcodeAutoLockOptions:l.lockManager.getAutoLockIntervalOptions(),user:l.application.getUser(),formData:{mergeLocal:!0,ephemeral:!1},mutable:{}},l.syncStatus=l.application.getSyncStatus(),l}var n,r,i,a,s,u,l,p,d,y,m,g,k,S,$,O,C,E,A;return t.$inject=["$scope","$rootScope","$timeout","appVersion","application","appState","archiveManager","godService","lockManager"],b()(t,e),P()(t,[{key:"onAppKeyChange",value:(A=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Y()(v()(t.prototype),"onAppKeyChange",this).call(this),this.setState(this.refreshedCredentialState());case 2:case"end":return e.stop()}}),e,this)}))),function(){return A.apply(this,arguments)})},{key:"onAppLaunch",value:(E=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Y()(v()(t.prototype),"onAppLaunch",this).call(this),this.setState(this.refreshedCredentialState()),this.loadHost(),this.checkForSecurityUpdate(),this.reloadAutoLockInterval(),this.loadBackupsAvailability();case 6:case"end":return e.stop()}}),e,this)}))),function(){return E.apply(this,arguments)})},{key:"refreshedCredentialState",value:function(){return{user:this.application.getUser(),canAddPasscode:!this.application.isEphemeralSession(),hasPasscode:this.application.hasPasscode(),showPasscodeForm:!1}}},{key:"$onInit",value:function(){Y()(v()(t.prototype),"$onInit",this).call(this),this.initProps({closeFunction:this.closeFunction})}},{key:"close",value:function(){var e=this;this.$timeout((function(){e.props.closeFunction()()}))}},{key:"loadHost",value:(C=_()(x.a.mark((function e(){var t;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.application.getHost();case 2:t=e.sent,this.setState({server:t,formData:St({},this.state.formData,{url:t})});case 4:case"end":return e.stop()}}),e,this)}))),function(){return C.apply(this,arguments)})},{key:"checkForSecurityUpdate",value:(O=_()(x.a.mark((function e(){var t;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.godService.checkForSecurityUpdate();case 2:t=e.sent,this.setState({securityUpdateAvailable:t});case 4:case"end":return e.stop()}}),e,this)}))),function(){return O.apply(this,arguments)})},{key:"loadBackupsAvailability",value:($=_()(x.a.mark((function e(){var t,n,r,i;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=function(){return t?"End-to-end encryption is enabled. Your data is encrypted on your device first, then synced to your private cloud.":n?"Encryption is enabled. Your data is encrypted using your passcode before it is saved to your device storage.":"Encryption is not enabled. Sign in, register, or add a passcode lock to enable encryption."},t=!o(this.application.getUser()),n=this.application.hasPasscode(),r=t||n,this.setState({encryptionStatusString:i(),encryptionEnabled:r,mutable:St({},this.state.mutable,{backupEncrypted:r})});case 5:case"end":return e.stop()}}),e,this)}))),function(){return $.apply(this,arguments)})},{key:"submitMfaForm",value:function(){this.login()}},{key:"blurAuthFields",value:function(){for(var e=0,t=["email","password","password_conf"];e<t.length;e++){var n=t[e],r=document.getElementsByName(n)[0];r&&r.blur()}}},{key:"submitAuthForm",value:function(){this.state.formData.email&&this.state.formData.user_password&&(this.blurAuthFields(),this.state.formData.showLogin?this.login():this.register())}},{key:"setFormDataState",value:(S=_()(x.a.mark((function e(t){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.setState({formData:St({},this.state.formData,{},t)}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"login",value:(k=_()(x.a.mark((function e(){var t,n;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setFormDataState({status:"Generating Login Keys...",authenticating:!0});case 2:return e.next=4,this.application.signIn({email:this.state.formData.email,password:this.state.formData.user_password,strict:this.state.formData.strictSignin,ephemeral:this.state.formData.ephemeral,mfaKeyPath:this.state.formData.mfa&&this.state.formData.mfa.payload.mfa_key,mfaCode:this.state.formData.userMfaCode,mergeLocal:this.state.formData.mergeLocal});case 4:if(!(t=e.sent)||t.error){e.next=11;break}return e.next=9,this.setFormDataState({authenticating:!1});case 9:return this.close(),e.abrupt("return");case 11:return e.next=13,this.setFormDataState({status:null,user_password:null});case 13:if("mfa-required"!==(n=t?t.error:{message:"An unknown error occured."}).tag&&"mfa-invalid"!==n.tag){e.next=19;break}return e.next=17,this.setFormDataState({showLogin:!1,mfa:n});case 17:e.next=22;break;case 19:return e.next=21,this.setFormDataState({showLogin:!0,mfa:null});case 21:n.message&&this.application.alertService.alert({text:n.message});case 22:return e.next=24,this.setFormDataState({authenticating:!1});case 24:case"end":return e.stop()}}),e,this)}))),function(){return k.apply(this,arguments)})},{key:"register",value:(g=_()(x.a.mark((function e(){var t,n;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.state.formData.password_conf===this.state.formData.user_password){e.next=4;break}return this.application.alertService.alert({text:"The two passwords you entered do not match. Please try again."}),e.abrupt("return");case 4:return e.next=6,this.setFormDataState({confirmPassword:!1,status:"Generating Account Keys...",authenticating:!0});case 6:return e.next=8,this.application.register({email:this.state.formData.email,password:this.state.formData.user_password,ephemeral:this.state.formData.ephemeral,mergeLocal:this.state.formData.mergeLocal});case 8:if((t=e.sent)&&!t.error){e.next=18;break}return e.next=12,this.setFormDataState({status:null});case 12:return n=t?t.error:{message:"An unknown error occured."},e.next=15,this.setFormDataState({authenticating:!1});case 15:this.application.alertService.alert({text:n.message}),e.next=21;break;case 18:return e.next=20,this.setFormDataState({authenticating:!1});case 20:this.close();case 21:case"end":return e.stop()}}),e,this)}))),function(){return g.apply(this,arguments)})},{key:"mergeLocalChanged",value:function(){var e=this;this.state.formData.mergeLocal||this.application.alertService.confirm({text:"Unchecking this option means any of the notes you have written while you were signed out will be deleted. Are you sure you want to discard these notes?",destructive:!0,onCancel:function(){e.setFormDataState({mergeLocal:!0})}})}},{key:"openPasswordWizard",value:function(e){this.close(),this.godService.presentPasswordWizard(e)}},{key:"openPrivilegesModal",value:(m=_()(x.a.mark((function e(){var t,n=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.close(),t=function(){n.godService.presentPrivilegesManagementModal()},e.next=4,this.application.privilegesService.actionRequiresPrivilege(w.ProtectedActions.ManagePrivileges);case 4:e.sent?this.godService.presentPrivilegesModal(w.ProtectedActions.ManagePrivileges,(function(){t()})):t();case 6:case"end":return e.stop()}}),e,this)}))),function(){return m.apply(this,arguments)})},{key:"destroyLocalData",value:function(){var e,t=this;this.application.alertService.confirm({text:"Are you sure you want to end your session? This will delete all local items and extensions.",destructive:!0,onConfirm:(e=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.application.signOut();case 2:case"end":return e.stop()}}),e)}))),function(){return e.apply(this,arguments)})})}},{key:"submitImportPassword",value:(y=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.performImport(this.state.importData.data,this.state.importData.password);case 2:case"end":return e.stop()}}),e,this)}))),function(){return y.apply(this,arguments)})},{key:"readFile",value:(d=_()(x.a.mark((function e(t){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){var r=new FileReader;r.onload=function(t){try{var n=JSON.parse(t.target.result);e(n)}catch(t){this.application.alertService.alert({text:"Unable to open file. Ensure it is a proper JSON file and try again."})}},r.readAsText(t)})));case 1:case"end":return e.stop()}}),e)}))),function(e){return d.apply(this,arguments)})},{key:"importFileSelected",value:(p=_()(x.a.mark((function e(t){var n,r=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=function(){var e=_()(x.a.mark((function e(){var n,i,a;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t[0],e.next=3,r.readFile(n);case 3:if(i=e.sent){e.next=6;break}return e.abrupt("return");case 6:if(!i.auth_params){e.next=13;break}return e.next=9,r.setState({importData:St({},r.state.importData,{requestPassword:!0,data:i})});case 9:(a=document.getElementById("import-password-request"))&&a.scrollIntoView(!1),e.next=15;break;case 13:return e.next=15,r.performImport(i,null);case 15:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),e.next=3,this.application.privilegesService.actionRequiresPrivilege(w.ProtectedActions.ManageBackups);case 3:e.sent?this.godService.presentPrivilegesModal(w.ProtectedActions.ManageBackups,n):n();case 5:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"performImport",value:(l=_()(x.a.mark((function e(t,n){var r,i;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setState({importData:St({},this.state.importData,{loading:!0})});case 2:return e.next=4,this.importJSONData(t,n);case 4:r=e.sent,this.setState({importData:null}),r>0?(i=pe({errorCount:r}),this.application.alertService.alert({text:i})):this.application.alertService.alert({text:"Your data has been successfully imported."});case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return l.apply(this,arguments)})},{key:"importJSONData",value:(u=_()(x.a.mark((function e(t,n){var r,i,a,o,s,c,u,l,f;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.application.importData({data:t.items,password:n});case 2:for(r=e.sent,i=r.affectedItems,a=r.errorCount,o=!0,s=!1,c=void 0,e.prev=8,u=i[Symbol.iterator]();!(o=(l=u.next()).done);o=!0)"SN|Component"===(f=l.value).content_type&&(f.active=!1);e.next=16;break;case 12:e.prev=12,e.t0=e.catch(8),s=!0,c=e.t0;case 16:e.prev=16,e.prev=17,o||null==u.return||u.return();case 19:if(e.prev=19,!s){e.next=22;break}throw c;case 22:return e.finish(19);case 23:return e.finish(16);case 24:return e.abrupt("return",a);case 25:case"end":return e.stop()}}),e,this,[[8,12,16,24],[17,,19,23]])}))),function(e,t){return u.apply(this,arguments)})},{key:"downloadDataArchive",value:(s=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.archiveManager.downloadBackup(this.state.mutable.backupEncrypted);case 1:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"notesAndTagsCount",value:function(){return this.application.getItems({contentType:["Note","Tag"]}).length}},{key:"encryptionStatusForNotes",value:function(){var e=this.notesAndTagsCount();return e+"/"+e+" notes and tags encrypted"}},{key:"reloadAutoLockInterval",value:(a=_()(x.a.mark((function e(){var t;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.lockManager.getAutoLockInterval();case 2:t=e.sent,this.setState({selectedAutoLockInterval:t});case 4:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"selectAutoLockInterval",value:(i=_()(x.a.mark((function e(t){var n,r=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=function(){var e=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.lockManager.setAutoLockInterval(t);case 2:r.reloadAutoLockInterval();case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),e.next=3,this.application.privilegesService.actionRequiresPrivilege(w.ProtectedActions.ManagePasscode);case 3:e.sent?this.godService.presentPrivilegesModal(w.ProtectedActions.ManagePasscode,(function(){n()})):n();case 5:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"hidePasswordForm",value:function(){this.setFormDataState({showLogin:!1,showRegister:!1,user_password:null,password_conf:null})}},{key:"hasPasscode",value:function(){return this.passcodeManager.hasPasscode()}},{key:"addPasscodeClicked",value:function(){this.setFormDataState({showPasscodeForm:!0})}},{key:"submitPasscodeForm",value:function(){var e=this,t=this.state.formData.passcode;t===this.state.formData.confirmPasscode?(this.state.formData.changingPasscode?this.application.changePasscode(t):this.application.setPasscode(t)).then((function(){e.setFormDataState({passcode:null,confirmPasscode:null,showPasscodeForm:!1})})):this.application.alertService.alert({text:"The two passcodes you entered do not match. Please try again."})}},{key:"changePasscodePressed",value:(r=_()(x.a.mark((function e(){var t,n=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=function(){n.state.formData.changingPasscode=!0,n.addPasscodeClicked()},e.next=3,this.application.privilegesService.actionRequiresPrivilege(w.ProtectedActions.ManagePasscode);case 3:e.sent?this.godService.presentPrivilegesModal(w.ProtectedActions.ManagePasscode,t):t();case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"removePasscodePressed",value:(n=_()(x.a.mark((function e(){var t,n=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=function(){var e=_()(x.a.mark((function e(){var t,r;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=o,e.next=3,n.application.getUser();case 3:e.t1=e.sent,t=!(0,e.t0)(e.t1),r="Are you sure you want to remove your local passcode?",t||(r+=" This will remove encryption from your local data."),n.application.alertService.confirm({text:r,destructive:!0,onConfirm:function(){n.application.removePasscode()}});case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),e.next=3,this.application.privilegesService.actionRequiresPrivilege(w.ProtectedActions.ManagePasscode);case 3:e.sent?this.godService.presentPrivilegesModal(w.ProtectedActions.ManagePasscode,t):t();case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"isDesktopApplication",value:function(){return c()}}]),t}(q),$t=function e(){f()(this,e),this.restrict="E",this.template=kt.a,this.controller=_t,this.controllerAs="self",this.bindToController=!0,this.scope={closeFunction:"&"}},Pt=n(66),Ot=n.n(Pt),Ct=function(e){function t(e,n,r,i,a){var o;return f()(this,t),(o=h()(this,v()(t).call(this,e,n,r,i))).godService=a,o.state={extensions:[]},o}var n,r;return t.$inject=["$scope","$timeout","application","appState","godService"],b()(t,e),P()(t,[{key:"$onInit",value:function(){Y()(v()(t.prototype),"$onInit",this).call(this),this.initProps({item:this.item}),this.loadExtensions()}},{key:"loadExtensions",value:(r=_()(x.a.mark((function e(){var t,n,r,i,a,o,s;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this.application.actionsManager.getExtensions().sort((function(e,t){return e.name.toLowerCase()<t.name.toLowerCase()?-1:1})),n=!0,r=!1,i=void 0,e.prev=4,a=t[Symbol.iterator]();case 6:if(n=(o=a.next()).done){e.next=15;break}return(s=o.value).loading=!0,e.next=11,this.application.actionsManager.loadExtensionInContextOfItem(s,this.props.item);case 11:s.loading=!1;case 12:n=!0,e.next=6;break;case 15:e.next=21;break;case 17:e.prev=17,e.t0=e.catch(4),r=!0,i=e.t0;case 21:e.prev=21,e.prev=22,n||null==a.return||a.return();case 24:if(e.prev=24,!r){e.next=27;break}throw i;case 27:return e.finish(24);case 28:return e.finish(21);case 29:this.setState({extensions:t});case 30:case"end":return e.stop()}}),e,this,[[4,17,21,29],[22,,24,28]])}))),function(){return r.apply(this,arguments)})},{key:"executeAction",value:(n=_()(x.a.mark((function e(t,n){var r;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("nested"!==t.verb){e.next=3;break}return t.subrows?t.subrows=null:t.subrows=this.subRowsForAction(t,n),e.abrupt("return");case 3:return t.running=!0,e.next=6,this.application.actionsManager.runAction({action:t,item:this.props.item,passwordRequestHandler:function(){}});case 6:if(r=e.sent,!t.error){e.next=9;break}return e.abrupt("return");case 9:return t.running=!1,this.handleActionResult(t,r),e.next=13,this.application.actionsManager.loadExtensionInContextOfItem(n,this.props.item);case 13:this.setState({extensions:this.state.extensions});case 14:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"handleActionResult",value:function(e,t){switch(e.verb){case"render":var n=t.item;this.godService.presentRevisionPreviewModal(n.uuid,n.content)}}},{key:"subRowsForAction",value:function(e,t){var n=this;return e.subactions?e.subactions.map((function(r){return{onClick:function(){n.executeAction(r,t,e)},label:r.label,subtitle:r.desc,spinnerClass:r.running?"info":null}})):null}}]),t}(q),Et=function e(){f()(this,e),this.restrict="E",this.template=Ot.a,this.replace=!0,this.controller=Ct,this.controllerAs="self",this.bindToController=!0,this.scope={item:"="}},At=n(67),It=n.n(At),jt=function(){function e(t,n){f()(this,e),this.$element=n,this.$scope=t}return e.$inject=["$scope","$element"],P()(e,[{key:"dismiss",value:function(e){this.$element.remove(),this.$scope.$destroy(),this.onDismiss&&this.onDismiss()&&this.onDismiss()(this.component),e&&e()}}]),e}(),Dt=function e(){f()(this,e),this.restrict="E",this.template=It.a,this.controller=jt,this.controllerAs="ctrl",this.bindToController=!0,this.scope={show:"=",component:"=",callback:"=",onDismiss:"&"}},Mt=n(68),Tt=n.n(Mt),Rt=function(){function e(t,n,r,i,a,o){var s=this;f()(this,e),this.$rootScope=n,this.$timeout=r,this.application=i,this.themeManager=o,this.desktopManager=a,this.componentValid=!0,t.$watch("ctrl.component",(function(e,t){s.componentValueDidSet(e,t)})),t.$on("ext-reload-complete",(function(){s.reloadStatus(!1)})),t.$on("$destroy",(function(){s.destroy()}))}var t,n,r;return e.$inject=["$scope","$rootScope","$timeout","application","desktopManager","themeManager"],P()(e,[{key:"$onInit",value:function(){this.registerComponentHandlers(),this.registerPackageUpdateObserver()}},{key:"registerPackageUpdateObserver",value:function(){var e=this;this.updateObserver=this.desktopManager.registerUpdateObserver((function(t){t===e.component&&t.active&&e.reloadComponent()}))}},{key:"registerComponentHandlers",value:function(){var e=this;this.themeHandlerIdentifier="component-view-"+Math.random(),this.application.componentManager.registerHandler({identifier:this.themeHandlerIdentifier,areas:["themes"],activationHandler:function(e){}}),this.identifier="component-view-"+Math.random(),this.application.componentManager.registerHandler({identifier:this.identifier,areas:[this.component.area],activationHandler:function(t){t===e.component&&e.$timeout((function(){e.handleActivation()}))},actionHandler:function(t,n,r){"set-size"===n&&e.application.componentManager.handleSetSizeEvent(t,r)}})}},{key:"onVisibilityChange",value:function(){"hidden"!==document.visibilityState&&this.issueLoading&&this.reloadComponent()}},{key:"reloadComponent",value:(r=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.componentValid=!1,e.next=3,this.application.componentManager.reloadComponent(this.component);case 3:this.reloadStatus();case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"reloadStatus",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.reloading=!0;var n=this.component,r=this.componentValid,i=n.offlineOnly&&!c(),a=c()?!n.local_url&&!n.hasValidHostedUrl():!n.hasValidHostedUrl();this.expired=n.valid_until&&n.valid_until<=new Date,n.lockReadonly||(n.readonly=this.expired),this.componentValid=!i&&!a,this.componentValid||(this.loading=!1),this.error=i?"offline-restricted":a?"url-missing":null,this.componentValid!==r&&this.componentValid&&this.application.componentManager.reloadComponent(n,!0),this.expired&&t&&this.$rootScope.$broadcast("reload-ext-dat"),this.$timeout((function(){e.reloading=!1}),500)}},{key:"handleActivation",value:function(){var e=this;if(this.component.active){var t=this.application.componentManager.iframeForComponent(this.component);t&&(this.loading=!0,this.loadTimeout&&this.$timeout.cancel(this.loadTimeout),this.loadTimeout=this.$timeout((function(){e.handleIframeLoadTimeout()}),4e3),t.onload=function(n){e.handleIframeLoad(t)})}}},{key:"handleIframeLoadTimeout",value:(n=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.loading&&(this.loading=!1,this.issueLoading=!0,this.didAttemptReload?document.addEventListener("visibilitychange",this.onVisibilityChange.bind(this)):(this.didAttemptReload=!0,this.reloadComponent()));case 1:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"handleIframeLoad",value:(t=_()(x.a.mark((function e(t){var n,r=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!1,c())try{t.contentWindow.origin&&"null"!==t.contentWindow.origin||(n=!0)}catch(e){}return this.$timeout.cancel(this.loadTimeout),e.next=5,this.application.componentManager.registerComponentWindow(this.component,t.contentWindow);case 5:this.$timeout((function(){r.loading=!1,r.issueLoading=!!n,r.onLoad&&r.onLoad(r.component)}),7);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"componentValueDidSet",value:function(e,t){t&&e!==t&&this.application.componentManager.deactivateComponent(t,!0),e&&(this.application.componentManager.activateComponent(e,!0),this.reloadStatus())}},{key:"disableActiveTheme",value:function(){this.themeManager.deactivateAllThemes()}},{key:"getUrl",value:function(){var e=this.application.componentManager.urlForComponent(this.component);return this.component.runningLocally=e===this.component.local_url,e}},{key:"destroy",value:function(){if(this.application.componentManager.deregisterHandler(this.themeHandlerIdentifier),this.application.componentManager.deregisterHandler(this.identifier),this.component&&!this.manualDealloc){this.application.componentManager.deactivateComponent(this.component,!0)}this.desktopManager.deregisterUpdateObserver(this.updateObserver),document.removeEventListener("visibilitychange",this.onVisibilityChange.bind(this))}}]),e}(),Lt=function e(){f()(this,e),this.restrict="E",this.template=Tt.a,this.scope={component:"=",onLoad:"=?",manualDealloc:"=?"},this.controller=Rt,this.controllerAs="ctrl",this.bindToController=!0},Nt=n(69),Ft=n.n(Nt),Ut=function(){function e(t,n,r){f()(this,e),this.$element=t,this.application=r,this.archiveManager=n}return e.$inject=["$element","archiveManager","application"],P()(e,[{key:"$onInit",value:function(){this.contentType=this.item1.content_type,this.item1Content=this.createContentString(this.item1),this.item2Content=this.createContentString(this.item2)}},{key:"createContentString",value:function(e){var t=Object.assign({created_at:e.created_at,updated_at:e.updated_at},e.content);return JSON.stringify(t,null,2)}},{key:"keepItem1",value:function(){var e=this;this.application.alertService.confirm({text:"Are you sure you want to delete the item on the right?",destructive:!0,onConfirm:function(){e.application.deleteItem({item:e.item2}),e.triggerCallback(),e.dismiss()}})}},{key:"keepItem2",value:function(){var e=this;this.application.alertService.confirm({text:"Are you sure you want to delete the item on the left?",destructive:!0,onConfirm:function(){e.application.deleteItem({item:e.item1}),e.triggerCallback(),e.dismiss()}})}},{key:"keepBoth",value:function(){this.triggerCallback(),this.dismiss()}},{key:"export",value:function(){this.archiveManager.downloadBackupOfItems([this.item1,this.item2],!0)}},{key:"triggerCallback",value:function(){this.callback&&this.callback()}},{key:"dismiss",value:function(){this.$element.remove()}}]),e}(),Kt=function e(){f()(this,e),this.restrict="E",this.template=Ft.a,this.controller=Ut,this.controllerAs="ctrl",this.bindToController=!0,this.scope={item1:"=",item2:"=",callback:"="}},Vt=n(70),Bt=n.n(Vt),Ht=function(e){function t(e,n,r,i){var a;return f()(this,t),(a=h()(this,v()(t).call(this,e,n,r,i))).state={isDesktop:c()},a}return t.$inject=["$scope","$timeout","application","appState"],b()(t,e),P()(t,[{key:"$onInit",value:function(){Y()(v()(t.prototype),"$onInit",this).call(this);var e=this.application.componentManager.componentsForArea("editor-editor").sort((function(e,t){return e.name.toLowerCase()<t.name.toLowerCase()?-1:1})),n=e.filter((function(e){return e.isDefaultEditor()}))[0];this.setState({editors:e,defaultEditor:n})}},{key:"selectComponent",value:function(e){var t=this;e&&e.content.conflict_of&&(e.content.conflict_of=null,this.application.saveItem({item:e})),this.$timeout((function(){t.callback()(e)}))}},{key:"toggleDefaultForEditor",value:function(e){this.state.defaultEditor===e?this.removeEditorDefault(e):this.makeEditorDefault(e)}},{key:"offlineAvailableForComponent",value:function(e){return e.local_url&&this.state.isDesktop}},{key:"makeEditorDefault",value:function(e){var t=this.application.componentManager.componentsForArea("editor-editor").filter((function(e){return e.isDefaultEditor()}))[0];t&&(t.setAppDataItem("defaultEditor",!1),this.application.setItemsNeedsSync({item:t})),e.setAppDataItem("defaultEditor",!0),this.application.saveItem({item:e}),this.setState({defaultEditor:e})}},{key:"removeEditorDefault",value:function(e){e.setAppDataItem("defaultEditor",!1),this.application.saveItem({item:e}),this.setState({defaultEditor:null})}},{key:"shouldDisplayRunningLocallyLabel",value:function(e){return!!e.runningLocally&&e===this.selectedEditor}}]),t}(q),zt=function e(){f()(this,e),this.restrict="E",this.template=Bt.a,this.controller=Ht,this.controllerAs="self",this.bindToController=!0,this.scope={callback:"&",selectedEditor:"=",currentItem:"="}},Wt=n(71),qt=n.n(Wt),Gt=function(){function e(t,n){f()(this,e),this.$element=n,this.formData={}}return e.$inject=["$scope","$element"],P()(e,[{key:"dismiss",value:function(){this.$element.remove(),this.$scope.$destroy()}},{key:"submit",value:function(){this.callback()(this.formData.input),this.dismiss()}}]),e}(),Yt=function e(){f()(this,e),this.restrict="E",this.template=qt.a,this.controller=Gt,this.controllerAs="ctrl",this.bindToController=!0,this.scope={type:"=",title:"=",message:"=",placeholder:"=",callback:"&"}},Jt=n(72),Qt=n.n(Jt),Zt=function(){function e(){f()(this,e)}return P()(e,[{key:"onClick",value:function(e){this.disabled||(e.stopPropagation(),this.action())}},{key:"clickAccessoryButton",value:function(e){this.disabled||(e.stopPropagation(),this.buttonAction())}}]),e}(),Xt=function e(){f()(this,e),this.restrict="E",this.transclude=!0,this.template=Qt.a,this.controller=Zt,this.controllerAs="ctrl",this.bindToController=!0,this.scope={action:"&",buttonAction:"&",buttonClass:"=",buttonText:"=",desc:"=",disabled:"=",circle:"=",circleAlign:"=",faded:"=",hasButton:"=",label:"=",spinnerClass:"=",stylekitClass:"=",subRows:"=",subtitle:"="}},en=n(73),tn=n.n(en),nn="right",rn="left",an="mousemove",on="mousedown",sn="mouseup",cn="hoverable",un="always-visible",ln="dragging",fn="no-selection",pn="collapsed",hn="animate-opacity",dn=function(){function e(t,n,r,i){f()(this,e),this.$compile=t,this.$element=n,this.$scope=r,this.$timeout=i}return e.$inject=["$compile","$element","$scope","$timeout"],P()(e,[{key:"$onInit",value:function(){this.configureDefaults(),this.reloadDefaultValues(),this.configureControl(),this.addDoubleClickHandler(),this.addMouseDownListener(),this.addMouseMoveListener(),this.addMouseUpListener()}},{key:"configureControl",value:function(){var e=this;this.control.setWidth=function(t){e.setWidth(t,!0)},this.control.setLeft=function(t){e.setLeft(t)},this.control.flash=function(){e.flash()},this.control.isCollapsed=function(){return e.isCollapsed()},this.control.ready=!0,this.control.onReady()}},{key:"configureDefaults",value:function(){this.panel=document.getElementById(this.panelId),this.panel||console.error("Panel not found for",this.panelId),this.resizerColumn=this.$element[0],this.currentMinWidth=this.minWidth||this.resizerColumn.offsetWidth,this.pressed=!1,this.startWidth=this.panel.scrollWidth,this.lastDownX=0,this.collapsed=!1,this.lastWidth=this.startWidth,this.startLeft=this.panel.offsetLeft,this.lastLeft=this.startLeft,this.appFrame=null,this.widthBeforeLastDblClick=0,this.property===nn&&this.configureRightPanel(),this.alwaysVisible&&this.resizerColumn.classList.add(un),this.hoverable&&this.resizerColumn.classList.add(cn)}},{key:"configureRightPanel",value:function(){var e,t,n,r,i=this,a=(e=function(e){i.reloadDefaultValues(),i.handleWidthEvent(),i.$timeout((function(){i.finishSettingWidth()}))},t=250,function(){var i=this,a=arguments,o=function(){r=null,n||e.apply(i,a)},s=n&&!r;clearTimeout(r),r=setTimeout(o,t),s&&e.apply(i,a)});window.addEventListener("resize",a),this.$scope.$on("$destroy",(function(){window.removeEventListener("resize",a)}))}},{key:"getParentRect",value:function(){return this.panel.parentNode.getBoundingClientRect()}},{key:"reloadDefaultValues",value:function(){this.startWidth=this.isAtMaxWidth()?this.getParentRect().width:this.panel.scrollWidth,this.lastWidth=this.startWidth,this.appFrame=document.getElementById("app").getBoundingClientRect()}},{key:"addDoubleClickHandler",value:function(){var e=this;this.resizerColumn.ondblclick=function(){e.$timeout((function(){var t=e.isCollapsed();t?e.setWidth(e.widthBeforeLastDblClick||e.defaultWidth):(e.widthBeforeLastDblClick=e.lastWidth,e.setWidth(e.currentMinWidth)),e.finishSettingWidth();var n=!t;e.onResizeFinish()(e.lastWidth,e.lastLeft,e.isAtMaxWidth(),n)}))}}},{key:"addMouseDownListener",value:function(){var e=this;this.resizerColumn.addEventListener(on,(function(t){e.addInvisibleOverlay(),e.pressed=!0,e.lastDownX=t.clientX,e.startWidth=e.panel.scrollWidth,e.startLeft=e.panel.offsetLeft,e.panel.classList.add(fn),e.hoverable&&e.resizerColumn.classList.add(ln)}))}},{key:"addMouseMoveListener",value:function(){var e=this;document.addEventListener(an,(function(t){e.pressed&&(t.preventDefault(),e.property&&e.property===rn?e.handleLeftEvent(t):e.handleWidthEvent(t))}))}},{key:"handleWidthEvent",value:function(e){var t;e?t=e.clientX:(t=0,this.lastDownX=0);var n=t-this.lastDownX,r=this.startWidth+n;this.setWidth(r,!1),this.onResize()&&this.onResize()(this.lastWidth,this.panel)}},{key:"handleLeftEvent",value:function(e){var t=this.panel.getBoundingClientRect(),n=(e.clientX||t.x)-this.lastDownX,r=this.startLeft+n;r<0&&(r=0,n=-this.startLeft);var i=this.getParentRect(),a=this.startWidth-n;a<this.currentMinWidth&&(a=this.currentMinWidth),a>i.width&&(a=i.width),r+a>i.width&&(r=i.width-a),this.setLeft(r,!1),this.setWidth(a,!1)}},{key:"addMouseUpListener",value:function(){var e=this;document.addEventListener(sn,(function(t){if(e.removeInvisibleOverlay(),e.pressed){e.pressed=!1,e.resizerColumn.classList.remove(ln),e.panel.classList.remove(fn);var n=e.isAtMaxWidth();e.onResizeFinish&&e.onResizeFinish()(e.lastWidth,e.lastLeft,n,e.isCollapsed()),e.finishSettingWidth()}}))}},{key:"isAtMaxWidth",value:function(){return Math.round(this.lastWidth+this.lastLeft)===Math.round(this.getParentRect().width)}},{key:"isCollapsed",value:function(){return this.lastWidth<=this.currentMinWidth}},{key:"setWidth",value:function(e,t){e<this.currentMinWidth&&(e=this.currentMinWidth);var n=this.getParentRect();e>n.width&&(e=n.width);var r=this.appFrame.width-this.panel.getBoundingClientRect().x;e>r&&(e=r),Math.round(e+this.lastLeft)===Math.round(n.width)?(this.panel.style.width="calc(100% - ".concat(this.lastLeft,"px)"),this.panel.style.flexBasis="calc(100% - ".concat(this.lastLeft,"px)")):(this.panel.style.flexBasis=e+"px",this.panel.style.width=e+"px"),this.lastWidth=e,t&&this.finishSettingWidth()}},{key:"setLeft",value:function(e){this.panel.style.left=e+"px",this.lastLeft=e}},{key:"finishSettingWidth",value:function(){this.collapsable&&(this.collapsed=this.isCollapsed(),this.collapsed?this.resizerColumn.classList.add(pn):this.resizerColumn.classList.remove(pn))}},{key:"addInvisibleOverlay",value:function(){this.overlay||(this.overlay=this.$compile("<div id='resizer-overlay'></div>")(this.$scope),a.a.element(document.body).prepend(this.overlay))}},{key:"removeInvisibleOverlay",value:function(){this.overlay&&(this.overlay.remove(),this.overlay=null)}},{key:"flash",value:function(){var e=this;this.resizerColumn.classList.add(hn),this.$timeout((function(){e.resizerColumn.classList.remove(hn)}),3e3)}}]),e}(),vn=function e(){f()(this,e),this.restrict="E",this.template=tn.a,this.controller=dn,this.controllerAs="ctrl",this.bindToController=!0,this.scope={alwaysVisible:"=",collapsable:"=",control:"=",defaultWidth:"=",hoverable:"=",index:"=",minWidth:"=",onResize:"&",onResizeFinish:"&",panelId:"=",property:"="}},yn=n(74),mn=n.n(yn);function gn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function bn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?gn(Object(n),!0).forEach((function(t){Q()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var wn=1,kn=2,xn=function(e){function t(e,n,r,i,a){var o;return f()(this,t),(o=h()(this,v()(t).call(this,n,r,i,a))).$element=e,o.$timeout=r,o.$scope=n,o.registerWindowUnloadStopper(),o}var n,r,i,a;return t.$inject=["$element","$scope","$timeout","application","appState"],b()(t,e),P()(t,[{key:"$onInit",value:function(){Y()(v()(t.prototype),"$onInit",this).call(this),this.initProps({type:this.type,changePassword:"change-pw"===this.type,securityUpdate:"upgrade-security"===this.type}),this.setState({formData:{},continueTitle:"Continue",step:wn,title:this.props.changePassword?"Change Password":"Account Update"})}},{key:"registerWindowUnloadStopper",value:function(){window.onbeforeunload=function(e){return!0},this.$scope.$on("$destroy",(function(){window.onbeforeunload=null}))}},{key:"resetContinueState",value:function(){this.setState({showSpinner:!1,continueTitle:"Continue"}),this.isContinuing=!1}},{key:"nextStep",value:(a=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.state.lockContinue&&!this.isContinuing){e.next=2;break}return e.abrupt("return");case 2:if(this.state.step!==kn){e.next=5;break}return this.dismiss(),e.abrupt("return");case 5:return this.isContinuing=!0,this.setState({showSpinner:!0,continueTitle:"Generating Keys..."}),e.next=9,this.validateCurrentPassword();case 9:if(e.sent){e.next=13;break}return this.resetContinueState(),e.abrupt("return");case 13:return e.next=15,this.processPasswordChange();case 15:if(e.sent){e.next=19;break}return this.resetContinueState(),e.abrupt("return");case 19:this.isContinuing=!1,this.setState({showSpinner:!1,continueTitle:"Finish",step:kn});case 21:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"setFormDataState",value:(i=_()(x.a.mark((function e(t){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.setState({formData:bn({},this.state.formData,{},t)}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"validateCurrentPassword",value:(r=_()(x.a.mark((function e(){var t,n,r;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.state.formData.currentPassword,n=this.props.securityUpdate?t:this.state.formData.newPassword,t&&0!==t.length){e.next=5;break}return this.application.alertService.alert({text:"Please enter your current password."}),e.abrupt("return",!1);case 5:if(!this.props.changePassword){e.next=13;break}if(n&&0!==n.length){e.next=9;break}return this.application.alertService.alert({text:"Please enter a new password."}),e.abrupt("return",!1);case 9:if(n===this.state.formData.newPasswordConfirmation){e.next=13;break}return this.application.alertService.alert({text:"Your new password does not match its confirmation."}),this.state.formData.status=null,e.abrupt("return",!1);case 13:if(this.application.getUser().email){e.next=17;break}return this.application.alertService.alert({text:"We don't have your email stored. Please log out then log back in to fix this issue."}),this.state.formData.status=null,e.abrupt("return",!1);case 17:return e.next=19,this.application.validateAccountPassword({password:this.state.formData.currentPassword});case 19:return(r=e.sent)||this.application.alertService.alert({text:"The current password you entered is not correct. Please try again."}),e.abrupt("return",r);case 22:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"processPasswordChange",value:(n=_()(x.a.mark((function e(){var t,n,r;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.setState({lockContinue:!0,processing:!0}),this.setFormDataState({status:"Processing encryption keys..."}),t=this.props.securityUpdate?this.state.formData.currentPassword:this.state.formData.newPassword,e.next=5,this.application.changePassword({email:this.application.getUser().email,currentPassword:this.state.formData.currentPassword,newPassword:t});case 5:return n=e.sent,r=!n.error,this.setFormDataState({statusError:!r,processing:r}),r?this.setState({lockContinue:!1,formData:bn({},this.state.formData,{status:this.props.changePassword?"Successfully changed password.":"Successfully performed account update."})}):(this.application.alertService.alert({text:n.error.message?n.error.message:"There was an error changing your password. Please try again."}),this.setFormDataState({status:"Unable to process your password. Please try again."})),e.abrupt("return",r);case 10:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"dismiss",value:function(){this.state.lockContinue?this.application.alertService.alert({text:"Cannot close window until pending tasks are complete."}):(this.$element.remove(),this.$scope.$destroy())}}]),t}(q),Sn=function e(){f()(this,e),this.restrict="E",this.template=mn.a,this.controller=xn,this.controllerAs="ctrl",this.bindToController=!0,this.scope={type:"="}},_n=n(75),$n=n.n(_n),Pn=function(){function e(t){f()(this,e),this.$element=t}return e.$inject=["$element"],P()(e,[{key:"dismiss",value:function(){this.$element.remove()}},{key:"accept",value:function(){this.callback(!0),this.dismiss()}},{key:"deny",value:function(){this.callback(!1),this.dismiss()}}]),e}(),On=function e(){f()(this,e),this.restrict="E",this.template=$n.a,this.controller=Pn,this.controllerAs="ctrl",this.bindToController=!0,this.scope={show:"=",component:"=",permissionsString:"=",callback:"="}},Cn=n(76),En=n.n(Cn),An=function(){function e(t,n,r){f()(this,e),this.$element=t,this.$timeout=n,this.application=r}var t;return e.$inject=["$element","$timeout","application"],P()(e,[{key:"$onInit",value:function(){var e=this;this.authParameters={},this.sessionLengthOptions=this.application.privilegesService.getSessionLengthOptions(),this.application.privilegesService.getSelectedSessionLength().then((function(t){e.$timeout((function(){e.selectedSessionLength=t}))})),this.application.privilegesService.netCredentialsForAction(this.action).then((function(t){e.$timeout((function(){e.requiredCredentials=t.sort()}))}))}},{key:"selectSessionLength",value:function(e){this.selectedSessionLength=e}},{key:"promptForCredential",value:function(e){return this.application.privilegesService.displayInfoForCredential(e).prompt}},{key:"cancel",value:function(){this.dismiss(),this.onCancel&&this.onCancel()}},{key:"isCredentialInFailureState",value:function(e){return!!this.failedCredentials&&null!=this.failedCredentials.find((function(t){return t===e}))}},{key:"validate",value:function(){var e=[],t=!0,n=!1,r=void 0;try{for(var i,a=this.requiredCredentials[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){var o=i.value,s=this.authParameters[o];s&&0!==s.length||e.push(o)}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}return this.failedCredentials=e,0===e.length}},{key:"submit",value:(t=_()(x.a.mark((function e(){var t,n=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.validate()){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.application.privilegesService.authenticateAction(this.action,this.authParameters);case 4:t=e.sent,this.$timeout((function(){t.success?(n.application.privilegesService.setSessionLength(n.selectedSessionLength),n.onSuccess(),n.dismiss()):n.failedCredentials=t.failedCredentials}));case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"dismiss",value:function(){this.$element.remove()}}]),e}(),In=function e(){f()(this,e),this.restrict="E",this.template=En.a,this.controller=An,this.controllerAs="ctrl",this.bindToController=!0,this.scope={action:"=",onSuccess:"=",onCancel:"="}},jn=n(77),Dn=n.n(jn),Mn=function(e){function t(e,n,r,i,a){var o;return f()(this,t),(o=h()(this,v()(t).call(this,e,n,i,a))).$element=r,o.application=i,o}var n,r;return t.$inject=["$scope","$timeout","$element","application","appState"],b()(t,e),P()(t,[{key:"onAppLaunch",value:function(){Y()(v()(t.prototype),"onAppLaunch",this).call(this),this.hasPasscode=this.application.hasPasscode(),this.hasAccount=!this.application.noAccount(),this.reloadPrivileges()}},{key:"displayInfoForCredential",value:function(e){var t=this.application.privilegesService.displayInfoForCredential(e);return e===w.PrivilegeCredentials.LocalPasscode?t.availability=this.hasPasscode:e===w.PrivilegeCredentials.AccountPassword?t.availability=this.hasAccount:t.availability=!0,t}},{key:"displayInfoForAction",value:function(e){return this.application.privilegesService.displayInfoForAction(e).label}},{key:"isCredentialRequiredForAction",value:function(e,t){return!!this.privileges&&this.privileges.isCredentialRequiredForAction(e,t)}},{key:"clearSession",value:(r=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.application.privilegesService.clearSession();case 2:this.reloadPrivileges();case 3:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"reloadPrivileges",value:(n=_()(x.a.mark((function e(){var t,n,r,i,a,o,s,c,u=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.availableActions=this.application.privilegesService.getAvailableActions(),this.availableCredentials=this.application.privilegesService.getAvailableCredentials(),e.next=4,this.application.privilegesService.getSessionExpirey();case 4:for(t=e.sent,this.sessionExpirey=t.toLocaleString(),this.sessionExpired=new Date>=t,this.credentialDisplayInfo={},n=!0,r=!1,i=void 0,e.prev=11,a=this.availableCredentials[Symbol.iterator]();!(n=(o=a.next()).done);n=!0)s=o.value,this.credentialDisplayInfo[s]=this.displayInfoForCredential(s);e.next=19;break;case 15:e.prev=15,e.t0=e.catch(11),r=!0,i=e.t0;case 19:e.prev=19,e.prev=20,n||null==a.return||a.return();case 22:if(e.prev=22,!r){e.next=25;break}throw i;case 25:return e.finish(22);case 26:return e.finish(19);case 27:return e.next=29,this.application.privilegesService.getPrivileges();case 29:c=e.sent,this.$timeout((function(){u.privileges=c}));case 31:case"end":return e.stop()}}),e,this,[[11,15,19,27],[20,,22,26]])}))),function(){return n.apply(this,arguments)})},{key:"checkboxValueChanged",value:function(e,t){this.privileges.toggleCredentialForAction(e,t),this.application.privilegesService.savePrivileges()}},{key:"cancel",value:function(){this.dismiss(),this.onCancel&&this.onCancel()}},{key:"dismiss",value:function(){this.$element.remove()}}]),t}(q),Tn=function e(){f()(this,e),this.restrict="E",this.template=Dn.a,this.controller=Mn,this.controllerAs="ctrl",this.bindToController=!0,this.scope={}},Rn=n(78),Ln=n.n(Rn),Nn=function(){function e(t,n,r,i){var a=this;f()(this,e),this.$element=t,this.$scope=n,this.$timeout=r,this.application=i,n.$on("$destroy",(function(){a.identifier&&a.application.componentManager.deregisterHandler(a.identifier)}))}var t;return e.$inject=["$element","$scope","$timeout","application"],P()(e,[{key:"$onInit",value:function(){this.configure()}},{key:"configure",value:(t=_()(x.a.mark((function e(){var t,n,r=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.application.createItem({contentType:w.ContentTypes.Note,content:this.content});case 2:return this.note=e.sent,this.note.uuid=this.uuid,t=this.application.componentManager.editorForNote(this.note),e.next=7,this.application.generateUuid();case 7:if(this.note.uuid=e.sent,!t){e.next=17;break}return e.next=11,this.application.createItem({contentType:w.ContentTypes.Component,content:t.content});case 11:(n=e.sent).readonly=!0,n.lockReadonly=!0,this.identifier=n.uuid,this.application.componentManager.registerHandler({identifier:this.identifier,areas:["editor-editor"],contextRequestHandler:function(e){if(e===r.editor)return r.note},componentForSessionKeyHandler:function(e){if(e===r.editor.sessionKey)return r.editor}}),this.editor=n;case 17:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"restore",value:function(e){var t=this,n=function(){var n=_()(x.a.mark((function n(){var r,i,a;return x.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!e){n.next=8;break}return(i=Object.assign({},t.content)).title&&(i.title+=" (copy)"),n.next=5,t.application.createItem({contentType:"Note",content:i,needsSync:!0});case 5:r=n.sent,n.next=13;break;case 8:return a=t.uuid,(r=t.application.findItem({uuid:a})).content=Object.assign({},t.content),n.next=13,t.application.mergeItem({item:r,source:w.PAYLOAD_SOURCE_REMOTE_ACTION_RETRIEVED});case 13:t.application.saveItem({item:r}),t.dismiss();case 15:case"end":return n.stop()}}),n)})));return function(){return n.apply(this,arguments)}}();e?n():this.application.alertService.confirm({text:"Are you sure you want to replace the current note's contents with what you see in this preview?",destructive:!0,onConfirm:n})}},{key:"dismiss",value:function(){this.$element.remove(),this.$scope.$destroy()}}]),e}(),Fn=function e(){f()(this,e),this.restrict="E",this.template=Ln.a,this.controller=Nn,this.controllerAs="ctrl",this.bindToController=!0,this.scope={uuid:"=",content:"="}},Un=n(79),Kn=n.n(Un),Vn=function(){function e(t,n,r){f()(this,e),this.$timeout=t,this.godService=n,this.application=r,this.diskEnabled=this.application.historyManager.isDiskEnabled(),this.autoOptimize=this.application.historyManager.isAutoOptimizeEnabled()}return e.$inject=["$timeout","godService","application"],P()(e,[{key:"$onInit",value:function(){this.reloadHistory()}},{key:"reloadHistory",value:function(){var e=this.application.historyManager.historyForItem(this.item);this.entries=e.entries.slice(0).sort((function(e,t){return e.item.updated_at<t.item.updated_at?1:-1})),this.history=e}},{key:"openRevision",value:function(e){this.godService.presentRevisionPreviewModal(e.item.uuid,e.item.content)}},{key:"classForRevision",value:function(e){var t=e.operationVector();return 0===t?"default":1===t?"success":-1===t?"danger":void 0}},{key:"clearItemHistory",value:function(){var e=this;this.application.alertService.confirm({text:"Are you sure you want to delete the local session history for this note?",destructive:!0,onConfirm:function(){e.application.historyManager.clearHistoryForItem(e.item).then((function(){e.$timeout((function(){e.reloadHistory()}))}))}})}},{key:"clearAllHistory",value:function(){var e=this;this.application.alertService.confirm({text:"Are you sure you want to delete the local session history for all notes?",destructive:!0,onConfirm:function(){e.application.historyManager.clearAllHistory().then((function(){e.$timeout((function(){e.reloadHistory()}))}))}})}},{key:"toggleDiskSaving",value:function(){var e=this,t=function(){e.application.historyManager.toggleDiskSaving().then((function(){e.$timeout((function(){e.diskEnabled=e.application.historyManager.diskEnabled}))}))};this.application.historyManager.diskEnabled?t():this.application.alertService.confirm({text:"Are you sure you want to save history to disk? This will decrease general \n performance, especially as you type. You are advised to disable this feature \n if you experience any lagging.",destructive:!0,onConfirm:t})}},{key:"toggleAutoOptimize",value:function(){var e=this;this.application.historyManager.toggleAutoOptimize().then((function(){e.$timeout((function(){e.autoOptimize=e.application.historyManager.autoOptimize}))}))}}]),e}(),Bn=function e(){f()(this,e),this.restrict="E",this.template=Kn.a,this.controller=Vn,this.controllerAs="ctrl",this.bindToController=!0,this.scope={item:"="}},Hn=n(80),zn=n.n(Hn),Wn=function(){function e(t,n,r){f()(this,e),this.$timeout=t,this.archiveManager=n,this.application=r,this.status={}}var t;return e.$inject=["$timeout","archiveManager","application"],P()(e,[{key:"downloadBackup",value:function(e){this.archiveManager.downloadBackup(e),this.status.backupFinished=!0}},{key:"skipBackup",value:function(){this.status.backupFinished=!0}},{key:"performSyncResolution",value:(t=_()(x.a.mark((function e(){var t=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.status.resolving=!0,e.next=3,this.application.resolveOutOfSync();case 3:this.$timeout((function(){t.status.resolving=!1,t.status.attemptedResolution=!0,t.application.getSyncStatus().isOutOfSync()?t.status.fail=!0:t.status.success=!0}));case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"close",value:function(){var e=this;this.$timeout((function(){e.closeFunction()()}))}}]),e}(),qn=function e(){f()(this,e),this.restrict="E",this.template=zn.a,this.controller=Wn,this.controllerAs="ctrl",this.bindToController=!0,this.scope={closeFunction:"&"}};function Gn(e){return function(t){return e.trustAsResourceUrl(t)}}Gn.$inject=["$sce"];var Yn=function(){function e(t,n,r){f()(this,e),this.lockManager=t,this.application=n,this.godService=r}var t,n,r,i,a;return e.$inject=["lockManager","application","godService"],P()(e,[{key:"downloadBackup",value:(a=_()(x.a.mark((function e(t){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.downloadBackupOfItems(this.application.modelManager.allItems,t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"downloadBackupOfItems",value:(i=_()(x.a.mark((function e(t,n){var r,i=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=function(){var e=_()(x.a.mark((function e(){var r;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n?w.EncryptionIntents.FileEncrypted:w.EncryptionIntents.FileDecrypted,i.itemsData(t,r).then((function(e){var r=n?"Encrypted":"Decrypted";i.downloadData(e,"Standard Notes ".concat(r," Backup - ").concat(i.formattedDate(),".txt")),n||i.downloadZippedItems(t)}));case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),e.next=3,this.application.privilegesService.actionRequiresPrivilege(w.ProtectedActions.ManageBackups);case 3:if(!e.sent){e.next=7;break}this.godService.presentPrivilegesModal(w.ProtectedActions.ManageBackups,(function(){r()})),e.next=8;break;case 7:r();case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"formattedDate",value:function(){var e="".concat(new Date),t=e.match(/^(.*?) \(/);return t.length>=2?t[1]:e}},{key:"itemsData",value:(r=_()(x.a.mark((function e(t,n){var r,i;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.application.createBackupFile({subItems:t,intent:n});case 2:return r=e.sent,i=new Blob([r],{type:"text/json"}),e.abrupt("return",i);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"loadZip",value:(n=_()(x.a.mark((function e(){var t;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!window.zip){e.next=2;break}return e.abrupt("return");case 2:return(t=document.createElement("script")).src="/assets/zip/zip.js",t.async=!1,document.getElementsByTagName("head")[0].appendChild(t),e.abrupt("return",new Promise((function(e,n){t.onload=function(){zip.workerScriptsPath="assets/zip/",e()}})));case 8:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)})},{key:"downloadZippedItems",value:(t=_()(x.a.mark((function e(t){var n=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadZip();case 2:zip.createWriter(new zip.BlobWriter("application/zip"),(function(e){var r=0;!function i(){var a,o,s=t[r];"Note"===s.content_type?(a=s.content.title,o=s.content.text):(a=s.content_type,o=JSON.stringify(s.content,null,2)),a||(a="");var c=new Blob([o],{type:"text/plain"}),u=a.replace(/\//g,"").replace(/\\+/g,""),l="-".concat(s.uuid.split("-")[0],".txt");u=u.slice(0,255-l.length);var f="".concat(s.content_type,"/").concat(u).concat(l);e.add(f,new zip.BlobReader(c),(function(){++r<t.length?i():e.close((function(t){n.downloadData(t,"Standard Notes Backup - ".concat(n.formattedDate(),".zip")),e=null}))}))}()}),onerror);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hrefForData",value:function(e){return null!==this.textFile&&window.URL.revokeObjectURL(this.textFile),this.textFile=window.URL.createObjectURL(e),this.textFile}},{key:"downloadData",value:function(e,t){var n=document.createElement("a");n.setAttribute("download",t),n.href=this.hrefForData(e),document.body.appendChild(n),n.click(),n.remove()}}]),e}(),Jn=function(){function e(t,n,r,i){var a=this;f()(this,e),this.$rootScope=t,this.$timeout=n,this.appState=i,this.application=r,this.componentActivationObservers=[],this.updateObservers=[],this.isDesktop=c(),t.$on("initial-data-loaded",(function(){a.dataLoaded=!0,a.dataLoadHandler&&a.dataLoadHandler()})),t.$on("major-data-change",(function(){a.majorDataChangeHandler&&a.majorDataChangeHandler()}))}var t,n,r,i,a;return e.$inject=["$rootScope","$timeout","application","appState"],P()(e,[{key:"saveBackup",value:function(){this.majorDataChangeHandler&&this.majorDataChangeHandler()}},{key:"getExtServerHost",value:function(){return console.assert(this.extServerHost,"extServerHost is null"),this.extServerHost}},{key:"convertComponentForTransmission",value:(a=_()(x.a.mark((function e(t){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.application.protocolService.payloadByEncryptingPayload({payload:t.payloadRepresentation(),intent:w.EncryptionIntents.FileDecrypted}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"syncComponentsInstallation",value:function(e){var t=this;this.isDesktop&&Promise.all(e.map((function(e){return t.convertComponentForTransmission(e)}))).then((function(e){t.installationSyncHandler(e)}))}},{key:"installComponent",value:(i=_()(x.a.mark((function e(t){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=this,e.next=3,this.convertComponentForTransmission(t);case 3:e.t1=e.sent,e.t0.installComponentHandler.call(e.t0,e.t1);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"registerUpdateObserver",value:function(e){var t={callback:e};return this.updateObservers.push(t),t}},{key:"searchText",value:function(e){this.isDesktop&&(this.lastSearchedText=e,this.searchHandler&&this.searchHandler(e))}},{key:"redoSearch",value:function(){this.lastSearchedText&&this.searchText(this.lastSearchedText)}},{key:"deregisterUpdateObserver",value:function(e){D()(this.updateObservers,e)}},{key:"desktop_setSearchHandler",value:function(e){this.searchHandler=e}},{key:"desktop_windowGainedFocus",value:function(){this.$rootScope.$broadcast("window-gained-focus")}},{key:"desktop_windowLostFocus",value:function(){this.$rootScope.$broadcast("window-lost-focus")}},{key:"desktop_onComponentInstallationComplete",value:(r=_()(x.a.mark((function e(t,n){var r,i,a,o,s=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.application.findItem({uuid:t.uuid});case 2:if(r=e.sent){e.next=5;break}return e.abrupt("return");case 5:if(n)r.setAppDataItem("installError",n);else{for(i=0,a=["package_info","local_url"];i<a.length;i++)r[o=a[i]]=t.content[o];r.setAppDataItem("installError",null)}this.application.saveItem({item:r}),this.$timeout((function(){var e=!0,t=!1,n=void 0;try{for(var i,a=s.updateObservers[Symbol.iterator]();!(e=(i=a.next()).done);e=!0)i.value.callback(r)}catch(e){t=!0,n=e}finally{try{e||null==a.return||a.return()}finally{if(t)throw n}}}));case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"desktop_registerComponentActivationObserver",value:function(e){var t={id:Math.random,callback:e};return this.componentActivationObservers.push(t),t}},{key:"desktop_deregisterComponentActivationObserver",value:function(e){D()(this.componentActivationObservers,e)}},{key:"notifyComponentActivation",value:(n=_()(x.a.mark((function e(t){var n,r=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.convertComponentForTransmission(t);case 2:n=e.sent,this.$timeout((function(){var e=!0,t=!1,i=void 0;try{for(var a,o=r.componentActivationObservers[Symbol.iterator]();!(e=(a=o.next()).done);e=!0)a.value.callback(n)}catch(e){t=!0,i=e}finally{try{e||null==o.return||o.return()}finally{if(t)throw i}}}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"desktop_setExtServerHost",value:function(e){this.extServerHost=e,this.appState.desktopExtensionsReady()}},{key:"desktop_setComponentInstallationSyncHandler",value:function(e){this.installationSyncHandler=e}},{key:"desktop_setInstallComponentHandler",value:function(e){this.installComponentHandler=e}},{key:"desktop_setInitialDataLoadHandler",value:function(e){this.dataLoadHandler=e,this.dataLoaded&&this.dataLoadHandler()}},{key:"desktop_requestBackupFile",value:(t=_()(x.a.mark((function e(t){var n;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.application.createBackupFile({returnIfEmpty:!0});case 2:n=e.sent,t(n);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"desktop_setMajorDataChangeHandler",value:function(e){this.majorDataChangeHandler=e}},{key:"desktop_didBeginBackup",value:function(){this.appState.beganBackupDownload()}},{key:"desktop_didFinishBackup",value:function(e){this.appState.endedBackupDownload({success:e})}}]),e}(),Qn=function(){function e(t,n,r){f()(this,e),this.$rootScope=t,this.$compile=n,this.application=r}var t,n;return e.$inject=["$rootScope","$compile","application"],P()(e,[{key:"checkForSecurityUpdate",value:(n=_()(x.a.mark((function e(){var t;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.application.noAccount()){e.next=2;break}return e.abrupt("return",!1);case 2:return e.next=4,this.application.protocolUpgradeAvailable();case 4:return(t=e.sent)!==this.securityUpdateAvailable&&(this.securityUpdateAvailable=t,this.$rootScope.$broadcast("security-update-status-changed")),e.abrupt("return",this.securityUpdateAvailable);case 7:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"presentPasswordWizard",value:function(e){var t=this.$rootScope.$new(!0);t.type=e;var n=this.$compile("<password-wizard type='type'></password-wizard>")(t);a.a.element(document.body).append(n)}},{key:"presentPrivilegesModal",value:(t=_()(x.a.mark((function e(t,n,r){var i,o,s,c,u=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.authenticationInProgress()){e.next=3;break}return r&&r(),e.abrupt("return");case 3:i=function(){var e=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=n,!e.t0){e.next=4;break}return e.next=4,n();case 4:u.currentAuthenticationElement=null;case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),o=function(){var e=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=r,!e.t0){e.next=4;break}return e.next=4,r();case 4:u.currentAuthenticationElement=null;case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),(s=this.$rootScope.$new(!0)).action=t,s.onSuccess=i,s.onCancel=o,c=this.$compile("\n <privileges-auth-modal action='action' on-success='onSuccess' \n on-cancel='onCancel' class='sk-modal'></privileges-auth-modal>\n ")(s),a.a.element(document.body).append(c),this.currentAuthenticationElement=c;case 12:case"end":return e.stop()}}),e,this)}))),function(e,n,r){return t.apply(this,arguments)})},{key:"presentPrivilegesManagementModal",value:function(){var e=this.$rootScope.$new(!0),t=this.$compile("<privileges-management-modal class='sk-modal'></privileges-management-modal>")(e);a.a.element(document.body).append(t)}},{key:"authenticationInProgress",value:function(){return null!=this.currentAuthenticationElement}},{key:"presentPasswordModal",value:function(e){var t=this.$rootScope.$new(!0);t.type="password",t.title="Decryption Assistance",t.message="Unable to decrypt this item with your current keys. \n Please enter your account password at the time of this revision.",t.callback=e;var n=this.$compile("<input-modal type='type' message='message' \n title='title' callback='callback'></input-modal>")(t);a.a.element(document.body).append(n)}},{key:"presentRevisionPreviewModal",value:function(e,t){var n=this.$rootScope.$new(!0);n.uuid=e,n.content=t;var r=this.$compile("<revision-preview-modal uuid='uuid' content='content' \n class='sk-modal'></revision-preview-modal>")(n);a.a.element(document.body).append(r)}}]),e}(),Zn=function(){function e(t,n,r){f()(this,e),this.$rootScope=t,this.application=n,this.appState=r,this.observeVisibility()}var t,n,r,i;return e.$inject=["$rootScope","application","appState"],P()(e,[{key:"observeVisibility",value:function(){var e=this;this.appState.addObserver((function(t,n){t===B?e.documentVisibilityChanged(!1):t===V&&e.documentVisibilityChanged(!0)})),c()||this.beginWebFocusPolling()}},{key:"setAutoLockInterval",value:(i=_()(x.a.mark((function e(t){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.application.setValue("AutoLockIntervalKey",t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getAutoLockInterval",value:(r=_()(x.a.mark((function e(){var t;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.application.getValue("AutoLockIntervalKey");case 2:if(!(t=e.sent)){e.next=7;break}return e.abrupt("return",t);case 7:return e.abrupt("return",0);case 8:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"beginWebFocusPolling",value:function(){var e=this;this.pollFocusTimeout=setInterval((function(){var t=document.hasFocus();t&&"hidden"===e.lastFocusState?e.documentVisibilityChanged(!0):t||"visible"!==e.lastFocusState||e.documentVisibilityChanged(!1),e.lastFocusState=t?"visible":"hidden"}),1e3)}},{key:"getAutoLockIntervalOptions",value:function(){return[{value:0,label:"Off"},{value:1,label:"Immediately"},{value:6e4,label:"1m"},{value:3e5,label:"5m"},{value:36e5,label:"1h"}]}},{key:"documentVisibilityChanged",value:(n=_()(x.a.mark((function e(t){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=8;break}return e.next=3,this.application.isLocked();case 3:!e.sent&&this.lockAfterDate&&new Date>this.lockAfterDate&&this.application.lock(),this.cancelAutoLockTimer(),e.next=9;break;case 8:this.beginAutoLockTimer();case 9:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"beginAutoLockTimer",value:(t=_()(x.a.mark((function e(){var t,n,r=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getAutoLockInterval();case 2:if(0!==(t=e.sent)){e.next=5;break}return e.abrupt("return");case 5:n=function(e){var t=new Date;return t.setSeconds(t.getSeconds()+e),t},this.lockAfterDate=n(t/1e3),this.lockTimeout=setTimeout((function(){r.cancelAutoLockTimer(),r.application.lock(),r.lockAfterDate=null}),t);case 8:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"cancelAutoLockTimer",value:function(){clearTimeout(this.lockTimeout),this.lockAfterDate=null}}]),e}(),Xn=function(){function e(t){var n=this;f()(this,e),this.application=t,this.extManagerId="org.standardnotes.extensions-manager",this.batchManagerId="org.standardnotes.batch-manager",this.unsub=t.addSingleEventObserver(w.ApplicationEvents.Launched,(function(){n.reload()}))}var t,n;return e.$inject=["application"],P()(e,[{key:"reload",value:function(){this.application.singletonManager.registerPredicate(this.extManagerPred),this.application.singletonManager.registerPredicate(this.batchManagerPred),this.resolveExtensionsManager(),this.resolveBatchManager()}},{key:"resolveExtensionsManager",value:(n=_()(x.a.mark((function e(){var t,n,r;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.application.singletonManager.findOrCreateSingleton({predicate:this.extManagerPred,createPayload:this.extensionsManagerTemplatePayload()});case 2:t=e.sent,n=!1,c()?t.local_url||(t.local_url=window._extensions_manager_location,n=!0):t.hosted_url||(t.hosted_url=window._extensions_manager_location,n=!0),(r=t.content.permissions.find((function(e){return"stream-items"===e.name}))).content_types.includes(w.ContentTypes.ExtensionRepo)||(r.content_types.push(w.ContentTypes.ExtensionRepo),n=!0),n&&this.application.saveItem({item:t});case 8:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"extensionsManagerTemplatePayload",value:function(){if(window._extensions_manager_location){var e={name:"Extensions",identifier:this.extManagerId},t={name:e.name,area:"rooms",package_info:e,permissions:[{name:"stream-items",content_types:[w.ContentTypes.Component,w.ContentTypes.Theme,w.ContentTypes.ServerExtension,w.ContentTypes.ActionsExtension,w.ContentTypes.Mfa,w.ContentTypes.Editor,w.ContentTypes.ExtensionRepo]}]};return c()?t.local_url=window._extensions_manager_location:t.hosted_url=window._extensions_manager_location,Object(w.CreateMaxPayloadFromAnyObject)({object:{content_type:w.ContentTypes.Component,content:t}})}console.error("window._extensions_manager_location must be set.")}},{key:"batchManagerTemplatePayload",value:function(){if(window._batch_manager_location){var e,t={name:"Batch Manager",identifier:this.batchManagerId},n=(e=w.ContentTypes,Object.keys(e).map((function(t){return e[t]}))),r={name:t.name,area:"modal",package_info:t,permissions:[{name:"stream-items",content_types:n}]};return c()?r.local_url=window._batch_manager_location:r.hosted_url=window._batch_manager_location,Object(w.CreateMaxPayloadFromAnyObject)({object:{content_type:w.ContentTypes.Component,content:r}})}console.error("window._batch_manager_location must be set.")}},{key:"resolveBatchManager",value:(t=_()(x.a.mark((function e(){var t,n,r;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.application.singletonManager.findOrCreateSingleton({predicate:this.batchManagerPred,createPayload:this.batchManagerTemplatePayload()});case 2:t=e.sent,n=!1,c()?t.local_url||(t.local_url=window._batch_manager_location,n=!0):t.hosted_url||(t.hosted_url=window._batch_manager_location,n=!0),(r=t.content.permissions.find((function(e){return"stream-items"===e.name}))).content_types.includes(w.ContentTypes.ExtensionRepo)||(r.content_types.push(w.ContentTypes.ExtensionRepo),n=!0),n&&this.application.saveItem({item:t});case 8:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"extManagerPred",get:function(){return w.SNPredicate.CompoundPredicate([new w.SNPredicate("content_type","=",w.ContentTypes.Component),new w.SNPredicate("package_info.identifier","=","org.standardnotes.extensions-manager")])}},{key:"batchManagerPred",get:function(){return w.SNPredicate.CompoundPredicate([new w.SNPredicate("content_type","=",w.ContentTypes.Component),new w.SNPredicate("package_info.identifier","=","org.standardnotes.batch-manager")])}}]),e}(),er=n(35),tr=n.n(er),nr=function(){function e(){f()(this,e),this.statuses=[],this.observers=[]}return P()(e,[{key:"statusFromString",value:function(e){return{string:e}}},{key:"replaceStatusWithString",value:function(e,t){return this.removeStatus(e),this.addStatusFromString(t)}},{key:"addStatusFromString",value:function(e){return this.addStatus(this.statusFromString(e))}},{key:"addStatus",value:function(e){if("object"===tr()(e))return this.statuses.push(e),this.notifyObservers(),e;console.error("Attempting to set non-object status",e)}},{key:"removeStatus",value:function(e){return Ge.a.pull(this.statuses,e),this.notifyObservers(),null}},{key:"getStatusString",value:function(){var e="";return this.statuses.forEach((function(t,n){n>0&&(e+=" "),e+=t.string})),e}},{key:"notifyObservers",value:function(){var e=!0,t=!1,n=void 0;try{for(var r,i=this.observers[Symbol.iterator]();!(e=(r=i.next()).done);e=!0){(0,r.value)(this.getStatusString())}}catch(e){t=!0,n=e}finally{try{e||null==i.return||i.return()}finally{if(t)throw n}}}},{key:"addStatusObserver",value:function(e){this.observers.push(e)}},{key:"removeStatusObserver",value:function(e){Ge.a.pull(this.statuses,e)}}]),e}(),rr=function(e){function t(e,n,r){var i;return f()(this,t),(i=h()(this,v()(t).call(this))).application=e,i.appState=n,i.desktopManager=r,i.activeThemes=[],i.application.isStarted()&&i.onAppStart(),i.unsub=e.addEventObserver((function(e){e===w.ApplicationEvents.Started?i.onAppStart():e===w.ApplicationEvents.SignedOut&&i.deactivateAllThemes()})),i.unsubState=n.addObserver((function(e,t){e===K&&i.activateCachedThemes()})),i}var n,r,i,a,o;return t.$inject=["application","appState","desktopManager"],b()(t,e),P()(t,[{key:"onAppStart",value:function(){this.registerObservers(),this.desktopManager.isDesktop||this.activateCachedThemes()}},{key:"deinit",value:(o=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Y()(v()(t.prototype),"deinit",this).call(this),this.unsubState();case 2:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"activateCachedThemes",value:(a=_()(x.a.mark((function e(){var t,n,r,i,a,o,s;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getCachedThemes();case 2:for(t=e.sent,n=!0,r=!1,i=void 0,e.prev=7,a=t[Symbol.iterator]();!(n=(o=a.next()).done);n=!0)s=o.value,this.activateTheme(s,!1);e.next=15;break;case 11:e.prev=11,e.t0=e.catch(7),r=!0,i=e.t0;case 15:e.prev=15,e.prev=16,n||null==a.return||a.return();case 18:if(e.prev=18,!r){e.next=21;break}throw i;case 21:return e.finish(18);case 22:return e.finish(15);case 23:case"end":return e.stop()}}),e,this,[[7,11,15,23],[16,,18,22]])}))),function(){return a.apply(this,arguments)})},{key:"registerObservers",value:function(){var e=this;this.desktopManager.registerUpdateObserver((function(t){t.active&&t.isTheme()&&(e.deactivateTheme(t),setTimeout((function(){e.activateTheme(t)}),10))})),this.application.componentManager.registerHandler({identifier:"themeManager",areas:["themes"],activationHandler:function(t){t.active?e.activateTheme(t):e.deactivateTheme(t)}})}},{key:"hasActiveTheme",value:function(){return this.application.componentManager.getActiveThemes().length>0}},{key:"deactivateAllThemes",value:function(){var e=this.application.componentManager.getActiveThemes(),t=!0,n=!1,r=void 0;try{for(var i,a=e[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){var o=i.value;o&&this.application.componentManager.deactivateComponent(o)}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}this.decacheThemes()}},{key:"activateTheme",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!Ge.a.find(this.activeThemes,{uuid:e.uuid})){this.activeThemes.push(e);var n=this.application.componentManager.urlForComponent(e),r=document.createElement("link");r.href=n,r.type="text/css",r.rel="stylesheet",r.media="screen,print",r.id=e.uuid,document.getElementsByTagName("head")[0].appendChild(r),t&&this.cacheThemes()}}},{key:"deactivateTheme",value:function(e){var t=document.getElementById(e.uuid);t&&(t.disabled=!0,t.parentNode.removeChild(t)),Ge.a.remove(this.activeThemes,{uuid:e.uuid}),this.cacheThemes()}},{key:"cacheThemes",value:(i=_()(x.a.mark((function e(){var t,n=this;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(this.activeThemes.map(function(){var e=_()(x.a.mark((function e(t){var r,i;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.payloadRepresentation(),e.next=3,n.application.protocolService.payloadByEncryptingPayload({payload:r,intent:w.EncryptionIntents.LocalStorageDecrypted});case 3:return i=e.sent,e.abrupt("return",i);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 2:return t=e.sent,e.abrupt("return",this.application.setValue("cachedThemes",t,w.StorageValueModes.Nonwrapped));case 4:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"decacheThemes",value:(r=_()(x.a.mark((function e(){return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.application.removeValue("cachedThemes",w.StorageValueModes.Nonwrapped));case 1:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getCachedThemes",value:(n=_()(x.a.mark((function e(){var t,n,r,i,a,o,s,c,u;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.application.getValue("cachedThemes",w.StorageValueModes.Nonwrapped);case 2:if(!(t=e.sent)){e.next=36;break}n=[],r=!0,i=!1,a=void 0,e.prev=8,o=t[Symbol.iterator]();case 10:if(r=(s=o.next()).done){e.next=19;break}return c=s.value,e.next=14,this.application.createItem({contentType:w.ContentTypes.Theme,content:c.content});case 14:u=e.sent,n.push(u);case 16:r=!0,e.next=10;break;case 19:e.next=25;break;case 21:e.prev=21,e.t0=e.catch(8),i=!0,a=e.t0;case 25:e.prev=25,e.prev=26,r||null==o.return||o.return();case 28:if(e.prev=28,!i){e.next=31;break}throw a;case 31:return e.finish(28);case 32:return e.finish(25);case 33:return e.abrupt("return",n);case 36:return e.abrupt("return",[]);case 37:case"end":return e.stop()}}),e,this,[[8,21,25,33],[26,,28,32]])}))),function(){return n.apply(this,arguments)})}]),t}(w.PureService);a.a.module("app",["ngSanitize"]),a.a.module("app").config(u).constant("appVersion","3.5.0"),a.a.module("app").directive("root",(function(){return new ut})).directive("tagsPanel",(function(){return new at})).directive("notesPanel",(function(){return new tt})).directive("editorPanel",(function(){return new Ve})).directive("footer",(function(){return new We})).directive("lockScreen",(function(){return new ht})),a.a.module("app").directive("snAutofocus",["$timeout",dt]).directive("clickOutside",["$document",vt]).directive("delayHide",yt).directive("elemReady",mt).directive("fileChange",(function(){return{restrict:"A",scope:{handler:"&"},link:function(e,t){t.on("change",(function(t){e.$apply((function(){e.handler({files:t.target.files})}))}))}}})).directive("infiniteScroll",["$rootScope","$window","$timeout",gt]).directive("lowercase",(function(){return{require:"ngModel",link:function(e,t,n,r){var i=function(e){void 0===e&&(e="");var t=e.toLowerCase();return t!==e&&(r.$setViewValue(t),r.$render()),t};r.$parsers.push(i),i(e[n.ngModel])}}})).directive("selectOnClick",["$window",bt]).directive("snEnter",(function(){return function(e,t,n){t.bind("keydown keypress",(function(t){13===t.which&&(e.$apply((function(){e.$eval(n.snEnter,{event:t})})),t.preventDefault())}))}})),a.a.module("app").directive("accountMenu",(function(){return new $t})).directive("actionsMenu",(function(){return new Et})).directive("componentModal",(function(){return new Dt})).directive("componentView",(function(){return new Lt})).directive("conflictResolutionModal",(function(){return new Kt})).directive("editorMenu",(function(){return new zt})).directive("inputModal",(function(){return new Yt})).directive("menuRow",(function(){return new Xt})).directive("panelResizer",(function(){return new vn})).directive("passwordWizard",(function(){return new Sn})).directive("permissionsModal",(function(){return new On})).directive("privilegesAuthModal",(function(){return new In})).directive("privilegesManagementModal",(function(){return new Tn})).directive("revisionPreviewModal",(function(){return new Fn})).directive("sessionHistoryMenu",(function(){return new Bn})).directive("syncResolutionMenu",(function(){return new qn})),a.a.module("app").filter("trusted",["$sce",Gn]),a.a.module("app").service("appState",W).service("application",I).service("archiveManager",Yn).service("desktopManager",Jn).service("godService",Qn).service("keyboardManager",se).service("lockManager",Zn).service("nativeExtManager",Xn).service("preferencesManager",Oe).service("statusManager",nr).service("themeManager",rr)}]);
//# sourceMappingURL=app.js.map