Socket
Socket
Sign inDemoInstall

@contactlab/sdk-browser

Package Overview
Dependencies
5
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

11

CHANGELOG.md

@@ -5,2 +5,13 @@ # Change Log

## [v1.1.0](https://github.com/contactlab/contacthub-sdk-browser/tree/v1.1.0) (2017-06-01)
[Full Changelog](https://github.com/contactlab/contacthub-sdk-browser/compare/v1.0.0...v1.1.0)
#### Fixes (bugs & defects):
- contextInfo cannot be set [#32](https://github.com/contactlab/contacthub-sdk-browser/issues/32)
#### New features:
- Allow using an existing customerId [#30](https://github.com/contactlab/contacthub-sdk-browser/issues/30)
## [v1.0.0](https://github.com/contactlab/contacthub-sdk-browser/tree/v1.0.0) (2017-03-17)

@@ -7,0 +18,0 @@ [Full Changelog](https://github.com/contactlab/contacthub-sdk-browser/compare/v0.4.1...v1.0.0)

2

dist/sdk.legacy.min.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ContactlabSDKBrowser=t():e.ContactlabSDKBrowser=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=RegExp("[?&]"+e+"=([^&]*)").exec(window.location.search);return t&&decodeURIComponent(t[1].replace(/\+/g," "))||undefined}var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(1),a=r(u),s=n(2),c=r(s),f=n(4),d=r(f),l=n(5),p=r(l),h=n(6);a["default"].configure({promise:function(e){return new h.Promise(e)}});var v=window.ContactHubObject||"ch",m=window.ContactHubCookie||"_ch",w=window.ContactHubAPI||"https://api.contactlab.it/hub/v1",y=function(){return c["default"].v4()},g=function(){var e=p["default"].getJSON(m);if(!e)throw new Error("Missing required ContactHub configuration.");if(!(e.workspaceId&&e.nodeId&&e.token))throw new Error("Missing required ContactHub configuration.");return e},b=["token","workspaceId","nodeId","context"],A=function(e){var t=p["default"].getJSON(m)||{},n=o("utm_source");n&&(t.ga={utm_source:n,utm_medium:o("utm_medium"),utm_term:o("utm_term"),utm_content:o("utm_content"),utm_campaign:o("utm_campaign")}),t.sid=t.sid||y();var r=Object.keys(e).filter(function(e){return-1!==b.indexOf(e)}).reduce(function(t,n){return t[n]=e[n],t},{});i(t,r),t.hasOwnProperty("context")||(t.context="WEB"),p["default"].set(m,t,{expires:365})},E=function(e,t){if("viewedPage"===e){var n={title:document.title,url:window.location.href,path:window.location.pathname,referer:document.referrer};return i(n,t)}return i({},t)},T=function(e){var t=g(),n=t.workspaceId,r=t.nodeId,o=t.token,i=t.context,u=t.sid,s=t.customerId,c=t.ga,f=e.type,d=e.properties;if(!f)throw new Error("Missing required event type");var l=E(f,d),p=c?{ga:c}:undefined,h=s?undefined:{type:"SESSION_ID",value:u,nodeId:r};(0,a["default"])({method:"POST",url:w+"/workspaces/"+n+"/events",data:{type:f,context:i,properties:l,tracking:p,customerId:s,bringBackProperties:h},headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+o}})},_=function(e){var t=e.workspaceId,n=e.nodeId,r=e.token,o=e.externalId,i=e.base,u=e.extended,s=e.extra,c=e.tags;return(0,a["default"])({method:"POST",url:w+"/workspaces/"+t+"/customers",headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+r},data:{nodeId:n,externalId:o,base:i,extended:u,extra:s,tags:c}}).then(function(e){return e.data.id})},x=function(e){var t=e.customerId,n=e.workspaceId,r=e.token,o=e.externalId,i=e.base,u=e.extended,s=e.extra,c=e.tags;return(0,a["default"])({method:"PATCH",url:w+"/workspaces/"+n+"/customers/"+t,headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+r},data:{externalId:o,base:i,extended:u,extra:s,tags:c}}).then(function(){return t})},S=function(e){var t=e.customerId,n=e.workspaceId,r=e.token;return(0,a["default"])({method:"POST",url:w+"/workspaces/"+n+"/customers/"+t+"/sessions",headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+r},data:{value:g().sid}}).then(function(){return t})},I=function(e){var t=new d["default"]("SHA-256","TEXT");return t.update(JSON.stringify(e)),t.getHash("HEX")},R=function(e){if(!e)return void p["default"].set(m,i(g(),{sid:y(),customerId:undefined,hash:undefined}));var t=g(),n=t.workspaceId,r=t.nodeId,o=t.token,u=t.customerId,a=t.hash,s=e.externalId,c=e.base,f=e.extended,d=e.extra,l=e.tags,v=I({base:c,extended:f,extra:d,tags:l,externalId:s}),w=function(e){if(409===e.status){var t=JSON.parse(e.response),i=t.data.customer.id;return x({customerId:i,workspaceId:n,nodeId:r,token:o,externalId:s,base:c,extended:f,extra:d,tags:l})}return h.Promise.reject(e)},b=function(e){return S({customerId:e,workspaceId:n,token:o,nodeId:r})},A=function(e){return p["default"].set(m,i(g(),{customerId:e,hash:v})),e};a!==v&&(u?function(e){return x({customerId:e,workspaceId:n,nodeId:r,token:o,externalId:s,base:c,extended:f,extra:d,tags:l})}(u).then(A):function(){return _({workspaceId:n,nodeId:r,token:o,externalId:s,base:c,extended:f,extra:d,tags:l})}()["catch"](w).then(A).then(b))},k=function(e,t){if("undefined"!=typeof JSON){var n={config:A,customer:R,event:T};e in n&&n[e].call(undefined,t)}};if(window[v]&&window[v].q){window[v].q.map(function(e){return k(e[0],e[1])})}window[v]=k},function(e,t,n){!function(t,n){e.exports=n()}(0,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="/",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e,t){return{status:e.status,response:e.response,data:t,xhr:e}}function o(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];for(var o in n)if({}.hasOwnProperty.call(n,o)){var i=n[o];if("object"===(void 0===i?"undefined":s(i)))for(var u in i)({}).hasOwnProperty.call(i,u)&&(e[u]=i[u])}return e}function i(e){m=o({},m,e)}function u(e,t){return(e&&e.promise?e.promise:m.promise||v.promise)(t)}function a(e){return u(e,function(t,n){var i=o({},v,m,e),u=i.xmlHttpRequest();u.withCredentials=i.withCredentials,i.abort&&e.abort(function(){n(r(u)),u.abort()}),u.open(i.method,i.params?i.url.split("?")[0]+"?"+(0,f["default"])(i.params):i.url,!0),u.addEventListener(l.LOAD,function(){if(u.status>=200&&u.status<300){var e=null;u.responseText&&(e=!0===i.raw?u.responseText:i.load(u.responseText)),t(r(u,e))}else n(r(u))}),u.addEventListener(l.ABORT,function(){return n(r(u))}),u.addEventListener(l.ERROR,function(){return n(r(u))}),u.addEventListener(l.TIMEOUT,function(){return n(r(u))});for(var a in i.headers)({}).hasOwnProperty.call(i.headers,a)&&u.setRequestHeader(a,i.headers[a]);for(var c in i.events)({}).hasOwnProperty.call(i.events,c)&&u.addEventListener(c,i.events[c].bind(null,u),!1);var d="object"!==s(i.data)||i.raw?i.data:i.dump(i.data);void 0!==d?u.send(d):u.send()})}t.__esModule=!0;var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},c=n(2),f=function(e){return e&&e.__esModule?e:{"default":e}}(c),d={GET:"GET",POST:"POST",PUT:"PUT",DELETE:"DELETE",PATCH:"PATCH",OPTIONS:"OPTIONS"},l={READY_STATE_CHANGE:"readystatechange",LOAD_START:"loadstart",PROGRESS:"progress",ABORT:"abort",ERROR:"error",LOAD:"load",TIMEOUT:"timeout",LOAD_END:"loadend"},p="undefined"==typeof JSON?function(){}:JSON.stringify,h="undefined"==typeof JSON?function(){}:JSON.parse,v={method:d.GET,data:void 0,headers:{Accept:"application/json","Content-Type":"application/json"},dump:p,load:h,xmlHttpRequest:function(){return new XMLHttpRequest},promise:function(e){return new Promise(e)},withCredentials:!1},m={};a.assign=o,a.encode=f["default"],a.configure=i,a.Methods=d,a.Events=l,a.defaults=v,a.get=function(e,t,n){return a(o({url:e,method:d.GET,params:t},n))},a.put=function(e,t,n){return a(o({url:e,method:d.PUT,data:t},n))},a.post=function(e,t,n){return a(o({url:e,method:d.POST,data:t},n))},a.patch=function(e,t,n){return a(o({url:e,method:d.PATCH,data:t},n))},a.del=function(e,t){return a(o({url:e,method:d.DELETE},t))},a.options=function(e,t){return a(o({url:e,method:d.OPTIONS},t))},t["default"]=a},function(e,t){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,r,o){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map(function(o){var i=encodeURIComponent(n(o))+r;return Array.isArray(e[o])?e[o].map(function(e){return i+encodeURIComponent(n(e))}).join(t):i+encodeURIComponent(n(e[o]))}).join(t):o?encodeURIComponent(n(o))+r+encodeURIComponent(n(e)):""}}])})},function(e,t,n){function r(e,t,n){var r=t&&n||0,o=0;for(t=t||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,function(e){o<16&&(t[r+o++]=c[e])});o<16;)t[r+o++]=0;return t}function o(e,t){var n=t||0,r=s;return r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]}function i(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var u=e.clockseq!==undefined?e.clockseq:p,a=e.msecs!==undefined?e.msecs:(new Date).getTime(),s=e.nsecs!==undefined?e.nsecs:v+1,c=a-h+(s-v)/1e4;if(c<0&&e.clockseq===undefined&&(u=u+1&16383),(c<0||a>h)&&e.nsecs===undefined&&(s=0),s>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");h=a,v=s,p=u,a+=122192928e5;var f=(1e4*(268435455&a)+s)%4294967296;i[r++]=f>>>24&255,i[r++]=f>>>16&255,i[r++]=f>>>8&255,i[r++]=255&f;var d=a/4294967296*1e4&268435455;i[r++]=d>>>8&255,i[r++]=255&d,i[r++]=d>>>24&15|16,i[r++]=d>>>16&255,i[r++]=u>>>8|128,i[r++]=255&u;for(var m=e.node||l,w=0;w<6;w++)i[r+w]=m[w];return t||o(i)}function u(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null),e=e||{};var i=e.random||(e.rng||a)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t)for(var u=0;u<16;u++)t[r+u]=i[u];return t||o(i)}for(var a=n(3),s=[],c={},f=0;f<256;f++)s[f]=(f+256).toString(16).substr(1),c[s[f]]=f;var d=a(),l=[1|d[0],d[1],d[2],d[3],d[4],d[5]],p=16383&(d[6]<<8|d[7]),h=0,v=0,m=u;m.v1=i,m.v4=u,m.parse=r,m.unparse=o,e.exports=m},function(e,t){(function(t){var n,r=t.crypto||t.msCrypto;if(r&&r.getRandomValues){var o=new Uint8Array(16);n=function(){return r.getRandomValues(o),o}}if(!n){var i=new Array(16);n=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}e.exports=n}).call(t,function(){return this}())},function(e,t,n){var r;!function(o){function i(e,t,n){var r,o,i,u,a,v,m,w,y,g=0,b=[],A=0,E=!1,T=[],_=[],I=!1;if(n=n||{},r=n.encoding||"UTF8",(y=n.numRounds||1)!==parseInt(y,10)||1>y)throw Error("numRounds must a integer >= 1");if(0!==e.lastIndexOf("SHA-",0))throw Error("Chosen SHA variant is not supported");if(v=function(t,n){return S(t,n,e)},m=function(t,n,r,o){var i,u;if("SHA-224"!==e&&"SHA-256"!==e)throw Error("Unexpected error in SHA-2 implementation");for(i=15+(n+65>>>9<<4),u=16;t.length<=i;)t.push(0);for(t[n>>>5]|=128<<24-n%32,n+=r,t[i]=4294967295&n,t[i-1]=n/4294967296|0,r=t.length,n=0;n<r;n+=u)o=S(t.slice(n,n+u),o,e);if("SHA-224"===e)t=[o[0],o[1],o[2],o[3],o[4],o[5],o[6]];else{if("SHA-256"!==e)throw Error("Unexpected error in SHA-2 implementation");t=o}return t},w=function(e){return e.slice()},"SHA-224"===e)a=512,u=224;else{if("SHA-256"!==e)throw Error("Chosen SHA variant is not supported");a=512,u=256}i=h(t,r),o=x(e),this.setHMACKey=function(t,n,i){var u;if(!0===E)throw Error("HMAC key already set");if(!0===I)throw Error("Cannot set HMAC key after calling update");for(r=(i||{}).encoding||"UTF8",n=h(n,r)(t),t=n.binLen,n=n.value,u=a>>>3,i=u/4-1,u<t/8&&(n=m(n,t,0,x(e)));n.length<=i;)n.push(0);for(t=0;t<=i;t+=1)T[t]=909522486^n[t],_[t]=1549556828^n[t];o=v(T,o),g=a,E=!0},this.update=function(e){var t,n,r,u=0,s=a>>>5;for(t=i(e,b,A),e=t.binLen,n=t.value,t=e>>>5,r=0;r<t;r+=s)u+a<=e&&(o=v(n.slice(r,r+s),o),u+=a);g+=u,b=n.slice(u>>>5),A=e%a,I=!0},this.getHash=function(t,n){var r,i,a,h;if(!0===E)throw Error("Cannot call getHash after setting HMAC key");switch(a=p(n),t){case"HEX":r=function(e){return s(e,u,a)};break;case"B64":r=function(e){return c(e,u,a)};break;case"BYTES":r=function(e){return f(e,u)};break;case"ARRAYBUFFER":try{i=new ArrayBuffer(0)}catch(v){throw Error("ARRAYBUFFER not supported by this environment")}r=function(e){return d(e,u)};break;case"UINT8ARRAY":try{i=new Uint8Array(0)}catch(v){throw Error("UINT8ARRAY not supported by this environment")}r=function(e){return l(e,u)};break;default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}for(h=m(b.slice(),A,g,w(o)),i=1;i<y;i+=1)h=m(h,u,0,x(e));return r(h)},this.getHMAC=function(t,n){var r,i,h,y;if(!1===E)throw Error("Cannot call getHMAC without first setting HMAC key");switch(h=p(n),t){case"HEX":r=function(e){return s(e,u,h)};break;case"B64":r=function(e){return c(e,u,h)};break;case"BYTES":r=function(e){return f(e,u)};break;case"ARRAYBUFFER":try{r=new ArrayBuffer(0)}catch(T){throw Error("ARRAYBUFFER not supported by this environment")}r=function(e){return d(e,u)};break;case"UINT8ARRAY":try{r=new Uint8Array(0)}catch(T){throw Error("UINT8ARRAY not supported by this environment")}r=function(e){return l(e,u)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}return i=m(b.slice(),A,g,w(o)),y=v(_,x(e)),y=m(i,u,a,y),r(y)}}function u(){}function a(e,t,n){var r,o,i,u;for(t=t||[0],n=n||0,o=n>>>3,r=0;r<e.length;r+=1)u=r+o,i=u>>>2,t.length<=i&&t.push(0),t[i]|=e[r]<<8*(3+u%4*-1);return{value:t,binLen:8*e.length+n}}function s(e,t,n){var r="";t/=8;var o,i;for(o=0;o<t;o+=1)i=e[o>>>2]>>>8*(3+o%4*-1),r+="0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i);return n.outputUpper?r.toUpperCase():r}function c(e,t,n){var r,o,i,u="",a=t/8;for(r=0;r<a;r+=3)for(o=r+1<a?e[r+1>>>2]:0,i=r+2<a?e[r+2>>>2]:0,i=(e[r>>>2]>>>8*(3+r%4*-1)&255)<<16|(o>>>8*(3+(r+1)%4*-1)&255)<<8|i>>>8*(3+(r+2)%4*-1)&255,o=0;4>o;o+=1)u+=8*r+6*o<=t?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(i>>>6*(3-o)&63):n.b64Pad;return u}function f(e,t){var n,r,o="",i=t/8;for(n=0;n<i;n+=1)r=e[n>>>2]>>>8*(3+n%4*-1)&255,o+=String.fromCharCode(r);return o}function d(e,t){var n,r,o=t/8,i=new ArrayBuffer(o);for(r=new Uint8Array(i),n=0;n<o;n+=1)r[n]=e[n>>>2]>>>8*(3+n%4*-1)&255;return i}function l(e,t){var n,r=t/8,o=new Uint8Array(r);for(n=0;n<r;n+=1)o[n]=e[n>>>2]>>>8*(3+n%4*-1)&255;return o}function p(e){var t={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(e=e||{},t.outputUpper=e.outputUpper||!1,!0===e.hasOwnProperty("b64Pad")&&(t.b64Pad=e.b64Pad),"boolean"!=typeof t.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof t.b64Pad)throw Error("Invalid b64Pad formatting option");return t}function h(e,t){var n;switch(t){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(e){case"HEX":n=function(e,t,n){var r,o,i,u,a,s=e.length;if(0!=s%2)throw Error("String of HEX type must be in byte increments");for(t=t||[0],n=n||0,a=n>>>3,r=0;r<s;r+=2){if(o=parseInt(e.substr(r,2),16),isNaN(o))throw Error("String of HEX type contains invalid characters");for(u=(r>>>1)+a,i=u>>>2;t.length<=i;)t.push(0);t[i]|=o<<8*(3+u%4*-1)}return{value:t,binLen:4*s+n}};break;case"TEXT":n=function(e,n,r){var o,i,u,a,s,c,f,d,l=0;if(n=n||[0],r=r||0,s=r>>>3,"UTF8"===t)for(d=3,u=0;u<e.length;u+=1)for(o=e.charCodeAt(u),i=[],128>o?i.push(o):2048>o?(i.push(192|o>>>6),i.push(128|63&o)):55296>o||57344<=o?i.push(224|o>>>12,128|o>>>6&63,128|63&o):(u+=1,o=65536+((1023&o)<<10|1023&e.charCodeAt(u)),i.push(240|o>>>18,128|o>>>12&63,128|o>>>6&63,128|63&o)),a=0;a<i.length;a+=1){for(f=l+s,c=f>>>2;n.length<=c;)n.push(0);n[c]|=i[a]<<8*(d+f%4*-1),l+=1}else if("UTF16BE"===t||"UTF16LE"===t)for(d=2,i="UTF16LE"===t&&!0||"UTF16LE"!==t&&!1,u=0;u<e.length;u+=1){for(o=e.charCodeAt(u),!0===i&&(a=255&o,o=a<<8|o>>>8),f=l+s,c=f>>>2;n.length<=c;)n.push(0);n[c]|=o<<8*(d+f%4*-1),l+=2}return{value:n,binLen:8*l+r}};break;case"B64":n=function(e,t,n){var r,o,i,u,a,s,c,f=0;if(-1===e.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(o=e.indexOf("="),e=e.replace(/\=/g,""),-1!==o&&o<e.length)throw Error("Invalid '=' found in base-64 string");for(t=t||[0],n=n||0,s=n>>>3,o=0;o<e.length;o+=4){for(a=e.substr(o,4),i=u=0;i<a.length;i+=1)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(i)),u|=r<<18-6*i;for(i=0;i<a.length-1;i+=1){for(c=f+s,r=c>>>2;t.length<=r;)t.push(0);t[r]|=(u>>>16-8*i&255)<<8*(3+c%4*-1),f+=1}}return{value:t,binLen:8*f+n}};break;case"BYTES":n=function(e,t,n){var r,o,i,u,a;for(t=t||[0],n=n||0,i=n>>>3,o=0;o<e.length;o+=1)r=e.charCodeAt(o),a=o+i,u=a>>>2,t.length<=u&&t.push(0),t[u]|=r<<8*(3+a%4*-1);return{value:t,binLen:8*e.length+n}};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(r){throw Error("ARRAYBUFFER not supported by this environment")}n=function(e,t,n){return a(new Uint8Array(e),t,n)};break;case"UINT8ARRAY":try{n=new Uint8Array(0)}catch(r){throw Error("UINT8ARRAY not supported by this environment")}n=function(e,t,n){return a(e,t,n)};break;default:throw Error("format must be HEX, TEXT, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}return n}function v(e,t){return e>>>t|e<<32-t}function m(e,t,n){return e&t^~e&n}function w(e,t,n){return e&t^e&n^t&n}function y(e){return v(e,2)^v(e,13)^v(e,22)}function g(e){return v(e,6)^v(e,11)^v(e,25)}function b(e){return v(e,7)^v(e,18)^e>>>3}function A(e){return v(e,17)^v(e,19)^e>>>10}function E(e,t){var n=(65535&e)+(65535&t);return((e>>>16)+(t>>>16)+(n>>>16)&65535)<<16|65535&n}function T(e,t,n,r){var o=(65535&e)+(65535&t)+(65535&n)+(65535&r);return((e>>>16)+(t>>>16)+(n>>>16)+(r>>>16)+(o>>>16)&65535)<<16|65535&o}function _(e,t,n,r,o){var i=(65535&e)+(65535&t)+(65535&n)+(65535&r)+(65535&o);return((e>>>16)+(t>>>16)+(n>>>16)+(r>>>16)+(o>>>16)+(i>>>16)&65535)<<16|65535&i}function x(e){var t,n=[];if(0!==e.lastIndexOf("SHA-",0))throw Error("No SHA variants supported");switch(n=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],t=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],e){case"SHA-224":break;case"SHA-256":n=t;break;case"SHA-384":case"SHA-512":n=[new u,new u,new u,new u,new u,new u,new u,new u];break;default:throw Error("Unknown SHA variant")}return n}function S(e,t,n){var r,o,i,u,a,s,c,f,d,l,p,h,v,x,S,R,k,C,U,O,H,P,B,F=[];if("SHA-224"!==n&&"SHA-256"!==n)throw Error("Unexpected error in SHA-2 implementation");for(l=64,h=1,P=Number,v=E,x=T,S=_,R=b,k=A,C=y,U=g,H=w,O=m,B=I,n=t[0],r=t[1],o=t[2],i=t[3],u=t[4],a=t[5],s=t[6],c=t[7],p=0;p<l;p+=1)16>p?(d=p*h,f=e.length<=d?0:e[d],d=e.length<=d+1?0:e[d+1],F[p]=new P(f,d)):F[p]=x(k(F[p-2]),F[p-7],R(F[p-15]),F[p-16]),f=S(c,U(u),O(u,a,s),B[p],F[p]),d=v(C(n),H(n,r,o)),c=s,s=a,a=u,u=v(i,f),i=o,o=r,r=n,n=v(f,d);return t[0]=v(n,t[0]),t[1]=v(r,t[1]),t[2]=v(o,t[2]),t[3]=v(i,t[3]),t[4]=v(u,t[4]),t[5]=v(a,t[5]),t[6]=v(s,t[6]),t[7]=v(c,t[7]),t}var I;I=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],(r=function(){return i}.call(t,n,t,e))!==undefined&&(e.exports=r)}()},function(e,t,n){var r,o;!function(i){var u;if(r=i,(o="function"==typeof r?r.call(t,n,t,e):r)!==undefined&&(e.exports=o),u=!0,e.exports=i(),u=!0,!u){var a=window.Cookies,s=window.Cookies=i();s.noConflict=function(){return window.Cookies=a,s}}}(function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}function n(r){function o(){}function i(t,n,i){if("undefined"!=typeof document){i=e({path:"/"},o.defaults,i),"number"==typeof i.expires&&(i.expires=new Date(1*new Date+864e5*i.expires)),i.expires=i.expires?i.expires.toUTCString():"";try{var u=JSON.stringify(n);/^[\{\[]/.test(u)&&(n=u)}catch(c){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var a="";for(var s in i)i[s]&&(a+="; "+s,!0!==i[s]&&(a+="="+i[s].split(";")[0]));return document.cookie=t+"="+n+a}}function u(e,n){if("undefined"!=typeof document){for(var o={},i=document.cookie?document.cookie.split("; "):[],u=0;u<i.length;u++){var a=i[u].split("="),s=a.slice(1).join("=");n||'"'!==s.charAt(0)||(s=s.slice(1,-1));try{var c=t(a[0]);if(s=(r.read||r)(s,c)||t(s),n)try{s=JSON.parse(s)}catch(f){}if(o[c]=s,e===c)break}catch(f){}}return e?o[e]:o}}return o.set=i,o.get=function(e){return u(e,!1)},o.getJSON=function(e){return u(e,!0)},o.remove=function(t,n){i(t,"",e(n,{expires:-1}))},o.defaults={},o.withConverter=n,o}return n(function(){})})},function(e,t,n){(function(t,r){!function(t,n){e.exports=n()}(0,function(){"use strict";function e(e){return"function"==typeof e||"object"==typeof e&&null!==e}function o(e){return"function"==typeof e}function i(e){J=e}function u(e){G=e}function a(){return function(){q(c)}}function s(){var e=setTimeout;return function(){return e(c,1)}}function c(){for(var e=0;e<X;e+=2){(0,Q[e])(Q[e+1]),Q[e]=undefined,Q[e+1]=undefined}X=0}function f(e,t){var n=arguments,r=this,o=new this.constructor(l);o[ee]===undefined&&U(o);var i=r._state;return i?function(){var e=n[i-1];G(function(){return R(i,o,e,r._result)})}():_(r,o,e,t),o}function d(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(l);return b(n,e),n}function l(){}function p(){return new TypeError("You cannot resolve a promise with itself")}function h(){return new TypeError("A promises callback cannot return that same promise.")}function v(e){try{return e.then}catch(t){return oe.error=t,oe}}function m(e,t,n,r){try{e.call(t,n,r)}catch(o){return o}}function w(e,t,n){G(function(e){var r=!1,o=m(n,t,function(n){r||(r=!0,t!==n?b(e,n):E(e,n))},function(t){r||(r=!0,T(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&o&&(r=!0,T(e,o))},e)}function y(e,t){t._state===ne?E(e,t._result):t._state===re?T(e,t._result):_(t,undefined,function(t){return b(e,t)},function(t){return T(e,t)})}function g(e,t,n){t.constructor===e.constructor&&n===f&&t.constructor.resolve===d?y(e,t):n===oe?T(e,oe.error):n===undefined?E(e,t):o(n)?w(e,t,n):E(e,t)}function b(t,n){t===n?T(t,p()):e(n)?g(t,n,v(n)):E(t,n)}function A(e){e._onerror&&e._onerror(e._result),x(e)}function E(e,t){e._state===te&&(e._result=t,e._state=ne,0!==e._subscribers.length&&G(x,e))}function T(e,t){e._state===te&&(e._state=re,e._result=t,G(A,e))}function _(e,t,n,r){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+ne]=n,o[i+re]=r,0===i&&e._state&&G(x,e)}function x(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r=undefined,o=undefined,i=e._result,u=0;u<t.length;u+=3)r=t[u],o=t[u+n],r?R(n,r,o,i):o(i);e._subscribers.length=0}}function S(){this.error=null}function I(e,t){try{return e(t)}catch(n){return ie.error=n,ie}}function R(e,t,n,r){var i=o(n),u=undefined,a=undefined,s=undefined,c=undefined;if(i){if(u=I(n,r),u===ie?(c=!0,a=u.error,u=null):s=!0,t===u)return void T(t,h())}else u=r,s=!0;t._state!==te||(i&&s?b(t,u):c?T(t,a):e===ne?E(t,u):e===re&&T(t,u))}function k(e,t){try{t(function(t){b(e,t)},function(t){T(e,t)})}catch(n){T(e,n)}}function C(){return ue++}function U(e){e[ee]=ue++,e._state=undefined,e._result=undefined,e._subscribers=[]}function O(e,t){this._instanceConstructor=e,this.promise=new e(l),this.promise[ee]||U(this.promise),D(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?E(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&E(this.promise,this._result))):T(this.promise,H())}function H(){return new Error("Array Methods must be provided an Array")}function P(e){return new O(this,e).promise}function B(e){var t=this;return new t(D(e)?function(n,r){for(var o=e.length,i=0;i<o;i++)t.resolve(e[i]).then(n,r)}:function(e,t){return t(new TypeError("You must pass an array to race."))})}function F(e){var t=this,n=new t(l);return T(n,e),n}function j(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function L(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function N(e){this[ee]=C(),this._result=this._state=undefined,this._subscribers=[],l!==e&&("function"!=typeof e&&j(),this instanceof N?k(this,e):L())}function Y(){var e=undefined;if(void 0!==r)e=r;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(o){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var n=null;try{n=Object.prototype.toString.call(t.resolve())}catch(o){}if("[object Promise]"===n&&!t.cast)return}e.Promise=N}var M=undefined;M=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var D=M,X=0,q=undefined,J=undefined,G=function(e,t){Q[X]=e,Q[X+1]=t,2===(X+=2)&&(J?J(c):$())},z="undefined"!=typeof window?window:undefined,K=z||{},V=K.MutationObserver||K.WebKitMutationObserver,W="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),Z="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,Q=new Array(1e3),$=undefined;$=W?function(){return function(){return t.nextTick(c)}}():V?function(){var e=0,t=new V(c),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}():Z?function(){var e=new MessageChannel;return e.port1.onmessage=c,function(){return e.port2.postMessage(0)}}():z===undefined?function(){try{var e=n(8);return q=e.runOnLoop||e.runOnContext,a()}catch(t){return s()}}():s();var ee=Math.random().toString(36).substring(16),te=void 0,ne=1,re=2,oe=new S,ie=new S,ue=0;return O.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===te&&n<e;n++)this._eachEntry(t[n],n)},O.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===d){var o=v(e);if(o===f&&e._state!==te)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(n===N){var i=new n(l);g(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},O.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===te&&(this._remaining--,e===re?T(r,n):this._result[t]=n),0===this._remaining&&E(r,this._result)},O.prototype._willSettleAt=function(e,t){var n=this;_(e,undefined,function(e){return n._settledAt(ne,t,e)},function(e){return n._settledAt(re,t,e)})},N.all=P,N.race=B,N.resolve=d,N.reject=F,N._setScheduler=i,N._setAsap=u,N._asap=G,N.prototype={constructor:N,then:f,"catch":function(e){return this.then(null,e)}},Y(),N.polyfill=Y,N.Promise=N,N})}).call(t,n(7),function(){return this}())},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(f===setTimeout)return setTimeout(e,0);if((f===n||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(d===clearTimeout)return clearTimeout(e);if((d===r||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function u(){v&&p&&(v=!1,p.length?h=p.concat(h):m=-1,h.length&&a())}function a(){if(!v){var e=o(u);v=!0;for(var t=h.length;t;){for(p=h,h=[];++m<t;)p&&p[m].run();m=-1,t=h.length}p=null,v=!1,i(e)}}function s(e,t){this.fun=e,this.array=t}function c(){}var f,d,l=e.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:n}catch(e){f=n}try{d="function"==typeof clearTimeout?clearTimeout:r}catch(e){d=r}}();var p,h=[],v=!1,m=-1;l.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];h.push(new s(e,t)),1!==h.length||v||o(a)},s.prototype.run=function(){this.fun.apply(null,this.array)},l.title="browser",l.browser=!0,l.env={},l.argv=[],l.version="",l.versions={},l.on=c,l.addListener=c,l.once=c,l.off=c,l.removeListener=c,l.removeAllListeners=c,l.emit=c,l.prependListener=c,l.prependOnceListener=c,l.listeners=function(e){return[]},l.binding=function(e){throw new Error("process.binding is not supported")},l.cwd=function(){return"/"},l.chdir=function(e){throw new Error("process.chdir is not supported")},l.umask=function(){return 0}},function(e,t){}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ContactlabSDKBrowser=t():e.ContactlabSDKBrowser=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=n(1),u=r(i),a=n(2),s=r(a),c=n(4),f=r(c),d=n(5),l=r(d),p=n(6);u["default"].configure({promise:function(e){return new p.Promise(e)}});var h=window.ContactHubObject||"ch",v=window.ContactHubCookie||"_ch",m=window.ContactHubAPI||"https://api.contactlab.it/hub/v1",w=function(e){var t=RegExp("[?&]"+e+"=([^&]*)").exec(window.location.search);return t&&decodeURIComponent(t[1].replace(/\+/g," "))||undefined},y=function(){return s["default"].v4()},g=function(){var e=l["default"].getJSON(v);if(!e)throw new Error("Missing required ContactHub configuration.");if(!(e.workspaceId&&e.nodeId&&e.token))throw new Error("Missing required ContactHub configuration.");return e},b=function(e,t){if("viewedPage"===e){var n={title:document.title,url:window.location.href,path:window.location.pathname,referer:document.referrer};return o(n,t)}return o({},t)},A=function(e){var t=g(),n=t.workspaceId,r=t.nodeId,o=t.token,i=t.context,a=t.contextInfo,s=t.sid,c=t.customerId,f=t.ga,d=e.type,l=e.properties;if(!d)throw new Error("Missing required event type");var p=b(d,l),h=f?{ga:f}:undefined,v=c?undefined:{type:"SESSION_ID",value:s,nodeId:r};(0,u["default"])({method:"POST",url:m+"/workspaces/"+n+"/events",data:{type:d,context:i,contextInfo:a,properties:p,tracking:h,customerId:c,bringBackProperties:v},headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+o}})},E=function(e){var t=e.workspaceId,n=e.nodeId,r=e.token,o=e.externalId,i=e.base,a=e.extended,s=e.extra,c=e.tags;return(0,u["default"])({method:"POST",url:m+"/workspaces/"+t+"/customers",headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+r},data:{nodeId:n,externalId:o,base:i,extended:a,extra:s,tags:c}}).then(function(e){return e.data.id})},T=function(e){var t=e.customerId,n=e.workspaceId,r=e.token,o=e.externalId,i=e.base,a=e.extended,s=e.extra,c=e.tags;return(0,u["default"])({method:"PATCH",url:m+"/workspaces/"+n+"/customers/"+t,headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+r},data:{externalId:o,base:i,extended:a,extra:s,tags:c}}).then(function(){return t})},x=function(e){var t=e.customerId,n=e.workspaceId,r=e.token;return(0,u["default"])({method:"POST",url:m+"/workspaces/"+n+"/customers/"+t+"/sessions",headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+r},data:{value:g().sid}}).then(function(){return t})},_=function(e){var t=new f["default"]("SHA-256","TEXT");return t.update(JSON.stringify(e)),t.getHash("HEX")},I=function(){l["default"].set(v,o(g(),{sid:y(),customerId:undefined,hash:undefined}))},S=function(e){if(!e)return void I();var t=g(),n=t.workspaceId,r=t.nodeId,i=t.token,u=t.customerId,a=t.hash,s=e.id,c=e.externalId,f=e.base,d=e.extended,h=e.extra,m=e.tags,w=_({base:f,extended:d,extra:h,tags:m,externalId:c}),y=function(e){return c||f||d||h||m?T({customerId:e,workspaceId:n,nodeId:r,token:i,externalId:c,base:f,extended:d,extra:h,tags:m}):p.Promise.resolve(e)},b=function(e){if(409===e.status){var t=JSON.parse(e.response),o=t.data.customer.id;return T({customerId:o,workspaceId:n,nodeId:r,token:i,externalId:c,base:f,extended:d,extra:h,tags:m})}return p.Promise.reject(e)},A=function(e){return x({customerId:e,workspaceId:n,token:i,nodeId:r})},S=function(e){return l["default"].set(v,o(g(),{customerId:e,hash:w})),e};a!==w&&(s&&u?function(e,t){return e===t?p.Promise.resolve(e):c||f||d||h||m?(I(),A(e)):p.Promise.reject("The provided id conflicts with the id stored in the cookie")}(s,u).then(y).then(S):s?A(s).then(y).then(S):u?y(u).then(S):function(){return E({workspaceId:n,nodeId:r,token:i,externalId:c,base:f,extended:d,extra:h,tags:m})}()["catch"](b).then(S).then(A))},R=["token","workspaceId","nodeId","context","contextInfo"],k=function(e){var t=l["default"].getJSON(v)||{},n=w("utm_source");n&&(t.ga={utm_source:n,utm_medium:w("utm_medium"),utm_term:w("utm_term"),utm_content:w("utm_content"),utm_campaign:w("utm_campaign")}),t.sid=t.sid||y();var r=Object.keys(e).filter(function(e){return-1!==R.indexOf(e)}).reduce(function(t,n){return t[n]=e[n],t},{});o(t,r),t.context=t.context||"WEB",t.contextInfo=t.contextInfo||{},l["default"].set(v,t,{expires:365});var i=w("clabId");i&&S({id:i})},C=function(e,t){if("undefined"!=typeof JSON){var n={config:k,customer:S,event:A};e in n&&n[e].call(undefined,t)}};if(window[h]&&window[h].q){window[h].q.map(function(e){return C(e[0],e[1])})}window[h]=C},function(e,t,n){!function(t,n){e.exports=n()}(0,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="/",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e,t){return{status:e.status,response:e.response,data:t,xhr:e}}function o(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];for(var o in n)if({}.hasOwnProperty.call(n,o)){var i=n[o];if("object"===(void 0===i?"undefined":s(i)))for(var u in i)({}).hasOwnProperty.call(i,u)&&(e[u]=i[u])}return e}function i(e){m=o({},m,e)}function u(e,t){return(e&&e.promise?e.promise:m.promise||v.promise)(t)}function a(e){return u(e,function(t,n){var i=o({},v,m,e),u=i.xmlHttpRequest();u.withCredentials=i.withCredentials,i.abort&&e.abort(function(){n(r(u)),u.abort()}),u.open(i.method,i.params?i.url.split("?")[0]+"?"+(0,f["default"])(i.params):i.url,!0),u.addEventListener(l.LOAD,function(){if(u.status>=200&&u.status<300){var e=null;u.responseText&&(e=!0===i.raw?u.responseText:i.load(u.responseText)),t(r(u,e))}else n(r(u))}),u.addEventListener(l.ABORT,function(){return n(r(u))}),u.addEventListener(l.ERROR,function(){return n(r(u))}),u.addEventListener(l.TIMEOUT,function(){return n(r(u))});for(var a in i.headers)({}).hasOwnProperty.call(i.headers,a)&&u.setRequestHeader(a,i.headers[a]);for(var c in i.events)({}).hasOwnProperty.call(i.events,c)&&u.addEventListener(c,i.events[c].bind(null,u),!1);var d="object"!==s(i.data)||i.raw?i.data:i.dump(i.data);void 0!==d?u.send(d):u.send()})}t.__esModule=!0;var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},c=n(2),f=function(e){return e&&e.__esModule?e:{"default":e}}(c),d={GET:"GET",POST:"POST",PUT:"PUT",DELETE:"DELETE",PATCH:"PATCH",OPTIONS:"OPTIONS"},l={READY_STATE_CHANGE:"readystatechange",LOAD_START:"loadstart",PROGRESS:"progress",ABORT:"abort",ERROR:"error",LOAD:"load",TIMEOUT:"timeout",LOAD_END:"loadend"},p="undefined"==typeof JSON?function(){}:JSON.stringify,h="undefined"==typeof JSON?function(){}:JSON.parse,v={method:d.GET,data:void 0,headers:{Accept:"application/json","Content-Type":"application/json"},dump:p,load:h,xmlHttpRequest:function(){return new XMLHttpRequest},promise:function(e){return new Promise(e)},withCredentials:!1},m={};a.assign=o,a.encode=f["default"],a.configure=i,a.Methods=d,a.Events=l,a.defaults=v,a.get=function(e,t,n){return a(o({url:e,method:d.GET,params:t},n))},a.put=function(e,t,n){return a(o({url:e,method:d.PUT,data:t},n))},a.post=function(e,t,n){return a(o({url:e,method:d.POST,data:t},n))},a.patch=function(e,t,n){return a(o({url:e,method:d.PATCH,data:t},n))},a.del=function(e,t){return a(o({url:e,method:d.DELETE},t))},a.options=function(e,t){return a(o({url:e,method:d.OPTIONS},t))},t["default"]=a},function(e,t){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,r,o){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map(function(o){var i=encodeURIComponent(n(o))+r;return Array.isArray(e[o])?e[o].map(function(e){return i+encodeURIComponent(n(e))}).join(t):i+encodeURIComponent(n(e[o]))}).join(t):o?encodeURIComponent(n(o))+r+encodeURIComponent(n(e)):""}}])})},function(e,t,n){function r(e,t,n){var r=t&&n||0,o=0;for(t=t||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,function(e){o<16&&(t[r+o++]=c[e])});o<16;)t[r+o++]=0;return t}function o(e,t){var n=t||0,r=s;return r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]}function i(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var u=e.clockseq!==undefined?e.clockseq:p,a=e.msecs!==undefined?e.msecs:(new Date).getTime(),s=e.nsecs!==undefined?e.nsecs:v+1,c=a-h+(s-v)/1e4;if(c<0&&e.clockseq===undefined&&(u=u+1&16383),(c<0||a>h)&&e.nsecs===undefined&&(s=0),s>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");h=a,v=s,p=u,a+=122192928e5;var f=(1e4*(268435455&a)+s)%4294967296;i[r++]=f>>>24&255,i[r++]=f>>>16&255,i[r++]=f>>>8&255,i[r++]=255&f;var d=a/4294967296*1e4&268435455;i[r++]=d>>>8&255,i[r++]=255&d,i[r++]=d>>>24&15|16,i[r++]=d>>>16&255,i[r++]=u>>>8|128,i[r++]=255&u;for(var m=e.node||l,w=0;w<6;w++)i[r+w]=m[w];return t||o(i)}function u(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null),e=e||{};var i=e.random||(e.rng||a)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t)for(var u=0;u<16;u++)t[r+u]=i[u];return t||o(i)}for(var a=n(3),s=[],c={},f=0;f<256;f++)s[f]=(f+256).toString(16).substr(1),c[s[f]]=f;var d=a(),l=[1|d[0],d[1],d[2],d[3],d[4],d[5]],p=16383&(d[6]<<8|d[7]),h=0,v=0,m=u;m.v1=i,m.v4=u,m.parse=r,m.unparse=o,e.exports=m},function(e,t){(function(t){var n,r=t.crypto||t.msCrypto;if(r&&r.getRandomValues){var o=new Uint8Array(16);n=function(){return r.getRandomValues(o),o}}if(!n){var i=new Array(16);n=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}e.exports=n}).call(t,function(){return this}())},function(e,t,n){var r;!function(o){function i(e,t,n){var r,o,i,u,a,v,m,w,y,g=0,b=[],A=0,E=!1,T=[],x=[],S=!1;if(n=n||{},r=n.encoding||"UTF8",(y=n.numRounds||1)!==parseInt(y,10)||1>y)throw Error("numRounds must a integer >= 1");if(0!==e.lastIndexOf("SHA-",0))throw Error("Chosen SHA variant is not supported");if(v=function(t,n){return I(t,n,e)},m=function(t,n,r,o){var i,u;if("SHA-224"!==e&&"SHA-256"!==e)throw Error("Unexpected error in SHA-2 implementation");for(i=15+(n+65>>>9<<4),u=16;t.length<=i;)t.push(0);for(t[n>>>5]|=128<<24-n%32,n+=r,t[i]=4294967295&n,t[i-1]=n/4294967296|0,r=t.length,n=0;n<r;n+=u)o=I(t.slice(n,n+u),o,e);if("SHA-224"===e)t=[o[0],o[1],o[2],o[3],o[4],o[5],o[6]];else{if("SHA-256"!==e)throw Error("Unexpected error in SHA-2 implementation");t=o}return t},w=function(e){return e.slice()},"SHA-224"===e)a=512,u=224;else{if("SHA-256"!==e)throw Error("Chosen SHA variant is not supported");a=512,u=256}i=h(t,r),o=_(e),this.setHMACKey=function(t,n,i){var u;if(!0===E)throw Error("HMAC key already set");if(!0===S)throw Error("Cannot set HMAC key after calling update");for(r=(i||{}).encoding||"UTF8",n=h(n,r)(t),t=n.binLen,n=n.value,u=a>>>3,i=u/4-1,u<t/8&&(n=m(n,t,0,_(e)));n.length<=i;)n.push(0);for(t=0;t<=i;t+=1)T[t]=909522486^n[t],x[t]=1549556828^n[t];o=v(T,o),g=a,E=!0},this.update=function(e){var t,n,r,u=0,s=a>>>5;for(t=i(e,b,A),e=t.binLen,n=t.value,t=e>>>5,r=0;r<t;r+=s)u+a<=e&&(o=v(n.slice(r,r+s),o),u+=a);g+=u,b=n.slice(u>>>5),A=e%a,S=!0},this.getHash=function(t,n){var r,i,a,h;if(!0===E)throw Error("Cannot call getHash after setting HMAC key");switch(a=p(n),t){case"HEX":r=function(e){return s(e,u,a)};break;case"B64":r=function(e){return c(e,u,a)};break;case"BYTES":r=function(e){return f(e,u)};break;case"ARRAYBUFFER":try{i=new ArrayBuffer(0)}catch(v){throw Error("ARRAYBUFFER not supported by this environment")}r=function(e){return d(e,u)};break;case"UINT8ARRAY":try{i=new Uint8Array(0)}catch(v){throw Error("UINT8ARRAY not supported by this environment")}r=function(e){return l(e,u)};break;default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}for(h=m(b.slice(),A,g,w(o)),i=1;i<y;i+=1)h=m(h,u,0,_(e));return r(h)},this.getHMAC=function(t,n){var r,i,h,y;if(!1===E)throw Error("Cannot call getHMAC without first setting HMAC key");switch(h=p(n),t){case"HEX":r=function(e){return s(e,u,h)};break;case"B64":r=function(e){return c(e,u,h)};break;case"BYTES":r=function(e){return f(e,u)};break;case"ARRAYBUFFER":try{r=new ArrayBuffer(0)}catch(T){throw Error("ARRAYBUFFER not supported by this environment")}r=function(e){return d(e,u)};break;case"UINT8ARRAY":try{r=new Uint8Array(0)}catch(T){throw Error("UINT8ARRAY not supported by this environment")}r=function(e){return l(e,u)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}return i=m(b.slice(),A,g,w(o)),y=v(x,_(e)),y=m(i,u,a,y),r(y)}}function u(){}function a(e,t,n){var r,o,i,u;for(t=t||[0],n=n||0,o=n>>>3,r=0;r<e.length;r+=1)u=r+o,i=u>>>2,t.length<=i&&t.push(0),t[i]|=e[r]<<8*(3+u%4*-1);return{value:t,binLen:8*e.length+n}}function s(e,t,n){var r="";t/=8;var o,i;for(o=0;o<t;o+=1)i=e[o>>>2]>>>8*(3+o%4*-1),r+="0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i);return n.outputUpper?r.toUpperCase():r}function c(e,t,n){var r,o,i,u="",a=t/8;for(r=0;r<a;r+=3)for(o=r+1<a?e[r+1>>>2]:0,i=r+2<a?e[r+2>>>2]:0,i=(e[r>>>2]>>>8*(3+r%4*-1)&255)<<16|(o>>>8*(3+(r+1)%4*-1)&255)<<8|i>>>8*(3+(r+2)%4*-1)&255,o=0;4>o;o+=1)u+=8*r+6*o<=t?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(i>>>6*(3-o)&63):n.b64Pad;return u}function f(e,t){var n,r,o="",i=t/8;for(n=0;n<i;n+=1)r=e[n>>>2]>>>8*(3+n%4*-1)&255,o+=String.fromCharCode(r);return o}function d(e,t){var n,r,o=t/8,i=new ArrayBuffer(o);for(r=new Uint8Array(i),n=0;n<o;n+=1)r[n]=e[n>>>2]>>>8*(3+n%4*-1)&255;return i}function l(e,t){var n,r=t/8,o=new Uint8Array(r);for(n=0;n<r;n+=1)o[n]=e[n>>>2]>>>8*(3+n%4*-1)&255;return o}function p(e){var t={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(e=e||{},t.outputUpper=e.outputUpper||!1,!0===e.hasOwnProperty("b64Pad")&&(t.b64Pad=e.b64Pad),"boolean"!=typeof t.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof t.b64Pad)throw Error("Invalid b64Pad formatting option");return t}function h(e,t){var n;switch(t){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(e){case"HEX":n=function(e,t,n){var r,o,i,u,a,s=e.length;if(0!=s%2)throw Error("String of HEX type must be in byte increments");for(t=t||[0],n=n||0,a=n>>>3,r=0;r<s;r+=2){if(o=parseInt(e.substr(r,2),16),isNaN(o))throw Error("String of HEX type contains invalid characters");for(u=(r>>>1)+a,i=u>>>2;t.length<=i;)t.push(0);t[i]|=o<<8*(3+u%4*-1)}return{value:t,binLen:4*s+n}};break;case"TEXT":n=function(e,n,r){var o,i,u,a,s,c,f,d,l=0;if(n=n||[0],r=r||0,s=r>>>3,"UTF8"===t)for(d=3,u=0;u<e.length;u+=1)for(o=e.charCodeAt(u),i=[],128>o?i.push(o):2048>o?(i.push(192|o>>>6),i.push(128|63&o)):55296>o||57344<=o?i.push(224|o>>>12,128|o>>>6&63,128|63&o):(u+=1,o=65536+((1023&o)<<10|1023&e.charCodeAt(u)),i.push(240|o>>>18,128|o>>>12&63,128|o>>>6&63,128|63&o)),a=0;a<i.length;a+=1){for(f=l+s,c=f>>>2;n.length<=c;)n.push(0);n[c]|=i[a]<<8*(d+f%4*-1),l+=1}else if("UTF16BE"===t||"UTF16LE"===t)for(d=2,i="UTF16LE"===t&&!0||"UTF16LE"!==t&&!1,u=0;u<e.length;u+=1){for(o=e.charCodeAt(u),!0===i&&(a=255&o,o=a<<8|o>>>8),f=l+s,c=f>>>2;n.length<=c;)n.push(0);n[c]|=o<<8*(d+f%4*-1),l+=2}return{value:n,binLen:8*l+r}};break;case"B64":n=function(e,t,n){var r,o,i,u,a,s,c,f=0;if(-1===e.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(o=e.indexOf("="),e=e.replace(/\=/g,""),-1!==o&&o<e.length)throw Error("Invalid '=' found in base-64 string");for(t=t||[0],n=n||0,s=n>>>3,o=0;o<e.length;o+=4){for(a=e.substr(o,4),i=u=0;i<a.length;i+=1)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(i)),u|=r<<18-6*i;for(i=0;i<a.length-1;i+=1){for(c=f+s,r=c>>>2;t.length<=r;)t.push(0);t[r]|=(u>>>16-8*i&255)<<8*(3+c%4*-1),f+=1}}return{value:t,binLen:8*f+n}};break;case"BYTES":n=function(e,t,n){var r,o,i,u,a;for(t=t||[0],n=n||0,i=n>>>3,o=0;o<e.length;o+=1)r=e.charCodeAt(o),a=o+i,u=a>>>2,t.length<=u&&t.push(0),t[u]|=r<<8*(3+a%4*-1);return{value:t,binLen:8*e.length+n}};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(r){throw Error("ARRAYBUFFER not supported by this environment")}n=function(e,t,n){return a(new Uint8Array(e),t,n)};break;case"UINT8ARRAY":try{n=new Uint8Array(0)}catch(r){throw Error("UINT8ARRAY not supported by this environment")}n=function(e,t,n){return a(e,t,n)};break;default:throw Error("format must be HEX, TEXT, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}return n}function v(e,t){return e>>>t|e<<32-t}function m(e,t,n){return e&t^~e&n}function w(e,t,n){return e&t^e&n^t&n}function y(e){return v(e,2)^v(e,13)^v(e,22)}function g(e){return v(e,6)^v(e,11)^v(e,25)}function b(e){return v(e,7)^v(e,18)^e>>>3}function A(e){return v(e,17)^v(e,19)^e>>>10}function E(e,t){var n=(65535&e)+(65535&t);return((e>>>16)+(t>>>16)+(n>>>16)&65535)<<16|65535&n}function T(e,t,n,r){var o=(65535&e)+(65535&t)+(65535&n)+(65535&r);return((e>>>16)+(t>>>16)+(n>>>16)+(r>>>16)+(o>>>16)&65535)<<16|65535&o}function x(e,t,n,r,o){var i=(65535&e)+(65535&t)+(65535&n)+(65535&r)+(65535&o);return((e>>>16)+(t>>>16)+(n>>>16)+(r>>>16)+(o>>>16)+(i>>>16)&65535)<<16|65535&i}function _(e){var t,n=[];if(0!==e.lastIndexOf("SHA-",0))throw Error("No SHA variants supported");switch(n=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],t=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],e){case"SHA-224":break;case"SHA-256":n=t;break;case"SHA-384":case"SHA-512":n=[new u,new u,new u,new u,new u,new u,new u,new u];break;default:throw Error("Unknown SHA variant")}return n}function I(e,t,n){var r,o,i,u,a,s,c,f,d,l,p,h,v,_,I,R,k,C,U,O,H,P,B,F=[];if("SHA-224"!==n&&"SHA-256"!==n)throw Error("Unexpected error in SHA-2 implementation");for(l=64,h=1,P=Number,v=E,_=T,I=x,R=b,k=A,C=y,U=g,H=w,O=m,B=S,n=t[0],r=t[1],o=t[2],i=t[3],u=t[4],a=t[5],s=t[6],c=t[7],p=0;p<l;p+=1)16>p?(d=p*h,f=e.length<=d?0:e[d],d=e.length<=d+1?0:e[d+1],F[p]=new P(f,d)):F[p]=_(k(F[p-2]),F[p-7],R(F[p-15]),F[p-16]),f=I(c,U(u),O(u,a,s),B[p],F[p]),d=v(C(n),H(n,r,o)),c=s,s=a,a=u,u=v(i,f),i=o,o=r,r=n,n=v(f,d);return t[0]=v(n,t[0]),t[1]=v(r,t[1]),t[2]=v(o,t[2]),t[3]=v(i,t[3]),t[4]=v(u,t[4]),t[5]=v(a,t[5]),t[6]=v(s,t[6]),t[7]=v(c,t[7]),t}var S;S=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],(r=function(){return i}.call(t,n,t,e))!==undefined&&(e.exports=r)}()},function(e,t,n){var r,o;!function(i){var u;if(r=i,(o="function"==typeof r?r.call(t,n,t,e):r)!==undefined&&(e.exports=o),u=!0,e.exports=i(),u=!0,!u){var a=window.Cookies,s=window.Cookies=i();s.noConflict=function(){return window.Cookies=a,s}}}(function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}function n(r){function o(){}function i(t,n,i){if("undefined"!=typeof document){i=e({path:"/"},o.defaults,i),"number"==typeof i.expires&&(i.expires=new Date(1*new Date+864e5*i.expires)),i.expires=i.expires?i.expires.toUTCString():"";try{var u=JSON.stringify(n);/^[\{\[]/.test(u)&&(n=u)}catch(c){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var a="";for(var s in i)i[s]&&(a+="; "+s,!0!==i[s]&&(a+="="+i[s].split(";")[0]));return document.cookie=t+"="+n+a}}function u(e,n){if("undefined"!=typeof document){for(var o={},i=document.cookie?document.cookie.split("; "):[],u=0;u<i.length;u++){var a=i[u].split("="),s=a.slice(1).join("=");n||'"'!==s.charAt(0)||(s=s.slice(1,-1));try{var c=t(a[0]);if(s=(r.read||r)(s,c)||t(s),n)try{s=JSON.parse(s)}catch(f){}if(o[c]=s,e===c)break}catch(f){}}return e?o[e]:o}}return o.set=i,o.get=function(e){return u(e,!1)},o.getJSON=function(e){return u(e,!0)},o.remove=function(t,n){i(t,"",e(n,{expires:-1}))},o.defaults={},o.withConverter=n,o}return n(function(){})})},function(e,t,n){(function(t,r){!function(t,n){e.exports=n()}(0,function(){"use strict";function e(e){return"function"==typeof e||"object"==typeof e&&null!==e}function o(e){return"function"==typeof e}function i(e){J=e}function u(e){G=e}function a(){return function(){q(c)}}function s(){var e=setTimeout;return function(){return e(c,1)}}function c(){for(var e=0;e<X;e+=2){(0,Q[e])(Q[e+1]),Q[e]=undefined,Q[e+1]=undefined}X=0}function f(e,t){var n=arguments,r=this,o=new this.constructor(l);o[ee]===undefined&&U(o);var i=r._state;return i?function(){var e=n[i-1];G(function(){return R(i,o,e,r._result)})}():x(r,o,e,t),o}function d(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(l);return b(n,e),n}function l(){}function p(){return new TypeError("You cannot resolve a promise with itself")}function h(){return new TypeError("A promises callback cannot return that same promise.")}function v(e){try{return e.then}catch(t){return oe.error=t,oe}}function m(e,t,n,r){try{e.call(t,n,r)}catch(o){return o}}function w(e,t,n){G(function(e){var r=!1,o=m(n,t,function(n){r||(r=!0,t!==n?b(e,n):E(e,n))},function(t){r||(r=!0,T(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&o&&(r=!0,T(e,o))},e)}function y(e,t){t._state===ne?E(e,t._result):t._state===re?T(e,t._result):x(t,undefined,function(t){return b(e,t)},function(t){return T(e,t)})}function g(e,t,n){t.constructor===e.constructor&&n===f&&t.constructor.resolve===d?y(e,t):n===oe?T(e,oe.error):n===undefined?E(e,t):o(n)?w(e,t,n):E(e,t)}function b(t,n){t===n?T(t,p()):e(n)?g(t,n,v(n)):E(t,n)}function A(e){e._onerror&&e._onerror(e._result),_(e)}function E(e,t){e._state===te&&(e._result=t,e._state=ne,0!==e._subscribers.length&&G(_,e))}function T(e,t){e._state===te&&(e._state=re,e._result=t,G(A,e))}function x(e,t,n,r){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+ne]=n,o[i+re]=r,0===i&&e._state&&G(_,e)}function _(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r=undefined,o=undefined,i=e._result,u=0;u<t.length;u+=3)r=t[u],o=t[u+n],r?R(n,r,o,i):o(i);e._subscribers.length=0}}function I(){this.error=null}function S(e,t){try{return e(t)}catch(n){return ie.error=n,ie}}function R(e,t,n,r){var i=o(n),u=undefined,a=undefined,s=undefined,c=undefined;if(i){if(u=S(n,r),u===ie?(c=!0,a=u.error,u=null):s=!0,t===u)return void T(t,h())}else u=r,s=!0;t._state!==te||(i&&s?b(t,u):c?T(t,a):e===ne?E(t,u):e===re&&T(t,u))}function k(e,t){try{t(function(t){b(e,t)},function(t){T(e,t)})}catch(n){T(e,n)}}function C(){return ue++}function U(e){e[ee]=ue++,e._state=undefined,e._result=undefined,e._subscribers=[]}function O(e,t){this._instanceConstructor=e,this.promise=new e(l),this.promise[ee]||U(this.promise),D(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?E(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&E(this.promise,this._result))):T(this.promise,H())}function H(){return new Error("Array Methods must be provided an Array")}function P(e){return new O(this,e).promise}function B(e){var t=this;return new t(D(e)?function(n,r){for(var o=e.length,i=0;i<o;i++)t.resolve(e[i]).then(n,r)}:function(e,t){return t(new TypeError("You must pass an array to race."))})}function F(e){var t=this,n=new t(l);return T(n,e),n}function j(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function L(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function N(e){this[ee]=C(),this._result=this._state=undefined,this._subscribers=[],l!==e&&("function"!=typeof e&&j(),this instanceof N?k(this,e):L())}function Y(){var e=undefined;if(void 0!==r)e=r;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(o){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var n=null;try{n=Object.prototype.toString.call(t.resolve())}catch(o){}if("[object Promise]"===n&&!t.cast)return}e.Promise=N}var M=undefined;M=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var D=M,X=0,q=undefined,J=undefined,G=function(e,t){Q[X]=e,Q[X+1]=t,2===(X+=2)&&(J?J(c):$())},z="undefined"!=typeof window?window:undefined,K=z||{},V=K.MutationObserver||K.WebKitMutationObserver,W="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),Z="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,Q=new Array(1e3),$=undefined;$=W?function(){return function(){return t.nextTick(c)}}():V?function(){var e=0,t=new V(c),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}():Z?function(){var e=new MessageChannel;return e.port1.onmessage=c,function(){return e.port2.postMessage(0)}}():z===undefined?function(){try{var e=n(8);return q=e.runOnLoop||e.runOnContext,a()}catch(t){return s()}}():s();var ee=Math.random().toString(36).substring(16),te=void 0,ne=1,re=2,oe=new I,ie=new I,ue=0;return O.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===te&&n<e;n++)this._eachEntry(t[n],n)},O.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===d){var o=v(e);if(o===f&&e._state!==te)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(n===N){var i=new n(l);g(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},O.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===te&&(this._remaining--,e===re?T(r,n):this._result[t]=n),0===this._remaining&&E(r,this._result)},O.prototype._willSettleAt=function(e,t){var n=this;x(e,undefined,function(e){return n._settledAt(ne,t,e)},function(e){return n._settledAt(re,t,e)})},N.all=P,N.race=B,N.resolve=d,N.reject=F,N._setScheduler=i,N._setAsap=u,N._asap=G,N.prototype={constructor:N,then:f,"catch":function(e){return this.then(null,e)}},Y(),N.polyfill=Y,N.Promise=N,N})}).call(t,n(7),function(){return this}())},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(f===setTimeout)return setTimeout(e,0);if((f===n||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(d===clearTimeout)return clearTimeout(e);if((d===r||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function u(){v&&p&&(v=!1,p.length?h=p.concat(h):m=-1,h.length&&a())}function a(){if(!v){var e=o(u);v=!0;for(var t=h.length;t;){for(p=h,h=[];++m<t;)p&&p[m].run();m=-1,t=h.length}p=null,v=!1,i(e)}}function s(e,t){this.fun=e,this.array=t}function c(){}var f,d,l=e.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:n}catch(e){f=n}try{d="function"==typeof clearTimeout?clearTimeout:r}catch(e){d=r}}();var p,h=[],v=!1,m=-1;l.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];h.push(new s(e,t)),1!==h.length||v||o(a)},s.prototype.run=function(){this.fun.apply(null,this.array)},l.title="browser",l.browser=!0,l.env={},l.argv=[],l.version="",l.versions={},l.on=c,l.addListener=c,l.once=c,l.off=c,l.removeListener=c,l.removeAllListeners=c,l.emit=c,l.prependListener=c,l.prependOnceListener=c,l.listeners=function(e){return[]},l.binding=function(e){throw new Error("process.binding is not supported")},l.cwd=function(){return"/"},l.chdir=function(e){throw new Error("process.chdir is not supported")},l.umask=function(){return 0}},function(e,t){}])});

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ContactlabSDKBrowser=t():e.ContactlabSDKBrowser=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=RegExp("[?&]"+e+"=([^&]*)").exec(window.location.search);return t&&decodeURIComponent(t[1].replace(/\+/g," "))||undefined}var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(1),a=r(u),s=n(2),c=r(s),f=n(4),d=r(f),l=n(5),p=r(l),h=n(6);a["default"].configure({promise:function(e){return new h.Promise(e)}});var v=window.ContactHubObject||"ch",m=window.ContactHubCookie||"_ch",w=window.ContactHubAPI||"https://api.contactlab.it/hub/v1",y=function(){return c["default"].v4()},g=function(){var e=p["default"].getJSON(m);if(!e)throw new Error("Missing required ContactHub configuration.");if(!(e.workspaceId&&e.nodeId&&e.token))throw new Error("Missing required ContactHub configuration.");return e},b=["token","workspaceId","nodeId","context"],A=function(e){var t=p["default"].getJSON(m)||{},n=o("utm_source");n&&(t.ga={utm_source:n,utm_medium:o("utm_medium"),utm_term:o("utm_term"),utm_content:o("utm_content"),utm_campaign:o("utm_campaign")}),t.sid=t.sid||y();var r=Object.keys(e).filter(function(e){return-1!==b.indexOf(e)}).reduce(function(t,n){return t[n]=e[n],t},{});i(t,r),t.hasOwnProperty("context")||(t.context="WEB"),p["default"].set(m,t,{expires:365})},E=function(e,t){if("viewedPage"===e){var n={title:document.title,url:window.location.href,path:window.location.pathname,referer:document.referrer};return i(n,t)}return i({},t)},T=function(e){var t=g(),n=t.workspaceId,r=t.nodeId,o=t.token,i=t.context,u=t.sid,s=t.customerId,c=t.ga,f=e.type,d=e.properties;if(!f)throw new Error("Missing required event type");var l=E(f,d),p=c?{ga:c}:undefined,h=s?undefined:{type:"SESSION_ID",value:u,nodeId:r};(0,a["default"])({method:"POST",url:w+"/workspaces/"+n+"/events",data:{type:f,context:i,properties:l,tracking:p,customerId:s,bringBackProperties:h},headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+o}})},_=function(e){var t=e.workspaceId,n=e.nodeId,r=e.token,o=e.externalId,i=e.base,u=e.extended,s=e.extra,c=e.tags;return(0,a["default"])({method:"POST",url:w+"/workspaces/"+t+"/customers",headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+r},data:{nodeId:n,externalId:o,base:i,extended:u,extra:s,tags:c}}).then(function(e){return e.data.id})},x=function(e){var t=e.customerId,n=e.workspaceId,r=e.token,o=e.externalId,i=e.base,u=e.extended,s=e.extra,c=e.tags;return(0,a["default"])({method:"PATCH",url:w+"/workspaces/"+n+"/customers/"+t,headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+r},data:{externalId:o,base:i,extended:u,extra:s,tags:c}}).then(function(){return t})},S=function(e){var t=e.customerId,n=e.workspaceId,r=e.token;return(0,a["default"])({method:"POST",url:w+"/workspaces/"+n+"/customers/"+t+"/sessions",headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+r},data:{value:g().sid}}).then(function(){return t})},I=function(e){var t=new d["default"]("SHA-256","TEXT");return t.update(JSON.stringify(e)),t.getHash("HEX")},R=function(e){if(!e)return void p["default"].set(m,i(g(),{sid:y(),customerId:undefined,hash:undefined}));var t=g(),n=t.workspaceId,r=t.nodeId,o=t.token,u=t.customerId,a=t.hash,s=e.externalId,c=e.base,f=e.extended,d=e.extra,l=e.tags,v=I({base:c,extended:f,extra:d,tags:l,externalId:s}),w=function(e){if(409===e.status){var t=JSON.parse(e.response),i=t.data.customer.id;return x({customerId:i,workspaceId:n,nodeId:r,token:o,externalId:s,base:c,extended:f,extra:d,tags:l})}return h.Promise.reject(e)},b=function(e){return S({customerId:e,workspaceId:n,token:o,nodeId:r})},A=function(e){return p["default"].set(m,i(g(),{customerId:e,hash:v})),e};a!==v&&(u?function(e){return x({customerId:e,workspaceId:n,nodeId:r,token:o,externalId:s,base:c,extended:f,extra:d,tags:l})}(u).then(A):function(){return _({workspaceId:n,nodeId:r,token:o,externalId:s,base:c,extended:f,extra:d,tags:l})}()["catch"](w).then(A).then(b))},k=function(e,t){if("undefined"!=typeof JSON){var n={config:A,customer:R,event:T};e in n&&n[e].call(undefined,t)}};if(window[v]&&window[v].q){window[v].q.map(function(e){return k(e[0],e[1])})}window[v]=k},function(e,t,n){!function(t,n){e.exports=n()}(0,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="/",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e,t){return{status:e.status,response:e.response,data:t,xhr:e}}function o(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];for(var o in n)if({}.hasOwnProperty.call(n,o)){var i=n[o];if("object"===(void 0===i?"undefined":s(i)))for(var u in i)({}).hasOwnProperty.call(i,u)&&(e[u]=i[u])}return e}function i(e){m=o({},m,e)}function u(e,t){return(e&&e.promise?e.promise:m.promise||v.promise)(t)}function a(e){return u(e,function(t,n){var i=o({},v,m,e),u=i.xmlHttpRequest();u.withCredentials=i.withCredentials,i.abort&&e.abort(function(){n(r(u)),u.abort()}),u.open(i.method,i.params?i.url.split("?")[0]+"?"+(0,f["default"])(i.params):i.url,!0),u.addEventListener(l.LOAD,function(){if(u.status>=200&&u.status<300){var e=null;u.responseText&&(e=!0===i.raw?u.responseText:i.load(u.responseText)),t(r(u,e))}else n(r(u))}),u.addEventListener(l.ABORT,function(){return n(r(u))}),u.addEventListener(l.ERROR,function(){return n(r(u))}),u.addEventListener(l.TIMEOUT,function(){return n(r(u))});for(var a in i.headers)({}).hasOwnProperty.call(i.headers,a)&&u.setRequestHeader(a,i.headers[a]);for(var c in i.events)({}).hasOwnProperty.call(i.events,c)&&u.addEventListener(c,i.events[c].bind(null,u),!1);var d="object"!==s(i.data)||i.raw?i.data:i.dump(i.data);void 0!==d?u.send(d):u.send()})}t.__esModule=!0;var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},c=n(2),f=function(e){return e&&e.__esModule?e:{"default":e}}(c),d={GET:"GET",POST:"POST",PUT:"PUT",DELETE:"DELETE",PATCH:"PATCH",OPTIONS:"OPTIONS"},l={READY_STATE_CHANGE:"readystatechange",LOAD_START:"loadstart",PROGRESS:"progress",ABORT:"abort",ERROR:"error",LOAD:"load",TIMEOUT:"timeout",LOAD_END:"loadend"},p="undefined"==typeof JSON?function(){}:JSON.stringify,h="undefined"==typeof JSON?function(){}:JSON.parse,v={method:d.GET,data:void 0,headers:{Accept:"application/json","Content-Type":"application/json"},dump:p,load:h,xmlHttpRequest:function(){return new XMLHttpRequest},promise:function(e){return new Promise(e)},withCredentials:!1},m={};a.assign=o,a.encode=f["default"],a.configure=i,a.Methods=d,a.Events=l,a.defaults=v,a.get=function(e,t,n){return a(o({url:e,method:d.GET,params:t},n))},a.put=function(e,t,n){return a(o({url:e,method:d.PUT,data:t},n))},a.post=function(e,t,n){return a(o({url:e,method:d.POST,data:t},n))},a.patch=function(e,t,n){return a(o({url:e,method:d.PATCH,data:t},n))},a.del=function(e,t){return a(o({url:e,method:d.DELETE},t))},a.options=function(e,t){return a(o({url:e,method:d.OPTIONS},t))},t["default"]=a},function(e,t){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,r,o){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map(function(o){var i=encodeURIComponent(n(o))+r;return Array.isArray(e[o])?e[o].map(function(e){return i+encodeURIComponent(n(e))}).join(t):i+encodeURIComponent(n(e[o]))}).join(t):o?encodeURIComponent(n(o))+r+encodeURIComponent(n(e)):""}}])})},function(e,t,n){function r(e,t,n){var r=t&&n||0,o=0;for(t=t||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,function(e){o<16&&(t[r+o++]=c[e])});o<16;)t[r+o++]=0;return t}function o(e,t){var n=t||0,r=s;return r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]}function i(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var u=e.clockseq!==undefined?e.clockseq:p,a=e.msecs!==undefined?e.msecs:(new Date).getTime(),s=e.nsecs!==undefined?e.nsecs:v+1,c=a-h+(s-v)/1e4;if(c<0&&e.clockseq===undefined&&(u=u+1&16383),(c<0||a>h)&&e.nsecs===undefined&&(s=0),s>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");h=a,v=s,p=u,a+=122192928e5;var f=(1e4*(268435455&a)+s)%4294967296;i[r++]=f>>>24&255,i[r++]=f>>>16&255,i[r++]=f>>>8&255,i[r++]=255&f;var d=a/4294967296*1e4&268435455;i[r++]=d>>>8&255,i[r++]=255&d,i[r++]=d>>>24&15|16,i[r++]=d>>>16&255,i[r++]=u>>>8|128,i[r++]=255&u;for(var m=e.node||l,w=0;w<6;w++)i[r+w]=m[w];return t||o(i)}function u(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null),e=e||{};var i=e.random||(e.rng||a)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t)for(var u=0;u<16;u++)t[r+u]=i[u];return t||o(i)}for(var a=n(3),s=[],c={},f=0;f<256;f++)s[f]=(f+256).toString(16).substr(1),c[s[f]]=f;var d=a(),l=[1|d[0],d[1],d[2],d[3],d[4],d[5]],p=16383&(d[6]<<8|d[7]),h=0,v=0,m=u;m.v1=i,m.v4=u,m.parse=r,m.unparse=o,e.exports=m},function(e,t){(function(t){var n,r=t.crypto||t.msCrypto;if(r&&r.getRandomValues){var o=new Uint8Array(16);n=function(){return r.getRandomValues(o),o}}if(!n){var i=new Array(16);n=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}e.exports=n}).call(t,function(){return this}())},function(e,t,n){var r;!function(o){function i(e,t,n){var r,o,i,u,a,v,m,w,y,g=0,b=[],A=0,E=!1,T=[],_=[],I=!1;if(n=n||{},r=n.encoding||"UTF8",(y=n.numRounds||1)!==parseInt(y,10)||1>y)throw Error("numRounds must a integer >= 1");if(0!==e.lastIndexOf("SHA-",0))throw Error("Chosen SHA variant is not supported");if(v=function(t,n){return S(t,n,e)},m=function(t,n,r,o){var i,u;if("SHA-224"!==e&&"SHA-256"!==e)throw Error("Unexpected error in SHA-2 implementation");for(i=15+(n+65>>>9<<4),u=16;t.length<=i;)t.push(0);for(t[n>>>5]|=128<<24-n%32,n+=r,t[i]=4294967295&n,t[i-1]=n/4294967296|0,r=t.length,n=0;n<r;n+=u)o=S(t.slice(n,n+u),o,e);if("SHA-224"===e)t=[o[0],o[1],o[2],o[3],o[4],o[5],o[6]];else{if("SHA-256"!==e)throw Error("Unexpected error in SHA-2 implementation");t=o}return t},w=function(e){return e.slice()},"SHA-224"===e)a=512,u=224;else{if("SHA-256"!==e)throw Error("Chosen SHA variant is not supported");a=512,u=256}i=h(t,r),o=x(e),this.setHMACKey=function(t,n,i){var u;if(!0===E)throw Error("HMAC key already set");if(!0===I)throw Error("Cannot set HMAC key after calling update");for(r=(i||{}).encoding||"UTF8",n=h(n,r)(t),t=n.binLen,n=n.value,u=a>>>3,i=u/4-1,u<t/8&&(n=m(n,t,0,x(e)));n.length<=i;)n.push(0);for(t=0;t<=i;t+=1)T[t]=909522486^n[t],_[t]=1549556828^n[t];o=v(T,o),g=a,E=!0},this.update=function(e){var t,n,r,u=0,s=a>>>5;for(t=i(e,b,A),e=t.binLen,n=t.value,t=e>>>5,r=0;r<t;r+=s)u+a<=e&&(o=v(n.slice(r,r+s),o),u+=a);g+=u,b=n.slice(u>>>5),A=e%a,I=!0},this.getHash=function(t,n){var r,i,a,h;if(!0===E)throw Error("Cannot call getHash after setting HMAC key");switch(a=p(n),t){case"HEX":r=function(e){return s(e,u,a)};break;case"B64":r=function(e){return c(e,u,a)};break;case"BYTES":r=function(e){return f(e,u)};break;case"ARRAYBUFFER":try{i=new ArrayBuffer(0)}catch(v){throw Error("ARRAYBUFFER not supported by this environment")}r=function(e){return d(e,u)};break;case"UINT8ARRAY":try{i=new Uint8Array(0)}catch(v){throw Error("UINT8ARRAY not supported by this environment")}r=function(e){return l(e,u)};break;default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}for(h=m(b.slice(),A,g,w(o)),i=1;i<y;i+=1)h=m(h,u,0,x(e));return r(h)},this.getHMAC=function(t,n){var r,i,h,y;if(!1===E)throw Error("Cannot call getHMAC without first setting HMAC key");switch(h=p(n),t){case"HEX":r=function(e){return s(e,u,h)};break;case"B64":r=function(e){return c(e,u,h)};break;case"BYTES":r=function(e){return f(e,u)};break;case"ARRAYBUFFER":try{r=new ArrayBuffer(0)}catch(T){throw Error("ARRAYBUFFER not supported by this environment")}r=function(e){return d(e,u)};break;case"UINT8ARRAY":try{r=new Uint8Array(0)}catch(T){throw Error("UINT8ARRAY not supported by this environment")}r=function(e){return l(e,u)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}return i=m(b.slice(),A,g,w(o)),y=v(_,x(e)),y=m(i,u,a,y),r(y)}}function u(){}function a(e,t,n){var r,o,i,u;for(t=t||[0],n=n||0,o=n>>>3,r=0;r<e.length;r+=1)u=r+o,i=u>>>2,t.length<=i&&t.push(0),t[i]|=e[r]<<8*(3+u%4*-1);return{value:t,binLen:8*e.length+n}}function s(e,t,n){var r="";t/=8;var o,i;for(o=0;o<t;o+=1)i=e[o>>>2]>>>8*(3+o%4*-1),r+="0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i);return n.outputUpper?r.toUpperCase():r}function c(e,t,n){var r,o,i,u="",a=t/8;for(r=0;r<a;r+=3)for(o=r+1<a?e[r+1>>>2]:0,i=r+2<a?e[r+2>>>2]:0,i=(e[r>>>2]>>>8*(3+r%4*-1)&255)<<16|(o>>>8*(3+(r+1)%4*-1)&255)<<8|i>>>8*(3+(r+2)%4*-1)&255,o=0;4>o;o+=1)u+=8*r+6*o<=t?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(i>>>6*(3-o)&63):n.b64Pad;return u}function f(e,t){var n,r,o="",i=t/8;for(n=0;n<i;n+=1)r=e[n>>>2]>>>8*(3+n%4*-1)&255,o+=String.fromCharCode(r);return o}function d(e,t){var n,r,o=t/8,i=new ArrayBuffer(o);for(r=new Uint8Array(i),n=0;n<o;n+=1)r[n]=e[n>>>2]>>>8*(3+n%4*-1)&255;return i}function l(e,t){var n,r=t/8,o=new Uint8Array(r);for(n=0;n<r;n+=1)o[n]=e[n>>>2]>>>8*(3+n%4*-1)&255;return o}function p(e){var t={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(e=e||{},t.outputUpper=e.outputUpper||!1,!0===e.hasOwnProperty("b64Pad")&&(t.b64Pad=e.b64Pad),"boolean"!=typeof t.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof t.b64Pad)throw Error("Invalid b64Pad formatting option");return t}function h(e,t){var n;switch(t){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(e){case"HEX":n=function(e,t,n){var r,o,i,u,a,s=e.length;if(0!=s%2)throw Error("String of HEX type must be in byte increments");for(t=t||[0],n=n||0,a=n>>>3,r=0;r<s;r+=2){if(o=parseInt(e.substr(r,2),16),isNaN(o))throw Error("String of HEX type contains invalid characters");for(u=(r>>>1)+a,i=u>>>2;t.length<=i;)t.push(0);t[i]|=o<<8*(3+u%4*-1)}return{value:t,binLen:4*s+n}};break;case"TEXT":n=function(e,n,r){var o,i,u,a,s,c,f,d,l=0;if(n=n||[0],r=r||0,s=r>>>3,"UTF8"===t)for(d=3,u=0;u<e.length;u+=1)for(o=e.charCodeAt(u),i=[],128>o?i.push(o):2048>o?(i.push(192|o>>>6),i.push(128|63&o)):55296>o||57344<=o?i.push(224|o>>>12,128|o>>>6&63,128|63&o):(u+=1,o=65536+((1023&o)<<10|1023&e.charCodeAt(u)),i.push(240|o>>>18,128|o>>>12&63,128|o>>>6&63,128|63&o)),a=0;a<i.length;a+=1){for(f=l+s,c=f>>>2;n.length<=c;)n.push(0);n[c]|=i[a]<<8*(d+f%4*-1),l+=1}else if("UTF16BE"===t||"UTF16LE"===t)for(d=2,i="UTF16LE"===t&&!0||"UTF16LE"!==t&&!1,u=0;u<e.length;u+=1){for(o=e.charCodeAt(u),!0===i&&(a=255&o,o=a<<8|o>>>8),f=l+s,c=f>>>2;n.length<=c;)n.push(0);n[c]|=o<<8*(d+f%4*-1),l+=2}return{value:n,binLen:8*l+r}};break;case"B64":n=function(e,t,n){var r,o,i,u,a,s,c,f=0;if(-1===e.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(o=e.indexOf("="),e=e.replace(/\=/g,""),-1!==o&&o<e.length)throw Error("Invalid '=' found in base-64 string");for(t=t||[0],n=n||0,s=n>>>3,o=0;o<e.length;o+=4){for(a=e.substr(o,4),i=u=0;i<a.length;i+=1)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(i)),u|=r<<18-6*i;for(i=0;i<a.length-1;i+=1){for(c=f+s,r=c>>>2;t.length<=r;)t.push(0);t[r]|=(u>>>16-8*i&255)<<8*(3+c%4*-1),f+=1}}return{value:t,binLen:8*f+n}};break;case"BYTES":n=function(e,t,n){var r,o,i,u,a;for(t=t||[0],n=n||0,i=n>>>3,o=0;o<e.length;o+=1)r=e.charCodeAt(o),a=o+i,u=a>>>2,t.length<=u&&t.push(0),t[u]|=r<<8*(3+a%4*-1);return{value:t,binLen:8*e.length+n}};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(r){throw Error("ARRAYBUFFER not supported by this environment")}n=function(e,t,n){return a(new Uint8Array(e),t,n)};break;case"UINT8ARRAY":try{n=new Uint8Array(0)}catch(r){throw Error("UINT8ARRAY not supported by this environment")}n=function(e,t,n){return a(e,t,n)};break;default:throw Error("format must be HEX, TEXT, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}return n}function v(e,t){return e>>>t|e<<32-t}function m(e,t,n){return e&t^~e&n}function w(e,t,n){return e&t^e&n^t&n}function y(e){return v(e,2)^v(e,13)^v(e,22)}function g(e){return v(e,6)^v(e,11)^v(e,25)}function b(e){return v(e,7)^v(e,18)^e>>>3}function A(e){return v(e,17)^v(e,19)^e>>>10}function E(e,t){var n=(65535&e)+(65535&t);return((e>>>16)+(t>>>16)+(n>>>16)&65535)<<16|65535&n}function T(e,t,n,r){var o=(65535&e)+(65535&t)+(65535&n)+(65535&r);return((e>>>16)+(t>>>16)+(n>>>16)+(r>>>16)+(o>>>16)&65535)<<16|65535&o}function _(e,t,n,r,o){var i=(65535&e)+(65535&t)+(65535&n)+(65535&r)+(65535&o);return((e>>>16)+(t>>>16)+(n>>>16)+(r>>>16)+(o>>>16)+(i>>>16)&65535)<<16|65535&i}function x(e){var t,n=[];if(0!==e.lastIndexOf("SHA-",0))throw Error("No SHA variants supported");switch(n=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],t=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],e){case"SHA-224":break;case"SHA-256":n=t;break;case"SHA-384":case"SHA-512":n=[new u,new u,new u,new u,new u,new u,new u,new u];break;default:throw Error("Unknown SHA variant")}return n}function S(e,t,n){var r,o,i,u,a,s,c,f,d,l,p,h,v,x,S,R,k,C,U,O,H,P,B,F=[];if("SHA-224"!==n&&"SHA-256"!==n)throw Error("Unexpected error in SHA-2 implementation");for(l=64,h=1,P=Number,v=E,x=T,S=_,R=b,k=A,C=y,U=g,H=w,O=m,B=I,n=t[0],r=t[1],o=t[2],i=t[3],u=t[4],a=t[5],s=t[6],c=t[7],p=0;p<l;p+=1)16>p?(d=p*h,f=e.length<=d?0:e[d],d=e.length<=d+1?0:e[d+1],F[p]=new P(f,d)):F[p]=x(k(F[p-2]),F[p-7],R(F[p-15]),F[p-16]),f=S(c,U(u),O(u,a,s),B[p],F[p]),d=v(C(n),H(n,r,o)),c=s,s=a,a=u,u=v(i,f),i=o,o=r,r=n,n=v(f,d);return t[0]=v(n,t[0]),t[1]=v(r,t[1]),t[2]=v(o,t[2]),t[3]=v(i,t[3]),t[4]=v(u,t[4]),t[5]=v(a,t[5]),t[6]=v(s,t[6]),t[7]=v(c,t[7]),t}var I;I=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],(r=function(){return i}.call(t,n,t,e))!==undefined&&(e.exports=r)}()},function(e,t,n){var r,o;!function(i){var u;if(r=i,(o="function"==typeof r?r.call(t,n,t,e):r)!==undefined&&(e.exports=o),u=!0,e.exports=i(),u=!0,!u){var a=window.Cookies,s=window.Cookies=i();s.noConflict=function(){return window.Cookies=a,s}}}(function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}function n(r){function o(){}function i(t,n,i){if("undefined"!=typeof document){i=e({path:"/"},o.defaults,i),"number"==typeof i.expires&&(i.expires=new Date(1*new Date+864e5*i.expires)),i.expires=i.expires?i.expires.toUTCString():"";try{var u=JSON.stringify(n);/^[\{\[]/.test(u)&&(n=u)}catch(c){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var a="";for(var s in i)i[s]&&(a+="; "+s,!0!==i[s]&&(a+="="+i[s].split(";")[0]));return document.cookie=t+"="+n+a}}function u(e,n){if("undefined"!=typeof document){for(var o={},i=document.cookie?document.cookie.split("; "):[],u=0;u<i.length;u++){var a=i[u].split("="),s=a.slice(1).join("=");n||'"'!==s.charAt(0)||(s=s.slice(1,-1));try{var c=t(a[0]);if(s=(r.read||r)(s,c)||t(s),n)try{s=JSON.parse(s)}catch(f){}if(o[c]=s,e===c)break}catch(f){}}return e?o[e]:o}}return o.set=i,o.get=function(e){return u(e,!1)},o.getJSON=function(e){return u(e,!0)},o.remove=function(t,n){i(t,"",e(n,{expires:-1}))},o.defaults={},o.withConverter=n,o}return n(function(){})})},function(e,t,n){(function(t,r){!function(t,n){e.exports=n()}(0,function(){"use strict";function e(e){return"function"==typeof e||"object"==typeof e&&null!==e}function o(e){return"function"==typeof e}function i(e){J=e}function u(e){G=e}function a(){return function(){q(c)}}function s(){var e=setTimeout;return function(){return e(c,1)}}function c(){for(var e=0;e<X;e+=2){(0,Q[e])(Q[e+1]),Q[e]=undefined,Q[e+1]=undefined}X=0}function f(e,t){var n=arguments,r=this,o=new this.constructor(l);o[ee]===undefined&&U(o);var i=r._state;return i?function(){var e=n[i-1];G(function(){return R(i,o,e,r._result)})}():_(r,o,e,t),o}function d(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(l);return b(n,e),n}function l(){}function p(){return new TypeError("You cannot resolve a promise with itself")}function h(){return new TypeError("A promises callback cannot return that same promise.")}function v(e){try{return e.then}catch(t){return oe.error=t,oe}}function m(e,t,n,r){try{e.call(t,n,r)}catch(o){return o}}function w(e,t,n){G(function(e){var r=!1,o=m(n,t,function(n){r||(r=!0,t!==n?b(e,n):E(e,n))},function(t){r||(r=!0,T(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&o&&(r=!0,T(e,o))},e)}function y(e,t){t._state===ne?E(e,t._result):t._state===re?T(e,t._result):_(t,undefined,function(t){return b(e,t)},function(t){return T(e,t)})}function g(e,t,n){t.constructor===e.constructor&&n===f&&t.constructor.resolve===d?y(e,t):n===oe?T(e,oe.error):n===undefined?E(e,t):o(n)?w(e,t,n):E(e,t)}function b(t,n){t===n?T(t,p()):e(n)?g(t,n,v(n)):E(t,n)}function A(e){e._onerror&&e._onerror(e._result),x(e)}function E(e,t){e._state===te&&(e._result=t,e._state=ne,0!==e._subscribers.length&&G(x,e))}function T(e,t){e._state===te&&(e._state=re,e._result=t,G(A,e))}function _(e,t,n,r){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+ne]=n,o[i+re]=r,0===i&&e._state&&G(x,e)}function x(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r=undefined,o=undefined,i=e._result,u=0;u<t.length;u+=3)r=t[u],o=t[u+n],r?R(n,r,o,i):o(i);e._subscribers.length=0}}function S(){this.error=null}function I(e,t){try{return e(t)}catch(n){return ie.error=n,ie}}function R(e,t,n,r){var i=o(n),u=undefined,a=undefined,s=undefined,c=undefined;if(i){if(u=I(n,r),u===ie?(c=!0,a=u.error,u=null):s=!0,t===u)return void T(t,h())}else u=r,s=!0;t._state!==te||(i&&s?b(t,u):c?T(t,a):e===ne?E(t,u):e===re&&T(t,u))}function k(e,t){try{t(function(t){b(e,t)},function(t){T(e,t)})}catch(n){T(e,n)}}function C(){return ue++}function U(e){e[ee]=ue++,e._state=undefined,e._result=undefined,e._subscribers=[]}function O(e,t){this._instanceConstructor=e,this.promise=new e(l),this.promise[ee]||U(this.promise),D(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?E(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&E(this.promise,this._result))):T(this.promise,H())}function H(){return new Error("Array Methods must be provided an Array")}function P(e){return new O(this,e).promise}function B(e){var t=this;return new t(D(e)?function(n,r){for(var o=e.length,i=0;i<o;i++)t.resolve(e[i]).then(n,r)}:function(e,t){return t(new TypeError("You must pass an array to race."))})}function F(e){var t=this,n=new t(l);return T(n,e),n}function j(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function L(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function N(e){this[ee]=C(),this._result=this._state=undefined,this._subscribers=[],l!==e&&("function"!=typeof e&&j(),this instanceof N?k(this,e):L())}function Y(){var e=undefined;if(void 0!==r)e=r;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(o){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var n=null;try{n=Object.prototype.toString.call(t.resolve())}catch(o){}if("[object Promise]"===n&&!t.cast)return}e.Promise=N}var M=undefined;M=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var D=M,X=0,q=undefined,J=undefined,G=function(e,t){Q[X]=e,Q[X+1]=t,2===(X+=2)&&(J?J(c):$())},z="undefined"!=typeof window?window:undefined,K=z||{},V=K.MutationObserver||K.WebKitMutationObserver,W="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),Z="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,Q=new Array(1e3),$=undefined;$=W?function(){return function(){return t.nextTick(c)}}():V?function(){var e=0,t=new V(c),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}():Z?function(){var e=new MessageChannel;return e.port1.onmessage=c,function(){return e.port2.postMessage(0)}}():z===undefined?function(){try{var e=n(8);return q=e.runOnLoop||e.runOnContext,a()}catch(t){return s()}}():s();var ee=Math.random().toString(36).substring(16),te=void 0,ne=1,re=2,oe=new S,ie=new S,ue=0;return O.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===te&&n<e;n++)this._eachEntry(t[n],n)},O.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===d){var o=v(e);if(o===f&&e._state!==te)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(n===N){var i=new n(l);g(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},O.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===te&&(this._remaining--,e===re?T(r,n):this._result[t]=n),0===this._remaining&&E(r,this._result)},O.prototype._willSettleAt=function(e,t){var n=this;_(e,undefined,function(e){return n._settledAt(ne,t,e)},function(e){return n._settledAt(re,t,e)})},N.all=P,N.race=B,N.resolve=d,N.reject=F,N._setScheduler=i,N._setAsap=u,N._asap=G,N.prototype={constructor:N,then:f,"catch":function(e){return this.then(null,e)}},Y(),N.polyfill=Y,N.Promise=N,N})}).call(t,n(7),function(){return this}())},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(f===setTimeout)return setTimeout(e,0);if((f===n||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(d===clearTimeout)return clearTimeout(e);if((d===r||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function u(){v&&p&&(v=!1,p.length?h=p.concat(h):m=-1,h.length&&a())}function a(){if(!v){var e=o(u);v=!0;for(var t=h.length;t;){for(p=h,h=[];++m<t;)p&&p[m].run();m=-1,t=h.length}p=null,v=!1,i(e)}}function s(e,t){this.fun=e,this.array=t}function c(){}var f,d,l=e.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:n}catch(e){f=n}try{d="function"==typeof clearTimeout?clearTimeout:r}catch(e){d=r}}();var p,h=[],v=!1,m=-1;l.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];h.push(new s(e,t)),1!==h.length||v||o(a)},s.prototype.run=function(){this.fun.apply(null,this.array)},l.title="browser",l.browser=!0,l.env={},l.argv=[],l.version="",l.versions={},l.on=c,l.addListener=c,l.once=c,l.off=c,l.removeListener=c,l.removeAllListeners=c,l.emit=c,l.prependListener=c,l.prependOnceListener=c,l.listeners=function(e){return[]},l.binding=function(e){throw new Error("process.binding is not supported")},l.cwd=function(){return"/"},l.chdir=function(e){throw new Error("process.chdir is not supported")},l.umask=function(){return 0}},function(e,t){}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ContactlabSDKBrowser=t():e.ContactlabSDKBrowser=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=n(1),u=r(i),a=n(2),s=r(a),c=n(4),f=r(c),d=n(5),l=r(d),p=n(6);u["default"].configure({promise:function(e){return new p.Promise(e)}});var h=window.ContactHubObject||"ch",v=window.ContactHubCookie||"_ch",m=window.ContactHubAPI||"https://api.contactlab.it/hub/v1",w=function(e){var t=RegExp("[?&]"+e+"=([^&]*)").exec(window.location.search);return t&&decodeURIComponent(t[1].replace(/\+/g," "))||undefined},y=function(){return s["default"].v4()},g=function(){var e=l["default"].getJSON(v);if(!e)throw new Error("Missing required ContactHub configuration.");if(!(e.workspaceId&&e.nodeId&&e.token))throw new Error("Missing required ContactHub configuration.");return e},b=function(e,t){if("viewedPage"===e){var n={title:document.title,url:window.location.href,path:window.location.pathname,referer:document.referrer};return o(n,t)}return o({},t)},A=function(e){var t=g(),n=t.workspaceId,r=t.nodeId,o=t.token,i=t.context,a=t.contextInfo,s=t.sid,c=t.customerId,f=t.ga,d=e.type,l=e.properties;if(!d)throw new Error("Missing required event type");var p=b(d,l),h=f?{ga:f}:undefined,v=c?undefined:{type:"SESSION_ID",value:s,nodeId:r};(0,u["default"])({method:"POST",url:m+"/workspaces/"+n+"/events",data:{type:d,context:i,contextInfo:a,properties:p,tracking:h,customerId:c,bringBackProperties:v},headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+o}})},E=function(e){var t=e.workspaceId,n=e.nodeId,r=e.token,o=e.externalId,i=e.base,a=e.extended,s=e.extra,c=e.tags;return(0,u["default"])({method:"POST",url:m+"/workspaces/"+t+"/customers",headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+r},data:{nodeId:n,externalId:o,base:i,extended:a,extra:s,tags:c}}).then(function(e){return e.data.id})},T=function(e){var t=e.customerId,n=e.workspaceId,r=e.token,o=e.externalId,i=e.base,a=e.extended,s=e.extra,c=e.tags;return(0,u["default"])({method:"PATCH",url:m+"/workspaces/"+n+"/customers/"+t,headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+r},data:{externalId:o,base:i,extended:a,extra:s,tags:c}}).then(function(){return t})},x=function(e){var t=e.customerId,n=e.workspaceId,r=e.token;return(0,u["default"])({method:"POST",url:m+"/workspaces/"+n+"/customers/"+t+"/sessions",headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+r},data:{value:g().sid}}).then(function(){return t})},_=function(e){var t=new f["default"]("SHA-256","TEXT");return t.update(JSON.stringify(e)),t.getHash("HEX")},I=function(){l["default"].set(v,o(g(),{sid:y(),customerId:undefined,hash:undefined}))},S=function(e){if(!e)return void I();var t=g(),n=t.workspaceId,r=t.nodeId,i=t.token,u=t.customerId,a=t.hash,s=e.id,c=e.externalId,f=e.base,d=e.extended,h=e.extra,m=e.tags,w=_({base:f,extended:d,extra:h,tags:m,externalId:c}),y=function(e){return c||f||d||h||m?T({customerId:e,workspaceId:n,nodeId:r,token:i,externalId:c,base:f,extended:d,extra:h,tags:m}):p.Promise.resolve(e)},b=function(e){if(409===e.status){var t=JSON.parse(e.response),o=t.data.customer.id;return T({customerId:o,workspaceId:n,nodeId:r,token:i,externalId:c,base:f,extended:d,extra:h,tags:m})}return p.Promise.reject(e)},A=function(e){return x({customerId:e,workspaceId:n,token:i,nodeId:r})},S=function(e){return l["default"].set(v,o(g(),{customerId:e,hash:w})),e};a!==w&&(s&&u?function(e,t){return e===t?p.Promise.resolve(e):c||f||d||h||m?(I(),A(e)):p.Promise.reject("The provided id conflicts with the id stored in the cookie")}(s,u).then(y).then(S):s?A(s).then(y).then(S):u?y(u).then(S):function(){return E({workspaceId:n,nodeId:r,token:i,externalId:c,base:f,extended:d,extra:h,tags:m})}()["catch"](b).then(S).then(A))},R=["token","workspaceId","nodeId","context","contextInfo"],k=function(e){var t=l["default"].getJSON(v)||{},n=w("utm_source");n&&(t.ga={utm_source:n,utm_medium:w("utm_medium"),utm_term:w("utm_term"),utm_content:w("utm_content"),utm_campaign:w("utm_campaign")}),t.sid=t.sid||y();var r=Object.keys(e).filter(function(e){return-1!==R.indexOf(e)}).reduce(function(t,n){return t[n]=e[n],t},{});o(t,r),t.context=t.context||"WEB",t.contextInfo=t.contextInfo||{},l["default"].set(v,t,{expires:365});var i=w("clabId");i&&S({id:i})},C=function(e,t){if("undefined"!=typeof JSON){var n={config:k,customer:S,event:A};e in n&&n[e].call(undefined,t)}};if(window[h]&&window[h].q){window[h].q.map(function(e){return C(e[0],e[1])})}window[h]=C},function(e,t,n){!function(t,n){e.exports=n()}(0,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="/",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e,t){return{status:e.status,response:e.response,data:t,xhr:e}}function o(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];for(var o in n)if({}.hasOwnProperty.call(n,o)){var i=n[o];if("object"===(void 0===i?"undefined":s(i)))for(var u in i)({}).hasOwnProperty.call(i,u)&&(e[u]=i[u])}return e}function i(e){m=o({},m,e)}function u(e,t){return(e&&e.promise?e.promise:m.promise||v.promise)(t)}function a(e){return u(e,function(t,n){var i=o({},v,m,e),u=i.xmlHttpRequest();u.withCredentials=i.withCredentials,i.abort&&e.abort(function(){n(r(u)),u.abort()}),u.open(i.method,i.params?i.url.split("?")[0]+"?"+(0,f["default"])(i.params):i.url,!0),u.addEventListener(l.LOAD,function(){if(u.status>=200&&u.status<300){var e=null;u.responseText&&(e=!0===i.raw?u.responseText:i.load(u.responseText)),t(r(u,e))}else n(r(u))}),u.addEventListener(l.ABORT,function(){return n(r(u))}),u.addEventListener(l.ERROR,function(){return n(r(u))}),u.addEventListener(l.TIMEOUT,function(){return n(r(u))});for(var a in i.headers)({}).hasOwnProperty.call(i.headers,a)&&u.setRequestHeader(a,i.headers[a]);for(var c in i.events)({}).hasOwnProperty.call(i.events,c)&&u.addEventListener(c,i.events[c].bind(null,u),!1);var d="object"!==s(i.data)||i.raw?i.data:i.dump(i.data);void 0!==d?u.send(d):u.send()})}t.__esModule=!0;var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},c=n(2),f=function(e){return e&&e.__esModule?e:{"default":e}}(c),d={GET:"GET",POST:"POST",PUT:"PUT",DELETE:"DELETE",PATCH:"PATCH",OPTIONS:"OPTIONS"},l={READY_STATE_CHANGE:"readystatechange",LOAD_START:"loadstart",PROGRESS:"progress",ABORT:"abort",ERROR:"error",LOAD:"load",TIMEOUT:"timeout",LOAD_END:"loadend"},p="undefined"==typeof JSON?function(){}:JSON.stringify,h="undefined"==typeof JSON?function(){}:JSON.parse,v={method:d.GET,data:void 0,headers:{Accept:"application/json","Content-Type":"application/json"},dump:p,load:h,xmlHttpRequest:function(){return new XMLHttpRequest},promise:function(e){return new Promise(e)},withCredentials:!1},m={};a.assign=o,a.encode=f["default"],a.configure=i,a.Methods=d,a.Events=l,a.defaults=v,a.get=function(e,t,n){return a(o({url:e,method:d.GET,params:t},n))},a.put=function(e,t,n){return a(o({url:e,method:d.PUT,data:t},n))},a.post=function(e,t,n){return a(o({url:e,method:d.POST,data:t},n))},a.patch=function(e,t,n){return a(o({url:e,method:d.PATCH,data:t},n))},a.del=function(e,t){return a(o({url:e,method:d.DELETE},t))},a.options=function(e,t){return a(o({url:e,method:d.OPTIONS},t))},t["default"]=a},function(e,t){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,r,o){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map(function(o){var i=encodeURIComponent(n(o))+r;return Array.isArray(e[o])?e[o].map(function(e){return i+encodeURIComponent(n(e))}).join(t):i+encodeURIComponent(n(e[o]))}).join(t):o?encodeURIComponent(n(o))+r+encodeURIComponent(n(e)):""}}])})},function(e,t,n){function r(e,t,n){var r=t&&n||0,o=0;for(t=t||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,function(e){o<16&&(t[r+o++]=c[e])});o<16;)t[r+o++]=0;return t}function o(e,t){var n=t||0,r=s;return r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]}function i(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var u=e.clockseq!==undefined?e.clockseq:p,a=e.msecs!==undefined?e.msecs:(new Date).getTime(),s=e.nsecs!==undefined?e.nsecs:v+1,c=a-h+(s-v)/1e4;if(c<0&&e.clockseq===undefined&&(u=u+1&16383),(c<0||a>h)&&e.nsecs===undefined&&(s=0),s>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");h=a,v=s,p=u,a+=122192928e5;var f=(1e4*(268435455&a)+s)%4294967296;i[r++]=f>>>24&255,i[r++]=f>>>16&255,i[r++]=f>>>8&255,i[r++]=255&f;var d=a/4294967296*1e4&268435455;i[r++]=d>>>8&255,i[r++]=255&d,i[r++]=d>>>24&15|16,i[r++]=d>>>16&255,i[r++]=u>>>8|128,i[r++]=255&u;for(var m=e.node||l,w=0;w<6;w++)i[r+w]=m[w];return t||o(i)}function u(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null),e=e||{};var i=e.random||(e.rng||a)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t)for(var u=0;u<16;u++)t[r+u]=i[u];return t||o(i)}for(var a=n(3),s=[],c={},f=0;f<256;f++)s[f]=(f+256).toString(16).substr(1),c[s[f]]=f;var d=a(),l=[1|d[0],d[1],d[2],d[3],d[4],d[5]],p=16383&(d[6]<<8|d[7]),h=0,v=0,m=u;m.v1=i,m.v4=u,m.parse=r,m.unparse=o,e.exports=m},function(e,t){(function(t){var n,r=t.crypto||t.msCrypto;if(r&&r.getRandomValues){var o=new Uint8Array(16);n=function(){return r.getRandomValues(o),o}}if(!n){var i=new Array(16);n=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}e.exports=n}).call(t,function(){return this}())},function(e,t,n){var r;!function(o){function i(e,t,n){var r,o,i,u,a,v,m,w,y,g=0,b=[],A=0,E=!1,T=[],x=[],S=!1;if(n=n||{},r=n.encoding||"UTF8",(y=n.numRounds||1)!==parseInt(y,10)||1>y)throw Error("numRounds must a integer >= 1");if(0!==e.lastIndexOf("SHA-",0))throw Error("Chosen SHA variant is not supported");if(v=function(t,n){return I(t,n,e)},m=function(t,n,r,o){var i,u;if("SHA-224"!==e&&"SHA-256"!==e)throw Error("Unexpected error in SHA-2 implementation");for(i=15+(n+65>>>9<<4),u=16;t.length<=i;)t.push(0);for(t[n>>>5]|=128<<24-n%32,n+=r,t[i]=4294967295&n,t[i-1]=n/4294967296|0,r=t.length,n=0;n<r;n+=u)o=I(t.slice(n,n+u),o,e);if("SHA-224"===e)t=[o[0],o[1],o[2],o[3],o[4],o[5],o[6]];else{if("SHA-256"!==e)throw Error("Unexpected error in SHA-2 implementation");t=o}return t},w=function(e){return e.slice()},"SHA-224"===e)a=512,u=224;else{if("SHA-256"!==e)throw Error("Chosen SHA variant is not supported");a=512,u=256}i=h(t,r),o=_(e),this.setHMACKey=function(t,n,i){var u;if(!0===E)throw Error("HMAC key already set");if(!0===S)throw Error("Cannot set HMAC key after calling update");for(r=(i||{}).encoding||"UTF8",n=h(n,r)(t),t=n.binLen,n=n.value,u=a>>>3,i=u/4-1,u<t/8&&(n=m(n,t,0,_(e)));n.length<=i;)n.push(0);for(t=0;t<=i;t+=1)T[t]=909522486^n[t],x[t]=1549556828^n[t];o=v(T,o),g=a,E=!0},this.update=function(e){var t,n,r,u=0,s=a>>>5;for(t=i(e,b,A),e=t.binLen,n=t.value,t=e>>>5,r=0;r<t;r+=s)u+a<=e&&(o=v(n.slice(r,r+s),o),u+=a);g+=u,b=n.slice(u>>>5),A=e%a,S=!0},this.getHash=function(t,n){var r,i,a,h;if(!0===E)throw Error("Cannot call getHash after setting HMAC key");switch(a=p(n),t){case"HEX":r=function(e){return s(e,u,a)};break;case"B64":r=function(e){return c(e,u,a)};break;case"BYTES":r=function(e){return f(e,u)};break;case"ARRAYBUFFER":try{i=new ArrayBuffer(0)}catch(v){throw Error("ARRAYBUFFER not supported by this environment")}r=function(e){return d(e,u)};break;case"UINT8ARRAY":try{i=new Uint8Array(0)}catch(v){throw Error("UINT8ARRAY not supported by this environment")}r=function(e){return l(e,u)};break;default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}for(h=m(b.slice(),A,g,w(o)),i=1;i<y;i+=1)h=m(h,u,0,_(e));return r(h)},this.getHMAC=function(t,n){var r,i,h,y;if(!1===E)throw Error("Cannot call getHMAC without first setting HMAC key");switch(h=p(n),t){case"HEX":r=function(e){return s(e,u,h)};break;case"B64":r=function(e){return c(e,u,h)};break;case"BYTES":r=function(e){return f(e,u)};break;case"ARRAYBUFFER":try{r=new ArrayBuffer(0)}catch(T){throw Error("ARRAYBUFFER not supported by this environment")}r=function(e){return d(e,u)};break;case"UINT8ARRAY":try{r=new Uint8Array(0)}catch(T){throw Error("UINT8ARRAY not supported by this environment")}r=function(e){return l(e,u)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}return i=m(b.slice(),A,g,w(o)),y=v(x,_(e)),y=m(i,u,a,y),r(y)}}function u(){}function a(e,t,n){var r,o,i,u;for(t=t||[0],n=n||0,o=n>>>3,r=0;r<e.length;r+=1)u=r+o,i=u>>>2,t.length<=i&&t.push(0),t[i]|=e[r]<<8*(3+u%4*-1);return{value:t,binLen:8*e.length+n}}function s(e,t,n){var r="";t/=8;var o,i;for(o=0;o<t;o+=1)i=e[o>>>2]>>>8*(3+o%4*-1),r+="0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i);return n.outputUpper?r.toUpperCase():r}function c(e,t,n){var r,o,i,u="",a=t/8;for(r=0;r<a;r+=3)for(o=r+1<a?e[r+1>>>2]:0,i=r+2<a?e[r+2>>>2]:0,i=(e[r>>>2]>>>8*(3+r%4*-1)&255)<<16|(o>>>8*(3+(r+1)%4*-1)&255)<<8|i>>>8*(3+(r+2)%4*-1)&255,o=0;4>o;o+=1)u+=8*r+6*o<=t?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(i>>>6*(3-o)&63):n.b64Pad;return u}function f(e,t){var n,r,o="",i=t/8;for(n=0;n<i;n+=1)r=e[n>>>2]>>>8*(3+n%4*-1)&255,o+=String.fromCharCode(r);return o}function d(e,t){var n,r,o=t/8,i=new ArrayBuffer(o);for(r=new Uint8Array(i),n=0;n<o;n+=1)r[n]=e[n>>>2]>>>8*(3+n%4*-1)&255;return i}function l(e,t){var n,r=t/8,o=new Uint8Array(r);for(n=0;n<r;n+=1)o[n]=e[n>>>2]>>>8*(3+n%4*-1)&255;return o}function p(e){var t={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(e=e||{},t.outputUpper=e.outputUpper||!1,!0===e.hasOwnProperty("b64Pad")&&(t.b64Pad=e.b64Pad),"boolean"!=typeof t.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof t.b64Pad)throw Error("Invalid b64Pad formatting option");return t}function h(e,t){var n;switch(t){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(e){case"HEX":n=function(e,t,n){var r,o,i,u,a,s=e.length;if(0!=s%2)throw Error("String of HEX type must be in byte increments");for(t=t||[0],n=n||0,a=n>>>3,r=0;r<s;r+=2){if(o=parseInt(e.substr(r,2),16),isNaN(o))throw Error("String of HEX type contains invalid characters");for(u=(r>>>1)+a,i=u>>>2;t.length<=i;)t.push(0);t[i]|=o<<8*(3+u%4*-1)}return{value:t,binLen:4*s+n}};break;case"TEXT":n=function(e,n,r){var o,i,u,a,s,c,f,d,l=0;if(n=n||[0],r=r||0,s=r>>>3,"UTF8"===t)for(d=3,u=0;u<e.length;u+=1)for(o=e.charCodeAt(u),i=[],128>o?i.push(o):2048>o?(i.push(192|o>>>6),i.push(128|63&o)):55296>o||57344<=o?i.push(224|o>>>12,128|o>>>6&63,128|63&o):(u+=1,o=65536+((1023&o)<<10|1023&e.charCodeAt(u)),i.push(240|o>>>18,128|o>>>12&63,128|o>>>6&63,128|63&o)),a=0;a<i.length;a+=1){for(f=l+s,c=f>>>2;n.length<=c;)n.push(0);n[c]|=i[a]<<8*(d+f%4*-1),l+=1}else if("UTF16BE"===t||"UTF16LE"===t)for(d=2,i="UTF16LE"===t&&!0||"UTF16LE"!==t&&!1,u=0;u<e.length;u+=1){for(o=e.charCodeAt(u),!0===i&&(a=255&o,o=a<<8|o>>>8),f=l+s,c=f>>>2;n.length<=c;)n.push(0);n[c]|=o<<8*(d+f%4*-1),l+=2}return{value:n,binLen:8*l+r}};break;case"B64":n=function(e,t,n){var r,o,i,u,a,s,c,f=0;if(-1===e.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(o=e.indexOf("="),e=e.replace(/\=/g,""),-1!==o&&o<e.length)throw Error("Invalid '=' found in base-64 string");for(t=t||[0],n=n||0,s=n>>>3,o=0;o<e.length;o+=4){for(a=e.substr(o,4),i=u=0;i<a.length;i+=1)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(i)),u|=r<<18-6*i;for(i=0;i<a.length-1;i+=1){for(c=f+s,r=c>>>2;t.length<=r;)t.push(0);t[r]|=(u>>>16-8*i&255)<<8*(3+c%4*-1),f+=1}}return{value:t,binLen:8*f+n}};break;case"BYTES":n=function(e,t,n){var r,o,i,u,a;for(t=t||[0],n=n||0,i=n>>>3,o=0;o<e.length;o+=1)r=e.charCodeAt(o),a=o+i,u=a>>>2,t.length<=u&&t.push(0),t[u]|=r<<8*(3+a%4*-1);return{value:t,binLen:8*e.length+n}};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(r){throw Error("ARRAYBUFFER not supported by this environment")}n=function(e,t,n){return a(new Uint8Array(e),t,n)};break;case"UINT8ARRAY":try{n=new Uint8Array(0)}catch(r){throw Error("UINT8ARRAY not supported by this environment")}n=function(e,t,n){return a(e,t,n)};break;default:throw Error("format must be HEX, TEXT, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}return n}function v(e,t){return e>>>t|e<<32-t}function m(e,t,n){return e&t^~e&n}function w(e,t,n){return e&t^e&n^t&n}function y(e){return v(e,2)^v(e,13)^v(e,22)}function g(e){return v(e,6)^v(e,11)^v(e,25)}function b(e){return v(e,7)^v(e,18)^e>>>3}function A(e){return v(e,17)^v(e,19)^e>>>10}function E(e,t){var n=(65535&e)+(65535&t);return((e>>>16)+(t>>>16)+(n>>>16)&65535)<<16|65535&n}function T(e,t,n,r){var o=(65535&e)+(65535&t)+(65535&n)+(65535&r);return((e>>>16)+(t>>>16)+(n>>>16)+(r>>>16)+(o>>>16)&65535)<<16|65535&o}function x(e,t,n,r,o){var i=(65535&e)+(65535&t)+(65535&n)+(65535&r)+(65535&o);return((e>>>16)+(t>>>16)+(n>>>16)+(r>>>16)+(o>>>16)+(i>>>16)&65535)<<16|65535&i}function _(e){var t,n=[];if(0!==e.lastIndexOf("SHA-",0))throw Error("No SHA variants supported");switch(n=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],t=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],e){case"SHA-224":break;case"SHA-256":n=t;break;case"SHA-384":case"SHA-512":n=[new u,new u,new u,new u,new u,new u,new u,new u];break;default:throw Error("Unknown SHA variant")}return n}function I(e,t,n){var r,o,i,u,a,s,c,f,d,l,p,h,v,_,I,R,k,C,U,O,H,P,B,F=[];if("SHA-224"!==n&&"SHA-256"!==n)throw Error("Unexpected error in SHA-2 implementation");for(l=64,h=1,P=Number,v=E,_=T,I=x,R=b,k=A,C=y,U=g,H=w,O=m,B=S,n=t[0],r=t[1],o=t[2],i=t[3],u=t[4],a=t[5],s=t[6],c=t[7],p=0;p<l;p+=1)16>p?(d=p*h,f=e.length<=d?0:e[d],d=e.length<=d+1?0:e[d+1],F[p]=new P(f,d)):F[p]=_(k(F[p-2]),F[p-7],R(F[p-15]),F[p-16]),f=I(c,U(u),O(u,a,s),B[p],F[p]),d=v(C(n),H(n,r,o)),c=s,s=a,a=u,u=v(i,f),i=o,o=r,r=n,n=v(f,d);return t[0]=v(n,t[0]),t[1]=v(r,t[1]),t[2]=v(o,t[2]),t[3]=v(i,t[3]),t[4]=v(u,t[4]),t[5]=v(a,t[5]),t[6]=v(s,t[6]),t[7]=v(c,t[7]),t}var S;S=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],(r=function(){return i}.call(t,n,t,e))!==undefined&&(e.exports=r)}()},function(e,t,n){var r,o;!function(i){var u;if(r=i,(o="function"==typeof r?r.call(t,n,t,e):r)!==undefined&&(e.exports=o),u=!0,e.exports=i(),u=!0,!u){var a=window.Cookies,s=window.Cookies=i();s.noConflict=function(){return window.Cookies=a,s}}}(function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}function n(r){function o(){}function i(t,n,i){if("undefined"!=typeof document){i=e({path:"/"},o.defaults,i),"number"==typeof i.expires&&(i.expires=new Date(1*new Date+864e5*i.expires)),i.expires=i.expires?i.expires.toUTCString():"";try{var u=JSON.stringify(n);/^[\{\[]/.test(u)&&(n=u)}catch(c){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var a="";for(var s in i)i[s]&&(a+="; "+s,!0!==i[s]&&(a+="="+i[s].split(";")[0]));return document.cookie=t+"="+n+a}}function u(e,n){if("undefined"!=typeof document){for(var o={},i=document.cookie?document.cookie.split("; "):[],u=0;u<i.length;u++){var a=i[u].split("="),s=a.slice(1).join("=");n||'"'!==s.charAt(0)||(s=s.slice(1,-1));try{var c=t(a[0]);if(s=(r.read||r)(s,c)||t(s),n)try{s=JSON.parse(s)}catch(f){}if(o[c]=s,e===c)break}catch(f){}}return e?o[e]:o}}return o.set=i,o.get=function(e){return u(e,!1)},o.getJSON=function(e){return u(e,!0)},o.remove=function(t,n){i(t,"",e(n,{expires:-1}))},o.defaults={},o.withConverter=n,o}return n(function(){})})},function(e,t,n){(function(t,r){!function(t,n){e.exports=n()}(0,function(){"use strict";function e(e){return"function"==typeof e||"object"==typeof e&&null!==e}function o(e){return"function"==typeof e}function i(e){J=e}function u(e){G=e}function a(){return function(){q(c)}}function s(){var e=setTimeout;return function(){return e(c,1)}}function c(){for(var e=0;e<X;e+=2){(0,Q[e])(Q[e+1]),Q[e]=undefined,Q[e+1]=undefined}X=0}function f(e,t){var n=arguments,r=this,o=new this.constructor(l);o[ee]===undefined&&U(o);var i=r._state;return i?function(){var e=n[i-1];G(function(){return R(i,o,e,r._result)})}():x(r,o,e,t),o}function d(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(l);return b(n,e),n}function l(){}function p(){return new TypeError("You cannot resolve a promise with itself")}function h(){return new TypeError("A promises callback cannot return that same promise.")}function v(e){try{return e.then}catch(t){return oe.error=t,oe}}function m(e,t,n,r){try{e.call(t,n,r)}catch(o){return o}}function w(e,t,n){G(function(e){var r=!1,o=m(n,t,function(n){r||(r=!0,t!==n?b(e,n):E(e,n))},function(t){r||(r=!0,T(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&o&&(r=!0,T(e,o))},e)}function y(e,t){t._state===ne?E(e,t._result):t._state===re?T(e,t._result):x(t,undefined,function(t){return b(e,t)},function(t){return T(e,t)})}function g(e,t,n){t.constructor===e.constructor&&n===f&&t.constructor.resolve===d?y(e,t):n===oe?T(e,oe.error):n===undefined?E(e,t):o(n)?w(e,t,n):E(e,t)}function b(t,n){t===n?T(t,p()):e(n)?g(t,n,v(n)):E(t,n)}function A(e){e._onerror&&e._onerror(e._result),_(e)}function E(e,t){e._state===te&&(e._result=t,e._state=ne,0!==e._subscribers.length&&G(_,e))}function T(e,t){e._state===te&&(e._state=re,e._result=t,G(A,e))}function x(e,t,n,r){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+ne]=n,o[i+re]=r,0===i&&e._state&&G(_,e)}function _(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r=undefined,o=undefined,i=e._result,u=0;u<t.length;u+=3)r=t[u],o=t[u+n],r?R(n,r,o,i):o(i);e._subscribers.length=0}}function I(){this.error=null}function S(e,t){try{return e(t)}catch(n){return ie.error=n,ie}}function R(e,t,n,r){var i=o(n),u=undefined,a=undefined,s=undefined,c=undefined;if(i){if(u=S(n,r),u===ie?(c=!0,a=u.error,u=null):s=!0,t===u)return void T(t,h())}else u=r,s=!0;t._state!==te||(i&&s?b(t,u):c?T(t,a):e===ne?E(t,u):e===re&&T(t,u))}function k(e,t){try{t(function(t){b(e,t)},function(t){T(e,t)})}catch(n){T(e,n)}}function C(){return ue++}function U(e){e[ee]=ue++,e._state=undefined,e._result=undefined,e._subscribers=[]}function O(e,t){this._instanceConstructor=e,this.promise=new e(l),this.promise[ee]||U(this.promise),D(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?E(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&E(this.promise,this._result))):T(this.promise,H())}function H(){return new Error("Array Methods must be provided an Array")}function P(e){return new O(this,e).promise}function B(e){var t=this;return new t(D(e)?function(n,r){for(var o=e.length,i=0;i<o;i++)t.resolve(e[i]).then(n,r)}:function(e,t){return t(new TypeError("You must pass an array to race."))})}function F(e){var t=this,n=new t(l);return T(n,e),n}function j(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function L(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function N(e){this[ee]=C(),this._result=this._state=undefined,this._subscribers=[],l!==e&&("function"!=typeof e&&j(),this instanceof N?k(this,e):L())}function Y(){var e=undefined;if(void 0!==r)e=r;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(o){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var n=null;try{n=Object.prototype.toString.call(t.resolve())}catch(o){}if("[object Promise]"===n&&!t.cast)return}e.Promise=N}var M=undefined;M=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var D=M,X=0,q=undefined,J=undefined,G=function(e,t){Q[X]=e,Q[X+1]=t,2===(X+=2)&&(J?J(c):$())},z="undefined"!=typeof window?window:undefined,K=z||{},V=K.MutationObserver||K.WebKitMutationObserver,W="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),Z="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,Q=new Array(1e3),$=undefined;$=W?function(){return function(){return t.nextTick(c)}}():V?function(){var e=0,t=new V(c),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}():Z?function(){var e=new MessageChannel;return e.port1.onmessage=c,function(){return e.port2.postMessage(0)}}():z===undefined?function(){try{var e=n(8);return q=e.runOnLoop||e.runOnContext,a()}catch(t){return s()}}():s();var ee=Math.random().toString(36).substring(16),te=void 0,ne=1,re=2,oe=new I,ie=new I,ue=0;return O.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===te&&n<e;n++)this._eachEntry(t[n],n)},O.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===d){var o=v(e);if(o===f&&e._state!==te)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(n===N){var i=new n(l);g(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},O.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===te&&(this._remaining--,e===re?T(r,n):this._result[t]=n),0===this._remaining&&E(r,this._result)},O.prototype._willSettleAt=function(e,t){var n=this;x(e,undefined,function(e){return n._settledAt(ne,t,e)},function(e){return n._settledAt(re,t,e)})},N.all=P,N.race=B,N.resolve=d,N.reject=F,N._setScheduler=i,N._setAsap=u,N._asap=G,N.prototype={constructor:N,then:f,"catch":function(e){return this.then(null,e)}},Y(),N.polyfill=Y,N.Promise=N,N})}).call(t,n(7),function(){return this}())},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(f===setTimeout)return setTimeout(e,0);if((f===n||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(d===clearTimeout)return clearTimeout(e);if((d===r||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function u(){v&&p&&(v=!1,p.length?h=p.concat(h):m=-1,h.length&&a())}function a(){if(!v){var e=o(u);v=!0;for(var t=h.length;t;){for(p=h,h=[];++m<t;)p&&p[m].run();m=-1,t=h.length}p=null,v=!1,i(e)}}function s(e,t){this.fun=e,this.array=t}function c(){}var f,d,l=e.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:n}catch(e){f=n}try{d="function"==typeof clearTimeout?clearTimeout:r}catch(e){d=r}}();var p,h=[],v=!1,m=-1;l.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];h.push(new s(e,t)),1!==h.length||v||o(a)},s.prototype.run=function(){this.fun.apply(null,this.array)},l.title="browser",l.browser=!0,l.env={},l.argv=[],l.version="",l.versions={},l.on=c,l.addListener=c,l.once=c,l.off=c,l.removeListener=c,l.removeAllListeners=c,l.emit=c,l.prependListener=c,l.prependOnceListener=c,l.listeners=function(e){return[]},l.binding=function(e){throw new Error("process.binding is not supported")},l.cwd=function(){return"/"},l.chdir=function(e){throw new Error("process.chdir is not supported")},l.umask=function(){return 0}},function(e,t){}])});
{
"name": "@contactlab/sdk-browser",
"version": "1.0.0",
"version": "1.1.0",
"description": "Contacthub Tracking Script",

@@ -16,3 +16,3 @@ "main": "dist/sdk.js",

"flow": "flow",
"example": "opn 'http://127.0.0.1.xip.io:8080/example/?workspaceId=WORKSPACE_ID&nodeId=NODE_ID&token=TOKEN' && http-server",
"example": "opn 'http://127.0.0.1:8080/example/?workspaceId=WORKSPACE_ID&nodeId=NODE_ID&token=TOKEN' && http-server",
"package": "npm run build && zip -j dist/contacthub-$(git tag | tail -n 1).zip dist/*js",

@@ -19,0 +19,0 @@ "webpack": "webpack",

@@ -140,3 +140,7 @@ [![Build Status](https://travis-ci.org/contactlab/contacthub-sdk-browser.svg?branch=master)](https://travis-ci.org/contactlab/contacthub-sdk-browser)

Since v1.0.0 of this library, `utm_` tags from Google Analytics are also
automatically detected from the query string, stored in the ContactHub cookie
and attached automatically to all ContactHub Events.
## Advanced usage

@@ -168,3 +172,2 @@

#### Renaming the ContactHub cookie

@@ -186,2 +189,38 @@

#### ContactHub ID
Every Customer is assigned an id in ContactHub. In general, you don't have to
think about it as the library will take care of it and avoid generating multiple
IDs for the same Customer.
If you store ContactHub ids on your database and you want to make sure that
events sent via the library are associated to the same id, you can specify the
ID when you use the `ch('customer', {...})` method:
```js
ch('customer', {
id: 'A_VALID_CONTACTHUB_ID',
...other customer properties...
});
```
#### The clabId query parameter
You can also send a ContactHub id using the `clabId` parameter in the query
string (`?clabId=A_VALID_CONTACTHUB_ID`). This is transformed by the library in
the following call:
```js
ch('customer', { id: clabId });
```
An example use case is if you send a newsletter to your customers and you want
to make sure that if they reach your website from a link contained in the email,
they are immediately recognised even if they are not logged in.
Please note that if a different user is logged in, the Contacthub id for the
currently logged in user is stored in the Contacthub cookie. The id contained in
the Contacthub cookie always takes precedence over an id specified using the
`clabId` query string parameter.
## Contributing to this library

@@ -188,0 +227,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc