@bearer/js
Advanced tools
Comparing version 0.97.3 to 0.98.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [0.98.0](https://github.com/Bearer/bearer/packages/js/compare/v0.97.4...v0.98.0) (2019-02-28) | ||
### Features | ||
* **js:** allow bearer to receive options ([#549](https://github.com/Bearer/bearer/packages/js/issues/549)) ([96b4977](https://github.com/Bearer/bearer/packages/js/commit/96b4977)) | ||
## [0.97.3](https://github.com/Bearer/bearer/packages/js/compare/v0.97.2...v0.97.3) (2019-02-27) | ||
@@ -8,0 +19,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).bearer=e()}(this,function(){"use strict";function t(t,e,n,r){return new(n||(n=Promise))(function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){t.done?o(t.value):new n(function(e){e(t.value)}).then(s,a)}c((r=r.apply(t,e||[])).next())})}function e(t,e,n){var r,o,i,s,a;function c(){var u=Date.now()-s;u<e&&u>=0?r=setTimeout(c,e-u):(r=null,n||(a=t.apply(i,o),i=o=null))}null==e&&(e=100);var u=function(){i=this,o=arguments,s=Date.now();var u=n&&!r;return r||(r=setTimeout(c,e)),u&&(a=t.apply(i,o),i=o=null),a};return u.clear=function(){r&&(clearTimeout(r),r=null)},u.flush=function(){r&&(a=t.apply(i,o),i=o=null,clearTimeout(r),r=null)},u}e.debounce=e;var n=e,r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(t,e){return t(e={exports:{}},e.exports),e.exports}var i,s=o(function(t,e){!function(t){var e=1e3,n=6e4,r=36e5,o=24*r,i=function(t,i){i=i||{};var a=typeof t;if("string"===a&&t.length>0)return function(t){if(!((t=String(t)).length>100)){var i=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(i){var s=parseFloat(i[1]);switch((i[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return 6048e5*s;case"days":case"day":case"d":return s*o;case"hours":case"hour":case"hrs":case"hr":case"h":return s*r;case"minutes":case"minute":case"mins":case"min":case"m":return s*n;case"seconds":case"second":case"secs":case"sec":case"s":return s*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}}}(t);if("number"===a&&!1===isNaN(t))return i.long?function(t){var i=Math.abs(t);return i>=o?s(t,i,o,"day"):i>=r?s(t,i,r,"hour"):i>=n?s(t,i,n,"minute"):i>=e?s(t,i,e,"second"):t+" ms"}(t):function(t){var i=Math.abs(t);return i>=o?Math.round(t/o)+"d":i>=r?Math.round(t/r)+"h":i>=n?Math.round(t/n)+"m":i>=e?Math.round(t/e)+"s":t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function s(t,e,n,r){var o=e>=1.5*n;return Math.round(t/n)+" "+r+(o?"s":"")}var a,c=(function(t,e){e.log=function(...t){return"object"==typeof console&&console.log&&console.log(...t)},e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;e.splice(1,0,n,"color: inherit");let r=0,o=0;e[0].replace(/%[a-zA-Z%]/g,t=>{"%%"!==t&&(r++,"%c"===t&&(o=r))}),e.splice(o,0,n)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(t){}return!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG),t},e.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},e.storage=function(){try{return localStorage}catch(t){}}(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.exports=function(t){function e(t){let e=0;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return n.colors[Math.abs(e)%n.colors.length]}function n(t){let i;function s(...t){if(!s.enabled)return;const e=s,r=Number(new Date),o=r-(i||r);e.diff=o,e.prev=i,e.curr=r,i=r,t[0]=n.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let a=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,(r,o)=>{if("%%"===r)return r;a++;const i=n.formatters[o];if("function"==typeof i){const n=t[a];r=i.call(e,n),t.splice(a,1),a--}return r}),n.formatArgs.call(e,t),(e.log||n.log).apply(e,t)}return s.namespace=t,s.enabled=n.enabled(t),s.useColors=n.useColors(),s.color=e(t),s.destroy=r,s.extend=o,"function"==typeof n.init&&n.init(s),n.instances.push(s),s}function r(){const t=n.instances.indexOf(this);return-1!==t&&(n.instances.splice(t,1),!0)}function o(t,e){const r=n(this.namespace+(void 0===e?":":e)+t);return r.log=this.log,r}function s(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(t){return t instanceof Error?t.stack||t.message:t},n.disable=function(){const t=[...n.names.map(s),...n.skips.map(s).map(t=>"-"+t)].join(",");return n.enable(""),t},n.enable=function(t){let e;n.save(t),n.names=[],n.skips=[];const r=("string"==typeof t?t:"").split(/[\s,]+/),o=r.length;for(e=0;e<o;e++)r[e]&&("-"===(t=r[e].replace(/\*/g,".*?"))[0]?n.skips.push(new RegExp("^"+t.substr(1)+"$")):n.names.push(new RegExp("^"+t+"$")));for(e=0;e<n.instances.length;e++){const t=n.instances[e];t.enabled=n.enabled(t.namespace)}},n.enabled=function(t){if("*"===t[t.length-1])return!0;let e,r;for(e=0,r=n.skips.length;e<r;e++)if(n.skips[e].test(t))return!1;for(e=0,r=n.names.length;e<r;e++)if(n.names[e].test(t))return!0;return!1},n.humanize=i,Object.keys(t).forEach(e=>{n[e]=t[e]}),n.instances=[],n.names=[],n.skips=[],n.formatters={},n.selectColor=e,n.enable(n.load()),n}(e);const{formatters:n}=t.exports;n.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}(a={exports:{}},a.exports),a.exports);c.log,c.formatArgs,c.save,c.load,c.useColors,c.storage,c.colors,t.default=(t=>c(`bearer:${t}`)),t.BearerIntentLogger=class{constructor(t){this.log=(t=>{c("bearer:intents")("%j",{data:t,scenarioId:this.context.integrationUuid,intentName:this.context.intentName})}),this.context=t}},Object.defineProperty(t,"__esModule",{value:!0})}(e)}),a=((i=s)&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i)("js");const c="bearer",u={domObserver:!0,refreshDebounceDelay:200};class l{constructor(e,r){this.clientId=e,this.registeredIntegrations={},this.config=u,this.loadMissingIntegrations=(()=>{const t=function(t,e=/^bearer-/i){return Array.from(t).filter(t=>e.test(t.tagName)).map(t=>t.tagName.toLowerCase())}(document.getElementsByTagName("*")),e=t.filter(t=>!this.registeredIntegration(t));a(this.registeredIntegrations,t,e),this.sendTags(e)}),this.registeredIntegration=(t=>(this.registeredIntegrations[t]=this.registeredIntegrations[t]||document.createElement(t).constructor!==HTMLElement,this.registeredIntegrations[t])),this.initialIntegrationLoading=(()=>{"complete"===document.readyState||"interactive"===document.readyState?this.debounceRefresh():document.addEventListener("DOMContentLoaded",this.debounceRefresh)}),this.registerDomObserver=(()=>{if("MutationObserver"in window){this.disconnectObserver();const t=document.documentElement||document.body,e={childList:!0,subtree:!0};this.observer=new MutationObserver(this.observerCallback),this.observer.observe(t,e)}}),this.observerCallback=(t=>{for(const e of t)"childList"==e.type&&e.addedNodes.length&&this.debounceRefresh()}),this.disconnectObserver=(()=>{this.observer&&(this.observer.disconnect(),delete this.observer)}),this.sendTags=(e=>t(this,void 0,void 0,function*(){if(!e.length)return Promise.resolve(!0);try{const t=yield fetch("https://int.bearer.sh/v1/parse-tags",{headers:{"content-type":"application/json"},body:JSON.stringify({tags:e,clientId:this.clientId}),method:"POST"});if(t.status>299)throw new Error(`Error while fetching integration tag names: ${e}`);return(yield t.json()).map(t=>{document.querySelector(`#${f(t.uuid)}`)||document.body.appendChild(function(t,e){const n=document.createElement("script");n.type="text/javascript",n.async=!0;const r=e.asset.indexOf("?")>-1?"&":"?";return n.src=[e.asset,[`clientId=${t}`].join("&")].join(r),n.id=f(e.uuid),n}(this.clientId,t))}),!0}catch(t){return!1}})),this.config=Object.assign({},r,u),this.debounceRefresh=n(this.loadMissingIntegrations,this.config.refreshDebounceDelay),this.initialIntegrationLoading(),this.config.domObserver&&this.registerDomObserver()}}function f(t){return`${c}-${t}`}var h=o(function(t,e){var n=200,o="__lodash_hash_undefined__",i=800,s=16,a=9007199254740991,c="[object Arguments]",u="[object AsyncFunction]",l="[object Function]",f="[object GeneratorFunction]",h="[object Null]",d="[object Object]",p="[object Proxy]",v="[object Undefined]",y=/^\[object .+?Constructor\]$/,g=/^(?:0|[1-9]\d*)$/,_={};_["[object Float32Array]"]=_["[object Float64Array]"]=_["[object Int8Array]"]=_["[object Int16Array]"]=_["[object Int32Array]"]=_["[object Uint8Array]"]=_["[object Uint8ClampedArray]"]=_["[object Uint16Array]"]=_["[object Uint32Array]"]=!0,_[c]=_["[object Array]"]=_["[object ArrayBuffer]"]=_["[object Boolean]"]=_["[object DataView]"]=_["[object Date]"]=_["[object Error]"]=_[l]=_["[object Map]"]=_["[object Number]"]=_[d]=_["[object RegExp]"]=_["[object Set]"]=_["[object String]"]=_["[object WeakMap]"]=!1;var b="object"==typeof r&&r&&r.Object===Object&&r,C="object"==typeof self&&self&&self.Object===Object&&self,m=b||C||Function("return this")(),j=e&&!e.nodeType&&e,w=j&&t&&!t.nodeType&&t,F=w&&w.exports===j,O=F&&b.process,A=function(){try{return O&&O.binding&&O.binding("util")}catch(t){}}(),x=A&&A.isTypedArray;function E(t,e){return"__proto__"==e?void 0:t[e]}var I,S,$,z=Array.prototype,k=Function.prototype,M=Object.prototype,T=m["__core-js_shared__"],L=k.toString,N=M.hasOwnProperty,P=(I=/[^.]+$/.exec(T&&T.keys&&T.keys.IE_PROTO||""))?"Symbol(src)_1."+I:"",D=M.toString,R=L.call(Object),U=RegExp("^"+L.call(N).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),B=F?m.Buffer:void 0,J=m.Symbol,G=m.Uint8Array,W=B?B.allocUnsafe:void 0,Z=(S=Object.getPrototypeOf,$=Object,function(t){return S($(t))}),q=Object.create,H=M.propertyIsEnumerable,V=z.splice,K=J?J.toStringTag:void 0,Q=function(){try{var t=jt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),X=B?B.isBuffer:void 0,Y=Math.max,tt=Date.now,et=jt(m,"Map"),nt=jt(Object,"create"),rt=function(){function t(){}return function(e){if(!kt(e))return{};if(q)return q(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function ot(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function it(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function st(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function at(t){var e=this.__data__=new it(t);this.size=e.size}function ct(t,e){var n=Et(t),r=!n&&xt(t),o=!n&&!r&&St(t),i=!n&&!r&&!o&&Tt(t),s=n||r||o||i,a=s?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],c=a.length;for(var u in t)!e&&!N.call(t,u)||s&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||wt(u,c))||a.push(u);return a}function ut(t,e,n){(void 0===n||At(t[e],n))&&(void 0!==n||e in t)||ht(t,e,n)}function lt(t,e,n){var r=t[e];N.call(t,e)&&At(r,n)&&(void 0!==n||e in t)||ht(t,e,n)}function ft(t,e){for(var n=t.length;n--;)if(At(t[n][0],e))return n;return-1}function ht(t,e,n){"__proto__"==e&&Q?Q(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}ot.prototype.clear=function(){this.__data__=nt?nt(null):{},this.size=0},ot.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},ot.prototype.get=function(t){var e=this.__data__;if(nt){var n=e[t];return n===o?void 0:n}return N.call(e,t)?e[t]:void 0},ot.prototype.has=function(t){var e=this.__data__;return nt?void 0!==e[t]:N.call(e,t)},ot.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=nt&&void 0===e?o:e,this},it.prototype.clear=function(){this.__data__=[],this.size=0},it.prototype.delete=function(t){var e=this.__data__,n=ft(e,t);return!(n<0||(n==e.length-1?e.pop():V.call(e,n,1),--this.size,0))},it.prototype.get=function(t){var e=this.__data__,n=ft(e,t);return n<0?void 0:e[n][1]},it.prototype.has=function(t){return ft(this.__data__,t)>-1},it.prototype.set=function(t,e){var n=this.__data__,r=ft(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},st.prototype.clear=function(){this.size=0,this.__data__={hash:new ot,map:new(et||it),string:new ot}},st.prototype.delete=function(t){var e=mt(this,t).delete(t);return this.size-=e?1:0,e},st.prototype.get=function(t){return mt(this,t).get(t)},st.prototype.has=function(t){return mt(this,t).has(t)},st.prototype.set=function(t,e){var n=mt(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},at.prototype.clear=function(){this.__data__=new it,this.size=0},at.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},at.prototype.get=function(t){return this.__data__.get(t)},at.prototype.has=function(t){return this.__data__.has(t)},at.prototype.set=function(t,e){var r=this.__data__;if(r instanceof it){var o=r.__data__;if(!et||o.length<n-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new st(o)}return r.set(t,e),this.size=r.size,this};var dt,pt=function(t,e,n){for(var r=-1,o=Object(t),i=n(t),s=i.length;s--;){var a=i[dt?s:++r];if(!1===e(o[a],a,o))break}return t};function vt(t){return null==t?void 0===t?v:h:K&&K in Object(t)?function(t){var e=N.call(t,K),n=t[K];try{t[K]=void 0;var r=!0}catch(t){}var o=D.call(t);r&&(e?t[K]=n:delete t[K]);return o}(t):function(t){return D.call(t)}(t)}function yt(t){return Mt(t)&&vt(t)==c}function gt(t){return!(!kt(t)||(e=t,P&&P in e))&&($t(t)?U:y).test(function(t){if(null!=t){try{return L.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t));var e}function _t(t){if(!kt(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=Ft(t),n=[];for(var r in t)("constructor"!=r||!e&&N.call(t,r))&&n.push(r);return n}function bt(t,e,n,r,o){t!==e&&pt(e,function(i,s){if(kt(i))o||(o=new at),function(t,e,n,r,o,i,s){var a=E(t,n),c=E(e,n),u=s.get(c);if(u)return void ut(t,n,u);var l=i?i(a,c,n+"",t,e,s):void 0,f=void 0===l;if(f){var h=Et(c),p=!h&&St(c),v=!h&&!p&&Tt(c);l=c,h||p||v?Et(a)?l=a:Mt(C=a)&&It(C)?l=function(t,e){var n=-1,r=t.length;e||(e=Array(r));for(;++n<r;)e[n]=t[n];return e}(a):p?(f=!1,l=function(t,e){if(e)return t.slice();var n=t.length,r=W?W(n):new t.constructor(n);return t.copy(r),r}(c,!0)):v?(f=!1,y=c,g=!0?(_=y.buffer,b=new _.constructor(_.byteLength),new G(b).set(new G(_)),b):y.buffer,l=new y.constructor(g,y.byteOffset,y.length)):l=[]:function(t){if(!Mt(t)||vt(t)!=d)return!1;var e=Z(t);if(null===e)return!0;var n=N.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&L.call(n)==R}(c)||xt(c)?(l=a,xt(a)?l=function(t){return function(t,e,n,r){var o=!n;n||(n={});var i=-1,s=e.length;for(;++i<s;){var a=e[i],c=r?r(n[a],t[a],a,n,t):void 0;void 0===c&&(c=t[a]),o?ht(n,a,c):lt(n,a,c)}return n}(t,Lt(t))}(a):(!kt(a)||r&&$t(a))&&(l=function(t){return"function"!=typeof t.constructor||Ft(t)?{}:rt(Z(t))}(c))):f=!1}var y,g,_,b;var C;f&&(s.set(c,l),o(l,c,r,i,s),s.delete(c));ut(t,n,l)}(t,e,s,n,bt,r,o);else{var a=r?r(E(t,s),i,s+"",t,e,o):void 0;void 0===a&&(a=i),ut(t,s,a)}},Lt)}function Ct(t,e){return Ot(function(t,e,n){return e=Y(void 0===e?t.length-1:e,0),function(){for(var r=arguments,o=-1,i=Y(r.length-e,0),s=Array(i);++o<i;)s[o]=r[e+o];o=-1;for(var a=Array(e+1);++o<e;)a[o]=r[o];return a[e]=n(s),function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}(t,this,a)}}(t,e,Dt),t+"")}function mt(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function jt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return gt(n)?n:void 0}function wt(t,e){var n=typeof t;return!!(e=null==e?a:e)&&("number"==n||"symbol"!=n&&g.test(t))&&t>-1&&t%1==0&&t<e}function Ft(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||M)}var Ot=function(t){var e=0,n=0;return function(){var r=tt(),o=s-(r-n);if(n=r,o>0){if(++e>=i)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(Q?function(t,e){return Q(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:Dt);function At(t,e){return t===e||t!=t&&e!=e}var xt=yt(function(){return arguments}())?yt:function(t){return Mt(t)&&N.call(t,"callee")&&!H.call(t,"callee")},Et=Array.isArray;function It(t){return null!=t&&zt(t.length)&&!$t(t)}var St=X||function(){return!1};function $t(t){if(!kt(t))return!1;var e=vt(t);return e==l||e==f||e==u||e==p}function zt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=a}function kt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Mt(t){return null!=t&&"object"==typeof t}var Tt=x?function(t){return function(e){return t(e)}}(x):function(t){return Mt(t)&&zt(t.length)&&!!_[vt(t)]};function Lt(t){return It(t)?ct(t,!0):_t(t)}var Nt,Pt=(Nt=function(t,e,n){bt(t,e,n)},Ct(function(t,e){var n=-1,r=e.length,o=r>1?e[r-1]:void 0,i=r>2?e[2]:void 0;for(o=Nt.length>3&&"function"==typeof o?(r--,o):void 0,i&&function(t,e,n){if(!kt(n))return!1;var r=typeof e;return!!("number"==r?It(n)&&wt(e,n.length):"string"==r&&e in n)&&At(n[e],t)}(e[0],e[1],i)&&(o=r<3?void 0:o,r=1),t=Object(t);++n<r;){var s=e[n];s&&Nt(t,s,n,o)}return t}));function Dt(t){return t}t.exports=Pt}),d="Expected a function",p="__lodash_hash_undefined__",v=1/0,y="[object Function]",g="[object GeneratorFunction]",_="[object Symbol]",b=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,C=/^\w*$/,m=/^\./,j=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,w=/\\(\\)?/g,F=/^\[object .+?Constructor\]$/,O="object"==typeof r&&r&&r.Object===Object&&r,A="object"==typeof self&&self&&self.Object===Object&&self,x=O||A||Function("return this")();var E,I=Array.prototype,S=Function.prototype,$=Object.prototype,z=x["__core-js_shared__"],k=(E=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+E:"",M=S.toString,T=$.hasOwnProperty,L=$.toString,N=RegExp("^"+M.call(T).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),P=x.Symbol,D=I.splice,R=Q(x,"Map"),U=Q(Object,"create"),B=P?P.prototype:void 0,J=B?B.toString:void 0;function G(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function W(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Z(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function q(t,e){for(var n,r,o=t.length;o--;)if((n=t[o][0])===(r=e)||n!=n&&r!=r)return o;return-1}function H(t,e){for(var n,r=0,o=(e=function(t,e){if(et(t))return!1;var n=typeof t;if("number"==n||"symbol"==n||"boolean"==n||null==t||rt(t))return!0;return C.test(t)||!b.test(t)||null!=e&&t in Object(e)}(e,t)?[e]:et(n=e)?n:X(n)).length;null!=t&&r<o;)t=t[Y(e[r++])];return r&&r==o?t:void 0}function V(t){return!(!nt(t)||(e=t,k&&k in e))&&(function(t){var e=nt(t)?L.call(t):"";return e==y||e==g}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?N:F).test(function(t){if(null!=t){try{return M.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t));var e}function K(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function Q(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return V(n)?n:void 0}G.prototype.clear=function(){this.__data__=U?U(null):{}},G.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},G.prototype.get=function(t){var e=this.__data__;if(U){var n=e[t];return n===p?void 0:n}return T.call(e,t)?e[t]:void 0},G.prototype.has=function(t){var e=this.__data__;return U?void 0!==e[t]:T.call(e,t)},G.prototype.set=function(t,e){return this.__data__[t]=U&&void 0===e?p:e,this},W.prototype.clear=function(){this.__data__=[]},W.prototype.delete=function(t){var e=this.__data__,n=q(e,t);return!(n<0||(n==e.length-1?e.pop():D.call(e,n,1),0))},W.prototype.get=function(t){var e=this.__data__,n=q(e,t);return n<0?void 0:e[n][1]},W.prototype.has=function(t){return q(this.__data__,t)>-1},W.prototype.set=function(t,e){var n=this.__data__,r=q(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},Z.prototype.clear=function(){this.__data__={hash:new G,map:new(R||W),string:new G}},Z.prototype.delete=function(t){return K(this,t).delete(t)},Z.prototype.get=function(t){return K(this,t).get(t)},Z.prototype.has=function(t){return K(this,t).has(t)},Z.prototype.set=function(t,e){return K(this,t).set(t,e),this};var X=tt(function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(rt(t))return J?J.call(t):"";var e=t+"";return"0"==e&&1/t==-v?"-0":e}(e);var n=[];return m.test(t)&&n.push(""),t.replace(j,function(t,e,r,o){n.push(r?o.replace(w,"$1"):e||t)}),n});function Y(t){if("string"==typeof t||rt(t))return t;var e=t+"";return"0"==e&&1/t==-v?"-0":e}function tt(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError(d);var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=t.apply(this,r);return n.cache=i.set(o,s),s};return n.cache=new(tt.Cache||Z),n}tt.Cache=Z;var et=Array.isArray;function nt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function rt(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&L.call(t)==_}var ot=function(t,e,n){var r=null==t?void 0:H(t,e);return void 0===r?n:r};const it=a.extend("i18n"),st="en",at="bearer-locale-changed";const ct=new class{constructor(){this._locale=st,this._dictionnary={[st]:{}},this.load=((e,n,{locale:r=this.locale}={})=>t(this,void 0,void 0,function*(){const t=yield n,o=e?{[e]:t}:t;this._dictionnary[r]=h(ot(this._dictionnary,r),o),this.localeChanged()})),this.get=((t,e,n={})=>{const r=[n.locale||this.locale,t,e].filter(t=>t).join(".");return it("lookup key",r),ot(this._dictionnary,r)})}localeChanged(){document.dispatchEvent(new CustomEvent(at,{detail:{locale:this.locale}}))}set locale(t){this._locale=t,this.localeChanged()}get locale(){return this._locale}},ut=t=>new l(t);return ut.version="0.97.3",ut.i18n=ct,ut}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).bearer=e()}(this,function(){"use strict";function t(t,e,n,r){return new(n||(n=Promise))(function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){t.done?o(t.value):new n(function(e){e(t.value)}).then(s,a)}c((r=r.apply(t,e||[])).next())})}function e(t,e,n){var r,o,i,s,a;function c(){var u=Date.now()-s;u<e&&u>=0?r=setTimeout(c,e-u):(r=null,n||(a=t.apply(i,o),i=o=null))}null==e&&(e=100);var u=function(){i=this,o=arguments,s=Date.now();var u=n&&!r;return r||(r=setTimeout(c,e)),u&&(a=t.apply(i,o),i=o=null),a};return u.clear=function(){r&&(clearTimeout(r),r=null)},u.flush=function(){r&&(a=t.apply(i,o),i=o=null,clearTimeout(r),r=null)},u}e.debounce=e;var n=e,r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(t,e){return t(e={exports:{}},e.exports),e.exports}var i,s=o(function(t,e){!function(t){var e=1e3,n=6e4,r=36e5,o=24*r,i=function(t,i){i=i||{};var a=typeof t;if("string"===a&&t.length>0)return function(t){if(!((t=String(t)).length>100)){var i=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(i){var s=parseFloat(i[1]);switch((i[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return 6048e5*s;case"days":case"day":case"d":return s*o;case"hours":case"hour":case"hrs":case"hr":case"h":return s*r;case"minutes":case"minute":case"mins":case"min":case"m":return s*n;case"seconds":case"second":case"secs":case"sec":case"s":return s*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}}}(t);if("number"===a&&!1===isNaN(t))return i.long?function(t){var i=Math.abs(t);return i>=o?s(t,i,o,"day"):i>=r?s(t,i,r,"hour"):i>=n?s(t,i,n,"minute"):i>=e?s(t,i,e,"second"):t+" ms"}(t):function(t){var i=Math.abs(t);return i>=o?Math.round(t/o)+"d":i>=r?Math.round(t/r)+"h":i>=n?Math.round(t/n)+"m":i>=e?Math.round(t/e)+"s":t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function s(t,e,n,r){var o=e>=1.5*n;return Math.round(t/n)+" "+r+(o?"s":"")}var a,c=(function(t,e){e.log=function(...t){return"object"==typeof console&&console.log&&console.log(...t)},e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;e.splice(1,0,n,"color: inherit");let r=0,o=0;e[0].replace(/%[a-zA-Z%]/g,t=>{"%%"!==t&&(r++,"%c"===t&&(o=r))}),e.splice(o,0,n)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(t){}return!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG),t},e.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},e.storage=function(){try{return localStorage}catch(t){}}(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.exports=function(t){function e(t){let e=0;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return n.colors[Math.abs(e)%n.colors.length]}function n(t){let i;function s(...t){if(!s.enabled)return;const e=s,r=Number(new Date),o=r-(i||r);e.diff=o,e.prev=i,e.curr=r,i=r,t[0]=n.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let a=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,(r,o)=>{if("%%"===r)return r;a++;const i=n.formatters[o];if("function"==typeof i){const n=t[a];r=i.call(e,n),t.splice(a,1),a--}return r}),n.formatArgs.call(e,t),(e.log||n.log).apply(e,t)}return s.namespace=t,s.enabled=n.enabled(t),s.useColors=n.useColors(),s.color=e(t),s.destroy=r,s.extend=o,"function"==typeof n.init&&n.init(s),n.instances.push(s),s}function r(){const t=n.instances.indexOf(this);return-1!==t&&(n.instances.splice(t,1),!0)}function o(t,e){const r=n(this.namespace+(void 0===e?":":e)+t);return r.log=this.log,r}function s(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(t){return t instanceof Error?t.stack||t.message:t},n.disable=function(){const t=[...n.names.map(s),...n.skips.map(s).map(t=>"-"+t)].join(",");return n.enable(""),t},n.enable=function(t){let e;n.save(t),n.names=[],n.skips=[];const r=("string"==typeof t?t:"").split(/[\s,]+/),o=r.length;for(e=0;e<o;e++)r[e]&&("-"===(t=r[e].replace(/\*/g,".*?"))[0]?n.skips.push(new RegExp("^"+t.substr(1)+"$")):n.names.push(new RegExp("^"+t+"$")));for(e=0;e<n.instances.length;e++){const t=n.instances[e];t.enabled=n.enabled(t.namespace)}},n.enabled=function(t){if("*"===t[t.length-1])return!0;let e,r;for(e=0,r=n.skips.length;e<r;e++)if(n.skips[e].test(t))return!1;for(e=0,r=n.names.length;e<r;e++)if(n.names[e].test(t))return!0;return!1},n.humanize=i,Object.keys(t).forEach(e=>{n[e]=t[e]}),n.instances=[],n.names=[],n.skips=[],n.formatters={},n.selectColor=e,n.enable(n.load()),n}(e);const{formatters:n}=t.exports;n.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}(a={exports:{}},a.exports),a.exports);c.log,c.formatArgs,c.save,c.load,c.useColors,c.storage,c.colors,t.default=(t=>c(`bearer:${t}`)),t.BearerIntentLogger=class{constructor(t){this.log=(t=>{c("bearer:intents")("%j",{data:t,scenarioId:this.context.integrationUuid,intentName:this.context.intentName})}),this.context=t}},Object.defineProperty(t,"__esModule",{value:!0})}(e)}),a=((i=s)&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i)("js");const c=a.extend("Bearer"),u="bearer",l={integrationHost:"https://int.bearer.sh",domObserver:!0,refreshDebounceDelay:200};class f{constructor(e,r){this.clientId=e,this.config=l,this.registeredIntegrations={},this.loadMissingIntegrations=(()=>{const t=function(t,e=/^bearer-/i){return Array.from(t).filter(t=>e.test(t.tagName)).map(t=>t.tagName.toLowerCase())}(document.getElementsByTagName("*")),e=t.filter(t=>!this.registeredIntegration(t));c(this.registeredIntegrations,t,e),this.sendTags(e)}),this.registeredIntegration=(t=>(this.registeredIntegrations[t]=this.registeredIntegrations[t]||document.createElement(t).constructor!==HTMLElement,this.registeredIntegrations[t])),this.initialIntegrationLoading=(()=>{"complete"===document.readyState||"interactive"===document.readyState?this.debounceRefresh():document.addEventListener("DOMContentLoaded",this.debounceRefresh)}),this.registerDomObserver=(()=>{if("MutationObserver"in window){this.disconnectObserver();const t=document.documentElement||document.body,e={childList:!0,subtree:!0};this.observer=new MutationObserver(this.observerCallback),this.observer.observe(t,e)}}),this.observerCallback=(t=>{for(const e of t)"childList"==e.type&&e.addedNodes.length&&this.debounceRefresh()}),this.disconnectObserver=(()=>{this.observer&&(this.observer.disconnect(),delete this.observer)}),this.sendTags=(e=>t(this,void 0,void 0,function*(){if(!e.length)return Promise.resolve(!0);try{const t=yield fetch(`${this.config.integrationHost}/v1/parse-tags`,{headers:{"content-type":"application/json"},body:JSON.stringify({tags:e,clientId:this.clientId}),method:"POST"});if(t.status>299)throw new Error(`Error while fetching integration tag names: ${e}`);return(yield t.json()).map(t=>{document.querySelector(`#${h(t.uuid)}`)||document.body.appendChild(function(t,e){const n=document.createElement("script");n.type="text/javascript",n.async=!0;const r=e.asset.indexOf("?")>-1?"&":"?";return n.src=[e.asset,[`clientId=${t}`].join("&")].join(r),n.id=h(e.uuid),n}(this.clientId,t))}),!0}catch(t){return!1}})),this.config=Object.assign({},l,r),this.debounceRefresh=n(this.loadMissingIntegrations,this.config.refreshDebounceDelay),this.initialIntegrationLoading(),this.config.domObserver&&this.registerDomObserver()}}function h(t){return`${u}-${t}`}var d=o(function(t,e){var n=200,o="__lodash_hash_undefined__",i=800,s=16,a=9007199254740991,c="[object Arguments]",u="[object AsyncFunction]",l="[object Function]",f="[object GeneratorFunction]",h="[object Null]",d="[object Object]",p="[object Proxy]",v="[object Undefined]",y=/^\[object .+?Constructor\]$/,g=/^(?:0|[1-9]\d*)$/,_={};_["[object Float32Array]"]=_["[object Float64Array]"]=_["[object Int8Array]"]=_["[object Int16Array]"]=_["[object Int32Array]"]=_["[object Uint8Array]"]=_["[object Uint8ClampedArray]"]=_["[object Uint16Array]"]=_["[object Uint32Array]"]=!0,_[c]=_["[object Array]"]=_["[object ArrayBuffer]"]=_["[object Boolean]"]=_["[object DataView]"]=_["[object Date]"]=_["[object Error]"]=_[l]=_["[object Map]"]=_["[object Number]"]=_[d]=_["[object RegExp]"]=_["[object Set]"]=_["[object String]"]=_["[object WeakMap]"]=!1;var b="object"==typeof r&&r&&r.Object===Object&&r,C="object"==typeof self&&self&&self.Object===Object&&self,m=b||C||Function("return this")(),j=e&&!e.nodeType&&e,w=j&&t&&!t.nodeType&&t,F=w&&w.exports===j,O=F&&b.process,x=function(){try{return O&&O.binding&&O.binding("util")}catch(t){}}(),A=x&&x.isTypedArray;function E(t,e){return"__proto__"==e?void 0:t[e]}var I,S,$,z=Array.prototype,k=Function.prototype,M=Object.prototype,T=m["__core-js_shared__"],L=k.toString,N=M.hasOwnProperty,P=(I=/[^.]+$/.exec(T&&T.keys&&T.keys.IE_PROTO||""))?"Symbol(src)_1."+I:"",D=M.toString,R=L.call(Object),U=RegExp("^"+L.call(N).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),B=F?m.Buffer:void 0,J=m.Symbol,G=m.Uint8Array,H=B?B.allocUnsafe:void 0,W=(S=Object.getPrototypeOf,$=Object,function(t){return S($(t))}),Z=Object.create,q=M.propertyIsEnumerable,V=z.splice,K=J?J.toStringTag:void 0,Q=function(){try{var t=jt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),X=B?B.isBuffer:void 0,Y=Math.max,tt=Date.now,et=jt(m,"Map"),nt=jt(Object,"create"),rt=function(){function t(){}return function(e){if(!kt(e))return{};if(Z)return Z(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function ot(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function it(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function st(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function at(t){var e=this.__data__=new it(t);this.size=e.size}function ct(t,e){var n=Et(t),r=!n&&At(t),o=!n&&!r&&St(t),i=!n&&!r&&!o&&Tt(t),s=n||r||o||i,a=s?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],c=a.length;for(var u in t)!e&&!N.call(t,u)||s&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||wt(u,c))||a.push(u);return a}function ut(t,e,n){(void 0===n||xt(t[e],n))&&(void 0!==n||e in t)||ht(t,e,n)}function lt(t,e,n){var r=t[e];N.call(t,e)&&xt(r,n)&&(void 0!==n||e in t)||ht(t,e,n)}function ft(t,e){for(var n=t.length;n--;)if(xt(t[n][0],e))return n;return-1}function ht(t,e,n){"__proto__"==e&&Q?Q(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}ot.prototype.clear=function(){this.__data__=nt?nt(null):{},this.size=0},ot.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},ot.prototype.get=function(t){var e=this.__data__;if(nt){var n=e[t];return n===o?void 0:n}return N.call(e,t)?e[t]:void 0},ot.prototype.has=function(t){var e=this.__data__;return nt?void 0!==e[t]:N.call(e,t)},ot.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=nt&&void 0===e?o:e,this},it.prototype.clear=function(){this.__data__=[],this.size=0},it.prototype.delete=function(t){var e=this.__data__,n=ft(e,t);return!(n<0||(n==e.length-1?e.pop():V.call(e,n,1),--this.size,0))},it.prototype.get=function(t){var e=this.__data__,n=ft(e,t);return n<0?void 0:e[n][1]},it.prototype.has=function(t){return ft(this.__data__,t)>-1},it.prototype.set=function(t,e){var n=this.__data__,r=ft(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},st.prototype.clear=function(){this.size=0,this.__data__={hash:new ot,map:new(et||it),string:new ot}},st.prototype.delete=function(t){var e=mt(this,t).delete(t);return this.size-=e?1:0,e},st.prototype.get=function(t){return mt(this,t).get(t)},st.prototype.has=function(t){return mt(this,t).has(t)},st.prototype.set=function(t,e){var n=mt(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},at.prototype.clear=function(){this.__data__=new it,this.size=0},at.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},at.prototype.get=function(t){return this.__data__.get(t)},at.prototype.has=function(t){return this.__data__.has(t)},at.prototype.set=function(t,e){var r=this.__data__;if(r instanceof it){var o=r.__data__;if(!et||o.length<n-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new st(o)}return r.set(t,e),this.size=r.size,this};var dt,pt=function(t,e,n){for(var r=-1,o=Object(t),i=n(t),s=i.length;s--;){var a=i[dt?s:++r];if(!1===e(o[a],a,o))break}return t};function vt(t){return null==t?void 0===t?v:h:K&&K in Object(t)?function(t){var e=N.call(t,K),n=t[K];try{t[K]=void 0;var r=!0}catch(t){}var o=D.call(t);r&&(e?t[K]=n:delete t[K]);return o}(t):function(t){return D.call(t)}(t)}function yt(t){return Mt(t)&&vt(t)==c}function gt(t){return!(!kt(t)||(e=t,P&&P in e))&&($t(t)?U:y).test(function(t){if(null!=t){try{return L.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t));var e}function _t(t){if(!kt(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=Ft(t),n=[];for(var r in t)("constructor"!=r||!e&&N.call(t,r))&&n.push(r);return n}function bt(t,e,n,r,o){t!==e&&pt(e,function(i,s){if(kt(i))o||(o=new at),function(t,e,n,r,o,i,s){var a=E(t,n),c=E(e,n),u=s.get(c);if(u)return void ut(t,n,u);var l=i?i(a,c,n+"",t,e,s):void 0,f=void 0===l;if(f){var h=Et(c),p=!h&&St(c),v=!h&&!p&&Tt(c);l=c,h||p||v?Et(a)?l=a:Mt(C=a)&&It(C)?l=function(t,e){var n=-1,r=t.length;e||(e=Array(r));for(;++n<r;)e[n]=t[n];return e}(a):p?(f=!1,l=function(t,e){if(e)return t.slice();var n=t.length,r=H?H(n):new t.constructor(n);return t.copy(r),r}(c,!0)):v?(f=!1,y=c,g=!0?(_=y.buffer,b=new _.constructor(_.byteLength),new G(b).set(new G(_)),b):y.buffer,l=new y.constructor(g,y.byteOffset,y.length)):l=[]:function(t){if(!Mt(t)||vt(t)!=d)return!1;var e=W(t);if(null===e)return!0;var n=N.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&L.call(n)==R}(c)||At(c)?(l=a,At(a)?l=function(t){return function(t,e,n,r){var o=!n;n||(n={});var i=-1,s=e.length;for(;++i<s;){var a=e[i],c=r?r(n[a],t[a],a,n,t):void 0;void 0===c&&(c=t[a]),o?ht(n,a,c):lt(n,a,c)}return n}(t,Lt(t))}(a):(!kt(a)||r&&$t(a))&&(l=function(t){return"function"!=typeof t.constructor||Ft(t)?{}:rt(W(t))}(c))):f=!1}var y,g,_,b;var C;f&&(s.set(c,l),o(l,c,r,i,s),s.delete(c));ut(t,n,l)}(t,e,s,n,bt,r,o);else{var a=r?r(E(t,s),i,s+"",t,e,o):void 0;void 0===a&&(a=i),ut(t,s,a)}},Lt)}function Ct(t,e){return Ot(function(t,e,n){return e=Y(void 0===e?t.length-1:e,0),function(){for(var r=arguments,o=-1,i=Y(r.length-e,0),s=Array(i);++o<i;)s[o]=r[e+o];o=-1;for(var a=Array(e+1);++o<e;)a[o]=r[o];return a[e]=n(s),function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}(t,this,a)}}(t,e,Dt),t+"")}function mt(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function jt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return gt(n)?n:void 0}function wt(t,e){var n=typeof t;return!!(e=null==e?a:e)&&("number"==n||"symbol"!=n&&g.test(t))&&t>-1&&t%1==0&&t<e}function Ft(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||M)}var Ot=function(t){var e=0,n=0;return function(){var r=tt(),o=s-(r-n);if(n=r,o>0){if(++e>=i)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(Q?function(t,e){return Q(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:Dt);function xt(t,e){return t===e||t!=t&&e!=e}var At=yt(function(){return arguments}())?yt:function(t){return Mt(t)&&N.call(t,"callee")&&!q.call(t,"callee")},Et=Array.isArray;function It(t){return null!=t&&zt(t.length)&&!$t(t)}var St=X||function(){return!1};function $t(t){if(!kt(t))return!1;var e=vt(t);return e==l||e==f||e==u||e==p}function zt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=a}function kt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Mt(t){return null!=t&&"object"==typeof t}var Tt=A?function(t){return function(e){return t(e)}}(A):function(t){return Mt(t)&&zt(t.length)&&!!_[vt(t)]};function Lt(t){return It(t)?ct(t,!0):_t(t)}var Nt,Pt=(Nt=function(t,e,n){bt(t,e,n)},Ct(function(t,e){var n=-1,r=e.length,o=r>1?e[r-1]:void 0,i=r>2?e[2]:void 0;for(o=Nt.length>3&&"function"==typeof o?(r--,o):void 0,i&&function(t,e,n){if(!kt(n))return!1;var r=typeof e;return!!("number"==r?It(n)&&wt(e,n.length):"string"==r&&e in n)&&xt(n[e],t)}(e[0],e[1],i)&&(o=r<3?void 0:o,r=1),t=Object(t);++n<r;){var s=e[n];s&&Nt(t,s,n,o)}return t}));function Dt(t){return t}t.exports=Pt}),p="Expected a function",v="__lodash_hash_undefined__",y=1/0,g="[object Function]",_="[object GeneratorFunction]",b="[object Symbol]",C=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,m=/^\w*$/,j=/^\./,w=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,F=/\\(\\)?/g,O=/^\[object .+?Constructor\]$/,x="object"==typeof r&&r&&r.Object===Object&&r,A="object"==typeof self&&self&&self.Object===Object&&self,E=x||A||Function("return this")();var I,S=Array.prototype,$=Function.prototype,z=Object.prototype,k=E["__core-js_shared__"],M=(I=/[^.]+$/.exec(k&&k.keys&&k.keys.IE_PROTO||""))?"Symbol(src)_1."+I:"",T=$.toString,L=z.hasOwnProperty,N=z.toString,P=RegExp("^"+T.call(L).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),D=E.Symbol,R=S.splice,U=X(E,"Map"),B=X(Object,"create"),J=D?D.prototype:void 0,G=J?J.toString:void 0;function H(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function W(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Z(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function q(t,e){for(var n,r,o=t.length;o--;)if((n=t[o][0])===(r=e)||n!=n&&r!=r)return o;return-1}function V(t,e){for(var n,r=0,o=(e=function(t,e){if(nt(t))return!1;var n=typeof t;if("number"==n||"symbol"==n||"boolean"==n||null==t||ot(t))return!0;return m.test(t)||!C.test(t)||null!=e&&t in Object(e)}(e,t)?[e]:nt(n=e)?n:Y(n)).length;null!=t&&r<o;)t=t[tt(e[r++])];return r&&r==o?t:void 0}function K(t){return!(!rt(t)||(e=t,M&&M in e))&&(function(t){var e=rt(t)?N.call(t):"";return e==g||e==_}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?P:O).test(function(t){if(null!=t){try{return T.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t));var e}function Q(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function X(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return K(n)?n:void 0}H.prototype.clear=function(){this.__data__=B?B(null):{}},H.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},H.prototype.get=function(t){var e=this.__data__;if(B){var n=e[t];return n===v?void 0:n}return L.call(e,t)?e[t]:void 0},H.prototype.has=function(t){var e=this.__data__;return B?void 0!==e[t]:L.call(e,t)},H.prototype.set=function(t,e){return this.__data__[t]=B&&void 0===e?v:e,this},W.prototype.clear=function(){this.__data__=[]},W.prototype.delete=function(t){var e=this.__data__,n=q(e,t);return!(n<0||(n==e.length-1?e.pop():R.call(e,n,1),0))},W.prototype.get=function(t){var e=this.__data__,n=q(e,t);return n<0?void 0:e[n][1]},W.prototype.has=function(t){return q(this.__data__,t)>-1},W.prototype.set=function(t,e){var n=this.__data__,r=q(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},Z.prototype.clear=function(){this.__data__={hash:new H,map:new(U||W),string:new H}},Z.prototype.delete=function(t){return Q(this,t).delete(t)},Z.prototype.get=function(t){return Q(this,t).get(t)},Z.prototype.has=function(t){return Q(this,t).has(t)},Z.prototype.set=function(t,e){return Q(this,t).set(t,e),this};var Y=et(function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(ot(t))return G?G.call(t):"";var e=t+"";return"0"==e&&1/t==-y?"-0":e}(e);var n=[];return j.test(t)&&n.push(""),t.replace(w,function(t,e,r,o){n.push(r?o.replace(F,"$1"):e||t)}),n});function tt(t){if("string"==typeof t||ot(t))return t;var e=t+"";return"0"==e&&1/t==-y?"-0":e}function et(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError(p);var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=t.apply(this,r);return n.cache=i.set(o,s),s};return n.cache=new(et.Cache||Z),n}et.Cache=Z;var nt=Array.isArray;function rt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function ot(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&N.call(t)==b}var it=function(t,e,n){var r=null==t?void 0:V(t,e);return void 0===r?n:r};const st=a.extend("i18n"),at="en",ct="bearer-locale-changed";const ut=new class{constructor(){this._locale=at,this._dictionnary={[at]:{}},this.load=((e,n,{locale:r=this.locale}={})=>t(this,void 0,void 0,function*(){const t=yield n,o=e?{[e]:t}:t;this._dictionnary[r]=d(it(this._dictionnary,r),o),this.localeChanged()})),this.get=((t,e,n={})=>{const r=[n.locale||this.locale,t,e].filter(t=>t).join(".");return st("lookup key",r),it(this._dictionnary,r)})}localeChanged(){document.dispatchEvent(new CustomEvent(ct,{detail:{locale:this.locale}}))}set locale(t){this._locale=t,this.localeChanged()}get locale(){return this._locale}},lt=(t,e)=>new f(t,e);return lt.version="0.98.0",lt.i18n=ut,lt}); | ||
//# sourceMappingURL=bearer.production.min.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";function __awaiter(e,t,r,n){return new(r||(r=Promise))(function(o,a){function i(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(i,s)}c((n=n.apply(e,t||[])).next())})}function debounce(e,t,r){var n,o,a,i,s;function c(){var u=Date.now()-i;u<t&&u>=0?n=setTimeout(c,t-u):(n=null,r||(s=e.apply(a,o),a=o=null))}null==t&&(t=100);var u=function(){a=this,o=arguments,i=Date.now();var u=r&&!n;return n||(n=setTimeout(c,t)),u&&(s=e.apply(a,o),a=o=null),s};return u.clear=function(){n&&(clearTimeout(n),n=null)},u.flush=function(){n&&(s=e.apply(a,o),a=o=null,clearTimeout(n),n=null)},u}debounce.debounce=debounce;var debounce_1=debounce,commonjsGlobal="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function unwrapExports(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var logger_browser=createCommonjsModule(function(e,t){!function(e){var t=1e3,r=6e4,n=36e5,o=24*n,a=function(e,a){a=a||{};var s=typeof e;if("string"===s&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var a=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(a){var i=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*i;case"weeks":case"week":case"w":return 6048e5*i;case"days":case"day":case"d":return i*o;case"hours":case"hour":case"hrs":case"hr":case"h":return i*n;case"minutes":case"minute":case"mins":case"min":case"m":return i*r;case"seconds":case"second":case"secs":case"sec":case"s":return i*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return i;default:return}}}}(e);if("number"===s&&!1===isNaN(e))return a.long?function(e){var a=Math.abs(e);return a>=o?i(e,a,o,"day"):a>=n?i(e,a,n,"hour"):a>=r?i(e,a,r,"minute"):a>=t?i(e,a,t,"second"):e+" ms"}(e):function(e){var a=Math.abs(e);return a>=o?Math.round(e/o)+"d":a>=n?Math.round(e/n)+"h":a>=r?Math.round(e/r)+"m":a>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function i(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}var s,c=(function(e,t){t.log=function(...e){return"object"==typeof console&&console.log&&console.log(...e)},t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))}),t.splice(o,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=function(e){function t(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return r.colors[Math.abs(t)%r.colors.length]}function r(e){let a;function i(...e){if(!i.enabled)return;const t=i,n=Number(new Date),o=n-(a||n);t.diff=o,t.prev=a,t.curr=n,a=n,e[0]=r.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(n,o)=>{if("%%"===n)return n;s++;const a=r.formatters[o];if("function"==typeof a){const r=e[s];n=a.call(t,r),e.splice(s,1),s--}return n}),r.formatArgs.call(t,e),(t.log||r.log).apply(t,e)}return i.namespace=e,i.enabled=r.enabled(e),i.useColors=r.useColors(),i.color=t(e),i.destroy=n,i.extend=o,"function"==typeof r.init&&r.init(i),r.instances.push(i),i}function n(){const e=r.instances.indexOf(this);return-1!==e&&(r.instances.splice(e,1),!0)}function o(e,t){const n=r(this.namespace+(void 0===t?":":t)+e);return n.log=this.log,n}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return r.debug=r,r.default=r,r.coerce=function(e){return e instanceof Error?e.stack||e.message:e},r.disable=function(){const e=[...r.names.map(i),...r.skips.map(i).map(e=>"-"+e)].join(",");return r.enable(""),e},r.enable=function(e){let t;r.save(e),r.names=[],r.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(t=0;t<o;t++)n[t]&&("-"===(e=n[t].replace(/\*/g,".*?"))[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")));for(t=0;t<r.instances.length;t++){const e=r.instances[t];e.enabled=r.enabled(e.namespace)}},r.enabled=function(e){if("*"===e[e.length-1])return!0;let t,n;for(t=0,n=r.skips.length;t<n;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;t<n;t++)if(r.names[t].test(e))return!0;return!1},r.humanize=a,Object.keys(e).forEach(t=>{r[t]=e[t]}),r.instances=[],r.names=[],r.skips=[],r.formatters={},r.selectColor=t,r.enable(r.load()),r}(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(s={exports:{}},s.exports),s.exports);c.log,c.formatArgs,c.save,c.load,c.useColors,c.storage,c.colors,e.default=(e=>c(`bearer:${e}`)),e.BearerIntentLogger=class{constructor(e){this.log=(e=>{c("bearer:intents")("%j",{data:e,scenarioId:this.context.integrationUuid,intentName:this.context.intentName})}),this.context=e}},Object.defineProperty(e,"__esModule",{value:!0})}(t)}),logger=unwrapExports(logger_browser),logger$1=logger("js");const prefix="bearer",DEFAULT_OPTIONS={domObserver:!0,refreshDebounceDelay:200};class Bearer{constructor(e,t){this.clientId=e,this.registeredIntegrations={},this.config=DEFAULT_OPTIONS,this.loadMissingIntegrations=(()=>{const e=findElements(document.getElementsByTagName("*")),t=e.filter(e=>!this.registeredIntegration(e));logger$1(this.registeredIntegrations,e,t),this.sendTags(t)}),this.registeredIntegration=(e=>(this.registeredIntegrations[e]=this.registeredIntegrations[e]||document.createElement(e).constructor!==HTMLElement,this.registeredIntegrations[e])),this.initialIntegrationLoading=(()=>{"complete"===document.readyState||"interactive"===document.readyState?this.debounceRefresh():document.addEventListener("DOMContentLoaded",this.debounceRefresh)}),this.registerDomObserver=(()=>{if("MutationObserver"in window){this.disconnectObserver();const e=document.documentElement||document.body,t={childList:!0,subtree:!0};this.observer=new MutationObserver(this.observerCallback),this.observer.observe(e,t)}}),this.observerCallback=(e=>{for(const t of e)"childList"==t.type&&t.addedNodes.length&&this.debounceRefresh()}),this.disconnectObserver=(()=>{this.observer&&(this.observer.disconnect(),delete this.observer)}),this.sendTags=(e=>__awaiter(this,void 0,void 0,function*(){if(!e.length)return Promise.resolve(!0);try{const t=yield fetch("https://int.bearer.sh/v1/parse-tags",{headers:{"content-type":"application/json"},body:JSON.stringify({tags:e,clientId:this.clientId}),method:"POST"});if(t.status>299)throw new Error(`Error while fetching integration tag names: ${e}`);return(yield t.json()).map(e=>{document.querySelector(`#${getScriptId(e.uuid)}`)||document.body.appendChild(getScriptDOM(this.clientId,e))}),!0}catch(e){return!1}})),this.config=Object.assign({},t,DEFAULT_OPTIONS),this.debounceRefresh=debounce_1(this.loadMissingIntegrations,this.config.refreshDebounceDelay),this.initialIntegrationLoading(),this.config.domObserver&&this.registerDomObserver()}}function findElements(e,t=/^bearer-/i){return Array.from(e).filter(e=>t.test(e.tagName)).map(e=>e.tagName.toLowerCase())}function getScriptId(e){return`${prefix}-${e}`}function getScriptDOM(e,t){const r=document.createElement("script");r.type="text/javascript",r.async=!0;const n=t.asset.indexOf("?")>-1?"&":"?";return r.src=[t.asset,[`clientId=${e}`].join("&")].join(n),r.id=getScriptId(t.uuid),r}var lodash_merge=createCommonjsModule(function(e,t){var r=200,n="__lodash_hash_undefined__",o=800,a=16,i=9007199254740991,s="[object Arguments]",c="[object AsyncFunction]",u="[object Function]",l="[object GeneratorFunction]",f="[object Null]",h="[object Object]",p="[object Proxy]",d="[object Undefined]",g=/^\[object .+?Constructor\]$/,y=/^(?:0|[1-9]\d*)$/,b={};b["[object Float32Array]"]=b["[object Float64Array]"]=b["[object Int8Array]"]=b["[object Int16Array]"]=b["[object Int32Array]"]=b["[object Uint8Array]"]=b["[object Uint8ClampedArray]"]=b["[object Uint16Array]"]=b["[object Uint32Array]"]=!0,b[s]=b["[object Array]"]=b["[object ArrayBuffer]"]=b["[object Boolean]"]=b["[object DataView]"]=b["[object Date]"]=b["[object Error]"]=b[u]=b["[object Map]"]=b["[object Number]"]=b[h]=b["[object RegExp]"]=b["[object Set]"]=b["[object String]"]=b["[object WeakMap]"]=!1;var v="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_="object"==typeof self&&self&&self.Object===Object&&self,C=v||_||Function("return this")(),m=t&&!t.nodeType&&t,j=m&&e&&!e.nodeType&&e,F=j&&j.exports===m,w=F&&v.process,O=function(){try{return w&&w.binding&&w.binding("util")}catch(e){}}(),S=O&&O.isTypedArray;function I(e,t){return"__proto__"==t?void 0:e[t]}var E,A,T,D=Array.prototype,x=Function.prototype,P=Object.prototype,M=C["__core-js_shared__"],N=x.toString,L=P.hasOwnProperty,$=(E=/[^.]+$/.exec(M&&M.keys&&M.keys.IE_PROTO||""))?"Symbol(src)_1."+E:"",k=P.toString,z=N.call(Object),H=RegExp("^"+N.call(L).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),G=F?C.Buffer:void 0,U=C.Symbol,R=C.Uint8Array,B=G?G.allocUnsafe:void 0,K=(A=Object.getPrototypeOf,T=Object,function(e){return A(T(e))}),J=Object.create,q=P.propertyIsEnumerable,V=D.splice,Y=U?U.toStringTag:void 0,W=function(){try{var e=me(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),X=G?G.isBuffer:void 0,Z=Math.max,Q=Date.now,ee=me(C,"Map"),te=me(Object,"create"),re=function(){function e(){}return function(t){if(!xe(t))return{};if(J)return J(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function ne(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function oe(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ae(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ie(e){var t=this.__data__=new oe(e);this.size=t.size}function se(e,t){var r=Ie(e),n=!r&&Se(e),o=!r&&!n&&Ae(e),a=!r&&!n&&!o&&Me(e),i=r||n||o||a,s=i?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=s.length;for(var u in e)!t&&!L.call(e,u)||i&&("length"==u||o&&("offset"==u||"parent"==u)||a&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||je(u,c))||s.push(u);return s}function ce(e,t,r){(void 0===r||Oe(e[t],r))&&(void 0!==r||t in e)||fe(e,t,r)}function ue(e,t,r){var n=e[t];L.call(e,t)&&Oe(n,r)&&(void 0!==r||t in e)||fe(e,t,r)}function le(e,t){for(var r=e.length;r--;)if(Oe(e[r][0],t))return r;return-1}function fe(e,t,r){"__proto__"==t&&W?W(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}ne.prototype.clear=function(){this.__data__=te?te(null):{},this.size=0},ne.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ne.prototype.get=function(e){var t=this.__data__;if(te){var r=t[e];return r===n?void 0:r}return L.call(t,e)?t[e]:void 0},ne.prototype.has=function(e){var t=this.__data__;return te?void 0!==t[e]:L.call(t,e)},ne.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=te&&void 0===t?n:t,this},oe.prototype.clear=function(){this.__data__=[],this.size=0},oe.prototype.delete=function(e){var t=this.__data__,r=le(t,e);return!(r<0||(r==t.length-1?t.pop():V.call(t,r,1),--this.size,0))},oe.prototype.get=function(e){var t=this.__data__,r=le(t,e);return r<0?void 0:t[r][1]},oe.prototype.has=function(e){return le(this.__data__,e)>-1},oe.prototype.set=function(e,t){var r=this.__data__,n=le(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},ae.prototype.clear=function(){this.size=0,this.__data__={hash:new ne,map:new(ee||oe),string:new ne}},ae.prototype.delete=function(e){var t=Ce(this,e).delete(e);return this.size-=t?1:0,t},ae.prototype.get=function(e){return Ce(this,e).get(e)},ae.prototype.has=function(e){return Ce(this,e).has(e)},ae.prototype.set=function(e,t){var r=Ce(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},ie.prototype.clear=function(){this.__data__=new oe,this.size=0},ie.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},ie.prototype.get=function(e){return this.__data__.get(e)},ie.prototype.has=function(e){return this.__data__.has(e)},ie.prototype.set=function(e,t){var n=this.__data__;if(n instanceof oe){var o=n.__data__;if(!ee||o.length<r-1)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new ae(o)}return n.set(e,t),this.size=n.size,this};var he,pe=function(e,t,r){for(var n=-1,o=Object(e),a=r(e),i=a.length;i--;){var s=a[he?i:++n];if(!1===t(o[s],s,o))break}return e};function de(e){return null==e?void 0===e?d:f:Y&&Y in Object(e)?function(e){var t=L.call(e,Y),r=e[Y];try{e[Y]=void 0;var n=!0}catch(e){}var o=k.call(e);n&&(t?e[Y]=r:delete e[Y]);return o}(e):function(e){return k.call(e)}(e)}function ge(e){return Pe(e)&&de(e)==s}function ye(e){return!(!xe(e)||(t=e,$&&$ in t))&&(Te(e)?H:g).test(function(e){if(null!=e){try{return N.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function be(e){if(!xe(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=Fe(e),r=[];for(var n in e)("constructor"!=n||!t&&L.call(e,n))&&r.push(n);return r}function ve(e,t,r,n,o){e!==t&&pe(t,function(a,i){if(xe(a))o||(o=new ie),function(e,t,r,n,o,a,i){var s=I(e,r),c=I(t,r),u=i.get(c);if(u)return void ce(e,r,u);var l=a?a(s,c,r+"",e,t,i):void 0,f=void 0===l;if(f){var p=Ie(c),d=!p&&Ae(c),g=!p&&!d&&Me(c);l=c,p||d||g?Ie(s)?l=s:Pe(C=s)&&Ee(C)?l=function(e,t){var r=-1,n=e.length;t||(t=Array(n));for(;++r<n;)t[r]=e[r];return t}(s):d?(f=!1,l=function(e,t){if(t)return e.slice();var r=e.length,n=B?B(r):new e.constructor(r);return e.copy(n),n}(c,!0)):g?(f=!1,y=c,b=!0?(v=y.buffer,_=new v.constructor(v.byteLength),new R(_).set(new R(v)),_):y.buffer,l=new y.constructor(b,y.byteOffset,y.length)):l=[]:function(e){if(!Pe(e)||de(e)!=h)return!1;var t=K(e);if(null===t)return!0;var r=L.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&N.call(r)==z}(c)||Se(c)?(l=s,Se(s)?l=function(e){return function(e,t,r,n){var o=!r;r||(r={});var a=-1,i=t.length;for(;++a<i;){var s=t[a],c=n?n(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),o?fe(r,s,c):ue(r,s,c)}return r}(e,Ne(e))}(s):(!xe(s)||n&&Te(s))&&(l=function(e){return"function"!=typeof e.constructor||Fe(e)?{}:re(K(e))}(c))):f=!1}var y,b,v,_;var C;f&&(i.set(c,l),o(l,c,n,a,i),i.delete(c));ce(e,r,l)}(e,t,i,r,ve,n,o);else{var s=n?n(I(e,i),a,i+"",e,t,o):void 0;void 0===s&&(s=a),ce(e,i,s)}},Ne)}function _e(e,t){return we(function(e,t,r){return t=Z(void 0===t?e.length-1:t,0),function(){for(var n=arguments,o=-1,a=Z(n.length-t,0),i=Array(a);++o<a;)i[o]=n[t+o];o=-1;for(var s=Array(t+1);++o<t;)s[o]=n[o];return s[t]=r(i),function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}(e,this,s)}}(e,t,ke),e+"")}function Ce(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function me(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return ye(r)?r:void 0}function je(e,t){var r=typeof e;return!!(t=null==t?i:t)&&("number"==r||"symbol"!=r&&y.test(e))&&e>-1&&e%1==0&&e<t}function Fe(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||P)}var we=function(e){var t=0,r=0;return function(){var n=Q(),i=a-(n-r);if(r=n,i>0){if(++t>=o)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(W?function(e,t){return W(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:ke);function Oe(e,t){return e===t||e!=e&&t!=t}var Se=ge(function(){return arguments}())?ge:function(e){return Pe(e)&&L.call(e,"callee")&&!q.call(e,"callee")},Ie=Array.isArray;function Ee(e){return null!=e&&De(e.length)&&!Te(e)}var Ae=X||function(){return!1};function Te(e){if(!xe(e))return!1;var t=de(e);return t==u||t==l||t==c||t==p}function De(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=i}function xe(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Pe(e){return null!=e&&"object"==typeof e}var Me=S?function(e){return function(t){return e(t)}}(S):function(e){return Pe(e)&&De(e.length)&&!!b[de(e)]};function Ne(e){return Ee(e)?se(e,!0):be(e)}var Le,$e=(Le=function(e,t,r){ve(e,t,r)},_e(function(e,t){var r=-1,n=t.length,o=n>1?t[n-1]:void 0,a=n>2?t[2]:void 0;for(o=Le.length>3&&"function"==typeof o?(n--,o):void 0,a&&function(e,t,r){if(!xe(r))return!1;var n=typeof t;return!!("number"==n?Ee(r)&&je(t,r.length):"string"==n&&t in r)&&Oe(r[t],e)}(t[0],t[1],a)&&(o=n<3?void 0:o,n=1),e=Object(e);++r<n;){var i=t[r];i&&Le(e,i,r,o)}return e}));function ke(e){return e}e.exports=$e}),FUNC_ERROR_TEXT="Expected a function",HASH_UNDEFINED="__lodash_hash_undefined__",INFINITY=1/0,funcTag="[object Function]",genTag="[object GeneratorFunction]",symbolTag="[object Symbol]",reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/,reLeadingDot=/^\./,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reEscapeChar=/\\(\\)?/g,reIsHostCtor=/^\[object .+?Constructor\]$/,freeGlobal="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")();function getValue(e,t){return null==e?void 0:e[t]}function isHostObject(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}var arrayProto=Array.prototype,funcProto=Function.prototype,objectProto=Object.prototype,coreJsData=root["__core-js_shared__"],maskSrcKey=function(){var e=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),funcToString=funcProto.toString,hasOwnProperty=objectProto.hasOwnProperty,objectToString=objectProto.toString,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Symbol$1=root.Symbol,splice=arrayProto.splice,Map=getNative(root,"Map"),nativeCreate=getNative(Object,"create"),symbolProto=Symbol$1?Symbol$1.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;function Hash(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{}}function hashDelete(e){return this.has(e)&&delete this.__data__[e]}function hashGet(e){var t=this.__data__;if(nativeCreate){var r=t[e];return r===HASH_UNDEFINED?void 0:r}return hasOwnProperty.call(t,e)?t[e]:void 0}function hashHas(e){var t=this.__data__;return nativeCreate?void 0!==t[e]:hasOwnProperty.call(t,e)}function hashSet(e,t){return this.__data__[e]=nativeCreate&&void 0===t?HASH_UNDEFINED:t,this}function ListCache(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function listCacheClear(){this.__data__=[]}function listCacheDelete(e){var t=this.__data__,r=assocIndexOf(t,e);return!(r<0)&&(r==t.length-1?t.pop():splice.call(t,r,1),!0)}function listCacheGet(e){var t=this.__data__,r=assocIndexOf(t,e);return r<0?void 0:t[r][1]}function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1}function listCacheSet(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function MapCache(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function mapCacheClear(){this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}function mapCacheDelete(e){return getMapData(this,e).delete(e)}function mapCacheGet(e){return getMapData(this,e).get(e)}function mapCacheHas(e){return getMapData(this,e).has(e)}function mapCacheSet(e,t){return getMapData(this,e).set(e,t),this}function assocIndexOf(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}function baseGet(e,t){for(var r=0,n=(t=isKey(t,e)?[t]:castPath(t)).length;null!=e&&r<n;)e=e[toKey(t[r++])];return r&&r==n?e:void 0}function baseIsNative(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)||isHostObject(e)?reIsNative:reIsHostCtor).test(toSource(e))}function baseToString(e){if("string"==typeof e)return e;if(isSymbol(e))return symbolToString?symbolToString.call(e):"";var t=e+"";return"0"==t&&1/e==-INFINITY?"-0":t}function castPath(e){return isArray(e)?e:stringToPath(e)}function getMapData(e,t){var r=e.__data__;return isKeyable(t)?r["string"==typeof t?"string":"hash"]:r.map}function getNative(e,t){var r=getValue(e,t);return baseIsNative(r)?r:void 0}function isKey(e,t){if(isArray(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol(e))||(reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}function isKeyable(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet,ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet,MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet;var stringToPath=memoize(function(e){e=toString(e);var t=[];return reLeadingDot.test(e)&&t.push(""),e.replace(rePropName,function(e,r,n,o){t.push(n?o.replace(reEscapeChar,"$1"):r||e)}),t});function toKey(e){if("string"==typeof e||isSymbol(e))return e;var t=e+"";return"0"==t&&1/e==-INFINITY?"-0":t}function toSource(e){if(null!=e){try{return funcToString.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function memoize(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(FUNC_ERROR_TEXT);var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=e.apply(this,n);return r.cache=a.set(o,i),i};return r.cache=new(memoize.Cache||MapCache),r}function eq(e,t){return e===t||e!=e&&t!=t}memoize.Cache=MapCache;var isArray=Array.isArray;function isFunction(e){var t=isObject(e)?objectToString.call(e):"";return t==funcTag||t==genTag}function isObject(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function isObjectLike(e){return!!e&&"object"==typeof e}function isSymbol(e){return"symbol"==typeof e||isObjectLike(e)&&objectToString.call(e)==symbolTag}function toString(e){return null==e?"":baseToString(e)}function get(e,t,r){var n=null==e?void 0:baseGet(e,t);return void 0===n?r:n}var lodash_get=get;const debug=logger$1.extend("i18n"),DEFAULT_LOCALE="en",LOCALE_CHANGED="bearer-locale-changed";class I18n{constructor(){this._locale=DEFAULT_LOCALE,this._dictionnary={[DEFAULT_LOCALE]:{}},this.load=((e,t,{locale:r=this.locale}={})=>__awaiter(this,void 0,void 0,function*(){const n=yield t,o=e?{[e]:n}:n;this._dictionnary[r]=lodash_merge(lodash_get(this._dictionnary,r),o),this.localeChanged()})),this.get=((e,t,r={})=>{const n=[r.locale||this.locale,e,t].filter(e=>e).join(".");return debug("lookup key",n),lodash_get(this._dictionnary,n)})}localeChanged(){document.dispatchEvent(new CustomEvent(LOCALE_CHANGED,{detail:{locale:this.locale}}))}set locale(e){this._locale=e,this.localeChanged()}get locale(){return this._locale}}const i18n=new I18n,bearer=e=>new Bearer(e);bearer.version="0.97.3",bearer.i18n=i18n,module.exports=bearer; | ||
"use strict";function __awaiter(e,t,r,n){return new(r||(r=Promise))(function(o,a){function i(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(i,s)}c((n=n.apply(e,t||[])).next())})}function debounce(e,t,r){var n,o,a,i,s;function c(){var u=Date.now()-i;u<t&&u>=0?n=setTimeout(c,t-u):(n=null,r||(s=e.apply(a,o),a=o=null))}null==t&&(t=100);var u=function(){a=this,o=arguments,i=Date.now();var u=r&&!n;return n||(n=setTimeout(c,t)),u&&(s=e.apply(a,o),a=o=null),s};return u.clear=function(){n&&(clearTimeout(n),n=null)},u.flush=function(){n&&(s=e.apply(a,o),a=o=null,clearTimeout(n),n=null)},u}debounce.debounce=debounce;var debounce_1=debounce,commonjsGlobal="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function unwrapExports(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var logger_browser=createCommonjsModule(function(e,t){!function(e){var t=1e3,r=6e4,n=36e5,o=24*n,a=function(e,a){a=a||{};var s=typeof e;if("string"===s&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var a=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(a){var i=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*i;case"weeks":case"week":case"w":return 6048e5*i;case"days":case"day":case"d":return i*o;case"hours":case"hour":case"hrs":case"hr":case"h":return i*n;case"minutes":case"minute":case"mins":case"min":case"m":return i*r;case"seconds":case"second":case"secs":case"sec":case"s":return i*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return i;default:return}}}}(e);if("number"===s&&!1===isNaN(e))return a.long?function(e){var a=Math.abs(e);return a>=o?i(e,a,o,"day"):a>=n?i(e,a,n,"hour"):a>=r?i(e,a,r,"minute"):a>=t?i(e,a,t,"second"):e+" ms"}(e):function(e){var a=Math.abs(e);return a>=o?Math.round(e/o)+"d":a>=n?Math.round(e/n)+"h":a>=r?Math.round(e/r)+"m":a>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function i(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}var s,c=(function(e,t){t.log=function(...e){return"object"==typeof console&&console.log&&console.log(...e)},t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))}),t.splice(o,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=function(e){function t(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return r.colors[Math.abs(t)%r.colors.length]}function r(e){let a;function i(...e){if(!i.enabled)return;const t=i,n=Number(new Date),o=n-(a||n);t.diff=o,t.prev=a,t.curr=n,a=n,e[0]=r.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(n,o)=>{if("%%"===n)return n;s++;const a=r.formatters[o];if("function"==typeof a){const r=e[s];n=a.call(t,r),e.splice(s,1),s--}return n}),r.formatArgs.call(t,e),(t.log||r.log).apply(t,e)}return i.namespace=e,i.enabled=r.enabled(e),i.useColors=r.useColors(),i.color=t(e),i.destroy=n,i.extend=o,"function"==typeof r.init&&r.init(i),r.instances.push(i),i}function n(){const e=r.instances.indexOf(this);return-1!==e&&(r.instances.splice(e,1),!0)}function o(e,t){const n=r(this.namespace+(void 0===t?":":t)+e);return n.log=this.log,n}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return r.debug=r,r.default=r,r.coerce=function(e){return e instanceof Error?e.stack||e.message:e},r.disable=function(){const e=[...r.names.map(i),...r.skips.map(i).map(e=>"-"+e)].join(",");return r.enable(""),e},r.enable=function(e){let t;r.save(e),r.names=[],r.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(t=0;t<o;t++)n[t]&&("-"===(e=n[t].replace(/\*/g,".*?"))[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")));for(t=0;t<r.instances.length;t++){const e=r.instances[t];e.enabled=r.enabled(e.namespace)}},r.enabled=function(e){if("*"===e[e.length-1])return!0;let t,n;for(t=0,n=r.skips.length;t<n;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;t<n;t++)if(r.names[t].test(e))return!0;return!1},r.humanize=a,Object.keys(e).forEach(t=>{r[t]=e[t]}),r.instances=[],r.names=[],r.skips=[],r.formatters={},r.selectColor=t,r.enable(r.load()),r}(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(s={exports:{}},s.exports),s.exports);c.log,c.formatArgs,c.save,c.load,c.useColors,c.storage,c.colors,e.default=(e=>c(`bearer:${e}`)),e.BearerIntentLogger=class{constructor(e){this.log=(e=>{c("bearer:intents")("%j",{data:e,scenarioId:this.context.integrationUuid,intentName:this.context.intentName})}),this.context=e}},Object.defineProperty(e,"__esModule",{value:!0})}(t)}),logger=unwrapExports(logger_browser),logger$1=logger("js");const logger$2=logger$1.extend("Bearer"),prefix="bearer",DEFAULT_OPTIONS={integrationHost:"https://int.bearer.sh",domObserver:!0,refreshDebounceDelay:200};class Bearer{constructor(e,t){this.clientId=e,this.config=DEFAULT_OPTIONS,this.registeredIntegrations={},this.loadMissingIntegrations=(()=>{const e=findElements(document.getElementsByTagName("*")),t=e.filter(e=>!this.registeredIntegration(e));logger$2(this.registeredIntegrations,e,t),this.sendTags(t)}),this.registeredIntegration=(e=>(this.registeredIntegrations[e]=this.registeredIntegrations[e]||document.createElement(e).constructor!==HTMLElement,this.registeredIntegrations[e])),this.initialIntegrationLoading=(()=>{"complete"===document.readyState||"interactive"===document.readyState?this.debounceRefresh():document.addEventListener("DOMContentLoaded",this.debounceRefresh)}),this.registerDomObserver=(()=>{if("MutationObserver"in window){this.disconnectObserver();const e=document.documentElement||document.body,t={childList:!0,subtree:!0};this.observer=new MutationObserver(this.observerCallback),this.observer.observe(e,t)}}),this.observerCallback=(e=>{for(const t of e)"childList"==t.type&&t.addedNodes.length&&this.debounceRefresh()}),this.disconnectObserver=(()=>{this.observer&&(this.observer.disconnect(),delete this.observer)}),this.sendTags=(e=>__awaiter(this,void 0,void 0,function*(){if(!e.length)return Promise.resolve(!0);try{const t=yield fetch(`${this.config.integrationHost}/v1/parse-tags`,{headers:{"content-type":"application/json"},body:JSON.stringify({tags:e,clientId:this.clientId}),method:"POST"});if(t.status>299)throw new Error(`Error while fetching integration tag names: ${e}`);return(yield t.json()).map(e=>{document.querySelector(`#${getScriptId(e.uuid)}`)||document.body.appendChild(getScriptDOM(this.clientId,e))}),!0}catch(e){return!1}})),this.config=Object.assign({},DEFAULT_OPTIONS,t),this.debounceRefresh=debounce_1(this.loadMissingIntegrations,this.config.refreshDebounceDelay),this.initialIntegrationLoading(),this.config.domObserver&&this.registerDomObserver()}}function findElements(e,t=/^bearer-/i){return Array.from(e).filter(e=>t.test(e.tagName)).map(e=>e.tagName.toLowerCase())}function getScriptId(e){return`${prefix}-${e}`}function getScriptDOM(e,t){const r=document.createElement("script");r.type="text/javascript",r.async=!0;const n=t.asset.indexOf("?")>-1?"&":"?";return r.src=[t.asset,[`clientId=${e}`].join("&")].join(n),r.id=getScriptId(t.uuid),r}var lodash_merge=createCommonjsModule(function(e,t){var r=200,n="__lodash_hash_undefined__",o=800,a=16,i=9007199254740991,s="[object Arguments]",c="[object AsyncFunction]",u="[object Function]",l="[object GeneratorFunction]",f="[object Null]",h="[object Object]",p="[object Proxy]",d="[object Undefined]",g=/^\[object .+?Constructor\]$/,y=/^(?:0|[1-9]\d*)$/,b={};b["[object Float32Array]"]=b["[object Float64Array]"]=b["[object Int8Array]"]=b["[object Int16Array]"]=b["[object Int32Array]"]=b["[object Uint8Array]"]=b["[object Uint8ClampedArray]"]=b["[object Uint16Array]"]=b["[object Uint32Array]"]=!0,b[s]=b["[object Array]"]=b["[object ArrayBuffer]"]=b["[object Boolean]"]=b["[object DataView]"]=b["[object Date]"]=b["[object Error]"]=b[u]=b["[object Map]"]=b["[object Number]"]=b[h]=b["[object RegExp]"]=b["[object Set]"]=b["[object String]"]=b["[object WeakMap]"]=!1;var v="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_="object"==typeof self&&self&&self.Object===Object&&self,C=v||_||Function("return this")(),m=t&&!t.nodeType&&t,j=m&&e&&!e.nodeType&&e,F=j&&j.exports===m,w=F&&v.process,O=function(){try{return w&&w.binding&&w.binding("util")}catch(e){}}(),S=O&&O.isTypedArray;function I(e,t){return"__proto__"==t?void 0:e[t]}var E,A,T,x=Array.prototype,D=Function.prototype,P=Object.prototype,M=C["__core-js_shared__"],N=D.toString,L=P.hasOwnProperty,$=(E=/[^.]+$/.exec(M&&M.keys&&M.keys.IE_PROTO||""))?"Symbol(src)_1."+E:"",k=P.toString,H=N.call(Object),z=RegExp("^"+N.call(L).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),G=F?C.Buffer:void 0,U=C.Symbol,R=C.Uint8Array,B=G?G.allocUnsafe:void 0,K=(A=Object.getPrototypeOf,T=Object,function(e){return A(T(e))}),J=Object.create,q=P.propertyIsEnumerable,V=x.splice,Y=U?U.toStringTag:void 0,W=function(){try{var e=me(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),X=G?G.isBuffer:void 0,Z=Math.max,Q=Date.now,ee=me(C,"Map"),te=me(Object,"create"),re=function(){function e(){}return function(t){if(!De(t))return{};if(J)return J(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function ne(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function oe(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ae(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ie(e){var t=this.__data__=new oe(e);this.size=t.size}function se(e,t){var r=Ie(e),n=!r&&Se(e),o=!r&&!n&&Ae(e),a=!r&&!n&&!o&&Me(e),i=r||n||o||a,s=i?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=s.length;for(var u in e)!t&&!L.call(e,u)||i&&("length"==u||o&&("offset"==u||"parent"==u)||a&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||je(u,c))||s.push(u);return s}function ce(e,t,r){(void 0===r||Oe(e[t],r))&&(void 0!==r||t in e)||fe(e,t,r)}function ue(e,t,r){var n=e[t];L.call(e,t)&&Oe(n,r)&&(void 0!==r||t in e)||fe(e,t,r)}function le(e,t){for(var r=e.length;r--;)if(Oe(e[r][0],t))return r;return-1}function fe(e,t,r){"__proto__"==t&&W?W(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}ne.prototype.clear=function(){this.__data__=te?te(null):{},this.size=0},ne.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ne.prototype.get=function(e){var t=this.__data__;if(te){var r=t[e];return r===n?void 0:r}return L.call(t,e)?t[e]:void 0},ne.prototype.has=function(e){var t=this.__data__;return te?void 0!==t[e]:L.call(t,e)},ne.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=te&&void 0===t?n:t,this},oe.prototype.clear=function(){this.__data__=[],this.size=0},oe.prototype.delete=function(e){var t=this.__data__,r=le(t,e);return!(r<0||(r==t.length-1?t.pop():V.call(t,r,1),--this.size,0))},oe.prototype.get=function(e){var t=this.__data__,r=le(t,e);return r<0?void 0:t[r][1]},oe.prototype.has=function(e){return le(this.__data__,e)>-1},oe.prototype.set=function(e,t){var r=this.__data__,n=le(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},ae.prototype.clear=function(){this.size=0,this.__data__={hash:new ne,map:new(ee||oe),string:new ne}},ae.prototype.delete=function(e){var t=Ce(this,e).delete(e);return this.size-=t?1:0,t},ae.prototype.get=function(e){return Ce(this,e).get(e)},ae.prototype.has=function(e){return Ce(this,e).has(e)},ae.prototype.set=function(e,t){var r=Ce(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},ie.prototype.clear=function(){this.__data__=new oe,this.size=0},ie.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},ie.prototype.get=function(e){return this.__data__.get(e)},ie.prototype.has=function(e){return this.__data__.has(e)},ie.prototype.set=function(e,t){var n=this.__data__;if(n instanceof oe){var o=n.__data__;if(!ee||o.length<r-1)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new ae(o)}return n.set(e,t),this.size=n.size,this};var he,pe=function(e,t,r){for(var n=-1,o=Object(e),a=r(e),i=a.length;i--;){var s=a[he?i:++n];if(!1===t(o[s],s,o))break}return e};function de(e){return null==e?void 0===e?d:f:Y&&Y in Object(e)?function(e){var t=L.call(e,Y),r=e[Y];try{e[Y]=void 0;var n=!0}catch(e){}var o=k.call(e);n&&(t?e[Y]=r:delete e[Y]);return o}(e):function(e){return k.call(e)}(e)}function ge(e){return Pe(e)&&de(e)==s}function ye(e){return!(!De(e)||(t=e,$&&$ in t))&&(Te(e)?z:g).test(function(e){if(null!=e){try{return N.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function be(e){if(!De(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=Fe(e),r=[];for(var n in e)("constructor"!=n||!t&&L.call(e,n))&&r.push(n);return r}function ve(e,t,r,n,o){e!==t&&pe(t,function(a,i){if(De(a))o||(o=new ie),function(e,t,r,n,o,a,i){var s=I(e,r),c=I(t,r),u=i.get(c);if(u)return void ce(e,r,u);var l=a?a(s,c,r+"",e,t,i):void 0,f=void 0===l;if(f){var p=Ie(c),d=!p&&Ae(c),g=!p&&!d&&Me(c);l=c,p||d||g?Ie(s)?l=s:Pe(C=s)&&Ee(C)?l=function(e,t){var r=-1,n=e.length;t||(t=Array(n));for(;++r<n;)t[r]=e[r];return t}(s):d?(f=!1,l=function(e,t){if(t)return e.slice();var r=e.length,n=B?B(r):new e.constructor(r);return e.copy(n),n}(c,!0)):g?(f=!1,y=c,b=!0?(v=y.buffer,_=new v.constructor(v.byteLength),new R(_).set(new R(v)),_):y.buffer,l=new y.constructor(b,y.byteOffset,y.length)):l=[]:function(e){if(!Pe(e)||de(e)!=h)return!1;var t=K(e);if(null===t)return!0;var r=L.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&N.call(r)==H}(c)||Se(c)?(l=s,Se(s)?l=function(e){return function(e,t,r,n){var o=!r;r||(r={});var a=-1,i=t.length;for(;++a<i;){var s=t[a],c=n?n(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),o?fe(r,s,c):ue(r,s,c)}return r}(e,Ne(e))}(s):(!De(s)||n&&Te(s))&&(l=function(e){return"function"!=typeof e.constructor||Fe(e)?{}:re(K(e))}(c))):f=!1}var y,b,v,_;var C;f&&(i.set(c,l),o(l,c,n,a,i),i.delete(c));ce(e,r,l)}(e,t,i,r,ve,n,o);else{var s=n?n(I(e,i),a,i+"",e,t,o):void 0;void 0===s&&(s=a),ce(e,i,s)}},Ne)}function _e(e,t){return we(function(e,t,r){return t=Z(void 0===t?e.length-1:t,0),function(){for(var n=arguments,o=-1,a=Z(n.length-t,0),i=Array(a);++o<a;)i[o]=n[t+o];o=-1;for(var s=Array(t+1);++o<t;)s[o]=n[o];return s[t]=r(i),function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}(e,this,s)}}(e,t,ke),e+"")}function Ce(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function me(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return ye(r)?r:void 0}function je(e,t){var r=typeof e;return!!(t=null==t?i:t)&&("number"==r||"symbol"!=r&&y.test(e))&&e>-1&&e%1==0&&e<t}function Fe(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||P)}var we=function(e){var t=0,r=0;return function(){var n=Q(),i=a-(n-r);if(r=n,i>0){if(++t>=o)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(W?function(e,t){return W(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:ke);function Oe(e,t){return e===t||e!=e&&t!=t}var Se=ge(function(){return arguments}())?ge:function(e){return Pe(e)&&L.call(e,"callee")&&!q.call(e,"callee")},Ie=Array.isArray;function Ee(e){return null!=e&&xe(e.length)&&!Te(e)}var Ae=X||function(){return!1};function Te(e){if(!De(e))return!1;var t=de(e);return t==u||t==l||t==c||t==p}function xe(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=i}function De(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Pe(e){return null!=e&&"object"==typeof e}var Me=S?function(e){return function(t){return e(t)}}(S):function(e){return Pe(e)&&xe(e.length)&&!!b[de(e)]};function Ne(e){return Ee(e)?se(e,!0):be(e)}var Le,$e=(Le=function(e,t,r){ve(e,t,r)},_e(function(e,t){var r=-1,n=t.length,o=n>1?t[n-1]:void 0,a=n>2?t[2]:void 0;for(o=Le.length>3&&"function"==typeof o?(n--,o):void 0,a&&function(e,t,r){if(!De(r))return!1;var n=typeof t;return!!("number"==n?Ee(r)&&je(t,r.length):"string"==n&&t in r)&&Oe(r[t],e)}(t[0],t[1],a)&&(o=n<3?void 0:o,n=1),e=Object(e);++r<n;){var i=t[r];i&&Le(e,i,r,o)}return e}));function ke(e){return e}e.exports=$e}),FUNC_ERROR_TEXT="Expected a function",HASH_UNDEFINED="__lodash_hash_undefined__",INFINITY=1/0,funcTag="[object Function]",genTag="[object GeneratorFunction]",symbolTag="[object Symbol]",reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/,reLeadingDot=/^\./,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reEscapeChar=/\\(\\)?/g,reIsHostCtor=/^\[object .+?Constructor\]$/,freeGlobal="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")();function getValue(e,t){return null==e?void 0:e[t]}function isHostObject(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}var arrayProto=Array.prototype,funcProto=Function.prototype,objectProto=Object.prototype,coreJsData=root["__core-js_shared__"],maskSrcKey=function(){var e=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),funcToString=funcProto.toString,hasOwnProperty=objectProto.hasOwnProperty,objectToString=objectProto.toString,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Symbol$1=root.Symbol,splice=arrayProto.splice,Map=getNative(root,"Map"),nativeCreate=getNative(Object,"create"),symbolProto=Symbol$1?Symbol$1.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;function Hash(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{}}function hashDelete(e){return this.has(e)&&delete this.__data__[e]}function hashGet(e){var t=this.__data__;if(nativeCreate){var r=t[e];return r===HASH_UNDEFINED?void 0:r}return hasOwnProperty.call(t,e)?t[e]:void 0}function hashHas(e){var t=this.__data__;return nativeCreate?void 0!==t[e]:hasOwnProperty.call(t,e)}function hashSet(e,t){return this.__data__[e]=nativeCreate&&void 0===t?HASH_UNDEFINED:t,this}function ListCache(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function listCacheClear(){this.__data__=[]}function listCacheDelete(e){var t=this.__data__,r=assocIndexOf(t,e);return!(r<0)&&(r==t.length-1?t.pop():splice.call(t,r,1),!0)}function listCacheGet(e){var t=this.__data__,r=assocIndexOf(t,e);return r<0?void 0:t[r][1]}function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1}function listCacheSet(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function MapCache(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function mapCacheClear(){this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}function mapCacheDelete(e){return getMapData(this,e).delete(e)}function mapCacheGet(e){return getMapData(this,e).get(e)}function mapCacheHas(e){return getMapData(this,e).has(e)}function mapCacheSet(e,t){return getMapData(this,e).set(e,t),this}function assocIndexOf(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}function baseGet(e,t){for(var r=0,n=(t=isKey(t,e)?[t]:castPath(t)).length;null!=e&&r<n;)e=e[toKey(t[r++])];return r&&r==n?e:void 0}function baseIsNative(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)||isHostObject(e)?reIsNative:reIsHostCtor).test(toSource(e))}function baseToString(e){if("string"==typeof e)return e;if(isSymbol(e))return symbolToString?symbolToString.call(e):"";var t=e+"";return"0"==t&&1/e==-INFINITY?"-0":t}function castPath(e){return isArray(e)?e:stringToPath(e)}function getMapData(e,t){var r=e.__data__;return isKeyable(t)?r["string"==typeof t?"string":"hash"]:r.map}function getNative(e,t){var r=getValue(e,t);return baseIsNative(r)?r:void 0}function isKey(e,t){if(isArray(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol(e))||(reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}function isKeyable(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet,ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet,MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet;var stringToPath=memoize(function(e){e=toString(e);var t=[];return reLeadingDot.test(e)&&t.push(""),e.replace(rePropName,function(e,r,n,o){t.push(n?o.replace(reEscapeChar,"$1"):r||e)}),t});function toKey(e){if("string"==typeof e||isSymbol(e))return e;var t=e+"";return"0"==t&&1/e==-INFINITY?"-0":t}function toSource(e){if(null!=e){try{return funcToString.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function memoize(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(FUNC_ERROR_TEXT);var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=e.apply(this,n);return r.cache=a.set(o,i),i};return r.cache=new(memoize.Cache||MapCache),r}function eq(e,t){return e===t||e!=e&&t!=t}memoize.Cache=MapCache;var isArray=Array.isArray;function isFunction(e){var t=isObject(e)?objectToString.call(e):"";return t==funcTag||t==genTag}function isObject(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function isObjectLike(e){return!!e&&"object"==typeof e}function isSymbol(e){return"symbol"==typeof e||isObjectLike(e)&&objectToString.call(e)==symbolTag}function toString(e){return null==e?"":baseToString(e)}function get(e,t,r){var n=null==e?void 0:baseGet(e,t);return void 0===n?r:n}var lodash_get=get;const debug=logger$1.extend("i18n"),DEFAULT_LOCALE="en",LOCALE_CHANGED="bearer-locale-changed";class I18n{constructor(){this._locale=DEFAULT_LOCALE,this._dictionnary={[DEFAULT_LOCALE]:{}},this.load=((e,t,{locale:r=this.locale}={})=>__awaiter(this,void 0,void 0,function*(){const n=yield t,o=e?{[e]:n}:n;this._dictionnary[r]=lodash_merge(lodash_get(this._dictionnary,r),o),this.localeChanged()})),this.get=((e,t,r={})=>{const n=[r.locale||this.locale,e,t].filter(e=>e).join(".");return debug("lookup key",n),lodash_get(this._dictionnary,n)})}localeChanged(){document.dispatchEvent(new CustomEvent(LOCALE_CHANGED,{detail:{locale:this.locale}}))}set locale(e){this._locale=e,this.localeChanged()}get locale(){return this._locale}}const i18n=new I18n,bearer=(e,t)=>new Bearer(e,t);bearer.version="0.98.0",bearer.i18n=i18n,module.exports=bearer; | ||
//# sourceMappingURL=index.js.map |
export default class Bearer { | ||
readonly clientId: string; | ||
config: TBearerOptions; | ||
private registeredIntegrations; | ||
private config; | ||
private observer?; | ||
@@ -34,4 +34,5 @@ private debounceRefresh; | ||
} | ||
declare type TBearerOptions = { | ||
export declare type TBearerOptions = { | ||
domObserver: boolean; | ||
integrationHost: string; | ||
refreshDebounceDelay: number; | ||
@@ -45,2 +46,1 @@ }; | ||
export declare function findElements(elements: HTMLCollection | NodeListOf<Element>, filter?: RegExp): string[]; | ||
export {}; |
@@ -1,4 +0,4 @@ | ||
import Bearer from './bearer'; | ||
import Bearer, { TBearerOptions } from './bearer'; | ||
declare const bearer: { | ||
(token: string): Bearer; | ||
(token: string, options?: Partial<TBearerOptions> | undefined): Bearer; | ||
version: string; | ||
@@ -5,0 +5,0 @@ i18n: import("./i18n").I18n; |
@@ -1,2 +0,2 @@ | ||
function __awaiter(e,t,r,n){return new(r||(r=Promise))(function(o,a){function i(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(i,s)}c((n=n.apply(e,t||[])).next())})}function debounce(e,t,r){var n,o,a,i,s;function c(){var u=Date.now()-i;u<t&&u>=0?n=setTimeout(c,t-u):(n=null,r||(s=e.apply(a,o),a=o=null))}null==t&&(t=100);var u=function(){a=this,o=arguments,i=Date.now();var u=r&&!n;return n||(n=setTimeout(c,t)),u&&(s=e.apply(a,o),a=o=null),s};return u.clear=function(){n&&(clearTimeout(n),n=null)},u.flush=function(){n&&(s=e.apply(a,o),a=o=null,clearTimeout(n),n=null)},u}debounce.debounce=debounce;var debounce_1=debounce,commonjsGlobal="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function unwrapExports(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var logger_browser=createCommonjsModule(function(e,t){!function(e){var t=1e3,r=6e4,n=36e5,o=24*n,a=function(e,a){a=a||{};var s=typeof e;if("string"===s&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var a=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(a){var i=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*i;case"weeks":case"week":case"w":return 6048e5*i;case"days":case"day":case"d":return i*o;case"hours":case"hour":case"hrs":case"hr":case"h":return i*n;case"minutes":case"minute":case"mins":case"min":case"m":return i*r;case"seconds":case"second":case"secs":case"sec":case"s":return i*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return i;default:return}}}}(e);if("number"===s&&!1===isNaN(e))return a.long?function(e){var a=Math.abs(e);return a>=o?i(e,a,o,"day"):a>=n?i(e,a,n,"hour"):a>=r?i(e,a,r,"minute"):a>=t?i(e,a,t,"second"):e+" ms"}(e):function(e){var a=Math.abs(e);return a>=o?Math.round(e/o)+"d":a>=n?Math.round(e/n)+"h":a>=r?Math.round(e/r)+"m":a>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function i(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}var s,c=(function(e,t){t.log=function(...e){return"object"==typeof console&&console.log&&console.log(...e)},t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))}),t.splice(o,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=function(e){function t(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return r.colors[Math.abs(t)%r.colors.length]}function r(e){let a;function i(...e){if(!i.enabled)return;const t=i,n=Number(new Date),o=n-(a||n);t.diff=o,t.prev=a,t.curr=n,a=n,e[0]=r.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(n,o)=>{if("%%"===n)return n;s++;const a=r.formatters[o];if("function"==typeof a){const r=e[s];n=a.call(t,r),e.splice(s,1),s--}return n}),r.formatArgs.call(t,e),(t.log||r.log).apply(t,e)}return i.namespace=e,i.enabled=r.enabled(e),i.useColors=r.useColors(),i.color=t(e),i.destroy=n,i.extend=o,"function"==typeof r.init&&r.init(i),r.instances.push(i),i}function n(){const e=r.instances.indexOf(this);return-1!==e&&(r.instances.splice(e,1),!0)}function o(e,t){const n=r(this.namespace+(void 0===t?":":t)+e);return n.log=this.log,n}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return r.debug=r,r.default=r,r.coerce=function(e){return e instanceof Error?e.stack||e.message:e},r.disable=function(){const e=[...r.names.map(i),...r.skips.map(i).map(e=>"-"+e)].join(",");return r.enable(""),e},r.enable=function(e){let t;r.save(e),r.names=[],r.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(t=0;t<o;t++)n[t]&&("-"===(e=n[t].replace(/\*/g,".*?"))[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")));for(t=0;t<r.instances.length;t++){const e=r.instances[t];e.enabled=r.enabled(e.namespace)}},r.enabled=function(e){if("*"===e[e.length-1])return!0;let t,n;for(t=0,n=r.skips.length;t<n;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;t<n;t++)if(r.names[t].test(e))return!0;return!1},r.humanize=a,Object.keys(e).forEach(t=>{r[t]=e[t]}),r.instances=[],r.names=[],r.skips=[],r.formatters={},r.selectColor=t,r.enable(r.load()),r}(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(s={exports:{}},s.exports),s.exports);c.log,c.formatArgs,c.save,c.load,c.useColors,c.storage,c.colors,e.default=(e=>c(`bearer:${e}`)),e.BearerIntentLogger=class{constructor(e){this.log=(e=>{c("bearer:intents")("%j",{data:e,scenarioId:this.context.integrationUuid,intentName:this.context.intentName})}),this.context=e}},Object.defineProperty(e,"__esModule",{value:!0})}(t)}),logger=unwrapExports(logger_browser),logger$1=logger("js");const prefix="bearer",DEFAULT_OPTIONS={domObserver:!0,refreshDebounceDelay:200};class Bearer{constructor(e,t){this.clientId=e,this.registeredIntegrations={},this.config=DEFAULT_OPTIONS,this.loadMissingIntegrations=(()=>{const e=findElements(document.getElementsByTagName("*")),t=e.filter(e=>!this.registeredIntegration(e));logger$1(this.registeredIntegrations,e,t),this.sendTags(t)}),this.registeredIntegration=(e=>(this.registeredIntegrations[e]=this.registeredIntegrations[e]||document.createElement(e).constructor!==HTMLElement,this.registeredIntegrations[e])),this.initialIntegrationLoading=(()=>{"complete"===document.readyState||"interactive"===document.readyState?this.debounceRefresh():document.addEventListener("DOMContentLoaded",this.debounceRefresh)}),this.registerDomObserver=(()=>{if("MutationObserver"in window){this.disconnectObserver();const e=document.documentElement||document.body,t={childList:!0,subtree:!0};this.observer=new MutationObserver(this.observerCallback),this.observer.observe(e,t)}}),this.observerCallback=(e=>{for(const t of e)"childList"==t.type&&t.addedNodes.length&&this.debounceRefresh()}),this.disconnectObserver=(()=>{this.observer&&(this.observer.disconnect(),delete this.observer)}),this.sendTags=(e=>__awaiter(this,void 0,void 0,function*(){if(!e.length)return Promise.resolve(!0);try{const t=yield fetch("https://int.bearer.sh/v1/parse-tags",{headers:{"content-type":"application/json"},body:JSON.stringify({tags:e,clientId:this.clientId}),method:"POST"});if(t.status>299)throw new Error(`Error while fetching integration tag names: ${e}`);return(yield t.json()).map(e=>{document.querySelector(`#${getScriptId(e.uuid)}`)||document.body.appendChild(getScriptDOM(this.clientId,e))}),!0}catch(e){return!1}})),this.config=Object.assign({},t,DEFAULT_OPTIONS),this.debounceRefresh=debounce_1(this.loadMissingIntegrations,this.config.refreshDebounceDelay),this.initialIntegrationLoading(),this.config.domObserver&&this.registerDomObserver()}}function findElements(e,t=/^bearer-/i){return Array.from(e).filter(e=>t.test(e.tagName)).map(e=>e.tagName.toLowerCase())}function getScriptId(e){return`${prefix}-${e}`}function getScriptDOM(e,t){const r=document.createElement("script");r.type="text/javascript",r.async=!0;const n=t.asset.indexOf("?")>-1?"&":"?";return r.src=[t.asset,[`clientId=${e}`].join("&")].join(n),r.id=getScriptId(t.uuid),r}var lodash_merge=createCommonjsModule(function(e,t){var r=200,n="__lodash_hash_undefined__",o=800,a=16,i=9007199254740991,s="[object Arguments]",c="[object AsyncFunction]",u="[object Function]",l="[object GeneratorFunction]",f="[object Null]",h="[object Object]",p="[object Proxy]",d="[object Undefined]",g=/^\[object .+?Constructor\]$/,y=/^(?:0|[1-9]\d*)$/,b={};b["[object Float32Array]"]=b["[object Float64Array]"]=b["[object Int8Array]"]=b["[object Int16Array]"]=b["[object Int32Array]"]=b["[object Uint8Array]"]=b["[object Uint8ClampedArray]"]=b["[object Uint16Array]"]=b["[object Uint32Array]"]=!0,b[s]=b["[object Array]"]=b["[object ArrayBuffer]"]=b["[object Boolean]"]=b["[object DataView]"]=b["[object Date]"]=b["[object Error]"]=b[u]=b["[object Map]"]=b["[object Number]"]=b[h]=b["[object RegExp]"]=b["[object Set]"]=b["[object String]"]=b["[object WeakMap]"]=!1;var v="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_="object"==typeof self&&self&&self.Object===Object&&self,C=v||_||Function("return this")(),m=t&&!t.nodeType&&t,j=m&&e&&!e.nodeType&&e,F=j&&j.exports===m,w=F&&v.process,O=function(){try{return w&&w.binding&&w.binding("util")}catch(e){}}(),S=O&&O.isTypedArray;function I(e,t){return"__proto__"==t?void 0:e[t]}var E,A,T,D=Array.prototype,x=Function.prototype,P=Object.prototype,M=C["__core-js_shared__"],N=x.toString,L=P.hasOwnProperty,$=(E=/[^.]+$/.exec(M&&M.keys&&M.keys.IE_PROTO||""))?"Symbol(src)_1."+E:"",k=P.toString,z=N.call(Object),H=RegExp("^"+N.call(L).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),G=F?C.Buffer:void 0,U=C.Symbol,R=C.Uint8Array,B=G?G.allocUnsafe:void 0,K=(A=Object.getPrototypeOf,T=Object,function(e){return A(T(e))}),J=Object.create,q=P.propertyIsEnumerable,V=D.splice,Y=U?U.toStringTag:void 0,W=function(){try{var e=me(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),X=G?G.isBuffer:void 0,Z=Math.max,Q=Date.now,ee=me(C,"Map"),te=me(Object,"create"),re=function(){function e(){}return function(t){if(!xe(t))return{};if(J)return J(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function ne(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function oe(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ae(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ie(e){var t=this.__data__=new oe(e);this.size=t.size}function se(e,t){var r=Ie(e),n=!r&&Se(e),o=!r&&!n&&Ae(e),a=!r&&!n&&!o&&Me(e),i=r||n||o||a,s=i?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=s.length;for(var u in e)!t&&!L.call(e,u)||i&&("length"==u||o&&("offset"==u||"parent"==u)||a&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||je(u,c))||s.push(u);return s}function ce(e,t,r){(void 0===r||Oe(e[t],r))&&(void 0!==r||t in e)||fe(e,t,r)}function ue(e,t,r){var n=e[t];L.call(e,t)&&Oe(n,r)&&(void 0!==r||t in e)||fe(e,t,r)}function le(e,t){for(var r=e.length;r--;)if(Oe(e[r][0],t))return r;return-1}function fe(e,t,r){"__proto__"==t&&W?W(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}ne.prototype.clear=function(){this.__data__=te?te(null):{},this.size=0},ne.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ne.prototype.get=function(e){var t=this.__data__;if(te){var r=t[e];return r===n?void 0:r}return L.call(t,e)?t[e]:void 0},ne.prototype.has=function(e){var t=this.__data__;return te?void 0!==t[e]:L.call(t,e)},ne.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=te&&void 0===t?n:t,this},oe.prototype.clear=function(){this.__data__=[],this.size=0},oe.prototype.delete=function(e){var t=this.__data__,r=le(t,e);return!(r<0||(r==t.length-1?t.pop():V.call(t,r,1),--this.size,0))},oe.prototype.get=function(e){var t=this.__data__,r=le(t,e);return r<0?void 0:t[r][1]},oe.prototype.has=function(e){return le(this.__data__,e)>-1},oe.prototype.set=function(e,t){var r=this.__data__,n=le(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},ae.prototype.clear=function(){this.size=0,this.__data__={hash:new ne,map:new(ee||oe),string:new ne}},ae.prototype.delete=function(e){var t=Ce(this,e).delete(e);return this.size-=t?1:0,t},ae.prototype.get=function(e){return Ce(this,e).get(e)},ae.prototype.has=function(e){return Ce(this,e).has(e)},ae.prototype.set=function(e,t){var r=Ce(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},ie.prototype.clear=function(){this.__data__=new oe,this.size=0},ie.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},ie.prototype.get=function(e){return this.__data__.get(e)},ie.prototype.has=function(e){return this.__data__.has(e)},ie.prototype.set=function(e,t){var n=this.__data__;if(n instanceof oe){var o=n.__data__;if(!ee||o.length<r-1)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new ae(o)}return n.set(e,t),this.size=n.size,this};var he,pe=function(e,t,r){for(var n=-1,o=Object(e),a=r(e),i=a.length;i--;){var s=a[he?i:++n];if(!1===t(o[s],s,o))break}return e};function de(e){return null==e?void 0===e?d:f:Y&&Y in Object(e)?function(e){var t=L.call(e,Y),r=e[Y];try{e[Y]=void 0;var n=!0}catch(e){}var o=k.call(e);n&&(t?e[Y]=r:delete e[Y]);return o}(e):function(e){return k.call(e)}(e)}function ge(e){return Pe(e)&&de(e)==s}function ye(e){return!(!xe(e)||(t=e,$&&$ in t))&&(Te(e)?H:g).test(function(e){if(null!=e){try{return N.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function be(e){if(!xe(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=Fe(e),r=[];for(var n in e)("constructor"!=n||!t&&L.call(e,n))&&r.push(n);return r}function ve(e,t,r,n,o){e!==t&&pe(t,function(a,i){if(xe(a))o||(o=new ie),function(e,t,r,n,o,a,i){var s=I(e,r),c=I(t,r),u=i.get(c);if(u)return void ce(e,r,u);var l=a?a(s,c,r+"",e,t,i):void 0,f=void 0===l;if(f){var p=Ie(c),d=!p&&Ae(c),g=!p&&!d&&Me(c);l=c,p||d||g?Ie(s)?l=s:Pe(C=s)&&Ee(C)?l=function(e,t){var r=-1,n=e.length;t||(t=Array(n));for(;++r<n;)t[r]=e[r];return t}(s):d?(f=!1,l=function(e,t){if(t)return e.slice();var r=e.length,n=B?B(r):new e.constructor(r);return e.copy(n),n}(c,!0)):g?(f=!1,y=c,b=!0?(v=y.buffer,_=new v.constructor(v.byteLength),new R(_).set(new R(v)),_):y.buffer,l=new y.constructor(b,y.byteOffset,y.length)):l=[]:function(e){if(!Pe(e)||de(e)!=h)return!1;var t=K(e);if(null===t)return!0;var r=L.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&N.call(r)==z}(c)||Se(c)?(l=s,Se(s)?l=function(e){return function(e,t,r,n){var o=!r;r||(r={});var a=-1,i=t.length;for(;++a<i;){var s=t[a],c=n?n(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),o?fe(r,s,c):ue(r,s,c)}return r}(e,Ne(e))}(s):(!xe(s)||n&&Te(s))&&(l=function(e){return"function"!=typeof e.constructor||Fe(e)?{}:re(K(e))}(c))):f=!1}var y,b,v,_;var C;f&&(i.set(c,l),o(l,c,n,a,i),i.delete(c));ce(e,r,l)}(e,t,i,r,ve,n,o);else{var s=n?n(I(e,i),a,i+"",e,t,o):void 0;void 0===s&&(s=a),ce(e,i,s)}},Ne)}function _e(e,t){return we(function(e,t,r){return t=Z(void 0===t?e.length-1:t,0),function(){for(var n=arguments,o=-1,a=Z(n.length-t,0),i=Array(a);++o<a;)i[o]=n[t+o];o=-1;for(var s=Array(t+1);++o<t;)s[o]=n[o];return s[t]=r(i),function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}(e,this,s)}}(e,t,ke),e+"")}function Ce(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function me(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return ye(r)?r:void 0}function je(e,t){var r=typeof e;return!!(t=null==t?i:t)&&("number"==r||"symbol"!=r&&y.test(e))&&e>-1&&e%1==0&&e<t}function Fe(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||P)}var we=function(e){var t=0,r=0;return function(){var n=Q(),i=a-(n-r);if(r=n,i>0){if(++t>=o)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(W?function(e,t){return W(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:ke);function Oe(e,t){return e===t||e!=e&&t!=t}var Se=ge(function(){return arguments}())?ge:function(e){return Pe(e)&&L.call(e,"callee")&&!q.call(e,"callee")},Ie=Array.isArray;function Ee(e){return null!=e&&De(e.length)&&!Te(e)}var Ae=X||function(){return!1};function Te(e){if(!xe(e))return!1;var t=de(e);return t==u||t==l||t==c||t==p}function De(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=i}function xe(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Pe(e){return null!=e&&"object"==typeof e}var Me=S?function(e){return function(t){return e(t)}}(S):function(e){return Pe(e)&&De(e.length)&&!!b[de(e)]};function Ne(e){return Ee(e)?se(e,!0):be(e)}var Le,$e=(Le=function(e,t,r){ve(e,t,r)},_e(function(e,t){var r=-1,n=t.length,o=n>1?t[n-1]:void 0,a=n>2?t[2]:void 0;for(o=Le.length>3&&"function"==typeof o?(n--,o):void 0,a&&function(e,t,r){if(!xe(r))return!1;var n=typeof t;return!!("number"==n?Ee(r)&&je(t,r.length):"string"==n&&t in r)&&Oe(r[t],e)}(t[0],t[1],a)&&(o=n<3?void 0:o,n=1),e=Object(e);++r<n;){var i=t[r];i&&Le(e,i,r,o)}return e}));function ke(e){return e}e.exports=$e}),FUNC_ERROR_TEXT="Expected a function",HASH_UNDEFINED="__lodash_hash_undefined__",INFINITY=1/0,funcTag="[object Function]",genTag="[object GeneratorFunction]",symbolTag="[object Symbol]",reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/,reLeadingDot=/^\./,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reEscapeChar=/\\(\\)?/g,reIsHostCtor=/^\[object .+?Constructor\]$/,freeGlobal="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")();function getValue(e,t){return null==e?void 0:e[t]}function isHostObject(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}var arrayProto=Array.prototype,funcProto=Function.prototype,objectProto=Object.prototype,coreJsData=root["__core-js_shared__"],maskSrcKey=function(){var e=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),funcToString=funcProto.toString,hasOwnProperty=objectProto.hasOwnProperty,objectToString=objectProto.toString,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Symbol$1=root.Symbol,splice=arrayProto.splice,Map=getNative(root,"Map"),nativeCreate=getNative(Object,"create"),symbolProto=Symbol$1?Symbol$1.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;function Hash(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{}}function hashDelete(e){return this.has(e)&&delete this.__data__[e]}function hashGet(e){var t=this.__data__;if(nativeCreate){var r=t[e];return r===HASH_UNDEFINED?void 0:r}return hasOwnProperty.call(t,e)?t[e]:void 0}function hashHas(e){var t=this.__data__;return nativeCreate?void 0!==t[e]:hasOwnProperty.call(t,e)}function hashSet(e,t){return this.__data__[e]=nativeCreate&&void 0===t?HASH_UNDEFINED:t,this}function ListCache(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function listCacheClear(){this.__data__=[]}function listCacheDelete(e){var t=this.__data__,r=assocIndexOf(t,e);return!(r<0)&&(r==t.length-1?t.pop():splice.call(t,r,1),!0)}function listCacheGet(e){var t=this.__data__,r=assocIndexOf(t,e);return r<0?void 0:t[r][1]}function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1}function listCacheSet(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function MapCache(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function mapCacheClear(){this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}function mapCacheDelete(e){return getMapData(this,e).delete(e)}function mapCacheGet(e){return getMapData(this,e).get(e)}function mapCacheHas(e){return getMapData(this,e).has(e)}function mapCacheSet(e,t){return getMapData(this,e).set(e,t),this}function assocIndexOf(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}function baseGet(e,t){for(var r=0,n=(t=isKey(t,e)?[t]:castPath(t)).length;null!=e&&r<n;)e=e[toKey(t[r++])];return r&&r==n?e:void 0}function baseIsNative(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)||isHostObject(e)?reIsNative:reIsHostCtor).test(toSource(e))}function baseToString(e){if("string"==typeof e)return e;if(isSymbol(e))return symbolToString?symbolToString.call(e):"";var t=e+"";return"0"==t&&1/e==-INFINITY?"-0":t}function castPath(e){return isArray(e)?e:stringToPath(e)}function getMapData(e,t){var r=e.__data__;return isKeyable(t)?r["string"==typeof t?"string":"hash"]:r.map}function getNative(e,t){var r=getValue(e,t);return baseIsNative(r)?r:void 0}function isKey(e,t){if(isArray(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol(e))||(reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}function isKeyable(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet,ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet,MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet;var stringToPath=memoize(function(e){e=toString(e);var t=[];return reLeadingDot.test(e)&&t.push(""),e.replace(rePropName,function(e,r,n,o){t.push(n?o.replace(reEscapeChar,"$1"):r||e)}),t});function toKey(e){if("string"==typeof e||isSymbol(e))return e;var t=e+"";return"0"==t&&1/e==-INFINITY?"-0":t}function toSource(e){if(null!=e){try{return funcToString.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function memoize(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(FUNC_ERROR_TEXT);var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=e.apply(this,n);return r.cache=a.set(o,i),i};return r.cache=new(memoize.Cache||MapCache),r}function eq(e,t){return e===t||e!=e&&t!=t}memoize.Cache=MapCache;var isArray=Array.isArray;function isFunction(e){var t=isObject(e)?objectToString.call(e):"";return t==funcTag||t==genTag}function isObject(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function isObjectLike(e){return!!e&&"object"==typeof e}function isSymbol(e){return"symbol"==typeof e||isObjectLike(e)&&objectToString.call(e)==symbolTag}function toString(e){return null==e?"":baseToString(e)}function get(e,t,r){var n=null==e?void 0:baseGet(e,t);return void 0===n?r:n}var lodash_get=get;const debug=logger$1.extend("i18n"),DEFAULT_LOCALE="en",LOCALE_CHANGED="bearer-locale-changed";class I18n{constructor(){this._locale=DEFAULT_LOCALE,this._dictionnary={[DEFAULT_LOCALE]:{}},this.load=((e,t,{locale:r=this.locale}={})=>__awaiter(this,void 0,void 0,function*(){const n=yield t,o=e?{[e]:n}:n;this._dictionnary[r]=lodash_merge(lodash_get(this._dictionnary,r),o),this.localeChanged()})),this.get=((e,t,r={})=>{const n=[r.locale||this.locale,e,t].filter(e=>e).join(".");return debug("lookup key",n),lodash_get(this._dictionnary,n)})}localeChanged(){document.dispatchEvent(new CustomEvent(LOCALE_CHANGED,{detail:{locale:this.locale}}))}set locale(e){this._locale=e,this.localeChanged()}get locale(){return this._locale}}const i18n=new I18n,bearer=e=>new Bearer(e);bearer.version="0.97.3",bearer.i18n=i18n;export default bearer; | ||
function __awaiter(e,t,r,n){return new(r||(r=Promise))(function(o,a){function i(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(i,s)}c((n=n.apply(e,t||[])).next())})}function debounce(e,t,r){var n,o,a,i,s;function c(){var u=Date.now()-i;u<t&&u>=0?n=setTimeout(c,t-u):(n=null,r||(s=e.apply(a,o),a=o=null))}null==t&&(t=100);var u=function(){a=this,o=arguments,i=Date.now();var u=r&&!n;return n||(n=setTimeout(c,t)),u&&(s=e.apply(a,o),a=o=null),s};return u.clear=function(){n&&(clearTimeout(n),n=null)},u.flush=function(){n&&(s=e.apply(a,o),a=o=null,clearTimeout(n),n=null)},u}debounce.debounce=debounce;var debounce_1=debounce,commonjsGlobal="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function unwrapExports(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var logger_browser=createCommonjsModule(function(e,t){!function(e){var t=1e3,r=6e4,n=36e5,o=24*n,a=function(e,a){a=a||{};var s=typeof e;if("string"===s&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var a=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(a){var i=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*i;case"weeks":case"week":case"w":return 6048e5*i;case"days":case"day":case"d":return i*o;case"hours":case"hour":case"hrs":case"hr":case"h":return i*n;case"minutes":case"minute":case"mins":case"min":case"m":return i*r;case"seconds":case"second":case"secs":case"sec":case"s":return i*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return i;default:return}}}}(e);if("number"===s&&!1===isNaN(e))return a.long?function(e){var a=Math.abs(e);return a>=o?i(e,a,o,"day"):a>=n?i(e,a,n,"hour"):a>=r?i(e,a,r,"minute"):a>=t?i(e,a,t,"second"):e+" ms"}(e):function(e){var a=Math.abs(e);return a>=o?Math.round(e/o)+"d":a>=n?Math.round(e/n)+"h":a>=r?Math.round(e/r)+"m":a>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function i(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}var s,c=(function(e,t){t.log=function(...e){return"object"==typeof console&&console.log&&console.log(...e)},t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))}),t.splice(o,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=function(e){function t(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return r.colors[Math.abs(t)%r.colors.length]}function r(e){let a;function i(...e){if(!i.enabled)return;const t=i,n=Number(new Date),o=n-(a||n);t.diff=o,t.prev=a,t.curr=n,a=n,e[0]=r.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(n,o)=>{if("%%"===n)return n;s++;const a=r.formatters[o];if("function"==typeof a){const r=e[s];n=a.call(t,r),e.splice(s,1),s--}return n}),r.formatArgs.call(t,e),(t.log||r.log).apply(t,e)}return i.namespace=e,i.enabled=r.enabled(e),i.useColors=r.useColors(),i.color=t(e),i.destroy=n,i.extend=o,"function"==typeof r.init&&r.init(i),r.instances.push(i),i}function n(){const e=r.instances.indexOf(this);return-1!==e&&(r.instances.splice(e,1),!0)}function o(e,t){const n=r(this.namespace+(void 0===t?":":t)+e);return n.log=this.log,n}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return r.debug=r,r.default=r,r.coerce=function(e){return e instanceof Error?e.stack||e.message:e},r.disable=function(){const e=[...r.names.map(i),...r.skips.map(i).map(e=>"-"+e)].join(",");return r.enable(""),e},r.enable=function(e){let t;r.save(e),r.names=[],r.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(t=0;t<o;t++)n[t]&&("-"===(e=n[t].replace(/\*/g,".*?"))[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")));for(t=0;t<r.instances.length;t++){const e=r.instances[t];e.enabled=r.enabled(e.namespace)}},r.enabled=function(e){if("*"===e[e.length-1])return!0;let t,n;for(t=0,n=r.skips.length;t<n;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;t<n;t++)if(r.names[t].test(e))return!0;return!1},r.humanize=a,Object.keys(e).forEach(t=>{r[t]=e[t]}),r.instances=[],r.names=[],r.skips=[],r.formatters={},r.selectColor=t,r.enable(r.load()),r}(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(s={exports:{}},s.exports),s.exports);c.log,c.formatArgs,c.save,c.load,c.useColors,c.storage,c.colors,e.default=(e=>c(`bearer:${e}`)),e.BearerIntentLogger=class{constructor(e){this.log=(e=>{c("bearer:intents")("%j",{data:e,scenarioId:this.context.integrationUuid,intentName:this.context.intentName})}),this.context=e}},Object.defineProperty(e,"__esModule",{value:!0})}(t)}),logger=unwrapExports(logger_browser),logger$1=logger("js");const logger$2=logger$1.extend("Bearer"),prefix="bearer",DEFAULT_OPTIONS={integrationHost:"https://int.bearer.sh",domObserver:!0,refreshDebounceDelay:200};class Bearer{constructor(e,t){this.clientId=e,this.config=DEFAULT_OPTIONS,this.registeredIntegrations={},this.loadMissingIntegrations=(()=>{const e=findElements(document.getElementsByTagName("*")),t=e.filter(e=>!this.registeredIntegration(e));logger$2(this.registeredIntegrations,e,t),this.sendTags(t)}),this.registeredIntegration=(e=>(this.registeredIntegrations[e]=this.registeredIntegrations[e]||document.createElement(e).constructor!==HTMLElement,this.registeredIntegrations[e])),this.initialIntegrationLoading=(()=>{"complete"===document.readyState||"interactive"===document.readyState?this.debounceRefresh():document.addEventListener("DOMContentLoaded",this.debounceRefresh)}),this.registerDomObserver=(()=>{if("MutationObserver"in window){this.disconnectObserver();const e=document.documentElement||document.body,t={childList:!0,subtree:!0};this.observer=new MutationObserver(this.observerCallback),this.observer.observe(e,t)}}),this.observerCallback=(e=>{for(const t of e)"childList"==t.type&&t.addedNodes.length&&this.debounceRefresh()}),this.disconnectObserver=(()=>{this.observer&&(this.observer.disconnect(),delete this.observer)}),this.sendTags=(e=>__awaiter(this,void 0,void 0,function*(){if(!e.length)return Promise.resolve(!0);try{const t=yield fetch(`${this.config.integrationHost}/v1/parse-tags`,{headers:{"content-type":"application/json"},body:JSON.stringify({tags:e,clientId:this.clientId}),method:"POST"});if(t.status>299)throw new Error(`Error while fetching integration tag names: ${e}`);return(yield t.json()).map(e=>{document.querySelector(`#${getScriptId(e.uuid)}`)||document.body.appendChild(getScriptDOM(this.clientId,e))}),!0}catch(e){return!1}})),this.config=Object.assign({},DEFAULT_OPTIONS,t),this.debounceRefresh=debounce_1(this.loadMissingIntegrations,this.config.refreshDebounceDelay),this.initialIntegrationLoading(),this.config.domObserver&&this.registerDomObserver()}}function findElements(e,t=/^bearer-/i){return Array.from(e).filter(e=>t.test(e.tagName)).map(e=>e.tagName.toLowerCase())}function getScriptId(e){return`${prefix}-${e}`}function getScriptDOM(e,t){const r=document.createElement("script");r.type="text/javascript",r.async=!0;const n=t.asset.indexOf("?")>-1?"&":"?";return r.src=[t.asset,[`clientId=${e}`].join("&")].join(n),r.id=getScriptId(t.uuid),r}var lodash_merge=createCommonjsModule(function(e,t){var r=200,n="__lodash_hash_undefined__",o=800,a=16,i=9007199254740991,s="[object Arguments]",c="[object AsyncFunction]",u="[object Function]",l="[object GeneratorFunction]",f="[object Null]",h="[object Object]",p="[object Proxy]",d="[object Undefined]",g=/^\[object .+?Constructor\]$/,y=/^(?:0|[1-9]\d*)$/,b={};b["[object Float32Array]"]=b["[object Float64Array]"]=b["[object Int8Array]"]=b["[object Int16Array]"]=b["[object Int32Array]"]=b["[object Uint8Array]"]=b["[object Uint8ClampedArray]"]=b["[object Uint16Array]"]=b["[object Uint32Array]"]=!0,b[s]=b["[object Array]"]=b["[object ArrayBuffer]"]=b["[object Boolean]"]=b["[object DataView]"]=b["[object Date]"]=b["[object Error]"]=b[u]=b["[object Map]"]=b["[object Number]"]=b[h]=b["[object RegExp]"]=b["[object Set]"]=b["[object String]"]=b["[object WeakMap]"]=!1;var v="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_="object"==typeof self&&self&&self.Object===Object&&self,C=v||_||Function("return this")(),m=t&&!t.nodeType&&t,j=m&&e&&!e.nodeType&&e,F=j&&j.exports===m,w=F&&v.process,O=function(){try{return w&&w.binding&&w.binding("util")}catch(e){}}(),S=O&&O.isTypedArray;function I(e,t){return"__proto__"==t?void 0:e[t]}var E,A,T,x=Array.prototype,D=Function.prototype,P=Object.prototype,M=C["__core-js_shared__"],N=D.toString,L=P.hasOwnProperty,$=(E=/[^.]+$/.exec(M&&M.keys&&M.keys.IE_PROTO||""))?"Symbol(src)_1."+E:"",k=P.toString,H=N.call(Object),z=RegExp("^"+N.call(L).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),G=F?C.Buffer:void 0,U=C.Symbol,R=C.Uint8Array,B=G?G.allocUnsafe:void 0,K=(A=Object.getPrototypeOf,T=Object,function(e){return A(T(e))}),J=Object.create,q=P.propertyIsEnumerable,V=x.splice,Y=U?U.toStringTag:void 0,W=function(){try{var e=me(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),X=G?G.isBuffer:void 0,Z=Math.max,Q=Date.now,ee=me(C,"Map"),te=me(Object,"create"),re=function(){function e(){}return function(t){if(!De(t))return{};if(J)return J(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function ne(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function oe(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ae(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ie(e){var t=this.__data__=new oe(e);this.size=t.size}function se(e,t){var r=Ie(e),n=!r&&Se(e),o=!r&&!n&&Ae(e),a=!r&&!n&&!o&&Me(e),i=r||n||o||a,s=i?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=s.length;for(var u in e)!t&&!L.call(e,u)||i&&("length"==u||o&&("offset"==u||"parent"==u)||a&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||je(u,c))||s.push(u);return s}function ce(e,t,r){(void 0===r||Oe(e[t],r))&&(void 0!==r||t in e)||fe(e,t,r)}function ue(e,t,r){var n=e[t];L.call(e,t)&&Oe(n,r)&&(void 0!==r||t in e)||fe(e,t,r)}function le(e,t){for(var r=e.length;r--;)if(Oe(e[r][0],t))return r;return-1}function fe(e,t,r){"__proto__"==t&&W?W(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}ne.prototype.clear=function(){this.__data__=te?te(null):{},this.size=0},ne.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ne.prototype.get=function(e){var t=this.__data__;if(te){var r=t[e];return r===n?void 0:r}return L.call(t,e)?t[e]:void 0},ne.prototype.has=function(e){var t=this.__data__;return te?void 0!==t[e]:L.call(t,e)},ne.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=te&&void 0===t?n:t,this},oe.prototype.clear=function(){this.__data__=[],this.size=0},oe.prototype.delete=function(e){var t=this.__data__,r=le(t,e);return!(r<0||(r==t.length-1?t.pop():V.call(t,r,1),--this.size,0))},oe.prototype.get=function(e){var t=this.__data__,r=le(t,e);return r<0?void 0:t[r][1]},oe.prototype.has=function(e){return le(this.__data__,e)>-1},oe.prototype.set=function(e,t){var r=this.__data__,n=le(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},ae.prototype.clear=function(){this.size=0,this.__data__={hash:new ne,map:new(ee||oe),string:new ne}},ae.prototype.delete=function(e){var t=Ce(this,e).delete(e);return this.size-=t?1:0,t},ae.prototype.get=function(e){return Ce(this,e).get(e)},ae.prototype.has=function(e){return Ce(this,e).has(e)},ae.prototype.set=function(e,t){var r=Ce(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},ie.prototype.clear=function(){this.__data__=new oe,this.size=0},ie.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},ie.prototype.get=function(e){return this.__data__.get(e)},ie.prototype.has=function(e){return this.__data__.has(e)},ie.prototype.set=function(e,t){var n=this.__data__;if(n instanceof oe){var o=n.__data__;if(!ee||o.length<r-1)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new ae(o)}return n.set(e,t),this.size=n.size,this};var he,pe=function(e,t,r){for(var n=-1,o=Object(e),a=r(e),i=a.length;i--;){var s=a[he?i:++n];if(!1===t(o[s],s,o))break}return e};function de(e){return null==e?void 0===e?d:f:Y&&Y in Object(e)?function(e){var t=L.call(e,Y),r=e[Y];try{e[Y]=void 0;var n=!0}catch(e){}var o=k.call(e);n&&(t?e[Y]=r:delete e[Y]);return o}(e):function(e){return k.call(e)}(e)}function ge(e){return Pe(e)&&de(e)==s}function ye(e){return!(!De(e)||(t=e,$&&$ in t))&&(Te(e)?z:g).test(function(e){if(null!=e){try{return N.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function be(e){if(!De(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=Fe(e),r=[];for(var n in e)("constructor"!=n||!t&&L.call(e,n))&&r.push(n);return r}function ve(e,t,r,n,o){e!==t&&pe(t,function(a,i){if(De(a))o||(o=new ie),function(e,t,r,n,o,a,i){var s=I(e,r),c=I(t,r),u=i.get(c);if(u)return void ce(e,r,u);var l=a?a(s,c,r+"",e,t,i):void 0,f=void 0===l;if(f){var p=Ie(c),d=!p&&Ae(c),g=!p&&!d&&Me(c);l=c,p||d||g?Ie(s)?l=s:Pe(C=s)&&Ee(C)?l=function(e,t){var r=-1,n=e.length;t||(t=Array(n));for(;++r<n;)t[r]=e[r];return t}(s):d?(f=!1,l=function(e,t){if(t)return e.slice();var r=e.length,n=B?B(r):new e.constructor(r);return e.copy(n),n}(c,!0)):g?(f=!1,y=c,b=!0?(v=y.buffer,_=new v.constructor(v.byteLength),new R(_).set(new R(v)),_):y.buffer,l=new y.constructor(b,y.byteOffset,y.length)):l=[]:function(e){if(!Pe(e)||de(e)!=h)return!1;var t=K(e);if(null===t)return!0;var r=L.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&N.call(r)==H}(c)||Se(c)?(l=s,Se(s)?l=function(e){return function(e,t,r,n){var o=!r;r||(r={});var a=-1,i=t.length;for(;++a<i;){var s=t[a],c=n?n(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),o?fe(r,s,c):ue(r,s,c)}return r}(e,Ne(e))}(s):(!De(s)||n&&Te(s))&&(l=function(e){return"function"!=typeof e.constructor||Fe(e)?{}:re(K(e))}(c))):f=!1}var y,b,v,_;var C;f&&(i.set(c,l),o(l,c,n,a,i),i.delete(c));ce(e,r,l)}(e,t,i,r,ve,n,o);else{var s=n?n(I(e,i),a,i+"",e,t,o):void 0;void 0===s&&(s=a),ce(e,i,s)}},Ne)}function _e(e,t){return we(function(e,t,r){return t=Z(void 0===t?e.length-1:t,0),function(){for(var n=arguments,o=-1,a=Z(n.length-t,0),i=Array(a);++o<a;)i[o]=n[t+o];o=-1;for(var s=Array(t+1);++o<t;)s[o]=n[o];return s[t]=r(i),function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}(e,this,s)}}(e,t,ke),e+"")}function Ce(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function me(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return ye(r)?r:void 0}function je(e,t){var r=typeof e;return!!(t=null==t?i:t)&&("number"==r||"symbol"!=r&&y.test(e))&&e>-1&&e%1==0&&e<t}function Fe(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||P)}var we=function(e){var t=0,r=0;return function(){var n=Q(),i=a-(n-r);if(r=n,i>0){if(++t>=o)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(W?function(e,t){return W(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:ke);function Oe(e,t){return e===t||e!=e&&t!=t}var Se=ge(function(){return arguments}())?ge:function(e){return Pe(e)&&L.call(e,"callee")&&!q.call(e,"callee")},Ie=Array.isArray;function Ee(e){return null!=e&&xe(e.length)&&!Te(e)}var Ae=X||function(){return!1};function Te(e){if(!De(e))return!1;var t=de(e);return t==u||t==l||t==c||t==p}function xe(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=i}function De(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Pe(e){return null!=e&&"object"==typeof e}var Me=S?function(e){return function(t){return e(t)}}(S):function(e){return Pe(e)&&xe(e.length)&&!!b[de(e)]};function Ne(e){return Ee(e)?se(e,!0):be(e)}var Le,$e=(Le=function(e,t,r){ve(e,t,r)},_e(function(e,t){var r=-1,n=t.length,o=n>1?t[n-1]:void 0,a=n>2?t[2]:void 0;for(o=Le.length>3&&"function"==typeof o?(n--,o):void 0,a&&function(e,t,r){if(!De(r))return!1;var n=typeof t;return!!("number"==n?Ee(r)&&je(t,r.length):"string"==n&&t in r)&&Oe(r[t],e)}(t[0],t[1],a)&&(o=n<3?void 0:o,n=1),e=Object(e);++r<n;){var i=t[r];i&&Le(e,i,r,o)}return e}));function ke(e){return e}e.exports=$e}),FUNC_ERROR_TEXT="Expected a function",HASH_UNDEFINED="__lodash_hash_undefined__",INFINITY=1/0,funcTag="[object Function]",genTag="[object GeneratorFunction]",symbolTag="[object Symbol]",reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/,reLeadingDot=/^\./,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reEscapeChar=/\\(\\)?/g,reIsHostCtor=/^\[object .+?Constructor\]$/,freeGlobal="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")();function getValue(e,t){return null==e?void 0:e[t]}function isHostObject(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}var arrayProto=Array.prototype,funcProto=Function.prototype,objectProto=Object.prototype,coreJsData=root["__core-js_shared__"],maskSrcKey=function(){var e=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),funcToString=funcProto.toString,hasOwnProperty=objectProto.hasOwnProperty,objectToString=objectProto.toString,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Symbol$1=root.Symbol,splice=arrayProto.splice,Map=getNative(root,"Map"),nativeCreate=getNative(Object,"create"),symbolProto=Symbol$1?Symbol$1.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;function Hash(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{}}function hashDelete(e){return this.has(e)&&delete this.__data__[e]}function hashGet(e){var t=this.__data__;if(nativeCreate){var r=t[e];return r===HASH_UNDEFINED?void 0:r}return hasOwnProperty.call(t,e)?t[e]:void 0}function hashHas(e){var t=this.__data__;return nativeCreate?void 0!==t[e]:hasOwnProperty.call(t,e)}function hashSet(e,t){return this.__data__[e]=nativeCreate&&void 0===t?HASH_UNDEFINED:t,this}function ListCache(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function listCacheClear(){this.__data__=[]}function listCacheDelete(e){var t=this.__data__,r=assocIndexOf(t,e);return!(r<0)&&(r==t.length-1?t.pop():splice.call(t,r,1),!0)}function listCacheGet(e){var t=this.__data__,r=assocIndexOf(t,e);return r<0?void 0:t[r][1]}function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1}function listCacheSet(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function MapCache(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function mapCacheClear(){this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}function mapCacheDelete(e){return getMapData(this,e).delete(e)}function mapCacheGet(e){return getMapData(this,e).get(e)}function mapCacheHas(e){return getMapData(this,e).has(e)}function mapCacheSet(e,t){return getMapData(this,e).set(e,t),this}function assocIndexOf(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}function baseGet(e,t){for(var r=0,n=(t=isKey(t,e)?[t]:castPath(t)).length;null!=e&&r<n;)e=e[toKey(t[r++])];return r&&r==n?e:void 0}function baseIsNative(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)||isHostObject(e)?reIsNative:reIsHostCtor).test(toSource(e))}function baseToString(e){if("string"==typeof e)return e;if(isSymbol(e))return symbolToString?symbolToString.call(e):"";var t=e+"";return"0"==t&&1/e==-INFINITY?"-0":t}function castPath(e){return isArray(e)?e:stringToPath(e)}function getMapData(e,t){var r=e.__data__;return isKeyable(t)?r["string"==typeof t?"string":"hash"]:r.map}function getNative(e,t){var r=getValue(e,t);return baseIsNative(r)?r:void 0}function isKey(e,t){if(isArray(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol(e))||(reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}function isKeyable(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet,ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet,MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet;var stringToPath=memoize(function(e){e=toString(e);var t=[];return reLeadingDot.test(e)&&t.push(""),e.replace(rePropName,function(e,r,n,o){t.push(n?o.replace(reEscapeChar,"$1"):r||e)}),t});function toKey(e){if("string"==typeof e||isSymbol(e))return e;var t=e+"";return"0"==t&&1/e==-INFINITY?"-0":t}function toSource(e){if(null!=e){try{return funcToString.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function memoize(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(FUNC_ERROR_TEXT);var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=e.apply(this,n);return r.cache=a.set(o,i),i};return r.cache=new(memoize.Cache||MapCache),r}function eq(e,t){return e===t||e!=e&&t!=t}memoize.Cache=MapCache;var isArray=Array.isArray;function isFunction(e){var t=isObject(e)?objectToString.call(e):"";return t==funcTag||t==genTag}function isObject(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function isObjectLike(e){return!!e&&"object"==typeof e}function isSymbol(e){return"symbol"==typeof e||isObjectLike(e)&&objectToString.call(e)==symbolTag}function toString(e){return null==e?"":baseToString(e)}function get(e,t,r){var n=null==e?void 0:baseGet(e,t);return void 0===n?r:n}var lodash_get=get;const debug=logger$1.extend("i18n"),DEFAULT_LOCALE="en",LOCALE_CHANGED="bearer-locale-changed";class I18n{constructor(){this._locale=DEFAULT_LOCALE,this._dictionnary={[DEFAULT_LOCALE]:{}},this.load=((e,t,{locale:r=this.locale}={})=>__awaiter(this,void 0,void 0,function*(){const n=yield t,o=e?{[e]:n}:n;this._dictionnary[r]=lodash_merge(lodash_get(this._dictionnary,r),o),this.localeChanged()})),this.get=((e,t,r={})=>{const n=[r.locale||this.locale,e,t].filter(e=>e).join(".");return debug("lookup key",n),lodash_get(this._dictionnary,n)})}localeChanged(){document.dispatchEvent(new CustomEvent(LOCALE_CHANGED,{detail:{locale:this.locale}}))}set locale(e){this._locale=e,this.localeChanged()}get locale(){return this._locale}}const i18n=new I18n,bearer=(e,t)=>new Bearer(e,t);bearer.version="0.98.0",bearer.i18n=i18n;export default bearer; | ||
//# sourceMappingURL=index.js.map |
export default class Bearer { | ||
readonly clientId: string; | ||
config: TBearerOptions; | ||
private registeredIntegrations; | ||
private config; | ||
private observer?; | ||
@@ -34,4 +34,5 @@ private debounceRefresh; | ||
} | ||
declare type TBearerOptions = { | ||
export declare type TBearerOptions = { | ||
domObserver: boolean; | ||
integrationHost: string; | ||
refreshDebounceDelay: number; | ||
@@ -45,2 +46,1 @@ }; | ||
export declare function findElements(elements: HTMLCollection | NodeListOf<Element>, filter?: RegExp): string[]; | ||
export {}; |
@@ -1,4 +0,4 @@ | ||
import Bearer from './bearer'; | ||
import Bearer, { TBearerOptions } from './bearer'; | ||
declare const bearer: { | ||
(token: string): Bearer; | ||
(token: string, options?: Partial<TBearerOptions> | undefined): Bearer; | ||
version: string; | ||
@@ -5,0 +5,0 @@ i18n: import("./i18n").I18n; |
export default class Bearer { | ||
readonly clientId: string; | ||
config: TBearerOptions; | ||
private registeredIntegrations; | ||
private config; | ||
private observer?; | ||
@@ -34,4 +34,5 @@ private debounceRefresh; | ||
} | ||
declare type TBearerOptions = { | ||
export declare type TBearerOptions = { | ||
domObserver: boolean; | ||
integrationHost: string; | ||
refreshDebounceDelay: number; | ||
@@ -45,2 +46,1 @@ }; | ||
export declare function findElements(elements: HTMLCollection | NodeListOf<Element>, filter?: RegExp): string[]; | ||
export {}; |
@@ -1,4 +0,4 @@ | ||
import Bearer from './bearer'; | ||
import Bearer, { TBearerOptions } from './bearer'; | ||
declare const bearer: { | ||
(token: string): Bearer; | ||
(token: string, options?: Partial<TBearerOptions> | undefined): Bearer; | ||
version: string; | ||
@@ -5,0 +5,0 @@ i18n: import("./i18n").I18n; |
{ | ||
"name": "@bearer/js", | ||
"version": "0.97.3", | ||
"version": "0.98.0", | ||
"description": "A JavaScript library for working with Bearer integrations", | ||
@@ -17,3 +17,3 @@ "jsdelivr": "lib/bearer.production.min.js", | ||
"dependencies": { | ||
"@bearer/logger": "^0.97.3", | ||
"@bearer/logger": "^0.98.0", | ||
"debounce": "^1.2.0", | ||
@@ -23,3 +23,3 @@ "jest-fetch-mock": "^2.1.1" | ||
"devDependencies": { | ||
"@bearer/tsconfig": "^0.97.3", | ||
"@bearer/tsconfig": "^0.98.0", | ||
"@types/debounce": "^1.2.0", | ||
@@ -46,3 +46,3 @@ "@types/jest": "^23.3.13", | ||
}, | ||
"gitHead": "1c20a20cd14fb9f36e578c5ae0a8b519a3932401" | ||
"gitHead": "0d56d0700898e746c34f8414aec55f325df97183" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
470431
525
+ Added@bearer/logger@0.98.0(transitive)
- Removed@bearer/logger@0.97.3(transitive)
Updated@bearer/logger@^0.98.0