UNPKG

coins-logon-widget

Version:

COINS Logon Widget. Injectable utility to manage browser authorization with COINS

21 lines 50.2 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("CoinsLogonWidget",[],e):"object"==typeof exports?exports.CoinsLogonWidget=e():t.CoinsLogonWidget=e()}(window,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=83)}([function(t,e,n){var r=n(20),o=n(18),i=n(47),s=n(27),a=n(17),u=n(16);t.exports={diff:r,patch:o,h:i,create:s,VNode:a,VText:u}},function(t,e){t.exports=function(t){return t&&"Widget"===t.type}},function(t,e){t.exports=function(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}},function(t,e){t.exports=function(t){return!!t&&"object"==typeof t}},function(t,e){t.exports="2"},function(t,e,n){var r=n(4);t.exports=function(t){return t&&"VirtualNode"===t.type&&t.version===r}},function(t,e){var n=9007199254740991;t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=n}},function(t,e,n){var r=n(77),o=n(6);t.exports=function(t){return null!=t&&o(r(t))}},function(t,e){t.exports=function(t){return t&&"Thunk"===t.type}},function(t,e,n){var r=n(4);t.exports=function(t){return t&&"VirtualText"===t.type&&t.version===r}},function(t,e){t.exports=function(t){return t&&("function"==typeof t.hook&&!t.hasOwnProperty("hook")||"function"==typeof t.unhook&&!t.hasOwnProperty("unhook"))}},function(t,e,n){var r=n(29),o=n(6),i=n(3),s=Object.prototype.toString,a=r(Array,"isArray")||function(t){return i(t)&&o(t.length)&&"[object Array]"==s.call(t)};t.exports=a},function(t,e,n){var r=n(7),o=n(3),i=Object.prototype,s=i.hasOwnProperty,a=i.propertyIsEnumerable;t.exports=function(t){return o(t)&&r(t)&&s.call(t,"callee")&&!a.call(t,"callee")}},function(t,e){var n=Array.isArray,r=Object.prototype.toString;t.exports=n||function(t){return"[object Array]"===r.call(t)}},function(t,e){var n=/^\d+$/,r=9007199254740991;t.exports=function(t,e){return t="number"==typeof t||n.test(t)?+t:-1,e=null==e?r:e,t>-1&&t%1==0&&t<e}},function(t,e,n){var r=n(12),o=n(11),i=n(14),s=n(6),a=n(2),u=Object.prototype.hasOwnProperty;t.exports=function(t){if(null==t)return[];a(t)||(t=Object(t));var e=t.length;e=e&&s(e)&&(o(t)||r(t))&&e||0;for(var n=t.constructor,c=-1,l="function"==typeof n&&n.prototype===t,p=Array(e),f=e>0;++c<e;)p[c]=c+"";for(var h in t)f&&i(h,e)||"constructor"==h&&(l||!u.call(t,h))||p.push(h);return p}},function(t,e,n){var r=n(4);function o(t){this.text=String(t)}t.exports=o,o.prototype.version=r,o.prototype.type="VirtualText"},function(t,e,n){var r=n(4),o=n(5),i=n(1),s=n(8),a=n(10);t.exports=l;var u={},c=[];function l(t,e,n,r,l){this.tagName=t,this.properties=e||u,this.children=n||c,this.key=null!=r?String(r):void 0,this.namespace="string"==typeof l?l:null;var p,f=n&&n.length||0,h=0,d=!1,g=!1,v=!1;for(var y in e)if(e.hasOwnProperty(y)){var m=e[y];a(m)&&m.unhook&&(p||(p={}),p[y]=m)}for(var w=0;w<f;w++){var x=n[w];o(x)?(h+=x.count||0,!d&&x.hasWidgets&&(d=!0),!g&&x.hasThunks&&(g=!0),v||!x.hooks&&!x.descendantHooks||(v=!0)):!d&&i(x)?"function"==typeof x.destroy&&(d=!0):!g&&s(x)&&(g=!0)}this.count=f+h,this.hasWidgets=d,this.hasThunks=g,this.hooks=p,this.descendantHooks=v}l.prototype.version=r,l.prototype.type="VirtualNode"},function(t,e,n){var r=n(51);t.exports=r},function(t,e,n){var r=n(4);function o(t,e,n){this.type=Number(t),this.vNode=e,this.patch=n}o.NONE=0,o.VTEXT=1,o.VNODE=2,o.WIDGET=3,o.PROPS=4,o.ORDER=5,o.INSERT=6,o.REMOVE=7,o.THUNK=8,t.exports=o,o.prototype.version=r,o.prototype.type="VirtualPatch"},function(t,e,n){var r=n(56);t.exports=r},function(t,e,n){var r=n(5),o=n(9),i=n(1),s=n(8);function a(t,e){var n=t.vnode;if(n||(n=t.vnode=t.render(e)),!(r(n)||o(n)||i(n)))throw new Error("thunk did not return a valid node");return n}t.exports=function(t,e){var n=t,r=e;s(e)&&(r=a(e,t));s(t)&&(n=a(t,null));return{a:n,b:r}}},function(t,e,n){"use strict";t.exports=function(t){return"object"==typeof t&&null!==t}},function(t,e,n){var r=n(22),o=n(10);function i(t,e,n,r){if(r){var i=r[e];if(o(i))i.unhook&&i.unhook(t,e,n);else if("attributes"===e)for(var s in i)t.removeAttribute(s);else if("style"===e)for(var a in i)t.style[a]="";else t[e]="string"==typeof i?"":null}}function s(t,e,n,o,i){var s=n?n[o]:void 0;if("attributes"!==o)if(s&&r(s)&&a(s)!==a(i))t[o]=i;else{r(t[o])||(t[o]={});var u="style"===o?"":void 0;for(var c in i){var l=i[c];t[o][c]=void 0===l?u:l}}else for(var p in i){var f=i[p];void 0===f?t.removeAttribute(p):t.setAttribute(p,f)}}function a(t){return Object.getPrototypeOf?Object.getPrototypeOf(t):t.__proto__?t.__proto__:t.constructor?t.constructor.prototype:void 0}t.exports=function(t,e,n){for(var a in e){var u=e[a];void 0===u?i(t,a,u,n):o(u)?(i(t,a,u,n),u.hook&&u.hook(t,a,n?n[a]:void 0)):r(u)?s(t,e,n,a,u):t[a]=u}}},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){(function(e){var r,o=void 0!==e?e:"undefined"!=typeof window?window:{},i=n(57);"undefined"!=typeof document?r=document:(r=o["__GLOBAL_DOCUMENT_CACHE@4"])||(r=o["__GLOBAL_DOCUMENT_CACHE@4"]=i),t.exports=r}).call(this,n(24))},function(t,e,n){var r=n(25),o=n(23),i=n(5),s=n(9),a=n(1),u=n(21);t.exports=function t(e,n){var c=n&&n.document||r;var l=n?n.warn:null;e=u(e).a;if(a(e))return e.init();if(s(e))return c.createTextNode(e.text);if(!i(e))return l&&l("Item is not a valid virtual dom node",e),null;var p=null===e.namespace?c.createElement(e.tagName):c.createElementNS(e.namespace,e.tagName);var f=e.properties;o(p,f);var h=e.children;for(var d=0;d<h.length;d++){var g=t(h[d],n);g&&p.appendChild(g)}return p}},function(t,e,n){var r=n(26);t.exports=r},function(t,e,n){var r=n(6),o=n(3),i={};i["[object Float32Array]"]=i["[object Float64Array]"]=i["[object Int8Array]"]=i["[object Int16Array]"]=i["[object Int32Array]"]=i["[object Uint8Array]"]=i["[object Uint8ClampedArray]"]=i["[object Uint16Array]"]=i["[object Uint32Array]"]=!0,i["[object Arguments]"]=i["[object Array]"]=i["[object ArrayBuffer]"]=i["[object Boolean]"]=i["[object Date]"]=i["[object Error]"]=i["[object Function]"]=i["[object Map]"]=i["[object Number]"]=i["[object Object]"]=i["[object RegExp]"]=i["[object Set]"]=i["[object String]"]=i["[object WeakMap]"]=!1;var s=Object.prototype.toString;t.exports=function(t){return o(t)&&r(t.length)&&!!i[s.call(t)]}},function(t,e,n){var r=n(75);t.exports=function(t,e){var n=null==t?void 0:t[e];return r(n)?n:void 0}},function(t,e,n){var r=n(81),o=n(64)(r);t.exports=o},function(t,e,n){"use strict";t.exports={assertElement:function(t){if(!t)throw new TypeError("Element required");if(!(t instanceof Node))throw new TypeError("Expected element to be a DOM node");return t},assertString:function(t,e){if(!t||"string"!=typeof t)throw new TypeError(["expected string",e?" ("+e+")":"",", received: ",t.toString()].join(""));return t},callOrReturn:function(t,e){return t instanceof Function?t.apply(null,e):t},formatDay:function(t){return t<1?"less than 1 day":Math.ceil(t)+" days"}}},function(t,e){t.exports=function(t){return null==t?"":t+""}},function(t,e,n){var r=n(32),o=0;t.exports=function(t){var e=++o;return r(t)+e}},function(t,e,n){"use strict";t.exports={accountExpired:"Your account has expired.",accountWillExpire:function(t){return"Your account will expire in "+t+"."},passwordExpired:"Your password has expired.",passwordWillExpire:function(t){return"Your password will expire in "+t+"."}}},function(t,e,n){"use strict";var r=n(0).VNode,o=n(0).VText;t.exports=function(t){var e=t.username,n=e?[new o("Logged in as "),new r("strong",void 0,[new o(e)]),new o(".")]:[new o("Logged in.")];return new r("p",{className:"coins-logon-widget-status"},n)}},function(t,e,n){"use strict";var r=n(0).VNode,o=n(0).VText;t.exports=function(t){var e,n={className:["coins-logon-widget-notification","coins-logon-widget-notification-error"].join(" ")},i=t.text;return Array.isArray(i)?e=i:"string"==typeof i&&(-1!==i.indexOf("<")&&-1!==i.indexOf(">")?n.innerHTML=i:e=[new o(i)]),new r("div",n,e)}},function(t,e,n){"use strict";var r=n(0).VNode,o=n(0).VText;t.exports=function(){var t="http://www.w3.org/2000/svg";return new r("div",{className:"coins-logon-widget-indicator"},[new r("svg",void 0,[new r("title",void 0,[new o("Loading…")],void 0,t),new r("circle",{attributes:{cx:"20",cy:"20",fill:"none",r:"8","stroke-width":"2","stroke-miterlimit":"4"}},void 0,void 0,t)],void 0,t)])}},function(t,e,n){"use strict";var r=n(0).VNode,o=n(0).VText;t.exports=function(t){var e=t.errorMessage,n=t.id,i=t.name,s=t.type||"text",a=void 0!==t.value?t.value:"",u="coins-logon-widget-form-group",c=i.charAt(0).toUpperCase()+i.substr(1),l={className:"coins-logon-widget-input",id:n,name:i,placeholder:c,type:s,value:a},p=[new r("label",{className:"coins-logon-widget-label coins-logon-widget-visuallyhidden",for:n},[new o(c)])];return e&&(p.push(new r("span",{"aria-hidden":"true",className:"coins-logon-widget-icon"}),new r("span",{className:"coins-logon-widget-input-message"},[new o(e)])),u+=" coins-logon-widget-form-group-error",l.onkeypress=function(e){t.onKeyPress(e)}),p.splice(1,0,new r("input",l)),new r("div",{className:u},p)}},function(t,e,n){"use strict";(function(e){var n="undefined"!=typeof window?window:void 0!==e?e:{};t.exports=function(t,e){if(t in n)return n[t];return n[t]=e,e}}).call(this,n(24))},function(t,e,n){"use strict";var r=n(39);t.exports=function(t,e,n){var o="__INDIVIDUAL_ONE_VERSION_"+t,i=r(o+"_ENFORCE_SINGLETON",e);if(i!==e)throw new Error("Can only have one copy of "+t+".\nYou already have version "+i+" installed.\nThis means you cannot install version "+e);return r(o,n)}},function(t,e,n){"use strict";n(40)("ev-store","7");var r="__EV_STORE_KEY@7";t.exports=function(t){var e=t[r];e||(e=t[r]={});return e}},function(t,e,n){"use strict";var r=n(41);function o(t){if(!(this instanceof o))return new o(t);this.value=t}t.exports=o,o.prototype.hook=function(t,e){r(t)[e.substr(3)]=this.value},o.prototype.unhook=function(t,e){r(t)[e.substr(3)]=void 0}},function(t,e,n){"use strict";function r(t){if(!(this instanceof r))return new r(t);this.value=t}t.exports=r,r.prototype.hook=function(t,e){t[e]!==this.value&&(t[e]=this.value)}},function(t,e){var n,r,o;
/*!
 * Cross-Browser Split 1.1.1
 * Copyright 2007-2012 Steven Levithan <stevenlevithan.com>
 * Available under the MIT License
 * ECMAScript compliant, uniform cross-browser split method
 */
t.exports=(r=String.prototype.split,o=/()??/.exec("")[1]===n,function(t,e,i){if("[object RegExp]"!==Object.prototype.toString.call(e))return r.call(t,e,i);var s,a,u,c,l=[],p=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":""),f=0;for(e=new RegExp(e.source,p+"g"),t+="",o||(s=new RegExp("^"+e.source+"$(?!\\s)",p)),i=i===n?-1>>>0:i>>>0;(a=e.exec(t))&&!((u=a.index+a[0].length)>f&&(l.push(t.slice(f,a.index)),!o&&a.length>1&&a[0].replace(s,function(){for(var t=1;t<arguments.length-2;t++)arguments[t]===n&&(a[t]=n)}),a.length>1&&a.index<t.length&&Array.prototype.push.apply(l,a.slice(1)),c=a[0].length,f=u,l.length>=i));)e.lastIndex===a.index&&e.lastIndex++;return f===t.length?!c&&e.test("")||l.push(""):l.push(t.slice(f)),l.length>i?l.slice(0,i):l})},function(t,e,n){"use strict";var r=n(44),o=/([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/,i=/^\.|#/;t.exports=function(t,e){if(!t)return"DIV";var n,s,a,u,c=!e.hasOwnProperty("id"),l=r(t,o),p=null;i.test(l[1])&&(p="DIV");for(u=0;u<l.length;u++)(s=l[u])&&(a=s.charAt(0),p?"."===a?(n=n||[]).push(s.substring(1,s.length)):"#"===a&&c&&(e.id=s.substring(1,s.length)):p=s);n&&(e.className&&n.push(e.className),e.className=n.join(" "));return e.namespace?p:p.toUpperCase()}},function(t,e,n){"use strict";var r=n(13),o=n(17),i=n(16),s=n(5),a=n(9),u=n(1),c=n(10),l=n(8),p=n(45),f=n(43),h=n(42);function d(t){return s(t)||a(t)||u(t)||l(t)}function g(t){try{return JSON.stringify(t,null,"    ")}catch(e){return String(t)}}t.exports=function(t,e,n){var s,a,u,l,v=[];!n&&(y=e,"string"==typeof y||r(y)||d(y))&&(n=e,a={});var y;s=p(t,a=a||e||{}),a.hasOwnProperty("key")&&(u=a.key,a.key=void 0);a.hasOwnProperty("namespace")&&(l=a.namespace,a.namespace=void 0);"INPUT"!==s||l||!a.hasOwnProperty("value")||void 0===a.value||c(a.value)||(a.value=f(a.value));(function(t){for(var e in t)if(t.hasOwnProperty(e)){var n=t[e];if(c(n))continue;"ev-"===e.substr(0,3)&&(t[e]=h(n))}})(a),void 0!==n&&null!==n&&function t(e,n,o,s){if("string"==typeof e)n.push(new i(e));else if("number"==typeof e)n.push(new i(String(e)));else if(d(e))n.push(e);else{if(!r(e)){if(null===e||void 0===e)return;throw u={foreignObject:e,parentVnode:{tagName:o,properties:s}},(c=new Error).type="virtual-hyperscript.unexpected.virtual-element",c.message="Unexpected virtual child passed to h().\nExpected a VNode / Vthunk / VWidget / string but:\ngot:\n"+g(u.foreignObject)+".\nThe parent vnode is:\n"+g(u.parentVnode),c.foreignObject=u.foreignObject,c.parentVnode=u.parentVnode,c}for(var a=0;a<e.length;a++)t(e[a],n,o,s)}var u,c}(n,v,s,a);return new o(s,a,v,u,l)}},function(t,e,n){var r=n(46);t.exports=r},function(t,e,n){var r=n(1);t.exports=function(t,e){if(r(t)&&r(e))return"name"in t&&"name"in e?t.id===e.id:t.init===e.init;return!1}},function(t,e,n){var r=n(23),o=n(1),i=n(19),s=n(48);function a(t,e){"function"==typeof e.destroy&&o(e)&&e.destroy(t)}t.exports=function(t,e,n){var o=t.type,u=t.vNode,c=t.patch;switch(o){case i.REMOVE:return function(t,e){var n=t.parentNode;n&&n.removeChild(t);return a(t,e),null}(e,u);case i.INSERT:return function(t,e,n){var r=n.render(e,n);t&&t.appendChild(r);return t}(e,c,n);case i.VTEXT:return function(t,e,n,r){var o;if(3===t.nodeType)t.replaceData(0,t.length,n.text),o=t;else{var i=t.parentNode;o=r.render(n,r),i&&o!==t&&i.replaceChild(o,t)}return o}(e,0,c,n);case i.WIDGET:return function(t,e,n,r){var o,i=s(e,n);o=i?n.update(e,t)||t:r.render(n,r);var u=t.parentNode;u&&o!==t&&u.replaceChild(o,t);i||a(t,e);return o}(e,u,c,n);case i.VNODE:return function(t,e,n,r){var o=t.parentNode,i=r.render(n,r);o&&i!==t&&o.replaceChild(i,t);return i}(e,0,c,n);case i.ORDER:return function(t,e){for(var n,r,o,i=t.childNodes,s={},a=0;a<e.removes.length;a++)r=e.removes[a],n=i[r.from],r.key&&(s[r.key]=n),t.removeChild(n);for(var u=i.length,c=0;c<e.inserts.length;c++)o=e.inserts[c],n=s[o.key],t.insertBefore(n,o.to>=u++?null:i[o.to])}(e,c),e;case i.PROPS:return r(e,c,u.properties),e;case i.THUNK:return function(t,e){t&&e&&t!==e&&t.parentNode&&t.parentNode.replaceChild(e,t);return e}(e,n.patch(e,c,n));default:return e}}},function(t,e){var n={};function r(t,e,n){if(0===t.length)return!1;for(var r,o,i=0,s=t.length-1;i<=s;){if(o=t[r=(s+i)/2>>0],i===s)return o>=e&&o<=n;if(o<e)i=r+1;else{if(!(o>n))return!0;s=r-1}}return!1}function o(t,e){return t>e?1:-1}t.exports=function(t,e,i,s){return i&&0!==i.length?(i.sort(o),function t(e,o,i,s,a){s=s||{};if(e){r(i,a,a)&&(s[a]=e);var u=o.children;if(u)for(var c=e.childNodes,l=0;l<o.children.length;l++){a+=1;var p=u[l]||n,f=a+(p.count||0);r(i,a,f)&&t(c[l],p,i,s,a),a=f}}return s}(t,e,i,s,0)):{}}},function(t,e,n){var r=n(25),o=n(13),i=n(26),s=n(50),a=n(49);function u(t,e,n){var o=function(t){var e=[];for(var n in t)"a"!==n&&e.push(Number(n));return e}(e);if(0===o.length)return t;var i=s(t,e.a,o),a=t.ownerDocument;n.document||a===r||(n.document=a);for(var u=0;u<o.length;u++){var l=o[u];t=c(t,i[l],e[l],n)}return t}function c(t,e,n,r){if(!e)return t;var i;if(o(n))for(var s=0;s<n.length;s++)i=a(n[s],e,r),e===t&&(t=i);else i=a(n,e,r),e===t&&(t=i);return t}t.exports=function t(e,n,r){r=r||{};r.patch=r.patch&&r.patch!==t?r.patch:u;r.render=r.render||i;return r.patch(e,n,r)}},function(t,e,n){"use strict";var r=n(0).VNode,o=n(0).VText;function i(t){var e,n="coins-logon-widget-button",i=t.href,s=t.onClick,a=t.style||"primary",u=t.text,c=t.type||"button",l={className:n+=" coins-logon-widget-button-"+a};return"link"===c?(e="a",i&&(l.href=i)):(e="button",l.type=c),s&&(l.onclick=function(t){t.preventDefault(),s(t)}),new r(e,l,[new o(u)])}t.exports=function(t){var e=arguments.length>1?[].slice.call(arguments).map(i):[i(t)];return new r("div",{className:"coins-logon-widget-button-group"},e)}},function(t,e,n){"use strict";var r=n(52),o=n(38),i=n(37),s=n(36),a=n(35),u=n(0).VNode;t.exports=function(t){var e,n=t.errorMessage,c=!!t.horizontal,l=(t.inputs,void 0!==t.isLoading&&t.isLoading),p=void 0!==t.isLoggedIn&&t.isLoggedIn,f=t.onSubmit,h=t.passwordProps,d=t.redirectUrl,g=t.username,v=t.usernameProps,y=[],m="coins-logon-widget-form";return c&&(m+=" coins-logon-widget-form-horizontal"),p?(e=[{style:"secondary",text:"Log Out",type:"submit"}],d&&e.push({href:d,text:"Go to COINS →",type:"link"}),y.push(a({username:g}),r.apply(null,e))):(n?(y.push(s({text:n})),m+=" coins-logon-widget-form-error"):y.push(new u("div",{className:"no-alert"})),y.push(o(v),o(h),r({text:"Log In",type:"submit"}))),l&&(y.push(i()),m+=" coins-logon-widget-form-loading"),new u("form",{className:m,onsubmit:function(t){t.preventDefault(),f(t)},method:"post"},y)}},function(t,e,n){var r;
/*!
 * EventEmitter v4.2.11 - git.io/ee
 * Unlicense - http://unlicense.org/
 * Oliver Caldwell - http://oli.me.uk/
 * @preserve
 */(function(){"use strict";function e(){}var o=e.prototype,i=this,s=i.EventEmitter;function a(t,e){for(var n=t.length;n--;)if(t[n].listener===e)return n;return-1}function u(t){return function(){return this[t].apply(this,arguments)}}o.getListeners=function(t){var e,n,r=this._getEvents();if(t instanceof RegExp)for(n in e={},r)r.hasOwnProperty(n)&&t.test(n)&&(e[n]=r[n]);else e=r[t]||(r[t]=[]);return e},o.flattenListeners=function(t){var e,n=[];for(e=0;e<t.length;e+=1)n.push(t[e].listener);return n},o.getListenersAsObject=function(t){var e,n=this.getListeners(t);return n instanceof Array&&((e={})[t]=n),e||n},o.addListener=function(t,e){var n,r=this.getListenersAsObject(t),o="object"==typeof e;for(n in r)r.hasOwnProperty(n)&&-1===a(r[n],e)&&r[n].push(o?e:{listener:e,once:!1});return this},o.on=u("addListener"),o.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},o.once=u("addOnceListener"),o.defineEvent=function(t){return this.getListeners(t),this},o.defineEvents=function(t){for(var e=0;e<t.length;e+=1)this.defineEvent(t[e]);return this},o.removeListener=function(t,e){var n,r,o=this.getListenersAsObject(t);for(r in o)o.hasOwnProperty(r)&&-1!==(n=a(o[r],e))&&o[r].splice(n,1);return this},o.off=u("removeListener"),o.addListeners=function(t,e){return this.manipulateListeners(!1,t,e)},o.removeListeners=function(t,e){return this.manipulateListeners(!0,t,e)},o.manipulateListeners=function(t,e,n){var r,o,i=t?this.removeListener:this.addListener,s=t?this.removeListeners:this.addListeners;if("object"!=typeof e||e instanceof RegExp)for(r=n.length;r--;)i.call(this,e,n[r]);else for(r in e)e.hasOwnProperty(r)&&(o=e[r])&&("function"==typeof o?i.call(this,r,o):s.call(this,r,o));return this},o.removeEvent=function(t){var e,n=typeof t,r=this._getEvents();if("string"===n)delete r[t];else if(t instanceof RegExp)for(e in r)r.hasOwnProperty(e)&&t.test(e)&&delete r[e];else delete this._events;return this},o.removeAllListeners=u("removeEvent"),o.emitEvent=function(t,e){var n,r,o,i,s=this.getListenersAsObject(t);for(i in s)if(s.hasOwnProperty(i))for(o=(n=s[i].slice(0)).length;o--;)!0===(r=n[o]).once&&this.removeListener(t,r.listener),r.listener.apply(this,e||[])===this._getOnceReturnValue()&&this.removeListener(t,r.listener);return this},o.trigger=u("emitEvent"),o.emit=function(t){var e=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,e)},o.setOnceReturnValue=function(t){return this._onceReturnValue=t,this},o._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},o._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return i.EventEmitter=s,e},void 0===(r=function(){return e}.call(i,n,i,t))||(t.exports=r)}).call(this)},function(t,e,n){var r=n(22),o=n(10);function i(t){return Object.getPrototypeOf?Object.getPrototypeOf(t):t.__proto__?t.__proto__:t.constructor?t.constructor.prototype:void 0}t.exports=function t(e,n){var s;for(var a in e){a in n||((s=s||{})[a]=void 0);var u=e[a],c=n[a];if(u!==c)if(r(u)&&r(c))if(i(c)!==i(u))(s=s||{})[a]=c;else if(o(c))(s=s||{})[a]=c;else{var l=t(u,c);l&&((s=s||{})[a]=l)}else(s=s||{})[a]=c}for(var p in n)p in e||((s=s||{})[p]=n[p]);return s}},function(t,e,n){var r=n(13),o=n(19),i=n(5),s=n(9),a=n(1),u=n(8),c=n(21),l=n(55);function p(t,e){var n={a:t};return f(t,e,n,0),n}function f(t,e,n,r){if(t!==e){var c=n[r],p=!1;if(u(t)||u(e))d(t,e,n,r);else if(null==e)a(t)||(h(t,n,r),c=n[r]),c=y(c,new o(o.REMOVE,t,e));else if(i(e))if(i(t))if(t.tagName===e.tagName&&t.namespace===e.namespace&&t.key===e.key){var m=l(t.properties,e.properties);m&&(c=y(c,new o(o.PROPS,t,m))),c=function(t,e,n,r,s){for(var a=t.children,u=function(t,e){var n=v(e),r=n.keys,o=n.free;if(o.length===e.length)return{children:e,moves:null};var i=v(t),s=i.keys;if(i.free.length===t.length)return{children:e,moves:null};for(var a=[],u=0,c=o.length,l=0,p=0;p<t.length;p++){var f,h=t[p];h.key?r.hasOwnProperty(h.key)?(f=r[h.key],a.push(e[f])):(f=p-l++,a.push(null)):u<c?(f=o[u++],a.push(e[f])):(f=p-l++,a.push(null))}for(var d=u>=o.length?e.length:o[u],y=0;y<e.length;y++){var m=e[y];m.key?s.hasOwnProperty(m.key)||a.push(m):y>=d&&a.push(m)}for(var w,x=a.slice(),_=0,O=[],E=[],b=0;b<e.length;){var N=e[b];for(w=x[_];null===w&&x.length;)O.push(g(x,_,null)),w=x[_];w&&w.key===N.key?(_++,b++):N.key?(w&&w.key&&r[w.key]!==b+1?(O.push(g(x,_,w.key)),(w=x[_])&&w.key===N.key?_++:E.push({key:N.key,to:b})):E.push({key:N.key,to:b}),b++):w&&w.key&&O.push(g(x,_,w.key))}for(;_<x.length;)w=x[_],O.push(g(x,_,w&&w.key));if(O.length===l&&!E.length)return{children:a,moves:null};return{children:a,moves:{removes:O,inserts:E}}}(a,e.children),c=u.children,l=a.length,p=c.length,h=l>p?l:p,d=0;d<h;d++){var m=a[d],w=c[d];s+=1,m?f(m,w,n,s):w&&(r=y(r,new o(o.INSERT,null,w))),i(m)&&m.count&&(s+=m.count)}u.moves&&(r=y(r,new o(o.ORDER,t,u.moves)));return r}(t,e,n,c,r)}else c=y(c,new o(o.VNODE,t,e)),p=!0;else c=y(c,new o(o.VNODE,t,e)),p=!0;else s(e)?s(t)?t.text!==e.text&&(c=y(c,new o(o.VTEXT,t,e))):(c=y(c,new o(o.VTEXT,t,e)),p=!0):a(e)&&(a(t)||(p=!0),c=y(c,new o(o.WIDGET,t,e)));c&&(n[r]=c),p&&h(t,n,r)}}function h(t,e,n){!function t(e,n,r){if(i(e)){if(e.hooks&&(n[r]=y(n[r],new o(o.PROPS,e,function(t){var e={};for(var n in t)e[n]=void 0;return e}(e.hooks)))),e.descendantHooks||e.hasThunks)for(var s=e.children,a=s.length,c=0;c<a;c++){var l=s[c];t(l,n,r+=1),i(l)&&l.count&&(r+=l.count)}}else u(e)&&d(e,null,n,r)}(t,e,n),function t(e,n,r){if(a(e))"function"==typeof e.destroy&&(n[r]=y(n[r],new o(o.REMOVE,e,null)));else if(i(e)&&(e.hasWidgets||e.hasThunks))for(var s=e.children,c=s.length,l=0;l<c;l++){var p=s[l];t(p,n,r+=1),i(p)&&p.count&&(r+=p.count)}else u(e)&&d(e,null,n,r)}(t,e,n)}function d(t,e,n,r){var i=c(t,e),s=p(i.a,i.b);(function(t){for(var e in t)if("a"!==e)return!0;return!1})(s)&&(n[r]=new o(o.THUNK,null,s))}function g(t,e,n){return t.splice(e,1),{from:e,key:n}}function v(t){for(var e={},n=[],r=t.length,o=0;o<r;o++){var i=t[o];i.key?e[i.key]=o:n.push(o)}return{keys:e,free:n}}function y(t,e){return t?(r(t)?t.push(e):t=[t,e],t):e}t.exports=p},function(t,e){},function(t,e,n){"use strict";const r={internals:{}};r.client={header:function(t,e,n){if(!t||"string"!=typeof t&&"object"!=typeof t||!e||"string"!=typeof e||!n||"object"!=typeof n)throw new Error("Invalid argument type");const o=n.timestamp||r.utils.nowSec(n.localtimeOffsetMsec),i=n.credentials;if(!(i&&i.id&&i.key&&i.algorithm))throw new Error("Invalid credentials");if(-1===r.crypto.algorithms.indexOf(i.algorithm))throw new Error("Unknown algorithm");"string"==typeof t&&(t=r.utils.parseUri(t));const s={ts:o,nonce:n.nonce||r.utils.randomString(6),method:e,resource:t.resource,host:t.host,port:t.port,hash:n.hash,ext:n.ext,app:n.app,dlg:n.dlg};s.hash||!n.payload&&""!==n.payload||(s.hash=r.crypto.calculatePayloadHash(n.payload,i.algorithm,n.contentType));const a=r.crypto.calculateMac("header",i,s),u=null!==s.ext&&void 0!==s.ext&&""!==s.ext;let c='Hawk id="'+i.id+'", ts="'+s.ts+'", nonce="'+s.nonce+(s.hash?'", hash="'+s.hash:"")+(u?'", ext="'+r.utils.escapeHeaderAttribute(s.ext):"")+'", mac="'+a+'"';return s.app&&(c+=', app="'+s.app+(s.dlg?'", dlg="'+s.dlg:"")+'"'),{artifacts:s,header:c}},bewit:function(t,e){if(!t||"string"!=typeof t||!e||"object"!=typeof e||!e.ttlSec)throw new Error("Invalid inputs");const n=null===e.ext||void 0===e.ext?"":e.ext,o=r.utils.nowSec(e.localtimeOffsetMsec),i=e.credentials;if(!(i&&i.id&&i.key&&i.algorithm))throw new Error("Invalid credentials");if(-1===r.crypto.algorithms.indexOf(i.algorithm))throw new Error("Unknown algorithm");t=r.utils.parseUri(t);const s=o+e.ttlSec,a=r.crypto.calculateMac("bewit",i,{ts:s,nonce:"",method:"GET",resource:t.resource,host:t.host,port:t.port,ext:n}),u=i.id+"\\"+s+"\\"+a+"\\"+n;return r.utils.base64urlEncode(u)},authenticate:function(t,e,n,o){o=o||{};const i=function(e){return t.headers?"function"==typeof t.headers.get?t.headers.get(e):t.headers[e]:t.getResponseHeader?t.getResponseHeader(e):t.getHeader(e)},s=i("www-authenticate");if(s){const t=r.utils.parseAuthorizationHeader(s,["ts","tsm","error"]);if(!t)return!1;if(t.ts){if(r.crypto.calculateTsMac(t.ts,e)!==t.tsm)return!1;r.utils.setNtpSecOffset(t.ts-Math.floor(Date.now()/1e3))}}const a=i("server-authorization");if(!a&&!o.required)return!0;const u=r.utils.parseAuthorizationHeader(a,["mac","ext","hash"]);if(!u)return!1;const c={ts:n.ts,nonce:n.nonce,method:n.method,resource:n.resource,host:n.host,port:n.port,hash:u.hash,ext:u.ext,app:n.app,dlg:n.dlg};return r.crypto.calculateMac("response",e,c)===u.mac&&(!o.payload&&""!==o.payload||!!u.hash&&r.crypto.calculatePayloadHash(o.payload,e.algorithm,i("content-type"))===u.hash)},message:function(t,e,n,o){if(!t||"string"!=typeof t||!e||"number"!=typeof e||null===n||void 0===n||"string"!=typeof n||!o||"object"!=typeof o)throw new Error("Invalid inputs");const i=o.timestamp||r.utils.nowSec(o.localtimeOffsetMsec),s=o.credentials;if(!(s&&s.id&&s.key&&s.algorithm))throw new Error("Invalid credentials");if(-1===r.crypto.algorithms.indexOf(s.algorithm))throw new Error("Unknown algorithm");const a={ts:i,nonce:o.nonce||r.utils.randomString(6),host:t,port:e,hash:r.crypto.calculatePayloadHash(n,s.algorithm)};return{id:s.id,ts:a.ts,nonce:a.nonce,hash:a.hash,mac:r.crypto.calculateMac("message",s,a)}},authenticateTimestamp:function(t,e,n){return r.crypto.calculateTsMac(t.ts,e)===t.tsm&&(!1!==n&&r.utils.setNtpSecOffset(t.ts-Math.floor(Date.now()/1e3)),!0)}},r.crypto={headerVersion:"1",algorithms:["sha1","sha256"],calculateMac:function(t,e,n){const o=r.crypto.generateNormalizedString(t,n);return u["Hmac"+e.algorithm.toUpperCase()](o,e.key).toString(u.enc.Base64)},generateNormalizedString:function(t,e){let n="hawk."+r.crypto.headerVersion+"."+t+"\n"+e.ts+"\n"+e.nonce+"\n"+(e.method||"").toUpperCase()+"\n"+(e.resource||"")+"\n"+e.host.toLowerCase()+"\n"+e.port+"\n"+(e.hash||"")+"\n";return e.ext&&(n+=e.ext.replace("\\","\\\\").replace("\n","\\n")),n+="\n",e.app&&(n+=e.app+"\n"+(e.dlg||"")+"\n"),n},calculatePayloadHash:function(t,e,n){const o=u.algo[e.toUpperCase()].create();return o.update("hawk."+r.crypto.headerVersion+".payload\n"),o.update(r.utils.parseContentType(n)+"\n"),o.update(t),o.update("\n"),o.finalize().toString(u.enc.Base64)},calculateTsMac:function(t,e){return u["Hmac"+e.algorithm.toUpperCase()]("hawk."+r.crypto.headerVersion+".ts\n"+t+"\n",e.key).toString(u.enc.Base64)}},r.internals.LocalStorage=function(){this._cache={},this.length=0,this.getItem=function(t){return this._cache.hasOwnProperty(t)?String(this._cache[t]):null},this.setItem=function(t,e){this._cache[t]=String(e),this.length=Object.keys(this._cache).length},this.removeItem=function(t){delete this._cache[t],this.length=Object.keys(this._cache).length},this.clear=function(){this._cache={},this.length=0},this.key=function(t){return Object.keys(this._cache)[t||0]}},r.utils={storage:new r.internals.LocalStorage,setStorage:function(t){const e=r.utils.storage.getItem("hawk_ntp_offset");r.utils.storage=t,e&&r.utils.setNtpSecOffset(e)},setNtpSecOffset:function(t){try{r.utils.storage.setItem("hawk_ntp_offset",t)}catch(t){console.error("[hawk] could not write to storage."),console.error(t)}},getNtpSecOffset:function(){const t=r.utils.storage.getItem("hawk_ntp_offset");return t?parseInt(t,10):0},now:function(t){return Date.now()+(t||0)+1e3*r.utils.getNtpSecOffset()},nowSec:function(t){return Math.floor(r.utils.now(t)/1e3)},escapeHeaderAttribute:function(t){return t.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')},parseContentType:function(t){return t?t.split(";")[0].replace(/^\s+|\s+$/g,"").toLowerCase():""},parseAuthorizationHeader:function(t,e){if(!t)return null;const n=t.match(/^(\w+)(?:\s+(.*))?$/);if(!n)return null;if("hawk"!==n[1].toLowerCase())return null;const r=n[2];if(!r)return null;const o={};return""!==r.replace(/(\w+)="([^"\\]*)"\s*(?:,\s*|$)/g,(t,n,r)=>{if(-1!==e.indexOf(n)&&null!==r.match(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~]+$/)&&!o.hasOwnProperty(n))return o[n]=r,""})?null:o},randomString:function(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",n=e.length,r=[];for(let o=0;o<t;++o)r[o]=e[Math.floor(Math.random()*n)];return r.join("")},uriRegex:/^([^:]+)\:\/\/(?:[^@/]*@)?([^\/:]+)(?:\:(\d+))?([^#]*)(?:#.*)?$/,parseUri:function(t){const e=t.match(r.utils.uriRegex);if(!e)return{host:"",port:"",resource:""};const n=e[1].toLowerCase();return{host:e[2],port:e[3]||("http"===n?"80":"https"===n?"443":""),resource:e[4]}},base64urlEncode:function(t){const e=u.enc.Utf8.parse(t);return u.enc.Base64.stringify(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}};var o,i,s,a,u=u||function(t,e){var n={},r=n.lib={},o=function(){},i=r.Base={extend:function(t){o.prototype=this;var e=new o;return t&&e.mixIn(t),e.hasOwnProperty("init")||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(let e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},s=r.WordArray=i.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=void 0!=e?e:4*t.length},toString:function(t){return(t||u).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes;if(t=t.sigBytes,this.clamp(),r%4)for(let o=0;o<t;o++)e[r+o>>>2]|=(n[o>>>2]>>>24-o%4*8&255)<<24-(r+o)%4*8;else if(65535<n.length)for(let o=0;o<t;o+=4)e[r+o>>>2]=n[o>>>2];else e.push.apply(e,n);return this.sigBytes+=t,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=i.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(let n=[],r=0;r<e;r+=4)n.push(4294967296*t.random()|0);return new s.init(b,e)}}),a=n.enc={},u=a.Hex={stringify:function(t){var e=t.words;t=t.sigBytes;for(var n=[],r=0;r<t;r++){var o=e[r>>>2]>>>24-r%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new s.init(n,e/2)}},c=a.Latin1={stringify:function(t){var e=t.words;t=t.sigBytes;for(var n=[],r=0;r<t;r++)n.push(String.fromCharCode(e[r>>>2]>>>24-r%4*8&255));return n.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new s.init(n,e)}},l=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(c.stringify(t)))}catch(t){throw Error("Malformed UTF-8 data")}},parse:function(t){return c.parse(unescape(encodeURIComponent(t)))}},p=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=l.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,o=n.sigBytes,i=this.blockSize,a=o/(4*i);if(e=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*i,o=t.min(4*e,o),e){for(var u=0;u<e;u+=i)this._doProcessBlock(r,u);u=r.splice(0,e),n.sigBytes-=o}return new s.init(u,o)},clone:function(){var t=i.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});r.Hasher=p.extend({cfg:i.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new f.HMAC.init(t,n).finalize(e)}}});var f=n.algo={};return n}(Math);(()=>{var t=u,e=(o=t.lib).WordArray,n=o.Hasher,r=[],o=t.algo.SHA1=n.extend({_doReset:function(){this._hash=new e.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=this._hash.words,o=n[0],i=n[1],s=n[2],a=n[3],u=n[4],c=0;80>c;c++){if(16>c)r[c]=0|t[e+c];else{var l=r[c-3]^r[c-8]^r[c-14]^r[c-16];r[c]=l<<1|l>>>31}l=(o<<5|o>>>27)+u+r[c],l=20>c?l+(1518500249+(i&s|~i&a)):40>c?l+(1859775393+(i^s^a)):60>c?l+((i&s|i&a|s&a)-1894007588):l+((i^s^a)-899497514),u=a,a=s,s=i<<30|i>>>2,i=o,o=l}n[0]=n[0]+o|0,n[1]=n[1]+i|0,n[2]=n[2]+s|0,n[3]=n[3]+a|0,n[4]=n[4]+u|0},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;return e[r>>>5]|=128<<24-r%32,e[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),e[15+(r+64>>>9<<4)]=n,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}});t.SHA1=n._createHelper(o),t.HmacSHA1=n._createHmacHelper(o)})(),function(t){for(var e=u,n=(o=e.lib).WordArray,r=o.Hasher,o=e.algo,i=[],s=[],a=function(t){return 4294967296*(t-(0|t))|0},c=2,l=0;64>l;){var p;t:{p=c;for(var f=t.sqrt(p),h=2;h<=f;h++)if(!(p%h)){p=!1;break t}p=!0}p&&(8>l&&(i[l]=a(t.pow(c,.5))),s[l]=a(t.pow(c,1/3)),l++),c++}var d=[];o=o.SHA256=r.extend({_doReset:function(){this._hash=new n.init(i.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],a=n[3],u=n[4],c=n[5],l=n[6],p=n[7],f=0;64>f;f++){if(16>f)d[f]=0|t[e+f];else{var h=d[f-15],g=d[f-2];d[f]=((h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3)+d[f-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+d[f-16]}h=p+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&c^~u&l)+s[f]+d[f],g=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&o^r&i^o&i),p=l,l=c,c=u,u=a+h|0,a=i,i=o,o=r,r=h+g|0}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+a|0,n[4]=n[4]+u|0,n[5]=n[5]+c|0,n[6]=n[6]+l|0,n[7]=n[7]+p|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,o=8*e.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=t.floor(r/4294967296),n[15+(o+64>>>9<<4)]=r,e.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=r._createHelper(o),e.HmacSHA256=r._createHmacHelper(o)}(Math),i=(o=u).enc.Utf8,o.algo.HMAC=o.lib.Base.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=i.parse(e));var n=t.blockSize,r=4*n;e.sigBytes>r&&(e=t.finalize(e)),e.clamp();for(var o=this._oKey=e.clone(),s=this._iKey=e.clone(),a=o.words,u=s.words,c=0;c<n;c++)a[c]^=1549556828,u[c]^=909522486;o.sigBytes=s.sigBytes=r,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher;return t=e.finalize(t),e.reset(),e.finalize(this._oKey.clone().concat(t))}}),a=(s=u).lib.WordArray,s.enc.Base64={stringify:function(t){var e=t.words,n=t.sigBytes,r=this._map;t.clamp(),t=[];for(var o=0;o<n;o+=3)for(var i=(e[o>>>2]>>>24-o%4*8&255)<<16|(e[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|e[o+2>>>2]>>>24-(o+2)%4*8&255,s=0;4>s&&o+.75*s<n;s++)t.push(r.charAt(i>>>6*(3-s)&63));if(e=r.charAt(64))for(;t.length%4;)t.push(e);return t.join("")},parse:function(t){var e=t.length,n=this._map;(r=n.charAt(64))&&-1!=(r=t.indexOf(r))&&(e=r);for(var r=[],o=0,i=0;i<e;i++)if(i%4){var s=n.indexOf(t.charAt(i-1))<<i%4*2,u=n.indexOf(t.charAt(i))>>>6-i%4*2;r[o>>>2]|=(s|u)<<24-o%4*8,o++}return a.create(r,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},r.crypto.utils=u,void 0!==t&&t.exports&&(t.exports=r)},function(t,e,n){var r,o;
/*!
 * JavaScript Cookie v2.2.0
 * https://github.com/js-cookie/js-cookie
 *
 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
 * Released under the MIT license
 */!function(i){if(void 0===(o="function"==typeof(r=i)?r.call(e,n,e,t):r)||(t.exports=o),!0,t.exports=i(),!!0){var s=window.Cookies,a=window.Cookies=i();a.noConflict=function(){return window.Cookies=s,a}}}(function(){function t(){for(var t=0,e={};t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}return function e(n){function r(e,o,i){var s;if("undefined"!=typeof document){if(arguments.length>1){if("number"==typeof(i=t({path:"/"},r.defaults,i)).expires){var a=new Date;a.setMilliseconds(a.getMilliseconds()+864e5*i.expires),i.expires=a}i.expires=i.expires?i.expires.toUTCString():"";try{s=JSON.stringify(o),/^[\{\[]/.test(s)&&(o=s)}catch(t){}o=n.write?n.write(o,e):encodeURIComponent(String(o)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),e=(e=(e=encodeURIComponent(String(e))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape);var u="";for(var c in i)i[c]&&(u+="; "+c,!0!==i[c]&&(u+="="+i[c]));return document.cookie=e+"="+o+u}e||(s={});for(var l=document.cookie?document.cookie.split("; "):[],p=/(%[0-9A-Z]{2})+/g,f=0;f<l.length;f++){var h=l[f].split("="),d=h.slice(1).join("=");this.json||'"'!==d.charAt(0)||(d=d.slice(1,-1));try{var g=h[0].replace(p,decodeURIComponent);if(d=n.read?n.read(d,g):n(d,g)||d.replace(p,decodeURIComponent),this.json)try{d=JSON.parse(d)}catch(t){}if(e===g){s=d;break}e||(s[g]=d)}catch(t){}}return s}}return r.set=r,r.get=function(t){return r.call(r,t)},r.getJSON=function(){return r.apply({json:!0},[].slice.call(arguments))},r.defaults={},r.remove=function(e,n){r(e,"",t(n,{expires:-1}))},r.withConverter=e,r}(function(){})})},function(t,e){var n="Expected a function",r=Math.max;t.exports=function(t,e){if("function"!=typeof t)throw new TypeError(n);return e=r(void 0===e?t.length-1:+e||0,0),function(){for(var n=arguments,o=-1,i=r(n.length-e,0),s=Array(i);++o<i;)s[o]=n[e+o];switch(e){case 0:return t.call(this,s);case 1:return t.call(this,n[0],s);case 2:return t.call(this,n[0],n[1],s)}var a=Array(e+1);for(o=-1;++o<e;)a[o]=n[o];return a[e]=s,t.apply(this,a)}}},function(t,e,n){var r=n(7),o=n(14),i=n(2);t.exports=function(t,e,n){if(!i(n))return!1;var s=typeof e;if("number"==s?r(n)&&o(e,n.length):"string"==s&&e in n){var a=n[e];return t==t?t===a:a!=a}return!1}},function(t,e){t.exports=function(t){return t}},function(t,e,n){var r=n(62);t.exports=function(t,e,n){if("function"!=typeof t)return r;if(void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 3:return function(n,r,o){return t.call(e,n,r,o)};case 4:return function(n,r,o,i){return t.call(e,n,r,o,i)};case 5:return function(n,r,o,i,s){return t.call(e,n,r,o,i,s)}}return function(){return t.apply(e,arguments)}}},function(t,e,n){var r=n(63),o=n(61),i=n(60);t.exports=function(t){return i(function(e,n){var i=-1,s=null==e?0:n.length,a=s>2?n[s-2]:void 0,u=s>2?n[2]:void 0,c=s>1?n[s-1]:void 0;for("function"==typeof a?(a=r(a,c,5),s-=2):s-=(a="function"==typeof c?c:void 0)?1:0,u&&o(n[0],n[1],u)&&(a=s<3?void 0:a,s=1);++i<s;){var l=n[i];l&&t(e,l,a)}return e})}},function(t,e,n){var r=n(12),o=n(11),i=n(14),s=n(6),a=n(15),u=Object.prototype.hasOwnProperty;t.exports=function(t){for(var e=a(t),n=e.length,c=n&&t.length,l=!!c&&s(c)&&(o(t)||r(t)),p=-1,f=[];++p<n;){var h=e[p];(l&&i(h,c)||u.call(t,h))&&f.push(h)}return f}},function(t,e,n){var r=n(29),o=n(7),i=n(2),s=n(65),a=r(Object,"keys"),u=a?function(t){var e=null==t?void 0:t.constructor;return"function"==typeof e&&e.prototype===t||"function"!=typeof t&&o(t)?s(t):i(t)?a(t):[]}:s;t.exports=u},function(t,e){t.exports=function(t,e,n){n||(n={});for(var r=-1,o=e.length;++r<o;){var i=e[r];n[i]=t[i]}return n}},function(t,e,n){var r=n(67),o=n(15);t.exports=function(t){return r(t,o(t))}},function(t,e,n){var r=n(2);t.exports=function(t){return r(t)?t:Object(t)}},function(t,e,n){var r=n(69);t.exports=function(t){return function(e,n,o){for(var i=r(e),s=o(e),a=s.length,u=t?a:-1;t?u--:++u<a;){var c=s[u];if(!1===n(i[c],c,i))break}return e}}},function(t,e,n){var r=n(70)();t.exports=r},function(t,e,n){var r=n(71),o=n(15);t.exports=function(t,e){return r(t,e,o)}},function(t,e,n){var r=n(72),o=n(12),i=n(3),s="[object Object]",a=Object.prototype,u=a.hasOwnProperty,c=a.toString;t.exports=function(t){var e,n;return!(!i(t)||c.call(t)!=s||o(t)||!(u.call(t,"constructor")||"function"!=typeof(e=t.constructor)||e instanceof e))&&(r(t,function(t,e){n=e}),void 0===n||u.call(t,n))}},function(t,e,n){var r=n(2),o="[object Function]",i=Object.prototype.toString;t.exports=function(t){return r(t)&&i.call(t)==o}},function(t,e,n){var r=n(74),o=n(3),i=/^\[object .+?Constructor\]$/,s=Object.prototype,a=Function.prototype.toString,u=s.hasOwnProperty,c=RegExp("^"+a.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return null!=t&&(r(t)?c.test(a.call(t)):o(t)&&i.test(t))}},function(t,e){t.exports=function(t){return function(e){return null==e?void 0:e[t]}}},function(t,e,n){var r=n(76)("length");t.exports=r},function(t,e){t.exports=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}},function(t,e,n){var r=n(78),o=n(12),i=n(11),s=n(7),a=n(73),u=n(28),c=n(68);t.exports=function(t,e,n,l,p,f,h){for(var d=f.length,g=e[n];d--;)if(f[d]==g)return void(t[n]=h[d]);var v=t[n],y=p?p(v,g,n,t,e):void 0,m=void 0===y;m&&(y=g,s(g)&&(i(g)||u(g))?y=i(v)?v:s(v)?r(v):[]:a(g)||o(g)?y=o(v)?c(v):a(v)?v:{}:m=!1),f.push(g),h.push(y),m?t[n]=l(y,g,p,f,h):(y==y?y!==v:v==v)&&(t[n]=y)}},function(t,e){t.exports=function(t,e){for(var n=-1,r=t.length;++n<r&&!1!==e(t[n],n,t););return t}},function(t,e,n){var r=n(80),o=n(79),i=n(11),s=n(7),a=n(2),u=n(3),c=n(28),l=n(66);t.exports=function t(e,n,p,f,h){if(!a(e))return e;var d=s(n)&&(i(n)||c(n)),g=d?void 0:l(n);return r(g||n,function(r,i){if(g&&(r=n[i=r]),u(r))f||(f=[]),h||(h=[]),o(e,n,i,t,p,f,h);else{var s=e[i],a=p?p(s,r,i,e,n):void 0,c=void 0===a;c&&(a=r),void 0===a&&(!d||i in e)||!c&&(a==a?a===s:s!=s)||(e[i]=a)}}),e}},function(t,e,n){"use strict";var r=n(30),o=n(59),i=n(58),s="COINS_AUTH_CREDENTIALS",a={authCookieName:"",baseUrl:""};function u(){return JSON.parse(localStorage.getItem(s))}function c(t){return localStorage.setItem(s,JSON.stringify(t)),u()}function l(t){return f().baseUrl+t}function p(){var t=f().authCookieName,e=location.hostname.split("."),n={path:"/"};return e.length>2?n.domain="."+e.slice(-2).join("."):n.domain=e.join("."),n?(o.remove(t,n),o.remove(t)):o.remove(t),c({date:Date.now(),status:"logged out"}),[].slice.call(arguments)}function f(){return a}function h(t){return t.data[0]}function d(t){var e,n=t.statusText;return t.responseText&&(e=((e=JSON.parse(t.responseText)||{}).error||{}).message||""),e||n||"Unknown error"}-1!==document.cookie.split("; ").indexOf("REMOVED")&&(document.cookie="=REMOVED;path=/;domain=.mrn.org;expires=Thu, 01 Jan 1970 00:00:01 GMT;"),t.exports={getOptions:f,setOptions:function(t){return r(a,t),f()},login:function(t,e){var n=jQuery.Deferred();return jQuery.ajax({data:{password:btoa(e),username:btoa(t)},dataType:"json",type:"POST",url:l("/auth/keys"),xhrFields:{withCredentials:!0}}).done(function(t){var e=h(t);c(e),n.resolve(e)}).fail(function(t){n.reject(d(t))}),n.promise()},logout:function(){var t=u(),e=l("/auth/keys/"+t.id);return jQuery.ajax({dataType:"json",headers:function(t,e,n){return{Authorization:i.client.header(t,e,{credentials:n}).field}}(e,"DELETE",t),type:"DELETE",url:e,xhrFields:{withCredentials:!0}}).then(h,d).then(p,p)},isLoggedIn:function(){var t,e=o.get(f().authCookieName),n=u();return e&&n&&(!(n instanceof Object)||"id"in n&&"key"in n)?(t=l("/auth/cookies/"+e),jQuery.ajax({dataType:"json",type:"GET",url:t,xhrFields:{withCredentials:!0}}).then(function(t){return"error"in t&&!t.error},function(){return!1})):jQuery.Deferred().resolve(!1)},getUsername:function(){var t=u();return"username"in t?t.username:""}}},function(t,e,n){"use strict";var r=n(82),o=n(27),i=n(20),s=n(54),a=n(53),u=n(30),c=n(34),l=n(18),p=n(33),f=n(31);function h(t){s.call(this,t);var e=h.EVENTS,n=this,o=f.assertString(t.authCookieName,"authCookieName"),i=f.assertString(t.baseUrl,"baseUrl");this.element=f.assertElement(t.el),this._options={authCookieName:o,baseUrl:i},this._options.messages=t.messages?u({},c,t.messages):c,this._options.checkAuth="boolean"==typeof t.checkAuth&&t.checkAuth,this._options.redirect="boolean"==typeof t.redirect&&t.redirect,this._options.redirectUrl="string"==typeof t.redirectUrl?t.redirectUrl:void 0,this._state={horizontal:!!t.horizontal,isLoggedIn:!1,onSubmit:this.login.bind(this),passwordProps:{id:p("coins-logon-widget-"),name:"password",type:"password"},redirectUrl:this._options.redirectUrl,usernameProps:{id:p("coins-logon-widget-"),name:"username"}},r.setOptions({authCookieName:o,baseUrl:i}),this.on(e.LOGIN,this.login),this.on(e.LOGIN_ERROR,this.onError),this.on(e.LOGIN_ACCOUNT_EXPIRED,this.onAccountExpired),this.on(e.LOGIN_ACCOUNT_WILL_EXPIRE,this.onAccountWillExpire),this.on(e.LOGIN_PASSWORD_EXPIRED,this.onPasswordExpired),this.on(e.LOGIN_PASSWORD_WILL_EXPIRE,this.onPasswordWillExpire),this.on(e.LOGIN_SUCCESS,this.onLogin),this.on(e.LOGOUT,this.logout),this.on(e.LOGOUT_ERROR,this.onError),this.on(e.LOGOUT_SUCCESS,this.onLogout),this.init(),this._options.checkAuth&&r.isLoggedIn().then(function(t){t&&n.emit(e.LOGIN_SUCCESS,{username:r.getUsername()})})}h.prototype=Object.create(s.prototype),h.prototype.constructor=h,h.prototype.destroy=function(){this.update(null),this.removeAllListeners()},h.prototype.getFormData=function(){return{password:this.element.querySelector("input[name=password]").value,username:this.element.querySelector("input[name=username]").value}},h.prototype.init=function(){this._tree=a(this._state),this._rootNode=o(this._tree),this.element.className=this.element.className+" coins-logon-widget",this.element.appendChild(this._rootNode)},h.prototype.login=function(){var t,e=this,n=h.EVENTS,o=this.getFormData(),i=o.password,s=o.username;return s&&i?(this.update({isLoading:!0}),r.login(s,i).then(function(t){var r=Date.parse(t.user.acctExpDate),o=h.DAY,i=Date.now(),s=Date.parse(t.user.passwordExpDate);return e.update({isLoading:!1}),r-i<10*o?e.emit(n.LOGIN_ACCOUNT_WILL_EXPIRE,t):s-i<10*o?e.emit(n.LOGIN_PASSWORD_WILL_EXPIRE,t):e.emit(n.LOGIN_SUCCESS,t),t},function(t){return e.update({isLoading:!1}),"Password expired"===t?e.emit(n.LOGIN_PASSWORD_EXPIRED,t):"Account expired"===t?e.emit(n.LOGIN_ACCOUNT_EXPIRED,t):e.emit(n.LOGIN_ERROR,t),t})):(t={},s||(t.usernameProps={errorMessage:"Missing username!",onKeyPress:this.onKeyPress.bind(this)},this.emit(n.INVALID,{field:"username"})),i||(t.passwordProps={errorMessage:"Missing password!",onKeyPress:this.onKeyPress.bind(this)},this.emit(n.INVALID,{field:"password"})),this.update(t))},h.prototype.logout=function(){var t=h.EVENTS,e=this;return this.update({isLoading:!0}),r.logout().then(function(n){return e.update({isLoading:!1}),e.emit(t.LOGOUT_SUCCESS,n),n},function(n){return e.update({isLoading:!1}),e.emit(t.LOGOUT_ERROR,n),n})},h.prototype.update=function(t){if(t!==this._state){if(this._state=u({},this._state,t),this._state.isLoggedIn)this._state.passwordProps.value="";else{var e=this.getFormData();this._state.passwordProps.value=e.password,this._state.usernameProps.value=e.username}var n=a(this._state),r=i(this._tree,n);this._rootNode=l(this._rootNode,r),this._tree=n}},h.prototype.onAccountExpired=function(){var t=f.callOrReturn(this._options.messages.accountExpired);this.update({errorMessage:t})},h.prototype.onAccountWillExpire=function(t){var e=Date.parse(t.user.acctExpDate),n=Date.now(),r=f.callOrReturn(this._options.messages.accountWillExpire,[f.formatDay((e-n)/h.DAY)]);this.update({errorMessage:r})},h.prototype.onError=function(t){var e;e=void 0!==t?t.message||t.toString():"Unknown error!",this.update({errorMessage:e}),console.error(t)},h.prototype.onKeyPress=function(t){var e={errorMessage:null,onKeyPress:null};"username"===t.target.name&&this.update({usernameProps:e}),"password"===t.target.name&&this.update({passwordProps:e})},h.prototype.onLogin=function(t){this._options.redirect&&this._options.redirectUrl?window.location=this._options.redirectUrl:this.update({isLoggedIn:!0,username:t.username})},h.prototype.onLogout=function(){this.update({isLoggedIn:!1})},h.prototype.onPasswordExpired=function(){var t=f.callOrReturn(this._options.messages.passwordExpired);this.update({errorMessage:t})},h.prototype.onPasswordWillExpire=function(t){var e=Date.parse(t.user.passwordExpDate),n=Date.now(),r=f.callOrReturn(this._options.messages.passwordWillExpire,[f.formatDay((e-n)/h.DAY)]);this.update({errorMessage:r})},h.DAY=864e5,h.EVENTS={INVALID:"invalid",LOGIN:"login:init",LOGIN_ERROR:"login:error",LOGIN_ACCOUNT_EXPIRED:"login:accountExpired",LOGIN_ACCOUNT_WILL_EXPIRE:"login:accountWillExpire",LOGIN_PASSWORD_EXPIRED:"login:passwordExpired",LOGIN_PASSWORD_WILL_EXPIRE:"login:passwordWillExpire",LOGIN_SUCCESS:"login:success",LOGOUT:"logout:init",LOGOUT_ERROR:"logout:error",LOGOUT_SUCCESS:"logout:success"},t.exports=h}])});