!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("b4Widget",[],t):"object"==typeof exports?exports.b4Widget=t():e.b4Widget=t()}(window,function(){return(n={},i.m=r={"./node_modules/@servicestack/client/dist/index.js":function(e,re,ne){"use strict";(function(t){var g=this&&this.__assign||Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e};Object.defineProperty(re,"__esModule",{value:!0}),ne("./node_modules/fetch-everywhere/fetch-npm-browserify.js");var i=function(e){Object.assign(this,e)};re.ResponseStatus=i;function e(e){Object.assign(this,e)}re.ResponseError=e;var s=function(e){Object.assign(this,e)};re.ErrorResponse=s;var o=(r.prototype.tryResolve=function(e){return new e},r);function r(){}re.NewInstanceResolver=o;var n=(a.prototype.tryResolve=function(e){return e.instance||(e.instance=new e)},a);function a(){}re.SingletonInstanceResolver=n;var u,T={onConnect:"ServerEventConnect",onHeartbeat:"ServerEventHeartbeat",onJoin:"ServerEventJoin",onLeave:"ServerEventLeave",onUpdate:"ServerEventUpdate"};(u=re.ReadyState||(re.ReadyState={}))[u.CONNECTING=0]="CONNECTING",u[u.OPEN=1]="OPEN",u[u.CLOSED=2]="CLOSED";var l=(c.prototype.getEventSourceOptions=function(){return{withCredentials:this.withCredentials}},c.prototype.reconnectServerEvents=function(t){var r=this;if(void 0===t&&(t={}),!this.stopped){t.error&&this.onError(t.error);var n=this.eventSource,e=t.url||this.eventStreamUri||n.url;null!=this.options.resolveStreamUrl&&(e=this.options.resolveStreamUrl(e));var i=this.EventSource?new this.EventSource(e,this.getEventSourceOptions()):new EventSource(e,this.getEventSourceOptions());i.addEventListener("error",function(e){return t.onerror||n.onerror||r.onError}),i.addEventListener("message",t.onmessage||n.onmessage||this.onMessage);var o=this.options.onReconnect;return null!=o&&o.call(i,t.error),n.removeEventListener&&(n.removeEventListener("error",this.onError),n.removeEventListener("message",this.onMessage)),n.close(),this.eventSource=i}},c.prototype.start=function(){var t=this;if(this.stopped=!1,null==this.eventSource||this.eventSource.readyState===EventSource.CLOSED){var e=this.eventStreamUri;null!=this.options.resolveStreamUrl&&(e=this.options.resolveStreamUrl(e)),this.eventSource=this.EventSource?new this.EventSource(e,this.getEventSourceOptions()):new EventSource(e,this.getEventSourceOptions()),this.eventSource.addEventListener("error",this.onError),this.eventSource.addEventListener("message",function(e){return t.onMessage(e)})}return this},c.prototype.stop=function(){this.stopped=!0,this.eventSource&&this.eventSource.close();var e=this.options;e&&e.heartbeat&&clearInterval(e.heartbeat);var t=this.connectionInfo;return null==t||null==t.unRegisterUrl?new Promise(function(e,t){return e()}):(this.connectionInfo=null,fetch(new Request(t.unRegisterUrl,{method:"POST",mode:"cors",credentials:this.serviceClient.credentials})).then(function(e){if(!e.ok)throw new Error(e.status+" - "+e.statusText)}).catch(this.onError))},c.prototype.invokeReceiver=function(e,t,r,n,i){if(e)if("function"==typeof e&&(e=this.resolver.tryResolve(e)),t=t.replace("-",""),e.client=this,e.request=n,"function"==typeof e[t])e[t].call(r||e,n.body,n);else if(t in e)e[t]=n.body;else{var o=t.toLowerCase();for(var s in e)if(s.toLowerCase()==o)return void("function"==typeof e[s]?e[s].call(r||e,n.body,n):e[s]=n.body);var a=e.noSuchMethod;"function"==typeof a&&a.call(r||e,n.target,n)}},c.prototype.hasConnected=function(){return null!=this.connectionInfo},c.prototype.registerHandler=function(e,t){return this.options.handlers||(this.options.handlers={}),this.options.handlers[e]=t,this},c.prototype.setResolver=function(e){return this.options.resolver=e,this},c.prototype.registerReceiver=function(e){return this.registerNamedReceiver("cmd",e)},c.prototype.registerNamedReceiver=function(e,t){return this.options.receivers||(this.options.receivers={}),this.options.receivers[e]=t,this},c.prototype.unregisterReceiver=function(e){return void 0===e&&(e="cmd"),this.options.receivers&&delete this.options.receivers[e],this},c.prototype.updateChannels=function(e){this.channels=e;var t=null!=this.eventSource?this.eventSource.url:this.eventStreamUri;this.eventStreamUri=t.substring(0,Math.min(t.indexOf("?"),t.length))+"?channels="+e.join(",")+"&t="+(new Date).getTime()},c.prototype.update=function(e,t){var r="string"==typeof e?e.split(","):e,n="string"==typeof t?t.split(","):t,i=[];for(var o in this.channels){var s=this.channels[o];null!=n&&-1!==n.indexOf(s)||i.push(s)}if(r)for(var o in r)s=r[o],-1===i.indexOf(s)&&i.push(s);this.updateChannels(i)},c.prototype.addListener=function(e,t){return(this.listeners[e]||(this.listeners[e]=[])).push(t),this},c.prototype.removeListener=function(e,t){var r=this.listeners[e];if(r){var n=r.indexOf(t);0<=n&&r.splice(n,1)}return this},c.prototype.raiseEvent=function(e,t){var r=this,n=this.listeners[e];n&&n.forEach(function(e){try{e(t)}catch(e){r.onError(e)}})},c.prototype.getConnectionInfo=function(){if(null==this.connectionInfo)throw"Not Connected";return this.connectionInfo},c.prototype.getSubscriptionId=function(){return this.getConnectionInfo().id},c.prototype.updateSubscriber=function(t){var r=this;return null==t.id&&(t.id=this.getSubscriptionId()),this.serviceClient.post(t).then(function(e){r.update(t.subscribeChannels,t.unsubscribeChannels)}).catch(this.onError)},c.prototype.subscribeToChannels=function(){for(var t=this,r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var n=new p;return n.id=this.getSubscriptionId(),n.subscribeChannels=r,this.serviceClient.post(n).then(function(e){t.update(r,null)}).catch(this.onError)},c.prototype.unsubscribeFromChannels=function(){for(var t=this,r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var n=new p;return n.id=this.getSubscriptionId(),n.unsubscribeChannels=r,this.serviceClient.post(n).then(function(e){t.update(null,r)}).catch(this.onError)},c.prototype.getChannelSubscribers=function(){var t=this,e=new y;return e.channels=this.channels,this.serviceClient.get(e).then(function(e){return e.map(function(e){return t.toServerEventUser(e)})}).catch(function(e){return t.onError(e),[]})},c.prototype.toServerEventUser=function(e){var t=e.channels,r=new b;for(var n in r.userId=e.userId,r.displayName=e.displayName,r.profileUrl=e.profileUrl,r.channels=t?t.split(","):null,e)"userId"!=n&&"displayName"!=n&&"profileUrl"!=n&&"channels"!=n&&(null==r.meta&&(r.meta={}),r.meta[n]=e[n]);return r},c.UnknownChannel="*",c);function c(e,t,r,n){void 0===r&&(r={}),void 0===n&&(n=null);var I=this;if(this.channels=t,this.options=r,this.eventSource=n,this.onMessage=function(e){if(!I.stopped){var t=I.options;if(void 0===r)var r={querySelectorAll:function(e){return[]}};var n=r.querySelectorAll.bind(r),i=re.splitOnFirst(e.data," "),o=null,s=i[0],a=re.splitOnFirst(s,"@");1<a.length&&(o=a[0],s=a[1]);var u=i[1],l=null;try{l=u?JSON.parse(u):null}catch(e){}if((i=re.splitOnFirst(s,".")).length<=1)throw"invalid selector format: "+s;var c=i[0],h=i[1].replace(new RegExp("%20","g")," "),f=re.splitOnFirst(h,"$"),p=f[0],d=f[1],m=d&&n(d),y=m&&m[0],v={eventId:parseInt(e.lastEventId),data:e.data,type:T[p]||"ServerEventMessage",channel:o,selector:s,json:u,body:l,op:c,target:f[0],cssSelector:d,meta:{}},g="object"==typeof l?Object.assign({},v,l):v;if(!t.validate||!1!==t.validate(v)){var b=new Headers;if(b.set("Content-Type","text/plain"),"cmd"===c)if("onConnect"===p){if(I.connectionInfo=g,"string"==typeof l.heartbeatIntervalMs&&(I.connectionInfo.heartbeatIntervalMs=parseInt(l.heartbeatIntervalMs)),"string"==typeof l.idleTimeoutMs&&(I.connectionInfo.idleTimeoutMs=parseInt(l.idleTimeoutMs)),Object.assign(t,l),(S=t.handlers.onConnect)&&(S.call(y||r.body,I.connectionInfo,v),I.stopped))return;t.heartbeatUrl&&(t.heartbeat&&clearInterval(t.heartbeat),t.heartbeat=setInterval(function(){if(I.eventSource.readyState===EventSource.CLOSED){clearInterval(t.heartbeat);var e=t.handlers.onStop;return null!=e&&e.apply(I.eventSource),void I.reconnectServerEvents({error:new Error("EventSource is CLOSED")})}fetch(new Request(t.heartbeatUrl,{method:"POST",mode:"cors",headers:b,credentials:I.serviceClient.credentials})).then(function(e){if(!e.ok)throw new Error(e.status+" - "+e.statusText)}).catch(function(e){return I.reconnectServerEvents({error:e})})},I.connectionInfo&&I.connectionInfo.heartbeatIntervalMs||t.heartbeatIntervalMs||1e4)),t.unRegisterUrl&&"undefined"!=typeof window&&(window.onunload=function(){return I.stop()}),I.updateSubscriberUrl=t.updateSubscriberUrl,I.updateChannels((t.channels||"").split(","))}else{var w="onJoin"==p||"onLeave"==p||"onUpdate"==p;if(S=t.handlers[p])w?S.call(y||r.body,g):S.call(y||r.body,l,v);else if(!w){var E=t.receivers&&t.receivers.cmd;I.invokeReceiver(E,p,y,v,"cmd")}w&&(S=t.handlers.onCommand)&&S.call(y||r.body,g)}else"trigger"===c?I.raiseEvent(h,v):"css"===c&&re.css(m||n("body"),p,l);var S;E=t.receivers&&t.receivers[c];if(I.invokeReceiver(E,p,y,v,c),!T[p])(S=t.handlers.onMessage)&&S.call(y||r.body,g);t.onTick&&t.onTick()}}},this.onError=function(e){if(!I.stopped){e||(e=event);var t=I.options.onException;null!=t&&t.call(I.eventSource,e),I.options.onTick&&I.options.onTick()}},0===this.channels.length)throw"at least 1 channel is required";this.resolver=this.options.resolver||new o,this.eventStreamUri=re.combinePaths(e,"event-stream")+"?",this.updateChannels(t),this.serviceClient=new P(e),this.listeners={},this.withCredentials=!0,this.options.handlers||(this.options.handlers={})}re.ServerEventsClient=l;var h=(f.prototype.noSuchMethod=function(e,t){},f);function f(){}re.ServerEventReceiver=h;var p=(d.prototype.createResponse=function(){return new m},d.prototype.getTypeName=function(){return"UpdateEventSubscriber"},d);function d(){}re.UpdateEventSubscriber=p;var m=function(){};re.UpdateEventSubscriberResponse=m;var y=(v.prototype.createResponse=function(){return[]},v.prototype.getTypeName=function(){return"GetEventSubscribers"},v);function v(){}re.GetEventSubscribers=y;var b=function(){};re.ServerEventUser=b;var w=(E.Get="GET",E.Post="POST",E.Put="PUT",E.Delete="DELETE",E.Patch="PATCH",E.Head="HEAD",E.Options="OPTIONS",E.hasRequestBody=function(e){return!("GET"===e||"DELETE"===e||"HEAD"===e||"OPTIONS"===e)},E);function E(){}re.HttpMethods=w;var S=(I.prototype.createResponse=function(){return new A},I.prototype.getTypeName=function(){return"GetAccessToken"},I);function I(){}var A=function(){};re.GetAccessTokenResponse=A;var P=(R.prototype.setCredentials=function(e,t){this.userName=e,this.password=t},R.prototype.setBearerToken=function(e){this.bearerToken=e},R.prototype.get=function(e,t){return"string"!=typeof e?this.send(w.Get,e,t):this.send(w.Get,null,t,this.toAbsoluteUrl(e))},R.prototype.delete=function(e,t){return"string"!=typeof e?this.send(w.Delete,e,t):this.send(w.Delete,null,t,this.toAbsoluteUrl(e))},R.prototype.post=function(e,t){return this.send(w.Post,e,t)},R.prototype.postToUrl=function(e,t,r){return this.send(w.Post,t,r,this.toAbsoluteUrl(e))},R.prototype.postBody=function(e,t,r){return this.sendBody(w.Post,e,t,r)},R.prototype.put=function(e,t){return this.send(w.Put,e,t)},R.prototype.putToUrl=function(e,t,r){return this.send(w.Put,t,r,this.toAbsoluteUrl(e))},R.prototype.putBody=function(e,t,r){return this.sendBody(w.Put,e,t,r)},R.prototype.patch=function(e,t){return this.send(w.Patch,e,t)},R.prototype.patchToUrl=function(e,t,r){return this.send(w.Patch,t,r,this.toAbsoluteUrl(e))},R.prototype.patchBody=function(e,t,r){return this.sendBody(w.Patch,e,t,r)},R.prototype.sendAll=function(e){if(0==e.length)return Promise.resolve([]);var t=re.combinePaths(this.replyBaseUrl,re.nameOf(e[0])+"[]");return this.send(w.Post,e,null,t)},R.prototype.sendAllOneWay=function(e){if(0==e.length)return Promise.resolve(void 0);var t=re.combinePaths(this.oneWayBaseUrl,re.nameOf(e[0])+"[]");return this.send(w.Post,e,null,t).then(function(e){})},R.prototype.createUrlFromDto=function(e,t){var r=re.combinePaths(this.replyBaseUrl,re.nameOf(t));return w.hasRequestBody(e)||(r=re.appendQueryString(r,t)),r},R.prototype.toAbsoluteUrl=function(e){return e.startsWith("http://")||e.startsWith("https://")?e:re.combinePaths(this.baseUrl,e)},R.prototype.createRequest=function(e){var r=this,t=e.method,n=e.request,i=e.url,o=e.args,s=e.body;if(i||(i=this.createUrlFromDto(t,n)),o&&(i=re.appendQueryString(i,o)),null!=this.bearerToken?this.headers.set("Authorization","Bearer "+this.bearerToken):null!=this.userName&&this.headers.set("Authorization","Basic "+R.toBase64(this.userName+":"+this.password)),this.manageCookies){var a=Object.keys(this.cookies).map(function(e){var t=r.cookies[e];return t.expires&&t.expires<new Date?null:t.name+"="+encodeURIComponent(t.value)}).filter(function(e){return!!e});0<a.length?this.headers.set("Cookie",a.join("; ")):this.headers.delete("Cookie")}var u=new Headers(this.headers),l=w.hasRequestBody(t),c={url:i,method:t,mode:this.mode,credentials:this.credentials,headers:u,compress:!1};return l&&(c.body=s||JSON.stringify(n),"undefined"!=typeof window&&s instanceof FormData&&u.delete("Content-Type")),null!=this.requestFilter&&this.requestFilter(c),c},R.prototype.createResponse=function(e,t){var r=this;if(!e.ok)throw e;if(this.manageCookies){var n=[];e.headers.forEach(function(e,t){"set-cookie"==t.toLowerCase()&&n.push(e)}),n.forEach(function(e){var t=re.parseCookie(e);t&&(r.cookies[t.name]=t)})}null!=this.responseFilter&&this.responseFilter(e);var i=t&&"string"!=typeof t&&"function"==typeof t.createResponse?t.createResponse():null;if("string"==typeof i)return e.text().then(function(e){return e});var o=e.headers.get("content-type"),s=o&&-1!==o.indexOf("application/json");if(s)return e.json().then(function(e){return e});if("undefined"!=typeof Uint8Array&&i instanceof Uint8Array){if("function"!=typeof e.arrayBuffer)throw new Error("This fetch polyfill does not implement 'arrayBuffer'");return e.arrayBuffer().then(function(e){return new Uint8Array(e)})}if("function"==typeof Blob&&i instanceof Blob){if("function"!=typeof e.blob)throw new Error("This fetch polyfill does not implement 'blob'");return e.blob().then(function(e){return e})}var a=e.headers.get("content-length");return"0"===a||null==a&&!s?i:e.json().then(function(e){return e})},R.prototype.handleError=function(e,r,n){var i=this;if(void 0===n&&(n=null),r instanceof Error)throw this.raiseError(e,r);if(r.bodyUsed)throw this.raiseError(r,C(r.status,r.statusText,n));return void 0===r.json&&r.responseStatus?new Promise(function(e,t){return t(i.raiseError(null,r))}):r.json().then(function(e){var t=re.sanitize(e);if(!t.responseStatus)throw C(r.status,r.statusText,n);throw null!=n&&(t.type=n),t}).catch(function(e){if(e instanceof Error||"undefined"!=typeof window&&e instanceof window.DOMException)throw i.raiseError(r,C(r.status,r.statusText,n));throw i.raiseError(r,e)})},R.prototype.send=function(e,t,r,n){return this.sendRequest({method:e,request:t,args:r,url:n})},R.prototype.sendBody=function(e,t,r,n){var i=re.combinePaths(this.replyBaseUrl,re.nameOf(t));return this.sendRequest({method:e,request:r,body:"string"==typeof r?r:"undefined"!=typeof window&&r instanceof FormData?r:JSON.stringify(r),url:re.appendQueryString(i,t),args:n,returns:t})},R.prototype.sendRequest=function(t){function i(){var e=o.createRequest(t);return o.urlFilter&&o.urlFilter(e.url),fetch(e.url,e).then(function(e){return o.createResponse(e,r)}).catch(function(e){return o.handleError(s,e)})}var o=this,e=this.createRequest(t),r=t.returns||t.request,s=null;return this.urlFilter&&this.urlFilter(e.url),fetch(e.url,e).then(function(e){return s=e,o.createResponse(e,r)}).catch(function(e){if(401===e.status){if(o.refreshToken){var t=new S;t.refreshToken=o.refreshToken;var r=o.refreshTokenUri||o.createUrlFromDto(w.Post,t),n=o.createRequest({method:w.Post,request:t,args:null,url:r});return fetch(r,n).then(function(e){return o.createResponse(e,t).then(function(e){return o.bearerToken=e.accessToken,i()})}).catch(function(e){return o.handleError(s,e,"RefreshTokenException")})}if(o.onAuthenticationRequired)return o.onAuthenticationRequired().then(i)}return o.handleError(s,e)})},R.prototype.raiseError=function(e,t){return null!=this.exceptionFilter&&this.exceptionFilter(e,t),t},R);function R(e){void 0===e&&(e="/"),this.baseUrl=e,this.replyBaseUrl=re.combinePaths(e,"json","reply")+"/",this.oneWayBaseUrl=re.combinePaths(e,"json","oneway")+"/",this.mode="cors",this.credentials="include",this.headers=new Headers,this.headers.set("Content-Type","application/json"),this.manageCookies="undefined"==typeof document,this.cookies={}}re.JsonServiceClient=P;var C=function(e,t,r){void 0===r&&(r=null);var n=new s;return null!=r&&(n.type=r),n.responseStatus=new i,n.responseStatus.errorCode=e&&e.toString(),n.responseStatus.message=t,n};re.toCamelCase=function(e){return e?e.charAt(0).toLowerCase()+e.substring(1):e},re.toPascalCase=function(e){return e?e.charAt(0).toUpperCase()+e.substring(1):e},re.sanitize=function(e){if(e.responseStatus)return e;if(e.errors)return e;var t={};for(var r in e)e.hasOwnProperty(r)&&(e[r]instanceof Object?t[re.toCamelCase(r)]=re.sanitize(e[r]):t[re.toCamelCase(r)]=e[r]);if(t.errors=[],null!=e.Errors)for(var n=0,i=e.Errors.length;n<i;n++){var o=e.Errors[n],s={};for(var a in o)s[re.toCamelCase(a)]=o[a];t.errors.push(s)}return t},re.nameOf=function(e){if(!e)return"null";if("function"==typeof e.getTypeName)return e.getTypeName();var t=e&&e.constructor;if(null==t)throw e+" doesn't have constructor";if(t.name)return t.name;var r=t.toString();return r.substring(9,r.indexOf("("))},re.css=function(e,t,r){for(var n="string"==typeof e?document.querySelectorAll(e):e,i=0;i<n.length;i++){var o=n[i];null!=o&&null!=o.style&&(o.style[t]=r)}},re.splitOnFirst=function(e,t){if(!e)return[e];var r=e.indexOf(t);return 0<=r?[e.substring(0,r),e.substring(r+1)]:[e]},re.splitOnLast=function(e,t){if(!e)return[e];var r=e.lastIndexOf(t);return 0<=r?[e.substring(0,r),e.substring(r+1)]:[e]};var O=function(e){return"string"!=typeof e?e:e.replace(/([A-Z]|[0-9]+)/g," $1").replace(/_/g," ").trim()};re.humanize=function(e){return!e||0<=e.indexOf(" ")?e:O(e)},re.queryString=function(e){if(!e||-1===e.indexOf("?"))return{};for(var t=re.splitOnFirst(e,"?")[1].split("&"),r={},n=0;n<t.length;++n){var i=t[n].split("=");r[i[0]]=1<i.length?decodeURIComponent(i[1].replace(/\+/g," ")):null}return r},re.combinePaths=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r,n,i=[];for(r=0,n=e.length;r<n;r++){var o=e[r];i=-1===o.indexOf("://")?i.concat(o.split("/")):i.concat(o.lastIndexOf("/")===o.length-1?o.substring(0,o.length-1):o)}var s=[];for(r=0,n=i.length;r<n;r++){var a=i[r];a&&"."!==a&&(".."===a?s.pop():s.push(a))}return""===i[0]&&s.unshift(""),s.join("/")||(s.length?"/":".")},re.createPath=function(e,t){var r={};for(var n in t)r[n.toLowerCase()]=n;for(var i=e.split("/"),o="",s=0;s<i.length;s++){var a=i[s];if(null==a&&(a=""),"{"===a[0]&&"}"===a[a.length-1]){var u=r[a.substring(1,a.length-1).toLowerCase()];u&&(a=t[u],delete t[u])}0<o.length&&(o+="/"),o+=a}return o},re.createUrl=function(e,t){var r=re.createPath(e,t);return re.appendQueryString(r,t)},re.appendQueryString=function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e+=0<=e.indexOf("?")?"&":"?",e+=r+"="+B(t[r]));return e};var B=function(e){return null==e?"":"undefined"!=typeof Uint8Array&&e instanceof Uint8Array?re.bytesToBase64(e):encodeURIComponent(e)||""};re.bytesToBase64=function(e){for(var t,r=(3-e.length%3)%3,n="",i=e.length,o=0,s=0;s<i;s++)t=s%3,o|=e[s]<<(16>>>t&24),2!=t&&e.length-s!=1||(n+=String.fromCharCode(D(o>>>18&63),D(o>>>12&63),D(o>>>6&63),D(63&o)),o=0);return 0==r?n:n.substring(0,n.length-r)+(1==r?"=":"==")};var D=function(e){return e<26?e+65:e<52?e+71:e<62?e-4:62===e?43:63===e?47:65},_="function"==typeof btoa?btoa:function(e){return new t(e).toString("base64")};P.toBase64=function(e){return _(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode(new Number("0x"+t).valueOf())}))},re.stripQuotes=function(e){return e&&'"'==e[0]&&'"'==e[e.length]?e.slice(1,-1):e},re.tryDecode=function(t){try{return decodeURIComponent(t)}catch(e){return t}},re.parseCookie=function(e){if(!e)return null;for(var t=null,r=e.split(/; */),n=0;n<r.length;n++){var i=r[n],o=re.splitOnFirst(i,"="),s=o[0].trim(),a=1<o.length?re.tryDecode(re.stripQuotes(o[1].trim())):null;if(0==n)t={name:s,value:a,path:"/"};else{var u=s.toLowerCase();"httponly"==u?t.httpOnly=!0:"secure"==u?t.secure=!0:"expires"==u?(t.expires=new Date(a),"Invalid Date"===t.expires.toString()&&(t.expires=new Date(a.replace(/-/g," ")))):t[s]=a}}return t},re.normalizeKey=function(e){return e.toLowerCase().replace(/_/g,"")};var x=function(e){return"[object Array]"===Object.prototype.toString.call(e)};function U(){var e=this.responseStatus||this.ResponseStatus;if(null!=e){var t=e.ErrorCode?re.sanitize(e):e;return t.errors&&0!=t.errors.length?void 0:t.message||t.errorCode}}function L(e){var t=this.responseStatus||this.ResponseStatus;if(null!=t){var r=t.ErrorCode?re.sanitize(t):t,n=re.toVarNames(e);if(n&&null!=r.errors&&0!=r.errors.length){for(var i=n.map(function(e){return(e||"").toLowerCase()}),o=0,s=r.errors;o<s.length;o++){var a=s[o];if(-1!==i.indexOf((a.fieldName||"").toLowerCase()))return}for(var u=0,l=r.errors;u<l.length;u++){a=l[u];if(-1===i.indexOf((a.fieldName||"").toLowerCase()))return a.message||a.errorCode}}return r.message||r.errorCode||void 0}}re.normalize=function(e,t){if(x(e)){if(!t)return e;for(var r=[],n=0;n<e.length;n++)r[n]=re.normalize(e[n],t);return r}if("object"!=typeof e)return e;var i={};for(var o in e)i[re.normalizeKey(o)]=t?re.normalize(e[o],t):e[o];return i},re.getField=function(e,t){return null==e||null==t?null:e[t]||e[Object.keys(e).filter(function(e){return re.normalizeKey(e)===re.normalizeKey(t)})[0]||""]},re.parseResponseStatus=function(t,r){void 0===r&&(r=null);try{var e=JSON.parse(t);return re.sanitize(e.ResponseStatus||e.responseStatus)}catch(e){return{message:r||e.message||e,__error:{error:e,json:t}}}},re.toFormData=function(e){if("undefined"!=typeof window){var t=new FormData;for(var r in e)t.append(r,e[r]);return t}},re.toObject=function(e){var t=this,r={};if(!e)return r;if("object"!=typeof e)throw new Error("keys must be an Array of object keys");return Array.prototype.slice.call(e).forEach(function(e){t[e]&&(r[e]=t[e])}),r},re.errorResponseSummary=U,re.errorResponseExcept=L,re.errorResponse=function(t){if(null==t)return U.call(this);var e=this.responseStatus||this.ResponseStatus;if(null!=e){var r=e.ErrorCode?re.sanitize(e):e;if(null!=r.errors&&0!=r.errors.length){var n=r.errors.find(function(e){return(e.fieldName||"").toLowerCase()==t.toLowerCase()});return n?n.message||n.errorCode:void 0}}},re.toDate=function(e){return e?"function"==typeof e.getMonth?e:"/"==e[0]?new Date(parseFloat(/Date\(([^)]+)\)/.exec(e)[1])):new Date(e):null},re.toDateFmt=function(e){return re.dateFmt(re.toDate(e))},re.padInt=function(e){return e<10?"0"+e:e},re.dateFmt=function(e){return void 0===e&&(e=new Date),e.getFullYear()+"/"+re.padInt(e.getMonth()+1)+"/"+re.padInt(e.getDate())},re.dateFmtHM=function(e){return void 0===e&&(e=new Date),e.getFullYear()+"/"+re.padInt(e.getMonth()+1)+"/"+re.padInt(e.getDate())+" "+re.padInt(e.getHours())+":"+re.padInt(e.getMinutes())},re.timeFmt12=function(e){return void 0===e&&(e=new Date),re.padInt((e.getHours()+24)%12||12)+":"+re.padInt(e.getMinutes())+":"+re.padInt(e.getSeconds())+" "+(12<e.getHours()?"PM":"AM")};var k=function(e){return'<div class="alert alert-danger">'+e+"</div>"},M=function(e,t){return e.getAttribute(t)},N=function(e,t,r){return e.setAttribute(t,r)},j=function(e,t){return e.removeAttribute(t)},F={className:"class",htmlFor:"for"};function H(e,t,r){var n=document.createElement(e);if(r)for(var i in r)N(n,F[i]||i,r[i]);return t&&t.insertAfter&&t.insertAfter.parentNode.insertBefore(n,t.insertAfter.nextSibling),n}function q(){var e=M(this,"data-invalid");if(e){var t="checkbox"===this.type||"radio"===this.type||Y(this,"form-check"),r=t?function(e,t){for(;null!=e&&!Y(e,t);)e=e.parentElement;return e}(this,"form-check"):null;t?z(r||this.parentElement,"is-invalid form-control"):z(this,"is-invalid");var n=this.nextElementSibling,i=!n||M(n,"for")!==this.id&&"SMALL"!==n.tagName?this:t?r||n.parentElement:n;(null!=i&&i.nextElementSibling&&Y(i.nextElementSibling,"invalid-feedback")?i.nextElementSibling:H("div",{insertAfter:i},{className:"invalid-feedback"})).innerHTML=e}}re.createElement=H;var Y=function(e,t){return!!e&&(e.classList?e.classList.contains(t):-1<(" "+e.className+" ").replace(/[\n\t\r]/g," ").indexOf(" "+t+" "))},z=function(e,t){return e?e.classList?(r=e.classList).add.apply(r,t.split(" ")):Y(e,t)?null:e.className=(e.className+" "+t).trim():null;var r},V=function(e,t){return e?e.classList?e.classList.remove(t):Y(e,t)?e.className=e.className.replace(/(\s|^)someclass(\s|$)/," "):null:null};re.bootstrap=function(e){for(var t=(e||document).querySelectorAll("[data-invalid]"),r=0;r<t.length;r++)q.call(t[r])},"undefined"!=typeof window&&void 0!==window.Element&&(Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;do{if(t.matches(e))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType);return null})),re.bindHandlers=function(u,e){void 0===e&&(e=document),e.addEventListener("click",function(e){var t=e.target,r=M(t,"data-click");if(!r){var n=t.closest("[data-click]");n&&(r=M(n,"data-click"))}if(r){var i=r.indexOf(":");if(0<=i){var o=r.substring(0,i),s=r.substring(i+1);(a=u[o])&&a.apply(e.target,s.split(","))}else{var a;(a=u[r])&&a.apply(e.target,[].slice.call(arguments))}}})};var W={overrideMessages:!(re.bootstrapForm=function(t,r){t&&(r.model&&te(t,r.model),t.onsubmit=function(e){return e.preventDefault(),r.type="bootstrap-v4",Q(t,r)})}),messages:{NotEmpty:"Required",NotNull:"Required",Email:"Invalid email",AlreadyExists:"Already exists"},errorFilter:function(e,t,r){return this.overrideMessages?this.messages[t]||e||O(t):e||O(t)}};function G(e){V(e,"has-errors");var t=e.querySelectorAll.bind(e);t(".error-summary").forEach(function(e){e.innerHTML="",e.style.display="none"}),t("[data-validation-summary]").forEach(function(e){e.innerHTML=""}),t(".error").forEach(function(e){return V(e,"error")}),t(".form-check.is-invalid [data-invalid]").forEach(function(e){j(e,"data-invalid")}),t(".form-check.is-invalid").forEach(function(e){return V(e,"form-control")}),t(".is-invalid").forEach(function(e){V(e,"is-invalid"),j(e,"data-invalid")}),t(".is-valid").forEach(function(e){return V(e,"is-valid")})}var J={MultiPart:"multipart/form-data",UrlEncoded:"application/x-www-form-urlencoded",Json:"application/json"};function $(e){void 0===e&&(e={});var t,r=this,n=M(r,"enctype")||J.UrlEncoded;if(n==J.MultiPart&&void 0===window.FormData)throw new Error("FormData Type is needed to send '"+J.MultiPart+"' Content Types");try{t=X(r,n)}catch(e){throw new Error(""+(e.message||e))}var i=new Headers;i.set("Accept",J.Json),i.set("Content-Type",n);var o={method:M(r,"method")||"POST",credentials:"include",mode:"cors",headers:i,body:t};return e.requestFilter&&e.requestFilter(o),fetch(new Request(e.url||M(r,"action"),o)).catch(function(e){throw new Error("Network is unreachable ("+(e.message||e)+")")}).then(function(t){return e.responseFilter&&e.responseFilter(t),t.ok?(function(e,t){var r=t.headers.get("X-Location");r&&(location.href=r);var n=t.headers.get("X-Trigger");if(n){var i=n.indexOf(":"),o=0<=i?n.substring(0,i):n,s=0<=i?n.substring(i+1):null;ee(e,o,s?[s]:[])}}(r,t),function(e){var t=e.headers.get("content-type"),r=t&&-1!==t.indexOf(J.Json);if(r)return e.json();var n=e.headers.get("content-length");return"0"===n||null==n&&!r?null:e.json()}(t)):t.json().catch(function(e){throw new Error("The request failed with "+(t.statusText||t.status))}).then(function(e){throw Object.assign.apply(Object,[new s].concat(re.sanitize(e)))})})}function Q(i,o){void 0===o&&(o={});var s="bootstrap-v4"===o.type;G(i);try{if(o.validate&&!1===o.validate.call(i))return!1}catch(e){return!1}var a=i.querySelectorAll.bind(i);z(i,"loading");var e=null==o.onSubmitDisable?"[type=submit]":o.onSubmitDisable,t=null!=e&&""!=e;function r(e,t){if(void 0===t&&(t=null),t)!function(e,n,t){if(G(e),n){n=re.sanitize(n),z(e,"has-errors");var s=t&&"bootstrap-v4"===t.type,r=g({},W,t);t.messages&&(r.overrideMessages=!0);var i=r.errorFilter.bind(r),o=n.errors,a=e.querySelectorAll.bind(e);if(o&&o.length){var u={},l={};a("input,textarea,select,button").forEach(function(e){var t=e,r=t.previousElementSibling,n=t.nextElementSibling,i=("radio"===t.type||"checkbox"===t.type?null:t.id)||M(t,"name");if(i){var o=i.toLowerCase();u[o]=t,s||(Y(r,"help-inline")||Y(r,"help-block")?l[o]=r:(Y(n,"help-inline")||Y(n,"help-block"))&&(l[o]=n))}}),a(".help-inline[data-for],.help-block[data-for]").forEach(function(e){var t=M(e,"data-for").toLowerCase();l[t]=e});for(var c=0,h=o;c<h.length;c++){var f=h[c],p=(f.fieldName||"").toLowerCase(),d=u[p];if(d)if(s){var m=M(d,"type");"radio"===m||"checkbox"===m||z(d,"is-invalid"),N(d,"data-invalid",i(f.message,f.errorCode,"field"))}else z(d,"error"),z(d.parentElement,"has-error");var y=l[p];y&&(z(y,"error"),y.innerHTML=i(f.message,f.errorCode,"field"),y.style.display="block")}a("[data-validation-summary]").forEach(function(e){var t=M(e,"data-validation-summary").split(","),r=L.call(n,t);r&&(e.innerHTML=k(r))})}else{var v=i(n.message||O(n.errorCode),n.errorCode,"summary");s?a("[data-validation-summary]").forEach(function(e){return e.innerHTML="<"===v[0]?v:k(v)}):a(".error-summary").forEach(function(e){e.innerHTML=v,e.style.display="block"})}}}(i,t.ResponseStatus||t.responseStatus,g({},o));else if(e){z(i,"has-errors");var r=a(".error-summary")[0];if(r&&(r.innerHTML=e),s){var n=a("[data-validation-summary]")[0];n&&(n.innerHTML=k(e))}}o.error&&o.error.call(i,t),s&&a("[data-invalid]").forEach(function(e){return q.call(e)})}return t&&a(e).forEach(function(e){N(e,"disabled","disabled")}),(o.submit||$).call(i,o).then(function(e){return o.success&&o.success.call(i,e),!1}).catch(function(e){e.responseStatus?r(null,e):r(""+(e.message||e),null)}).finally(function(){V(i,"loading"),t&&a(e).forEach(function(e){j(e,"disabled")}),o.complete&&o.complete.call(i)})}function X(e,t){return void 0===t&&(t=null),t===J.MultiPart?new FormData(e):t==J.Json?JSON.stringify(re.serializeToObject(e)):Z(e)}function K(e,t,r){for(var n,i=e,o=i.elements.length,s=0;s<o;s++)if((n=i.elements[s]).name&&!n.disabled&&"file"!=n.type&&"reset"!=n.type&&"submit"!=n.type&&"button"!=n.type)if("select-multiple"==n.type)for(var a=i.elements[s].options.length-1;0<=a;a--)n.options[a].selected&&r(t,n.name,n.options[a].value);else("checkbox"!=n.type&&"radio"!=n.type||n.checked)&&r(t,n.name,n.value);return t}function Z(e){return K(e,[],function(e,t,r){return"string"==typeof r?e.push(encodeURIComponent(t)+"="+encodeURIComponent(r)):null}).join("&").replace(/%20/g,"+")}function ee(e,t,r){if(void 0===r&&(r=null),document.createEvent){(n=document.createEvent("click"==t||t.startsWith("mouse")?"MouseEvents":"HTMLEvents")).initEvent(t,!0,!0),n.data=r,e.dispatchEvent(n)}else{var n=document.createEventObject();e.fireEvent("on"+t,n)}}function te(e,t){if(t){var r;for(var n in t){var i=t[n];null==i&&(i="");var o=e.elements.namedItem(n)||e.elements.namedItem((r=n)?r[0]===r[0].toUpperCase()?re.toCamelCase(r):r[0]===r[0].toLowerCase()?re.toPascalCase(r):r:r),s=o;if(o)switch(s.type||o[0].type){case"radio":case"checkbox":for(var a=o.length,u=0;u<a;u++)o[u].checked=-1<i.indexOf(o[u].value);break;case"select-multiple":var l=x(i)?i:[i],c=o;for(u=0;u<c.options.length;u++)c.options[u].selected=-1<l.indexOf(c.options[u].value);break;case"select":case"select-one":s.value=i.toString()||i;break;case"date":var h=re.toDate(i);h&&(s.value=h.toISOString().split("T")[0]);break;default:s.value=i}}}}re.toVarNames=function(e){return e?x(e)?e:e.split(",").map(function(e){return e.trim()}):[]},re.formSubmit=$,re.ajaxSubmit=Q,re.serializeForm=X,re.serializeToObject=function(e){return K(e,{},function(e,t,r){return e[t]=r})},re.serializeToUrlEncoded=Z,re.serializeToFormData=function(e){return K(e,new FormData,function(e,t,r){return e.append(t,r)})},re.triggerEvent=ee,re.populateForm=te}).call(this,ne("./node_modules/buffer/index.js").Buffer)},"./node_modules/base64-js/index.js":function(e,t,r){"use strict";t.byteLength=function(e){var t=h(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=h(e),i=n[0],o=n[1],s=new c(function(e,t,r){return 3*(t+r)/4-r}(0,i,o)),a=0,u=0<o?i-4:i;for(r=0;r<u;r+=4)t=l[e.charCodeAt(r)]<<18|l[e.charCodeAt(r+1)]<<12|l[e.charCodeAt(r+2)]<<6|l[e.charCodeAt(r+3)],s[a++]=t>>16&255,s[a++]=t>>8&255,s[a++]=255&t;2===o&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,s[a++]=255&t);1===o&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,s[a++]=t>>8&255,s[a++]=255&t);return s},t.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o<s;o+=16383)i.push(u(e,o,s<o+16383?s:o+16383));1==n?(t=e[r-1],i.push(a[t>>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;i<o;++i)a[i]=n[i],l[n.charCodeAt(i)]=i;function h(e){var t=e.length;if(0<t%4)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function u(e,t,r){for(var n,i,o=[],s=t;s<r;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),o.push(a[(i=n)>>18&63]+a[i>>12&63]+a[i>>6&63]+a[63&i]);return o.join("")}l["-".charCodeAt(0)]=62,l["_".charCodeAt(0)]=63},"./node_modules/buffer/index.js":function(e,M,N){"use strict";(function(e){var n=N("./node_modules/base64-js/index.js"),o=N("./node_modules/ieee754/index.js"),s=N("./node_modules/isarray/index.js");function r(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(r()<t)throw new RangeError("Invalid typed array length");return h.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=h.prototype:(null===e&&(e=new h(t)),e.length=t),e}function h(e,t,r){if(!(h.TYPED_ARRAY_SUPPORT||this instanceof h))return new h(e,t,r);if("number"!=typeof e)return i(this,e,t,r);if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return l(this,e)}function i(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);h.TYPED_ARRAY_SUPPORT?(e=t).__proto__=h.prototype:e=c(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!h.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(t,r),i=(e=a(e,n)).write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(h.isBuffer(t)){var r=0|f(t.length);return 0===(e=a(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||function(e){return e!=e}(t.length)?a(e,0):c(e,t);if("Buffer"===t.type&&s(t.data))return c(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function u(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 l(e,t){if(u(t),e=a(e,t<0?0:0|f(t)),!h.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function c(e,t){var r=t.length<0?0:0|f(t.length);e=a(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function f(e){if(e>=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|e}function p(e,t){if(h.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 r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return L(e).length;default:if(n)return U(e).length;t=(""+t).toLowerCase(),n=!0}}function d(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):2147483647<r?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=h.from(t,n)),h.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"==typeof t)return t&=255,h.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){var o,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a/=s=2,u/=2,r/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var c=-1;for(o=r;o<a;o++)if(l(e,o)===l(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===u)return c*s}else-1!==c&&(o-=o-c),c=-1}else for(a<r+u&&(r=a-u),o=r;0<=o;o--){for(var h=!0,f=0;f<u;f++)if(l(e,o+f)!==l(t,f)){h=!1;break}if(h)return o}return-1}function v(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?i<(n=Number(n))&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");o/2<n&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[r+s]=a}return s}function g(e,t,r,n){return k(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function b(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function w(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,s,a,u,l=e[i],c=null,h=239<l?4:223<l?3:191<l?2:1;if(i+h<=r)switch(h){case 1:l<128&&(c=l);break;case 2:128==(192&(o=e[i+1]))&&127<(u=(31&l)<<6|63&o)&&(c=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&2047<(u=(15&l)<<12|(63&o)<<6|63&s)&&(u<55296||57343<u)&&(c=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&65535<(u=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)&&u<1114112&&(c=u)}null===c?(c=65533,h=1):65535<c&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=h}return function(e){var t=e.length;if(t<=E)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=E));return r}(n)}M.Buffer=h,M.SlowBuffer=function(e){+e!=e&&(e=0);return h.alloc(+e)},M.INSPECT_MAX_BYTES=50,h.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}}(),M.kMaxLength=r(),h.poolSize=8192,h._augment=function(e){return e.__proto__=h.prototype,e},h.from=function(e,t,r){return i(null,e,t,r)},h.TYPED_ARRAY_SUPPORT&&(h.prototype.__proto__=Uint8Array.prototype,h.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&h[Symbol.species]===h&&Object.defineProperty(h,Symbol.species,{value:null,configurable:!0})),h.alloc=function(e,t,r){return function(e,t,r,n){return u(t),t<=0?a(e,t):void 0!==r?"string"==typeof n?a(e,t).fill(r,n):a(e,t).fill(r):a(e,t)}(null,e,t,r)},h.allocUnsafe=function(e){return l(null,e)},h.allocUnsafeSlow=function(e){return l(null,e)},h.isBuffer=function(e){return!(null==e||!e._isBuffer)},h.compare=function(e,t){if(!h.isBuffer(e)||!h.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},h.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}},h.concat=function(e,t){if(!s(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return h.alloc(0);var r;if(void 0===t)for(r=t=0;r<e.length;++r)t+=e[r].length;var n=h.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(!h.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},h.byteLength=p,h.prototype._isBuffer=!0,h.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)d(this,t,t+1);return this},h.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)d(this,t,t+3),d(this,t+1,t+2);return this},h.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)d(this,t,t+7),d(this,t+1,t+6),d(this,t+2,t+5),d(this,t+3,t+4);return this},h.prototype.toString=function(){var e=0|this.length;return 0==e?"":0===arguments.length?w(this,0,e):function(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,r);case"utf8":case"utf-8":return w(this,t,r);case"ascii":return S(this,t,r);case"latin1":case"binary":return I(this,t,r);case"base64":return b(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},h.prototype.equals=function(e){if(!h.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===h.compare(this,e)},h.prototype.inspect=function(){var e="",t=M.INSPECT_MAX_BYTES;return 0<this.length&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},h.prototype.compare=function(e,t,r,n,i){if(!h.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),u=this.slice(n,i),l=e.slice(t,r),c=0;c<a;++c)if(u[c]!==l[c]){o=u[c],s=l[c];break}return o<s?-1:s<o?1:0},h.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},h.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},h.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},h.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||i<r)&&(r=i),0<e.length&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o,s,a,u,l,c,h,f,p,d=!1;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return f=t,p=r,k(U(e,(h=this).length-f),h,f,p);case"ascii":return g(this,e,t,r);case"latin1":case"binary":return g(this,e,t,r);case"base64":return u=this,l=t,c=r,k(L(e),u,l,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s=t,a=r,k(function(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,(o=this).length-s),o,s,a);default:if(d)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),d=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var E=4096;function S(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function I(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function T(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||n<r)&&(r=n);for(var i="",o=t;o<r;++o)i+=x(e[o]);return i}function A(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function P(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(r<e+t)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,r,n,i,o){if(!h.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(i<t||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function C(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i<o;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function O(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i<o;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function B(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,r,n,i){return i||B(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function _(e,t,r,n,i){return i||B(e,0,r,8),o.write(e,t,r,n,52,8),r+8}h.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):n<e&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):n<t&&(t=n),t<e&&(t=e),h.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=h.prototype;else{var i=t-e;r=new h(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+e]}return r},h.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},h.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var n=this[e+--t],i=1;0<t&&(i*=256);)n+=this[e+--t]*i;return n},h.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},h.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},h.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},h.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},h.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},h.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return(i*=128)<=n&&(n-=Math.pow(2,8*t)),n},h.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0<n&&(i*=256);)o+=this[e+--n]*i;return(i*=128)<=o&&(o-=Math.pow(2,8*t)),o},h.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},h.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},h.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},h.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!0,23,4)},h.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!1,23,4)},h.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!0,52,8)},h.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!1,52,8)},h.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||R(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},h.prototype.writeUIntBE=function(e,t,r,n){e=+e,t|=0,r|=0,n||R(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},h.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,1,255,0),h.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},h.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):C(this,e,t,!0),t+2},h.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):C(this,e,t,!1),t+2},h.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):O(this,e,t,!0),t+4},h.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):O(this,e,t,!1),t+4},h.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);R(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},h.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);R(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;0<=--o&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},h.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,1,127,-128),h.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},h.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):C(this,e,t,!0),t+2},h.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):C(this,e,t,!1),t+2},h.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):O(this,e,t,!0),t+4},h.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):O(this,e,t,!1),t+4},h.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},h.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},h.prototype.writeDoubleLE=function(e,t,r){return _(this,e,t,!0,r)},h.prototype.writeDoubleBE=function(e,t,r){return _(this,e,t,!1,r)},h.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),0<n&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,o=n-r;if(this===e&&r<t&&t<n)for(i=o-1;0<=i;--i)e[i+t]=this[i+r];else if(o<1e3||!h.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+o),t);return o},h.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!h.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var s=h.isBuffer(e)?e:U(new h(e,n).toString()),a=s.length;for(o=0;o<r-t;++o)this[o+t]=s[o%a]}return this};var t=/[^+\/0-9A-Za-z-_]/g;function x(e){return e<16?"0"+e.toString(16):e.toString(16)}function U(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],s=0;s<n;++s){if(55295<(r=e.charCodeAt(s))&&r<57344){if(!i){if(56319<r){-1<(t-=3)&&o.push(239,191,189);continue}if(s+1===n){-1<(t-=3)&&o.push(239,191,189);continue}i=r;continue}if(r<56320){-1<(t-=3)&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&-1<(t-=3)&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function L(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(t,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function k(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,N("./node_modules/webpack/buildin/global.js"))},"./node_modules/fetch-everywhere/fetch-npm-browserify.js":function(e,t,r){r("./node_modules/whatwg-fetch/fetch.js");var n="undefined"!=typeof self&&self||this;e.exports=n.fetch.bind(n)},"./node_modules/ieee754/index.js":function(e,t){t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,l=u>>1,c=-7,h=r?i-1:0,f=r?-1:1,p=e[t+h];for(h+=f,o=p&(1<<-c)-1,p>>=-c,c+=a;0<c;o=256*o+e[t+h],h+=f,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;0<c;s=256*s+e[t+h],h+=f,c-=8);if(0===o)o=1-l;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=l}return(p?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,u,l=8*o-i-1,c=(1<<l)-1,h=c>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),2<=(t+=1<=s+h?f/u:f*Math.pow(2,1-h))*u&&(s++,u/=2),c<=s+h?(a=0,s=c):1<=s+h?(a=(t*u-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));8<=i;e[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<<i|a,l+=i;0<l;e[r+p]=255&s,p+=d,s/=256,l-=8);e[r+p-d]|=128*m}},"./node_modules/isarray/index.js":function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},"./node_modules/webpack/buildin/global.js":function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},"./node_modules/whatwg-fetch/fetch.js":function(e,t,r){"use strict";r.r(t),r.d(t,"Headers",function(){return l}),r.d(t,"Request",function(){return y}),r.d(t,"Response",function(){return g}),r.d(t,"DOMException",function(){return w}),r.d(t,"fetch",function(){return E});var a={searchParams:"URLSearchParams"in self,iterable:"Symbol"in self&&"iterator"in Symbol,blob:"FileReader"in self&&"Blob"in self&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in self,arrayBuffer:"ArrayBuffer"in self};if(a.arrayBuffer)var n=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],i=ArrayBuffer.isView||function(e){return e&&-1<n.indexOf(Object.prototype.toString.call(e))};function o(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function s(e){return"string"!=typeof e&&(e=String(e)),e}function u(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return a.iterable&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach(function(e,t){this.append(t,e)},this):Array.isArray(t)?t.forEach(function(e){this.append(e[0],e[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function c(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function h(r){return new Promise(function(e,t){r.onload=function(){e(r.result)},r.onerror=function(){t(r.error)}})}function f(e){var t=new FileReader,r=h(t);return t.readAsArrayBuffer(e),r}function p(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function d(){return this.bodyUsed=!1,this._initBody=function(e){(this._bodyInit=e)?"string"==typeof e?this._bodyText=e:a.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:a.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:a.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():a.arrayBuffer&&a.blob&&function(e){return e&&DataView.prototype.isPrototypeOf(e)}(e)?(this._bodyArrayBuffer=p(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||i(e))?this._bodyArrayBuffer=p(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):a.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a.blob&&(this.blob=function(){var e=c(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(f)}),this.text=function(){var e=c(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,r=h(t);return t.readAsText(e),r}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a.formData&&(this.formData=function(){return this.text().then(v)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(e,t){e=o(e),t=s(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},l.prototype.delete=function(e){delete this.map[o(e)]},l.prototype.get=function(e){return e=o(e),this.has(e)?this.map[e]:null},l.prototype.has=function(e){return this.map.hasOwnProperty(o(e))},l.prototype.set=function(e,t){this.map[o(e)]=s(t)},l.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},l.prototype.keys=function(){var r=[];return this.forEach(function(e,t){r.push(t)}),u(r)},l.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),u(t)},l.prototype.entries=function(){var r=[];return this.forEach(function(e,t){r.push([t,e])}),u(r)},a.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var m=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function y(e,t){var r=(t=t||{}).body;if(e instanceof y){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new l(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,r||null==e._bodyInit||(r=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new l(t.headers)),this.method=function(e){var t=e.toUpperCase();return-1<m.indexOf(t)?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function v(e){var i=new FormData;return e.trim().split("&").forEach(function(e){if(e){var t=e.split("="),r=t.shift().replace(/\+/g," "),n=t.join("=").replace(/\+/g," ");i.append(decodeURIComponent(r),decodeURIComponent(n))}}),i}function g(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=200<=this.status&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new l(t.headers),this.url=t.url||"",this._initBody(e)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},d.call(y.prototype),d.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},g.error=function(){var e=new g(null,{status:0,statusText:""});return e.type="error",e};var b=[301,302,303,307,308];g.redirect=function(e,t){if(-1===b.indexOf(t))throw new RangeError("Invalid status code");return new g(null,{status:t,headers:{location:e}})};var w=self.DOMException;try{new w}catch(e){(w=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack}).prototype=Object.create(Error.prototype),w.prototype.constructor=w}function E(o,s){return new Promise(function(r,e){var t=new y(o,s);if(t.signal&&t.signal.aborted)return e(new w("Aborted","AbortError"));var n=new XMLHttpRequest;function i(){n.abort()}n.onload=function(){var e={status:n.status,statusText:n.statusText,headers:function(e){var i=new l;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(e){var t=e.split(":"),r=t.shift().trim();if(r){var n=t.join(":").trim();i.append(r,n)}}),i}(n.getAllResponseHeaders()||"")};e.url="responseURL"in n?n.responseURL:e.headers.get("X-Request-URL");var t="response"in n?n.response:n.responseText;r(new g(t,e))},n.onerror=function(){e(new TypeError("Network request failed"))},n.ontimeout=function(){e(new TypeError("Network request failed"))},n.onabort=function(){e(new w("Aborted","AbortError"))},n.open(t.method,t.url,!0),"include"===t.credentials?n.withCredentials=!0:"omit"===t.credentials&&(n.withCredentials=!1),"responseType"in n&&a.blob&&(n.responseType="blob"),t.headers.forEach(function(e,t){n.setRequestHeader(t,e)}),t.signal&&(t.signal.addEventListener("abort",i),n.onreadystatechange=function(){4===n.readyState&&t.signal.removeEventListener("abort",i)}),n.send(void 0===t._bodyInit?null:t._bodyInit)})}E.polyfill=!0,self.fetch||(self.fetch=E,self.Headers=l,self.Request=y,self.Response=g)},"./src/_shared/dtos.ts":function(e,t,r){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s,a,u,l,c,h,f,p;r.d(t,"b",function(){return d}),r.d(t,"c",function(){return m}),r.d(t,"a",function(){return y}),(a=s||(s={})).NotSpecified="NotSpecified",a.Male="Male",a.Female="Female",(l=u||(u={})).NotSelected="NotSelected",l.Single="Single",l.Married="Married",l.Divorced="Divorced",l.Widowed="Widowed",(h=c||(c={})).Email="Email",h.SMS="SMS",h.DM="DM",h.LP="LP",h.Banner="Banner",(p=f||(f={})).Active="Active",p.Archived="Archived";var d=function e(){o(this,e)},m=function(){function e(){o(this,e)}return i(e,[{key:"createResponse",value:function(){return new Object}},{key:"getTypeName",value:function(){return"SubscribeRequest"}}]),e}(),y=function(){function e(){o(this,e)}return i(e,[{key:"createResponse",value:function(){return new d}},{key:"getTypeName",value:function(){return"SignUpWidgetResourcesRequest"}}]),e}()},"./src/app/api.ts":function(e,t,r){"use strict";var o=r("./src/_shared/dtos.ts"),s=r("./src/app/service.ts");t.a={subscribe:function(e,t,r){var n=new o.c;n=Object.assign(n,e);var i=s.a.getClient(r);return i.setBearerToken(t),i.post(n)},validateDomain:function(e,t){var r=new o.a;r.token=e;var n=s.a.getClient(t);return n.setBearerToken(e),n.post(r)}}},"./src/app/b4Widget.ts":function(e,t,r){"use strict";r.d(t,"a",function(){return l});var i=r("./src/_shared/dtos.ts"),n=r("./src/app/common/locations.ts"),h=r("./src/app/common/functions.ts"),f=r("./src/app/common/validations.ts"),o=r("./src/app/api.ts");function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}Object(n.b)();var a=[{name:"firstName",tagName:"input",label:"First name",placeHolder:"first name",field:"firstName",type:"text"},{name:"lastName",tagName:"input",label:"Last name",placeHolder:"last name",field:"lastName",type:"text"},{name:"email",tagName:"input",label:"Email",placeHolder:"email",field:"email",type:"text"},{name:"phone",tagName:"input",label:"Phone",placeHolder:"phone",field:"phone",type:"text"},{name:"birthDate",tagName:"input",label:"Birth date",placeHolder:"birth date",field:"birthDate",type:"text"},{name:"locationSelect",tagName:"select",label:"Locations",field:"locationIds"},{name:"subscribe",tagName:"button",innerText:"subscribe"},{name:"errorLabel",tagName:"div"}],u={input:"form-control",select:"form-control",textarea:"form-control",button:"btn"},l=function(){function e(r){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.userDefine={},this.validDomain=!1,this.locs=[],this.locations=[],this.url=h.a.mapParameter(r,"url"),this.token=h.a.mapParameter(r,"token"),o.a.validateDomain(this.token,this.url).then(function(e){var t=new i.b;t=Object.assign(t,e),n.validDomain=t.validDomain,n.checkValidDomain(),n.accountId=t.accountId,n.locations=h.a.setBrandLocations(t.locations),n.parseParameters(r),n.render()}).catch(function(e){throw new Error(e)})}return function(e,t,r){t&&s(e.prototype,t),r&&s(e,r)}(e,[{key:"setLocation",value:function(e){this.checkValidDomain(),this.manualLocationSet?(this.locs=[],e&&this.locs.push(e)):console.warn("The parameter manualLocationSet is set to 'False'. This not allow set location manually.")}},{key:"getIdFromStoredIdentifier",value:function(t){this.checkValidDomain();var e=this.locations.filter(function(e){return e.storeIdentifier==t});return 0<e.length?e[0]:null}},{key:"setLocationByStoreIdentifier",value:function(e){this.checkValidDomain();var t=this.getIdFromStoredIdentifier(e);this.setLocation(t.locationId)}},{key:"getLocationsList",value:function(){return this.checkValidDomain(),this.locations.filter(function(e){return e})}},{key:"getClosestLocations",value:function(r,n){if(this.checkValidDomain(),n&&"function"==typeof n)if(navigator.geolocation){var i=this;navigator.geolocation.getCurrentPosition(function(e){if(0<i.locations.length){var t=i.searchClosestLocations(e.coords,r);n(t)}else n(new Array)},function(e){console.warn("ERROR(".concat(e.code,"): ").concat(e.message)),n(new Array)},{enableHighAccuracy:!0,timeout:1e4,maximumAge:0})}else console.warn("Geolocation is not supported by this browser."),n(new Array);else console.warn("Parameter 'callback' must be provided and of type function.")}},{key:"searchClosestLocations",value:function(t,e){this.checkValidDomain();var r=h.a.mapParameter(e,"topNLocations")||1,n=h.a.mapParameter(e,"metricUnit")||0,i=h.a.mapParameter(e,"searchRange")||1,o=h.a.mapParameter(e,"setFirstCloseLocation")||!1,s=this.locations.filter(function(e){return e});return s.forEach(function(e){e.distance=h.a.getDistanceFromLatLon(t.latitude,t.longitude,e.latitude,e.longitude,n)}),s.sort(function(e,t){return e.distance>t.distance?1:-1}),s=(s=s.filter(function(e){return e.distance<=i})).slice(0,r),o&&0<s.length&&this.setLocationByStoreIdentifier(s[0].storeIdentifier),s}},{key:"parseParameters",value:function(e){if(this.checkValidDomain(),!e)throw new Error("The parameters must be define.");this.userDefine=h.a.mapParameter(e,"layout.userDefine"),this.targetId=h.a.mapParameter(e,"layout.targetId"),this.useLabels=h.a.mapParameter(e,"layout.useLabels")||!1,this.usePlaceholdersInFields=h.a.mapParameter(e,"layout.usePlaceholdersInFields")||!1,this.useBootstrapClasses=h.a.mapParameter(e,"layout.useBootstrapClasses")||!1,this.excludedFields=h.a.mapParameter(e,"layout.excludedFields")||[];var t=h.a.mapParameter(e,"layout.fieldOrientation")||"";this.fieldOrientation=t.match(/^(?:horizontal|vertical)$/)?t:"horizontal",this.hideWidgetAfterSignUp=h.a.mapParameter(e,"hideWidgetAfterSignUp")||!1,this.manualLocationSet=h.a.mapParameter(e,"manualLocationSet")||!1,this.onSubscriptionEvent=h.a.mapParameter(e,"events.onSubscription"),this.onSubscribedEvent=h.a.mapParameter(e,"events.onSubscribed"),this.showOnlyLocs=h.a.mapParameter(e,"locations.showOnlyLocs")||[],this.excludedLocs=h.a.mapParameter(e,"locations.excludedLocs")||[],this.subscriptionSucceededMsg=h.a.mapParameter(e,"messages.subscriptionSucceeded")||"Subscription successful!",this.subscriptionFailedMsg=h.a.mapParameter(e,"messages.subscriptionFailed")||"Subscription failed, please try again later or contact us."}},{key:"render",value:function(){var r=this;this.checkValidDomain();var e=[];if(this.userDefine){if(!(e=h.a.mapParameter(this.userDefine,"fieldsToShow"))||0==e.length)throw new Error("Must map the fields to capture the information for the subscription.")}else{if(this.targetElement=document.getElementById(this.targetId),!this.targetElement)throw new Error("The value of the parameter targetId (".concat(this.targetId,") does not correspond to any HTML Element."));this.createHTMLElements()}var t=e.filter(function(e){return"firstName"==e.mappedField});this.firstNameInput=document.getElementById(0<t.length?t[0].target:"".concat(this.targetId,"-firstName"));var n=e.filter(function(e){return"lastName"==e.mappedField});this.lastNameInput=document.getElementById(0<n.length?n[0].target:"".concat(this.targetId,"-lastName"));var i=e.filter(function(e){return"email"==e.mappedField});this.emailInput=document.getElementById(0<i.length?i[0].target:"".concat(this.targetId,"-email"));var o=e.filter(function(e){return"phone"==e.mappedField});this.phoneInput=document.getElementById(0<o.length?o[0].target:"".concat(this.targetId,"-phone"));var s=e.filter(function(e){return"birthDate"==e.mappedField});this.birthDateInput=document.getElementById(0<s.length?s[0].target:"".concat(this.targetId,"-birthDate"));var a=e.filter(function(e){return"locationIds"==e.mappedField});this.locationSelect=document.getElementById(0<a.length?a[0].target:"".concat(this.targetId,"-locationSelect"));var u=h.a.mapParameter(this.userDefine,"subscribeButton");if(this.subscribeBtn=document.getElementById(u||"".concat(this.targetId,"-subscribe")),this.subscribeBtn&&this.subscribeBtn.addEventListener("click",function(e){e.preventDefault(),r.subscribe()}),this.locationSelect){this.locationSelect.innerText=null;var l=[];0==(l=this.locations.filter(function(t){return r.showOnlyLocs.some(function(e){return e==t.locationId})})).length&&(l=this.locations),(l=l.filter(function(t){return 0==r.excludedLocs.some(function(e){return e==t.locationId})})).forEach(function(e){var t=document.createElement("option");t.value=e.locationId.toString(),t.text=e.locationName,r.locationSelect.add(t)})}}},{key:"createHTMLElements",value:function(){var i=this;this.checkValidDomain();var o=document.createElement("form");o.id="".concat(this.targetId,"-frm"),o.className="".concat(this.targetId,"-frm-cls"),o.style.width=this.fieldOrientation.match("horizontal")?"auto":"200px",a.forEach(function(e){if(h.a.mapParameter(e,"name")&&h.a.mapParameter(e,"tagName")&&!i.excludedFields.includes(e.name)){var t=document.createElement("div");if(t.className="div-".concat(e.name,"-cls ").concat(i.useBootstrapClasses?"form-group":""),t.className=t.className.trim(),i.useLabels&&h.a.mapParameter(e,"label")){var r=document.createElement("label");r.innerText=e.label,t.appendChild(r)}var n=document.createElement(e.tagName);n.id="".concat(i.targetId,"-").concat(e.name),n.className="".concat(i.targetId,"-").concat(e.name,"-cls ").concat(i.useBootstrapClasses&&h.a.mapParameter(u,e.tagName)||""),n.className=n.className.trim(),n.className.trim(),h.a.mapParameter(e,"type")&&(n.type=e.type),i.usePlaceholdersInFields&&h.a.mapParameter(e,"placeHolder")&&(n.placeholder=e.placeHolder),h.a.mapParameter(e,"innerText")&&(n.innerText=e.innerText),t.appendChild(n),o.appendChild(t)}}),this.targetElement.appendChild(o)}},{key:"subscribe",value:function(){var t=this;this.checkValidDomain(),this.firstName=this.firstNameInput?this.firstNameInput.value:null,this.lastName=this.lastNameInput?this.lastNameInput.value:null,this.email=this.emailInput?this.emailInput.value:null,this.phone=this.phoneInput?this.phoneInput.value:null,this.locationSelect&&!this.manualLocationSet&&(this.locs=[],Array.from(this.locationSelect.selectedOptions).forEach(function(e){t.locs.push(Number(e.value))})),this.birthDate=this.birthDateInput?this.birthDateInput.value:null;var e=null;if(this.userDefine&&(e=h.a.mapParameter(this.userDefine,"eventsMessage")),this.eventsMessageTarget=this.userDefine?null==e?null:document.getElementById(e):document.getElementById("".concat(this.targetId,"-errorLabel")),this.validate()){this.userDefine||(this.subscribeBtn.disabled=!0),this.onSubscriptionEvent&&this.onSubscriptionEvent();var r=new i.c;if(r.firstName=this.firstName,r.lastName=this.lastName,r.email=this.email,r.phone=this.phone,r.birthdate=this.birthDateInput&&"text"==this.birthDateInput.type?h.a.parseBirthDate(this.birthDate):this.birthDate,r.locationIds=this.locs,r.accountId=this.accountId,this.onSubscribedEvent){var n=o.a.subscribe(r,this.token,this.url);this.onSubscribedEvent(n),n.then(function(){t.hideWidgetAfterSignUp&&t.hideWidgetElements()}).catch().finally(function(){t.userDefine||(t.subscribeBtn.disabled=!1)})}else o.a.subscribe(r,this.token,this.url).then(function(e){t.clearWidgetElements(),t.hideWidgetAfterSignUp&&t.hideWidgetElements(),t.eventsMessageTarget&&(t.eventsMessageTarget.innerHTML=t.subscriptionSucceededMsg)}).catch(function(e){t.eventsMessageTarget&&(t.eventsMessageTarget.innerHTML=t.subscriptionFailedMsg),console.log(e)}).finally(function(){t.userDefine||(t.subscribeBtn.disabled=!1)})}}},{key:"validate",value:function(){this.checkValidDomain();var e,t=!0;this.errorArray=[],this.eventsMessageTarget&&(this.eventsMessageTarget.innerHTML="");var r=[];this.userDefine&&(r=h.a.mapParameter(this.userDefine,"fieldsToShow"));var n=r.filter(function(e){return"email"==e.mappedField}),i=0<n.length?document.getElementById(n[0].msgValidationTarget):null,o=r.filter(function(e){return"phone"==e.mappedField}),s=0<o.length?document.getElementById(o[0].msgValidationTarget):null,a=r.filter(function(e){return"birthDate"==e.mappedField}),u=0<a.length?document.getElementById(a[0].msgValidationTarget):null,l=r.filter(function(e){return"locationIds"==e.mappedField}),c=0<l.length?document.getElementById(l[0].msgValidationTarget):null;return null!=this.email&&0!=this.email.length||null!=this.phone&&0!=this.phone.length?(t=1==(e=f.a.email(this.email))&&t,this.userDefine&&null!=i?i.innerHTML=1==e?"":e:h.a.pushError(e,this.errorArray),t=1==(e=f.a.phone(this.phone))&&t,this.userDefine&&null!=s?s.innerHTML=1==e?"":e:h.a.pushError(e,this.errorArray)):(t=!1,e=this.emailInput&&this.phoneInput?"Must specify at least email or phone.":this.phoneInput?"Must specify phone.":"Must specify email.",this.userDefine&&null!=i?i.innerHTML=e:h.a.pushError(e,this.errorArray)),this.birthDateInput&&"text"==this.birthDateInput.type&&(t=1==(e=f.a.birthDate(this.birthDate))&&t,this.userDefine&&null!=u?u.innerHTML=1==e?"":e:h.a.pushError(e,this.errorArray)),0==this.locs.length&&(t=!1,e="Must select at least one location.",this.userDefine&&null!=c?c.innerHTML=e:h.a.pushError(e,this.errorArray)),this.userDefine||t||(this.eventsMessageTarget.innerHTML=this.errorArray.join("</br>")),t}},{key:"checkValidDomain",value:function(){if(!this.validDomain)throw new Error("Invalid Token.")}},{key:"clearWidgetElements",value:function(){this.checkValidDomain(),this.firstNameInput&&(this.firstNameInput.value=null),this.lastNameInput&&(this.lastNameInput.value=null),this.emailInput&&(this.emailInput.value=null),this.phoneInput&&(this.phoneInput.value=null),this.birthDateInput&&(this.birthDateInput.value=null),this.manualLocationSet&&(this.locs=[])}},{key:"hideWidgetElements",value:function(){this.checkValidDomain();var e="none";this.userDefine?(this.firstNameInput&&(this.firstNameInput.style.display=e),this.lastNameInput&&(this.lastNameInput.style.display=e),this.emailInput&&(this.emailInput.style.display=e),this.phoneInput&&(this.phoneInput.style.display=e),this.birthDateInput&&(this.birthDateInput.style.display=e),this.locationSelect&&(this.locationSelect.style.display=e),this.subscribeBtn&&(this.subscribeBtn.style.display=e),this.eventsMessageTarget&&(this.eventsMessageTarget.style.display=e)):this.targetElement.style.display=e}}]),e}()},"./src/app/common/functions.ts":function(e,t,r){"use strict";var n=r("./src/app/common/locations.ts");function i(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)))return;var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}t.a={mapParameter:function(e,t){if(!t)return e;var r,n;return r=t.split("."),n=e,r.reduce(function(e,t){return e&&e[t]?e[t]:null},n)},parseBirthDate:function(e){if(e&&0<e.length){var t=i(e.split("/"),2),r=t[0],n=t[1];return"".concat(1904,"-").concat(r,"-").concat(n)}return null},pushError:function(e,t){1!=e&&t.push(e)},setBrandLocations:function(e){n.c.splice(0,n.c.length);var r=[];return e.forEach(function(e){var t=new n.a(e.id,e.name,e.brandId,e.storeIdentifier,e.addressLine1,e.state,e.zipCode,e.city,e.phone,e.latitude,e.longitude);n.c.push(t),r.push(t)}),r},getDistanceFromLatLon:function(e,t,r,n,i){var o=0==(4<arguments.length&&void 0!==i?i:0)?3963:6378,s=this.degree2Radian(r-e),a=this.degree2Radian(n-t),u=Math.sin(s/2)*Math.sin(s/2)+Math.cos(this.degree2Radian(e))*Math.cos(this.degree2Radian(r))*Math.sin(a/2)*Math.sin(a/2);return o*(2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)))},degree2Radian:function(e){return e*(Math.PI/180)}}},"./src/app/common/locations.ts":function(e,t,r){"use strict";r.d(t,"a",function(){return n}),r.d(t,"b",function(){return i});var n=function e(t,r,n,i,o,s,a,u,l,c,h){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.locationId=t,this.locationName=r,this.brandId=n,this.storeIdentifier=i,this.addressLine1=o,this.state=s,this.zipCode=a,this.city=u,this.phone=l,this.latitude=c,this.longitude=h,this.distance=0};function i(){return[]}t.c=[]},"./src/app/common/validations.ts":function(e,t,r){"use strict";t.a={phone:function(e){return new RegExp("^((\\d{10})?|null)$").test(e)||"Only positive whole numbers allowed of 10 digits."},email:function(e){return/^(((([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,})))?|null)$/.test(e)||"Invalid e-mail."},birthDate:function(e){return/^(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)|(?:(?:0?[13-9]|1[0-2])(\/|-|\.)(?:29|30)))$|^(?:0?2(\/|-|\.)29)$|^(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])$|^null$|^$/.test(e)||"Invalid date."}}},"./src/app/index.ts":function(e,t,r){"use strict";r.r(t);var n=r("./src/app/b4Widget.ts");function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var o=new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){t&&i(e.prototype,t),r&&i(e,r)}(e,[{key:"init",value:function(e){return new n.a(e)}}]),e}());t.default=o},"./src/app/service.ts":function(e,t,r){"use strict";var n=r("./node_modules/@servicestack/client/dist/index.js");function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){t&&i(e.prototype,t),r&&i(e,r)}(e,[{key:"getClient",value:function(e){var t=null!=e?e:"https://toolkit.beyond4app.com";return this._jsonServiceClient||(this._jsonServiceClient=new n.JsonServiceClient(t))}}],[{key:"instance",get:function(){return this._instance||(this._instance=new this)}}]),e}();t.a=o.instance},0:function(e,t,r){e.exports=r("./src/app/index.ts")}},i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(r,n,function(e){return t[e]}.bind(null,n));return r},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="/",i(i.s=0)).default;function i(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,i),t.l=!0,t.exports}var r,n});