@contactlab/sdk-browser
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -5,2 +5,10 @@ # Change Log | ||
## [v1.3.0](https://github.com/contactlab/contacthub-sdk-browser/tree/v1.3.0) (2018-05-25) | ||
[Full Changelog](https://github.com/contactlab/contacthub-sdk-browser/compare/v1.2.0...v1.3.0) | ||
#### New features: | ||
- Reset cookie if token changes [#40](https://github.com/contactlab/contacthub-sdk-browser/issues/40) | ||
- Expire utm information after 30 minutes [#39](https://github.com/contactlab/contacthub-sdk-browser/issues/39) | ||
## [v1.2.0](https://github.com/contactlab/contacthub-sdk-browser/tree/v1.2.0) (2018-04-30) | ||
@@ -7,0 +15,0 @@ [Full Changelog](https://github.com/contactlab/contacthub-sdk-browser/compare/v1.1.1...v1.2.0) |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ContactlabSDKBrowser=e():t.ContactlabSDKBrowser=e()}(window,function(){return function(r){var n={};function o(t){if(n[t])return n[t].exports;var e=n[t]={i:t,l:!1,exports:{}};return r[t].call(e.exports,e,e.exports,o),e.l=!0,e.exports}return o.m=r,o.c=n,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},o.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=0)}([function(t,e,r){"use strict";var H=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},U=o(r(1)),n=o(r(2)),P=o(r(7)),j=o(r(8)),B=r(9);function o(t){return t&&t.__esModule?t:{default:t}}U.default.configure({promise:function(t){return new B.Promise(t)}});var i=window.ContactHubObject||"ch",F=window.ContactHubCookie||"_ch",L=window.ContactHubAPI||"https://api.contactlab.it/hub/v1",u=function(t){var e=RegExp("[?&]"+t+"=([^&]*)").exec(window.location.search);return e&&decodeURIComponent(e[1].replace(/\+/g," "))||void 0},a=function(){return n.default.v4()},M=function(){var t=j.default.getJSON(F);if(!t)throw new Error("Missing required ContactHub configuration.");if(!(t.workspaceId&&t.nodeId&&t.token))throw new Error("Missing required ContactHub configuration.");return t},s=function(t){var e=M(),r=e.workspaceId,n=e.nodeId,o=e.token,i=e.context,u=e.contextInfo,a=e.sid,s=e.customerId,c=e.ga,f=t.type,d=t.properties;if(!f)throw new Error("Missing required event type");var l=function(t,e){if("viewedPage"===t){var r={title:document.title,url:window.location.href,path:window.location.pathname,referer:document.referrer};return H(r,e)}return H({},e)}(f,d),p=c?{ga:c}:void 0,h=s?void 0:{type:"SESSION_ID",value:a,nodeId:n};(0,U.default)({method:"POST",url:L+"/workspaces/"+r+"/events",data:{type:f,context:i,contextInfo:u,properties:l,tracking:p,customerId:s,bringBackProperties:h},headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+o}})},N=function(t){var e=t.customerId,r=t.workspaceId,n=t.token,o=t.externalId,i=t.base,u=t.extended,a=t.consents,s=t.extra,c=t.tags;return(0,U.default)({method:"PATCH",url:L+"/workspaces/"+r+"/customers/"+e,headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+n},data:{externalId:o,base:i,extended:u,consents:a,extra:s,tags:c}}).then(function(){return e})},Y=function(){j.default.set(F,H(M(),{sid:a(),customerId:void 0,hash:void 0}))},c=function(t){if(t){var e,r,n,o,i,u,a,s,c,f,d,l,p,h,v=M(),m=v.workspaceId,w=v.nodeId,y=v.token,b=v.customerId,g=v.hash,A=t.id,E=t.externalId,x=t.base,T=t.extended,_=t.consents,S=t.extra,I=t.tags,C=(e={base:x,extended:T,consents:_,extra:S,tags:I,externalId:E},(r=new P.default("SHA-256","TEXT")).update(JSON.stringify(e)),r.getHash("HEX")),k=function(t){return E||x||T||_||S||I?N({customerId:t,workspaceId:m,nodeId:w,token:y,externalId:E,base:x,extended:T,consents:_,extra:S,tags:I}):B.Promise.resolve(t)},O=function(t){return r=(e={customerId:t,workspaceId:m,token:y,nodeId:w}).customerId,n=e.workspaceId,o=e.token,(0,U.default)({method:"POST",url:L+"/workspaces/"+n+"/customers/"+r+"/sessions",headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+o},data:{value:M().sid}}).then(function(){return r});var e,r,n,o},R=function(t){return j.default.set(F,H(M(),{customerId:t,hash:C})),t};if(g!==C)A&&b?(p=A,h=b,p===h?B.Promise.resolve(p):E||x||T||_||S||I?(Y(),O(p)):B.Promise.reject("The provided id conflicts with the id stored in the cookie")).then(k).then(R):A?O(A).then(k).then(R):b?k(b).then(R):(o=(n={workspaceId:m,nodeId:w,token:y,externalId:E,base:x,extended:T,consents:_,extra:S,tags:I}).workspaceId,i=n.nodeId,u=n.token,a=n.externalId,s=n.base,c=n.extended,f=n.consents,d=n.extra,l=n.tags,(0,U.default)({method:"POST",url:L+"/workspaces/"+o+"/customers",headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+u},data:{nodeId:i,externalId:a,base:s,extended:c,consents:f,extra:d,tags:l}}).then(function(t){return t.data.id})).catch(function(t){if(409===t.status){var e=JSON.parse(t.response).data.customer.id;return N({customerId:e,workspaceId:m,nodeId:w,token:y,externalId:E,base:x,extended:T,consents:_,extra:S,tags:I})}return B.Promise.reject(t)}).then(R).then(O)}else Y()},f=["token","workspaceId","nodeId","context","contextInfo"],d=function(r){var t=j.default.getJSON(F)||{},e=u("utm_source");e&&(t.ga={utm_source:e,utm_medium:u("utm_medium"),utm_term:u("utm_term"),utm_content:u("utm_content"),utm_campaign:u("utm_campaign")}),t.sid=t.sid||a();var n=Object.keys(r).filter(function(t){return-1!==f.indexOf(t)}).reduce(function(t,e){return t[e]=r[e],t},{});H(t,n),t.context=t.context||"WEB",t.contextInfo=t.contextInfo||{},j.default.set(F,t,{expires:365});var o=u("clabId");o&&c({id:o})},l=function(t,e){if(Array.prototype.map){var r={config:d,customer:c,event:s};t in r&&r[t].call(void 0,e)}};window[i]&&window[i].q&&(Array.prototype.map&&window[i].q.map(function(t){return l(t[0],t[1])}));window[i]=l},function(t,e,r){t.exports=function(r){function n(t){if(o[t])return o[t].exports;var e=o[t]={exports:{},id:t,loaded:!1};return r[t].call(e.exports,e,e.exports,n),e.loaded=!0,e.exports}var o={};return n.m=r,n.c=o,n.p="/",n(0)}([function(t,e,r){t.exports=r(1)},function(t,e,r){"use strict";function s(t,e){return{status:t.status,response:t.response,data:e,xhr:t}}function c(t){for(var e=arguments.length,r=Array(1<e?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];for(var o in r)if({}.hasOwnProperty.call(r,o)){var i=r[o];if("object"===(void 0===i?"undefined":f(i)))for(var u in i)({}).hasOwnProperty.call(i,u)&&(t[u]=i[u])}return t}function n(a){return e=function(e,r){var n=c({},h,v,a),o=n.xmlHttpRequest();for(var t in o.withCredentials=n.withCredentials,n.abort&&a.abort(function(){r(s(o)),o.abort()}),o.open(n.method,n.params?n.url.split("?")[0]+"?"+(0,d.default)(n.params):n.url,!0),o.addEventListener(l.LOAD,function(){if(200<=o.status&&o.status<300){var t=null;o.responseText&&(t=!0===n.raw?o.responseText:n.load(o.responseText)),e(s(o,t))}else r(s(o))}),o.addEventListener(l.ABORT,function(){return r(s(o))}),o.addEventListener(l.ERROR,function(){return r(s(o))}),o.addEventListener(l.TIMEOUT,function(){return r(s(o))}),n.headers)({}).hasOwnProperty.call(n.headers,t)&&o.setRequestHeader(t,n.headers[t]);for(var i in n.events)({}).hasOwnProperty.call(n.events,i)&&o.addEventListener(i,n.events[i].bind(null,o),!1);var u="object"!==f(n.data)||n.raw?n.data:n.dump(n.data);void 0!==u?o.send(u):o.send()},((t=a)&&t.promise?t.promise:v.promise||h.promise)(e);var t,e}e.__esModule=!0;var o,f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},i=r(2),d=(o=i)&&o.__esModule?o:{default:o},u={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"},a="undefined"==typeof JSON?function(){}:JSON.stringify,p="undefined"==typeof JSON?function(){}:JSON.parse,h={method:u.GET,data:void 0,headers:{Accept:"application/json","Content-Type":"application/json"},dump:a,load:p,xmlHttpRequest:function(){return new XMLHttpRequest},promise:function(t){return new Promise(t)},withCredentials:!1},v={};n.assign=c,n.encode=d.default,n.configure=function(t){v=c({},v,t)},n.Methods=u,n.Events=l,n.defaults=h,n.get=function(t,e,r){return n(c({url:t,method:u.GET,params:e},r))},n.put=function(t,e,r){return n(c({url:t,method:u.PUT,data:e},r))},n.post=function(t,e,r){return n(c({url:t,method:u.POST,data:e},r))},n.patch=function(t,e,r){return n(c({url:t,method:u.PATCH,data:e},r))},n.del=function(t,e){return n(c({url:t,method:u.DELETE},e))},n.options=function(t,e){return n(c({url:t,method:u.OPTIONS},e))},e.default=n},function(t,e){"use strict";var i=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(r,n,o,t){return n=n||"&",o=o||"=",null===r&&(r=void 0),"object"==typeof r?Object.keys(r).map(function(t){var e=encodeURIComponent(i(t))+o;return Array.isArray(r[t])?r[t].map(function(t){return e+encodeURIComponent(i(t))}).join(n):e+encodeURIComponent(i(r[t]))}).join(n):t?encodeURIComponent(i(t))+o+encodeURIComponent(i(r)):""}}])},function(t,e,r){var n=r(3),o=r(6),i=o;i.v1=n,i.v4=o,t.exports=i},function(t,e,r){var h,v,m=r(4),w=r(5),y=0,b=0;t.exports=function(t,e,r){var n=e&&r||0,o=e||[],i=(t=t||{}).node||h,u=void 0!==t.clockseq?t.clockseq:v;if(null==i||null==u){var a=m();null==i&&(i=h=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==u&&(u=v=16383&(a[6]<<8|a[7]))}var s=void 0!==t.msecs?t.msecs:(new Date).getTime(),c=void 0!==t.nsecs?t.nsecs:b+1,f=s-y+(c-b)/1e4;if(f<0&&void 0===t.clockseq&&(u=u+1&16383),(f<0||y<s)&&void 0===t.nsecs&&(c=0),1e4<=c)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");y=s,v=u;var d=(1e4*(268435455&(s+=122192928e5))+(b=c))%4294967296;o[n++]=d>>>24&255,o[n++]=d>>>16&255,o[n++]=d>>>8&255,o[n++]=255&d;var l=s/4294967296*1e4&268435455;o[n++]=l>>>8&255,o[n++]=255&l,o[n++]=l>>>24&15|16,o[n++]=l>>>16&255,o[n++]=u>>>8|128,o[n++]=255&u;for(var p=0;p<6;++p)o[n+p]=i[p];return e||w(o)}},function(t,e){var r="undefined"!=typeof crypto&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&msCrypto.getRandomValues.bind(msCrypto);if(r){var n=new Uint8Array(16);t.exports=function(){return r(n),n}}else{var o=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),o[e]=t>>>((3&e)<<3)&255;return o}}},function(t,e){for(var o=[],r=0;r<256;++r)o[r]=(r+256).toString(16).substr(1);t.exports=function(t,e){var r=e||0,n=o;return n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]}},function(t,e,r){var u=r(4),a=r(5);t.exports=function(t,e,r){var n=e&&r||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var o=(t=t||{}).random||(t.rng||u)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e)for(var i=0;i<16;++i)e[n+i]=o[i];return e||a(o)}},function(o,i,u){"use strict";var a;!function(t){function e(u,t,e){var o,a,s,c,f,d,l,p,h,v=0,m=[],w=0,y=!1,i=[],b=[],g=!1;if(o=(e=e||{}).encoding||"UTF8",(h=e.numRounds||1)!==parseInt(h,10)||h<1)throw Error("numRounds must a integer >= 1");if(0!==u.lastIndexOf("SHA-",0))throw Error("Chosen SHA variant is not supported");if(d=function(t,e){return F(t,e,u)},l=function(t,e,r,n){var o,i;if("SHA-224"!==u&&"SHA-256"!==u)throw Error("Unexpected error in SHA-2 implementation");for(o=15+(e+65>>>9<<4),i=16;t.length<=o;)t.push(0);for(t[e>>>5]|=128<<24-e%32,e+=r,t[o]=4294967295&e,t[o-1]=e/4294967296|0,r=t.length,e=0;e<r;e+=i)n=F(t.slice(e,e+i),n,u);if("SHA-224"===u)t=[n[0],n[1],n[2],n[3],n[4],n[5],n[6]];else{if("SHA-256"!==u)throw Error("Unexpected error in SHA-2 implementation");t=n}return t},p=function(t){return t.slice()},"SHA-224"===u)f=512,c=224;else{if("SHA-256"!==u)throw Error("Chosen SHA variant is not supported");f=512,c=256}s=S(t,o),a=B(u),this.setHMACKey=function(t,e,r){var n;if(!0===y)throw Error("HMAC key already set");if(!0===g)throw Error("Cannot set HMAC key after calling update");if(t=(e=S(e,o=(r||{}).encoding||"UTF8")(t)).binLen,e=e.value,r=(n=f>>>3)/4-1,n<t/8){for(e=l(e,t,0,B(u));e.length<=r;)e.push(0);e[r]&=4294967040}else if(t/8<n){for(;e.length<=r;)e.push(0);e[r]&=4294967040}for(t=0;t<=r;t+=1)i[t]=909522486^e[t],b[t]=1549556828^e[t];a=d(i,a),v=f,y=!0},this.update=function(t){var e,r,n,o=0,i=f>>>5;for(t=(e=s(t,m,w)).binLen,r=e.value,e=t>>>5,n=0;n<e;n+=i)o+f<=t&&(a=d(r.slice(n,n+i),a),o+=f);v+=o,m=r.slice(o>>>5),w=t%f,g=!0},this.getHash=function(t,e){var r,n,o,i;if(!0===y)throw Error("Cannot call getHash after setting HMAC key");switch(o=_(e),t){case"HEX":r=function(t){return A(t,c,o)};break;case"B64":r=function(t){return E(t,c,o)};break;case"BYTES":r=function(t){return x(t,c)};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}r=function(t){return T(t,c)};break;default:throw Error("format must be HEX, B64, BYTES, or ARRAYBUFFER")}for(i=l(m.slice(),w,v,p(a)),n=1;n<h;n+=1)i=l(i,c,0,B(u));return r(i)},this.getHMAC=function(t,e){var r,n,o,i;if(!1===y)throw Error("Cannot call getHMAC without first setting HMAC key");switch(o=_(e),t){case"HEX":r=function(t){return A(t,c,o)};break;case"B64":r=function(t){return E(t,c,o)};break;case"BYTES":r=function(t){return x(t,c)};break;case"ARRAYBUFFER":try{r=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}r=function(t){return T(t,c)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, or ARRAYBUFFER")}return n=l(m.slice(),w,v,p(a)),i=d(b,B(u)),r(i=l(n,c,f,i))}}function n(){}function A(t,e,r){var n,o,i="";for(e/=8,n=0;n<e;n+=1)o=t[n>>>2]>>>8*(3+n%4*-1),i+="0123456789abcdef".charAt(o>>>4&15)+"0123456789abcdef".charAt(15&o);return r.outputUpper?i.toUpperCase():i}function E(t,e,r){var n,o,i,u="",a=e/8;for(n=0;n<a;n+=3)for(o=n+1<a?t[n+1>>>2]:0,i=n+2<a?t[n+2>>>2]:0,i=(t[n>>>2]>>>8*(3+n%4*-1)&255)<<16|(o>>>8*(3+(n+1)%4*-1)&255)<<8|i>>>8*(3+(n+2)%4*-1)&255,o=0;o<4;o+=1)u+=8*n+6*o<=e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(i>>>6*(3-o)&63):r.b64Pad;return u}function x(t,e){var r,n,o="",i=e/8;for(r=0;r<i;r+=1)n=t[r>>>2]>>>8*(3+r%4*-1)&255,o+=String.fromCharCode(n);return o}function T(t,e){var r,n,o=e/8,i=new ArrayBuffer(o);for(n=new Uint8Array(i),r=0;r<o;r+=1)n[r]=t[r>>>2]>>>8*(3+r%4*-1)&255;return i}function _(t){var e={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(t=t||{},e.outputUpper=t.outputUpper||!1,!0===t.hasOwnProperty("b64Pad")&&(e.b64Pad=t.b64Pad),"boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function S(t,l){var e;switch(l){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":e=function(t,e,r){var n,o,i,u,a,s=t.length;if(0!=s%2)throw Error("String of HEX type must be in byte increments");for(e=e||[0],a=(r=r||0)>>>3,n=0;n<s;n+=2){if(o=parseInt(t.substr(n,2),16),isNaN(o))throw Error("String of HEX type contains invalid characters");for(i=(u=(n>>>1)+a)>>>2;e.length<=i;)e.push(0);e[i]|=o<<8*(3+u%4*-1)}return{value:e,binLen:4*s+r}};break;case"TEXT":e=function(t,e,r){var n,o,i,u,a,s,c,f,d=0;if(e=e||[0],a=(r=r||0)>>>3,"UTF8"===l)for(f=3,i=0;i<t.length;i+=1)for(o=[],(n=t.charCodeAt(i))<128?o.push(n):n<2048?(o.push(192|n>>>6),o.push(128|63&n)):n<55296||57344<=n?o.push(224|n>>>12,128|n>>>6&63,128|63&n):(i+=1,n=65536+((1023&n)<<10|1023&t.charCodeAt(i)),o.push(240|n>>>18,128|n>>>12&63,128|n>>>6&63,128|63&n)),u=0;u<o.length;u+=1){for(s=(c=d+a)>>>2;e.length<=s;)e.push(0);e[s]|=o[u]<<8*(f+c%4*-1),d+=1}else if("UTF16BE"===l||"UTF16LE"===l)for(f=2,o="UTF16LE"===l||"UTF16LE"!==l&&!1,i=0;i<t.length;i+=1){for(n=t.charCodeAt(i),!0===o&&(n=(u=255&n)<<8|n>>>8),s=(c=d+a)>>>2;e.length<=s;)e.push(0);e[s]|=n<<8*(f+c%4*-1),d+=2}return{value:e,binLen:8*d+r}};break;case"B64":e=function(t,e,r){var n,o,i,u,a,s,c,f=0;if(-1===t.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(o=t.indexOf("="),t=t.replace(/\=/g,""),-1!==o&&o<t.length)throw Error("Invalid '=' found in base-64 string");for(e=e||[0],s=(r=r||0)>>>3,o=0;o<t.length;o+=4){for(a=t.substr(o,4),i=u=0;i<a.length;i+=1)u|=(n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a[i]))<<18-6*i;for(i=0;i<a.length-1;i+=1){for(n=(c=f+s)>>>2;e.length<=n;)e.push(0);e[n]|=(u>>>16-8*i&255)<<8*(3+c%4*-1),f+=1}}return{value:e,binLen:8*f+r}};break;case"BYTES":e=function(t,e,r){var n,o,i,u,a;for(e=e||[0],i=(r=r||0)>>>3,o=0;o<t.length;o+=1)n=t.charCodeAt(o),u=(a=o+i)>>>2,e.length<=u&&e.push(0),e[u]|=n<<8*(3+a%4*-1);return{value:e,binLen:8*t.length+r}};break;case"ARRAYBUFFER":try{e=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}e=function(t,e,r){var n,o,i,u,a;for(e=e||[0],o=(r=r||0)>>>3,a=new Uint8Array(t),n=0;n<t.byteLength;n+=1)i=(u=n+o)>>>2,e.length<=i&&e.push(0),e[i]|=a[n]<<8*(3+u%4*-1);return{value:e,binLen:8*t.byteLength+r}};break;default:throw Error("format must be HEX, TEXT, B64, BYTES, or ARRAYBUFFER")}return e}function r(t,e){return t>>>e|t<<32-e}function I(t,e,r){return t&e^~t&r}function C(t,e,r){return t&e^t&r^e&r}function k(t){return r(t,2)^r(t,13)^r(t,22)}function O(t){return r(t,6)^r(t,11)^r(t,25)}function R(t){return r(t,7)^r(t,18)^t>>>3}function H(t){return r(t,17)^r(t,19)^t>>>10}function U(t,e){var r=(65535&t)+(65535&e);return((t>>>16)+(e>>>16)+(r>>>16)&65535)<<16|65535&r}function P(t,e,r,n){var o=(65535&t)+(65535&e)+(65535&r)+(65535&n);return((t>>>16)+(e>>>16)+(r>>>16)+(n>>>16)+(o>>>16)&65535)<<16|65535&o}function j(t,e,r,n,o){var i=(65535&t)+(65535&e)+(65535&r)+(65535&n)+(65535&o);return((t>>>16)+(e>>>16)+(r>>>16)+(n>>>16)+(o>>>16)+(i>>>16)&65535)<<16|65535&i}function B(t){var e,r=[];if(0!==t.lastIndexOf("SHA-",0))throw Error("No SHA variants supported");switch(r=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],e=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t){case"SHA-224":break;case"SHA-256":r=e;break;case"SHA-384":case"SHA-512":r=[new n,new n,new n,new n,new n,new n,new n,new n];break;default:throw Error("Unknown SHA variant")}return r}function F(t,e,r){var n,o,i,u,a,s,c,f,d,l,p,h,v,m,w,y,b,g,A,E,x,T,_,S=[];if("SHA-224"!==r&&"SHA-256"!==r)throw Error("Unexpected error in SHA-2 implementation");for(l=64,h=1,T=Number,v=U,m=P,w=j,y=R,b=H,g=k,A=O,x=C,E=I,_=L,r=e[0],n=e[1],o=e[2],i=e[3],u=e[4],a=e[5],s=e[6],c=e[7],p=0;p<l;p+=1)p<16?(d=p*h,f=t.length<=d?0:t[d],d=t.length<=d+1?0:t[d+1],S[p]=new T(f,d)):S[p]=m(b(S[p-2]),S[p-7],y(S[p-15]),S[p-16]),f=w(c,A(u),E(u,a,s),_[p],S[p]),d=v(g(r),x(r,n,o)),c=s,s=a,a=u,u=v(i,f),i=o,o=n,n=r,r=v(f,d);return e[0]=v(r,e[0]),e[1]=v(n,e[1]),e[2]=v(o,e[2]),e[3]=v(i,e[3]),e[4]=v(u,e[4]),e[5]=v(a,e[5]),e[6]=v(s,e[6]),e[7]=v(c,e[7]),e}var L;L=[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],void 0===(a=function(){return e}.call(i,u,i,o))||(o.exports=a)}()},function(n,o,i){var u,a;!function(t){if(void 0===(a="function"==typeof(u=t)?u.call(o,i,o,n):u)||(n.exports=a),!0,n.exports=t(),!!0){var e=window.Cookies,r=window.Cookies=t();r.noConflict=function(){return window.Cookies=e,r}}}(function(){function v(){for(var t=0,e={};t<arguments.length;t++){var r=arguments[t];for(var n in r)e[n]=r[n]}return e}return function t(p){function h(t,e,r){var n;if("undefined"!=typeof document){if(1<arguments.length){if("number"==typeof(r=v({path:"/"},h.defaults,r)).expires){var o=new Date;o.setMilliseconds(o.getMilliseconds()+864e5*r.expires),r.expires=o}r.expires=r.expires?r.expires.toUTCString():"";try{n=JSON.stringify(e),/^[\{\[]/.test(n)&&(e=n)}catch(t){}e=p.write?p.write(e,t):encodeURIComponent(String(e)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=(t=(t=encodeURIComponent(String(t))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape);var i="";for(var u in r)r[u]&&(i+="; "+u,!0!==r[u]&&(i+="="+r[u]));return document.cookie=t+"="+e+i}t||(n={});for(var a=document.cookie?document.cookie.split("; "):[],s=/(%[0-9A-Z]{2})+/g,c=0;c<a.length;c++){var f=a[c].split("="),d=f.slice(1).join("=");this.json||'"'!==d.charAt(0)||(d=d.slice(1,-1));try{var l=f[0].replace(s,decodeURIComponent);if(d=p.read?p.read(d,l):p(d,l)||d.replace(s,decodeURIComponent),this.json)try{d=JSON.parse(d)}catch(t){}if(t===l){n=d;break}t||(n[l]=d)}catch(t){}}return n}}return(h.set=h).get=function(t){return h.call(h,t)},h.getJSON=function(){return h.apply({json:!0},[].slice.call(arguments))},h.defaults={},h.remove=function(t,e){h(t,"",v(e,{expires:-1}))},h.withConverter=t,h}(function(){})})},function(n,o,i){"use strict";(function(N,Y){var t,e,r,D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};r=function(){function c(t){return"function"==typeof t}var r=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},n=0,e=void 0,o=void 0,a=function(t,e){l[n]=t,l[n+1]=e,2===(n+=2)&&(o?o(p):y())};var t="undefined"!=typeof window?window:void 0,i=t||{},u=i.MutationObserver||i.WebKitMutationObserver,s="undefined"==typeof self&&void 0!==N&&"[object process]"==={}.toString.call(N),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(p,1)}}var l=new Array(1e3);function p(){for(var t=0;t<n;t+=2){(0,l[t])(l[t+1]),l[t]=void 0,l[t+1]=void 0}n=0}var h,v,m,w,y=void 0;function b(t,e){var r=this,n=new this.constructor(E);void 0===n[A]&&F(n);var o=r._state;if(o){var i=arguments[o-1];a(function(){return j(o,n,i,r._result)})}else U(r,n,t,e);return n}function g(t){if(t&&"object"===(void 0===t?"undefined":D(t))&&t.constructor===this)return t;var e=new this(E);return k(e,t),e}s?y=function(){return N.nextTick(p)}:u?(v=0,m=new u(p),w=document.createTextNode(""),m.observe(w,{characterData:!0}),y=function(){w.data=v=++v%2}):f?((h=new MessageChannel).port1.onmessage=p,y=function(){return h.port2.postMessage(0)}):y=void 0===t?function(){try{var t=Function("return this")().require("vertx");return void 0!==(e=t.runOnLoop||t.runOnContext)?function(){e(p)}:d()}catch(t){return d()}}():d();var A=Math.random().toString(36).substring(2);function E(){}var x=void 0,T=1,_=2,S={error:null};function I(t){try{return t.then}catch(t){return S.error=t,S}}function C(t,e,r){var n,o,i,u;e.constructor===t.constructor&&r===b&&e.constructor.resolve===g?(i=t,(u=e)._state===T?R(i,u._result):u._state===_?H(i,u._result):U(u,void 0,function(t){return k(i,t)},function(t){return H(i,t)})):r===S?(H(t,S.error),S.error=null):void 0===r?R(t,e):c(r)?(n=e,o=r,a(function(e){var r=!1,t=function(t,e,r,n){try{t.call(e,r,n)}catch(t){return t}}(o,n,function(t){r||(r=!0,n!==t?k(e,t):R(e,t))},function(t){r||(r=!0,H(e,t))},e._label);!r&&t&&(r=!0,H(e,t))},t)):R(t,e)}function k(t,e){var r,n;t===e?H(t,new TypeError("You cannot resolve a promise with itself")):(n=void 0===(r=e)?"undefined":D(r),null===r||"object"!==n&&"function"!==n?R(t,e):C(t,e,I(e)))}function O(t){t._onerror&&t._onerror(t._result),P(t)}function R(t,e){t._state===x&&(t._result=e,t._state=T,0!==t._subscribers.length&&a(P,t))}function H(t,e){t._state===x&&(t._state=_,t._result=e,a(O,t))}function U(t,e,r,n){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+T]=r,o[i+_]=n,0===i&&t._state&&a(P,t)}function P(t){var e=t._subscribers,r=t._state;if(0!==e.length){for(var n=void 0,o=void 0,i=t._result,u=0;u<e.length;u+=3)n=e[u],o=e[u+r],n?j(r,n,o,i):o(i);t._subscribers.length=0}}function j(t,e,r,n){var o=c(r),i=void 0,u=void 0,a=void 0,s=void 0;if(o){if((i=function(t,e){try{return t(e)}catch(t){return S.error=t,S}}(r,n))===S?(s=!0,u=i.error,i.error=null):a=!0,e===i)return void H(e,new TypeError("A promises callback cannot return that same promise."))}else i=n,a=!0;e._state!==x||(o&&a?k(e,i):s?H(e,u):t===T?R(e,i):t===_&&H(e,i))}var B=0;function F(t){t[A]=B++,t._state=void 0,t._result=void 0,t._subscribers=[]}var L=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(E),this.promise[A]||F(this.promise),r(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?R(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&R(this.promise,this._result))):H(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;this._state===x&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,n=r.resolve;if(n===g){var o=I(e);if(o===b&&e._state!==x)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(r===M){var i=new r(E);C(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new r(function(t){return t(e)}),t)}else this._willSettleAt(n(e),t)},t.prototype._settledAt=function(t,e,r){var n=this.promise;n._state===x&&(this._remaining--,t===_?H(n,r):this._result[e]=r),0===this._remaining&&R(n,this._result)},t.prototype._willSettleAt=function(t,e){var r=this;U(t,void 0,function(t){return r._settledAt(T,e,t)},function(t){return r._settledAt(_,e,t)})},t}();var M=function(){function e(t){this[A]=B++,this._result=this._state=void 0,this._subscribers=[],E!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(e,t){try{t(function(t){k(e,t)},function(t){H(e,t)})}catch(t){H(e,t)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(t){return this.then(null,t)},e.prototype.finally=function(e){var r=this.constructor;return this.then(function(t){return r.resolve(e()).then(function(){return t})},function(t){return r.resolve(e()).then(function(){throw t})})},e}();return M.prototype.then=b,M.all=function(t){return new L(this,t).promise},M.race=function(o){var i=this;return r(o)?new i(function(t,e){for(var r=o.length,n=0;n<r;n++)i.resolve(o[n]).then(t,e)}):new i(function(t,e){return e(new TypeError("You must pass an array to race."))})},M.resolve=g,M.reject=function(t){var e=new this(E);return H(e,t),e},M._setScheduler=function(t){o=t},M._setAsap=function(t){a=t},M._asap=a,M.polyfill=function(){var t=void 0;if(void 0!==Y)t=Y;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var r=null;try{r=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===r&&!e.cast)return}t.Promise=M},M.Promise=M},"object"===D(o)&&void 0!==n?n.exports=r():void 0===(e="function"==typeof(t=r)?t.call(o,i,o,n):t)||(n.exports=e)}).call(this,i(10),i(11))},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:u}catch(t){n=u}}();var s,c=[],f=!1,d=-1;function l(){f&&s&&(f=!1,s.length?c=s.concat(c):d=-1,c.length&&p())}function p(){if(!f){var t=a(l);f=!0;for(var e=c.length;e;){for(s=c,c=[];++d<e;)s&&s[d].run();d=-1,e=c.length}s=null,f=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===u||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function v(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new h(t,e)),1!==c.length||f||a(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ContactlabSDKBrowser=e():t.ContactlabSDKBrowser=e()}(window,function(){return function(r){var n={};function o(t){if(n[t])return n[t].exports;var e=n[t]={i:t,l:!1,exports:{}};return r[t].call(e.exports,e,e.exports,o),e.l=!0,e.exports}return o.m=r,o.c=n,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},o.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=0)}([function(t,e,r){"use strict";var H=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},U=o(r(1)),n=o(r(2)),P=o(r(7)),j=o(r(8)),B=r(9);function o(t){return t&&t.__esModule?t:{default:t}}U.default.configure({promise:function(t){return new B.Promise(t)}});var i=window.ContactHubObject||"ch",F=window.ContactHubCookie||"_ch",v=window.ContactHubUtmCookie||"_chutm",L=window.ContactHubAPI||"https://api.contactlab.it/hub/v1",u=function(t){var e=RegExp("[?&]"+t+"=([^&]*)").exec(window.location.href);return e&&decodeURIComponent(e[1].replace(/\+/g," "))||void 0},a=function(){return n.default.v4()},M=function(){var t=j.default.getJSON(F);if(!t)throw new Error("Missing required ContactHub configuration.");if(!(t.workspaceId&&t.nodeId&&t.token))throw new Error("Missing required ContactHub configuration.");return t},s=function(t){var e=M(),r=e.workspaceId,n=e.nodeId,o=e.token,i=e.context,u=e.contextInfo,a=e.sid,s=e.customerId,c=j.default.getJSON(v),f=t.type,d=t.properties;if(!f)throw new Error("Missing required event type");var l=function(t,e){if("viewedPage"===t){var r={title:document.title,url:window.location.href,path:window.location.pathname,referer:document.referrer};return H(r,e)}return H({},e)}(f,d),p=c&&c.utm_source?{ga:c}:void 0,h=s?void 0:{type:"SESSION_ID",value:a,nodeId:n};(0,U.default)({method:"POST",url:L+"/workspaces/"+r+"/events",data:{type:f,context:i,contextInfo:u,properties:l,tracking:p,customerId:s,bringBackProperties:h},headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+o}})},N=function(t){var e=t.customerId,r=t.workspaceId,n=t.token,o=t.externalId,i=t.base,u=t.extended,a=t.consents,s=t.extra,c=t.tags;return(0,U.default)({method:"PATCH",url:L+"/workspaces/"+r+"/customers/"+e,headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+n},data:{externalId:o,base:i,extended:u,consents:a,extra:s,tags:c}}).then(function(){return e})},Y=function(){j.default.set(F,H(M(),{sid:a(),customerId:void 0,hash:void 0}))},c=function(t){if(t){var e,r,n,o,i,u,a,s,c,f,d,l,p,h,v=M(),m=v.workspaceId,w=v.nodeId,y=v.token,b=v.customerId,g=v.hash,A=t.id,E=t.externalId,x=t.base,T=t.extended,_=t.consents,S=t.extra,I=t.tags,k=(e={base:x,extended:T,consents:_,extra:S,tags:I,externalId:E},(r=new P.default("SHA-256","TEXT")).update(JSON.stringify(e)),r.getHash("HEX")),C=function(t){return E||x||T||_||S||I?N({customerId:t,workspaceId:m,nodeId:w,token:y,externalId:E,base:x,extended:T,consents:_,extra:S,tags:I}):B.Promise.resolve(t)},O=function(t){return r=(e={customerId:t,workspaceId:m,token:y,nodeId:w}).customerId,n=e.workspaceId,o=e.token,(0,U.default)({method:"POST",url:L+"/workspaces/"+n+"/customers/"+r+"/sessions",headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+o},data:{value:M().sid}}).then(function(){return r});var e,r,n,o},R=function(t){return j.default.set(F,H(M(),{customerId:t,hash:k})),t};if(g!==k)A&&b?(p=A,h=b,p===h?B.Promise.resolve(p):E||x||T||_||S||I?(Y(),O(p)):B.Promise.reject("The provided id conflicts with the id stored in the cookie")).then(C).then(R):A?O(A).then(C).then(R):b?C(b).then(R):(o=(n={workspaceId:m,nodeId:w,token:y,externalId:E,base:x,extended:T,consents:_,extra:S,tags:I}).workspaceId,i=n.nodeId,u=n.token,a=n.externalId,s=n.base,c=n.extended,f=n.consents,d=n.extra,l=n.tags,(0,U.default)({method:"POST",url:L+"/workspaces/"+o+"/customers",headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+u},data:{nodeId:i,externalId:a,base:s,extended:c,consents:f,extra:d,tags:l}}).then(function(t){return t.data.id})).catch(function(t){if(409===t.status){var e=JSON.parse(t.response).data.customer.id;return N({customerId:e,workspaceId:m,nodeId:w,token:y,externalId:E,base:x,extended:T,consents:_,extra:S,tags:I})}return B.Promise.reject(t)}).then(R).then(O)}else Y()},f=["token","workspaceId","nodeId","context","contextInfo"],d=function(r){if(!(r.workspaceId&&r.nodeId&&r.token))throw new Error("Invalid ContactHub configuration");var t=j.default.getJSON(F)||{},e=r.token!==t.token?{}:t,n=j.default.getJSON(v)||{};u("utm_source")&&(n.utm_source=u("utm_source"),n.utm_medium=u("utm_medium"),n.utm_term=u("utm_term"),n.utm_content=u("utm_content"),n.utm_campaign=u("utm_campaign")),e.sid=e.sid||a();var o=Object.keys(r).filter(function(t){return-1!==f.indexOf(t)}).reduce(function(t,e){return t[e]=r[e],t},{});H(e,o),e.context=e.context||"WEB",e.contextInfo=e.contextInfo||{},j.default.set(F,e,{expires:365}),j.default.set(v,n,{expires:1/48});var i=u("clabId");i&&c({id:i})},l=function(t,e){if(Array.prototype.map){var r={config:d,customer:c,event:s};t in r&&r[t].call(void 0,e)}};window[i]&&window[i].q&&(Array.prototype.map&&window[i].q.map(function(t){return l(t[0],t[1])}));window[i]=l},function(t,e,r){t.exports=function(r){function n(t){if(o[t])return o[t].exports;var e=o[t]={exports:{},id:t,loaded:!1};return r[t].call(e.exports,e,e.exports,n),e.loaded=!0,e.exports}var o={};return n.m=r,n.c=o,n.p="/",n(0)}([function(t,e,r){t.exports=r(1)},function(t,e,r){"use strict";function s(t,e){return{status:t.status,response:t.response,data:e,xhr:t}}function c(t){for(var e=arguments.length,r=Array(1<e?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];for(var o in r)if({}.hasOwnProperty.call(r,o)){var i=r[o];if("object"===(void 0===i?"undefined":f(i)))for(var u in i)({}).hasOwnProperty.call(i,u)&&(t[u]=i[u])}return t}function n(a){return e=function(e,r){var n=c({},h,v,a),o=n.xmlHttpRequest();for(var t in o.withCredentials=n.withCredentials,n.abort&&a.abort(function(){r(s(o)),o.abort()}),o.open(n.method,n.params?n.url.split("?")[0]+"?"+(0,d.default)(n.params):n.url,!0),o.addEventListener(l.LOAD,function(){if(200<=o.status&&o.status<300){var t=null;o.responseText&&(t=!0===n.raw?o.responseText:n.load(o.responseText)),e(s(o,t))}else r(s(o))}),o.addEventListener(l.ABORT,function(){return r(s(o))}),o.addEventListener(l.ERROR,function(){return r(s(o))}),o.addEventListener(l.TIMEOUT,function(){return r(s(o))}),n.headers)({}).hasOwnProperty.call(n.headers,t)&&o.setRequestHeader(t,n.headers[t]);for(var i in n.events)({}).hasOwnProperty.call(n.events,i)&&o.addEventListener(i,n.events[i].bind(null,o),!1);var u="object"!==f(n.data)||n.raw?n.data:n.dump(n.data);void 0!==u?o.send(u):o.send()},((t=a)&&t.promise?t.promise:v.promise||h.promise)(e);var t,e}e.__esModule=!0;var o,f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},i=r(2),d=(o=i)&&o.__esModule?o:{default:o},u={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"},a="undefined"==typeof JSON?function(){}:JSON.stringify,p="undefined"==typeof JSON?function(){}:JSON.parse,h={method:u.GET,data:void 0,headers:{Accept:"application/json","Content-Type":"application/json"},dump:a,load:p,xmlHttpRequest:function(){return new XMLHttpRequest},promise:function(t){return new Promise(t)},withCredentials:!1},v={};n.assign=c,n.encode=d.default,n.configure=function(t){v=c({},v,t)},n.Methods=u,n.Events=l,n.defaults=h,n.get=function(t,e,r){return n(c({url:t,method:u.GET,params:e},r))},n.put=function(t,e,r){return n(c({url:t,method:u.PUT,data:e},r))},n.post=function(t,e,r){return n(c({url:t,method:u.POST,data:e},r))},n.patch=function(t,e,r){return n(c({url:t,method:u.PATCH,data:e},r))},n.del=function(t,e){return n(c({url:t,method:u.DELETE},e))},n.options=function(t,e){return n(c({url:t,method:u.OPTIONS},e))},e.default=n},function(t,e){"use strict";var i=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(r,n,o,t){return n=n||"&",o=o||"=",null===r&&(r=void 0),"object"==typeof r?Object.keys(r).map(function(t){var e=encodeURIComponent(i(t))+o;return Array.isArray(r[t])?r[t].map(function(t){return e+encodeURIComponent(i(t))}).join(n):e+encodeURIComponent(i(r[t]))}).join(n):t?encodeURIComponent(i(t))+o+encodeURIComponent(i(r)):""}}])},function(t,e,r){var n=r(3),o=r(6),i=o;i.v1=n,i.v4=o,t.exports=i},function(t,e,r){var h,v,m=r(4),w=r(5),y=0,b=0;t.exports=function(t,e,r){var n=e&&r||0,o=e||[],i=(t=t||{}).node||h,u=void 0!==t.clockseq?t.clockseq:v;if(null==i||null==u){var a=m();null==i&&(i=h=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==u&&(u=v=16383&(a[6]<<8|a[7]))}var s=void 0!==t.msecs?t.msecs:(new Date).getTime(),c=void 0!==t.nsecs?t.nsecs:b+1,f=s-y+(c-b)/1e4;if(f<0&&void 0===t.clockseq&&(u=u+1&16383),(f<0||y<s)&&void 0===t.nsecs&&(c=0),1e4<=c)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");y=s,v=u;var d=(1e4*(268435455&(s+=122192928e5))+(b=c))%4294967296;o[n++]=d>>>24&255,o[n++]=d>>>16&255,o[n++]=d>>>8&255,o[n++]=255&d;var l=s/4294967296*1e4&268435455;o[n++]=l>>>8&255,o[n++]=255&l,o[n++]=l>>>24&15|16,o[n++]=l>>>16&255,o[n++]=u>>>8|128,o[n++]=255&u;for(var p=0;p<6;++p)o[n+p]=i[p];return e||w(o)}},function(t,e){var r="undefined"!=typeof crypto&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&msCrypto.getRandomValues.bind(msCrypto);if(r){var n=new Uint8Array(16);t.exports=function(){return r(n),n}}else{var o=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),o[e]=t>>>((3&e)<<3)&255;return o}}},function(t,e){for(var o=[],r=0;r<256;++r)o[r]=(r+256).toString(16).substr(1);t.exports=function(t,e){var r=e||0,n=o;return n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]}},function(t,e,r){var u=r(4),a=r(5);t.exports=function(t,e,r){var n=e&&r||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var o=(t=t||{}).random||(t.rng||u)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e)for(var i=0;i<16;++i)e[n+i]=o[i];return e||a(o)}},function(o,i,u){"use strict";var a;!function(t){function e(u,t,e){var o,a,s,c,f,d,l,p,h,v=0,m=[],w=0,y=!1,i=[],b=[],g=!1;if(o=(e=e||{}).encoding||"UTF8",(h=e.numRounds||1)!==parseInt(h,10)||h<1)throw Error("numRounds must a integer >= 1");if(0!==u.lastIndexOf("SHA-",0))throw Error("Chosen SHA variant is not supported");if(d=function(t,e){return F(t,e,u)},l=function(t,e,r,n){var o,i;if("SHA-224"!==u&&"SHA-256"!==u)throw Error("Unexpected error in SHA-2 implementation");for(o=15+(e+65>>>9<<4),i=16;t.length<=o;)t.push(0);for(t[e>>>5]|=128<<24-e%32,e+=r,t[o]=4294967295&e,t[o-1]=e/4294967296|0,r=t.length,e=0;e<r;e+=i)n=F(t.slice(e,e+i),n,u);if("SHA-224"===u)t=[n[0],n[1],n[2],n[3],n[4],n[5],n[6]];else{if("SHA-256"!==u)throw Error("Unexpected error in SHA-2 implementation");t=n}return t},p=function(t){return t.slice()},"SHA-224"===u)f=512,c=224;else{if("SHA-256"!==u)throw Error("Chosen SHA variant is not supported");f=512,c=256}s=S(t,o),a=B(u),this.setHMACKey=function(t,e,r){var n;if(!0===y)throw Error("HMAC key already set");if(!0===g)throw Error("Cannot set HMAC key after calling update");if(t=(e=S(e,o=(r||{}).encoding||"UTF8")(t)).binLen,e=e.value,r=(n=f>>>3)/4-1,n<t/8){for(e=l(e,t,0,B(u));e.length<=r;)e.push(0);e[r]&=4294967040}else if(t/8<n){for(;e.length<=r;)e.push(0);e[r]&=4294967040}for(t=0;t<=r;t+=1)i[t]=909522486^e[t],b[t]=1549556828^e[t];a=d(i,a),v=f,y=!0},this.update=function(t){var e,r,n,o=0,i=f>>>5;for(t=(e=s(t,m,w)).binLen,r=e.value,e=t>>>5,n=0;n<e;n+=i)o+f<=t&&(a=d(r.slice(n,n+i),a),o+=f);v+=o,m=r.slice(o>>>5),w=t%f,g=!0},this.getHash=function(t,e){var r,n,o,i;if(!0===y)throw Error("Cannot call getHash after setting HMAC key");switch(o=_(e),t){case"HEX":r=function(t){return A(t,c,o)};break;case"B64":r=function(t){return E(t,c,o)};break;case"BYTES":r=function(t){return x(t,c)};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}r=function(t){return T(t,c)};break;default:throw Error("format must be HEX, B64, BYTES, or ARRAYBUFFER")}for(i=l(m.slice(),w,v,p(a)),n=1;n<h;n+=1)i=l(i,c,0,B(u));return r(i)},this.getHMAC=function(t,e){var r,n,o,i;if(!1===y)throw Error("Cannot call getHMAC without first setting HMAC key");switch(o=_(e),t){case"HEX":r=function(t){return A(t,c,o)};break;case"B64":r=function(t){return E(t,c,o)};break;case"BYTES":r=function(t){return x(t,c)};break;case"ARRAYBUFFER":try{r=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}r=function(t){return T(t,c)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, or ARRAYBUFFER")}return n=l(m.slice(),w,v,p(a)),i=d(b,B(u)),r(i=l(n,c,f,i))}}function n(){}function A(t,e,r){var n,o,i="";for(e/=8,n=0;n<e;n+=1)o=t[n>>>2]>>>8*(3+n%4*-1),i+="0123456789abcdef".charAt(o>>>4&15)+"0123456789abcdef".charAt(15&o);return r.outputUpper?i.toUpperCase():i}function E(t,e,r){var n,o,i,u="",a=e/8;for(n=0;n<a;n+=3)for(o=n+1<a?t[n+1>>>2]:0,i=n+2<a?t[n+2>>>2]:0,i=(t[n>>>2]>>>8*(3+n%4*-1)&255)<<16|(o>>>8*(3+(n+1)%4*-1)&255)<<8|i>>>8*(3+(n+2)%4*-1)&255,o=0;o<4;o+=1)u+=8*n+6*o<=e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(i>>>6*(3-o)&63):r.b64Pad;return u}function x(t,e){var r,n,o="",i=e/8;for(r=0;r<i;r+=1)n=t[r>>>2]>>>8*(3+r%4*-1)&255,o+=String.fromCharCode(n);return o}function T(t,e){var r,n,o=e/8,i=new ArrayBuffer(o);for(n=new Uint8Array(i),r=0;r<o;r+=1)n[r]=t[r>>>2]>>>8*(3+r%4*-1)&255;return i}function _(t){var e={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(t=t||{},e.outputUpper=t.outputUpper||!1,!0===t.hasOwnProperty("b64Pad")&&(e.b64Pad=t.b64Pad),"boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function S(t,l){var e;switch(l){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":e=function(t,e,r){var n,o,i,u,a,s=t.length;if(0!=s%2)throw Error("String of HEX type must be in byte increments");for(e=e||[0],a=(r=r||0)>>>3,n=0;n<s;n+=2){if(o=parseInt(t.substr(n,2),16),isNaN(o))throw Error("String of HEX type contains invalid characters");for(i=(u=(n>>>1)+a)>>>2;e.length<=i;)e.push(0);e[i]|=o<<8*(3+u%4*-1)}return{value:e,binLen:4*s+r}};break;case"TEXT":e=function(t,e,r){var n,o,i,u,a,s,c,f,d=0;if(e=e||[0],a=(r=r||0)>>>3,"UTF8"===l)for(f=3,i=0;i<t.length;i+=1)for(o=[],(n=t.charCodeAt(i))<128?o.push(n):n<2048?(o.push(192|n>>>6),o.push(128|63&n)):n<55296||57344<=n?o.push(224|n>>>12,128|n>>>6&63,128|63&n):(i+=1,n=65536+((1023&n)<<10|1023&t.charCodeAt(i)),o.push(240|n>>>18,128|n>>>12&63,128|n>>>6&63,128|63&n)),u=0;u<o.length;u+=1){for(s=(c=d+a)>>>2;e.length<=s;)e.push(0);e[s]|=o[u]<<8*(f+c%4*-1),d+=1}else if("UTF16BE"===l||"UTF16LE"===l)for(f=2,o="UTF16LE"===l||"UTF16LE"!==l&&!1,i=0;i<t.length;i+=1){for(n=t.charCodeAt(i),!0===o&&(n=(u=255&n)<<8|n>>>8),s=(c=d+a)>>>2;e.length<=s;)e.push(0);e[s]|=n<<8*(f+c%4*-1),d+=2}return{value:e,binLen:8*d+r}};break;case"B64":e=function(t,e,r){var n,o,i,u,a,s,c,f=0;if(-1===t.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(o=t.indexOf("="),t=t.replace(/\=/g,""),-1!==o&&o<t.length)throw Error("Invalid '=' found in base-64 string");for(e=e||[0],s=(r=r||0)>>>3,o=0;o<t.length;o+=4){for(a=t.substr(o,4),i=u=0;i<a.length;i+=1)u|=(n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a[i]))<<18-6*i;for(i=0;i<a.length-1;i+=1){for(n=(c=f+s)>>>2;e.length<=n;)e.push(0);e[n]|=(u>>>16-8*i&255)<<8*(3+c%4*-1),f+=1}}return{value:e,binLen:8*f+r}};break;case"BYTES":e=function(t,e,r){var n,o,i,u,a;for(e=e||[0],i=(r=r||0)>>>3,o=0;o<t.length;o+=1)n=t.charCodeAt(o),u=(a=o+i)>>>2,e.length<=u&&e.push(0),e[u]|=n<<8*(3+a%4*-1);return{value:e,binLen:8*t.length+r}};break;case"ARRAYBUFFER":try{e=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}e=function(t,e,r){var n,o,i,u,a;for(e=e||[0],o=(r=r||0)>>>3,a=new Uint8Array(t),n=0;n<t.byteLength;n+=1)i=(u=n+o)>>>2,e.length<=i&&e.push(0),e[i]|=a[n]<<8*(3+u%4*-1);return{value:e,binLen:8*t.byteLength+r}};break;default:throw Error("format must be HEX, TEXT, B64, BYTES, or ARRAYBUFFER")}return e}function r(t,e){return t>>>e|t<<32-e}function I(t,e,r){return t&e^~t&r}function k(t,e,r){return t&e^t&r^e&r}function C(t){return r(t,2)^r(t,13)^r(t,22)}function O(t){return r(t,6)^r(t,11)^r(t,25)}function R(t){return r(t,7)^r(t,18)^t>>>3}function H(t){return r(t,17)^r(t,19)^t>>>10}function U(t,e){var r=(65535&t)+(65535&e);return((t>>>16)+(e>>>16)+(r>>>16)&65535)<<16|65535&r}function P(t,e,r,n){var o=(65535&t)+(65535&e)+(65535&r)+(65535&n);return((t>>>16)+(e>>>16)+(r>>>16)+(n>>>16)+(o>>>16)&65535)<<16|65535&o}function j(t,e,r,n,o){var i=(65535&t)+(65535&e)+(65535&r)+(65535&n)+(65535&o);return((t>>>16)+(e>>>16)+(r>>>16)+(n>>>16)+(o>>>16)+(i>>>16)&65535)<<16|65535&i}function B(t){var e,r=[];if(0!==t.lastIndexOf("SHA-",0))throw Error("No SHA variants supported");switch(r=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],e=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t){case"SHA-224":break;case"SHA-256":r=e;break;case"SHA-384":case"SHA-512":r=[new n,new n,new n,new n,new n,new n,new n,new n];break;default:throw Error("Unknown SHA variant")}return r}function F(t,e,r){var n,o,i,u,a,s,c,f,d,l,p,h,v,m,w,y,b,g,A,E,x,T,_,S=[];if("SHA-224"!==r&&"SHA-256"!==r)throw Error("Unexpected error in SHA-2 implementation");for(l=64,h=1,T=Number,v=U,m=P,w=j,y=R,b=H,g=C,A=O,x=k,E=I,_=L,r=e[0],n=e[1],o=e[2],i=e[3],u=e[4],a=e[5],s=e[6],c=e[7],p=0;p<l;p+=1)p<16?(d=p*h,f=t.length<=d?0:t[d],d=t.length<=d+1?0:t[d+1],S[p]=new T(f,d)):S[p]=m(b(S[p-2]),S[p-7],y(S[p-15]),S[p-16]),f=w(c,A(u),E(u,a,s),_[p],S[p]),d=v(g(r),x(r,n,o)),c=s,s=a,a=u,u=v(i,f),i=o,o=n,n=r,r=v(f,d);return e[0]=v(r,e[0]),e[1]=v(n,e[1]),e[2]=v(o,e[2]),e[3]=v(i,e[3]),e[4]=v(u,e[4]),e[5]=v(a,e[5]),e[6]=v(s,e[6]),e[7]=v(c,e[7]),e}var L;L=[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],void 0===(a=function(){return e}.call(i,u,i,o))||(o.exports=a)}()},function(n,o,i){var u,a;!function(t){if(void 0===(a="function"==typeof(u=t)?u.call(o,i,o,n):u)||(n.exports=a),!0,n.exports=t(),!!0){var e=window.Cookies,r=window.Cookies=t();r.noConflict=function(){return window.Cookies=e,r}}}(function(){function v(){for(var t=0,e={};t<arguments.length;t++){var r=arguments[t];for(var n in r)e[n]=r[n]}return e}return function t(p){function h(t,e,r){var n;if("undefined"!=typeof document){if(1<arguments.length){if("number"==typeof(r=v({path:"/"},h.defaults,r)).expires){var o=new Date;o.setMilliseconds(o.getMilliseconds()+864e5*r.expires),r.expires=o}r.expires=r.expires?r.expires.toUTCString():"";try{n=JSON.stringify(e),/^[\{\[]/.test(n)&&(e=n)}catch(t){}e=p.write?p.write(e,t):encodeURIComponent(String(e)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=(t=(t=encodeURIComponent(String(t))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape);var i="";for(var u in r)r[u]&&(i+="; "+u,!0!==r[u]&&(i+="="+r[u]));return document.cookie=t+"="+e+i}t||(n={});for(var a=document.cookie?document.cookie.split("; "):[],s=/(%[0-9A-Z]{2})+/g,c=0;c<a.length;c++){var f=a[c].split("="),d=f.slice(1).join("=");this.json||'"'!==d.charAt(0)||(d=d.slice(1,-1));try{var l=f[0].replace(s,decodeURIComponent);if(d=p.read?p.read(d,l):p(d,l)||d.replace(s,decodeURIComponent),this.json)try{d=JSON.parse(d)}catch(t){}if(t===l){n=d;break}t||(n[l]=d)}catch(t){}}return n}}return(h.set=h).get=function(t){return h.call(h,t)},h.getJSON=function(){return h.apply({json:!0},[].slice.call(arguments))},h.defaults={},h.remove=function(t,e){h(t,"",v(e,{expires:-1}))},h.withConverter=t,h}(function(){})})},function(n,o,i){"use strict";(function(N,Y){var t,e,r,D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};r=function(){function c(t){return"function"==typeof t}var r=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},n=0,e=void 0,o=void 0,a=function(t,e){l[n]=t,l[n+1]=e,2===(n+=2)&&(o?o(p):y())};var t="undefined"!=typeof window?window:void 0,i=t||{},u=i.MutationObserver||i.WebKitMutationObserver,s="undefined"==typeof self&&void 0!==N&&"[object process]"==={}.toString.call(N),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(p,1)}}var l=new Array(1e3);function p(){for(var t=0;t<n;t+=2){(0,l[t])(l[t+1]),l[t]=void 0,l[t+1]=void 0}n=0}var h,v,m,w,y=void 0;function b(t,e){var r=this,n=new this.constructor(E);void 0===n[A]&&F(n);var o=r._state;if(o){var i=arguments[o-1];a(function(){return j(o,n,i,r._result)})}else U(r,n,t,e);return n}function g(t){if(t&&"object"===(void 0===t?"undefined":D(t))&&t.constructor===this)return t;var e=new this(E);return C(e,t),e}s?y=function(){return N.nextTick(p)}:u?(v=0,m=new u(p),w=document.createTextNode(""),m.observe(w,{characterData:!0}),y=function(){w.data=v=++v%2}):f?((h=new MessageChannel).port1.onmessage=p,y=function(){return h.port2.postMessage(0)}):y=void 0===t?function(){try{var t=Function("return this")().require("vertx");return void 0!==(e=t.runOnLoop||t.runOnContext)?function(){e(p)}:d()}catch(t){return d()}}():d();var A=Math.random().toString(36).substring(2);function E(){}var x=void 0,T=1,_=2,S={error:null};function I(t){try{return t.then}catch(t){return S.error=t,S}}function k(t,e,r){var n,o,i,u;e.constructor===t.constructor&&r===b&&e.constructor.resolve===g?(i=t,(u=e)._state===T?R(i,u._result):u._state===_?H(i,u._result):U(u,void 0,function(t){return C(i,t)},function(t){return H(i,t)})):r===S?(H(t,S.error),S.error=null):void 0===r?R(t,e):c(r)?(n=e,o=r,a(function(e){var r=!1,t=function(t,e,r,n){try{t.call(e,r,n)}catch(t){return t}}(o,n,function(t){r||(r=!0,n!==t?C(e,t):R(e,t))},function(t){r||(r=!0,H(e,t))},e._label);!r&&t&&(r=!0,H(e,t))},t)):R(t,e)}function C(t,e){var r,n;t===e?H(t,new TypeError("You cannot resolve a promise with itself")):(n=void 0===(r=e)?"undefined":D(r),null===r||"object"!==n&&"function"!==n?R(t,e):k(t,e,I(e)))}function O(t){t._onerror&&t._onerror(t._result),P(t)}function R(t,e){t._state===x&&(t._result=e,t._state=T,0!==t._subscribers.length&&a(P,t))}function H(t,e){t._state===x&&(t._state=_,t._result=e,a(O,t))}function U(t,e,r,n){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+T]=r,o[i+_]=n,0===i&&t._state&&a(P,t)}function P(t){var e=t._subscribers,r=t._state;if(0!==e.length){for(var n=void 0,o=void 0,i=t._result,u=0;u<e.length;u+=3)n=e[u],o=e[u+r],n?j(r,n,o,i):o(i);t._subscribers.length=0}}function j(t,e,r,n){var o=c(r),i=void 0,u=void 0,a=void 0,s=void 0;if(o){if((i=function(t,e){try{return t(e)}catch(t){return S.error=t,S}}(r,n))===S?(s=!0,u=i.error,i.error=null):a=!0,e===i)return void H(e,new TypeError("A promises callback cannot return that same promise."))}else i=n,a=!0;e._state!==x||(o&&a?C(e,i):s?H(e,u):t===T?R(e,i):t===_&&H(e,i))}var B=0;function F(t){t[A]=B++,t._state=void 0,t._result=void 0,t._subscribers=[]}var L=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(E),this.promise[A]||F(this.promise),r(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?R(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&R(this.promise,this._result))):H(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;this._state===x&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,n=r.resolve;if(n===g){var o=I(e);if(o===b&&e._state!==x)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(r===M){var i=new r(E);k(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new r(function(t){return t(e)}),t)}else this._willSettleAt(n(e),t)},t.prototype._settledAt=function(t,e,r){var n=this.promise;n._state===x&&(this._remaining--,t===_?H(n,r):this._result[e]=r),0===this._remaining&&R(n,this._result)},t.prototype._willSettleAt=function(t,e){var r=this;U(t,void 0,function(t){return r._settledAt(T,e,t)},function(t){return r._settledAt(_,e,t)})},t}();var M=function(){function e(t){this[A]=B++,this._result=this._state=void 0,this._subscribers=[],E!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(e,t){try{t(function(t){C(e,t)},function(t){H(e,t)})}catch(t){H(e,t)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(t){return this.then(null,t)},e.prototype.finally=function(e){var r=this.constructor;return this.then(function(t){return r.resolve(e()).then(function(){return t})},function(t){return r.resolve(e()).then(function(){throw t})})},e}();return M.prototype.then=b,M.all=function(t){return new L(this,t).promise},M.race=function(o){var i=this;return r(o)?new i(function(t,e){for(var r=o.length,n=0;n<r;n++)i.resolve(o[n]).then(t,e)}):new i(function(t,e){return e(new TypeError("You must pass an array to race."))})},M.resolve=g,M.reject=function(t){var e=new this(E);return H(e,t),e},M._setScheduler=function(t){o=t},M._setAsap=function(t){a=t},M._asap=a,M.polyfill=function(){var t=void 0;if(void 0!==Y)t=Y;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var r=null;try{r=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===r&&!e.cast)return}t.Promise=M},M.Promise=M},"object"===D(o)&&void 0!==n?n.exports=r():void 0===(e="function"==typeof(t=r)?t.call(o,i,o,n):t)||(n.exports=e)}).call(this,i(10),i(11))},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:u}catch(t){n=u}}();var s,c=[],f=!1,d=-1;function l(){f&&s&&(f=!1,s.length?c=s.concat(c):d=-1,c.length&&p())}function p(){if(!f){var t=a(l);f=!0;for(var e=c.length;e;){for(s=c,c=[];++d<e;)s&&s[d].run();d=-1,e=c.length}s=null,f=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===u||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function v(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new h(t,e)),1!==c.length||f||a(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r}])}); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ContactlabSDKBrowser=e():t.ContactlabSDKBrowser=e()}(window,function(){return function(r){var n={};function o(t){if(n[t])return n[t].exports;var e=n[t]={i:t,l:!1,exports:{}};return r[t].call(e.exports,e,e.exports,o),e.l=!0,e.exports}return o.m=r,o.c=n,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},o.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=0)}([function(t,e,r){"use strict";var H=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},U=o(r(1)),n=o(r(2)),P=o(r(7)),j=o(r(8)),B=r(9);function o(t){return t&&t.__esModule?t:{default:t}}U.default.configure({promise:function(t){return new B.Promise(t)}});var i=window.ContactHubObject||"ch",F=window.ContactHubCookie||"_ch",L=window.ContactHubAPI||"https://api.contactlab.it/hub/v1",u=function(t){var e=RegExp("[?&]"+t+"=([^&]*)").exec(window.location.search);return e&&decodeURIComponent(e[1].replace(/\+/g," "))||void 0},a=function(){return n.default.v4()},M=function(){var t=j.default.getJSON(F);if(!t)throw new Error("Missing required ContactHub configuration.");if(!(t.workspaceId&&t.nodeId&&t.token))throw new Error("Missing required ContactHub configuration.");return t},s=function(t){var e=M(),r=e.workspaceId,n=e.nodeId,o=e.token,i=e.context,u=e.contextInfo,a=e.sid,s=e.customerId,c=e.ga,f=t.type,d=t.properties;if(!f)throw new Error("Missing required event type");var l=function(t,e){if("viewedPage"===t){var r={title:document.title,url:window.location.href,path:window.location.pathname,referer:document.referrer};return H(r,e)}return H({},e)}(f,d),p=c?{ga:c}:void 0,h=s?void 0:{type:"SESSION_ID",value:a,nodeId:n};(0,U.default)({method:"POST",url:L+"/workspaces/"+r+"/events",data:{type:f,context:i,contextInfo:u,properties:l,tracking:p,customerId:s,bringBackProperties:h},headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+o}})},N=function(t){var e=t.customerId,r=t.workspaceId,n=t.token,o=t.externalId,i=t.base,u=t.extended,a=t.consents,s=t.extra,c=t.tags;return(0,U.default)({method:"PATCH",url:L+"/workspaces/"+r+"/customers/"+e,headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+n},data:{externalId:o,base:i,extended:u,consents:a,extra:s,tags:c}}).then(function(){return e})},Y=function(){j.default.set(F,H(M(),{sid:a(),customerId:void 0,hash:void 0}))},c=function(t){if(t){var e,r,n,o,i,u,a,s,c,f,d,l,p,h,v=M(),m=v.workspaceId,w=v.nodeId,y=v.token,b=v.customerId,g=v.hash,A=t.id,E=t.externalId,x=t.base,T=t.extended,_=t.consents,S=t.extra,I=t.tags,C=(e={base:x,extended:T,consents:_,extra:S,tags:I,externalId:E},(r=new P.default("SHA-256","TEXT")).update(JSON.stringify(e)),r.getHash("HEX")),k=function(t){return E||x||T||_||S||I?N({customerId:t,workspaceId:m,nodeId:w,token:y,externalId:E,base:x,extended:T,consents:_,extra:S,tags:I}):B.Promise.resolve(t)},O=function(t){return r=(e={customerId:t,workspaceId:m,token:y,nodeId:w}).customerId,n=e.workspaceId,o=e.token,(0,U.default)({method:"POST",url:L+"/workspaces/"+n+"/customers/"+r+"/sessions",headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+o},data:{value:M().sid}}).then(function(){return r});var e,r,n,o},R=function(t){return j.default.set(F,H(M(),{customerId:t,hash:C})),t};if(g!==C)A&&b?(p=A,h=b,p===h?B.Promise.resolve(p):E||x||T||_||S||I?(Y(),O(p)):B.Promise.reject("The provided id conflicts with the id stored in the cookie")).then(k).then(R):A?O(A).then(k).then(R):b?k(b).then(R):(o=(n={workspaceId:m,nodeId:w,token:y,externalId:E,base:x,extended:T,consents:_,extra:S,tags:I}).workspaceId,i=n.nodeId,u=n.token,a=n.externalId,s=n.base,c=n.extended,f=n.consents,d=n.extra,l=n.tags,(0,U.default)({method:"POST",url:L+"/workspaces/"+o+"/customers",headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+u},data:{nodeId:i,externalId:a,base:s,extended:c,consents:f,extra:d,tags:l}}).then(function(t){return t.data.id})).catch(function(t){if(409===t.status){var e=JSON.parse(t.response).data.customer.id;return N({customerId:e,workspaceId:m,nodeId:w,token:y,externalId:E,base:x,extended:T,consents:_,extra:S,tags:I})}return B.Promise.reject(t)}).then(R).then(O)}else Y()},f=["token","workspaceId","nodeId","context","contextInfo"],d=function(r){var t=j.default.getJSON(F)||{},e=u("utm_source");e&&(t.ga={utm_source:e,utm_medium:u("utm_medium"),utm_term:u("utm_term"),utm_content:u("utm_content"),utm_campaign:u("utm_campaign")}),t.sid=t.sid||a();var n=Object.keys(r).filter(function(t){return-1!==f.indexOf(t)}).reduce(function(t,e){return t[e]=r[e],t},{});H(t,n),t.context=t.context||"WEB",t.contextInfo=t.contextInfo||{},j.default.set(F,t,{expires:365});var o=u("clabId");o&&c({id:o})},l=function(t,e){if(Array.prototype.map){var r={config:d,customer:c,event:s};t in r&&r[t].call(void 0,e)}};window[i]&&window[i].q&&(Array.prototype.map&&window[i].q.map(function(t){return l(t[0],t[1])}));window[i]=l},function(t,e,r){t.exports=function(r){function n(t){if(o[t])return o[t].exports;var e=o[t]={exports:{},id:t,loaded:!1};return r[t].call(e.exports,e,e.exports,n),e.loaded=!0,e.exports}var o={};return n.m=r,n.c=o,n.p="/",n(0)}([function(t,e,r){t.exports=r(1)},function(t,e,r){"use strict";function s(t,e){return{status:t.status,response:t.response,data:e,xhr:t}}function c(t){for(var e=arguments.length,r=Array(1<e?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];for(var o in r)if({}.hasOwnProperty.call(r,o)){var i=r[o];if("object"===(void 0===i?"undefined":f(i)))for(var u in i)({}).hasOwnProperty.call(i,u)&&(t[u]=i[u])}return t}function n(a){return e=function(e,r){var n=c({},h,v,a),o=n.xmlHttpRequest();for(var t in o.withCredentials=n.withCredentials,n.abort&&a.abort(function(){r(s(o)),o.abort()}),o.open(n.method,n.params?n.url.split("?")[0]+"?"+(0,d.default)(n.params):n.url,!0),o.addEventListener(l.LOAD,function(){if(200<=o.status&&o.status<300){var t=null;o.responseText&&(t=!0===n.raw?o.responseText:n.load(o.responseText)),e(s(o,t))}else r(s(o))}),o.addEventListener(l.ABORT,function(){return r(s(o))}),o.addEventListener(l.ERROR,function(){return r(s(o))}),o.addEventListener(l.TIMEOUT,function(){return r(s(o))}),n.headers)({}).hasOwnProperty.call(n.headers,t)&&o.setRequestHeader(t,n.headers[t]);for(var i in n.events)({}).hasOwnProperty.call(n.events,i)&&o.addEventListener(i,n.events[i].bind(null,o),!1);var u="object"!==f(n.data)||n.raw?n.data:n.dump(n.data);void 0!==u?o.send(u):o.send()},((t=a)&&t.promise?t.promise:v.promise||h.promise)(e);var t,e}e.__esModule=!0;var o,f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},i=r(2),d=(o=i)&&o.__esModule?o:{default:o},u={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"},a="undefined"==typeof JSON?function(){}:JSON.stringify,p="undefined"==typeof JSON?function(){}:JSON.parse,h={method:u.GET,data:void 0,headers:{Accept:"application/json","Content-Type":"application/json"},dump:a,load:p,xmlHttpRequest:function(){return new XMLHttpRequest},promise:function(t){return new Promise(t)},withCredentials:!1},v={};n.assign=c,n.encode=d.default,n.configure=function(t){v=c({},v,t)},n.Methods=u,n.Events=l,n.defaults=h,n.get=function(t,e,r){return n(c({url:t,method:u.GET,params:e},r))},n.put=function(t,e,r){return n(c({url:t,method:u.PUT,data:e},r))},n.post=function(t,e,r){return n(c({url:t,method:u.POST,data:e},r))},n.patch=function(t,e,r){return n(c({url:t,method:u.PATCH,data:e},r))},n.del=function(t,e){return n(c({url:t,method:u.DELETE},e))},n.options=function(t,e){return n(c({url:t,method:u.OPTIONS},e))},e.default=n},function(t,e){"use strict";var i=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(r,n,o,t){return n=n||"&",o=o||"=",null===r&&(r=void 0),"object"==typeof r?Object.keys(r).map(function(t){var e=encodeURIComponent(i(t))+o;return Array.isArray(r[t])?r[t].map(function(t){return e+encodeURIComponent(i(t))}).join(n):e+encodeURIComponent(i(r[t]))}).join(n):t?encodeURIComponent(i(t))+o+encodeURIComponent(i(r)):""}}])},function(t,e,r){var n=r(3),o=r(6),i=o;i.v1=n,i.v4=o,t.exports=i},function(t,e,r){var h,v,m=r(4),w=r(5),y=0,b=0;t.exports=function(t,e,r){var n=e&&r||0,o=e||[],i=(t=t||{}).node||h,u=void 0!==t.clockseq?t.clockseq:v;if(null==i||null==u){var a=m();null==i&&(i=h=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==u&&(u=v=16383&(a[6]<<8|a[7]))}var s=void 0!==t.msecs?t.msecs:(new Date).getTime(),c=void 0!==t.nsecs?t.nsecs:b+1,f=s-y+(c-b)/1e4;if(f<0&&void 0===t.clockseq&&(u=u+1&16383),(f<0||y<s)&&void 0===t.nsecs&&(c=0),1e4<=c)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");y=s,v=u;var d=(1e4*(268435455&(s+=122192928e5))+(b=c))%4294967296;o[n++]=d>>>24&255,o[n++]=d>>>16&255,o[n++]=d>>>8&255,o[n++]=255&d;var l=s/4294967296*1e4&268435455;o[n++]=l>>>8&255,o[n++]=255&l,o[n++]=l>>>24&15|16,o[n++]=l>>>16&255,o[n++]=u>>>8|128,o[n++]=255&u;for(var p=0;p<6;++p)o[n+p]=i[p];return e||w(o)}},function(t,e){var r="undefined"!=typeof crypto&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&msCrypto.getRandomValues.bind(msCrypto);if(r){var n=new Uint8Array(16);t.exports=function(){return r(n),n}}else{var o=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),o[e]=t>>>((3&e)<<3)&255;return o}}},function(t,e){for(var o=[],r=0;r<256;++r)o[r]=(r+256).toString(16).substr(1);t.exports=function(t,e){var r=e||0,n=o;return n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]}},function(t,e,r){var u=r(4),a=r(5);t.exports=function(t,e,r){var n=e&&r||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var o=(t=t||{}).random||(t.rng||u)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e)for(var i=0;i<16;++i)e[n+i]=o[i];return e||a(o)}},function(o,i,u){"use strict";var a;!function(t){function e(u,t,e){var o,a,s,c,f,d,l,p,h,v=0,m=[],w=0,y=!1,i=[],b=[],g=!1;if(o=(e=e||{}).encoding||"UTF8",(h=e.numRounds||1)!==parseInt(h,10)||h<1)throw Error("numRounds must a integer >= 1");if(0!==u.lastIndexOf("SHA-",0))throw Error("Chosen SHA variant is not supported");if(d=function(t,e){return F(t,e,u)},l=function(t,e,r,n){var o,i;if("SHA-224"!==u&&"SHA-256"!==u)throw Error("Unexpected error in SHA-2 implementation");for(o=15+(e+65>>>9<<4),i=16;t.length<=o;)t.push(0);for(t[e>>>5]|=128<<24-e%32,e+=r,t[o]=4294967295&e,t[o-1]=e/4294967296|0,r=t.length,e=0;e<r;e+=i)n=F(t.slice(e,e+i),n,u);if("SHA-224"===u)t=[n[0],n[1],n[2],n[3],n[4],n[5],n[6]];else{if("SHA-256"!==u)throw Error("Unexpected error in SHA-2 implementation");t=n}return t},p=function(t){return t.slice()},"SHA-224"===u)f=512,c=224;else{if("SHA-256"!==u)throw Error("Chosen SHA variant is not supported");f=512,c=256}s=S(t,o),a=B(u),this.setHMACKey=function(t,e,r){var n;if(!0===y)throw Error("HMAC key already set");if(!0===g)throw Error("Cannot set HMAC key after calling update");if(t=(e=S(e,o=(r||{}).encoding||"UTF8")(t)).binLen,e=e.value,r=(n=f>>>3)/4-1,n<t/8){for(e=l(e,t,0,B(u));e.length<=r;)e.push(0);e[r]&=4294967040}else if(t/8<n){for(;e.length<=r;)e.push(0);e[r]&=4294967040}for(t=0;t<=r;t+=1)i[t]=909522486^e[t],b[t]=1549556828^e[t];a=d(i,a),v=f,y=!0},this.update=function(t){var e,r,n,o=0,i=f>>>5;for(t=(e=s(t,m,w)).binLen,r=e.value,e=t>>>5,n=0;n<e;n+=i)o+f<=t&&(a=d(r.slice(n,n+i),a),o+=f);v+=o,m=r.slice(o>>>5),w=t%f,g=!0},this.getHash=function(t,e){var r,n,o,i;if(!0===y)throw Error("Cannot call getHash after setting HMAC key");switch(o=_(e),t){case"HEX":r=function(t){return A(t,c,o)};break;case"B64":r=function(t){return E(t,c,o)};break;case"BYTES":r=function(t){return x(t,c)};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}r=function(t){return T(t,c)};break;default:throw Error("format must be HEX, B64, BYTES, or ARRAYBUFFER")}for(i=l(m.slice(),w,v,p(a)),n=1;n<h;n+=1)i=l(i,c,0,B(u));return r(i)},this.getHMAC=function(t,e){var r,n,o,i;if(!1===y)throw Error("Cannot call getHMAC without first setting HMAC key");switch(o=_(e),t){case"HEX":r=function(t){return A(t,c,o)};break;case"B64":r=function(t){return E(t,c,o)};break;case"BYTES":r=function(t){return x(t,c)};break;case"ARRAYBUFFER":try{r=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}r=function(t){return T(t,c)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, or ARRAYBUFFER")}return n=l(m.slice(),w,v,p(a)),i=d(b,B(u)),r(i=l(n,c,f,i))}}function n(){}function A(t,e,r){var n,o,i="";for(e/=8,n=0;n<e;n+=1)o=t[n>>>2]>>>8*(3+n%4*-1),i+="0123456789abcdef".charAt(o>>>4&15)+"0123456789abcdef".charAt(15&o);return r.outputUpper?i.toUpperCase():i}function E(t,e,r){var n,o,i,u="",a=e/8;for(n=0;n<a;n+=3)for(o=n+1<a?t[n+1>>>2]:0,i=n+2<a?t[n+2>>>2]:0,i=(t[n>>>2]>>>8*(3+n%4*-1)&255)<<16|(o>>>8*(3+(n+1)%4*-1)&255)<<8|i>>>8*(3+(n+2)%4*-1)&255,o=0;o<4;o+=1)u+=8*n+6*o<=e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(i>>>6*(3-o)&63):r.b64Pad;return u}function x(t,e){var r,n,o="",i=e/8;for(r=0;r<i;r+=1)n=t[r>>>2]>>>8*(3+r%4*-1)&255,o+=String.fromCharCode(n);return o}function T(t,e){var r,n,o=e/8,i=new ArrayBuffer(o);for(n=new Uint8Array(i),r=0;r<o;r+=1)n[r]=t[r>>>2]>>>8*(3+r%4*-1)&255;return i}function _(t){var e={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(t=t||{},e.outputUpper=t.outputUpper||!1,!0===t.hasOwnProperty("b64Pad")&&(e.b64Pad=t.b64Pad),"boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function S(t,l){var e;switch(l){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":e=function(t,e,r){var n,o,i,u,a,s=t.length;if(0!=s%2)throw Error("String of HEX type must be in byte increments");for(e=e||[0],a=(r=r||0)>>>3,n=0;n<s;n+=2){if(o=parseInt(t.substr(n,2),16),isNaN(o))throw Error("String of HEX type contains invalid characters");for(i=(u=(n>>>1)+a)>>>2;e.length<=i;)e.push(0);e[i]|=o<<8*(3+u%4*-1)}return{value:e,binLen:4*s+r}};break;case"TEXT":e=function(t,e,r){var n,o,i,u,a,s,c,f,d=0;if(e=e||[0],a=(r=r||0)>>>3,"UTF8"===l)for(f=3,i=0;i<t.length;i+=1)for(o=[],(n=t.charCodeAt(i))<128?o.push(n):n<2048?(o.push(192|n>>>6),o.push(128|63&n)):n<55296||57344<=n?o.push(224|n>>>12,128|n>>>6&63,128|63&n):(i+=1,n=65536+((1023&n)<<10|1023&t.charCodeAt(i)),o.push(240|n>>>18,128|n>>>12&63,128|n>>>6&63,128|63&n)),u=0;u<o.length;u+=1){for(s=(c=d+a)>>>2;e.length<=s;)e.push(0);e[s]|=o[u]<<8*(f+c%4*-1),d+=1}else if("UTF16BE"===l||"UTF16LE"===l)for(f=2,o="UTF16LE"===l||"UTF16LE"!==l&&!1,i=0;i<t.length;i+=1){for(n=t.charCodeAt(i),!0===o&&(n=(u=255&n)<<8|n>>>8),s=(c=d+a)>>>2;e.length<=s;)e.push(0);e[s]|=n<<8*(f+c%4*-1),d+=2}return{value:e,binLen:8*d+r}};break;case"B64":e=function(t,e,r){var n,o,i,u,a,s,c,f=0;if(-1===t.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(o=t.indexOf("="),t=t.replace(/\=/g,""),-1!==o&&o<t.length)throw Error("Invalid '=' found in base-64 string");for(e=e||[0],s=(r=r||0)>>>3,o=0;o<t.length;o+=4){for(a=t.substr(o,4),i=u=0;i<a.length;i+=1)u|=(n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a[i]))<<18-6*i;for(i=0;i<a.length-1;i+=1){for(n=(c=f+s)>>>2;e.length<=n;)e.push(0);e[n]|=(u>>>16-8*i&255)<<8*(3+c%4*-1),f+=1}}return{value:e,binLen:8*f+r}};break;case"BYTES":e=function(t,e,r){var n,o,i,u,a;for(e=e||[0],i=(r=r||0)>>>3,o=0;o<t.length;o+=1)n=t.charCodeAt(o),u=(a=o+i)>>>2,e.length<=u&&e.push(0),e[u]|=n<<8*(3+a%4*-1);return{value:e,binLen:8*t.length+r}};break;case"ARRAYBUFFER":try{e=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}e=function(t,e,r){var n,o,i,u,a;for(e=e||[0],o=(r=r||0)>>>3,a=new Uint8Array(t),n=0;n<t.byteLength;n+=1)i=(u=n+o)>>>2,e.length<=i&&e.push(0),e[i]|=a[n]<<8*(3+u%4*-1);return{value:e,binLen:8*t.byteLength+r}};break;default:throw Error("format must be HEX, TEXT, B64, BYTES, or ARRAYBUFFER")}return e}function r(t,e){return t>>>e|t<<32-e}function I(t,e,r){return t&e^~t&r}function C(t,e,r){return t&e^t&r^e&r}function k(t){return r(t,2)^r(t,13)^r(t,22)}function O(t){return r(t,6)^r(t,11)^r(t,25)}function R(t){return r(t,7)^r(t,18)^t>>>3}function H(t){return r(t,17)^r(t,19)^t>>>10}function U(t,e){var r=(65535&t)+(65535&e);return((t>>>16)+(e>>>16)+(r>>>16)&65535)<<16|65535&r}function P(t,e,r,n){var o=(65535&t)+(65535&e)+(65535&r)+(65535&n);return((t>>>16)+(e>>>16)+(r>>>16)+(n>>>16)+(o>>>16)&65535)<<16|65535&o}function j(t,e,r,n,o){var i=(65535&t)+(65535&e)+(65535&r)+(65535&n)+(65535&o);return((t>>>16)+(e>>>16)+(r>>>16)+(n>>>16)+(o>>>16)+(i>>>16)&65535)<<16|65535&i}function B(t){var e,r=[];if(0!==t.lastIndexOf("SHA-",0))throw Error("No SHA variants supported");switch(r=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],e=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t){case"SHA-224":break;case"SHA-256":r=e;break;case"SHA-384":case"SHA-512":r=[new n,new n,new n,new n,new n,new n,new n,new n];break;default:throw Error("Unknown SHA variant")}return r}function F(t,e,r){var n,o,i,u,a,s,c,f,d,l,p,h,v,m,w,y,b,g,A,E,x,T,_,S=[];if("SHA-224"!==r&&"SHA-256"!==r)throw Error("Unexpected error in SHA-2 implementation");for(l=64,h=1,T=Number,v=U,m=P,w=j,y=R,b=H,g=k,A=O,x=C,E=I,_=L,r=e[0],n=e[1],o=e[2],i=e[3],u=e[4],a=e[5],s=e[6],c=e[7],p=0;p<l;p+=1)p<16?(d=p*h,f=t.length<=d?0:t[d],d=t.length<=d+1?0:t[d+1],S[p]=new T(f,d)):S[p]=m(b(S[p-2]),S[p-7],y(S[p-15]),S[p-16]),f=w(c,A(u),E(u,a,s),_[p],S[p]),d=v(g(r),x(r,n,o)),c=s,s=a,a=u,u=v(i,f),i=o,o=n,n=r,r=v(f,d);return e[0]=v(r,e[0]),e[1]=v(n,e[1]),e[2]=v(o,e[2]),e[3]=v(i,e[3]),e[4]=v(u,e[4]),e[5]=v(a,e[5]),e[6]=v(s,e[6]),e[7]=v(c,e[7]),e}var L;L=[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],void 0===(a=function(){return e}.call(i,u,i,o))||(o.exports=a)}()},function(n,o,i){var u,a;!function(t){if(void 0===(a="function"==typeof(u=t)?u.call(o,i,o,n):u)||(n.exports=a),!0,n.exports=t(),!!0){var e=window.Cookies,r=window.Cookies=t();r.noConflict=function(){return window.Cookies=e,r}}}(function(){function v(){for(var t=0,e={};t<arguments.length;t++){var r=arguments[t];for(var n in r)e[n]=r[n]}return e}return function t(p){function h(t,e,r){var n;if("undefined"!=typeof document){if(1<arguments.length){if("number"==typeof(r=v({path:"/"},h.defaults,r)).expires){var o=new Date;o.setMilliseconds(o.getMilliseconds()+864e5*r.expires),r.expires=o}r.expires=r.expires?r.expires.toUTCString():"";try{n=JSON.stringify(e),/^[\{\[]/.test(n)&&(e=n)}catch(t){}e=p.write?p.write(e,t):encodeURIComponent(String(e)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=(t=(t=encodeURIComponent(String(t))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape);var i="";for(var u in r)r[u]&&(i+="; "+u,!0!==r[u]&&(i+="="+r[u]));return document.cookie=t+"="+e+i}t||(n={});for(var a=document.cookie?document.cookie.split("; "):[],s=/(%[0-9A-Z]{2})+/g,c=0;c<a.length;c++){var f=a[c].split("="),d=f.slice(1).join("=");this.json||'"'!==d.charAt(0)||(d=d.slice(1,-1));try{var l=f[0].replace(s,decodeURIComponent);if(d=p.read?p.read(d,l):p(d,l)||d.replace(s,decodeURIComponent),this.json)try{d=JSON.parse(d)}catch(t){}if(t===l){n=d;break}t||(n[l]=d)}catch(t){}}return n}}return(h.set=h).get=function(t){return h.call(h,t)},h.getJSON=function(){return h.apply({json:!0},[].slice.call(arguments))},h.defaults={},h.remove=function(t,e){h(t,"",v(e,{expires:-1}))},h.withConverter=t,h}(function(){})})},function(n,o,i){"use strict";(function(N,Y){var t,e,r,D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};r=function(){function c(t){return"function"==typeof t}var r=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},n=0,e=void 0,o=void 0,a=function(t,e){l[n]=t,l[n+1]=e,2===(n+=2)&&(o?o(p):y())};var t="undefined"!=typeof window?window:void 0,i=t||{},u=i.MutationObserver||i.WebKitMutationObserver,s="undefined"==typeof self&&void 0!==N&&"[object process]"==={}.toString.call(N),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(p,1)}}var l=new Array(1e3);function p(){for(var t=0;t<n;t+=2){(0,l[t])(l[t+1]),l[t]=void 0,l[t+1]=void 0}n=0}var h,v,m,w,y=void 0;function b(t,e){var r=this,n=new this.constructor(E);void 0===n[A]&&F(n);var o=r._state;if(o){var i=arguments[o-1];a(function(){return j(o,n,i,r._result)})}else U(r,n,t,e);return n}function g(t){if(t&&"object"===(void 0===t?"undefined":D(t))&&t.constructor===this)return t;var e=new this(E);return k(e,t),e}s?y=function(){return N.nextTick(p)}:u?(v=0,m=new u(p),w=document.createTextNode(""),m.observe(w,{characterData:!0}),y=function(){w.data=v=++v%2}):f?((h=new MessageChannel).port1.onmessage=p,y=function(){return h.port2.postMessage(0)}):y=void 0===t?function(){try{var t=Function("return this")().require("vertx");return void 0!==(e=t.runOnLoop||t.runOnContext)?function(){e(p)}:d()}catch(t){return d()}}():d();var A=Math.random().toString(36).substring(2);function E(){}var x=void 0,T=1,_=2,S={error:null};function I(t){try{return t.then}catch(t){return S.error=t,S}}function C(t,e,r){var n,o,i,u;e.constructor===t.constructor&&r===b&&e.constructor.resolve===g?(i=t,(u=e)._state===T?R(i,u._result):u._state===_?H(i,u._result):U(u,void 0,function(t){return k(i,t)},function(t){return H(i,t)})):r===S?(H(t,S.error),S.error=null):void 0===r?R(t,e):c(r)?(n=e,o=r,a(function(e){var r=!1,t=function(t,e,r,n){try{t.call(e,r,n)}catch(t){return t}}(o,n,function(t){r||(r=!0,n!==t?k(e,t):R(e,t))},function(t){r||(r=!0,H(e,t))},e._label);!r&&t&&(r=!0,H(e,t))},t)):R(t,e)}function k(t,e){var r,n;t===e?H(t,new TypeError("You cannot resolve a promise with itself")):(n=void 0===(r=e)?"undefined":D(r),null===r||"object"!==n&&"function"!==n?R(t,e):C(t,e,I(e)))}function O(t){t._onerror&&t._onerror(t._result),P(t)}function R(t,e){t._state===x&&(t._result=e,t._state=T,0!==t._subscribers.length&&a(P,t))}function H(t,e){t._state===x&&(t._state=_,t._result=e,a(O,t))}function U(t,e,r,n){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+T]=r,o[i+_]=n,0===i&&t._state&&a(P,t)}function P(t){var e=t._subscribers,r=t._state;if(0!==e.length){for(var n=void 0,o=void 0,i=t._result,u=0;u<e.length;u+=3)n=e[u],o=e[u+r],n?j(r,n,o,i):o(i);t._subscribers.length=0}}function j(t,e,r,n){var o=c(r),i=void 0,u=void 0,a=void 0,s=void 0;if(o){if((i=function(t,e){try{return t(e)}catch(t){return S.error=t,S}}(r,n))===S?(s=!0,u=i.error,i.error=null):a=!0,e===i)return void H(e,new TypeError("A promises callback cannot return that same promise."))}else i=n,a=!0;e._state!==x||(o&&a?k(e,i):s?H(e,u):t===T?R(e,i):t===_&&H(e,i))}var B=0;function F(t){t[A]=B++,t._state=void 0,t._result=void 0,t._subscribers=[]}var L=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(E),this.promise[A]||F(this.promise),r(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?R(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&R(this.promise,this._result))):H(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;this._state===x&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,n=r.resolve;if(n===g){var o=I(e);if(o===b&&e._state!==x)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(r===M){var i=new r(E);C(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new r(function(t){return t(e)}),t)}else this._willSettleAt(n(e),t)},t.prototype._settledAt=function(t,e,r){var n=this.promise;n._state===x&&(this._remaining--,t===_?H(n,r):this._result[e]=r),0===this._remaining&&R(n,this._result)},t.prototype._willSettleAt=function(t,e){var r=this;U(t,void 0,function(t){return r._settledAt(T,e,t)},function(t){return r._settledAt(_,e,t)})},t}();var M=function(){function e(t){this[A]=B++,this._result=this._state=void 0,this._subscribers=[],E!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(e,t){try{t(function(t){k(e,t)},function(t){H(e,t)})}catch(t){H(e,t)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(t){return this.then(null,t)},e.prototype.finally=function(e){var r=this.constructor;return this.then(function(t){return r.resolve(e()).then(function(){return t})},function(t){return r.resolve(e()).then(function(){throw t})})},e}();return M.prototype.then=b,M.all=function(t){return new L(this,t).promise},M.race=function(o){var i=this;return r(o)?new i(function(t,e){for(var r=o.length,n=0;n<r;n++)i.resolve(o[n]).then(t,e)}):new i(function(t,e){return e(new TypeError("You must pass an array to race."))})},M.resolve=g,M.reject=function(t){var e=new this(E);return H(e,t),e},M._setScheduler=function(t){o=t},M._setAsap=function(t){a=t},M._asap=a,M.polyfill=function(){var t=void 0;if(void 0!==Y)t=Y;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var r=null;try{r=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===r&&!e.cast)return}t.Promise=M},M.Promise=M},"object"===D(o)&&void 0!==n?n.exports=r():void 0===(e="function"==typeof(t=r)?t.call(o,i,o,n):t)||(n.exports=e)}).call(this,i(10),i(11))},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:u}catch(t){n=u}}();var s,c=[],f=!1,d=-1;function l(){f&&s&&(f=!1,s.length?c=s.concat(c):d=-1,c.length&&p())}function p(){if(!f){var t=a(l);f=!0;for(var e=c.length;e;){for(s=c,c=[];++d<e;)s&&s[d].run();d=-1,e=c.length}s=null,f=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===u||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function v(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new h(t,e)),1!==c.length||f||a(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ContactlabSDKBrowser=e():t.ContactlabSDKBrowser=e()}(window,function(){return function(r){var n={};function o(t){if(n[t])return n[t].exports;var e=n[t]={i:t,l:!1,exports:{}};return r[t].call(e.exports,e,e.exports,o),e.l=!0,e.exports}return o.m=r,o.c=n,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},o.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=0)}([function(t,e,r){"use strict";var H=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},U=o(r(1)),n=o(r(2)),P=o(r(7)),j=o(r(8)),B=r(9);function o(t){return t&&t.__esModule?t:{default:t}}U.default.configure({promise:function(t){return new B.Promise(t)}});var i=window.ContactHubObject||"ch",F=window.ContactHubCookie||"_ch",v=window.ContactHubUtmCookie||"_chutm",L=window.ContactHubAPI||"https://api.contactlab.it/hub/v1",u=function(t){var e=RegExp("[?&]"+t+"=([^&]*)").exec(window.location.href);return e&&decodeURIComponent(e[1].replace(/\+/g," "))||void 0},a=function(){return n.default.v4()},M=function(){var t=j.default.getJSON(F);if(!t)throw new Error("Missing required ContactHub configuration.");if(!(t.workspaceId&&t.nodeId&&t.token))throw new Error("Missing required ContactHub configuration.");return t},s=function(t){var e=M(),r=e.workspaceId,n=e.nodeId,o=e.token,i=e.context,u=e.contextInfo,a=e.sid,s=e.customerId,c=j.default.getJSON(v),f=t.type,d=t.properties;if(!f)throw new Error("Missing required event type");var l=function(t,e){if("viewedPage"===t){var r={title:document.title,url:window.location.href,path:window.location.pathname,referer:document.referrer};return H(r,e)}return H({},e)}(f,d),p=c&&c.utm_source?{ga:c}:void 0,h=s?void 0:{type:"SESSION_ID",value:a,nodeId:n};(0,U.default)({method:"POST",url:L+"/workspaces/"+r+"/events",data:{type:f,context:i,contextInfo:u,properties:l,tracking:p,customerId:s,bringBackProperties:h},headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+o}})},N=function(t){var e=t.customerId,r=t.workspaceId,n=t.token,o=t.externalId,i=t.base,u=t.extended,a=t.consents,s=t.extra,c=t.tags;return(0,U.default)({method:"PATCH",url:L+"/workspaces/"+r+"/customers/"+e,headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+n},data:{externalId:o,base:i,extended:u,consents:a,extra:s,tags:c}}).then(function(){return e})},Y=function(){j.default.set(F,H(M(),{sid:a(),customerId:void 0,hash:void 0}))},c=function(t){if(t){var e,r,n,o,i,u,a,s,c,f,d,l,p,h,v=M(),m=v.workspaceId,w=v.nodeId,y=v.token,b=v.customerId,g=v.hash,A=t.id,E=t.externalId,x=t.base,T=t.extended,_=t.consents,S=t.extra,I=t.tags,k=(e={base:x,extended:T,consents:_,extra:S,tags:I,externalId:E},(r=new P.default("SHA-256","TEXT")).update(JSON.stringify(e)),r.getHash("HEX")),C=function(t){return E||x||T||_||S||I?N({customerId:t,workspaceId:m,nodeId:w,token:y,externalId:E,base:x,extended:T,consents:_,extra:S,tags:I}):B.Promise.resolve(t)},O=function(t){return r=(e={customerId:t,workspaceId:m,token:y,nodeId:w}).customerId,n=e.workspaceId,o=e.token,(0,U.default)({method:"POST",url:L+"/workspaces/"+n+"/customers/"+r+"/sessions",headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+o},data:{value:M().sid}}).then(function(){return r});var e,r,n,o},R=function(t){return j.default.set(F,H(M(),{customerId:t,hash:k})),t};if(g!==k)A&&b?(p=A,h=b,p===h?B.Promise.resolve(p):E||x||T||_||S||I?(Y(),O(p)):B.Promise.reject("The provided id conflicts with the id stored in the cookie")).then(C).then(R):A?O(A).then(C).then(R):b?C(b).then(R):(o=(n={workspaceId:m,nodeId:w,token:y,externalId:E,base:x,extended:T,consents:_,extra:S,tags:I}).workspaceId,i=n.nodeId,u=n.token,a=n.externalId,s=n.base,c=n.extended,f=n.consents,d=n.extra,l=n.tags,(0,U.default)({method:"POST",url:L+"/workspaces/"+o+"/customers",headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+u},data:{nodeId:i,externalId:a,base:s,extended:c,consents:f,extra:d,tags:l}}).then(function(t){return t.data.id})).catch(function(t){if(409===t.status){var e=JSON.parse(t.response).data.customer.id;return N({customerId:e,workspaceId:m,nodeId:w,token:y,externalId:E,base:x,extended:T,consents:_,extra:S,tags:I})}return B.Promise.reject(t)}).then(R).then(O)}else Y()},f=["token","workspaceId","nodeId","context","contextInfo"],d=function(r){if(!(r.workspaceId&&r.nodeId&&r.token))throw new Error("Invalid ContactHub configuration");var t=j.default.getJSON(F)||{},e=r.token!==t.token?{}:t,n=j.default.getJSON(v)||{};u("utm_source")&&(n.utm_source=u("utm_source"),n.utm_medium=u("utm_medium"),n.utm_term=u("utm_term"),n.utm_content=u("utm_content"),n.utm_campaign=u("utm_campaign")),e.sid=e.sid||a();var o=Object.keys(r).filter(function(t){return-1!==f.indexOf(t)}).reduce(function(t,e){return t[e]=r[e],t},{});H(e,o),e.context=e.context||"WEB",e.contextInfo=e.contextInfo||{},j.default.set(F,e,{expires:365}),j.default.set(v,n,{expires:1/48});var i=u("clabId");i&&c({id:i})},l=function(t,e){if(Array.prototype.map){var r={config:d,customer:c,event:s};t in r&&r[t].call(void 0,e)}};window[i]&&window[i].q&&(Array.prototype.map&&window[i].q.map(function(t){return l(t[0],t[1])}));window[i]=l},function(t,e,r){t.exports=function(r){function n(t){if(o[t])return o[t].exports;var e=o[t]={exports:{},id:t,loaded:!1};return r[t].call(e.exports,e,e.exports,n),e.loaded=!0,e.exports}var o={};return n.m=r,n.c=o,n.p="/",n(0)}([function(t,e,r){t.exports=r(1)},function(t,e,r){"use strict";function s(t,e){return{status:t.status,response:t.response,data:e,xhr:t}}function c(t){for(var e=arguments.length,r=Array(1<e?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];for(var o in r)if({}.hasOwnProperty.call(r,o)){var i=r[o];if("object"===(void 0===i?"undefined":f(i)))for(var u in i)({}).hasOwnProperty.call(i,u)&&(t[u]=i[u])}return t}function n(a){return e=function(e,r){var n=c({},h,v,a),o=n.xmlHttpRequest();for(var t in o.withCredentials=n.withCredentials,n.abort&&a.abort(function(){r(s(o)),o.abort()}),o.open(n.method,n.params?n.url.split("?")[0]+"?"+(0,d.default)(n.params):n.url,!0),o.addEventListener(l.LOAD,function(){if(200<=o.status&&o.status<300){var t=null;o.responseText&&(t=!0===n.raw?o.responseText:n.load(o.responseText)),e(s(o,t))}else r(s(o))}),o.addEventListener(l.ABORT,function(){return r(s(o))}),o.addEventListener(l.ERROR,function(){return r(s(o))}),o.addEventListener(l.TIMEOUT,function(){return r(s(o))}),n.headers)({}).hasOwnProperty.call(n.headers,t)&&o.setRequestHeader(t,n.headers[t]);for(var i in n.events)({}).hasOwnProperty.call(n.events,i)&&o.addEventListener(i,n.events[i].bind(null,o),!1);var u="object"!==f(n.data)||n.raw?n.data:n.dump(n.data);void 0!==u?o.send(u):o.send()},((t=a)&&t.promise?t.promise:v.promise||h.promise)(e);var t,e}e.__esModule=!0;var o,f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},i=r(2),d=(o=i)&&o.__esModule?o:{default:o},u={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"},a="undefined"==typeof JSON?function(){}:JSON.stringify,p="undefined"==typeof JSON?function(){}:JSON.parse,h={method:u.GET,data:void 0,headers:{Accept:"application/json","Content-Type":"application/json"},dump:a,load:p,xmlHttpRequest:function(){return new XMLHttpRequest},promise:function(t){return new Promise(t)},withCredentials:!1},v={};n.assign=c,n.encode=d.default,n.configure=function(t){v=c({},v,t)},n.Methods=u,n.Events=l,n.defaults=h,n.get=function(t,e,r){return n(c({url:t,method:u.GET,params:e},r))},n.put=function(t,e,r){return n(c({url:t,method:u.PUT,data:e},r))},n.post=function(t,e,r){return n(c({url:t,method:u.POST,data:e},r))},n.patch=function(t,e,r){return n(c({url:t,method:u.PATCH,data:e},r))},n.del=function(t,e){return n(c({url:t,method:u.DELETE},e))},n.options=function(t,e){return n(c({url:t,method:u.OPTIONS},e))},e.default=n},function(t,e){"use strict";var i=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(r,n,o,t){return n=n||"&",o=o||"=",null===r&&(r=void 0),"object"==typeof r?Object.keys(r).map(function(t){var e=encodeURIComponent(i(t))+o;return Array.isArray(r[t])?r[t].map(function(t){return e+encodeURIComponent(i(t))}).join(n):e+encodeURIComponent(i(r[t]))}).join(n):t?encodeURIComponent(i(t))+o+encodeURIComponent(i(r)):""}}])},function(t,e,r){var n=r(3),o=r(6),i=o;i.v1=n,i.v4=o,t.exports=i},function(t,e,r){var h,v,m=r(4),w=r(5),y=0,b=0;t.exports=function(t,e,r){var n=e&&r||0,o=e||[],i=(t=t||{}).node||h,u=void 0!==t.clockseq?t.clockseq:v;if(null==i||null==u){var a=m();null==i&&(i=h=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==u&&(u=v=16383&(a[6]<<8|a[7]))}var s=void 0!==t.msecs?t.msecs:(new Date).getTime(),c=void 0!==t.nsecs?t.nsecs:b+1,f=s-y+(c-b)/1e4;if(f<0&&void 0===t.clockseq&&(u=u+1&16383),(f<0||y<s)&&void 0===t.nsecs&&(c=0),1e4<=c)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");y=s,v=u;var d=(1e4*(268435455&(s+=122192928e5))+(b=c))%4294967296;o[n++]=d>>>24&255,o[n++]=d>>>16&255,o[n++]=d>>>8&255,o[n++]=255&d;var l=s/4294967296*1e4&268435455;o[n++]=l>>>8&255,o[n++]=255&l,o[n++]=l>>>24&15|16,o[n++]=l>>>16&255,o[n++]=u>>>8|128,o[n++]=255&u;for(var p=0;p<6;++p)o[n+p]=i[p];return e||w(o)}},function(t,e){var r="undefined"!=typeof crypto&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&msCrypto.getRandomValues.bind(msCrypto);if(r){var n=new Uint8Array(16);t.exports=function(){return r(n),n}}else{var o=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),o[e]=t>>>((3&e)<<3)&255;return o}}},function(t,e){for(var o=[],r=0;r<256;++r)o[r]=(r+256).toString(16).substr(1);t.exports=function(t,e){var r=e||0,n=o;return n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]}},function(t,e,r){var u=r(4),a=r(5);t.exports=function(t,e,r){var n=e&&r||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var o=(t=t||{}).random||(t.rng||u)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e)for(var i=0;i<16;++i)e[n+i]=o[i];return e||a(o)}},function(o,i,u){"use strict";var a;!function(t){function e(u,t,e){var o,a,s,c,f,d,l,p,h,v=0,m=[],w=0,y=!1,i=[],b=[],g=!1;if(o=(e=e||{}).encoding||"UTF8",(h=e.numRounds||1)!==parseInt(h,10)||h<1)throw Error("numRounds must a integer >= 1");if(0!==u.lastIndexOf("SHA-",0))throw Error("Chosen SHA variant is not supported");if(d=function(t,e){return F(t,e,u)},l=function(t,e,r,n){var o,i;if("SHA-224"!==u&&"SHA-256"!==u)throw Error("Unexpected error in SHA-2 implementation");for(o=15+(e+65>>>9<<4),i=16;t.length<=o;)t.push(0);for(t[e>>>5]|=128<<24-e%32,e+=r,t[o]=4294967295&e,t[o-1]=e/4294967296|0,r=t.length,e=0;e<r;e+=i)n=F(t.slice(e,e+i),n,u);if("SHA-224"===u)t=[n[0],n[1],n[2],n[3],n[4],n[5],n[6]];else{if("SHA-256"!==u)throw Error("Unexpected error in SHA-2 implementation");t=n}return t},p=function(t){return t.slice()},"SHA-224"===u)f=512,c=224;else{if("SHA-256"!==u)throw Error("Chosen SHA variant is not supported");f=512,c=256}s=S(t,o),a=B(u),this.setHMACKey=function(t,e,r){var n;if(!0===y)throw Error("HMAC key already set");if(!0===g)throw Error("Cannot set HMAC key after calling update");if(t=(e=S(e,o=(r||{}).encoding||"UTF8")(t)).binLen,e=e.value,r=(n=f>>>3)/4-1,n<t/8){for(e=l(e,t,0,B(u));e.length<=r;)e.push(0);e[r]&=4294967040}else if(t/8<n){for(;e.length<=r;)e.push(0);e[r]&=4294967040}for(t=0;t<=r;t+=1)i[t]=909522486^e[t],b[t]=1549556828^e[t];a=d(i,a),v=f,y=!0},this.update=function(t){var e,r,n,o=0,i=f>>>5;for(t=(e=s(t,m,w)).binLen,r=e.value,e=t>>>5,n=0;n<e;n+=i)o+f<=t&&(a=d(r.slice(n,n+i),a),o+=f);v+=o,m=r.slice(o>>>5),w=t%f,g=!0},this.getHash=function(t,e){var r,n,o,i;if(!0===y)throw Error("Cannot call getHash after setting HMAC key");switch(o=_(e),t){case"HEX":r=function(t){return A(t,c,o)};break;case"B64":r=function(t){return E(t,c,o)};break;case"BYTES":r=function(t){return x(t,c)};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}r=function(t){return T(t,c)};break;default:throw Error("format must be HEX, B64, BYTES, or ARRAYBUFFER")}for(i=l(m.slice(),w,v,p(a)),n=1;n<h;n+=1)i=l(i,c,0,B(u));return r(i)},this.getHMAC=function(t,e){var r,n,o,i;if(!1===y)throw Error("Cannot call getHMAC without first setting HMAC key");switch(o=_(e),t){case"HEX":r=function(t){return A(t,c,o)};break;case"B64":r=function(t){return E(t,c,o)};break;case"BYTES":r=function(t){return x(t,c)};break;case"ARRAYBUFFER":try{r=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}r=function(t){return T(t,c)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, or ARRAYBUFFER")}return n=l(m.slice(),w,v,p(a)),i=d(b,B(u)),r(i=l(n,c,f,i))}}function n(){}function A(t,e,r){var n,o,i="";for(e/=8,n=0;n<e;n+=1)o=t[n>>>2]>>>8*(3+n%4*-1),i+="0123456789abcdef".charAt(o>>>4&15)+"0123456789abcdef".charAt(15&o);return r.outputUpper?i.toUpperCase():i}function E(t,e,r){var n,o,i,u="",a=e/8;for(n=0;n<a;n+=3)for(o=n+1<a?t[n+1>>>2]:0,i=n+2<a?t[n+2>>>2]:0,i=(t[n>>>2]>>>8*(3+n%4*-1)&255)<<16|(o>>>8*(3+(n+1)%4*-1)&255)<<8|i>>>8*(3+(n+2)%4*-1)&255,o=0;o<4;o+=1)u+=8*n+6*o<=e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(i>>>6*(3-o)&63):r.b64Pad;return u}function x(t,e){var r,n,o="",i=e/8;for(r=0;r<i;r+=1)n=t[r>>>2]>>>8*(3+r%4*-1)&255,o+=String.fromCharCode(n);return o}function T(t,e){var r,n,o=e/8,i=new ArrayBuffer(o);for(n=new Uint8Array(i),r=0;r<o;r+=1)n[r]=t[r>>>2]>>>8*(3+r%4*-1)&255;return i}function _(t){var e={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(t=t||{},e.outputUpper=t.outputUpper||!1,!0===t.hasOwnProperty("b64Pad")&&(e.b64Pad=t.b64Pad),"boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function S(t,l){var e;switch(l){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":e=function(t,e,r){var n,o,i,u,a,s=t.length;if(0!=s%2)throw Error("String of HEX type must be in byte increments");for(e=e||[0],a=(r=r||0)>>>3,n=0;n<s;n+=2){if(o=parseInt(t.substr(n,2),16),isNaN(o))throw Error("String of HEX type contains invalid characters");for(i=(u=(n>>>1)+a)>>>2;e.length<=i;)e.push(0);e[i]|=o<<8*(3+u%4*-1)}return{value:e,binLen:4*s+r}};break;case"TEXT":e=function(t,e,r){var n,o,i,u,a,s,c,f,d=0;if(e=e||[0],a=(r=r||0)>>>3,"UTF8"===l)for(f=3,i=0;i<t.length;i+=1)for(o=[],(n=t.charCodeAt(i))<128?o.push(n):n<2048?(o.push(192|n>>>6),o.push(128|63&n)):n<55296||57344<=n?o.push(224|n>>>12,128|n>>>6&63,128|63&n):(i+=1,n=65536+((1023&n)<<10|1023&t.charCodeAt(i)),o.push(240|n>>>18,128|n>>>12&63,128|n>>>6&63,128|63&n)),u=0;u<o.length;u+=1){for(s=(c=d+a)>>>2;e.length<=s;)e.push(0);e[s]|=o[u]<<8*(f+c%4*-1),d+=1}else if("UTF16BE"===l||"UTF16LE"===l)for(f=2,o="UTF16LE"===l||"UTF16LE"!==l&&!1,i=0;i<t.length;i+=1){for(n=t.charCodeAt(i),!0===o&&(n=(u=255&n)<<8|n>>>8),s=(c=d+a)>>>2;e.length<=s;)e.push(0);e[s]|=n<<8*(f+c%4*-1),d+=2}return{value:e,binLen:8*d+r}};break;case"B64":e=function(t,e,r){var n,o,i,u,a,s,c,f=0;if(-1===t.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(o=t.indexOf("="),t=t.replace(/\=/g,""),-1!==o&&o<t.length)throw Error("Invalid '=' found in base-64 string");for(e=e||[0],s=(r=r||0)>>>3,o=0;o<t.length;o+=4){for(a=t.substr(o,4),i=u=0;i<a.length;i+=1)u|=(n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a[i]))<<18-6*i;for(i=0;i<a.length-1;i+=1){for(n=(c=f+s)>>>2;e.length<=n;)e.push(0);e[n]|=(u>>>16-8*i&255)<<8*(3+c%4*-1),f+=1}}return{value:e,binLen:8*f+r}};break;case"BYTES":e=function(t,e,r){var n,o,i,u,a;for(e=e||[0],i=(r=r||0)>>>3,o=0;o<t.length;o+=1)n=t.charCodeAt(o),u=(a=o+i)>>>2,e.length<=u&&e.push(0),e[u]|=n<<8*(3+a%4*-1);return{value:e,binLen:8*t.length+r}};break;case"ARRAYBUFFER":try{e=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}e=function(t,e,r){var n,o,i,u,a;for(e=e||[0],o=(r=r||0)>>>3,a=new Uint8Array(t),n=0;n<t.byteLength;n+=1)i=(u=n+o)>>>2,e.length<=i&&e.push(0),e[i]|=a[n]<<8*(3+u%4*-1);return{value:e,binLen:8*t.byteLength+r}};break;default:throw Error("format must be HEX, TEXT, B64, BYTES, or ARRAYBUFFER")}return e}function r(t,e){return t>>>e|t<<32-e}function I(t,e,r){return t&e^~t&r}function k(t,e,r){return t&e^t&r^e&r}function C(t){return r(t,2)^r(t,13)^r(t,22)}function O(t){return r(t,6)^r(t,11)^r(t,25)}function R(t){return r(t,7)^r(t,18)^t>>>3}function H(t){return r(t,17)^r(t,19)^t>>>10}function U(t,e){var r=(65535&t)+(65535&e);return((t>>>16)+(e>>>16)+(r>>>16)&65535)<<16|65535&r}function P(t,e,r,n){var o=(65535&t)+(65535&e)+(65535&r)+(65535&n);return((t>>>16)+(e>>>16)+(r>>>16)+(n>>>16)+(o>>>16)&65535)<<16|65535&o}function j(t,e,r,n,o){var i=(65535&t)+(65535&e)+(65535&r)+(65535&n)+(65535&o);return((t>>>16)+(e>>>16)+(r>>>16)+(n>>>16)+(o>>>16)+(i>>>16)&65535)<<16|65535&i}function B(t){var e,r=[];if(0!==t.lastIndexOf("SHA-",0))throw Error("No SHA variants supported");switch(r=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],e=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t){case"SHA-224":break;case"SHA-256":r=e;break;case"SHA-384":case"SHA-512":r=[new n,new n,new n,new n,new n,new n,new n,new n];break;default:throw Error("Unknown SHA variant")}return r}function F(t,e,r){var n,o,i,u,a,s,c,f,d,l,p,h,v,m,w,y,b,g,A,E,x,T,_,S=[];if("SHA-224"!==r&&"SHA-256"!==r)throw Error("Unexpected error in SHA-2 implementation");for(l=64,h=1,T=Number,v=U,m=P,w=j,y=R,b=H,g=C,A=O,x=k,E=I,_=L,r=e[0],n=e[1],o=e[2],i=e[3],u=e[4],a=e[5],s=e[6],c=e[7],p=0;p<l;p+=1)p<16?(d=p*h,f=t.length<=d?0:t[d],d=t.length<=d+1?0:t[d+1],S[p]=new T(f,d)):S[p]=m(b(S[p-2]),S[p-7],y(S[p-15]),S[p-16]),f=w(c,A(u),E(u,a,s),_[p],S[p]),d=v(g(r),x(r,n,o)),c=s,s=a,a=u,u=v(i,f),i=o,o=n,n=r,r=v(f,d);return e[0]=v(r,e[0]),e[1]=v(n,e[1]),e[2]=v(o,e[2]),e[3]=v(i,e[3]),e[4]=v(u,e[4]),e[5]=v(a,e[5]),e[6]=v(s,e[6]),e[7]=v(c,e[7]),e}var L;L=[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],void 0===(a=function(){return e}.call(i,u,i,o))||(o.exports=a)}()},function(n,o,i){var u,a;!function(t){if(void 0===(a="function"==typeof(u=t)?u.call(o,i,o,n):u)||(n.exports=a),!0,n.exports=t(),!!0){var e=window.Cookies,r=window.Cookies=t();r.noConflict=function(){return window.Cookies=e,r}}}(function(){function v(){for(var t=0,e={};t<arguments.length;t++){var r=arguments[t];for(var n in r)e[n]=r[n]}return e}return function t(p){function h(t,e,r){var n;if("undefined"!=typeof document){if(1<arguments.length){if("number"==typeof(r=v({path:"/"},h.defaults,r)).expires){var o=new Date;o.setMilliseconds(o.getMilliseconds()+864e5*r.expires),r.expires=o}r.expires=r.expires?r.expires.toUTCString():"";try{n=JSON.stringify(e),/^[\{\[]/.test(n)&&(e=n)}catch(t){}e=p.write?p.write(e,t):encodeURIComponent(String(e)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=(t=(t=encodeURIComponent(String(t))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape);var i="";for(var u in r)r[u]&&(i+="; "+u,!0!==r[u]&&(i+="="+r[u]));return document.cookie=t+"="+e+i}t||(n={});for(var a=document.cookie?document.cookie.split("; "):[],s=/(%[0-9A-Z]{2})+/g,c=0;c<a.length;c++){var f=a[c].split("="),d=f.slice(1).join("=");this.json||'"'!==d.charAt(0)||(d=d.slice(1,-1));try{var l=f[0].replace(s,decodeURIComponent);if(d=p.read?p.read(d,l):p(d,l)||d.replace(s,decodeURIComponent),this.json)try{d=JSON.parse(d)}catch(t){}if(t===l){n=d;break}t||(n[l]=d)}catch(t){}}return n}}return(h.set=h).get=function(t){return h.call(h,t)},h.getJSON=function(){return h.apply({json:!0},[].slice.call(arguments))},h.defaults={},h.remove=function(t,e){h(t,"",v(e,{expires:-1}))},h.withConverter=t,h}(function(){})})},function(n,o,i){"use strict";(function(N,Y){var t,e,r,D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};r=function(){function c(t){return"function"==typeof t}var r=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},n=0,e=void 0,o=void 0,a=function(t,e){l[n]=t,l[n+1]=e,2===(n+=2)&&(o?o(p):y())};var t="undefined"!=typeof window?window:void 0,i=t||{},u=i.MutationObserver||i.WebKitMutationObserver,s="undefined"==typeof self&&void 0!==N&&"[object process]"==={}.toString.call(N),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(p,1)}}var l=new Array(1e3);function p(){for(var t=0;t<n;t+=2){(0,l[t])(l[t+1]),l[t]=void 0,l[t+1]=void 0}n=0}var h,v,m,w,y=void 0;function b(t,e){var r=this,n=new this.constructor(E);void 0===n[A]&&F(n);var o=r._state;if(o){var i=arguments[o-1];a(function(){return j(o,n,i,r._result)})}else U(r,n,t,e);return n}function g(t){if(t&&"object"===(void 0===t?"undefined":D(t))&&t.constructor===this)return t;var e=new this(E);return C(e,t),e}s?y=function(){return N.nextTick(p)}:u?(v=0,m=new u(p),w=document.createTextNode(""),m.observe(w,{characterData:!0}),y=function(){w.data=v=++v%2}):f?((h=new MessageChannel).port1.onmessage=p,y=function(){return h.port2.postMessage(0)}):y=void 0===t?function(){try{var t=Function("return this")().require("vertx");return void 0!==(e=t.runOnLoop||t.runOnContext)?function(){e(p)}:d()}catch(t){return d()}}():d();var A=Math.random().toString(36).substring(2);function E(){}var x=void 0,T=1,_=2,S={error:null};function I(t){try{return t.then}catch(t){return S.error=t,S}}function k(t,e,r){var n,o,i,u;e.constructor===t.constructor&&r===b&&e.constructor.resolve===g?(i=t,(u=e)._state===T?R(i,u._result):u._state===_?H(i,u._result):U(u,void 0,function(t){return C(i,t)},function(t){return H(i,t)})):r===S?(H(t,S.error),S.error=null):void 0===r?R(t,e):c(r)?(n=e,o=r,a(function(e){var r=!1,t=function(t,e,r,n){try{t.call(e,r,n)}catch(t){return t}}(o,n,function(t){r||(r=!0,n!==t?C(e,t):R(e,t))},function(t){r||(r=!0,H(e,t))},e._label);!r&&t&&(r=!0,H(e,t))},t)):R(t,e)}function C(t,e){var r,n;t===e?H(t,new TypeError("You cannot resolve a promise with itself")):(n=void 0===(r=e)?"undefined":D(r),null===r||"object"!==n&&"function"!==n?R(t,e):k(t,e,I(e)))}function O(t){t._onerror&&t._onerror(t._result),P(t)}function R(t,e){t._state===x&&(t._result=e,t._state=T,0!==t._subscribers.length&&a(P,t))}function H(t,e){t._state===x&&(t._state=_,t._result=e,a(O,t))}function U(t,e,r,n){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+T]=r,o[i+_]=n,0===i&&t._state&&a(P,t)}function P(t){var e=t._subscribers,r=t._state;if(0!==e.length){for(var n=void 0,o=void 0,i=t._result,u=0;u<e.length;u+=3)n=e[u],o=e[u+r],n?j(r,n,o,i):o(i);t._subscribers.length=0}}function j(t,e,r,n){var o=c(r),i=void 0,u=void 0,a=void 0,s=void 0;if(o){if((i=function(t,e){try{return t(e)}catch(t){return S.error=t,S}}(r,n))===S?(s=!0,u=i.error,i.error=null):a=!0,e===i)return void H(e,new TypeError("A promises callback cannot return that same promise."))}else i=n,a=!0;e._state!==x||(o&&a?C(e,i):s?H(e,u):t===T?R(e,i):t===_&&H(e,i))}var B=0;function F(t){t[A]=B++,t._state=void 0,t._result=void 0,t._subscribers=[]}var L=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(E),this.promise[A]||F(this.promise),r(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?R(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&R(this.promise,this._result))):H(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;this._state===x&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,n=r.resolve;if(n===g){var o=I(e);if(o===b&&e._state!==x)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(r===M){var i=new r(E);k(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new r(function(t){return t(e)}),t)}else this._willSettleAt(n(e),t)},t.prototype._settledAt=function(t,e,r){var n=this.promise;n._state===x&&(this._remaining--,t===_?H(n,r):this._result[e]=r),0===this._remaining&&R(n,this._result)},t.prototype._willSettleAt=function(t,e){var r=this;U(t,void 0,function(t){return r._settledAt(T,e,t)},function(t){return r._settledAt(_,e,t)})},t}();var M=function(){function e(t){this[A]=B++,this._result=this._state=void 0,this._subscribers=[],E!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(e,t){try{t(function(t){C(e,t)},function(t){H(e,t)})}catch(t){H(e,t)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(t){return this.then(null,t)},e.prototype.finally=function(e){var r=this.constructor;return this.then(function(t){return r.resolve(e()).then(function(){return t})},function(t){return r.resolve(e()).then(function(){throw t})})},e}();return M.prototype.then=b,M.all=function(t){return new L(this,t).promise},M.race=function(o){var i=this;return r(o)?new i(function(t,e){for(var r=o.length,n=0;n<r;n++)i.resolve(o[n]).then(t,e)}):new i(function(t,e){return e(new TypeError("You must pass an array to race."))})},M.resolve=g,M.reject=function(t){var e=new this(E);return H(e,t),e},M._setScheduler=function(t){o=t},M._setAsap=function(t){a=t},M._asap=a,M.polyfill=function(){var t=void 0;if(void 0!==Y)t=Y;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var r=null;try{r=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===r&&!e.cast)return}t.Promise=M},M.Promise=M},"object"===D(o)&&void 0!==n?n.exports=r():void 0===(e="function"==typeof(t=r)?t.call(o,i,o,n):t)||(n.exports=e)}).call(this,i(10),i(11))},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:u}catch(t){n=u}}();var s,c=[],f=!1,d=-1;function l(){f&&s&&(f=!1,s.length?c=s.concat(c):d=-1,c.length&&p())}function p(){if(!f){var t=a(l);f=!0;for(var e=c.length;e;){for(s=c,c=[];++d<e;)s&&s[d].run();d=-1,e=c.length}s=null,f=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===u||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function v(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new h(t,e)),1!==c.length||f||a(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r}])}); |
{ | ||
"name": "@contactlab/sdk-browser", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "ContactHub Browser SDK", | ||
@@ -5,0 +5,0 @@ "main": "dist/sdk.js", |
@@ -60,6 +60,10 @@ [![Build Status](https://travis-ci.org/contactlab/contacthub-sdk-browser.svg?branch=master)](https://travis-ci.org/contactlab/contacthub-sdk-browser) | ||
token: 'UYTF546FUTF636JH', // required, found in the ContactHub admin area | ||
context: 'CTX' // optional, defaults to 'WEB' | ||
context: 'CTX', // optional, defaults to 'WEB' | ||
contextInfo: {} // optional, defaults to an empty object | ||
}); | ||
``` | ||
The JSON schemas for the `contextInfo` property can be found at | ||
http://developer.contactlab.com/documentation/contacthub/schemas/ | ||
### The customer API | ||
@@ -70,3 +74,3 @@ | ||
The full schemas for all Customer properties can be found at | ||
The JSON schemas for all Customer properties can be found at | ||
http://developer.contactlab.com/documentation/contacthub/schemas/ | ||
@@ -73,0 +77,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
529664
4020
280