@candulabs/core
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.5.2](https://github.com/candulabs/candu-sdk/tree/master/packages/candu-core/compare/v0.5.1...v0.5.2) (2020-10-09) | ||
**Note:** Version bump only for package @candulabs/core | ||
## [0.5.1](https://github.com/candulabs/candu-sdk/tree/master/packages/candu-core/compare/v0.5.0...v0.5.1) (2020-10-09) | ||
@@ -8,0 +16,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var util=require("util"),e=_interopDefault(require("crypto")),commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var freeGlobal="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_freeGlobal=freeGlobal,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=_freeGlobal||freeSelf||Function("return this")(),_root=root,Symbol=_root.Symbol,_Symbol=Symbol,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,nativeObjectToString=objectProto.toString,symToStringTag=_Symbol?_Symbol.toStringTag:void 0;function getRawTag(e){var t=hasOwnProperty.call(e,symToStringTag),r=e[symToStringTag];try{e[symToStringTag]=void 0;var a=!0}catch(e){}var o=nativeObjectToString.call(e);return a&&(t?e[symToStringTag]=r:delete e[symToStringTag]),o}var _getRawTag=getRawTag,objectProto$1=Object.prototype,nativeObjectToString$1=objectProto$1.toString;function objectToString(e){return nativeObjectToString$1.call(e)}var _objectToString=objectToString,nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag$1=_Symbol?_Symbol.toStringTag:void 0;function baseGetTag(e){return null==e?void 0===e?undefinedTag:nullTag:symToStringTag$1&&symToStringTag$1 in Object(e)?_getRawTag(e):_objectToString(e)}var _baseGetTag=baseGetTag;function isObject(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var isObject_1=isObject,asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction(e){if(!isObject_1(e))return!1;var t=_baseGetTag(e);return t==funcTag||t==genTag||t==asyncTag||t==proxyTag}var isFunction_1=isFunction,coreJsData=_root["__core-js_shared__"],_coreJsData=coreJsData,maskSrcKey=function(){var e=/[^.]+$/.exec(_coreJsData&&_coreJsData.keys&&_coreJsData.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}var _isMasked=isMasked,funcProto=Function.prototype,funcToString=funcProto.toString;function toSource(e){if(null!=e){try{return funcToString.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var _toSource=toSource,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto$1=Function.prototype,objectProto$2=Object.prototype,funcToString$1=funcProto$1.toString,hasOwnProperty$1=objectProto$2.hasOwnProperty,reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$1).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(e){return!(!isObject_1(e)||_isMasked(e))&&(isFunction_1(e)?reIsNative:reIsHostCtor).test(_toSource(e))}var _baseIsNative=baseIsNative;function getValue(e,t){return null==e?void 0:e[t]}var _getValue=getValue;function getNative(e,t){var r=_getValue(e,t);return _baseIsNative(r)?r:void 0}var _getNative=getNative,defineProperty=function(){try{var e=_getNative(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),_defineProperty=defineProperty;function baseAssignValue(e,t,r){"__proto__"==t&&_defineProperty?_defineProperty(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var _baseAssignValue=baseAssignValue;function createBaseFor(e){return function(t,r,a){for(var o=-1,n=Object(t),i=a(t),s=i.length;s--;){var c=i[e?s:++o];if(!1===r(n[c],c,n))break}return t}}var _createBaseFor=createBaseFor,baseFor=_createBaseFor(),_baseFor=baseFor;function baseTimes(e,t){for(var r=-1,a=Array(e);++r<e;)a[r]=t(r);return a}var _baseTimes=baseTimes;function isObjectLike(e){return null!=e&&"object"==typeof e}var isObjectLike_1=isObjectLike,argsTag="[object Arguments]";function baseIsArguments(e){return isObjectLike_1(e)&&_baseGetTag(e)==argsTag}var _baseIsArguments=baseIsArguments,objectProto$3=Object.prototype,hasOwnProperty$2=objectProto$3.hasOwnProperty,propertyIsEnumerable=objectProto$3.propertyIsEnumerable,isArguments=_baseIsArguments(function(){return arguments}())?_baseIsArguments:function(e){return isObjectLike_1(e)&&hasOwnProperty$2.call(e,"callee")&&!propertyIsEnumerable.call(e,"callee")},isArguments_1=isArguments,isArray=Array.isArray,isArray_1=isArray;function stubFalse(){return!1}var stubFalse_1=stubFalse,isBuffer_1=createCommonjsModule((function(e,t){var r=t&&!t.nodeType&&t,a=r&&e&&!e.nodeType&&e,o=a&&a.exports===r?_root.Buffer:void 0,n=(o?o.isBuffer:void 0)||stubFalse_1;e.exports=n})),MAX_SAFE_INTEGER=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex(e,t){var r=typeof e;return!!(t=null==t?MAX_SAFE_INTEGER:t)&&("number"==r||"symbol"!=r&&reIsUint.test(e))&&e>-1&&e%1==0&&e<t}var _isIndex=isIndex,MAX_SAFE_INTEGER$1=9007199254740991;function isLength(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=MAX_SAFE_INTEGER$1}var isLength_1=isLength,argsTag$1="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag$1="[object Function]",mapTag="[object Map]",numberTag="[object Number]",objectTag="[object Object]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",weakMapTag="[object WeakMap]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",typedArrayTags={};function baseIsTypedArray(e){return isObjectLike_1(e)&&isLength_1(e.length)&&!!typedArrayTags[_baseGetTag(e)]}typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=!0,typedArrayTags[argsTag$1]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag$1]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=!1;var _baseIsTypedArray=baseIsTypedArray;function baseUnary(e){return function(t){return e(t)}}var _baseUnary=baseUnary,_nodeUtil=createCommonjsModule((function(e,t){var r=t&&!t.nodeType&&t,a=r&&e&&!e.nodeType&&e,o=a&&a.exports===r&&_freeGlobal.process,n=function(){try{var e=a&&a.require&&a.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=n})),nodeIsTypedArray=_nodeUtil&&_nodeUtil.isTypedArray,isTypedArray=nodeIsTypedArray?_baseUnary(nodeIsTypedArray):_baseIsTypedArray,isTypedArray_1=isTypedArray,objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty;function arrayLikeKeys(e,t){var r=isArray_1(e),a=!r&&isArguments_1(e),o=!r&&!a&&isBuffer_1(e),n=!r&&!a&&!o&&isTypedArray_1(e),i=r||a||o||n,s=i?_baseTimes(e.length,String):[],c=s.length;for(var _ in e)!t&&!hasOwnProperty$3.call(e,_)||i&&("length"==_||o&&("offset"==_||"parent"==_)||n&&("buffer"==_||"byteLength"==_||"byteOffset"==_)||_isIndex(_,c))||s.push(_);return s}var _arrayLikeKeys=arrayLikeKeys,objectProto$5=Object.prototype;function isPrototype(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||objectProto$5)}var _isPrototype=isPrototype;function overArg(e,t){return function(r){return e(t(r))}}var _overArg=overArg,nativeKeys=_overArg(Object.keys,Object),_nativeKeys=nativeKeys,objectProto$6=Object.prototype,hasOwnProperty$4=objectProto$6.hasOwnProperty;function baseKeys(e){if(!_isPrototype(e))return _nativeKeys(e);var t=[];for(var r in Object(e))hasOwnProperty$4.call(e,r)&&"constructor"!=r&&t.push(r);return t}var _baseKeys=baseKeys;function isArrayLike(e){return null!=e&&isLength_1(e.length)&&!isFunction_1(e)}var isArrayLike_1=isArrayLike;function keys(e){return isArrayLike_1(e)?_arrayLikeKeys(e):_baseKeys(e)}var keys_1=keys;function baseForOwn(e,t){return e&&_baseFor(e,t,keys_1)}var _baseForOwn=baseForOwn;function listCacheClear(){this.__data__=[],this.size=0}var _listCacheClear=listCacheClear;function eq(e,t){return e===t||e!=e&&t!=t}var eq_1=eq;function assocIndexOf(e,t){for(var r=e.length;r--;)if(eq_1(e[r][0],t))return r;return-1}var _assocIndexOf=assocIndexOf,arrayProto=Array.prototype,splice=arrayProto.splice;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),--this.size,!0)}var _listCacheDelete=listCacheDelete;function listCacheGet(e){var t=this.__data__,r=_assocIndexOf(t,e);return r<0?void 0:t[r][1]}var _listCacheGet=listCacheGet;function listCacheHas(e){return _assocIndexOf(this.__data__,e)>-1}var _listCacheHas=listCacheHas;function listCacheSet(e,t){var r=this.__data__,a=_assocIndexOf(r,e);return a<0?(++this.size,r.push([e,t])):r[a][1]=t,this}var _listCacheSet=listCacheSet;function ListCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var a=e[t];this.set(a[0],a[1])}}ListCache.prototype.clear=_listCacheClear,ListCache.prototype.delete=_listCacheDelete,ListCache.prototype.get=_listCacheGet,ListCache.prototype.has=_listCacheHas,ListCache.prototype.set=_listCacheSet;var _ListCache=ListCache;function stackClear(){this.__data__=new _ListCache,this.size=0}var _stackClear=stackClear;function stackDelete(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var _stackDelete=stackDelete;function stackGet(e){return this.__data__.get(e)}var _stackGet=stackGet;function stackHas(e){return this.__data__.has(e)}var _stackHas=stackHas,Map=_getNative(_root,"Map"),_Map=Map,nativeCreate=_getNative(Object,"create"),_nativeCreate=nativeCreate;function hashClear(){this.__data__=_nativeCreate?_nativeCreate(null):{},this.size=0}var _hashClear=hashClear;function hashDelete(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var _hashDelete=hashDelete,HASH_UNDEFINED="__lodash_hash_undefined__",objectProto$7=Object.prototype,hasOwnProperty$5=objectProto$7.hasOwnProperty;function hashGet(e){var t=this.__data__;if(_nativeCreate){var r=t[e];return r===HASH_UNDEFINED?void 0:r}return hasOwnProperty$5.call(t,e)?t[e]:void 0}var _hashGet=hashGet,objectProto$8=Object.prototype,hasOwnProperty$6=objectProto$8.hasOwnProperty;function hashHas(e){var t=this.__data__;return _nativeCreate?void 0!==t[e]:hasOwnProperty$6.call(t,e)}var _hashHas=hashHas,HASH_UNDEFINED$1="__lodash_hash_undefined__";function hashSet(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=_nativeCreate&&void 0===t?HASH_UNDEFINED$1:t,this}var _hashSet=hashSet;function Hash(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var a=e[t];this.set(a[0],a[1])}}Hash.prototype.clear=_hashClear,Hash.prototype.delete=_hashDelete,Hash.prototype.get=_hashGet,Hash.prototype.has=_hashHas,Hash.prototype.set=_hashSet;var _Hash=Hash;function mapCacheClear(){this.size=0,this.__data__={hash:new _Hash,map:new(_Map||_ListCache),string:new _Hash}}var _mapCacheClear=mapCacheClear;function isKeyable(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}var _isKeyable=isKeyable;function getMapData(e,t){var r=e.__data__;return _isKeyable(t)?r["string"==typeof t?"string":"hash"]:r.map}var _getMapData=getMapData;function mapCacheDelete(e){var t=_getMapData(this,e).delete(e);return this.size-=t?1:0,t}var _mapCacheDelete=mapCacheDelete;function mapCacheGet(e){return _getMapData(this,e).get(e)}var _mapCacheGet=mapCacheGet;function mapCacheHas(e){return _getMapData(this,e).has(e)}var _mapCacheHas=mapCacheHas;function mapCacheSet(e,t){var r=_getMapData(this,e),a=r.size;return r.set(e,t),this.size+=r.size==a?0:1,this}var _mapCacheSet=mapCacheSet;function MapCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var a=e[t];this.set(a[0],a[1])}}MapCache.prototype.clear=_mapCacheClear,MapCache.prototype.delete=_mapCacheDelete,MapCache.prototype.get=_mapCacheGet,MapCache.prototype.has=_mapCacheHas,MapCache.prototype.set=_mapCacheSet;var _MapCache=MapCache,LARGE_ARRAY_SIZE=200;function stackSet(e,t){var r=this.__data__;if(r instanceof _ListCache){var a=r.__data__;if(!_Map||a.length<LARGE_ARRAY_SIZE-1)return a.push([e,t]),this.size=++r.size,this;r=this.__data__=new _MapCache(a)}return r.set(e,t),this.size=r.size,this}var _stackSet=stackSet;function Stack(e){var t=this.__data__=new _ListCache(e);this.size=t.size}Stack.prototype.clear=_stackClear,Stack.prototype.delete=_stackDelete,Stack.prototype.get=_stackGet,Stack.prototype.has=_stackHas,Stack.prototype.set=_stackSet;var _Stack=Stack,HASH_UNDEFINED$2="__lodash_hash_undefined__";function setCacheAdd(e){return this.__data__.set(e,HASH_UNDEFINED$2),this}var _setCacheAdd=setCacheAdd;function setCacheHas(e){return this.__data__.has(e)}var _setCacheHas=setCacheHas;function SetCache(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new _MapCache;++t<r;)this.add(e[t])}SetCache.prototype.add=SetCache.prototype.push=_setCacheAdd,SetCache.prototype.has=_setCacheHas;var _SetCache=SetCache;function arraySome(e,t){for(var r=-1,a=null==e?0:e.length;++r<a;)if(t(e[r],r,e))return!0;return!1}var _arraySome=arraySome;function cacheHas(e,t){return e.has(t)}var _cacheHas=cacheHas,COMPARE_PARTIAL_FLAG=1,COMPARE_UNORDERED_FLAG=2;function equalArrays(e,t,r,a,o,n){var i=r&COMPARE_PARTIAL_FLAG,s=e.length,c=t.length;if(s!=c&&!(i&&c>s))return!1;var _=n.get(e);if(_&&n.get(t))return _==t;var u=-1,l=!0,p=r&COMPARE_UNORDERED_FLAG?new _SetCache:void 0;for(n.set(e,t),n.set(t,e);++u<s;){var g=e[u],d=t[u];if(a)var y=i?a(d,g,u,t,e,n):a(g,d,u,e,t,n);if(void 0!==y){if(y)continue;l=!1;break}if(p){if(!_arraySome(t,(function(e,t){if(!_cacheHas(p,t)&&(g===e||o(g,e,r,a,n)))return p.push(t)}))){l=!1;break}}else if(g!==d&&!o(g,d,r,a,n)){l=!1;break}}return n.delete(e),n.delete(t),l}var _equalArrays=equalArrays,Uint8Array=_root.Uint8Array,_Uint8Array=Uint8Array;function mapToArray(e){var t=-1,r=Array(e.size);return e.forEach((function(e,a){r[++t]=[a,e]})),r}var _mapToArray=mapToArray;function setToArray(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var _setToArray=setToArray,COMPARE_PARTIAL_FLAG$1=1,COMPARE_UNORDERED_FLAG$1=2,boolTag$1="[object Boolean]",dateTag$1="[object Date]",errorTag$1="[object Error]",mapTag$1="[object Map]",numberTag$1="[object Number]",regexpTag$1="[object RegExp]",setTag$1="[object Set]",stringTag$1="[object String]",symbolTag="[object Symbol]",arrayBufferTag$1="[object ArrayBuffer]",dataViewTag$1="[object DataView]",symbolProto=_Symbol?_Symbol.prototype:void 0,symbolValueOf=symbolProto?symbolProto.valueOf:void 0;function equalByTag(e,t,r,a,o,n,i){switch(r){case dataViewTag$1:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case arrayBufferTag$1:return!(e.byteLength!=t.byteLength||!n(new _Uint8Array(e),new _Uint8Array(t)));case boolTag$1:case dateTag$1:case numberTag$1:return eq_1(+e,+t);case errorTag$1:return e.name==t.name&&e.message==t.message;case regexpTag$1:case stringTag$1:return e==t+"";case mapTag$1:var s=_mapToArray;case setTag$1:var c=a&COMPARE_PARTIAL_FLAG$1;if(s||(s=_setToArray),e.size!=t.size&&!c)return!1;var _=i.get(e);if(_)return _==t;a|=COMPARE_UNORDERED_FLAG$1,i.set(e,t);var u=_equalArrays(s(e),s(t),a,o,n,i);return i.delete(e),u;case symbolTag:if(symbolValueOf)return symbolValueOf.call(e)==symbolValueOf.call(t)}return!1}var _equalByTag=equalByTag;function arrayPush(e,t){for(var r=-1,a=t.length,o=e.length;++r<a;)e[o+r]=t[r];return e}var _arrayPush=arrayPush;function baseGetAllKeys(e,t,r){var a=t(e);return isArray_1(e)?a:_arrayPush(a,r(e))}var _baseGetAllKeys=baseGetAllKeys;function arrayFilter(e,t){for(var r=-1,a=null==e?0:e.length,o=0,n=[];++r<a;){var i=e[r];t(i,r,e)&&(n[o++]=i)}return n}var _arrayFilter=arrayFilter;function stubArray(){return[]}var stubArray_1=stubArray,objectProto$9=Object.prototype,propertyIsEnumerable$1=objectProto$9.propertyIsEnumerable,nativeGetSymbols=Object.getOwnPropertySymbols,getSymbols=nativeGetSymbols?function(e){return null==e?[]:(e=Object(e),_arrayFilter(nativeGetSymbols(e),(function(t){return propertyIsEnumerable$1.call(e,t)})))}:stubArray_1,_getSymbols=getSymbols;function getAllKeys(e){return _baseGetAllKeys(e,keys_1,_getSymbols)}var _getAllKeys=getAllKeys,COMPARE_PARTIAL_FLAG$2=1,objectProto$a=Object.prototype,hasOwnProperty$7=objectProto$a.hasOwnProperty;function equalObjects(e,t,r,a,o,n){var i=r&COMPARE_PARTIAL_FLAG$2,s=_getAllKeys(e),c=s.length;if(c!=_getAllKeys(t).length&&!i)return!1;for(var _=c;_--;){var u=s[_];if(!(i?u in t:hasOwnProperty$7.call(t,u)))return!1}var l=n.get(e);if(l&&n.get(t))return l==t;var p=!0;n.set(e,t),n.set(t,e);for(var g=i;++_<c;){var d=e[u=s[_]],y=t[u];if(a)var E=i?a(y,d,u,t,e,n):a(d,y,u,e,t,n);if(!(void 0===E?d===y||o(d,y,r,a,n):E)){p=!1;break}g||(g="constructor"==u)}if(p&&!g){var T=e.constructor,f=t.constructor;T!=f&&"constructor"in e&&"constructor"in t&&!("function"==typeof T&&T instanceof T&&"function"==typeof f&&f instanceof f)&&(p=!1)}return n.delete(e),n.delete(t),p}var _equalObjects=equalObjects,DataView=_getNative(_root,"DataView"),_DataView=DataView,Promise$1=_getNative(_root,"Promise"),_Promise=Promise$1,Set=_getNative(_root,"Set"),_Set=Set,WeakMap=_getNative(_root,"WeakMap"),_WeakMap=WeakMap,mapTag$2="[object Map]",objectTag$1="[object Object]",promiseTag="[object Promise]",setTag$2="[object Set]",weakMapTag$1="[object WeakMap]",dataViewTag$2="[object DataView]",dataViewCtorString=_toSource(_DataView),mapCtorString=_toSource(_Map),promiseCtorString=_toSource(_Promise),setCtorString=_toSource(_Set),weakMapCtorString=_toSource(_WeakMap),getTag=_baseGetTag;(_DataView&&getTag(new _DataView(new ArrayBuffer(1)))!=dataViewTag$2||_Map&&getTag(new _Map)!=mapTag$2||_Promise&&getTag(_Promise.resolve())!=promiseTag||_Set&&getTag(new _Set)!=setTag$2||_WeakMap&&getTag(new _WeakMap)!=weakMapTag$1)&&(getTag=function(e){var t=_baseGetTag(e),r=t==objectTag$1?e.constructor:void 0,a=r?_toSource(r):"";if(a)switch(a){case dataViewCtorString:return dataViewTag$2;case mapCtorString:return mapTag$2;case promiseCtorString:return promiseTag;case setCtorString:return setTag$2;case weakMapCtorString:return weakMapTag$1}return t});var _getTag=getTag,COMPARE_PARTIAL_FLAG$3=1,argsTag$2="[object Arguments]",arrayTag$1="[object Array]",objectTag$2="[object Object]",objectProto$b=Object.prototype,hasOwnProperty$8=objectProto$b.hasOwnProperty;function baseIsEqualDeep(e,t,r,a,o,n){var i=isArray_1(e),s=isArray_1(t),c=i?arrayTag$1:_getTag(e),_=s?arrayTag$1:_getTag(t),u=(c=c==argsTag$2?objectTag$2:c)==objectTag$2,l=(_=_==argsTag$2?objectTag$2:_)==objectTag$2,p=c==_;if(p&&isBuffer_1(e)){if(!isBuffer_1(t))return!1;i=!0,u=!1}if(p&&!u)return n||(n=new _Stack),i||isTypedArray_1(e)?_equalArrays(e,t,r,a,o,n):_equalByTag(e,t,c,r,a,o,n);if(!(r&COMPARE_PARTIAL_FLAG$3)){var g=u&&hasOwnProperty$8.call(e,"__wrapped__"),d=l&&hasOwnProperty$8.call(t,"__wrapped__");if(g||d){var y=g?e.value():e,E=d?t.value():t;return n||(n=new _Stack),o(y,E,r,a,n)}}return!!p&&(n||(n=new _Stack),_equalObjects(e,t,r,a,o,n))}var _baseIsEqualDeep=baseIsEqualDeep;function baseIsEqual(e,t,r,a,o){return e===t||(null==e||null==t||!isObjectLike_1(e)&&!isObjectLike_1(t)?e!=e&&t!=t:_baseIsEqualDeep(e,t,r,a,baseIsEqual,o))}var _baseIsEqual=baseIsEqual,COMPARE_PARTIAL_FLAG$4=1,COMPARE_UNORDERED_FLAG$2=2;function baseIsMatch(e,t,r,a){var o=r.length,n=o,i=!a;if(null==e)return!n;for(e=Object(e);o--;){var s=r[o];if(i&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++o<n;){var c=(s=r[o])[0],_=e[c],u=s[1];if(i&&s[2]){if(void 0===_&&!(c in e))return!1}else{var l=new _Stack;if(a)var p=a(_,u,c,e,t,l);if(!(void 0===p?_baseIsEqual(u,_,COMPARE_PARTIAL_FLAG$4|COMPARE_UNORDERED_FLAG$2,a,l):p))return!1}}return!0}var _baseIsMatch=baseIsMatch;function isStrictComparable(e){return e==e&&!isObject_1(e)}var _isStrictComparable=isStrictComparable;function getMatchData(e){for(var t=keys_1(e),r=t.length;r--;){var a=t[r],o=e[a];t[r]=[a,o,_isStrictComparable(o)]}return t}var _getMatchData=getMatchData;function matchesStrictComparable(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}}var _matchesStrictComparable=matchesStrictComparable;function baseMatches(e){var t=_getMatchData(e);return 1==t.length&&t[0][2]?_matchesStrictComparable(t[0][0],t[0][1]):function(r){return r===e||_baseIsMatch(r,e,t)}}var _baseMatches=baseMatches,symbolTag$1="[object Symbol]";function isSymbol(e){return"symbol"==typeof e||isObjectLike_1(e)&&_baseGetTag(e)==symbolTag$1}var isSymbol_1=isSymbol,reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(e,t){if(isArray_1(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol_1(e))||(reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}var _isKey=isKey,FUNC_ERROR_TEXT="Expected a function";function memoize(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(FUNC_ERROR_TEXT);var r=function(){var a=arguments,o=t?t.apply(this,a):a[0],n=r.cache;if(n.has(o))return n.get(o);var i=e.apply(this,a);return r.cache=n.set(o,i)||n,i};return r.cache=new(memoize.Cache||_MapCache),r}memoize.Cache=_MapCache;var memoize_1=memoize,MAX_MEMOIZE_SIZE=500;function memoizeCapped(e){var t=memoize_1(e,(function(e){return r.size===MAX_MEMOIZE_SIZE&&r.clear(),e})),r=t.cache;return t}var _memoizeCapped=memoizeCapped,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=_memoizeCapped((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(rePropName,(function(e,r,a,o){t.push(a?o.replace(reEscapeChar,"$1"):r||e)})),t})),_stringToPath=stringToPath;function arrayMap(e,t){for(var r=-1,a=null==e?0:e.length,o=Array(a);++r<a;)o[r]=t(e[r],r,e);return o}var _arrayMap=arrayMap,INFINITY=1/0,symbolProto$1=_Symbol?_Symbol.prototype:void 0,symbolToString=symbolProto$1?symbolProto$1.toString:void 0;function baseToString(e){if("string"==typeof e)return e;if(isArray_1(e))return _arrayMap(e,baseToString)+"";if(isSymbol_1(e))return symbolToString?symbolToString.call(e):"";var t=e+"";return"0"==t&&1/e==-INFINITY?"-0":t}var _baseToString=baseToString;function toString(e){return null==e?"":_baseToString(e)}var toString_1=toString;function castPath(e,t){return isArray_1(e)?e:_isKey(e,t)?[e]:_stringToPath(toString_1(e))}var _castPath=castPath,INFINITY$1=1/0;function toKey(e){if("string"==typeof e||isSymbol_1(e))return e;var t=e+"";return"0"==t&&1/e==-INFINITY$1?"-0":t}var _toKey=toKey;function baseGet(e,t){for(var r=0,a=(t=_castPath(t,e)).length;null!=e&&r<a;)e=e[_toKey(t[r++])];return r&&r==a?e:void 0}var _baseGet=baseGet;function get(e,t,r){var a=null==e?void 0:_baseGet(e,t);return void 0===a?r:a}var get_1=get;function baseHasIn(e,t){return null!=e&&t in Object(e)}var _baseHasIn=baseHasIn;function hasPath(e,t,r){for(var a=-1,o=(t=_castPath(t,e)).length,n=!1;++a<o;){var i=_toKey(t[a]);if(!(n=null!=e&&r(e,i)))break;e=e[i]}return n||++a!=o?n:!!(o=null==e?0:e.length)&&isLength_1(o)&&_isIndex(i,o)&&(isArray_1(e)||isArguments_1(e))}var _hasPath=hasPath;function hasIn(e,t){return null!=e&&_hasPath(e,t,_baseHasIn)}var hasIn_1=hasIn,COMPARE_PARTIAL_FLAG$5=1,COMPARE_UNORDERED_FLAG$3=2;function baseMatchesProperty(e,t){return _isKey(e)&&_isStrictComparable(t)?_matchesStrictComparable(_toKey(e),t):function(r){var a=get_1(r,e);return void 0===a&&a===t?hasIn_1(r,e):_baseIsEqual(t,a,COMPARE_PARTIAL_FLAG$5|COMPARE_UNORDERED_FLAG$3)}}var _baseMatchesProperty=baseMatchesProperty;function identity(e){return e}var identity_1=identity;function baseProperty(e){return function(t){return null==t?void 0:t[e]}}var _baseProperty=baseProperty;function basePropertyDeep(e){return function(t){return _baseGet(t,e)}}var _basePropertyDeep=basePropertyDeep;function property(e){return _isKey(e)?_baseProperty(_toKey(e)):_basePropertyDeep(e)}var property_1=property;function baseIteratee(e){return"function"==typeof e?e:null==e?identity_1:"object"==typeof e?isArray_1(e)?_baseMatchesProperty(e[0],e[1]):_baseMatches(e):property_1(e)}var _baseIteratee=baseIteratee;function mapValues(e,t){var r={};return t=_baseIteratee(t),_baseForOwn(e,(function(e,a,o){_baseAssignValue(r,a,t(e,a,o))})),r}var mapValues_1=mapValues,isUnitlessNumber={boxFlex:!0,boxFlexGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0};function prefixKey(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}var prefixes=["Webkit","ms","Moz","O"];Object.keys(isUnitlessNumber).forEach((function(e){prefixes.forEach((function(t){isUnitlessNumber[prefixKey(t,e)]=isUnitlessNumber[e]}))}));var shorthandPropertyExpansions={background:{backgroundImage:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundColor:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0}},CSSProperty={isUnitlessNumber:isUnitlessNumber,shorthandPropertyExpansions:shorthandPropertyExpansions},CSSProperty_1=CSSProperty;const unpackShorthandStyles=e=>{const{padding:t,margin:r,...a}=e.css;let o={};return t&&(o={paddingRight:t,paddingLeft:t,paddingBottom:t,paddingTop:t}),r&&(o={...o,marginRight:r,marginLeft:r,marginBottom:r,marginTop:r}),{...e,css:{...o,...a}}},convertStyleNumberValues=e=>{const t=e.css,r={};return Object.entries(t).forEach(([e,t])=>{if(util.isNumber(t))return CSSProperty_1.isUnitlessNumber[e]?void(r[e]=`${t}`):void(r[e]=`${t}px`);r[e]=t}),{...e,css:r}},typographyNode=e=>{const t=get_1(e,"data.custom.variant","P");return{...e,type:t}},normalizeFlexBasis=e=>{const{flexBasis:t}=e.css;return"0"===t||"0px"===t?{...e,css:{...e.css,flexBasis:"0%"}}:e},adaptCustomNodes=e=>mapValues_1(e,e=>{let t=e;return"Typography"===t.type&&(t=typographyNode(t)),t.css&&"flexBasis"in t.css&&(t=normalizeFlexBasis(t)),t.css&&(t=unpackShorthandStyles(t),t=convertStyleNumberValues(t)),t}),eventPrefix=e=>`candu.sdk.${e}`,errorPrefix=e=>eventPrefix(`error.${e}`),ERROR_SLUGS={UNKOWN_NODE_TYPE:"unknown_node_type",UNKOWN_BLOCK_NODE_TYPE:"unkown_block_node_type",UNKOWN_INLINE_NODE_TYPE:"unkown_inline_node_type",UNKOWN_NODE_OBJECT_TYPE:"unkown_node_object_type",TUTORIAL_ERROR:"tutorial_error_boundary",PORTAL_ERROR:"portal_error_boundary",STYLEGUIDE_MAP_ERROR:"styleguide_map",RENDER_NODE_ERROR:"render_node"},EVENT_NAMES={HEARTBEAT:eventPrefix("heartbeat"),PREVIEW_OPEN:eventPrefix("preview.open"),PORTAL:eventPrefix("portal"),TUTORIAL:eventPrefix("tutorial"),TUTORIAL_INTERACTION:eventPrefix("tutorial.interaction"),PORTAL_ASSET_NOT_FOUND:errorPrefix("portal_asset_not_found"),PORTAL_NO_SEGMENT_IDS:errorPrefix("portal_no_segment_ids"),NO_MATCHING_TUTORIALS:errorPrefix("no_matching_tutorials"),NO_VALID_TUTORIAL_IDENTIFIER:errorPrefix("no_valid_tutorial_identifier"),COMMIT_API_LOADING_ERROR:errorPrefix("commit_api"),TUTORIAL_LOADING_ERROR:errorPrefix("tutorial"),UNKOWN_NODE_TYPE:errorPrefix(ERROR_SLUGS.UNKOWN_NODE_TYPE),UNKOWN_INLINE_NODE_TYPE:errorPrefix(ERROR_SLUGS.UNKOWN_INLINE_NODE_TYPE),UNKOWN_NODE_OBJECT_TYPE:errorPrefix(ERROR_SLUGS.UNKOWN_NODE_OBJECT_TYPE),TUTORIAL_ERROR:errorPrefix(ERROR_SLUGS.TUTORIAL_ERROR),PORTAL_ERROR:errorPrefix(ERROR_SLUGS.PORTAL_ERROR),STYLEGUIDE_MAP_ERROR:errorPrefix(ERROR_SLUGS.TUTORIAL_ERROR),RENDER_NODE_ERROR:errorPrefix(ERROR_SLUGS.TUTORIAL_ERROR),CIRCULAR_DEPENDENCY_EMBED_PORTAL:errorPrefix("circular_dependecy_embed_portal"),CIRCULAR_DEPENDENCY_EMBED_TUTORIAL:errorPrefix("circular_dependecy_embed_tutorial")},PORTAL_ASSET_NOT_FOUND="Could not find the requested Portal. This could happen because:\n1. The Portal does not exist or it was deleted.\n2. The Portal has not been made avaliable to be rendered.\n3. CORS Authenticaton failed.\nSee http://udn.ac/portal-not-found for more information.\n",unknownMessage=e=>`An error has occured while trying to parse your Tutorial.\nUpgrade the SDK to the latest version to get rid of this error.\nErrorCode: ${e}.`,EVENTING_NOT_INITIALIZED="You tried to send an event, but you haven't initialized eventing.\nThis is happening because you called eventing outside the scope of the CanduProvider. It can be fixed by:\n1. Adding CanduProvider to the root of the application.\n2. Initializing a new Eventing object outside of Candu.\nRead here for more context: http://udn.ac/tracking-not-init.\n",PORTAL_NO_SEGMENT_IDS="You have tried to render a Portal that doesn't contain any content.\nAdd content to your Portal: https://udn.ac/update-portals.\n",NO_MATCHING_TUTORIALS="The Tutorial will not be rendered because there are no matching segments for the given user.",ERROR_MESSAGES={EVENTING_NOT_INITIALIZED:EVENTING_NOT_INITIALIZED,[EVENT_NAMES.PORTAL_ASSET_NOT_FOUND]:PORTAL_ASSET_NOT_FOUND,[EVENT_NAMES.PORTAL_NO_SEGMENT_IDS]:PORTAL_NO_SEGMENT_IDS,[EVENT_NAMES.NO_MATCHING_TUTORIALS]:NO_MATCHING_TUTORIALS,[EVENT_NAMES.NO_VALID_TUTORIAL_IDENTIFIER]:"(Candu/Tutorial) You must define one of tutorialId, slug, commitId or contentHashId.",[EVENT_NAMES.TUTORIAL_LOADING_ERROR]:"An error has occurred while trying to load the Tutorial",[EVENT_NAMES.UNKOWN_INLINE_NODE_TYPE]:unknownMessage(ERROR_SLUGS.UNKOWN_INLINE_NODE_TYPE),[EVENT_NAMES.UNKOWN_NODE_TYPE]:unknownMessage(ERROR_SLUGS.UNKOWN_NODE_TYPE),[EVENT_NAMES.CIRCULAR_DEPENDENCY_EMBED_PORTAL]:"Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",[EVENT_NAMES.CIRCULAR_DEPENDENCY_EMBED_TUTORIAL]:"Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",[EVENT_NAMES.PORTAL_ERROR]:"An error has occured within Portal",[EVENT_NAMES.TUTORIAL_ERROR]:"An error has occured within Tutorial",[EVENT_NAMES.RENDER_NODE_ERROR]:"An error has occured while rendering tutorial node",[EVENT_NAMES.STYLEGUIDE_MAP_ERROR]:"An error has occured while mapping node to styleguide"},defaultStyleguide={Alert:!0,B:!0,Badge:!0,Button:!0,Card:!0,Code:!0,Document:!0,Em:!0,EmbedPortal:!0,EmbedTutorial:!0,Flex:!0,FlexItem:!0,H1:!0,H2:!0,H3:!0,H4:!0,H5:!0,H6:!0,Image:!0,InlineCode:!0,Link:!0,List:!0,ListItem:!0,P:!0,RichText:!0,Spacing:!0,Text:!0,U:!0,View:!0,Player:!0},trackStyleguideProperties=e=>{const t={};return Object.keys(e).forEach(r=>{defaultStyleguide[r]&&(t[`styleguide.${r}`]=e[r].displayName||!0)}),t},LOGGER={error:console.error,warning:console.warn},internalEventing=({identify:e,track:t})=>({provider:({userId:r,traits:a,styleguide:o})=>{e(r,a),t(EVENT_NAMES.HEARTBEAT,trackStyleguideProperties(o))},tutorialDocumentLoadingError:({tutorialId:e,slug:r,contentHashId:a})=>{LOGGER.error(ERROR_MESSAGES[EVENT_NAMES.TUTORIAL_LOADING_ERROR]),t(EVENT_NAMES.TUTORIAL_LOADING_ERROR,{tutorialId:e,slug:r,contentHashId:a})}});for(var n=function(){return e.randomBytes(16)},t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);var i,s,a=function(e,r){var a=r||0,o=t;return[o[e[a++]],o[e[a++]],o[e[a++]],o[e[a++]],"-",o[e[a++]],o[e[a++]],"-",o[e[a++]],o[e[a++]],"-",o[e[a++]],o[e[a++]],"-",o[e[a++]],o[e[a++]],o[e[a++]],o[e[a++]],o[e[a++]],o[e[a++]]].join("")},o=function(e,t,r){var o=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var i=(e=e||{}).random||(e.rng||n)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t)for(var s=0;s<16;++s)t[o+s]=i[s];return t||a(i)},c=Object.freeze({__proto__:null,API_BASE_URL:"https://api.candu.ai",VERSION:"0.5.0"});!function(e){e.UserGenerated="UserGenerated",e.SDK="SDK"}(i||(i={})),function(e){e.Identify="Identify",e.Group="Group",e.Track="Track",e.Page="Page",e.Screen="Screen"}(s||(s={}));const m=()=>"undefined"!=typeof window&&window.localStorage,g=e=>t=>{m()&&null!=t&&window.localStorage.setItem(e,JSON.stringify(t))};var f={anonymousId:{getOrCreate:((e,t)=>()=>(e=>()=>{if(m()){const e=window.localStorage.getItem("candu:anonymous_id");if(e)try{return JSON.parse(e)}catch(e){return null}}})()()||(()=>{const e=o();return g("candu:anonymous_id")(e),e})())(),set:g("candu:anonymous_id")}};const O=f.anonymousId.getOrCreate;var t$1="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n$1="object"==typeof t$1&&t$1&&t$1.Object===Object&&t$1,o$1="object"==typeof self&&self&&self.Object===Object&&self,r$1=(n$1||o$1||Function("return this")()).Symbol,a$1=Object.prototype,i$1=a$1.hasOwnProperty,l=a$1.toString,E=r$1?r$1.toStringTag:void 0,c$1=function(e){var t=i$1.call(e,E),r=e[E];try{e[E]=void 0;var a=!0}catch(e){}var o=l.call(e);return a&&(t?e[E]=r:delete e[E]),o},s$1=Object.prototype.toString,u=function(e){return s$1.call(e)},d="[object Null]",p="[object Undefined]",v=r$1?r$1.toStringTag:void 0,T=function(e){return null==e?void 0===e?p:d:v&&v in Object(e)?c$1(e):u(e)},O$1=Array.isArray,_=function(e){return null!=e&&"object"==typeof e},A="[object String]",f$1=function(e){return"string"==typeof e||!O$1(e)&&_(e)&&T(e)==A},m$1="[object Number]",N=function(e){return"number"==typeof e||_(e)&&T(e)==m$1};const P=/^([a-zA-Z0-9]|_|-)+$/,S=e=>f$1(e)&&e.length>=3&&e.length<100&&P.test(e),g$1=e=>N(e)&&e>=0,I=e=>f$1(e)&&!!e.match(/^[0-9a-zA-Z]*$/)&&e.length>=10,R=e=>g$1(e)||f$1(e)&&e.trim().length>0;var L,b,M,w,$,j;!function(e){e.SDK="SDK",e.PREVIEW="PREVIEW"}(L||(L={})),function(e){e.BOOTSTRAP="Bootstrap",e.CHANGE_POSITION="ChangePosition",e.CLOSE_PREVIEW="ClosePreview",e.PREVIEW_LOADED="PreviewLoaded",e.SET_AVALIABLE_PORTALS="SetAvaliablePortals",e.SET_CONTENT="SetContent",e.SET_SELECTED_ELEMENT="SetSelectedElement",e.SET_VIEW_MODE="SetViewMode",e.ADD_ELEMENT="AddElement",e.REMOVE_ELEMENT="RemoveElement",e.UPDATE_ELEMENT="UpdateElement",e.SET_ELEMENT="SetElement"}(b||(b={})),(M||(M={})).ON_CLICK="OnClick",function(e){e.NATIVE="Native",e.PENDO="Pendo"}(w||(w={})),function(e){e.NAVIGATE="Navigate",e.CHANGE_TUTORIAL="ChangeTutorial",e.OPEN_GUIDE="OpenGuide"}($||($={})),function(e){e.PRIMARY="primary",e.SECONDARY="primary",e.WARNING="warning",e.DANGER="danger",e.NEUTRAL="neutral",e.ACTIVE="active",e.INFO="info"}(j||(j={}));const V=j.PRIMARY;var W;!function(e){e.U="U",e.B="B",e.Em="Em",e.InlineCode="InlineCode"}(W||(W={}));const U=e=>f$1(e)&&!!e.match(/^[0-9a-zA-Z]{40}$/),B=e=>g$1(e),k=e=>S(e);var X,q,Q,ee,K=Object.freeze({__proto__:null,PREVIEW_SCRIPT_URL:"https://app.candu.ai/preview.html"});!function(e){e.COLLAPSED="Collapsed",e.EXPANDED="Expanded",e.MINIMIZED="Minimized"}(X||(X={})),function(e){e.TUTORIAL="Tutorial",e.PORTAL="Portal"}(q||(q={})),function(e){e.Global="Global",e.Organization="Organization"}(Q||(Q={})),function(e){e.Root="root",e.Rule="rule",e.Atrule="atrule",e.Decl="decl",e.Any="any"}(ee||(ee={}));var invariant=function(e,t,r,a,o,n,i,s){if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var _=[r,a,o,n,i,s],u=0;(c=new Error(t.replace(/%s/g,(function(){return _[u++]})))).name="Invariant Violation"}throw c.framesToPop=1,c}},invariant_1=invariant;const isValidStyleguideProps=e=>invariant_1(!e||isObject_1(e),"(Candu) styleguide must be undefined or an object"),providerValidation=({clientToken:e,userId:t,traits:r,options:a,styleguide:o,...n})=>(invariant_1(I(e),"(Candu) you must provide a valid clientToken"),invariant_1(!t||R(t),"(Candu) you must provide a valid userId"),isValidStyleguideProps(o),invariant_1(!r||isObject_1(r),"(Candu) traits must be undefined or an object"),invariant_1(!a||isObject_1(a),"(Candu) options must be undefined or an object"),{...n,clientToken:e,traits:r||{},options:a||{},styleguide:o||{},userId:t||O()}),tutorialValidation=({slug:e,styleguide:t,contentHashId:r,tutorialId:a,tutorialDocument:o,...n})=>(isValidStyleguideProps(t),{...n,slug:e,styleguide:t||{},contentHashId:r,tutorialId:a,tutorialDocument:o}),portalValidation=({slug:e,styleguide:t})=>(isValidStyleguideProps(t),{slug:e,styleguide:t||{}}),API_BASE_URL="https://api.candu.ai",CDN_BASE_URL="https://cdn.candu.ai",VERSION="0.5.1";var injections=Object.freeze({__proto__:null,API_BASE_URL:API_BASE_URL,CDN_BASE_URL:CDN_BASE_URL,VERSION:"0.5.1"});const{API_BASE_URL:API_BASE_URL$1}=injections,{CDN_BASE_URL:CDN_BASE_URL$1}=injections,ENDPOINTS={segmentMembership:"/api/segmentMemberships",tutorialDocuments:"/api/tutorialDocumentsEditor"},fetchURL=async e=>(await fetch(e)).json(),fetchFromApi=e=>fetchURL(`${API_BASE_URL$1}${e}`),fetchFromCdn=e=>fetchURL(`${CDN_BASE_URL$1}${e}`),getTutorialDocument=e=>({byId:t=>fetchFromApi(`${ENDPOINTS.tutorialDocuments}/${t}?token=${e}`),bySlug:t=>fetchFromCdn(`/tutorials/${e}/${t}.json`),byContentHash:t=>fetchFromCdn(`/tutorials/${e}/${t}.json`)}),RESOURCES={tutorialDocumentLatestPublished:async(e,t)=>fetchFromApi(`${ENDPOINTS.tutorialDocuments}?token=${e}&finder=latestPublished&tutorialId=${t}`),portalAsset:async(e,t)=>fetchFromCdn(`/portals/${e}/${t}/head.json`),segmentMembership:async(e,t)=>fetchFromApi(`${ENDPOINTS.segmentMembership}/${t}?token=${e}`),tutorialDocument:(e,t,r)=>{const{contentHashId:a,tutorialId:o,tutorialDocument:n,slug:i}=e,s=getTutorialDocument(t);return B(o)?s.byId(o):k(i)?s.bySlug(i):U(a)?s.byContentHash(a):isObject_1(n)?Promise.resolve(n):(LOGGER.error(ERROR_MESSAGES[EVENT_NAMES.NO_VALID_TUTORIAL_IDENTIFIER]),r.track(EVENT_NAMES.NO_VALID_TUTORIAL_IDENTIFIER,{slug:e.slug}),null)}},logError=(...e)=>console.error(...e),logWarning=(...e)=>console.warn(...e),logger={error:logError,warning:logWarning},getEventHandler=e=>{switch(e.trigger){case M.ON_CLICK:default:return"onClick"}},getActionHandler=(e,t)=>{switch(e.handler.type){case $.NAVIGATE:return{[getEventHandler(e)]:()=>{const{href:r,target:a}=e.handler;t(e),"Blank"===a?window.open(r,"_blank"):r&&r.includes("mailto:")?window.location=r:document.location.href=r}};case $.CHANGE_TUTORIAL:return{[getEventHandler(e)]:()=>{const{tutorialId:t}=e.handler;logError("TODO -> change tutorial",t)}};case $.OPEN_GUIDE:return{[getEventHandler(e)]:()=>{const{guideId:t}=e.handler;logError("TODO -> open guide",t)}};default:return{}}},getActionHandlers=({data:e},t)=>{if(!e||!e.actions)return{};const r=e=>{t.provider.eventing.track(EVENT_NAMES.TUTORIAL_INTERACTION,{...e,...t.trackingIdentifiers||{}})};return e.actions.map(e=>getActionHandler(e,r)).reduce((e,t)=>({...e,...t}),{})},mapNodeToStyleguide=(e,t)=>{try{const{provider:r,document:a,trackingIdentifiers:o}=t,n=a.nodes[e];if(!n)return logger.error("Document is corrupted. Refusing to move further."),null;const i=e=>mapNodeToStyleguide(e,t),{type:s,props:c,css:_}=n,u={...c||{},style:_||{},children:(c||{}).children||n.nodes&&n.nodes.map(i),...getActionHandlers(n,{trackingIdentifiers:o,provider:r})},l={nodeId:e,node:n,document:a,render:{node:i,styleguide:(e,r={})=>t.renderNode(e,{api:l,attributes:r}),tutorial:e=>t.renderTutorial(e),portal:e=>t.renderPortal(e)},trackingIdentifiers:o},p=l.render.styleguide(s,u);return p||(logger.error(ERROR_MESSAGES[EVENT_NAMES.UNKOWN_NODE_TYPE],{type:s}),r.eventing.track(EVENT_NAMES.UNKOWN_NODE_TYPE,{type:s}),null)}catch(e){return logger.error(ERROR_MESSAGES[EVENT_NAMES.STYLEGUIDE_MAP_ERROR],e),null}},mergeStyleguidesFromContext=memoize_1((e,t)=>{const{provider:r,portal:a,tutorial:o}=e,n=r.styleguide;let i,s;return o&&(s=o.styleguide),a&&(i=a.styleguide),{...n||{},...i||{},...s||{},...t||{}}}),DEFAULT_ALT="",DEFAULT_ALERT_COLOR="#EDEDED",DEFAULT_TAB_HEADER_COLOR="#333745",DEFAULT_TAB_ITEM_COLOR="#838792",DEFAULT_TAB_ACTIVE_COLOR="#FEFEFE",DEFAULT_TAB_COLOR="#FEFEFE",STYLEGUIDE_COLORS={primary:"#6310E5",secondary:"#59C3C3",tertiary:"#4D515D",warning:"#FCAD0D",danger:"#EE4266"},attachStylesheet=e=>{const t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",`${CDN_BASE_URL$1}/styleguides/applications/${e}/default/main.css`),document.head.appendChild(t)};exports.DEFAULT_ALERT_COLOR="#EDEDED",exports.DEFAULT_ALT="",exports.DEFAULT_TAB_ACTIVE_COLOR="#FEFEFE",exports.DEFAULT_TAB_COLOR="#FEFEFE",exports.DEFAULT_TAB_HEADER_COLOR="#333745",exports.DEFAULT_TAB_ITEM_COLOR="#838792",exports.ERROR_MESSAGES=ERROR_MESSAGES,exports.ERROR_SLUGS=ERROR_SLUGS,exports.EVENT_NAMES=EVENT_NAMES,exports.LOGGER=LOGGER,exports.RESOURCES=RESOURCES,exports.STYLEGUIDE_COLORS=STYLEGUIDE_COLORS,exports.adaptCustomNodes=adaptCustomNodes,exports.attachStylesheet=attachStylesheet,exports.convertStyleNumberValues=convertStyleNumberValues,exports.defaultStyleguide=defaultStyleguide,exports.internalEventing=internalEventing,exports.logError=logError,exports.logWarning=logWarning,exports.logger=logger,exports.mapNodeToStyleguide=mapNodeToStyleguide,exports.mergeStyleguidesFromContext=mergeStyleguidesFromContext,exports.portalValidation=portalValidation,exports.providerValidation=providerValidation,exports.tutorialValidation=tutorialValidation,exports.unpackShorthandStyles=unpackShorthandStyles; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var util=require("util"),crypto=_interopDefault(require("crypto")),commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var freeGlobal="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_freeGlobal=freeGlobal,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=_freeGlobal||freeSelf||Function("return this")(),_root=root,Symbol=_root.Symbol,_Symbol=Symbol,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,nativeObjectToString=objectProto.toString,symToStringTag=_Symbol?_Symbol.toStringTag:void 0;function getRawTag(e){var t=hasOwnProperty.call(e,symToStringTag),r=e[symToStringTag];try{e[symToStringTag]=void 0;var a=!0}catch(e){}var o=nativeObjectToString.call(e);return a&&(t?e[symToStringTag]=r:delete e[symToStringTag]),o}var _getRawTag=getRawTag,objectProto$1=Object.prototype,nativeObjectToString$1=objectProto$1.toString;function objectToString(e){return nativeObjectToString$1.call(e)}var _objectToString=objectToString,nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag$1=_Symbol?_Symbol.toStringTag:void 0;function baseGetTag(e){return null==e?void 0===e?undefinedTag:nullTag:symToStringTag$1&&symToStringTag$1 in Object(e)?_getRawTag(e):_objectToString(e)}var _baseGetTag=baseGetTag;function isObject(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var isObject_1=isObject,asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction(e){if(!isObject_1(e))return!1;var t=_baseGetTag(e);return t==funcTag||t==genTag||t==asyncTag||t==proxyTag}var isFunction_1=isFunction,coreJsData=_root["__core-js_shared__"],_coreJsData=coreJsData,maskSrcKey=function(){var e=/[^.]+$/.exec(_coreJsData&&_coreJsData.keys&&_coreJsData.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}var _isMasked=isMasked,funcProto=Function.prototype,funcToString=funcProto.toString;function toSource(e){if(null!=e){try{return funcToString.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var _toSource=toSource,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto$1=Function.prototype,objectProto$2=Object.prototype,funcToString$1=funcProto$1.toString,hasOwnProperty$1=objectProto$2.hasOwnProperty,reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$1).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(e){return!(!isObject_1(e)||_isMasked(e))&&(isFunction_1(e)?reIsNative:reIsHostCtor).test(_toSource(e))}var _baseIsNative=baseIsNative;function getValue(e,t){return null==e?void 0:e[t]}var _getValue=getValue;function getNative(e,t){var r=_getValue(e,t);return _baseIsNative(r)?r:void 0}var _getNative=getNative,defineProperty=function(){try{var e=_getNative(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),_defineProperty=defineProperty;function baseAssignValue(e,t,r){"__proto__"==t&&_defineProperty?_defineProperty(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var _baseAssignValue=baseAssignValue;function createBaseFor(e){return function(t,r,a){for(var o=-1,n=Object(t),i=a(t),s=i.length;s--;){var c=i[e?s:++o];if(!1===r(n[c],c,n))break}return t}}var _createBaseFor=createBaseFor,baseFor=_createBaseFor(),_baseFor=baseFor;function baseTimes(e,t){for(var r=-1,a=Array(e);++r<e;)a[r]=t(r);return a}var _baseTimes=baseTimes;function isObjectLike(e){return null!=e&&"object"==typeof e}var isObjectLike_1=isObjectLike,argsTag="[object Arguments]";function baseIsArguments(e){return isObjectLike_1(e)&&_baseGetTag(e)==argsTag}var _baseIsArguments=baseIsArguments,objectProto$3=Object.prototype,hasOwnProperty$2=objectProto$3.hasOwnProperty,propertyIsEnumerable=objectProto$3.propertyIsEnumerable,isArguments=_baseIsArguments(function(){return arguments}())?_baseIsArguments:function(e){return isObjectLike_1(e)&&hasOwnProperty$2.call(e,"callee")&&!propertyIsEnumerable.call(e,"callee")},isArguments_1=isArguments,isArray=Array.isArray,isArray_1=isArray;function stubFalse(){return!1}var stubFalse_1=stubFalse,isBuffer_1=createCommonjsModule((function(e,t){var r=t&&!t.nodeType&&t,a=r&&e&&!e.nodeType&&e,o=a&&a.exports===r?_root.Buffer:void 0,n=(o?o.isBuffer:void 0)||stubFalse_1;e.exports=n})),MAX_SAFE_INTEGER=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex(e,t){var r=typeof e;return!!(t=null==t?MAX_SAFE_INTEGER:t)&&("number"==r||"symbol"!=r&&reIsUint.test(e))&&e>-1&&e%1==0&&e<t}var _isIndex=isIndex,MAX_SAFE_INTEGER$1=9007199254740991;function isLength(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=MAX_SAFE_INTEGER$1}var isLength_1=isLength,argsTag$1="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag$1="[object Function]",mapTag="[object Map]",numberTag="[object Number]",objectTag="[object Object]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",weakMapTag="[object WeakMap]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",typedArrayTags={};function baseIsTypedArray(e){return isObjectLike_1(e)&&isLength_1(e.length)&&!!typedArrayTags[_baseGetTag(e)]}typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=!0,typedArrayTags[argsTag$1]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag$1]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=!1;var _baseIsTypedArray=baseIsTypedArray;function baseUnary(e){return function(t){return e(t)}}var _baseUnary=baseUnary,_nodeUtil=createCommonjsModule((function(e,t){var r=t&&!t.nodeType&&t,a=r&&e&&!e.nodeType&&e,o=a&&a.exports===r&&_freeGlobal.process,n=function(){try{var e=a&&a.require&&a.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=n})),nodeIsTypedArray=_nodeUtil&&_nodeUtil.isTypedArray,isTypedArray=nodeIsTypedArray?_baseUnary(nodeIsTypedArray):_baseIsTypedArray,isTypedArray_1=isTypedArray,objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty;function arrayLikeKeys(e,t){var r=isArray_1(e),a=!r&&isArguments_1(e),o=!r&&!a&&isBuffer_1(e),n=!r&&!a&&!o&&isTypedArray_1(e),i=r||a||o||n,s=i?_baseTimes(e.length,String):[],c=s.length;for(var _ in e)!t&&!hasOwnProperty$3.call(e,_)||i&&("length"==_||o&&("offset"==_||"parent"==_)||n&&("buffer"==_||"byteLength"==_||"byteOffset"==_)||_isIndex(_,c))||s.push(_);return s}var _arrayLikeKeys=arrayLikeKeys,objectProto$5=Object.prototype;function isPrototype(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||objectProto$5)}var _isPrototype=isPrototype;function overArg(e,t){return function(r){return e(t(r))}}var _overArg=overArg,nativeKeys=_overArg(Object.keys,Object),_nativeKeys=nativeKeys,objectProto$6=Object.prototype,hasOwnProperty$4=objectProto$6.hasOwnProperty;function baseKeys(e){if(!_isPrototype(e))return _nativeKeys(e);var t=[];for(var r in Object(e))hasOwnProperty$4.call(e,r)&&"constructor"!=r&&t.push(r);return t}var _baseKeys=baseKeys;function isArrayLike(e){return null!=e&&isLength_1(e.length)&&!isFunction_1(e)}var isArrayLike_1=isArrayLike;function keys(e){return isArrayLike_1(e)?_arrayLikeKeys(e):_baseKeys(e)}var keys_1=keys;function baseForOwn(e,t){return e&&_baseFor(e,t,keys_1)}var _baseForOwn=baseForOwn;function listCacheClear(){this.__data__=[],this.size=0}var _listCacheClear=listCacheClear;function eq(e,t){return e===t||e!=e&&t!=t}var eq_1=eq;function assocIndexOf(e,t){for(var r=e.length;r--;)if(eq_1(e[r][0],t))return r;return-1}var _assocIndexOf=assocIndexOf,arrayProto=Array.prototype,splice=arrayProto.splice;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),--this.size,!0)}var _listCacheDelete=listCacheDelete;function listCacheGet(e){var t=this.__data__,r=_assocIndexOf(t,e);return r<0?void 0:t[r][1]}var _listCacheGet=listCacheGet;function listCacheHas(e){return _assocIndexOf(this.__data__,e)>-1}var _listCacheHas=listCacheHas;function listCacheSet(e,t){var r=this.__data__,a=_assocIndexOf(r,e);return a<0?(++this.size,r.push([e,t])):r[a][1]=t,this}var _listCacheSet=listCacheSet;function ListCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var a=e[t];this.set(a[0],a[1])}}ListCache.prototype.clear=_listCacheClear,ListCache.prototype.delete=_listCacheDelete,ListCache.prototype.get=_listCacheGet,ListCache.prototype.has=_listCacheHas,ListCache.prototype.set=_listCacheSet;var _ListCache=ListCache;function stackClear(){this.__data__=new _ListCache,this.size=0}var _stackClear=stackClear;function stackDelete(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var _stackDelete=stackDelete;function stackGet(e){return this.__data__.get(e)}var _stackGet=stackGet;function stackHas(e){return this.__data__.has(e)}var _stackHas=stackHas,Map=_getNative(_root,"Map"),_Map=Map,nativeCreate=_getNative(Object,"create"),_nativeCreate=nativeCreate;function hashClear(){this.__data__=_nativeCreate?_nativeCreate(null):{},this.size=0}var _hashClear=hashClear;function hashDelete(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var _hashDelete=hashDelete,HASH_UNDEFINED="__lodash_hash_undefined__",objectProto$7=Object.prototype,hasOwnProperty$5=objectProto$7.hasOwnProperty;function hashGet(e){var t=this.__data__;if(_nativeCreate){var r=t[e];return r===HASH_UNDEFINED?void 0:r}return hasOwnProperty$5.call(t,e)?t[e]:void 0}var _hashGet=hashGet,objectProto$8=Object.prototype,hasOwnProperty$6=objectProto$8.hasOwnProperty;function hashHas(e){var t=this.__data__;return _nativeCreate?void 0!==t[e]:hasOwnProperty$6.call(t,e)}var _hashHas=hashHas,HASH_UNDEFINED$1="__lodash_hash_undefined__";function hashSet(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=_nativeCreate&&void 0===t?HASH_UNDEFINED$1:t,this}var _hashSet=hashSet;function Hash(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var a=e[t];this.set(a[0],a[1])}}Hash.prototype.clear=_hashClear,Hash.prototype.delete=_hashDelete,Hash.prototype.get=_hashGet,Hash.prototype.has=_hashHas,Hash.prototype.set=_hashSet;var _Hash=Hash;function mapCacheClear(){this.size=0,this.__data__={hash:new _Hash,map:new(_Map||_ListCache),string:new _Hash}}var _mapCacheClear=mapCacheClear;function isKeyable(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}var _isKeyable=isKeyable;function getMapData(e,t){var r=e.__data__;return _isKeyable(t)?r["string"==typeof t?"string":"hash"]:r.map}var _getMapData=getMapData;function mapCacheDelete(e){var t=_getMapData(this,e).delete(e);return this.size-=t?1:0,t}var _mapCacheDelete=mapCacheDelete;function mapCacheGet(e){return _getMapData(this,e).get(e)}var _mapCacheGet=mapCacheGet;function mapCacheHas(e){return _getMapData(this,e).has(e)}var _mapCacheHas=mapCacheHas;function mapCacheSet(e,t){var r=_getMapData(this,e),a=r.size;return r.set(e,t),this.size+=r.size==a?0:1,this}var _mapCacheSet=mapCacheSet;function MapCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var a=e[t];this.set(a[0],a[1])}}MapCache.prototype.clear=_mapCacheClear,MapCache.prototype.delete=_mapCacheDelete,MapCache.prototype.get=_mapCacheGet,MapCache.prototype.has=_mapCacheHas,MapCache.prototype.set=_mapCacheSet;var _MapCache=MapCache,LARGE_ARRAY_SIZE=200;function stackSet(e,t){var r=this.__data__;if(r instanceof _ListCache){var a=r.__data__;if(!_Map||a.length<LARGE_ARRAY_SIZE-1)return a.push([e,t]),this.size=++r.size,this;r=this.__data__=new _MapCache(a)}return r.set(e,t),this.size=r.size,this}var _stackSet=stackSet;function Stack(e){var t=this.__data__=new _ListCache(e);this.size=t.size}Stack.prototype.clear=_stackClear,Stack.prototype.delete=_stackDelete,Stack.prototype.get=_stackGet,Stack.prototype.has=_stackHas,Stack.prototype.set=_stackSet;var _Stack=Stack,HASH_UNDEFINED$2="__lodash_hash_undefined__";function setCacheAdd(e){return this.__data__.set(e,HASH_UNDEFINED$2),this}var _setCacheAdd=setCacheAdd;function setCacheHas(e){return this.__data__.has(e)}var _setCacheHas=setCacheHas;function SetCache(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new _MapCache;++t<r;)this.add(e[t])}SetCache.prototype.add=SetCache.prototype.push=_setCacheAdd,SetCache.prototype.has=_setCacheHas;var _SetCache=SetCache;function arraySome(e,t){for(var r=-1,a=null==e?0:e.length;++r<a;)if(t(e[r],r,e))return!0;return!1}var _arraySome=arraySome;function cacheHas(e,t){return e.has(t)}var _cacheHas=cacheHas,COMPARE_PARTIAL_FLAG=1,COMPARE_UNORDERED_FLAG=2;function equalArrays(e,t,r,a,o,n){var i=r&COMPARE_PARTIAL_FLAG,s=e.length,c=t.length;if(s!=c&&!(i&&c>s))return!1;var _=n.get(e);if(_&&n.get(t))return _==t;var u=-1,l=!0,g=r&COMPARE_UNORDERED_FLAG?new _SetCache:void 0;for(n.set(e,t),n.set(t,e);++u<s;){var y=e[u],p=t[u];if(a)var d=i?a(p,y,u,t,e,n):a(y,p,u,e,t,n);if(void 0!==d){if(d)continue;l=!1;break}if(g){if(!_arraySome(t,(function(e,t){if(!_cacheHas(g,t)&&(y===e||o(y,e,r,a,n)))return g.push(t)}))){l=!1;break}}else if(y!==p&&!o(y,p,r,a,n)){l=!1;break}}return n.delete(e),n.delete(t),l}var _equalArrays=equalArrays,Uint8Array=_root.Uint8Array,_Uint8Array=Uint8Array;function mapToArray(e){var t=-1,r=Array(e.size);return e.forEach((function(e,a){r[++t]=[a,e]})),r}var _mapToArray=mapToArray;function setToArray(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var _setToArray=setToArray,COMPARE_PARTIAL_FLAG$1=1,COMPARE_UNORDERED_FLAG$1=2,boolTag$1="[object Boolean]",dateTag$1="[object Date]",errorTag$1="[object Error]",mapTag$1="[object Map]",numberTag$1="[object Number]",regexpTag$1="[object RegExp]",setTag$1="[object Set]",stringTag$1="[object String]",symbolTag="[object Symbol]",arrayBufferTag$1="[object ArrayBuffer]",dataViewTag$1="[object DataView]",symbolProto=_Symbol?_Symbol.prototype:void 0,symbolValueOf=symbolProto?symbolProto.valueOf:void 0;function equalByTag(e,t,r,a,o,n,i){switch(r){case dataViewTag$1:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case arrayBufferTag$1:return!(e.byteLength!=t.byteLength||!n(new _Uint8Array(e),new _Uint8Array(t)));case boolTag$1:case dateTag$1:case numberTag$1:return eq_1(+e,+t);case errorTag$1:return e.name==t.name&&e.message==t.message;case regexpTag$1:case stringTag$1:return e==t+"";case mapTag$1:var s=_mapToArray;case setTag$1:var c=a&COMPARE_PARTIAL_FLAG$1;if(s||(s=_setToArray),e.size!=t.size&&!c)return!1;var _=i.get(e);if(_)return _==t;a|=COMPARE_UNORDERED_FLAG$1,i.set(e,t);var u=_equalArrays(s(e),s(t),a,o,n,i);return i.delete(e),u;case symbolTag:if(symbolValueOf)return symbolValueOf.call(e)==symbolValueOf.call(t)}return!1}var _equalByTag=equalByTag;function arrayPush(e,t){for(var r=-1,a=t.length,o=e.length;++r<a;)e[o+r]=t[r];return e}var _arrayPush=arrayPush;function baseGetAllKeys(e,t,r){var a=t(e);return isArray_1(e)?a:_arrayPush(a,r(e))}var _baseGetAllKeys=baseGetAllKeys;function arrayFilter(e,t){for(var r=-1,a=null==e?0:e.length,o=0,n=[];++r<a;){var i=e[r];t(i,r,e)&&(n[o++]=i)}return n}var _arrayFilter=arrayFilter;function stubArray(){return[]}var stubArray_1=stubArray,objectProto$9=Object.prototype,propertyIsEnumerable$1=objectProto$9.propertyIsEnumerable,nativeGetSymbols=Object.getOwnPropertySymbols,getSymbols=nativeGetSymbols?function(e){return null==e?[]:(e=Object(e),_arrayFilter(nativeGetSymbols(e),(function(t){return propertyIsEnumerable$1.call(e,t)})))}:stubArray_1,_getSymbols=getSymbols;function getAllKeys(e){return _baseGetAllKeys(e,keys_1,_getSymbols)}var _getAllKeys=getAllKeys,COMPARE_PARTIAL_FLAG$2=1,objectProto$a=Object.prototype,hasOwnProperty$7=objectProto$a.hasOwnProperty;function equalObjects(e,t,r,a,o,n){var i=r&COMPARE_PARTIAL_FLAG$2,s=_getAllKeys(e),c=s.length;if(c!=_getAllKeys(t).length&&!i)return!1;for(var _=c;_--;){var u=s[_];if(!(i?u in t:hasOwnProperty$7.call(t,u)))return!1}var l=n.get(e);if(l&&n.get(t))return l==t;var g=!0;n.set(e,t),n.set(t,e);for(var y=i;++_<c;){var p=e[u=s[_]],d=t[u];if(a)var T=i?a(d,p,u,t,e,n):a(p,d,u,e,t,n);if(!(void 0===T?p===d||o(p,d,r,a,n):T)){g=!1;break}y||(y="constructor"==u)}if(g&&!y){var E=e.constructor,b=t.constructor;E!=b&&"constructor"in e&&"constructor"in t&&!("function"==typeof E&&E instanceof E&&"function"==typeof b&&b instanceof b)&&(g=!1)}return n.delete(e),n.delete(t),g}var _equalObjects=equalObjects,DataView=_getNative(_root,"DataView"),_DataView=DataView,Promise$1=_getNative(_root,"Promise"),_Promise=Promise$1,Set=_getNative(_root,"Set"),_Set=Set,WeakMap=_getNative(_root,"WeakMap"),_WeakMap=WeakMap,mapTag$2="[object Map]",objectTag$1="[object Object]",promiseTag="[object Promise]",setTag$2="[object Set]",weakMapTag$1="[object WeakMap]",dataViewTag$2="[object DataView]",dataViewCtorString=_toSource(_DataView),mapCtorString=_toSource(_Map),promiseCtorString=_toSource(_Promise),setCtorString=_toSource(_Set),weakMapCtorString=_toSource(_WeakMap),getTag=_baseGetTag;(_DataView&&getTag(new _DataView(new ArrayBuffer(1)))!=dataViewTag$2||_Map&&getTag(new _Map)!=mapTag$2||_Promise&&getTag(_Promise.resolve())!=promiseTag||_Set&&getTag(new _Set)!=setTag$2||_WeakMap&&getTag(new _WeakMap)!=weakMapTag$1)&&(getTag=function(e){var t=_baseGetTag(e),r=t==objectTag$1?e.constructor:void 0,a=r?_toSource(r):"";if(a)switch(a){case dataViewCtorString:return dataViewTag$2;case mapCtorString:return mapTag$2;case promiseCtorString:return promiseTag;case setCtorString:return setTag$2;case weakMapCtorString:return weakMapTag$1}return t});var _getTag=getTag,COMPARE_PARTIAL_FLAG$3=1,argsTag$2="[object Arguments]",arrayTag$1="[object Array]",objectTag$2="[object Object]",objectProto$b=Object.prototype,hasOwnProperty$8=objectProto$b.hasOwnProperty;function baseIsEqualDeep(e,t,r,a,o,n){var i=isArray_1(e),s=isArray_1(t),c=i?arrayTag$1:_getTag(e),_=s?arrayTag$1:_getTag(t),u=(c=c==argsTag$2?objectTag$2:c)==objectTag$2,l=(_=_==argsTag$2?objectTag$2:_)==objectTag$2,g=c==_;if(g&&isBuffer_1(e)){if(!isBuffer_1(t))return!1;i=!0,u=!1}if(g&&!u)return n||(n=new _Stack),i||isTypedArray_1(e)?_equalArrays(e,t,r,a,o,n):_equalByTag(e,t,c,r,a,o,n);if(!(r&COMPARE_PARTIAL_FLAG$3)){var y=u&&hasOwnProperty$8.call(e,"__wrapped__"),p=l&&hasOwnProperty$8.call(t,"__wrapped__");if(y||p){var d=y?e.value():e,T=p?t.value():t;return n||(n=new _Stack),o(d,T,r,a,n)}}return!!g&&(n||(n=new _Stack),_equalObjects(e,t,r,a,o,n))}var _baseIsEqualDeep=baseIsEqualDeep;function baseIsEqual(e,t,r,a,o){return e===t||(null==e||null==t||!isObjectLike_1(e)&&!isObjectLike_1(t)?e!=e&&t!=t:_baseIsEqualDeep(e,t,r,a,baseIsEqual,o))}var _baseIsEqual=baseIsEqual,COMPARE_PARTIAL_FLAG$4=1,COMPARE_UNORDERED_FLAG$2=2;function baseIsMatch(e,t,r,a){var o=r.length,n=o,i=!a;if(null==e)return!n;for(e=Object(e);o--;){var s=r[o];if(i&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++o<n;){var c=(s=r[o])[0],_=e[c],u=s[1];if(i&&s[2]){if(void 0===_&&!(c in e))return!1}else{var l=new _Stack;if(a)var g=a(_,u,c,e,t,l);if(!(void 0===g?_baseIsEqual(u,_,COMPARE_PARTIAL_FLAG$4|COMPARE_UNORDERED_FLAG$2,a,l):g))return!1}}return!0}var _baseIsMatch=baseIsMatch;function isStrictComparable(e){return e==e&&!isObject_1(e)}var _isStrictComparable=isStrictComparable;function getMatchData(e){for(var t=keys_1(e),r=t.length;r--;){var a=t[r],o=e[a];t[r]=[a,o,_isStrictComparable(o)]}return t}var _getMatchData=getMatchData;function matchesStrictComparable(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}}var _matchesStrictComparable=matchesStrictComparable;function baseMatches(e){var t=_getMatchData(e);return 1==t.length&&t[0][2]?_matchesStrictComparable(t[0][0],t[0][1]):function(r){return r===e||_baseIsMatch(r,e,t)}}var _baseMatches=baseMatches,symbolTag$1="[object Symbol]";function isSymbol(e){return"symbol"==typeof e||isObjectLike_1(e)&&_baseGetTag(e)==symbolTag$1}var isSymbol_1=isSymbol,reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(e,t){if(isArray_1(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol_1(e))||(reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}var _isKey=isKey,FUNC_ERROR_TEXT="Expected a function";function memoize(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(FUNC_ERROR_TEXT);var r=function(){var a=arguments,o=t?t.apply(this,a):a[0],n=r.cache;if(n.has(o))return n.get(o);var i=e.apply(this,a);return r.cache=n.set(o,i)||n,i};return r.cache=new(memoize.Cache||_MapCache),r}memoize.Cache=_MapCache;var memoize_1=memoize,MAX_MEMOIZE_SIZE=500;function memoizeCapped(e){var t=memoize_1(e,(function(e){return r.size===MAX_MEMOIZE_SIZE&&r.clear(),e})),r=t.cache;return t}var _memoizeCapped=memoizeCapped,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=_memoizeCapped((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(rePropName,(function(e,r,a,o){t.push(a?o.replace(reEscapeChar,"$1"):r||e)})),t})),_stringToPath=stringToPath;function arrayMap(e,t){for(var r=-1,a=null==e?0:e.length,o=Array(a);++r<a;)o[r]=t(e[r],r,e);return o}var _arrayMap=arrayMap,INFINITY=1/0,symbolProto$1=_Symbol?_Symbol.prototype:void 0,symbolToString=symbolProto$1?symbolProto$1.toString:void 0;function baseToString(e){if("string"==typeof e)return e;if(isArray_1(e))return _arrayMap(e,baseToString)+"";if(isSymbol_1(e))return symbolToString?symbolToString.call(e):"";var t=e+"";return"0"==t&&1/e==-INFINITY?"-0":t}var _baseToString=baseToString;function toString(e){return null==e?"":_baseToString(e)}var toString_1=toString;function castPath(e,t){return isArray_1(e)?e:_isKey(e,t)?[e]:_stringToPath(toString_1(e))}var _castPath=castPath,INFINITY$1=1/0;function toKey(e){if("string"==typeof e||isSymbol_1(e))return e;var t=e+"";return"0"==t&&1/e==-INFINITY$1?"-0":t}var _toKey=toKey;function baseGet(e,t){for(var r=0,a=(t=_castPath(t,e)).length;null!=e&&r<a;)e=e[_toKey(t[r++])];return r&&r==a?e:void 0}var _baseGet=baseGet;function get(e,t,r){var a=null==e?void 0:_baseGet(e,t);return void 0===a?r:a}var get_1=get;function baseHasIn(e,t){return null!=e&&t in Object(e)}var _baseHasIn=baseHasIn;function hasPath(e,t,r){for(var a=-1,o=(t=_castPath(t,e)).length,n=!1;++a<o;){var i=_toKey(t[a]);if(!(n=null!=e&&r(e,i)))break;e=e[i]}return n||++a!=o?n:!!(o=null==e?0:e.length)&&isLength_1(o)&&_isIndex(i,o)&&(isArray_1(e)||isArguments_1(e))}var _hasPath=hasPath;function hasIn(e,t){return null!=e&&_hasPath(e,t,_baseHasIn)}var hasIn_1=hasIn,COMPARE_PARTIAL_FLAG$5=1,COMPARE_UNORDERED_FLAG$3=2;function baseMatchesProperty(e,t){return _isKey(e)&&_isStrictComparable(t)?_matchesStrictComparable(_toKey(e),t):function(r){var a=get_1(r,e);return void 0===a&&a===t?hasIn_1(r,e):_baseIsEqual(t,a,COMPARE_PARTIAL_FLAG$5|COMPARE_UNORDERED_FLAG$3)}}var _baseMatchesProperty=baseMatchesProperty;function identity(e){return e}var identity_1=identity;function baseProperty(e){return function(t){return null==t?void 0:t[e]}}var _baseProperty=baseProperty;function basePropertyDeep(e){return function(t){return _baseGet(t,e)}}var _basePropertyDeep=basePropertyDeep;function property(e){return _isKey(e)?_baseProperty(_toKey(e)):_basePropertyDeep(e)}var property_1=property;function baseIteratee(e){return"function"==typeof e?e:null==e?identity_1:"object"==typeof e?isArray_1(e)?_baseMatchesProperty(e[0],e[1]):_baseMatches(e):property_1(e)}var _baseIteratee=baseIteratee;function mapValues(e,t){var r={};return t=_baseIteratee(t),_baseForOwn(e,(function(e,a,o){_baseAssignValue(r,a,t(e,a,o))})),r}var mapValues_1=mapValues,isUnitlessNumber={boxFlex:!0,boxFlexGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0};function prefixKey(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}var prefixes=["Webkit","ms","Moz","O"];Object.keys(isUnitlessNumber).forEach((function(e){prefixes.forEach((function(t){isUnitlessNumber[prefixKey(t,e)]=isUnitlessNumber[e]}))}));var shorthandPropertyExpansions={background:{backgroundImage:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundColor:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0}},CSSProperty={isUnitlessNumber:isUnitlessNumber,shorthandPropertyExpansions:shorthandPropertyExpansions},CSSProperty_1=CSSProperty;const unpackShorthandStyles=e=>{const{padding:t,margin:r,...a}=e.css;let o={};return t&&(o={paddingRight:t,paddingLeft:t,paddingBottom:t,paddingTop:t}),r&&(o={...o,marginRight:r,marginLeft:r,marginBottom:r,marginTop:r}),{...e,css:{...o,...a}}},convertStyleNumberValues=e=>{const t=e.css,r={};return Object.entries(t).forEach(([e,t])=>{if(util.isNumber(t))return CSSProperty_1.isUnitlessNumber[e]?void(r[e]=`${t}`):void(r[e]=`${t}px`);r[e]=t}),{...e,css:r}},typographyNode=e=>{const t=get_1(e,"data.custom.variant","P");return{...e,type:t}},normalizeFlexBasis=e=>{const{flexBasis:t}=e.css;return"0"===t||"0px"===t?{...e,css:{...e.css,flexBasis:"0%"}}:e},adaptCustomNodes=e=>mapValues_1(e,e=>{let t=e;return"Typography"===t.type&&(t=typographyNode(t)),t.css&&isObject_1(t.css)&&t.css.flexBasis&&(t=normalizeFlexBasis(t)),t.css&&(t=unpackShorthandStyles(t),t=convertStyleNumberValues(t)),t}),eventPrefix=e=>`candu.sdk.${e}`,errorPrefix=e=>eventPrefix(`error.${e}`),ERROR_SLUGS={UNKOWN_NODE_TYPE:"unknown_node_type",UNKOWN_BLOCK_NODE_TYPE:"unkown_block_node_type",UNKOWN_INLINE_NODE_TYPE:"unkown_inline_node_type",UNKOWN_NODE_OBJECT_TYPE:"unkown_node_object_type",TUTORIAL_ERROR:"tutorial_error_boundary",PORTAL_ERROR:"portal_error_boundary",STYLEGUIDE_MAP_ERROR:"styleguide_map",RENDER_NODE_ERROR:"render_node"},EVENT_NAMES={HEARTBEAT:eventPrefix("heartbeat"),PREVIEW_OPEN:eventPrefix("preview.open"),PORTAL:eventPrefix("portal"),TUTORIAL:eventPrefix("tutorial"),TUTORIAL_INTERACTION:eventPrefix("tutorial.interaction"),PORTAL_ASSET_NOT_FOUND:errorPrefix("portal_asset_not_found"),PORTAL_NO_SEGMENT_IDS:errorPrefix("portal_no_segment_ids"),NO_MATCHING_TUTORIALS:errorPrefix("no_matching_tutorials"),NO_VALID_TUTORIAL_IDENTIFIER:errorPrefix("no_valid_tutorial_identifier"),COMMIT_API_LOADING_ERROR:errorPrefix("commit_api"),TUTORIAL_LOADING_ERROR:errorPrefix("tutorial"),UNKOWN_NODE_TYPE:errorPrefix(ERROR_SLUGS.UNKOWN_NODE_TYPE),UNKOWN_INLINE_NODE_TYPE:errorPrefix(ERROR_SLUGS.UNKOWN_INLINE_NODE_TYPE),UNKOWN_NODE_OBJECT_TYPE:errorPrefix(ERROR_SLUGS.UNKOWN_NODE_OBJECT_TYPE),TUTORIAL_ERROR:errorPrefix(ERROR_SLUGS.TUTORIAL_ERROR),PORTAL_ERROR:errorPrefix(ERROR_SLUGS.PORTAL_ERROR),STYLEGUIDE_MAP_ERROR:errorPrefix(ERROR_SLUGS.TUTORIAL_ERROR),RENDER_NODE_ERROR:errorPrefix(ERROR_SLUGS.TUTORIAL_ERROR),CIRCULAR_DEPENDENCY_EMBED_PORTAL:errorPrefix("circular_dependecy_embed_portal"),CIRCULAR_DEPENDENCY_EMBED_TUTORIAL:errorPrefix("circular_dependecy_embed_tutorial")},PORTAL_ASSET_NOT_FOUND="Could not find the requested Portal. This could happen because:\n1. The Portal does not exist or it was deleted.\n2. The Portal has not been made avaliable to be rendered.\n3. CORS Authenticaton failed.\nSee http://udn.ac/portal-not-found for more information.\n",unknownMessage=e=>`An error has occured while trying to parse your Tutorial.\nUpgrade the SDK to the latest version to get rid of this error.\nErrorCode: ${e}.`,EVENTING_NOT_INITIALIZED="You tried to send an event, but you haven't initialized eventing.\nThis is happening because you called eventing outside the scope of the CanduProvider. It can be fixed by:\n1. Adding CanduProvider to the root of the application.\n2. Initializing a new Eventing object outside of Candu.\nRead here for more context: http://udn.ac/tracking-not-init.\n",PORTAL_NO_SEGMENT_IDS="You have tried to render a Portal that doesn't contain any content.\nAdd content to your Portal: https://udn.ac/update-portals.\n",NO_MATCHING_TUTORIALS="The Tutorial will not be rendered because there are no matching segments for the given user.",ERROR_MESSAGES={EVENTING_NOT_INITIALIZED:EVENTING_NOT_INITIALIZED,[EVENT_NAMES.PORTAL_ASSET_NOT_FOUND]:PORTAL_ASSET_NOT_FOUND,[EVENT_NAMES.PORTAL_NO_SEGMENT_IDS]:PORTAL_NO_SEGMENT_IDS,[EVENT_NAMES.NO_MATCHING_TUTORIALS]:NO_MATCHING_TUTORIALS,[EVENT_NAMES.NO_VALID_TUTORIAL_IDENTIFIER]:"(Candu/Tutorial) You must define one of tutorialId, slug, commitId or contentHashId.",[EVENT_NAMES.TUTORIAL_LOADING_ERROR]:"An error has occurred while trying to load the Tutorial",[EVENT_NAMES.UNKOWN_INLINE_NODE_TYPE]:unknownMessage(ERROR_SLUGS.UNKOWN_INLINE_NODE_TYPE),[EVENT_NAMES.UNKOWN_NODE_TYPE]:unknownMessage(ERROR_SLUGS.UNKOWN_NODE_TYPE),[EVENT_NAMES.CIRCULAR_DEPENDENCY_EMBED_PORTAL]:"Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",[EVENT_NAMES.CIRCULAR_DEPENDENCY_EMBED_TUTORIAL]:"Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",[EVENT_NAMES.PORTAL_ERROR]:"An error has occured within Portal",[EVENT_NAMES.TUTORIAL_ERROR]:"An error has occured within Tutorial",[EVENT_NAMES.RENDER_NODE_ERROR]:"An error has occured while rendering tutorial node",[EVENT_NAMES.STYLEGUIDE_MAP_ERROR]:"An error has occured while mapping node to styleguide"},defaultStyleguide={Alert:!0,B:!0,Badge:!0,Button:!0,Card:!0,Code:!0,Document:!0,Em:!0,EmbedPortal:!0,EmbedTutorial:!0,Flex:!0,FlexItem:!0,H1:!0,H2:!0,H3:!0,H4:!0,H5:!0,H6:!0,Image:!0,InlineCode:!0,Link:!0,List:!0,ListItem:!0,P:!0,RichText:!0,Spacing:!0,Text:!0,U:!0,View:!0,Player:!0},trackStyleguideProperties=e=>{const t={};return Object.keys(e).forEach(r=>{defaultStyleguide[r]&&(t[`styleguide.${r}`]=e[r].displayName||!0)}),t},LOGGER={error:console.error,warning:console.warn},internalEventing=({identify:e,track:t})=>({provider:({userId:r,traits:a,styleguide:o})=>{e(r,a),t(EVENT_NAMES.HEARTBEAT,trackStyleguideProperties(o))},tutorialDocumentLoadingError:({tutorialId:e,slug:r,contentHashId:a})=>{LOGGER.error(ERROR_MESSAGES[EVENT_NAMES.TUTORIAL_LOADING_ERROR]),t(EVENT_NAMES.TUTORIAL_LOADING_ERROR,{tutorialId:e,slug:r,contentHashId:a})}});for(var rng=function(){return crypto.randomBytes(16)},byteToHex=[],i=0;i<256;++i)byteToHex[i]=(i+256).toString(16).substr(1);function bytesToUuid(e,t){var r=t||0,a=byteToHex;return[a[e[r++]],a[e[r++]],a[e[r++]],a[e[r++]],"-",a[e[r++]],a[e[r++]],"-",a[e[r++]],a[e[r++]],"-",a[e[r++]],a[e[r++]],"-",a[e[r++]],a[e[r++]],a[e[r++]],a[e[r++]],a[e[r++]],a[e[r++]]].join("")}var bytesToUuid_1=bytesToUuid;function v4(e,t,r){var a=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||rng)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var n=0;n<16;++n)t[a+n]=o[n];return t||bytesToUuid_1(o)}var Source,EventType,v4_1=v4;!function(e){e.UserGenerated="UserGenerated",e.SDK="SDK"}(Source||(Source={})),function(e){e.Identify="Identify",e.Group="Group",e.Track="Track",e.Page="Page",e.Screen="Screen"}(EventType||(EventType={}));const ANONYMOUS_ID_STORAGE_KEY="candu:anonymous_id",hasStorage=()=>"undefined"!=typeof window&&window.localStorage,get$1=e=>()=>{if(hasStorage()){const t=window.localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(e){return null}}},getOrCreate=(e,t)=>()=>get$1(e)()||t(),set=e=>t=>{hasStorage()&&null!=t&&window.localStorage.setItem(e,JSON.stringify(t))};var storage={anonymousId:{getOrCreate:getOrCreate("candu:anonymous_id",()=>{const e=v4_1();return set("candu:anonymous_id")(e),e}),set:set("candu:anonymous_id")}};const getAnonymousId=storage.anonymousId.getOrCreate;var commonjsGlobal$1="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},freeGlobal$1="object"==typeof commonjsGlobal$1&&commonjsGlobal$1&&commonjsGlobal$1.Object===Object&&commonjsGlobal$1,_freeGlobal$1=freeGlobal$1,freeSelf$1="object"==typeof self&&self&&self.Object===Object&&self,root$1=_freeGlobal$1||freeSelf$1||Function("return this")(),_root$1=root$1,Symbol$1=_root$1.Symbol,_Symbol$1=Symbol$1,objectProto$c=Object.prototype,hasOwnProperty$9=objectProto$c.hasOwnProperty,nativeObjectToString$2=objectProto$c.toString,symToStringTag$2=_Symbol$1?_Symbol$1.toStringTag:void 0;function getRawTag$1(e){var t=hasOwnProperty$9.call(e,symToStringTag$2),r=e[symToStringTag$2];try{e[symToStringTag$2]=void 0;var a=!0}catch(e){}var o=nativeObjectToString$2.call(e);return a&&(t?e[symToStringTag$2]=r:delete e[symToStringTag$2]),o}var _getRawTag$1=getRawTag$1,objectProto$1$1=Object.prototype,nativeObjectToString$1$1=objectProto$1$1.toString;function objectToString$1(e){return nativeObjectToString$1$1.call(e)}var _objectToString$1=objectToString$1,nullTag$1="[object Null]",undefinedTag$1="[object Undefined]",symToStringTag$1$1=_Symbol$1?_Symbol$1.toStringTag:void 0;function baseGetTag$1(e){return null==e?void 0===e?undefinedTag$1:nullTag$1:symToStringTag$1$1&&symToStringTag$1$1 in Object(e)?_getRawTag$1(e):_objectToString$1(e)}var _baseGetTag$1=baseGetTag$1,isArray$1=Array.isArray,isArray_1$1=isArray$1;function isObjectLike$1(e){return null!=e&&"object"==typeof e}var isObjectLike_1$1=isObjectLike$1,stringTag$2="[object String]";function isString(e){return"string"==typeof e||!isArray_1$1(e)&&isObjectLike_1$1(e)&&_baseGetTag$1(e)==stringTag$2}var isString_1=isString,numberTag$2="[object Number]";function isNumber(e){return"number"==typeof e||isObjectLike_1$1(e)&&_baseGetTag$1(e)==numberTag$2}var isNumber_1=isNumber;const identifierRegex=/^([a-zA-Z0-9]|_|-)+$/,isIdentifier=e=>isString_1(e)&&e.length>=3&&e.length<100&&identifierRegex.test(e),IsNumericId=e=>isNumber_1(e)&&e>=0,isClientToken=e=>isString_1(e)&&!!e.match(/^[0-9a-zA-Z]*$/)&&e.length>=10,isUserId=e=>IsNumericId(e)||isString_1(e)&&e.trim().length>0;var ACTORS,MESSAGES,TRIGGERS,CATEGORIES,HANDLER_TYPES,COLORS;!function(e){e.SDK="SDK",e.PREVIEW="PREVIEW"}(ACTORS||(ACTORS={})),function(e){e.BOOTSTRAP="Bootstrap",e.CHANGE_POSITION="ChangePosition",e.CLOSE_PREVIEW="ClosePreview",e.PREVIEW_LOADED="PreviewLoaded",e.SET_AVALIABLE_PORTALS="SetAvaliablePortals",e.SET_CONTENT="SetContent",e.SET_SELECTED_ELEMENT="SetSelectedElement",e.SET_VIEW_MODE="SetViewMode",e.ADD_ELEMENT="AddElement",e.REMOVE_ELEMENT="RemoveElement",e.UPDATE_ELEMENT="UpdateElement",e.SET_ELEMENT="SetElement"}(MESSAGES||(MESSAGES={})),function(e){e.ON_CLICK="OnClick"}(TRIGGERS||(TRIGGERS={})),function(e){e.NATIVE="Native",e.PENDO="Pendo"}(CATEGORIES||(CATEGORIES={})),function(e){e.NAVIGATE="Navigate",e.CHANGE_TUTORIAL="ChangeTutorial",e.OPEN_GUIDE="OpenGuide"}(HANDLER_TYPES||(HANDLER_TYPES={})),function(e){e.PRIMARY="primary",e.SECONDARY="primary",e.WARNING="warning",e.DANGER="danger",e.NEUTRAL="neutral",e.ACTIVE="active",e.INFO="info"}(COLORS||(COLORS={}));const DEFAULT_COLOR=COLORS.PRIMARY;var Mark;!function(e){e.U="U",e.B="B",e.Em="Em",e.InlineCode="InlineCode"}(Mark||(Mark={}));const isContentHashId=e=>isString_1(e)&&!!e.match(/^[0-9a-zA-Z]{40}$/),isTutorialId=e=>IsNumericId(e),isTutorialSlug=e=>isIdentifier(e);var FRAME_SIZES,PREVIEW_MODES,StyleguideScope,CSSNodeTypes;!function(e){e.COLLAPSED="Collapsed",e.EXPANDED="Expanded",e.MINIMIZED="Minimized"}(FRAME_SIZES||(FRAME_SIZES={})),function(e){e.TUTORIAL="Tutorial",e.PORTAL="Portal"}(PREVIEW_MODES||(PREVIEW_MODES={})),function(e){e.Global="Global",e.Organization="Organization"}(StyleguideScope||(StyleguideScope={})),function(e){e.Root="root",e.Rule="rule",e.Atrule="atrule",e.Decl="decl",e.Any="any"}(CSSNodeTypes||(CSSNodeTypes={}));var invariant=function(e,t,r,a,o,n,i,s){if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var _=[r,a,o,n,i,s],u=0;(c=new Error(t.replace(/%s/g,(function(){return _[u++]})))).name="Invariant Violation"}throw c.framesToPop=1,c}},invariant_1=invariant;const isValidStyleguideProps=e=>invariant_1(!e||isObject_1(e),"(Candu) styleguide must be undefined or an object"),providerValidation=({clientToken:e,userId:t,traits:r,options:a,styleguide:o,...n})=>(invariant_1(isClientToken(e),"(Candu) you must provide a valid clientToken"),invariant_1(!t||isUserId(t),"(Candu) you must provide a valid userId"),isValidStyleguideProps(o),invariant_1(!r||isObject_1(r),"(Candu) traits must be undefined or an object"),invariant_1(!a||isObject_1(a),"(Candu) options must be undefined or an object"),{...n,clientToken:e,traits:r||{},options:a||{},styleguide:o||{},userId:t||getAnonymousId()}),tutorialValidation=({slug:e,styleguide:t,contentHashId:r,tutorialId:a,tutorialDocument:o,...n})=>(isValidStyleguideProps(t),{...n,slug:e,styleguide:t||{},contentHashId:r,tutorialId:a,tutorialDocument:o}),portalValidation=({slug:e,styleguide:t})=>(isValidStyleguideProps(t),{slug:e,styleguide:t||{}}),API_BASE_URL="https://api.candu.ai",CDN_BASE_URL="https://cdn.candu.ai",VERSION="0.5.2";var injections=Object.freeze({__proto__:null,API_BASE_URL:API_BASE_URL,CDN_BASE_URL:CDN_BASE_URL,VERSION:"0.5.2"});const{API_BASE_URL:API_BASE_URL$1}=injections,{CDN_BASE_URL:CDN_BASE_URL$1}=injections,ENDPOINTS={segmentMembership:"/api/segmentMemberships",tutorialDocuments:"/api/tutorialDocumentsEditor"},fetchURL=async e=>(await fetch(e)).json(),fetchFromApi=e=>fetchURL(`${API_BASE_URL$1}${e}`),fetchFromCdn=e=>fetchURL(`${CDN_BASE_URL$1}${e}`),getTutorialDocument=e=>({byId:t=>fetchFromApi(`${ENDPOINTS.tutorialDocuments}/${t}?token=${e}`),bySlug:t=>fetchFromCdn(`/tutorials/${e}/${t}.json`),byContentHash:t=>fetchFromCdn(`/tutorials/${e}/${t}.json`)}),RESOURCES={tutorialDocumentLatestPublished:async(e,t)=>fetchFromApi(`${ENDPOINTS.tutorialDocuments}?token=${e}&finder=latestPublished&tutorialId=${t}`),portalAsset:async(e,t)=>fetchFromCdn(`/portals/${e}/${t}/head.json`),segmentMembership:async(e,t)=>fetchFromApi(`${ENDPOINTS.segmentMembership}/${t}?token=${e}`),tutorialDocument:(e,t,r)=>{const{contentHashId:a,tutorialId:o,tutorialDocument:n,slug:i}=e,s=getTutorialDocument(t);return isTutorialId(o)?s.byId(o):isTutorialSlug(i)?s.bySlug(i):isContentHashId(a)?s.byContentHash(a):isObject_1(n)?Promise.resolve(n):(LOGGER.error(ERROR_MESSAGES[EVENT_NAMES.NO_VALID_TUTORIAL_IDENTIFIER]),r.track(EVENT_NAMES.NO_VALID_TUTORIAL_IDENTIFIER,{slug:e.slug}),null)}},logError=(...e)=>console.error(...e),logWarning=(...e)=>console.warn(...e),logger={error:logError,warning:logWarning},getEventHandler=e=>{switch(e.trigger){case TRIGGERS.ON_CLICK:default:return"onClick"}},getActionHandler=(e,t)=>{switch(e.handler.type){case HANDLER_TYPES.NAVIGATE:return{[getEventHandler(e)]:()=>{const{href:r,target:a}=e.handler;t(e),"Blank"===a?window.open(r,"_blank"):r&&r.includes("mailto:")?window.location=r:document.location.href=r}};case HANDLER_TYPES.CHANGE_TUTORIAL:return{[getEventHandler(e)]:()=>{const{tutorialId:t}=e.handler;logError("TODO -> change tutorial",t)}};case HANDLER_TYPES.OPEN_GUIDE:return{[getEventHandler(e)]:()=>{const{guideId:t}=e.handler;logError("TODO -> open guide",t)}};default:return{}}},getActionHandlers=({data:e},t)=>{if(!e||!e.actions)return{};const r=e=>{t.provider.eventing.track(EVENT_NAMES.TUTORIAL_INTERACTION,{...e,...t.trackingIdentifiers||{}})};return e.actions.map(e=>getActionHandler(e,r)).reduce((e,t)=>({...e,...t}),{})},mapNodeToStyleguide=(e,t)=>{try{const{provider:r,document:a,trackingIdentifiers:o}=t,n=a.nodes[e];if(!n)return logger.error("Document is corrupted. Refusing to move further."),null;const i=e=>mapNodeToStyleguide(e,t),{type:s,props:c,css:_}=n,u={...c||{},style:_||{},children:(c||{}).children||n.nodes&&n.nodes.map(i),...getActionHandlers(n,{trackingIdentifiers:o,provider:r})},l={nodeId:e,node:n,document:a,render:{node:i,styleguide:(e,r={})=>t.renderNode(e,{api:l,attributes:r}),tutorial:e=>t.renderTutorial(e),portal:e=>t.renderPortal(e)},trackingIdentifiers:o},g=l.render.styleguide(s,u);return g||(logger.error(ERROR_MESSAGES[EVENT_NAMES.UNKOWN_NODE_TYPE],{type:s}),r.eventing.track(EVENT_NAMES.UNKOWN_NODE_TYPE,{type:s}),null)}catch(e){return logger.error(ERROR_MESSAGES[EVENT_NAMES.STYLEGUIDE_MAP_ERROR],e),null}},mergeStyleguidesFromContext=memoize_1((e,t)=>{const{provider:r,portal:a,tutorial:o}=e,n=r.styleguide;let i,s;return o&&(s=o.styleguide),a&&(i=a.styleguide),{...n||{},...i||{},...s||{},...t||{}}}),DEFAULT_ALT="",DEFAULT_ALERT_COLOR="#EDEDED",DEFAULT_TAB_HEADER_COLOR="#333745",DEFAULT_TAB_ITEM_COLOR="#838792",DEFAULT_TAB_ACTIVE_COLOR="#FEFEFE",DEFAULT_TAB_COLOR="#FEFEFE",STYLEGUIDE_COLORS={primary:"#6310E5",secondary:"#59C3C3",tertiary:"#4D515D",warning:"#FCAD0D",danger:"#EE4266"},attachStylesheet=e=>{const t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",`${CDN_BASE_URL$1}/styleguides/applications/${e}/default/main.css`),document.head.appendChild(t)};exports.DEFAULT_ALERT_COLOR="#EDEDED",exports.DEFAULT_ALT="",exports.DEFAULT_TAB_ACTIVE_COLOR="#FEFEFE",exports.DEFAULT_TAB_COLOR="#FEFEFE",exports.DEFAULT_TAB_HEADER_COLOR="#333745",exports.DEFAULT_TAB_ITEM_COLOR="#838792",exports.ERROR_MESSAGES=ERROR_MESSAGES,exports.ERROR_SLUGS=ERROR_SLUGS,exports.EVENT_NAMES=EVENT_NAMES,exports.LOGGER=LOGGER,exports.RESOURCES=RESOURCES,exports.STYLEGUIDE_COLORS=STYLEGUIDE_COLORS,exports.adaptCustomNodes=adaptCustomNodes,exports.attachStylesheet=attachStylesheet,exports.convertStyleNumberValues=convertStyleNumberValues,exports.defaultStyleguide=defaultStyleguide,exports.internalEventing=internalEventing,exports.logError=logError,exports.logWarning=logWarning,exports.logger=logger,exports.mapNodeToStyleguide=mapNodeToStyleguide,exports.mergeStyleguidesFromContext=mergeStyleguidesFromContext,exports.portalValidation=portalValidation,exports.providerValidation=providerValidation,exports.tutorialValidation=tutorialValidation,exports.unpackShorthandStyles=unpackShorthandStyles; | ||
//# sourceMappingURL=index.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
import{isNumber as t}from"util";import e from"crypto";var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(t,e){return t(e={exports:{}},e.exports),e.exports}var o="object"==typeof r&&r&&r.Object===Object&&r,a="object"==typeof self&&self&&self.Object===Object&&self,i=o||a||Function("return this")(),u=i.Symbol,c=Object.prototype,l=c.hasOwnProperty,s=c.toString,d=u?u.toStringTag:void 0;var f=function(t){var e=l.call(t,d),r=t[d];try{t[d]=void 0;var n=!0}catch(t){}var o=s.call(t);return n&&(e?t[d]=r:delete t[d]),o},_=Object.prototype.toString;var p=function(t){return _.call(t)},v="[object Null]",h="[object Undefined]",y=u?u.toStringTag:void 0;var b=function(t){return null==t?void 0===t?h:v:y&&y in Object(t)?f(t):p(t)};var E=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},g="[object AsyncFunction]",O="[object Function]",T="[object GeneratorFunction]",R="[object Proxy]";var I,A=function(t){if(!E(t))return!1;var e=b(t);return e==O||e==T||e==g||e==R},N=i["__core-js_shared__"],m=(I=/[^.]+$/.exec(N&&N.keys&&N.keys.IE_PROTO||""))?"Symbol(src)_1."+I:"";var j=function(t){return!!m&&m in t},P=Function.prototype.toString;var D=function(t){if(null!=t){try{return P.call(t)}catch(t){}try{return t+""}catch(t){}}return""},w=/^\[object .+?Constructor\]$/,L=Function.prototype,S=Object.prototype,C=L.toString,U=S.hasOwnProperty,k=RegExp("^"+C.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var B=function(t){return!(!E(t)||j(t))&&(A(t)?k:w).test(D(t))};var z=function(t,e){return null==t?void 0:t[e]};var M=function(t,e){var r=z(t,e);return B(r)?r:void 0},$=function(){try{var t=M(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var x=function(t,e,r){"__proto__"==e&&$?$(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r};var W=function(t){return function(e,r,n){for(var o=-1,a=Object(e),i=n(e),u=i.length;u--;){var c=i[t?u:++o];if(!1===r(a[c],c,a))break}return e}}();var G=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n};var Y=function(t){return null!=t&&"object"==typeof t},F="[object Arguments]";var V=function(t){return Y(t)&&b(t)==F},K=Object.prototype,H=K.hasOwnProperty,J=K.propertyIsEnumerable,Z=V(function(){return arguments}())?V:function(t){return Y(t)&&H.call(t,"callee")&&!J.call(t,"callee")},q=Array.isArray;var X=function(){return!1},Q=n((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r?i.Buffer:void 0,a=(o?o.isBuffer:void 0)||X;t.exports=a})),tt=9007199254740991,et=/^(?:0|[1-9]\d*)$/;var rt=function(t,e){var r=typeof t;return!!(e=null==e?tt:e)&&("number"==r||"symbol"!=r&&et.test(t))&&t>-1&&t%1==0&&t<e},nt=9007199254740991;var ot=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=nt},at={};at["[object Float32Array]"]=at["[object Float64Array]"]=at["[object Int8Array]"]=at["[object Int16Array]"]=at["[object Int32Array]"]=at["[object Uint8Array]"]=at["[object Uint8ClampedArray]"]=at["[object Uint16Array]"]=at["[object Uint32Array]"]=!0,at["[object Arguments]"]=at["[object Array]"]=at["[object ArrayBuffer]"]=at["[object Boolean]"]=at["[object DataView]"]=at["[object Date]"]=at["[object Error]"]=at["[object Function]"]=at["[object Map]"]=at["[object Number]"]=at["[object Object]"]=at["[object RegExp]"]=at["[object Set]"]=at["[object String]"]=at["[object WeakMap]"]=!1;var it=function(t){return Y(t)&&ot(t.length)&&!!at[b(t)]};var ut=function(t){return function(e){return t(e)}},ct=n((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,a=n&&n.exports===r&&o.process,i=function(){try{var t=n&&n.require&&n.require("util").types;return t||a&&a.binding&&a.binding("util")}catch(t){}}();t.exports=i})),lt=ct&&ct.isTypedArray,st=lt?ut(lt):it,dt=Object.prototype.hasOwnProperty;var ft=function(t,e){var r=q(t),n=!r&&Z(t),o=!r&&!n&&Q(t),a=!r&&!n&&!o&&st(t),i=r||n||o||a,u=i?G(t.length,String):[],c=u.length;for(var l in t)!e&&!dt.call(t,l)||i&&("length"==l||o&&("offset"==l||"parent"==l)||a&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||rt(l,c))||u.push(l);return u},_t=Object.prototype;var pt=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||_t)};var vt=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),ht=Object.prototype.hasOwnProperty;var yt=function(t){if(!pt(t))return vt(t);var e=[];for(var r in Object(t))ht.call(t,r)&&"constructor"!=r&&e.push(r);return e};var bt=function(t){return null!=t&&ot(t.length)&&!A(t)};var Et=function(t){return bt(t)?ft(t):yt(t)};var gt=function(t,e){return t&&W(t,e,Et)};var Ot=function(){this.__data__=[],this.size=0};var Tt=function(t,e){return t===e||t!=t&&e!=e};var Rt=function(t,e){for(var r=t.length;r--;)if(Tt(t[r][0],e))return r;return-1},It=Array.prototype.splice;var At=function(t){var e=this.__data__,r=Rt(e,t);return!(r<0)&&(r==e.length-1?e.pop():It.call(e,r,1),--this.size,!0)};var Nt=function(t){var e=this.__data__,r=Rt(e,t);return r<0?void 0:e[r][1]};var mt=function(t){return Rt(this.__data__,t)>-1};var jt=function(t,e){var r=this.__data__,n=Rt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function Pt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Pt.prototype.clear=Ot,Pt.prototype.delete=At,Pt.prototype.get=Nt,Pt.prototype.has=mt,Pt.prototype.set=jt;var Dt=Pt;var wt=function(){this.__data__=new Dt,this.size=0};var Lt=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};var St=function(t){return this.__data__.get(t)};var Ct=function(t){return this.__data__.has(t)},Ut=M(i,"Map"),kt=M(Object,"create");var Bt=function(){this.__data__=kt?kt(null):{},this.size=0};var zt=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Mt="__lodash_hash_undefined__",$t=Object.prototype.hasOwnProperty;var xt=function(t){var e=this.__data__;if(kt){var r=e[t];return r===Mt?void 0:r}return $t.call(e,t)?e[t]:void 0},Wt=Object.prototype.hasOwnProperty;var Gt=function(t){var e=this.__data__;return kt?void 0!==e[t]:Wt.call(e,t)},Yt="__lodash_hash_undefined__";var Ft=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=kt&&void 0===e?Yt:e,this};function Vt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Vt.prototype.clear=Bt,Vt.prototype.delete=zt,Vt.prototype.get=xt,Vt.prototype.has=Gt,Vt.prototype.set=Ft;var Kt=Vt;var Ht=function(){this.size=0,this.__data__={hash:new Kt,map:new(Ut||Dt),string:new Kt}};var Jt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Zt=function(t,e){var r=t.__data__;return Jt(e)?r["string"==typeof e?"string":"hash"]:r.map};var qt=function(t){var e=Zt(this,t).delete(t);return this.size-=e?1:0,e};var Xt=function(t){return Zt(this,t).get(t)};var Qt=function(t){return Zt(this,t).has(t)};var te=function(t,e){var r=Zt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function ee(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}ee.prototype.clear=Ht,ee.prototype.delete=qt,ee.prototype.get=Xt,ee.prototype.has=Qt,ee.prototype.set=te;var re=ee,ne=200;var oe=function(t,e){var r=this.__data__;if(r instanceof Dt){var n=r.__data__;if(!Ut||n.length<ne-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new re(n)}return r.set(t,e),this.size=r.size,this};function ae(t){var e=this.__data__=new Dt(t);this.size=e.size}ae.prototype.clear=wt,ae.prototype.delete=Lt,ae.prototype.get=St,ae.prototype.has=Ct,ae.prototype.set=oe;var ie=ae,ue="__lodash_hash_undefined__";var ce=function(t){return this.__data__.set(t,ue),this};var le=function(t){return this.__data__.has(t)};function se(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new re;++e<r;)this.add(t[e])}se.prototype.add=se.prototype.push=ce,se.prototype.has=le;var de=se;var fe=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1};var _e=function(t,e){return t.has(e)},pe=1,ve=2;var he=function(t,e,r,n,o,a){var i=r&pe,u=t.length,c=e.length;if(u!=c&&!(i&&c>u))return!1;var l=a.get(t);if(l&&a.get(e))return l==e;var s=-1,d=!0,f=r&ve?new de:void 0;for(a.set(t,e),a.set(e,t);++s<u;){var _=t[s],p=e[s];if(n)var v=i?n(p,_,s,e,t,a):n(_,p,s,t,e,a);if(void 0!==v){if(v)continue;d=!1;break}if(f){if(!fe(e,(function(t,e){if(!_e(f,e)&&(_===t||o(_,t,r,n,a)))return f.push(e)}))){d=!1;break}}else if(_!==p&&!o(_,p,r,n,a)){d=!1;break}}return a.delete(t),a.delete(e),d},ye=i.Uint8Array;var be=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r};var Ee=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r},ge=1,Oe=2,Te="[object Boolean]",Re="[object Date]",Ie="[object Error]",Ae="[object Map]",Ne="[object Number]",me="[object RegExp]",je="[object Set]",Pe="[object String]",De="[object Symbol]",we="[object ArrayBuffer]",Le="[object DataView]",Se=u?u.prototype:void 0,Ce=Se?Se.valueOf:void 0;var Ue=function(t,e,r,n,o,a,i){switch(r){case Le:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case we:return!(t.byteLength!=e.byteLength||!a(new ye(t),new ye(e)));case Te:case Re:case Ne:return Tt(+t,+e);case Ie:return t.name==e.name&&t.message==e.message;case me:case Pe:return t==e+"";case Ae:var u=be;case je:var c=n≥if(u||(u=Ee),t.size!=e.size&&!c)return!1;var l=i.get(t);if(l)return l==e;n|=Oe,i.set(t,e);var s=he(u(t),u(e),n,o,a,i);return i.delete(t),s;case De:if(Ce)return Ce.call(t)==Ce.call(e)}return!1};var ke=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t};var Be=function(t,e,r){var n=e(t);return q(t)?n:ke(n,r(t))};var ze=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,a=[];++r<n;){var i=t[r];e(i,r,t)&&(a[o++]=i)}return a};var Me=function(){return[]},$e=Object.prototype.propertyIsEnumerable,xe=Object.getOwnPropertySymbols,We=xe?function(t){return null==t?[]:(t=Object(t),ze(xe(t),(function(e){return $e.call(t,e)})))}:Me;var Ge=function(t){return Be(t,Et,We)},Ye=1,Fe=Object.prototype.hasOwnProperty;var Ve=function(t,e,r,n,o,a){var i=r&Ye,u=Ge(t),c=u.length;if(c!=Ge(e).length&&!i)return!1;for(var l=c;l--;){var s=u[l];if(!(i?s in e:Fe.call(e,s)))return!1}var d=a.get(t);if(d&&a.get(e))return d==e;var f=!0;a.set(t,e),a.set(e,t);for(var _=i;++l<c;){var p=t[s=u[l]],v=e[s];if(n)var h=i?n(v,p,s,e,t,a):n(p,v,s,t,e,a);if(!(void 0===h?p===v||o(p,v,r,n,a):h)){f=!1;break}_||(_="constructor"==s)}if(f&&!_){var y=t.constructor,b=e.constructor;y!=b&&"constructor"in t&&"constructor"in e&&!("function"==typeof y&&y instanceof y&&"function"==typeof b&&b instanceof b)&&(f=!1)}return a.delete(t),a.delete(e),f},Ke=M(i,"DataView"),He=M(i,"Promise"),Je=M(i,"Set"),Ze=M(i,"WeakMap"),qe=D(Ke),Xe=D(Ut),Qe=D(He),tr=D(Je),er=D(Ze),rr=b;(Ke&&"[object DataView]"!=rr(new Ke(new ArrayBuffer(1)))||Ut&&"[object Map]"!=rr(new Ut)||He&&"[object Promise]"!=rr(He.resolve())||Je&&"[object Set]"!=rr(new Je)||Ze&&"[object WeakMap]"!=rr(new Ze))&&(rr=function(t){var e=b(t),r="[object Object]"==e?t.constructor:void 0,n=r?D(r):"";if(n)switch(n){case qe:return"[object DataView]";case Xe:return"[object Map]";case Qe:return"[object Promise]";case tr:return"[object Set]";case er:return"[object WeakMap]"}return e});var nr=rr,or=1,ar="[object Arguments]",ir="[object Array]",ur="[object Object]",cr=Object.prototype.hasOwnProperty;var lr=function(t,e,r,n,o,a){var i=q(t),u=q(e),c=i?ir:nr(t),l=u?ir:nr(e),s=(c=c==ar?ur:c)==ur,d=(l=l==ar?ur:l)==ur,f=c==l;if(f&&Q(t)){if(!Q(e))return!1;i=!0,s=!1}if(f&&!s)return a||(a=new ie),i||st(t)?he(t,e,r,n,o,a):Ue(t,e,c,r,n,o,a);if(!(r&or)){var _=s&&cr.call(t,"__wrapped__"),p=d&&cr.call(e,"__wrapped__");if(_||p){var v=_?t.value():t,h=p?e.value():e;return a||(a=new ie),o(v,h,r,n,a)}}return!!f&&(a||(a=new ie),Ve(t,e,r,n,o,a))};var sr=function t(e,r,n,o,a){return e===r||(null==e||null==r||!Y(e)&&!Y(r)?e!=e&&r!=r:lr(e,r,n,o,t,a))},dr=1,fr=2;var _r=function(t,e,r,n){var o=r.length,a=o,i=!n;if(null==t)return!a;for(t=Object(t);o--;){var u=r[o];if(i&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<a;){var c=(u=r[o])[0],l=t[c],s=u[1];if(i&&u[2]){if(void 0===l&&!(c in t))return!1}else{var d=new ie;if(n)var f=n(l,s,c,t,e,d);if(!(void 0===f?sr(s,l,dr|fr,n,d):f))return!1}}return!0};var pr=function(t){return t==t&&!E(t)};var vr=function(t){for(var e=Et(t),r=e.length;r--;){var n=e[r],o=t[n];e[r]=[n,o,pr(o)]}return e};var hr=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}};var yr=function(t){var e=vr(t);return 1==e.length&&e[0][2]?hr(e[0][0],e[0][1]):function(r){return r===t||_r(r,t,e)}},br="[object Symbol]";var Er=function(t){return"symbol"==typeof t||Y(t)&&b(t)==br},gr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Or=/^\w*$/;var Tr=function(t,e){if(q(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!Er(t))||(Or.test(t)||!gr.test(t)||null!=e&&t in Object(e))},Rr="Expected a function";function Ir(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(Rr);var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=t.apply(this,n);return r.cache=a.set(o,i)||a,i};return r.cache=new(Ir.Cache||re),r}Ir.Cache=re;var Ar=Ir,Nr=500;var mr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,jr=/\\(\\)?/g,Pr=function(t){var e=Ar(t,(function(t){return r.size===Nr&&r.clear(),t})),r=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(mr,(function(t,r,n,o){e.push(n?o.replace(jr,"$1"):r||t)})),e}));var Dr=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o},wr=1/0,Lr=u?u.prototype:void 0,Sr=Lr?Lr.toString:void 0;var Cr=function t(e){if("string"==typeof e)return e;if(q(e))return Dr(e,t)+"";if(Er(e))return Sr?Sr.call(e):"";var r=e+"";return"0"==r&&1/e==-wr?"-0":r};var Ur=function(t){return null==t?"":Cr(t)};var kr=function(t,e){return q(t)?t:Tr(t,e)?[t]:Pr(Ur(t))},Br=1/0;var zr=function(t){if("string"==typeof t||Er(t))return t;var e=t+"";return"0"==e&&1/t==-Br?"-0":e};var Mr=function(t,e){for(var r=0,n=(e=kr(e,t)).length;null!=t&&r<n;)t=t[zr(e[r++])];return r&&r==n?t:void 0};var $r=function(t,e,r){var n=null==t?void 0:Mr(t,e);return void 0===n?r:n};var xr=function(t,e){return null!=t&&e in Object(t)};var Wr=function(t,e,r){for(var n=-1,o=(e=kr(e,t)).length,a=!1;++n<o;){var i=zr(e[n]);if(!(a=null!=t&&r(t,i)))break;t=t[i]}return a||++n!=o?a:!!(o=null==t?0:t.length)&&ot(o)&&rt(i,o)&&(q(t)||Z(t))};var Gr=function(t,e){return null!=t&&Wr(t,e,xr)},Yr=1,Fr=2;var Vr=function(t,e){return Tr(t)&&pr(e)?hr(zr(t),e):function(r){var n=$r(r,t);return void 0===n&&n===e?Gr(r,t):sr(e,n,Yr|Fr)}};var Kr=function(t){return t};var Hr=function(t){return function(e){return null==e?void 0:e[t]}};var Jr=function(t){return function(e){return Mr(e,t)}};var Zr=function(t){return Tr(t)?Hr(zr(t)):Jr(t)};var qr=function(t){return"function"==typeof t?t:null==t?Kr:"object"==typeof t?q(t)?Vr(t[0],t[1]):yr(t):Zr(t)};var Xr=function(t,e){var r={};return e=qr(e),gt(t,(function(t,n,o){x(r,n,e(t,n,o))})),r},Qr={boxFlex:!0,boxFlexGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0};var tn=["Webkit","ms","Moz","O"];Object.keys(Qr).forEach((function(t){tn.forEach((function(e){Qr[function(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}(e,t)]=Qr[t]}))}));var en={isUnitlessNumber:Qr,shorthandPropertyExpansions:{background:{backgroundImage:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundColor:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0}}};const rn=t=>{const{padding:e,margin:r,...n}=t.css;let o={};return e&&(o={paddingRight:e,paddingLeft:e,paddingBottom:e,paddingTop:e}),r&&(o={...o,marginRight:r,marginLeft:r,marginBottom:r,marginTop:r}),{...t,css:{...o,...n}}},nn=e=>{const r=e.css,n={};return Object.entries(r).forEach(([e,r])=>{if(t(r))return en.isUnitlessNumber[e]?void(n[e]=`${r}`):void(n[e]=`${r}px`);n[e]=r}),{...e,css:n}},on=t=>Xr(t,t=>{let e=t;return"Typography"===e.type&&(e=(t=>{const e=$r(t,"data.custom.variant","P");return{...t,type:e}})(e)),e.css&&"flexBasis"in e.css&&(e=(t=>{const{flexBasis:e}=t.css;return"0"===e||"0px"===e?{...t,css:{...t.css,flexBasis:"0%"}}:t})(e)),e.css&&(e=rn(e),e=nn(e)),e}),an=t=>`candu.sdk.${t}`,un=t=>an(`error.${t}`),cn={UNKOWN_NODE_TYPE:"unknown_node_type",UNKOWN_BLOCK_NODE_TYPE:"unkown_block_node_type",UNKOWN_INLINE_NODE_TYPE:"unkown_inline_node_type",UNKOWN_NODE_OBJECT_TYPE:"unkown_node_object_type",TUTORIAL_ERROR:"tutorial_error_boundary",PORTAL_ERROR:"portal_error_boundary",STYLEGUIDE_MAP_ERROR:"styleguide_map",RENDER_NODE_ERROR:"render_node"},ln={HEARTBEAT:an("heartbeat"),PREVIEW_OPEN:an("preview.open"),PORTAL:an("portal"),TUTORIAL:an("tutorial"),TUTORIAL_INTERACTION:an("tutorial.interaction"),PORTAL_ASSET_NOT_FOUND:un("portal_asset_not_found"),PORTAL_NO_SEGMENT_IDS:un("portal_no_segment_ids"),NO_MATCHING_TUTORIALS:un("no_matching_tutorials"),NO_VALID_TUTORIAL_IDENTIFIER:un("no_valid_tutorial_identifier"),COMMIT_API_LOADING_ERROR:un("commit_api"),TUTORIAL_LOADING_ERROR:un("tutorial"),UNKOWN_NODE_TYPE:un(cn.UNKOWN_NODE_TYPE),UNKOWN_INLINE_NODE_TYPE:un(cn.UNKOWN_INLINE_NODE_TYPE),UNKOWN_NODE_OBJECT_TYPE:un(cn.UNKOWN_NODE_OBJECT_TYPE),TUTORIAL_ERROR:un(cn.TUTORIAL_ERROR),PORTAL_ERROR:un(cn.PORTAL_ERROR),STYLEGUIDE_MAP_ERROR:un(cn.TUTORIAL_ERROR),RENDER_NODE_ERROR:un(cn.TUTORIAL_ERROR),CIRCULAR_DEPENDENCY_EMBED_PORTAL:un("circular_dependecy_embed_portal"),CIRCULAR_DEPENDENCY_EMBED_TUTORIAL:un("circular_dependecy_embed_tutorial")},sn=t=>`An error has occured while trying to parse your Tutorial.\nUpgrade the SDK to the latest version to get rid of this error.\nErrorCode: ${t}.`,dn={EVENTING_NOT_INITIALIZED:"You tried to send an event, but you haven't initialized eventing.\nThis is happening because you called eventing outside the scope of the CanduProvider. It can be fixed by:\n1. Adding CanduProvider to the root of the application.\n2. Initializing a new Eventing object outside of Candu.\nRead here for more context: http://udn.ac/tracking-not-init.\n",[ln.PORTAL_ASSET_NOT_FOUND]:"Could not find the requested Portal. This could happen because:\n1. The Portal does not exist or it was deleted.\n2. The Portal has not been made avaliable to be rendered.\n3. CORS Authenticaton failed.\nSee http://udn.ac/portal-not-found for more information.\n",[ln.PORTAL_NO_SEGMENT_IDS]:"You have tried to render a Portal that doesn't contain any content.\nAdd content to your Portal: https://udn.ac/update-portals.\n",[ln.NO_MATCHING_TUTORIALS]:"The Tutorial will not be rendered because there are no matching segments for the given user.",[ln.NO_VALID_TUTORIAL_IDENTIFIER]:"(Candu/Tutorial) You must define one of tutorialId, slug, commitId or contentHashId.",[ln.TUTORIAL_LOADING_ERROR]:"An error has occurred while trying to load the Tutorial",[ln.UNKOWN_INLINE_NODE_TYPE]:sn(cn.UNKOWN_INLINE_NODE_TYPE),[ln.UNKOWN_NODE_TYPE]:sn(cn.UNKOWN_NODE_TYPE),[ln.CIRCULAR_DEPENDENCY_EMBED_PORTAL]:"Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",[ln.CIRCULAR_DEPENDENCY_EMBED_TUTORIAL]:"Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",[ln.PORTAL_ERROR]:"An error has occured within Portal",[ln.TUTORIAL_ERROR]:"An error has occured within Tutorial",[ln.RENDER_NODE_ERROR]:"An error has occured while rendering tutorial node",[ln.STYLEGUIDE_MAP_ERROR]:"An error has occured while mapping node to styleguide"},fn={Alert:!0,B:!0,Badge:!0,Button:!0,Card:!0,Code:!0,Document:!0,Em:!0,EmbedPortal:!0,EmbedTutorial:!0,Flex:!0,FlexItem:!0,H1:!0,H2:!0,H3:!0,H4:!0,H5:!0,H6:!0,Image:!0,InlineCode:!0,Link:!0,List:!0,ListItem:!0,P:!0,RichText:!0,Spacing:!0,Text:!0,U:!0,View:!0,Player:!0},_n={error:console.error,warning:console.warn},pn=({identify:t,track:e})=>({provider:({userId:r,traits:n,styleguide:o})=>{t(r,n),e(ln.HEARTBEAT,(t=>{const e={};return Object.keys(t).forEach(r=>{fn[r]&&(e[`styleguide.${r}`]=t[r].displayName||!0)}),e})(o))},tutorialDocumentLoadingError:({tutorialId:t,slug:r,contentHashId:n})=>{_n.error(dn[ln.TUTORIAL_LOADING_ERROR]),e(ln.TUTORIAL_LOADING_ERROR,{tutorialId:t,slug:r,contentHashId:n})}});for(var vn=function(){return e.randomBytes(16)},hn=[],yn=0;yn<256;++yn)hn[yn]=(yn+256).toString(16).substr(1);var bn,En,gn=function(t,e){var r=e||0,n=hn;return[n[t[r++]],n[t[r++]],n[t[r++]],n[t[r++]],"-",n[t[r++]],n[t[r++]],"-",n[t[r++]],n[t[r++]],"-",n[t[r++]],n[t[r++]],"-",n[t[r++]],n[t[r++]],n[t[r++]],n[t[r++]],n[t[r++]],n[t[r++]]].join("")},On=function(t,e,r){var n=e&&r||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var o=(t=t||{}).random||(t.rng||vn)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e)for(var a=0;a<16;++a)e[n+a]=o[a];return e||gn(o)};Object.freeze({__proto__:null,API_BASE_URL:"https://api.candu.ai",VERSION:"0.5.0"});!function(t){t.UserGenerated="UserGenerated",t.SDK="SDK"}(bn||(bn={})),function(t){t.Identify="Identify",t.Group="Group",t.Track="Track",t.Page="Page",t.Screen="Screen"}(En||(En={}));const Tn=()=>"undefined"!=typeof window&&window.localStorage,Rn=t=>e=>{Tn()&&null!=e&&window.localStorage.setItem(t,JSON.stringify(e))};const In={anonymousId:{getOrCreate:((t,e)=>()=>(t=>()=>{if(Tn()){const t=window.localStorage.getItem("candu:anonymous_id");if(t)try{return JSON.parse(t)}catch(t){return null}}})()()||(()=>{const t=On();return Rn("candu:anonymous_id")(t),t})())(),set:Rn("candu:anonymous_id")}}.anonymousId.getOrCreate;var An="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Nn="object"==typeof An&&An&&An.Object===Object&&An,mn="object"==typeof self&&self&&self.Object===Object&&self,jn=(Nn||mn||Function("return this")()).Symbol,Pn=Object.prototype,Dn=Pn.hasOwnProperty,wn=Pn.toString,Ln=jn?jn.toStringTag:void 0,Sn=Object.prototype.toString,Cn=jn?jn.toStringTag:void 0,Un=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Cn&&Cn in Object(t)?function(t){var e=Dn.call(t,Ln),r=t[Ln];try{t[Ln]=void 0;var n=!0}catch(t){}var o=wn.call(t);return n&&(e?t[Ln]=r:delete t[Ln]),o}(t):function(t){return Sn.call(t)}(t)},kn=Array.isArray,Bn=function(t){return null!=t&&"object"==typeof t},zn=function(t){return"string"==typeof t||!kn(t)&&Bn(t)&&"[object String]"==Un(t)};const Mn=/^([a-zA-Z0-9]|_|-)+$/,$n=t=>(function(t){return"number"==typeof t||Bn(t)&&"[object Number]"==Un(t)})(t)&&t>=0;var xn,Wn,Gn,Yn,Fn,Vn;!function(t){t.SDK="SDK",t.PREVIEW="PREVIEW"}(xn||(xn={})),function(t){t.BOOTSTRAP="Bootstrap",t.CHANGE_POSITION="ChangePosition",t.CLOSE_PREVIEW="ClosePreview",t.PREVIEW_LOADED="PreviewLoaded",t.SET_AVALIABLE_PORTALS="SetAvaliablePortals",t.SET_CONTENT="SetContent",t.SET_SELECTED_ELEMENT="SetSelectedElement",t.SET_VIEW_MODE="SetViewMode",t.ADD_ELEMENT="AddElement",t.REMOVE_ELEMENT="RemoveElement",t.UPDATE_ELEMENT="UpdateElement",t.SET_ELEMENT="SetElement"}(Wn||(Wn={})),(Gn||(Gn={})).ON_CLICK="OnClick",function(t){t.NATIVE="Native",t.PENDO="Pendo"}(Yn||(Yn={})),function(t){t.NAVIGATE="Navigate",t.CHANGE_TUTORIAL="ChangeTutorial",t.OPEN_GUIDE="OpenGuide"}(Fn||(Fn={})),function(t){t.PRIMARY="primary",t.SECONDARY="primary",t.WARNING="warning",t.DANGER="danger",t.NEUTRAL="neutral",t.ACTIVE="active",t.INFO="info"}(Vn||(Vn={}));Vn.PRIMARY;var Kn;!function(t){t.U="U",t.B="B",t.Em="Em",t.InlineCode="InlineCode"}(Kn||(Kn={}));const Hn=t=>(t=>zn(t)&&t.length>=3&&t.length<100&&Mn.test(t))(t);var Jn,Zn,qn,Xn;Object.freeze({__proto__:null,PREVIEW_SCRIPT_URL:"https://app.candu.ai/preview.html"});!function(t){t.COLLAPSED="Collapsed",t.EXPANDED="Expanded",t.MINIMIZED="Minimized"}(Jn||(Jn={})),function(t){t.TUTORIAL="Tutorial",t.PORTAL="Portal"}(Zn||(Zn={})),function(t){t.Global="Global",t.Organization="Organization"}(qn||(qn={})),function(t){t.Root="root",t.Rule="rule",t.Atrule="atrule",t.Decl="decl",t.Any="any"}(Xn||(Xn={}));var Qn=function(t,e,r,n,o,a,i,u){if(!t){var c;if(void 0===e)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[r,n,o,a,i,u],s=0;(c=new Error(e.replace(/%s/g,(function(){return l[s++]})))).name="Invariant Violation"}throw c.framesToPop=1,c}};const to=t=>Qn(!t||E(t),"(Candu) styleguide must be undefined or an object"),eo=({clientToken:t,userId:e,traits:r,options:n,styleguide:o,...a})=>(Qn((t=>zn(t)&&!!t.match(/^[0-9a-zA-Z]*$/)&&t.length>=10)(t),"(Candu) you must provide a valid clientToken"),Qn(!e||(t=>$n(t)||zn(t)&&t.trim().length>0)(e),"(Candu) you must provide a valid userId"),to(o),Qn(!r||E(r),"(Candu) traits must be undefined or an object"),Qn(!n||E(n),"(Candu) options must be undefined or an object"),{...a,clientToken:t,traits:r||{},options:n||{},styleguide:o||{},userId:e||In()}),ro=({slug:t,styleguide:e,contentHashId:r,tutorialId:n,tutorialDocument:o,...a})=>(to(e),{...a,slug:t,styleguide:e||{},contentHashId:r,tutorialId:n,tutorialDocument:o}),no=({slug:t,styleguide:e})=>(to(e),{slug:t,styleguide:e||{}});var oo=Object.freeze({__proto__:null,API_BASE_URL:"https://api.candu.ai",CDN_BASE_URL:"https://cdn.candu.ai",VERSION:"0.5.1"});const{API_BASE_URL:ao}=oo,{CDN_BASE_URL:io}=oo,uo="/api/segmentMemberships",co="/api/tutorialDocumentsEditor",lo=async t=>(await fetch(t)).json(),so=t=>lo(`${ao}${t}`),fo=t=>lo(`${io}${t}`),_o={tutorialDocumentLatestPublished:async(t,e)=>so(`${co}?token=${t}&finder=latestPublished&tutorialId=${e}`),portalAsset:async(t,e)=>fo(`/portals/${t}/${e}/head.json`),segmentMembership:async(t,e)=>so(`${uo}/${e}?token=${t}`),tutorialDocument:(t,e,r)=>{const{contentHashId:n,tutorialId:o,tutorialDocument:a,slug:i}=t,u=(t=>({byId:e=>so(`${co}/${e}?token=${t}`),bySlug:e=>fo(`/tutorials/${t}/${e}.json`),byContentHash:e=>fo(`/tutorials/${t}/${e}.json`)}))(e);return(t=>$n(t))(o)?u.byId(o):Hn(i)?u.bySlug(i):(t=>zn(t)&&!!t.match(/^[0-9a-zA-Z]{40}$/))(n)?u.byContentHash(n):E(a)?Promise.resolve(a):(_n.error(dn[ln.NO_VALID_TUTORIAL_IDENTIFIER]),r.track(ln.NO_VALID_TUTORIAL_IDENTIFIER,{slug:t.slug}),null)}},po=(...t)=>console.error(...t),vo=(...t)=>console.warn(...t),ho={error:po,warning:vo},yo=t=>{switch(t.trigger){case Gn.ON_CLICK:default:return"onClick"}},bo=({data:t},e)=>{if(!t||!t.actions)return{};const r=t=>{e.provider.eventing.track(ln.TUTORIAL_INTERACTION,{...t,...e.trackingIdentifiers||{}})};return t.actions.map(t=>((t,e)=>{switch(t.handler.type){case Fn.NAVIGATE:return{[yo(t)]:()=>{const{href:r,target:n}=t.handler;e(t),"Blank"===n?window.open(r,"_blank"):r&&r.includes("mailto:")?window.location=r:document.location.href=r}};case Fn.CHANGE_TUTORIAL:return{[yo(t)]:()=>{const{tutorialId:e}=t.handler;po("TODO -> change tutorial",e)}};case Fn.OPEN_GUIDE:return{[yo(t)]:()=>{const{guideId:e}=t.handler;po("TODO -> open guide",e)}};default:return{}}})(t,r)).reduce((t,e)=>({...t,...e}),{})},Eo=(t,e)=>{try{const{provider:r,document:n,trackingIdentifiers:o}=e,a=n.nodes[t];if(!a)return ho.error("Document is corrupted. Refusing to move further."),null;const i=t=>Eo(t,e),{type:u,props:c,css:l}=a,s={...c||{},style:l||{},children:(c||{}).children||a.nodes&&a.nodes.map(i),...bo(a,{trackingIdentifiers:o,provider:r})},d={nodeId:t,node:a,document:n,render:{node:i,styleguide:(t,r={})=>e.renderNode(t,{api:d,attributes:r}),tutorial:t=>e.renderTutorial(t),portal:t=>e.renderPortal(t)},trackingIdentifiers:o},f=d.render.styleguide(u,s);return f||(ho.error(dn[ln.UNKOWN_NODE_TYPE],{type:u}),r.eventing.track(ln.UNKOWN_NODE_TYPE,{type:u}),null)}catch(t){return ho.error(dn[ln.STYLEGUIDE_MAP_ERROR],t),null}},go=Ar((t,e)=>{const{provider:r,portal:n,tutorial:o}=t,a=r.styleguide;let i,u;return o&&(u=o.styleguide),n&&(i=n.styleguide),{...a||{},...i||{},...u||{},...e||{}}}),Oo="",To="#EDEDED",Ro="#333745",Io="#838792",Ao="#FEFEFE",No="#FEFEFE",mo={primary:"#6310E5",secondary:"#59C3C3",tertiary:"#4D515D",warning:"#FCAD0D",danger:"#EE4266"},jo=t=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("href",`${io}/styleguides/applications/${t}/default/main.css`),document.head.appendChild(e)};export{To as DEFAULT_ALERT_COLOR,Oo as DEFAULT_ALT,Ao as DEFAULT_TAB_ACTIVE_COLOR,No as DEFAULT_TAB_COLOR,Ro as DEFAULT_TAB_HEADER_COLOR,Io as DEFAULT_TAB_ITEM_COLOR,dn as ERROR_MESSAGES,cn as ERROR_SLUGS,ln as EVENT_NAMES,_n as LOGGER,_o as RESOURCES,mo as STYLEGUIDE_COLORS,on as adaptCustomNodes,jo as attachStylesheet,nn as convertStyleNumberValues,fn as defaultStyleguide,pn as internalEventing,po as logError,vo as logWarning,ho as logger,Eo as mapNodeToStyleguide,go as mergeStyleguidesFromContext,no as portalValidation,eo as providerValidation,ro as tutorialValidation,rn as unpackShorthandStyles}; | ||
import{isNumber as t}from"util";import e from"crypto";var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(t,e){return t(e={exports:{}},e.exports),e.exports}var o="object"==typeof r&&r&&r.Object===Object&&r,a="object"==typeof self&&self&&self.Object===Object&&self,i=o||a||Function("return this")(),u=i.Symbol,c=Object.prototype,s=c.hasOwnProperty,l=c.toString,d=u?u.toStringTag:void 0;var f=function(t){var e=s.call(t,d),r=t[d];try{t[d]=void 0;var n=!0}catch(t){}var o=l.call(t);return n&&(e?t[d]=r:delete t[d]),o},_=Object.prototype.toString;var p=function(t){return _.call(t)},v="[object Null]",h="[object Undefined]",y=u?u.toStringTag:void 0;var b=function(t){return null==t?void 0===t?h:v:y&&y in Object(t)?f(t):p(t)};var E=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},g="[object AsyncFunction]",O="[object Function]",T="[object GeneratorFunction]",R="[object Proxy]";var I,N=function(t){if(!E(t))return!1;var e=b(t);return e==O||e==T||e==g||e==R},A=i["__core-js_shared__"],m=(I=/[^.]+$/.exec(A&&A.keys&&A.keys.IE_PROTO||""))?"Symbol(src)_1."+I:"";var j=function(t){return!!m&&m in t},D=Function.prototype.toString;var P=function(t){if(null!=t){try{return D.call(t)}catch(t){}try{return t+""}catch(t){}}return""},w=/^\[object .+?Constructor\]$/,L=Function.prototype,S=Object.prototype,C=L.toString,U=S.hasOwnProperty,k=RegExp("^"+C.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var B=function(t){return!(!E(t)||j(t))&&(N(t)?k:w).test(P(t))};var M=function(t,e){return null==t?void 0:t[e]};var $=function(t,e){var r=M(t,e);return B(r)?r:void 0},x=function(){try{var t=$(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var z=function(t,e,r){"__proto__"==e&&x?x(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r};var W=function(t){return function(e,r,n){for(var o=-1,a=Object(e),i=n(e),u=i.length;u--;){var c=i[t?u:++o];if(!1===r(a[c],c,a))break}return e}}();var G=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n};var Y=function(t){return null!=t&&"object"==typeof t},F="[object Arguments]";var V=function(t){return Y(t)&&b(t)==F},K=Object.prototype,H=K.hasOwnProperty,J=K.propertyIsEnumerable,Z=V(function(){return arguments}())?V:function(t){return Y(t)&&H.call(t,"callee")&&!J.call(t,"callee")},q=Array.isArray;var X=function(){return!1},Q=n((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r?i.Buffer:void 0,a=(o?o.isBuffer:void 0)||X;t.exports=a})),tt=9007199254740991,et=/^(?:0|[1-9]\d*)$/;var rt=function(t,e){var r=typeof t;return!!(e=null==e?tt:e)&&("number"==r||"symbol"!=r&&et.test(t))&&t>-1&&t%1==0&&t<e},nt=9007199254740991;var ot=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=nt},at={};at["[object Float32Array]"]=at["[object Float64Array]"]=at["[object Int8Array]"]=at["[object Int16Array]"]=at["[object Int32Array]"]=at["[object Uint8Array]"]=at["[object Uint8ClampedArray]"]=at["[object Uint16Array]"]=at["[object Uint32Array]"]=!0,at["[object Arguments]"]=at["[object Array]"]=at["[object ArrayBuffer]"]=at["[object Boolean]"]=at["[object DataView]"]=at["[object Date]"]=at["[object Error]"]=at["[object Function]"]=at["[object Map]"]=at["[object Number]"]=at["[object Object]"]=at["[object RegExp]"]=at["[object Set]"]=at["[object String]"]=at["[object WeakMap]"]=!1;var it=function(t){return Y(t)&&ot(t.length)&&!!at[b(t)]};var ut=function(t){return function(e){return t(e)}},ct=n((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,a=n&&n.exports===r&&o.process,i=function(){try{var t=n&&n.require&&n.require("util").types;return t||a&&a.binding&&a.binding("util")}catch(t){}}();t.exports=i})),st=ct&&ct.isTypedArray,lt=st?ut(st):it,dt=Object.prototype.hasOwnProperty;var ft=function(t,e){var r=q(t),n=!r&&Z(t),o=!r&&!n&&Q(t),a=!r&&!n&&!o&<(t),i=r||n||o||a,u=i?G(t.length,String):[],c=u.length;for(var s in t)!e&&!dt.call(t,s)||i&&("length"==s||o&&("offset"==s||"parent"==s)||a&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||rt(s,c))||u.push(s);return u},_t=Object.prototype;var pt=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||_t)};var vt=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),ht=Object.prototype.hasOwnProperty;var yt=function(t){if(!pt(t))return vt(t);var e=[];for(var r in Object(t))ht.call(t,r)&&"constructor"!=r&&e.push(r);return e};var bt=function(t){return null!=t&&ot(t.length)&&!N(t)};var Et=function(t){return bt(t)?ft(t):yt(t)};var gt=function(t,e){return t&&W(t,e,Et)};var Ot=function(){this.__data__=[],this.size=0};var Tt=function(t,e){return t===e||t!=t&&e!=e};var Rt=function(t,e){for(var r=t.length;r--;)if(Tt(t[r][0],e))return r;return-1},It=Array.prototype.splice;var Nt=function(t){var e=this.__data__,r=Rt(e,t);return!(r<0)&&(r==e.length-1?e.pop():It.call(e,r,1),--this.size,!0)};var At=function(t){var e=this.__data__,r=Rt(e,t);return r<0?void 0:e[r][1]};var mt=function(t){return Rt(this.__data__,t)>-1};var jt=function(t,e){var r=this.__data__,n=Rt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function Dt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Dt.prototype.clear=Ot,Dt.prototype.delete=Nt,Dt.prototype.get=At,Dt.prototype.has=mt,Dt.prototype.set=jt;var Pt=Dt;var wt=function(){this.__data__=new Pt,this.size=0};var Lt=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};var St=function(t){return this.__data__.get(t)};var Ct=function(t){return this.__data__.has(t)},Ut=$(i,"Map"),kt=$(Object,"create");var Bt=function(){this.__data__=kt?kt(null):{},this.size=0};var Mt=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},$t="__lodash_hash_undefined__",xt=Object.prototype.hasOwnProperty;var zt=function(t){var e=this.__data__;if(kt){var r=e[t];return r===$t?void 0:r}return xt.call(e,t)?e[t]:void 0},Wt=Object.prototype.hasOwnProperty;var Gt=function(t){var e=this.__data__;return kt?void 0!==e[t]:Wt.call(e,t)},Yt="__lodash_hash_undefined__";var Ft=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=kt&&void 0===e?Yt:e,this};function Vt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Vt.prototype.clear=Bt,Vt.prototype.delete=Mt,Vt.prototype.get=zt,Vt.prototype.has=Gt,Vt.prototype.set=Ft;var Kt=Vt;var Ht=function(){this.size=0,this.__data__={hash:new Kt,map:new(Ut||Pt),string:new Kt}};var Jt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Zt=function(t,e){var r=t.__data__;return Jt(e)?r["string"==typeof e?"string":"hash"]:r.map};var qt=function(t){var e=Zt(this,t).delete(t);return this.size-=e?1:0,e};var Xt=function(t){return Zt(this,t).get(t)};var Qt=function(t){return Zt(this,t).has(t)};var te=function(t,e){var r=Zt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function ee(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}ee.prototype.clear=Ht,ee.prototype.delete=qt,ee.prototype.get=Xt,ee.prototype.has=Qt,ee.prototype.set=te;var re=ee,ne=200;var oe=function(t,e){var r=this.__data__;if(r instanceof Pt){var n=r.__data__;if(!Ut||n.length<ne-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new re(n)}return r.set(t,e),this.size=r.size,this};function ae(t){var e=this.__data__=new Pt(t);this.size=e.size}ae.prototype.clear=wt,ae.prototype.delete=Lt,ae.prototype.get=St,ae.prototype.has=Ct,ae.prototype.set=oe;var ie=ae,ue="__lodash_hash_undefined__";var ce=function(t){return this.__data__.set(t,ue),this};var se=function(t){return this.__data__.has(t)};function le(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new re;++e<r;)this.add(t[e])}le.prototype.add=le.prototype.push=ce,le.prototype.has=se;var de=le;var fe=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1};var _e=function(t,e){return t.has(e)},pe=1,ve=2;var he=function(t,e,r,n,o,a){var i=r&pe,u=t.length,c=e.length;if(u!=c&&!(i&&c>u))return!1;var s=a.get(t);if(s&&a.get(e))return s==e;var l=-1,d=!0,f=r&ve?new de:void 0;for(a.set(t,e),a.set(e,t);++l<u;){var _=t[l],p=e[l];if(n)var v=i?n(p,_,l,e,t,a):n(_,p,l,t,e,a);if(void 0!==v){if(v)continue;d=!1;break}if(f){if(!fe(e,(function(t,e){if(!_e(f,e)&&(_===t||o(_,t,r,n,a)))return f.push(e)}))){d=!1;break}}else if(_!==p&&!o(_,p,r,n,a)){d=!1;break}}return a.delete(t),a.delete(e),d},ye=i.Uint8Array;var be=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r};var Ee=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r},ge=1,Oe=2,Te="[object Boolean]",Re="[object Date]",Ie="[object Error]",Ne="[object Map]",Ae="[object Number]",me="[object RegExp]",je="[object Set]",De="[object String]",Pe="[object Symbol]",we="[object ArrayBuffer]",Le="[object DataView]",Se=u?u.prototype:void 0,Ce=Se?Se.valueOf:void 0;var Ue=function(t,e,r,n,o,a,i){switch(r){case Le:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case we:return!(t.byteLength!=e.byteLength||!a(new ye(t),new ye(e)));case Te:case Re:case Ae:return Tt(+t,+e);case Ie:return t.name==e.name&&t.message==e.message;case me:case De:return t==e+"";case Ne:var u=be;case je:var c=n≥if(u||(u=Ee),t.size!=e.size&&!c)return!1;var s=i.get(t);if(s)return s==e;n|=Oe,i.set(t,e);var l=he(u(t),u(e),n,o,a,i);return i.delete(t),l;case Pe:if(Ce)return Ce.call(t)==Ce.call(e)}return!1};var ke=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t};var Be=function(t,e,r){var n=e(t);return q(t)?n:ke(n,r(t))};var Me=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,a=[];++r<n;){var i=t[r];e(i,r,t)&&(a[o++]=i)}return a};var $e=function(){return[]},xe=Object.prototype.propertyIsEnumerable,ze=Object.getOwnPropertySymbols,We=ze?function(t){return null==t?[]:(t=Object(t),Me(ze(t),(function(e){return xe.call(t,e)})))}:$e;var Ge=function(t){return Be(t,Et,We)},Ye=1,Fe=Object.prototype.hasOwnProperty;var Ve=function(t,e,r,n,o,a){var i=r&Ye,u=Ge(t),c=u.length;if(c!=Ge(e).length&&!i)return!1;for(var s=c;s--;){var l=u[s];if(!(i?l in e:Fe.call(e,l)))return!1}var d=a.get(t);if(d&&a.get(e))return d==e;var f=!0;a.set(t,e),a.set(e,t);for(var _=i;++s<c;){var p=t[l=u[s]],v=e[l];if(n)var h=i?n(v,p,l,e,t,a):n(p,v,l,t,e,a);if(!(void 0===h?p===v||o(p,v,r,n,a):h)){f=!1;break}_||(_="constructor"==l)}if(f&&!_){var y=t.constructor,b=e.constructor;y!=b&&"constructor"in t&&"constructor"in e&&!("function"==typeof y&&y instanceof y&&"function"==typeof b&&b instanceof b)&&(f=!1)}return a.delete(t),a.delete(e),f},Ke=$(i,"DataView"),He=$(i,"Promise"),Je=$(i,"Set"),Ze=$(i,"WeakMap"),qe=P(Ke),Xe=P(Ut),Qe=P(He),tr=P(Je),er=P(Ze),rr=b;(Ke&&"[object DataView]"!=rr(new Ke(new ArrayBuffer(1)))||Ut&&"[object Map]"!=rr(new Ut)||He&&"[object Promise]"!=rr(He.resolve())||Je&&"[object Set]"!=rr(new Je)||Ze&&"[object WeakMap]"!=rr(new Ze))&&(rr=function(t){var e=b(t),r="[object Object]"==e?t.constructor:void 0,n=r?P(r):"";if(n)switch(n){case qe:return"[object DataView]";case Xe:return"[object Map]";case Qe:return"[object Promise]";case tr:return"[object Set]";case er:return"[object WeakMap]"}return e});var nr=rr,or=1,ar="[object Arguments]",ir="[object Array]",ur="[object Object]",cr=Object.prototype.hasOwnProperty;var sr=function(t,e,r,n,o,a){var i=q(t),u=q(e),c=i?ir:nr(t),s=u?ir:nr(e),l=(c=c==ar?ur:c)==ur,d=(s=s==ar?ur:s)==ur,f=c==s;if(f&&Q(t)){if(!Q(e))return!1;i=!0,l=!1}if(f&&!l)return a||(a=new ie),i||lt(t)?he(t,e,r,n,o,a):Ue(t,e,c,r,n,o,a);if(!(r&or)){var _=l&&cr.call(t,"__wrapped__"),p=d&&cr.call(e,"__wrapped__");if(_||p){var v=_?t.value():t,h=p?e.value():e;return a||(a=new ie),o(v,h,r,n,a)}}return!!f&&(a||(a=new ie),Ve(t,e,r,n,o,a))};var lr=function t(e,r,n,o,a){return e===r||(null==e||null==r||!Y(e)&&!Y(r)?e!=e&&r!=r:sr(e,r,n,o,t,a))},dr=1,fr=2;var _r=function(t,e,r,n){var o=r.length,a=o,i=!n;if(null==t)return!a;for(t=Object(t);o--;){var u=r[o];if(i&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<a;){var c=(u=r[o])[0],s=t[c],l=u[1];if(i&&u[2]){if(void 0===s&&!(c in t))return!1}else{var d=new ie;if(n)var f=n(s,l,c,t,e,d);if(!(void 0===f?lr(l,s,dr|fr,n,d):f))return!1}}return!0};var pr=function(t){return t==t&&!E(t)};var vr=function(t){for(var e=Et(t),r=e.length;r--;){var n=e[r],o=t[n];e[r]=[n,o,pr(o)]}return e};var hr=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}};var yr=function(t){var e=vr(t);return 1==e.length&&e[0][2]?hr(e[0][0],e[0][1]):function(r){return r===t||_r(r,t,e)}},br="[object Symbol]";var Er=function(t){return"symbol"==typeof t||Y(t)&&b(t)==br},gr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Or=/^\w*$/;var Tr=function(t,e){if(q(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!Er(t))||(Or.test(t)||!gr.test(t)||null!=e&&t in Object(e))},Rr="Expected a function";function Ir(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(Rr);var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=t.apply(this,n);return r.cache=a.set(o,i)||a,i};return r.cache=new(Ir.Cache||re),r}Ir.Cache=re;var Nr=Ir,Ar=500;var mr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,jr=/\\(\\)?/g,Dr=function(t){var e=Nr(t,(function(t){return r.size===Ar&&r.clear(),t})),r=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(mr,(function(t,r,n,o){e.push(n?o.replace(jr,"$1"):r||t)})),e}));var Pr=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o},wr=1/0,Lr=u?u.prototype:void 0,Sr=Lr?Lr.toString:void 0;var Cr=function t(e){if("string"==typeof e)return e;if(q(e))return Pr(e,t)+"";if(Er(e))return Sr?Sr.call(e):"";var r=e+"";return"0"==r&&1/e==-wr?"-0":r};var Ur=function(t){return null==t?"":Cr(t)};var kr=function(t,e){return q(t)?t:Tr(t,e)?[t]:Dr(Ur(t))},Br=1/0;var Mr=function(t){if("string"==typeof t||Er(t))return t;var e=t+"";return"0"==e&&1/t==-Br?"-0":e};var $r=function(t,e){for(var r=0,n=(e=kr(e,t)).length;null!=t&&r<n;)t=t[Mr(e[r++])];return r&&r==n?t:void 0};var xr=function(t,e,r){var n=null==t?void 0:$r(t,e);return void 0===n?r:n};var zr=function(t,e){return null!=t&&e in Object(t)};var Wr=function(t,e,r){for(var n=-1,o=(e=kr(e,t)).length,a=!1;++n<o;){var i=Mr(e[n]);if(!(a=null!=t&&r(t,i)))break;t=t[i]}return a||++n!=o?a:!!(o=null==t?0:t.length)&&ot(o)&&rt(i,o)&&(q(t)||Z(t))};var Gr=function(t,e){return null!=t&&Wr(t,e,zr)},Yr=1,Fr=2;var Vr=function(t,e){return Tr(t)&&pr(e)?hr(Mr(t),e):function(r){var n=xr(r,t);return void 0===n&&n===e?Gr(r,t):lr(e,n,Yr|Fr)}};var Kr=function(t){return t};var Hr=function(t){return function(e){return null==e?void 0:e[t]}};var Jr=function(t){return function(e){return $r(e,t)}};var Zr=function(t){return Tr(t)?Hr(Mr(t)):Jr(t)};var qr=function(t){return"function"==typeof t?t:null==t?Kr:"object"==typeof t?q(t)?Vr(t[0],t[1]):yr(t):Zr(t)};var Xr=function(t,e){var r={};return e=qr(e),gt(t,(function(t,n,o){z(r,n,e(t,n,o))})),r},Qr={boxFlex:!0,boxFlexGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0};var tn=["Webkit","ms","Moz","O"];Object.keys(Qr).forEach((function(t){tn.forEach((function(e){Qr[function(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}(e,t)]=Qr[t]}))}));var en={isUnitlessNumber:Qr,shorthandPropertyExpansions:{background:{backgroundImage:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundColor:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0}}};const rn=t=>{const{padding:e,margin:r,...n}=t.css;let o={};return e&&(o={paddingRight:e,paddingLeft:e,paddingBottom:e,paddingTop:e}),r&&(o={...o,marginRight:r,marginLeft:r,marginBottom:r,marginTop:r}),{...t,css:{...o,...n}}},nn=e=>{const r=e.css,n={};return Object.entries(r).forEach(([e,r])=>{if(t(r))return en.isUnitlessNumber[e]?void(n[e]=`${r}`):void(n[e]=`${r}px`);n[e]=r}),{...e,css:n}},on=t=>Xr(t,t=>{let e=t;return"Typography"===e.type&&(e=(t=>{const e=xr(t,"data.custom.variant","P");return{...t,type:e}})(e)),e.css&&E(e.css)&&e.css.flexBasis&&(e=(t=>{const{flexBasis:e}=t.css;return"0"===e||"0px"===e?{...t,css:{...t.css,flexBasis:"0%"}}:t})(e)),e.css&&(e=rn(e),e=nn(e)),e}),an=t=>`candu.sdk.${t}`,un=t=>an(`error.${t}`),cn={UNKOWN_NODE_TYPE:"unknown_node_type",UNKOWN_BLOCK_NODE_TYPE:"unkown_block_node_type",UNKOWN_INLINE_NODE_TYPE:"unkown_inline_node_type",UNKOWN_NODE_OBJECT_TYPE:"unkown_node_object_type",TUTORIAL_ERROR:"tutorial_error_boundary",PORTAL_ERROR:"portal_error_boundary",STYLEGUIDE_MAP_ERROR:"styleguide_map",RENDER_NODE_ERROR:"render_node"},sn={HEARTBEAT:an("heartbeat"),PREVIEW_OPEN:an("preview.open"),PORTAL:an("portal"),TUTORIAL:an("tutorial"),TUTORIAL_INTERACTION:an("tutorial.interaction"),PORTAL_ASSET_NOT_FOUND:un("portal_asset_not_found"),PORTAL_NO_SEGMENT_IDS:un("portal_no_segment_ids"),NO_MATCHING_TUTORIALS:un("no_matching_tutorials"),NO_VALID_TUTORIAL_IDENTIFIER:un("no_valid_tutorial_identifier"),COMMIT_API_LOADING_ERROR:un("commit_api"),TUTORIAL_LOADING_ERROR:un("tutorial"),UNKOWN_NODE_TYPE:un(cn.UNKOWN_NODE_TYPE),UNKOWN_INLINE_NODE_TYPE:un(cn.UNKOWN_INLINE_NODE_TYPE),UNKOWN_NODE_OBJECT_TYPE:un(cn.UNKOWN_NODE_OBJECT_TYPE),TUTORIAL_ERROR:un(cn.TUTORIAL_ERROR),PORTAL_ERROR:un(cn.PORTAL_ERROR),STYLEGUIDE_MAP_ERROR:un(cn.TUTORIAL_ERROR),RENDER_NODE_ERROR:un(cn.TUTORIAL_ERROR),CIRCULAR_DEPENDENCY_EMBED_PORTAL:un("circular_dependecy_embed_portal"),CIRCULAR_DEPENDENCY_EMBED_TUTORIAL:un("circular_dependecy_embed_tutorial")},ln=t=>`An error has occured while trying to parse your Tutorial.\nUpgrade the SDK to the latest version to get rid of this error.\nErrorCode: ${t}.`,dn={EVENTING_NOT_INITIALIZED:"You tried to send an event, but you haven't initialized eventing.\nThis is happening because you called eventing outside the scope of the CanduProvider. It can be fixed by:\n1. Adding CanduProvider to the root of the application.\n2. Initializing a new Eventing object outside of Candu.\nRead here for more context: http://udn.ac/tracking-not-init.\n",[sn.PORTAL_ASSET_NOT_FOUND]:"Could not find the requested Portal. This could happen because:\n1. The Portal does not exist or it was deleted.\n2. The Portal has not been made avaliable to be rendered.\n3. CORS Authenticaton failed.\nSee http://udn.ac/portal-not-found for more information.\n",[sn.PORTAL_NO_SEGMENT_IDS]:"You have tried to render a Portal that doesn't contain any content.\nAdd content to your Portal: https://udn.ac/update-portals.\n",[sn.NO_MATCHING_TUTORIALS]:"The Tutorial will not be rendered because there are no matching segments for the given user.",[sn.NO_VALID_TUTORIAL_IDENTIFIER]:"(Candu/Tutorial) You must define one of tutorialId, slug, commitId or contentHashId.",[sn.TUTORIAL_LOADING_ERROR]:"An error has occurred while trying to load the Tutorial",[sn.UNKOWN_INLINE_NODE_TYPE]:ln(cn.UNKOWN_INLINE_NODE_TYPE),[sn.UNKOWN_NODE_TYPE]:ln(cn.UNKOWN_NODE_TYPE),[sn.CIRCULAR_DEPENDENCY_EMBED_PORTAL]:"Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",[sn.CIRCULAR_DEPENDENCY_EMBED_TUTORIAL]:"Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",[sn.PORTAL_ERROR]:"An error has occured within Portal",[sn.TUTORIAL_ERROR]:"An error has occured within Tutorial",[sn.RENDER_NODE_ERROR]:"An error has occured while rendering tutorial node",[sn.STYLEGUIDE_MAP_ERROR]:"An error has occured while mapping node to styleguide"},fn={Alert:!0,B:!0,Badge:!0,Button:!0,Card:!0,Code:!0,Document:!0,Em:!0,EmbedPortal:!0,EmbedTutorial:!0,Flex:!0,FlexItem:!0,H1:!0,H2:!0,H3:!0,H4:!0,H5:!0,H6:!0,Image:!0,InlineCode:!0,Link:!0,List:!0,ListItem:!0,P:!0,RichText:!0,Spacing:!0,Text:!0,U:!0,View:!0,Player:!0},_n={error:console.error,warning:console.warn},pn=({identify:t,track:e})=>({provider:({userId:r,traits:n,styleguide:o})=>{t(r,n),e(sn.HEARTBEAT,(t=>{const e={};return Object.keys(t).forEach(r=>{fn[r]&&(e[`styleguide.${r}`]=t[r].displayName||!0)}),e})(o))},tutorialDocumentLoadingError:({tutorialId:t,slug:r,contentHashId:n})=>{_n.error(dn[sn.TUTORIAL_LOADING_ERROR]),e(sn.TUTORIAL_LOADING_ERROR,{tutorialId:t,slug:r,contentHashId:n})}});for(var vn=function(){return e.randomBytes(16)},hn=[],yn=0;yn<256;++yn)hn[yn]=(yn+256).toString(16).substr(1);var bn=function(t,e){var r=e||0,n=hn;return[n[t[r++]],n[t[r++]],n[t[r++]],n[t[r++]],"-",n[t[r++]],n[t[r++]],"-",n[t[r++]],n[t[r++]],"-",n[t[r++]],n[t[r++]],"-",n[t[r++]],n[t[r++]],n[t[r++]],n[t[r++]],n[t[r++]],n[t[r++]]].join("")};var En,gn,On=function(t,e,r){var n=e&&r||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var o=(t=t||{}).random||(t.rng||vn)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e)for(var a=0;a<16;++a)e[n+a]=o[a];return e||bn(o)};!function(t){t.UserGenerated="UserGenerated",t.SDK="SDK"}(En||(En={})),function(t){t.Identify="Identify",t.Group="Group",t.Track="Track",t.Page="Page",t.Screen="Screen"}(gn||(gn={}));const Tn=()=>"undefined"!=typeof window&&window.localStorage,Rn=t=>e=>{Tn()&&null!=e&&window.localStorage.setItem(t,JSON.stringify(e))};const In={anonymousId:{getOrCreate:((t,e)=>()=>(t=>()=>{if(Tn()){const e=window.localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(t){return null}}})(t)()||e())("candu:anonymous_id",()=>{const t=On();return Rn("candu:anonymous_id")(t),t}),set:Rn("candu:anonymous_id")}}.anonymousId.getOrCreate;var Nn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},An="object"==typeof Nn&&Nn&&Nn.Object===Object&&Nn,mn="object"==typeof self&&self&&self.Object===Object&&self,jn=(An||mn||Function("return this")()).Symbol,Dn=Object.prototype,Pn=Dn.hasOwnProperty,wn=Dn.toString,Ln=jn?jn.toStringTag:void 0;var Sn=function(t){var e=Pn.call(t,Ln),r=t[Ln];try{t[Ln]=void 0;var n=!0}catch(t){}var o=wn.call(t);return n&&(e?t[Ln]=r:delete t[Ln]),o},Cn=Object.prototype.toString;var Un=function(t){return Cn.call(t)},kn="[object Null]",Bn="[object Undefined]",Mn=jn?jn.toStringTag:void 0;var $n=function(t){return null==t?void 0===t?Bn:kn:Mn&&Mn in Object(t)?Sn(t):Un(t)},xn=Array.isArray;var zn=function(t){return null!=t&&"object"==typeof t},Wn="[object String]";var Gn=function(t){return"string"==typeof t||!xn(t)&&zn(t)&&$n(t)==Wn},Yn="[object Number]";var Fn=function(t){return"number"==typeof t||zn(t)&&$n(t)==Yn};const Vn=/^([a-zA-Z0-9]|_|-)+$/,Kn=t=>Fn(t)&&t>=0;var Hn,Jn,Zn,qn,Xn,Qn;!function(t){t.SDK="SDK",t.PREVIEW="PREVIEW"}(Hn||(Hn={})),function(t){t.BOOTSTRAP="Bootstrap",t.CHANGE_POSITION="ChangePosition",t.CLOSE_PREVIEW="ClosePreview",t.PREVIEW_LOADED="PreviewLoaded",t.SET_AVALIABLE_PORTALS="SetAvaliablePortals",t.SET_CONTENT="SetContent",t.SET_SELECTED_ELEMENT="SetSelectedElement",t.SET_VIEW_MODE="SetViewMode",t.ADD_ELEMENT="AddElement",t.REMOVE_ELEMENT="RemoveElement",t.UPDATE_ELEMENT="UpdateElement",t.SET_ELEMENT="SetElement"}(Jn||(Jn={})),function(t){t.ON_CLICK="OnClick"}(Zn||(Zn={})),function(t){t.NATIVE="Native",t.PENDO="Pendo"}(qn||(qn={})),function(t){t.NAVIGATE="Navigate",t.CHANGE_TUTORIAL="ChangeTutorial",t.OPEN_GUIDE="OpenGuide"}(Xn||(Xn={})),function(t){t.PRIMARY="primary",t.SECONDARY="primary",t.WARNING="warning",t.DANGER="danger",t.NEUTRAL="neutral",t.ACTIVE="active",t.INFO="info"}(Qn||(Qn={}));Qn.PRIMARY;var to;!function(t){t.U="U",t.B="B",t.Em="Em",t.InlineCode="InlineCode"}(to||(to={}));const eo=t=>(t=>Gn(t)&&t.length>=3&&t.length<100&&Vn.test(t))(t);var ro,no,oo,ao;!function(t){t.COLLAPSED="Collapsed",t.EXPANDED="Expanded",t.MINIMIZED="Minimized"}(ro||(ro={})),function(t){t.TUTORIAL="Tutorial",t.PORTAL="Portal"}(no||(no={})),function(t){t.Global="Global",t.Organization="Organization"}(oo||(oo={})),function(t){t.Root="root",t.Rule="rule",t.Atrule="atrule",t.Decl="decl",t.Any="any"}(ao||(ao={}));var io=function(t,e,r,n,o,a,i,u){if(!t){var c;if(void 0===e)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[r,n,o,a,i,u],l=0;(c=new Error(e.replace(/%s/g,(function(){return s[l++]})))).name="Invariant Violation"}throw c.framesToPop=1,c}};const uo=t=>io(!t||E(t),"(Candu) styleguide must be undefined or an object"),co=({clientToken:t,userId:e,traits:r,options:n,styleguide:o,...a})=>(io((t=>Gn(t)&&!!t.match(/^[0-9a-zA-Z]*$/)&&t.length>=10)(t),"(Candu) you must provide a valid clientToken"),io(!e||(t=>Kn(t)||Gn(t)&&t.trim().length>0)(e),"(Candu) you must provide a valid userId"),uo(o),io(!r||E(r),"(Candu) traits must be undefined or an object"),io(!n||E(n),"(Candu) options must be undefined or an object"),{...a,clientToken:t,traits:r||{},options:n||{},styleguide:o||{},userId:e||In()}),so=({slug:t,styleguide:e,contentHashId:r,tutorialId:n,tutorialDocument:o,...a})=>(uo(e),{...a,slug:t,styleguide:e||{},contentHashId:r,tutorialId:n,tutorialDocument:o}),lo=({slug:t,styleguide:e})=>(uo(e),{slug:t,styleguide:e||{}});var fo=Object.freeze({__proto__:null,API_BASE_URL:"https://api.candu.ai",CDN_BASE_URL:"https://cdn.candu.ai",VERSION:"0.5.2"});const{API_BASE_URL:_o}=fo,{CDN_BASE_URL:po}=fo,vo="/api/segmentMemberships",ho="/api/tutorialDocumentsEditor",yo=async t=>(await fetch(t)).json(),bo=t=>yo(`${_o}${t}`),Eo=t=>yo(`${po}${t}`),go={tutorialDocumentLatestPublished:async(t,e)=>bo(`${ho}?token=${t}&finder=latestPublished&tutorialId=${e}`),portalAsset:async(t,e)=>Eo(`/portals/${t}/${e}/head.json`),segmentMembership:async(t,e)=>bo(`${vo}/${e}?token=${t}`),tutorialDocument:(t,e,r)=>{const{contentHashId:n,tutorialId:o,tutorialDocument:a,slug:i}=t,u=(t=>({byId:e=>bo(`${ho}/${e}?token=${t}`),bySlug:e=>Eo(`/tutorials/${t}/${e}.json`),byContentHash:e=>Eo(`/tutorials/${t}/${e}.json`)}))(e);return(t=>Kn(t))(o)?u.byId(o):eo(i)?u.bySlug(i):(t=>Gn(t)&&!!t.match(/^[0-9a-zA-Z]{40}$/))(n)?u.byContentHash(n):E(a)?Promise.resolve(a):(_n.error(dn[sn.NO_VALID_TUTORIAL_IDENTIFIER]),r.track(sn.NO_VALID_TUTORIAL_IDENTIFIER,{slug:t.slug}),null)}},Oo=(...t)=>console.error(...t),To=(...t)=>console.warn(...t),Ro={error:Oo,warning:To},Io=t=>{switch(t.trigger){case Zn.ON_CLICK:default:return"onClick"}},No=({data:t},e)=>{if(!t||!t.actions)return{};const r=t=>{e.provider.eventing.track(sn.TUTORIAL_INTERACTION,{...t,...e.trackingIdentifiers||{}})};return t.actions.map(t=>((t,e)=>{switch(t.handler.type){case Xn.NAVIGATE:return{[Io(t)]:()=>{const{href:r,target:n}=t.handler;e(t),"Blank"===n?window.open(r,"_blank"):r&&r.includes("mailto:")?window.location=r:document.location.href=r}};case Xn.CHANGE_TUTORIAL:return{[Io(t)]:()=>{const{tutorialId:e}=t.handler;Oo("TODO -> change tutorial",e)}};case Xn.OPEN_GUIDE:return{[Io(t)]:()=>{const{guideId:e}=t.handler;Oo("TODO -> open guide",e)}};default:return{}}})(t,r)).reduce((t,e)=>({...t,...e}),{})},Ao=(t,e)=>{try{const{provider:r,document:n,trackingIdentifiers:o}=e,a=n.nodes[t];if(!a)return Ro.error("Document is corrupted. Refusing to move further."),null;const i=t=>Ao(t,e),{type:u,props:c,css:s}=a,l={...c||{},style:s||{},children:(c||{}).children||a.nodes&&a.nodes.map(i),...No(a,{trackingIdentifiers:o,provider:r})},d={nodeId:t,node:a,document:n,render:{node:i,styleguide:(t,r={})=>e.renderNode(t,{api:d,attributes:r}),tutorial:t=>e.renderTutorial(t),portal:t=>e.renderPortal(t)},trackingIdentifiers:o},f=d.render.styleguide(u,l);return f||(Ro.error(dn[sn.UNKOWN_NODE_TYPE],{type:u}),r.eventing.track(sn.UNKOWN_NODE_TYPE,{type:u}),null)}catch(t){return Ro.error(dn[sn.STYLEGUIDE_MAP_ERROR],t),null}},mo=Nr((t,e)=>{const{provider:r,portal:n,tutorial:o}=t,a=r.styleguide;let i,u;return o&&(u=o.styleguide),n&&(i=n.styleguide),{...a||{},...i||{},...u||{},...e||{}}}),jo="",Do="#EDEDED",Po="#333745",wo="#838792",Lo="#FEFEFE",So="#FEFEFE",Co={primary:"#6310E5",secondary:"#59C3C3",tertiary:"#4D515D",warning:"#FCAD0D",danger:"#EE4266"},Uo=t=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("href",`${po}/styleguides/applications/${t}/default/main.css`),document.head.appendChild(e)};export{Do as DEFAULT_ALERT_COLOR,jo as DEFAULT_ALT,Lo as DEFAULT_TAB_ACTIVE_COLOR,So as DEFAULT_TAB_COLOR,Po as DEFAULT_TAB_HEADER_COLOR,wo as DEFAULT_TAB_ITEM_COLOR,dn as ERROR_MESSAGES,cn as ERROR_SLUGS,sn as EVENT_NAMES,_n as LOGGER,go as RESOURCES,Co as STYLEGUIDE_COLORS,on as adaptCustomNodes,Uo as attachStylesheet,nn as convertStyleNumberValues,fn as defaultStyleguide,pn as internalEventing,Oo as logError,To as logWarning,Ro as logger,Ao as mapNodeToStyleguide,mo as mergeStyleguidesFromContext,lo as portalValidation,co as providerValidation,so as tutorialValidation,rn as unpackShorthandStyles}; | ||
//# sourceMappingURL=index.es.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("util"),require("crypto")):"function"==typeof define&&define.amd?define(["exports","util","crypto"],e):e((t=t||self)["@candulabs/core"]={},t.util,t.e)}(this,(function(t,e,r){"use strict";r=r&&r.hasOwnProperty("default")?r.default:r;var n="undefined"!=typeof globalThis?globalThis:"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 a="object"==typeof n&&n&&n.Object===Object&&n,i="object"==typeof self&&self&&self.Object===Object&&self,u=a||i||Function("return this")(),c=u.Symbol,l=Object.prototype,s=l.hasOwnProperty,d=l.toString,f=c?c.toStringTag:void 0;var _=function(t){var e=s.call(t,f),r=t[f];try{t[f]=void 0;var n=!0}catch(t){}var o=d.call(t);return n&&(e?t[f]=r:delete t[f]),o},p=Object.prototype.toString;var v=function(t){return p.call(t)},h="[object Null]",E="[object Undefined]",y=c?c.toStringTag:void 0;var b=function(t){return null==t?void 0===t?E:h:y&&y in Object(t)?_(t):v(t)};var O=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},g="[object AsyncFunction]",T="[object Function]",R="[object GeneratorFunction]",A="[object Proxy]";var I,N=function(t){if(!O(t))return!1;var e=b(t);return e==T||e==R||e==g||e==A},m=u["__core-js_shared__"],j=(I=/[^.]+$/.exec(m&&m.keys&&m.keys.IE_PROTO||""))?"Symbol(src)_1."+I:"";var L=function(t){return!!j&&j in t},D=Function.prototype.toString;var P=function(t){if(null!=t){try{return D.call(t)}catch(t){}try{return t+""}catch(t){}}return""},S=/^\[object .+?Constructor\]$/,w=Function.prototype,C=Object.prototype,U=w.toString,k=C.hasOwnProperty,B=RegExp("^"+U.call(k).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var M=function(t){return!(!O(t)||L(t))&&(N(t)?B:S).test(P(t))};var x=function(t,e){return null==t?void 0:t[e]};var z=function(t,e){var r=x(t,e);return M(r)?r:void 0},$=function(){try{var t=z(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var G=function(t,e,r){"__proto__"==e&&$?$(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r};var W=function(t){return function(e,r,n){for(var o=-1,a=Object(e),i=n(e),u=i.length;u--;){var c=i[t?u:++o];if(!1===r(a[c],c,a))break}return e}}();var F=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n};var V=function(t){return null!=t&&"object"==typeof t},Y="[object Arguments]";var H=function(t){return V(t)&&b(t)==Y},K=Object.prototype,q=K.hasOwnProperty,J=K.propertyIsEnumerable,Z=H(function(){return arguments}())?H:function(t){return V(t)&&q.call(t,"callee")&&!J.call(t,"callee")},X=Array.isArray;var Q=function(){return!1},tt=o((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r?u.Buffer:void 0,a=(o?o.isBuffer:void 0)||Q;t.exports=a})),et=9007199254740991,rt=/^(?:0|[1-9]\d*)$/;var nt=function(t,e){var r=typeof t;return!!(e=null==e?et:e)&&("number"==r||"symbol"!=r&&rt.test(t))&&t>-1&&t%1==0&&t<e},ot=9007199254740991;var at=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=ot},it={};it["[object Float32Array]"]=it["[object Float64Array]"]=it["[object Int8Array]"]=it["[object Int16Array]"]=it["[object Int32Array]"]=it["[object Uint8Array]"]=it["[object Uint8ClampedArray]"]=it["[object Uint16Array]"]=it["[object Uint32Array]"]=!0,it["[object Arguments]"]=it["[object Array]"]=it["[object ArrayBuffer]"]=it["[object Boolean]"]=it["[object DataView]"]=it["[object Date]"]=it["[object Error]"]=it["[object Function]"]=it["[object Map]"]=it["[object Number]"]=it["[object Object]"]=it["[object RegExp]"]=it["[object Set]"]=it["[object String]"]=it["[object WeakMap]"]=!1;var ut=function(t){return V(t)&&at(t.length)&&!!it[b(t)]};var ct=function(t){return function(e){return t(e)}},lt=o((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r&&a.process,i=function(){try{var t=n&&n.require&&n.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=i})),st=lt&<.isTypedArray,dt=st?ct(st):ut,ft=Object.prototype.hasOwnProperty;var _t=function(t,e){var r=X(t),n=!r&&Z(t),o=!r&&!n&&tt(t),a=!r&&!n&&!o&&dt(t),i=r||n||o||a,u=i?F(t.length,String):[],c=u.length;for(var l in t)!e&&!ft.call(t,l)||i&&("length"==l||o&&("offset"==l||"parent"==l)||a&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||nt(l,c))||u.push(l);return u},pt=Object.prototype;var vt=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||pt)};var ht=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),Et=Object.prototype.hasOwnProperty;var yt=function(t){if(!vt(t))return ht(t);var e=[];for(var r in Object(t))Et.call(t,r)&&"constructor"!=r&&e.push(r);return e};var bt=function(t){return null!=t&&at(t.length)&&!N(t)};var Ot=function(t){return bt(t)?_t(t):yt(t)};var gt=function(t,e){return t&&W(t,e,Ot)};var Tt=function(){this.__data__=[],this.size=0};var Rt=function(t,e){return t===e||t!=t&&e!=e};var At=function(t,e){for(var r=t.length;r--;)if(Rt(t[r][0],e))return r;return-1},It=Array.prototype.splice;var Nt=function(t){var e=this.__data__,r=At(e,t);return!(r<0)&&(r==e.length-1?e.pop():It.call(e,r,1),--this.size,!0)};var mt=function(t){var e=this.__data__,r=At(e,t);return r<0?void 0:e[r][1]};var jt=function(t){return At(this.__data__,t)>-1};var Lt=function(t,e){var r=this.__data__,n=At(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function Dt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Dt.prototype.clear=Tt,Dt.prototype.delete=Nt,Dt.prototype.get=mt,Dt.prototype.has=jt,Dt.prototype.set=Lt;var Pt=Dt;var St=function(){this.__data__=new Pt,this.size=0};var wt=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};var Ct=function(t){return this.__data__.get(t)};var Ut=function(t){return this.__data__.has(t)},kt=z(u,"Map"),Bt=z(Object,"create");var Mt=function(){this.__data__=Bt?Bt(null):{},this.size=0};var xt=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},zt="__lodash_hash_undefined__",$t=Object.prototype.hasOwnProperty;var Gt=function(t){var e=this.__data__;if(Bt){var r=e[t];return r===zt?void 0:r}return $t.call(e,t)?e[t]:void 0},Wt=Object.prototype.hasOwnProperty;var Ft=function(t){var e=this.__data__;return Bt?void 0!==e[t]:Wt.call(e,t)},Vt="__lodash_hash_undefined__";var Yt=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Bt&&void 0===e?Vt:e,this};function Ht(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Ht.prototype.clear=Mt,Ht.prototype.delete=xt,Ht.prototype.get=Gt,Ht.prototype.has=Ft,Ht.prototype.set=Yt;var Kt=Ht;var qt=function(){this.size=0,this.__data__={hash:new Kt,map:new(kt||Pt),string:new Kt}};var Jt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Zt=function(t,e){var r=t.__data__;return Jt(e)?r["string"==typeof e?"string":"hash"]:r.map};var Xt=function(t){var e=Zt(this,t).delete(t);return this.size-=e?1:0,e};var Qt=function(t){return Zt(this,t).get(t)};var te=function(t){return Zt(this,t).has(t)};var ee=function(t,e){var r=Zt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function re(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}re.prototype.clear=qt,re.prototype.delete=Xt,re.prototype.get=Qt,re.prototype.has=te,re.prototype.set=ee;var ne=re,oe=200;var ae=function(t,e){var r=this.__data__;if(r instanceof Pt){var n=r.__data__;if(!kt||n.length<oe-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new ne(n)}return r.set(t,e),this.size=r.size,this};function ie(t){var e=this.__data__=new Pt(t);this.size=e.size}ie.prototype.clear=St,ie.prototype.delete=wt,ie.prototype.get=Ct,ie.prototype.has=Ut,ie.prototype.set=ae;var ue=ie,ce="__lodash_hash_undefined__";var le=function(t){return this.__data__.set(t,ce),this};var se=function(t){return this.__data__.has(t)};function de(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new ne;++e<r;)this.add(t[e])}de.prototype.add=de.prototype.push=le,de.prototype.has=se;var fe=de;var _e=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1};var pe=function(t,e){return t.has(e)},ve=1,he=2;var Ee=function(t,e,r,n,o,a){var i=r&ve,u=t.length,c=e.length;if(u!=c&&!(i&&c>u))return!1;var l=a.get(t);if(l&&a.get(e))return l==e;var s=-1,d=!0,f=r&he?new fe:void 0;for(a.set(t,e),a.set(e,t);++s<u;){var _=t[s],p=e[s];if(n)var v=i?n(p,_,s,e,t,a):n(_,p,s,t,e,a);if(void 0!==v){if(v)continue;d=!1;break}if(f){if(!_e(e,(function(t,e){if(!pe(f,e)&&(_===t||o(_,t,r,n,a)))return f.push(e)}))){d=!1;break}}else if(_!==p&&!o(_,p,r,n,a)){d=!1;break}}return a.delete(t),a.delete(e),d},ye=u.Uint8Array;var be=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r};var Oe=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r},ge=1,Te=2,Re="[object Boolean]",Ae="[object Date]",Ie="[object Error]",Ne="[object Map]",me="[object Number]",je="[object RegExp]",Le="[object Set]",De="[object String]",Pe="[object Symbol]",Se="[object ArrayBuffer]",we="[object DataView]",Ce=c?c.prototype:void 0,Ue=Ce?Ce.valueOf:void 0;var ke=function(t,e,r,n,o,a,i){switch(r){case we:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Se:return!(t.byteLength!=e.byteLength||!a(new ye(t),new ye(e)));case Re:case Ae:case me:return Rt(+t,+e);case Ie:return t.name==e.name&&t.message==e.message;case je:case De:return t==e+"";case Ne:var u=be;case Le:var c=n≥if(u||(u=Oe),t.size!=e.size&&!c)return!1;var l=i.get(t);if(l)return l==e;n|=Te,i.set(t,e);var s=Ee(u(t),u(e),n,o,a,i);return i.delete(t),s;case Pe:if(Ue)return Ue.call(t)==Ue.call(e)}return!1};var Be=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t};var Me=function(t,e,r){var n=e(t);return X(t)?n:Be(n,r(t))};var xe=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,a=[];++r<n;){var i=t[r];e(i,r,t)&&(a[o++]=i)}return a};var ze=function(){return[]},$e=Object.prototype.propertyIsEnumerable,Ge=Object.getOwnPropertySymbols,We=Ge?function(t){return null==t?[]:(t=Object(t),xe(Ge(t),(function(e){return $e.call(t,e)})))}:ze;var Fe=function(t){return Me(t,Ot,We)},Ve=1,Ye=Object.prototype.hasOwnProperty;var He=function(t,e,r,n,o,a){var i=r&Ve,u=Fe(t),c=u.length;if(c!=Fe(e).length&&!i)return!1;for(var l=c;l--;){var s=u[l];if(!(i?s in e:Ye.call(e,s)))return!1}var d=a.get(t);if(d&&a.get(e))return d==e;var f=!0;a.set(t,e),a.set(e,t);for(var _=i;++l<c;){var p=t[s=u[l]],v=e[s];if(n)var h=i?n(v,p,s,e,t,a):n(p,v,s,t,e,a);if(!(void 0===h?p===v||o(p,v,r,n,a):h)){f=!1;break}_||(_="constructor"==s)}if(f&&!_){var E=t.constructor,y=e.constructor;E!=y&&"constructor"in t&&"constructor"in e&&!("function"==typeof E&&E instanceof E&&"function"==typeof y&&y instanceof y)&&(f=!1)}return a.delete(t),a.delete(e),f},Ke=z(u,"DataView"),qe=z(u,"Promise"),Je=z(u,"Set"),Ze=z(u,"WeakMap"),Xe=P(Ke),Qe=P(kt),tr=P(qe),er=P(Je),rr=P(Ze),nr=b;(Ke&&"[object DataView]"!=nr(new Ke(new ArrayBuffer(1)))||kt&&"[object Map]"!=nr(new kt)||qe&&"[object Promise]"!=nr(qe.resolve())||Je&&"[object Set]"!=nr(new Je)||Ze&&"[object WeakMap]"!=nr(new Ze))&&(nr=function(t){var e=b(t),r="[object Object]"==e?t.constructor:void 0,n=r?P(r):"";if(n)switch(n){case Xe:return"[object DataView]";case Qe:return"[object Map]";case tr:return"[object Promise]";case er:return"[object Set]";case rr:return"[object WeakMap]"}return e});var or=nr,ar=1,ir="[object Arguments]",ur="[object Array]",cr="[object Object]",lr=Object.prototype.hasOwnProperty;var sr=function(t,e,r,n,o,a){var i=X(t),u=X(e),c=i?ur:or(t),l=u?ur:or(e),s=(c=c==ir?cr:c)==cr,d=(l=l==ir?cr:l)==cr,f=c==l;if(f&&tt(t)){if(!tt(e))return!1;i=!0,s=!1}if(f&&!s)return a||(a=new ue),i||dt(t)?Ee(t,e,r,n,o,a):ke(t,e,c,r,n,o,a);if(!(r&ar)){var _=s&&lr.call(t,"__wrapped__"),p=d&&lr.call(e,"__wrapped__");if(_||p){var v=_?t.value():t,h=p?e.value():e;return a||(a=new ue),o(v,h,r,n,a)}}return!!f&&(a||(a=new ue),He(t,e,r,n,o,a))};var dr=function t(e,r,n,o,a){return e===r||(null==e||null==r||!V(e)&&!V(r)?e!=e&&r!=r:sr(e,r,n,o,t,a))},fr=1,_r=2;var pr=function(t,e,r,n){var o=r.length,a=o,i=!n;if(null==t)return!a;for(t=Object(t);o--;){var u=r[o];if(i&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<a;){var c=(u=r[o])[0],l=t[c],s=u[1];if(i&&u[2]){if(void 0===l&&!(c in t))return!1}else{var d=new ue;if(n)var f=n(l,s,c,t,e,d);if(!(void 0===f?dr(s,l,fr|_r,n,d):f))return!1}}return!0};var vr=function(t){return t==t&&!O(t)};var hr=function(t){for(var e=Ot(t),r=e.length;r--;){var n=e[r],o=t[n];e[r]=[n,o,vr(o)]}return e};var Er=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}};var yr=function(t){var e=hr(t);return 1==e.length&&e[0][2]?Er(e[0][0],e[0][1]):function(r){return r===t||pr(r,t,e)}},br="[object Symbol]";var Or=function(t){return"symbol"==typeof t||V(t)&&b(t)==br},gr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Tr=/^\w*$/;var Rr=function(t,e){if(X(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!Or(t))||(Tr.test(t)||!gr.test(t)||null!=e&&t in Object(e))},Ar="Expected a function";function Ir(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(Ar);var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=t.apply(this,n);return r.cache=a.set(o,i)||a,i};return r.cache=new(Ir.Cache||ne),r}Ir.Cache=ne;var Nr=Ir,mr=500;var jr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Lr=/\\(\\)?/g,Dr=function(t){var e=Nr(t,(function(t){return r.size===mr&&r.clear(),t})),r=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(jr,(function(t,r,n,o){e.push(n?o.replace(Lr,"$1"):r||t)})),e}));var Pr=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o},Sr=1/0,wr=c?c.prototype:void 0,Cr=wr?wr.toString:void 0;var Ur=function t(e){if("string"==typeof e)return e;if(X(e))return Pr(e,t)+"";if(Or(e))return Cr?Cr.call(e):"";var r=e+"";return"0"==r&&1/e==-Sr?"-0":r};var kr=function(t){return null==t?"":Ur(t)};var Br=function(t,e){return X(t)?t:Rr(t,e)?[t]:Dr(kr(t))},Mr=1/0;var xr=function(t){if("string"==typeof t||Or(t))return t;var e=t+"";return"0"==e&&1/t==-Mr?"-0":e};var zr=function(t,e){for(var r=0,n=(e=Br(e,t)).length;null!=t&&r<n;)t=t[xr(e[r++])];return r&&r==n?t:void 0};var $r=function(t,e,r){var n=null==t?void 0:zr(t,e);return void 0===n?r:n};var Gr=function(t,e){return null!=t&&e in Object(t)};var Wr=function(t,e,r){for(var n=-1,o=(e=Br(e,t)).length,a=!1;++n<o;){var i=xr(e[n]);if(!(a=null!=t&&r(t,i)))break;t=t[i]}return a||++n!=o?a:!!(o=null==t?0:t.length)&&at(o)&&nt(i,o)&&(X(t)||Z(t))};var Fr=function(t,e){return null!=t&&Wr(t,e,Gr)},Vr=1,Yr=2;var Hr=function(t,e){return Rr(t)&&vr(e)?Er(xr(t),e):function(r){var n=$r(r,t);return void 0===n&&n===e?Fr(r,t):dr(e,n,Vr|Yr)}};var Kr=function(t){return t};var qr=function(t){return function(e){return null==e?void 0:e[t]}};var Jr=function(t){return function(e){return zr(e,t)}};var Zr=function(t){return Rr(t)?qr(xr(t)):Jr(t)};var Xr=function(t){return"function"==typeof t?t:null==t?Kr:"object"==typeof t?X(t)?Hr(t[0],t[1]):yr(t):Zr(t)};var Qr=function(t,e){var r={};return e=Xr(e),gt(t,(function(t,n,o){G(r,n,e(t,n,o))})),r},tn={boxFlex:!0,boxFlexGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0};var en=["Webkit","ms","Moz","O"];Object.keys(tn).forEach((function(t){en.forEach((function(e){tn[function(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}(e,t)]=tn[t]}))}));var rn={isUnitlessNumber:tn,shorthandPropertyExpansions:{background:{backgroundImage:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundColor:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0}}};const nn=t=>{const{padding:e,margin:r,...n}=t.css;let o={};return e&&(o={paddingRight:e,paddingLeft:e,paddingBottom:e,paddingTop:e}),r&&(o={...o,marginRight:r,marginLeft:r,marginBottom:r,marginTop:r}),{...t,css:{...o,...n}}},on=t=>{const r=t.css,n={};return Object.entries(r).forEach(([t,r])=>{if(e.isNumber(r))return rn.isUnitlessNumber[t]?void(n[t]=`${r}`):void(n[t]=`${r}px`);n[t]=r}),{...t,css:n}},an=t=>`candu.sdk.${t}`,un=t=>an(`error.${t}`),cn={UNKOWN_NODE_TYPE:"unknown_node_type",UNKOWN_BLOCK_NODE_TYPE:"unkown_block_node_type",UNKOWN_INLINE_NODE_TYPE:"unkown_inline_node_type",UNKOWN_NODE_OBJECT_TYPE:"unkown_node_object_type",TUTORIAL_ERROR:"tutorial_error_boundary",PORTAL_ERROR:"portal_error_boundary",STYLEGUIDE_MAP_ERROR:"styleguide_map",RENDER_NODE_ERROR:"render_node"},ln={HEARTBEAT:an("heartbeat"),PREVIEW_OPEN:an("preview.open"),PORTAL:an("portal"),TUTORIAL:an("tutorial"),TUTORIAL_INTERACTION:an("tutorial.interaction"),PORTAL_ASSET_NOT_FOUND:un("portal_asset_not_found"),PORTAL_NO_SEGMENT_IDS:un("portal_no_segment_ids"),NO_MATCHING_TUTORIALS:un("no_matching_tutorials"),NO_VALID_TUTORIAL_IDENTIFIER:un("no_valid_tutorial_identifier"),COMMIT_API_LOADING_ERROR:un("commit_api"),TUTORIAL_LOADING_ERROR:un("tutorial"),UNKOWN_NODE_TYPE:un(cn.UNKOWN_NODE_TYPE),UNKOWN_INLINE_NODE_TYPE:un(cn.UNKOWN_INLINE_NODE_TYPE),UNKOWN_NODE_OBJECT_TYPE:un(cn.UNKOWN_NODE_OBJECT_TYPE),TUTORIAL_ERROR:un(cn.TUTORIAL_ERROR),PORTAL_ERROR:un(cn.PORTAL_ERROR),STYLEGUIDE_MAP_ERROR:un(cn.TUTORIAL_ERROR),RENDER_NODE_ERROR:un(cn.TUTORIAL_ERROR),CIRCULAR_DEPENDENCY_EMBED_PORTAL:un("circular_dependecy_embed_portal"),CIRCULAR_DEPENDENCY_EMBED_TUTORIAL:un("circular_dependecy_embed_tutorial")},sn=t=>`An error has occured while trying to parse your Tutorial.\nUpgrade the SDK to the latest version to get rid of this error.\nErrorCode: ${t}.`,dn={EVENTING_NOT_INITIALIZED:"You tried to send an event, but you haven't initialized eventing.\nThis is happening because you called eventing outside the scope of the CanduProvider. It can be fixed by:\n1. Adding CanduProvider to the root of the application.\n2. Initializing a new Eventing object outside of Candu.\nRead here for more context: http://udn.ac/tracking-not-init.\n",[ln.PORTAL_ASSET_NOT_FOUND]:"Could not find the requested Portal. This could happen because:\n1. The Portal does not exist or it was deleted.\n2. The Portal has not been made avaliable to be rendered.\n3. CORS Authenticaton failed.\nSee http://udn.ac/portal-not-found for more information.\n",[ln.PORTAL_NO_SEGMENT_IDS]:"You have tried to render a Portal that doesn't contain any content.\nAdd content to your Portal: https://udn.ac/update-portals.\n",[ln.NO_MATCHING_TUTORIALS]:"The Tutorial will not be rendered because there are no matching segments for the given user.",[ln.NO_VALID_TUTORIAL_IDENTIFIER]:"(Candu/Tutorial) You must define one of tutorialId, slug, commitId or contentHashId.",[ln.TUTORIAL_LOADING_ERROR]:"An error has occurred while trying to load the Tutorial",[ln.UNKOWN_INLINE_NODE_TYPE]:sn(cn.UNKOWN_INLINE_NODE_TYPE),[ln.UNKOWN_NODE_TYPE]:sn(cn.UNKOWN_NODE_TYPE),[ln.CIRCULAR_DEPENDENCY_EMBED_PORTAL]:"Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",[ln.CIRCULAR_DEPENDENCY_EMBED_TUTORIAL]:"Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",[ln.PORTAL_ERROR]:"An error has occured within Portal",[ln.TUTORIAL_ERROR]:"An error has occured within Tutorial",[ln.RENDER_NODE_ERROR]:"An error has occured while rendering tutorial node",[ln.STYLEGUIDE_MAP_ERROR]:"An error has occured while mapping node to styleguide"},fn={Alert:!0,B:!0,Badge:!0,Button:!0,Card:!0,Code:!0,Document:!0,Em:!0,EmbedPortal:!0,EmbedTutorial:!0,Flex:!0,FlexItem:!0,H1:!0,H2:!0,H3:!0,H4:!0,H5:!0,H6:!0,Image:!0,InlineCode:!0,Link:!0,List:!0,ListItem:!0,P:!0,RichText:!0,Spacing:!0,Text:!0,U:!0,View:!0,Player:!0},_n={error:console.error,warning:console.warn};for(var pn=function(){return r.randomBytes(16)},vn=[],hn=0;hn<256;++hn)vn[hn]=(hn+256).toString(16).substr(1);var En,yn,bn=function(t,e){var r=e||0,n=vn;return[n[t[r++]],n[t[r++]],n[t[r++]],n[t[r++]],"-",n[t[r++]],n[t[r++]],"-",n[t[r++]],n[t[r++]],"-",n[t[r++]],n[t[r++]],"-",n[t[r++]],n[t[r++]],n[t[r++]],n[t[r++]],n[t[r++]],n[t[r++]]].join("")},On=function(t,e,r){var n=e&&r||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var o=(t=t||{}).random||(t.rng||pn)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e)for(var a=0;a<16;++a)e[n+a]=o[a];return e||bn(o)};Object.freeze({__proto__:null,API_BASE_URL:"https://api.candu.ai",VERSION:"0.5.0"});!function(t){t.UserGenerated="UserGenerated",t.SDK="SDK"}(En||(En={})),function(t){t.Identify="Identify",t.Group="Group",t.Track="Track",t.Page="Page",t.Screen="Screen"}(yn||(yn={}));const gn=()=>"undefined"!=typeof window&&window.localStorage,Tn=t=>e=>{gn()&&null!=e&&window.localStorage.setItem(t,JSON.stringify(e))};const Rn={anonymousId:{getOrCreate:((t,e)=>()=>(t=>()=>{if(gn()){const t=window.localStorage.getItem("candu:anonymous_id");if(t)try{return JSON.parse(t)}catch(t){return null}}})()()||(()=>{const t=On();return Tn("candu:anonymous_id")(t),t})())(),set:Tn("candu:anonymous_id")}}.anonymousId.getOrCreate;var An="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},In="object"==typeof An&&An&&An.Object===Object&&An,Nn="object"==typeof self&&self&&self.Object===Object&&self,mn=(In||Nn||Function("return this")()).Symbol,jn=Object.prototype,Ln=jn.hasOwnProperty,Dn=jn.toString,Pn=mn?mn.toStringTag:void 0,Sn=Object.prototype.toString,wn=mn?mn.toStringTag:void 0,Cn=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":wn&&wn in Object(t)?function(t){var e=Ln.call(t,Pn),r=t[Pn];try{t[Pn]=void 0;var n=!0}catch(t){}var o=Dn.call(t);return n&&(e?t[Pn]=r:delete t[Pn]),o}(t):function(t){return Sn.call(t)}(t)},Un=Array.isArray,kn=function(t){return null!=t&&"object"==typeof t},Bn=function(t){return"string"==typeof t||!Un(t)&&kn(t)&&"[object String]"==Cn(t)};const Mn=/^([a-zA-Z0-9]|_|-)+$/,xn=t=>(function(t){return"number"==typeof t||kn(t)&&"[object Number]"==Cn(t)})(t)&&t>=0;var zn,$n,Gn,Wn,Fn,Vn;!function(t){t.SDK="SDK",t.PREVIEW="PREVIEW"}(zn||(zn={})),function(t){t.BOOTSTRAP="Bootstrap",t.CHANGE_POSITION="ChangePosition",t.CLOSE_PREVIEW="ClosePreview",t.PREVIEW_LOADED="PreviewLoaded",t.SET_AVALIABLE_PORTALS="SetAvaliablePortals",t.SET_CONTENT="SetContent",t.SET_SELECTED_ELEMENT="SetSelectedElement",t.SET_VIEW_MODE="SetViewMode",t.ADD_ELEMENT="AddElement",t.REMOVE_ELEMENT="RemoveElement",t.UPDATE_ELEMENT="UpdateElement",t.SET_ELEMENT="SetElement"}($n||($n={})),function(t){t.ON_CLICK="OnClick"}(Gn||(Gn={})),function(t){t.NATIVE="Native",t.PENDO="Pendo"}(Wn||(Wn={})),function(t){t.NAVIGATE="Navigate",t.CHANGE_TUTORIAL="ChangeTutorial",t.OPEN_GUIDE="OpenGuide"}(Fn||(Fn={})),function(t){t.PRIMARY="primary",t.SECONDARY="primary",t.WARNING="warning",t.DANGER="danger",t.NEUTRAL="neutral",t.ACTIVE="active",t.INFO="info"}(Vn||(Vn={}));Vn.PRIMARY;var Yn;!function(t){t.U="U",t.B="B",t.Em="Em",t.InlineCode="InlineCode"}(Yn||(Yn={}));const Hn=t=>(t=>Bn(t)&&t.length>=3&&t.length<100&&Mn.test(t))(t);var Kn,qn,Jn,Zn;Object.freeze({__proto__:null,PREVIEW_SCRIPT_URL:"https://app.candu.ai/preview.html"});!function(t){t.COLLAPSED="Collapsed",t.EXPANDED="Expanded",t.MINIMIZED="Minimized"}(Kn||(Kn={})),function(t){t.TUTORIAL="Tutorial",t.PORTAL="Portal"}(qn||(qn={})),function(t){t.Global="Global",t.Organization="Organization"}(Jn||(Jn={})),function(t){t.Root="root",t.Rule="rule",t.Atrule="atrule",t.Decl="decl",t.Any="any"}(Zn||(Zn={}));var Xn=function(t,e,r,n,o,a,i,u){if(!t){var c;if(void 0===e)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[r,n,o,a,i,u],s=0;(c=new Error(e.replace(/%s/g,(function(){return l[s++]})))).name="Invariant Violation"}throw c.framesToPop=1,c}};const Qn=t=>Xn(!t||O(t),"(Candu) styleguide must be undefined or an object");var to=Object.freeze({__proto__:null,API_BASE_URL:"https://api.candu.ai",CDN_BASE_URL:"https://cdn.candu.ai",VERSION:"0.5.1"});const{API_BASE_URL:eo}=to,{CDN_BASE_URL:ro}=to,no="/api/segmentMemberships",oo="/api/tutorialDocumentsEditor",ao=async t=>(await fetch(t)).json(),io=t=>ao(`${eo}${t}`),uo=t=>ao(`${ro}${t}`),co={tutorialDocumentLatestPublished:async(t,e)=>io(`${oo}?token=${t}&finder=latestPublished&tutorialId=${e}`),portalAsset:async(t,e)=>uo(`/portals/${t}/${e}/head.json`),segmentMembership:async(t,e)=>io(`${no}/${e}?token=${t}`),tutorialDocument:(t,e,r)=>{const{contentHashId:n,tutorialId:o,tutorialDocument:a,slug:i}=t,u=(t=>({byId:e=>io(`${oo}/${e}?token=${t}`),bySlug:e=>uo(`/tutorials/${t}/${e}.json`),byContentHash:e=>uo(`/tutorials/${t}/${e}.json`)}))(e);return(t=>xn(t))(o)?u.byId(o):Hn(i)?u.bySlug(i):(t=>Bn(t)&&!!t.match(/^[0-9a-zA-Z]{40}$/))(n)?u.byContentHash(n):O(a)?Promise.resolve(a):(_n.error(dn[ln.NO_VALID_TUTORIAL_IDENTIFIER]),r.track(ln.NO_VALID_TUTORIAL_IDENTIFIER,{slug:t.slug}),null)}},lo=(...t)=>console.error(...t),so=(...t)=>console.warn(...t),fo={error:lo,warning:so},_o=t=>{switch(t.trigger){case Gn.ON_CLICK:default:return"onClick"}},po=({data:t},e)=>{if(!t||!t.actions)return{};const r=t=>{e.provider.eventing.track(ln.TUTORIAL_INTERACTION,{...t,...e.trackingIdentifiers||{}})};return t.actions.map(t=>((t,e)=>{switch(t.handler.type){case Fn.NAVIGATE:return{[_o(t)]:()=>{const{href:r,target:n}=t.handler;e(t),"Blank"===n?window.open(r,"_blank"):r&&r.includes("mailto:")?window.location=r:document.location.href=r}};case Fn.CHANGE_TUTORIAL:return{[_o(t)]:()=>{const{tutorialId:e}=t.handler;lo("TODO -> change tutorial",e)}};case Fn.OPEN_GUIDE:return{[_o(t)]:()=>{const{guideId:e}=t.handler;lo("TODO -> open guide",e)}};default:return{}}})(t,r)).reduce((t,e)=>({...t,...e}),{})},vo=(t,e)=>{try{const{provider:r,document:n,trackingIdentifiers:o}=e,a=n.nodes[t];if(!a)return fo.error("Document is corrupted. Refusing to move further."),null;const i=t=>vo(t,e),{type:u,props:c,css:l}=a,s={...c||{},style:l||{},children:(c||{}).children||a.nodes&&a.nodes.map(i),...po(a,{trackingIdentifiers:o,provider:r})},d={nodeId:t,node:a,document:n,render:{node:i,styleguide:(t,r={})=>e.renderNode(t,{api:d,attributes:r}),tutorial:t=>e.renderTutorial(t),portal:t=>e.renderPortal(t)},trackingIdentifiers:o},f=d.render.styleguide(u,s);return f||(fo.error(dn[ln.UNKOWN_NODE_TYPE],{type:u}),r.eventing.track(ln.UNKOWN_NODE_TYPE,{type:u}),null)}catch(t){return fo.error(dn[ln.STYLEGUIDE_MAP_ERROR],t),null}},ho=Nr((t,e)=>{const{provider:r,portal:n,tutorial:o}=t,a=r.styleguide;let i,u;return o&&(u=o.styleguide),n&&(i=n.styleguide),{...a||{},...i||{},...u||{},...e||{}}});t.DEFAULT_ALERT_COLOR="#EDEDED",t.DEFAULT_ALT="",t.DEFAULT_TAB_ACTIVE_COLOR="#FEFEFE",t.DEFAULT_TAB_COLOR="#FEFEFE",t.DEFAULT_TAB_HEADER_COLOR="#333745",t.DEFAULT_TAB_ITEM_COLOR="#838792",t.ERROR_MESSAGES=dn,t.ERROR_SLUGS=cn,t.EVENT_NAMES=ln,t.LOGGER=_n,t.RESOURCES=co,t.STYLEGUIDE_COLORS={primary:"#6310E5",secondary:"#59C3C3",tertiary:"#4D515D",warning:"#FCAD0D",danger:"#EE4266"},t.adaptCustomNodes=t=>Qr(t,t=>{let e=t;return"Typography"===e.type&&(e=(t=>{const e=$r(t,"data.custom.variant","P");return{...t,type:e}})(e)),e.css&&"flexBasis"in e.css&&(e=(t=>{const{flexBasis:e}=t.css;return"0"===e||"0px"===e?{...t,css:{...t.css,flexBasis:"0%"}}:t})(e)),e.css&&(e=nn(e),e=on(e)),e}),t.attachStylesheet=t=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("href",`${ro}/styleguides/applications/${t}/default/main.css`),document.head.appendChild(e)},t.convertStyleNumberValues=on,t.defaultStyleguide=fn,t.internalEventing=({identify:t,track:e})=>({provider:({userId:r,traits:n,styleguide:o})=>{t(r,n),e(ln.HEARTBEAT,(t=>{const e={};return Object.keys(t).forEach(r=>{fn[r]&&(e[`styleguide.${r}`]=t[r].displayName||!0)}),e})(o))},tutorialDocumentLoadingError:({tutorialId:t,slug:r,contentHashId:n})=>{_n.error(dn[ln.TUTORIAL_LOADING_ERROR]),e(ln.TUTORIAL_LOADING_ERROR,{tutorialId:t,slug:r,contentHashId:n})}}),t.logError=lo,t.logWarning=so,t.logger=fo,t.mapNodeToStyleguide=vo,t.mergeStyleguidesFromContext=ho,t.portalValidation=({slug:t,styleguide:e})=>(Qn(e),{slug:t,styleguide:e||{}}),t.providerValidation=({clientToken:t,userId:e,traits:r,options:n,styleguide:o,...a})=>(Xn((t=>Bn(t)&&!!t.match(/^[0-9a-zA-Z]*$/)&&t.length>=10)(t),"(Candu) you must provide a valid clientToken"),Xn(!e||(t=>xn(t)||Bn(t)&&t.trim().length>0)(e),"(Candu) you must provide a valid userId"),Qn(o),Xn(!r||O(r),"(Candu) traits must be undefined or an object"),Xn(!n||O(n),"(Candu) options must be undefined or an object"),{...a,clientToken:t,traits:r||{},options:n||{},styleguide:o||{},userId:e||Rn()}),t.tutorialValidation=({slug:t,styleguide:e,contentHashId:r,tutorialId:n,tutorialDocument:o,...a})=>(Qn(e),{...a,slug:t,styleguide:e||{},contentHashId:r,tutorialId:n,tutorialDocument:o}),t.unpackShorthandStyles=nn,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("util"),require("crypto")):"function"==typeof define&&define.amd?define(["exports","util","crypto"],e):e((t=t||self)["@candulabs/core"]={},t.util,t.crypto)}(this,(function(t,e,r){"use strict";r=r&&r.hasOwnProperty("default")?r.default:r;var n="undefined"!=typeof globalThis?globalThis:"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 a="object"==typeof n&&n&&n.Object===Object&&n,i="object"==typeof self&&self&&self.Object===Object&&self,u=a||i||Function("return this")(),c=u.Symbol,l=Object.prototype,s=l.hasOwnProperty,d=l.toString,f=c?c.toStringTag:void 0;var _=function(t){var e=s.call(t,f),r=t[f];try{t[f]=void 0;var n=!0}catch(t){}var o=d.call(t);return n&&(e?t[f]=r:delete t[f]),o},p=Object.prototype.toString;var v=function(t){return p.call(t)},h="[object Null]",E="[object Undefined]",y=c?c.toStringTag:void 0;var b=function(t){return null==t?void 0===t?E:h:y&&y in Object(t)?_(t):v(t)};var O=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},g="[object AsyncFunction]",T="[object Function]",R="[object GeneratorFunction]",A="[object Proxy]";var I,N=function(t){if(!O(t))return!1;var e=b(t);return e==T||e==R||e==g||e==A},m=u["__core-js_shared__"],j=(I=/[^.]+$/.exec(m&&m.keys&&m.keys.IE_PROTO||""))?"Symbol(src)_1."+I:"";var D=function(t){return!!j&&j in t},L=Function.prototype.toString;var P=function(t){if(null!=t){try{return L.call(t)}catch(t){}try{return t+""}catch(t){}}return""},S=/^\[object .+?Constructor\]$/,w=Function.prototype,C=Object.prototype,U=w.toString,k=C.hasOwnProperty,B=RegExp("^"+U.call(k).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var M=function(t){return!(!O(t)||D(t))&&(N(t)?B:S).test(P(t))};var x=function(t,e){return null==t?void 0:t[e]};var $=function(t,e){var r=x(t,e);return M(r)?r:void 0},z=function(){try{var t=$(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var G=function(t,e,r){"__proto__"==e&&z?z(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r};var W=function(t){return function(e,r,n){for(var o=-1,a=Object(e),i=n(e),u=i.length;u--;){var c=i[t?u:++o];if(!1===r(a[c],c,a))break}return e}}();var F=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n};var V=function(t){return null!=t&&"object"==typeof t},Y="[object Arguments]";var H=function(t){return V(t)&&b(t)==Y},K=Object.prototype,q=K.hasOwnProperty,J=K.propertyIsEnumerable,Z=H(function(){return arguments}())?H:function(t){return V(t)&&q.call(t,"callee")&&!J.call(t,"callee")},X=Array.isArray;var Q=function(){return!1},tt=o((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r?u.Buffer:void 0,a=(o?o.isBuffer:void 0)||Q;t.exports=a})),et=9007199254740991,rt=/^(?:0|[1-9]\d*)$/;var nt=function(t,e){var r=typeof t;return!!(e=null==e?et:e)&&("number"==r||"symbol"!=r&&rt.test(t))&&t>-1&&t%1==0&&t<e},ot=9007199254740991;var at=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=ot},it={};it["[object Float32Array]"]=it["[object Float64Array]"]=it["[object Int8Array]"]=it["[object Int16Array]"]=it["[object Int32Array]"]=it["[object Uint8Array]"]=it["[object Uint8ClampedArray]"]=it["[object Uint16Array]"]=it["[object Uint32Array]"]=!0,it["[object Arguments]"]=it["[object Array]"]=it["[object ArrayBuffer]"]=it["[object Boolean]"]=it["[object DataView]"]=it["[object Date]"]=it["[object Error]"]=it["[object Function]"]=it["[object Map]"]=it["[object Number]"]=it["[object Object]"]=it["[object RegExp]"]=it["[object Set]"]=it["[object String]"]=it["[object WeakMap]"]=!1;var ut=function(t){return V(t)&&at(t.length)&&!!it[b(t)]};var ct=function(t){return function(e){return t(e)}},lt=o((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r&&a.process,i=function(){try{var t=n&&n.require&&n.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=i})),st=lt&<.isTypedArray,dt=st?ct(st):ut,ft=Object.prototype.hasOwnProperty;var _t=function(t,e){var r=X(t),n=!r&&Z(t),o=!r&&!n&&tt(t),a=!r&&!n&&!o&&dt(t),i=r||n||o||a,u=i?F(t.length,String):[],c=u.length;for(var l in t)!e&&!ft.call(t,l)||i&&("length"==l||o&&("offset"==l||"parent"==l)||a&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||nt(l,c))||u.push(l);return u},pt=Object.prototype;var vt=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||pt)};var ht=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),Et=Object.prototype.hasOwnProperty;var yt=function(t){if(!vt(t))return ht(t);var e=[];for(var r in Object(t))Et.call(t,r)&&"constructor"!=r&&e.push(r);return e};var bt=function(t){return null!=t&&at(t.length)&&!N(t)};var Ot=function(t){return bt(t)?_t(t):yt(t)};var gt=function(t,e){return t&&W(t,e,Ot)};var Tt=function(){this.__data__=[],this.size=0};var Rt=function(t,e){return t===e||t!=t&&e!=e};var At=function(t,e){for(var r=t.length;r--;)if(Rt(t[r][0],e))return r;return-1},It=Array.prototype.splice;var Nt=function(t){var e=this.__data__,r=At(e,t);return!(r<0)&&(r==e.length-1?e.pop():It.call(e,r,1),--this.size,!0)};var mt=function(t){var e=this.__data__,r=At(e,t);return r<0?void 0:e[r][1]};var jt=function(t){return At(this.__data__,t)>-1};var Dt=function(t,e){var r=this.__data__,n=At(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function Lt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Lt.prototype.clear=Tt,Lt.prototype.delete=Nt,Lt.prototype.get=mt,Lt.prototype.has=jt,Lt.prototype.set=Dt;var Pt=Lt;var St=function(){this.__data__=new Pt,this.size=0};var wt=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};var Ct=function(t){return this.__data__.get(t)};var Ut=function(t){return this.__data__.has(t)},kt=$(u,"Map"),Bt=$(Object,"create");var Mt=function(){this.__data__=Bt?Bt(null):{},this.size=0};var xt=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},$t="__lodash_hash_undefined__",zt=Object.prototype.hasOwnProperty;var Gt=function(t){var e=this.__data__;if(Bt){var r=e[t];return r===$t?void 0:r}return zt.call(e,t)?e[t]:void 0},Wt=Object.prototype.hasOwnProperty;var Ft=function(t){var e=this.__data__;return Bt?void 0!==e[t]:Wt.call(e,t)},Vt="__lodash_hash_undefined__";var Yt=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Bt&&void 0===e?Vt:e,this};function Ht(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Ht.prototype.clear=Mt,Ht.prototype.delete=xt,Ht.prototype.get=Gt,Ht.prototype.has=Ft,Ht.prototype.set=Yt;var Kt=Ht;var qt=function(){this.size=0,this.__data__={hash:new Kt,map:new(kt||Pt),string:new Kt}};var Jt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Zt=function(t,e){var r=t.__data__;return Jt(e)?r["string"==typeof e?"string":"hash"]:r.map};var Xt=function(t){var e=Zt(this,t).delete(t);return this.size-=e?1:0,e};var Qt=function(t){return Zt(this,t).get(t)};var te=function(t){return Zt(this,t).has(t)};var ee=function(t,e){var r=Zt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function re(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}re.prototype.clear=qt,re.prototype.delete=Xt,re.prototype.get=Qt,re.prototype.has=te,re.prototype.set=ee;var ne=re,oe=200;var ae=function(t,e){var r=this.__data__;if(r instanceof Pt){var n=r.__data__;if(!kt||n.length<oe-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new ne(n)}return r.set(t,e),this.size=r.size,this};function ie(t){var e=this.__data__=new Pt(t);this.size=e.size}ie.prototype.clear=St,ie.prototype.delete=wt,ie.prototype.get=Ct,ie.prototype.has=Ut,ie.prototype.set=ae;var ue=ie,ce="__lodash_hash_undefined__";var le=function(t){return this.__data__.set(t,ce),this};var se=function(t){return this.__data__.has(t)};function de(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new ne;++e<r;)this.add(t[e])}de.prototype.add=de.prototype.push=le,de.prototype.has=se;var fe=de;var _e=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1};var pe=function(t,e){return t.has(e)},ve=1,he=2;var Ee=function(t,e,r,n,o,a){var i=r&ve,u=t.length,c=e.length;if(u!=c&&!(i&&c>u))return!1;var l=a.get(t);if(l&&a.get(e))return l==e;var s=-1,d=!0,f=r&he?new fe:void 0;for(a.set(t,e),a.set(e,t);++s<u;){var _=t[s],p=e[s];if(n)var v=i?n(p,_,s,e,t,a):n(_,p,s,t,e,a);if(void 0!==v){if(v)continue;d=!1;break}if(f){if(!_e(e,(function(t,e){if(!pe(f,e)&&(_===t||o(_,t,r,n,a)))return f.push(e)}))){d=!1;break}}else if(_!==p&&!o(_,p,r,n,a)){d=!1;break}}return a.delete(t),a.delete(e),d},ye=u.Uint8Array;var be=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r};var Oe=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r},ge=1,Te=2,Re="[object Boolean]",Ae="[object Date]",Ie="[object Error]",Ne="[object Map]",me="[object Number]",je="[object RegExp]",De="[object Set]",Le="[object String]",Pe="[object Symbol]",Se="[object ArrayBuffer]",we="[object DataView]",Ce=c?c.prototype:void 0,Ue=Ce?Ce.valueOf:void 0;var ke=function(t,e,r,n,o,a,i){switch(r){case we:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Se:return!(t.byteLength!=e.byteLength||!a(new ye(t),new ye(e)));case Re:case Ae:case me:return Rt(+t,+e);case Ie:return t.name==e.name&&t.message==e.message;case je:case Le:return t==e+"";case Ne:var u=be;case De:var c=n≥if(u||(u=Oe),t.size!=e.size&&!c)return!1;var l=i.get(t);if(l)return l==e;n|=Te,i.set(t,e);var s=Ee(u(t),u(e),n,o,a,i);return i.delete(t),s;case Pe:if(Ue)return Ue.call(t)==Ue.call(e)}return!1};var Be=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t};var Me=function(t,e,r){var n=e(t);return X(t)?n:Be(n,r(t))};var xe=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,a=[];++r<n;){var i=t[r];e(i,r,t)&&(a[o++]=i)}return a};var $e=function(){return[]},ze=Object.prototype.propertyIsEnumerable,Ge=Object.getOwnPropertySymbols,We=Ge?function(t){return null==t?[]:(t=Object(t),xe(Ge(t),(function(e){return ze.call(t,e)})))}:$e;var Fe=function(t){return Me(t,Ot,We)},Ve=1,Ye=Object.prototype.hasOwnProperty;var He=function(t,e,r,n,o,a){var i=r&Ve,u=Fe(t),c=u.length;if(c!=Fe(e).length&&!i)return!1;for(var l=c;l--;){var s=u[l];if(!(i?s in e:Ye.call(e,s)))return!1}var d=a.get(t);if(d&&a.get(e))return d==e;var f=!0;a.set(t,e),a.set(e,t);for(var _=i;++l<c;){var p=t[s=u[l]],v=e[s];if(n)var h=i?n(v,p,s,e,t,a):n(p,v,s,t,e,a);if(!(void 0===h?p===v||o(p,v,r,n,a):h)){f=!1;break}_||(_="constructor"==s)}if(f&&!_){var E=t.constructor,y=e.constructor;E!=y&&"constructor"in t&&"constructor"in e&&!("function"==typeof E&&E instanceof E&&"function"==typeof y&&y instanceof y)&&(f=!1)}return a.delete(t),a.delete(e),f},Ke=$(u,"DataView"),qe=$(u,"Promise"),Je=$(u,"Set"),Ze=$(u,"WeakMap"),Xe=P(Ke),Qe=P(kt),tr=P(qe),er=P(Je),rr=P(Ze),nr=b;(Ke&&"[object DataView]"!=nr(new Ke(new ArrayBuffer(1)))||kt&&"[object Map]"!=nr(new kt)||qe&&"[object Promise]"!=nr(qe.resolve())||Je&&"[object Set]"!=nr(new Je)||Ze&&"[object WeakMap]"!=nr(new Ze))&&(nr=function(t){var e=b(t),r="[object Object]"==e?t.constructor:void 0,n=r?P(r):"";if(n)switch(n){case Xe:return"[object DataView]";case Qe:return"[object Map]";case tr:return"[object Promise]";case er:return"[object Set]";case rr:return"[object WeakMap]"}return e});var or=nr,ar=1,ir="[object Arguments]",ur="[object Array]",cr="[object Object]",lr=Object.prototype.hasOwnProperty;var sr=function(t,e,r,n,o,a){var i=X(t),u=X(e),c=i?ur:or(t),l=u?ur:or(e),s=(c=c==ir?cr:c)==cr,d=(l=l==ir?cr:l)==cr,f=c==l;if(f&&tt(t)){if(!tt(e))return!1;i=!0,s=!1}if(f&&!s)return a||(a=new ue),i||dt(t)?Ee(t,e,r,n,o,a):ke(t,e,c,r,n,o,a);if(!(r&ar)){var _=s&&lr.call(t,"__wrapped__"),p=d&&lr.call(e,"__wrapped__");if(_||p){var v=_?t.value():t,h=p?e.value():e;return a||(a=new ue),o(v,h,r,n,a)}}return!!f&&(a||(a=new ue),He(t,e,r,n,o,a))};var dr=function t(e,r,n,o,a){return e===r||(null==e||null==r||!V(e)&&!V(r)?e!=e&&r!=r:sr(e,r,n,o,t,a))},fr=1,_r=2;var pr=function(t,e,r,n){var o=r.length,a=o,i=!n;if(null==t)return!a;for(t=Object(t);o--;){var u=r[o];if(i&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<a;){var c=(u=r[o])[0],l=t[c],s=u[1];if(i&&u[2]){if(void 0===l&&!(c in t))return!1}else{var d=new ue;if(n)var f=n(l,s,c,t,e,d);if(!(void 0===f?dr(s,l,fr|_r,n,d):f))return!1}}return!0};var vr=function(t){return t==t&&!O(t)};var hr=function(t){for(var e=Ot(t),r=e.length;r--;){var n=e[r],o=t[n];e[r]=[n,o,vr(o)]}return e};var Er=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}};var yr=function(t){var e=hr(t);return 1==e.length&&e[0][2]?Er(e[0][0],e[0][1]):function(r){return r===t||pr(r,t,e)}},br="[object Symbol]";var Or=function(t){return"symbol"==typeof t||V(t)&&b(t)==br},gr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Tr=/^\w*$/;var Rr=function(t,e){if(X(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!Or(t))||(Tr.test(t)||!gr.test(t)||null!=e&&t in Object(e))},Ar="Expected a function";function Ir(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(Ar);var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=t.apply(this,n);return r.cache=a.set(o,i)||a,i};return r.cache=new(Ir.Cache||ne),r}Ir.Cache=ne;var Nr=Ir,mr=500;var jr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Dr=/\\(\\)?/g,Lr=function(t){var e=Nr(t,(function(t){return r.size===mr&&r.clear(),t})),r=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(jr,(function(t,r,n,o){e.push(n?o.replace(Dr,"$1"):r||t)})),e}));var Pr=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o},Sr=1/0,wr=c?c.prototype:void 0,Cr=wr?wr.toString:void 0;var Ur=function t(e){if("string"==typeof e)return e;if(X(e))return Pr(e,t)+"";if(Or(e))return Cr?Cr.call(e):"";var r=e+"";return"0"==r&&1/e==-Sr?"-0":r};var kr=function(t){return null==t?"":Ur(t)};var Br=function(t,e){return X(t)?t:Rr(t,e)?[t]:Lr(kr(t))},Mr=1/0;var xr=function(t){if("string"==typeof t||Or(t))return t;var e=t+"";return"0"==e&&1/t==-Mr?"-0":e};var $r=function(t,e){for(var r=0,n=(e=Br(e,t)).length;null!=t&&r<n;)t=t[xr(e[r++])];return r&&r==n?t:void 0};var zr=function(t,e,r){var n=null==t?void 0:$r(t,e);return void 0===n?r:n};var Gr=function(t,e){return null!=t&&e in Object(t)};var Wr=function(t,e,r){for(var n=-1,o=(e=Br(e,t)).length,a=!1;++n<o;){var i=xr(e[n]);if(!(a=null!=t&&r(t,i)))break;t=t[i]}return a||++n!=o?a:!!(o=null==t?0:t.length)&&at(o)&&nt(i,o)&&(X(t)||Z(t))};var Fr=function(t,e){return null!=t&&Wr(t,e,Gr)},Vr=1,Yr=2;var Hr=function(t,e){return Rr(t)&&vr(e)?Er(xr(t),e):function(r){var n=zr(r,t);return void 0===n&&n===e?Fr(r,t):dr(e,n,Vr|Yr)}};var Kr=function(t){return t};var qr=function(t){return function(e){return null==e?void 0:e[t]}};var Jr=function(t){return function(e){return $r(e,t)}};var Zr=function(t){return Rr(t)?qr(xr(t)):Jr(t)};var Xr=function(t){return"function"==typeof t?t:null==t?Kr:"object"==typeof t?X(t)?Hr(t[0],t[1]):yr(t):Zr(t)};var Qr=function(t,e){var r={};return e=Xr(e),gt(t,(function(t,n,o){G(r,n,e(t,n,o))})),r},tn={boxFlex:!0,boxFlexGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0};var en=["Webkit","ms","Moz","O"];Object.keys(tn).forEach((function(t){en.forEach((function(e){tn[function(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}(e,t)]=tn[t]}))}));var rn={isUnitlessNumber:tn,shorthandPropertyExpansions:{background:{backgroundImage:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundColor:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0}}};const nn=t=>{const{padding:e,margin:r,...n}=t.css;let o={};return e&&(o={paddingRight:e,paddingLeft:e,paddingBottom:e,paddingTop:e}),r&&(o={...o,marginRight:r,marginLeft:r,marginBottom:r,marginTop:r}),{...t,css:{...o,...n}}},on=t=>{const r=t.css,n={};return Object.entries(r).forEach(([t,r])=>{if(e.isNumber(r))return rn.isUnitlessNumber[t]?void(n[t]=`${r}`):void(n[t]=`${r}px`);n[t]=r}),{...t,css:n}},an=t=>`candu.sdk.${t}`,un=t=>an(`error.${t}`),cn={UNKOWN_NODE_TYPE:"unknown_node_type",UNKOWN_BLOCK_NODE_TYPE:"unkown_block_node_type",UNKOWN_INLINE_NODE_TYPE:"unkown_inline_node_type",UNKOWN_NODE_OBJECT_TYPE:"unkown_node_object_type",TUTORIAL_ERROR:"tutorial_error_boundary",PORTAL_ERROR:"portal_error_boundary",STYLEGUIDE_MAP_ERROR:"styleguide_map",RENDER_NODE_ERROR:"render_node"},ln={HEARTBEAT:an("heartbeat"),PREVIEW_OPEN:an("preview.open"),PORTAL:an("portal"),TUTORIAL:an("tutorial"),TUTORIAL_INTERACTION:an("tutorial.interaction"),PORTAL_ASSET_NOT_FOUND:un("portal_asset_not_found"),PORTAL_NO_SEGMENT_IDS:un("portal_no_segment_ids"),NO_MATCHING_TUTORIALS:un("no_matching_tutorials"),NO_VALID_TUTORIAL_IDENTIFIER:un("no_valid_tutorial_identifier"),COMMIT_API_LOADING_ERROR:un("commit_api"),TUTORIAL_LOADING_ERROR:un("tutorial"),UNKOWN_NODE_TYPE:un(cn.UNKOWN_NODE_TYPE),UNKOWN_INLINE_NODE_TYPE:un(cn.UNKOWN_INLINE_NODE_TYPE),UNKOWN_NODE_OBJECT_TYPE:un(cn.UNKOWN_NODE_OBJECT_TYPE),TUTORIAL_ERROR:un(cn.TUTORIAL_ERROR),PORTAL_ERROR:un(cn.PORTAL_ERROR),STYLEGUIDE_MAP_ERROR:un(cn.TUTORIAL_ERROR),RENDER_NODE_ERROR:un(cn.TUTORIAL_ERROR),CIRCULAR_DEPENDENCY_EMBED_PORTAL:un("circular_dependecy_embed_portal"),CIRCULAR_DEPENDENCY_EMBED_TUTORIAL:un("circular_dependecy_embed_tutorial")},sn=t=>`An error has occured while trying to parse your Tutorial.\nUpgrade the SDK to the latest version to get rid of this error.\nErrorCode: ${t}.`,dn={EVENTING_NOT_INITIALIZED:"You tried to send an event, but you haven't initialized eventing.\nThis is happening because you called eventing outside the scope of the CanduProvider. It can be fixed by:\n1. Adding CanduProvider to the root of the application.\n2. Initializing a new Eventing object outside of Candu.\nRead here for more context: http://udn.ac/tracking-not-init.\n",[ln.PORTAL_ASSET_NOT_FOUND]:"Could not find the requested Portal. This could happen because:\n1. The Portal does not exist or it was deleted.\n2. The Portal has not been made avaliable to be rendered.\n3. CORS Authenticaton failed.\nSee http://udn.ac/portal-not-found for more information.\n",[ln.PORTAL_NO_SEGMENT_IDS]:"You have tried to render a Portal that doesn't contain any content.\nAdd content to your Portal: https://udn.ac/update-portals.\n",[ln.NO_MATCHING_TUTORIALS]:"The Tutorial will not be rendered because there are no matching segments for the given user.",[ln.NO_VALID_TUTORIAL_IDENTIFIER]:"(Candu/Tutorial) You must define one of tutorialId, slug, commitId or contentHashId.",[ln.TUTORIAL_LOADING_ERROR]:"An error has occurred while trying to load the Tutorial",[ln.UNKOWN_INLINE_NODE_TYPE]:sn(cn.UNKOWN_INLINE_NODE_TYPE),[ln.UNKOWN_NODE_TYPE]:sn(cn.UNKOWN_NODE_TYPE),[ln.CIRCULAR_DEPENDENCY_EMBED_PORTAL]:"Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",[ln.CIRCULAR_DEPENDENCY_EMBED_TUTORIAL]:"Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",[ln.PORTAL_ERROR]:"An error has occured within Portal",[ln.TUTORIAL_ERROR]:"An error has occured within Tutorial",[ln.RENDER_NODE_ERROR]:"An error has occured while rendering tutorial node",[ln.STYLEGUIDE_MAP_ERROR]:"An error has occured while mapping node to styleguide"},fn={Alert:!0,B:!0,Badge:!0,Button:!0,Card:!0,Code:!0,Document:!0,Em:!0,EmbedPortal:!0,EmbedTutorial:!0,Flex:!0,FlexItem:!0,H1:!0,H2:!0,H3:!0,H4:!0,H5:!0,H6:!0,Image:!0,InlineCode:!0,Link:!0,List:!0,ListItem:!0,P:!0,RichText:!0,Spacing:!0,Text:!0,U:!0,View:!0,Player:!0},_n={error:console.error,warning:console.warn};for(var pn=function(){return r.randomBytes(16)},vn=[],hn=0;hn<256;++hn)vn[hn]=(hn+256).toString(16).substr(1);var En=function(t,e){var r=e||0,n=vn;return[n[t[r++]],n[t[r++]],n[t[r++]],n[t[r++]],"-",n[t[r++]],n[t[r++]],"-",n[t[r++]],n[t[r++]],"-",n[t[r++]],n[t[r++]],"-",n[t[r++]],n[t[r++]],n[t[r++]],n[t[r++]],n[t[r++]],n[t[r++]]].join("")};var yn,bn,On=function(t,e,r){var n=e&&r||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var o=(t=t||{}).random||(t.rng||pn)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e)for(var a=0;a<16;++a)e[n+a]=o[a];return e||En(o)};!function(t){t.UserGenerated="UserGenerated",t.SDK="SDK"}(yn||(yn={})),function(t){t.Identify="Identify",t.Group="Group",t.Track="Track",t.Page="Page",t.Screen="Screen"}(bn||(bn={}));const gn=()=>"undefined"!=typeof window&&window.localStorage,Tn=t=>e=>{gn()&&null!=e&&window.localStorage.setItem(t,JSON.stringify(e))};const Rn={anonymousId:{getOrCreate:((t,e)=>()=>(t=>()=>{if(gn()){const e=window.localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(t){return null}}})(t)()||e())("candu:anonymous_id",()=>{const t=On();return Tn("candu:anonymous_id")(t),t}),set:Tn("candu:anonymous_id")}}.anonymousId.getOrCreate;var An="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},In="object"==typeof An&&An&&An.Object===Object&&An,Nn="object"==typeof self&&self&&self.Object===Object&&self,mn=(In||Nn||Function("return this")()).Symbol,jn=Object.prototype,Dn=jn.hasOwnProperty,Ln=jn.toString,Pn=mn?mn.toStringTag:void 0;var Sn=function(t){var e=Dn.call(t,Pn),r=t[Pn];try{t[Pn]=void 0;var n=!0}catch(t){}var o=Ln.call(t);return n&&(e?t[Pn]=r:delete t[Pn]),o},wn=Object.prototype.toString;var Cn=function(t){return wn.call(t)},Un="[object Null]",kn="[object Undefined]",Bn=mn?mn.toStringTag:void 0;var Mn=function(t){return null==t?void 0===t?kn:Un:Bn&&Bn in Object(t)?Sn(t):Cn(t)},xn=Array.isArray;var $n=function(t){return null!=t&&"object"==typeof t},zn="[object String]";var Gn=function(t){return"string"==typeof t||!xn(t)&&$n(t)&&Mn(t)==zn},Wn="[object Number]";var Fn=function(t){return"number"==typeof t||$n(t)&&Mn(t)==Wn};const Vn=/^([a-zA-Z0-9]|_|-)+$/,Yn=t=>Fn(t)&&t>=0;var Hn,Kn,qn,Jn,Zn,Xn;!function(t){t.SDK="SDK",t.PREVIEW="PREVIEW"}(Hn||(Hn={})),function(t){t.BOOTSTRAP="Bootstrap",t.CHANGE_POSITION="ChangePosition",t.CLOSE_PREVIEW="ClosePreview",t.PREVIEW_LOADED="PreviewLoaded",t.SET_AVALIABLE_PORTALS="SetAvaliablePortals",t.SET_CONTENT="SetContent",t.SET_SELECTED_ELEMENT="SetSelectedElement",t.SET_VIEW_MODE="SetViewMode",t.ADD_ELEMENT="AddElement",t.REMOVE_ELEMENT="RemoveElement",t.UPDATE_ELEMENT="UpdateElement",t.SET_ELEMENT="SetElement"}(Kn||(Kn={})),function(t){t.ON_CLICK="OnClick"}(qn||(qn={})),function(t){t.NATIVE="Native",t.PENDO="Pendo"}(Jn||(Jn={})),function(t){t.NAVIGATE="Navigate",t.CHANGE_TUTORIAL="ChangeTutorial",t.OPEN_GUIDE="OpenGuide"}(Zn||(Zn={})),function(t){t.PRIMARY="primary",t.SECONDARY="primary",t.WARNING="warning",t.DANGER="danger",t.NEUTRAL="neutral",t.ACTIVE="active",t.INFO="info"}(Xn||(Xn={}));Xn.PRIMARY;var Qn;!function(t){t.U="U",t.B="B",t.Em="Em",t.InlineCode="InlineCode"}(Qn||(Qn={}));const to=t=>(t=>Gn(t)&&t.length>=3&&t.length<100&&Vn.test(t))(t);var eo,ro,no,oo;!function(t){t.COLLAPSED="Collapsed",t.EXPANDED="Expanded",t.MINIMIZED="Minimized"}(eo||(eo={})),function(t){t.TUTORIAL="Tutorial",t.PORTAL="Portal"}(ro||(ro={})),function(t){t.Global="Global",t.Organization="Organization"}(no||(no={})),function(t){t.Root="root",t.Rule="rule",t.Atrule="atrule",t.Decl="decl",t.Any="any"}(oo||(oo={}));var ao=function(t,e,r,n,o,a,i,u){if(!t){var c;if(void 0===e)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[r,n,o,a,i,u],s=0;(c=new Error(e.replace(/%s/g,(function(){return l[s++]})))).name="Invariant Violation"}throw c.framesToPop=1,c}};const io=t=>ao(!t||O(t),"(Candu) styleguide must be undefined or an object");var uo=Object.freeze({__proto__:null,API_BASE_URL:"https://api.candu.ai",CDN_BASE_URL:"https://cdn.candu.ai",VERSION:"0.5.2"});const{API_BASE_URL:co}=uo,{CDN_BASE_URL:lo}=uo,so="/api/segmentMemberships",fo="/api/tutorialDocumentsEditor",_o=async t=>(await fetch(t)).json(),po=t=>_o(`${co}${t}`),vo=t=>_o(`${lo}${t}`),ho={tutorialDocumentLatestPublished:async(t,e)=>po(`${fo}?token=${t}&finder=latestPublished&tutorialId=${e}`),portalAsset:async(t,e)=>vo(`/portals/${t}/${e}/head.json`),segmentMembership:async(t,e)=>po(`${so}/${e}?token=${t}`),tutorialDocument:(t,e,r)=>{const{contentHashId:n,tutorialId:o,tutorialDocument:a,slug:i}=t,u=(t=>({byId:e=>po(`${fo}/${e}?token=${t}`),bySlug:e=>vo(`/tutorials/${t}/${e}.json`),byContentHash:e=>vo(`/tutorials/${t}/${e}.json`)}))(e);return(t=>Yn(t))(o)?u.byId(o):to(i)?u.bySlug(i):(t=>Gn(t)&&!!t.match(/^[0-9a-zA-Z]{40}$/))(n)?u.byContentHash(n):O(a)?Promise.resolve(a):(_n.error(dn[ln.NO_VALID_TUTORIAL_IDENTIFIER]),r.track(ln.NO_VALID_TUTORIAL_IDENTIFIER,{slug:t.slug}),null)}},Eo=(...t)=>console.error(...t),yo=(...t)=>console.warn(...t),bo={error:Eo,warning:yo},Oo=t=>{switch(t.trigger){case qn.ON_CLICK:default:return"onClick"}},go=({data:t},e)=>{if(!t||!t.actions)return{};const r=t=>{e.provider.eventing.track(ln.TUTORIAL_INTERACTION,{...t,...e.trackingIdentifiers||{}})};return t.actions.map(t=>((t,e)=>{switch(t.handler.type){case Zn.NAVIGATE:return{[Oo(t)]:()=>{const{href:r,target:n}=t.handler;e(t),"Blank"===n?window.open(r,"_blank"):r&&r.includes("mailto:")?window.location=r:document.location.href=r}};case Zn.CHANGE_TUTORIAL:return{[Oo(t)]:()=>{const{tutorialId:e}=t.handler;Eo("TODO -> change tutorial",e)}};case Zn.OPEN_GUIDE:return{[Oo(t)]:()=>{const{guideId:e}=t.handler;Eo("TODO -> open guide",e)}};default:return{}}})(t,r)).reduce((t,e)=>({...t,...e}),{})},To=(t,e)=>{try{const{provider:r,document:n,trackingIdentifiers:o}=e,a=n.nodes[t];if(!a)return bo.error("Document is corrupted. Refusing to move further."),null;const i=t=>To(t,e),{type:u,props:c,css:l}=a,s={...c||{},style:l||{},children:(c||{}).children||a.nodes&&a.nodes.map(i),...go(a,{trackingIdentifiers:o,provider:r})},d={nodeId:t,node:a,document:n,render:{node:i,styleguide:(t,r={})=>e.renderNode(t,{api:d,attributes:r}),tutorial:t=>e.renderTutorial(t),portal:t=>e.renderPortal(t)},trackingIdentifiers:o},f=d.render.styleguide(u,s);return f||(bo.error(dn[ln.UNKOWN_NODE_TYPE],{type:u}),r.eventing.track(ln.UNKOWN_NODE_TYPE,{type:u}),null)}catch(t){return bo.error(dn[ln.STYLEGUIDE_MAP_ERROR],t),null}},Ro=Nr((t,e)=>{const{provider:r,portal:n,tutorial:o}=t,a=r.styleguide;let i,u;return o&&(u=o.styleguide),n&&(i=n.styleguide),{...a||{},...i||{},...u||{},...e||{}}});t.DEFAULT_ALERT_COLOR="#EDEDED",t.DEFAULT_ALT="",t.DEFAULT_TAB_ACTIVE_COLOR="#FEFEFE",t.DEFAULT_TAB_COLOR="#FEFEFE",t.DEFAULT_TAB_HEADER_COLOR="#333745",t.DEFAULT_TAB_ITEM_COLOR="#838792",t.ERROR_MESSAGES=dn,t.ERROR_SLUGS=cn,t.EVENT_NAMES=ln,t.LOGGER=_n,t.RESOURCES=ho,t.STYLEGUIDE_COLORS={primary:"#6310E5",secondary:"#59C3C3",tertiary:"#4D515D",warning:"#FCAD0D",danger:"#EE4266"},t.adaptCustomNodes=t=>Qr(t,t=>{let e=t;return"Typography"===e.type&&(e=(t=>{const e=zr(t,"data.custom.variant","P");return{...t,type:e}})(e)),e.css&&O(e.css)&&e.css.flexBasis&&(e=(t=>{const{flexBasis:e}=t.css;return"0"===e||"0px"===e?{...t,css:{...t.css,flexBasis:"0%"}}:t})(e)),e.css&&(e=nn(e),e=on(e)),e}),t.attachStylesheet=t=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("href",`${lo}/styleguides/applications/${t}/default/main.css`),document.head.appendChild(e)},t.convertStyleNumberValues=on,t.defaultStyleguide=fn,t.internalEventing=({identify:t,track:e})=>({provider:({userId:r,traits:n,styleguide:o})=>{t(r,n),e(ln.HEARTBEAT,(t=>{const e={};return Object.keys(t).forEach(r=>{fn[r]&&(e[`styleguide.${r}`]=t[r].displayName||!0)}),e})(o))},tutorialDocumentLoadingError:({tutorialId:t,slug:r,contentHashId:n})=>{_n.error(dn[ln.TUTORIAL_LOADING_ERROR]),e(ln.TUTORIAL_LOADING_ERROR,{tutorialId:t,slug:r,contentHashId:n})}}),t.logError=Eo,t.logWarning=yo,t.logger=bo,t.mapNodeToStyleguide=To,t.mergeStyleguidesFromContext=Ro,t.portalValidation=({slug:t,styleguide:e})=>(io(e),{slug:t,styleguide:e||{}}),t.providerValidation=({clientToken:t,userId:e,traits:r,options:n,styleguide:o,...a})=>(ao((t=>Gn(t)&&!!t.match(/^[0-9a-zA-Z]*$/)&&t.length>=10)(t),"(Candu) you must provide a valid clientToken"),ao(!e||(t=>Yn(t)||Gn(t)&&t.trim().length>0)(e),"(Candu) you must provide a valid userId"),io(o),ao(!r||O(r),"(Candu) traits must be undefined or an object"),ao(!n||O(n),"(Candu) options must be undefined or an object"),{...a,clientToken:t,traits:r||{},options:n||{},styleguide:o||{},userId:e||Rn()}),t.tutorialValidation=({slug:t,styleguide:e,contentHashId:r,tutorialId:n,tutorialDocument:o,...a})=>(io(e),{...a,slug:t,styleguide:e||{},contentHashId:r,tutorialId:n,tutorialDocument:o}),t.unpackShorthandStyles=nn,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.js.map |
@@ -12,3 +12,3 @@ { | ||
}, | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"main": "dist/index.js", | ||
@@ -31,3 +31,3 @@ "module": "dist/index.es.js", | ||
}, | ||
"gitHead": "f5139f40ec517ce32e7280f49053415772089127" | ||
"gitHead": "989ecba50869dcd7463acd1379ca666615d9b2cb" | ||
} |
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
662034
86
1320